@formio/js 5.1.0-dev.6048.569bfc1 → 5.1.0-dev.6049.6110ca0
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/Changelog.md +99 -310
- package/README.md +7 -0
- package/dist/formio.builder.css +1 -0
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +1 -0
- package/dist/formio.form.js +658 -669
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +685 -696
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- package/dist/formio.js +90 -68
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +103 -81
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/lib/cjs/Element.d.ts +2 -1
- package/lib/cjs/Element.js +18 -39
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +10 -11
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +14 -15
- package/lib/cjs/WebformBuilder.d.ts +2 -1
- package/lib/cjs/WebformBuilder.js +62 -20
- package/lib/cjs/Wizard.d.ts +2 -2
- package/lib/cjs/Wizard.js +40 -26
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/cjs/components/_classes/component/Component.js +156 -95
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/cjs/components/address/Address.d.ts +8 -0
- package/lib/cjs/components/address/Address.js +32 -9
- package/lib/cjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +7 -11
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.js +5 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +15 -13
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/cjs/components/day/Day.js +2 -2
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.js +4 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.js +6 -2
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/cjs/components/form/Form.d.ts +0 -1
- package/lib/cjs/components/form/Form.js +31 -23
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.d.ts +8 -0
- package/lib/cjs/components/radio/Radio.js +16 -6
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +21 -5
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +10 -2
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/textfield/TextField.js +9 -32
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/cjs/components/unknown/Unknown.form.js +13 -9
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/cjs/translations/en.d.ts +1 -234
- package/lib/cjs/translations/en.js +4 -2
- package/lib/cjs/utils/Evaluator.d.ts +20 -6
- package/lib/cjs/utils/Evaluator.js +38 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +169 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +31 -37
- package/lib/cjs/utils/utils.js +80 -135
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/cjs/widgets/CalendarWidget.js +19 -40
- package/lib/mjs/Element.d.ts +2 -1
- package/lib/mjs/Element.js +11 -9
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +9 -10
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +12 -13
- package/lib/mjs/WebformBuilder.d.ts +2 -1
- package/lib/mjs/WebformBuilder.js +53 -13
- package/lib/mjs/Wizard.d.ts +2 -2
- package/lib/mjs/Wizard.js +38 -24
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/mjs/components/_classes/component/Component.js +129 -45
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/mjs/components/address/Address.d.ts +8 -0
- package/lib/mjs/components/address/Address.js +32 -9
- package/lib/mjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +7 -10
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +15 -13
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/mjs/components/day/Day.js +2 -2
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.js +4 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.js +6 -2
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/mjs/components/form/Form.d.ts +0 -1
- package/lib/mjs/components/form/Form.js +30 -23
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.d.ts +8 -0
- package/lib/mjs/components/radio/Radio.js +16 -6
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +21 -5
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +10 -2
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/textfield/TextField.js +3 -3
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/mjs/components/unknown/Unknown.form.js +13 -9
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +3 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/mjs/translations/en.d.ts +1 -234
- package/lib/mjs/translations/en.js +6 -47
- package/lib/mjs/utils/Evaluator.d.ts +20 -6
- package/lib/mjs/utils/Evaluator.js +31 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +169 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +31 -37
- package/lib/mjs/utils/utils.js +72 -109
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/mjs/widgets/CalendarWidget.js +19 -40
- package/package.json +8 -6
- package/lib/cjs/i18n.d.ts +0 -13
- package/lib/cjs/i18n.js +0 -19
- package/lib/cjs/utils/i18n.d.ts +0 -19
- package/lib/cjs/utils/i18n.js +0 -120
- package/lib/mjs/i18n.d.ts +0 -13
- package/lib/mjs/i18n.js +0 -14
- package/lib/mjs/utils/i18n.d.ts +0 -19
- package/lib/mjs/utils/i18n.js +0 -112
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
22
22
|
|
23
|
+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
|
24
|
+
|
23
25
|
/*! formiojs v5.1.0-dev.2 | https://unpkg.com/formiojs@5.1.0-dev.2/LICENSE.txt */
|
24
26
|
|
25
27
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
@@ -43,4 +45,4 @@
|
|
43
45
|
|
44
46
|
//! moment.js
|
45
47
|
|
46
|
-
//! version : 0.5.
|
48
|
+
//! version : 0.5.48
|
package/lib/cjs/Element.d.ts
CHANGED
@@ -170,10 +170,11 @@ export default class Element {
|
|
170
170
|
/**
|
171
171
|
* Translate a text using the i18n system.
|
172
172
|
* @param {string|Array<string>} text - The i18n identifier.
|
173
|
+
* @param {any} data - contextual data object containing data, component, row, etc.
|
173
174
|
* @param {...any} args - The arguments to pass to the i18n translation.
|
174
175
|
* @returns {string} - The translated text.
|
175
176
|
*/
|
176
|
-
t(text: string | Array<string>, ...args: any[]): string;
|
177
|
+
t(text: string | Array<string>, data: any, ...args: any[]): string;
|
177
178
|
/**
|
178
179
|
* Alias to create a text node.
|
179
180
|
* @param {string} text - The text to create.
|
package/lib/cjs/Element.js
CHANGED
@@ -1,38 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
4
|
};
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
30
|
-
const Formio_1 = require("./Formio");
|
31
|
-
const FormioUtils = __importStar(require("./utils/utils"));
|
32
|
-
const i18n_1 = require("./utils/i18n");
|
33
6
|
const lodash_1 = __importDefault(require("lodash"));
|
34
7
|
const moment_1 = __importDefault(require("moment"));
|
35
8
|
const vanilla_text_mask_1 = __importDefault(require("@formio/vanilla-text-mask"));
|
9
|
+
const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
10
|
+
const Formio_1 = require("./Formio");
|
11
|
+
const utils_1 = __importDefault(require("./utils"));
|
12
|
+
const core_1 = require("@formio/core");
|
13
|
+
const en_1 = __importDefault(require("./translations/en"));
|
36
14
|
/**
|
37
15
|
* The root component for all elements within the Form.io renderer.
|
38
16
|
*/
|
@@ -56,7 +34,7 @@ class Element {
|
|
56
34
|
* can also be provided from the component.id value passed into the constructor.
|
57
35
|
* @type {string}
|
58
36
|
*/
|
59
|
-
this.id =
|
37
|
+
this.id = utils_1.default.getRandomComponentId();
|
60
38
|
/**
|
61
39
|
* An array of event handlers so that the destry command can deregister them.
|
62
40
|
* @type {Array}
|
@@ -67,7 +45,7 @@ class Element {
|
|
67
45
|
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.language) {
|
68
46
|
this.options.i18n.language = this.options.language;
|
69
47
|
}
|
70
|
-
this.options.i18next = this.i18next = this.options.i18next ||
|
48
|
+
this.options.i18next = this.i18next = this.options.i18next || core_1.I18n.init(Object.assign({ en: en_1.default }, this.options.i18n));
|
71
49
|
/**
|
72
50
|
* An instance of the EventEmitter class to handle the emitting and registration of events.
|
73
51
|
* @type {EventEmitter}
|
@@ -385,7 +363,7 @@ class Element {
|
|
385
363
|
*/
|
386
364
|
setInputMask(input, inputMask, usePlaceholder) {
|
387
365
|
if (input && inputMask) {
|
388
|
-
const mask =
|
366
|
+
const mask = utils_1.default.getInputMask(inputMask, this.placeholderChar);
|
389
367
|
this.defaultMask = mask;
|
390
368
|
try {
|
391
369
|
//destroy previous mask
|
@@ -415,11 +393,12 @@ class Element {
|
|
415
393
|
/**
|
416
394
|
* Translate a text using the i18n system.
|
417
395
|
* @param {string|Array<string>} text - The i18n identifier.
|
396
|
+
* @param {any} data - contextual data object containing data, component, row, etc.
|
418
397
|
* @param {...any} args - The arguments to pass to the i18n translation.
|
419
398
|
* @returns {string} - The translated text.
|
420
399
|
*/
|
421
|
-
t(text, ...args) {
|
422
|
-
return this.i18next ? this.i18next.t(text, ...args) : text;
|
400
|
+
t(text, data, ...args) {
|
401
|
+
return this.i18next ? this.i18next.t(text, data, ...args) : text;
|
423
402
|
}
|
424
403
|
/**
|
425
404
|
* Alias to create a text node.
|
@@ -522,8 +501,8 @@ class Element {
|
|
522
501
|
var _a;
|
523
502
|
return Object.assign({
|
524
503
|
_: lodash_1.default,
|
525
|
-
utils:
|
526
|
-
util:
|
504
|
+
utils: utils_1.default,
|
505
|
+
util: utils_1.default,
|
527
506
|
user: Formio_1.Formio.getUser(),
|
528
507
|
moment: moment_1.default,
|
529
508
|
instance: this,
|
@@ -548,15 +527,15 @@ class Element {
|
|
548
527
|
*/
|
549
528
|
interpolate(string, data, options = {}) {
|
550
529
|
if (typeof string !== 'function' && (this.component.content || this.component.html)
|
551
|
-
&& !
|
552
|
-
string =
|
530
|
+
&& !utils_1.default.Evaluator.templateSettings.interpolate.test(string)) {
|
531
|
+
string = utils_1.default.translateHTMLTemplate(String(string), (value) => this.t(value));
|
553
532
|
}
|
554
533
|
if (this.component.filter === string && !this.options.building) {
|
555
534
|
const evalContext = this.evalContext(data);
|
556
535
|
evalContext.data = lodash_1.default.mapValues(evalContext.data, (val) => lodash_1.default.isString(val) ? encodeURIComponent(val) : val);
|
557
|
-
return
|
536
|
+
return utils_1.default.Evaluator.interpolate(string, evalContext, options);
|
558
537
|
}
|
559
|
-
return
|
538
|
+
return utils_1.default.Evaluator.interpolate(string, this.evalContext(data), options);
|
560
539
|
}
|
561
540
|
/**
|
562
541
|
* Performs an evaluation using the evaluation context of this component.
|
@@ -568,7 +547,7 @@ class Element {
|
|
568
547
|
* @returns {*} - The result of the evaluation.
|
569
548
|
*/
|
570
549
|
evaluate(func, args, ret, interpolate, options = {}) {
|
571
|
-
return
|
550
|
+
return utils_1.default.evaluate(func, this.evalContext(args), ret, interpolate, options);
|
572
551
|
}
|
573
552
|
/**
|
574
553
|
* Allow for options to hook into the functionality of this renderer.
|
package/lib/cjs/EventEmitter.js
CHANGED
@@ -1,30 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
3
|
const eventemitter3_1 = require("eventemitter3");
|
27
|
-
const
|
4
|
+
const utils_1 = require("./utils");
|
28
5
|
class EventEmitter extends eventemitter3_1.EventEmitter {
|
29
6
|
constructor(conf = {}) {
|
30
7
|
const { loadLimit = 1000, eventsSafeInterval = 300 } = conf;
|
@@ -38,7 +15,7 @@ class EventEmitter extends eventemitter3_1.EventEmitter {
|
|
38
15
|
const overloadHandler = () => {
|
39
16
|
console.warn(`There were more than ${loadLimit} events emitted in ${eventsSafeInterval} ms. It might be caused by events' infinite loop`, this.id);
|
40
17
|
};
|
41
|
-
const dispatch =
|
18
|
+
const dispatch = (0, utils_1.observeOverload)(overloadHandler, {
|
42
19
|
limit: loadLimit,
|
43
20
|
delay: eventsSafeInterval
|
44
21
|
});
|
package/lib/cjs/Form.js
CHANGED
@@ -1,27 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
4
|
};
|
@@ -30,7 +7,7 @@ const Element_1 = __importDefault(require("./Element"));
|
|
30
7
|
const Formio_1 = require("./Formio");
|
31
8
|
const displays_1 = __importDefault(require("./displays"));
|
32
9
|
const templates_1 = __importDefault(require("./templates"));
|
33
|
-
const
|
10
|
+
const utils_1 = __importDefault(require("./utils"));
|
34
11
|
class Form extends Element_1.default {
|
35
12
|
constructor(elementOrForm, formOrOptions, options = {}) {
|
36
13
|
let element, form, formOptions;
|
@@ -324,7 +301,7 @@ class Form extends Element_1.default {
|
|
324
301
|
if (this.options.sanitize === false && !forceSanitize) {
|
325
302
|
return dirty;
|
326
303
|
}
|
327
|
-
return
|
304
|
+
return utils_1.default.sanitize(dirty, this.options);
|
328
305
|
}
|
329
306
|
setContent(element, content, forceSanitize) {
|
330
307
|
if (element instanceof HTMLElement) {
|
package/lib/cjs/PDF.js
CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const Formio_1 = require("./Formio");
|
7
7
|
const Webform_1 = __importDefault(require("./Webform"));
|
8
|
-
const utils_1 = require("./utils
|
8
|
+
const utils_1 = require("./utils");
|
9
9
|
class PDF extends Webform_1.default {
|
10
10
|
constructor(element, options) {
|
11
11
|
options.display = 'pdf';
|
package/lib/cjs/PDFBuilder.d.ts
CHANGED
package/lib/cjs/PDFBuilder.js
CHANGED
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Formio_1 = require("./Formio");
|
8
8
|
const WebformBuilder_1 = __importDefault(require("./WebformBuilder"));
|
9
|
-
const utils_1 = require("./utils
|
10
|
-
const formUtils_1 = require("./utils/formUtils");
|
9
|
+
const utils_1 = require("./utils");
|
11
10
|
const builder_1 = __importDefault(require("./utils/builder"));
|
12
11
|
const PDF_1 = __importDefault(require("./PDF"));
|
13
12
|
class PDFBuilder extends WebformBuilder_1.default {
|
@@ -272,7 +271,7 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
272
271
|
getParentContainer(component) {
|
273
272
|
let container = [];
|
274
273
|
let originalComponent = null;
|
275
|
-
(0,
|
274
|
+
(0, utils_1.eachComponent)(this.webform._form.components, (comp, path, components) => {
|
276
275
|
if (comp.id === component.component.id) {
|
277
276
|
container = components;
|
278
277
|
originalComponent = comp;
|
@@ -452,21 +451,21 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
452
451
|
e.target.style.cursor = 'default';
|
453
452
|
}
|
454
453
|
highlightInvalidComponents() {
|
455
|
-
const
|
454
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
456
455
|
// update elements which path was duplicated if any pathes have been changed
|
457
|
-
if (!lodash_1.default.isEqual(this.
|
458
|
-
(0,
|
459
|
-
if (this.
|
456
|
+
if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
|
457
|
+
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
458
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
460
459
|
this.webform.postMessage({ name: 'updateElement', data: comp.component });
|
461
460
|
}
|
462
461
|
});
|
463
|
-
this.
|
462
|
+
this.repeatablePathsComps = repeatablePathsComps;
|
464
463
|
}
|
465
|
-
if (!
|
464
|
+
if (!repeatablePathsComps.length) {
|
466
465
|
return;
|
467
466
|
}
|
468
|
-
(0,
|
469
|
-
if (this.
|
467
|
+
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
468
|
+
if (this.repeatablePathsComps.includes(comp)) {
|
470
469
|
this.webform.postMessage({
|
471
470
|
name: 'showBuilderErrors',
|
472
471
|
data: {
|
package/lib/cjs/Webform.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}} [
|
48
|
+
* @property {{[key: string]: string}} [enTranslation] - 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.
|
@@ -586,7 +586,7 @@ export type FormOptions = {
|
|
586
586
|
/**
|
587
587
|
* - The translation file for this rendering.
|
588
588
|
*/
|
589
|
-
|
589
|
+
enTranslation?: {
|
590
590
|
[key: string]: string;
|
591
591
|
} | undefined;
|
592
592
|
/**
|
package/lib/cjs/Webform.js
CHANGED
@@ -4,15 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
8
7
|
const compare_versions_1 = require("compare-versions");
|
9
8
|
const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
10
|
-
const
|
9
|
+
const en_1 = __importDefault(require("./translations/en"));
|
11
10
|
const Formio_1 = require("./Formio");
|
12
11
|
const Components_1 = __importDefault(require("./components/Components"));
|
13
12
|
const NestedDataComponent_1 = __importDefault(require("./components/_classes/nesteddata/NestedDataComponent"));
|
14
|
-
const utils_1 = require("./utils
|
15
|
-
const
|
13
|
+
const utils_1 = require("./utils");
|
14
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
16
15
|
// We need this here because dragula pulls in CustomEvent class that requires global to exist.
|
17
16
|
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
18
17
|
window.global = window;
|
@@ -100,7 +99,7 @@ function getOptions(options) {
|
|
100
99
|
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
101
100
|
* @property {boolean} [readOnly] - Set this form to readOnly.
|
102
101
|
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
103
|
-
* @property {{[key: string]: string}} [
|
102
|
+
* @property {{[key: string]: string}} [enTranslation] - The translation file for this rendering.
|
104
103
|
* @property {string} [template] - Custom logic for creation of elements.
|
105
104
|
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
106
105
|
* @property {any} [fileService] - The file service for this form.
|
@@ -370,7 +369,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
370
369
|
*/
|
371
370
|
addLanguage(code, lang, active = false) {
|
372
371
|
if (this.i18next) {
|
373
|
-
var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(
|
372
|
+
var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(en_1.default), lang);
|
374
373
|
this.i18next.addResourceBundle(code, 'translation', translations, true, true);
|
375
374
|
if (active) {
|
376
375
|
this.language = code;
|
@@ -661,7 +660,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
661
660
|
const rebuild = this.rebuild() || Promise.resolve();
|
662
661
|
return rebuild.then(() => {
|
663
662
|
this.emit('formLoad', form);
|
664
|
-
this.
|
663
|
+
if (!this.options.server) {
|
664
|
+
this.triggerCaptcha();
|
665
|
+
}
|
665
666
|
// Make sure to trigger onChange after a render event occurs to speed up form rendering.
|
666
667
|
setTimeout(() => {
|
667
668
|
this.onChange(flags);
|
@@ -990,7 +991,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
990
991
|
}
|
991
992
|
hasRequiredFields() {
|
992
993
|
let result = false;
|
993
|
-
(0,
|
994
|
+
(0, utils_1.eachComponent)(this.form.components, (component) => {
|
994
995
|
if (component.validate.required) {
|
995
996
|
result = true;
|
996
997
|
return true;
|
@@ -1157,11 +1158,8 @@ class Webform extends NestedDataComponent_1.default {
|
|
1157
1158
|
};
|
1158
1159
|
errors.forEach(({ message, context, fromServer, component }, index) => {
|
1159
1160
|
const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer
|
1160
|
-
? this.t(
|
1161
|
-
: this.t(
|
1162
|
-
label: this.t(component === null || component === void 0 ? void 0 : component.label),
|
1163
|
-
message: this.t(message),
|
1164
|
-
});
|
1161
|
+
? this.t(message)
|
1162
|
+
: `${this.t(component === null || component === void 0 ? void 0 : component.label)}: ${this.t(message)}`;
|
1165
1163
|
displayedErrors.push(createListItem(text, index));
|
1166
1164
|
});
|
1167
1165
|
}
|
@@ -1315,13 +1313,14 @@ class Webform extends NestedDataComponent_1.default {
|
|
1315
1313
|
submission.metadata = submission.metadata || {};
|
1316
1314
|
lodash_1.default.defaults(submission.metadata, {
|
1317
1315
|
timezone: lodash_1.default.get(this, '_submission.metadata.timezone', (0, utils_1.currentTimezone)()),
|
1318
|
-
offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0,
|
1316
|
+
offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0, dayjs_1.default)().utcOffset()), 10),
|
1319
1317
|
origin: document.location.origin,
|
1320
1318
|
referrer: document.referrer,
|
1321
1319
|
browserName: navigator.appName,
|
1322
1320
|
userAgent: navigator.userAgent,
|
1323
1321
|
pathName: window.location.pathname,
|
1324
1322
|
onLine: navigator.onLine,
|
1323
|
+
language: this.language,
|
1325
1324
|
});
|
1326
1325
|
}
|
1327
1326
|
submitForm(options = {}, local = false) {
|
@@ -1539,7 +1538,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1539
1538
|
return;
|
1540
1539
|
}
|
1541
1540
|
const captchaComponent = [];
|
1542
|
-
(0,
|
1541
|
+
(0, utils_1.eachComponent)(components || this.components, (component) => {
|
1543
1542
|
if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
|
1544
1543
|
captchaComponent.push(component);
|
1545
1544
|
}
|
@@ -77,7 +77,8 @@ export default class WebformBuilder extends Component {
|
|
77
77
|
removeComponent(component: any, parent: any, original: any, componentInstance: any): boolean | undefined;
|
78
78
|
replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
|
79
79
|
updateComponent(component: any, changed: any): void;
|
80
|
-
|
80
|
+
originalDefaultValue: any;
|
81
|
+
findComponentsWithRepeatablePaths(): any[];
|
81
82
|
highlightInvalidComponents(): void;
|
82
83
|
/**
|
83
84
|
* Called when a new component is saved.
|
@@ -8,8 +8,7 @@ const Component_1 = __importDefault(require("./components/_classes/component/Com
|
|
8
8
|
const tippy_js_1 = __importDefault(require("tippy.js"));
|
9
9
|
const Components_1 = __importDefault(require("./components/Components"));
|
10
10
|
const Formio_1 = require("./Formio");
|
11
|
-
const utils_1 = require("./utils
|
12
|
-
const formUtils_1 = require("./utils/formUtils");
|
11
|
+
const utils_1 = require("./utils");
|
13
12
|
const builder_1 = __importDefault(require("./utils/builder"));
|
14
13
|
const lodash_1 = __importDefault(require("lodash"));
|
15
14
|
const dom_autoscroller_1 = __importDefault(require("dom-autoscroller"));
|
@@ -284,7 +283,7 @@ class WebformBuilder extends Component_1.default {
|
|
284
283
|
componentOrder: [],
|
285
284
|
default: index === 0,
|
286
285
|
};
|
287
|
-
(0,
|
286
|
+
(0, utils_1.eachComponent)(resource.components, (component) => {
|
288
287
|
if (component.type === 'button')
|
289
288
|
return;
|
290
289
|
if (this.options &&
|
@@ -450,7 +449,7 @@ class WebformBuilder extends Component_1.default {
|
|
450
449
|
return [...componentSchema.components, componentSchema];
|
451
450
|
}
|
452
451
|
// Get the namespace component so we have the original object.
|
453
|
-
const namespaceComponent = (0,
|
452
|
+
const namespaceComponent = (0, utils_1.getComponent)(this.form.components, namespaceKey, true);
|
454
453
|
return namespaceComponent ? namespaceComponent.components : comp.components;
|
455
454
|
}
|
456
455
|
recurseNamespace(component) {
|
@@ -812,7 +811,7 @@ class WebformBuilder extends Component_1.default {
|
|
812
811
|
const draggableComponent = ((_a = this.groups[group]) === null || _a === void 0 ? void 0 : _a.components[compKey]) || {};
|
813
812
|
if (draggableComponent.disableSiblings || draggableComponent.uniqueComponent) {
|
814
813
|
let isCompAlreadyExists = false;
|
815
|
-
(0,
|
814
|
+
(0, utils_1.eachComponent)(this.webform.components, (component) => {
|
816
815
|
if ((draggableComponent.disableSiblings && component.type === draggableComponent.schema.type) ||
|
817
816
|
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
818
817
|
isCompAlreadyExists = true;
|
@@ -947,7 +946,7 @@ class WebformBuilder extends Component_1.default {
|
|
947
946
|
//populate isEnabled for captcha form settings
|
948
947
|
let isCaptchaEnabled = false;
|
949
948
|
if (this.form.components) {
|
950
|
-
(0,
|
949
|
+
(0, utils_1.eachComponent)(form.components, component => {
|
951
950
|
if (isCaptchaEnabled) {
|
952
951
|
return;
|
953
952
|
}
|
@@ -1042,7 +1041,7 @@ class WebformBuilder extends Component_1.default {
|
|
1042
1041
|
}
|
1043
1042
|
}
|
1044
1043
|
// Change the "default value" field to be reflective of this component.
|
1045
|
-
const defaultValueComponent = (0,
|
1044
|
+
const defaultValueComponent = (0, utils_1.getComponent)(this.editForm.components, 'defaultValue', true);
|
1046
1045
|
if (defaultValueComponent && component.type !== 'hidden') {
|
1047
1046
|
const defaultChanged = changed && ((changed.component && changed.component.key === 'defaultValue')
|
1048
1047
|
|| (changed.instance && defaultValueComponent.hasComponent && defaultValueComponent.hasComponent(changed.instance)));
|
@@ -1070,6 +1069,17 @@ class WebformBuilder extends Component_1.default {
|
|
1070
1069
|
'fields.month.required',
|
1071
1070
|
'fields.year.required',
|
1072
1071
|
]));
|
1072
|
+
if (defaultValueComponent.component.components) {
|
1073
|
+
if (!this.originalDefaultValue) {
|
1074
|
+
this.originalDefaultValue = (0, utils_1.fastCloneDeep)(defaultValueComponent.component);
|
1075
|
+
}
|
1076
|
+
(0, utils_1.eachComponent)(defaultValueComponent.component.components, (comp => {
|
1077
|
+
var _a;
|
1078
|
+
if ((_a = comp.validate) === null || _a === void 0 ? void 0 : _a.required) {
|
1079
|
+
comp.validate.required = false;
|
1080
|
+
}
|
1081
|
+
}));
|
1082
|
+
}
|
1073
1083
|
const parentComponent = defaultValueComponent.parent;
|
1074
1084
|
let tabIndex = -1;
|
1075
1085
|
let index = -1;
|
@@ -1115,28 +1125,53 @@ class WebformBuilder extends Component_1.default {
|
|
1115
1125
|
// Called when we update a component.
|
1116
1126
|
this.emit('updateComponent', component);
|
1117
1127
|
}
|
1118
|
-
|
1119
|
-
const repeatablePaths =
|
1128
|
+
findComponentsWithRepeatablePaths() {
|
1129
|
+
const repeatablePaths = {};
|
1120
1130
|
const keys = new Map();
|
1121
|
-
(0,
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
keys.
|
1131
|
+
(0, utils_1.eachComponent)(this.form.components, (comp, path, components, parent, paths) => {
|
1132
|
+
var _a, _b;
|
1133
|
+
const isRadioCheckbox = comp.type === 'checkbox' && comp.inputType === 'radio';
|
1134
|
+
const isLayout = (0, utils_1.componentInfo)(comp).layout;
|
1135
|
+
if (!isLayout) {
|
1136
|
+
if (keys.has(paths.dataPath)) {
|
1137
|
+
const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
|
1138
|
+
repeatablePaths[paths.dataPath] = {
|
1139
|
+
comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
|
1140
|
+
onlyRadioCheckboxes,
|
1141
|
+
};
|
1142
|
+
}
|
1143
|
+
else {
|
1144
|
+
keys.set(paths.dataPath, comp);
|
1145
|
+
}
|
1127
1146
|
}
|
1128
1147
|
}, true);
|
1129
|
-
|
1148
|
+
const componentsWithRepeatablePaths = [];
|
1149
|
+
Object.keys(repeatablePaths).forEach((path) => {
|
1150
|
+
const { comps, onlyRadioCheckboxes } = repeatablePaths[path];
|
1151
|
+
if (!onlyRadioCheckboxes) {
|
1152
|
+
componentsWithRepeatablePaths.push(...comps);
|
1153
|
+
}
|
1154
|
+
});
|
1155
|
+
return componentsWithRepeatablePaths;
|
1130
1156
|
}
|
1131
1157
|
highlightInvalidComponents() {
|
1132
|
-
const
|
1158
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
1133
1159
|
let hasInvalidComponents = false;
|
1160
|
+
// Matches anything expect letters and '_' at the beginning of the key and anything except of letters, numbers,
|
1161
|
+
// '-', '.' and '_' in the rest of the key
|
1162
|
+
const badCharacters = /^[^A-Za-z_]+|[^A-Za-z0-9\-._]+/g;
|
1134
1163
|
this.webform.everyComponent((comp) => {
|
1135
|
-
|
1136
|
-
if (repeatablePaths.includes(path)) {
|
1164
|
+
if (repeatablePathsComps.includes(comp.component)) {
|
1137
1165
|
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
1138
1166
|
hasInvalidComponents = true;
|
1139
1167
|
}
|
1168
|
+
else if (comp.key.replace(badCharacters, '') === '') {
|
1169
|
+
comp.setCustomValidity(this.t('apiKeyNotValid', { key: comp.key }));
|
1170
|
+
hasInvalidComponents = true;
|
1171
|
+
}
|
1172
|
+
else {
|
1173
|
+
comp.setCustomValidity();
|
1174
|
+
}
|
1140
1175
|
});
|
1141
1176
|
this.emit('builderFormValidityChange', hasInvalidComponents);
|
1142
1177
|
}
|
@@ -1161,6 +1196,9 @@ class WebformBuilder extends Component_1.default {
|
|
1161
1196
|
if (index !== -1) {
|
1162
1197
|
let submissionData = this.editForm.submission.data;
|
1163
1198
|
submissionData = submissionData.componentJson || submissionData;
|
1199
|
+
if (submissionData.components && this.originalDefaultValue) {
|
1200
|
+
submissionData.components = this.originalDefaultValue.components;
|
1201
|
+
}
|
1164
1202
|
const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
|
1165
1203
|
this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
|
1166
1204
|
this.hook('beforeSaveComponentSettings', submissionData);
|
@@ -1623,7 +1661,11 @@ class WebformBuilder extends Component_1.default {
|
|
1623
1661
|
info.type);
|
1624
1662
|
}
|
1625
1663
|
hasEditTabs(type) {
|
1626
|
-
|
1664
|
+
// If the component type does not exist then it has no edit tabs
|
1665
|
+
if (!Components_1.default.components[type === 'custom' ? 'unknown' : type]) {
|
1666
|
+
return false;
|
1667
|
+
}
|
1668
|
+
const editTabs = (0, utils_1.getComponent)(Components_1.default.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
|
1627
1669
|
const hiddenEditTabs = lodash_1.default.filter(lodash_1.default.get(this.options, `editForm.${type}`, []), 'ignore');
|
1628
1670
|
return lodash_1.default.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
|
1629
1671
|
}
|
package/lib/cjs/Wizard.d.ts
CHANGED
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
6
6
|
originalComponents: any[];
|
7
7
|
page: number;
|
8
8
|
currentPanel: any;
|
9
|
-
currentPanels: any[] | null;
|
10
9
|
currentNextPage: number;
|
11
10
|
_seenPages: number[];
|
12
11
|
subWizards: any[];
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
17
16
|
originalOptions: any;
|
18
17
|
isLastPage(): any;
|
19
18
|
getPages(args?: {}): any[];
|
20
|
-
get
|
19
|
+
get hasSubWizards(): boolean;
|
21
20
|
get localData(): any;
|
22
21
|
get wizardKey(): string;
|
23
22
|
set wizard(form: object);
|
@@ -106,6 +105,7 @@ declare class Wizard extends Webform {
|
|
106
105
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
107
106
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
108
107
|
focusOnComponent(key: any): void | Promise<void>;
|
108
|
+
triggerButtonCaptcha(page: any): void;
|
109
109
|
}
|
110
110
|
declare namespace Wizard {
|
111
111
|
let setBaseUrl: any;
|