@byteluck-fe/model-driven-engine 2.3.7 → 2.3.9
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 +15 -9
- package/dist/index.umd.js +5 -5
- package/package.json +2 -2
|
@@ -901,7 +901,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
901
901
|
*/ key: "setStates",
|
|
902
902
|
value: function setStates(states, rowIndex, options) {
|
|
903
903
|
var _this = this;
|
|
904
|
-
var newStates = states;
|
|
904
|
+
var newStates = states !== null && states !== void 0 ? states : {};
|
|
905
905
|
Object.keys(newStates).forEach(function(stateId) {
|
|
906
906
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
907
907
|
var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
@@ -1161,12 +1161,6 @@ 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
|
-
};
|
|
1170
1164
|
var newState = {};
|
|
1171
1165
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1172
1166
|
var entity = dataSet[dataCode];
|
|
@@ -1218,8 +1212,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1218
1212
|
;
|
|
1219
1213
|
var emptyState = JSONCopy(_this.store.emptyState);
|
|
1220
1214
|
if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
|
|
1215
|
+
var _this_getDataBindMapping;
|
|
1221
1216
|
//判断entity 为空对象就给表单赋值默认值
|
|
1222
1217
|
newState = JSONCopy(emptyState);
|
|
1218
|
+
var _this_getDataBindMapping_controlId;
|
|
1219
|
+
var dataViewControlId = (_this_getDataBindMapping_controlId = (_this_getDataBindMapping = _this.getDataBindMapping(dataCode)) === null || _this_getDataBindMapping === void 0 ? void 0 : _this_getDataBindMapping.controlId) !== null && _this_getDataBindMapping_controlId !== void 0 ? _this_getDataBindMapping_controlId : "";
|
|
1220
|
+
var _emptyState_dataViewControlId;
|
|
1221
|
+
var state = (_emptyState_dataViewControlId = emptyState[dataViewControlId]) !== null && _emptyState_dataViewControlId !== void 0 ? _emptyState_dataViewControlId : {};
|
|
1222
|
+
Object.keys(state).map(function(key) {
|
|
1223
|
+
if (_this.getControlIdMapping()[key].children !== undefined) {
|
|
1224
|
+
newState[dataViewControlId][key] = [];
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1223
1227
|
} else {
|
|
1224
1228
|
Object.keys(entity).map(function(fieldCode) {
|
|
1225
1229
|
if (skipKey.includes(fieldCode)) {
|
|
@@ -1332,7 +1336,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1332
1336
|
}
|
|
1333
1337
|
}
|
|
1334
1338
|
} else {
|
|
1335
|
-
var
|
|
1339
|
+
var _this_getControlIdMapping;
|
|
1340
|
+
var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
|
|
1336
1341
|
var _Object_entries_find;
|
|
1337
1342
|
var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1338
1343
|
var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
|
|
@@ -1557,7 +1562,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1557
1562
|
{
|
|
1558
1563
|
key: "inList",
|
|
1559
1564
|
value: function inList(controlId) {
|
|
1560
|
-
var
|
|
1565
|
+
var _this_store_controlIdMapping;
|
|
1566
|
+
var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
|
|
1561
1567
|
var result = Object.keys(mapping).some(function(key) {
|
|
1562
1568
|
var _mapping_key, _mapping_key_children;
|
|
1563
1569
|
return (_mapping_key = mapping[key]) === null || _mapping_key === void 0 ? void 0 : (_mapping_key_children = _mapping_key.children) === null || _mapping_key_children === void 0 ? void 0 : _mapping_key_children.hasOwnProperty(controlId);
|