@formio/js 5.0.0-dev.5703.20a26ed → 5.0.0-dev.5704.50db01f

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 (183) hide show
  1. package/Changelog.md +36 -0
  2. package/dist/formio.embed.js +1 -1
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.form.js +55 -35
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +2 -0
  7. package/dist/formio.full.js +61 -41
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +2 -0
  10. package/dist/formio.js +1 -1
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.utils.js +25 -5
  13. package/dist/formio.utils.min.js +1 -1
  14. package/dist/formio.utils.min.js.LICENSE.txt +2 -0
  15. package/lib/cjs/CDN.js +1 -2
  16. package/lib/cjs/Form.d.ts +2 -2
  17. package/lib/cjs/Form.js +11 -5
  18. package/lib/cjs/PDF.js +1 -1
  19. package/lib/cjs/PDFBuilder.js +2 -1
  20. package/lib/cjs/Webform.js +6 -4
  21. package/lib/cjs/WebformBuilder.js +13 -3
  22. package/lib/cjs/Wizard.js +1 -1
  23. package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
  24. package/lib/cjs/components/_classes/component/Component.js +7 -6
  25. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  26. package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
  27. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  28. package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
  29. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
  30. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +56 -29
  31. package/lib/cjs/components/address/Address.d.ts +6 -0
  32. package/lib/cjs/components/address/Address.js +7 -1
  33. package/lib/cjs/components/currency/Currency.d.ts +2 -0
  34. package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
  35. package/lib/cjs/components/datagrid/DataGrid.js +2 -9
  36. package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  37. package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
  38. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  39. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  40. package/lib/cjs/components/datamap/DataMap.js +1 -1
  41. package/lib/cjs/components/day/Day.d.ts +3 -4
  42. package/lib/cjs/components/day/Day.js +31 -10
  43. package/lib/cjs/components/editgrid/EditGrid.js +2 -5
  44. package/lib/cjs/components/editgrid/fixtures/comp17.d.ts +80 -0
  45. package/lib/cjs/components/editgrid/fixtures/comp17.js +99 -0
  46. package/lib/cjs/components/editgrid/fixtures/index.d.ts +8 -7
  47. package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
  48. package/lib/cjs/components/file/File.d.ts +2 -2
  49. package/lib/cjs/components/file/File.js +13 -2
  50. package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
  51. package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
  52. package/lib/cjs/components/form/fixtures/index.d.ts +2 -1
  53. package/lib/cjs/components/form/fixtures/index.js +3 -1
  54. package/lib/cjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  55. package/lib/cjs/components/form/fixtures/nestedWizardForm.js +765 -0
  56. package/lib/cjs/components/number/Number.d.ts +17 -2
  57. package/lib/cjs/components/number/Number.js +26 -6
  58. package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
  59. package/lib/cjs/components/number/fixtures/comp10.js +21 -0
  60. package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
  61. package/lib/cjs/components/number/fixtures/comp9.js +21 -0
  62. package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
  63. package/lib/cjs/components/number/fixtures/index.js +5 -1
  64. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  65. package/lib/cjs/components/panel/Panel.js +1 -0
  66. package/lib/cjs/components/radio/Radio.d.ts +2 -18
  67. package/lib/cjs/components/radio/Radio.js +29 -27
  68. package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
  69. package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
  70. package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
  71. package/lib/cjs/components/radio/fixtures/index.js +3 -1
  72. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  73. package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
  74. package/lib/cjs/components/select/Select.d.ts +38 -0
  75. package/lib/cjs/components/select/Select.js +13 -3
  76. package/lib/cjs/components/select/fixtures/comp25.d.ts +59 -0
  77. package/lib/cjs/components/select/fixtures/comp25.js +66 -0
  78. package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
  79. package/lib/cjs/components/select/fixtures/comp26.js +59 -0
  80. package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
  81. package/lib/cjs/components/select/fixtures/index.js +5 -1
  82. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  83. package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
  84. package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  85. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
  86. package/lib/cjs/components/tags/Tags.js +3 -3
  87. package/lib/cjs/components/time/Time.d.ts +2 -2
  88. package/lib/cjs/components/time/Time.form.js +2 -2
  89. package/lib/cjs/components/time/Time.js +3 -7
  90. package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
  91. package/lib/cjs/components/time/fixtures/comp4.js +171 -0
  92. package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
  93. package/lib/cjs/components/time/fixtures/index.js +3 -1
  94. package/lib/cjs/templates/Templates.js +1 -1
  95. package/lib/cjs/translations/en.d.ts +1 -0
  96. package/lib/cjs/translations/en.js +1 -0
  97. package/lib/cjs/utils/utils.d.ts +9 -1
  98. package/lib/cjs/utils/utils.js +14 -13
  99. package/lib/mjs/CDN.js +1 -2
  100. package/lib/mjs/Form.d.ts +2 -2
  101. package/lib/mjs/Form.js +11 -5
  102. package/lib/mjs/PDF.js +1 -1
  103. package/lib/mjs/PDFBuilder.js +1 -1
  104. package/lib/mjs/Webform.js +10 -4
  105. package/lib/mjs/WebformBuilder.js +12 -3
  106. package/lib/mjs/Wizard.js +1 -1
  107. package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
  108. package/lib/mjs/components/_classes/component/Component.js +4 -3
  109. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  110. package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
  111. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  112. package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
  113. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
  114. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +57 -29
  115. package/lib/mjs/components/address/Address.d.ts +6 -0
  116. package/lib/mjs/components/address/Address.js +10 -1
  117. package/lib/mjs/components/currency/Currency.d.ts +2 -0
  118. package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
  119. package/lib/mjs/components/datagrid/DataGrid.js +2 -9
  120. package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  121. package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
  122. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  123. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  124. package/lib/mjs/components/datamap/DataMap.js +1 -1
  125. package/lib/mjs/components/day/Day.d.ts +3 -4
  126. package/lib/mjs/components/day/Day.js +30 -10
  127. package/lib/mjs/components/editgrid/EditGrid.js +2 -5
  128. package/lib/mjs/components/editgrid/fixtures/comp17.d.ts +80 -0
  129. package/lib/mjs/components/editgrid/fixtures/comp17.js +97 -0
  130. package/lib/mjs/components/editgrid/fixtures/index.d.ts +8 -7
  131. package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
  132. package/lib/mjs/components/file/File.d.ts +2 -2
  133. package/lib/mjs/components/file/File.js +13 -2
  134. package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
  135. package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
  136. package/lib/mjs/components/form/fixtures/index.d.ts +2 -1
  137. package/lib/mjs/components/form/fixtures/index.js +2 -1
  138. package/lib/mjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  139. package/lib/mjs/components/form/fixtures/nestedWizardForm.js +763 -0
  140. package/lib/mjs/components/number/Number.d.ts +17 -2
  141. package/lib/mjs/components/number/Number.js +25 -5
  142. package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
  143. package/lib/mjs/components/number/fixtures/comp10.js +19 -0
  144. package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
  145. package/lib/mjs/components/number/fixtures/comp9.js +19 -0
  146. package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
  147. package/lib/mjs/components/number/fixtures/index.js +3 -1
  148. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  149. package/lib/mjs/components/panel/Panel.js +1 -0
  150. package/lib/mjs/components/radio/Radio.d.ts +2 -18
  151. package/lib/mjs/components/radio/Radio.js +32 -30
  152. package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
  153. package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
  154. package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
  155. package/lib/mjs/components/radio/fixtures/index.js +2 -1
  156. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  157. package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
  158. package/lib/mjs/components/select/Select.d.ts +38 -0
  159. package/lib/mjs/components/select/Select.js +16 -4
  160. package/lib/mjs/components/select/fixtures/comp25.d.ts +59 -0
  161. package/lib/mjs/components/select/fixtures/comp25.js +64 -0
  162. package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
  163. package/lib/mjs/components/select/fixtures/comp26.js +57 -0
  164. package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
  165. package/lib/mjs/components/select/fixtures/index.js +3 -1
  166. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  167. package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
  168. package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  169. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
  170. package/lib/mjs/components/tags/Tags.js +3 -3
  171. package/lib/mjs/components/time/Time.d.ts +2 -2
  172. package/lib/mjs/components/time/Time.form.js +2 -2
  173. package/lib/mjs/components/time/Time.js +3 -13
  174. package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
  175. package/lib/mjs/components/time/fixtures/comp4.js +169 -0
  176. package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
  177. package/lib/mjs/components/time/fixtures/index.js +2 -1
  178. package/lib/mjs/templates/Templates.js +1 -1
  179. package/lib/mjs/translations/en.d.ts +1 -0
  180. package/lib/mjs/translations/en.js +1 -0
  181. package/lib/mjs/utils/utils.d.ts +9 -1
  182. package/lib/mjs/utils/utils.js +14 -2
  183. package/package.json +4 -4
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ "type": "form",
5
+ "display": "wizard",
6
+ "components": [
7
+ {
8
+ "title": "Page 1",
9
+ "breadcrumbClickable": true,
10
+ "buttonSettings": {
11
+ "previous": true,
12
+ "cancel": true,
13
+ "next": true
14
+ },
15
+ "navigateOnEnter": false,
16
+ "saveOnEnter": false,
17
+ "scrollToTop": false,
18
+ "collapsible": false,
19
+ "key": "page1",
20
+ "type": "panel",
21
+ "label": "Page 1",
22
+ "components": [
23
+ {
24
+ "label": "Time",
25
+ "disabled": true,
26
+ "alwaysEnabled": false,
27
+ "tableView": true,
28
+ "defaultValue": "03:03 PM",
29
+ "key": "time1",
30
+ "type": "time",
31
+ "input": true,
32
+ "inputMask": "99:99",
33
+ "hideOnChildrenHidden": false,
34
+ "id": "efw9yyq",
35
+ "placeholder": "",
36
+ "prefix": "",
37
+ "customClass": "",
38
+ "suffix": "",
39
+ "multiple": false,
40
+ "protected": false,
41
+ "unique": false,
42
+ "persistent": true,
43
+ "hidden": false,
44
+ "clearOnHide": true,
45
+ "refreshOn": "",
46
+ "redrawOn": "",
47
+ "modalEdit": false,
48
+ "dataGridLabel": false,
49
+ "labelPosition": "top",
50
+ "description": "",
51
+ "errorLabel": "",
52
+ "tooltip": "",
53
+ "hideLabel": false,
54
+ "tabindex": "",
55
+ "autofocus": false,
56
+ "dbIndex": false,
57
+ "customDefaultValue": "",
58
+ "calculateValue": "",
59
+ "calculateServer": false,
60
+ "widget": {
61
+ "type": "input"
62
+ },
63
+ "attributes": {},
64
+ "validateOn": "change",
65
+ "validate": {
66
+ "required": false,
67
+ "custom": "",
68
+ "customPrivate": false,
69
+ "strictDateValidation": false,
70
+ "multiple": false,
71
+ "unique": false,
72
+ "minLength": "",
73
+ "maxLength": "",
74
+ "pattern": ""
75
+ },
76
+ "conditional": {
77
+ "show": null,
78
+ "when": null,
79
+ "eq": ""
80
+ },
81
+ "overlay": {
82
+ "style": "",
83
+ "left": "",
84
+ "top": "",
85
+ "width": "",
86
+ "height": ""
87
+ },
88
+ "allowCalculateOverride": false,
89
+ "encrypted": false,
90
+ "showCharCount": false,
91
+ "showWordCount": false,
92
+ "properties": {},
93
+ "allowMultipleMasks": false,
94
+ "addons": [],
95
+ "mask": false,
96
+ "inputType": "time",
97
+ "inputFormat": "plain",
98
+ "displayMask": "",
99
+ "spellcheck": true,
100
+ "truncateMultipleSpaces": false,
101
+ "format": "HH:mm",
102
+ "dataFormat": "HH:mm:ss"
103
+ }
104
+ ],
105
+ "input": false,
106
+ "tableView": false,
107
+ "id": "e7vej1d",
108
+ "placeholder": "",
109
+ "prefix": "",
110
+ "customClass": "",
111
+ "suffix": "",
112
+ "multiple": false,
113
+ "defaultValue": null,
114
+ "protected": false,
115
+ "unique": false,
116
+ "persistent": false,
117
+ "hidden": false,
118
+ "clearOnHide": false,
119
+ "refreshOn": "",
120
+ "redrawOn": "",
121
+ "modalEdit": false,
122
+ "dataGridLabel": false,
123
+ "labelPosition": "top",
124
+ "description": "",
125
+ "errorLabel": "",
126
+ "tooltip": "",
127
+ "hideLabel": false,
128
+ "tabindex": "",
129
+ "disabled": false,
130
+ "autofocus": false,
131
+ "dbIndex": false,
132
+ "customDefaultValue": "",
133
+ "calculateValue": "",
134
+ "calculateServer": false,
135
+ "widget": null,
136
+ "attributes": {},
137
+ "validateOn": "change",
138
+ "validate": {
139
+ "required": false,
140
+ "custom": "",
141
+ "customPrivate": false,
142
+ "strictDateValidation": false,
143
+ "multiple": false,
144
+ "unique": false
145
+ },
146
+ "conditional": {
147
+ "show": null,
148
+ "when": null,
149
+ "eq": ""
150
+ },
151
+ "overlay": {
152
+ "style": "",
153
+ "left": "",
154
+ "top": "",
155
+ "width": "",
156
+ "height": ""
157
+ },
158
+ "allowCalculateOverride": false,
159
+ "encrypted": false,
160
+ "showCharCount": false,
161
+ "showWordCount": false,
162
+ "properties": {},
163
+ "allowMultipleMasks": false,
164
+ "addons": [],
165
+ "tree": false,
166
+ "lazyLoad": false,
167
+ "theme": "default",
168
+ "breadcrumb": "default"
169
+ }
170
+ ],
171
+ };
@@ -1,6 +1,7 @@
1
1
  import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
+ import comp4 from './comp4';
4
5
  import timeForm from './timeForm';
5
6
  import timeForm2 from './timeForm2';
6
- export { comp1, comp2, comp3, timeForm, timeForm2 };
7
+ export { comp1, comp2, comp3, comp4, timeForm, timeForm2 };
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.timeForm2 = exports.timeForm = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.timeForm2 = exports.timeForm = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
10
10
  exports.comp2 = comp2_1.default;
11
11
  const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
+ const comp4_1 = __importDefault(require("./comp4"));
14
+ exports.comp4 = comp4_1.default;
13
15
  const timeForm_1 = __importDefault(require("./timeForm"));
14
16
  exports.timeForm = timeForm_1.default;
15
17
  const timeForm2_1 = __importDefault(require("./timeForm2"));
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_1 = __importDefault(require("./index"));
7
7
  const experimental_1 = require("@formio/core/experimental");
8
8
  experimental_1.Template.addTemplates(index_1.default);
9
- experimental_1.Template.defaultTemplates = index_1.default.bootstrap;
9
+ experimental_1.Template.defaultTemplates = experimental_1.Template.templates.bootstrap;
10
10
  exports.default = experimental_1.Template;
@@ -75,6 +75,7 @@ declare namespace _default {
75
75
  let typeRemaining: string;
76
76
  let typeCount: string;
77
77
  let requiredDayField: string;
78
+ let requiredDayEmpty: string;
78
79
  let requiredMonthField: string;
79
80
  let requiredYearField: string;
80
81
  }
@@ -77,6 +77,7 @@ exports.default = {
77
77
  typeRemaining: '{{ remaining }} {{ type }} remaining.',
78
78
  typeCount: '{{ count }} {{ type }}',
79
79
  requiredDayField: '{{ field }} is required',
80
+ requiredDayEmpty: '{{ field }} is required',
80
81
  requiredMonthField: '{{ field }} is required',
81
82
  requiredYearField: '{{ field }} is required'
82
83
  };
@@ -56,6 +56,14 @@ export function isMongoId(text: string): boolean;
56
56
  * @param {*} rowData - The contextual row data for the component.
57
57
  */
58
58
  export function checkCalculated(component: import('@formio/core').Component, submission: import('@formio/core').Submission, rowData: any): void;
59
+ /**
60
+ *
61
+ * @param component
62
+ * @param condition
63
+ * @param row
64
+ * @param data
65
+ * @param instance
66
+ */
59
67
  export function checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
60
68
  /**
61
69
  * Returns a components normalized value.
@@ -523,4 +531,4 @@ import jsonLogic from 'json-logic-js';
523
531
  import ConditionOperators from './conditionOperators';
524
532
  import { Evaluator } from './Evaluator';
525
533
  export const interpolate: typeof Evaluator.interpolate;
526
- export { jsonLogic, ConditionOperators, Evaluator, _ };
534
+ export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
@@ -11,21 +11,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
11
  if (k2 === undefined) k2 = k;
12
12
  o[k2] = m[k];
13
13
  }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
14
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
16
  };
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
29
17
  var __importDefault = (this && this.__importDefault) || function (mod) {
30
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
31
19
  };
@@ -37,6 +25,7 @@ exports._ = lodash_1.default;
37
25
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
38
26
  exports.jsonLogic = json_logic_js_1.default;
39
27
  const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
28
+ exports.moment = moment_timezone_1.default;
40
29
  const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
41
30
  const operators_1 = require("./jsonlogic/operators");
42
31
  const dompurify_1 = __importDefault(require("dompurify"));
@@ -62,7 +51,6 @@ json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
62
51
  json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
63
52
  return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
64
53
  });
65
- exports.moment = __importStar(require("moment-timezone/moment-timezone"));
66
54
  /**
67
55
  * Sets the path to the component and parent schema.
68
56
  * @param {import('@formio/core').Component} component - The component to set the path for.
@@ -190,6 +178,11 @@ exports.checkCalculated = checkCalculated;
190
178
  * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
191
179
  * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
192
180
  */
181
+ /**
182
+ *
183
+ * @param conditionPaths
184
+ * @param data
185
+ */
193
186
  function getConditionalPathsRecursive(conditionPaths, data) {
194
187
  let currentGlobalIndex = 0;
195
188
  const conditionalPathsArray = [];
@@ -228,6 +221,14 @@ function getConditionalPathsRecursive(conditionPaths, data) {
228
221
  getConditionalPaths(data);
229
222
  return conditionalPathsArray;
230
223
  }
224
+ /**
225
+ *
226
+ * @param component
227
+ * @param condition
228
+ * @param row
229
+ * @param data
230
+ * @param instance
231
+ */
231
232
  function checkSimpleConditional(component, condition, row, data, instance) {
232
233
  if (condition.when) {
233
234
  const value = getComponentActualValue(condition.when, data, row);
package/lib/mjs/CDN.js CHANGED
@@ -63,8 +63,7 @@ class CDN {
63
63
  url += `/${lib}`;
64
64
  }
65
65
  // Only attach the version if this is the hosted cdn.
66
- if (cdnUrl.includes('form.io') &&
67
- version && version !== 'latest') {
66
+ if (cdnUrl.match(/cdn\.(test-)?form.io/) && version && version !== 'latest') {
68
67
  url += `/${version}`;
69
68
  }
70
69
  return url;
package/lib/mjs/Form.d.ts CHANGED
@@ -398,10 +398,10 @@ export default class Form extends Element {
398
398
  getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
399
  /**
400
400
  * Sets the form to the JSON schema of a form.
401
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
401
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
402
402
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
403
  */
404
- setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
404
+ setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
405
405
  _form: any;
406
406
  getSubmission(formio: any, opts: any): any;
407
407
  /**
package/lib/mjs/Form.js CHANGED
@@ -134,13 +134,13 @@ export default class Form extends Element {
134
134
  else {
135
135
  this.element = null;
136
136
  }
137
+ this.options = formOptions;
138
+ this.options.events = this.events;
137
139
  if (form) {
138
140
  this.setForm(form)
139
141
  .then(() => this.readyResolve(this.instance))
140
142
  .catch(this.readyReject);
141
143
  }
142
- this.options = formOptions;
143
- this.options.events = this.events;
144
144
  this.display = '';
145
145
  }
146
146
  createElement(tag, attrs, children) {
@@ -264,7 +264,7 @@ export default class Form extends Element {
264
264
  }
265
265
  /**
266
266
  * Sets the form to the JSON schema of a form.
267
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
267
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
268
268
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
269
269
  */
270
270
  setForm(formParam) {
@@ -291,8 +291,14 @@ export default class Form extends Element {
291
291
  }
292
292
  this.loading = false;
293
293
  this.instance = this.instance || this.create(form.display);
294
- const options = this.getFormInitOptions(formParam, form);
295
- this.instance.setUrl(formParam, options);
294
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
295
+ if (this.instance.setUrl) {
296
+ const options = this.getFormInitOptions(formParam, form);
297
+ this.instance.setUrl(formParam, options);
298
+ }
299
+ else {
300
+ this.instance.url = formParam;
301
+ }
296
302
  this.instance.nosubmit = false;
297
303
  this._form = this.instance.form = form;
298
304
  if (submission) {
package/lib/mjs/PDF.js CHANGED
@@ -65,7 +65,7 @@ export default class PDF extends Webform {
65
65
  super.destroy(all);
66
66
  }
67
67
  rebuild() {
68
- if (this.attached && this.builderMode && this.component.components) {
68
+ if (this.builderMode && this.component.components) {
69
69
  this.destroyComponents();
70
70
  this.addComponents();
71
71
  return Promise.resolve();
@@ -429,7 +429,7 @@ export default class PDFBuilder extends WebformBuilder {
429
429
  _.merge(schema, info);
430
430
  }
431
431
  // Set a unique key for this component.
432
- BuilderUtils.uniquify([this.webform._form], schema);
432
+ BuilderUtils.uniquify(this.webform._form?.components || [], schema);
433
433
  this.webform._form.components.push(schema);
434
434
  schema.overlay = {
435
435
  top: layerY ? (layerY - this.itemOffsetY + HEIGHT) : (e.clientY - iframeRect.top - (this.itemOffsetY - HEIGHT) * 2),
@@ -830,7 +830,6 @@ export default class Webform extends NestedDataComponent {
830
830
  if (!submission || !submission.data) {
831
831
  submission = {
832
832
  data: {},
833
- metadata: submission.metadata,
834
833
  };
835
834
  }
836
835
  // Metadata needs to be available before setValue
@@ -851,6 +850,9 @@ export default class Webform extends NestedDataComponent {
851
850
  return changed;
852
851
  }
853
852
  getValue() {
853
+ if (!this._submission) {
854
+ this._submission = {};
855
+ }
854
856
  if (!this._submission.data) {
855
857
  this._submission.data = {};
856
858
  }
@@ -1134,7 +1136,7 @@ export default class Webform extends NestedDataComponent {
1134
1136
  });
1135
1137
  const displayedErrors = [];
1136
1138
  if (errors.length) {
1137
- errors = _.uniqBy(errors, (error) => error.message);
1139
+ errors = _.uniqBy(errors, (error) => [error.message, error.component?.id, error.context?.path].join());
1138
1140
  const createListItem = (message, index) => {
1139
1141
  const err = errors[index];
1140
1142
  const messageFromIndex = !_.isUndefined(index) && errors && errors[index];
@@ -1248,10 +1250,14 @@ export default class Webform extends NestedDataComponent {
1248
1250
  }
1249
1251
  this.checkData(value.data, flags);
1250
1252
  const shouldValidate = !flags.noValidate ||
1251
- flags.fromIFrame ||
1253
+ flags.fromIframe ||
1252
1254
  (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
1253
1255
  const errors = shouldValidate
1254
- ? this.validate(value.data, { ...flags, process: "change" })
1256
+ ? this.validate(value.data, {
1257
+ ...flags,
1258
+ noValidate: false,
1259
+ process: 'change'
1260
+ })
1255
1261
  : [];
1256
1262
  value.isValid = errors.length === 0;
1257
1263
  this.loading = false;
@@ -187,7 +187,8 @@ export default class WebformBuilder extends Component {
187
187
  params: {
188
188
  type: 'resource',
189
189
  limit: 1000000,
190
- select: '_id,title,name,components'
190
+ select: '_id,title,name,components',
191
+ 'tags__ne': 'noBuilderResource'
191
192
  }
192
193
  };
193
194
  if (this.options && this.options.resourceTag) {
@@ -892,7 +893,11 @@ export default class WebformBuilder extends Component {
892
893
  if (form && form.properties) {
893
894
  this.options.properties = form.properties;
894
895
  }
895
- this.keyboardActionsEnabled = _.get(this.options, 'keyboardBuilder', false) || this.options.properties?.keyboardBuilder;
896
+ let keyboardActionsEnabled = _.get(this.options, 'keyboardBuilder', false) || this.options.properties?.keyboardBuilder;
897
+ if (typeof keyboardActionsEnabled === 'string') {
898
+ keyboardActionsEnabled = keyboardActionsEnabled === 'true';
899
+ }
900
+ this.keyboardActionsEnabled = keyboardActionsEnabled;
896
901
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
897
902
  && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
898
903
  // Ensure there is at least a submit button.
@@ -1044,7 +1049,10 @@ export default class WebformBuilder extends Component {
1044
1049
  'calculateValue',
1045
1050
  'conditional',
1046
1051
  'customConditional',
1047
- 'id'
1052
+ 'id',
1053
+ 'fields.day.required',
1054
+ 'fields.month.required',
1055
+ 'fields.year.required',
1048
1056
  ]));
1049
1057
  const parentComponent = defaultValueComponent.parent;
1050
1058
  let tabIndex = -1;
@@ -1231,6 +1239,7 @@ export default class WebformBuilder extends Component {
1231
1239
  helplinks: this.helplinks,
1232
1240
  }));
1233
1241
  this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
1242
+ this.updateComponent(this.editForm.submission.data ?? component);
1234
1243
  this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1235
1244
  });
1236
1245
  });
package/lib/mjs/Wizard.js CHANGED
@@ -13,7 +13,7 @@ export default class Wizard extends Webform {
13
13
  */
14
14
  constructor(elementOrOptions = undefined, _options = undefined) {
15
15
  let element, options;
16
- if (elementOrOptions instanceof HTMLElement || options) {
16
+ if (elementOrOptions instanceof HTMLElement || _options) {
17
17
  element = elementOrOptions;
18
18
  options = _options || {};
19
19
  }
@@ -1076,7 +1076,7 @@ declare class Component extends Element {
1076
1076
  elementInfo(): any;
1077
1077
  autofocus(): void;
1078
1078
  scrollIntoView(element?: any): void;
1079
- focus(index?: number): void;
1079
+ focus(index: any): void;
1080
1080
  /**
1081
1081
  * Get `Formio` instance for working with files
1082
1082
  * @returns {import('@formio/core').Formio} - The Formio instance file service.
@@ -2988,7 +2988,7 @@ export default class Component extends Element {
2988
2988
  this.parent.childErrors.push(...errors);
2989
2989
  }
2990
2990
  else {
2991
- _.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
2991
+ _.remove(this.parent.childErrors, (err) => (err?.component?.key || err?.context?.key) === this.component.key);
2992
2992
  }
2993
2993
  }
2994
2994
  this.showValidationErrors(errors, data, row, flags);
@@ -3004,7 +3004,7 @@ export default class Component extends Element {
3004
3004
  this.parent.childErrors.push(...errors);
3005
3005
  }
3006
3006
  else {
3007
- _.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
3007
+ _.remove(this.parent.childErrors, (err) => (err?.component?.key || err?.context?.key) === this.component.key);
3008
3008
  }
3009
3009
  }
3010
3010
  return errors.length === 0;
@@ -3425,10 +3425,11 @@ export default class Component extends Element {
3425
3425
  const { left, top } = element.getBoundingClientRect();
3426
3426
  window.scrollTo(left + window.scrollX, top + window.scrollY);
3427
3427
  }
3428
- focus(index = (this.refs.input.length - 1)) {
3428
+ focus(index) {
3429
3429
  if ('beforeFocus' in this.parent) {
3430
3430
  this.parent.beforeFocus(this);
3431
3431
  }
3432
+ index = index || this.refs.input?.length - 1;
3432
3433
  if (this.refs.input?.length) {
3433
3434
  const focusingInput = this.refs.input[index];
3434
3435
  if (this.component.widget?.type === 'calendar') {
@@ -1,6 +1,5 @@
1
1
  export default class Multivalue extends Field {
2
2
  get addAnother(): string;
3
- useWrapper(): any;
4
3
  /**
5
4
  * @returns {Field} - The created field.
6
5
  */
@@ -1,12 +1,40 @@
1
1
  import Field from '../field/Field';
2
2
  import _ from 'lodash';
3
3
  export default class Multivalue extends Field {
4
- get dataValue() {
5
- const parent = super.dataValue;
6
- if (!parent && this.component.multiple) {
7
- return [];
4
+ /**
5
+ * Normalize values coming into updateValue.
6
+ * @param {*} value - The value to normalize before setting.
7
+ * @returns {*} - The normalized value.
8
+ */
9
+ normalizeValue(value) {
10
+ if (this.component.multiple) {
11
+ if (Array.isArray(value)) {
12
+ if (value.length === 0) {
13
+ return [this.emptyValue];
14
+ }
15
+ if (this.component.storeas === 'array') {
16
+ return super.normalizeValue([value]);
17
+ }
18
+ return super.normalizeValue(value);
19
+ }
20
+ else {
21
+ return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
22
+ }
23
+ }
24
+ else {
25
+ if (Array.isArray(value) && this.component.storeas !== 'array') {
26
+ if (this.component.storeas === 'string') {
27
+ return super.normalizeValue(value.join(this.delimiter || ''));
28
+ }
29
+ return super.normalizeValue(value[0] || this.emptyValue);
30
+ }
31
+ else {
32
+ return super.normalizeValue(value);
33
+ }
8
34
  }
9
- return parent;
35
+ }
36
+ get dataValue() {
37
+ return super.dataValue;
10
38
  }
11
39
  set dataValue(value) {
12
40
  super.dataValue = value;
@@ -26,30 +54,20 @@ export default class Multivalue extends Field {
26
54
  get addAnother() {
27
55
  return this.t(this.component.addAnother || 'Add Another');
28
56
  }
29
- useWrapper() {
30
- return this.component.hasOwnProperty('multiple') && this.component.multiple;
31
- }
32
57
  /**
33
58
  * @returns {Field} - The created field.
34
59
  */
35
60
  render() {
36
- // If single value field.
37
- if (!this.useWrapper()) {
38
- return super.render(`<div ${this._referenceAttributeName}="element">
39
- ${this.renderElement(this.component.type !== 'hidden' ? this.dataValue : '')}
40
- </div>`);
41
- }
42
- // Make sure dataValue is in the correct array format.
43
- let dataValue = this.dataValue;
44
- if (!Array.isArray(dataValue)) {
45
- dataValue = dataValue ? [dataValue] : [];
46
- }
47
- // If multiple value field.
48
- return super.render(this.renderTemplate('multiValueTable', {
49
- rows: dataValue.map(this.renderRow.bind(this)).join(''),
50
- disabled: this.disabled,
51
- addAnother: this.addAnother,
52
- }));
61
+ let dataValue = this.normalizeValue(this.dataValue);
62
+ return this.component.hasOwnProperty('multiple') && this.component.multiple
63
+ ? super.render(this.renderTemplate('multiValueTable', {
64
+ rows: dataValue.map(this.renderRow.bind(this)).join(''),
65
+ disabled: this.disabled,
66
+ addAnother: this.addAnother,
67
+ }))
68
+ : super.render(`<div ${this._referenceAttributeName}="element">
69
+ ${this.renderElement(this.component.type !== 'hidden' ? dataValue : '')}
70
+ </div>`);
53
71
  }
54
72
  renderElement() {
55
73
  return '';
@@ -211,11 +211,12 @@ export default class NestedComponent extends Field {
211
211
  calculateValue(data: any, flags: any, row: any): any;
212
212
  isLastPage(): boolean;
213
213
  isValid(data: any, dirty: any): any;
214
- validationProcessor({ scope, data, row, instance }: {
214
+ validationProcessor({ scope, data, row, instance, component }: {
215
215
  scope: any;
216
216
  data: any;
217
217
  row: any;
218
218
  instance: any;
219
+ component: any;
219
220
  }, flags: any): void;
220
221
  /**
221
222
  * Perform a validation on all child components of this nested component.