@byteluck-fe/model-driven-engine 2.3.1-beta.24 → 2.3.1-beta.26
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.
- package/dist/esm/common/Engine.js +10 -5
- package/dist/index.umd.js +6 -6
- package/package.json +3 -3
|
@@ -1161,6 +1161,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1161
1161
|
value: function setData(dataSet, options) {
|
|
1162
1162
|
var _this = this;
|
|
1163
1163
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1164
|
+
var isEmpty = function(value) {
|
|
1165
|
+
if (isString(value) || Array.isArray(value)) {
|
|
1166
|
+
return value.length === 0;
|
|
1167
|
+
}
|
|
1168
|
+
return false;
|
|
1169
|
+
};
|
|
1164
1170
|
var newState = {};
|
|
1165
1171
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1166
1172
|
var entity = dataSet[dataCode];
|
|
@@ -1223,7 +1229,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1223
1229
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1224
1230
|
} else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
|
|
1225
1231
|
var _this_getEmptyState;
|
|
1226
|
-
var objValue =
|
|
1232
|
+
var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
|
|
1227
1233
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1228
1234
|
var dataBind = mapping.dataBind[key];
|
|
1229
1235
|
if (entity[dataBind.fieldCode] !== undefined) {
|
|
@@ -1245,16 +1251,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1245
1251
|
var _newState_newMapping_controlId;
|
|
1246
1252
|
var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
|
|
1247
1253
|
mappingKeys.forEach(function(key) {
|
|
1248
|
-
if (!mainStateKeys.includes(key) && key !== "uid") {
|
|
1254
|
+
if (!mainStateKeys.includes(key) && key !== "uid" && !isEmpty(mappingValue[key])) {
|
|
1249
1255
|
if (Object.keys(newState).length) {
|
|
1250
|
-
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, [
|
|
1251
|
-
mappingValue[key]
|
|
1252
|
-
]));
|
|
1256
|
+
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
|
|
1253
1257
|
} else {
|
|
1254
1258
|
Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
|
|
1255
1259
|
}
|
|
1256
1260
|
}
|
|
1257
1261
|
});
|
|
1262
|
+
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1258
1263
|
}
|
|
1259
1264
|
}
|
|
1260
1265
|
});
|