@byteluck-fe/model-driven-engine 2.7.0-alpha.30a → 2.7.0-alpha.33
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 +79 -118
- package/dist/esm/common/Runtime.js +30 -69
- package/dist/esm/plugins/CalcPlugin.js +1 -1
- package/dist/esm/plugins/ES6ModulePlugin.js +18 -47
- package/dist/index.umd.js +7 -7
- package/dist/types/common/Engine.d.ts +3 -4
- package/dist/types/common/Runtime.d.ts +0 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +1 -2
- package/package.json +4 -4
|
@@ -702,8 +702,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
702
702
|
var columns = this.createControl(template);
|
|
703
703
|
(_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
|
|
704
704
|
}
|
|
705
|
-
//@ts-ignore
|
|
706
|
-
row.parent = instance;
|
|
707
705
|
return row;
|
|
708
706
|
}
|
|
709
707
|
},
|
|
@@ -823,12 +821,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
823
821
|
return this.setInstance(instance, props, value, rowIndex);
|
|
824
822
|
}
|
|
825
823
|
},
|
|
826
|
-
{
|
|
827
|
-
key: "getRule",
|
|
828
|
-
value: function getRule(controlType, props) {
|
|
829
|
-
return Runtime.staticGetRules(controlType, props);
|
|
830
|
-
}
|
|
831
|
-
},
|
|
832
824
|
{
|
|
833
825
|
key: "getAllRules",
|
|
834
826
|
value: function getAllRules(controlId) {
|
|
@@ -1138,7 +1130,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1138
1130
|
value: function buildFields(dataCode, state) {
|
|
1139
1131
|
var _this = this;
|
|
1140
1132
|
var mapping = this.getDataBindMapping(dataCode);
|
|
1141
|
-
if (!mapping
|
|
1133
|
+
if (!mapping) {
|
|
1142
1134
|
return;
|
|
1143
1135
|
}
|
|
1144
1136
|
var skipKeys = [];
|
|
@@ -1331,59 +1323,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1331
1323
|
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1332
1324
|
* @param controlId
|
|
1333
1325
|
* @param header 明细表内是否获取表头的控件
|
|
1334
|
-
*/
|
|
1335
|
-
// controlId?: string,
|
|
1336
|
-
// header: boolean = false
|
|
1337
|
-
// ): ControlRuntimeInstance<ControlsKeys>[] {
|
|
1338
|
-
// // const cc = console
|
|
1339
|
-
// // const label = '🐑 genInstances ' + controlId + ' ' + Date.now()
|
|
1340
|
-
// // cc.time(label)
|
|
1341
|
-
//
|
|
1342
|
-
// if (controlId === undefined) {
|
|
1343
|
-
// // cc.timeEnd(label)
|
|
1344
|
-
// return this.runtime.flatInstances
|
|
1345
|
-
// }
|
|
1346
|
-
// const instances = Array.from(this.runtime.instanceMap[controlId] || [])
|
|
1347
|
-
// if (header) {
|
|
1348
|
-
// // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1349
|
-
// if (instances.length) {
|
|
1350
|
-
// const instance: RuntimeControl = instances[0]
|
|
1351
|
-
// // if (this.inList(instance.id) === true) {
|
|
1352
|
-
// if (this.inList(instance.id) !== undefined) {
|
|
1353
|
-
// const headerInstance = this.getInstanceInSubtableHeader(instance)
|
|
1354
|
-
// if (headerInstance) {
|
|
1355
|
-
// instances.unshift(headerInstance)
|
|
1356
|
-
// }
|
|
1357
|
-
// }
|
|
1358
|
-
// } else {
|
|
1359
|
-
// const controlIdMapping = this.getControlIdMapping()
|
|
1360
|
-
// const [subtableId] =
|
|
1361
|
-
// Object.entries(controlIdMapping).find(
|
|
1362
|
-
// ([_, mapping]) => mapping.children && controlId in mapping.children
|
|
1363
|
-
// ) ?? []
|
|
1364
|
-
// if (subtableId) {
|
|
1365
|
-
// const subtable = this.getInstance(subtableId)
|
|
1366
|
-
// // @ts-ignore
|
|
1367
|
-
// const headerColumn = subtable.props.headers.find((column: any) =>
|
|
1368
|
-
// column.children.find((item: any) => item.id === controlId)
|
|
1369
|
-
// )
|
|
1370
|
-
// if (headerColumn) {
|
|
1371
|
-
// const headerInstance = headerColumn.children.find(
|
|
1372
|
-
// (item: any) => item.id === controlId
|
|
1373
|
-
// )
|
|
1374
|
-
// if (headerInstance) {
|
|
1375
|
-
// instances.unshift(
|
|
1376
|
-
// headerInstance as ControlRuntimeInstance<ControlsKeys>
|
|
1377
|
-
// )
|
|
1378
|
-
// }
|
|
1379
|
-
// }
|
|
1380
|
-
// }
|
|
1381
|
-
// }
|
|
1382
|
-
// }
|
|
1383
|
-
// // @ts-ignore
|
|
1384
|
-
// return instances
|
|
1385
|
-
// }
|
|
1386
|
-
key: "getInstances",
|
|
1326
|
+
*/ key: "getInstances",
|
|
1387
1327
|
value: function getInstances(controlId) {
|
|
1388
1328
|
var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1389
1329
|
// const cc = console
|
|
@@ -1393,15 +1333,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1393
1333
|
// cc.timeEnd(label)
|
|
1394
1334
|
return this.runtime.flatInstances;
|
|
1395
1335
|
}
|
|
1396
|
-
var instances = this.runtime.instanceMap[controlId] || [];
|
|
1336
|
+
var instances = Array.from(this.runtime.instanceMap[controlId] || []);
|
|
1397
1337
|
if (header) {
|
|
1398
|
-
|
|
1399
|
-
if (
|
|
1400
|
-
var
|
|
1401
|
-
//
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1338
|
+
// 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1339
|
+
if (instances.length) {
|
|
1340
|
+
var instance = instances[0];
|
|
1341
|
+
// if (this.inList(instance.id) === true) {
|
|
1342
|
+
if (this.inList(instance.id) !== undefined) {
|
|
1343
|
+
var headerInstance = this.getInstanceInSubtableHeader(instance);
|
|
1344
|
+
if (headerInstance) {
|
|
1345
|
+
instances.unshift(headerInstance);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
} else {
|
|
1349
|
+
var _this_getControlIdMapping;
|
|
1350
|
+
var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
|
|
1351
|
+
var _Object_entries_find;
|
|
1352
|
+
var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1353
|
+
var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
|
|
1354
|
+
return mapping.children && controlId in mapping.children;
|
|
1355
|
+
})) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
|
|
1356
|
+
if (subtableId) {
|
|
1357
|
+
var subtable = this.getInstance(subtableId);
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
var headerColumn = subtable.props.headers.find(function(column) {
|
|
1360
|
+
return column.children.find(function(item) {
|
|
1361
|
+
return item.id === controlId;
|
|
1362
|
+
});
|
|
1363
|
+
});
|
|
1364
|
+
if (headerColumn) {
|
|
1365
|
+
var headerInstance1 = headerColumn.children.find(function(item) {
|
|
1366
|
+
return item.id === controlId;
|
|
1367
|
+
});
|
|
1368
|
+
if (headerInstance1) {
|
|
1369
|
+
instances.unshift(headerInstance1);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1405
1372
|
}
|
|
1406
1373
|
}
|
|
1407
1374
|
}
|
|
@@ -1516,64 +1483,55 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1516
1483
|
* 如果控件在表头内,则返回-1
|
|
1517
1484
|
* 如果控件在表内,则返回行下标
|
|
1518
1485
|
* 如果控件不在明细表内,则返回undefined
|
|
1519
|
-
* */
|
|
1520
|
-
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1521
|
-
// ) {
|
|
1522
|
-
// if (!instance.parent) {
|
|
1523
|
-
// return
|
|
1524
|
-
// }
|
|
1525
|
-
// let rowIndex: number | undefined
|
|
1526
|
-
// // @ts-ignore
|
|
1527
|
-
// if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
|
|
1528
|
-
// // 表头内的控件
|
|
1529
|
-
// // @ts-ignore
|
|
1530
|
-
// if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1531
|
-
// rowIndex = -1
|
|
1532
|
-
// } else {
|
|
1533
|
-
// // @ts-ignore
|
|
1534
|
-
// // const index = instance.parent.children.findIndex(
|
|
1535
|
-
// // (item: any) => item === instance
|
|
1536
|
-
// // )
|
|
1537
|
-
// let instances = this.runtime.instanceMap[instance.id] || []
|
|
1538
|
-
// const index = instances.findIndex((item: any) => item === instance)
|
|
1539
|
-
// if (index > -1) {
|
|
1540
|
-
// rowIndex = index
|
|
1541
|
-
// }
|
|
1542
|
-
// }
|
|
1543
|
-
// } else {
|
|
1544
|
-
// rowIndex = this.getInstanceRowIndex(instance.parent)
|
|
1545
|
-
// }
|
|
1546
|
-
// return rowIndex
|
|
1547
|
-
// }
|
|
1548
|
-
function getInstanceRowIndex(instance) {
|
|
1486
|
+
* */ function getInstanceRowIndex(instance) {
|
|
1549
1487
|
if (!instance.parent) {
|
|
1550
1488
|
return;
|
|
1551
1489
|
}
|
|
1552
1490
|
var rowIndex;
|
|
1553
1491
|
// @ts-ignore
|
|
1554
|
-
if (this.assertInstance(instance, CONTROL_TYPE.
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
rowIndex = index;
|
|
1567
|
-
}
|
|
1492
|
+
if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
|
|
1493
|
+
// 表头内的控件
|
|
1494
|
+
// @ts-ignore
|
|
1495
|
+
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1496
|
+
rowIndex = -1;
|
|
1497
|
+
} else {
|
|
1498
|
+
// @ts-ignore
|
|
1499
|
+
var index = instance.parent.children.findIndex(function(item) {
|
|
1500
|
+
return item === instance;
|
|
1501
|
+
});
|
|
1502
|
+
if (index > -1) {
|
|
1503
|
+
rowIndex = index;
|
|
1568
1504
|
}
|
|
1569
1505
|
}
|
|
1506
|
+
} else {
|
|
1507
|
+
rowIndex = this.getInstanceRowIndex(instance.parent);
|
|
1570
1508
|
}
|
|
1571
1509
|
return rowIndex;
|
|
1572
1510
|
}
|
|
1573
1511
|
},
|
|
1574
1512
|
{
|
|
1575
1513
|
key: "getInstanceParentControl",
|
|
1576
|
-
value:
|
|
1514
|
+
value: // public getInstanceRowIndex(
|
|
1515
|
+
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1516
|
+
// ) {
|
|
1517
|
+
// let rowIndex: number | undefined
|
|
1518
|
+
// // @ts-ignore
|
|
1519
|
+
// if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1520
|
+
// rowIndex = -1
|
|
1521
|
+
// }else{
|
|
1522
|
+
// const instanceList = this.runtime.instanceMap[instance.id]
|
|
1523
|
+
// if(Object.prototype.toString.call(instanceList) === '[object Array]'){
|
|
1524
|
+
// const index = instanceList.findIndex(
|
|
1525
|
+
// (item: any) => item === instance
|
|
1526
|
+
// )
|
|
1527
|
+
// if (index > -1) {
|
|
1528
|
+
// rowIndex = index
|
|
1529
|
+
// }
|
|
1530
|
+
// }
|
|
1531
|
+
// }
|
|
1532
|
+
// return rowIndex
|
|
1533
|
+
// }
|
|
1534
|
+
function getInstanceParentControl(instance, controlType) {
|
|
1577
1535
|
if (!instance.parent) {
|
|
1578
1536
|
return;
|
|
1579
1537
|
}
|
|
@@ -1652,8 +1610,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1652
1610
|
{
|
|
1653
1611
|
key: "register",
|
|
1654
1612
|
value: // 注册外部控件
|
|
1655
|
-
function register(
|
|
1656
|
-
|
|
1613
|
+
function register() {
|
|
1614
|
+
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1615
|
+
arg[_key] = arguments[_key];
|
|
1616
|
+
}
|
|
1617
|
+
var _Runtime;
|
|
1618
|
+
return (_Runtime = Runtime).register.apply(_Runtime, _to_consumable_array(arg));
|
|
1657
1619
|
}
|
|
1658
1620
|
},
|
|
1659
1621
|
{
|
|
@@ -1665,5 +1627,4 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1665
1627
|
]);
|
|
1666
1628
|
return Engine;
|
|
1667
1629
|
}(Watcher);
|
|
1668
|
-
// @ts-ignore
|
|
1669
1630
|
export { Engine };
|
|
@@ -97,7 +97,7 @@ function _create_super(Derived) {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
import { RegisterControls } from "@byteluck-fe/model-driven-core";
|
|
100
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE,
|
|
100
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from "@byteluck-fe/model-driven-shared";
|
|
101
101
|
import { hasChildrenControl, loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
|
|
102
102
|
export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
103
103
|
"use strict";
|
|
@@ -111,7 +111,6 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
111
111
|
_define_property(_assert_this_initialized(_this), "_instance", void 0);
|
|
112
112
|
_define_property(_assert_this_initialized(_this), "_flatInstances", []);
|
|
113
113
|
_define_property(_assert_this_initialized(_this), "_instanceMap", {});
|
|
114
|
-
_define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
|
|
115
114
|
var schema = props.schema;
|
|
116
115
|
_this._schema = schema;
|
|
117
116
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
@@ -124,32 +123,19 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
124
123
|
value: function getFlatInstances() {
|
|
125
124
|
var instances = [];
|
|
126
125
|
var instanceMap = {};
|
|
127
|
-
|
|
128
|
-
loop(this._instance, "", function(item, parentId) {
|
|
126
|
+
loop(this._instance, function(item) {
|
|
129
127
|
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// return
|
|
133
|
-
// }
|
|
134
|
-
if (parentId) {
|
|
135
|
-
// @ts-ignore
|
|
136
|
-
controlParentIdMap[item.id] = parentId;
|
|
128
|
+
if (item.type === "subtable-row" || item.type === "subtable-column") {
|
|
129
|
+
return;
|
|
137
130
|
}
|
|
131
|
+
instances.push(item);
|
|
138
132
|
if (!instanceMap[item.id]) {
|
|
139
133
|
instanceMap[item.id] = [];
|
|
140
134
|
}
|
|
141
|
-
//不知为何subtable-column会多存一次
|
|
142
|
-
if (item.type === "subtable-column") {
|
|
143
|
-
if (instanceMap[item.id].length > 0) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
instances.push(item);
|
|
148
135
|
instanceMap[item.id].push(item);
|
|
149
136
|
});
|
|
150
137
|
this._flatInstances = instances;
|
|
151
138
|
this._instanceMap = instanceMap;
|
|
152
|
-
this._controlParentIdMap = controlParentIdMap;
|
|
153
139
|
return this._flatInstances;
|
|
154
140
|
}
|
|
155
141
|
},
|
|
@@ -183,9 +169,8 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
183
169
|
var antdRules = {};
|
|
184
170
|
var ruleItems = {};
|
|
185
171
|
loopDataViewControl(this._instance, function(dataView) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
antdRules[dataView.id] = JSONCopy(result[0]);
|
|
172
|
+
ruleItems[dataView.id] = dataView.rules[0];
|
|
173
|
+
antdRules[dataView.id] = dataView.rules[0];
|
|
189
174
|
loopFormControl(dataView.children, function(item) {
|
|
190
175
|
// if (
|
|
191
176
|
// item instanceof RuntimeFormControl ||
|
|
@@ -208,9 +193,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
208
193
|
get: function get() {
|
|
209
194
|
var ruleItems = {};
|
|
210
195
|
loopDataViewControl(this._instance, function(dataView) {
|
|
211
|
-
|
|
212
|
-
// ruleItems[dataView.id] = dataView.rules[0]
|
|
213
|
-
ruleItems[dataView.id] = result[0];
|
|
196
|
+
ruleItems[dataView.id] = dataView.rules[0];
|
|
214
197
|
loopFormControl(dataView.children, function(item) {
|
|
215
198
|
// if (
|
|
216
199
|
// item instanceof RuntimeFormControl ||
|
|
@@ -229,9 +212,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
229
212
|
get: function get() {
|
|
230
213
|
var antdRules = {};
|
|
231
214
|
loopDataViewControl(this._instance, function(dataView) {
|
|
232
|
-
|
|
233
|
-
// antdRules[dataView.id] = dataView.rules[0]
|
|
234
|
-
antdRules[dataView.id] = result[0];
|
|
215
|
+
antdRules[dataView.id] = dataView.rules[0];
|
|
235
216
|
loopFormControl(dataView.children, function(item) {
|
|
236
217
|
// if (
|
|
237
218
|
// item instanceof RuntimeFormControl ||
|
|
@@ -248,30 +229,22 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
248
229
|
]);
|
|
249
230
|
return Runtime;
|
|
250
231
|
}(RegisterControls);
|
|
251
|
-
function loop(control,
|
|
252
|
-
|
|
253
|
-
control
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
232
|
+
function loop(control, callback) {
|
|
233
|
+
if (Array.isArray(control)) {
|
|
234
|
+
control.map(function(item) {
|
|
235
|
+
callback(item);
|
|
236
|
+
if (hasChildrenControl(item)) {
|
|
237
|
+
var ctl = item;
|
|
238
|
+
if (!ctl.children) {
|
|
239
|
+
ctl.children = [];
|
|
240
|
+
}
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
loop(ctl.children, callback);
|
|
261
243
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
loop(item.props.headers, item.id, callback);
|
|
267
|
-
}
|
|
268
|
-
if (hasHeaderOrFooterControl(item, "footers")) {
|
|
269
|
-
loop(item.props.footers, item.id, callback);
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function hasHeaderOrFooterControl(control, checkType) {
|
|
274
|
-
return checkType in control.props && isArray(control.props[checkType]);
|
|
244
|
+
});
|
|
245
|
+
} else {
|
|
246
|
+
callback(control);
|
|
247
|
+
}
|
|
275
248
|
}
|
|
276
249
|
/**
|
|
277
250
|
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
@@ -279,7 +252,7 @@ function hasHeaderOrFooterControl(control, checkType) {
|
|
|
279
252
|
if (control.props.isHide) {
|
|
280
253
|
return true;
|
|
281
254
|
}
|
|
282
|
-
if (control.parent === null
|
|
255
|
+
if (control.parent === null) {
|
|
283
256
|
return false;
|
|
284
257
|
}
|
|
285
258
|
return getControlIsHide(control.parent);
|
|
@@ -289,14 +262,11 @@ item) {
|
|
|
289
262
|
if (getControlIsHide(item)) {
|
|
290
263
|
return;
|
|
291
264
|
}
|
|
292
|
-
var result = Runtime.staticGetRules(item.type, item.props);
|
|
293
265
|
// if (item instanceof RuntimeFormControl) {
|
|
294
266
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
295
|
-
|
|
296
|
-
data[item.id] = result;
|
|
267
|
+
data[item.id] = item.rules;
|
|
297
268
|
} else if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
298
|
-
|
|
299
|
-
data[item.id] = result;
|
|
269
|
+
data[item.id] = item.rules;
|
|
300
270
|
var itemRules = {
|
|
301
271
|
type: "array",
|
|
302
272
|
fields: {}
|
|
@@ -311,13 +281,8 @@ item) {
|
|
|
311
281
|
fields: {}
|
|
312
282
|
};
|
|
313
283
|
}
|
|
314
|
-
// // @ts-ignore
|
|
315
|
-
// itemRules.fields[index].fields[formControl.id] = (
|
|
316
|
-
// formControl as RuntimeFormControl
|
|
317
|
-
// ).rules
|
|
318
|
-
var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
|
|
319
284
|
// @ts-ignore
|
|
320
|
-
itemRules.fields[index].fields[formControl.id] =
|
|
285
|
+
itemRules.fields[index].fields[formControl.id] = formControl.rules;
|
|
321
286
|
}
|
|
322
287
|
});
|
|
323
288
|
});
|
|
@@ -329,19 +294,15 @@ item) {
|
|
|
329
294
|
if (getControlIsHide(item)) {
|
|
330
295
|
return;
|
|
331
296
|
}
|
|
332
|
-
var result = Runtime.staticGetRules(item.type, item.props);
|
|
333
297
|
// if (item instanceof RuntimeFormControl) {
|
|
334
298
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
335
|
-
|
|
336
|
-
antdRules[item.id] = result;
|
|
299
|
+
antdRules[item.id] = item.rules;
|
|
337
300
|
} else if (item.type === CONTROL_TYPE.SUBTABLE && item.children.length) {
|
|
338
301
|
antdRules[item.id] = [];
|
|
339
302
|
item.children.forEach(function(row) {
|
|
340
303
|
var rules = {};
|
|
341
304
|
loopFormSchema(row.children, function(formControl) {
|
|
342
|
-
|
|
343
|
-
var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
|
|
344
|
-
rules[formControl.id] = childResult;
|
|
305
|
+
rules[formControl.id] = formControl.rules;
|
|
345
306
|
});
|
|
346
307
|
antdRules[item.id].push(rules);
|
|
347
308
|
});
|
|
@@ -156,7 +156,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
156
156
|
if (control.props.isHide) {
|
|
157
157
|
return true;
|
|
158
158
|
}
|
|
159
|
-
if (control.parent === null
|
|
159
|
+
if (control.parent === null) {
|
|
160
160
|
return false;
|
|
161
161
|
}
|
|
162
162
|
return this.getControlIsHide(control.parent);
|
|
@@ -79,15 +79,13 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
79
79
|
import { error } from "@byteluck-fe/model-driven-shared";
|
|
80
80
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
81
81
|
"use strict";
|
|
82
|
-
function ES6ModulePlugin(config, env
|
|
82
|
+
function ES6ModulePlugin(config, env) {
|
|
83
83
|
_class_call_check(this, ES6ModulePlugin);
|
|
84
84
|
_define_property(this, "config", void 0);
|
|
85
85
|
_define_property(this, "engine", void 0);
|
|
86
86
|
_define_property(this, "env", void 0);
|
|
87
|
-
_define_property(this, "eventJs", void 0);
|
|
88
87
|
this.config = config;
|
|
89
88
|
this.env = env;
|
|
90
|
-
this.eventJs = eventJs;
|
|
91
89
|
}
|
|
92
90
|
_create_class(ES6ModulePlugin, [
|
|
93
91
|
{
|
|
@@ -98,55 +96,28 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
98
96
|
if (!action) {
|
|
99
97
|
return;
|
|
100
98
|
}
|
|
99
|
+
var res = parseModule(action, engine, this.env);
|
|
100
|
+
if (!res) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
101
103
|
var actionManager = engine.getAction();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
108
|
-
try {
|
|
109
|
-
for(var _iterator = Object.entries(this.eventJs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
110
|
-
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
111
|
-
actionManager.addAction(key, value);
|
|
112
|
-
}
|
|
113
|
-
} catch (err) {
|
|
114
|
-
_didIteratorError = true;
|
|
115
|
-
_iteratorError = err;
|
|
116
|
-
} finally{
|
|
117
|
-
try {
|
|
118
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
119
|
-
_iterator.return();
|
|
120
|
-
}
|
|
121
|
-
} finally{
|
|
122
|
-
if (_didIteratorError) {
|
|
123
|
-
throw _iteratorError;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
var res = parseModule(action, engine, this.env);
|
|
129
|
-
if (!res) {
|
|
130
|
-
return;
|
|
104
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
105
|
+
try {
|
|
106
|
+
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
107
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
108
|
+
actionManager.addAction(key, value);
|
|
131
109
|
}
|
|
132
|
-
|
|
110
|
+
} catch (err) {
|
|
111
|
+
_didIteratorError = true;
|
|
112
|
+
_iteratorError = err;
|
|
113
|
+
} finally{
|
|
133
114
|
try {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
actionManager.addAction(key1, value1);
|
|
115
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
116
|
+
_iterator.return();
|
|
137
117
|
}
|
|
138
|
-
} catch (err) {
|
|
139
|
-
_didIteratorError1 = true;
|
|
140
|
-
_iteratorError1 = err;
|
|
141
118
|
} finally{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
_iterator1.return();
|
|
145
|
-
}
|
|
146
|
-
} finally{
|
|
147
|
-
if (_didIteratorError1) {
|
|
148
|
-
throw _iteratorError1;
|
|
149
|
-
}
|
|
119
|
+
if (_didIteratorError) {
|
|
120
|
+
throw _iteratorError;
|
|
150
121
|
}
|
|
151
122
|
}
|
|
152
123
|
}
|