@formio/js 5.1.0-dev.6042.18ef5d3 → 5.1.0-dev.6042.603237d

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.
Files changed (156) hide show
  1. package/Changelog.md +57 -402
  2. package/README.md +7 -0
  3. package/dist/formio.builder.css +1 -0
  4. package/dist/formio.builder.min.css +1 -1
  5. package/dist/formio.form.css +1 -0
  6. package/dist/formio.form.js +104 -126
  7. package/dist/formio.form.min.css +1 -1
  8. package/dist/formio.form.min.js +1 -1
  9. package/dist/formio.form.min.js.LICENSE.txt +3 -1
  10. package/dist/formio.full.css +1 -0
  11. package/dist/formio.full.js +111 -133
  12. package/dist/formio.full.min.css +1 -1
  13. package/dist/formio.full.min.js +1 -1
  14. package/dist/formio.full.min.js.LICENSE.txt +3 -1
  15. package/dist/formio.js +53 -64
  16. package/dist/formio.min.js +1 -1
  17. package/dist/formio.utils.js +66 -77
  18. package/dist/formio.utils.min.js +1 -1
  19. package/dist/formio.utils.min.js.LICENSE.txt +3 -1
  20. package/lib/cjs/Element.js +13 -36
  21. package/lib/cjs/EventEmitter.js +2 -25
  22. package/lib/cjs/Form.js +2 -25
  23. package/lib/cjs/PDF.js +1 -1
  24. package/lib/cjs/PDFBuilder.js +4 -5
  25. package/lib/cjs/Webform.js +8 -7
  26. package/lib/cjs/WebformBuilder.d.ts +1 -0
  27. package/lib/cjs/WebformBuilder.js +40 -14
  28. package/lib/cjs/Wizard.d.ts +1 -2
  29. package/lib/cjs/Wizard.js +18 -24
  30. package/lib/cjs/WizardBuilder.js +1 -1
  31. package/lib/cjs/components/_classes/component/Component.d.ts +26 -2
  32. package/lib/cjs/components/_classes/component/Component.js +97 -88
  33. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  34. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  35. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  36. package/lib/cjs/components/_classes/input/Input.js +1 -1
  37. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  38. package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -7
  39. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  40. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  41. package/lib/cjs/components/address/Address.js +1 -1
  42. package/lib/cjs/components/alert/Alert.js +1 -1
  43. package/lib/cjs/components/button/Button.d.ts +1 -1
  44. package/lib/cjs/components/button/Button.js +7 -11
  45. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  46. package/lib/cjs/components/container/Container.js +1 -1
  47. package/lib/cjs/components/currency/Currency.js +1 -1
  48. package/lib/cjs/components/datagrid/DataGrid.js +5 -1
  49. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  50. package/lib/cjs/components/datetime/DateTime.js +15 -13
  51. package/lib/cjs/components/day/Day.js +2 -2
  52. package/lib/cjs/components/editgrid/EditGrid.js +1 -1
  53. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  54. package/lib/cjs/components/file/File.js +5 -6
  55. package/lib/cjs/components/form/Form.d.ts +0 -1
  56. package/lib/cjs/components/form/Form.js +26 -22
  57. package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
  58. package/lib/cjs/components/number/Number.js +1 -1
  59. package/lib/cjs/components/panel/Panel.js +1 -1
  60. package/lib/cjs/components/radio/Radio.d.ts +8 -0
  61. package/lib/cjs/components/radio/Radio.js +16 -6
  62. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  63. package/lib/cjs/components/select/Select.d.ts +1 -0
  64. package/lib/cjs/components/select/Select.js +20 -4
  65. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  66. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  67. package/lib/cjs/components/selectboxes/SelectBoxes.js +4 -1
  68. package/lib/cjs/components/signature/Signature.js +1 -1
  69. package/lib/cjs/components/survey/Survey.js +1 -1
  70. package/lib/cjs/components/tags/Tags.js +1 -1
  71. package/lib/cjs/components/textarea/TextArea.js +3 -3
  72. package/lib/cjs/components/textfield/TextField.js +9 -32
  73. package/lib/cjs/components/time/Time.js +1 -1
  74. package/lib/cjs/formio.form.js +3 -3
  75. package/lib/cjs/providers/storage/uploadAdapter.js +3 -3
  76. package/lib/cjs/translations/en.js +1 -1
  77. package/lib/cjs/utils/Evaluator.d.ts +20 -6
  78. package/lib/cjs/utils/Evaluator.js +38 -15
  79. package/lib/cjs/utils/builder.js +5 -5
  80. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  81. package/lib/cjs/utils/formUtils.d.ts +2 -2
  82. package/lib/cjs/utils/index.d.ts +169 -2
  83. package/lib/cjs/utils/index.js +22 -2
  84. package/lib/cjs/utils/utils.d.ts +31 -37
  85. package/lib/cjs/utils/utils.js +79 -135
  86. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
  87. package/lib/cjs/widgets/CalendarWidget.js +19 -40
  88. package/lib/mjs/Element.js +6 -6
  89. package/lib/mjs/EventEmitter.js +2 -2
  90. package/lib/mjs/Form.js +1 -1
  91. package/lib/mjs/PDF.js +1 -1
  92. package/lib/mjs/PDFBuilder.js +1 -2
  93. package/lib/mjs/Webform.js +6 -5
  94. package/lib/mjs/WebformBuilder.d.ts +1 -0
  95. package/lib/mjs/WebformBuilder.js +32 -7
  96. package/lib/mjs/Wizard.d.ts +1 -2
  97. package/lib/mjs/Wizard.js +17 -23
  98. package/lib/mjs/WizardBuilder.js +1 -1
  99. package/lib/mjs/components/_classes/component/Component.d.ts +26 -2
  100. package/lib/mjs/components/_classes/component/Component.js +70 -38
  101. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  102. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  103. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  104. package/lib/mjs/components/_classes/input/Input.js +1 -1
  105. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  106. package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -7
  107. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  108. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  109. package/lib/mjs/components/address/Address.js +1 -1
  110. package/lib/mjs/components/alert/Alert.js +1 -1
  111. package/lib/mjs/components/button/Button.d.ts +1 -1
  112. package/lib/mjs/components/button/Button.js +7 -10
  113. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  114. package/lib/mjs/components/container/Container.js +1 -1
  115. package/lib/mjs/components/currency/Currency.js +1 -1
  116. package/lib/mjs/components/datagrid/DataGrid.js +5 -1
  117. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  118. package/lib/mjs/components/datetime/DateTime.js +15 -13
  119. package/lib/mjs/components/day/Day.js +2 -2
  120. package/lib/mjs/components/editgrid/EditGrid.js +1 -1
  121. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  122. package/lib/mjs/components/file/File.js +5 -6
  123. package/lib/mjs/components/form/Form.d.ts +0 -1
  124. package/lib/mjs/components/form/Form.js +25 -22
  125. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
  126. package/lib/mjs/components/number/Number.js +1 -1
  127. package/lib/mjs/components/panel/Panel.js +1 -1
  128. package/lib/mjs/components/radio/Radio.d.ts +8 -0
  129. package/lib/mjs/components/radio/Radio.js +16 -6
  130. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  131. package/lib/mjs/components/select/Select.d.ts +1 -0
  132. package/lib/mjs/components/select/Select.js +20 -4
  133. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  134. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  135. package/lib/mjs/components/selectboxes/SelectBoxes.js +4 -1
  136. package/lib/mjs/components/signature/Signature.js +1 -1
  137. package/lib/mjs/components/survey/Survey.js +1 -1
  138. package/lib/mjs/components/tags/Tags.js +1 -1
  139. package/lib/mjs/components/textarea/TextArea.js +3 -3
  140. package/lib/mjs/components/textfield/TextField.js +3 -3
  141. package/lib/mjs/components/time/Time.js +1 -1
  142. package/lib/mjs/formio.form.js +2 -2
  143. package/lib/mjs/providers/storage/uploadAdapter.js +3 -3
  144. package/lib/mjs/translations/en.js +3 -0
  145. package/lib/mjs/utils/Evaluator.d.ts +20 -6
  146. package/lib/mjs/utils/Evaluator.js +31 -13
  147. package/lib/mjs/utils/builder.js +1 -1
  148. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  149. package/lib/mjs/utils/formUtils.d.ts +2 -2
  150. package/lib/mjs/utils/index.d.ts +169 -2
  151. package/lib/mjs/utils/index.js +18 -1
  152. package/lib/mjs/utils/utils.d.ts +31 -37
  153. package/lib/mjs/utils/utils.js +71 -109
  154. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
  155. package/lib/mjs/widgets/CalendarWidget.js +19 -40
  156. package/package.json +8 -6
@@ -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 FormioUtils = __importStar(require("../../../utils/utils"));
46
- const utils_1 = require("../../../utils/utils");
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 = FormioUtils.getBrowserInfo().ie;
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 FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.any];
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, utils_1.fastCloneDeep)(this.component);
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, utils_1.boolValue)(this.component.disabled) ? this.component.disabled : false;
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 = FormioUtils.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 }));
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
@@ -458,10 +435,15 @@ class Component extends Element_1.default {
458
435
  var _a;
459
436
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
460
437
  }
438
+ /**
439
+ * Returns if the parent should conditionally clear.
440
+ * @returns {boolean} - If the parent should conditionally clear.
441
+ */
461
442
  parentShouldConditionallyClear() {
462
443
  let currentParent = this.parent;
463
444
  while (currentParent) {
464
- if (currentParent.shouldConditionallyClear(true)) {
445
+ if ((currentParent.allowData && currentParent._conditionallyClear) ||
446
+ (!currentParent.allowData && currentParent._conditionallyHidden)) {
465
447
  return true;
466
448
  }
467
449
  currentParent = currentParent.parent;
@@ -471,7 +453,21 @@ class Component extends Element_1.default {
471
453
  parentConditionallyHidden() {
472
454
  let currentParent = this.parent;
473
455
  while (currentParent) {
474
- if (currentParent.conditionallyHidden(true)) {
456
+ if (currentParent._conditionallyHidden) {
457
+ return true;
458
+ }
459
+ currentParent = currentParent.parent;
460
+ }
461
+ return false;
462
+ }
463
+ /**
464
+ * Returns true if any of the parents default their component "hidden" property to true.
465
+ * @returns {boolean} - If any parent defaults the hidden property to true.
466
+ */
467
+ anyParentDefaultsHidden() {
468
+ let currentParent = this.parent;
469
+ while (currentParent) {
470
+ if (currentParent.component.hidden) {
475
471
  return true;
476
472
  }
477
473
  currentParent = currentParent.parent;
@@ -504,7 +500,7 @@ class Component extends Element_1.default {
504
500
  label.labelPosition = this.component.labelPosition;
505
501
  label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
506
502
  const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
507
- if (this.hasInput && this.component.validate && (0, utils_1.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
503
+ if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
508
504
  label.className += ' field-required';
509
505
  }
510
506
  if (label.hidden) {
@@ -537,7 +533,7 @@ class Component extends Element_1.default {
537
533
  */
538
534
  set rowIndex(value) {
539
535
  var _a, _b;
540
- this.paths = FormioUtils.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 }));
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 }));
541
537
  this._rowIndex = value;
542
538
  }
543
539
  afterComponentAssign() {
@@ -689,48 +685,58 @@ class Component extends Element_1.default {
689
685
  }
690
686
  return this._logicallyHidden;
691
687
  }
692
- shouldConditionallyClear(skipParent = false) {
688
+ /**
689
+ * Determines if the component should clear its value when the root form is pristine.
690
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
691
+ */
692
+ shouldConditionallyClearOnPristine() {
693
+ // If the form is pristine, we should NOT clear the value of a conditionally hidden child component
694
+ // of a layout component that defaults to hidden using the "hidden" component property.
695
+ return !this.anyParentDefaultsHidden();
696
+ }
697
+ /**
698
+ * Returns if the component should clear its value when conditionally hidden.
699
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
700
+ */
701
+ shouldConditionallyClear() {
693
702
  // Skip if this component has clearOnHide set to false.
694
703
  if (this.component.clearOnHide === false) {
695
- return false;
704
+ this._conditionallyClear = false;
705
+ return this._conditionallyClear;
696
706
  }
697
707
  // If the component is logically hidden, then it is conditionally hidden and should clear.
698
708
  if (this.logicallyHidden) {
699
- return true;
709
+ this._conditionallyClear = true;
710
+ return this._conditionallyClear;
700
711
  }
701
712
  // If we have a condition and it is not conditionally visible, the it should conditionally clear.
702
- if (this.hasCondition() && !this.conditionallyVisible()) {
703
- return true;
704
- }
705
- if (skipParent) {
706
- // Stop recurrsion for the parent checks.
707
- return false;
713
+ if (this.hasCondition() &&
714
+ !this.conditionallyVisible() &&
715
+ (!this.rootPristine || this.shouldConditionallyClearOnPristine())) {
716
+ this._conditionallyClear = true;
717
+ return this._conditionallyClear;
708
718
  }
709
- // If this component has a set value, then it should ONLY clear if a parent is hidden
710
- // and has the clearOnHide set to true.
711
- if (this.hasSetValue) {
712
- return this.parentShouldConditionallyClear();
713
- }
714
- // Clear the value if the parent is conditionally hidden.
715
- return this.parentConditionallyHidden();
719
+ this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
720
+ return this._conditionallyClear;
716
721
  }
717
- conditionallyHidden(skipParent = false) {
722
+ /**
723
+ * Returns if the component is conditionally hidden.
724
+ * @returns {boolean} - If the component is conditionally hidden.
725
+ */
726
+ conditionallyHidden() {
727
+ // If it is logically hidden, then it is conditionally hidden.
718
728
  if (this.logicallyHidden) {
719
- return true;
720
- }
721
- if (!this.hasCondition() && !skipParent) {
722
- return this.parentConditionallyHidden();
723
- }
724
- // Return if we are not conditionally visible (conditionallyHidden)
725
- if (!this.conditionallyVisible()) {
726
- return true;
729
+ this._conditionallyHidden = true;
730
+ return this._conditionallyHidden;
727
731
  }
728
- if (skipParent) {
729
- // Stop recurrsion for the parent checks.
730
- return false;
732
+ // If it has a condition, and is not conditionally visible, then it is conditionally hidden.
733
+ if (this.hasCondition() && !this.conditionallyVisible()) {
734
+ this._conditionallyHidden = true;
735
+ return this._conditionallyHidden;
731
736
  }
732
- // Check the parent.
733
- return this.parentConditionallyHidden();
737
+ // It is conditionally hidden if its parent is conditionally hidden.
738
+ this._conditionallyHidden = this.parentConditionallyHidden();
739
+ return this._conditionallyHidden;
734
740
  }
735
741
  get currentForm() {
736
742
  return this._currentForm;
@@ -847,7 +853,7 @@ class Component extends Element_1.default {
847
853
  * @returns {object} - The JSON schema for this component.
848
854
  */
849
855
  get schema() {
850
- return (0, utils_1.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
856
+ return (0, utils_2.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
851
857
  }
852
858
  /**
853
859
  * Returns true if component is inside DataGrid
@@ -999,7 +1005,7 @@ class Component extends Element_1.default {
999
1005
  if (!this.shouldSanitizeValue && !forceSanitize) {
1000
1006
  return dirty;
1001
1007
  }
1002
- return FormioUtils.sanitize(dirty, {
1008
+ return utils_1.default.sanitize(dirty, {
1003
1009
  sanitizeConfig: lodash_1.default.merge(((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitizeConfig) || {}, options || {}),
1004
1010
  });
1005
1011
  }
@@ -1118,7 +1124,7 @@ class Component extends Element_1.default {
1118
1124
  return submissionTimezone;
1119
1125
  }
1120
1126
  // Return current timezone if none are provided.
1121
- return (0, utils_1.currentTimezone)();
1127
+ return (0, utils_2.currentTimezone)();
1122
1128
  }
1123
1129
  /**
1124
1130
  *
@@ -1423,7 +1429,7 @@ class Component extends Element_1.default {
1423
1429
  else {
1424
1430
  this.refreshOnChanged = true;
1425
1431
  }
1426
- this.refreshOnValue = (0, utils_1.fastCloneDeep)(value);
1432
+ this.refreshOnValue = (0, utils_2.fastCloneDeep)(value);
1427
1433
  if (this.refreshOnChanged) {
1428
1434
  if (this.component.clearOnRefresh) {
1429
1435
  this.setValue(null);
@@ -1665,7 +1671,7 @@ class Component extends Element_1.default {
1665
1671
  if (this.component.customClass) {
1666
1672
  className += this.component.customClass;
1667
1673
  }
1668
- if (this.hasInput && this.component.validate && (0, utils_1.boolValue)(this.component.validate.required)) {
1674
+ if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required)) {
1669
1675
  className += ' required';
1670
1676
  }
1671
1677
  if (this.labelIsHidden()) {
@@ -1953,7 +1959,7 @@ class Component extends Element_1.default {
1953
1959
  if (this._hasCondition !== null) {
1954
1960
  return this._hasCondition;
1955
1961
  }
1956
- this._hasCondition = FormioUtils.hasCondition(this.component);
1962
+ this._hasCondition = utils_1.default.hasCondition(this.component);
1957
1963
  return this._hasCondition;
1958
1964
  }
1959
1965
  /**
@@ -1980,7 +1986,7 @@ class Component extends Element_1.default {
1980
1986
  * @returns {boolean} - True if the condition applies to this component.
1981
1987
  */
1982
1988
  checkCondition(row, data) {
1983
- return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
1989
+ return utils_1.default.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
1984
1990
  }
1985
1991
  /**
1986
1992
  * Check for conditionals and hide/show the element based on those conditions.
@@ -2036,9 +2042,9 @@ class Component extends Element_1.default {
2036
2042
  if (logics.length === 0) {
2037
2043
  return;
2038
2044
  }
2039
- const newComponent = (0, utils_1.fastCloneDeep)(this.originalComponent);
2045
+ const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
2040
2046
  let changed = logics.reduce((changed, logic) => {
2041
- const result = FormioUtils.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
2047
+ const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
2042
2048
  return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
2043
2049
  }, false);
2044
2050
  // If component definition changed, replace and mark as changed.
@@ -2105,7 +2111,7 @@ class Component extends Element_1.default {
2105
2111
  return actions.reduce((changed, action) => {
2106
2112
  switch (action.type) {
2107
2113
  case 'property': {
2108
- FormioUtils.setActionProperty(newComponent, action, result, row, data, this);
2114
+ utils_1.default.setActionProperty(newComponent, action, result, row, data, this);
2109
2115
  const property = action.property.value;
2110
2116
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2111
2117
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
@@ -2618,7 +2624,7 @@ class Component extends Element_1.default {
2618
2624
  if (this.component.type !== 'textfield') {
2619
2625
  const placeholderChar = this.placeholderChar;
2620
2626
  value = (0, vanilla_text_mask_1.conformToMask)(value, this.defaultMask, { placeholderChar }).conformedValue;
2621
- if (!FormioUtils.matchInputMask(value, this.defaultMask)) {
2627
+ if (!utils_1.default.matchInputMask(value, this.defaultMask)) {
2622
2628
  value = '';
2623
2629
  }
2624
2630
  }
@@ -2684,13 +2690,16 @@ class Component extends Element_1.default {
2684
2690
  }
2685
2691
  const isArray = Array.isArray(value);
2686
2692
  const valueInput = this.refs.fileLink || this.refs.input;
2693
+ const isFilelink = !!this.refs.fileLink;
2687
2694
  if (isArray &&
2688
2695
  Array.isArray(this.defaultValue) &&
2689
2696
  this.refs.hasOwnProperty('input') &&
2690
2697
  valueInput &&
2691
2698
  (valueInput.length !== value.length) &&
2692
2699
  this.visible) {
2693
- this.redraw();
2700
+ if (isFilelink || valueInput.length) {
2701
+ this.redraw();
2702
+ }
2694
2703
  }
2695
2704
  if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
2696
2705
  this.redraw();
@@ -2936,7 +2945,7 @@ class Component extends Element_1.default {
2936
2945
  }
2937
2946
  if (fromSubmission) {
2938
2947
  // If we set value from submission and it differs from calculated one, set the calculated value to prevent overriding dataValue in the next pass
2939
- this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
2948
+ this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
2940
2949
  return false;
2941
2950
  }
2942
2951
  // If this is the firstPass, and the dataValue is different than to the calculatedValue.
@@ -2945,7 +2954,7 @@ class Component extends Element_1.default {
2945
2954
  return true;
2946
2955
  }
2947
2956
  }
2948
- this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
2957
+ this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
2949
2958
  if (changed) {
2950
2959
  if (!flags.noPristineChangeOnModified && this.root.initialized) {
2951
2960
  this.pristine = false;
@@ -3006,7 +3015,7 @@ class Component extends Element_1.default {
3006
3015
  var _a;
3007
3016
  const { local } = options;
3008
3017
  if (!row) {
3009
- row = (0, utils_1.getContextualRowData)(this.component, data, this.paths);
3018
+ row = (0, utils_2.getContextualRowData)(this.component, data, this.paths);
3010
3019
  }
3011
3020
  if (!ignoreCondition && !this.checkCondition(row, data)) {
3012
3021
  return '';
@@ -3035,7 +3044,7 @@ class Component extends Element_1.default {
3035
3044
  ]
3036
3045
  });
3037
3046
  const errors = validationScope.errors;
3038
- const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
3047
+ const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
3039
3048
  return lodash_1.default.map(interpolatedErrors, 'message').join('\n\n');
3040
3049
  }
3041
3050
  /**
@@ -3066,7 +3075,7 @@ class Component extends Element_1.default {
3066
3075
  */
3067
3076
  interpolateErrors(errors) {
3068
3077
  var _a;
3069
- const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
3078
+ const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
3070
3079
  return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length) ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
3071
3080
  }
3072
3081
  /**
@@ -3201,6 +3210,9 @@ class Component extends Element_1.default {
3201
3210
  data = data || this.rootValue;
3202
3211
  flags = flags || {};
3203
3212
  row = row || this.data;
3213
+ if (flags.noCheck) {
3214
+ return true;
3215
+ }
3204
3216
  // Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
3205
3217
  // as setValue. Historically, this was bypassed by a series of cached states around the data model
3206
3218
  // which caused its own problems. We need to ensure that premium and custom components do not fall into
@@ -3215,9 +3227,6 @@ class Component extends Element_1.default {
3215
3227
  if (!flags.fromBlur) {
3216
3228
  this.checkRefreshOn(flags.changes, flags);
3217
3229
  }
3218
- if (flags.noCheck) {
3219
- return true;
3220
- }
3221
3230
  this.checkComponentConditions(data, flags, row);
3222
3231
  if (this.id !== flags.triggeredComponentId) {
3223
3232
  this.calculateComponentValue(data, flags, row);
@@ -3286,7 +3295,7 @@ class Component extends Element_1.default {
3286
3295
  }
3287
3296
  });
3288
3297
  this.addEventListener(element, 'blur', () => {
3289
- this.root.pendingBlur = FormioUtils.delay(() => {
3298
+ this.root.pendingBlur = utils_1.default.delay(() => {
3290
3299
  this.emit('blur', this);
3291
3300
  if (this.component.validateOn === 'blur') {
3292
3301
  this.root.triggerChange({ fromBlur: true }, {
@@ -3534,7 +3543,7 @@ class Component extends Element_1.default {
3534
3543
  if (logic.trigger.type === 'event') {
3535
3544
  const event = this.interpolate(logic.trigger.event);
3536
3545
  this.on(event, (...args) => {
3537
- const newComponent = (0, utils_1.fastCloneDeep)(this.originalComponent);
3546
+ const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
3538
3547
  if (this.applyActions(newComponent, logic.actions, args)) {
3539
3548
  // If component definition changed, replace it.
3540
3549
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
@@ -3669,7 +3678,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3669
3678
  }.bind(Component.externalLibraries[name]);
3670
3679
  }
3671
3680
  // See if the plugin already exists.
3672
- const plugin = (0, utils_1.getScriptPlugin)(property);
3681
+ const plugin = (0, utils_2.getScriptPlugin)(property);
3673
3682
  if (plugin) {
3674
3683
  Component.externalLibraries[name].resolve(plugin);
3675
3684
  }
@@ -3712,7 +3721,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3712
3721
  // if no callback is provided, then check periodically for the script.
3713
3722
  if (polling) {
3714
3723
  setTimeout(function checkLibrary() {
3715
- const plugin = (0, utils_1.getScriptPlugin)(property);
3724
+ const plugin = (0, utils_2.getScriptPlugin)(property);
3716
3725
  if (plugin) {
3717
3726
  Component.externalLibraries[name].resolve(plugin);
3718
3727
  }
@@ -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/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/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/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/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/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/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 = (0, utils_1.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 }));
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 = (0, utils_1.getStringFromComponentPath)(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
- (0, utils_1.componentMatches)(component.component, {
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 = (0, utils_1.getBestMatch)(matches)) === null || _a === void 0 ? void 0 : _a.instance;
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 = (0, utils_1.getRandomComponentId)();
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.hasExtraPages && this.page !== this.root.page) {
667
+ if (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);
@@ -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/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/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/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/utils");
7
+ const utils_1 = require("../../utils");
8
8
  class Alert {
9
9
  constructor(container, component) {
10
10
  this.container = container;
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
9
9
  };
10
10
  static savedValueTypes(schema: any): string[];
11
11
  constructor(component: any, options: any, data: any);
12
- filesUploading: any[];
12
+ filesUploading: number;
13
13
  get inputInfo(): any;
14
14
  get labelInfo(): {
15
15
  hidden: boolean;
@@ -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/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({
@@ -39,7 +39,7 @@ class ButtonComponent extends Field_1.default {
39
39
  }
40
40
  constructor(component, options, data) {
41
41
  super(component, options, data);
42
- this.filesUploading = [];
42
+ this.filesUploading = 0;
43
43
  }
44
44
  get defaultSchema() {
45
45
  return ButtonComponent.schema();
@@ -147,16 +147,13 @@ class ButtonComponent extends Field_1.default {
147
147
  this.addClass(this.refs.buttonMessageContainer, 'has-error');
148
148
  this.setContent(this.refs.buttonMessage, resultMessage);
149
149
  }, true);
150
- this.on('fileUploadingStart', (filePromise) => {
151
- this.filesUploading.push(filePromise);
150
+ this.on('fileUploadingStart', () => {
151
+ this.filesUploading++;
152
152
  this.disabled = true;
153
153
  this.setDisabled(this.refs.button, this.disabled);
154
154
  }, true);
155
- this.on('fileUploadingEnd', (filePromise) => {
156
- const index = this.filesUploading.indexOf(filePromise);
157
- if (index !== -1) {
158
- this.filesUploading.splice(index, 1);
159
- }
155
+ this.on('fileUploadingEnd', () => {
156
+ this.filesUploading--;
160
157
  this.disabled = this.shouldDisabled ? true : false;
161
158
  this.setDisabled(this.refs.button, this.disabled);
162
159
  }, true);
@@ -252,8 +249,7 @@ class ButtonComponent extends Field_1.default {
252
249
  }
253
250
  }
254
251
  get shouldDisabled() {
255
- var _a;
256
- return super.shouldDisabled || !!((_a = this.filesUploading) === null || _a === void 0 ? void 0 : _a.length) || this.isDisabledOnInvalid;
252
+ return super.shouldDisabled || this.filesUploading > 0 || this.isDisabledOnInvalid;
257
253
  }
258
254
  attach(element) {
259
255
  this.loadRefs(element, {