@byteluck-fe/model-driven-driven 2.23.0-beta.2 → 2.23.0-beta.4
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/README.md +13 -13
- package/dist/types/Builder.d.ts +9 -9
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +114 -114
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +41 -41
- package/package.json +3 -3
- package/dist/esm/Builder.js +0 -186
- package/dist/esm/Designer.js +0 -378
- package/dist/esm/Driven.js +0 -814
- package/dist/esm/EventLogic.js +0 -2
- package/dist/esm/Plugin.js +0 -10
- package/dist/esm/Store.js +0 -350
- package/dist/esm/constants.js +0 -33
- package/dist/esm/designerUtils.js +0 -34
- package/dist/esm/index.js +0 -7
- package/dist/esm/utils.js +0 -465
- package/dist/index.umd.js +0 -45
package/dist/esm/EventLogic.js
DELETED
package/dist/esm/Plugin.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
var Plugin = function Plugin() {
|
|
7
|
-
"use strict";
|
|
8
|
-
_class_call_check(this, Plugin);
|
|
9
|
-
};
|
|
10
|
-
export { Plugin };
|
package/dist/esm/Store.js
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _array_without_holes(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
-
}
|
|
12
|
-
function _class_call_check(instance, Constructor) {
|
|
13
|
-
if (!(instance instanceof Constructor)) {
|
|
14
|
-
throw new TypeError("Cannot call a class as a function");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function _defineProperties(target, props) {
|
|
18
|
-
for(var i = 0; i < props.length; i++){
|
|
19
|
-
var descriptor = props[i];
|
|
20
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
21
|
-
descriptor.configurable = true;
|
|
22
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
23
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
27
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
28
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
29
|
-
return Constructor;
|
|
30
|
-
}
|
|
31
|
-
function _define_property(obj, key, value) {
|
|
32
|
-
if (key in obj) {
|
|
33
|
-
Object.defineProperty(obj, key, {
|
|
34
|
-
value: value,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
obj[key] = value;
|
|
41
|
-
}
|
|
42
|
-
return obj;
|
|
43
|
-
}
|
|
44
|
-
function _iterable_to_array(iter) {
|
|
45
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
46
|
-
}
|
|
47
|
-
function _iterable_to_array_limit(arr, i) {
|
|
48
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
49
|
-
if (_i == null) return;
|
|
50
|
-
var _arr = [];
|
|
51
|
-
var _n = true;
|
|
52
|
-
var _d = false;
|
|
53
|
-
var _s, _e;
|
|
54
|
-
try {
|
|
55
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
56
|
-
_arr.push(_s.value);
|
|
57
|
-
if (i && _arr.length === i) break;
|
|
58
|
-
}
|
|
59
|
-
} catch (err) {
|
|
60
|
-
_d = true;
|
|
61
|
-
_e = err;
|
|
62
|
-
} finally{
|
|
63
|
-
try {
|
|
64
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
65
|
-
} finally{
|
|
66
|
-
if (_d) throw _e;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return _arr;
|
|
70
|
-
}
|
|
71
|
-
function _non_iterable_rest() {
|
|
72
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
73
|
-
}
|
|
74
|
-
function _non_iterable_spread() {
|
|
75
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
76
|
-
}
|
|
77
|
-
function _sliced_to_array(arr, i) {
|
|
78
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
79
|
-
}
|
|
80
|
-
function _to_consumable_array(arr) {
|
|
81
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
82
|
-
}
|
|
83
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
84
|
-
if (!o) return;
|
|
85
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
86
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
89
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
|
-
}
|
|
91
|
-
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
92
|
-
import { hasChildrenControl, hasHeaderControl } from './designerUtils';
|
|
93
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
94
|
-
// 维护当前selected,。。 selectedControlSetting
|
|
95
|
-
export var Store = /*#__PURE__*/ function() {
|
|
96
|
-
"use strict";
|
|
97
|
-
function Store(options) {
|
|
98
|
-
_class_call_check(this, Store);
|
|
99
|
-
/**
|
|
100
|
-
* 页面控件实例树
|
|
101
|
-
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
104
|
-
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
107
|
-
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
118
|
-
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
121
|
-
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
124
|
-
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
|
-
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
128
|
-
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
|
-
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
132
|
-
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
135
|
-
* */ _define_property(this, "external", {});
|
|
136
|
-
_define_property(this, "movingInstance", null);
|
|
137
|
-
_define_property(this, "movingInstanceOldParent", null);
|
|
138
|
-
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
139
|
-
_define_property(this, "getParentBeforeInstanceMove", void 0);
|
|
140
|
-
var _options_getParentBeforeInstanceMove;
|
|
141
|
-
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
142
|
-
return instance.parent;
|
|
143
|
-
};
|
|
144
|
-
this.instance = options.instance;
|
|
145
|
-
this.getFlatInstances();
|
|
146
|
-
}
|
|
147
|
-
_create_class(Store, [
|
|
148
|
-
{
|
|
149
|
-
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
152
|
-
* */ function get() {
|
|
153
|
-
if (!this.selected) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
return this.selected.rules;
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
163
|
-
* */ function get() {
|
|
164
|
-
var rules = this.selectedRules;
|
|
165
|
-
if (!rules) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
// TODO 转换Antd rules
|
|
169
|
-
return rules;
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
key: "setInstances",
|
|
174
|
-
value: function setInstances(instances) {
|
|
175
|
-
this.instance = instances;
|
|
176
|
-
this.getFlatInstances();
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
key: "setSelectInstance",
|
|
181
|
-
value: function setSelectInstance(instance) {
|
|
182
|
-
this.selected = instance;
|
|
183
|
-
this.selectedInstanceDataScopeParent = instance ? findInstanceDataScopeParent(instance) : null;
|
|
184
|
-
this.selectedDataScopeFlatInstances = this.selectedInstanceDataScopeParent ? getDataScopeFlatInstances(this.selectedInstanceDataScopeParent) : [];
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
key: "setSelectInstanceSettings",
|
|
189
|
-
value: function setSelectInstanceSettings(settings) {
|
|
190
|
-
var _this = this;
|
|
191
|
-
this.selectedInstanceSetting = settings;
|
|
192
|
-
this.selectedInstanceSettingItems = [];
|
|
193
|
-
this.selectedInstanceSetting.forEach(function(group) {
|
|
194
|
-
var _this_selectedInstanceSettingItems;
|
|
195
|
-
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _to_consumable_array(_this.getSettingItems(group)));
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
key: "getSettingItems",
|
|
201
|
-
value: function getSettingItems(group) {
|
|
202
|
-
// return group instanceof Group
|
|
203
|
-
return group.type === 'group' ? group.items : group.items.reduce(function(result, curr) {
|
|
204
|
-
var _result;
|
|
205
|
-
(_result = result).push.apply(_result, _to_consumable_array(curr.items));
|
|
206
|
-
return result;
|
|
207
|
-
}, []);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
key: "setSelectedFieldItem",
|
|
212
|
-
value: function setSelectedFieldItem(fieldItem) {
|
|
213
|
-
this.selectedFieldItem = fieldItem;
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
key: "setMovingInstance",
|
|
218
|
-
value: function setMovingInstance(instance) {
|
|
219
|
-
this.movingInstance = instance;
|
|
220
|
-
this.movingInstanceOldParent = instance ? this.getParentBeforeInstanceMove(instance) : null;
|
|
221
|
-
this.movingInstanceOldDataScopeParent = findInstanceDataScopeParent(instance);
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
key: "updateDataFieldCodeMap",
|
|
226
|
-
value: function updateDataFieldCodeMap(instance) {
|
|
227
|
-
var scopeParent = findInstanceDataScopeParent(instance);
|
|
228
|
-
if (!scopeParent) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
var map = this.dataFieldCodeMap.get(scopeParent.props.datasourceBind.dataCode);
|
|
232
|
-
if (!map) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
236
|
-
try {
|
|
237
|
-
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
238
|
-
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
239
|
-
if (value.id === instance.id) {
|
|
240
|
-
map.delete(key);
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
} catch (err) {
|
|
245
|
-
_didIteratorError = true;
|
|
246
|
-
_iteratorError = err;
|
|
247
|
-
} finally{
|
|
248
|
-
try {
|
|
249
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
250
|
-
_iterator.return();
|
|
251
|
-
}
|
|
252
|
-
} finally{
|
|
253
|
-
if (_didIteratorError) {
|
|
254
|
-
throw _iteratorError;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
setInstanceInDataFieldCodeMap(instance, this.dataFieldCodeMap);
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
key: "getFlatInstances",
|
|
263
|
-
value: function getFlatInstances() {
|
|
264
|
-
var instances = [];
|
|
265
|
-
var instanceIdMap = new Map();
|
|
266
|
-
var dataFieldCodeMap = new Map();
|
|
267
|
-
loop(this.instance, function(instance) {
|
|
268
|
-
instances.push(instance);
|
|
269
|
-
instanceIdMap.set(instance.id, instance);
|
|
270
|
-
setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap);
|
|
271
|
-
});
|
|
272
|
-
this.flatInstances = instances;
|
|
273
|
-
this.instanceIdMap = instanceIdMap;
|
|
274
|
-
this.dataFieldCodeMap = dataFieldCodeMap;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
]);
|
|
278
|
-
return Store;
|
|
279
|
-
}();
|
|
280
|
-
function setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance) {
|
|
281
|
-
var dataCode = dataBind.dataCode, fieldCode = dataBind.fieldCode;
|
|
282
|
-
if (dataCode && fieldCode) {
|
|
283
|
-
if (!dataFieldCodeMap.has(dataCode)) {
|
|
284
|
-
dataFieldCodeMap.set(dataCode, new Map());
|
|
285
|
-
}
|
|
286
|
-
dataFieldCodeMap.get(dataCode).set(fieldCode, instance);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
|
|
290
|
-
// if (instance instanceof DesignerFormControl) {
|
|
291
|
-
if (instance.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
292
|
-
var dataBind = instance.props.dataBind;
|
|
293
|
-
//if (dataBind instanceof DataBind) {
|
|
294
|
-
if (isDataBind(dataBind)) {
|
|
295
|
-
setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
|
|
296
|
-
} else {
|
|
297
|
-
Object.values(dataBind).forEach(function(subDataBind) {
|
|
298
|
-
setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
export function loop(instances, callback) {
|
|
304
|
-
var _instances = Array.isArray(instances) ? instances : [
|
|
305
|
-
instances
|
|
306
|
-
];
|
|
307
|
-
_instances.forEach(function(item) {
|
|
308
|
-
callback(item);
|
|
309
|
-
if (hasChildrenControl(item)) {
|
|
310
|
-
loop(item.children, callback);
|
|
311
|
-
}
|
|
312
|
-
if (hasHeaderControl(item)) {
|
|
313
|
-
loop(item.props.headers, callback);
|
|
314
|
-
}
|
|
315
|
-
// if(item)) {
|
|
316
|
-
// loop(item.props?.footers ?? [], callback)
|
|
317
|
-
// }
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
export function isDataScopeInstance(instance) {
|
|
321
|
-
return [
|
|
322
|
-
CONTROL_TYPE.SUBTABLE,
|
|
323
|
-
CONTROL_TYPE.DATA_VIEW,
|
|
324
|
-
CONTROL_TYPE.LIST_VIEW
|
|
325
|
-
].includes(instance.type);
|
|
326
|
-
}
|
|
327
|
-
export function findInstanceDataScopeParent(instance) {
|
|
328
|
-
var parent = instance ? instance.parent : null;
|
|
329
|
-
if (!parent) {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
while(parent && !isDataScopeInstance(parent)){
|
|
333
|
-
parent = parent.parent;
|
|
334
|
-
}
|
|
335
|
-
return parent;
|
|
336
|
-
}
|
|
337
|
-
export function getDataScopeFlatInstances(dataScopeInstance) {
|
|
338
|
-
var result = [
|
|
339
|
-
dataScopeInstance
|
|
340
|
-
];
|
|
341
|
-
loop(dataScopeInstance, function(instance) {
|
|
342
|
-
if (instance === dataScopeInstance) {
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
if (result.includes(instance.parent) && !isDataScopeInstance(instance)) {
|
|
346
|
-
result.push(instance);
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
return result;
|
|
350
|
-
}
|
package/dist/esm/constants.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CONTROL_TYPE, FieldTypes, RulesMessage } from '@byteluck-fe/model-driven-shared';
|
|
2
|
-
// 使用ObjectDataBind 的控件
|
|
3
|
-
export var objectDataBindControlTypes = [
|
|
4
|
-
CONTROL_TYPE.AMOUNT,
|
|
5
|
-
CONTROL_TYPE.CALC,
|
|
6
|
-
CONTROL_TYPE.DATE_RANGE
|
|
7
|
-
];
|
|
8
|
-
export var objectDataBindKeyToFieldType = {
|
|
9
|
-
amount: {
|
|
10
|
-
caption: RulesMessage.getMessage('amount'),
|
|
11
|
-
fieldType: FieldTypes.DECIMAL
|
|
12
|
-
},
|
|
13
|
-
currency: {
|
|
14
|
-
caption: RulesMessage.getMessage('currency'),
|
|
15
|
-
fieldType: FieldTypes.VARCHAR
|
|
16
|
-
},
|
|
17
|
-
result: {
|
|
18
|
-
caption: RulesMessage.getMessage('result'),
|
|
19
|
-
fieldType: FieldTypes.DECIMAL
|
|
20
|
-
},
|
|
21
|
-
unit: {
|
|
22
|
-
caption: RulesMessage.getMessage('unit'),
|
|
23
|
-
fieldType: FieldTypes.VARCHAR
|
|
24
|
-
},
|
|
25
|
-
min: {
|
|
26
|
-
caption: RulesMessage.getMessage('startTime'),
|
|
27
|
-
fieldType: FieldTypes.TIMESTAMP
|
|
28
|
-
},
|
|
29
|
-
max: {
|
|
30
|
-
caption: RulesMessage.getMessage('endTime'),
|
|
31
|
-
fieldType: FieldTypes.TIMESTAMP
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from '@byteluck-fe/model-driven-shared';
|
|
2
|
-
export function hasChildrenControl(instance) {
|
|
3
|
-
return 'children' in instance && isArray(instance.children);
|
|
4
|
-
}
|
|
5
|
-
export function hasHeaderControl(instance) {
|
|
6
|
-
return 'headers' in instance.props && isArray(instance.props.headers);
|
|
7
|
-
}
|
|
8
|
-
// export function hasFooterControl(
|
|
9
|
-
// instance: DesignerControl
|
|
10
|
-
// ): instance is DesignerListControl {
|
|
11
|
-
// return (
|
|
12
|
-
// 'footers' in instance.props &&
|
|
13
|
-
// isArray((instance as DesignerListControl).props.footers)
|
|
14
|
-
// )
|
|
15
|
-
// }
|
|
16
|
-
export function loopFormControl(control, callback) {
|
|
17
|
-
if (Array.isArray(control)) {
|
|
18
|
-
control.map(function(item) {
|
|
19
|
-
//TODO 此处需要再抽象一层 datagrid/datalist
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
loopFormControl(item.props.headers, callback);
|
|
24
|
-
} else if (hasChildrenControl(item)) {
|
|
25
|
-
loopFormControl(// @ts-ignore
|
|
26
|
-
item === null || item === void 0 ? void 0 : item.children, callback);
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
// } else if (item instanceof DesignerFormControl) {
|
|
29
|
-
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
30
|
-
callback(item);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|