@formio/js 5.0.0-dev.5902.1eb1690 → 5.0.0-dev.5902.8763b69

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.
@@ -1250,7 +1250,8 @@ class WebformBuilder extends Component_1.default {
1250
1250
  helplinks: this.helplinks,
1251
1251
  }));
1252
1252
  this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
1253
- this.updateComponent((_a = this.editForm.submission.data) !== null && _a !== void 0 ? _a : component);
1253
+ const editFormData = (_a = this.editForm.submission) === null || _a === void 0 ? void 0 : _a.data;
1254
+ this.updateComponent((editFormData === null || editFormData === void 0 ? void 0 : editFormData.componentJson) || editFormData || component);
1254
1255
  this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1255
1256
  });
1256
1257
  });
@@ -43,7 +43,7 @@ export default class EditGridComponent extends NestedArrayComponent {
43
43
  get defaultValue(): any[];
44
44
  hasRemoveButtons(): boolean;
45
45
  editRows: any;
46
- checkRowVariableTypeComponents(editRow: any, rowIndex: any): void;
46
+ checkRowVariableTypeComponents(editRow: any, rowIndex: any): boolean;
47
47
  setVariableTypeComponents(): void;
48
48
  variableTypeComponentsIndexes: any[] | undefined;
49
49
  isOpen(editRow: any): boolean;
@@ -294,12 +294,15 @@ class EditGridComponent extends NestedArrayComponent_1.default {
294
294
  }
295
295
  checkRowVariableTypeComponents(editRow, rowIndex) {
296
296
  const rowComponents = editRow.components;
297
+ let typeChanged = false;
297
298
  if (lodash_1.default.some(this.variableTypeComponentsIndexes, (compIndex) => {
298
299
  const variableTypeComp = rowComponents[compIndex];
299
300
  return variableTypeComp.type !== variableTypeComp.component.type;
300
301
  })) {
301
302
  editRow.components = this.createRowComponents(editRow.data, rowIndex, true);
303
+ typeChanged = true;
302
304
  }
305
+ return typeChanged;
303
306
  }
304
307
  setVariableTypeComponents() {
305
308
  //set components which type is changing within a row (e.g.,by mergeComponentSchema action)
@@ -952,8 +955,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
952
955
  this.validateRow(editRow, false, false);
953
956
  }
954
957
  if (this.variableTypeComponentsIndexes.length) {
955
- this.checkRowVariableTypeComponents(editRow, rowIndex);
956
- this.redraw();
958
+ const typeChanged = this.checkRowVariableTypeComponents(editRow, rowIndex);
959
+ if (typeChanged) {
960
+ this.redraw();
961
+ }
957
962
  }
958
963
  };
959
964
  const comp = this.createComponent(lodash_1.default.assign({}, column, { row: options.row }), options, row, null, recreatePartially && currentRowComponents ? currentRowComponents[colIndex] : null);
@@ -428,6 +428,7 @@ class FormComponent extends Component_1.default {
428
428
  const isSubmitButton = component.type === 'button' && (component.action === 'submit' || !component.action);
429
429
  if (isSubmitButton) {
430
430
  component.hidden = true;
431
+ // clearOnHide no longer clears from the JSON `hidden` flag, so we make the button conditionally hidden to clear its data
431
432
  component.customConditional = 'show = false';
432
433
  }
433
434
  }
@@ -1233,7 +1233,8 @@ export default class WebformBuilder extends Component {
1233
1233
  helplinks: this.helplinks,
1234
1234
  }));
1235
1235
  this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
1236
- this.updateComponent(this.editForm.submission.data ?? component);
1236
+ const editFormData = this.editForm.submission?.data;
1237
+ this.updateComponent(editFormData?.componentJson || editFormData || component);
1237
1238
  this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1238
1239
  });
1239
1240
  });
@@ -43,7 +43,7 @@ export default class EditGridComponent extends NestedArrayComponent {
43
43
  get defaultValue(): any[];
44
44
  hasRemoveButtons(): boolean;
45
45
  editRows: any;
46
- checkRowVariableTypeComponents(editRow: any, rowIndex: any): void;
46
+ checkRowVariableTypeComponents(editRow: any, rowIndex: any): boolean;
47
47
  setVariableTypeComponents(): void;
48
48
  variableTypeComponentsIndexes: any[] | undefined;
49
49
  isOpen(editRow: any): boolean;
@@ -289,12 +289,15 @@ export default class EditGridComponent extends NestedArrayComponent {
289
289
  }
290
290
  checkRowVariableTypeComponents(editRow, rowIndex) {
291
291
  const rowComponents = editRow.components;
292
+ let typeChanged = false;
292
293
  if (_.some(this.variableTypeComponentsIndexes, (compIndex) => {
293
294
  const variableTypeComp = rowComponents[compIndex];
294
295
  return variableTypeComp.type !== variableTypeComp.component.type;
295
296
  })) {
296
297
  editRow.components = this.createRowComponents(editRow.data, rowIndex, true);
298
+ typeChanged = true;
297
299
  }
300
+ return typeChanged;
298
301
  }
299
302
  setVariableTypeComponents() {
300
303
  //set components which type is changing within a row (e.g.,by mergeComponentSchema action)
@@ -943,8 +946,10 @@ export default class EditGridComponent extends NestedArrayComponent {
943
946
  this.validateRow(editRow, false, false);
944
947
  }
945
948
  if (this.variableTypeComponentsIndexes.length) {
946
- this.checkRowVariableTypeComponents(editRow, rowIndex);
947
- this.redraw();
949
+ const typeChanged = this.checkRowVariableTypeComponents(editRow, rowIndex);
950
+ if (typeChanged) {
951
+ this.redraw();
952
+ }
948
953
  }
949
954
  };
950
955
  const comp = this.createComponent(_.assign({}, column, { row: options.row }), options, row, null, recreatePartially && currentRowComponents ? currentRowComponents[colIndex] : null);
@@ -424,6 +424,7 @@ export default class FormComponent extends Component {
424
424
  const isSubmitButton = component.type === 'button' && (component.action === 'submit' || !component.action);
425
425
  if (isSubmitButton) {
426
426
  component.hidden = true;
427
+ // clearOnHide no longer clears from the JSON `hidden` flag, so we make the button conditionally hidden to clear its data
427
428
  component.customConditional = 'show = false';
428
429
  }
429
430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5902.1eb1690",
3
+ "version": "5.0.0-dev.5902.8763b69",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {