@formio/js 5.1.0-dev.5936.fa0f253 → 5.1.0-dev.5939.f5aa9d6
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 +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 +114 -147
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +121 -154
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +65 -54
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +76 -76
- package/dist/formio.utils.min.js +1 -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 +9 -9
- package/lib/cjs/WebformBuilder.d.ts +1 -1
- package/lib/cjs/WebformBuilder.js +45 -21
- package/lib/cjs/Wizard.d.ts +1 -2
- package/lib/cjs/Wizard.js +18 -24
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +41 -57
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/cjs/components/_classes/input/Input.js +3 -3
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +10 -8
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/cjs/components/address/Address.js +2 -2
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.js +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +15 -13
- package/lib/cjs/components/day/Day.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.d.ts +0 -1
- package/lib/cjs/components/editgrid/EditGrid.js +1 -9
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/file/File.js +1 -1
- package/lib/cjs/components/form/Form.js +14 -2
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +9 -4
- package/lib/cjs/components/radio/Radio.js +40 -76
- 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 +20 -4
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +13 -31
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/cjs/translations/en.d.ts +1 -232
- 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 +22 -37
- package/lib/cjs/utils/utils.js +64 -135
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/cjs/widgets/CalendarWidget.js +17 -43
- 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 +7 -7
- package/lib/mjs/WebformBuilder.d.ts +1 -1
- package/lib/mjs/WebformBuilder.js +36 -13
- package/lib/mjs/Wizard.d.ts +1 -2
- package/lib/mjs/Wizard.js +17 -23
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +14 -7
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/mjs/components/_classes/input/Input.js +3 -3
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +10 -8
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/mjs/components/address/Address.js +2 -2
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.js +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +15 -13
- package/lib/mjs/components/day/Day.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.d.ts +0 -1
- package/lib/mjs/components/editgrid/EditGrid.js +1 -9
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/file/File.js +1 -1
- package/lib/mjs/components/form/Form.js +13 -2
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +9 -4
- package/lib/mjs/components/radio/Radio.js +40 -75
- 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 +20 -4
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +7 -2
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +3 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/mjs/translations/en.d.ts +1 -232
- package/lib/mjs/translations/en.js +8 -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 +22 -37
- package/lib/mjs/utils/utils.js +57 -109
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/mjs/widgets/CalendarWidget.js +17 -43
- package/package.json +5 -3
- 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
package/lib/cjs/WizardBuilder.js
CHANGED
@@ -7,7 +7,7 @@ const WebformBuilder_1 = __importDefault(require("./WebformBuilder"));
|
|
7
7
|
const Webform_1 = __importDefault(require("./Webform"));
|
8
8
|
const builder_1 = __importDefault(require("./utils/builder"));
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
|
-
const utils_1 = require("./utils
|
10
|
+
const utils_1 = require("./utils");
|
11
11
|
class WizardBuilder extends WebformBuilder_1.default {
|
12
12
|
constructor() {
|
13
13
|
let element, options;
|
@@ -165,7 +165,6 @@ declare class Component extends Element {
|
|
165
165
|
get componentsMap(): object;
|
166
166
|
/**
|
167
167
|
* Returns if the parent should conditionally clear.
|
168
|
-
*
|
169
168
|
* @returns {boolean} - If the parent should conditionally clear.
|
170
169
|
*/
|
171
170
|
parentShouldConditionallyClear(): boolean;
|
@@ -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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -42,8 +19,8 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
42
19
|
const ismobilejs_1 = __importDefault(require("ismobilejs"));
|
43
20
|
const process_1 = require("@formio/core/process");
|
44
21
|
const Formio_1 = require("../../../Formio");
|
45
|
-
const
|
46
|
-
const
|
22
|
+
const utils_1 = __importDefault(require("../../../utils"));
|
23
|
+
const utils_2 = require("../../../utils");
|
47
24
|
const Element_1 = __importDefault(require("../../../Element"));
|
48
25
|
const ComponentModal_1 = __importDefault(require("../componentModal/ComponentModal"));
|
49
26
|
const widgets_1 = __importDefault(require("../../../widgets"));
|
@@ -51,7 +28,7 @@ const addons_1 = __importDefault(require("../../../addons"));
|
|
51
28
|
const uploadAdapter_1 = require("../../../providers/storage/uploadAdapter");
|
52
29
|
const en_1 = __importDefault(require("../../../translations/en"));
|
53
30
|
const Templates_1 = __importDefault(require("../../../templates/Templates"));
|
54
|
-
const isIEBrowser =
|
31
|
+
const isIEBrowser = utils_1.default.getBrowserInfo().ie;
|
55
32
|
/**
|
56
33
|
* This is the Component class
|
57
34
|
which all elements within the FormioForm derive from.
|
@@ -225,7 +202,7 @@ class Component extends Element_1.default {
|
|
225
202
|
*/
|
226
203
|
static savedValueTypes(schema) {
|
227
204
|
schema = schema || {};
|
228
|
-
return
|
205
|
+
return utils_1.default.getComponentSavedTypes(schema) || [utils_1.default.componentValueTypes.any];
|
229
206
|
}
|
230
207
|
/**
|
231
208
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
@@ -292,7 +269,7 @@ class Component extends Element_1.default {
|
|
292
269
|
this.component.id = this.id;
|
293
270
|
this.afterComponentAssign();
|
294
271
|
// Save off the original component to be used in logic.
|
295
|
-
this.originalComponent = (0,
|
272
|
+
this.originalComponent = (0, utils_2.fastCloneDeep)(this.component);
|
296
273
|
/**
|
297
274
|
* If the component has been attached
|
298
275
|
*/
|
@@ -325,7 +302,7 @@ class Component extends Element_1.default {
|
|
325
302
|
* Determines if this component is disabled, or not.
|
326
303
|
* @type {boolean}
|
327
304
|
*/
|
328
|
-
this._disabled = (0,
|
305
|
+
this._disabled = (0, utils_2.boolValue)(this.component.disabled) ? this.component.disabled : false;
|
329
306
|
/**
|
330
307
|
* Points to the root component, usually the FormComponent.
|
331
308
|
* @type {Component}
|
@@ -346,7 +323,7 @@ class Component extends Element_1.default {
|
|
346
323
|
* The component paths for this component.
|
347
324
|
* @type {import('@formio/core').ComponentPaths} - The component paths.
|
348
325
|
*/
|
349
|
-
this.paths =
|
326
|
+
this.paths = utils_1.default.getComponentPaths(this.component, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component, Object.assign(Object.assign({}, (_b = this.parent) === null || _b === void 0 ? void 0 : _b.paths), { dataIndex: this.options.rowIndex === undefined ? (_d = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.paths) === null || _d === void 0 ? void 0 : _d.dataIndex : this.options.rowIndex }));
|
350
327
|
this.options.name = this.options.name || 'data';
|
351
328
|
this._path = '';
|
352
329
|
// Needs for Nextgen Rules Engine
|
@@ -460,7 +437,6 @@ class Component extends Element_1.default {
|
|
460
437
|
}
|
461
438
|
/**
|
462
439
|
* Returns if the parent should conditionally clear.
|
463
|
-
*
|
464
440
|
* @returns {boolean} - If the parent should conditionally clear.
|
465
441
|
*/
|
466
442
|
parentShouldConditionallyClear() {
|
@@ -524,7 +500,7 @@ class Component extends Element_1.default {
|
|
524
500
|
label.labelPosition = this.component.labelPosition;
|
525
501
|
label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
|
526
502
|
const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
|
527
|
-
if (this.hasInput && this.component.validate && (0,
|
503
|
+
if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
|
528
504
|
label.className += ' field-required';
|
529
505
|
}
|
530
506
|
if (label.hidden) {
|
@@ -557,7 +533,7 @@ class Component extends Element_1.default {
|
|
557
533
|
*/
|
558
534
|
set rowIndex(value) {
|
559
535
|
var _a, _b;
|
560
|
-
this.paths =
|
536
|
+
this.paths = utils_1.default.getComponentPaths(this.component, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component, Object.assign(Object.assign({}, (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.paths) || {})), { dataIndex: value }));
|
561
537
|
this._rowIndex = value;
|
562
538
|
}
|
563
539
|
afterComponentAssign() {
|
@@ -877,7 +853,7 @@ class Component extends Element_1.default {
|
|
877
853
|
* @returns {object} - The JSON schema for this component.
|
878
854
|
*/
|
879
855
|
get schema() {
|
880
|
-
return (0,
|
856
|
+
return (0, utils_2.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
881
857
|
}
|
882
858
|
/**
|
883
859
|
* Returns true if component is inside DataGrid
|
@@ -1029,7 +1005,7 @@ class Component extends Element_1.default {
|
|
1029
1005
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
1030
1006
|
return dirty;
|
1031
1007
|
}
|
1032
|
-
return
|
1008
|
+
return utils_1.default.sanitize(dirty, {
|
1033
1009
|
sanitizeConfig: lodash_1.default.merge(((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitizeConfig) || {}, options || {}),
|
1034
1010
|
});
|
1035
1011
|
}
|
@@ -1148,7 +1124,7 @@ class Component extends Element_1.default {
|
|
1148
1124
|
return submissionTimezone;
|
1149
1125
|
}
|
1150
1126
|
// Return current timezone if none are provided.
|
1151
|
-
return (0,
|
1127
|
+
return (0, utils_2.currentTimezone)();
|
1152
1128
|
}
|
1153
1129
|
/**
|
1154
1130
|
*
|
@@ -1453,7 +1429,7 @@ class Component extends Element_1.default {
|
|
1453
1429
|
else {
|
1454
1430
|
this.refreshOnChanged = true;
|
1455
1431
|
}
|
1456
|
-
this.refreshOnValue = (0,
|
1432
|
+
this.refreshOnValue = (0, utils_2.fastCloneDeep)(value);
|
1457
1433
|
if (this.refreshOnChanged) {
|
1458
1434
|
if (this.component.clearOnRefresh) {
|
1459
1435
|
this.setValue(null);
|
@@ -1695,7 +1671,7 @@ class Component extends Element_1.default {
|
|
1695
1671
|
if (this.component.customClass) {
|
1696
1672
|
className += this.component.customClass;
|
1697
1673
|
}
|
1698
|
-
if (this.hasInput && this.component.validate && (0,
|
1674
|
+
if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required)) {
|
1699
1675
|
className += ' required';
|
1700
1676
|
}
|
1701
1677
|
if (this.labelIsHidden()) {
|
@@ -1983,7 +1959,7 @@ class Component extends Element_1.default {
|
|
1983
1959
|
if (this._hasCondition !== null) {
|
1984
1960
|
return this._hasCondition;
|
1985
1961
|
}
|
1986
|
-
this._hasCondition =
|
1962
|
+
this._hasCondition = utils_1.default.hasCondition(this.component);
|
1987
1963
|
return this._hasCondition;
|
1988
1964
|
}
|
1989
1965
|
/**
|
@@ -2010,7 +1986,7 @@ class Component extends Element_1.default {
|
|
2010
1986
|
* @returns {boolean} - True if the condition applies to this component.
|
2011
1987
|
*/
|
2012
1988
|
checkCondition(row, data) {
|
2013
|
-
return
|
1989
|
+
return utils_1.default.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
2014
1990
|
}
|
2015
1991
|
/**
|
2016
1992
|
* Check for conditionals and hide/show the element based on those conditions.
|
@@ -2066,9 +2042,9 @@ class Component extends Element_1.default {
|
|
2066
2042
|
if (logics.length === 0) {
|
2067
2043
|
return;
|
2068
2044
|
}
|
2069
|
-
const newComponent = (0,
|
2045
|
+
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
2070
2046
|
let changed = logics.reduce((changed, logic) => {
|
2071
|
-
const result =
|
2047
|
+
const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
|
2072
2048
|
return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
|
2073
2049
|
}, false);
|
2074
2050
|
// If component definition changed, replace and mark as changed.
|
@@ -2135,7 +2111,7 @@ class Component extends Element_1.default {
|
|
2135
2111
|
return actions.reduce((changed, action) => {
|
2136
2112
|
switch (action.type) {
|
2137
2113
|
case 'property': {
|
2138
|
-
|
2114
|
+
utils_1.default.setActionProperty(newComponent, action, result, row, data, this);
|
2139
2115
|
const property = action.property.value;
|
2140
2116
|
if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
|
2141
2117
|
// Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
|
@@ -2648,7 +2624,7 @@ class Component extends Element_1.default {
|
|
2648
2624
|
if (this.component.type !== 'textfield') {
|
2649
2625
|
const placeholderChar = this.placeholderChar;
|
2650
2626
|
value = (0, vanilla_text_mask_1.conformToMask)(value, this.defaultMask, { placeholderChar }).conformedValue;
|
2651
|
-
if (!
|
2627
|
+
if (!utils_1.default.matchInputMask(value, this.defaultMask)) {
|
2652
2628
|
value = '';
|
2653
2629
|
}
|
2654
2630
|
}
|
@@ -2714,13 +2690,16 @@ class Component extends Element_1.default {
|
|
2714
2690
|
}
|
2715
2691
|
const isArray = Array.isArray(value);
|
2716
2692
|
const valueInput = this.refs.fileLink || this.refs.input;
|
2693
|
+
const isFilelink = !!this.refs.fileLink;
|
2717
2694
|
if (isArray &&
|
2718
2695
|
Array.isArray(this.defaultValue) &&
|
2719
2696
|
this.refs.hasOwnProperty('input') &&
|
2720
2697
|
valueInput &&
|
2721
2698
|
(valueInput.length !== value.length) &&
|
2722
2699
|
this.visible) {
|
2723
|
-
|
2700
|
+
if (isFilelink || valueInput.length) {
|
2701
|
+
this.redraw();
|
2702
|
+
}
|
2724
2703
|
}
|
2725
2704
|
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
2726
2705
|
this.redraw();
|
@@ -2731,6 +2710,11 @@ class Component extends Element_1.default {
|
|
2731
2710
|
this.setValueAt(i, isArray && !this.isSingleInputValue() ? value[i] : value, flags);
|
2732
2711
|
}
|
2733
2712
|
}
|
2713
|
+
// Also reset value of the modal component, otherwise it will keep the old value locally and the preview
|
2714
|
+
// element won't refresh
|
2715
|
+
if (this.componentModal && flags && flags.resetValue) {
|
2716
|
+
this.componentModal.setValue(value);
|
2717
|
+
}
|
2734
2718
|
return changed;
|
2735
2719
|
}
|
2736
2720
|
/**
|
@@ -2966,7 +2950,7 @@ class Component extends Element_1.default {
|
|
2966
2950
|
}
|
2967
2951
|
if (fromSubmission) {
|
2968
2952
|
// If we set value from submission and it differs from calculated one, set the calculated value to prevent overriding dataValue in the next pass
|
2969
|
-
this.calculatedValue = (0,
|
2953
|
+
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
2970
2954
|
return false;
|
2971
2955
|
}
|
2972
2956
|
// If this is the firstPass, and the dataValue is different than to the calculatedValue.
|
@@ -2975,7 +2959,7 @@ class Component extends Element_1.default {
|
|
2975
2959
|
return true;
|
2976
2960
|
}
|
2977
2961
|
}
|
2978
|
-
this.calculatedValue = (0,
|
2962
|
+
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
2979
2963
|
if (changed) {
|
2980
2964
|
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
2981
2965
|
this.pristine = false;
|
@@ -3036,7 +3020,7 @@ class Component extends Element_1.default {
|
|
3036
3020
|
var _a;
|
3037
3021
|
const { local } = options;
|
3038
3022
|
if (!row) {
|
3039
|
-
row = (0,
|
3023
|
+
row = (0, utils_2.getContextualRowData)(this.component, data, this.paths);
|
3040
3024
|
}
|
3041
3025
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
3042
3026
|
return '';
|
@@ -3065,7 +3049,7 @@ class Component extends Element_1.default {
|
|
3065
3049
|
]
|
3066
3050
|
});
|
3067
3051
|
const errors = validationScope.errors;
|
3068
|
-
const interpolatedErrors =
|
3052
|
+
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
3069
3053
|
return lodash_1.default.map(interpolatedErrors, 'message').join('\n\n');
|
3070
3054
|
}
|
3071
3055
|
/**
|
@@ -3096,7 +3080,7 @@ class Component extends Element_1.default {
|
|
3096
3080
|
*/
|
3097
3081
|
interpolateErrors(errors) {
|
3098
3082
|
var _a;
|
3099
|
-
const interpolatedErrors =
|
3083
|
+
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
3100
3084
|
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length) ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
|
3101
3085
|
}
|
3102
3086
|
/**
|
@@ -3231,6 +3215,9 @@ class Component extends Element_1.default {
|
|
3231
3215
|
data = data || this.rootValue;
|
3232
3216
|
flags = flags || {};
|
3233
3217
|
row = row || this.data;
|
3218
|
+
if (flags.noCheck) {
|
3219
|
+
return true;
|
3220
|
+
}
|
3234
3221
|
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3235
3222
|
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3236
3223
|
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
@@ -3245,9 +3232,6 @@ class Component extends Element_1.default {
|
|
3245
3232
|
if (!flags.fromBlur) {
|
3246
3233
|
this.checkRefreshOn(flags.changes, flags);
|
3247
3234
|
}
|
3248
|
-
if (flags.noCheck) {
|
3249
|
-
return true;
|
3250
|
-
}
|
3251
3235
|
this.checkComponentConditions(data, flags, row);
|
3252
3236
|
if (this.id !== flags.triggeredComponentId) {
|
3253
3237
|
this.calculateComponentValue(data, flags, row);
|
@@ -3316,7 +3300,7 @@ class Component extends Element_1.default {
|
|
3316
3300
|
}
|
3317
3301
|
});
|
3318
3302
|
this.addEventListener(element, 'blur', () => {
|
3319
|
-
this.root.pendingBlur =
|
3303
|
+
this.root.pendingBlur = utils_1.default.delay(() => {
|
3320
3304
|
this.emit('blur', this);
|
3321
3305
|
if (this.component.validateOn === 'blur') {
|
3322
3306
|
this.root.triggerChange({ fromBlur: true }, {
|
@@ -3564,7 +3548,7 @@ class Component extends Element_1.default {
|
|
3564
3548
|
if (logic.trigger.type === 'event') {
|
3565
3549
|
const event = this.interpolate(logic.trigger.event);
|
3566
3550
|
this.on(event, (...args) => {
|
3567
|
-
const newComponent = (0,
|
3551
|
+
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
3568
3552
|
if (this.applyActions(newComponent, logic.actions, args)) {
|
3569
3553
|
// If component definition changed, replace it.
|
3570
3554
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
@@ -3699,7 +3683,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
3699
3683
|
}.bind(Component.externalLibraries[name]);
|
3700
3684
|
}
|
3701
3685
|
// See if the plugin already exists.
|
3702
|
-
const plugin = (0,
|
3686
|
+
const plugin = (0, utils_2.getScriptPlugin)(property);
|
3703
3687
|
if (plugin) {
|
3704
3688
|
Component.externalLibraries[name].resolve(plugin);
|
3705
3689
|
}
|
@@ -3742,7 +3726,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
3742
3726
|
// if no callback is provided, then check periodically for the script.
|
3743
3727
|
if (polling) {
|
3744
3728
|
setTimeout(function checkLibrary() {
|
3745
|
-
const plugin = (0,
|
3729
|
+
const plugin = (0, utils_2.getScriptPlugin)(property);
|
3746
3730
|
if (plugin) {
|
3747
3731
|
Component.externalLibraries[name].resolve(plugin);
|
3748
3732
|
}
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const utils_1 = __importDefault(require("./utils"));
|
7
|
-
const utils_2 = require("../../../../utils
|
7
|
+
const utils_2 = require("../../../../utils");
|
8
8
|
/* eslint-disable quotes, max-len */
|
9
9
|
exports.default = [
|
10
10
|
{
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const utils_1 = __importDefault(require("./utils"));
|
7
|
-
const utils_2 = require("../../../../utils
|
7
|
+
const utils_2 = require("../../../../utils");
|
8
8
|
/* eslint-disable quotes, max-len */
|
9
9
|
exports.default = [
|
10
10
|
{
|
@@ -4,7 +4,7 @@ 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 utils_1 = require("../../../utils
|
7
|
+
const utils_1 = require("../../../utils");
|
8
8
|
class ComponentModal {
|
9
9
|
static render(component, data, topLevel) {
|
10
10
|
const children = component.renderTemplate('component', data, topLevel);
|
@@ -25,7 +25,7 @@ export default class Input extends Multivalue {
|
|
25
25
|
get suffix(): any;
|
26
26
|
renderElement(value: any, index: any): any;
|
27
27
|
setCounter(type: any, element: any, count: any, max: any): void;
|
28
|
-
updateValueAt(value: any, flags: any, index
|
28
|
+
updateValueAt(value: any, flags: any, index?: number): void;
|
29
29
|
getValueAt(index: any): any;
|
30
30
|
updateValue(value: any, flags: any, index: any): boolean;
|
31
31
|
parseValue(value: any): any;
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const Multivalue_1 = __importDefault(require("../multivalue/Multivalue"));
|
7
|
-
const utils_1 = require("../../../utils
|
7
|
+
const utils_1 = require("../../../utils");
|
8
8
|
const widgets_1 = __importDefault(require("../../../widgets"));
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
10
|
class Input extends Multivalue_1.default {
|
@@ -118,7 +118,7 @@ class Input extends Multivalue_1.default {
|
|
118
118
|
}
|
119
119
|
const info = this.inputInfo;
|
120
120
|
info.attr = info.attr || {};
|
121
|
-
info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(value)))
|
121
|
+
info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(this.isMultipleMasksField ? value.value : value)))
|
122
122
|
.replace(/"/g, '"');
|
123
123
|
const valueMask = this.component.inputMask;
|
124
124
|
const displayMask = this.component.displayMask;
|
@@ -163,7 +163,7 @@ class Input extends Multivalue_1.default {
|
|
163
163
|
}));
|
164
164
|
}
|
165
165
|
}
|
166
|
-
updateValueAt(value, flags, index) {
|
166
|
+
updateValueAt(value, flags, index = 0) {
|
167
167
|
flags = flags || {};
|
168
168
|
if (lodash_1.default.get(this.component, 'showWordCount', false)) {
|
169
169
|
if (this.refs.wordcount && this.refs.wordcount[index]) {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Field_1 = __importDefault(require("../field/Field"));
|
7
7
|
const Formio_1 = require("../../../Formio");
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../../utils
|
9
|
+
const utils_1 = require("../../../utils");
|
10
10
|
class ListComponent extends Field_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Field_1.default.schema({
|
@@ -7,7 +7,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const Field_1 = __importDefault(require("../field/Field"));
|
8
8
|
const Components_1 = __importDefault(require("../../Components"));
|
9
9
|
'';
|
10
|
-
const utils_1 = require("../../../utils
|
10
|
+
const utils_1 = __importDefault(require("../../../utils"));
|
11
11
|
const process_1 = require("@formio/core/process");
|
12
12
|
/**
|
13
13
|
* NestedComponent class.
|
@@ -209,7 +209,7 @@ class NestedComponent extends Field_1.default {
|
|
209
209
|
set rowIndex(value) {
|
210
210
|
var _a, _b;
|
211
211
|
this._rowIndex = value;
|
212
|
-
this.paths =
|
212
|
+
this.paths = utils_1.default.getComponentPaths(this.component, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component, Object.assign(Object.assign({}, (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.paths) || {})), { dataIndex: value }));
|
213
213
|
this.eachComponent((component) => {
|
214
214
|
component.rowIndex = value;
|
215
215
|
});
|
@@ -311,7 +311,7 @@ class NestedComponent extends Field_1.default {
|
|
311
311
|
*/
|
312
312
|
getComponent(path) {
|
313
313
|
var _a;
|
314
|
-
path =
|
314
|
+
path = utils_1.default.getStringFromComponentPath(path);
|
315
315
|
const matches = {
|
316
316
|
path: undefined,
|
317
317
|
fullPath: undefined,
|
@@ -324,7 +324,7 @@ class NestedComponent extends Field_1.default {
|
|
324
324
|
this.everyComponent((component) => {
|
325
325
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
326
326
|
// All searches are relative to this component so replace this path from the child paths.
|
327
|
-
|
327
|
+
utils_1.default.componentMatches(component.component, {
|
328
328
|
path: (_b = (_a = component.paths) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.replace(new RegExp(`^${(_c = this.paths) === null || _c === void 0 ? void 0 : _c.path}\\.?`), ''),
|
329
329
|
fullPath: (_e = (_d = component.paths) === null || _d === void 0 ? void 0 : _d.fullPath) === null || _e === void 0 ? void 0 : _e.replace(new RegExp(`^${(_f = this.paths) === null || _f === void 0 ? void 0 : _f.fullPath}\\.?`), ''),
|
330
330
|
localPath: (_h = (_g = component.paths) === null || _g === void 0 ? void 0 : _g.localPath) === null || _h === void 0 ? void 0 : _h.replace(new RegExp(`^${(_j = this.paths) === null || _j === void 0 ? void 0 : _j.localPath}\\.?`), ''),
|
@@ -336,7 +336,7 @@ class NestedComponent extends Field_1.default {
|
|
336
336
|
return match;
|
337
337
|
});
|
338
338
|
});
|
339
|
-
return (_a =
|
339
|
+
return (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
|
340
340
|
}
|
341
341
|
/**
|
342
342
|
* Return a component provided the Id of the component.
|
@@ -378,7 +378,7 @@ class NestedComponent extends Field_1.default {
|
|
378
378
|
options.localRoot = this.localRoot;
|
379
379
|
options.skipInit = true;
|
380
380
|
if (!(options.display === 'pdf' && this.builderMode)) {
|
381
|
-
component.id =
|
381
|
+
component.id = utils_1.default.getRandomComponentId();
|
382
382
|
}
|
383
383
|
const comp = Components_1.default.create(component, options, data, true);
|
384
384
|
comp.init();
|
@@ -664,7 +664,7 @@ class NestedComponent extends Field_1.default {
|
|
664
664
|
validationProcessor({ scope, data, row, instance, paths }, flags) {
|
665
665
|
var _a;
|
666
666
|
const { dirty } = flags;
|
667
|
-
if (this.root.
|
667
|
+
if (this.root && this.root.hasSubWizards && this.page !== this.root.page) {
|
668
668
|
instance = ((_a = this.componentsMap) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(paths.dataPath))
|
669
669
|
? this.componentsMap[paths.dataPath]
|
670
670
|
: this.getComponent(paths.dataPath);
|
@@ -800,8 +800,10 @@ class NestedComponent extends Field_1.default {
|
|
800
800
|
return this.data;
|
801
801
|
}
|
802
802
|
resetValue() {
|
803
|
-
|
803
|
+
// Reset values of child components first, then reset the parent one, otherwise it will restore the default
|
804
|
+
// value of parent component and clear it one by one while resetting child components
|
804
805
|
this.getComponents().forEach((comp) => comp.resetValue());
|
806
|
+
super.resetValue();
|
805
807
|
this.setPristine(true);
|
806
808
|
}
|
807
809
|
get dataReady() {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const utils_1 = require("@formio/core/utils");
|
8
8
|
const { getComponentPaths } = utils_1.Utils;
|
9
|
-
const utils_2 = require("../../../utils
|
9
|
+
const utils_2 = require("../../../utils");
|
10
10
|
const Component_1 = __importDefault(require("../component/Component"));
|
11
11
|
const NestedDataComponent_1 = __importDefault(require("../nesteddata/NestedDataComponent"));
|
12
12
|
class NestedArrayComponent extends NestedDataComponent_1.default {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Component_1 = __importDefault(require("../component/Component"));
|
7
7
|
const NestedComponent_1 = __importDefault(require("../nested/NestedComponent"));
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../../utils
|
9
|
+
const utils_1 = require("../../../utils");
|
10
10
|
class NestedDataComponent extends NestedComponent_1.default {
|
11
11
|
hasChanged(newValue, oldValue) {
|
12
12
|
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
|
@@ -11,7 +11,7 @@ const GoogleAddressProvider_1 = require("../../providers/address/GoogleAddressPr
|
|
11
11
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
12
12
|
const NestedComponent_1 = __importDefault(require("../_classes/nested/NestedComponent"));
|
13
13
|
const Container_1 = __importDefault(require("../container/Container"));
|
14
|
-
const utils_1 = require("../../utils
|
14
|
+
const utils_1 = require("../../utils");
|
15
15
|
exports.AddressComponentMode = {
|
16
16
|
Autocomplete: 'autocomplete',
|
17
17
|
Manual: 'manual',
|
@@ -249,7 +249,7 @@ class AddressComponent extends Container_1.default {
|
|
249
249
|
if (this.manualMode) {
|
250
250
|
this.restoreComponentsContext();
|
251
251
|
}
|
252
|
-
if (changed || !lodash_1.default.isEmpty(value) && flags.fromSubmission) {
|
252
|
+
if (changed || !lodash_1.default.isEmpty(value) && flags.fromSubmission || flags.resetValue) {
|
253
253
|
this.redraw();
|
254
254
|
}
|
255
255
|
return changed;
|
@@ -4,7 +4,7 @@ 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 utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
class Alert {
|
9
9
|
constructor(container, component) {
|
10
10
|
this.container = container;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
8
8
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class ButtonComponent extends Field_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Input_1.default.schema({
|
@@ -4,7 +4,7 @@ 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 utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
9
9
|
class CheckBoxComponent extends Field_1.default {
|
10
10
|
static schema(...extend) {
|
@@ -4,7 +4,7 @@ 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 utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
9
9
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
10
10
|
const NestedDataComponent_1 = __importDefault(require("../_classes/nesteddata/NestedDataComponent"));
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const text_mask_addons_1 = require("@formio/text-mask-addons");
|
7
7
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
const Number_1 = __importDefault(require("../number/Number"));
|
11
11
|
class CurrencyComponent extends Number_1.default {
|
12
12
|
static schema(...extend) {
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
8
|
-
const utils_1 = require("../../utils
|
8
|
+
const utils_1 = require("../../utils");
|
9
9
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
10
10
|
static schema(...extend) {
|
11
11
|
return NestedArrayComponent_1.default.schema({
|
@@ -17,7 +17,7 @@ export default class DateTimeComponent extends Input {
|
|
17
17
|
};
|
18
18
|
static savedValueTypes(schema: any): string[];
|
19
19
|
get emptyValue(): string;
|
20
|
-
get
|
20
|
+
get dayjsFormat(): string;
|
21
21
|
createWrapper(): boolean;
|
22
22
|
checkValidity(data: any, dirty: any, rowData: any): boolean;
|
23
23
|
getValueAsString(value: any, options: any): any;
|