@byteluck-fe/model-driven-engine 2.3.1-beta.19 → 2.3.1-beta.20

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.
@@ -1113,35 +1113,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1113
1113
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1114
1114
  }
1115
1115
  }
1116
- });
1117
- }
1118
- var mapping = _this.getDataBindMapping(dataCode);
1119
- if (mapping) {
1120
- var mappingValue = Object.keys(JSONCopy(_this.getEmptyState(mapping.controlId)));
1121
- if (mapping.dataViewId === mapping.controlId) {
1122
- var _newState_mapping_dataViewId;
1123
- var _newState_mapping_dataViewId_mapping_controlId;
1124
- var subtableStateKeys = Object.keys((_newState_mapping_dataViewId_mapping_controlId = newState === null || newState === void 0 ? void 0 : (_newState_mapping_dataViewId = newState[mapping.dataViewId]) === null || _newState_mapping_dataViewId === void 0 ? void 0 : _newState_mapping_dataViewId[mapping.controlId]) !== null && _newState_mapping_dataViewId_mapping_controlId !== void 0 ? _newState_mapping_dataViewId_mapping_controlId : {});
1125
- if (!subtableStateKeys.length) {
1126
- return;
1127
- }
1128
- Object.keys(mappingValue).forEach(function(key) {
1129
- if (!subtableStateKeys.includes(key) && key !== "uid") {
1130
- Object.assign(newState[mapping.dataViewId][mapping.controlId], mappingValue[key]);
1131
- }
1132
- });
1133
- } else {
1134
- var _newState_mapping_controlId;
1135
- var mainStateKeys = Object.keys((_newState_mapping_controlId = newState === null || newState === void 0 ? void 0 : newState[mapping.controlId]) !== null && _newState_mapping_controlId !== void 0 ? _newState_mapping_controlId : {});
1136
- if (!mainStateKeys.length) {
1137
- return;
1116
+ var newMapping = _this.getDataBindMapping(dataCode);
1117
+ if (newMapping) {
1118
+ var _newMapping_fields;
1119
+ var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (_newMapping_fields = newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
1120
+ return item === null || item === void 0 ? void 0 : item.controlId;
1121
+ });
1122
+ var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1123
+ var mainStateKeys = Object.keys(newState);
1124
+ mappingKeys.forEach(function(key) {
1125
+ if (!mainStateKeys.includes(key) && key !== "uid") {
1126
+ if (Object.keys(newState).length) {
1127
+ Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, [
1128
+ mappingValue[key]
1129
+ ]));
1130
+ } else {
1131
+ Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
1132
+ }
1133
+ }
1134
+ });
1138
1135
  }
1139
- Object.keys(mappingValue).forEach(function(key) {
1140
- if (!mainStateKeys.includes(key) && key !== "uid") {
1141
- Object.assign(newState[mapping.controlId], mappingValue[key]);
1142
- }
1143
- });
1144
- }
1136
+ });
1145
1137
  }
1146
1138
  });
1147
1139
  this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);