@formio/js 5.4.0 → 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 (217) hide show
  1. package/README.md +11 -5
  2. package/dist/formio.builder.css +12 -5
  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 +12 -5
  8. package/dist/formio.form.js +2883 -2867
  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 +12 -5
  13. package/dist/formio.full.js +3507 -3491
  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 +1139 -1145
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +2 -2
  20. package/dist/formio.utils.js +1066 -1072
  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 +10 -5
  39. package/lib/cjs/components/_classes/component/Component.js +76 -134
  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.d.ts +1 -0
  55. package/lib/cjs/components/button/Button.js +31 -17
  56. package/lib/cjs/components/button/editForm/Button.edit.display.js +8 -32
  57. package/lib/cjs/components/checkbox/Checkbox.js +4 -10
  58. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
  59. package/lib/cjs/components/columns/Columns.js +5 -17
  60. package/lib/cjs/components/container/Container.js +1 -3
  61. package/lib/cjs/components/currency/Currency.js +2 -7
  62. package/lib/cjs/components/datagrid/DataGrid.js +27 -68
  63. package/lib/cjs/components/datamap/DataMap.js +4 -16
  64. package/lib/cjs/components/datetime/DateTime.js +2 -6
  65. package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
  66. package/lib/cjs/components/day/Day.js +12 -70
  67. package/lib/cjs/components/day/editForm/Day.edit.day.js +1 -3
  68. package/lib/cjs/components/day/editForm/Day.edit.month.js +1 -3
  69. package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
  70. package/lib/cjs/components/editgrid/EditGrid.js +18 -44
  71. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
  72. package/lib/cjs/components/file/File.js +40 -70
  73. package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
  74. package/lib/cjs/components/file/editForm/File.edit.file.js +8 -30
  75. package/lib/cjs/components/form/Form.js +5 -7
  76. package/lib/cjs/components/html/HTML.js +1 -5
  77. package/lib/cjs/components/number/Number.js +2 -4
  78. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -12
  79. package/lib/cjs/components/password/Password.js +1 -4
  80. package/lib/cjs/components/radio/Radio.js +7 -17
  81. package/lib/cjs/components/radio/editForm/Radio.edit.data.js +4 -14
  82. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -6
  83. package/lib/cjs/components/select/Select.js +49 -94
  84. package/lib/cjs/components/select/editForm/Select.edit.data.js +37 -182
  85. package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -9
  86. package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -6
  87. package/lib/cjs/components/signature/Signature.d.ts +1 -1
  88. package/lib/cjs/components/signature/Signature.js +5 -10
  89. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +2 -6
  90. package/lib/cjs/components/survey/Survey.js +6 -17
  91. package/lib/cjs/components/survey/editForm/Survey.edit.data.js +4 -12
  92. package/lib/cjs/components/table/editForm/Table.edit.display.js +3 -3
  93. package/lib/cjs/components/tabs/Tabs.js +4 -19
  94. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
  95. package/lib/cjs/components/tags/Tags.js +4 -14
  96. package/lib/cjs/components/textarea/TextArea.js +8 -15
  97. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
  98. package/lib/cjs/components/textfield/TextField.js +4 -4
  99. package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +2 -8
  100. package/lib/cjs/components/time/Time.js +1 -4
  101. package/lib/cjs/components/time/editForm/Time.edit.display.js +1 -4
  102. package/lib/cjs/formio.form.js +5 -5
  103. package/lib/cjs/package.json +1 -1
  104. package/lib/cjs/providers/address/AddressProvider.js +1 -1
  105. package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -4
  106. package/lib/cjs/providers/processor/fileProcessor.js +1 -3
  107. package/lib/cjs/providers/storage/azure.js +5 -6
  108. package/lib/cjs/providers/storage/indexeddb.js +5 -15
  109. package/lib/cjs/providers/storage/s3.js +3 -14
  110. package/lib/cjs/providers/storage/xhr.js +19 -28
  111. package/lib/cjs/templates/Templates.js +1 -0
  112. package/lib/cjs/translations/en.d.ts +237 -81
  113. package/lib/cjs/translations/en.js +10 -81
  114. package/lib/cjs/utils/ChoicesWrapper.js +1 -1
  115. package/lib/cjs/utils/builder.js +5 -26
  116. package/lib/cjs/utils/i18n.d.ts +5 -2
  117. package/lib/cjs/utils/i18n.js +33 -12
  118. package/lib/cjs/utils/utils.js +42 -52
  119. package/lib/cjs/widgets/CalendarWidget.js +2 -6
  120. package/lib/mjs/Embed.js +8 -16
  121. package/lib/mjs/Form.js +4 -4
  122. package/lib/mjs/Formio.js +2 -9
  123. package/lib/mjs/InlineEmbed.js +1 -4
  124. package/lib/mjs/PDF.js +27 -8
  125. package/lib/mjs/PDFBuilder.js +6 -10
  126. package/lib/mjs/Webform.d.ts +1 -0
  127. package/lib/mjs/Webform.js +19 -31
  128. package/lib/mjs/WebformBuilder.js +27 -68
  129. package/lib/mjs/Wizard.d.ts +1 -0
  130. package/lib/mjs/Wizard.js +39 -27
  131. package/lib/mjs/WizardBuilder.js +5 -15
  132. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
  133. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
  134. package/lib/mjs/addons/index.js +1 -3
  135. package/lib/mjs/components/_classes/component/Component.d.ts +10 -5
  136. package/lib/mjs/components/_classes/component/Component.js +75 -134
  137. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
  138. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
  139. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
  140. package/lib/mjs/components/_classes/field/Field.js +1 -4
  141. package/lib/mjs/components/_classes/input/Input.js +2 -2
  142. package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
  143. package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
  144. package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -26
  145. package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -4
  146. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
  147. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
  148. package/lib/mjs/components/address/Address.js +10 -30
  149. package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -32
  150. package/lib/mjs/components/alert/Alert.js +3 -6
  151. package/lib/mjs/components/button/Button.d.ts +1 -0
  152. package/lib/mjs/components/button/Button.js +29 -16
  153. package/lib/mjs/components/button/editForm/Button.edit.display.js +8 -32
  154. package/lib/mjs/components/checkbox/Checkbox.js +4 -10
  155. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
  156. package/lib/mjs/components/columns/Columns.js +5 -17
  157. package/lib/mjs/components/container/Container.js +1 -3
  158. package/lib/mjs/components/currency/Currency.js +2 -7
  159. package/lib/mjs/components/datagrid/DataGrid.js +28 -69
  160. package/lib/mjs/components/datamap/DataMap.js +12 -18
  161. package/lib/mjs/components/datetime/DateTime.js +2 -6
  162. package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
  163. package/lib/mjs/components/day/Day.js +12 -70
  164. package/lib/mjs/components/day/editForm/Day.edit.day.js +1 -3
  165. package/lib/mjs/components/day/editForm/Day.edit.month.js +1 -3
  166. package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
  167. package/lib/mjs/components/editgrid/EditGrid.js +18 -44
  168. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
  169. package/lib/mjs/components/file/File.js +40 -70
  170. package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
  171. package/lib/mjs/components/file/editForm/File.edit.file.js +8 -30
  172. package/lib/mjs/components/form/Form.js +5 -7
  173. package/lib/mjs/components/html/HTML.js +1 -5
  174. package/lib/mjs/components/number/Number.js +2 -4
  175. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -12
  176. package/lib/mjs/components/password/Password.js +1 -4
  177. package/lib/mjs/components/radio/Radio.js +7 -17
  178. package/lib/mjs/components/radio/editForm/Radio.edit.data.js +4 -14
  179. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -6
  180. package/lib/mjs/components/select/Select.js +52 -97
  181. package/lib/mjs/components/select/editForm/Select.edit.data.js +37 -182
  182. package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -9
  183. package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -6
  184. package/lib/mjs/components/signature/Signature.d.ts +1 -1
  185. package/lib/mjs/components/signature/Signature.js +5 -10
  186. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +2 -6
  187. package/lib/mjs/components/survey/Survey.js +6 -17
  188. package/lib/mjs/components/survey/editForm/Survey.edit.data.js +4 -12
  189. package/lib/mjs/components/table/editForm/Table.edit.display.js +3 -3
  190. package/lib/mjs/components/tabs/Tabs.js +4 -19
  191. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
  192. package/lib/mjs/components/tags/Tags.js +4 -14
  193. package/lib/mjs/components/textarea/TextArea.js +8 -15
  194. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
  195. package/lib/mjs/components/textfield/TextField.js +4 -4
  196. package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +2 -8
  197. package/lib/mjs/components/time/Time.js +1 -4
  198. package/lib/mjs/components/time/editForm/Time.edit.display.js +1 -4
  199. package/lib/mjs/formio.form.js +6 -6
  200. package/lib/mjs/package.json +1 -1
  201. package/lib/mjs/providers/address/AddressProvider.js +1 -1
  202. package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -4
  203. package/lib/mjs/providers/processor/fileProcessor.js +1 -3
  204. package/lib/mjs/providers/storage/azure.js +5 -6
  205. package/lib/mjs/providers/storage/indexeddb.js +5 -15
  206. package/lib/mjs/providers/storage/s3.js +3 -14
  207. package/lib/mjs/providers/storage/xhr.js +19 -32
  208. package/lib/mjs/templates/Templates.js +1 -0
  209. package/lib/mjs/translations/en.d.ts +237 -81
  210. package/lib/mjs/translations/en.js +91 -1
  211. package/lib/mjs/utils/ChoicesWrapper.js +1 -1
  212. package/lib/mjs/utils/builder.js +5 -26
  213. package/lib/mjs/utils/i18n.d.ts +5 -2
  214. package/lib/mjs/utils/i18n.js +33 -12
  215. package/lib/mjs/utils/utils.js +42 -52
  216. package/lib/mjs/widgets/CalendarWidget.js +2 -6
  217. package/package.json +8 -6
@@ -21,10 +21,7 @@ exports.default = [
21
21
  tooltip: 'A URL that returns a JSON array to use as the data source.',
22
22
  conditional: {
23
23
  json: {
24
- '===': [
25
- { var: 'data.dataSrc' },
26
- 'url',
27
- ],
24
+ '===': [{ var: 'data.dataSrc' }, 'url'],
28
25
  },
29
26
  },
30
27
  },
@@ -51,10 +48,7 @@ exports.default = [
51
48
  ],
52
49
  conditional: {
53
50
  json: {
54
- '===': [
55
- { var: 'data.dataSrc' },
56
- 'url',
57
- ],
51
+ '===': [{ var: 'data.dataSrc' }, 'url'],
58
52
  },
59
53
  },
60
54
  },
@@ -70,14 +64,7 @@ exports.default = [
70
64
  tooltip: 'The property of each item in the data source to use as the select value. If not specified, the item itself will be used.',
71
65
  conditional: {
72
66
  json: {
73
- in: [
74
- { var: 'data.dataSrc' },
75
- [
76
- 'json',
77
- 'url',
78
- 'custom',
79
- ],
80
- ],
67
+ in: [{ var: 'data.dataSrc' }, ['json', 'url', 'custom']],
81
68
  },
82
69
  },
83
70
  },
@@ -110,10 +97,7 @@ exports.default = [
110
97
  tooltip: 'Check this if you would like to use Formio Authentication with the request.',
111
98
  conditional: {
112
99
  json: {
113
- '===': [
114
- { var: 'data.dataSrc' },
115
- 'url',
116
- ],
100
+ '===': [{ var: 'data.dataSrc' }, 'url'],
117
101
  },
118
102
  },
119
103
  },
@@ -128,16 +112,10 @@ exports.default = [
128
112
  json: {
129
113
  or: [
130
114
  {
131
- '===': [
132
- { var: 'data.dataSrc' },
133
- 'url',
134
- ],
115
+ '===': [{ var: 'data.dataSrc' }, 'url'],
135
116
  },
136
117
  {
137
- '===': [
138
- { var: 'data.dataSrc' },
139
- 'resource',
140
- ],
118
+ '===': [{ var: 'data.dataSrc' }, 'resource'],
141
119
  },
142
120
  ],
143
121
  },
@@ -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
  }
@@ -29,6 +29,7 @@ export default class ButtonComponent extends Field {
29
29
  detach(element: any): void;
30
30
  onClick(event: any): void;
31
31
  openOauth(settings: any): void;
32
+ _handleOauthSessionExpired(): void;
32
33
  get oauthComponentPath(): any;
33
34
  focus(): void;
34
35
  triggerCaptcha(): void;
@@ -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,8 +364,14 @@ class ButtonComponent extends Field_1.default {
371
364
  }
372
365
  openOauth(settings) {
373
366
  var _a;
367
+ // this is if the temp session (storing the state and code verifiers) expires in the db
368
+ // and we need to fetch new oauth state
369
+ if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
370
+ this._handleOauthSessionExpired();
371
+ return;
372
+ }
374
373
  if (!((_a = this.root) === null || _a === void 0 ? void 0 : _a.formio)) {
375
- console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');
374
+ console.warn(this.t('noOAuthFormUrl'));
376
375
  return;
377
376
  }
378
377
  let params = {
@@ -386,7 +385,8 @@ class ButtonComponent extends Field_1.default {
386
385
  if (settings.state) {
387
386
  params.state = settings.state;
388
387
  }
389
- else if (settings.code_challenge) {
388
+ // okta requires both a state and a code challenge for PKCE
389
+ if (settings.code_challenge) {
390
390
  params.code_challenge = settings.code_challenge;
391
391
  params.code_challenge_method = 'S256';
392
392
  }
@@ -426,9 +426,12 @@ class ButtonComponent extends Field_1.default {
426
426
  }
427
427
  // TODO: check for error response here
428
428
  if (settings.state !== params.state) {
429
- (_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'));
430
430
  return;
431
431
  }
432
+ if (settings.sessionId) {
433
+ params.sessionId = settings.sessionId;
434
+ }
432
435
  // Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
433
436
  let requestPromise = Promise.resolve();
434
437
  if (lodash_1.default.has(this, 'root.form.config.oauth') &&
@@ -457,6 +460,11 @@ class ButtonComponent extends Field_1.default {
457
460
  })
458
461
  .catch((err) => {
459
462
  var _a;
463
+ console.log(err);
464
+ if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
465
+ this._handleOauthSessionExpired();
466
+ return;
467
+ }
460
468
  (_a = this.root) === null || _a === void 0 ? void 0 : _a.onSubmissionError(err);
461
469
  });
462
470
  }
@@ -464,7 +472,7 @@ class ButtonComponent extends Field_1.default {
464
472
  catch (error) {
465
473
  if (error.name !== 'SecurityError' &&
466
474
  (error.name !== 'Error' || error.message !== 'Permission denied')) {
467
- (_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}`));
468
476
  }
469
477
  }
470
478
  if (!popup || popup.closed || popup.closed === undefined) {
@@ -472,6 +480,12 @@ class ButtonComponent extends Field_1.default {
472
480
  }
473
481
  }, 100);
474
482
  }
483
+ _handleOauthSessionExpired() {
484
+ var _a;
485
+ (_a = this.root) === null || _a === void 0 ? void 0 : _a.setAlert('warning', this.t('oauthSessionExpired'));
486
+ this.loading = true;
487
+ setTimeout(() => window.location.reload(), 2000);
488
+ }
475
489
  get oauthComponentPath() {
476
490
  const pathArray = (0, utils_1.getArrayFromComponentPath)(this.path);
477
491
  return lodash_1.default.chain(pathArray)
@@ -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
  },