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