@formio/js 5.1.0-dev.6088.658bd4e → 5.1.0-dev.6090.1122fcd

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.
@@ -43,4 +43,4 @@
43
43
 
44
44
  //! moment.js
45
45
 
46
- //! version : 0.5.46
46
+ //! version : 0.5.48
@@ -77,6 +77,7 @@ export default class WebformBuilder extends Component {
77
77
  removeComponent(component: any, parent: any, original: any, componentInstance: any): boolean | undefined;
78
78
  replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
79
79
  updateComponent(component: any, changed: any): void;
80
+ originalDefaultValue: any;
80
81
  findRepeatablePaths(): any[];
81
82
  highlightInvalidComponents(): void;
82
83
  /**
@@ -1070,6 +1070,17 @@ class WebformBuilder extends Component_1.default {
1070
1070
  'fields.month.required',
1071
1071
  'fields.year.required',
1072
1072
  ]));
1073
+ if (defaultValueComponent.component.components) {
1074
+ if (!this.originalDefaultValue) {
1075
+ this.originalDefaultValue = (0, utils_1.fastCloneDeep)(defaultValueComponent.component);
1076
+ }
1077
+ (0, formUtils_1.eachComponent)(defaultValueComponent.component.components, (comp => {
1078
+ var _a;
1079
+ if ((_a = comp.validate) === null || _a === void 0 ? void 0 : _a.required) {
1080
+ comp.validate.required = false;
1081
+ }
1082
+ }));
1083
+ }
1073
1084
  const parentComponent = defaultValueComponent.parent;
1074
1085
  let tabIndex = -1;
1075
1086
  let index = -1;
@@ -1161,6 +1172,9 @@ class WebformBuilder extends Component_1.default {
1161
1172
  if (index !== -1) {
1162
1173
  let submissionData = this.editForm.submission.data;
1163
1174
  submissionData = submissionData.componentJson || submissionData;
1175
+ if (submissionData.components && this.originalDefaultValue) {
1176
+ submissionData.components = this.originalDefaultValue.components;
1177
+ }
1164
1178
  const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
1165
1179
  this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
1166
1180
  this.hook('beforeSaveComponentSettings', submissionData);
@@ -903,8 +903,9 @@ class SelectComponent extends ListComponent_1.default {
903
903
  });
904
904
  }
905
905
  // Add value options.
906
+ const value = this.undoValueTyping(this.dataValue);
906
907
  this.addValueOptions();
907
- this.setChoicesValue(this.dataValue);
908
+ this.setChoicesValue(value);
908
909
  if (this.isSelectResource && this.refs.addResource) {
909
910
  this.addEventListener(this.refs.addResource, 'click', (event) => {
910
911
  event.preventDefault();
@@ -1283,6 +1284,9 @@ class SelectComponent extends ListComponent_1.default {
1283
1284
  this.lazyLoadInit = true;
1284
1285
  const searchProperty = this.component.searchField || this.component.valueProperty;
1285
1286
  this.triggerUpdate(lodash_1.default.get(value.data || value, searchProperty, value), true);
1287
+ this.itemsLoaded.then(() => {
1288
+ this.setChoicesValue(value, hasPreviousValue, flags);
1289
+ });
1286
1290
  return changed;
1287
1291
  }
1288
1292
  // Add the value options.
@@ -77,6 +77,7 @@ export default class WebformBuilder extends Component {
77
77
  removeComponent(component: any, parent: any, original: any, componentInstance: any): boolean | undefined;
78
78
  replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
79
79
  updateComponent(component: any, changed: any): void;
80
+ originalDefaultValue: any;
80
81
  findRepeatablePaths(): any[];
81
82
  highlightInvalidComponents(): void;
82
83
  /**
@@ -1054,6 +1054,16 @@ export default class WebformBuilder extends Component {
1054
1054
  'fields.month.required',
1055
1055
  'fields.year.required',
1056
1056
  ]));
1057
+ if (defaultValueComponent.component.components) {
1058
+ if (!this.originalDefaultValue) {
1059
+ this.originalDefaultValue = fastCloneDeep(defaultValueComponent.component);
1060
+ }
1061
+ eachComponent(defaultValueComponent.component.components, (comp => {
1062
+ if (comp.validate?.required) {
1063
+ comp.validate.required = false;
1064
+ }
1065
+ }));
1066
+ }
1057
1067
  const parentComponent = defaultValueComponent.parent;
1058
1068
  let tabIndex = -1;
1059
1069
  let index = -1;
@@ -1145,6 +1155,9 @@ export default class WebformBuilder extends Component {
1145
1155
  if (index !== -1) {
1146
1156
  let submissionData = this.editForm.submission.data;
1147
1157
  submissionData = submissionData.componentJson || submissionData;
1158
+ if (submissionData.components && this.originalDefaultValue) {
1159
+ submissionData.components = this.originalDefaultValue.components;
1160
+ }
1148
1161
  const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
1149
1162
  this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
1150
1163
  this.hook('beforeSaveComponentSettings', submissionData);
@@ -935,8 +935,9 @@ export default class SelectComponent extends ListComponent {
935
935
  });
936
936
  }
937
937
  // Add value options.
938
+ const value = this.undoValueTyping(this.dataValue);
938
939
  this.addValueOptions();
939
- this.setChoicesValue(this.dataValue);
940
+ this.setChoicesValue(value);
940
941
  if (this.isSelectResource && this.refs.addResource) {
941
942
  this.addEventListener(this.refs.addResource, 'click', (event) => {
942
943
  event.preventDefault();
@@ -1312,6 +1313,9 @@ export default class SelectComponent extends ListComponent {
1312
1313
  this.lazyLoadInit = true;
1313
1314
  const searchProperty = this.component.searchField || this.component.valueProperty;
1314
1315
  this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);
1316
+ this.itemsLoaded.then(() => {
1317
+ this.setChoicesValue(value, hasPreviousValue, flags);
1318
+ });
1315
1319
  return changed;
1316
1320
  }
1317
1321
  // Add the value options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6088.658bd4e",
3
+ "version": "5.1.0-dev.6090.1122fcd",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -108,7 +108,7 @@
108
108
  "jwt-decode": "^3.1.2",
109
109
  "lodash": "^4.17.21",
110
110
  "moment": "^2.29.4",
111
- "moment-timezone": "^0.5.44",
111
+ "moment-timezone": "^0.5.48",
112
112
  "quill": "^2.0.2",
113
113
  "signature_pad": "^4.2.0",
114
114
  "string-hash": "^1.1.3",