@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
@@ -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;
|
@@ -1,59 +1,66 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = {
|
4
|
-
|
5
|
-
name: 'fio8072',
|
6
|
-
path: 'fio8072',
|
7
|
-
type: 'form',
|
8
|
-
display: 'form',
|
9
|
-
components: [
|
4
|
+
"components": [
|
10
5
|
{
|
11
|
-
label:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
6
|
+
"label": "Edit Grid",
|
7
|
+
"tableView": false,
|
8
|
+
"modal": true,
|
9
|
+
"rowDrafts": true,
|
10
|
+
"key": "editGrid",
|
11
|
+
"type": "editgrid",
|
12
|
+
"displayAsTable": false,
|
13
|
+
"input": true,
|
14
|
+
"components": [
|
15
|
+
{
|
16
|
+
"label": "Select",
|
17
|
+
"widget": "choicesjs",
|
18
|
+
"tableView": true,
|
19
|
+
"data": {
|
20
|
+
"values": [
|
21
|
+
{
|
22
|
+
"label": "a",
|
23
|
+
"value": "a"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"label": "b",
|
27
|
+
"value": "b"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"label": "c",
|
31
|
+
"value": "c"
|
32
|
+
}
|
33
|
+
]
|
19
34
|
},
|
20
|
-
{
|
21
|
-
|
22
|
-
value: '2',
|
35
|
+
"validate": {
|
36
|
+
"required": true
|
23
37
|
},
|
24
|
-
|
25
|
-
|
26
|
-
|
38
|
+
"key": "select",
|
39
|
+
"type": "select",
|
40
|
+
"input": true
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"label": "Text Field",
|
44
|
+
"applyMaskOn": "change",
|
45
|
+
"tableView": true,
|
46
|
+
"validate": {
|
47
|
+
"required": true
|
27
48
|
},
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
dataType: 'number',
|
35
|
-
key: 'select',
|
36
|
-
type: 'select',
|
37
|
-
input: true,
|
49
|
+
"validateWhenHidden": false,
|
50
|
+
"key": "textField",
|
51
|
+
"type": "textfield",
|
52
|
+
"input": true
|
53
|
+
}
|
54
|
+
]
|
38
55
|
},
|
39
56
|
{
|
40
|
-
label:
|
41
|
-
|
42
|
-
tableView:
|
43
|
-
key:
|
44
|
-
type:
|
45
|
-
input: true,
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
conditions: [
|
50
|
-
{
|
51
|
-
component: 'select',
|
52
|
-
operator: 'lessThan',
|
53
|
-
value: 5,
|
54
|
-
},
|
55
|
-
],
|
56
|
-
},
|
57
|
-
},
|
58
|
-
],
|
57
|
+
"label": "Submit",
|
58
|
+
"showValidations": false,
|
59
|
+
"tableView": false,
|
60
|
+
"key": "submit",
|
61
|
+
"type": "button",
|
62
|
+
"input": true,
|
63
|
+
"saveOnEnter": false
|
64
|
+
}
|
65
|
+
]
|
59
66
|
};
|
@@ -0,0 +1,44 @@
|
|
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
|
+
let components: ({
|
8
|
+
label: string;
|
9
|
+
widget: string;
|
10
|
+
tableView: boolean;
|
11
|
+
data: {
|
12
|
+
values: {
|
13
|
+
label: string;
|
14
|
+
value: string;
|
15
|
+
}[];
|
16
|
+
};
|
17
|
+
dataType: string;
|
18
|
+
key: string;
|
19
|
+
type: string;
|
20
|
+
input: boolean;
|
21
|
+
applyMaskOn?: undefined;
|
22
|
+
conditional?: undefined;
|
23
|
+
} | {
|
24
|
+
label: string;
|
25
|
+
applyMaskOn: string;
|
26
|
+
tableView: boolean;
|
27
|
+
key: string;
|
28
|
+
type: string;
|
29
|
+
input: boolean;
|
30
|
+
conditional: {
|
31
|
+
show: boolean;
|
32
|
+
conjunction: string;
|
33
|
+
conditions: {
|
34
|
+
component: string;
|
35
|
+
operator: string;
|
36
|
+
value: number;
|
37
|
+
}[];
|
38
|
+
};
|
39
|
+
widget?: undefined;
|
40
|
+
data?: undefined;
|
41
|
+
dataType?: undefined;
|
42
|
+
})[];
|
43
|
+
}
|
44
|
+
export default _default;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
title: 'FIO-8072',
|
5
|
+
name: 'fio8072',
|
6
|
+
path: 'fio8072',
|
7
|
+
type: 'form',
|
8
|
+
display: 'form',
|
9
|
+
components: [
|
10
|
+
{
|
11
|
+
label: 'Select',
|
12
|
+
widget: 'choicesjs',
|
13
|
+
tableView: true,
|
14
|
+
data: {
|
15
|
+
values: [
|
16
|
+
{
|
17
|
+
label: 'A',
|
18
|
+
value: '1',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
label: 'B',
|
22
|
+
value: '2',
|
23
|
+
},
|
24
|
+
{
|
25
|
+
label: 'C',
|
26
|
+
value: '10',
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: 'D',
|
30
|
+
value: '1d',
|
31
|
+
},
|
32
|
+
],
|
33
|
+
},
|
34
|
+
dataType: 'number',
|
35
|
+
key: 'select',
|
36
|
+
type: 'select',
|
37
|
+
input: true,
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: 'Text Field',
|
41
|
+
applyMaskOn: 'change',
|
42
|
+
tableView: true,
|
43
|
+
key: 'textField',
|
44
|
+
type: 'textfield',
|
45
|
+
input: true,
|
46
|
+
conditional: {
|
47
|
+
show: true,
|
48
|
+
conjunction: 'all',
|
49
|
+
conditions: [
|
50
|
+
{
|
51
|
+
component: 'select',
|
52
|
+
operator: 'lessThan',
|
53
|
+
value: 5,
|
54
|
+
},
|
55
|
+
],
|
56
|
+
},
|
57
|
+
},
|
58
|
+
],
|
59
|
+
};
|
@@ -22,6 +22,7 @@ import comp22 from './comp22';
|
|
22
22
|
import comp23 from './comp23';
|
23
23
|
import comp24 from './comp24';
|
24
24
|
import comp25 from './comp25';
|
25
|
+
import comp26 from './comp26';
|
25
26
|
import comp27 from './comp27';
|
26
27
|
export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
|
27
28
|
export { multiSelect, multiSelectOptions } from "./comp3";
|
@@ -166,12 +166,19 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
166
166
|
return changed;
|
167
167
|
}
|
168
168
|
getValueAsString(value, options = {}) {
|
169
|
+
var _a, _b;
|
169
170
|
if (!value) {
|
170
171
|
return '';
|
171
172
|
}
|
172
173
|
if (this.isSelectURL) {
|
173
|
-
if (options.modalPreview
|
174
|
-
|
174
|
+
if (options.modalPreview || this.options.readOnly || this.inDataTable) {
|
175
|
+
const checkedItems = lodash_1.default.keys(lodash_1.default.pickBy(value, (val) => val));
|
176
|
+
if (((_a = this.selectData) === null || _a === void 0 ? void 0 : _a.length) === checkedItems.length) {
|
177
|
+
return this.selectData.map(item => this.itemTemplate(item)).join(', ');
|
178
|
+
}
|
179
|
+
else if ((_b = this.loadedOptions) === null || _b === void 0 ? void 0 : _b.length) {
|
180
|
+
return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
|
181
|
+
}
|
175
182
|
}
|
176
183
|
return (0, lodash_1.default)(value).pickBy((val) => val).keys().join(', ');
|
177
184
|
}
|
@@ -20,10 +20,10 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
20
20
|
setReadOnlyValue(value: any, index: any): void;
|
21
21
|
get isJsonValue(): any;
|
22
22
|
/**
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
24
|
+
* @param {*} value - The value to normalize
|
25
|
+
* @returns {*} - Returns the normalized value
|
26
|
+
*/
|
27
27
|
normalizeValue(value: any): any;
|
28
28
|
normalizeSingleValue(value: any): any;
|
29
29
|
setConvertedValue(value: any, index: any): any;
|
@@ -310,10 +310,10 @@ class TextAreaComponent extends TextField_1.default {
|
|
310
310
|
return this.component.as && this.component.as === 'json';
|
311
311
|
}
|
312
312
|
/**
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
313
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
314
|
+
* @param {*} value - The value to normalize
|
315
|
+
* @returns {*} - Returns the normalized value
|
316
|
+
*/
|
317
317
|
normalizeValue(value) {
|
318
318
|
if (this.component.multiple && Array.isArray(value)) {
|
319
319
|
return value.map((singleValue) => this.normalizeSingleValue(singleValue));
|
@@ -56,12 +56,6 @@ class TimeComponent extends TextField_1.default {
|
|
56
56
|
}
|
57
57
|
return value;
|
58
58
|
}
|
59
|
-
get validationValue() {
|
60
|
-
if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
|
61
|
-
return this.dataValue;
|
62
|
-
}
|
63
|
-
return this.rawData;
|
64
|
-
}
|
65
59
|
get inputInfo() {
|
66
60
|
const info = super.inputInfo;
|
67
61
|
info.attr.type = this.component.inputType;
|
@@ -14,6 +14,15 @@ exports.default = {
|
|
14
14
|
'input': true,
|
15
15
|
'inputMask': '99:99'
|
16
16
|
},
|
17
|
+
{
|
18
|
+
'label': 'Multiple Time',
|
19
|
+
'inputType': 'text',
|
20
|
+
'tableView': true,
|
21
|
+
'key': 'multipleTime',
|
22
|
+
'type': 'time',
|
23
|
+
'input': true,
|
24
|
+
'inputMask': '99:99'
|
25
|
+
},
|
17
26
|
{
|
18
27
|
'label': 'Submit',
|
19
28
|
'showValidations': false,
|
@@ -27,15 +27,7 @@ class IsEqualTo extends ConditionOperator_1.default {
|
|
27
27
|
if (conditionTriggerComponent
|
28
28
|
&& (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
|
29
29
|
&& ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
|
30
|
-
|
31
|
-
return false;
|
32
|
-
}
|
33
|
-
const { template, valueProperty } = conditionTriggerComponent.component;
|
34
|
-
if (valueProperty === 'data') {
|
35
|
-
value = { data: value };
|
36
|
-
comparedValue = { data: comparedValue };
|
37
|
-
}
|
38
|
-
return lodash_1.default.every((0, utils_1.getItemTemplateKeys)(template) || [], k => lodash_1.default.isEqual(lodash_1.default.get(value, k), lodash_1.default.get(comparedValue, k)));
|
30
|
+
return (0, utils_1.compareSelectResourceWithObjectTypeValues)(value, comparedValue, conditionTriggerComponent.component);
|
39
31
|
}
|
40
32
|
}
|
41
33
|
//special check for select boxes
|
@@ -41,4 +41,7 @@ export const applyFormChanges: typeof Utils.applyFormChanges;
|
|
41
41
|
export const findComponent: typeof Utils.findComponent;
|
42
42
|
export const getEmptyValue: typeof Utils.getEmptyValue;
|
43
43
|
export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
|
44
|
+
export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
|
45
|
+
export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
|
46
|
+
export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
|
44
47
|
import { Utils } from '@formio/core';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
|
3
|
+
exports.getItemTemplateKeys = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
|
4
4
|
const core_1 = require("@formio/core");
|
5
|
-
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = core_1.Utils;
|
5
|
+
const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys } = core_1.Utils;
|
6
6
|
exports.flattenComponents = flattenComponents;
|
7
7
|
exports.guid = guid;
|
8
8
|
exports.uniqueName = uniqueName;
|
@@ -39,6 +39,9 @@ exports.applyFormChanges = applyFormChanges;
|
|
39
39
|
exports.findComponent = findComponent;
|
40
40
|
exports.getEmptyValue = getEmptyValue;
|
41
41
|
exports.isComponentDataEmpty = isComponentDataEmpty;
|
42
|
+
exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
|
43
|
+
exports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;
|
44
|
+
exports.getItemTemplateKeys = getItemTemplateKeys;
|
42
45
|
/**
|
43
46
|
* Deprecated version of findComponents. Renamed to searchComponents.
|
44
47
|
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -498,18 +498,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
|
|
498
498
|
* @returns {Array<string>|null} - The saved types for the component
|
499
499
|
*/
|
500
500
|
export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
|
501
|
-
/**
|
502
|
-
* Returns the template keys inside the template code.
|
503
|
-
* @param {string} template - The template to get the keys from.
|
504
|
-
* @returns {Array<string>} - The keys inside the template.
|
505
|
-
*/
|
506
|
-
export function getItemTemplateKeys(template: string): Array<string>;
|
507
|
-
/**
|
508
|
-
* Returns if the component is a select resource with an object for its value.
|
509
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
510
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
511
|
-
*/
|
512
|
-
export function isSelectResourceWithObjectValue(comp?: import('@formio/core').Component): boolean;
|
513
501
|
export * from "./formUtils";
|
514
502
|
/**
|
515
503
|
* Map values through unfold and return first non-nil value.
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
19
|
};
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
21
|
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
22
|
-
exports.
|
22
|
+
exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
|
23
23
|
const lodash_1 = __importDefault(require("lodash"));
|
24
24
|
exports._ = lodash_1.default;
|
25
25
|
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
@@ -1681,35 +1681,3 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
1681
1681
|
});
|
1682
1682
|
};
|
1683
1683
|
exports.interpolateErrors = interpolateErrors;
|
1684
|
-
/**
|
1685
|
-
* Returns the template keys inside the template code.
|
1686
|
-
* @param {string} template - The template to get the keys from.
|
1687
|
-
* @returns {Array<string>} - The keys inside the template.
|
1688
|
-
*/
|
1689
|
-
function getItemTemplateKeys(template) {
|
1690
|
-
const templateKeys = [];
|
1691
|
-
if (!template) {
|
1692
|
-
return templateKeys;
|
1693
|
-
}
|
1694
|
-
const keys = template.match(/({{\s*(.*?)\s*}})/g);
|
1695
|
-
if (keys) {
|
1696
|
-
keys.forEach((key) => {
|
1697
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
1698
|
-
if (propKey && propKey.length > 1) {
|
1699
|
-
templateKeys.push(propKey[1]);
|
1700
|
-
}
|
1701
|
-
});
|
1702
|
-
}
|
1703
|
-
return templateKeys;
|
1704
|
-
}
|
1705
|
-
exports.getItemTemplateKeys = getItemTemplateKeys;
|
1706
|
-
/**
|
1707
|
-
* Returns if the component is a select resource with an object for its value.
|
1708
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
1709
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
1710
|
-
*/
|
1711
|
-
function isSelectResourceWithObjectValue(comp = {}) {
|
1712
|
-
const { reference, dataSrc, valueProperty } = comp;
|
1713
|
-
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|
1714
|
-
}
|
1715
|
-
exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
|
package/lib/mjs/Webform.js
CHANGED
@@ -1232,7 +1232,12 @@ export default class Webform extends NestedDataComponent {
|
|
1232
1232
|
onChange(flags, changed, modified, changes) {
|
1233
1233
|
flags = flags || {};
|
1234
1234
|
let isChangeEventEmitted = false;
|
1235
|
-
|
1235
|
+
if (this.parent?.subForm === this) {
|
1236
|
+
super.onChange({ ...flags, modified }, false);
|
1237
|
+
}
|
1238
|
+
else {
|
1239
|
+
super.onChange(flags, true);
|
1240
|
+
}
|
1236
1241
|
const value = _.clone(this.submission);
|
1237
1242
|
flags.changed = value.changed = changed;
|
1238
1243
|
flags.changes = changes;
|
package/lib/mjs/Wizard.js
CHANGED
@@ -903,7 +903,7 @@ export default class Wizard extends Webform {
|
|
903
903
|
const components = !currentPageOnly || this.isLastPage()
|
904
904
|
? this.getComponents()
|
905
905
|
: this.currentPage.components;
|
906
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
906
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
907
907
|
}
|
908
908
|
get errors() {
|
909
909
|
if (!this.isLastPage()) {
|
@@ -1067,7 +1067,7 @@ declare class Component extends Element {
|
|
1067
1067
|
elementInfo(): any;
|
1068
1068
|
autofocus(): void;
|
1069
1069
|
scrollIntoView(element: any, verticalOnly: any): void;
|
1070
|
-
focus(index
|
1070
|
+
focus(index: any): void;
|
1071
1071
|
/**
|
1072
1072
|
* Get `Formio` instance for working with files
|
1073
1073
|
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
@@ -1702,12 +1702,12 @@ export default class Component extends Element {
|
|
1702
1702
|
restoreCaretPosition() {
|
1703
1703
|
if (this.root?.currentSelection) {
|
1704
1704
|
if (this.refs.input?.length) {
|
1705
|
-
const {
|
1705
|
+
const { index } = this.root.currentSelection;
|
1706
1706
|
let input = this.refs.input[index];
|
1707
1707
|
const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test(i?.type || '');
|
1708
1708
|
if (input) {
|
1709
1709
|
if (isInputRangeSelectable(input)) {
|
1710
|
-
input.setSelectionRange(
|
1710
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
1711
1711
|
}
|
1712
1712
|
}
|
1713
1713
|
else {
|
@@ -2901,14 +2901,12 @@ export default class Component extends Element {
|
|
2901
2901
|
if (flags.silentCheck) {
|
2902
2902
|
return [];
|
2903
2903
|
}
|
2904
|
+
let isDirty = this.dirty || flags.dirty;
|
2904
2905
|
if (this.options.alwaysDirty) {
|
2905
|
-
|
2906
|
+
isDirty = true;
|
2906
2907
|
}
|
2907
|
-
|
2908
|
-
|
2909
|
-
}
|
2910
|
-
this.setDirty(flags.dirty);
|
2911
|
-
return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
|
2908
|
+
this.setDirty(isDirty);
|
2909
|
+
return this.setComponentValidity(errors, isDirty, flags.silentCheck, flags.fromSubmission);
|
2912
2910
|
}
|
2913
2911
|
/**
|
2914
2912
|
* Perform a component validation.
|
@@ -3401,7 +3399,7 @@ export default class Component extends Element {
|
|
3401
3399
|
const { left, top } = element.getBoundingClientRect();
|
3402
3400
|
window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
|
3403
3401
|
}
|
3404
|
-
focus(index
|
3402
|
+
focus(index) {
|
3405
3403
|
if ('beforeFocus' in this.parent) {
|
3406
3404
|
this.parent.beforeFocus(this);
|
3407
3405
|
}
|
@@ -45,6 +45,6 @@ export default [
|
|
45
45
|
},
|
46
46
|
EditFormUtils.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
|
47
47
|
'<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
|
48
|
-
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="
|
48
|
+
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
|
49
49
|
];
|
50
50
|
/* eslint-enable quotes, max-len */
|
@@ -135,7 +135,7 @@ export default [
|
|
135
135
|
input: true
|
136
136
|
},
|
137
137
|
EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<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>'),
|
138
|
-
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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="
|
138
|
+
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
|
139
139
|
{
|
140
140
|
type: 'checkbox',
|
141
141
|
input: true,
|
@@ -50,7 +50,7 @@ const EditFormUtils = {
|
|
50
50
|
'<tr><th>value</th><td>The current value of the component.</td></tr>' +
|
51
51
|
'<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +
|
52
52
|
'<tr><th>_</th><td>An instance of <a href="https://lodash.com/docs/" target="_blank" rel="noopener noreferrer">Lodash</a>.</td></tr>' +
|
53
|
-
'<tr><th>utils</th><td>An instance of the <a href="
|
53
|
+
'<tr><th>utils</th><td>An instance of the <a href="https://help.form.io/developers/javascript-development/javascript-utilities" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
|
54
54
|
'<tr><th>util</th><td>An alias for "utils".</td></tr>' +
|
55
55
|
'</table><br/>'
|
56
56
|
/* eslint-enable prefer-template */
|