@formio/js 5.1.2 → 5.2.0-dev.6141.ebbe6dc
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 +6876 -0
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +110 -121
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +116 -127
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +59 -48
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +68 -68
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Element.js +13 -36
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -5
- package/lib/cjs/Webform.js +3 -4
- package/lib/cjs/WebformBuilder.js +9 -10
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -0
- package/lib/cjs/components/_classes/component/Component.js +33 -52
- 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.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +6 -6
- 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 +1 -1
- 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 +4 -4
- 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/datamap/DataMap.d.ts +1 -1
- package/lib/cjs/components/datamap/DataMap.js +4 -4
- package/lib/cjs/components/datetime/DateTime.js +1 -1
- package/lib/cjs/components/day/Day.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +1 -1
- 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 +1 -1
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- 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 +10 -2
- package/lib/cjs/components/textfield/TextField.js +7 -30
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +3 -3
- package/lib/cjs/i18n.js +1 -1
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
- 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/i18n.js +3 -3
- package/lib/cjs/utils/index.d.ts +167 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +0 -5
- package/lib/cjs/utils/utils.js +4 -42
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.js +6 -6
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -2
- package/lib/mjs/Webform.js +1 -2
- package/lib/mjs/WebformBuilder.js +1 -2
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -0
- package/lib/mjs/components/_classes/component/Component.js +6 -2
- 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.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +6 -6
- 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 +1 -1
- 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 +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/datamap/DataMap.d.ts +1 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/datetime/DateTime.js +1 -1
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +1 -1
- 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 +1 -1
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- 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 +10 -2
- package/lib/mjs/components/textfield/TextField.js +1 -1
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +2 -2
- package/lib/mjs/i18n.js +1 -1
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
- 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/i18n.js +1 -1
- package/lib/mjs/utils/index.d.ts +167 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +0 -5
- package/lib/mjs/utils/utils.js +1 -23
- package/lib/mjs/widgets/CalendarWidget.js +1 -1
- package/package.json +2 -2
@@ -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
|
};
|
@@ -33,8 +10,8 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
33
10
|
const ismobilejs_1 = __importDefault(require("ismobilejs"));
|
34
11
|
const process_1 = require("@formio/core/process");
|
35
12
|
const Formio_1 = require("../../../Formio");
|
36
|
-
const
|
37
|
-
const
|
13
|
+
const utils_1 = __importDefault(require("../../../utils"));
|
14
|
+
const utils_2 = require("../../../utils");
|
38
15
|
const Element_1 = __importDefault(require("../../../Element"));
|
39
16
|
const ComponentModal_1 = __importDefault(require("../componentModal/ComponentModal"));
|
40
17
|
const widgets_1 = __importDefault(require("../../../widgets"));
|
@@ -42,7 +19,7 @@ const addons_1 = __importDefault(require("../../../addons"));
|
|
42
19
|
const uploadAdapter_1 = require("../../../providers/storage/uploadAdapter");
|
43
20
|
const en_1 = __importDefault(require("../../../translations/en"));
|
44
21
|
const Templates_1 = __importDefault(require("../../../templates/Templates"));
|
45
|
-
const isIEBrowser =
|
22
|
+
const isIEBrowser = utils_1.default.getBrowserInfo().ie;
|
46
23
|
/**
|
47
24
|
* This is the Component class
|
48
25
|
which all elements within the FormioForm derive from.
|
@@ -215,7 +192,7 @@ class Component extends Element_1.default {
|
|
215
192
|
*/
|
216
193
|
static savedValueTypes(schema) {
|
217
194
|
schema = schema || {};
|
218
|
-
return
|
195
|
+
return utils_1.default.getComponentSavedTypes(schema) || [utils_1.default.componentValueTypes.any];
|
219
196
|
}
|
220
197
|
/**
|
221
198
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
@@ -282,7 +259,7 @@ class Component extends Element_1.default {
|
|
282
259
|
this.component.id = this.id;
|
283
260
|
this.afterComponentAssign();
|
284
261
|
// Save off the original component to be used in logic.
|
285
|
-
this.originalComponent = (0,
|
262
|
+
this.originalComponent = (0, utils_2.fastCloneDeep)(this.component);
|
286
263
|
/**
|
287
264
|
* If the component has been attached
|
288
265
|
*/
|
@@ -315,7 +292,7 @@ class Component extends Element_1.default {
|
|
315
292
|
* Determines if this component is disabled, or not.
|
316
293
|
* @type {boolean}
|
317
294
|
*/
|
318
|
-
this._disabled = (0,
|
295
|
+
this._disabled = (0, utils_2.boolValue)(this.component.disabled) ? this.component.disabled : false;
|
319
296
|
/**
|
320
297
|
* Points to the root component, usually the FormComponent.
|
321
298
|
* @type {Component}
|
@@ -336,7 +313,7 @@ class Component extends Element_1.default {
|
|
336
313
|
* The component paths for this component.
|
337
314
|
* @type {import('@formio/core').ComponentPaths} - The component paths.
|
338
315
|
*/
|
339
|
-
this.paths =
|
316
|
+
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 }));
|
340
317
|
this.options.name = this.options.name || 'data';
|
341
318
|
this._path = '';
|
342
319
|
// Needs for Nextgen Rules Engine
|
@@ -445,6 +422,10 @@ class Component extends Element_1.default {
|
|
445
422
|
var _a;
|
446
423
|
return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
|
447
424
|
}
|
425
|
+
/**
|
426
|
+
* Returns if the parent should conditionally clear.
|
427
|
+
* @returns {boolean} - If the parent should conditionally clear.
|
428
|
+
*/
|
448
429
|
parentShouldConditionallyClear() {
|
449
430
|
let currentParent = this.parent;
|
450
431
|
while (currentParent) {
|
@@ -491,7 +472,7 @@ class Component extends Element_1.default {
|
|
491
472
|
label.labelPosition = this.component.labelPosition;
|
492
473
|
label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
|
493
474
|
const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
|
494
|
-
if (this.hasInput && this.component.validate && (0,
|
475
|
+
if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
|
495
476
|
label.className += ' field-required';
|
496
477
|
}
|
497
478
|
if (label.hidden) {
|
@@ -524,7 +505,7 @@ class Component extends Element_1.default {
|
|
524
505
|
*/
|
525
506
|
set rowIndex(value) {
|
526
507
|
var _a, _b;
|
527
|
-
this.paths =
|
508
|
+
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 }));
|
528
509
|
this._rowIndex = value;
|
529
510
|
}
|
530
511
|
afterComponentAssign() {
|
@@ -831,7 +812,7 @@ class Component extends Element_1.default {
|
|
831
812
|
* @returns {object} - The JSON schema for this component.
|
832
813
|
*/
|
833
814
|
get schema() {
|
834
|
-
return (0,
|
815
|
+
return (0, utils_2.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
835
816
|
}
|
836
817
|
/**
|
837
818
|
* Returns true if component is inside DataGrid
|
@@ -985,7 +966,7 @@ class Component extends Element_1.default {
|
|
985
966
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
986
967
|
return dirty;
|
987
968
|
}
|
988
|
-
return
|
969
|
+
return utils_1.default.sanitize(dirty, {
|
989
970
|
sanitizeConfig: lodash_1.default.merge(((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitizeConfig) || {}, options || {}),
|
990
971
|
});
|
991
972
|
}
|
@@ -1104,7 +1085,7 @@ class Component extends Element_1.default {
|
|
1104
1085
|
return submissionTimezone;
|
1105
1086
|
}
|
1106
1087
|
// Return current timezone if none are provided.
|
1107
|
-
return (0,
|
1088
|
+
return (0, utils_2.currentTimezone)();
|
1108
1089
|
}
|
1109
1090
|
/**
|
1110
1091
|
*
|
@@ -1409,7 +1390,7 @@ class Component extends Element_1.default {
|
|
1409
1390
|
else {
|
1410
1391
|
this.refreshOnChanged = true;
|
1411
1392
|
}
|
1412
|
-
this.refreshOnValue = (0,
|
1393
|
+
this.refreshOnValue = (0, utils_2.fastCloneDeep)(value);
|
1413
1394
|
if (this.refreshOnChanged) {
|
1414
1395
|
if (this.component.clearOnRefresh) {
|
1415
1396
|
this.setValue(null);
|
@@ -1651,7 +1632,7 @@ class Component extends Element_1.default {
|
|
1651
1632
|
if (this.component.customClass) {
|
1652
1633
|
className += this.component.customClass;
|
1653
1634
|
}
|
1654
|
-
if (this.hasInput && this.component.validate && (0,
|
1635
|
+
if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required)) {
|
1655
1636
|
className += ' required';
|
1656
1637
|
}
|
1657
1638
|
if (this.labelIsHidden()) {
|
@@ -1939,7 +1920,7 @@ class Component extends Element_1.default {
|
|
1939
1920
|
if (this._hasCondition !== null) {
|
1940
1921
|
return this._hasCondition;
|
1941
1922
|
}
|
1942
|
-
this._hasCondition =
|
1923
|
+
this._hasCondition = utils_1.default.hasCondition(this.component);
|
1943
1924
|
return this._hasCondition;
|
1944
1925
|
}
|
1945
1926
|
/**
|
@@ -1966,7 +1947,7 @@ class Component extends Element_1.default {
|
|
1966
1947
|
* @returns {boolean} - True if the condition applies to this component.
|
1967
1948
|
*/
|
1968
1949
|
checkCondition(row, data) {
|
1969
|
-
return
|
1950
|
+
return utils_1.default.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
1970
1951
|
}
|
1971
1952
|
/**
|
1972
1953
|
* Check for conditionals and hide/show the element based on those conditions.
|
@@ -2022,9 +2003,9 @@ class Component extends Element_1.default {
|
|
2022
2003
|
if (logics.length === 0) {
|
2023
2004
|
return;
|
2024
2005
|
}
|
2025
|
-
const newComponent = (0,
|
2006
|
+
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
2026
2007
|
let changed = logics.reduce((changed, logic) => {
|
2027
|
-
const result =
|
2008
|
+
const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
|
2028
2009
|
return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
|
2029
2010
|
}, false);
|
2030
2011
|
// If component definition changed, replace and mark as changed.
|
@@ -2091,7 +2072,7 @@ class Component extends Element_1.default {
|
|
2091
2072
|
return actions.reduce((changed, action) => {
|
2092
2073
|
switch (action.type) {
|
2093
2074
|
case 'property': {
|
2094
|
-
|
2075
|
+
utils_1.default.setActionProperty(newComponent, action, result, row, data, this);
|
2095
2076
|
const property = action.property.value;
|
2096
2077
|
if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
|
2097
2078
|
// Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
|
@@ -2595,7 +2576,7 @@ class Component extends Element_1.default {
|
|
2595
2576
|
if (this.component.type !== 'textfield') {
|
2596
2577
|
const placeholderChar = this.placeholderChar;
|
2597
2578
|
value = (0, vanilla_text_mask_1.conformToMask)(value, this.defaultMask, { placeholderChar }).conformedValue;
|
2598
|
-
if (!
|
2579
|
+
if (!utils_1.default.matchInputMask(value, this.defaultMask)) {
|
2599
2580
|
value = '';
|
2600
2581
|
}
|
2601
2582
|
}
|
@@ -2917,7 +2898,7 @@ class Component extends Element_1.default {
|
|
2917
2898
|
}
|
2918
2899
|
if (fromSubmission) {
|
2919
2900
|
// If we set value from submission and it differs from calculated one, set the calculated value to prevent overriding dataValue in the next pass
|
2920
|
-
this.calculatedValue = (0,
|
2901
|
+
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
2921
2902
|
return false;
|
2922
2903
|
}
|
2923
2904
|
// If this is the firstPass, and the dataValue is different than to the calculatedValue.
|
@@ -2926,7 +2907,7 @@ class Component extends Element_1.default {
|
|
2926
2907
|
return true;
|
2927
2908
|
}
|
2928
2909
|
}
|
2929
|
-
this.calculatedValue = (0,
|
2910
|
+
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
2930
2911
|
if (changed) {
|
2931
2912
|
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
2932
2913
|
this.pristine = false;
|
@@ -2987,7 +2968,7 @@ class Component extends Element_1.default {
|
|
2987
2968
|
var _a;
|
2988
2969
|
const { local } = options;
|
2989
2970
|
if (!row) {
|
2990
|
-
row = (0,
|
2971
|
+
row = (0, utils_2.getContextualRowData)(this.component, data, this.paths);
|
2991
2972
|
}
|
2992
2973
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
2993
2974
|
return '';
|
@@ -3016,7 +2997,7 @@ class Component extends Element_1.default {
|
|
3016
2997
|
]
|
3017
2998
|
});
|
3018
2999
|
const errors = validationScope.errors;
|
3019
|
-
const interpolatedErrors =
|
3000
|
+
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
3020
3001
|
return lodash_1.default.map(interpolatedErrors, 'message').join('\n\n');
|
3021
3002
|
}
|
3022
3003
|
/**
|
@@ -3047,7 +3028,7 @@ class Component extends Element_1.default {
|
|
3047
3028
|
*/
|
3048
3029
|
interpolateErrors(errors) {
|
3049
3030
|
var _a;
|
3050
|
-
const interpolatedErrors =
|
3031
|
+
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
3051
3032
|
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length) ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
|
3052
3033
|
}
|
3053
3034
|
/**
|
@@ -3267,7 +3248,7 @@ class Component extends Element_1.default {
|
|
3267
3248
|
}
|
3268
3249
|
});
|
3269
3250
|
this.addEventListener(element, 'blur', () => {
|
3270
|
-
this.root.pendingBlur =
|
3251
|
+
this.root.pendingBlur = utils_1.default.delay(() => {
|
3271
3252
|
this.emit('blur', this);
|
3272
3253
|
if (this.component.validateOn === 'blur') {
|
3273
3254
|
this.root.triggerChange({ fromBlur: true }, {
|
@@ -3515,7 +3496,7 @@ class Component extends Element_1.default {
|
|
3515
3496
|
if (logic.trigger.type === 'event') {
|
3516
3497
|
const event = this.interpolate(logic.trigger.event);
|
3517
3498
|
this.on(event, (...args) => {
|
3518
|
-
const newComponent = (0,
|
3499
|
+
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
3519
3500
|
if (this.applyActions(newComponent, logic.actions, args)) {
|
3520
3501
|
// If component definition changed, replace it.
|
3521
3502
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
@@ -3646,7 +3627,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
3646
3627
|
}.bind(Component.externalLibraries[name]);
|
3647
3628
|
}
|
3648
3629
|
// See if the plugin already exists.
|
3649
|
-
const plugin = (0,
|
3630
|
+
const plugin = (0, utils_2.getScriptPlugin)(property);
|
3650
3631
|
if (plugin) {
|
3651
3632
|
Component.externalLibraries[name].resolve(plugin);
|
3652
3633
|
}
|
@@ -3689,7 +3670,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
3689
3670
|
// if no callback is provided, then check periodically for the script.
|
3690
3671
|
if (polling) {
|
3691
3672
|
setTimeout(function checkLibrary() {
|
3692
|
-
const plugin = (0,
|
3673
|
+
const plugin = (0, utils_2.getScriptPlugin)(property);
|
3693
3674
|
if (plugin) {
|
3694
3675
|
Component.externalLibraries[name].resolve(plugin);
|
3695
3676
|
}
|
@@ -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);
|
@@ -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 {
|
@@ -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();
|
@@ -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',
|
@@ -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;
|
@@ -7,7 +7,7 @@ export default class ButtonComponent extends Field {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
-
static savedValueTypes(schema: any):
|
10
|
+
static savedValueTypes(schema: any): any;
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
12
|
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
@@ -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
|
9
|
+
const formUtils_1 = require("../../utils/formUtils");
|
10
10
|
class ButtonComponent extends Field_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Input_1.default.schema({
|
@@ -35,7 +35,7 @@ class ButtonComponent extends Field_1.default {
|
|
35
35
|
};
|
36
36
|
}
|
37
37
|
static savedValueTypes(schema) {
|
38
|
-
return (0,
|
38
|
+
return (0, formUtils_1.getComponentSavedTypes)(schema) || [formUtils_1.componentValueTypes.boolean];
|
39
39
|
}
|
40
40
|
constructor(component, options, data) {
|
41
41
|
super(component, options, data);
|
@@ -306,7 +306,7 @@ class ButtonComponent extends Field_1.default {
|
|
306
306
|
const form = this.getRoot();
|
307
307
|
const flattened = {};
|
308
308
|
const components = {};
|
309
|
-
(0,
|
309
|
+
(0, formUtils_1.eachComponent)(form.components, (componentWrapper, path) => {
|
310
310
|
const component = componentWrapper.component || componentWrapper;
|
311
311
|
flattened[path] = component;
|
312
312
|
components[component.key] = component;
|
@@ -447,7 +447,7 @@ class ButtonComponent extends Field_1.default {
|
|
447
447
|
}, 100);
|
448
448
|
}
|
449
449
|
get oauthComponentPath() {
|
450
|
-
const pathArray = (0,
|
450
|
+
const pathArray = (0, formUtils_1.getArrayFromComponentPath)(this.path);
|
451
451
|
return lodash_1.default.chain(pathArray).filter(pathPart => !lodash_1.default.isNumber(pathPart)).join('.').value();
|
452
452
|
}
|
453
453
|
focus() {
|
@@ -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
|
const dragula_1 = __importDefault(require("dragula"));
|
10
10
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
11
11
|
static schema(...extend) {
|
@@ -7,7 +7,7 @@ const Component_1 = __importDefault(require("../_classes/component/Component"));
|
|
7
7
|
const DataGrid_1 = __importDefault(require("../datagrid/DataGrid"));
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
9
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
10
|
-
const
|
10
|
+
const formUtils_1 = require("../../utils/formUtils");
|
11
11
|
class DataMapComponent extends DataGrid_1.default {
|
12
12
|
static schema(...extend) {
|
13
13
|
return Component_1.default.schema({
|
@@ -50,7 +50,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
50
50
|
return lodash_1.default.omit(schema, 'components');
|
51
51
|
}
|
52
52
|
static savedValueTypes(schema) {
|
53
|
-
return (0,
|
53
|
+
return (0, formUtils_1.getComponentSavedTypes)(schema) || [formUtils_1.componentValueTypes.object];
|
54
54
|
}
|
55
55
|
constructor(component, options, data) {
|
56
56
|
super(component, options, data);
|
@@ -149,7 +149,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
149
149
|
getRowKey(rowIndex) {
|
150
150
|
const keys = Object.keys(this.dataValue);
|
151
151
|
if (!keys[rowIndex]) {
|
152
|
-
keys[rowIndex] = (0,
|
152
|
+
keys[rowIndex] = (0, formUtils_1.uniqueKey)(this.dataValue, this.defaultRowKey);
|
153
153
|
}
|
154
154
|
return keys[rowIndex];
|
155
155
|
}
|
@@ -232,7 +232,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
232
232
|
components['__key'] = this.createComponent(this.keySchema, options, { __key: this.builderMode ? this.defaultRowKey : key });
|
233
233
|
components['__key'].on('componentChange', (event) => {
|
234
234
|
const dataValue = this.dataValue;
|
235
|
-
const newKey = (0,
|
235
|
+
const newKey = (0, formUtils_1.uniqueKey)(dataValue, event.value);
|
236
236
|
dataValue[newKey] = dataValue[key];
|
237
237
|
delete dataValue[key];
|
238
238
|
const comp = components[this.valueKey];
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
8
8
|
const utils_1 = __importDefault(require("../../utils"));
|
9
|
-
const utils_2 = require("../../utils
|
9
|
+
const utils_2 = require("../../utils");
|
10
10
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
11
11
|
class DateTimeComponent extends Input_1.default {
|
12
12
|
static schema(...extend) {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
8
8
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
const core_1 = require("@formio/core");
|
11
11
|
class DayComponent extends Field_1.default {
|
12
12
|
static schema(...extend) {
|
@@ -9,7 +9,7 @@ const components_1 = require("@formio/bootstrap/components");
|
|
9
9
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
10
10
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
11
11
|
const Alert_1 = __importDefault(require("../alert/Alert"));
|
12
|
-
const utils_1 = require("../../utils
|
12
|
+
const utils_1 = require("../../utils");
|
13
13
|
const EditRowState = {
|
14
14
|
New: 'new',
|
15
15
|
Editing: 'editing',
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
16
|
-
const utils_1 = require("../../utils
|
16
|
+
const utils_1 = require("../../utils");
|
17
17
|
const downloadjs_1 = __importDefault(require("downloadjs"));
|
18
18
|
const lodash_1 = __importDefault(require("lodash"));
|
19
19
|
const fileProcessor_1 = __importDefault(require("../../providers/processor/fileProcessor"));
|
@@ -8,7 +8,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
9
9
|
const ComponentModal_1 = __importDefault(require("../_classes/componentModal/ComponentModal"));
|
10
10
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
11
|
-
const utils_1 = require("../../utils
|
11
|
+
const utils_1 = require("../../utils");
|
12
12
|
const Formio_1 = require("../../Formio");
|
13
13
|
const Form_1 = __importDefault(require("../../Form"));
|
14
14
|
class FormComponent extends Component_1.default {
|
@@ -7,7 +7,7 @@ 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
9
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
10
|
-
const utils_1 = require("../../utils/
|
10
|
+
const utils_1 = require("../../utils/");
|
11
11
|
class NumberComponent extends Input_1.default {
|
12
12
|
static schema(...extend) {
|
13
13
|
return Input_1.default.schema({
|