@byteluck-fe/model-driven-engine 2.7.0-alpha.14 → 2.7.0-alpha.15a
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.
|
@@ -690,6 +690,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
690
690
|
return this.setInstance(instance, props, value, rowIndex);
|
|
691
691
|
}
|
|
692
692
|
},
|
|
693
|
+
{
|
|
694
|
+
key: "getRule",
|
|
695
|
+
value: function getRule(controlType, props) {
|
|
696
|
+
return Runtime.staticGetRules(controlType, props);
|
|
697
|
+
}
|
|
698
|
+
},
|
|
693
699
|
{
|
|
694
700
|
key: "getAllRules",
|
|
695
701
|
value: function getAllRules(controlId) {
|
|
@@ -1000,7 +1006,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1000
1006
|
value: function buildFields(dataCode, state) {
|
|
1001
1007
|
var _this = this;
|
|
1002
1008
|
var mapping = this.getDataBindMapping(dataCode);
|
|
1003
|
-
if (!mapping) {
|
|
1009
|
+
if (!mapping || !mapping.fields) {
|
|
1004
1010
|
return;
|
|
1005
1011
|
}
|
|
1006
1012
|
var skipKeys = [];
|
|
@@ -1196,7 +1202,59 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1196
1202
|
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1197
1203
|
* @param controlId
|
|
1198
1204
|
* @param header 明细表内是否获取表头的控件
|
|
1199
|
-
*/
|
|
1205
|
+
*/ // getInstances(
|
|
1206
|
+
// controlId?: string,
|
|
1207
|
+
// header: boolean = false
|
|
1208
|
+
// ): ControlRuntimeInstance<ControlsKeys>[] {
|
|
1209
|
+
// // const cc = console
|
|
1210
|
+
// // const label = '🐑 genInstances ' + controlId + ' ' + Date.now()
|
|
1211
|
+
// // cc.time(label)
|
|
1212
|
+
//
|
|
1213
|
+
// if (controlId === undefined) {
|
|
1214
|
+
// // cc.timeEnd(label)
|
|
1215
|
+
// return this.runtime.flatInstances
|
|
1216
|
+
// }
|
|
1217
|
+
// const instances = Array.from(this.runtime.instanceMap[controlId] || [])
|
|
1218
|
+
// if (header) {
|
|
1219
|
+
// // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1220
|
+
// if (instances.length) {
|
|
1221
|
+
// const instance: RuntimeControl = instances[0]
|
|
1222
|
+
// // if (this.inList(instance.id) === true) {
|
|
1223
|
+
// if (this.inList(instance.id) !== undefined) {
|
|
1224
|
+
// const headerInstance = this.getInstanceInSubtableHeader(instance)
|
|
1225
|
+
// if (headerInstance) {
|
|
1226
|
+
// instances.unshift(headerInstance)
|
|
1227
|
+
// }
|
|
1228
|
+
// }
|
|
1229
|
+
// } else {
|
|
1230
|
+
// const controlIdMapping = this.getControlIdMapping()
|
|
1231
|
+
// const [subtableId] =
|
|
1232
|
+
// Object.entries(controlIdMapping).find(
|
|
1233
|
+
// ([_, mapping]) => mapping.children && controlId in mapping.children
|
|
1234
|
+
// ) ?? []
|
|
1235
|
+
// if (subtableId) {
|
|
1236
|
+
// const subtable = this.getInstance(subtableId)
|
|
1237
|
+
// // @ts-ignore
|
|
1238
|
+
// const headerColumn = subtable.props.headers.find((column: any) =>
|
|
1239
|
+
// column.children.find((item: any) => item.id === controlId)
|
|
1240
|
+
// )
|
|
1241
|
+
// if (headerColumn) {
|
|
1242
|
+
// const headerInstance = headerColumn.children.find(
|
|
1243
|
+
// (item: any) => item.id === controlId
|
|
1244
|
+
// )
|
|
1245
|
+
// if (headerInstance) {
|
|
1246
|
+
// instances.unshift(
|
|
1247
|
+
// headerInstance as ControlRuntimeInstance<ControlsKeys>
|
|
1248
|
+
// )
|
|
1249
|
+
// }
|
|
1250
|
+
// }
|
|
1251
|
+
// }
|
|
1252
|
+
// }
|
|
1253
|
+
// }
|
|
1254
|
+
// // @ts-ignore
|
|
1255
|
+
// return instances
|
|
1256
|
+
// }
|
|
1257
|
+
key: "getInstances",
|
|
1200
1258
|
value: function getInstances(controlId) {
|
|
1201
1259
|
var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1202
1260
|
// const cc = console
|
|
@@ -1206,42 +1264,15 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1206
1264
|
// cc.timeEnd(label)
|
|
1207
1265
|
return this.runtime.flatInstances;
|
|
1208
1266
|
}
|
|
1209
|
-
var instances =
|
|
1267
|
+
var instances = this.runtime.instanceMap[controlId] || [];
|
|
1210
1268
|
if (header) {
|
|
1211
|
-
|
|
1212
|
-
if (
|
|
1213
|
-
var instance = instances[0];
|
|
1214
|
-
// if (this.inList(instance.id) === true) {
|
|
1215
|
-
if (this.inList(instance.id) !== undefined) {
|
|
1216
|
-
var headerInstance = this.getInstanceInSubtableHeader(instance);
|
|
1217
|
-
if (headerInstance) {
|
|
1218
|
-
instances.unshift(headerInstance);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
} else {
|
|
1269
|
+
var instance = instances[0];
|
|
1270
|
+
if (instance) {
|
|
1222
1271
|
var ref;
|
|
1223
|
-
|
|
1224
|
-
var
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
return mapping.children && controlId in mapping.children;
|
|
1228
|
-
})) !== null && ref21 !== void 0 ? ref21 : [], 1), subtableId = ref22[0];
|
|
1229
|
-
if (subtableId) {
|
|
1230
|
-
var subtable = this.getInstance(subtableId);
|
|
1231
|
-
// @ts-ignore
|
|
1232
|
-
var headerColumn = subtable.props.headers.find(function(column) {
|
|
1233
|
-
return column.children.find(function(item) {
|
|
1234
|
-
return item.id === controlId;
|
|
1235
|
-
});
|
|
1236
|
-
});
|
|
1237
|
-
if (headerColumn) {
|
|
1238
|
-
var headerInstance1 = headerColumn.children.find(function(item) {
|
|
1239
|
-
return item.id === controlId;
|
|
1240
|
-
});
|
|
1241
|
-
if (headerInstance1) {
|
|
1242
|
-
instances.unshift(headerInstance1);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1272
|
+
// @ts-ignore
|
|
1273
|
+
var parentId = (ref = instance.parent) === null || ref === void 0 ? void 0 : ref.id;
|
|
1274
|
+
if (parentId) {
|
|
1275
|
+
instances = this.runtime.instanceMap[parentId] || [];
|
|
1245
1276
|
}
|
|
1246
1277
|
}
|
|
1247
1278
|
}
|
|
@@ -1356,55 +1387,64 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1356
1387
|
* 如果控件在表头内,则返回-1
|
|
1357
1388
|
* 如果控件在表内,则返回行下标
|
|
1358
1389
|
* 如果控件不在明细表内,则返回undefined
|
|
1359
|
-
* */
|
|
1390
|
+
* */ // public getInstanceRowIndex(
|
|
1391
|
+
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1392
|
+
// ) {
|
|
1393
|
+
// if (!instance.parent) {
|
|
1394
|
+
// return
|
|
1395
|
+
// }
|
|
1396
|
+
// let rowIndex: number | undefined
|
|
1397
|
+
// // @ts-ignore
|
|
1398
|
+
// if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
|
|
1399
|
+
// // 表头内的控件
|
|
1400
|
+
// // @ts-ignore
|
|
1401
|
+
// if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1402
|
+
// rowIndex = -1
|
|
1403
|
+
// } else {
|
|
1404
|
+
// // @ts-ignore
|
|
1405
|
+
// // const index = instance.parent.children.findIndex(
|
|
1406
|
+
// // (item: any) => item === instance
|
|
1407
|
+
// // )
|
|
1408
|
+
// let instances = this.runtime.instanceMap[instance.id] || []
|
|
1409
|
+
// const index = instances.findIndex((item: any) => item === instance)
|
|
1410
|
+
// if (index > -1) {
|
|
1411
|
+
// rowIndex = index
|
|
1412
|
+
// }
|
|
1413
|
+
// }
|
|
1414
|
+
// } else {
|
|
1415
|
+
// rowIndex = this.getInstanceRowIndex(instance.parent)
|
|
1416
|
+
// }
|
|
1417
|
+
// return rowIndex
|
|
1418
|
+
// }
|
|
1419
|
+
function getInstanceRowIndex(instance) {
|
|
1360
1420
|
if (!instance.parent) {
|
|
1361
1421
|
return;
|
|
1362
1422
|
}
|
|
1363
1423
|
var rowIndex;
|
|
1364
1424
|
// @ts-ignore
|
|
1365
|
-
if (this.assertInstance(instance
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1425
|
+
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1426
|
+
rowIndex = -1;
|
|
1427
|
+
} else {
|
|
1428
|
+
var isColumnChild = this.getInstanceParentControl(instance, // @ts-ignore
|
|
1429
|
+
CONTROL_TYPE.SUBTABLE_COLUMN);
|
|
1430
|
+
if (isColumnChild) {
|
|
1431
|
+
var instanceList = this.runtime.instanceMap[instance.id];
|
|
1432
|
+
if (Object.prototype.toString.call(instanceList) === '[object Array]') {
|
|
1433
|
+
var index = instanceList.findIndex(function(item) {
|
|
1434
|
+
return item === instance;
|
|
1435
|
+
});
|
|
1436
|
+
if (index > -1) {
|
|
1437
|
+
rowIndex = index;
|
|
1438
|
+
}
|
|
1377
1439
|
}
|
|
1378
1440
|
}
|
|
1379
|
-
} else {
|
|
1380
|
-
rowIndex = this.getInstanceRowIndex(instance.parent);
|
|
1381
1441
|
}
|
|
1382
1442
|
return rowIndex;
|
|
1383
1443
|
}
|
|
1384
1444
|
},
|
|
1385
1445
|
{
|
|
1386
1446
|
key: "getInstanceParentControl",
|
|
1387
|
-
value:
|
|
1388
|
-
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1389
|
-
// ) {
|
|
1390
|
-
// let rowIndex: number | undefined
|
|
1391
|
-
// // @ts-ignore
|
|
1392
|
-
// if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
|
|
1393
|
-
// rowIndex = -1
|
|
1394
|
-
// }else{
|
|
1395
|
-
// const instanceList = this.runtime.instanceMap[instance.id]
|
|
1396
|
-
// if(Object.prototype.toString.call(instanceList) === '[object Array]'){
|
|
1397
|
-
// const index = instanceList.findIndex(
|
|
1398
|
-
// (item: any) => item === instance
|
|
1399
|
-
// )
|
|
1400
|
-
// if (index > -1) {
|
|
1401
|
-
// rowIndex = index
|
|
1402
|
-
// }
|
|
1403
|
-
// }
|
|
1404
|
-
// }
|
|
1405
|
-
// return rowIndex
|
|
1406
|
-
// }
|
|
1407
|
-
function getInstanceParentControl(instance, controlType) {
|
|
1447
|
+
value: function getInstanceParentControl(instance, controlType) {
|
|
1408
1448
|
if (!instance.parent) {
|
|
1409
1449
|
return;
|
|
1410
1450
|
}
|
|
@@ -1469,8 +1509,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1469
1509
|
var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
|
|
1470
1510
|
var listKey = undefined;
|
|
1471
1511
|
Object.keys(mapping).some(function(key) {
|
|
1472
|
-
var ref,
|
|
1473
|
-
var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (
|
|
1512
|
+
var ref, ref21;
|
|
1513
|
+
var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref21 = ref.children) === null || ref21 === void 0 ? void 0 : ref21.hasOwnProperty(controlId);
|
|
1474
1514
|
if (matched) {
|
|
1475
1515
|
listKey = key;
|
|
1476
1516
|
}
|
|
@@ -1483,12 +1523,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1483
1523
|
{
|
|
1484
1524
|
key: "register",
|
|
1485
1525
|
value: // 注册外部控件
|
|
1486
|
-
function register() {
|
|
1487
|
-
|
|
1488
|
-
arg[_key] = arguments[_key];
|
|
1489
|
-
}
|
|
1490
|
-
var _Runtime;
|
|
1491
|
-
return (_Runtime = Runtime).register.apply(_Runtime, _toConsumableArray(arg));
|
|
1526
|
+
function register(control) {
|
|
1527
|
+
return Runtime.register(control, 'Runtime');
|
|
1492
1528
|
}
|
|
1493
1529
|
},
|
|
1494
1530
|
{
|
|
@@ -1500,4 +1536,5 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1500
1536
|
]);
|
|
1501
1537
|
return Engine;
|
|
1502
1538
|
}(Watcher);
|
|
1539
|
+
// @ts-ignore
|
|
1503
1540
|
export { Engine };
|
|
@@ -84,7 +84,7 @@ function _createSuper(Derived) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
import { RegisterControls } from '@byteluck-fe/model-driven-core';
|
|
87
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from '@byteluck-fe/model-driven-shared';
|
|
87
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
|
|
88
88
|
import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
|
|
89
89
|
export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
90
90
|
"use strict";
|
|
@@ -96,6 +96,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
96
96
|
_this = _super.call(this, 'Runtime');
|
|
97
97
|
_this._flatInstances = [];
|
|
98
98
|
_this._instanceMap = {};
|
|
99
|
+
_this._controlParentIdMap = {};
|
|
99
100
|
var schema = props.schema;
|
|
100
101
|
_this._schema = schema;
|
|
101
102
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
@@ -108,19 +109,32 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
108
109
|
value: function getFlatInstances() {
|
|
109
110
|
var instances = [];
|
|
110
111
|
var instanceMap = {};
|
|
111
|
-
|
|
112
|
+
var controlParentIdMap = {};
|
|
113
|
+
loop(this._instance, '', function(item, parentId) {
|
|
112
114
|
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
//4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
|
|
116
|
+
// if (item.type === 'subtable-row' || item.type === 'subtable-column') {
|
|
117
|
+
// return
|
|
118
|
+
// }
|
|
119
|
+
if (parentId) {
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
controlParentIdMap[item.id] = parentId;
|
|
115
122
|
}
|
|
116
|
-
instances.push(item);
|
|
117
123
|
if (!instanceMap[item.id]) {
|
|
118
124
|
instanceMap[item.id] = [];
|
|
119
125
|
}
|
|
126
|
+
//不知为何subtable-column会多存一次
|
|
127
|
+
if (item.type === 'subtable-column') {
|
|
128
|
+
if (instanceMap[item.id].length > 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
instances.push(item);
|
|
120
133
|
instanceMap[item.id].push(item);
|
|
121
134
|
});
|
|
122
135
|
this._flatInstances = instances;
|
|
123
136
|
this._instanceMap = instanceMap;
|
|
137
|
+
this._controlParentIdMap = controlParentIdMap;
|
|
124
138
|
return this._flatInstances;
|
|
125
139
|
}
|
|
126
140
|
},
|
|
@@ -154,8 +168,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
154
168
|
var antdRules = {};
|
|
155
169
|
var ruleItems = {};
|
|
156
170
|
loopDataViewControl(this._instance, function(dataView) {
|
|
157
|
-
|
|
158
|
-
|
|
171
|
+
var result = Runtime.staticGetRules(dataView.type, dataView.props);
|
|
172
|
+
ruleItems[dataView.id] = JSONCopy(result[0]);
|
|
173
|
+
antdRules[dataView.id] = JSONCopy(result[0]);
|
|
159
174
|
loopFormControl(dataView.children, function(item) {
|
|
160
175
|
// if (
|
|
161
176
|
// item instanceof RuntimeFormControl ||
|
|
@@ -178,7 +193,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
178
193
|
get: function get() {
|
|
179
194
|
var ruleItems = {};
|
|
180
195
|
loopDataViewControl(this._instance, function(dataView) {
|
|
181
|
-
|
|
196
|
+
var result = Runtime.staticGetRules(dataView.type, dataView.props);
|
|
197
|
+
// ruleItems[dataView.id] = dataView.rules[0]
|
|
198
|
+
ruleItems[dataView.id] = result[0];
|
|
182
199
|
loopFormControl(dataView.children, function(item) {
|
|
183
200
|
// if (
|
|
184
201
|
// item instanceof RuntimeFormControl ||
|
|
@@ -197,7 +214,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
197
214
|
get: function get() {
|
|
198
215
|
var antdRules = {};
|
|
199
216
|
loopDataViewControl(this._instance, function(dataView) {
|
|
200
|
-
|
|
217
|
+
var result = Runtime.staticGetRules(dataView.type, dataView.props);
|
|
218
|
+
// antdRules[dataView.id] = dataView.rules[0]
|
|
219
|
+
antdRules[dataView.id] = result[0];
|
|
201
220
|
loopFormControl(dataView.children, function(item) {
|
|
202
221
|
// if (
|
|
203
222
|
// item instanceof RuntimeFormControl ||
|
|
@@ -214,22 +233,30 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
214
233
|
]);
|
|
215
234
|
return Runtime;
|
|
216
235
|
}(RegisterControls);
|
|
217
|
-
function loop(control, callback) {
|
|
218
|
-
|
|
219
|
-
control
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
loop(ctl.children, callback);
|
|
236
|
+
function loop(control, parentId, callback) {
|
|
237
|
+
var _instances = Array.isArray(control) ? control : [
|
|
238
|
+
control
|
|
239
|
+
];
|
|
240
|
+
_instances.map(function(item) {
|
|
241
|
+
callback(item, parentId);
|
|
242
|
+
if (hasChildrenControl(item)) {
|
|
243
|
+
var ctl = item;
|
|
244
|
+
if (!ctl.children) {
|
|
245
|
+
ctl.children = [];
|
|
228
246
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
loop(ctl.children, ctl.id, callback);
|
|
249
|
+
}
|
|
250
|
+
if (hasHeaderOrFooterControl(item, 'headers')) {
|
|
251
|
+
loop(item.props.headers, item.id, callback);
|
|
252
|
+
}
|
|
253
|
+
if (hasHeaderOrFooterControl(item, 'footers')) {
|
|
254
|
+
loop(item.props.footers, item.id, callback);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function hasHeaderOrFooterControl(control, checkType) {
|
|
259
|
+
return checkType in control.props && isArray(control.props[checkType]);
|
|
233
260
|
}
|
|
234
261
|
/**
|
|
235
262
|
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
@@ -237,7 +264,7 @@ function loop(control, callback) {
|
|
|
237
264
|
if (control.props.isHide) {
|
|
238
265
|
return true;
|
|
239
266
|
}
|
|
240
|
-
if (control.parent === null) {
|
|
267
|
+
if (control.parent === null || control.parent === undefined) {
|
|
241
268
|
return false;
|
|
242
269
|
}
|
|
243
270
|
return getControlIsHide(control.parent);
|
|
@@ -247,11 +274,14 @@ item) {
|
|
|
247
274
|
if (getControlIsHide(item)) {
|
|
248
275
|
return;
|
|
249
276
|
}
|
|
277
|
+
var result = Runtime.staticGetRules(item.type, item.props);
|
|
250
278
|
// if (item instanceof RuntimeFormControl) {
|
|
251
279
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
252
|
-
data[item.id] = item.rules
|
|
280
|
+
// data[item.id] = item.rules
|
|
281
|
+
data[item.id] = result;
|
|
253
282
|
} else if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
254
|
-
data[item.id] = item.rules
|
|
283
|
+
// data[item.id] = item.rules
|
|
284
|
+
data[item.id] = result;
|
|
255
285
|
var itemRules = {
|
|
256
286
|
type: 'array',
|
|
257
287
|
fields: {}
|
|
@@ -266,8 +296,13 @@ item) {
|
|
|
266
296
|
fields: {}
|
|
267
297
|
};
|
|
268
298
|
}
|
|
299
|
+
// // @ts-ignore
|
|
300
|
+
// itemRules.fields[index].fields[formControl.id] = (
|
|
301
|
+
// formControl as RuntimeFormControl
|
|
302
|
+
// ).rules
|
|
303
|
+
var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
|
|
269
304
|
// @ts-ignore
|
|
270
|
-
itemRules.fields[index].fields[formControl.id] =
|
|
305
|
+
itemRules.fields[index].fields[formControl.id] = childResult;
|
|
271
306
|
}
|
|
272
307
|
});
|
|
273
308
|
});
|
|
@@ -279,15 +314,19 @@ item) {
|
|
|
279
314
|
if (getControlIsHide(item)) {
|
|
280
315
|
return;
|
|
281
316
|
}
|
|
317
|
+
var result = Runtime.staticGetRules(item.type, item.props);
|
|
282
318
|
// if (item instanceof RuntimeFormControl) {
|
|
283
319
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
284
|
-
antdRules[item.id] = item.rules
|
|
320
|
+
// antdRules[item.id] = item.rules
|
|
321
|
+
antdRules[item.id] = result;
|
|
285
322
|
} else if (item.type === CONTROL_TYPE.SUBTABLE && item.children.length) {
|
|
286
323
|
antdRules[item.id] = [];
|
|
287
324
|
item.children.forEach(function(row) {
|
|
288
325
|
var rules = {};
|
|
289
326
|
loopFormSchema(row.children, function(formControl) {
|
|
290
|
-
rules[formControl.id] = formControl.rules
|
|
327
|
+
// rules[formControl.id] = (formControl as RuntimeFormControl).rules
|
|
328
|
+
var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
|
|
329
|
+
rules[formControl.id] = childResult;
|
|
291
330
|
});
|
|
292
331
|
antdRules[item.id].push(rules);
|
|
293
332
|
});
|