@formio/js 5.0.0-dev.5704.492ccdf → 5.0.0-dev.5704.50db01f
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 +47 -0
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.form.js +55 -131
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +61 -41
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +25 -5
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Form.d.ts +2 -2
- package/lib/cjs/Form.js +11 -5
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +2 -1
- package/lib/cjs/Webform.js +3 -6
- package/lib/cjs/WebformBuilder.js +13 -3
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/cjs/components/_classes/component/Component.js +25 -6
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +56 -29
- package/lib/cjs/components/address/Address.d.ts +6 -0
- package/lib/cjs/components/address/Address.js +7 -1
- package/lib/cjs/components/currency/Currency.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -1
- package/lib/cjs/components/datagrid/DataGrid.js +40 -35
- package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.js +2 -2
- package/lib/cjs/components/day/Day.d.ts +3 -4
- package/lib/cjs/components/day/Day.js +31 -10
- package/lib/cjs/components/editgrid/EditGrid.js +14 -6
- package/lib/cjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
- package/lib/cjs/components/editgrid/fixtures/comp-test-events.js +54 -0
- package/lib/cjs/components/editgrid/fixtures/comp16.d.ts +52 -0
- package/lib/cjs/components/editgrid/fixtures/comp16.js +71 -0
- package/lib/cjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/cjs/components/editgrid/fixtures/comp17.js +99 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +10 -7
- package/lib/cjs/components/editgrid/fixtures/index.js +7 -1
- package/lib/cjs/components/file/File.d.ts +2 -2
- package/lib/cjs/components/file/File.js +13 -2
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/cjs/components/form/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/form/fixtures/index.js +3 -1
- package/lib/cjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
- package/lib/cjs/components/form/fixtures/nestedWizardForm.js +765 -0
- package/lib/cjs/components/number/Number.d.ts +17 -2
- package/lib/cjs/components/number/Number.js +26 -6
- package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp10.js +21 -0
- package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp9.js +21 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/number/fixtures/index.js +5 -1
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/radio/Radio.d.ts +2 -18
- package/lib/cjs/components/radio/Radio.js +29 -27
- package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
- package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
- package/lib/cjs/components/select/Select.d.ts +38 -0
- package/lib/cjs/components/select/Select.js +13 -3
- package/lib/cjs/components/select/fixtures/comp25.d.ts +59 -0
- package/lib/cjs/components/select/fixtures/comp25.js +66 -0
- 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 +3 -1
- package/lib/cjs/components/select/fixtures/index.js +5 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/tags/Tags.js +3 -3
- package/lib/cjs/components/time/Time.d.ts +2 -2
- package/lib/cjs/components/time/Time.form.js +2 -2
- package/lib/cjs/components/time/Time.js +3 -7
- package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/cjs/components/time/fixtures/comp4.js +171 -0
- package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/time/fixtures/index.js +3 -1
- package/lib/cjs/templates/Templates.js +1 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/cjs/utils/utils.d.ts +9 -1
- package/lib/cjs/utils/utils.js +14 -13
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Form.d.ts +2 -2
- package/lib/mjs/Form.js +11 -5
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -1
- package/lib/mjs/Webform.js +7 -6
- package/lib/mjs/WebformBuilder.js +12 -3
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/mjs/components/_classes/component/Component.js +11 -3
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +57 -29
- package/lib/mjs/components/address/Address.d.ts +6 -0
- package/lib/mjs/components/address/Address.js +10 -1
- package/lib/mjs/components/currency/Currency.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -1
- package/lib/mjs/components/datagrid/DataGrid.js +39 -34
- package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.js +2 -2
- package/lib/mjs/components/day/Day.d.ts +3 -4
- package/lib/mjs/components/day/Day.js +30 -10
- package/lib/mjs/components/editgrid/EditGrid.js +14 -6
- package/lib/mjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
- package/lib/mjs/components/editgrid/fixtures/comp-test-events.js +52 -0
- package/lib/mjs/components/editgrid/fixtures/comp16.d.ts +52 -0
- package/lib/mjs/components/editgrid/fixtures/comp16.js +69 -0
- package/lib/mjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/mjs/components/editgrid/fixtures/comp17.js +97 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +10 -7
- package/lib/mjs/components/editgrid/fixtures/index.js +4 -1
- package/lib/mjs/components/file/File.d.ts +2 -2
- package/lib/mjs/components/file/File.js +13 -2
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/mjs/components/form/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/form/fixtures/index.js +2 -1
- package/lib/mjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
- package/lib/mjs/components/form/fixtures/nestedWizardForm.js +763 -0
- package/lib/mjs/components/number/Number.d.ts +17 -2
- package/lib/mjs/components/number/Number.js +25 -5
- package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp10.js +19 -0
- package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp9.js +19 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/number/fixtures/index.js +3 -1
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/radio/Radio.d.ts +2 -18
- package/lib/mjs/components/radio/Radio.js +32 -30
- package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
- package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
- package/lib/mjs/components/select/Select.d.ts +38 -0
- package/lib/mjs/components/select/Select.js +16 -4
- package/lib/mjs/components/select/fixtures/comp25.d.ts +59 -0
- package/lib/mjs/components/select/fixtures/comp25.js +64 -0
- 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 +3 -1
- package/lib/mjs/components/select/fixtures/index.js +3 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/tags/Tags.js +3 -3
- package/lib/mjs/components/time/Time.d.ts +2 -2
- package/lib/mjs/components/time/Time.form.js +2 -2
- package/lib/mjs/components/time/Time.js +3 -13
- package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/mjs/components/time/fixtures/comp4.js +169 -0
- package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/time/fixtures/index.js +2 -1
- package/lib/mjs/templates/Templates.js +1 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/lib/mjs/utils/utils.d.ts +9 -1
- package/lib/mjs/utils/utils.js +14 -2
- package/package.json +4 -4
|
@@ -6,8 +6,7 @@ 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 = require("../Components");
|
|
10
|
-
const dragula_1 = __importDefault(require("dragula"));
|
|
9
|
+
const Components_1 = __importDefault(require("../Components"));
|
|
11
10
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
|
12
11
|
static schema(...extend) {
|
|
13
12
|
return NestedArrayComponent_1.default.schema({
|
|
@@ -44,6 +43,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
44
43
|
if (this.initRows || !lodash_1.default.isEqual(this.dataValue, this.emptyValue)) {
|
|
45
44
|
this.createRows(true);
|
|
46
45
|
}
|
|
46
|
+
if (this.allowReorder) {
|
|
47
|
+
this.dragulaReady = this.getDragula();
|
|
48
|
+
}
|
|
47
49
|
this.visibleColumns = {};
|
|
48
50
|
this.prevHasAddButton = this.hasAddButton();
|
|
49
51
|
this.checkColumns();
|
|
@@ -261,13 +263,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
261
263
|
return hasHeader || ((col.label || col.title) && !col.hideLabel);
|
|
262
264
|
}, false);
|
|
263
265
|
}
|
|
264
|
-
loadRefs(element, refs) {
|
|
265
|
-
super.loadRefs(element, refs);
|
|
266
|
-
if (refs['messageContainer'] === 'single') {
|
|
267
|
-
const container = lodash_1.default.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
|
|
268
|
-
this.refs['messageContainer'] = container || this.refs['messageContainer'];
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
266
|
attach(element) {
|
|
272
267
|
this.loadRefs(element, {
|
|
273
268
|
[`${this.datagridKey}-row`]: 'multiple',
|
|
@@ -276,37 +271,30 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
276
271
|
[`${this.datagridKey}-removeRow`]: 'multiple',
|
|
277
272
|
[`${this.datagridKey}-group-header`]: 'multiple',
|
|
278
273
|
[this.datagridKey]: 'multiple',
|
|
279
|
-
'messageContainer': 'single'
|
|
280
274
|
});
|
|
281
275
|
if (this.allowReorder) {
|
|
282
276
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
283
277
|
row.dragInfo = { index };
|
|
284
278
|
});
|
|
285
|
-
this.dragula
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
279
|
+
this.dragulaReady.then((dragula) => {
|
|
280
|
+
// The drop event may call redraw twice which calls attach twice and because this block of code is asynchronous
|
|
281
|
+
// BOTH redraws may be called before this block of code runs (which causes this block of code to run twice sequentially).
|
|
282
|
+
// This causes two dragula() calls on the same container which breaks dragula. To fix this the return value must
|
|
283
|
+
// be saved in this.dragula and have its container contents reset if it exists
|
|
284
|
+
if (this.dragula && this.dragula.containers) {
|
|
285
|
+
this.dragula.containers = [];
|
|
293
286
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
|
304
|
-
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
|
305
|
-
}, '');
|
|
306
|
-
el.children[index].style.cssText = cssText;
|
|
287
|
+
this.dragula = dragula([this.refs[`${this.datagridKey}-tbody`]], {
|
|
288
|
+
moves: (_draggedElement, _oldParent, clickedElement) => {
|
|
289
|
+
const clickedElementKey = clickedElement.getAttribute('data-key');
|
|
290
|
+
const oldParentKey = _oldParent.getAttribute('data-key');
|
|
291
|
+
//Check if the clicked button belongs to that container, if false, it belongs to the nested container
|
|
292
|
+
if (oldParentKey === clickedElementKey) {
|
|
293
|
+
return clickedElement.classList.contains('formio-drag-button');
|
|
307
294
|
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
295
|
+
}
|
|
296
|
+
}).on('drop', this.onReorder.bind(this))
|
|
297
|
+
.on('cloned', this.onCloned.bind(this));
|
|
310
298
|
});
|
|
311
299
|
}
|
|
312
300
|
this.refs[`${this.datagridKey}-addRow`].forEach((addButton) => {
|
|
@@ -373,6 +361,22 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
373
361
|
this.setValue(dataValue, { isReordered: true });
|
|
374
362
|
this.rebuild();
|
|
375
363
|
}
|
|
364
|
+
onCloned(el, original) {
|
|
365
|
+
if (el && el.children && original && original.children) {
|
|
366
|
+
lodash_1.default.each(original.children, (child, index) => {
|
|
367
|
+
const styles = getComputedStyle(child, null);
|
|
368
|
+
if (styles.cssText !== '') {
|
|
369
|
+
el.children[index].style.cssText = styles.cssText;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
const cssText = Object.values(styles).reduce((css, propertyName) => {
|
|
373
|
+
return `${css}${propertyName}:${styles.getPropertyValue(propertyName)};`;
|
|
374
|
+
}, '');
|
|
375
|
+
el.children[index].style.cssText = cssText;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
376
380
|
focusOnNewRowElement(row) {
|
|
377
381
|
Object.keys(row).find((key) => {
|
|
378
382
|
const element = row[key].element;
|
|
@@ -422,7 +426,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
422
426
|
}
|
|
423
427
|
component.rowIndex = rowIndex;
|
|
424
428
|
component.row = `${rowIndex}-${colIndex}`;
|
|
425
|
-
component.path = Components_1.
|
|
429
|
+
component.path = Components_1.default.getComponentPath(component);
|
|
426
430
|
});
|
|
427
431
|
}
|
|
428
432
|
updateRowsComponents(rowIndex) {
|
|
@@ -432,10 +436,11 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
432
436
|
}
|
|
433
437
|
removeRow(index) {
|
|
434
438
|
const makeEmpty = index === 0 && this.rows.length === 1;
|
|
435
|
-
const flags = { isReordered: !makeEmpty, resetValue: makeEmpty };
|
|
439
|
+
const flags = { isReordered: !makeEmpty, resetValue: makeEmpty, modified: true };
|
|
436
440
|
this.splice(index, flags);
|
|
437
441
|
this.emit('dataGridDeleteRow', { index });
|
|
438
442
|
const [row] = this.rows.splice(index, 1);
|
|
443
|
+
this.removeSubmissionMetadataRow(index);
|
|
439
444
|
this.removeRowComponents(row);
|
|
440
445
|
this.updateRowsComponents(index);
|
|
441
446
|
this.setValue(this.dataValue, flags);
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
key: string;
|
|
16
|
+
type: string;
|
|
17
|
+
input: boolean;
|
|
18
|
+
components: {
|
|
19
|
+
label: string;
|
|
20
|
+
widget: string;
|
|
21
|
+
tableView: boolean;
|
|
22
|
+
data: {
|
|
23
|
+
values: {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
validateWhenHidden: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
defaultValue: string;
|
|
33
|
+
}[];
|
|
34
|
+
disableOnInvalid?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
label: string;
|
|
38
|
+
key: string;
|
|
39
|
+
disableOnInvalid: boolean;
|
|
40
|
+
input: boolean;
|
|
41
|
+
tableView: boolean;
|
|
42
|
+
reorder?: undefined;
|
|
43
|
+
addAnotherPosition?: undefined;
|
|
44
|
+
layoutFixed?: undefined;
|
|
45
|
+
enableRowGroups?: undefined;
|
|
46
|
+
initEmpty?: undefined;
|
|
47
|
+
components?: undefined;
|
|
48
|
+
})[];
|
|
49
|
+
}
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'Select in Data Grid',
|
|
5
|
+
name: 'selectInDataGrid',
|
|
6
|
+
path: 'selectInDataGrid',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Data Grid',
|
|
12
|
+
reorder: false,
|
|
13
|
+
addAnotherPosition: 'bottom',
|
|
14
|
+
layoutFixed: false,
|
|
15
|
+
enableRowGroups: false,
|
|
16
|
+
initEmpty: false,
|
|
17
|
+
tableView: false,
|
|
18
|
+
key: 'dataGrid',
|
|
19
|
+
type: 'datagrid',
|
|
20
|
+
input: true,
|
|
21
|
+
components: [
|
|
22
|
+
{
|
|
23
|
+
label: 'Select',
|
|
24
|
+
widget: 'choicesjs',
|
|
25
|
+
tableView: true,
|
|
26
|
+
data: {
|
|
27
|
+
values: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Individual',
|
|
30
|
+
value: 'individual'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: 'Entity',
|
|
34
|
+
value: 'entity'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
validateWhenHidden: false,
|
|
39
|
+
key: 'select',
|
|
40
|
+
type: 'select',
|
|
41
|
+
input: true,
|
|
42
|
+
defaultValue: 'entity'
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'button',
|
|
48
|
+
label: 'Submit',
|
|
49
|
+
key: 'submit',
|
|
50
|
+
disableOnInvalid: true,
|
|
51
|
+
input: true,
|
|
52
|
+
tableView: false
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
};
|
|
@@ -8,6 +8,7 @@ import comp7 from './comp7';
|
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
10
|
import comp10 from './comp10';
|
|
11
|
+
import comp11 from './comp11';
|
|
11
12
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
12
13
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
13
14
|
import withDefValue from './comp-with-def-value';
|
|
@@ -18,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
18
19
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
19
20
|
import withCheckboxes from './comp-with-checkboxes';
|
|
20
21
|
import withReorder from './comp-with-reorder';
|
|
21
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
22
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -24,6 +24,8 @@ const comp9_1 = __importDefault(require("./comp9"));
|
|
|
24
24
|
exports.comp9 = comp9_1.default;
|
|
25
25
|
const comp10_1 = __importDefault(require("./comp10"));
|
|
26
26
|
exports.comp10 = comp10_1.default;
|
|
27
|
+
const comp11_1 = __importDefault(require("./comp11"));
|
|
28
|
+
exports.comp11 = comp11_1.default;
|
|
27
29
|
const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
|
|
28
30
|
exports.withDefValue = comp_with_def_value_1.default;
|
|
29
31
|
const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
|
|
@@ -8,7 +8,7 @@ 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 = require("../Components");
|
|
11
|
+
const Components_1 = __importDefault(require("../Components"));
|
|
12
12
|
class DataMapComponent extends DataGrid_1.default {
|
|
13
13
|
static schema(...extend) {
|
|
14
14
|
return Component_1.default.schema({
|
|
@@ -241,7 +241,7 @@ 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.
|
|
244
|
+
comp.path = Components_1.default.getComponentPath(comp);
|
|
245
245
|
key = newKey;
|
|
246
246
|
});
|
|
247
247
|
const valueComponent = lodash_1.default.clone(this.component.valueComponent);
|
|
@@ -17,9 +17,9 @@ export default class DayComponent extends Field {
|
|
|
17
17
|
constructor(component: any, options: any, data: any);
|
|
18
18
|
/**
|
|
19
19
|
* The empty value for day component.
|
|
20
|
-
* @returns {'
|
|
20
|
+
* @returns {''} - The empty value of the day component.
|
|
21
21
|
*/
|
|
22
|
-
get emptyValue(): "
|
|
22
|
+
get emptyValue(): "";
|
|
23
23
|
get valueMask(): RegExp;
|
|
24
24
|
get dayRequired(): any;
|
|
25
25
|
get showDay(): boolean;
|
|
@@ -130,8 +130,7 @@ export default class DayComponent extends Field {
|
|
|
130
130
|
* @returns {string|null} - The string value of the date.
|
|
131
131
|
*/
|
|
132
132
|
getValueAsString(value: any): string | null;
|
|
133
|
-
focus(field: any): void;
|
|
134
133
|
isPartialDay(value: any): boolean;
|
|
135
|
-
getValidationFormat():
|
|
134
|
+
getValidationFormat(): string;
|
|
136
135
|
}
|
|
137
136
|
import Field from '../_classes/field/Field';
|
|
@@ -30,7 +30,8 @@ class DayComponent extends Field_1.default {
|
|
|
30
30
|
required: false
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
dayFirst: false
|
|
33
|
+
dayFirst: false,
|
|
34
|
+
defaultValue: ''
|
|
34
35
|
}, ...extend);
|
|
35
36
|
}
|
|
36
37
|
static get builderInfo() {
|
|
@@ -64,10 +65,10 @@ class DayComponent extends Field_1.default {
|
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* The empty value for day component.
|
|
67
|
-
* @returns {'
|
|
68
|
+
* @returns {''} - The empty value of the day component.
|
|
68
69
|
*/
|
|
69
70
|
get emptyValue() {
|
|
70
|
-
return '
|
|
71
|
+
return '';
|
|
71
72
|
}
|
|
72
73
|
get valueMask() {
|
|
73
74
|
return /^\d{2}\/\d{2}\/\d{4}$/;
|
|
@@ -343,15 +344,21 @@ class DayComponent extends Field_1.default {
|
|
|
343
344
|
const valueParts = value.split('/');
|
|
344
345
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
345
346
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
|
346
|
-
const getNextPart = (shouldTake, defaultValue) =>
|
|
347
|
+
const getNextPart = (shouldTake, defaultValue) => {
|
|
348
|
+
// Only push the part if it's not an empty string
|
|
349
|
+
const part = shouldTake ? valueParts.shift() : defaultValue;
|
|
350
|
+
if (part !== '') {
|
|
351
|
+
dateParts.push(part);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
347
354
|
if (this.dayFirst) {
|
|
348
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
355
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
349
356
|
}
|
|
350
|
-
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '
|
|
357
|
+
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
|
|
351
358
|
if (!this.dayFirst) {
|
|
352
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
359
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
353
360
|
}
|
|
354
|
-
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '
|
|
361
|
+
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
|
|
355
362
|
return dateParts.join('/');
|
|
356
363
|
}
|
|
357
364
|
/**
|
|
@@ -363,7 +370,7 @@ class DayComponent extends Field_1.default {
|
|
|
363
370
|
setValueAt(index, value) {
|
|
364
371
|
// temporary solution to avoid input reset
|
|
365
372
|
// on invalid date.
|
|
366
|
-
if (
|
|
373
|
+
if (value === 'Invalid date') {
|
|
367
374
|
return null;
|
|
368
375
|
}
|
|
369
376
|
const parts = value.split('/');
|
|
@@ -558,10 +565,24 @@ class DayComponent extends Field_1.default {
|
|
|
558
565
|
}
|
|
559
566
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
560
567
|
const values = value.split('/');
|
|
568
|
+
if (values.length < 3) {
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
561
571
|
return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
562
572
|
}
|
|
563
573
|
getValidationFormat() {
|
|
564
|
-
|
|
574
|
+
var _a, _b, _c, _d, _e, _f;
|
|
575
|
+
let validationFormat = this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
|
|
576
|
+
if ((_b = (_a = this.fields) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.hide) {
|
|
577
|
+
validationFormat = validationFormat.replace('DD-', '');
|
|
578
|
+
}
|
|
579
|
+
if ((_d = (_c = this.fields) === null || _c === void 0 ? void 0 : _c.month) === null || _d === void 0 ? void 0 : _d.hide) {
|
|
580
|
+
validationFormat = validationFormat.replace('MM-', '');
|
|
581
|
+
}
|
|
582
|
+
if ((_f = (_e = this.fields) === null || _e === void 0 ? void 0 : _e.year) === null || _f === void 0 ? void 0 : _f.hide) {
|
|
583
|
+
validationFormat = validationFormat.replace('-YYYY', '');
|
|
584
|
+
}
|
|
585
|
+
return validationFormat;
|
|
565
586
|
}
|
|
566
587
|
}
|
|
567
588
|
exports.default = DayComponent;
|
|
@@ -490,11 +490,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
490
490
|
else {
|
|
491
491
|
this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
|
|
492
492
|
}
|
|
493
|
-
|
|
494
|
-
this.loadRefs(element, {
|
|
495
|
-
messageContainer: 'single-scope',
|
|
496
|
-
});
|
|
497
|
-
return superAttach;
|
|
493
|
+
return super.attach(element);
|
|
498
494
|
}
|
|
499
495
|
flattenRowDataValue(dataValue) {
|
|
500
496
|
const flattened = {};
|
|
@@ -681,6 +677,11 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
681
677
|
}
|
|
682
678
|
},
|
|
683
679
|
}, this.component.saveRow || 'Save'));
|
|
680
|
+
this.emit('editGridOpenModal', {
|
|
681
|
+
component: this.component,
|
|
682
|
+
row: editRow,
|
|
683
|
+
instance: this,
|
|
684
|
+
});
|
|
684
685
|
return this.attachComponents(modalContent, components);
|
|
685
686
|
}
|
|
686
687
|
showDialog(rowIndex) {
|
|
@@ -738,6 +739,11 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
738
739
|
editRow.data = dataSnapshot;
|
|
739
740
|
this.restoreRowContext(editRow);
|
|
740
741
|
}
|
|
742
|
+
this.emit('editGridEditRow', {
|
|
743
|
+
component: this.component,
|
|
744
|
+
row: editRow,
|
|
745
|
+
instance: this,
|
|
746
|
+
});
|
|
741
747
|
if (this.component.modal) {
|
|
742
748
|
return this.addRowModal(rowIndex);
|
|
743
749
|
}
|
|
@@ -889,6 +895,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
889
895
|
}
|
|
890
896
|
this.clearErrors(rowIndex);
|
|
891
897
|
this.baseRemoveRow(rowIndex);
|
|
898
|
+
this.removeSubmissionMetadataRow(rowIndex);
|
|
892
899
|
this.splice(rowIndex);
|
|
893
900
|
this.emit('editGridDeleteRow', {
|
|
894
901
|
index: rowIndex
|
|
@@ -1091,7 +1098,8 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1091
1098
|
return false;
|
|
1092
1099
|
}
|
|
1093
1100
|
else if (rowsEditing && this.saveEditMode && !this.component.openWhenEmpty) {
|
|
1094
|
-
this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
|
1101
|
+
this._errors = this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
|
1102
|
+
errors.push(...this._errors);
|
|
1095
1103
|
return false;
|
|
1096
1104
|
}
|
|
1097
1105
|
const message = this.invalid || this.invalidMessage(data, dirty, false, row);
|
|
@@ -0,0 +1,54 @@
|
|
|
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 owner: string;
|
|
9
|
+
let components: ({
|
|
10
|
+
label: string;
|
|
11
|
+
tableView: boolean;
|
|
12
|
+
modal: boolean;
|
|
13
|
+
validateWhenHidden: boolean;
|
|
14
|
+
rowDrafts: boolean;
|
|
15
|
+
key: string;
|
|
16
|
+
type: string;
|
|
17
|
+
displayAsTable: boolean;
|
|
18
|
+
input: boolean;
|
|
19
|
+
components: {
|
|
20
|
+
label: string;
|
|
21
|
+
applyMaskOn: string;
|
|
22
|
+
tableView: boolean;
|
|
23
|
+
validateWhenHidden: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
type: string;
|
|
26
|
+
input: boolean;
|
|
27
|
+
}[];
|
|
28
|
+
disableOnInvalid?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
type: string;
|
|
31
|
+
label: string;
|
|
32
|
+
key: string;
|
|
33
|
+
disableOnInvalid: boolean;
|
|
34
|
+
input: boolean;
|
|
35
|
+
tableView: boolean;
|
|
36
|
+
modal?: undefined;
|
|
37
|
+
validateWhenHidden?: undefined;
|
|
38
|
+
rowDrafts?: undefined;
|
|
39
|
+
displayAsTable?: undefined;
|
|
40
|
+
components?: undefined;
|
|
41
|
+
})[];
|
|
42
|
+
let pdfComponents: never[];
|
|
43
|
+
let settings: {};
|
|
44
|
+
let properties: {};
|
|
45
|
+
let project: string;
|
|
46
|
+
let controller: string;
|
|
47
|
+
let revisions: string;
|
|
48
|
+
let submissionRevisions: string;
|
|
49
|
+
let _vid: number;
|
|
50
|
+
let created: string;
|
|
51
|
+
let modified: string;
|
|
52
|
+
let machineName: string;
|
|
53
|
+
}
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
_id: '669e1c88a40e327e67e7d1c5',
|
|
5
|
+
title: 'editGrid test',
|
|
6
|
+
name: 'editGridTest',
|
|
7
|
+
path: 'editgridtest',
|
|
8
|
+
type: 'form',
|
|
9
|
+
display: 'form',
|
|
10
|
+
owner: '637b2e6b48c1227e60b1f910',
|
|
11
|
+
components: [
|
|
12
|
+
{
|
|
13
|
+
label: 'Edit Grid',
|
|
14
|
+
tableView: false,
|
|
15
|
+
modal: false,
|
|
16
|
+
validateWhenHidden: false,
|
|
17
|
+
rowDrafts: false,
|
|
18
|
+
key: 'editGrid',
|
|
19
|
+
type: 'editgrid',
|
|
20
|
+
displayAsTable: false,
|
|
21
|
+
input: true,
|
|
22
|
+
components: [
|
|
23
|
+
{
|
|
24
|
+
label: 'Text Field',
|
|
25
|
+
applyMaskOn: 'change',
|
|
26
|
+
tableView: true,
|
|
27
|
+
validateWhenHidden: false,
|
|
28
|
+
key: 'textField',
|
|
29
|
+
type: 'textfield',
|
|
30
|
+
input: true,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'button',
|
|
36
|
+
label: 'Submit',
|
|
37
|
+
key: 'submit',
|
|
38
|
+
disableOnInvalid: true,
|
|
39
|
+
input: true,
|
|
40
|
+
tableView: false,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
pdfComponents: [],
|
|
44
|
+
settings: {},
|
|
45
|
+
properties: {},
|
|
46
|
+
project: '669e1c68a40e327e67e7cedd',
|
|
47
|
+
controller: '',
|
|
48
|
+
revisions: '',
|
|
49
|
+
submissionRevisions: '',
|
|
50
|
+
_vid: 0,
|
|
51
|
+
created: '2024-07-22T08:47:04.399Z',
|
|
52
|
+
modified: '2024-07-22T10:04:23.474Z',
|
|
53
|
+
machineName: 'authoring-qzdhayddccjauyr:editGridTest',
|
|
54
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let type: string;
|
|
3
|
+
let display: string;
|
|
4
|
+
let components: ({
|
|
5
|
+
title: string;
|
|
6
|
+
breadcrumbClickable: boolean;
|
|
7
|
+
buttonSettings: {
|
|
8
|
+
previous: boolean;
|
|
9
|
+
cancel: boolean;
|
|
10
|
+
next: boolean;
|
|
11
|
+
};
|
|
12
|
+
collapsible: boolean;
|
|
13
|
+
tableView: boolean;
|
|
14
|
+
key: string;
|
|
15
|
+
type: string;
|
|
16
|
+
label: string;
|
|
17
|
+
input: boolean;
|
|
18
|
+
components: {
|
|
19
|
+
label: string;
|
|
20
|
+
tableView: boolean;
|
|
21
|
+
rowDrafts: boolean;
|
|
22
|
+
key: string;
|
|
23
|
+
type: string;
|
|
24
|
+
input: boolean;
|
|
25
|
+
components: {
|
|
26
|
+
label: string;
|
|
27
|
+
tableView: boolean;
|
|
28
|
+
key: string;
|
|
29
|
+
type: string;
|
|
30
|
+
input: boolean;
|
|
31
|
+
alwaysEnabled: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
alwaysEnabled: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
alwaysEnabled: boolean;
|
|
36
|
+
showValidations?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
label: string;
|
|
39
|
+
showValidations: boolean;
|
|
40
|
+
alwaysEnabled: boolean;
|
|
41
|
+
tableView: boolean;
|
|
42
|
+
key: string;
|
|
43
|
+
type: string;
|
|
44
|
+
input: boolean;
|
|
45
|
+
title?: undefined;
|
|
46
|
+
breadcrumbClickable?: undefined;
|
|
47
|
+
buttonSettings?: undefined;
|
|
48
|
+
collapsible?: undefined;
|
|
49
|
+
components?: undefined;
|
|
50
|
+
})[];
|
|
51
|
+
}
|
|
52
|
+
export default _default;
|