@formio/js 5.6.0 → 5.7.0-api912.2
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/dist/formio.builder.css +5 -5
- package/dist/formio.builder.min.css +1 -1
- 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.css +5 -5
- package/dist/formio.form.js +5218 -5191
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.css +5 -5
- package/dist/formio.full.js +6073 -6046
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- package/dist/formio.js +1215 -1188
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +3 -1
- package/dist/formio.utils.js +1106 -1079
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/lib/cjs/Embed.js +38 -25
- package/lib/cjs/Form.d.ts +8 -2
- package/lib/cjs/Form.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.d.ts +1 -0
- package/lib/cjs/PDF.js +21 -5
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +1 -0
- package/lib/cjs/Webform.d.ts +13 -1
- package/lib/cjs/Webform.js +79 -26
- package/lib/cjs/Wizard.d.ts +1 -1
- package/lib/cjs/Wizard.js +12 -6
- package/lib/cjs/components/Components.js +1 -5
- package/lib/cjs/components/_classes/component/Component.d.ts +14 -0
- package/lib/cjs/components/_classes/component/Component.js +33 -65
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +10 -8
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +20 -0
- package/lib/cjs/components/datagrid/DataGrid.js +2 -6
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/cjs/components/editgrid/EditGrid.js +22 -2
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/cjs/components/form/Form.js +21 -1
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.d.ts +11 -0
- package/lib/cjs/components/number/Number.js +35 -0
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/password/editForm/Password.edit.display.js +12 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -0
- 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/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/utils/formUtils.d.ts +3 -0
- package/lib/cjs/utils/formUtils.js +5 -2
- package/lib/cjs/utils/index.d.ts +3 -0
- package/lib/cjs/utils/utils.js +6 -18
- package/lib/mjs/Embed.js +37 -24
- package/lib/mjs/Form.d.ts +8 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.d.ts +1 -0
- package/lib/mjs/PDF.js +21 -5
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +1 -0
- package/lib/mjs/Webform.d.ts +13 -1
- package/lib/mjs/Webform.js +75 -24
- package/lib/mjs/Wizard.d.ts +1 -1
- package/lib/mjs/Wizard.js +12 -6
- package/lib/mjs/components/Components.js +1 -5
- package/lib/mjs/components/_classes/component/Component.d.ts +14 -0
- package/lib/mjs/components/_classes/component/Component.js +33 -65
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +10 -8
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +20 -0
- package/lib/mjs/components/datagrid/DataGrid.js +2 -6
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/mjs/components/editgrid/EditGrid.js +22 -2
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/mjs/components/form/Form.js +21 -1
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.d.ts +11 -0
- package/lib/mjs/components/number/Number.js +34 -0
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/password/editForm/Password.edit.display.js +12 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -0
- 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/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/utils/formUtils.d.ts +3 -0
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/index.d.ts +3 -0
- package/lib/mjs/utils/utils.js +6 -18
- package/package.json +2 -2
|
@@ -441,6 +441,39 @@ class Component extends Element_1.default {
|
|
|
441
441
|
currentRoot = currentRoot.root;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* Registers this instance in every root's `childComponentsMap`. Several components can resolve
|
|
446
|
+
* to one data path — see `getSharedPathKey` in `@formio/core` for the rule this follows.
|
|
447
|
+
* @returns {void}
|
|
448
|
+
*/
|
|
449
|
+
registerComponentInstance() {
|
|
450
|
+
const path = this.path;
|
|
451
|
+
if (!path) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// Recorded on every instance, not just the ones that lose the race for the path: it names
|
|
455
|
+
// this registration for `unregisterComponentInstance()`, which can run after `path` changed.
|
|
456
|
+
this.sharedPathKey = utils_1.default.getSharedPathKey(path, this.component.key);
|
|
457
|
+
this.eachRootChildComponentsMap((map) => {
|
|
458
|
+
utils_1.default.registerInstanceAtPath(map, path, this.component.key, this);
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Removes this instance from every root's `childComponentsMap`.
|
|
463
|
+
* @param {string} [path] - The path this instance was registered under, when it has since
|
|
464
|
+
* been re-keyed (a DataGrid row index change regenerates paths before unregistering).
|
|
465
|
+
* @returns {void}
|
|
466
|
+
*/
|
|
467
|
+
unregisterComponentInstance(path = this.path) {
|
|
468
|
+
this.eachRootChildComponentsMap((map) => {
|
|
469
|
+
if (map[path] === this) {
|
|
470
|
+
delete map[path];
|
|
471
|
+
}
|
|
472
|
+
if (this.sharedPathKey && map[this.sharedPathKey] === this) {
|
|
473
|
+
delete map[this.sharedPathKey];
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
444
477
|
/**
|
|
445
478
|
* Returns if the parent should conditionally clear.
|
|
446
479
|
*
|
|
@@ -2573,19 +2606,6 @@ class Component extends Element_1.default {
|
|
|
2573
2606
|
return Promise.resolve(editor);
|
|
2574
2607
|
}
|
|
2575
2608
|
else {
|
|
2576
|
-
// Due to an issue with ckeditor not loading styles in the shadowdom (https://github.com/ckeditor/ckeditor5/issues/15824), we need to copy cke-styles to the shadowdom
|
|
2577
|
-
let current = element;
|
|
2578
|
-
while (current) {
|
|
2579
|
-
if (current instanceof ShadowRoot) {
|
|
2580
|
-
const ckeStyles = document.querySelector('style[data-cke="true"]');
|
|
2581
|
-
const clone = document.createElement('style');
|
|
2582
|
-
clone.setAttribute('data-cke', 'true');
|
|
2583
|
-
clone.textContent = ckeStyles.textContent;
|
|
2584
|
-
current.prepend(clone);
|
|
2585
|
-
break;
|
|
2586
|
-
}
|
|
2587
|
-
current = current.parentNode || current.host;
|
|
2588
|
-
}
|
|
2589
2609
|
return ClassicEditor.create(element, settings).then((editor) => {
|
|
2590
2610
|
editor.model.document.on('change', () => onChange(editor.data.get()));
|
|
2591
2611
|
return editor;
|
|
@@ -2606,58 +2626,6 @@ class Component extends Element_1.default {
|
|
|
2606
2626
|
return Promise.reject();
|
|
2607
2627
|
}
|
|
2608
2628
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2609
|
-
const root = element.getRootNode();
|
|
2610
|
-
if (root instanceof ShadowRoot && root.getSelection) {
|
|
2611
|
-
const sel = this.quill.selection;
|
|
2612
|
-
// 1. getNativeRange: read selection from shadowRoot instead of document
|
|
2613
|
-
sel.getNativeRange = () => {
|
|
2614
|
-
const shadowSelection = root.getSelection();
|
|
2615
|
-
if (shadowSelection == null || shadowSelection.rangeCount <= 0)
|
|
2616
|
-
return null;
|
|
2617
|
-
const nativeRange = shadowSelection.getRangeAt(0);
|
|
2618
|
-
if (nativeRange == null)
|
|
2619
|
-
return null;
|
|
2620
|
-
return sel.normalizeNative(nativeRange);
|
|
2621
|
-
};
|
|
2622
|
-
// 2. hasFocus: check shadowRoot.activeElement instead of document.activeElement
|
|
2623
|
-
sel.hasFocus = () => {
|
|
2624
|
-
return (root.activeElement === sel.root ||
|
|
2625
|
-
(root.activeElement != null && sel.root.contains(root.activeElement)));
|
|
2626
|
-
};
|
|
2627
|
-
// 3. setNativeRange: use shadowRoot's selection to add/remove ranges
|
|
2628
|
-
const origSetNativeRange = sel.setNativeRange.bind(sel);
|
|
2629
|
-
sel.setNativeRange = (startNode, startOffset, endNode, endOffset, force) => {
|
|
2630
|
-
// Delegate to original logic for the null case (blur)
|
|
2631
|
-
if (startNode == null) {
|
|
2632
|
-
origSetNativeRange(null);
|
|
2633
|
-
return;
|
|
2634
|
-
}
|
|
2635
|
-
if (!sel.hasFocus()) {
|
|
2636
|
-
sel.root.focus({ preventScroll: true });
|
|
2637
|
-
}
|
|
2638
|
-
const shadowSelection = root.getSelection();
|
|
2639
|
-
if (shadowSelection == null)
|
|
2640
|
-
return;
|
|
2641
|
-
const { native } = sel.getNativeRange() || {};
|
|
2642
|
-
endNode = endNode !== null && endNode !== void 0 ? endNode : startNode;
|
|
2643
|
-
endOffset = endOffset !== null && endOffset !== void 0 ? endOffset : startOffset;
|
|
2644
|
-
if (native == null ||
|
|
2645
|
-
force ||
|
|
2646
|
-
startNode !== native.startContainer ||
|
|
2647
|
-
startOffset !== native.startOffset ||
|
|
2648
|
-
endNode !== native.endContainer ||
|
|
2649
|
-
endOffset !== native.endOffset) {
|
|
2650
|
-
const range = document.createRange();
|
|
2651
|
-
range.setStart(startNode, startOffset);
|
|
2652
|
-
range.setEnd(endNode, endOffset);
|
|
2653
|
-
shadowSelection.removeAllRanges();
|
|
2654
|
-
shadowSelection.addRange(range);
|
|
2655
|
-
}
|
|
2656
|
-
};
|
|
2657
|
-
document.addEventListener('selectionchange', () => {
|
|
2658
|
-
sel.update();
|
|
2659
|
-
});
|
|
2660
|
-
}
|
|
2661
2629
|
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
|
|
2662
2630
|
const txtArea = document.createElement('textarea');
|
|
2663
2631
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
@@ -11,6 +11,19 @@ const Components_1 = __importDefault(require("../../Components"));
|
|
|
11
11
|
*/
|
|
12
12
|
function default_1(...extend) {
|
|
13
13
|
return Components_1.default.baseEditForm([
|
|
14
|
+
{
|
|
15
|
+
key: 'display',
|
|
16
|
+
components: [
|
|
17
|
+
{
|
|
18
|
+
key: 'labelWidth',
|
|
19
|
+
ignore: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: 'labelMargin',
|
|
23
|
+
ignore: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
14
27
|
{
|
|
15
28
|
key: 'data',
|
|
16
29
|
ignore: true,
|
|
@@ -557,11 +557,7 @@ class NestedComponent extends Field_1.default {
|
|
|
557
557
|
components = components || this.components;
|
|
558
558
|
component.destroy(all);
|
|
559
559
|
lodash_1.default.remove(components, { id: component.id });
|
|
560
|
-
component.
|
|
561
|
-
if (map[component.path]) {
|
|
562
|
-
delete map[component.path];
|
|
563
|
-
}
|
|
564
|
-
});
|
|
560
|
+
component.unregisterComponentInstance();
|
|
565
561
|
}
|
|
566
562
|
/**
|
|
567
563
|
* Removes a component provided the API key of that component.
|
|
@@ -671,9 +667,11 @@ class NestedComponent extends Field_1.default {
|
|
|
671
667
|
var _a;
|
|
672
668
|
const { dirty } = flags;
|
|
673
669
|
if (this.root && this.root.hasSubWizards && this.page !== this.root.page) {
|
|
674
|
-
instance
|
|
675
|
-
|
|
676
|
-
|
|
670
|
+
// `instance` was resolved by @formio/core against this very map, shared-path rule and
|
|
671
|
+
// all, so only fill in what that lookup cannot reach: components keyed by their data
|
|
672
|
+
// path where core looked under a full path, and components absent from the map.
|
|
673
|
+
instance =
|
|
674
|
+
instance || ((_a = this.componentsMap) === null || _a === void 0 ? void 0 : _a[paths.dataPath]) || this.getComponent(paths.dataPath);
|
|
677
675
|
}
|
|
678
676
|
if (!instance) {
|
|
679
677
|
return;
|
|
@@ -833,6 +831,10 @@ class NestedComponent extends Field_1.default {
|
|
|
833
831
|
// if no value is provided and noDefault flag, set empty value
|
|
834
832
|
else if (flags.noDefault && component.allowData) {
|
|
835
833
|
flags.resetValue = true;
|
|
834
|
+
// Preserve the live value instead of wiping it, so client-side calculations that read it don't blank out.
|
|
835
|
+
if (component.component.persistent === 'client-only') {
|
|
836
|
+
return false;
|
|
837
|
+
}
|
|
836
838
|
return component.setValue(component.emptyValue, flags);
|
|
837
839
|
}
|
|
838
840
|
else if ((!this.rootPristine || component.visible) &&
|
|
@@ -5,10 +5,30 @@ exports.default = [
|
|
|
5
5
|
key: 'inputMask',
|
|
6
6
|
ignore: true,
|
|
7
7
|
},
|
|
8
|
+
{
|
|
9
|
+
key: 'widget.type',
|
|
10
|
+
ignore: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: 'widget',
|
|
14
|
+
ignore: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'inputMasks',
|
|
18
|
+
ignore: true,
|
|
19
|
+
},
|
|
8
20
|
{
|
|
9
21
|
key: 'allowMultipleMasks',
|
|
10
22
|
ignore: true,
|
|
11
23
|
},
|
|
24
|
+
{
|
|
25
|
+
key: 'labelWidth',
|
|
26
|
+
ignore: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: 'labelMargin',
|
|
30
|
+
ignore: true,
|
|
31
|
+
},
|
|
12
32
|
{
|
|
13
33
|
key: 'showWordCount',
|
|
14
34
|
ignore: true,
|
|
@@ -436,12 +436,8 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
436
436
|
component.rowIndex = rowIndex;
|
|
437
437
|
component.row = `${rowIndex}-${colIndex}`;
|
|
438
438
|
entries.forEach(({ instance, oldPath }) => {
|
|
439
|
-
instance.
|
|
440
|
-
|
|
441
|
-
delete map[oldPath];
|
|
442
|
-
}
|
|
443
|
-
map[instance.paths.dataPath] = instance;
|
|
444
|
-
});
|
|
439
|
+
instance.unregisterComponentInstance(oldPath);
|
|
440
|
+
instance.registerComponentInstance();
|
|
445
441
|
});
|
|
446
442
|
});
|
|
447
443
|
}
|
|
@@ -48,6 +48,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
48
48
|
setVariableTypeComponents(): void;
|
|
49
49
|
variableTypeComponentsIndexes: any[] | undefined;
|
|
50
50
|
isOpen(editRow: any): boolean;
|
|
51
|
+
shouldBlockUnsavedOpenRows(): boolean;
|
|
51
52
|
isComponentVisibleInSomeRow(component: any): any;
|
|
52
53
|
visibleInHeader: any;
|
|
53
54
|
flattenRowDataValue(dataValue: any): {};
|
|
@@ -315,6 +315,24 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
315
315
|
isOpen(editRow) {
|
|
316
316
|
return [EditRowState.New, EditRowState.Editing, EditRowState.Viewing].includes(editRow.state);
|
|
317
317
|
}
|
|
318
|
+
shouldBlockUnsavedOpenRows() {
|
|
319
|
+
const openRows = this.editRows.filter((editRow) => this.isOpen(editRow));
|
|
320
|
+
if (!openRows.length) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
const isOnlyPristineOpenWhenEmptyRow = this.component.openWhenEmpty &&
|
|
324
|
+
openRows.length === 1 &&
|
|
325
|
+
openRows.every((row) => row.state === EditRowState.New) &&
|
|
326
|
+
openRows.every((row) => {
|
|
327
|
+
let isPristine = true;
|
|
328
|
+
(0, utils_1.eachComponent)(row.components, (comp) => {
|
|
329
|
+
isPristine =
|
|
330
|
+
comp.type === 'form' ? lodash_1.default.isEqual(comp.emptyValue, comp.dataValue) : comp.pristine;
|
|
331
|
+
});
|
|
332
|
+
return isPristine;
|
|
333
|
+
});
|
|
334
|
+
return !isOnlyPristineOpenWhenEmptyRow;
|
|
335
|
+
}
|
|
318
336
|
isComponentVisibleInSomeRow(component) {
|
|
319
337
|
const rows = this.editRows;
|
|
320
338
|
const savedStates = [EditRowState.Saved, EditRowState.Editing, EditRowState.Draft];
|
|
@@ -1079,7 +1097,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1079
1097
|
if (valid === null) {
|
|
1080
1098
|
editRow.errors.push({
|
|
1081
1099
|
type: 'error',
|
|
1082
|
-
message: this.t('componentInvalidRowValidation', { componentKey: this.key })
|
|
1100
|
+
message: this.t('componentInvalidRowValidation', { componentKey: this.key }),
|
|
1083
1101
|
});
|
|
1084
1102
|
}
|
|
1085
1103
|
}
|
|
@@ -1152,7 +1170,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1152
1170
|
}
|
|
1153
1171
|
return false;
|
|
1154
1172
|
}
|
|
1155
|
-
else if (rowsEditing &&
|
|
1173
|
+
else if (rowsEditing &&
|
|
1174
|
+
this.saveEditMode &&
|
|
1175
|
+
(this.shouldBlockUnsavedOpenRows() || this.errors.length)) {
|
|
1156
1176
|
this._errors = this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
|
1157
1177
|
errors.push(...this._errors);
|
|
1158
1178
|
return false;
|
|
@@ -9,6 +9,18 @@ exports.default = [
|
|
|
9
9
|
key: 'allowMultipleMasks',
|
|
10
10
|
ignore: true,
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
key: 'inputMasks',
|
|
14
|
+
ignore: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'widget.type',
|
|
18
|
+
ignore: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: 'widget',
|
|
22
|
+
ignore: true,
|
|
23
|
+
},
|
|
12
24
|
{
|
|
13
25
|
key: 'showWordCount',
|
|
14
26
|
ignore: true,
|
|
@@ -295,7 +295,7 @@ exports.default = [
|
|
|
295
295
|
key: 'imageSize',
|
|
296
296
|
label: 'Image Size',
|
|
297
297
|
placeholder: '100',
|
|
298
|
-
tooltip: 'The image size, in square pixels, for previewing images.',
|
|
298
|
+
tooltip: 'The image size, in square pixels, for previewing images. If explicitly set, the frame of the component must be large enough to allow for the specified size.',
|
|
299
299
|
weight: 40,
|
|
300
300
|
clearOnHide: false,
|
|
301
301
|
conditional: {
|
|
@@ -273,7 +273,7 @@ class FormComponent extends Component_1.default {
|
|
|
273
273
|
return super.attach(element);
|
|
274
274
|
}
|
|
275
275
|
return super.attach(element).then(() => {
|
|
276
|
-
if (this.isSubFormLazyLoad() && !this.
|
|
276
|
+
if (this.isSubFormLazyLoad() && !this.subForm && !this.subFormLoading) {
|
|
277
277
|
this.createSubForm(true);
|
|
278
278
|
}
|
|
279
279
|
if (!this.subFormReady) {
|
|
@@ -372,6 +372,26 @@ class FormComponent extends Component_1.default {
|
|
|
372
372
|
}
|
|
373
373
|
return super.redraw();
|
|
374
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Get Row Index. Declared so the setter below does not shadow the inherited getter.
|
|
377
|
+
* @returns {number} - The row index.
|
|
378
|
+
*/
|
|
379
|
+
get rowIndex() {
|
|
380
|
+
return super.rowIndex;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Set Row Index to row and pass it down to the subform so that its components
|
|
384
|
+
* regenerate their paths. Unlike NestedComponent, the subform is not part of
|
|
385
|
+
* this.components, so the row index has to be forwarded explicitly.
|
|
386
|
+
* @param {number} value - The row index.
|
|
387
|
+
* @returns {void}
|
|
388
|
+
*/
|
|
389
|
+
set rowIndex(value) {
|
|
390
|
+
super.rowIndex = value;
|
|
391
|
+
if (this.subForm) {
|
|
392
|
+
this.subForm.rowIndex = value;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
375
395
|
/**
|
|
376
396
|
* Pass everyComponent to subform.
|
|
377
397
|
* @param {any[]} args - Arguments to pass through to the subform's everyComponent method.
|
|
@@ -51,5 +51,16 @@ export default class NumberComponent extends Input {
|
|
|
51
51
|
focus(): void;
|
|
52
52
|
getMaskedValue(value: any): any;
|
|
53
53
|
getValueAsString(value: any, options: any): any;
|
|
54
|
+
setErrorClasses(elements: any, dirty: any, hasErrors: any, hasMessages: any, element?: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* Points the invalid inputs at the rendered error messages through `aria-describedby`, so a
|
|
57
|
+
* screen reader announces what is wrong with the value. The base class only marks the input
|
|
58
|
+
* `aria-invalid`, which says the value was rejected but not why.
|
|
59
|
+
* @param {Array<HTMLElement>} elements - The input elements the errors apply to.
|
|
60
|
+
* @param {boolean} hasErrors - TRUE if the component currently has errors.
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
linkErrorMessages(elements: Array<HTMLElement>, hasErrors: boolean): void;
|
|
64
|
+
errorMessageIds: any[] | undefined;
|
|
54
65
|
}
|
|
55
66
|
import Input from '../_classes/input/Input';
|
|
@@ -271,5 +271,40 @@ class NumberComponent extends Input_1.default {
|
|
|
271
271
|
element.value = this.getValueAsString(this.formatValue(this.parseValue(element.value)));
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
+
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
275
|
+
super.setErrorClasses(elements, dirty, hasErrors, hasMessages, element);
|
|
276
|
+
this.linkErrorMessages(elements, hasErrors);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Points the invalid inputs at the rendered error messages through `aria-describedby`, so a
|
|
280
|
+
* screen reader announces what is wrong with the value. The base class only marks the input
|
|
281
|
+
* `aria-invalid`, which says the value was rejected but not why.
|
|
282
|
+
* @param {Array<HTMLElement>} elements - The input elements the errors apply to.
|
|
283
|
+
* @param {boolean} hasErrors - TRUE if the component currently has errors.
|
|
284
|
+
* @returns {void}
|
|
285
|
+
*/
|
|
286
|
+
linkErrorMessages(elements, hasErrors) {
|
|
287
|
+
var _a;
|
|
288
|
+
const previousIds = this.errorMessageIds || [];
|
|
289
|
+
const renderedMessages = Array.from(((_a = this.refs.messageContainer) === null || _a === void 0 ? void 0 : _a.children) || []);
|
|
290
|
+
const errorIds = hasErrors ? renderedMessages.map((message) => message.id).filter(Boolean) : [];
|
|
291
|
+
const invalidInputs = hasErrors ? Array.from(elements || []) : [];
|
|
292
|
+
const isOwnErrorId = (id) => previousIds.includes(id) || errorIds.includes(id);
|
|
293
|
+
Array.from(this.refs.input || []).forEach((input) => {
|
|
294
|
+
const describedBy = (input.getAttribute('aria-describedby') || '')
|
|
295
|
+
.split(' ')
|
|
296
|
+
.filter((id) => id && !isOwnErrorId(id));
|
|
297
|
+
if (invalidInputs.includes(input)) {
|
|
298
|
+
describedBy.push(...errorIds);
|
|
299
|
+
}
|
|
300
|
+
if (describedBy.length) {
|
|
301
|
+
input.setAttribute('aria-describedby', describedBy.join(' '));
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
input.removeAttribute('aria-describedby');
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
this.errorMessageIds = errorIds;
|
|
308
|
+
}
|
|
274
309
|
}
|
|
275
310
|
exports.default = NumberComponent;
|
|
@@ -13,6 +13,18 @@ exports.default = [
|
|
|
13
13
|
key: 'allowMultipleMasks',
|
|
14
14
|
ignore: true,
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
key: 'inputMasks',
|
|
18
|
+
ignore: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: 'widget.type',
|
|
22
|
+
ignore: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: 'widget',
|
|
26
|
+
ignore: true,
|
|
27
|
+
},
|
|
16
28
|
{
|
|
17
29
|
key: 'showWordCount',
|
|
18
30
|
ignore: true,
|
|
@@ -1057,6 +1057,7 @@ declare const _default: ({
|
|
|
1057
1057
|
alwaysEnabled?: undefined;
|
|
1058
1058
|
} | {
|
|
1059
1059
|
key: string;
|
|
1060
|
+
type: string;
|
|
1060
1061
|
conditional: {
|
|
1061
1062
|
json: {
|
|
1062
1063
|
and: ({
|
|
@@ -1107,7 +1108,6 @@ declare const _default: ({
|
|
|
1107
1108
|
};
|
|
1108
1109
|
};
|
|
1109
1110
|
data?: undefined;
|
|
1110
|
-
type?: undefined;
|
|
1111
1111
|
as?: undefined;
|
|
1112
1112
|
editor?: undefined;
|
|
1113
1113
|
weight?: undefined;
|
|
@@ -14,10 +14,22 @@ exports.default = [
|
|
|
14
14
|
key: 'allowMultipleMasks',
|
|
15
15
|
ignore: true,
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
key: 'inputMasks',
|
|
19
|
+
ignore: true,
|
|
20
|
+
},
|
|
17
21
|
{
|
|
18
22
|
key: 'mask',
|
|
19
23
|
ignore: true,
|
|
20
24
|
},
|
|
25
|
+
{
|
|
26
|
+
key: 'widget.type',
|
|
27
|
+
ignore: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: 'widget',
|
|
31
|
+
ignore: true,
|
|
32
|
+
},
|
|
21
33
|
{
|
|
22
34
|
type: 'number',
|
|
23
35
|
input: true,
|
|
@@ -9,6 +9,18 @@ exports.default = [
|
|
|
9
9
|
key: 'allowMultipleMasks',
|
|
10
10
|
ignore: true,
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
key: 'inputMasks',
|
|
14
|
+
ignore: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'widget.type',
|
|
18
|
+
ignore: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: 'widget',
|
|
22
|
+
ignore: true,
|
|
23
|
+
},
|
|
12
24
|
{
|
|
13
25
|
key: 'showWordCount',
|
|
14
26
|
ignore: true,
|
package/lib/cjs/package.json
CHANGED