@byteluck-fe/model-driven-engine 2.22.0-beta.7 → 2.22.1-beta.1
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.
|
@@ -549,7 +549,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
549
549
|
createdNewRows = createRows(newRowLengths);
|
|
550
550
|
createdNewRowsData = args;
|
|
551
551
|
(_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
|
|
552
|
-
this.runtime.getFlatInstances();
|
|
553
552
|
break;
|
|
554
553
|
case 'splice':
|
|
555
554
|
if (args.length > 2) {
|
|
@@ -567,7 +566,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
567
566
|
start,
|
|
568
567
|
replace
|
|
569
568
|
].concat(_to_consumable_array(createdNewRows)));
|
|
570
|
-
this.runtime.getFlatInstances();
|
|
571
569
|
// newValues.forEach((item: any, index) => {
|
|
572
570
|
// let newIndex = start + index
|
|
573
571
|
// this.setStates(item, newIndex, options)
|
|
@@ -583,14 +581,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
583
581
|
isDeleteLastOne = true;
|
|
584
582
|
}
|
|
585
583
|
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
|
|
586
|
-
this.runtime.getFlatInstances();
|
|
587
584
|
}
|
|
588
585
|
break;
|
|
589
586
|
default:
|
|
590
587
|
var // @ts-ignore
|
|
591
588
|
_subtable_children3;
|
|
592
589
|
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
|
|
593
|
-
this.runtime.getFlatInstances();
|
|
594
590
|
break;
|
|
595
591
|
}
|
|
596
592
|
if (type === 'splice') {
|
|
@@ -605,6 +601,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
605
601
|
}
|
|
606
602
|
var subtableData = this.getState(subtable.id);
|
|
607
603
|
this._handlerSubtableUpdateUid(subtableData);
|
|
604
|
+
this.runtime.getFlatInstances();
|
|
608
605
|
this.emit('list-change', {
|
|
609
606
|
instance: subtable,
|
|
610
607
|
value: subtableData,
|
|
@@ -658,7 +655,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
658
655
|
row && newRows.push(row);
|
|
659
656
|
}
|
|
660
657
|
(_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
|
|
661
|
-
this.runtime.getFlatInstances();
|
|
662
658
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
663
659
|
// for (let i = 0; i < newValue.length; i++) {
|
|
664
660
|
// this.setStates(newValue[i], i, options)
|
|
@@ -666,6 +662,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
666
662
|
var deleted = oldValue !== null && oldValue !== void 0 ? oldValue : [];
|
|
667
663
|
if ((options === null || options === void 0 ? void 0 : options.setData) === true) {
|
|
668
664
|
deleted = [];
|
|
665
|
+
} else {
|
|
666
|
+
this.runtime.getFlatInstances();
|
|
669
667
|
}
|
|
670
668
|
this._handlerSubtableUpdateUid(newValue);
|
|
671
669
|
this.emit('list-change', {
|
|
@@ -1401,6 +1399,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1401
1399
|
this.setStates(newState, undefined, _object_spread({
|
|
1402
1400
|
setData: true
|
|
1403
1401
|
}, options));
|
|
1402
|
+
this.runtime.getFlatInstances();
|
|
1404
1403
|
this.debugLog("engine setData方法执行完成。");
|
|
1405
1404
|
}
|
|
1406
1405
|
},
|
|
@@ -1505,12 +1504,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1505
1504
|
var instances = Array.from(this.runtime.instanceMap[controlId] || []);
|
|
1506
1505
|
if (header) {
|
|
1507
1506
|
// 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1508
|
-
if (instances.length) {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1507
|
+
// if (instances.length) {
|
|
1508
|
+
// const instance: RuntimeControl = instances[0]
|
|
1509
|
+
// const headerInstance = this.findSubtableHeadersControl(instance.id)
|
|
1510
|
+
// if (headerInstance !== undefined) {
|
|
1511
|
+
// instances.unshift(headerInstance)
|
|
1512
|
+
// }
|
|
1513
|
+
// }
|
|
1514
|
+
var headerInstance = this.findSubtableHeadersControl(controlId);
|
|
1515
|
+
if (headerInstance !== undefined) {
|
|
1516
|
+
instances.unshift(headerInstance);
|
|
1514
1517
|
}
|
|
1515
1518
|
}
|
|
1516
1519
|
// @ts-ignore
|
|
@@ -126,6 +126,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
126
126
|
var instanceMap = {};
|
|
127
127
|
var controlParentIdMap = {};
|
|
128
128
|
loop(this._instance, '', function(item, parentId) {
|
|
129
|
+
var _item_parent;
|
|
129
130
|
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
130
131
|
//4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
|
|
131
132
|
// if (item.type === 'subtable-row' || item.type === 'subtable-column') {
|
|
@@ -145,6 +146,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
instances.push(item);
|
|
149
|
+
if (((_item_parent = item.parent) === null || _item_parent === void 0 ? void 0 : _item_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN && item.parent.parent === undefined) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
148
152
|
instanceMap[item.id].push(item);
|
|
149
153
|
});
|
|
150
154
|
this._flatInstances = instances;
|
|
@@ -293,9 +297,9 @@ function loop(control, parentId, callback) {
|
|
|
293
297
|
if (hasHeaderOrFooterControl(item, 'headers')) {
|
|
294
298
|
loop(item.props.headers, item.id, callback);
|
|
295
299
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
300
|
+
// if (hasHeaderOrFooterControl(item, 'footers')) {
|
|
301
|
+
// loop((item.props as any).footers, item.id, callback)
|
|
302
|
+
// }
|
|
299
303
|
});
|
|
300
304
|
}
|
|
301
305
|
function hasHeaderOrFooterControl(control, checkType) {
|
|
@@ -6,7 +6,8 @@ export function loopFormControl(control, callback) {
|
|
|
6
6
|
if (Array.isArray(control)) {
|
|
7
7
|
control.map(function(item) {
|
|
8
8
|
//TODO 此处需要再抽象一层 datagrid/datalist
|
|
9
|
-
if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
9
|
+
// if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
10
|
+
if (item.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
10
11
|
// @ts-ignore
|
|
11
12
|
var children = []//item.getChildrenFormControl() as RuntimeFormControl[]
|
|
12
13
|
;
|