@formio/js 5.3.6 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.builder.css +31 -5
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.css +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 +31 -5
- package/dist/formio.form.js +2837 -2818
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +31 -5
- package/dist/formio.full.js +3442 -3403
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1152 -1154
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1084 -1086
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +28 -1
- package/lib/cjs/Form.d.ts +4 -2
- package/lib/cjs/Form.js +2 -2
- package/lib/cjs/FormBuilder.d.ts +2 -2
- package/lib/cjs/FormBuilder.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +2 -0
- package/lib/cjs/PDFBuilder.js +6 -1
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +50 -1
- package/lib/cjs/WebformBuilder.js +29 -1
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +11 -0
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +13 -3
- package/lib/cjs/components/_classes/component/Component.js +167 -47
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -1
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/cjs/components/address/Address.js +18 -0
- package/lib/cjs/components/datagrid/DataGrid.js +12 -2
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.js +37 -4
- package/lib/cjs/components/datetime/DateTime.js +11 -1
- package/lib/cjs/components/day/Day.d.ts +0 -15
- package/lib/cjs/components/day/Day.js +8 -17
- package/lib/cjs/components/editgrid/EditGrid.js +11 -1
- package/lib/cjs/components/fieldset/Fieldset.js +1 -0
- package/lib/cjs/components/file/File.d.ts +3 -1
- package/lib/cjs/components/file/File.js +62 -17
- package/lib/cjs/components/form/Form.js +3 -1
- package/lib/cjs/components/number/Number.d.ts +1 -0
- package/lib/cjs/components/number/Number.js +18 -0
- package/lib/cjs/components/select/Select.js +5 -1
- package/lib/cjs/components/signature/Signature.js +5 -5
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/cjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/cjs/formio.form.js +2 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/storage/azure.js +9 -3
- package/lib/cjs/templates/index.d.ts +3 -0
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +2 -0
- package/lib/cjs/utils/i18n.d.ts +1 -0
- package/lib/cjs/utils/i18n.js +2 -0
- package/lib/cjs/utils/index.d.ts +1 -1
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +23 -6
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Embed.js +26 -1
- package/lib/mjs/Form.d.ts +4 -2
- package/lib/mjs/Form.js +2 -2
- package/lib/mjs/FormBuilder.d.ts +2 -2
- package/lib/mjs/FormBuilder.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +2 -0
- package/lib/mjs/PDFBuilder.js +6 -1
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +48 -1
- package/lib/mjs/WebformBuilder.js +28 -1
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +12 -1
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +13 -3
- package/lib/mjs/components/_classes/component/Component.js +164 -46
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -1
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/mjs/components/address/Address.js +17 -0
- package/lib/mjs/components/datagrid/DataGrid.js +14 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.js +36 -4
- package/lib/mjs/components/datetime/DateTime.js +11 -1
- package/lib/mjs/components/day/Day.d.ts +0 -15
- package/lib/mjs/components/day/Day.js +8 -17
- package/lib/mjs/components/editgrid/EditGrid.js +11 -1
- package/lib/mjs/components/fieldset/Fieldset.js +1 -0
- package/lib/mjs/components/file/File.d.ts +3 -1
- package/lib/mjs/components/file/File.js +60 -15
- package/lib/mjs/components/form/Form.js +3 -1
- package/lib/mjs/components/number/Number.d.ts +1 -0
- package/lib/mjs/components/number/Number.js +17 -0
- package/lib/mjs/components/select/Select.js +5 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/mjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/mjs/formio.form.js +4 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/storage/azure.js +9 -3
- package/lib/mjs/templates/index.d.ts +3 -0
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +2 -0
- package/lib/mjs/utils/i18n.d.ts +1 -0
- package/lib/mjs/utils/i18n.js +2 -0
- package/lib/mjs/utils/index.d.ts +1 -1
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +22 -6
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +8 -6
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
/*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */
|
|
22
22
|
|
|
23
|
-
/*! formiojs v5.
|
|
23
|
+
/*! formiojs v5.4.0 | https://unpkg.com/formiojs@5.4.0/LICENSE.txt */
|
|
24
24
|
|
|
25
25
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
26
26
|
|
package/lib/cjs/Embed.js
CHANGED
|
@@ -273,6 +273,7 @@ class Formio {
|
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
static init(element, options = {}, builder = false) {
|
|
276
|
+
var _b;
|
|
276
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
277
278
|
_a.cdn = new CDN_js_1.default(_a.config.cdn, _a.config.cdnUrls || {});
|
|
278
279
|
_a.config.libs = _a.config.libs || {
|
|
@@ -352,6 +353,25 @@ class Formio {
|
|
|
352
353
|
};
|
|
353
354
|
});
|
|
354
355
|
const id = _a.config.id || `formio-${Math.random().toString(36).substring(7)}`;
|
|
356
|
+
const hasQuillComponent = (components = []) => {
|
|
357
|
+
if (!Array.isArray(components)) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
return components.some((component) => {
|
|
361
|
+
var _b, _c;
|
|
362
|
+
if (!component || typeof component !== 'object') {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
const isQuillTextarea = component.type === 'textarea' &&
|
|
366
|
+
component.wysiwyg === true &&
|
|
367
|
+
component.editor === 'quill';
|
|
368
|
+
return (isQuillTextarea ||
|
|
369
|
+
hasQuillComponent(component.components) ||
|
|
370
|
+
hasQuillComponent((_b = component.columns) === null || _b === void 0 ? void 0 : _b.flatMap((column) => column.components || [])) ||
|
|
371
|
+
hasQuillComponent((_c = component.rows) === null || _c === void 0 ? void 0 : _c.flatMap((row) => row.flatMap((cell) => cell.components || []))));
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
const disableShadowForQuill = hasQuillComponent((_b = _a.config.form) === null || _b === void 0 ? void 0 : _b.components);
|
|
355
375
|
// Create a new wrapper and add the element inside of a new wrapper.
|
|
356
376
|
let wrapper = _a.createElement('div', {
|
|
357
377
|
id: `${id}-wrapper`,
|
|
@@ -360,12 +380,19 @@ class Formio {
|
|
|
360
380
|
// If we include the libraries, then we will attempt to run this in shadow dom.
|
|
361
381
|
const useShadowDom = _a.config.includeLibs &&
|
|
362
382
|
!_a.config.noshadow &&
|
|
383
|
+
!disableShadowForQuill &&
|
|
363
384
|
typeof wrapper.attachShadow === 'function';
|
|
364
385
|
if (useShadowDom) {
|
|
365
386
|
wrapper = wrapper.attachShadow({
|
|
366
387
|
mode: 'open',
|
|
367
388
|
});
|
|
368
389
|
options.shadowRoot = wrapper;
|
|
390
|
+
// Due to an issue with quill not loading styles in the shadowdom, we need to add quill styles and js to the shadowdom
|
|
391
|
+
const quill = {
|
|
392
|
+
js: `${_a.cdn.quill}/quill.js`,
|
|
393
|
+
css: `${_a.cdn.quill}/quill.snow.css`
|
|
394
|
+
};
|
|
395
|
+
yield _a.addLibrary(wrapper, quill, 'quill');
|
|
369
396
|
}
|
|
370
397
|
element.parentNode.removeChild(element);
|
|
371
398
|
wrapper.appendChild(element);
|
|
@@ -481,7 +508,7 @@ Formio.formioReady = new Promise((ready, reject) => {
|
|
|
481
508
|
_a._formioReady = ready;
|
|
482
509
|
_a._formioReadyReject = reject;
|
|
483
510
|
});
|
|
484
|
-
Formio.version = '5.
|
|
511
|
+
Formio.version = '5.4.0';
|
|
485
512
|
// Create a report.
|
|
486
513
|
Formio.Report = {
|
|
487
514
|
create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
package/lib/cjs/Form.d.ts
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
|
46
46
|
* @property {boolean} [readOnly] - Set this form to readOnly.
|
|
47
47
|
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
|
48
|
-
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
|
48
|
+
* @property {{[key: string]: string} | { translationsUrl: string }} [i18n] - The translation file for this rendering.
|
|
49
49
|
* @property {string} [template] - Custom logic for creation of elements.
|
|
50
50
|
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
|
51
51
|
* @property {any} [fileService] - The file service for this form.
|
|
@@ -202,6 +202,8 @@ export type FormOptions = {
|
|
|
202
202
|
*/
|
|
203
203
|
i18n?: {
|
|
204
204
|
[key: string]: string;
|
|
205
|
+
} | {
|
|
206
|
+
translationsUrl: string;
|
|
205
207
|
} | undefined;
|
|
206
208
|
/**
|
|
207
209
|
* - Custom logic for creation of elements.
|
|
@@ -236,7 +238,7 @@ export type FormOptions = {
|
|
|
236
238
|
/**
|
|
237
239
|
* - The render mode for this form.
|
|
238
240
|
*/
|
|
239
|
-
renderMode?: "
|
|
241
|
+
renderMode?: "form" | "builder" | "html" | "flat" | "pdf" | undefined;
|
|
240
242
|
/**
|
|
241
243
|
* - Highlight any errors on the form.
|
|
242
244
|
*/
|
package/lib/cjs/Form.js
CHANGED
|
@@ -56,7 +56,7 @@ const utils_1 = __importDefault(require("./utils"));
|
|
|
56
56
|
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
|
57
57
|
* @property {boolean} [readOnly] - Set this form to readOnly.
|
|
58
58
|
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
|
59
|
-
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
|
59
|
+
* @property {{[key: string]: string} | { translationsUrl: string }} [i18n] - The translation file for this rendering.
|
|
60
60
|
* @property {string} [template] - Custom logic for creation of elements.
|
|
61
61
|
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
|
62
62
|
* @property {any} [fileService] - The file service for this form.
|
|
@@ -360,7 +360,7 @@ class Form extends Element_1.default {
|
|
|
360
360
|
return Promise.resolve(this.instance);
|
|
361
361
|
}
|
|
362
362
|
this.form.display = display;
|
|
363
|
-
this.instance.destroy();
|
|
363
|
+
this.instance.destroy(true);
|
|
364
364
|
this.instance = this.create(display);
|
|
365
365
|
return this.setForm(this.form).then(() => {
|
|
366
366
|
this.instance.emit('setDisplay', this.form.display);
|
package/lib/cjs/FormBuilder.d.ts
CHANGED
|
@@ -73,11 +73,11 @@ export default class FormBuilder extends Form {
|
|
|
73
73
|
/**
|
|
74
74
|
* Creates a new form builder.
|
|
75
75
|
* @param {HTMLElement} element - The HTML element to place the form builder.
|
|
76
|
-
* @param {string | object} form - The form to pass to the builder
|
|
76
|
+
* @param {string | object | undefined} form - The form to pass to the builder
|
|
77
77
|
* @param {FormBuilderOptions} options - The options to create this builder.
|
|
78
78
|
* @returns {FormBuilder} - The form builder instance.
|
|
79
79
|
*/
|
|
80
|
-
constructor(element: HTMLElement, form: string | object, options: {
|
|
80
|
+
constructor(element: HTMLElement, form: string | object | undefined, options: {
|
|
81
81
|
/**
|
|
82
82
|
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
83
83
|
*/
|
package/lib/cjs/FormBuilder.js
CHANGED
|
@@ -10,7 +10,7 @@ class FormBuilder extends Form_1.default {
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a new form builder.
|
|
12
12
|
* @param {HTMLElement} element - The HTML element to place the form builder.
|
|
13
|
-
* @param {string | object} form - The form to pass to the builder
|
|
13
|
+
* @param {string | object | undefined} form - The form to pass to the builder
|
|
14
14
|
* @param {FormBuilderOptions} options - The options to create this builder.
|
|
15
15
|
* @returns {FormBuilder} - The form builder instance.
|
|
16
16
|
*/
|
package/lib/cjs/Formio.js
CHANGED
|
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
|
|
|
11
11
|
const providers_1 = __importDefault(require("./providers"));
|
|
12
12
|
sdk_1.Formio.cdn = new CDN_1.default();
|
|
13
13
|
sdk_1.Formio.Providers = providers_1.default;
|
|
14
|
-
sdk_1.Formio.version = '5.
|
|
14
|
+
sdk_1.Formio.version = '5.4.0';
|
|
15
15
|
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc')
|
|
16
16
|
? 'https://cdn.test-form.io'
|
|
17
17
|
: 'https://cdn.form.io';
|
package/lib/cjs/PDF.js
CHANGED
|
@@ -17,9 +17,11 @@ class PDF extends Webform_1.default {
|
|
|
17
17
|
// Handle an iframe submission.
|
|
18
18
|
this.on('iframe-submission', (submission) => this.setValue(submission, {
|
|
19
19
|
fromIframe: true,
|
|
20
|
+
noDefault: true
|
|
20
21
|
}), true);
|
|
21
22
|
this.on('iframe-change', (submission) => this.setValue(submission, {
|
|
22
23
|
fromIframe: true,
|
|
24
|
+
noDefault: true
|
|
23
25
|
}), true);
|
|
24
26
|
this.on('iframe-getIframePositions', (query) => {
|
|
25
27
|
const iframe = document.getElementById(`iframe-${query.formId}`);
|
package/lib/cjs/PDFBuilder.js
CHANGED
|
@@ -233,7 +233,12 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
|
233
233
|
nonFillableConversionUsed: autoConversionComponentsAssigned && result.data.formfields.nonFillableConversionUsed,
|
|
234
234
|
});
|
|
235
235
|
this.emit('pdfUploaded', result.data);
|
|
236
|
-
|
|
236
|
+
if (autoConversionComponentsAssigned) {
|
|
237
|
+
this.rebuild();
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.redraw();
|
|
241
|
+
}
|
|
237
242
|
})
|
|
238
243
|
.catch((err) => this.setUploadError(err));
|
|
239
244
|
}
|
package/lib/cjs/Webform.d.ts
CHANGED
|
@@ -372,6 +372,7 @@ declare class Webform extends NestedDataComponent {
|
|
|
372
372
|
submit(before?: boolean, options?: any): Promise<any>;
|
|
373
373
|
submitUrl(URL: any, headers: any): void;
|
|
374
374
|
triggerCaptcha(components?: null): void;
|
|
375
|
+
loadTranslations(): Promise<any>;
|
|
375
376
|
_nosubmit: any;
|
|
376
377
|
get conditions(): any;
|
|
377
378
|
get variables(): any;
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -575,7 +575,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
575
575
|
}
|
|
576
576
|
this.initialized = false;
|
|
577
577
|
const rebuild = this.rebuild() || Promise.resolve();
|
|
578
|
-
return
|
|
578
|
+
return this.loadTranslations()
|
|
579
|
+
.then(() => rebuild)
|
|
580
|
+
.then(() => {
|
|
579
581
|
this.emit('formLoad', form);
|
|
580
582
|
if (!this.options.server) {
|
|
581
583
|
this.triggerCaptcha();
|
|
@@ -1125,6 +1127,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1125
1127
|
this.setPristine(true);
|
|
1126
1128
|
// We want to return the submitted submission and setValue will mutate the submission so cloneDeep it here.
|
|
1127
1129
|
this.setValue((0, utils_1.fastCloneDeep)(submission), {
|
|
1130
|
+
noDefault: true,
|
|
1128
1131
|
noValidate: true,
|
|
1129
1132
|
noCheck: true,
|
|
1130
1133
|
});
|
|
@@ -1283,6 +1286,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1283
1286
|
}
|
|
1284
1287
|
}
|
|
1285
1288
|
setMetadata(submission) {
|
|
1289
|
+
var _a, _b;
|
|
1286
1290
|
// Add in metadata about client submitting the form
|
|
1287
1291
|
submission.metadata = submission.metadata || {};
|
|
1288
1292
|
lodash_1.default.defaults(submission.metadata, {
|
|
@@ -1294,6 +1298,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1294
1298
|
userAgent: navigator.userAgent,
|
|
1295
1299
|
pathName: window.location.pathname,
|
|
1296
1300
|
onLine: navigator.onLine,
|
|
1301
|
+
language: ((_a = this.i18next) === null || _a === void 0 ? void 0 : _a.originalLanguage) || this.options.language || ((_b = this.i18next) === null || _b === void 0 ? void 0 : _b.language),
|
|
1297
1302
|
});
|
|
1298
1303
|
}
|
|
1299
1304
|
submitForm(options = {}, local = false) {
|
|
@@ -1526,6 +1531,50 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1526
1531
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
|
1527
1532
|
}
|
|
1528
1533
|
}
|
|
1534
|
+
loadTranslations() {
|
|
1535
|
+
var _a;
|
|
1536
|
+
// We only need a resolve since if translations cannot load, we still want to proceed and render the for
|
|
1537
|
+
let translationsLoadResolve;
|
|
1538
|
+
const promise = new Promise((resolve) => {
|
|
1539
|
+
translationsLoadResolve = resolve;
|
|
1540
|
+
});
|
|
1541
|
+
const translationsUrl = typeof ((_a = this.options.i18n) === null || _a === void 0 ? void 0 : _a.translationsUrl) === 'string'
|
|
1542
|
+
? this.options.i18n.translationsUrl
|
|
1543
|
+
: null;
|
|
1544
|
+
if (translationsUrl) {
|
|
1545
|
+
const url = this.sanitize(this.interpolate(translationsUrl, {}), this.shouldSanitizeValue);
|
|
1546
|
+
Formio_1.Formio.makeStaticRequest(url, 'GET')
|
|
1547
|
+
.then((response) => {
|
|
1548
|
+
let languages = response;
|
|
1549
|
+
try {
|
|
1550
|
+
if (typeof languages == 'string') {
|
|
1551
|
+
languages = JSON.parse(languages);
|
|
1552
|
+
}
|
|
1553
|
+
this.i18next.setLanguages(languages);
|
|
1554
|
+
this.i18next.changeLanguage(this.i18next.originalLanguage, (err) => {
|
|
1555
|
+
if (err) {
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
this.emit('languageChanged');
|
|
1559
|
+
});
|
|
1560
|
+
this.redraw();
|
|
1561
|
+
translationsLoadResolve();
|
|
1562
|
+
}
|
|
1563
|
+
catch (err) {
|
|
1564
|
+
console.warn(err.message);
|
|
1565
|
+
translationsLoadResolve();
|
|
1566
|
+
}
|
|
1567
|
+
})
|
|
1568
|
+
.catch((err) => {
|
|
1569
|
+
console.warn(err);
|
|
1570
|
+
translationsLoadResolve();
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
translationsLoadResolve();
|
|
1575
|
+
}
|
|
1576
|
+
return promise;
|
|
1577
|
+
}
|
|
1529
1578
|
set nosubmit(value) {
|
|
1530
1579
|
this._nosubmit = !!value;
|
|
1531
1580
|
this.emit('nosubmit', this._nosubmit);
|
|
@@ -379,11 +379,14 @@ class WebformBuilder extends Component_1.default {
|
|
|
379
379
|
this.attachTooltip(component.refs.editComponent, this.t('Edit'));
|
|
380
380
|
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, {
|
|
381
381
|
inDataGrid: component.isInDataGrid,
|
|
382
|
+
editComponentPath: component.path,
|
|
382
383
|
}));
|
|
383
384
|
}
|
|
384
385
|
if (component.refs.editJson) {
|
|
385
386
|
this.attachTooltip(component.refs.editJson, this.t('Edit JSON'));
|
|
386
|
-
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component
|
|
387
|
+
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component, {
|
|
388
|
+
editComponentPath: component.path,
|
|
389
|
+
}));
|
|
387
390
|
}
|
|
388
391
|
if (component.refs.removeComponent) {
|
|
389
392
|
this.attachTooltip(component.refs.removeComponent, this.t('Remove'));
|
|
@@ -949,7 +952,22 @@ class WebformBuilder extends Component_1.default {
|
|
|
949
952
|
rebuild = Promise.resolve();
|
|
950
953
|
}
|
|
951
954
|
return rebuild.then(() => {
|
|
955
|
+
// Get the updated `toIndex` after the component has been inserted/rebuilt
|
|
956
|
+
const toIndex = lodash_1.default.findIndex(target.formioContainer, { key: info.key });
|
|
952
957
|
this.emit('addComponent', info, parent, path, index, isNew && !this.options.noNewEdit && !info.noNewEdit);
|
|
958
|
+
// If this is not a new component — it means it was moved
|
|
959
|
+
if (!isNew) {
|
|
960
|
+
const payload = {
|
|
961
|
+
component: info,
|
|
962
|
+
parent,
|
|
963
|
+
path,
|
|
964
|
+
fromIndex: index,
|
|
965
|
+
toIndex,
|
|
966
|
+
timestamp: new Date()
|
|
967
|
+
};
|
|
968
|
+
// New event that allows explicit tracking of reordering
|
|
969
|
+
this.emit('moveComponent', payload);
|
|
970
|
+
}
|
|
953
971
|
if (!isNew || this.options.noNewEdit || info.noNewEdit) {
|
|
954
972
|
this.emit('change', this.form);
|
|
955
973
|
}
|
|
@@ -1080,10 +1098,19 @@ class WebformBuilder extends Component_1.default {
|
|
|
1080
1098
|
}
|
|
1081
1099
|
}
|
|
1082
1100
|
updateComponent(component, changed) {
|
|
1101
|
+
var _a, _b;
|
|
1083
1102
|
const sanitizeConfig = lodash_1.default.get(this.webform, 'form.settings.sanitizeConfig') ||
|
|
1084
1103
|
lodash_1.default.get(this.webform, 'form.globalSettings.sanitizeConfig');
|
|
1085
1104
|
// Update the preview.
|
|
1086
1105
|
if (this.preview) {
|
|
1106
|
+
if (((_a = changed === null || changed === void 0 ? void 0 : changed.instance) === null || _a === void 0 ? void 0 : _a.key) === 'allowMultipleMasks' && (changed === null || changed === void 0 ? void 0 : changed.value) === false) {
|
|
1107
|
+
const changedComp = (_b = this.preview) === null || _b === void 0 ? void 0 : _b.getComponent(component.key);
|
|
1108
|
+
if (changedComp) {
|
|
1109
|
+
const emptyValue = changedComp.emptyValue;
|
|
1110
|
+
changedComp.dataValue = emptyValue;
|
|
1111
|
+
component.defaultValue = emptyValue;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1087
1114
|
this.preview.form = {
|
|
1088
1115
|
components: [
|
|
1089
1116
|
lodash_1.default.omit(Object.assign({}, component), [
|
|
@@ -1403,6 +1430,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1403
1430
|
// Pass along the form being edited.
|
|
1404
1431
|
editFormOptions.editForm = this.form;
|
|
1405
1432
|
editFormOptions.editComponent = component;
|
|
1433
|
+
editFormOptions.editComponentPath = flags.editComponentPath;
|
|
1406
1434
|
editFormOptions.flags = flags;
|
|
1407
1435
|
this.hook('editComponentParentInstance', editFormOptions, parent);
|
|
1408
1436
|
this.editForm = new Webform_1.default(Object.assign(Object.assign(Object.assign(Object.assign({}, lodash_1.default.omit(this.options, [
|
package/lib/cjs/Wizard.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ declare class Wizard extends Webform {
|
|
|
90
90
|
nextPage(): Promise<void>;
|
|
91
91
|
validateCurrentPage(flags?: {}): any;
|
|
92
92
|
emitPrevPage(): void;
|
|
93
|
+
announceCurrentPage(): void;
|
|
93
94
|
prevPage(): Promise<void>;
|
|
94
95
|
cancel(noconfirm: any): Promise<void> | Promise<number>;
|
|
95
96
|
getPageIndexByKey(key: any): number;
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -715,6 +715,7 @@ class Wizard extends Webform_1.default {
|
|
|
715
715
|
}
|
|
716
716
|
emitNextPage() {
|
|
717
717
|
this.emit('nextPage', { page: this.page, submission: this.submission });
|
|
718
|
+
this.announceCurrentPage();
|
|
718
719
|
}
|
|
719
720
|
nextPage() {
|
|
720
721
|
// Read-only forms should not worry about validation before going to next page, nor should they submit.
|
|
@@ -760,6 +761,16 @@ class Wizard extends Webform_1.default {
|
|
|
760
761
|
}
|
|
761
762
|
emitPrevPage() {
|
|
762
763
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
764
|
+
this.announceCurrentPage();
|
|
765
|
+
}
|
|
766
|
+
announceCurrentPage() {
|
|
767
|
+
if (lodash_1.default.get(this.form, 'settings.wizardHeaderType', '') === 'StepIndicator') {
|
|
768
|
+
(0, utils_1.screenReaderSpeech)(`Now on step ${this.page + 1} of ${this.pages.length}: ${lodash_1.default.get(this.currentPage, 'component.title')}`);
|
|
769
|
+
const currentLink = lodash_1.default.get(this.refs, `${this.wizardKey}-link.[${this.page}]`);
|
|
770
|
+
if (currentLink) {
|
|
771
|
+
currentLink.focus();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
763
774
|
}
|
|
764
775
|
prevPage() {
|
|
765
776
|
return this.beforePage().then(() => {
|
|
@@ -2,6 +2,7 @@ export default class Components {
|
|
|
2
2
|
static _editFormUtils: {
|
|
3
3
|
sortAndFilterComponents(components: any): any;
|
|
4
4
|
unifyComponents(objValue: any, srcValue: any): any;
|
|
5
|
+
tokenVariableDescription(): string;
|
|
5
6
|
logicVariablesTable(additional: any): {
|
|
6
7
|
type: string;
|
|
7
8
|
tag: string;
|
|
@@ -86,6 +87,7 @@ export default class Components {
|
|
|
86
87
|
static set EditFormUtils(value: {
|
|
87
88
|
sortAndFilterComponents(components: any): any;
|
|
88
89
|
unifyComponents(objValue: any, srcValue: any): any;
|
|
90
|
+
tokenVariableDescription(): string;
|
|
89
91
|
logicVariablesTable(additional: any): {
|
|
90
92
|
type: string;
|
|
91
93
|
tag: string;
|
|
@@ -169,6 +171,7 @@ export default class Components {
|
|
|
169
171
|
static get EditFormUtils(): {
|
|
170
172
|
sortAndFilterComponents(components: any): any;
|
|
171
173
|
unifyComponents(objValue: any, srcValue: any): any;
|
|
174
|
+
tokenVariableDescription(): string;
|
|
172
175
|
logicVariablesTable(additional: any): {
|
|
173
176
|
type: string;
|
|
174
177
|
tag: string;
|
|
@@ -177,6 +177,7 @@ declare class Component extends Element {
|
|
|
177
177
|
* @returns {boolean} - If the parent should conditionally clear.
|
|
178
178
|
*/
|
|
179
179
|
parentShouldConditionallyClear(): boolean;
|
|
180
|
+
hasCondionallyHiddenLayoutParent(): boolean;
|
|
180
181
|
parentConditionallyHidden(): boolean;
|
|
181
182
|
/**
|
|
182
183
|
* Returns true if any of the parents default their component "hidden" property to true.
|
|
@@ -593,6 +594,15 @@ declare class Component extends Element {
|
|
|
593
594
|
* @returns {string} - The custom style
|
|
594
595
|
*/
|
|
595
596
|
get customStyle(): string;
|
|
597
|
+
/**
|
|
598
|
+
* Build custom styles from the styles form option or global config.
|
|
599
|
+
* @param {string[]} templateNames - The possible template names.
|
|
600
|
+
* @returns {{ [refName: string]: string[] }} - The custom styles object for the named template.
|
|
601
|
+
* @todo - Rename this to a better method name that doesn't clash
|
|
602
|
+
*/
|
|
603
|
+
getCustomStyles(templateNames: string[]): {
|
|
604
|
+
[refName: string]: string[];
|
|
605
|
+
};
|
|
596
606
|
/**
|
|
597
607
|
* Returns if the application is on a mobile device.
|
|
598
608
|
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
@@ -927,9 +937,9 @@ declare class Component extends Element {
|
|
|
927
937
|
*/
|
|
928
938
|
get hasDefaultValue(): boolean;
|
|
929
939
|
/**
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
940
|
+
* Determine if we should add a default value for this component.
|
|
941
|
+
* @returns {boolean} - TRUE if a default value should be set
|
|
942
|
+
*/
|
|
933
943
|
get shouldAddDefaultValue(): boolean;
|
|
934
944
|
/**
|
|
935
945
|
* Get the default value of this component.
|