@formio/js 5.1.0-dev.6159.811e953 → 5.1.0-dev.6166.dce1c56

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 (73) hide show
  1. package/dist/formio.form.js +22 -44
  2. package/dist/formio.form.min.js +1 -1
  3. package/dist/formio.full.js +24 -46
  4. package/dist/formio.full.min.js +1 -1
  5. package/dist/formio.js +7 -7
  6. package/dist/formio.min.js +1 -1
  7. package/dist/formio.utils.js +7 -7
  8. package/dist/formio.utils.min.js +1 -1
  9. package/lib/cjs/Element.d.ts +2 -1
  10. package/lib/cjs/Element.js +6 -4
  11. package/lib/cjs/PDFBuilder.d.ts +1 -0
  12. package/lib/cjs/PDFBuilder.js +8 -8
  13. package/lib/cjs/Webform.d.ts +2 -2
  14. package/lib/cjs/Webform.js +4 -3
  15. package/lib/cjs/WebformBuilder.d.ts +1 -1
  16. package/lib/cjs/WebformBuilder.js +20 -8
  17. package/lib/cjs/components/Components.js +7 -1
  18. package/lib/cjs/components/_classes/component/Component.js +15 -5
  19. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  20. package/lib/cjs/components/_classes/input/Input.js +2 -2
  21. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  22. package/lib/cjs/components/_classes/nested/NestedComponent.js +13 -3
  23. package/lib/cjs/components/address/Address.js +1 -1
  24. package/lib/cjs/components/datamap/DataMap.js +7 -2
  25. package/lib/cjs/components/editgrid/EditGrid.d.ts +0 -1
  26. package/lib/cjs/components/editgrid/EditGrid.js +0 -8
  27. package/lib/cjs/components/radio/Radio.d.ts +1 -0
  28. package/lib/cjs/components/radio/Radio.js +4 -4
  29. package/lib/cjs/components/select/Select.js +1 -1
  30. package/lib/cjs/components/textarea/TextArea.js +6 -1
  31. package/lib/cjs/components/textfield/TextField.js +6 -1
  32. package/lib/cjs/formio.form.js +2 -2
  33. package/lib/cjs/translations/en.d.ts +1 -233
  34. package/lib/cjs/translations/en.js +4 -2
  35. package/lib/cjs/utils/formUtils.d.ts +2 -2
  36. package/lib/cjs/utils/index.d.ts +2 -2
  37. package/lib/mjs/Element.d.ts +2 -1
  38. package/lib/mjs/Element.js +6 -4
  39. package/lib/mjs/PDFBuilder.d.ts +1 -0
  40. package/lib/mjs/PDFBuilder.js +8 -8
  41. package/lib/mjs/Webform.d.ts +2 -2
  42. package/lib/mjs/Webform.js +4 -3
  43. package/lib/mjs/WebformBuilder.d.ts +1 -1
  44. package/lib/mjs/WebformBuilder.js +19 -8
  45. package/lib/mjs/components/Components.js +7 -1
  46. package/lib/mjs/components/_classes/component/Component.js +15 -5
  47. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  48. package/lib/mjs/components/_classes/input/Input.js +2 -2
  49. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  50. package/lib/mjs/components/_classes/nested/NestedComponent.js +13 -3
  51. package/lib/mjs/components/address/Address.js +1 -1
  52. package/lib/mjs/components/datamap/DataMap.js +7 -2
  53. package/lib/mjs/components/editgrid/EditGrid.d.ts +0 -1
  54. package/lib/mjs/components/editgrid/EditGrid.js +0 -8
  55. package/lib/mjs/components/radio/Radio.d.ts +1 -0
  56. package/lib/mjs/components/radio/Radio.js +4 -4
  57. package/lib/mjs/components/select/Select.js +1 -1
  58. package/lib/mjs/components/textarea/TextArea.js +6 -1
  59. package/lib/mjs/components/textfield/TextField.js +6 -1
  60. package/lib/mjs/formio.form.js +1 -1
  61. package/lib/mjs/translations/en.d.ts +1 -233
  62. package/lib/mjs/translations/en.js +7 -47
  63. package/lib/mjs/utils/formUtils.d.ts +2 -2
  64. package/lib/mjs/utils/index.d.ts +2 -2
  65. package/package.json +2 -2
  66. package/lib/cjs/i18n.d.ts +0 -13
  67. package/lib/cjs/i18n.js +0 -19
  68. package/lib/cjs/utils/i18n.d.ts +0 -19
  69. package/lib/cjs/utils/i18n.js +0 -120
  70. package/lib/mjs/i18n.d.ts +0 -13
  71. package/lib/mjs/i18n.js +0 -14
  72. package/lib/mjs/utils/i18n.d.ts +0 -19
  73. package/lib/mjs/utils/i18n.js +0 -112
@@ -170,10 +170,11 @@ export default class Element {
170
170
  /**
171
171
  * Translate a text using the i18n system.
172
172
  * @param {string|Array<string>} text - The i18n identifier.
173
+ * @param {any} data - contextual data object containing data, component, row, etc.
173
174
  * @param {...any} args - The arguments to pass to the i18n translation.
174
175
  * @returns {string} - The translated text.
175
176
  */
176
- t(text: string | Array<string>, ...args: any[]): string;
177
+ t(text: string | Array<string>, data: any, ...args: any[]): string;
177
178
  /**
178
179
  * Alias to create a text node.
179
180
  * @param {string} text - The text to create.
@@ -8,8 +8,9 @@ const moment_1 = __importDefault(require("moment"));
8
8
  const vanilla_text_mask_1 = __importDefault(require("@formio/vanilla-text-mask"));
9
9
  const EventEmitter_1 = __importDefault(require("./EventEmitter"));
10
10
  const Formio_1 = require("./Formio");
11
- const i18n_1 = require("./utils/i18n");
12
11
  const utils_1 = __importDefault(require("./utils"));
12
+ const core_1 = require("@formio/core");
13
+ const en_1 = __importDefault(require("./translations/en"));
13
14
  /**
14
15
  * The root component for all elements within the Form.io renderer.
15
16
  */
@@ -44,7 +45,7 @@ class Element {
44
45
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.language) {
45
46
  this.options.i18n.language = this.options.language;
46
47
  }
47
- this.options.i18next = this.i18next = this.options.i18next || i18n_1.I18n.init(this.options.i18n);
48
+ this.options.i18next = this.i18next = this.options.i18next || core_1.I18n.init(Object.assign({ en: en_1.default }, this.options.i18n));
48
49
  /**
49
50
  * An instance of the EventEmitter class to handle the emitting and registration of events.
50
51
  * @type {EventEmitter}
@@ -392,11 +393,12 @@ class Element {
392
393
  /**
393
394
  * Translate a text using the i18n system.
394
395
  * @param {string|Array<string>} text - The i18n identifier.
396
+ * @param {any} data - contextual data object containing data, component, row, etc.
395
397
  * @param {...any} args - The arguments to pass to the i18n translation.
396
398
  * @returns {string} - The translated text.
397
399
  */
398
- t(text, ...args) {
399
- return this.i18next ? this.i18next.t(text, ...args) : text;
400
+ t(text, data, ...args) {
401
+ return this.i18next ? this.i18next.t(text, data, ...args) : text;
400
402
  }
401
403
  /**
402
404
  * Alias to create a text node.
@@ -51,5 +51,6 @@ export default class PDFBuilder extends WebformBuilder {
51
51
  onDropzoneDrop(e: any): boolean;
52
52
  dropEvent: any;
53
53
  onDragEnd(e: any): void;
54
+ repeatablePathsComps: any[] | undefined;
54
55
  }
55
56
  import WebformBuilder from './WebformBuilder';
@@ -451,21 +451,21 @@ class PDFBuilder extends WebformBuilder_1.default {
451
451
  e.target.style.cursor = 'default';
452
452
  }
453
453
  highlightInvalidComponents() {
454
- const repeatablePaths = this.findRepeatablePaths();
454
+ const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
455
455
  // update elements which path was duplicated if any pathes have been changed
456
- if (!lodash_1.default.isEqual(this.repeatablePaths, repeatablePaths)) {
457
- (0, utils_1.eachComponent)(this.webform.getComponents(), (comp, path) => {
458
- if (this.repeatablePaths.includes(path)) {
456
+ if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
457
+ (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
458
+ if (this.repeatablePathsComps.includes(comp.component)) {
459
459
  this.webform.postMessage({ name: 'updateElement', data: comp.component });
460
460
  }
461
461
  });
462
- this.repeatablePaths = repeatablePaths;
462
+ this.repeatablePathsComps = repeatablePathsComps;
463
463
  }
464
- if (!repeatablePaths.length) {
464
+ if (!repeatablePathsComps.length) {
465
465
  return;
466
466
  }
467
- (0, utils_1.eachComponent)(this.webform.getComponents(), (comp, path) => {
468
- if (this.repeatablePaths.includes(path)) {
467
+ (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
468
+ if (this.repeatablePathsComps.includes(comp)) {
469
469
  this.webform.postMessage({
470
470
  name: 'showBuilderErrors',
471
471
  data: {
@@ -45,7 +45,7 @@
45
45
  * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
46
46
  * @property {boolean} [readOnly] - Set this form to readOnly.
47
47
  * @property {boolean} [noAlerts] - Disable the alerts dialog.
48
- * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
48
+ * @property {{[key: string]: string}} [enTranslation] - The translation file for this rendering.
49
49
  * @property {string} [template] - Custom logic for creation of elements.
50
50
  * @property {boolean} [noDefaults] - Exclude default values from the settings.
51
51
  * @property {any} [fileService] - The file service for this form.
@@ -586,7 +586,7 @@ export type FormOptions = {
586
586
  /**
587
587
  * - The translation file for this rendering.
588
588
  */
589
- i18n?: {
589
+ enTranslation?: {
590
590
  [key: string]: string;
591
591
  } | undefined;
592
592
  /**
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const compare_versions_1 = require("compare-versions");
8
8
  const EventEmitter_1 = __importDefault(require("./EventEmitter"));
9
- const i18n_1 = __importDefault(require("./i18n"));
9
+ const en_1 = __importDefault(require("./translations/en"));
10
10
  const Formio_1 = require("./Formio");
11
11
  const Components_1 = __importDefault(require("./components/Components"));
12
12
  const NestedDataComponent_1 = __importDefault(require("./components/_classes/nesteddata/NestedDataComponent"));
@@ -99,7 +99,7 @@ function getOptions(options) {
99
99
  * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
100
100
  * @property {boolean} [readOnly] - Set this form to readOnly.
101
101
  * @property {boolean} [noAlerts] - Disable the alerts dialog.
102
- * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
102
+ * @property {{[key: string]: string}} [enTranslation] - The translation file for this rendering.
103
103
  * @property {string} [template] - Custom logic for creation of elements.
104
104
  * @property {boolean} [noDefaults] - Exclude default values from the settings.
105
105
  * @property {any} [fileService] - The file service for this form.
@@ -369,7 +369,7 @@ class Webform extends NestedDataComponent_1.default {
369
369
  */
370
370
  addLanguage(code, lang, active = false) {
371
371
  if (this.i18next) {
372
- var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);
372
+ var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(en_1.default), lang);
373
373
  this.i18next.addResourceBundle(code, 'translation', translations, true, true);
374
374
  if (active) {
375
375
  this.language = code;
@@ -1320,6 +1320,7 @@ class Webform extends NestedDataComponent_1.default {
1320
1320
  userAgent: navigator.userAgent,
1321
1321
  pathName: window.location.pathname,
1322
1322
  onLine: navigator.onLine,
1323
+ language: this.language,
1323
1324
  });
1324
1325
  }
1325
1326
  submitForm(options = {}, local = false) {
@@ -78,7 +78,7 @@ export default class WebformBuilder extends Component {
78
78
  replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
79
79
  updateComponent(component: any, changed: any): void;
80
80
  originalDefaultValue: any;
81
- findRepeatablePaths(): any[];
81
+ findComponentsWithRepeatablePaths(): any[];
82
82
  highlightInvalidComponents(): void;
83
83
  /**
84
84
  * Called when a new component is saved.
@@ -1125,31 +1125,43 @@ class WebformBuilder extends Component_1.default {
1125
1125
  // Called when we update a component.
1126
1126
  this.emit('updateComponent', component);
1127
1127
  }
1128
- findRepeatablePaths() {
1129
- const repeatablePaths = [];
1128
+ findComponentsWithRepeatablePaths() {
1129
+ const repeatablePaths = {};
1130
1130
  const keys = new Map();
1131
1131
  (0, utils_1.eachComponent)(this.form.components, (comp, path, components, parent, paths) => {
1132
+ var _a, _b;
1133
+ const isRadioCheckbox = comp.type === 'checkbox' && comp.inputType === 'radio';
1132
1134
  const isLayout = (0, utils_1.componentInfo)(comp).layout;
1133
1135
  if (!isLayout) {
1134
1136
  if (keys.has(paths.dataPath)) {
1135
- repeatablePaths.push(paths.dataPath);
1137
+ const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
1138
+ repeatablePaths[paths.dataPath] = {
1139
+ comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
1140
+ onlyRadioCheckboxes,
1141
+ };
1136
1142
  }
1137
1143
  else {
1138
- keys.set(paths.dataPath, true);
1144
+ keys.set(paths.dataPath, comp);
1139
1145
  }
1140
1146
  }
1141
1147
  }, true);
1142
- return repeatablePaths;
1148
+ const componentsWithRepeatablePaths = [];
1149
+ Object.keys(repeatablePaths).forEach((path) => {
1150
+ const { comps, onlyRadioCheckboxes } = repeatablePaths[path];
1151
+ if (!onlyRadioCheckboxes) {
1152
+ componentsWithRepeatablePaths.push(...comps);
1153
+ }
1154
+ });
1155
+ return componentsWithRepeatablePaths;
1143
1156
  }
1144
1157
  highlightInvalidComponents() {
1145
- const repeatablePaths = this.findRepeatablePaths();
1158
+ const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
1146
1159
  let hasInvalidComponents = false;
1147
1160
  // Matches anything expect letters and '_' at the beginning of the key and anything except of letters, numbers,
1148
1161
  // '-', '.' and '_' in the rest of the key
1149
1162
  const badCharacters = /^[^A-Za-z_]+|[^A-Za-z0-9\-._]+/g;
1150
1163
  this.webform.everyComponent((comp) => {
1151
- const path = comp.path;
1152
- if (repeatablePaths.includes(path)) {
1164
+ if (repeatablePathsComps.includes(comp.component)) {
1153
1165
  comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
1154
1166
  hasInvalidComponents = true;
1155
1167
  }
@@ -57,7 +57,7 @@ class Components {
57
57
  // eslint-disable-next-line new-cap
58
58
  comp = new Components.components['datagrid'](component, options, data);
59
59
  }
60
- else if (component.tree) {
60
+ else if (component.tree || (component.input && Array.isArray(component.components))) {
61
61
  // eslint-disable-next-line new-cap
62
62
  comp = new Components.components['nesteddata'](component, options, data);
63
63
  }
@@ -75,6 +75,12 @@ class Components {
75
75
  if (comp.path) {
76
76
  comp.componentsMap[comp.path] = comp;
77
77
  }
78
+ // Reset the componentMatches on the root element if any new component is created.
79
+ let parent = comp.parent;
80
+ while (parent) {
81
+ parent.componentMatches = {};
82
+ parent = parent.parent;
83
+ }
78
84
  return comp;
79
85
  }
80
86
  }
@@ -2375,12 +2375,14 @@ class Component extends Element_1.default {
2375
2375
  ckeditor: {
2376
2376
  image: {
2377
2377
  toolbar: [
2378
+ 'toggleImageCaption',
2378
2379
  'imageTextAlternative',
2379
2380
  '|',
2380
- 'imageStyle:full',
2381
- 'imageStyle:alignLeft',
2382
- 'imageStyle:alignCenter',
2383
- 'imageStyle:alignRight'
2381
+ 'imageStyle:inline',
2382
+ 'imageStyle:wrapText',
2383
+ 'imageStyle:breakText',
2384
+ '|',
2385
+ 'resizeImage'
2384
2386
  ],
2385
2387
  styles: [
2386
2388
  'full',
@@ -2402,7 +2404,10 @@ class Component extends Element_1.default {
2402
2404
  if (this.component.isUploadEnabled) {
2403
2405
  settings.extraPlugins.push((0, uploadAdapter_1.getFormioUploadAdapterPlugin)(this.fileService, this));
2404
2406
  }
2405
- return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.js`), true)
2407
+ Formio_1.Formio.requireLibrary(`ckeditor-css`, isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', [
2408
+ { type: 'styles', src: `${Formio_1.Formio.cdn.ckeditor}/ckeditor.css` }
2409
+ ], true);
2410
+ return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.umd.js`), true)
2406
2411
  .then(() => {
2407
2412
  if (!element.parentNode) {
2408
2413
  return Promise.reject();
@@ -2710,6 +2715,11 @@ class Component extends Element_1.default {
2710
2715
  this.setValueAt(i, isArray && !this.isSingleInputValue() ? value[i] : value, flags);
2711
2716
  }
2712
2717
  }
2718
+ // Also reset value of the modal component, otherwise it will keep the old value locally and the preview
2719
+ // element won't refresh
2720
+ if (this.componentModal && flags && flags.resetValue) {
2721
+ this.componentModal.setValue(value);
2722
+ }
2713
2723
  return changed;
2714
2724
  }
2715
2725
  /**
@@ -25,7 +25,7 @@ export default class Input extends Multivalue {
25
25
  get suffix(): any;
26
26
  renderElement(value: any, index: any): any;
27
27
  setCounter(type: any, element: any, count: any, max: any): void;
28
- updateValueAt(value: any, flags: any, index: any): void;
28
+ updateValueAt(value: any, flags: any, index?: number): void;
29
29
  getValueAt(index: any): any;
30
30
  updateValue(value: any, flags: any, index: any): boolean;
31
31
  parseValue(value: any): any;
@@ -118,7 +118,7 @@ class Input extends Multivalue_1.default {
118
118
  }
119
119
  const info = this.inputInfo;
120
120
  info.attr = info.attr || {};
121
- info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(value)))
121
+ info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(this.isMultipleMasksField ? value.value : value)))
122
122
  .replace(/"/g, '&quot;');
123
123
  const valueMask = this.component.inputMask;
124
124
  const displayMask = this.component.displayMask;
@@ -163,7 +163,7 @@ class Input extends Multivalue_1.default {
163
163
  }));
164
164
  }
165
165
  }
166
- updateValueAt(value, flags, index) {
166
+ updateValueAt(value, flags, index = 0) {
167
167
  flags = flags || {};
168
168
  if (lodash_1.default.get(this.component, 'showWordCount', false)) {
169
169
  if (this.refs.wordcount && this.refs.wordcount[index]) {
@@ -108,6 +108,7 @@ export default class NestedComponent extends Field {
108
108
  * @returns {any} - The component that is located.
109
109
  */
110
110
  getComponent(path: string): any;
111
+ componentMatches: {} | undefined;
111
112
  /**
112
113
  * Return a component provided the Id of the component.
113
114
  * @param {string} id - The Id of the component.
@@ -311,6 +311,13 @@ class NestedComponent extends Field_1.default {
311
311
  */
312
312
  getComponent(path) {
313
313
  var _a;
314
+ // If the component is found
315
+ if (!this.componentMatches) {
316
+ this.componentMatches = {};
317
+ }
318
+ if (this.componentMatches && this.componentMatches[path]) {
319
+ return this.componentMatches[path];
320
+ }
314
321
  path = utils_1.default.getStringFromComponentPath(path);
315
322
  const matches = {
316
323
  path: undefined,
@@ -336,7 +343,8 @@ class NestedComponent extends Field_1.default {
336
343
  return match;
337
344
  });
338
345
  });
339
- return (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
346
+ this.componentMatches[path] = (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
347
+ return this.componentMatches[path];
340
348
  }
341
349
  /**
342
350
  * Return a component provided the Id of the component.
@@ -800,8 +808,10 @@ class NestedComponent extends Field_1.default {
800
808
  return this.data;
801
809
  }
802
810
  resetValue() {
803
- super.resetValue();
811
+ // Reset values of child components first, then reset the parent one, otherwise it will restore the default
812
+ // value of parent component and clear it one by one while resetting child components
804
813
  this.getComponents().forEach((comp) => comp.resetValue());
814
+ super.resetValue();
805
815
  this.setPristine(true);
806
816
  }
807
817
  get dataReady() {
@@ -813,7 +823,7 @@ class NestedComponent extends Field_1.default {
813
823
  return false;
814
824
  }
815
825
  if (component.type === 'components') {
816
- if (component.tree && component.hasValue(value)) {
826
+ if ((component.tree || component.hasInput) && component.hasValue(value)) {
817
827
  return component.setValue(lodash_1.default.get(value, component.key), flags);
818
828
  }
819
829
  return component.setValue(value, flags);
@@ -249,7 +249,7 @@ class AddressComponent extends Container_1.default {
249
249
  if (this.manualMode) {
250
250
  this.restoreComponentsContext();
251
251
  }
252
- if (changed || !lodash_1.default.isEmpty(value) && flags.fromSubmission) {
252
+ if (changed || !lodash_1.default.isEmpty(value) && flags.fromSubmission || flags.resetValue) {
253
253
  this.redraw();
254
254
  }
255
255
  return changed;
@@ -228,6 +228,9 @@ class DataMapComponent extends DataGrid_1.default {
228
228
  options.name += `[${rowIndex}]`;
229
229
  options.row = `${rowIndex}`;
230
230
  options.rowIndex = rowIndex;
231
+ options.onChange = (flags, changed, modified) => {
232
+ this.triggerChange({ modified });
233
+ };
231
234
  const components = {};
232
235
  components['__key'] = this.createComponent(this.keySchema, options, { __key: this.builderMode ? this.defaultRowKey : key });
233
236
  components['__key'].on('componentChange', (event) => {
@@ -243,7 +246,9 @@ class DataMapComponent extends DataGrid_1.default {
243
246
  valueComponent.key = key;
244
247
  const componentOptions = this.options;
245
248
  componentOptions.row = options.row;
246
- components[this.valueKey] = this.createComponent(valueComponent, componentOptions, this.dataValue);
249
+ const componentOptionsCloned = lodash_1.default.clone(componentOptions);
250
+ componentOptionsCloned.onChange = options.onChange;
251
+ components[this.valueKey] = this.createComponent(valueComponent, componentOptionsCloned, this.dataValue);
247
252
  return components;
248
253
  }
249
254
  get canAddColumn() {
@@ -266,7 +271,7 @@ class DataMapComponent extends DataGrid_1.default {
266
271
  const index = this.rows.length;
267
272
  this.rows[index] = this.createRowComponents(this.dataValue, index);
268
273
  this.redraw();
269
- this.triggerChange();
274
+ this.triggerChange({ modified: true });
270
275
  }
271
276
  removeRow(index) {
272
277
  const keys = Object.keys(this.dataValue);
@@ -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';
@@ -1200,14 +1200,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1200
1200
  this.setNestedValue(component, editRow.data, flags);
1201
1201
  });
1202
1202
  }
1203
- emptyRows() {
1204
- this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
1205
- this.editRows = [];
1206
- }
1207
- resetValue() {
1208
- super.resetValue();
1209
- this.emptyRows();
1210
- }
1211
1203
  }
1212
1204
  exports.default = EditGridComponent;
1213
1205
  EditGridComponent.prototype.hasChanged = Component_1.default.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;
@@ -79,13 +79,15 @@ class RadioComponent extends ListComponent_1.default {
79
79
  }
80
80
  return defaultValue;
81
81
  }
82
- resetValue() {
82
+ uncheckValue(flags = {}) {
83
83
  this.unset();
84
84
  this.setValue(this.emptyValue, {
85
85
  noUpdateEvent: true,
86
86
  noValidate: true,
87
87
  resetValue: true
88
88
  });
89
+ this.triggerChange(flags);
90
+ this.setSelectedClasses();
89
91
  }
90
92
  get inputInfo() {
91
93
  var _a;
@@ -400,9 +402,7 @@ class RadioComponent extends ListComponent_1.default {
400
402
  this.currentValue = this.dataValue;
401
403
  const shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;
402
404
  if (shouldResetValue) {
403
- this.resetValue();
404
- this.triggerChange(flags);
405
- this.setSelectedClasses();
405
+ this.uncheckValue(flags);
406
406
  }
407
407
  this.previousValue = this.dataValue;
408
408
  return changed;
@@ -1232,7 +1232,7 @@ class SelectComponent extends ListComponent_1.default {
1232
1232
  }
1233
1233
  lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
1234
1234
  }
1235
- if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
1235
+ if (flags.resetValue && !flags.fromSubmission && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
1236
1236
  const submission = this.root.submission;
1237
1237
  if (!submission.metadata) {
1238
1238
  submission.metadata = {};
@@ -193,7 +193,12 @@ class TextAreaComponent extends TextField_1.default {
193
193
  const editorHeight = (numRows * 31) + 14;
194
194
  editor.ui.view.editable.editableElement.style.height = `${(editorHeight)}px`;
195
195
  }
196
- editor.isReadOnly = isReadOnly;
196
+ if (isReadOnly) {
197
+ editor.enableReadOnlyMode(this.id);
198
+ }
199
+ else {
200
+ editor.disableReadOnlyMode(this.id);
201
+ }
197
202
  editor.data.set(value);
198
203
  }
199
204
  editorReady(editor);
@@ -107,7 +107,12 @@ class TextFieldComponent extends Input_1.default {
107
107
  // If no value is provided, then set the defaultValue.
108
108
  if (!value.value) {
109
109
  const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
110
- value.value = Array.isArray(defaultValue) ? defaultValue[0] : defaultValue;
110
+ if (Array.isArray(defaultValue)) {
111
+ value.value = lodash_1.default.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
112
+ }
113
+ else {
114
+ value.value = lodash_1.default.isObject(defaultValue) ? defaultValue.value : defaultValue;
115
+ }
111
116
  }
112
117
  return value;
113
118
  }
@@ -28,7 +28,7 @@ const EventEmitter_1 = __importDefault(require("./EventEmitter"));
28
28
  exports.EventEmitter = EventEmitter_1.default;
29
29
  const Webform_1 = __importDefault(require("./Webform"));
30
30
  exports.Webform = Webform_1.default;
31
- const i18n_1 = require("./utils/i18n");
31
+ const core_1 = require("@formio/core");
32
32
  const utils_2 = require("./utils");
33
33
  Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
34
34
  Formio_1.Formio.requireLibrary(name, name, path, true)
@@ -103,7 +103,7 @@ function registerModule(mod, defaultFn = null, options = {}) {
103
103
  (0, utils_2.registerEvaluator)(mod.evaluator);
104
104
  break;
105
105
  case 'translations':
106
- i18n_1.I18n.setDefaultTranslations(mod.translations);
106
+ core_1.I18n.setDefaultTranslations(mod.translations);
107
107
  break;
108
108
  case 'library':
109
109
  options.license