@formio/js 5.1.0-dev.6109.79f22ad → 5.1.0-dev.6112.1314654

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 (180) hide show
  1. package/README.md +7 -0
  2. package/dist/formio.builder.css +1 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.form.css +1 -0
  5. package/dist/formio.form.js +119 -152
  6. package/dist/formio.form.min.css +1 -1
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.full.css +1 -0
  9. package/dist/formio.full.js +126 -159
  10. package/dist/formio.full.min.css +1 -1
  11. package/dist/formio.full.min.js +1 -1
  12. package/dist/formio.js +66 -55
  13. package/dist/formio.min.js +1 -1
  14. package/dist/formio.utils.js +76 -76
  15. package/dist/formio.utils.min.js +1 -1
  16. package/lib/cjs/Element.d.ts +2 -1
  17. package/lib/cjs/Element.js +18 -39
  18. package/lib/cjs/EventEmitter.js +2 -25
  19. package/lib/cjs/Form.js +2 -25
  20. package/lib/cjs/PDF.js +1 -1
  21. package/lib/cjs/PDFBuilder.d.ts +1 -0
  22. package/lib/cjs/PDFBuilder.js +10 -11
  23. package/lib/cjs/Webform.d.ts +2 -2
  24. package/lib/cjs/Webform.js +10 -10
  25. package/lib/cjs/WebformBuilder.d.ts +1 -1
  26. package/lib/cjs/WebformBuilder.js +45 -21
  27. package/lib/cjs/Wizard.d.ts +1 -2
  28. package/lib/cjs/Wizard.js +18 -24
  29. package/lib/cjs/WizardBuilder.js +1 -1
  30. package/lib/cjs/components/Components.js +7 -1
  31. package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
  32. package/lib/cjs/components/_classes/component/Component.js +70 -64
  33. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  34. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  35. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  36. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  37. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  38. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  39. package/lib/cjs/components/_classes/input/Input.js +3 -3
  40. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  41. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  42. package/lib/cjs/components/_classes/nested/NestedComponent.js +19 -9
  43. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  44. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  45. package/lib/cjs/components/address/Address.js +2 -2
  46. package/lib/cjs/components/alert/Alert.js +1 -1
  47. package/lib/cjs/components/button/Button.js +1 -1
  48. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  49. package/lib/cjs/components/container/Container.js +1 -1
  50. package/lib/cjs/components/currency/Currency.js +1 -1
  51. package/lib/cjs/components/datagrid/DataGrid.js +5 -1
  52. package/lib/cjs/components/datamap/DataMap.js +7 -2
  53. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  54. package/lib/cjs/components/datetime/DateTime.js +15 -13
  55. package/lib/cjs/components/day/Day.js +2 -2
  56. package/lib/cjs/components/editgrid/EditGrid.d.ts +0 -1
  57. package/lib/cjs/components/editgrid/EditGrid.js +1 -9
  58. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  59. package/lib/cjs/components/fieldset/Fieldset.js +1 -0
  60. package/lib/cjs/components/file/File.js +1 -1
  61. package/lib/cjs/components/form/Form.js +14 -2
  62. package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
  63. package/lib/cjs/components/number/Number.js +1 -1
  64. package/lib/cjs/components/panel/Panel.js +1 -1
  65. package/lib/cjs/components/radio/Radio.d.ts +9 -0
  66. package/lib/cjs/components/radio/Radio.js +20 -10
  67. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  68. package/lib/cjs/components/select/Select.js +7 -3
  69. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  70. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  71. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  72. package/lib/cjs/components/signature/Signature.js +1 -1
  73. package/lib/cjs/components/survey/Survey.js +1 -1
  74. package/lib/cjs/components/tags/Tags.js +1 -1
  75. package/lib/cjs/components/textarea/TextArea.js +9 -4
  76. package/lib/cjs/components/textfield/TextField.js +13 -31
  77. package/lib/cjs/components/time/Time.js +1 -1
  78. package/lib/cjs/formio.form.js +5 -5
  79. package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
  80. package/lib/cjs/providers/storage/url.js +7 -3
  81. package/lib/cjs/translations/en.d.ts +1 -232
  82. package/lib/cjs/translations/en.js +4 -2
  83. package/lib/cjs/utils/Evaluator.d.ts +20 -6
  84. package/lib/cjs/utils/Evaluator.js +38 -15
  85. package/lib/cjs/utils/builder.js +5 -5
  86. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  87. package/lib/cjs/utils/formUtils.d.ts +2 -2
  88. package/lib/cjs/utils/index.d.ts +169 -2
  89. package/lib/cjs/utils/index.js +22 -2
  90. package/lib/cjs/utils/utils.d.ts +22 -37
  91. package/lib/cjs/utils/utils.js +63 -138
  92. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
  93. package/lib/cjs/widgets/CalendarWidget.js +17 -43
  94. package/lib/mjs/Element.d.ts +2 -1
  95. package/lib/mjs/Element.js +11 -9
  96. package/lib/mjs/EventEmitter.js +2 -2
  97. package/lib/mjs/Form.js +1 -1
  98. package/lib/mjs/PDF.js +1 -1
  99. package/lib/mjs/PDFBuilder.d.ts +1 -0
  100. package/lib/mjs/PDFBuilder.js +9 -10
  101. package/lib/mjs/Webform.d.ts +2 -2
  102. package/lib/mjs/Webform.js +8 -8
  103. package/lib/mjs/WebformBuilder.d.ts +1 -1
  104. package/lib/mjs/WebformBuilder.js +36 -13
  105. package/lib/mjs/Wizard.d.ts +1 -2
  106. package/lib/mjs/Wizard.js +17 -23
  107. package/lib/mjs/WizardBuilder.js +1 -1
  108. package/lib/mjs/components/Components.js +7 -1
  109. package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
  110. package/lib/mjs/components/_classes/component/Component.js +42 -13
  111. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  112. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  113. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  114. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  115. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  116. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  117. package/lib/mjs/components/_classes/input/Input.js +3 -3
  118. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  119. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  120. package/lib/mjs/components/_classes/nested/NestedComponent.js +19 -9
  121. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  122. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  123. package/lib/mjs/components/address/Address.js +2 -2
  124. package/lib/mjs/components/alert/Alert.js +1 -1
  125. package/lib/mjs/components/button/Button.js +1 -1
  126. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  127. package/lib/mjs/components/container/Container.js +1 -1
  128. package/lib/mjs/components/currency/Currency.js +1 -1
  129. package/lib/mjs/components/datagrid/DataGrid.js +5 -1
  130. package/lib/mjs/components/datamap/DataMap.js +7 -2
  131. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  132. package/lib/mjs/components/datetime/DateTime.js +15 -13
  133. package/lib/mjs/components/day/Day.js +2 -2
  134. package/lib/mjs/components/editgrid/EditGrid.d.ts +0 -1
  135. package/lib/mjs/components/editgrid/EditGrid.js +1 -9
  136. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  137. package/lib/mjs/components/fieldset/Fieldset.js +1 -0
  138. package/lib/mjs/components/file/File.js +1 -1
  139. package/lib/mjs/components/form/Form.js +13 -2
  140. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
  141. package/lib/mjs/components/number/Number.js +1 -1
  142. package/lib/mjs/components/panel/Panel.js +1 -1
  143. package/lib/mjs/components/radio/Radio.d.ts +9 -0
  144. package/lib/mjs/components/radio/Radio.js +20 -10
  145. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  146. package/lib/mjs/components/select/Select.js +7 -3
  147. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  148. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  149. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  150. package/lib/mjs/components/signature/Signature.js +1 -1
  151. package/lib/mjs/components/survey/Survey.js +1 -1
  152. package/lib/mjs/components/tags/Tags.js +1 -1
  153. package/lib/mjs/components/textarea/TextArea.js +9 -4
  154. package/lib/mjs/components/textfield/TextField.js +7 -2
  155. package/lib/mjs/components/time/Time.js +1 -1
  156. package/lib/mjs/formio.form.js +3 -3
  157. package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
  158. package/lib/mjs/providers/storage/url.js +7 -3
  159. package/lib/mjs/translations/en.d.ts +1 -232
  160. package/lib/mjs/translations/en.js +8 -47
  161. package/lib/mjs/utils/Evaluator.d.ts +20 -6
  162. package/lib/mjs/utils/Evaluator.js +31 -13
  163. package/lib/mjs/utils/builder.js +1 -1
  164. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  165. package/lib/mjs/utils/formUtils.d.ts +2 -2
  166. package/lib/mjs/utils/index.d.ts +169 -2
  167. package/lib/mjs/utils/index.js +18 -1
  168. package/lib/mjs/utils/utils.d.ts +22 -37
  169. package/lib/mjs/utils/utils.js +57 -113
  170. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
  171. package/lib/mjs/widgets/CalendarWidget.js +17 -43
  172. package/package.json +5 -3
  173. package/lib/cjs/i18n.d.ts +0 -13
  174. package/lib/cjs/i18n.js +0 -19
  175. package/lib/cjs/utils/i18n.d.ts +0 -19
  176. package/lib/cjs/utils/i18n.js +0 -120
  177. package/lib/mjs/i18n.d.ts +0 -13
  178. package/lib/mjs/i18n.js +0 -14
  179. package/lib/mjs/utils/i18n.d.ts +0 -19
  180. package/lib/mjs/utils/i18n.js +0 -112
@@ -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/utils");
10
+ const utils_1 = require("./utils");
11
11
  class WizardBuilder extends WebformBuilder_1.default {
12
12
  constructor() {
13
13
  let element, options;
@@ -57,7 +57,7 @@ class Components {
57
57
  // eslint-disable-next-line new-cap
58
58
  comp = new Components.components['datagrid'](component, options, data);
59
59
  }
60
- else if (component.tree) {
60
+ else if (component.tree || (component.input && Array.isArray(component.components))) {
61
61
  // eslint-disable-next-line new-cap
62
62
  comp = new Components.components['nesteddata'](component, options, data);
63
63
  }
@@ -75,6 +75,12 @@ class Components {
75
75
  if (comp.path) {
76
76
  comp.componentsMap[comp.path] = comp;
77
77
  }
78
+ // Reset the componentMatches on the root element if any new component is created.
79
+ let parent = comp.parent;
80
+ while (parent) {
81
+ parent.componentMatches = {};
82
+ parent = parent.parent;
83
+ }
78
84
  return comp;
79
85
  }
80
86
  }
@@ -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 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
@@ -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, utils_1.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
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 = 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 }));
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, 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));
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 FormioUtils.sanitize(dirty, {
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, utils_1.currentTimezone)();
1127
+ return (0, utils_2.currentTimezone)();
1152
1128
  }
1153
1129
  /**
1154
1130
  *
@@ -1194,15 +1170,21 @@ class Component extends Element_1.default {
1194
1170
  * @returns {string} - The modal preview template.
1195
1171
  */
1196
1172
  getModalPreviewTemplate() {
1197
- var _a;
1173
+ var _a, _b;
1198
1174
  const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
1199
1175
  let modalLabel;
1200
1176
  if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
1201
1177
  modalLabel = { className: 'field-required' };
1202
1178
  }
1179
+ let messages = '';
1180
+ if ((_b = this.errors) === null || _b === void 0 ? void 0 : _b.length) {
1181
+ messages = this.errors.map((err) => {
1182
+ return err.level === 'error' ? this.renderTemplate('message', Object.assign({}, err)) : '';
1183
+ }).join('');
1184
+ }
1203
1185
  return this.renderModalPreview({
1204
1186
  previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
1205
- messages: '',
1187
+ messages,
1206
1188
  labelInfo: modalLabel,
1207
1189
  });
1208
1190
  }
@@ -1453,7 +1435,7 @@ class Component extends Element_1.default {
1453
1435
  else {
1454
1436
  this.refreshOnChanged = true;
1455
1437
  }
1456
- this.refreshOnValue = (0, utils_1.fastCloneDeep)(value);
1438
+ this.refreshOnValue = (0, utils_2.fastCloneDeep)(value);
1457
1439
  if (this.refreshOnChanged) {
1458
1440
  if (this.component.clearOnRefresh) {
1459
1441
  this.setValue(null);
@@ -1695,7 +1677,7 @@ class Component extends Element_1.default {
1695
1677
  if (this.component.customClass) {
1696
1678
  className += this.component.customClass;
1697
1679
  }
1698
- if (this.hasInput && this.component.validate && (0, utils_1.boolValue)(this.component.validate.required)) {
1680
+ if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required)) {
1699
1681
  className += ' required';
1700
1682
  }
1701
1683
  if (this.labelIsHidden()) {
@@ -1983,7 +1965,7 @@ class Component extends Element_1.default {
1983
1965
  if (this._hasCondition !== null) {
1984
1966
  return this._hasCondition;
1985
1967
  }
1986
- this._hasCondition = FormioUtils.hasCondition(this.component);
1968
+ this._hasCondition = utils_1.default.hasCondition(this.component);
1987
1969
  return this._hasCondition;
1988
1970
  }
1989
1971
  /**
@@ -2010,7 +1992,7 @@ class Component extends Element_1.default {
2010
1992
  * @returns {boolean} - True if the condition applies to this component.
2011
1993
  */
2012
1994
  checkCondition(row, data) {
2013
- return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
1995
+ return utils_1.default.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
2014
1996
  }
2015
1997
  /**
2016
1998
  * Check for conditionals and hide/show the element based on those conditions.
@@ -2066,9 +2048,9 @@ class Component extends Element_1.default {
2066
2048
  if (logics.length === 0) {
2067
2049
  return;
2068
2050
  }
2069
- const newComponent = (0, utils_1.fastCloneDeep)(this.originalComponent);
2051
+ const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
2070
2052
  let changed = logics.reduce((changed, logic) => {
2071
- const result = FormioUtils.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
2053
+ const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
2072
2054
  return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
2073
2055
  }, false);
2074
2056
  // If component definition changed, replace and mark as changed.
@@ -2135,7 +2117,7 @@ class Component extends Element_1.default {
2135
2117
  return actions.reduce((changed, action) => {
2136
2118
  switch (action.type) {
2137
2119
  case 'property': {
2138
- FormioUtils.setActionProperty(newComponent, action, result, row, data, this);
2120
+ utils_1.default.setActionProperty(newComponent, action, result, row, data, this);
2139
2121
  const property = action.property.value;
2140
2122
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2141
2123
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
@@ -2399,12 +2381,14 @@ class Component extends Element_1.default {
2399
2381
  ckeditor: {
2400
2382
  image: {
2401
2383
  toolbar: [
2384
+ 'toggleImageCaption',
2402
2385
  'imageTextAlternative',
2403
2386
  '|',
2404
- 'imageStyle:full',
2405
- 'imageStyle:alignLeft',
2406
- 'imageStyle:alignCenter',
2407
- 'imageStyle:alignRight'
2387
+ 'imageStyle:inline',
2388
+ 'imageStyle:wrapText',
2389
+ 'imageStyle:breakText',
2390
+ '|',
2391
+ 'resizeImage'
2408
2392
  ],
2409
2393
  styles: [
2410
2394
  'full',
@@ -2426,7 +2410,10 @@ class Component extends Element_1.default {
2426
2410
  if (this.component.isUploadEnabled) {
2427
2411
  settings.extraPlugins.push((0, uploadAdapter_1.getFormioUploadAdapterPlugin)(this.fileService, this));
2428
2412
  }
2429
- return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.js`), true)
2413
+ Formio_1.Formio.requireLibrary(`ckeditor-css`, isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', [
2414
+ { type: 'styles', src: `${Formio_1.Formio.cdn.ckeditor}/ckeditor.css` }
2415
+ ], true);
2416
+ return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.umd.js`), true)
2430
2417
  .then(() => {
2431
2418
  if (!element.parentNode) {
2432
2419
  return Promise.reject();
@@ -2609,6 +2596,17 @@ class Component extends Element_1.default {
2609
2596
  noUpdateEvent: true,
2610
2597
  noDefault: true
2611
2598
  });
2599
+ if (utils_1.default.isLayoutComponent(this.component) && this.component.clearOnHide === true && !this.hasValue()) {
2600
+ utils_1.default.eachComponent(this.components, (component) => {
2601
+ if (component.component.clearOnHide !== false) {
2602
+ component.setValue(null, {
2603
+ noUpdateEvent: true,
2604
+ noDefault: true
2605
+ });
2606
+ component.unset();
2607
+ }
2608
+ });
2609
+ }
2612
2610
  this.unset();
2613
2611
  }
2614
2612
  getCustomDefaultValue(defaultValue) {
@@ -2648,7 +2646,7 @@ class Component extends Element_1.default {
2648
2646
  if (this.component.type !== 'textfield') {
2649
2647
  const placeholderChar = this.placeholderChar;
2650
2648
  value = (0, vanilla_text_mask_1.conformToMask)(value, this.defaultMask, { placeholderChar }).conformedValue;
2651
- if (!FormioUtils.matchInputMask(value, this.defaultMask)) {
2649
+ if (!utils_1.default.matchInputMask(value, this.defaultMask)) {
2652
2650
  value = '';
2653
2651
  }
2654
2652
  }
@@ -2714,13 +2712,16 @@ class Component extends Element_1.default {
2714
2712
  }
2715
2713
  const isArray = Array.isArray(value);
2716
2714
  const valueInput = this.refs.fileLink || this.refs.input;
2715
+ const isFilelink = !!this.refs.fileLink;
2717
2716
  if (isArray &&
2718
2717
  Array.isArray(this.defaultValue) &&
2719
2718
  this.refs.hasOwnProperty('input') &&
2720
2719
  valueInput &&
2721
2720
  (valueInput.length !== value.length) &&
2722
2721
  this.visible) {
2723
- this.redraw();
2722
+ if (isFilelink || valueInput.length) {
2723
+ this.redraw();
2724
+ }
2724
2725
  }
2725
2726
  if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
2726
2727
  this.redraw();
@@ -2731,6 +2732,11 @@ class Component extends Element_1.default {
2731
2732
  this.setValueAt(i, isArray && !this.isSingleInputValue() ? value[i] : value, flags);
2732
2733
  }
2733
2734
  }
2735
+ // Also reset value of the modal component, otherwise it will keep the old value locally and the preview
2736
+ // element won't refresh
2737
+ if (this.componentModal && flags && flags.resetValue) {
2738
+ this.componentModal.setValue(value);
2739
+ }
2734
2740
  return changed;
2735
2741
  }
2736
2742
  /**
@@ -2966,7 +2972,7 @@ class Component extends Element_1.default {
2966
2972
  }
2967
2973
  if (fromSubmission) {
2968
2974
  // 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, utils_1.fastCloneDeep)(calculatedValue);
2975
+ this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
2970
2976
  return false;
2971
2977
  }
2972
2978
  // If this is the firstPass, and the dataValue is different than to the calculatedValue.
@@ -2975,7 +2981,7 @@ class Component extends Element_1.default {
2975
2981
  return true;
2976
2982
  }
2977
2983
  }
2978
- this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
2984
+ this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
2979
2985
  if (changed) {
2980
2986
  if (!flags.noPristineChangeOnModified && this.root.initialized) {
2981
2987
  this.pristine = false;
@@ -3036,7 +3042,7 @@ class Component extends Element_1.default {
3036
3042
  var _a;
3037
3043
  const { local } = options;
3038
3044
  if (!row) {
3039
- row = (0, utils_1.getContextualRowData)(this.component, data, this.paths);
3045
+ row = (0, utils_2.getContextualRowData)(this.component, data, this.paths);
3040
3046
  }
3041
3047
  if (!ignoreCondition && !this.checkCondition(row, data)) {
3042
3048
  return '';
@@ -3065,7 +3071,7 @@ class Component extends Element_1.default {
3065
3071
  ]
3066
3072
  });
3067
3073
  const errors = validationScope.errors;
3068
- const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
3074
+ const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
3069
3075
  return lodash_1.default.map(interpolatedErrors, 'message').join('\n\n');
3070
3076
  }
3071
3077
  /**
@@ -3096,7 +3102,7 @@ class Component extends Element_1.default {
3096
3102
  */
3097
3103
  interpolateErrors(errors) {
3098
3104
  var _a;
3099
- const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
3105
+ const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
3100
3106
  return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length) ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
3101
3107
  }
3102
3108
  /**
@@ -3231,6 +3237,9 @@ class Component extends Element_1.default {
3231
3237
  data = data || this.rootValue;
3232
3238
  flags = flags || {};
3233
3239
  row = row || this.data;
3240
+ if (flags.noCheck) {
3241
+ return true;
3242
+ }
3234
3243
  // Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
3235
3244
  // as setValue. Historically, this was bypassed by a series of cached states around the data model
3236
3245
  // which caused its own problems. We need to ensure that premium and custom components do not fall into
@@ -3245,9 +3254,6 @@ class Component extends Element_1.default {
3245
3254
  if (!flags.fromBlur) {
3246
3255
  this.checkRefreshOn(flags.changes, flags);
3247
3256
  }
3248
- if (flags.noCheck) {
3249
- return true;
3250
- }
3251
3257
  this.checkComponentConditions(data, flags, row);
3252
3258
  if (this.id !== flags.triggeredComponentId) {
3253
3259
  this.calculateComponentValue(data, flags, row);
@@ -3316,7 +3322,7 @@ class Component extends Element_1.default {
3316
3322
  }
3317
3323
  });
3318
3324
  this.addEventListener(element, 'blur', () => {
3319
- this.root.pendingBlur = FormioUtils.delay(() => {
3325
+ this.root.pendingBlur = utils_1.default.delay(() => {
3320
3326
  this.emit('blur', this);
3321
3327
  if (this.component.validateOn === 'blur') {
3322
3328
  this.root.triggerChange({ fromBlur: true }, {
@@ -3564,7 +3570,7 @@ class Component extends Element_1.default {
3564
3570
  if (logic.trigger.type === 'event') {
3565
3571
  const event = this.interpolate(logic.trigger.event);
3566
3572
  this.on(event, (...args) => {
3567
- const newComponent = (0, utils_1.fastCloneDeep)(this.originalComponent);
3573
+ const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
3568
3574
  if (this.applyActions(newComponent, logic.actions, args)) {
3569
3575
  // If component definition changed, replace it.
3570
3576
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
@@ -3699,7 +3705,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3699
3705
  }.bind(Component.externalLibraries[name]);
3700
3706
  }
3701
3707
  // See if the plugin already exists.
3702
- const plugin = (0, utils_1.getScriptPlugin)(property);
3708
+ const plugin = (0, utils_2.getScriptPlugin)(property);
3703
3709
  if (plugin) {
3704
3710
  Component.externalLibraries[name].resolve(plugin);
3705
3711
  }
@@ -3742,7 +3748,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3742
3748
  // if no callback is provided, then check periodically for the script.
3743
3749
  if (polling) {
3744
3750
  setTimeout(function checkLibrary() {
3745
- const plugin = (0, utils_1.getScriptPlugin)(property);
3751
+ const plugin = (0, utils_2.getScriptPlugin)(property);
3746
3752
  if (plugin) {
3747
3753
  Component.externalLibraries[name].resolve(plugin);
3748
3754
  }
@@ -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
  {
@@ -82,6 +82,7 @@ declare const _default: ({
82
82
  inline?: undefined;
83
83
  defaultValue?: undefined;
84
84
  values?: undefined;
85
+ customConditional?: undefined;
85
86
  logic?: undefined;
86
87
  dataSrc?: undefined;
87
88
  valueProperty?: undefined;
@@ -101,6 +102,7 @@ declare const _default: ({
101
102
  inline?: undefined;
102
103
  defaultValue?: undefined;
103
104
  values?: undefined;
105
+ customConditional?: undefined;
104
106
  logic?: undefined;
105
107
  dataSrc?: undefined;
106
108
  valueProperty?: undefined;
@@ -126,6 +128,7 @@ declare const _default: ({
126
128
  value: string;
127
129
  })[];
128
130
  placeholder?: undefined;
131
+ customConditional?: undefined;
129
132
  logic?: undefined;
130
133
  dataSrc?: undefined;
131
134
  valueProperty?: undefined;
@@ -141,6 +144,7 @@ declare const _default: ({
141
144
  tooltip: string;
142
145
  key: string;
143
146
  input: boolean;
147
+ customConditional: string;
144
148
  logic: ({
145
149
  name: string;
146
150
  trigger: {
@@ -211,6 +215,7 @@ declare const _default: ({
211
215
  inline?: undefined;
212
216
  defaultValue?: undefined;
213
217
  values?: undefined;
218
+ customConditional?: undefined;
214
219
  logic?: undefined;
215
220
  as?: undefined;
216
221
  editor?: undefined;
@@ -226,6 +231,7 @@ declare const _default: ({
226
231
  placeholder?: undefined;
227
232
  inline?: undefined;
228
233
  values?: undefined;
234
+ customConditional?: undefined;
229
235
  logic?: undefined;
230
236
  dataSrc?: undefined;
231
237
  valueProperty?: undefined;
@@ -248,6 +254,7 @@ declare const _default: ({
248
254
  placeholder?: undefined;
249
255
  inline?: undefined;
250
256
  values?: undefined;
257
+ customConditional?: undefined;
251
258
  logic?: undefined;
252
259
  dataSrc?: undefined;
253
260
  valueProperty?: undefined;
@@ -61,6 +61,7 @@ exports.default = [
61
61
  tooltip: 'Encrypt this field on the server. This is two way encryption which is not suitable for passwords.',
62
62
  key: 'encrypted',
63
63
  input: true,
64
+ customConditional: 'show = data.encrypted;',
64
65
  logic: [
65
66
  {
66
67
  name: 'disabled',
@@ -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);
@@ -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: any): void;
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/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/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({
@@ -108,6 +108,7 @@ export default class NestedComponent extends Field {
108
108
  * @returns {any} - The component that is located.
109
109
  */
110
110
  getComponent(path: string): any;
111
+ componentMatches: {} | undefined;
111
112
  /**
112
113
  * Return a component provided the Id of the component.
113
114
  * @param {string} id - The Id of the component.