@formio/js 5.4.0 → 5.4.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/README.md +11 -5
- package/dist/formio.builder.css +12 -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 +12 -5
- package/dist/formio.form.js +2883 -2867
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +12 -5
- package/dist/formio.full.js +3507 -3491
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +1139 -1145
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +1066 -1072
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Embed.js +8 -16
- package/lib/cjs/Form.js +4 -4
- package/lib/cjs/Formio.js +2 -9
- package/lib/cjs/InlineEmbed.js +1 -4
- package/lib/cjs/PDF.js +28 -8
- package/lib/cjs/PDFBuilder.js +6 -10
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +19 -34
- package/lib/cjs/WebformBuilder.js +27 -68
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +44 -31
- package/lib/cjs/WizardBuilder.js +5 -15
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/cjs/addons/index.js +1 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +10 -5
- package/lib/cjs/components/_classes/component/Component.js +76 -134
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/cjs/components/_classes/field/Field.js +1 -4
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/cjs/components/address/Address.js +10 -30
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/cjs/components/alert/Alert.js +3 -6
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +31 -17
- package/lib/cjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/cjs/components/checkbox/Checkbox.js +4 -10
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/cjs/components/columns/Columns.js +5 -17
- package/lib/cjs/components/container/Container.js +1 -3
- package/lib/cjs/components/currency/Currency.js +2 -7
- package/lib/cjs/components/datagrid/DataGrid.js +27 -68
- package/lib/cjs/components/datamap/DataMap.js +4 -16
- package/lib/cjs/components/datetime/DateTime.js +2 -6
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/cjs/components/day/Day.js +12 -70
- package/lib/cjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/cjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/cjs/components/editgrid/EditGrid.js +18 -44
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/cjs/components/file/File.js +40 -70
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/cjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/cjs/components/form/Form.js +5 -7
- package/lib/cjs/components/html/HTML.js +1 -5
- package/lib/cjs/components/number/Number.js +2 -4
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/cjs/components/password/Password.js +1 -4
- package/lib/cjs/components/radio/Radio.js +7 -17
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/cjs/components/select/Select.js +49 -94
- package/lib/cjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +5 -10
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/cjs/components/survey/Survey.js +6 -17
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/cjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/cjs/components/tabs/Tabs.js +4 -19
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/cjs/components/tags/Tags.js +4 -14
- package/lib/cjs/components/textarea/TextArea.js +8 -15
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/cjs/components/textfield/TextField.js +4 -4
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/cjs/components/time/Time.js +1 -4
- package/lib/cjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/AddressProvider.js +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -4
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +5 -6
- package/lib/cjs/providers/storage/indexeddb.js +5 -15
- package/lib/cjs/providers/storage/s3.js +3 -14
- package/lib/cjs/providers/storage/xhr.js +19 -28
- package/lib/cjs/templates/Templates.js +1 -0
- package/lib/cjs/translations/en.d.ts +237 -81
- package/lib/cjs/translations/en.js +10 -81
- package/lib/cjs/utils/ChoicesWrapper.js +1 -1
- package/lib/cjs/utils/builder.js +5 -26
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +33 -12
- package/lib/cjs/utils/utils.js +42 -52
- package/lib/cjs/widgets/CalendarWidget.js +2 -6
- package/lib/mjs/Embed.js +8 -16
- package/lib/mjs/Form.js +4 -4
- package/lib/mjs/Formio.js +2 -9
- package/lib/mjs/InlineEmbed.js +1 -4
- package/lib/mjs/PDF.js +27 -8
- package/lib/mjs/PDFBuilder.js +6 -10
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +19 -31
- package/lib/mjs/WebformBuilder.js +27 -68
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +39 -27
- package/lib/mjs/WizardBuilder.js +5 -15
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/mjs/addons/index.js +1 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +10 -5
- package/lib/mjs/components/_classes/component/Component.js +75 -134
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/mjs/components/_classes/field/Field.js +1 -4
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/mjs/components/address/Address.js +10 -30
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/mjs/components/alert/Alert.js +3 -6
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +29 -16
- package/lib/mjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/mjs/components/checkbox/Checkbox.js +4 -10
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/mjs/components/columns/Columns.js +5 -17
- package/lib/mjs/components/container/Container.js +1 -3
- package/lib/mjs/components/currency/Currency.js +2 -7
- package/lib/mjs/components/datagrid/DataGrid.js +28 -69
- package/lib/mjs/components/datamap/DataMap.js +12 -18
- package/lib/mjs/components/datetime/DateTime.js +2 -6
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/mjs/components/day/Day.js +12 -70
- package/lib/mjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/mjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/mjs/components/editgrid/EditGrid.js +18 -44
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/mjs/components/file/File.js +40 -70
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/mjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/mjs/components/form/Form.js +5 -7
- package/lib/mjs/components/html/HTML.js +1 -5
- package/lib/mjs/components/number/Number.js +2 -4
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/mjs/components/password/Password.js +1 -4
- package/lib/mjs/components/radio/Radio.js +7 -17
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/mjs/components/select/Select.js +52 -97
- package/lib/mjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +5 -10
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/mjs/components/survey/Survey.js +6 -17
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/mjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/mjs/components/tabs/Tabs.js +4 -19
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/mjs/components/tags/Tags.js +4 -14
- package/lib/mjs/components/textarea/TextArea.js +8 -15
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/mjs/components/textfield/TextField.js +4 -4
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/mjs/components/time/Time.js +1 -4
- package/lib/mjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/mjs/formio.form.js +6 -6
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/AddressProvider.js +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -4
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +5 -6
- package/lib/mjs/providers/storage/indexeddb.js +5 -15
- package/lib/mjs/providers/storage/s3.js +3 -14
- package/lib/mjs/providers/storage/xhr.js +19 -32
- package/lib/mjs/templates/Templates.js +1 -0
- package/lib/mjs/translations/en.d.ts +237 -81
- package/lib/mjs/translations/en.js +91 -1
- package/lib/mjs/utils/ChoicesWrapper.js +1 -1
- package/lib/mjs/utils/builder.js +5 -26
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +33 -12
- package/lib/mjs/utils/utils.js +42 -52
- package/lib/mjs/widgets/CalendarWidget.js +2 -6
- package/package.json +8 -6
|
@@ -170,12 +170,7 @@ export default class Component extends Element {
|
|
|
170
170
|
*/
|
|
171
171
|
static get conditionOperatorsSettings() {
|
|
172
172
|
return {
|
|
173
|
-
operators: [
|
|
174
|
-
'isEqual',
|
|
175
|
-
'isNotEqual',
|
|
176
|
-
'isEmpty',
|
|
177
|
-
'isNotEmpty',
|
|
178
|
-
],
|
|
173
|
+
operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
|
|
179
174
|
valueComponent() {
|
|
180
175
|
return {
|
|
181
176
|
type: 'textfield',
|
|
@@ -193,9 +188,7 @@ export default class Component extends Element {
|
|
|
193
188
|
*/
|
|
194
189
|
static savedValueTypes(schema) {
|
|
195
190
|
schema = schema || {};
|
|
196
|
-
return
|
|
197
|
-
FormioUtils.componentValueTypes.any,
|
|
198
|
-
]);
|
|
191
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.any];
|
|
199
192
|
}
|
|
200
193
|
/**
|
|
201
194
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
@@ -463,7 +456,9 @@ export default class Component extends Element {
|
|
|
463
456
|
hasCondionallyHiddenLayoutParent() {
|
|
464
457
|
let currentParent = this.parent;
|
|
465
458
|
while (currentParent) {
|
|
466
|
-
if (currentParent._conditionallyHidden &&
|
|
459
|
+
if (currentParent._conditionallyHidden &&
|
|
460
|
+
FormioUtils.isLayoutComponent(currentParent) &&
|
|
461
|
+
currentParent.component.clearOnHide === true) {
|
|
467
462
|
return true;
|
|
468
463
|
}
|
|
469
464
|
currentParent = currentParent.parent;
|
|
@@ -587,7 +582,10 @@ export default class Component extends Element {
|
|
|
587
582
|
this.addons.push(addon);
|
|
588
583
|
}
|
|
589
584
|
else {
|
|
590
|
-
console.warn(
|
|
585
|
+
console.warn(this.t('addonSupportTypeError', {
|
|
586
|
+
type: this.component.type,
|
|
587
|
+
label: name.label,
|
|
588
|
+
}));
|
|
591
589
|
}
|
|
592
590
|
}
|
|
593
591
|
return addon;
|
|
@@ -641,7 +639,7 @@ export default class Component extends Element {
|
|
|
641
639
|
return this.paths.dataPath;
|
|
642
640
|
}
|
|
643
641
|
set path(path) {
|
|
644
|
-
throw new Error(
|
|
642
|
+
throw new Error(this.t('setPathError'));
|
|
645
643
|
}
|
|
646
644
|
set parentVisible(value) {
|
|
647
645
|
this._parentVisible = value;
|
|
@@ -745,7 +743,9 @@ export default class Component extends Element {
|
|
|
745
743
|
this._conditionallyClear = true;
|
|
746
744
|
return this._conditionallyClear;
|
|
747
745
|
}
|
|
748
|
-
this._conditionallyClear = this.hasSetValue
|
|
746
|
+
this._conditionallyClear = this.hasSetValue
|
|
747
|
+
? this.hasCondionallyHiddenLayoutParent()
|
|
748
|
+
: this.parentShouldConditionallyClear();
|
|
749
749
|
return this._conditionallyClear;
|
|
750
750
|
}
|
|
751
751
|
/**
|
|
@@ -780,7 +780,7 @@ export default class Component extends Element {
|
|
|
780
780
|
return this.options.attachMode === 'builder';
|
|
781
781
|
}
|
|
782
782
|
get calculatedPath() {
|
|
783
|
-
console.error(
|
|
783
|
+
console.error(this.t('calculatedPathDeprecation'));
|
|
784
784
|
return this.path;
|
|
785
785
|
}
|
|
786
786
|
get labelPosition() {
|
|
@@ -795,12 +795,7 @@ export default class Component extends Element {
|
|
|
795
795
|
return margin >= 0 ? margin : 3;
|
|
796
796
|
}
|
|
797
797
|
get isAdvancedLabel() {
|
|
798
|
-
return [
|
|
799
|
-
'left-left',
|
|
800
|
-
'left-right',
|
|
801
|
-
'right-left',
|
|
802
|
-
'right-right',
|
|
803
|
-
].includes(this.labelPosition);
|
|
798
|
+
return ['left-left', 'left-right', 'right-left', 'right-right'].includes(this.labelPosition);
|
|
804
799
|
}
|
|
805
800
|
get labelPositions() {
|
|
806
801
|
return this.labelPosition.split('-');
|
|
@@ -928,16 +923,8 @@ export default class Component extends Element {
|
|
|
928
923
|
: (type, value) => value;
|
|
929
924
|
}
|
|
930
925
|
getTemplate(names, modes) {
|
|
931
|
-
modes = Array.isArray(modes)
|
|
932
|
-
|
|
933
|
-
: [
|
|
934
|
-
modes,
|
|
935
|
-
];
|
|
936
|
-
names = Array.isArray(names)
|
|
937
|
-
? names
|
|
938
|
-
: [
|
|
939
|
-
names,
|
|
940
|
-
];
|
|
926
|
+
modes = Array.isArray(modes) ? modes : [modes];
|
|
927
|
+
names = Array.isArray(names) ? names : [names];
|
|
941
928
|
if (!modes.includes('form')) {
|
|
942
929
|
modes.push('form');
|
|
943
930
|
}
|
|
@@ -959,7 +946,7 @@ export default class Component extends Element {
|
|
|
959
946
|
const name = names[names.length - 1];
|
|
960
947
|
const templatesByName = Templates.defaultTemplates[name];
|
|
961
948
|
if (!templatesByName) {
|
|
962
|
-
return { template:
|
|
949
|
+
return { template: this.t('unknownTemplate', { name }) };
|
|
963
950
|
}
|
|
964
951
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
|
965
952
|
if (templateByMode) {
|
|
@@ -1028,9 +1015,7 @@ export default class Component extends Element {
|
|
|
1028
1015
|
data.disabled = this.disabled;
|
|
1029
1016
|
data.builder = this.builderMode;
|
|
1030
1017
|
data.render = (...args) => {
|
|
1031
|
-
console.warn(
|
|
1032
|
-
If you need to render template (template A) inside of another template (template B),
|
|
1033
|
-
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
|
1018
|
+
console.warn(this.t('renderTemplateFunctionDeprecation'));
|
|
1034
1019
|
return this.renderTemplate(...args);
|
|
1035
1020
|
};
|
|
1036
1021
|
data.label = data.labelInfo || this.labelInfo;
|
|
@@ -1179,9 +1164,7 @@ export default class Component extends Element {
|
|
|
1179
1164
|
if (this.options.pdf && submissionTimezone) {
|
|
1180
1165
|
return submissionTimezone;
|
|
1181
1166
|
}
|
|
1182
|
-
const staticSnapshot = this.options.server ||
|
|
1183
|
-
this.options.renderMode === 'html' ||
|
|
1184
|
-
!!this.options.viewAsHtml;
|
|
1167
|
+
const staticSnapshot = this.options.server || this.options.renderMode === 'html' || !!this.options.viewAsHtml;
|
|
1185
1168
|
if (submissionTimezone &&
|
|
1186
1169
|
(mode === 'submission' || (staticSnapshot && (mode === 'viewer' || mode === 'location')))) {
|
|
1187
1170
|
return submissionTimezone;
|
|
@@ -1212,6 +1195,19 @@ export default class Component extends Element {
|
|
|
1212
1195
|
}
|
|
1213
1196
|
}
|
|
1214
1197
|
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Announces a message to screen readers via the component's live region.
|
|
1200
|
+
* @param {string} message - The message to announce.
|
|
1201
|
+
*/
|
|
1202
|
+
announce(message) {
|
|
1203
|
+
const liveRegion = this.refs.liveRegion;
|
|
1204
|
+
if (liveRegion) {
|
|
1205
|
+
liveRegion.textContent = '';
|
|
1206
|
+
setTimeout(() => {
|
|
1207
|
+
liveRegion.textContent = message;
|
|
1208
|
+
}, 50);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1215
1211
|
/**
|
|
1216
1212
|
* Opens the modal element.
|
|
1217
1213
|
* @param {string} template - The template to use for the modal dialog.
|
|
@@ -1238,7 +1234,7 @@ export default class Component extends Element {
|
|
|
1238
1234
|
modalLabel = { className: 'field-required' };
|
|
1239
1235
|
}
|
|
1240
1236
|
return this.renderModalPreview({
|
|
1241
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
|
1237
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
|
1242
1238
|
messages: '',
|
|
1243
1239
|
labelInfo: modalLabel,
|
|
1244
1240
|
});
|
|
@@ -1263,7 +1259,7 @@ export default class Component extends Element {
|
|
|
1263
1259
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1264
1260
|
* @returns {string} - The rendered HTML string of a component.
|
|
1265
1261
|
*/
|
|
1266
|
-
render(children =
|
|
1262
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
|
1267
1263
|
const isVisible = this.visible;
|
|
1268
1264
|
this.rendered = true;
|
|
1269
1265
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
@@ -1352,6 +1348,7 @@ export default class Component extends Element {
|
|
|
1352
1348
|
this.loadRefs(element, {
|
|
1353
1349
|
messageContainer: 'single',
|
|
1354
1350
|
tooltip: 'multiple',
|
|
1351
|
+
liveRegion: 'single',
|
|
1355
1352
|
});
|
|
1356
1353
|
this.attachTooltips(this.refs.tooltip);
|
|
1357
1354
|
// Attach logic.
|
|
@@ -1471,9 +1468,7 @@ export default class Component extends Element {
|
|
|
1471
1468
|
return;
|
|
1472
1469
|
}
|
|
1473
1470
|
if (!changes.length && flags.changed) {
|
|
1474
|
-
changes = [
|
|
1475
|
-
flags.changed,
|
|
1476
|
-
];
|
|
1471
|
+
changes = [flags.changed];
|
|
1477
1472
|
}
|
|
1478
1473
|
const refreshOn = flags.fromBlur
|
|
1479
1474
|
? this.component.refreshOnBlur
|
|
@@ -1573,10 +1568,11 @@ export default class Component extends Element {
|
|
|
1573
1568
|
/**
|
|
1574
1569
|
* Uses the widget to determine the output string.
|
|
1575
1570
|
* @param {any} value - The current value of the component.
|
|
1576
|
-
* @param {any}
|
|
1571
|
+
* @param {any} _options - The options for getValueAsString.
|
|
1577
1572
|
* @returns {any|Array<any>} - The value as a string.
|
|
1578
1573
|
*/
|
|
1579
|
-
|
|
1574
|
+
// GOTCHA(G-FJS04)
|
|
1575
|
+
getWidgetValueAsString(value, _options) {
|
|
1580
1576
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
1581
1577
|
if (!value || noInputWidget) {
|
|
1582
1578
|
if (!this.widget || !value) {
|
|
@@ -1591,13 +1587,13 @@ export default class Component extends Element {
|
|
|
1591
1587
|
value.forEach((val, index) => {
|
|
1592
1588
|
const widget = this.refs.input[index] && this.refs.input[index].widget;
|
|
1593
1589
|
if (widget) {
|
|
1594
|
-
values.push(widget.getValueAsString(val
|
|
1590
|
+
values.push(widget.getValueAsString(val));
|
|
1595
1591
|
}
|
|
1596
1592
|
});
|
|
1597
1593
|
return values;
|
|
1598
1594
|
}
|
|
1599
1595
|
const widget = this.refs.input[0].widget;
|
|
1600
|
-
return widget.getValueAsString(value
|
|
1596
|
+
return widget.getValueAsString(value);
|
|
1601
1597
|
}
|
|
1602
1598
|
/**
|
|
1603
1599
|
* Returns the value of the component as a string.
|
|
@@ -1888,10 +1884,7 @@ export default class Component extends Element {
|
|
|
1888
1884
|
const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
|
|
1889
1885
|
return Templates.current.hasOwnProperty('iconClass')
|
|
1890
1886
|
? Templates.current.iconClass(iconset, name, spinning)
|
|
1891
|
-
: [
|
|
1892
|
-
'fa',
|
|
1893
|
-
'bi',
|
|
1894
|
-
].includes(this.options.iconset)
|
|
1887
|
+
: ['fa', 'bi'].includes(this.options.iconset)
|
|
1895
1888
|
? Templates.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1896
1889
|
: name;
|
|
1897
1890
|
}
|
|
@@ -2073,7 +2066,10 @@ export default class Component extends Element {
|
|
|
2073
2066
|
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
2074
2067
|
*/
|
|
2075
2068
|
conditionallyVisible(data, row) {
|
|
2076
|
-
data =
|
|
2069
|
+
data =
|
|
2070
|
+
data ||
|
|
2071
|
+
(this.root?.submissionSet && _.merge({}, this.root?.subFromServer, this.rootValue)) ||
|
|
2072
|
+
this.rootValue;
|
|
2077
2073
|
row = row || this.data;
|
|
2078
2074
|
if (this.builderMode || this.previewMode) {
|
|
2079
2075
|
return true;
|
|
@@ -2310,9 +2306,7 @@ export default class Component extends Element {
|
|
|
2310
2306
|
};
|
|
2311
2307
|
}
|
|
2312
2308
|
if (!Array.isArray(messages)) {
|
|
2313
|
-
messages = [
|
|
2314
|
-
messages,
|
|
2315
|
-
];
|
|
2309
|
+
messages = [messages];
|
|
2316
2310
|
}
|
|
2317
2311
|
messages = _.uniqBy(messages, (message) => message.message);
|
|
2318
2312
|
if (this.refs.messageContainer) {
|
|
@@ -2463,30 +2457,15 @@ export default class Component extends Element {
|
|
|
2463
2457
|
toolbar: [
|
|
2464
2458
|
[
|
|
2465
2459
|
{
|
|
2466
|
-
size: [
|
|
2467
|
-
'small',
|
|
2468
|
-
false,
|
|
2469
|
-
'large',
|
|
2470
|
-
'huge',
|
|
2471
|
-
],
|
|
2460
|
+
size: ['small', false, 'large', 'huge'],
|
|
2472
2461
|
},
|
|
2473
2462
|
], // custom dropdown
|
|
2474
2463
|
[
|
|
2475
2464
|
{
|
|
2476
|
-
header: [
|
|
2477
|
-
1,
|
|
2478
|
-
2,
|
|
2479
|
-
3,
|
|
2480
|
-
4,
|
|
2481
|
-
5,
|
|
2482
|
-
6,
|
|
2483
|
-
false,
|
|
2484
|
-
],
|
|
2465
|
+
header: [1, 2, 3, 4, 5, 6, false],
|
|
2485
2466
|
},
|
|
2486
2467
|
],
|
|
2487
|
-
[
|
|
2488
|
-
{ font: [] },
|
|
2489
|
-
],
|
|
2468
|
+
[{ font: [] }],
|
|
2490
2469
|
[
|
|
2491
2470
|
'bold',
|
|
2492
2471
|
'italic',
|
|
@@ -2496,10 +2475,7 @@ export default class Component extends Element {
|
|
|
2496
2475
|
{ script: 'super' },
|
|
2497
2476
|
'clean',
|
|
2498
2477
|
],
|
|
2499
|
-
[
|
|
2500
|
-
{ color: [] },
|
|
2501
|
-
{ background: [] },
|
|
2502
|
-
],
|
|
2478
|
+
[{ color: [] }, { background: [] }],
|
|
2503
2479
|
[
|
|
2504
2480
|
{ list: 'ordered' },
|
|
2505
2481
|
{ list: 'bullet' },
|
|
@@ -2507,17 +2483,8 @@ export default class Component extends Element {
|
|
|
2507
2483
|
{ indent: '+1' },
|
|
2508
2484
|
{ align: [] },
|
|
2509
2485
|
],
|
|
2510
|
-
[
|
|
2511
|
-
|
|
2512
|
-
'code-block',
|
|
2513
|
-
],
|
|
2514
|
-
[
|
|
2515
|
-
'link',
|
|
2516
|
-
'image',
|
|
2517
|
-
'video',
|
|
2518
|
-
'formula',
|
|
2519
|
-
'source',
|
|
2520
|
-
],
|
|
2486
|
+
['blockquote', 'code-block'],
|
|
2487
|
+
['link', 'image', 'video', 'formula', 'source'],
|
|
2521
2488
|
],
|
|
2522
2489
|
},
|
|
2523
2490
|
},
|
|
@@ -2539,12 +2506,7 @@ export default class Component extends Element {
|
|
|
2539
2506
|
'imageStyle:alignCenter',
|
|
2540
2507
|
'imageStyle:alignRight',
|
|
2541
2508
|
],
|
|
2542
|
-
styles: [
|
|
2543
|
-
'full',
|
|
2544
|
-
'alignLeft',
|
|
2545
|
-
'alignCenter',
|
|
2546
|
-
'alignRight',
|
|
2547
|
-
],
|
|
2509
|
+
styles: ['full', 'alignLeft', 'alignCenter', 'alignRight'],
|
|
2548
2510
|
},
|
|
2549
2511
|
extraPlugins: [],
|
|
2550
2512
|
},
|
|
@@ -2580,7 +2542,6 @@ export default class Component extends Element {
|
|
|
2580
2542
|
current.prepend(clone);
|
|
2581
2543
|
break;
|
|
2582
2544
|
}
|
|
2583
|
-
;
|
|
2584
2545
|
current = current.parentNode || current.host;
|
|
2585
2546
|
}
|
|
2586
2547
|
return ClassicEditor.create(element, settings).then((editor) => {
|
|
@@ -2601,9 +2562,7 @@ export default class Component extends Element {
|
|
|
2601
2562
|
},
|
|
2602
2563
|
};
|
|
2603
2564
|
// Lazy load the quill css.
|
|
2604
|
-
Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2605
|
-
{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` },
|
|
2606
|
-
], true);
|
|
2565
|
+
Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` }], true);
|
|
2607
2566
|
// Lazy load the quill library.
|
|
2608
2567
|
return Formio.requireLibrary('quill', 'Quill', _.get(this.options, 'editors.quill.src', `${Formio.cdn.quill}/quill.js`), true).then(() => {
|
|
2609
2568
|
return Formio.requireLibrary('quill-table', 'Quill', `${Formio.cdn.baseUrl}/quill/quill-table.js`, true).then(() => {
|
|
@@ -2626,8 +2585,8 @@ export default class Component extends Element {
|
|
|
2626
2585
|
};
|
|
2627
2586
|
// 2. hasFocus: check shadowRoot.activeElement instead of document.activeElement
|
|
2628
2587
|
sel.hasFocus = () => {
|
|
2629
|
-
return root.activeElement === sel.root ||
|
|
2630
|
-
(root.activeElement != null && sel.root.contains(root.activeElement));
|
|
2588
|
+
return (root.activeElement === sel.root ||
|
|
2589
|
+
(root.activeElement != null && sel.root.contains(root.activeElement)));
|
|
2631
2590
|
};
|
|
2632
2591
|
// 3. setNativeRange: use shadowRoot's selection to add/remove ranges
|
|
2633
2592
|
const origSetNativeRange = sel.setNativeRange.bind(sel);
|
|
@@ -2646,9 +2605,12 @@ export default class Component extends Element {
|
|
|
2646
2605
|
const { native } = sel.getNativeRange() || {};
|
|
2647
2606
|
endNode = endNode ?? startNode;
|
|
2648
2607
|
endOffset = endOffset ?? startOffset;
|
|
2649
|
-
if (native == null ||
|
|
2650
|
-
|
|
2651
|
-
|
|
2608
|
+
if (native == null ||
|
|
2609
|
+
force ||
|
|
2610
|
+
startNode !== native.startContainer ||
|
|
2611
|
+
startOffset !== native.startOffset ||
|
|
2612
|
+
endNode !== native.endContainer ||
|
|
2613
|
+
endOffset !== native.endOffset) {
|
|
2652
2614
|
const range = document.createRange();
|
|
2653
2615
|
range.setStart(startNode, startOffset);
|
|
2654
2616
|
range.setEnd(endNode, endOffset);
|
|
@@ -2817,9 +2779,9 @@ export default class Component extends Element {
|
|
|
2817
2779
|
this.component.defaultValue !== undefined));
|
|
2818
2780
|
}
|
|
2819
2781
|
/**
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2782
|
+
* Determine if we should add a default value for this component.
|
|
2783
|
+
* @returns {boolean} - TRUE if a default value should be set
|
|
2784
|
+
*/
|
|
2823
2785
|
get shouldAddDefaultValue() {
|
|
2824
2786
|
return this.pristine && this.allowData && (this.hasDefaultValue || !this.options.noDefaults);
|
|
2825
2787
|
}
|
|
@@ -3250,9 +3212,7 @@ export default class Component extends Element {
|
|
|
3250
3212
|
paths: this.paths,
|
|
3251
3213
|
scope: validationScope,
|
|
3252
3214
|
instance: this,
|
|
3253
|
-
processors: [
|
|
3254
|
-
validateProcessInfo,
|
|
3255
|
-
],
|
|
3215
|
+
processors: [validateProcessInfo],
|
|
3256
3216
|
});
|
|
3257
3217
|
const errors = validationScope.errors;
|
|
3258
3218
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3289,10 +3249,7 @@ export default class Component extends Element {
|
|
|
3289
3249
|
interpolateErrors(errors) {
|
|
3290
3250
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3291
3251
|
return this.serverErrors?.length
|
|
3292
|
-
? [
|
|
3293
|
-
...interpolatedErrors,
|
|
3294
|
-
...this.serverErrors,
|
|
3295
|
-
]
|
|
3252
|
+
? [...interpolatedErrors, ...this.serverErrors]
|
|
3296
3253
|
: interpolatedErrors;
|
|
3297
3254
|
}
|
|
3298
3255
|
/**
|
|
@@ -3340,9 +3297,7 @@ export default class Component extends Element {
|
|
|
3340
3297
|
instance: this,
|
|
3341
3298
|
form: this.root ? this.root._form : {},
|
|
3342
3299
|
scope: { errors: [] },
|
|
3343
|
-
processors: [
|
|
3344
|
-
validateProcessInfo,
|
|
3345
|
-
],
|
|
3300
|
+
processors: [validateProcessInfo],
|
|
3346
3301
|
};
|
|
3347
3302
|
if (async) {
|
|
3348
3303
|
return processOne(processContext).then(() => {
|
|
@@ -3457,9 +3412,7 @@ export default class Component extends Element {
|
|
|
3457
3412
|
return;
|
|
3458
3413
|
}
|
|
3459
3414
|
if (dirty && !isValid) {
|
|
3460
|
-
this.setErrorClasses([
|
|
3461
|
-
this.refs.openModal,
|
|
3462
|
-
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3415
|
+
this.setErrorClasses([this.refs.openModal], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3463
3416
|
}
|
|
3464
3417
|
else {
|
|
3465
3418
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3546,9 +3499,7 @@ export default class Component extends Element {
|
|
|
3546
3499
|
}
|
|
3547
3500
|
if (!Array.isArray(messages)) {
|
|
3548
3501
|
if (messages) {
|
|
3549
|
-
messages = [
|
|
3550
|
-
messages,
|
|
3551
|
-
];
|
|
3502
|
+
messages = [messages];
|
|
3552
3503
|
}
|
|
3553
3504
|
else {
|
|
3554
3505
|
messages = [];
|
|
@@ -3644,7 +3595,7 @@ export default class Component extends Element {
|
|
|
3644
3595
|
}
|
|
3645
3596
|
// Maintain reverse compatibility.
|
|
3646
3597
|
whenReady() {
|
|
3647
|
-
console.warn(
|
|
3598
|
+
console.warn(this.t('whenReadyDeprecation'));
|
|
3648
3599
|
return this.dataReady;
|
|
3649
3600
|
}
|
|
3650
3601
|
get dataReady() {
|
|
@@ -3657,13 +3608,7 @@ export default class Component extends Element {
|
|
|
3657
3608
|
*/
|
|
3658
3609
|
asString(value) {
|
|
3659
3610
|
value = value || this.getValue();
|
|
3660
|
-
return (Array.isArray(value)
|
|
3661
|
-
? value
|
|
3662
|
-
: [
|
|
3663
|
-
value,
|
|
3664
|
-
])
|
|
3665
|
-
.map(_.toString)
|
|
3666
|
-
.join(', ');
|
|
3611
|
+
return (Array.isArray(value) ? value : [value]).map(_.toString).join(', ');
|
|
3667
3612
|
}
|
|
3668
3613
|
/**
|
|
3669
3614
|
* Return if the component is disabled.
|
|
@@ -3915,11 +3860,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3915
3860
|
Component.externalLibraries[name].resolve(plugin);
|
|
3916
3861
|
}
|
|
3917
3862
|
else {
|
|
3918
|
-
src = Array.isArray(src)
|
|
3919
|
-
? src
|
|
3920
|
-
: [
|
|
3921
|
-
src,
|
|
3922
|
-
];
|
|
3863
|
+
src = Array.isArray(src) ? src : [src];
|
|
3923
3864
|
src.forEach((lib) => {
|
|
3924
3865
|
let attrs = {};
|
|
3925
3866
|
let elementType = '';
|
|
@@ -123,9 +123,7 @@ export default [
|
|
|
123
123
|
},
|
|
124
124
|
conditional: {
|
|
125
125
|
json: {
|
|
126
|
-
'!': [
|
|
127
|
-
{ var: 'data.dataSrc' },
|
|
128
|
-
],
|
|
126
|
+
'!': [{ var: 'data.dataSrc' }],
|
|
129
127
|
},
|
|
130
128
|
},
|
|
131
129
|
},
|
|
@@ -167,5 +165,5 @@ export default [
|
|
|
167
165
|
tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
|
|
168
166
|
defaultValue: {},
|
|
169
167
|
description: '<b>Example</b>: { "clearOnHide": true }',
|
|
170
|
-
}
|
|
168
|
+
},
|
|
171
169
|
];
|
|
@@ -50,16 +50,10 @@ export default [
|
|
|
50
50
|
json: {
|
|
51
51
|
and: [
|
|
52
52
|
{
|
|
53
|
-
'!==': [
|
|
54
|
-
{ var: 'data.labelPosition' },
|
|
55
|
-
'top',
|
|
56
|
-
],
|
|
53
|
+
'!==': [{ var: 'data.labelPosition' }, 'top'],
|
|
57
54
|
},
|
|
58
55
|
{
|
|
59
|
-
'!==': [
|
|
60
|
-
{ var: 'data.labelPosition' },
|
|
61
|
-
'bottom',
|
|
62
|
-
],
|
|
56
|
+
'!==': [{ var: 'data.labelPosition' }, 'bottom'],
|
|
63
57
|
},
|
|
64
58
|
],
|
|
65
59
|
},
|
|
@@ -83,16 +77,10 @@ export default [
|
|
|
83
77
|
json: {
|
|
84
78
|
and: [
|
|
85
79
|
{
|
|
86
|
-
'!==': [
|
|
87
|
-
{ var: 'data.labelPosition' },
|
|
88
|
-
'top',
|
|
89
|
-
],
|
|
80
|
+
'!==': [{ var: 'data.labelPosition' }, 'top'],
|
|
90
81
|
},
|
|
91
82
|
{
|
|
92
|
-
'!==': [
|
|
93
|
-
{ var: 'data.labelPosition' },
|
|
94
|
-
'bottom',
|
|
95
|
-
],
|
|
83
|
+
'!==': [{ var: 'data.labelPosition' }, 'bottom'],
|
|
96
84
|
},
|
|
97
85
|
],
|
|
98
86
|
},
|
|
@@ -35,10 +35,7 @@ export default class Field extends Component {
|
|
|
35
35
|
if (this.root?.focusedComponent?.path === this.path) {
|
|
36
36
|
try {
|
|
37
37
|
this.root.currentSelection = {
|
|
38
|
-
selection: [
|
|
39
|
-
element.selectionStart,
|
|
40
|
-
element.selectionEnd,
|
|
41
|
-
],
|
|
38
|
+
selection: [element.selectionStart, element.selectionEnd],
|
|
42
39
|
index,
|
|
43
40
|
};
|
|
44
41
|
}
|
|
@@ -247,9 +247,9 @@ export default class Input extends Multivalue {
|
|
|
247
247
|
announceScreenReaderMessage(comp, comp.dataValue, 0, true);
|
|
248
248
|
});
|
|
249
249
|
this.on('blur', (comp) => {
|
|
250
|
-
const el = comp.refs?.[
|
|
250
|
+
const el = comp.refs?.['announceMessage']?.[0];
|
|
251
251
|
if (el) {
|
|
252
|
-
el.textContent =
|
|
252
|
+
el.textContent = '';
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
return promise;
|
|
@@ -131,11 +131,11 @@ export default class ListComponent extends Field {
|
|
|
131
131
|
component: this.component,
|
|
132
132
|
message: err.toString(),
|
|
133
133
|
});
|
|
134
|
-
console.warn(
|
|
134
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
|
135
135
|
}
|
|
136
136
|
updateItems(searchInput, forceUpdate) {
|
|
137
137
|
if (!this.component.data) {
|
|
138
|
-
console.warn(
|
|
138
|
+
console.warn(this.t('noSelectDataConfiguration', { componentKey: this.key }));
|
|
139
139
|
this.itemsLoadedResolve();
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
@@ -169,7 +169,7 @@ export default class ListComponent extends Field {
|
|
|
169
169
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
|
170
170
|
}
|
|
171
171
|
catch (ignoreErr) {
|
|
172
|
-
console.warn(
|
|
172
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
@@ -218,7 +218,7 @@ export default class ListComponent extends Field {
|
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
if (!window.indexedDB) {
|
|
221
|
-
window.alert(
|
|
221
|
+
window.alert(this.t('indexedDBSupportError'));
|
|
222
222
|
}
|
|
223
223
|
if (this.component.indexeddb &&
|
|
224
224
|
this.component.indexeddb.database &&
|