@formio/js 5.0.0-dev.5932.9b8cb6d → 5.0.0-dev.5933.606556f

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.
@@ -1085,12 +1085,6 @@ class WebformBuilder extends Component_1.default {
1085
1085
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1086
1086
  newComp.checkValidity = () => true;
1087
1087
  newComp.build(defaultValueComponent.element);
1088
- if (this.preview && !this.preview.defaultChanged) {
1089
- const defaultValue = lodash_1.default.get(this.preview._data, this.editForm._data.key);
1090
- if (lodash_1.default.isObject(defaultValue) && !lodash_1.default.isArray(defaultValue)) {
1091
- this.editForm._data.defaultValue = defaultValue;
1092
- }
1093
- }
1094
1088
  }
1095
1089
  }
1096
1090
  else {
@@ -1101,7 +1095,6 @@ class WebformBuilder extends Component_1.default {
1101
1095
  path.unshift(component.key);
1102
1096
  dataPath = (0, utils_1.getStringFromComponentPath)(path);
1103
1097
  }
1104
- this.preview.defaultChanged = true;
1105
1098
  lodash_1.default.set(this.preview._data, dataPath, changed.value);
1106
1099
  lodash_1.default.set(this.webform._data, dataPath, changed.value);
1107
1100
  }
@@ -413,6 +413,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
413
413
  });
414
414
  this.checkConditions();
415
415
  this.triggerChange();
416
+ this.triggerChange({ modified: true });
416
417
  this.redraw().then(() => {
417
418
  this.focusOnNewRowElement(this.rows[index]);
418
419
  });
@@ -492,6 +493,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
492
493
  const options = lodash_1.default.clone(this.options);
493
494
  options.name += `[${rowIndex}]`;
494
495
  options.row = `${rowIndex}-${colIndex}`;
496
+ options.onChange = (flags, changed, modified) => {
497
+ this.triggerChange({ modified });
498
+ };
495
499
  let columnComponent;
496
500
  if (this.builderMode) {
497
501
  col.id = col.id + rowIndex;
@@ -139,14 +139,6 @@ class SelectBoxesComponent extends Radio_1.default {
139
139
  checkedValues.forEach((value) => selectData.push(this.templateData[value]));
140
140
  lodash_1.default.set(submission.metadata.selectData, this.path, selectData);
141
141
  }
142
- // Ensure that for dataSrc == 'values' that there are not any other superfluous values.
143
- if (this.component.dataSrc === 'values') {
144
- for (const key in value) {
145
- if (!this.component.values.find((val) => val.value === key)) {
146
- delete value[key];
147
- }
148
- }
149
- }
150
142
  return value;
151
143
  }
152
144
  /**
@@ -1069,12 +1069,6 @@ export default class WebformBuilder extends Component {
1069
1069
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1070
1070
  newComp.checkValidity = () => true;
1071
1071
  newComp.build(defaultValueComponent.element);
1072
- if (this.preview && !this.preview.defaultChanged) {
1073
- const defaultValue = _.get(this.preview._data, this.editForm._data.key);
1074
- if (_.isObject(defaultValue) && !_.isArray(defaultValue)) {
1075
- this.editForm._data.defaultValue = defaultValue;
1076
- }
1077
- }
1078
1072
  }
1079
1073
  }
1080
1074
  else {
@@ -1085,7 +1079,6 @@ export default class WebformBuilder extends Component {
1085
1079
  path.unshift(component.key);
1086
1080
  dataPath = getStringFromComponentPath(path);
1087
1081
  }
1088
- this.preview.defaultChanged = true;
1089
1082
  _.set(this.preview._data, dataPath, changed.value);
1090
1083
  _.set(this.webform._data, dataPath, changed.value);
1091
1084
  }
@@ -410,6 +410,7 @@ export default class DataGridComponent extends NestedArrayComponent {
410
410
  });
411
411
  this.checkConditions();
412
412
  this.triggerChange();
413
+ this.triggerChange({ modified: true });
413
414
  this.redraw().then(() => {
414
415
  this.focusOnNewRowElement(this.rows[index]);
415
416
  });
@@ -488,6 +489,9 @@ export default class DataGridComponent extends NestedArrayComponent {
488
489
  const options = _.clone(this.options);
489
490
  options.name += `[${rowIndex}]`;
490
491
  options.row = `${rowIndex}-${colIndex}`;
492
+ options.onChange = (flags, changed, modified) => {
493
+ this.triggerChange({ modified });
494
+ };
491
495
  let columnComponent;
492
496
  if (this.builderMode) {
493
497
  col.id = col.id + rowIndex;
@@ -141,14 +141,6 @@ export default class SelectBoxesComponent extends RadioComponent {
141
141
  checkedValues.forEach((value) => selectData.push(this.templateData[value]));
142
142
  _.set(submission.metadata.selectData, this.path, selectData);
143
143
  }
144
- // Ensure that for dataSrc == 'values' that there are not any other superfluous values.
145
- if (this.component.dataSrc === 'values') {
146
- for (const key in value) {
147
- if (!this.component.values.find((val) => val.value === key)) {
148
- delete value[key];
149
- }
150
- }
151
- }
152
144
  return value;
153
145
  }
154
146
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5932.9b8cb6d",
3
+ "version": "5.0.0-dev.5933.606556f",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {