@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
|
@@ -175,12 +175,7 @@ class Component extends Element_1.default {
|
|
|
175
175
|
*/
|
|
176
176
|
static get conditionOperatorsSettings() {
|
|
177
177
|
return {
|
|
178
|
-
operators: [
|
|
179
|
-
'isEqual',
|
|
180
|
-
'isNotEqual',
|
|
181
|
-
'isEmpty',
|
|
182
|
-
'isNotEmpty',
|
|
183
|
-
],
|
|
178
|
+
operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
|
|
184
179
|
valueComponent() {
|
|
185
180
|
return {
|
|
186
181
|
type: 'textfield',
|
|
@@ -198,9 +193,7 @@ class Component extends Element_1.default {
|
|
|
198
193
|
*/
|
|
199
194
|
static savedValueTypes(schema) {
|
|
200
195
|
schema = schema || {};
|
|
201
|
-
return
|
|
202
|
-
utils_1.default.componentValueTypes.any,
|
|
203
|
-
]);
|
|
196
|
+
return utils_1.default.getComponentSavedTypes(schema) || [utils_1.default.componentValueTypes.any];
|
|
204
197
|
}
|
|
205
198
|
/**
|
|
206
199
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
@@ -467,7 +460,9 @@ class Component extends Element_1.default {
|
|
|
467
460
|
hasCondionallyHiddenLayoutParent() {
|
|
468
461
|
let currentParent = this.parent;
|
|
469
462
|
while (currentParent) {
|
|
470
|
-
if (currentParent._conditionallyHidden &&
|
|
463
|
+
if (currentParent._conditionallyHidden &&
|
|
464
|
+
utils_1.default.isLayoutComponent(currentParent) &&
|
|
465
|
+
currentParent.component.clearOnHide === true) {
|
|
471
466
|
return true;
|
|
472
467
|
}
|
|
473
468
|
currentParent = currentParent.parent;
|
|
@@ -592,7 +587,10 @@ class Component extends Element_1.default {
|
|
|
592
587
|
this.addons.push(addon);
|
|
593
588
|
}
|
|
594
589
|
else {
|
|
595
|
-
console.warn(
|
|
590
|
+
console.warn(this.t('addonSupportTypeError', {
|
|
591
|
+
type: this.component.type,
|
|
592
|
+
label: name.label,
|
|
593
|
+
}));
|
|
596
594
|
}
|
|
597
595
|
}
|
|
598
596
|
return addon;
|
|
@@ -646,7 +644,7 @@ class Component extends Element_1.default {
|
|
|
646
644
|
return this.paths.dataPath;
|
|
647
645
|
}
|
|
648
646
|
set path(path) {
|
|
649
|
-
throw new Error(
|
|
647
|
+
throw new Error(this.t('setPathError'));
|
|
650
648
|
}
|
|
651
649
|
set parentVisible(value) {
|
|
652
650
|
this._parentVisible = value;
|
|
@@ -750,7 +748,9 @@ class Component extends Element_1.default {
|
|
|
750
748
|
this._conditionallyClear = true;
|
|
751
749
|
return this._conditionallyClear;
|
|
752
750
|
}
|
|
753
|
-
this._conditionallyClear = this.hasSetValue
|
|
751
|
+
this._conditionallyClear = this.hasSetValue
|
|
752
|
+
? this.hasCondionallyHiddenLayoutParent()
|
|
753
|
+
: this.parentShouldConditionallyClear();
|
|
754
754
|
return this._conditionallyClear;
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
@@ -785,7 +785,7 @@ class Component extends Element_1.default {
|
|
|
785
785
|
return this.options.attachMode === 'builder';
|
|
786
786
|
}
|
|
787
787
|
get calculatedPath() {
|
|
788
|
-
console.error(
|
|
788
|
+
console.error(this.t('calculatedPathDeprecation'));
|
|
789
789
|
return this.path;
|
|
790
790
|
}
|
|
791
791
|
get labelPosition() {
|
|
@@ -800,12 +800,7 @@ class Component extends Element_1.default {
|
|
|
800
800
|
return margin >= 0 ? margin : 3;
|
|
801
801
|
}
|
|
802
802
|
get isAdvancedLabel() {
|
|
803
|
-
return [
|
|
804
|
-
'left-left',
|
|
805
|
-
'left-right',
|
|
806
|
-
'right-left',
|
|
807
|
-
'right-right',
|
|
808
|
-
].includes(this.labelPosition);
|
|
803
|
+
return ['left-left', 'left-right', 'right-left', 'right-right'].includes(this.labelPosition);
|
|
809
804
|
}
|
|
810
805
|
get labelPositions() {
|
|
811
806
|
return this.labelPosition.split('-');
|
|
@@ -933,16 +928,8 @@ class Component extends Element_1.default {
|
|
|
933
928
|
: (type, value) => value;
|
|
934
929
|
}
|
|
935
930
|
getTemplate(names, modes) {
|
|
936
|
-
modes = Array.isArray(modes)
|
|
937
|
-
|
|
938
|
-
: [
|
|
939
|
-
modes,
|
|
940
|
-
];
|
|
941
|
-
names = Array.isArray(names)
|
|
942
|
-
? names
|
|
943
|
-
: [
|
|
944
|
-
names,
|
|
945
|
-
];
|
|
931
|
+
modes = Array.isArray(modes) ? modes : [modes];
|
|
932
|
+
names = Array.isArray(names) ? names : [names];
|
|
946
933
|
if (!modes.includes('form')) {
|
|
947
934
|
modes.push('form');
|
|
948
935
|
}
|
|
@@ -964,7 +951,7 @@ class Component extends Element_1.default {
|
|
|
964
951
|
const name = names[names.length - 1];
|
|
965
952
|
const templatesByName = Templates_1.default.defaultTemplates[name];
|
|
966
953
|
if (!templatesByName) {
|
|
967
|
-
return { template:
|
|
954
|
+
return { template: this.t('unknownTemplate', { name }) };
|
|
968
955
|
}
|
|
969
956
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
|
970
957
|
if (templateByMode) {
|
|
@@ -1033,9 +1020,7 @@ class Component extends Element_1.default {
|
|
|
1033
1020
|
data.disabled = this.disabled;
|
|
1034
1021
|
data.builder = this.builderMode;
|
|
1035
1022
|
data.render = (...args) => {
|
|
1036
|
-
console.warn(
|
|
1037
|
-
If you need to render template (template A) inside of another template (template B),
|
|
1038
|
-
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
|
1023
|
+
console.warn(this.t('renderTemplateFunctionDeprecation'));
|
|
1039
1024
|
return this.renderTemplate(...args);
|
|
1040
1025
|
};
|
|
1041
1026
|
data.label = data.labelInfo || this.labelInfo;
|
|
@@ -1186,9 +1171,7 @@ class Component extends Element_1.default {
|
|
|
1186
1171
|
if (this.options.pdf && submissionTimezone) {
|
|
1187
1172
|
return submissionTimezone;
|
|
1188
1173
|
}
|
|
1189
|
-
const staticSnapshot = this.options.server ||
|
|
1190
|
-
this.options.renderMode === 'html' ||
|
|
1191
|
-
!!this.options.viewAsHtml;
|
|
1174
|
+
const staticSnapshot = this.options.server || this.options.renderMode === 'html' || !!this.options.viewAsHtml;
|
|
1192
1175
|
if (submissionTimezone &&
|
|
1193
1176
|
(mode === 'submission' || (staticSnapshot && (mode === 'viewer' || mode === 'location')))) {
|
|
1194
1177
|
return submissionTimezone;
|
|
@@ -1219,6 +1202,19 @@ class Component extends Element_1.default {
|
|
|
1219
1202
|
}
|
|
1220
1203
|
}
|
|
1221
1204
|
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Announces a message to screen readers via the component's live region.
|
|
1207
|
+
* @param {string} message - The message to announce.
|
|
1208
|
+
*/
|
|
1209
|
+
announce(message) {
|
|
1210
|
+
const liveRegion = this.refs.liveRegion;
|
|
1211
|
+
if (liveRegion) {
|
|
1212
|
+
liveRegion.textContent = '';
|
|
1213
|
+
setTimeout(() => {
|
|
1214
|
+
liveRegion.textContent = message;
|
|
1215
|
+
}, 50);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1222
1218
|
/**
|
|
1223
1219
|
* Opens the modal element.
|
|
1224
1220
|
* @param {string} template - The template to use for the modal dialog.
|
|
@@ -1246,7 +1242,7 @@ class Component extends Element_1.default {
|
|
|
1246
1242
|
modalLabel = { className: 'field-required' };
|
|
1247
1243
|
}
|
|
1248
1244
|
return this.renderModalPreview({
|
|
1249
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
|
1245
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
|
1250
1246
|
messages: '',
|
|
1251
1247
|
labelInfo: modalLabel,
|
|
1252
1248
|
});
|
|
@@ -1271,7 +1267,7 @@ class Component extends Element_1.default {
|
|
|
1271
1267
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1272
1268
|
* @returns {string} - The rendered HTML string of a component.
|
|
1273
1269
|
*/
|
|
1274
|
-
render(children =
|
|
1270
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
|
1275
1271
|
const isVisible = this.visible;
|
|
1276
1272
|
this.rendered = true;
|
|
1277
1273
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
@@ -1352,6 +1348,7 @@ class Component extends Element_1.default {
|
|
|
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.
|
|
@@ -1475,9 +1472,7 @@ class Component extends Element_1.default {
|
|
|
1475
1472
|
return;
|
|
1476
1473
|
}
|
|
1477
1474
|
if (!changes.length && flags.changed) {
|
|
1478
|
-
changes = [
|
|
1479
|
-
flags.changed,
|
|
1480
|
-
];
|
|
1475
|
+
changes = [flags.changed];
|
|
1481
1476
|
}
|
|
1482
1477
|
const refreshOn = flags.fromBlur
|
|
1483
1478
|
? this.component.refreshOnBlur
|
|
@@ -1578,10 +1573,11 @@ class Component extends Element_1.default {
|
|
|
1578
1573
|
/**
|
|
1579
1574
|
* Uses the widget to determine the output string.
|
|
1580
1575
|
* @param {any} value - The current value of the component.
|
|
1581
|
-
* @param {any}
|
|
1576
|
+
* @param {any} _options - The options for getValueAsString.
|
|
1582
1577
|
* @returns {any|Array<any>} - The value as a string.
|
|
1583
1578
|
*/
|
|
1584
|
-
|
|
1579
|
+
// GOTCHA(G-FJS04)
|
|
1580
|
+
getWidgetValueAsString(value, _options) {
|
|
1585
1581
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
1586
1582
|
if (!value || noInputWidget) {
|
|
1587
1583
|
if (!this.widget || !value) {
|
|
@@ -1596,13 +1592,13 @@ class Component extends Element_1.default {
|
|
|
1596
1592
|
value.forEach((val, index) => {
|
|
1597
1593
|
const widget = this.refs.input[index] && this.refs.input[index].widget;
|
|
1598
1594
|
if (widget) {
|
|
1599
|
-
values.push(widget.getValueAsString(val
|
|
1595
|
+
values.push(widget.getValueAsString(val));
|
|
1600
1596
|
}
|
|
1601
1597
|
});
|
|
1602
1598
|
return values;
|
|
1603
1599
|
}
|
|
1604
1600
|
const widget = this.refs.input[0].widget;
|
|
1605
|
-
return widget.getValueAsString(value
|
|
1601
|
+
return widget.getValueAsString(value);
|
|
1606
1602
|
}
|
|
1607
1603
|
/**
|
|
1608
1604
|
* Returns the value of the component as a string.
|
|
@@ -1895,10 +1891,7 @@ class Component extends Element_1.default {
|
|
|
1895
1891
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1896
1892
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1897
1893
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1898
|
-
: [
|
|
1899
|
-
'fa',
|
|
1900
|
-
'bi',
|
|
1901
|
-
].includes(this.options.iconset)
|
|
1894
|
+
: ['fa', 'bi'].includes(this.options.iconset)
|
|
1902
1895
|
? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1903
1896
|
: name;
|
|
1904
1897
|
}
|
|
@@ -2081,7 +2074,11 @@ class Component extends Element_1.default {
|
|
|
2081
2074
|
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
2082
2075
|
*/
|
|
2083
2076
|
conditionallyVisible(data, row) {
|
|
2084
|
-
|
|
2077
|
+
var _a, _b;
|
|
2078
|
+
data =
|
|
2079
|
+
data ||
|
|
2080
|
+
(((_a = this.root) === null || _a === void 0 ? void 0 : _a.submissionSet) && lodash_1.default.merge({}, (_b = this.root) === null || _b === void 0 ? void 0 : _b.subFromServer, this.rootValue)) ||
|
|
2081
|
+
this.rootValue;
|
|
2085
2082
|
row = row || this.data;
|
|
2086
2083
|
if (this.builderMode || this.previewMode) {
|
|
2087
2084
|
return true;
|
|
@@ -2318,9 +2315,7 @@ class Component extends Element_1.default {
|
|
|
2318
2315
|
};
|
|
2319
2316
|
}
|
|
2320
2317
|
if (!Array.isArray(messages)) {
|
|
2321
|
-
messages = [
|
|
2322
|
-
messages,
|
|
2323
|
-
];
|
|
2318
|
+
messages = [messages];
|
|
2324
2319
|
}
|
|
2325
2320
|
messages = lodash_1.default.uniqBy(messages, (message) => message.message);
|
|
2326
2321
|
if (this.refs.messageContainer) {
|
|
@@ -2472,30 +2467,15 @@ class Component extends Element_1.default {
|
|
|
2472
2467
|
toolbar: [
|
|
2473
2468
|
[
|
|
2474
2469
|
{
|
|
2475
|
-
size: [
|
|
2476
|
-
'small',
|
|
2477
|
-
false,
|
|
2478
|
-
'large',
|
|
2479
|
-
'huge',
|
|
2480
|
-
],
|
|
2470
|
+
size: ['small', false, 'large', 'huge'],
|
|
2481
2471
|
},
|
|
2482
2472
|
], // custom dropdown
|
|
2483
2473
|
[
|
|
2484
2474
|
{
|
|
2485
|
-
header: [
|
|
2486
|
-
1,
|
|
2487
|
-
2,
|
|
2488
|
-
3,
|
|
2489
|
-
4,
|
|
2490
|
-
5,
|
|
2491
|
-
6,
|
|
2492
|
-
false,
|
|
2493
|
-
],
|
|
2475
|
+
header: [1, 2, 3, 4, 5, 6, false],
|
|
2494
2476
|
},
|
|
2495
2477
|
],
|
|
2496
|
-
[
|
|
2497
|
-
{ font: [] },
|
|
2498
|
-
],
|
|
2478
|
+
[{ font: [] }],
|
|
2499
2479
|
[
|
|
2500
2480
|
'bold',
|
|
2501
2481
|
'italic',
|
|
@@ -2505,10 +2485,7 @@ class Component extends Element_1.default {
|
|
|
2505
2485
|
{ script: 'super' },
|
|
2506
2486
|
'clean',
|
|
2507
2487
|
],
|
|
2508
|
-
[
|
|
2509
|
-
{ color: [] },
|
|
2510
|
-
{ background: [] },
|
|
2511
|
-
],
|
|
2488
|
+
[{ color: [] }, { background: [] }],
|
|
2512
2489
|
[
|
|
2513
2490
|
{ list: 'ordered' },
|
|
2514
2491
|
{ list: 'bullet' },
|
|
@@ -2516,17 +2493,8 @@ class Component extends Element_1.default {
|
|
|
2516
2493
|
{ indent: '+1' },
|
|
2517
2494
|
{ align: [] },
|
|
2518
2495
|
],
|
|
2519
|
-
[
|
|
2520
|
-
|
|
2521
|
-
'code-block',
|
|
2522
|
-
],
|
|
2523
|
-
[
|
|
2524
|
-
'link',
|
|
2525
|
-
'image',
|
|
2526
|
-
'video',
|
|
2527
|
-
'formula',
|
|
2528
|
-
'source',
|
|
2529
|
-
],
|
|
2496
|
+
['blockquote', 'code-block'],
|
|
2497
|
+
['link', 'image', 'video', 'formula', 'source'],
|
|
2530
2498
|
],
|
|
2531
2499
|
},
|
|
2532
2500
|
},
|
|
@@ -2548,12 +2516,7 @@ class Component extends Element_1.default {
|
|
|
2548
2516
|
'imageStyle:alignCenter',
|
|
2549
2517
|
'imageStyle:alignRight',
|
|
2550
2518
|
],
|
|
2551
|
-
styles: [
|
|
2552
|
-
'full',
|
|
2553
|
-
'alignLeft',
|
|
2554
|
-
'alignCenter',
|
|
2555
|
-
'alignRight',
|
|
2556
|
-
],
|
|
2519
|
+
styles: ['full', 'alignLeft', 'alignCenter', 'alignRight'],
|
|
2557
2520
|
},
|
|
2558
2521
|
extraPlugins: [],
|
|
2559
2522
|
},
|
|
@@ -2589,7 +2552,6 @@ class Component extends Element_1.default {
|
|
|
2589
2552
|
current.prepend(clone);
|
|
2590
2553
|
break;
|
|
2591
2554
|
}
|
|
2592
|
-
;
|
|
2593
2555
|
current = current.parentNode || current.host;
|
|
2594
2556
|
}
|
|
2595
2557
|
return ClassicEditor.create(element, settings).then((editor) => {
|
|
@@ -2604,9 +2566,7 @@ class Component extends Element_1.default {
|
|
|
2604
2566
|
settings = lodash_1.default.merge(this.wysiwygDefault.quill, lodash_1.default.get(this.options, 'editors.quill.settings', {}), settings);
|
|
2605
2567
|
settings = Object.assign(Object.assign({}, settings), { modules: Object.assign({ table: true }, settings.modules) });
|
|
2606
2568
|
// Lazy load the quill css.
|
|
2607
|
-
Formio_1.Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2608
|
-
{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` },
|
|
2609
|
-
], true);
|
|
2569
|
+
Formio_1.Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` }], true);
|
|
2610
2570
|
// Lazy load the quill library.
|
|
2611
2571
|
return Formio_1.Formio.requireLibrary('quill', 'Quill', lodash_1.default.get(this.options, 'editors.quill.src', `${Formio_1.Formio.cdn.quill}/quill.js`), true).then(() => {
|
|
2612
2572
|
return Formio_1.Formio.requireLibrary('quill-table', 'Quill', `${Formio_1.Formio.cdn.baseUrl}/quill/quill-table.js`, true).then(() => {
|
|
@@ -2629,8 +2589,8 @@ class Component extends Element_1.default {
|
|
|
2629
2589
|
};
|
|
2630
2590
|
// 2. hasFocus: check shadowRoot.activeElement instead of document.activeElement
|
|
2631
2591
|
sel.hasFocus = () => {
|
|
2632
|
-
return root.activeElement === sel.root ||
|
|
2633
|
-
(root.activeElement != null && sel.root.contains(root.activeElement));
|
|
2592
|
+
return (root.activeElement === sel.root ||
|
|
2593
|
+
(root.activeElement != null && sel.root.contains(root.activeElement)));
|
|
2634
2594
|
};
|
|
2635
2595
|
// 3. setNativeRange: use shadowRoot's selection to add/remove ranges
|
|
2636
2596
|
const origSetNativeRange = sel.setNativeRange.bind(sel);
|
|
@@ -2649,9 +2609,12 @@ class Component extends Element_1.default {
|
|
|
2649
2609
|
const { native } = sel.getNativeRange() || {};
|
|
2650
2610
|
endNode = endNode !== null && endNode !== void 0 ? endNode : startNode;
|
|
2651
2611
|
endOffset = endOffset !== null && endOffset !== void 0 ? endOffset : startOffset;
|
|
2652
|
-
if (native == null ||
|
|
2653
|
-
|
|
2654
|
-
|
|
2612
|
+
if (native == null ||
|
|
2613
|
+
force ||
|
|
2614
|
+
startNode !== native.startContainer ||
|
|
2615
|
+
startOffset !== native.startOffset ||
|
|
2616
|
+
endNode !== native.endContainer ||
|
|
2617
|
+
endOffset !== native.endOffset) {
|
|
2655
2618
|
const range = document.createRange();
|
|
2656
2619
|
range.setStart(startNode, startOffset);
|
|
2657
2620
|
range.setEnd(endNode, endOffset);
|
|
@@ -2822,9 +2785,9 @@ class Component extends Element_1.default {
|
|
|
2822
2785
|
this.component.defaultValue !== undefined));
|
|
2823
2786
|
}
|
|
2824
2787
|
/**
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2788
|
+
* Determine if we should add a default value for this component.
|
|
2789
|
+
* @returns {boolean} - TRUE if a default value should be set
|
|
2790
|
+
*/
|
|
2828
2791
|
get shouldAddDefaultValue() {
|
|
2829
2792
|
return this.pristine && this.allowData && (this.hasDefaultValue || !this.options.noDefaults);
|
|
2830
2793
|
}
|
|
@@ -3259,9 +3222,7 @@ class Component extends Element_1.default {
|
|
|
3259
3222
|
paths: this.paths,
|
|
3260
3223
|
scope: validationScope,
|
|
3261
3224
|
instance: this,
|
|
3262
|
-
processors: [
|
|
3263
|
-
process_1.validateProcessInfo,
|
|
3264
|
-
],
|
|
3225
|
+
processors: [process_1.validateProcessInfo],
|
|
3265
3226
|
});
|
|
3266
3227
|
const errors = validationScope.errors;
|
|
3267
3228
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3299,10 +3260,7 @@ class Component extends Element_1.default {
|
|
|
3299
3260
|
var _a;
|
|
3300
3261
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3301
3262
|
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length)
|
|
3302
|
-
? [
|
|
3303
|
-
...interpolatedErrors,
|
|
3304
|
-
...this.serverErrors,
|
|
3305
|
-
]
|
|
3263
|
+
? [...interpolatedErrors, ...this.serverErrors]
|
|
3306
3264
|
: interpolatedErrors;
|
|
3307
3265
|
}
|
|
3308
3266
|
/**
|
|
@@ -3351,9 +3309,7 @@ class Component extends Element_1.default {
|
|
|
3351
3309
|
instance: this,
|
|
3352
3310
|
form: this.root ? this.root._form : {},
|
|
3353
3311
|
scope: { errors: [] },
|
|
3354
|
-
processors: [
|
|
3355
|
-
process_1.validateProcessInfo,
|
|
3356
|
-
],
|
|
3312
|
+
processors: [process_1.validateProcessInfo],
|
|
3357
3313
|
};
|
|
3358
3314
|
if (async) {
|
|
3359
3315
|
return (0, process_1.processOne)(processContext).then(() => {
|
|
@@ -3468,9 +3424,7 @@ class Component extends Element_1.default {
|
|
|
3468
3424
|
return;
|
|
3469
3425
|
}
|
|
3470
3426
|
if (dirty && !isValid) {
|
|
3471
|
-
this.setErrorClasses([
|
|
3472
|
-
this.refs.openModal,
|
|
3473
|
-
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3427
|
+
this.setErrorClasses([this.refs.openModal], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3474
3428
|
}
|
|
3475
3429
|
else {
|
|
3476
3430
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3558,9 +3512,7 @@ class Component extends Element_1.default {
|
|
|
3558
3512
|
}
|
|
3559
3513
|
if (!Array.isArray(messages)) {
|
|
3560
3514
|
if (messages) {
|
|
3561
|
-
messages = [
|
|
3562
|
-
messages,
|
|
3563
|
-
];
|
|
3515
|
+
messages = [messages];
|
|
3564
3516
|
}
|
|
3565
3517
|
else {
|
|
3566
3518
|
messages = [];
|
|
@@ -3659,7 +3611,7 @@ class Component extends Element_1.default {
|
|
|
3659
3611
|
}
|
|
3660
3612
|
// Maintain reverse compatibility.
|
|
3661
3613
|
whenReady() {
|
|
3662
|
-
console.warn(
|
|
3614
|
+
console.warn(this.t('whenReadyDeprecation'));
|
|
3663
3615
|
return this.dataReady;
|
|
3664
3616
|
}
|
|
3665
3617
|
get dataReady() {
|
|
@@ -3672,13 +3624,7 @@ class Component extends Element_1.default {
|
|
|
3672
3624
|
*/
|
|
3673
3625
|
asString(value) {
|
|
3674
3626
|
value = value || this.getValue();
|
|
3675
|
-
return (Array.isArray(value)
|
|
3676
|
-
? value
|
|
3677
|
-
: [
|
|
3678
|
-
value,
|
|
3679
|
-
])
|
|
3680
|
-
.map(lodash_1.default.toString)
|
|
3681
|
-
.join(', ');
|
|
3627
|
+
return (Array.isArray(value) ? value : [value]).map(lodash_1.default.toString).join(', ');
|
|
3682
3628
|
}
|
|
3683
3629
|
/**
|
|
3684
3630
|
* Return if the component is disabled.
|
|
@@ -3933,11 +3879,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3933
3879
|
Component.externalLibraries[name].resolve(plugin);
|
|
3934
3880
|
}
|
|
3935
3881
|
else {
|
|
3936
|
-
src = Array.isArray(src)
|
|
3937
|
-
? src
|
|
3938
|
-
: [
|
|
3939
|
-
src,
|
|
3940
|
-
];
|
|
3882
|
+
src = Array.isArray(src) ? src : [src];
|
|
3941
3883
|
src.forEach((lib) => {
|
|
3942
3884
|
let attrs = {};
|
|
3943
3885
|
let elementType = '';
|
|
@@ -128,9 +128,7 @@ exports.default = [
|
|
|
128
128
|
},
|
|
129
129
|
conditional: {
|
|
130
130
|
json: {
|
|
131
|
-
'!': [
|
|
132
|
-
{ var: 'data.dataSrc' },
|
|
133
|
-
],
|
|
131
|
+
'!': [{ var: 'data.dataSrc' }],
|
|
134
132
|
},
|
|
135
133
|
},
|
|
136
134
|
},
|
|
@@ -172,5 +170,5 @@ exports.default = [
|
|
|
172
170
|
tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
|
|
173
171
|
defaultValue: {},
|
|
174
172
|
description: '<b>Example</b>: { "clearOnHide": true }',
|
|
175
|
-
}
|
|
173
|
+
},
|
|
176
174
|
];
|
|
@@ -52,16 +52,10 @@ exports.default = [
|
|
|
52
52
|
json: {
|
|
53
53
|
and: [
|
|
54
54
|
{
|
|
55
|
-
'!==': [
|
|
56
|
-
{ var: 'data.labelPosition' },
|
|
57
|
-
'top',
|
|
58
|
-
],
|
|
55
|
+
'!==': [{ var: 'data.labelPosition' }, 'top'],
|
|
59
56
|
},
|
|
60
57
|
{
|
|
61
|
-
'!==': [
|
|
62
|
-
{ var: 'data.labelPosition' },
|
|
63
|
-
'bottom',
|
|
64
|
-
],
|
|
58
|
+
'!==': [{ var: 'data.labelPosition' }, 'bottom'],
|
|
65
59
|
},
|
|
66
60
|
],
|
|
67
61
|
},
|
|
@@ -85,16 +79,10 @@ exports.default = [
|
|
|
85
79
|
json: {
|
|
86
80
|
and: [
|
|
87
81
|
{
|
|
88
|
-
'!==': [
|
|
89
|
-
{ var: 'data.labelPosition' },
|
|
90
|
-
'top',
|
|
91
|
-
],
|
|
82
|
+
'!==': [{ var: 'data.labelPosition' }, 'top'],
|
|
92
83
|
},
|
|
93
84
|
{
|
|
94
|
-
'!==': [
|
|
95
|
-
{ var: 'data.labelPosition' },
|
|
96
|
-
'bottom',
|
|
97
|
-
],
|
|
85
|
+
'!==': [{ var: 'data.labelPosition' }, 'bottom'],
|
|
98
86
|
},
|
|
99
87
|
],
|
|
100
88
|
},
|
|
@@ -37,10 +37,7 @@ class Field extends Component_1.default {
|
|
|
37
37
|
if (((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path) {
|
|
38
38
|
try {
|
|
39
39
|
this.root.currentSelection = {
|
|
40
|
-
selection: [
|
|
41
|
-
element.selectionStart,
|
|
42
|
-
element.selectionEnd,
|
|
43
|
-
],
|
|
40
|
+
selection: [element.selectionStart, element.selectionEnd],
|
|
44
41
|
index,
|
|
45
42
|
};
|
|
46
43
|
}
|
|
@@ -254,9 +254,9 @@ class Input extends Multivalue_1.default {
|
|
|
254
254
|
});
|
|
255
255
|
this.on('blur', (comp) => {
|
|
256
256
|
var _a, _b;
|
|
257
|
-
const el = (_b = (_a = comp.refs) === null || _a === void 0 ? void 0 : _a[
|
|
257
|
+
const el = (_b = (_a = comp.refs) === null || _a === void 0 ? void 0 : _a['announceMessage']) === null || _b === void 0 ? void 0 : _b[0];
|
|
258
258
|
if (el) {
|
|
259
|
-
el.textContent =
|
|
259
|
+
el.textContent = '';
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
return promise;
|
|
@@ -136,11 +136,11 @@ class ListComponent extends Field_1.default {
|
|
|
136
136
|
component: this.component,
|
|
137
137
|
message: err.toString(),
|
|
138
138
|
});
|
|
139
|
-
console.warn(
|
|
139
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
|
140
140
|
}
|
|
141
141
|
updateItems(searchInput, forceUpdate) {
|
|
142
142
|
if (!this.component.data) {
|
|
143
|
-
console.warn(
|
|
143
|
+
console.warn(this.t('noSelectDataConfiguration', { componentKey: this.key }));
|
|
144
144
|
this.itemsLoadedResolve();
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
@@ -174,7 +174,7 @@ class ListComponent extends Field_1.default {
|
|
|
174
174
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
|
175
175
|
}
|
|
176
176
|
catch (ignoreErr) {
|
|
177
|
-
console.warn(
|
|
177
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
@@ -223,7 +223,7 @@ class ListComponent extends Field_1.default {
|
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
if (!window.indexedDB) {
|
|
226
|
-
window.alert(
|
|
226
|
+
window.alert(this.t('indexedDBSupportError'));
|
|
227
227
|
}
|
|
228
228
|
if (this.component.indexeddb &&
|
|
229
229
|
this.component.indexeddb.database &&
|