@byteluck-fe/model-driven-engine 2.3.0 → 2.3.1-beta.11
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.
|
@@ -1088,6 +1088,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1088
1088
|
} else if (entity) {
|
|
1089
1089
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1090
1090
|
;
|
|
1091
|
+
var emptyState = JSONCopy(_this.store.emptyState);
|
|
1091
1092
|
Object.keys(entity).map(function(fieldCode) {
|
|
1092
1093
|
if (skipKey.includes(fieldCode)) {
|
|
1093
1094
|
return;
|
|
@@ -1098,7 +1099,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1098
1099
|
newState[mapping.dataViewId[0]] = {};
|
|
1099
1100
|
}
|
|
1100
1101
|
if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
|
|
1101
|
-
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode];
|
|
1102
|
+
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1102
1103
|
} else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
|
|
1103
1104
|
var _this_getEmptyState;
|
|
1104
1105
|
var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
|
|
@@ -1198,24 +1199,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1198
1199
|
return instances;
|
|
1199
1200
|
};
|
|
1200
1201
|
_proto.setInstance = function setInstance(instance, props, value, rowIndex) {
|
|
1202
|
+
var _this = this;
|
|
1201
1203
|
try {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1204
|
+
if (typeof instance === "string" && rowIndex === -1) {
|
|
1205
|
+
//修改明细表整列属性的逻辑
|
|
1206
|
+
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1207
|
+
instances.map(function(_instance) {
|
|
1208
|
+
if (_instance) {
|
|
1209
|
+
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1210
|
+
updateValueFromKeys(_instance.props, props, value);
|
|
1211
|
+
_this.schemaEvent("schema-change", {
|
|
1212
|
+
instance: _instance,
|
|
1213
|
+
props: props,
|
|
1214
|
+
value: value,
|
|
1215
|
+
rowIndex: rowIndex
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1205
1219
|
} else {
|
|
1206
|
-
_instance
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1220
|
+
var _instance;
|
|
1221
|
+
if (typeof instance === "string") {
|
|
1222
|
+
_instance = this.getInstance(instance, rowIndex);
|
|
1223
|
+
} else {
|
|
1224
|
+
_instance = instance;
|
|
1225
|
+
}
|
|
1226
|
+
if (!_instance) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1230
|
+
updateValueFromKeys(_instance.props, props, value);
|
|
1231
|
+
this.schemaEvent("schema-change", {
|
|
1232
|
+
instance: _instance,
|
|
1233
|
+
props: props,
|
|
1234
|
+
value: value,
|
|
1235
|
+
rowIndex: rowIndex
|
|
1236
|
+
});
|
|
1210
1237
|
}
|
|
1211
|
-
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1212
|
-
updateValueFromKeys(_instance.props, props, value);
|
|
1213
|
-
this.schemaEvent("schema-change", {
|
|
1214
|
-
instance: _instance,
|
|
1215
|
-
props: props,
|
|
1216
|
-
value: value,
|
|
1217
|
-
rowIndex: rowIndex
|
|
1218
|
-
});
|
|
1219
1238
|
} catch (e) {
|
|
1220
1239
|
throw e;
|
|
1221
1240
|
}
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -204,7 +204,8 @@ function buildState(dataViewState, emptyDataViewState, // @ts-ignore
|
|
|
204
204
|
item) {
|
|
205
205
|
//if (item instanceof RuntimeFormControl) {
|
|
206
206
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
207
|
-
|
|
207
|
+
// 2023-3-23 jiaqi 首次进入页面去除填充默认值
|
|
208
|
+
// dataViewState[item.id] = JSONCopy(item.props.defaultValue)
|
|
208
209
|
emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
209
210
|
} else {
|
|
210
211
|
var emptyTemplate = {};
|