@formio/js 5.4.1 → 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 +1 -0
- 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 +1 -0
- package/dist/formio.form.js +131 -109
- 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 +1 -0
- package/dist/formio.full.js +155 -133
- 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 +26 -26
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +19 -19
- 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 +5 -5
- package/lib/cjs/components/_classes/component/Component.js +60 -132
- 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.js +10 -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 +23 -63
- 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 +48 -92
- 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 +1 -3
- 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 -82
- package/lib/cjs/translations/en.js +9 -82
- 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 +37 -47
- 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 +5 -5
- package/lib/mjs/components/_classes/component/Component.js +59 -132
- 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.js +9 -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 +23 -63
- 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 +51 -95
- 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 +1 -3
- 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 -82
- package/lib/mjs/translations/en.js +88 -0
- 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 +37 -47
- package/lib/mjs/widgets/CalendarWidget.js +2 -6
- package/package.json +6 -4
|
@@ -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;
|
|
@@ -1251,7 +1234,7 @@ export default class Component extends Element {
|
|
|
1251
1234
|
modalLabel = { className: 'field-required' };
|
|
1252
1235
|
}
|
|
1253
1236
|
return this.renderModalPreview({
|
|
1254
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
|
1237
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
|
1255
1238
|
messages: '',
|
|
1256
1239
|
labelInfo: modalLabel,
|
|
1257
1240
|
});
|
|
@@ -1276,7 +1259,7 @@ export default class Component extends Element {
|
|
|
1276
1259
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1277
1260
|
* @returns {string} - The rendered HTML string of a component.
|
|
1278
1261
|
*/
|
|
1279
|
-
render(children =
|
|
1262
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
|
1280
1263
|
const isVisible = this.visible;
|
|
1281
1264
|
this.rendered = true;
|
|
1282
1265
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
@@ -1485,9 +1468,7 @@ export default class Component extends Element {
|
|
|
1485
1468
|
return;
|
|
1486
1469
|
}
|
|
1487
1470
|
if (!changes.length && flags.changed) {
|
|
1488
|
-
changes = [
|
|
1489
|
-
flags.changed,
|
|
1490
|
-
];
|
|
1471
|
+
changes = [flags.changed];
|
|
1491
1472
|
}
|
|
1492
1473
|
const refreshOn = flags.fromBlur
|
|
1493
1474
|
? this.component.refreshOnBlur
|
|
@@ -1587,10 +1568,11 @@ export default class Component extends Element {
|
|
|
1587
1568
|
/**
|
|
1588
1569
|
* Uses the widget to determine the output string.
|
|
1589
1570
|
* @param {any} value - The current value of the component.
|
|
1590
|
-
* @param {any}
|
|
1571
|
+
* @param {any} _options - The options for getValueAsString.
|
|
1591
1572
|
* @returns {any|Array<any>} - The value as a string.
|
|
1592
1573
|
*/
|
|
1593
|
-
|
|
1574
|
+
// GOTCHA(G-FJS04)
|
|
1575
|
+
getWidgetValueAsString(value, _options) {
|
|
1594
1576
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
1595
1577
|
if (!value || noInputWidget) {
|
|
1596
1578
|
if (!this.widget || !value) {
|
|
@@ -1902,10 +1884,7 @@ export default class Component extends Element {
|
|
|
1902
1884
|
const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
|
|
1903
1885
|
return Templates.current.hasOwnProperty('iconClass')
|
|
1904
1886
|
? Templates.current.iconClass(iconset, name, spinning)
|
|
1905
|
-
: [
|
|
1906
|
-
'fa',
|
|
1907
|
-
'bi',
|
|
1908
|
-
].includes(this.options.iconset)
|
|
1887
|
+
: ['fa', 'bi'].includes(this.options.iconset)
|
|
1909
1888
|
? Templates.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1910
1889
|
: name;
|
|
1911
1890
|
}
|
|
@@ -2087,7 +2066,10 @@ export default class Component extends Element {
|
|
|
2087
2066
|
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
2088
2067
|
*/
|
|
2089
2068
|
conditionallyVisible(data, row) {
|
|
2090
|
-
data =
|
|
2069
|
+
data =
|
|
2070
|
+
data ||
|
|
2071
|
+
(this.root?.submissionSet && _.merge({}, this.root?.subFromServer, this.rootValue)) ||
|
|
2072
|
+
this.rootValue;
|
|
2091
2073
|
row = row || this.data;
|
|
2092
2074
|
if (this.builderMode || this.previewMode) {
|
|
2093
2075
|
return true;
|
|
@@ -2324,9 +2306,7 @@ export default class Component extends Element {
|
|
|
2324
2306
|
};
|
|
2325
2307
|
}
|
|
2326
2308
|
if (!Array.isArray(messages)) {
|
|
2327
|
-
messages = [
|
|
2328
|
-
messages,
|
|
2329
|
-
];
|
|
2309
|
+
messages = [messages];
|
|
2330
2310
|
}
|
|
2331
2311
|
messages = _.uniqBy(messages, (message) => message.message);
|
|
2332
2312
|
if (this.refs.messageContainer) {
|
|
@@ -2477,30 +2457,15 @@ export default class Component extends Element {
|
|
|
2477
2457
|
toolbar: [
|
|
2478
2458
|
[
|
|
2479
2459
|
{
|
|
2480
|
-
size: [
|
|
2481
|
-
'small',
|
|
2482
|
-
false,
|
|
2483
|
-
'large',
|
|
2484
|
-
'huge',
|
|
2485
|
-
],
|
|
2460
|
+
size: ['small', false, 'large', 'huge'],
|
|
2486
2461
|
},
|
|
2487
2462
|
], // custom dropdown
|
|
2488
2463
|
[
|
|
2489
2464
|
{
|
|
2490
|
-
header: [
|
|
2491
|
-
1,
|
|
2492
|
-
2,
|
|
2493
|
-
3,
|
|
2494
|
-
4,
|
|
2495
|
-
5,
|
|
2496
|
-
6,
|
|
2497
|
-
false,
|
|
2498
|
-
],
|
|
2465
|
+
header: [1, 2, 3, 4, 5, 6, false],
|
|
2499
2466
|
},
|
|
2500
2467
|
],
|
|
2501
|
-
[
|
|
2502
|
-
{ font: [] },
|
|
2503
|
-
],
|
|
2468
|
+
[{ font: [] }],
|
|
2504
2469
|
[
|
|
2505
2470
|
'bold',
|
|
2506
2471
|
'italic',
|
|
@@ -2510,10 +2475,7 @@ export default class Component extends Element {
|
|
|
2510
2475
|
{ script: 'super' },
|
|
2511
2476
|
'clean',
|
|
2512
2477
|
],
|
|
2513
|
-
[
|
|
2514
|
-
{ color: [] },
|
|
2515
|
-
{ background: [] },
|
|
2516
|
-
],
|
|
2478
|
+
[{ color: [] }, { background: [] }],
|
|
2517
2479
|
[
|
|
2518
2480
|
{ list: 'ordered' },
|
|
2519
2481
|
{ list: 'bullet' },
|
|
@@ -2521,17 +2483,8 @@ export default class Component extends Element {
|
|
|
2521
2483
|
{ indent: '+1' },
|
|
2522
2484
|
{ align: [] },
|
|
2523
2485
|
],
|
|
2524
|
-
[
|
|
2525
|
-
|
|
2526
|
-
'code-block',
|
|
2527
|
-
],
|
|
2528
|
-
[
|
|
2529
|
-
'link',
|
|
2530
|
-
'image',
|
|
2531
|
-
'video',
|
|
2532
|
-
'formula',
|
|
2533
|
-
'source',
|
|
2534
|
-
],
|
|
2486
|
+
['blockquote', 'code-block'],
|
|
2487
|
+
['link', 'image', 'video', 'formula', 'source'],
|
|
2535
2488
|
],
|
|
2536
2489
|
},
|
|
2537
2490
|
},
|
|
@@ -2553,12 +2506,7 @@ export default class Component extends Element {
|
|
|
2553
2506
|
'imageStyle:alignCenter',
|
|
2554
2507
|
'imageStyle:alignRight',
|
|
2555
2508
|
],
|
|
2556
|
-
styles: [
|
|
2557
|
-
'full',
|
|
2558
|
-
'alignLeft',
|
|
2559
|
-
'alignCenter',
|
|
2560
|
-
'alignRight',
|
|
2561
|
-
],
|
|
2509
|
+
styles: ['full', 'alignLeft', 'alignCenter', 'alignRight'],
|
|
2562
2510
|
},
|
|
2563
2511
|
extraPlugins: [],
|
|
2564
2512
|
},
|
|
@@ -2594,7 +2542,6 @@ export default class Component extends Element {
|
|
|
2594
2542
|
current.prepend(clone);
|
|
2595
2543
|
break;
|
|
2596
2544
|
}
|
|
2597
|
-
;
|
|
2598
2545
|
current = current.parentNode || current.host;
|
|
2599
2546
|
}
|
|
2600
2547
|
return ClassicEditor.create(element, settings).then((editor) => {
|
|
@@ -2615,9 +2562,7 @@ export default class Component extends Element {
|
|
|
2615
2562
|
},
|
|
2616
2563
|
};
|
|
2617
2564
|
// Lazy load the quill css.
|
|
2618
|
-
Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2619
|
-
{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` },
|
|
2620
|
-
], true);
|
|
2565
|
+
Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` }], true);
|
|
2621
2566
|
// Lazy load the quill library.
|
|
2622
2567
|
return Formio.requireLibrary('quill', 'Quill', _.get(this.options, 'editors.quill.src', `${Formio.cdn.quill}/quill.js`), true).then(() => {
|
|
2623
2568
|
return Formio.requireLibrary('quill-table', 'Quill', `${Formio.cdn.baseUrl}/quill/quill-table.js`, true).then(() => {
|
|
@@ -2640,8 +2585,8 @@ export default class Component extends Element {
|
|
|
2640
2585
|
};
|
|
2641
2586
|
// 2. hasFocus: check shadowRoot.activeElement instead of document.activeElement
|
|
2642
2587
|
sel.hasFocus = () => {
|
|
2643
|
-
return root.activeElement === sel.root ||
|
|
2644
|
-
(root.activeElement != null && sel.root.contains(root.activeElement));
|
|
2588
|
+
return (root.activeElement === sel.root ||
|
|
2589
|
+
(root.activeElement != null && sel.root.contains(root.activeElement)));
|
|
2645
2590
|
};
|
|
2646
2591
|
// 3. setNativeRange: use shadowRoot's selection to add/remove ranges
|
|
2647
2592
|
const origSetNativeRange = sel.setNativeRange.bind(sel);
|
|
@@ -2660,9 +2605,12 @@ export default class Component extends Element {
|
|
|
2660
2605
|
const { native } = sel.getNativeRange() || {};
|
|
2661
2606
|
endNode = endNode ?? startNode;
|
|
2662
2607
|
endOffset = endOffset ?? startOffset;
|
|
2663
|
-
if (native == null ||
|
|
2664
|
-
|
|
2665
|
-
|
|
2608
|
+
if (native == null ||
|
|
2609
|
+
force ||
|
|
2610
|
+
startNode !== native.startContainer ||
|
|
2611
|
+
startOffset !== native.startOffset ||
|
|
2612
|
+
endNode !== native.endContainer ||
|
|
2613
|
+
endOffset !== native.endOffset) {
|
|
2666
2614
|
const range = document.createRange();
|
|
2667
2615
|
range.setStart(startNode, startOffset);
|
|
2668
2616
|
range.setEnd(endNode, endOffset);
|
|
@@ -2831,9 +2779,9 @@ export default class Component extends Element {
|
|
|
2831
2779
|
this.component.defaultValue !== undefined));
|
|
2832
2780
|
}
|
|
2833
2781
|
/**
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2782
|
+
* Determine if we should add a default value for this component.
|
|
2783
|
+
* @returns {boolean} - TRUE if a default value should be set
|
|
2784
|
+
*/
|
|
2837
2785
|
get shouldAddDefaultValue() {
|
|
2838
2786
|
return this.pristine && this.allowData && (this.hasDefaultValue || !this.options.noDefaults);
|
|
2839
2787
|
}
|
|
@@ -3264,9 +3212,7 @@ export default class Component extends Element {
|
|
|
3264
3212
|
paths: this.paths,
|
|
3265
3213
|
scope: validationScope,
|
|
3266
3214
|
instance: this,
|
|
3267
|
-
processors: [
|
|
3268
|
-
validateProcessInfo,
|
|
3269
|
-
],
|
|
3215
|
+
processors: [validateProcessInfo],
|
|
3270
3216
|
});
|
|
3271
3217
|
const errors = validationScope.errors;
|
|
3272
3218
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3303,10 +3249,7 @@ export default class Component extends Element {
|
|
|
3303
3249
|
interpolateErrors(errors) {
|
|
3304
3250
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3305
3251
|
return this.serverErrors?.length
|
|
3306
|
-
? [
|
|
3307
|
-
...interpolatedErrors,
|
|
3308
|
-
...this.serverErrors,
|
|
3309
|
-
]
|
|
3252
|
+
? [...interpolatedErrors, ...this.serverErrors]
|
|
3310
3253
|
: interpolatedErrors;
|
|
3311
3254
|
}
|
|
3312
3255
|
/**
|
|
@@ -3354,9 +3297,7 @@ export default class Component extends Element {
|
|
|
3354
3297
|
instance: this,
|
|
3355
3298
|
form: this.root ? this.root._form : {},
|
|
3356
3299
|
scope: { errors: [] },
|
|
3357
|
-
processors: [
|
|
3358
|
-
validateProcessInfo,
|
|
3359
|
-
],
|
|
3300
|
+
processors: [validateProcessInfo],
|
|
3360
3301
|
};
|
|
3361
3302
|
if (async) {
|
|
3362
3303
|
return processOne(processContext).then(() => {
|
|
@@ -3471,9 +3412,7 @@ export default class Component extends Element {
|
|
|
3471
3412
|
return;
|
|
3472
3413
|
}
|
|
3473
3414
|
if (dirty && !isValid) {
|
|
3474
|
-
this.setErrorClasses([
|
|
3475
|
-
this.refs.openModal,
|
|
3476
|
-
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3415
|
+
this.setErrorClasses([this.refs.openModal], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3477
3416
|
}
|
|
3478
3417
|
else {
|
|
3479
3418
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3560,9 +3499,7 @@ export default class Component extends Element {
|
|
|
3560
3499
|
}
|
|
3561
3500
|
if (!Array.isArray(messages)) {
|
|
3562
3501
|
if (messages) {
|
|
3563
|
-
messages = [
|
|
3564
|
-
messages,
|
|
3565
|
-
];
|
|
3502
|
+
messages = [messages];
|
|
3566
3503
|
}
|
|
3567
3504
|
else {
|
|
3568
3505
|
messages = [];
|
|
@@ -3658,7 +3595,7 @@ export default class Component extends Element {
|
|
|
3658
3595
|
}
|
|
3659
3596
|
// Maintain reverse compatibility.
|
|
3660
3597
|
whenReady() {
|
|
3661
|
-
console.warn(
|
|
3598
|
+
console.warn(this.t('whenReadyDeprecation'));
|
|
3662
3599
|
return this.dataReady;
|
|
3663
3600
|
}
|
|
3664
3601
|
get dataReady() {
|
|
@@ -3671,13 +3608,7 @@ export default class Component extends Element {
|
|
|
3671
3608
|
*/
|
|
3672
3609
|
asString(value) {
|
|
3673
3610
|
value = value || this.getValue();
|
|
3674
|
-
return (Array.isArray(value)
|
|
3675
|
-
? value
|
|
3676
|
-
: [
|
|
3677
|
-
value,
|
|
3678
|
-
])
|
|
3679
|
-
.map(_.toString)
|
|
3680
|
-
.join(', ');
|
|
3611
|
+
return (Array.isArray(value) ? value : [value]).map(_.toString).join(', ');
|
|
3681
3612
|
}
|
|
3682
3613
|
/**
|
|
3683
3614
|
* Return if the component is disabled.
|
|
@@ -3929,11 +3860,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3929
3860
|
Component.externalLibraries[name].resolve(plugin);
|
|
3930
3861
|
}
|
|
3931
3862
|
else {
|
|
3932
|
-
src = Array.isArray(src)
|
|
3933
|
-
? src
|
|
3934
|
-
: [
|
|
3935
|
-
src,
|
|
3936
|
-
];
|
|
3863
|
+
src = Array.isArray(src) ? src : [src];
|
|
3937
3864
|
src.forEach((lib) => {
|
|
3938
3865
|
let attrs = {};
|
|
3939
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 &&
|
|
@@ -19,10 +19,7 @@ export default [
|
|
|
19
19
|
tooltip: 'A URL that returns a JSON array to use as the data source.',
|
|
20
20
|
conditional: {
|
|
21
21
|
json: {
|
|
22
|
-
'===': [
|
|
23
|
-
{ var: 'data.dataSrc' },
|
|
24
|
-
'url',
|
|
25
|
-
],
|
|
22
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
},
|
|
@@ -49,10 +46,7 @@ export default [
|
|
|
49
46
|
],
|
|
50
47
|
conditional: {
|
|
51
48
|
json: {
|
|
52
|
-
'===': [
|
|
53
|
-
{ var: 'data.dataSrc' },
|
|
54
|
-
'url',
|
|
55
|
-
],
|
|
49
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
56
50
|
},
|
|
57
51
|
},
|
|
58
52
|
},
|
|
@@ -68,14 +62,7 @@ export default [
|
|
|
68
62
|
tooltip: 'The property of each item in the data source to use as the select value. If not specified, the item itself will be used.',
|
|
69
63
|
conditional: {
|
|
70
64
|
json: {
|
|
71
|
-
in: [
|
|
72
|
-
{ var: 'data.dataSrc' },
|
|
73
|
-
[
|
|
74
|
-
'json',
|
|
75
|
-
'url',
|
|
76
|
-
'custom',
|
|
77
|
-
],
|
|
78
|
-
],
|
|
65
|
+
in: [{ var: 'data.dataSrc' }, ['json', 'url', 'custom']],
|
|
79
66
|
},
|
|
80
67
|
},
|
|
81
68
|
},
|
|
@@ -108,10 +95,7 @@ export default [
|
|
|
108
95
|
tooltip: 'Check this if you would like to use Formio Authentication with the request.',
|
|
109
96
|
conditional: {
|
|
110
97
|
json: {
|
|
111
|
-
'===': [
|
|
112
|
-
{ var: 'data.dataSrc' },
|
|
113
|
-
'url',
|
|
114
|
-
],
|
|
98
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
115
99
|
},
|
|
116
100
|
},
|
|
117
101
|
},
|
|
@@ -126,16 +110,10 @@ export default [
|
|
|
126
110
|
json: {
|
|
127
111
|
or: [
|
|
128
112
|
{
|
|
129
|
-
'===': [
|
|
130
|
-
{ var: 'data.dataSrc' },
|
|
131
|
-
'url',
|
|
132
|
-
],
|
|
113
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
133
114
|
},
|
|
134
115
|
{
|
|
135
|
-
'===': [
|
|
136
|
-
{ var: 'data.dataSrc' },
|
|
137
|
-
'resource',
|
|
138
|
-
],
|
|
116
|
+
'===': [{ var: 'data.dataSrc' }, 'resource'],
|
|
139
117
|
},
|
|
140
118
|
],
|
|
141
119
|
},
|