@formio/js 5.0.0-dev.5898.ffba52a → 5.0.0-dev.5902.1eb1690
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +307 -10
- package/dist/formio.form.js +603 -591
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.js +605 -593
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +3131 -209
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +14 -0
- package/dist/formio.utils.js +58 -46
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Webform.d.ts +1 -1
- package/lib/cjs/Webform.js +27 -28
- package/lib/cjs/WebformBuilder.js +26 -35
- package/lib/cjs/Wizard.d.ts +0 -1
- package/lib/cjs/Wizard.js +19 -33
- package/lib/cjs/components/Components.d.ts +0 -7
- package/lib/cjs/components/Components.js +1 -33
- package/lib/cjs/components/_classes/component/Component.d.ts +39 -7
- package/lib/cjs/components/_classes/component/Component.js +106 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.d.ts +1 -0
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +4 -19
- package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -60
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +9 -46
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -45
- package/lib/cjs/components/datamap/DataMap.js +2 -3
- package/lib/cjs/components/editgrid/EditGrid.js +13 -13
- package/lib/cjs/components/form/Form.d.ts +1 -3
- package/lib/cjs/components/form/Form.js +20 -28
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/html/HTML.js +15 -3
- package/lib/cjs/components/radio/Radio.js +2 -3
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/cjs/components/signature/Signature.js +3 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.d.ts +2 -2
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.d.ts +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/cjs/utils/formUtils.d.ts +25 -14
- package/lib/cjs/utils/formUtils.js +11 -16
- package/lib/cjs/utils/i18n.js +5 -0
- package/lib/cjs/utils/utils.d.ts +1 -2
- package/lib/cjs/utils/utils.js +15 -31
- package/lib/mjs/Webform.d.ts +1 -1
- package/lib/mjs/Webform.js +24 -27
- package/lib/mjs/WebformBuilder.js +26 -35
- package/lib/mjs/Wizard.d.ts +0 -1
- package/lib/mjs/Wizard.js +16 -29
- package/lib/mjs/components/Components.d.ts +0 -7
- package/lib/mjs/components/Components.js +1 -32
- package/lib/mjs/components/_classes/component/Component.d.ts +39 -7
- package/lib/mjs/components/_classes/component/Component.js +108 -38
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.d.ts +1 -0
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +4 -19
- package/lib/mjs/components/_classes/nested/NestedComponent.js +55 -61
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +8 -43
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -45
- package/lib/mjs/components/datamap/DataMap.js +2 -3
- package/lib/mjs/components/editgrid/EditGrid.js +15 -12
- package/lib/mjs/components/form/Form.d.ts +1 -3
- package/lib/mjs/components/form/Form.js +21 -28
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/html/HTML.js +15 -3
- package/lib/mjs/components/radio/Radio.js +2 -3
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/mjs/components/signature/Signature.js +3 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +2 -2
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.d.ts +2 -2
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/mjs/utils/conditionOperators/IsEqualTo.d.ts +2 -2
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/mjs/utils/formUtils.d.ts +25 -14
- package/lib/mjs/utils/formUtils.js +2 -12
- package/lib/mjs/utils/i18n.js +4 -0
- package/lib/mjs/utils/utils.d.ts +1 -2
- package/lib/mjs/utils/utils.js +14 -29
- package/package.json +4 -4
|
@@ -2,6 +2,8 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
2
2
|
static savedValueTypes(): string[];
|
|
3
3
|
componentContext(component: any): any;
|
|
4
4
|
get iteratableRows(): void;
|
|
5
|
+
set rowIndex(value: number | undefined);
|
|
6
|
+
get rowIndex(): number | undefined;
|
|
5
7
|
prevHasAddButton: any;
|
|
6
8
|
checkAddButtonChanged(): void;
|
|
7
9
|
checkData(data: any, flags: any, row: any): any;
|
|
@@ -10,7 +12,6 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
10
12
|
checkRow(...args: any[]): any;
|
|
11
13
|
processRow(method: any, data: any, opts: any, row: any, components: any, silentCheck: any): any;
|
|
12
14
|
hasAddButton(): any;
|
|
13
|
-
getComponent(path: any, fn: any, originalPath: any): any;
|
|
14
15
|
everyComponent(fn: any, rowIndex: any, options?: {}): void;
|
|
15
16
|
_getEmailTableHeader(options: any): string;
|
|
16
17
|
_getEmailTableBody(options: any): string;
|
|
@@ -4,7 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const utils_1 = require("
|
|
7
|
+
const utils_1 = require("@formio/core/utils");
|
|
8
|
+
const { getComponentPaths } = utils_1.Utils;
|
|
9
|
+
const utils_2 = require("../../../utils/utils");
|
|
8
10
|
const Component_1 = __importDefault(require("../component/Component"));
|
|
9
11
|
const NestedDataComponent_1 = __importDefault(require("../nesteddata/NestedDataComponent"));
|
|
10
12
|
class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
@@ -14,7 +16,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
14
16
|
}, ...extend);
|
|
15
17
|
}
|
|
16
18
|
static savedValueTypes() {
|
|
17
|
-
return [
|
|
19
|
+
return [utils_2.componentValueTypes.array];
|
|
18
20
|
}
|
|
19
21
|
componentContext(component) {
|
|
20
22
|
return this.iteratableRows[component.rowIndex].data;
|
|
@@ -23,9 +25,11 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
23
25
|
throw new Error('Getter #iteratableRows() is not implemented');
|
|
24
26
|
}
|
|
25
27
|
get rowIndex() {
|
|
26
|
-
return
|
|
28
|
+
return this._rowIndex;
|
|
27
29
|
}
|
|
28
30
|
set rowIndex(value) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
this.paths = getComponentPaths(this.component, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component, Object.assign(Object.assign({}, (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.paths) || {})), { dataIndex: value }));
|
|
29
33
|
this._rowIndex = value;
|
|
30
34
|
}
|
|
31
35
|
init() {
|
|
@@ -88,47 +92,6 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
88
92
|
value: this.dataValue,
|
|
89
93
|
}, 'show'));
|
|
90
94
|
}
|
|
91
|
-
getComponent(path, fn, originalPath) {
|
|
92
|
-
originalPath = originalPath || (0, utils_1.getStringFromComponentPath)(path);
|
|
93
|
-
if (this.componentsMap.hasOwnProperty(originalPath)) {
|
|
94
|
-
if (fn) {
|
|
95
|
-
return fn(this.componentsMap[originalPath]);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return this.componentsMap[originalPath];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
path = Array.isArray(path) ? path : [path];
|
|
102
|
-
let key = path.shift();
|
|
103
|
-
const remainingPath = path;
|
|
104
|
-
let result = [];
|
|
105
|
-
let possibleComp = null;
|
|
106
|
-
let comp = null;
|
|
107
|
-
let rowIndex = null;
|
|
108
|
-
if (lodash_1.default.isNumber(key)) {
|
|
109
|
-
rowIndex = key;
|
|
110
|
-
key = remainingPath.shift();
|
|
111
|
-
}
|
|
112
|
-
if (!lodash_1.default.isString(key)) {
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
this.everyComponent((component, components) => {
|
|
116
|
-
if (component.component.key === key) {
|
|
117
|
-
possibleComp = component;
|
|
118
|
-
if (remainingPath.length > 0 && 'getComponent' in component) {
|
|
119
|
-
comp = component.getComponent(remainingPath, fn, originalPath);
|
|
120
|
-
}
|
|
121
|
-
else if (fn) {
|
|
122
|
-
fn(component, components);
|
|
123
|
-
}
|
|
124
|
-
result = rowIndex !== null ? comp : result.concat(comp || possibleComp);
|
|
125
|
-
}
|
|
126
|
-
}, rowIndex);
|
|
127
|
-
if ((!result || result.length === 0) && possibleComp) {
|
|
128
|
-
result = rowIndex !== null ? possibleComp : [possibleComp];
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
95
|
everyComponent(fn, rowIndex, options = {}) {
|
|
133
96
|
if (lodash_1.default.isObject(rowIndex)) {
|
|
134
97
|
options = rowIndex;
|
|
@@ -163,7 +126,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
163
126
|
if (component.isInputComponent) {
|
|
164
127
|
row += getHeaderCell(component);
|
|
165
128
|
}
|
|
166
|
-
else if ((0,
|
|
129
|
+
else if ((0, utils_2.isLayoutComponent)(component) && typeof component.everyComponent === 'function') {
|
|
167
130
|
component.everyComponent((comp) => {
|
|
168
131
|
row += getHeaderCell(comp);
|
|
169
132
|
}, options);
|
|
@@ -185,7 +148,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
185
148
|
if (component.isInputComponent) {
|
|
186
149
|
row += getBodyCell(component);
|
|
187
150
|
}
|
|
188
|
-
else if ((0,
|
|
151
|
+
else if ((0, utils_2.isLayoutComponent)(component) && typeof component.everyComponent === 'function') {
|
|
189
152
|
component.everyComponent((comp) => {
|
|
190
153
|
row += getBodyCell(comp);
|
|
191
154
|
}, options);
|
|
@@ -87,7 +87,6 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
87
87
|
show: boolean;
|
|
88
88
|
};
|
|
89
89
|
checkComponentConditions(data: any, flags: any, row: any): boolean;
|
|
90
|
-
getComponent(path: any, fn: any): any;
|
|
91
90
|
toggleGroup(element: any, index: any): void;
|
|
92
91
|
}
|
|
93
92
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
|
8
8
|
const utils_1 = require("../../utils/utils");
|
|
9
|
-
const Components_1 = __importDefault(require("../Components"));
|
|
10
9
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
|
11
10
|
static schema(...extend) {
|
|
12
11
|
return NestedArrayComponent_1.default.schema({
|
|
@@ -426,7 +425,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
426
425
|
}
|
|
427
426
|
component.rowIndex = rowIndex;
|
|
428
427
|
component.row = `${rowIndex}-${colIndex}`;
|
|
429
|
-
component.path = Components_1.default.getComponentPath(component);
|
|
430
428
|
});
|
|
431
429
|
}
|
|
432
430
|
updateRowsComponents(rowIndex) {
|
|
@@ -492,6 +490,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
492
490
|
const options = lodash_1.default.clone(this.options);
|
|
493
491
|
options.name += `[${rowIndex}]`;
|
|
494
492
|
options.row = `${rowIndex}-${colIndex}`;
|
|
493
|
+
options.rowIndex = rowIndex;
|
|
495
494
|
let columnComponent;
|
|
496
495
|
if (this.builderMode) {
|
|
497
496
|
col.id = col.id + rowIndex;
|
|
@@ -614,49 +613,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
614
613
|
restoreComponentsContext() {
|
|
615
614
|
this.rows.forEach((row, index) => lodash_1.default.forIn(row, (component) => component.data = this.dataValue[index]));
|
|
616
615
|
}
|
|
617
|
-
getComponent(path, fn) {
|
|
618
|
-
path = Array.isArray(path) ? path : [path];
|
|
619
|
-
const [key, ...remainingPath] = path;
|
|
620
|
-
let result = [];
|
|
621
|
-
if (lodash_1.default.isNumber(key) && remainingPath.length) {
|
|
622
|
-
const compKey = remainingPath.pop();
|
|
623
|
-
result = this.rows[key][compKey];
|
|
624
|
-
// If the component is inside a Layout Component, try to find it among all the row's components
|
|
625
|
-
if (!result) {
|
|
626
|
-
Object.entries(this.rows[key]).forEach(([, comp]) => {
|
|
627
|
-
if ('getComponent' in comp) {
|
|
628
|
-
const possibleResult = comp.getComponent([compKey], fn);
|
|
629
|
-
if (possibleResult) {
|
|
630
|
-
result = possibleResult;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
if (result && lodash_1.default.isFunction(fn)) {
|
|
636
|
-
fn(result, this.getComponents());
|
|
637
|
-
}
|
|
638
|
-
if (remainingPath.length && 'getComponent' in result) {
|
|
639
|
-
return result.getComponent(remainingPath, fn);
|
|
640
|
-
}
|
|
641
|
-
return result;
|
|
642
|
-
}
|
|
643
|
-
if (!lodash_1.default.isString(key)) {
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
this.everyComponent((component, components) => {
|
|
647
|
-
if (component.component.key === key) {
|
|
648
|
-
let comp = component;
|
|
649
|
-
if (remainingPath.length > 0 && 'getComponent' in component) {
|
|
650
|
-
comp = component.getComponent(remainingPath, fn);
|
|
651
|
-
}
|
|
652
|
-
else if (fn) {
|
|
653
|
-
fn(component, components);
|
|
654
|
-
}
|
|
655
|
-
result = result.concat(comp);
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
return result.length > 0 ? result : null;
|
|
659
|
-
}
|
|
660
616
|
toggleGroup(element, index) {
|
|
661
617
|
element.classList.toggle('collapsed');
|
|
662
618
|
lodash_1.default.each(this.refs.chunks[index], row => {
|
|
@@ -8,7 +8,6 @@ const DataGrid_1 = __importDefault(require("../datagrid/DataGrid"));
|
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
10
10
|
const utils_1 = require("../../utils/utils");
|
|
11
|
-
const Components_1 = __importDefault(require("../Components"));
|
|
12
11
|
class DataMapComponent extends DataGrid_1.default {
|
|
13
12
|
static schema(...extend) {
|
|
14
13
|
return Component_1.default.schema({
|
|
@@ -75,7 +74,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
75
74
|
}
|
|
76
75
|
get dataValue() {
|
|
77
76
|
if (!this.key ||
|
|
78
|
-
(
|
|
77
|
+
(this.conditionallyHidden && this.component.clearOnHide)) {
|
|
79
78
|
return this.emptyValue;
|
|
80
79
|
}
|
|
81
80
|
if (!this.hasValue() && this.shouldAddDefaultValue) {
|
|
@@ -232,6 +231,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
232
231
|
options.events = new eventemitter3_1.default();
|
|
233
232
|
options.name += `[${rowIndex}]`;
|
|
234
233
|
options.row = `${rowIndex}`;
|
|
234
|
+
options.rowIndex = rowIndex;
|
|
235
235
|
const components = {};
|
|
236
236
|
components['__key'] = this.createComponent(this.keySchema, options, { __key: this.builderMode ? this.defaultRowKey : key });
|
|
237
237
|
components['__key'].on('componentChange', (event) => {
|
|
@@ -241,7 +241,6 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
241
241
|
delete dataValue[key];
|
|
242
242
|
const comp = components[this.valueKey];
|
|
243
243
|
comp.component.key = newKey;
|
|
244
|
-
comp.path = Components_1.default.getComponentPath(comp);
|
|
245
244
|
key = newKey;
|
|
246
245
|
});
|
|
247
246
|
const valueComponent = lodash_1.default.clone(this.component.valueComponent);
|
|
@@ -934,6 +934,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
934
934
|
const options = lodash_1.default.clone(this.options);
|
|
935
935
|
options.name += `[${rowIndex}]`;
|
|
936
936
|
options.row = `${rowIndex}-${colIndex}`;
|
|
937
|
+
options.rowIndex = rowIndex;
|
|
937
938
|
options.onChange = (flags = {}, changed, modified) => {
|
|
938
939
|
var _a, _b;
|
|
939
940
|
if (((_a = changed.instance.root) === null || _a === void 0 ? void 0 : _a.id) && (((_b = this.root) === null || _b === void 0 ? void 0 : _b.id) !== changed.instance.root.id)) {
|
|
@@ -948,7 +949,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
948
949
|
const editRow = this.editRows[rowIndex];
|
|
949
950
|
if (editRow) {
|
|
950
951
|
this.processRow('checkData', null, Object.assign(Object.assign({}, flags), { changed }), editRow.data, editRow.components);
|
|
951
|
-
this.validateRow(editRow, false);
|
|
952
|
+
this.validateRow(editRow, false, false);
|
|
952
953
|
}
|
|
953
954
|
if (this.variableTypeComponentsIndexes.length) {
|
|
954
955
|
this.checkRowVariableTypeComponents(editRow, rowIndex);
|
|
@@ -987,25 +988,24 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
987
988
|
dirty;
|
|
988
989
|
}
|
|
989
990
|
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
|
990
|
-
var _a;
|
|
991
|
+
var _a, _b;
|
|
991
992
|
editRow.errors = [];
|
|
992
993
|
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
|
993
|
-
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
|
994
|
+
const silentCheck = forceSilentCheck === false ? false : ((this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck);
|
|
994
995
|
const rootValue = (0, utils_1.fastCloneDeep)(this.rootValue);
|
|
995
996
|
const editGridValue = lodash_1.default.get(rootValue, this.path, []);
|
|
996
997
|
editGridValue[editRow.rowIndex] = editRow.data;
|
|
997
998
|
lodash_1.default.set(rootValue, this.path, editGridValue);
|
|
998
999
|
const validationProcessorProcess = (context) => this.validationProcessor(context, { dirty, silentCheck });
|
|
999
1000
|
const errors = (0, process_1.processSync)({
|
|
1000
|
-
components:
|
|
1001
|
-
component.parentPath = `${this.path}[${editRow.rowIndex}]`;
|
|
1002
|
-
return component;
|
|
1003
|
-
}),
|
|
1001
|
+
components: this.component.components,
|
|
1004
1002
|
data: rootValue,
|
|
1005
1003
|
row: editRow.data,
|
|
1006
1004
|
process: 'validateRow',
|
|
1007
1005
|
instances: this.componentsMap,
|
|
1008
1006
|
scope: { errors: [] },
|
|
1007
|
+
parent: this.component,
|
|
1008
|
+
parentPaths: Object.assign(Object.assign({}, this.paths), { dataIndex: editRow.rowIndex }),
|
|
1009
1009
|
processors: [
|
|
1010
1010
|
{
|
|
1011
1011
|
process: validationProcessorProcess,
|
|
@@ -1037,9 +1037,12 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
if (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted)) {
|
|
1040
|
+
if (editRow.alerts && (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted))) {
|
|
1041
1041
|
this.showRowErrorAlerts(editRow, editRow.errors);
|
|
1042
1042
|
}
|
|
1043
|
+
else if ((_b = editRow.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1044
|
+
this.setCustomValidity(editRow.errors, dirty);
|
|
1045
|
+
}
|
|
1043
1046
|
return editRow.errors;
|
|
1044
1047
|
}
|
|
1045
1048
|
showRowErrorAlerts(editRow, errors) {
|
|
@@ -1151,7 +1154,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1151
1154
|
}
|
|
1152
1155
|
}
|
|
1153
1156
|
const changed = this.hasChanged(value, this.dataValue);
|
|
1154
|
-
if (this.parent
|
|
1157
|
+
if (this.parent) {
|
|
1155
1158
|
this.parent.checkComponentConditions();
|
|
1156
1159
|
}
|
|
1157
1160
|
this.dataValue = value;
|
|
@@ -1184,10 +1187,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1184
1187
|
this.editRows = this.editRows.slice(0, dataLength);
|
|
1185
1188
|
this.openWhenEmpty();
|
|
1186
1189
|
this.updateOnChange(flags, changed);
|
|
1187
|
-
|
|
1188
|
-
if (!this.options.server) {
|
|
1189
|
-
this.checkData();
|
|
1190
|
-
}
|
|
1190
|
+
this.checkData();
|
|
1191
1191
|
this.changeState(changed, flags);
|
|
1192
1192
|
return changed;
|
|
1193
1193
|
}
|
|
@@ -21,7 +21,7 @@ export default class FormComponent extends Component {
|
|
|
21
21
|
get useOriginalRevision(): any;
|
|
22
22
|
setFormRevision(rev: any): void;
|
|
23
23
|
subFormRevision: any;
|
|
24
|
-
getComponent(path: any
|
|
24
|
+
getComponent(path: any): any;
|
|
25
25
|
getSubOptions(options?: {}): {};
|
|
26
26
|
render(): string;
|
|
27
27
|
asString(value: any): any;
|
|
@@ -55,8 +55,6 @@ export default class FormComponent extends Component {
|
|
|
55
55
|
*/
|
|
56
56
|
loadSubForm(fromAttach: boolean): Promise<any>;
|
|
57
57
|
subFormLoading: boolean | undefined;
|
|
58
|
-
get subFormData(): any;
|
|
59
|
-
checkComponentValidity(data: any, dirty: any, row: any, options: any, errors?: any[]): any;
|
|
60
58
|
checkComponentConditions(data: any, flags: any, row: any): any;
|
|
61
59
|
calculateValue(data: any, flags: any, row: any): any;
|
|
62
60
|
setPristine(pristine: any): void;
|
|
@@ -133,15 +133,11 @@ class FormComponent extends Component_1.default {
|
|
|
133
133
|
this.subFormRevision = undefined;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
getComponent(path
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
path.shift();
|
|
140
|
-
}
|
|
141
|
-
const originalPathStr = `${this.path}.data.${(0, utils_1.getStringFromComponentPath)(path)}`;
|
|
142
|
-
if (this.subForm) {
|
|
143
|
-
return this.subForm.getComponent(path, fn, originalPathStr);
|
|
136
|
+
getComponent(path) {
|
|
137
|
+
if (!this.subForm) {
|
|
138
|
+
return null;
|
|
144
139
|
}
|
|
140
|
+
return this.subForm.getComponent(path);
|
|
145
141
|
}
|
|
146
142
|
/* eslint-disable max-statements */
|
|
147
143
|
getSubOptions(options = {}) {
|
|
@@ -209,6 +205,7 @@ class FormComponent extends Component_1.default {
|
|
|
209
205
|
if (this.options.skipDraftRestore) {
|
|
210
206
|
options.skipDraftRestore = this.options.skipDraftRestore;
|
|
211
207
|
}
|
|
208
|
+
options.parent = this;
|
|
212
209
|
return options;
|
|
213
210
|
}
|
|
214
211
|
/* eslint-enable max-statements */
|
|
@@ -297,6 +294,7 @@ class FormComponent extends Component_1.default {
|
|
|
297
294
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
298
295
|
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
|
299
296
|
this.componentModal = new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
297
|
+
this.subForm.element = this.componentModal.refs.componentContent || this.subForm.element;
|
|
300
298
|
this.setOpenModalElement();
|
|
301
299
|
}
|
|
302
300
|
this.calculateValue();
|
|
@@ -395,6 +393,10 @@ class FormComponent extends Component_1.default {
|
|
|
395
393
|
return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {
|
|
396
394
|
this.subForm = instance;
|
|
397
395
|
this.subForm.currentForm = this;
|
|
396
|
+
const componentsMap = this.componentsMap;
|
|
397
|
+
const formComponentsMap = this.subForm.componentsMap;
|
|
398
|
+
lodash_1.default.assign(componentsMap, formComponentsMap);
|
|
399
|
+
this.component.components = this.subForm.components.map((comp) => comp.component);
|
|
398
400
|
this.subForm.parent = this;
|
|
399
401
|
this.subForm.parentVisible = this.visible;
|
|
400
402
|
this.subForm.on('change', () => {
|
|
@@ -413,6 +415,8 @@ class FormComponent extends Component_1.default {
|
|
|
413
415
|
this.valueChanged = this.hasSetValue;
|
|
414
416
|
this.onChange();
|
|
415
417
|
return this.subForm;
|
|
418
|
+
}).catch((err) => {
|
|
419
|
+
console.log(err);
|
|
416
420
|
});
|
|
417
421
|
}).then((subForm) => {
|
|
418
422
|
this.updateSubWizards(subForm);
|
|
@@ -421,10 +425,10 @@ class FormComponent extends Component_1.default {
|
|
|
421
425
|
return this.subFormReady;
|
|
422
426
|
}
|
|
423
427
|
hideSubmitButton(component) {
|
|
424
|
-
const isSubmitButton =
|
|
425
|
-
((component.action === 'submit') || !component.action);
|
|
428
|
+
const isSubmitButton = component.type === 'button' && (component.action === 'submit' || !component.action);
|
|
426
429
|
if (isSubmitButton) {
|
|
427
430
|
component.hidden = true;
|
|
431
|
+
component.customConditional = 'show = false';
|
|
428
432
|
}
|
|
429
433
|
}
|
|
430
434
|
/**
|
|
@@ -434,7 +438,7 @@ class FormComponent extends Component_1.default {
|
|
|
434
438
|
*/
|
|
435
439
|
loadSubForm(fromAttach) {
|
|
436
440
|
var _a, _b, _c, _d, _e;
|
|
437
|
-
if (this.builderMode || this.
|
|
441
|
+
if (this.builderMode || this.conditionallyHidden || (this.isSubFormLazyLoad() && !fromAttach)) {
|
|
438
442
|
return Promise.resolve();
|
|
439
443
|
}
|
|
440
444
|
if (this.hasLoadedForm && !this.isRevisionChanged &&
|
|
@@ -469,18 +473,6 @@ class FormComponent extends Component_1.default {
|
|
|
469
473
|
}
|
|
470
474
|
return Promise.resolve();
|
|
471
475
|
}
|
|
472
|
-
get subFormData() {
|
|
473
|
-
var _a;
|
|
474
|
-
return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};
|
|
475
|
-
}
|
|
476
|
-
checkComponentValidity(data, dirty, row, options, errors = []) {
|
|
477
|
-
options = options || {};
|
|
478
|
-
const silentCheck = options.silentCheck || false;
|
|
479
|
-
if (this.subForm && !this.isNestedWizard) {
|
|
480
|
-
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
|
481
|
-
}
|
|
482
|
-
return super.checkComponentValidity(data, dirty, row, options, errors);
|
|
483
|
-
}
|
|
484
476
|
checkComponentConditions(data, flags, row) {
|
|
485
477
|
const visible = super.checkComponentConditions(data, flags, row);
|
|
486
478
|
// Return if already hidden
|
|
@@ -488,14 +480,14 @@ class FormComponent extends Component_1.default {
|
|
|
488
480
|
return visible;
|
|
489
481
|
}
|
|
490
482
|
if (this.subForm) {
|
|
491
|
-
return this.subForm.checkConditions(
|
|
483
|
+
return this.subForm.checkConditions(data, flags, row);
|
|
492
484
|
}
|
|
493
485
|
// There are few cases when subForm is not loaded when a change is triggered,
|
|
494
486
|
// so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode
|
|
495
487
|
else if (this.subFormReady) {
|
|
496
488
|
this.subFormReady.then(() => {
|
|
497
489
|
if (this.subForm) {
|
|
498
|
-
return this.subForm.checkConditions(
|
|
490
|
+
return this.subForm.checkConditions(data, flags, row);
|
|
499
491
|
}
|
|
500
492
|
});
|
|
501
493
|
}
|
|
@@ -503,7 +495,7 @@ class FormComponent extends Component_1.default {
|
|
|
503
495
|
}
|
|
504
496
|
calculateValue(data, flags, row) {
|
|
505
497
|
if (this.subForm) {
|
|
506
|
-
return this.subForm.calculateValue(
|
|
498
|
+
return this.subForm.calculateValue(data, flags, row);
|
|
507
499
|
}
|
|
508
500
|
return super.calculateValue(data, flags, row);
|
|
509
501
|
}
|
|
@@ -518,7 +510,7 @@ class FormComponent extends Component_1.default {
|
|
|
518
510
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
|
519
511
|
*/
|
|
520
512
|
get shouldSubmit() {
|
|
521
|
-
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.
|
|
513
|
+
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.conditionallyHidden;
|
|
522
514
|
}
|
|
523
515
|
/**
|
|
524
516
|
* Returns the data for the subform.
|
|
@@ -545,7 +537,7 @@ class FormComponent extends Component_1.default {
|
|
|
545
537
|
}
|
|
546
538
|
this.subForm.nosubmit = false;
|
|
547
539
|
this.subForm.submitted = true;
|
|
548
|
-
return this.subForm.submitForm().then(result => {
|
|
540
|
+
return this.subForm.submitForm({}, true).then(result => {
|
|
549
541
|
this.subForm.loading = false;
|
|
550
542
|
this.subForm.showAllErrors = false;
|
|
551
543
|
this.dataValue = result.submission;
|
|
@@ -56,9 +56,21 @@ class HTMLComponent extends Component_1.default {
|
|
|
56
56
|
}
|
|
57
57
|
checkRefreshOn(changed) {
|
|
58
58
|
super.checkRefreshOn(changed);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.
|
|
59
|
+
let visible;
|
|
60
|
+
if (this.hasCondition()) {
|
|
61
|
+
this._conditionallyHidden = this.checkConditionallyHidden();
|
|
62
|
+
visible = !this.conditionallyHidden;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
visible = !this.component.hidden;
|
|
66
|
+
}
|
|
67
|
+
const shouldSetContent = !this.builderMode
|
|
68
|
+
&& this.component.refreshOnChange
|
|
69
|
+
&& this.element
|
|
70
|
+
&& !lodash_1.default.isUndefined(changed)
|
|
71
|
+
&& ((lodash_1.default.isBoolean(changed) && changed) || !lodash_1.default.isEmpty(changed))
|
|
72
|
+
&& visible;
|
|
73
|
+
if (shouldSetContent) {
|
|
62
74
|
this.setContent(this.element, this.renderContent());
|
|
63
75
|
}
|
|
64
76
|
}
|
|
@@ -342,9 +342,8 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
342
342
|
label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
|
|
343
343
|
};
|
|
344
344
|
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
(!this.isRadio && lodash_1.default.isBoolean(valueAtProperty)))) {
|
|
345
|
+
const value = this.loadedOptions[i].value;
|
|
346
|
+
if (!this.isRadio && (lodash_1.default.isObject(value) || lodash_1.default.isBoolean(value) || lodash_1.default.isUndefined(value))) {
|
|
348
347
|
this.loadedOptions[i].invalid = true;
|
|
349
348
|
}
|
|
350
349
|
});
|
|
@@ -1099,6 +1099,7 @@ declare const _default: ({
|
|
|
1099
1099
|
alwaysEnabled?: undefined;
|
|
1100
1100
|
} | {
|
|
1101
1101
|
key: string;
|
|
1102
|
+
type: string;
|
|
1102
1103
|
conditional: {
|
|
1103
1104
|
json: {
|
|
1104
1105
|
and: ({
|
|
@@ -1149,7 +1150,6 @@ declare const _default: ({
|
|
|
1149
1150
|
};
|
|
1150
1151
|
};
|
|
1151
1152
|
data?: undefined;
|
|
1152
|
-
type?: undefined;
|
|
1153
1153
|
weight?: undefined;
|
|
1154
1154
|
input?: undefined;
|
|
1155
1155
|
label?: undefined;
|
|
@@ -139,6 +139,14 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
|
139
139
|
checkedValues.forEach((value) => selectData.push(this.templateData[value]));
|
|
140
140
|
lodash_1.default.set(submission.metadata.selectData, this.path, selectData);
|
|
141
141
|
}
|
|
142
|
+
// Ensure that for dataSrc == 'values' that there are not any other superfluous values.
|
|
143
|
+
if (this.component.dataSrc === 'values') {
|
|
144
|
+
for (const key in value) {
|
|
145
|
+
if (!this.component.values.find((val) => val.value === key)) {
|
|
146
|
+
delete value[key];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
142
150
|
return value;
|
|
143
151
|
}
|
|
144
152
|
/**
|
|
@@ -267,7 +275,6 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
|
267
275
|
else {
|
|
268
276
|
return super.setCustomValidity(messages, dirty, external);
|
|
269
277
|
}
|
|
270
|
-
;
|
|
271
278
|
}
|
|
272
279
|
validateValueAvailability(setting, value) {
|
|
273
280
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
|
@@ -20,13 +20,13 @@ class DateGeaterThan extends ConditionOperator_1.default {
|
|
|
20
20
|
}
|
|
21
21
|
execute(options, functionName = 'isAfter') {
|
|
22
22
|
var _a;
|
|
23
|
-
const { value, instance,
|
|
23
|
+
const { value, instance, path } = options;
|
|
24
24
|
if (!value) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
let conditionTriggerComponent = null;
|
|
28
28
|
if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
|
|
29
|
-
conditionTriggerComponent = instance.root.getComponent(
|
|
29
|
+
conditionTriggerComponent = instance.root.getComponent(path);
|
|
30
30
|
}
|
|
31
31
|
if (conditionTriggerComponent && conditionTriggerComponent.isPartialDay && conditionTriggerComponent.isPartialDay(value)) {
|
|
32
32
|
return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class IsEmptyValue extends ConditionOperator {
|
|
2
|
-
execute({ value, instance,
|
|
2
|
+
execute({ value, instance, path }: {
|
|
3
3
|
value: any;
|
|
4
4
|
instance: any;
|
|
5
|
-
|
|
5
|
+
path: any;
|
|
6
6
|
}): any;
|
|
7
7
|
getResult(options: any): any;
|
|
8
8
|
}
|
|
@@ -15,11 +15,11 @@ class IsEmptyValue extends ConditionOperator_1.default {
|
|
|
15
15
|
static get requireValue() {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
execute({ value, instance,
|
|
18
|
+
execute({ value, instance, path }) {
|
|
19
19
|
var _a;
|
|
20
20
|
const isEmptyValue = lodash_1.default.isEmpty(lodash_1.default.isNumber(value) ? String(value) : value);
|
|
21
21
|
if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
|
|
22
|
-
const conditionTriggerComponent = instance.root.getComponent(
|
|
22
|
+
const conditionTriggerComponent = instance.root.getComponent(path);
|
|
23
23
|
return (conditionTriggerComponent === null || conditionTriggerComponent === void 0 ? void 0 : conditionTriggerComponent.isEmpty) ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
24
24
|
}
|
|
25
25
|
return isEmptyValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default class IsEqualTo extends ConditionOperator {
|
|
2
|
-
execute({ value, comparedValue, instance,
|
|
2
|
+
execute({ value, comparedValue, instance, path }: {
|
|
3
3
|
value: any;
|
|
4
4
|
comparedValue: any;
|
|
5
5
|
instance: any;
|
|
6
|
-
|
|
6
|
+
path: any;
|
|
7
7
|
}): any;
|
|
8
8
|
}
|
|
9
9
|
import ConditionOperator from './ConditionOperator';
|