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

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.
@@ -1115,6 +1115,34 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1115
1115
  }
1116
1116
  });
1117
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;
1138
+ }
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
+ }
1145
+ }
1118
1146
  });
1119
1147
  this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
1120
1148
  this.setStates(newState, undefined, options);
@@ -133,7 +133,7 @@ var Store = /*#__PURE__*/ function() {
133
133
  if (controlInfo !== undefined) {
134
134
  var state = this.emptyState[controlInfo.dataView][controlId];
135
135
  //判断找到的是否是明细表的控件
136
- if ("children" in this.emptyState[controlInfo.dataView]) {
136
+ if ("children" in controlInfo) {
137
137
  Object.assign(state, {
138
138
  uid: "new:" + buildUUID("uid")
139
139
  });
@@ -211,8 +211,8 @@ function buildState(dataViewState, emptyDataViewState, // @ts-ignore
211
211
  item) {
212
212
  //if (item instanceof RuntimeFormControl) {
213
213
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
214
- // 2023-3-23 jiaqi 首次进入页面去除填充默认值
215
- dataViewState[item.id] = JSONCopy(item.props.defaultValue);
214
+ // 2023-4-2 jiaqi 首次进入页面去除填充默认值
215
+ // dataViewState[item.id] = JSONCopy(item.props.defaultValue)
216
216
  emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
217
217
  } else {
218
218
  var emptyTemplate = {};