@formio/js 5.1.0-dev.5936.81a1533 → 5.1.0-dev.5939.f5aa9d6

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 (77) hide show
  1. package/dist/formio.builder.css +1 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.form.css +1 -0
  4. package/dist/formio.form.js +20 -42
  5. package/dist/formio.form.min.css +1 -1
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.full.css +1 -0
  8. package/dist/formio.full.js +22 -44
  9. package/dist/formio.full.min.css +1 -1
  10. package/dist/formio.full.min.js +1 -1
  11. package/dist/formio.js +7 -7
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.utils.js +8 -8
  14. package/dist/formio.utils.min.js +1 -1
  15. package/lib/cjs/Element.d.ts +2 -1
  16. package/lib/cjs/Element.js +6 -4
  17. package/lib/cjs/PDFBuilder.d.ts +1 -0
  18. package/lib/cjs/PDFBuilder.js +8 -8
  19. package/lib/cjs/Webform.d.ts +2 -2
  20. package/lib/cjs/Webform.js +4 -3
  21. package/lib/cjs/WebformBuilder.d.ts +1 -1
  22. package/lib/cjs/WebformBuilder.js +27 -8
  23. package/lib/cjs/components/_classes/component/Component.js +5 -0
  24. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  25. package/lib/cjs/components/_classes/input/Input.js +2 -2
  26. package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -2
  27. package/lib/cjs/components/address/Address.js +1 -1
  28. package/lib/cjs/components/editgrid/EditGrid.d.ts +0 -1
  29. package/lib/cjs/components/editgrid/EditGrid.js +0 -8
  30. package/lib/cjs/components/radio/Radio.d.ts +9 -4
  31. package/lib/cjs/components/radio/Radio.js +40 -76
  32. package/lib/cjs/components/select/Select.d.ts +1 -0
  33. package/lib/cjs/components/select/Select.js +19 -3
  34. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  35. package/lib/cjs/components/textfield/TextField.js +6 -1
  36. package/lib/cjs/formio.form.js +2 -2
  37. package/lib/cjs/translations/en.d.ts +1 -232
  38. package/lib/cjs/translations/en.js +4 -2
  39. package/lib/cjs/utils/formUtils.d.ts +2 -2
  40. package/lib/cjs/utils/index.d.ts +2 -2
  41. package/lib/cjs/utils/utils.js +10 -3
  42. package/lib/mjs/Element.d.ts +2 -1
  43. package/lib/mjs/Element.js +6 -4
  44. package/lib/mjs/PDFBuilder.d.ts +1 -0
  45. package/lib/mjs/PDFBuilder.js +8 -8
  46. package/lib/mjs/Webform.d.ts +2 -2
  47. package/lib/mjs/Webform.js +4 -3
  48. package/lib/mjs/WebformBuilder.d.ts +1 -1
  49. package/lib/mjs/WebformBuilder.js +26 -8
  50. package/lib/mjs/components/_classes/component/Component.js +5 -0
  51. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  52. package/lib/mjs/components/_classes/input/Input.js +2 -2
  53. package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -2
  54. package/lib/mjs/components/address/Address.js +1 -1
  55. package/lib/mjs/components/editgrid/EditGrid.d.ts +0 -1
  56. package/lib/mjs/components/editgrid/EditGrid.js +0 -8
  57. package/lib/mjs/components/radio/Radio.d.ts +9 -4
  58. package/lib/mjs/components/radio/Radio.js +40 -75
  59. package/lib/mjs/components/select/Select.d.ts +1 -0
  60. package/lib/mjs/components/select/Select.js +19 -3
  61. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  62. package/lib/mjs/components/textfield/TextField.js +6 -1
  63. package/lib/mjs/formio.form.js +1 -1
  64. package/lib/mjs/translations/en.d.ts +1 -232
  65. package/lib/mjs/translations/en.js +8 -47
  66. package/lib/mjs/utils/formUtils.d.ts +2 -2
  67. package/lib/mjs/utils/index.d.ts +2 -2
  68. package/lib/mjs/utils/utils.js +10 -2
  69. package/package.json +2 -2
  70. package/lib/cjs/i18n.d.ts +0 -13
  71. package/lib/cjs/i18n.js +0 -19
  72. package/lib/cjs/utils/i18n.d.ts +0 -19
  73. package/lib/cjs/utils/i18n.js +0 -120
  74. package/lib/mjs/i18n.d.ts +0 -13
  75. package/lib/mjs/i18n.js +0 -14
  76. package/lib/mjs/utils/i18n.d.ts +0 -19
  77. package/lib/mjs/utils/i18n.js +0 -112
@@ -659,7 +659,7 @@ export default class NestedComponent extends Field {
659
659
  }
660
660
  validationProcessor({ scope, data, row, instance, paths }, flags) {
661
661
  const { dirty } = flags;
662
- if (this.root.hasSubWizards && this.page !== this.root.page) {
662
+ if (this.root && this.root.hasSubWizards && this.page !== this.root.page) {
663
663
  instance = this.componentsMap?.hasOwnProperty(paths.dataPath)
664
664
  ? this.componentsMap[paths.dataPath]
665
665
  : this.getComponent(paths.dataPath);
@@ -795,8 +795,10 @@ export default class NestedComponent extends Field {
795
795
  return this.data;
796
796
  }
797
797
  resetValue() {
798
- super.resetValue();
798
+ // Reset values of child components first, then reset the parent one, otherwise it will restore the default
799
+ // value of parent component and clear it one by one while resetting child components
799
800
  this.getComponents().forEach((comp) => comp.resetValue());
801
+ super.resetValue();
800
802
  this.setPristine(true);
801
803
  }
802
804
  get dataReady() {
@@ -245,7 +245,7 @@ export default class AddressComponent extends ContainerComponent {
245
245
  if (this.manualMode) {
246
246
  this.restoreComponentsContext();
247
247
  }
248
- if (changed || !_.isEmpty(value) && flags.fromSubmission) {
248
+ if (changed || !_.isEmpty(value) && flags.fromSubmission || flags.resetValue) {
249
249
  this.redraw();
250
250
  }
251
251
  return changed;
@@ -101,7 +101,6 @@ export default class EditGridComponent extends NestedArrayComponent {
101
101
  changeState(changed: any, flags: any): void;
102
102
  openWhenEmpty(): void;
103
103
  restoreRowContext(editRow: any, flags?: {}): void;
104
- emptyRows(): void;
105
104
  hasChanged: (newValue: any, oldValue: any) => boolean;
106
105
  }
107
106
  import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
@@ -1192,13 +1192,5 @@ export default class EditGridComponent extends NestedArrayComponent {
1192
1192
  this.setNestedValue(component, editRow.data, flags);
1193
1193
  });
1194
1194
  }
1195
- emptyRows() {
1196
- this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
1197
- this.editRows = [];
1198
- }
1199
- resetValue() {
1200
- super.resetValue();
1201
- this.emptyRows();
1202
- }
1203
1195
  }
1204
1196
  EditGridComponent.prototype.hasChanged = Component.prototype.hasChanged;
@@ -16,6 +16,7 @@ export default class RadioComponent extends ListComponent {
16
16
  static savedValueTypes(schema: any): any[];
17
17
  constructor(component: any, options: any, data: any);
18
18
  previousValue: any;
19
+ uncheckValue(flags?: {}): void;
19
20
  get inputInfo(): any;
20
21
  get emptyValue(): string;
21
22
  get isRadio(): boolean;
@@ -27,8 +28,8 @@ export default class RadioComponent extends ListComponent {
27
28
  itemsLoadedResolve: ((value: any) => void) | undefined;
28
29
  optionsLoaded: boolean | undefined;
29
30
  loadedOptions: any[] | undefined;
30
- valuesMap: Map<any, any> | undefined;
31
31
  beforeSubmit(): Promise<any>;
32
+ convertValues(values: any): any;
32
33
  render(): string;
33
34
  attach(element: any): Promise<void>;
34
35
  detach(element: any): void;
@@ -36,14 +37,18 @@ export default class RadioComponent extends ListComponent {
36
37
  validateValueAvailability(setting: any, value: any): boolean;
37
38
  getValueAsString(value: any, options?: {}): any;
38
39
  setValueAt(index: any, value: any): void;
39
- prepareValue(item: any, options?: {}): any;
40
- getValueByInput(input: any): any;
41
40
  loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
42
41
  loadItemsFromMetadata(): void;
43
42
  setItems(items: any): void;
44
43
  setSelectedClasses(): void;
45
- setMetadata(value: any): void;
46
44
  updateValue(value: any, flags: any): boolean;
47
45
  currentValue: any;
46
+ /**
47
+ * Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
48
+ * @param {*} value - The value to normalize
49
+ * @returns {*} - Returns the normalized value
50
+ */
51
+ convertByDataType(value: any): any;
52
+ normalizeValue(value: any): any;
48
53
  }
49
54
  import ListComponent from '../_classes/list/ListComponent';
@@ -1,8 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import ListComponent from '../_classes/list/ListComponent';
3
3
  import { Formio } from '../../Formio';
4
- import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
5
- import { v4 as uuidv4 } from 'uuid';
4
+ import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils';
6
5
  export default class RadioComponent extends ListComponent {
7
6
  static schema(...extend) {
8
7
  return ListComponent.schema({
@@ -81,13 +80,15 @@ export default class RadioComponent extends ListComponent {
81
80
  }
82
81
  return defaultValue;
83
82
  }
84
- resetValue() {
83
+ uncheckValue(flags = {}) {
85
84
  this.unset();
86
85
  this.setValue(this.emptyValue, {
87
86
  noUpdateEvent: true,
88
87
  noValidate: true,
89
88
  resetValue: true
90
89
  });
90
+ this.triggerChange(flags);
91
+ this.setSelectedClasses();
91
92
  }
92
93
  get inputInfo() {
93
94
  const info = super.elementInfo();
@@ -143,7 +144,6 @@ export default class RadioComponent extends ListComponent {
143
144
  });
144
145
  this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
145
146
  this.loadedOptions = [];
146
- this.valuesMap = new Map();
147
147
  if (!this.visible) {
148
148
  this.itemsLoadedResolve();
149
149
  }
@@ -155,6 +155,12 @@ export default class RadioComponent extends ListComponent {
155
155
  this.dataReady.then(() => res(true));
156
156
  });
157
157
  }
158
+ convertValues(values) {
159
+ if (this.options.renderMode === 'html' && this.type === 'radio') {
160
+ return values.map(x => ({ ...x, value: this.convertByDataType(x.value) }));
161
+ }
162
+ return values;
163
+ }
158
164
  render() {
159
165
  if (!this.optionsLoaded) {
160
166
  return super.render(this.renderTemplate('loader'));
@@ -162,7 +168,7 @@ export default class RadioComponent extends ListComponent {
162
168
  return super.render(this.renderTemplate('radio', {
163
169
  input: this.inputInfo,
164
170
  inline: this.component.inline,
165
- values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,
171
+ values: this.component.dataSrc === 'values' ? this.convertValues(this.component.values) : this.loadedOptions,
166
172
  value: this.dataValue,
167
173
  row: this.row,
168
174
  }));
@@ -183,12 +189,9 @@ export default class RadioComponent extends ListComponent {
183
189
  if (!_.isString(this.dataValue)) {
184
190
  dataValue = _.toString(this.dataValue);
185
191
  }
186
- if (this.isSelectURL) {
187
- const valueKey = this.loadedOptions[index].value;
188
- const optionValue = this.valuesMap.has(valueKey)
189
- ? this.valuesMap.get(valueKey)
190
- : valueKey;
191
- input.checked = _.isEqual(this.normalizeValue(optionValue), this.dataValue);
192
+ if (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) {
193
+ const optionValue = this.component.dataType === 'string' ? JSON.stringify(this.loadedOptions[index].value) : this.loadedOptions[index].value;
194
+ input.checked = _.isEqual(optionValue, this.dataValue);
192
195
  }
193
196
  else {
194
197
  input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));
@@ -225,14 +228,9 @@ export default class RadioComponent extends ListComponent {
225
228
  let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
226
229
  this.refs.input.forEach((input, index) => {
227
230
  if (input.checked) {
228
- if (!this.isSelectURL) {
229
- value = input.value;
230
- return;
231
- }
232
- const optionValue = this.loadedOptions[index].value;
233
- value = this.valuesMap.has(optionValue)
234
- ? this.valuesMap.get(optionValue)
235
- : optionValue;
231
+ value = (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) ?
232
+ this.loadedOptions[index].value :
233
+ input.value;
236
234
  }
237
235
  });
238
236
  return value;
@@ -276,8 +274,8 @@ export default class RadioComponent extends ListComponent {
276
274
  }
277
275
  setValueAt(index, value) {
278
276
  if (this.refs.input && this.refs.input[index] && value !== null && value !== undefined) {
279
- const inputValue = this.getValueByInput(this.refs.input[index]);
280
- this.refs.input[index].checked = _.isEqual(inputValue, value);
277
+ const inputValue = this.refs.input[index].value;
278
+ this.refs.input[index].checked = (inputValue === value.toString());
281
279
  }
282
280
  }
283
281
  get shouldLoad() {
@@ -287,23 +285,6 @@ export default class RadioComponent extends ListComponent {
287
285
  }
288
286
  return super.shouldLoad;
289
287
  }
290
- prepareValue(item, options = {}) {
291
- const value = this.component.valueProperty && !options.skipValueProperty
292
- ? _.get(item, this.component.valueProperty)
293
- : item;
294
- if (this.component.type === 'radio' && typeof value !== 'string') {
295
- const uuid = uuidv4();
296
- this.valuesMap.set(uuid, value);
297
- return uuid;
298
- }
299
- return value;
300
- }
301
- getValueByInput(input) {
302
- const inputValue = input.value;
303
- return this.valuesMap.has(inputValue)
304
- ? this.valuesMap.get(inputValue)
305
- : inputValue;
306
- }
307
288
  loadItems(url, search, headers, options, method, body) {
308
289
  if (this.optionsLoaded) {
309
290
  this.itemsLoadedResolve();
@@ -354,7 +335,7 @@ export default class RadioComponent extends ListComponent {
354
335
  label: this.itemTemplate(item)
355
336
  };
356
337
  if (_.isEqual(item, this.selectData || _.pick(this.dataValue, _.keys(item)))) {
357
- this.loadedOptions[i].value = this.prepareValue(this.dataValue, { skipValueProperty: true });
338
+ this.loadedOptions[i].value = this.dataValue;
358
339
  }
359
340
  });
360
341
  this.optionsLoaded = true;
@@ -364,15 +345,12 @@ export default class RadioComponent extends ListComponent {
364
345
  const listData = [];
365
346
  items?.forEach((item, i) => {
366
347
  const valueAtProperty = _.get(item, this.component.valueProperty);
367
- const value = this.prepareValue(item);
368
- const label = this.component.valueProperty
369
- ? this.itemTemplate(item, valueAtProperty, i)
370
- : this.itemTemplate(item, item, i);
371
- this.loadedOptions[i] = { label, value };
372
- listData.push(this.templateData[i]);
373
- if (this.valuesMap.has(value)) {
374
- this.templateData[value] = this.templateData[i];
375
- }
348
+ this.loadedOptions[i] = {
349
+ value: this.component.valueProperty ? valueAtProperty : item,
350
+ label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
351
+ };
352
+ listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
353
+ const value = this.loadedOptions[i].value;
376
354
  if (!this.isRadio && (_.isObject(value) || _.isBoolean(value) || _.isUndefined(value))) {
377
355
  this.loadedOptions[i].invalid = true;
378
356
  }
@@ -395,11 +373,7 @@ export default class RadioComponent extends ListComponent {
395
373
  const value = this.dataValue;
396
374
  this.refs.wrapper.forEach((wrapper, index) => {
397
375
  const input = this.refs.input[index];
398
- const checked = (value === undefined || value === null)
399
- ? false
400
- : (input.type === 'checkbox')
401
- ? value[input.value] || input.checked
402
- : _.isEqual(this.normalizeValue(this.getValueByInput(input)), value);
376
+ const checked = (value === undefined || value === null) ? false : (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
403
377
  if (checked) {
404
378
  //add class to container when selected
405
379
  this.addClass(wrapper, this.optionSelectedClass);
@@ -413,25 +387,10 @@ export default class RadioComponent extends ListComponent {
413
387
  });
414
388
  }
415
389
  }
416
- setMetadata(value) {
417
- let key = value;
418
- if (typeof value !== 'string') {
419
- const checkedInput = Array.prototype.find.call(this.refs.input ?? [], (input => input.type === 'radio' && input.getAttribute('checked')));
420
- key = checkedInput?.value || key;
421
- }
422
- if (this.isSelectURL && this.templateData && this.templateData[key]) {
423
- const submission = this.root.submission;
424
- if (!submission.metadata.selectData) {
425
- submission.metadata.selectData = {};
426
- }
427
- _.set(submission.metadata.selectData, this.path, this.templateData[key]);
428
- }
429
- }
430
390
  updateValue(value, flags) {
431
391
  const changed = super.updateValue(value, flags);
432
392
  if (changed) {
433
393
  this.setSelectedClasses();
434
- this.setMetadata(this.dataValue);
435
394
  }
436
395
  if (!flags || !flags.modified || !this.isRadio) {
437
396
  if (changed) {
@@ -443,9 +402,7 @@ export default class RadioComponent extends ListComponent {
443
402
  this.currentValue = this.dataValue;
444
403
  const shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;
445
404
  if (shouldResetValue) {
446
- this.resetValue();
447
- this.triggerChange(flags);
448
- this.setSelectedClasses();
405
+ this.uncheckValue(flags);
449
406
  }
450
407
  this.previousValue = this.dataValue;
451
408
  return changed;
@@ -455,7 +412,7 @@ export default class RadioComponent extends ListComponent {
455
412
  * @param {*} value - The value to normalize
456
413
  * @returns {*} - Returns the normalized value
457
414
  */
458
- normalizeValue(value) {
415
+ convertByDataType(value) {
459
416
  const dataType = this.component.dataType || 'auto';
460
417
  if (value === this.emptyValue) {
461
418
  return value;
@@ -487,9 +444,17 @@ export default class RadioComponent extends ListComponent {
487
444
  value = !(!value || value.toString() === 'false');
488
445
  break;
489
446
  }
490
- return super.normalizeValue(value);
447
+ return value;
491
448
  }
492
- isSingleInputValue() {
493
- return true;
449
+ normalizeValue(value) {
450
+ const valueConverted = this.convertByDataType(value);
451
+ if (this.isSelectURL && this.templateData && this.templateData[valueConverted]) {
452
+ const submission = this.root.submission;
453
+ if (!submission.metadata.selectData) {
454
+ submission.metadata.selectData = {};
455
+ }
456
+ _.set(submission.metadata.selectData, this.path, this.templateData[valueConverted]);
457
+ }
458
+ return super.normalizeValue(valueConverted);
494
459
  }
495
460
  }
@@ -89,6 +89,7 @@ export default class SelectComponent extends ListComponent {
89
89
  disableInfiniteScroll(): void;
90
90
  set serverCount(value: any);
91
91
  get serverCount(): any;
92
+ shouldResetChoicesItems(items: any): boolean;
92
93
  setItems(items: any, fromSearch: any): void;
93
94
  selectItems: any;
94
95
  set downloadedResources(value: any);
@@ -359,6 +359,18 @@ export default class SelectComponent extends ListComponent {
359
359
  this.downloadedResources.serverCount = this.downloadedResources.length;
360
360
  this.serverCount = this.downloadedResources.length;
361
361
  }
362
+ shouldResetChoicesItems(items) {
363
+ if (this.choices._store.choices.length !== items.length) {
364
+ return true;
365
+ }
366
+ for (let item of items) {
367
+ const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
368
+ if (!choicesItem) {
369
+ return true;
370
+ }
371
+ }
372
+ return false;
373
+ }
362
374
  /* eslint-disable max-statements */
363
375
  setItems(items, fromSearch) {
364
376
  this.selectItems = items;
@@ -444,7 +456,7 @@ export default class SelectComponent extends ListComponent {
444
456
  this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _.get(item, this.component.idPath, String(index)));
445
457
  });
446
458
  if (this.choices) {
447
- this.choices.setChoices(this.selectOptions, 'value', 'label', true);
459
+ this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
448
460
  }
449
461
  else if (this.loading) {
450
462
  // Re-attach select input.
@@ -935,8 +947,9 @@ export default class SelectComponent extends ListComponent {
935
947
  });
936
948
  }
937
949
  // Add value options.
950
+ const value = this.undoValueTyping(this.dataValue);
938
951
  this.addValueOptions();
939
- this.setChoicesValue(this.dataValue);
952
+ this.setChoicesValue(value);
940
953
  if (this.isSelectResource && this.refs.addResource) {
941
954
  this.addEventListener(this.refs.addResource, 'click', (event) => {
942
955
  event.preventDefault();
@@ -1248,7 +1261,7 @@ export default class SelectComponent extends ListComponent {
1248
1261
  }
1249
1262
  _.set(submission.metadata.selectData, this.path, templateData);
1250
1263
  }
1251
- if (flags.resetValue && this.root?.submission && !this.options.readOnly) {
1264
+ if (flags.resetValue && !flags.fromSubmission && this.root?.submission && !this.options.readOnly) {
1252
1265
  const submission = this.root.submission;
1253
1266
  if (!submission.metadata) {
1254
1267
  submission.metadata = {};
@@ -1312,6 +1325,9 @@ export default class SelectComponent extends ListComponent {
1312
1325
  this.lazyLoadInit = true;
1313
1326
  const searchProperty = this.component.searchField || this.component.valueProperty;
1314
1327
  this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);
1328
+ this.itemsLoaded.then(() => {
1329
+ this.setChoicesValue(value, hasPreviousValue, flags);
1330
+ });
1315
1331
  return changed;
1316
1332
  }
1317
1333
  // Add the value options.
@@ -8,6 +8,12 @@ export default class SelectBoxesComponent extends RadioComponent {
8
8
  * @returns {boolean} - If the value is empty.
9
9
  */
10
10
  isEmpty(value?: any): boolean;
11
+ /**
12
+ * Normalize values coming into updateValue.
13
+ * @param {any} value - The value to normalize.
14
+ * @returns {*} - The normalized value
15
+ */
16
+ normalizeValue(value: any): any;
11
17
  setInputsDisabled(value: any, onlyUnchecked: any): void;
12
18
  checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
13
19
  }
@@ -114,7 +114,12 @@ export default class TextFieldComponent extends Input {
114
114
  // If no value is provided, then set the defaultValue.
115
115
  if (!value.value) {
116
116
  const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
117
- value.value = Array.isArray(defaultValue) ? defaultValue[0] : defaultValue;
117
+ if (Array.isArray(defaultValue)) {
118
+ value.value = _.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
119
+ }
120
+ else {
121
+ value.value = _.isObject(defaultValue) ? defaultValue.value : defaultValue;
122
+ }
118
123
  }
119
124
  return value;
120
125
  }
@@ -11,7 +11,7 @@ import Utils from './utils';
11
11
  import Licenses from './licenses';
12
12
  import EventEmitter from './EventEmitter';
13
13
  import Webform from './Webform';
14
- import { I18n } from './utils/i18n';
14
+ import { I18n } from '@formio/core';
15
15
  import { Evaluator, registerEvaluator } from './utils';
16
16
  Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
17
17
  Formio.requireLibrary(name, name, path, true)
@@ -1,233 +1,2 @@
1
- declare const _default: {
2
- unsavedRowsError: string;
3
- invalidRowsError: string;
4
- invalidRowError: string;
5
- invalidOption: string;
6
- invalidDay: string;
7
- complete: string;
8
- error: string;
9
- errorListHotkey: string;
10
- errorsListNavigationMessage: string;
11
- submitError: string;
12
- required: string;
13
- unique: string;
14
- array: string;
15
- array_nonempty: string;
16
- nonarray: string;
17
- select: string;
18
- pattern: string;
19
- minLength: string;
20
- maxLength: string;
21
- minWords: string;
22
- maxWords: string;
23
- min: string;
24
- max: string;
25
- maxDate: string;
26
- minDate: string;
27
- maxYear: string;
28
- minYear: string;
29
- minSelectedCount: string;
30
- maxSelectedCount: string;
31
- invalid_email: string;
32
- invalid_url: string;
33
- invalid_regex: string;
34
- invalid_date: string;
35
- invalid_day: string;
36
- invalidValueProperty: string;
37
- mask: string;
38
- valueIsNotAvailable: string;
39
- stripe: string;
40
- month: string;
41
- day: string;
42
- year: string;
43
- january: string;
44
- february: string;
45
- march: string;
46
- april: string;
47
- may: string;
48
- june: string;
49
- july: string;
50
- august: string;
51
- september: string;
52
- october: string;
53
- november: string;
54
- december: string;
55
- next: string;
56
- previous: string;
57
- cancel: string;
58
- submit: string;
59
- confirmCancel: string;
60
- saveDraftInstanceError: string;
61
- saveDraftAuthError: string;
62
- restoreDraftInstanceError: string;
63
- saveDraftError: string;
64
- restoreDraftError: string;
65
- time: string;
66
- cancelButtonAriaLabel: string;
67
- previousButtonAriaLabel: string;
68
- nextButtonAriaLabel: string;
69
- submitButtonAriaLabel: string;
70
- reCaptchaTokenValidationError: string;
71
- reCaptchaTokenNotSpecifiedError: string;
72
- apiKey: string;
73
- typeRemaining: string;
74
- typeCount: string;
75
- requiredDayField: string;
76
- requiredDayEmpty: string;
77
- requiredMonthField: string;
78
- requiredYearField: string;
79
- formNotReady: string;
80
- noFormElement: string;
81
- notUniqueKey: string;
82
- newFormSchema: string;
83
- missingUrl: string;
84
- urlNotAttachedToBtn: string;
85
- loadingProjectSettingsError: string;
86
- sessionStorageSupportError: string;
87
- builderUniqueError: string;
88
- pageNotFound: string;
89
- noDragInfoError: string;
90
- addonSupportTypeError: string;
91
- setPathError: string;
92
- calculatedPathDeprecation: string;
93
- unknownTemplate: string;
94
- unknownComponent: string;
95
- renderTemplateFunctionDeprecation: string;
96
- whenReadyDeprecation: string;
97
- loadResourcesError: string;
98
- noSelectDataConfiguration: string;
99
- indexedDBSupportError: string;
100
- caretPositionSavingError: string;
101
- iteratableRowsError: string;
102
- checkRowDeprecation: string;
103
- noOAuthBtn: string;
104
- noOAuthConfiguration: string;
105
- oAuthErrorsTitle: string;
106
- noOAuthFormUrl: string;
107
- oAuthStateError: string;
108
- componentInvalidRowValidation: string;
109
- videoPlayerNotFound: string;
110
- synchronizationFailed: string;
111
- fileWithDuplicatedNameInProgress: string;
112
- fileWithDuplicatedNameLoaded: string;
113
- nestedForm: string;
114
- noDataProvided: string;
115
- subformSubmissionLoadingError: string;
116
- noDelimiterSet: string;
117
- noSiteKey: string;
118
- failedToNormalize: string;
119
- failedToCompareItems: string;
120
- editorFocusError: string;
121
- quillImageUploadFailed: string;
122
- noFilesSelected: string;
123
- needConfigurationForQuill: string;
124
- waitPdfConverting: string;
125
- uploading: string;
126
- pasteBelow: string;
127
- copy: string;
128
- move: string;
129
- edit: string;
130
- editJson: string;
131
- remove: string;
132
- clickToSetValue: string;
133
- words: string;
134
- characters: string;
135
- addAnother: string;
136
- yes: string;
137
- no: string;
138
- wantToClearData: string;
139
- yesDelete: string;
140
- waitFileProcessing: string;
141
- wrongFileType: string;
142
- fileTooSmall: string;
143
- fileTooBig: string;
144
- noFileService: string;
145
- fileProcessingFailed: string;
146
- readyForUpload: string;
147
- readyForRemovingFromStorage: string;
148
- preparingFileToRemove: string;
149
- succefullyRemoved: string;
150
- succefullyUploaded: string;
151
- maxSelectItems: string;
152
- minSelectItems: string;
153
- clickToSign: string;
154
- surveyQuestion: string;
155
- surveyQuestionValue: string;
156
- success: string;
157
- noResultsFound: string;
158
- noChoices: string;
159
- typeToSearch: string;
160
- loading: string;
161
- help: string;
162
- component: string;
163
- save: string;
164
- preview: string;
165
- dragAndDropComponent: string;
166
- searchFields: string;
167
- noMatchesFound: string;
168
- fileName: string;
169
- size: string;
170
- type: string;
171
- gallery: string;
172
- camera: string;
173
- dropFilesToAttach: string;
174
- useCamera: string;
175
- browse: string;
176
- takePicture: string;
177
- switchToFileUpload: string;
178
- completeStatus: string;
179
- noStorageSet: string;
180
- noFileApiSupport: string;
181
- noFormDataSupport: string;
182
- noProgressSupport: string;
183
- close: string;
184
- addResource: string;
185
- autocomplete: string;
186
- showPreview: string;
187
- hidePreview: string;
188
- createPage: string;
189
- page: string;
190
- closeBtnDescription: string;
191
- cancelBtnDescription: string;
192
- saveBtnDescription: string;
193
- addOrRemove: string;
194
- anyFileTypesAllowed: string;
195
- allowedFileTypes: string;
196
- syncing: string;
197
- syncNow: string;
198
- pressToOpen: string;
199
- browseToAttachFileFor: string;
200
- or: string;
201
- numericOnly: string;
202
- uploadPdfFile: string;
203
- dropToStart: string;
204
- expand: string;
205
- collapse: string;
206
- add: string;
207
- delete: string;
208
- revert: string;
209
- removeBtnPressToRemove: string;
210
- file: string;
211
- captureVideo: string;
212
- captureAudio: string;
213
- captureImage: string;
214
- browseFiles: string;
215
- noComponentsSetInGrid: string;
216
- sortAscending: string;
217
- sortDescending: string;
218
- filter: string;
219
- clear: string;
220
- showItemsWithValue: string;
221
- gridItemsPerPage: string;
222
- gridAllItems: string;
223
- recordsSelectedOnPage: string;
224
- recordsSelectedInTable: string;
225
- gridSelectAll: string;
226
- itemsInTable: string;
227
- clearSelection: string;
228
- editGridRow: string;
229
- deleteGridRow: string;
230
- selected: string;
231
- actions: string;
232
- };
1
+ declare const _default: any;
233
2
  export default _default;