@byteluck-fe/model-driven-engine 2.1.0-sourcemap.8 → 2.2.0
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.
|
@@ -430,16 +430,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
430
430
|
this.store.state = proxyState(this.store.state, this._proxyStateCallback.bind(this), this._proxyStateBeforeSetCallback.bind(this));
|
|
431
431
|
};
|
|
432
432
|
_proto._proxyStateBeforeSetCallback = function _proxyStateBeforeSetCallback(state, key, newValue, oldValue) {
|
|
433
|
-
var
|
|
433
|
+
var _this = this;
|
|
434
|
+
var instance = findItem(this.runtime.flatInstances, key);
|
|
434
435
|
// 找不到控件说明不是改动控件上的字段,直接通过
|
|
435
436
|
if (!instance) {
|
|
436
437
|
return newValue;
|
|
437
438
|
}
|
|
438
439
|
// @ts-ignore
|
|
439
440
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
440
|
-
if (newValue === null) {
|
|
441
|
-
return [];
|
|
442
|
-
}
|
|
443
441
|
// @ts-ignore
|
|
444
442
|
var fieldTypeMap = instance.props.headers.reduce(function(result, column) {
|
|
445
443
|
var formInstance = column.children[0];
|
|
@@ -448,11 +446,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
448
446
|
}
|
|
449
447
|
return result;
|
|
450
448
|
}, {});
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
if (newValue === null) {
|
|
450
|
+
return [];
|
|
451
|
+
}
|
|
453
452
|
return newValue.map(function(row) {
|
|
454
453
|
return(// @ts-ignore
|
|
455
|
-
checkerSubtableValue(fieldTypeMap, row,
|
|
454
|
+
checkerSubtableValue(fieldTypeMap, row, _this.getEmptyState(instance.id)));
|
|
456
455
|
});
|
|
457
456
|
}
|
|
458
457
|
var keys = key.split(".");
|
|
@@ -473,7 +472,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
473
472
|
};
|
|
474
473
|
_proto._handlerArrayUpdate = function _handlerArrayUpdate(state, key, type, args, result) {
|
|
475
474
|
var _this = this;
|
|
476
|
-
var subtable = findItem(this.runtime.flatInstances, key
|
|
475
|
+
var subtable = findItem(this.runtime.flatInstances, key);
|
|
477
476
|
if (!_instanceof(subtable, RuntimeListControl)) return;
|
|
478
477
|
// 新增多行方法
|
|
479
478
|
var createRows = function(len) {
|
|
@@ -563,7 +562,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
563
562
|
}
|
|
564
563
|
};
|
|
565
564
|
_proto._handlerObjectUpdate = function _handlerObjectUpdate(state, key, value, oldValue) {
|
|
566
|
-
var instance = findItem(this.runtime.flatInstances, key
|
|
565
|
+
var instance = findItem(this.runtime.flatInstances, key);
|
|
567
566
|
if (!instance) {
|
|
568
567
|
return;
|
|
569
568
|
}
|
|
@@ -880,7 +879,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
880
879
|
for(var keyChi1 in item[keyChi]){
|
|
881
880
|
var _controlIdMapping_key_children_keyChi2;
|
|
882
881
|
objChi[(_controlIdMapping_key_children_keyChi2 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi2 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi2.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
|
|
883
|
-
//
|
|
882
|
+
//
|
|
884
883
|
}
|
|
885
884
|
}
|
|
886
885
|
}
|
|
@@ -1131,11 +1130,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1131
1130
|
* @param header 明细表内是否获取表头的控件
|
|
1132
1131
|
*/ _proto.getInstances = function getInstances(controlId) {
|
|
1133
1132
|
var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1134
|
-
var cc = console;
|
|
1135
|
-
var label = "\uD83D\uDC11 genInstances " + controlId + " " + Date.now();
|
|
1136
|
-
cc.time(label);
|
|
1137
1133
|
if (controlId === undefined) {
|
|
1138
|
-
cc.timeEnd(label);
|
|
1139
1134
|
return this.runtime.flatInstances;
|
|
1140
1135
|
}
|
|
1141
1136
|
var instances = this.runtime.flatInstances.filter(// @ts-ignore
|
|
@@ -1178,7 +1173,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1178
1173
|
}
|
|
1179
1174
|
}
|
|
1180
1175
|
}
|
|
1181
|
-
cc.timeEnd(label);
|
|
1182
1176
|
return instances;
|
|
1183
1177
|
};
|
|
1184
1178
|
_proto.setInstance = function setInstance(instance, props, value, rowIndex) {
|
|
@@ -1333,4 +1327,3 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1333
1327
|
return Engine;
|
|
1334
1328
|
}(Watcher);
|
|
1335
1329
|
export { Engine };
|
|
1336
|
-
console.log("a");
|
|
@@ -114,10 +114,6 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
114
114
|
var instances = [];
|
|
115
115
|
var instanceMap = {};
|
|
116
116
|
loop(this._instance, function(item) {
|
|
117
|
-
// 3.4.1 避免将 subtable-column 放到 _flatInstances 中
|
|
118
|
-
if (item.type === "subtable-column") {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
117
|
instances.push(item);
|
|
122
118
|
if (!instanceMap[item.id]) {
|
|
123
119
|
instanceMap[item.id] = [];
|
|
@@ -32,7 +32,6 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
32
32
|
}
|
|
33
33
|
import { RuntimeFormControl } from "@byteluck-fe/model-driven-core";
|
|
34
34
|
import { error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
35
|
-
var cc = console;
|
|
36
35
|
var proxyArrayApi = [
|
|
37
36
|
"splice",
|
|
38
37
|
"push",
|
|
@@ -222,21 +221,15 @@ function flatInstanceForChildren(controls) {
|
|
|
222
221
|
* 在flatInstance中通过key查找出对应的instance
|
|
223
222
|
* @param flatInstance 拍平的instance数组
|
|
224
223
|
* @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
|
|
225
|
-
* */ export function findItem(flatInstance, key
|
|
224
|
+
* */ export function findItem(flatInstance, key) {
|
|
226
225
|
if (key === "") return undefined;
|
|
227
226
|
var keys = key.split(".");
|
|
228
227
|
if (keys.length === 0) return undefined;
|
|
229
228
|
var oneKey = keys[0];
|
|
230
229
|
var otherKeys = keys.slice(1);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// cc.log('🏠 findItem flatInstance find result', initInstance)
|
|
235
|
-
// cc.timeEnd('findItem flatInstance find')
|
|
236
|
-
// cc.time('findItem instanceMap match')
|
|
237
|
-
var initInstance = instanceMap[oneKey];
|
|
238
|
-
// cc.log('🏠 findItem instanceMap match result', initInstance)
|
|
239
|
-
// cc.timeEnd('findItem instanceMap match')
|
|
230
|
+
var initInstance = flatInstance.find(function(item) {
|
|
231
|
+
return item.id === oneKey;
|
|
232
|
+
});
|
|
240
233
|
if (otherKeys.length === 0) return initInstance;
|
|
241
234
|
// @ts-ignore
|
|
242
235
|
return otherKeys.reduce(function(prevItem, key) {
|