@formio/js 5.0.0-rc.91 → 5.0.0-rc.93
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +31 -31
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +32 -32
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +4 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +12 -12
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Webform.js +7 -1
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/cjs/components/_classes/component/Component.js +7 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +15 -0
- package/lib/cjs/components/day/fixtures/comp5.d.ts +18 -2
- package/lib/cjs/components/day/fixtures/comp5.js +6 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +14 -7
- package/lib/cjs/components/editgrid/fixtures/comp19.d.ts +59 -0
- package/lib/cjs/components/editgrid/fixtures/comp19.js +73 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/number/fixtures/comp11.d.ts +17 -0
- package/lib/cjs/components/number/fixtures/comp11.js +20 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/number/fixtures/index.js +3 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -0
- package/lib/cjs/components/radio/Radio.js +13 -4
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/fixtures/comp25.d.ts +43 -28
- package/lib/cjs/components/select/fixtures/comp25.js +56 -49
- package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp26.js +59 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +1 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -2
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/cjs/components/textarea/TextArea.js +4 -4
- package/lib/cjs/components/time/Time.js +0 -6
- package/lib/cjs/components/time/fixtures/timeForm2.js +9 -0
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -9
- package/lib/cjs/utils/formUtils.d.ts +3 -0
- package/lib/cjs/utils/formUtils.js +5 -2
- package/lib/cjs/utils/utils.d.ts +0 -12
- package/lib/cjs/utils/utils.js +1 -33
- package/lib/mjs/Webform.js +6 -1
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/mjs/components/_classes/component/Component.js +7 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +15 -0
- package/lib/mjs/components/day/fixtures/comp5.d.ts +18 -2
- package/lib/mjs/components/day/fixtures/comp5.js +6 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +14 -7
- package/lib/mjs/components/editgrid/fixtures/comp19.d.ts +59 -0
- package/lib/mjs/components/editgrid/fixtures/comp19.js +71 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/number/fixtures/comp11.d.ts +17 -0
- package/lib/mjs/components/number/fixtures/comp11.js +18 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/number/fixtures/index.js +2 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -0
- package/lib/mjs/components/radio/Radio.js +13 -4
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/fixtures/comp25.d.ts +43 -28
- package/lib/mjs/components/select/fixtures/comp25.js +56 -49
- package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp26.js +57 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +1 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -2
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/mjs/components/textarea/TextArea.js +4 -4
- package/lib/mjs/components/time/Time.js +0 -6
- package/lib/mjs/components/time/fixtures/timeForm2.js +9 -0
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -10
- package/lib/mjs/utils/formUtils.d.ts +3 -0
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/utils.d.ts +0 -12
- package/lib/mjs/utils/utils.js +0 -30
- package/package.json +3 -3
@@ -11,6 +11,7 @@ export default class DayComponent extends Field {
|
|
11
11
|
operators: string[];
|
12
12
|
};
|
13
13
|
static savedValueTypes(schema: any): string[];
|
14
|
+
static oldEmptyValue: string;
|
14
15
|
static get serverConditionSettings(): {
|
15
16
|
operators: string[];
|
16
17
|
};
|
@@ -135,7 +136,6 @@ export default class DayComponent extends Field {
|
|
135
136
|
* @returns {string|null} - The string value of the date.
|
136
137
|
*/
|
137
138
|
getValueAsString(value: any): string | null;
|
138
|
-
focus(field: any): void;
|
139
139
|
isPartialDay(value: any): boolean;
|
140
140
|
getValidationFormat(): string;
|
141
141
|
}
|
@@ -49,6 +49,8 @@ export default class DayComponent extends Field {
|
|
49
49
|
schema = schema || {};
|
50
50
|
return getComponentSavedTypes(schema) || [componentValueTypes.string];
|
51
51
|
}
|
52
|
+
// Empty value used before 9.3.x
|
53
|
+
static oldEmptyValue = '00/00/0000';
|
52
54
|
constructor(component, options, data) {
|
53
55
|
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
54
56
|
component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
|
@@ -102,6 +104,12 @@ export default class DayComponent extends Field {
|
|
102
104
|
info.changeEvent = 'input';
|
103
105
|
return info;
|
104
106
|
}
|
107
|
+
isEmpty(value = this.dataValue) {
|
108
|
+
if (value === DayComponent.oldEmptyValue) {
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
return super.isEmpty(value);
|
112
|
+
}
|
105
113
|
inputDefinition(name) {
|
106
114
|
let min, max;
|
107
115
|
if (name === 'day') {
|
@@ -335,6 +343,10 @@ export default class DayComponent extends Field {
|
|
335
343
|
}
|
336
344
|
}
|
337
345
|
normalizeValue(value) {
|
346
|
+
// Adjust the value from old to new format
|
347
|
+
if (value === DayComponent.oldEmptyValue) {
|
348
|
+
value = '';
|
349
|
+
}
|
338
350
|
if (!value || this.valueMask.test(value)) {
|
339
351
|
return value;
|
340
352
|
}
|
@@ -582,6 +594,9 @@ export default class DayComponent extends Field {
|
|
582
594
|
* @returns {string|null} - The string value of the date.
|
583
595
|
*/
|
584
596
|
getValueAsString(value) {
|
597
|
+
if (!value) {
|
598
|
+
return '';
|
599
|
+
}
|
585
600
|
return this.getDate(value) || '';
|
586
601
|
}
|
587
602
|
focus(field) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
declare namespace _default {
|
2
2
|
let type: string;
|
3
3
|
let display: string;
|
4
|
-
let components: {
|
4
|
+
let components: ({
|
5
5
|
label: string;
|
6
6
|
hideInputLabels: boolean;
|
7
7
|
inputsLabelPosition: string;
|
@@ -24,6 +24,22 @@ declare namespace _default {
|
|
24
24
|
type: string;
|
25
25
|
input: boolean;
|
26
26
|
defaultValue: string;
|
27
|
-
|
27
|
+
action?: undefined;
|
28
|
+
theme?: undefined;
|
29
|
+
} | {
|
30
|
+
type: string;
|
31
|
+
action: string;
|
32
|
+
label: string;
|
33
|
+
theme: string;
|
34
|
+
hideInputLabels?: undefined;
|
35
|
+
inputsLabelPosition?: undefined;
|
36
|
+
useLocaleSettings?: undefined;
|
37
|
+
tableView?: undefined;
|
38
|
+
fields?: undefined;
|
39
|
+
validateOn?: undefined;
|
40
|
+
key?: undefined;
|
41
|
+
input?: undefined;
|
42
|
+
defaultValue?: undefined;
|
43
|
+
})[];
|
28
44
|
}
|
29
45
|
export default _default;
|
@@ -89,8 +89,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
89
89
|
hasOpenRows(): any;
|
90
90
|
getAttachedData(data?: null): any;
|
91
91
|
shouldValidateDraft(editRow: any): any;
|
92
|
-
shouldValidateRow(editRow: any, dirty: any): any;
|
93
|
-
validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
|
92
|
+
shouldValidateRow(editRow: any, dirty: any, fromSubmission: any): any;
|
93
|
+
validateRow(editRow: any, dirty: any, forceSilentCheck: any, fromSubmission: any): any;
|
94
94
|
showRowErrorAlerts(editRow: any, errors: any): void;
|
95
95
|
/**
|
96
96
|
* @returns {boolean} - Return that this component processes its own validation.
|
@@ -8,6 +8,7 @@ import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } fr
|
|
8
8
|
const EditRowState = {
|
9
9
|
New: 'new',
|
10
10
|
Editing: 'editing',
|
11
|
+
Saving: 'saving',
|
11
12
|
Saved: 'saved',
|
12
13
|
Viewing: 'viewing',
|
13
14
|
Removed: 'removed',
|
@@ -788,6 +789,10 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
788
789
|
if (!this.component.rowDrafts) {
|
789
790
|
editRow.components.forEach((comp) => comp.setPristine(false));
|
790
791
|
}
|
792
|
+
// Mark the row with a 'Saving' state to trigger validation for future row changes
|
793
|
+
if (editRow.state === EditRowState.New) {
|
794
|
+
editRow.state = EditRowState.Saving;
|
795
|
+
}
|
791
796
|
const errors = this.validateRow(editRow, true);
|
792
797
|
if (!this.component.rowDrafts) {
|
793
798
|
if (errors.length) {
|
@@ -800,7 +805,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
800
805
|
this.root.focusedComponent = null;
|
801
806
|
}
|
802
807
|
switch (editRow.state) {
|
803
|
-
case EditRowState.
|
808
|
+
case EditRowState.Saving: {
|
804
809
|
const newIndex = dataValue.length;
|
805
810
|
dataValue.push(editRow.data);
|
806
811
|
editRow.components.forEach(component => component.rowIndex = newIndex);
|
@@ -958,16 +963,17 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
958
963
|
!this.hasOpenRows()) ||
|
959
964
|
this.root?.submitted;
|
960
965
|
}
|
961
|
-
shouldValidateRow(editRow, dirty) {
|
966
|
+
shouldValidateRow(editRow, dirty, fromSubmission) {
|
962
967
|
return this.shouldValidateDraft(editRow) ||
|
963
|
-
editRow.state === EditRowState.
|
968
|
+
editRow.state === EditRowState.Saving ||
|
964
969
|
editRow.state === EditRowState.Editing ||
|
965
970
|
editRow.alerts ||
|
971
|
+
fromSubmission ||
|
966
972
|
dirty;
|
967
973
|
}
|
968
|
-
validateRow(editRow, dirty, forceSilentCheck) {
|
974
|
+
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
969
975
|
editRow.errors = [];
|
970
|
-
if (this.shouldValidateRow(editRow, dirty)) {
|
976
|
+
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
971
977
|
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
972
978
|
const rootValue = fastCloneDeep(this.rootValue);
|
973
979
|
const editGridValue = _.get(rootValue, this.path, []);
|
@@ -1038,7 +1044,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1038
1044
|
return true;
|
1039
1045
|
}
|
1040
1046
|
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
1041
|
-
const { silentCheck } = options;
|
1047
|
+
const { silentCheck, fromSubmission } = options;
|
1042
1048
|
const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
|
1043
1049
|
// If super tells us that component invalid and there is no need to update alerts, just return false
|
1044
1050
|
if (!superValid && (!this.alert && !this.hasOpenRows())) {
|
@@ -1048,7 +1054,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1048
1054
|
const allRowErrors = [];
|
1049
1055
|
this.editRows.forEach((editRow, index) => {
|
1050
1056
|
// Trigger all errors on the row.
|
1051
|
-
const rowErrors = this.validateRow(editRow, dirty, silentCheck);
|
1057
|
+
const rowErrors = this.validateRow(editRow, dirty, silentCheck, fromSubmission);
|
1052
1058
|
errors.push(...rowErrors);
|
1053
1059
|
allRowErrors.push(...rowErrors);
|
1054
1060
|
if (this.rowRefs) {
|
@@ -1062,6 +1068,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1062
1068
|
}
|
1063
1069
|
else if (errorContainer) {
|
1064
1070
|
errorContainer.textContent = '';
|
1071
|
+
this.removeClass(errorContainer, 'help-block');
|
1065
1072
|
}
|
1066
1073
|
}
|
1067
1074
|
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let _id: string;
|
3
|
+
let title: string;
|
4
|
+
let name: string;
|
5
|
+
let path: string;
|
6
|
+
let type: string;
|
7
|
+
let display: string;
|
8
|
+
let components: ({
|
9
|
+
label: string;
|
10
|
+
tableView: boolean;
|
11
|
+
validateWhenHidden: boolean;
|
12
|
+
rowDrafts: boolean;
|
13
|
+
key: string;
|
14
|
+
type: string;
|
15
|
+
displayAsTable: boolean;
|
16
|
+
input: boolean;
|
17
|
+
components: {
|
18
|
+
label: string;
|
19
|
+
columns: {
|
20
|
+
components: {
|
21
|
+
label: string;
|
22
|
+
applyMaskOn: string;
|
23
|
+
tableView: boolean;
|
24
|
+
validate: {
|
25
|
+
required: boolean;
|
26
|
+
};
|
27
|
+
validateWhenHidden: boolean;
|
28
|
+
key: string;
|
29
|
+
type: string;
|
30
|
+
input: boolean;
|
31
|
+
}[];
|
32
|
+
width: number;
|
33
|
+
offset: number;
|
34
|
+
push: number;
|
35
|
+
pull: number;
|
36
|
+
size: string;
|
37
|
+
currentWidth: number;
|
38
|
+
}[];
|
39
|
+
key: string;
|
40
|
+
type: string;
|
41
|
+
input: boolean;
|
42
|
+
tableView: boolean;
|
43
|
+
}[];
|
44
|
+
disableOnInvalid?: undefined;
|
45
|
+
} | {
|
46
|
+
type: string;
|
47
|
+
label: string;
|
48
|
+
key: string;
|
49
|
+
disableOnInvalid: boolean;
|
50
|
+
input: boolean;
|
51
|
+
tableView: boolean;
|
52
|
+
validateWhenHidden?: undefined;
|
53
|
+
rowDrafts?: undefined;
|
54
|
+
displayAsTable?: undefined;
|
55
|
+
components?: undefined;
|
56
|
+
})[];
|
57
|
+
let project: string;
|
58
|
+
}
|
59
|
+
export default _default;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
export default {
|
2
|
+
_id: '6704f3d329cf52a3ddd4e244',
|
3
|
+
title: 'uiu',
|
4
|
+
name: 'uiu',
|
5
|
+
path: 'uiu',
|
6
|
+
type: 'resource',
|
7
|
+
display: 'form',
|
8
|
+
components: [
|
9
|
+
{
|
10
|
+
label: 'Edit Grid',
|
11
|
+
tableView: false,
|
12
|
+
validateWhenHidden: false,
|
13
|
+
rowDrafts: false,
|
14
|
+
key: 'editGrid',
|
15
|
+
type: 'editgrid',
|
16
|
+
displayAsTable: false,
|
17
|
+
input: true,
|
18
|
+
components: [
|
19
|
+
{
|
20
|
+
label: 'Columns',
|
21
|
+
columns: [
|
22
|
+
{
|
23
|
+
components: [
|
24
|
+
{
|
25
|
+
label: 'Text Field',
|
26
|
+
applyMaskOn: 'change',
|
27
|
+
tableView: true,
|
28
|
+
validate: {
|
29
|
+
required: true,
|
30
|
+
},
|
31
|
+
validateWhenHidden: false,
|
32
|
+
key: 'textField',
|
33
|
+
type: 'textfield',
|
34
|
+
input: true,
|
35
|
+
},
|
36
|
+
],
|
37
|
+
width: 6,
|
38
|
+
offset: 0,
|
39
|
+
push: 0,
|
40
|
+
pull: 0,
|
41
|
+
size: 'md',
|
42
|
+
currentWidth: 6,
|
43
|
+
},
|
44
|
+
{
|
45
|
+
components: [],
|
46
|
+
width: 6,
|
47
|
+
offset: 0,
|
48
|
+
push: 0,
|
49
|
+
pull: 0,
|
50
|
+
size: 'md',
|
51
|
+
currentWidth: 6,
|
52
|
+
},
|
53
|
+
],
|
54
|
+
key: 'columns',
|
55
|
+
type: 'columns',
|
56
|
+
input: false,
|
57
|
+
tableView: false,
|
58
|
+
},
|
59
|
+
],
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: 'button',
|
63
|
+
label: 'Submit',
|
64
|
+
key: 'submit',
|
65
|
+
disableOnInvalid: true,
|
66
|
+
input: true,
|
67
|
+
tableView: false,
|
68
|
+
},
|
69
|
+
],
|
70
|
+
project: '66f66c655879bf08113cf465',
|
71
|
+
};
|
@@ -15,7 +15,8 @@ import comp14 from './comp14';
|
|
15
15
|
import comp15 from './comp15';
|
16
16
|
import comp16 from './comp16';
|
17
17
|
import comp18 from './comp18';
|
18
|
+
import comp19 from './comp19';
|
18
19
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
19
20
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
20
21
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
21
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
22
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
@@ -16,8 +16,9 @@ import comp15 from './comp15';
|
|
16
16
|
import comp16 from './comp16';
|
17
17
|
import comp17 from './comp17';
|
18
18
|
import comp18 from './comp18';
|
19
|
+
import comp19 from './comp19';
|
19
20
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
20
21
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
21
22
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
22
23
|
import compTestEvents from './comp-test-events';
|
23
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
24
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
@@ -2,7 +2,7 @@ import EditFormUtils from '../../_classes/component/editForm/utils';
|
|
2
2
|
/* eslint-disable max-len */
|
3
3
|
export default [
|
4
4
|
EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 120, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
|
5
|
-
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="
|
5
|
+
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'),
|
6
6
|
{
|
7
7
|
weight: 140,
|
8
8
|
type: 'checkbox',
|
@@ -0,0 +1,17 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
mask: boolean;
|
5
|
+
tableView: boolean;
|
6
|
+
modalEdit: boolean;
|
7
|
+
multiple: boolean;
|
8
|
+
delimiter: string;
|
9
|
+
requireDecimal: boolean;
|
10
|
+
inputFormat: string;
|
11
|
+
truncateMultipleSpaces: boolean;
|
12
|
+
key: string;
|
13
|
+
type: string;
|
14
|
+
input: boolean;
|
15
|
+
}[];
|
16
|
+
}
|
17
|
+
export default _default;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export default {
|
2
|
+
components: [
|
3
|
+
{
|
4
|
+
label: 'Number',
|
5
|
+
mask: true,
|
6
|
+
tableView: false,
|
7
|
+
modalEdit: true,
|
8
|
+
multiple: true,
|
9
|
+
delimiter: ',',
|
10
|
+
requireDecimal: false,
|
11
|
+
inputFormat: 'plain',
|
12
|
+
truncateMultipleSpaces: false,
|
13
|
+
key: 'number',
|
14
|
+
type: 'number',
|
15
|
+
input: true
|
16
|
+
}
|
17
|
+
]
|
18
|
+
};
|
@@ -8,4 +8,5 @@ import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
|
-
|
11
|
+
import comp11 from './comp11';
|
12
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
|
@@ -8,4 +8,5 @@ import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
|
-
|
11
|
+
import comp11 from './comp11';
|
12
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
|
@@ -21,6 +21,7 @@ export default class RadioComponent extends ListComponent {
|
|
21
21
|
get isRadio(): boolean;
|
22
22
|
get optionSelectedClass(): string;
|
23
23
|
get listData(): any;
|
24
|
+
get selectMetadata(): any;
|
24
25
|
templateData: {} | undefined;
|
25
26
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
26
27
|
itemsLoadedResolve: ((value: any) => void) | undefined;
|
@@ -109,6 +109,12 @@ export default class RadioComponent extends ListComponent {
|
|
109
109
|
const listData = _.get(this.root, 'submission.metadata.listData', {});
|
110
110
|
return _.get(listData, this.path);
|
111
111
|
}
|
112
|
+
get selectMetadata() {
|
113
|
+
return super.selectData;
|
114
|
+
}
|
115
|
+
get selectData() {
|
116
|
+
return this.selectMetadata || this.component.selectData;
|
117
|
+
}
|
112
118
|
init() {
|
113
119
|
super.init();
|
114
120
|
this.templateData = {};
|
@@ -244,12 +250,15 @@ export default class RadioComponent extends ListComponent {
|
|
244
250
|
else if (!_.isString(value)) {
|
245
251
|
value = _.toString(value);
|
246
252
|
}
|
247
|
-
const
|
248
|
-
|
253
|
+
const shouldUseSelectData = (options.modalPreview || this.inDataTable)
|
254
|
+
&& this.component.dataSrc === 'url' && (this.loadedOptions.length || this.selectData);
|
255
|
+
if (this.component.dataSrc !== 'values' && !shouldUseSelectData) {
|
249
256
|
return value;
|
250
257
|
}
|
251
|
-
const values =
|
252
|
-
const option =
|
258
|
+
const values = shouldUseSelectData ? this.loadedOptions : this.component.values;
|
259
|
+
const option = !values?.length && shouldUseSelectData ? {
|
260
|
+
label: this.itemTemplate(this.selectData),
|
261
|
+
} : _.find(values, (v) => v.value === value);
|
253
262
|
if (!value) {
|
254
263
|
return _.get(option, 'label', '');
|
255
264
|
}
|
@@ -1589,8 +1589,8 @@ export default class SelectComponent extends ListComponent {
|
|
1589
1589
|
super.detach();
|
1590
1590
|
}
|
1591
1591
|
focus() {
|
1592
|
+
super.focus.call(this);
|
1592
1593
|
if (this.focusableElement) {
|
1593
|
-
super.focus.call(this);
|
1594
1594
|
this.focusableElement.focus();
|
1595
1595
|
}
|
1596
1596
|
}
|
@@ -1,44 +1,59 @@
|
|
1
1
|
declare namespace _default {
|
2
|
-
let title: string;
|
3
|
-
let name: string;
|
4
|
-
let path: string;
|
5
|
-
let type: string;
|
6
|
-
let display: string;
|
7
2
|
let components: ({
|
8
3
|
label: string;
|
9
|
-
widget: string;
|
10
4
|
tableView: boolean;
|
11
|
-
|
12
|
-
|
13
|
-
label: string;
|
14
|
-
value: string;
|
15
|
-
}[];
|
16
|
-
};
|
17
|
-
dataType: string;
|
5
|
+
modal: boolean;
|
6
|
+
rowDrafts: boolean;
|
18
7
|
key: string;
|
19
8
|
type: string;
|
9
|
+
displayAsTable: boolean;
|
20
10
|
input: boolean;
|
21
|
-
|
22
|
-
|
11
|
+
components: ({
|
12
|
+
label: string;
|
13
|
+
widget: string;
|
14
|
+
tableView: boolean;
|
15
|
+
data: {
|
16
|
+
values: {
|
17
|
+
label: string;
|
18
|
+
value: string;
|
19
|
+
}[];
|
20
|
+
};
|
21
|
+
validate: {
|
22
|
+
required: boolean;
|
23
|
+
};
|
24
|
+
key: string;
|
25
|
+
type: string;
|
26
|
+
input: boolean;
|
27
|
+
applyMaskOn?: undefined;
|
28
|
+
validateWhenHidden?: undefined;
|
29
|
+
} | {
|
30
|
+
label: string;
|
31
|
+
applyMaskOn: string;
|
32
|
+
tableView: boolean;
|
33
|
+
validate: {
|
34
|
+
required: boolean;
|
35
|
+
};
|
36
|
+
validateWhenHidden: boolean;
|
37
|
+
key: string;
|
38
|
+
type: string;
|
39
|
+
input: boolean;
|
40
|
+
widget?: undefined;
|
41
|
+
data?: undefined;
|
42
|
+
})[];
|
43
|
+
showValidations?: undefined;
|
44
|
+
saveOnEnter?: undefined;
|
23
45
|
} | {
|
24
46
|
label: string;
|
25
|
-
|
47
|
+
showValidations: boolean;
|
26
48
|
tableView: boolean;
|
27
49
|
key: string;
|
28
50
|
type: string;
|
29
51
|
input: boolean;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
operator: string;
|
36
|
-
value: number;
|
37
|
-
}[];
|
38
|
-
};
|
39
|
-
widget?: undefined;
|
40
|
-
data?: undefined;
|
41
|
-
dataType?: undefined;
|
52
|
+
saveOnEnter: boolean;
|
53
|
+
modal?: undefined;
|
54
|
+
rowDrafts?: undefined;
|
55
|
+
displayAsTable?: undefined;
|
56
|
+
components?: undefined;
|
42
57
|
})[];
|
43
58
|
}
|
44
59
|
export default _default;
|