@byteluck-fe/model-driven-engine 2.8.1-alpha.1 → 2.8.1-alpha.5
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.
|
@@ -1471,35 +1471,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1471
1471
|
// 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1472
1472
|
if (instances.length) {
|
|
1473
1473
|
var instance = instances[0];
|
|
1474
|
-
var headerInstance = this.
|
|
1475
|
-
if (headerInstance) {
|
|
1474
|
+
var headerInstance = this.findSubtableHeadersControl(instance.id);
|
|
1475
|
+
if (headerInstance !== undefined) {
|
|
1476
1476
|
instances.unshift(headerInstance);
|
|
1477
1477
|
}
|
|
1478
|
-
} else {
|
|
1479
|
-
var _this_getControlIdMapping;
|
|
1480
|
-
var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
|
|
1481
|
-
var _Object_entries_find;
|
|
1482
|
-
var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1483
|
-
var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
|
|
1484
|
-
return mapping.children && controlId in mapping.children;
|
|
1485
|
-
})) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
|
|
1486
|
-
if (subtableId) {
|
|
1487
|
-
var subtable = this.getInstance(subtableId);
|
|
1488
|
-
// @ts-ignore
|
|
1489
|
-
var headerColumn = subtable.props.headers.find(function(column) {
|
|
1490
|
-
return column.children.find(function(item) {
|
|
1491
|
-
return item.id === controlId;
|
|
1492
|
-
});
|
|
1493
|
-
});
|
|
1494
|
-
if (headerColumn) {
|
|
1495
|
-
var headerInstance1 = headerColumn.children.find(function(item) {
|
|
1496
|
-
return item.id === controlId;
|
|
1497
|
-
});
|
|
1498
|
-
if (headerInstance1) {
|
|
1499
|
-
instances.unshift(headerInstance1);
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
1478
|
}
|
|
1504
1479
|
}
|
|
1505
1480
|
// @ts-ignore
|
|
@@ -1741,18 +1716,29 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1741
1716
|
{
|
|
1742
1717
|
key: "inList",
|
|
1743
1718
|
value: function inList(controlId) {
|
|
1744
|
-
var
|
|
1745
|
-
var
|
|
1746
|
-
var
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
if (matched) {
|
|
1751
|
-
listKey = key;
|
|
1719
|
+
var mapping = this.store.subtableHeadersControlIdMapping;
|
|
1720
|
+
var subtableId = undefined;
|
|
1721
|
+
for(var key in mapping){
|
|
1722
|
+
if (controlId in mapping[key]) {
|
|
1723
|
+
subtableId = key;
|
|
1724
|
+
break;
|
|
1752
1725
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1726
|
+
}
|
|
1727
|
+
return subtableId;
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
key: "findSubtableHeadersControl",
|
|
1732
|
+
value: function findSubtableHeadersControl(controlId) {
|
|
1733
|
+
var mapping = this.store.subtableHeadersControlIdMapping;
|
|
1734
|
+
var instance = undefined;
|
|
1735
|
+
for(var key in mapping){
|
|
1736
|
+
if (controlId in mapping[key]) {
|
|
1737
|
+
instance = mapping[key][controlId];
|
|
1738
|
+
break;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
return instance;
|
|
1756
1742
|
}
|
|
1757
1743
|
}
|
|
1758
1744
|
], [
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -57,13 +57,15 @@ var Store = /*#__PURE__*/ function() {
|
|
|
57
57
|
_define_property(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
58
58
|
);
|
|
59
59
|
_define_property(this, "controlIdMapping", void 0);
|
|
60
|
+
_define_property(this, "subtableHeadersControlIdMapping", void 0);
|
|
60
61
|
_define_property(this, "defaultState", void 0);
|
|
61
|
-
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
|
|
62
|
+
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState, subtableHeadersControlIdMapping = _init.subtableHeadersControlIdMapping;
|
|
62
63
|
this.emptyState = emptyState;
|
|
63
64
|
this.state = state;
|
|
64
65
|
this.dataBindMapping = databindMapping;
|
|
65
66
|
this.controlIdMapping = controlidMapping;
|
|
66
67
|
this.defaultState = defaultState;
|
|
68
|
+
this.subtableHeadersControlIdMapping = subtableHeadersControlIdMapping;
|
|
67
69
|
}
|
|
68
70
|
_create_class(Store, [
|
|
69
71
|
{
|
|
@@ -233,6 +235,7 @@ function init(instance) {
|
|
|
233
235
|
var emptyState = {};
|
|
234
236
|
var databindMapping = {};
|
|
235
237
|
var controlidMapping = {};
|
|
238
|
+
var subtableHeadersControlIdMapping = {};
|
|
236
239
|
var defaultState = {};
|
|
237
240
|
// loopFormControl(instance, (item, children) => {
|
|
238
241
|
// })
|
|
@@ -248,6 +251,7 @@ function init(instance) {
|
|
|
248
251
|
buildState(dataViewState, emptyDataViewState, item);
|
|
249
252
|
buildDataBindMapping(databindMapping, dvId, item);
|
|
250
253
|
buildControlIdMapping(controlidMapping, dvId, item);
|
|
254
|
+
buildSubtableHeadersControlIdMapping(subtableHeadersControlIdMapping, item);
|
|
251
255
|
});
|
|
252
256
|
state[dvId] = {};
|
|
253
257
|
defaultState[dvId] = dataViewState;
|
|
@@ -256,6 +260,7 @@ function init(instance) {
|
|
|
256
260
|
return {
|
|
257
261
|
state: state,
|
|
258
262
|
defaultState: defaultState,
|
|
263
|
+
subtableHeadersControlIdMapping: subtableHeadersControlIdMapping,
|
|
259
264
|
emptyState: emptyState,
|
|
260
265
|
databindMapping: databindMapping,
|
|
261
266
|
controlidMapping: controlidMapping
|
|
@@ -400,4 +405,17 @@ item) {
|
|
|
400
405
|
});
|
|
401
406
|
}
|
|
402
407
|
}
|
|
408
|
+
function buildSubtableHeadersControlIdMapping(data, // @ts-ignore
|
|
409
|
+
item) {
|
|
410
|
+
if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
411
|
+
var headersInstances = {};
|
|
412
|
+
item.props.headers.map(// @ts-ignore
|
|
413
|
+
function(item) {
|
|
414
|
+
item.children.map(function(item) {
|
|
415
|
+
Object.assign(headersInstances, _define_property({}, item.id, item));
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
Object.assign(data, _define_property({}, item.id, headersInstances));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
403
421
|
export { Store };
|