@formio/js 5.4.1 → 5.4.2

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 (215) hide show
  1. package/README.md +11 -5
  2. package/dist/formio.builder.css +1 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +1 -0
  8. package/dist/formio.form.js +131 -109
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  12. package/dist/formio.full.css +1 -0
  13. package/dist/formio.full.js +155 -133
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  17. package/dist/formio.js +26 -26
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +2 -2
  20. package/dist/formio.utils.js +19 -19
  21. package/dist/formio.utils.min.js +1 -1
  22. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  23. package/lib/cjs/Embed.js +8 -16
  24. package/lib/cjs/Form.js +4 -4
  25. package/lib/cjs/Formio.js +2 -9
  26. package/lib/cjs/InlineEmbed.js +1 -4
  27. package/lib/cjs/PDF.js +28 -8
  28. package/lib/cjs/PDFBuilder.js +6 -10
  29. package/lib/cjs/Webform.d.ts +1 -0
  30. package/lib/cjs/Webform.js +19 -34
  31. package/lib/cjs/WebformBuilder.js +27 -68
  32. package/lib/cjs/Wizard.d.ts +1 -0
  33. package/lib/cjs/Wizard.js +44 -31
  34. package/lib/cjs/WizardBuilder.js +5 -15
  35. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
  36. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
  37. package/lib/cjs/addons/index.js +1 -3
  38. package/lib/cjs/components/_classes/component/Component.d.ts +5 -5
  39. package/lib/cjs/components/_classes/component/Component.js +60 -132
  40. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
  41. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
  42. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
  43. package/lib/cjs/components/_classes/field/Field.js +1 -4
  44. package/lib/cjs/components/_classes/input/Input.js +2 -2
  45. package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
  46. package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
  47. package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -26
  48. package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -4
  49. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
  50. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
  51. package/lib/cjs/components/address/Address.js +10 -30
  52. package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -32
  53. package/lib/cjs/components/alert/Alert.js +3 -6
  54. package/lib/cjs/components/button/Button.js +10 -17
  55. package/lib/cjs/components/button/editForm/Button.edit.display.js +8 -32
  56. package/lib/cjs/components/checkbox/Checkbox.js +4 -10
  57. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
  58. package/lib/cjs/components/columns/Columns.js +5 -17
  59. package/lib/cjs/components/container/Container.js +1 -3
  60. package/lib/cjs/components/currency/Currency.js +2 -7
  61. package/lib/cjs/components/datagrid/DataGrid.js +23 -63
  62. package/lib/cjs/components/datamap/DataMap.js +4 -16
  63. package/lib/cjs/components/datetime/DateTime.js +2 -6
  64. package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
  65. package/lib/cjs/components/day/Day.js +12 -70
  66. package/lib/cjs/components/day/editForm/Day.edit.day.js +1 -3
  67. package/lib/cjs/components/day/editForm/Day.edit.month.js +1 -3
  68. package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
  69. package/lib/cjs/components/editgrid/EditGrid.js +18 -44
  70. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
  71. package/lib/cjs/components/file/File.js +40 -70
  72. package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
  73. package/lib/cjs/components/file/editForm/File.edit.file.js +8 -30
  74. package/lib/cjs/components/form/Form.js +5 -7
  75. package/lib/cjs/components/html/HTML.js +1 -5
  76. package/lib/cjs/components/number/Number.js +2 -4
  77. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -12
  78. package/lib/cjs/components/password/Password.js +1 -4
  79. package/lib/cjs/components/radio/Radio.js +7 -17
  80. package/lib/cjs/components/radio/editForm/Radio.edit.data.js +4 -14
  81. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -6
  82. package/lib/cjs/components/select/Select.js +48 -92
  83. package/lib/cjs/components/select/editForm/Select.edit.data.js +37 -182
  84. package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -9
  85. package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -6
  86. package/lib/cjs/components/signature/Signature.d.ts +1 -1
  87. package/lib/cjs/components/signature/Signature.js +5 -10
  88. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +2 -6
  89. package/lib/cjs/components/survey/Survey.js +6 -17
  90. package/lib/cjs/components/survey/editForm/Survey.edit.data.js +4 -12
  91. package/lib/cjs/components/table/editForm/Table.edit.display.js +3 -3
  92. package/lib/cjs/components/tabs/Tabs.js +4 -19
  93. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
  94. package/lib/cjs/components/tags/Tags.js +4 -14
  95. package/lib/cjs/components/textarea/TextArea.js +8 -15
  96. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
  97. package/lib/cjs/components/textfield/TextField.js +4 -4
  98. package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +2 -8
  99. package/lib/cjs/components/time/Time.js +1 -4
  100. package/lib/cjs/components/time/editForm/Time.edit.display.js +1 -4
  101. package/lib/cjs/formio.form.js +5 -5
  102. package/lib/cjs/package.json +1 -1
  103. package/lib/cjs/providers/address/AddressProvider.js +1 -1
  104. package/lib/cjs/providers/address/GoogleAddressProvider.js +1 -3
  105. package/lib/cjs/providers/processor/fileProcessor.js +1 -3
  106. package/lib/cjs/providers/storage/azure.js +5 -6
  107. package/lib/cjs/providers/storage/indexeddb.js +5 -15
  108. package/lib/cjs/providers/storage/s3.js +3 -14
  109. package/lib/cjs/providers/storage/xhr.js +19 -28
  110. package/lib/cjs/templates/Templates.js +1 -0
  111. package/lib/cjs/translations/en.d.ts +237 -82
  112. package/lib/cjs/translations/en.js +9 -82
  113. package/lib/cjs/utils/ChoicesWrapper.js +1 -1
  114. package/lib/cjs/utils/builder.js +5 -26
  115. package/lib/cjs/utils/i18n.d.ts +5 -2
  116. package/lib/cjs/utils/i18n.js +33 -12
  117. package/lib/cjs/utils/utils.js +37 -47
  118. package/lib/cjs/widgets/CalendarWidget.js +2 -6
  119. package/lib/mjs/Embed.js +8 -16
  120. package/lib/mjs/Form.js +4 -4
  121. package/lib/mjs/Formio.js +2 -9
  122. package/lib/mjs/InlineEmbed.js +1 -4
  123. package/lib/mjs/PDF.js +27 -8
  124. package/lib/mjs/PDFBuilder.js +6 -10
  125. package/lib/mjs/Webform.d.ts +1 -0
  126. package/lib/mjs/Webform.js +19 -31
  127. package/lib/mjs/WebformBuilder.js +27 -68
  128. package/lib/mjs/Wizard.d.ts +1 -0
  129. package/lib/mjs/Wizard.js +39 -27
  130. package/lib/mjs/WizardBuilder.js +5 -15
  131. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
  132. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
  133. package/lib/mjs/addons/index.js +1 -3
  134. package/lib/mjs/components/_classes/component/Component.d.ts +5 -5
  135. package/lib/mjs/components/_classes/component/Component.js +59 -132
  136. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
  137. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
  138. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
  139. package/lib/mjs/components/_classes/field/Field.js +1 -4
  140. package/lib/mjs/components/_classes/input/Input.js +2 -2
  141. package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
  142. package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
  143. package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -26
  144. package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -4
  145. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
  146. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
  147. package/lib/mjs/components/address/Address.js +10 -30
  148. package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -32
  149. package/lib/mjs/components/alert/Alert.js +3 -6
  150. package/lib/mjs/components/button/Button.js +9 -16
  151. package/lib/mjs/components/button/editForm/Button.edit.display.js +8 -32
  152. package/lib/mjs/components/checkbox/Checkbox.js +4 -10
  153. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
  154. package/lib/mjs/components/columns/Columns.js +5 -17
  155. package/lib/mjs/components/container/Container.js +1 -3
  156. package/lib/mjs/components/currency/Currency.js +2 -7
  157. package/lib/mjs/components/datagrid/DataGrid.js +23 -63
  158. package/lib/mjs/components/datamap/DataMap.js +12 -18
  159. package/lib/mjs/components/datetime/DateTime.js +2 -6
  160. package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
  161. package/lib/mjs/components/day/Day.js +12 -70
  162. package/lib/mjs/components/day/editForm/Day.edit.day.js +1 -3
  163. package/lib/mjs/components/day/editForm/Day.edit.month.js +1 -3
  164. package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
  165. package/lib/mjs/components/editgrid/EditGrid.js +18 -44
  166. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
  167. package/lib/mjs/components/file/File.js +40 -70
  168. package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
  169. package/lib/mjs/components/file/editForm/File.edit.file.js +8 -30
  170. package/lib/mjs/components/form/Form.js +5 -7
  171. package/lib/mjs/components/html/HTML.js +1 -5
  172. package/lib/mjs/components/number/Number.js +2 -4
  173. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -12
  174. package/lib/mjs/components/password/Password.js +1 -4
  175. package/lib/mjs/components/radio/Radio.js +7 -17
  176. package/lib/mjs/components/radio/editForm/Radio.edit.data.js +4 -14
  177. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -6
  178. package/lib/mjs/components/select/Select.js +51 -95
  179. package/lib/mjs/components/select/editForm/Select.edit.data.js +37 -182
  180. package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -9
  181. package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -6
  182. package/lib/mjs/components/signature/Signature.d.ts +1 -1
  183. package/lib/mjs/components/signature/Signature.js +5 -10
  184. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +2 -6
  185. package/lib/mjs/components/survey/Survey.js +6 -17
  186. package/lib/mjs/components/survey/editForm/Survey.edit.data.js +4 -12
  187. package/lib/mjs/components/table/editForm/Table.edit.display.js +3 -3
  188. package/lib/mjs/components/tabs/Tabs.js +4 -19
  189. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
  190. package/lib/mjs/components/tags/Tags.js +4 -14
  191. package/lib/mjs/components/textarea/TextArea.js +8 -15
  192. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
  193. package/lib/mjs/components/textfield/TextField.js +4 -4
  194. package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +2 -8
  195. package/lib/mjs/components/time/Time.js +1 -4
  196. package/lib/mjs/components/time/editForm/Time.edit.display.js +1 -4
  197. package/lib/mjs/formio.form.js +6 -6
  198. package/lib/mjs/package.json +1 -1
  199. package/lib/mjs/providers/address/AddressProvider.js +1 -1
  200. package/lib/mjs/providers/address/GoogleAddressProvider.js +1 -3
  201. package/lib/mjs/providers/processor/fileProcessor.js +1 -3
  202. package/lib/mjs/providers/storage/azure.js +5 -6
  203. package/lib/mjs/providers/storage/indexeddb.js +5 -15
  204. package/lib/mjs/providers/storage/s3.js +3 -14
  205. package/lib/mjs/providers/storage/xhr.js +19 -32
  206. package/lib/mjs/templates/Templates.js +1 -0
  207. package/lib/mjs/translations/en.d.ts +237 -82
  208. package/lib/mjs/translations/en.js +88 -0
  209. package/lib/mjs/utils/ChoicesWrapper.js +1 -1
  210. package/lib/mjs/utils/builder.js +5 -26
  211. package/lib/mjs/utils/i18n.d.ts +5 -2
  212. package/lib/mjs/utils/i18n.js +33 -12
  213. package/lib/mjs/utils/utils.js +37 -47
  214. package/lib/mjs/widgets/CalendarWidget.js +2 -6
  215. package/package.json +6 -4
@@ -22,26 +22,16 @@ class Multivalue extends Field_1.default {
22
22
  if (Array.isArray(value)) {
23
23
  if (underlyingValueShouldBeArray) {
24
24
  if (value.length === 0 || !Array.isArray(value[0])) {
25
- return [
26
- value,
27
- ];
25
+ return [value];
28
26
  }
29
27
  }
30
28
  if (value.length === 0) {
31
- return [
32
- emptyValue,
33
- ];
29
+ return [emptyValue];
34
30
  }
35
31
  return super.normalizeValue(value, flags);
36
32
  }
37
33
  else {
38
- return super.normalizeValue(value == null
39
- ? [
40
- emptyValue,
41
- ]
42
- : [
43
- value,
44
- ], flags);
34
+ return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
45
35
  }
46
36
  }
47
37
  else {
@@ -69,22 +59,16 @@ class Multivalue extends Field_1.default {
69
59
  let value = super.defaultValue;
70
60
  if (this.component.multiple) {
71
61
  if (lodash_1.default.isArray(value)) {
72
- value = !value.length
73
- ? [
74
- super.emptyValue,
75
- ]
76
- : value;
62
+ value = !value.length ? [super.emptyValue] : value;
77
63
  }
78
64
  else {
79
- value = [
80
- value,
81
- ];
65
+ value = [value];
82
66
  }
83
67
  }
84
68
  return value;
85
69
  }
86
70
  get addAnother() {
87
- return this.t(this.component.addAnother || 'Add Another');
71
+ return this.t(this.component.addAnother || 'addAnother');
88
72
  }
89
73
  /**
90
74
  * @returns {Field} - The created field.
@@ -203,7 +187,7 @@ class Multivalue extends Field_1.default {
203
187
  this.saveCaretPosition(element, index);
204
188
  }
205
189
  catch (err) {
206
- console.warn('An error occurred while trying to save caret position', err);
190
+ console.warn(this.t('caretPositionSavingError'), err);
207
191
  }
208
192
  // If a mask is present, delay the update to allow mask to update first.
209
193
  if (element.mask) {
@@ -305,9 +289,7 @@ class Multivalue extends Field_1.default {
305
289
  }
306
290
  let dataValue = this.dataValue || [];
307
291
  if (!Array.isArray(dataValue)) {
308
- dataValue = [
309
- dataValue,
310
- ];
292
+ dataValue = [dataValue];
311
293
  }
312
294
  if (Array.isArray(value)) {
313
295
  dataValue = dataValue.concat(value);
@@ -515,10 +515,7 @@ class NestedComponent extends Field_1.default {
515
515
  }
516
516
  });
517
517
  }
518
- return Promise.all([
519
- superPromise,
520
- childPromise,
521
- ]);
518
+ return Promise.all([superPromise, childPromise]);
522
519
  }
523
520
  /**
524
521
  * Attach the logic to the components.
@@ -16,15 +16,13 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
16
16
  }, ...extend);
17
17
  }
18
18
  static savedValueTypes() {
19
- return [
20
- utils_2.componentValueTypes.array,
21
- ];
19
+ return [utils_2.componentValueTypes.array];
22
20
  }
23
21
  componentContext(component) {
24
22
  return this.iteratableRows[component.rowIndex].data;
25
23
  }
26
24
  get iteratableRows() {
27
- throw new Error('Getter #iteratableRows() is not implemented');
25
+ throw new Error(this.t('iteratableRowsError'));
28
26
  }
29
27
  get rowIndex() {
30
28
  return this._rowIndex;
@@ -64,12 +62,10 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
64
62
  }
65
63
  validate(data, flags = {}) {
66
64
  data = data || this.data;
67
- return this.validateComponents([
68
- this.component,
69
- ], data, flags);
65
+ return this.validateComponents([this.component], data, flags);
70
66
  }
71
67
  checkRow(...args) {
72
- console.log('Deprecation Warning: checkRow method has been replaced with processRow');
68
+ console.log(this.t('checkRowDeprecation'));
73
69
  return this.processRow.call(this, ...args);
74
70
  }
75
71
  processRow(method, data, opts, row, components, silentCheck) {
@@ -127,7 +123,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
127
123
  `;
128
124
  (_a = this.component.components) === null || _a === void 0 ? void 0 : _a.forEach((component) => {
129
125
  const label = component.label || component.key;
130
- result += `<th style="padding: 5px 10px;">${label}</th>`;
126
+ result += `<th style="padding: 5px 10px;">${this.t(label, { _userInput: true })}</th>`;
131
127
  });
132
128
  result += `
133
129
  </tr>
@@ -16,9 +16,7 @@ class NestedDataComponent extends NestedComponent_1.default {
16
16
  return !lodash_1.default.isEqual(newValue, oldValue);
17
17
  }
18
18
  static savedValueTypes(schema) {
19
- return ((0, utils_1.getComponentSavedTypes)(schema) || [
20
- utils_1.componentValueTypes.object,
21
- ]);
19
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
22
20
  }
23
21
  get allowData() {
24
22
  return true;
@@ -84,9 +84,7 @@ class AddressComponent extends Container_1.default {
84
84
  }
85
85
  static savedValueTypes(schema) {
86
86
  schema = schema || {};
87
- return ((0, utils_1.getComponentSavedTypes)(schema) || [
88
- utils_1.componentValueTypes.object,
89
- ]);
87
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
90
88
  }
91
89
  static get builderInfo() {
92
90
  return {
@@ -102,10 +100,7 @@ class AddressComponent extends Container_1.default {
102
100
  return AddressComponent.conditionOperatorsSettings;
103
101
  }
104
102
  static get conditionOperatorsSettings() {
105
- return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [
106
- 'isEmpty',
107
- 'isNotEmpty',
108
- ] });
103
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
109
104
  }
110
105
  mergeSchema(component = {}) {
111
106
  let { defaultSchema } = this;
@@ -205,11 +200,7 @@ class AddressComponent extends Container_1.default {
205
200
  }
206
201
  get address() {
207
202
  if (this.isMultiple) {
208
- return lodash_1.default.isArray(this.dataValue)
209
- ? this.dataValue
210
- : [
211
- this.dataValue,
212
- ];
203
+ return lodash_1.default.isArray(this.dataValue) ? this.dataValue : [this.dataValue];
213
204
  }
214
205
  // Manual mode is not implementing for multiple value
215
206
  return this.manualModeEnabled && this.dataValue ? this.dataValue.address : this.dataValue;
@@ -225,11 +216,7 @@ class AddressComponent extends Container_1.default {
225
216
  get defaultValue() {
226
217
  let defaultValue = super.defaultValue;
227
218
  if (this.isMultiple) {
228
- defaultValue = lodash_1.default.isArray(defaultValue)
229
- ? defaultValue
230
- : [
231
- defaultValue,
232
- ];
219
+ defaultValue = lodash_1.default.isArray(defaultValue) ? defaultValue : [defaultValue];
233
220
  }
234
221
  return defaultValue;
235
222
  }
@@ -245,9 +232,7 @@ class AddressComponent extends Container_1.default {
245
232
  get dataValue() {
246
233
  const resultValue = lodash_1.default.get(this._data, this.path);
247
234
  if (!lodash_1.default.isArray(resultValue) && this.component.multiple) {
248
- return [
249
- resultValue,
250
- ];
235
+ return [resultValue];
251
236
  }
252
237
  return super.dataValue;
253
238
  }
@@ -342,7 +327,7 @@ class AddressComponent extends Container_1.default {
342
327
  return !this.isMultiple && (this.builderMode || this.manualModeEnabled);
343
328
  }
344
329
  get addAnother() {
345
- return this.t(this.component.addAnother || 'Add Another');
330
+ return this.t(this.component.addAnother || 'addAnother');
346
331
  }
347
332
  renderElement(value) {
348
333
  return this.renderTemplate(this.templateName, {
@@ -385,9 +370,7 @@ class AddressComponent extends Container_1.default {
385
370
  var _a;
386
371
  if (this.isMultiple) {
387
372
  this.address[index] = address;
388
- this.address = [
389
- ...this.address,
390
- ];
373
+ this.address = [...this.address];
391
374
  }
392
375
  else {
393
376
  this.address = address;
@@ -604,12 +587,9 @@ class AddressComponent extends Container_1.default {
604
587
  }
605
588
  return this.getComponents()
606
589
  .filter((component) => component.hasValue(address))
607
- .map((component) => [
608
- component,
609
- lodash_1.default.get(address, component.key),
610
- ])
611
- .filter(([component, componentValue,]) => !component.isEmpty(componentValue))
612
- .map(([component, componentValue,]) => component.getValueAsString(componentValue, options))
590
+ .map((component) => [component, lodash_1.default.get(address, component.key)])
591
+ .filter(([component, componentValue]) => !component.isEmpty(componentValue))
592
+ .map(([component, componentValue]) => component.getValueAsString(componentValue, options))
613
593
  .join(', ');
614
594
  }
615
595
  return super.getValueAsString(address, options);
@@ -43,10 +43,7 @@ exports.default = [
43
43
  },
44
44
  conditional: {
45
45
  json: {
46
- '===': [
47
- { var: 'data.provider' },
48
- 'azure',
49
- ],
46
+ '===': [{ var: 'data.provider' }, 'azure'],
50
47
  },
51
48
  },
52
49
  },
@@ -63,10 +60,7 @@ exports.default = [
63
60
  },
64
61
  conditional: {
65
62
  json: {
66
- '===': [
67
- { var: 'data.provider' },
68
- 'custom',
69
- ],
63
+ '===': [{ var: 'data.provider' }, 'custom'],
70
64
  },
71
65
  },
72
66
  },
@@ -81,10 +75,7 @@ exports.default = [
81
75
  tooltip: 'Which query param should be used to pass as a search string. Default is `query`.',
82
76
  conditional: {
83
77
  json: {
84
- '===': [
85
- { var: 'data.provider' },
86
- 'custom',
87
- ],
78
+ '===': [{ var: 'data.provider' }, 'custom'],
88
79
  },
89
80
  },
90
81
  },
@@ -98,10 +89,7 @@ exports.default = [
98
89
  tooltip: 'The property within the response data, where iterable addresses reside. For example: results.',
99
90
  conditional: {
100
91
  json: {
101
- '===': [
102
- { var: 'data.provider' },
103
- 'custom',
104
- ],
92
+ '===': [{ var: 'data.provider' }, 'custom'],
105
93
  },
106
94
  },
107
95
  },
@@ -115,10 +103,7 @@ exports.default = [
115
103
  tooltip: 'The property of each address in the response to use as the display value.',
116
104
  conditional: {
117
105
  json: {
118
- '===': [
119
- { var: 'data.provider' },
120
- 'custom',
121
- ],
106
+ '===': [{ var: 'data.provider' }, 'custom'],
122
107
  },
123
108
  },
124
109
  },
@@ -135,10 +120,7 @@ exports.default = [
135
120
  tooltip: 'Additional query params can be specified here in a way of JSON object.',
136
121
  conditional: {
137
122
  json: {
138
- '===': [
139
- { var: 'data.provider' },
140
- 'custom',
141
- ],
123
+ '===': [{ var: 'data.provider' }, 'custom'],
142
124
  },
143
125
  },
144
126
  },
@@ -155,10 +137,7 @@ exports.default = [
155
137
  },
156
138
  conditional: {
157
139
  json: {
158
- '===': [
159
- { var: 'data.provider' },
160
- 'google',
161
- ],
140
+ '===': [{ var: 'data.provider' }, 'google'],
162
141
  },
163
142
  },
164
143
  },
@@ -176,10 +155,7 @@ exports.default = [
176
155
  tooltip: "Specify Google Maps Autocomplete options used for address searching as JSON object. Follow the <a href ='https://developers.google.com/maps/documentation/javascript/places-autocomplete' target='_blank'>link</a> for available options",
177
156
  conditional: {
178
157
  json: {
179
- '===': [
180
- { var: 'data.provider' },
181
- 'google',
182
- ],
158
+ '===': [{ var: 'data.provider' }, 'google'],
183
159
  },
184
160
  },
185
161
  },
@@ -27,11 +27,7 @@ class Alert {
27
27
  };
28
28
  }
29
29
  showErrors(errors = [], triggerEvent = false, options = {}) {
30
- errors = lodash_1.default.isArray(errors)
31
- ? errors
32
- : [
33
- errors,
34
- ];
30
+ errors = lodash_1.default.isArray(errors) ? errors : [errors];
35
31
  const messagesList = this.createMessagesList('error', errors);
36
32
  this.showAlert('error', messagesList, options);
37
33
  if (triggerEvent) {
@@ -114,7 +110,7 @@ class Alert {
114
110
  ] });
115
111
  if ((_c = this.refs.messageRef) === null || _c === void 0 ? void 0 : _c.length) {
116
112
  this.refs.messageRef.forEach((el) => {
117
- Object.entries(customEvents).forEach(([event, listeners,]) => {
113
+ Object.entries(customEvents).forEach(([event, listeners]) => {
118
114
  listeners.forEach((listener) => this.parentComponent.addEventListener(el, event, listener));
119
115
  this.eventListenersKeys.push(event);
120
116
  });
@@ -146,6 +142,7 @@ class Alert {
146
142
  const component = (_a = this.parentComponent.root) === null || _a === void 0 ? void 0 : _a.getComponent(path, null, keyOrPath);
147
143
  if (component && lodash_1.default.isFunction(component.focus)) {
148
144
  component.focus();
145
+ component.scrollIntoView();
149
146
  }
150
147
  }
151
148
  }
@@ -35,9 +35,7 @@ class ButtonComponent extends Field_1.default {
35
35
  };
36
36
  }
37
37
  static savedValueTypes(schema) {
38
- return ((0, utils_1.getComponentSavedTypes)(schema) || [
39
- utils_1.componentValueTypes.boolean,
40
- ]);
38
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.boolean];
41
39
  }
42
40
  constructor(component, options, data) {
43
41
  super(component, options, data);
@@ -49,12 +47,7 @@ class ButtonComponent extends Field_1.default {
49
47
  get inputInfo() {
50
48
  const info = super.elementInfo();
51
49
  info.type = 'button';
52
- info.attr.type = [
53
- 'submit',
54
- 'saveState',
55
- ].includes(this.component.action)
56
- ? 'submit'
57
- : 'button';
50
+ info.attr.type = ['submit', 'saveState'].includes(this.component.action) ? 'submit' : 'button';
58
51
  this.component.theme = this.component.theme || 'default';
59
52
  info.attr.class = `btn btn-${this.component.theme}`;
60
53
  if (this.component.size) {
@@ -282,7 +275,7 @@ class ButtonComponent extends Field_1.default {
282
275
  super.detach();
283
276
  }
284
277
  onClick(event) {
285
- var _a, _b, _c, _d;
278
+ var _a, _b, _c;
286
279
  this.triggerCaptcha();
287
280
  // Don't click if disabled or in builder mode.
288
281
  if (this.disabled || this.options.attachMode === 'builder') {
@@ -352,17 +345,17 @@ class ButtonComponent extends Field_1.default {
352
345
  break;
353
346
  case 'oauth':
354
347
  if (this.root === this) {
355
- console.warn('You must add the OAuth button to a form for it to function properly');
348
+ console.warn(this.t('noOAuthBtn'));
356
349
  return;
357
350
  }
358
351
  // Display Alert if OAuth config is missing
359
352
  if (!this.oauthConfig) {
360
- (_c = this.root) === null || _c === void 0 ? void 0 : _c.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');
353
+ this.root.setAlert('danger', this.t('noOAuthConfiguration'));
361
354
  break;
362
355
  }
363
356
  // Display Alert if oAuth has an error is missing
364
357
  if (this.oauthConfig.error) {
365
- (_d = this.root) === null || _d === void 0 ? void 0 : _d.setAlert('danger', `The Following Error Has Occured ${this.oauthConfig.error}`);
358
+ (_c = this.root) === null || _c === void 0 ? void 0 : _c.setAlert('danger', `${this.t('oAuthErrorsTitle')} ${this.t(this.oauthConfig.error)}`);
366
359
  break;
367
360
  }
368
361
  this.openOauth(this.oauthConfig);
@@ -371,14 +364,14 @@ class ButtonComponent extends Field_1.default {
371
364
  }
372
365
  openOauth(settings) {
373
366
  var _a;
374
- // this is if the temp session (storing the state and code verifiers) expires in the db
367
+ // this is if the temp session (storing the state and code verifiers) expires in the db
375
368
  // and we need to fetch new oauth state
376
369
  if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
377
370
  this._handleOauthSessionExpired();
378
371
  return;
379
372
  }
380
373
  if (!((_a = this.root) === null || _a === void 0 ? void 0 : _a.formio)) {
381
- console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');
374
+ console.warn(this.t('noOAuthFormUrl'));
382
375
  return;
383
376
  }
384
377
  let params = {
@@ -433,7 +426,7 @@ class ButtonComponent extends Field_1.default {
433
426
  }
434
427
  // TODO: check for error response here
435
428
  if (settings.state !== params.state) {
436
- (_b = this.root) === null || _b === void 0 ? void 0 : _b.setAlert('danger', 'OAuth state does not match. Please try logging in again.');
429
+ (_b = this.root) === null || _b === void 0 ? void 0 : _b.setAlert('danger', this.t('oAuthStateError'));
437
430
  return;
438
431
  }
439
432
  if (settings.sessionId) {
@@ -479,7 +472,7 @@ class ButtonComponent extends Field_1.default {
479
472
  catch (error) {
480
473
  if (error.name !== 'SecurityError' &&
481
474
  (error.name !== 'Error' || error.message !== 'Permission denied')) {
482
- (_h = this.root) === null || _h === void 0 ? void 0 : _h.setAlert('danger', error.message || error);
475
+ (_h = this.root) === null || _h === void 0 ? void 0 : _h.setAlert('danger', this.t(`${error.message || error}`));
483
476
  }
484
477
  }
485
478
  if (!popup || popup.closed || popup.closed === undefined) {
@@ -62,10 +62,7 @@ exports.default = [
62
62
  },
63
63
  conditional: {
64
64
  json: {
65
- '===': [
66
- { var: 'data.action' },
67
- 'oauth',
68
- ],
65
+ '===': [{ var: 'data.action' }, 'oauth'],
69
66
  },
70
67
  },
71
68
  },
@@ -79,10 +76,7 @@ exports.default = [
79
76
  input: true,
80
77
  conditional: {
81
78
  json: {
82
- '===': [
83
- { var: 'data.action' },
84
- 'saveState',
85
- ],
79
+ '===': [{ var: 'data.action' }, 'saveState'],
86
80
  },
87
81
  },
88
82
  },
@@ -96,10 +90,7 @@ exports.default = [
96
90
  tooltip: 'Use the Enter key to submit form.',
97
91
  conditional: {
98
92
  json: {
99
- '===': [
100
- { var: 'data.action' },
101
- 'submit',
102
- ],
93
+ '===': [{ var: 'data.action' }, 'submit'],
103
94
  },
104
95
  },
105
96
  },
@@ -113,10 +104,7 @@ exports.default = [
113
104
  tooltip: 'When the button is pressed, show any validation errors on the form.',
114
105
  conditional: {
115
106
  json: {
116
- '!==': [
117
- { var: 'data.action' },
118
- 'submit',
119
- ],
107
+ '!==': [{ var: 'data.action' }, 'submit'],
120
108
  },
121
109
  },
122
110
  },
@@ -129,10 +117,7 @@ exports.default = [
129
117
  tooltip: 'The event to fire when the button is clicked.',
130
118
  conditional: {
131
119
  json: {
132
- '===': [
133
- { var: 'data.action' },
134
- 'event',
135
- ],
120
+ '===': [{ var: 'data.action' }, 'event'],
136
121
  },
137
122
  },
138
123
  },
@@ -147,10 +132,7 @@ exports.default = [
147
132
  placeholder: 'https://example.form.io',
148
133
  conditional: {
149
134
  json: {
150
- '===': [
151
- { var: 'data.action' },
152
- 'url',
153
- ],
135
+ '===': [{ var: 'data.action' }, 'url'],
154
136
  },
155
137
  },
156
138
  },
@@ -178,10 +160,7 @@ exports.default = [
178
160
  ],
179
161
  conditional: {
180
162
  json: {
181
- '===': [
182
- { var: 'data.action' },
183
- 'url',
184
- ],
163
+ '===': [{ var: 'data.action' }, 'url'],
185
164
  },
186
165
  },
187
166
  },
@@ -197,10 +176,7 @@ exports.default = [
197
176
  placeholder: "data['mykey'] = data['anotherKey'];",
198
177
  conditional: {
199
178
  json: {
200
- '===': [
201
- { var: 'data.action' },
202
- 'custom',
203
- ],
179
+ '===': [{ var: 'data.action' }, 'custom'],
204
180
  },
205
181
  },
206
182
  },
@@ -33,9 +33,7 @@ class CheckBoxComponent extends Field_1.default {
33
33
  return CheckBoxComponent.conditionOperatorsSettings;
34
34
  }
35
35
  static get conditionOperatorsSettings() {
36
- return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [
37
- 'isEqual',
38
- ], valueComponent() {
36
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEqual'], valueComponent() {
39
37
  return {
40
38
  valueType: 'boolean',
41
39
  data: {
@@ -55,13 +53,9 @@ class CheckBoxComponent extends Field_1.default {
55
53
  return types;
56
54
  }
57
55
  if (schema.inputType === 'radio') {
58
- return [
59
- utils_1.componentValueTypes.string,
60
- ];
56
+ return [utils_1.componentValueTypes.string];
61
57
  }
62
- return [
63
- utils_1.componentValueTypes.boolean,
64
- ];
58
+ return [utils_1.componentValueTypes.boolean];
65
59
  }
66
60
  get defaultSchema() {
67
61
  return CheckBoxComponent.schema();
@@ -196,7 +190,7 @@ class CheckBoxComponent extends Field_1.default {
196
190
  if (lodash_1.default.isUndefined(value) && this.inDataTable) {
197
191
  return '';
198
192
  }
199
- return this.t(hasValue ? 'Yes' : 'No');
193
+ return this.t(hasValue ? 'yes' : 'no');
200
194
  }
201
195
  updateValue(value, flags) {
202
196
  // If this is a radio and is alredy checked, uncheck it.
@@ -63,10 +63,7 @@ exports.default = [
63
63
  weight: 420,
64
64
  conditional: {
65
65
  json: {
66
- '===': [
67
- { var: 'data.inputType' },
68
- 'radio',
69
- ],
66
+ '===': [{ var: 'data.inputType' }, 'radio'],
70
67
  },
71
68
  },
72
69
  },
@@ -79,10 +76,7 @@ exports.default = [
79
76
  weight: 430,
80
77
  conditional: {
81
78
  json: {
82
- '===': [
83
- { var: 'data.inputType' },
84
- 'radio',
85
- ],
79
+ '===': [{ var: 'data.inputType' }, 'radio'],
86
80
  },
87
81
  },
88
82
  },
@@ -42,9 +42,7 @@ class ColumnsComponent extends NestedComponent_1.default {
42
42
  }
43
43
  get schema() {
44
44
  var _a;
45
- const schema = lodash_1.default.omit(super.schema, [
46
- 'components',
47
- ]);
45
+ const schema = lodash_1.default.omit(super.schema, ['components']);
48
46
  (_a = schema.columns) === null || _a === void 0 ? void 0 : _a.map((column, colIndex) => {
49
47
  column.components.map((comp, compIndex) => {
50
48
  const clonedComp = lodash_1.default.clone(comp);
@@ -128,28 +126,18 @@ class ColumnsComponent extends NestedComponent_1.default {
128
126
  const initVal = { stack: [], rows: [] };
129
127
  const width = (x) => x.component.width;
130
128
  const result = lodash_1.default.reduce(this.components, (acc, next) => {
131
- const stack = [
132
- ...acc.stack,
133
- next,
134
- ];
129
+ const stack = [...acc.stack, next];
135
130
  if (lodash_1.default.sumBy(stack, width) <= this.gridSize) {
136
131
  acc.stack = stack;
137
132
  return acc;
138
133
  }
139
134
  else {
140
- acc.rows = [
141
- ...acc.rows,
142
- acc.stack,
143
- ];
144
- acc.stack = [
145
- next,
146
- ];
135
+ acc.rows = [...acc.rows, acc.stack];
136
+ acc.stack = [next];
147
137
  return acc;
148
138
  }
149
139
  }, initVal);
150
- return lodash_1.default.concat(result.rows, [
151
- result.stack,
152
- ]);
140
+ return lodash_1.default.concat(result.rows, [result.stack]);
153
141
  }
154
142
  checkData(data, flags, row, components) {
155
143
  super.checkData(data, flags, row, components);
@@ -37,9 +37,7 @@ class ContainerComponent extends NestedDataComponent_1.default {
37
37
  this.type = 'container';
38
38
  }
39
39
  static savedValueTypes(schema) {
40
- return ((0, utils_1.getComponentSavedTypes)(schema) || [
41
- utils_1.componentValueTypes.object,
42
- ]);
40
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
43
41
  }
44
42
  addComponents(data, options) {
45
43
  return super.addComponents(this.dataValue, options);