@byteluck-fe/model-driven-driven 2.4.0-alpha.4 → 2.4.1-beta.0
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/Builder.js +127 -87
- package/dist/esm/Designer.js +160 -105
- package/dist/esm/Driven.js +604 -445
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +167 -110
- package/dist/esm/utils.js +24 -24
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- 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 +55 -55
- package/package.json +5 -5
package/dist/esm/Plugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
2
|
if (!(instance instanceof Constructor)) {
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
var Plugin = function Plugin() {
|
|
7
7
|
"use strict";
|
|
8
|
-
|
|
8
|
+
_class_call_check(this, Plugin);
|
|
9
9
|
};
|
|
10
10
|
export { Plugin };
|
package/dist/esm/Store.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _class_call_check(instance, Constructor) {
|
|
13
13
|
if (!(instance instanceof Constructor)) {
|
|
14
14
|
throw new TypeError("Cannot call a class as a function");
|
|
15
15
|
}
|
|
@@ -23,11 +23,24 @@ function _defineProperties(target, props) {
|
|
|
23
23
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
27
27
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
28
28
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
29
29
|
return Constructor;
|
|
30
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
|
+
}
|
|
31
44
|
function _instanceof(left, right) {
|
|
32
45
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
33
46
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -35,10 +48,10 @@ function _instanceof(left, right) {
|
|
|
35
48
|
return left instanceof right;
|
|
36
49
|
}
|
|
37
50
|
}
|
|
38
|
-
function
|
|
51
|
+
function _iterable_to_array(iter) {
|
|
39
52
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
40
53
|
}
|
|
41
|
-
function
|
|
54
|
+
function _iterable_to_array_limit(arr, i) {
|
|
42
55
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
43
56
|
if (_i == null) return;
|
|
44
57
|
var _arr = [];
|
|
@@ -62,25 +75,25 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
62
75
|
}
|
|
63
76
|
return _arr;
|
|
64
77
|
}
|
|
65
|
-
function
|
|
78
|
+
function _non_iterable_rest() {
|
|
66
79
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
67
80
|
}
|
|
68
|
-
function
|
|
81
|
+
function _non_iterable_spread() {
|
|
69
82
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
70
83
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
84
|
+
function _sliced_to_array(arr, i) {
|
|
85
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
73
86
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
87
|
+
function _to_consumable_array(arr) {
|
|
88
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
76
89
|
}
|
|
77
|
-
function
|
|
90
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
78
91
|
if (!o) return;
|
|
79
|
-
if (typeof o === "string") return
|
|
92
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
80
93
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
81
94
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
82
95
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
83
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
96
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
84
97
|
}
|
|
85
98
|
import { DataBind } from "@byteluck-fe/model-driven-core";
|
|
86
99
|
import { hasChildrenControl, hasHeaderControl } from "./designerUtils";
|
|
@@ -90,27 +103,48 @@ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-share
|
|
|
90
103
|
export var Store = /*#__PURE__*/ function() {
|
|
91
104
|
"use strict";
|
|
92
105
|
function Store(options) {
|
|
93
|
-
|
|
106
|
+
_class_call_check(this, Store);
|
|
107
|
+
/**
|
|
108
|
+
* 页面控件实例树
|
|
109
|
+
* */ _define_property(this, "instance", void 0);
|
|
110
|
+
/**
|
|
111
|
+
* 拍平的控件数组
|
|
112
|
+
* */ _define_property(this, "flatInstances", void 0);
|
|
113
|
+
/**
|
|
114
|
+
* 控件id组成的map
|
|
115
|
+
* */ _define_property(this, "instanceIdMap", void 0);
|
|
116
|
+
/**
|
|
117
|
+
* dataCode和fieldCode组成的map
|
|
118
|
+
* {
|
|
119
|
+
* [主表dataCode]: {
|
|
120
|
+
* [fieldCode]: 控件
|
|
121
|
+
* },
|
|
122
|
+
* [子表dataCode]: {
|
|
123
|
+
* [fieldCode]: 控件
|
|
124
|
+
* }
|
|
125
|
+
* }
|
|
126
|
+
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
94
127
|
/**
|
|
95
128
|
* 当前选中的控件
|
|
96
|
-
* */ this
|
|
129
|
+
* */ _define_property(this, "selected", null);
|
|
97
130
|
/**
|
|
98
131
|
* 当前选中的数据作用域控件
|
|
99
|
-
* */ this
|
|
100
|
-
this
|
|
132
|
+
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
133
|
+
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
101
134
|
/**
|
|
102
135
|
* 当前选中控件的setting
|
|
103
|
-
* */ this
|
|
104
|
-
this
|
|
136
|
+
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
137
|
+
_define_property(this, "selectedInstanceSettingItems", []);
|
|
105
138
|
/**
|
|
106
139
|
* 当前选中控件的数据模型
|
|
107
|
-
* */ this
|
|
140
|
+
* */ _define_property(this, "selectedFieldItem", null);
|
|
108
141
|
/**
|
|
109
142
|
* 扩展字段,比如appId,dataCode等
|
|
110
|
-
* */ this
|
|
111
|
-
this
|
|
112
|
-
this
|
|
113
|
-
this
|
|
143
|
+
* */ _define_property(this, "external", {});
|
|
144
|
+
_define_property(this, "movingInstance", null);
|
|
145
|
+
_define_property(this, "movingInstanceOldParent", null);
|
|
146
|
+
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
147
|
+
_define_property(this, "getParentBeforeInstanceMove", void 0);
|
|
114
148
|
var _options_getParentBeforeInstanceMove;
|
|
115
149
|
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
116
150
|
return instance.parent;
|
|
@@ -118,88 +152,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
118
152
|
this.instance = options.instance;
|
|
119
153
|
this.getFlatInstances();
|
|
120
154
|
}
|
|
121
|
-
|
|
122
|
-
_proto.setInstances = function setInstances(instances) {
|
|
123
|
-
this.instance = instances;
|
|
124
|
-
this.getFlatInstances();
|
|
125
|
-
};
|
|
126
|
-
_proto.setSelectInstance = function setSelectInstance(instance) {
|
|
127
|
-
this.selected = instance;
|
|
128
|
-
this.selectedInstanceDataScopeParent = instance ? findInstanceDataScopeParent(instance) : null;
|
|
129
|
-
this.selectedDataScopeFlatInstances = this.selectedInstanceDataScopeParent ? getDataScopeFlatInstances(this.selectedInstanceDataScopeParent) : [];
|
|
130
|
-
};
|
|
131
|
-
_proto.setSelectInstanceSettings = function setSelectInstanceSettings(settings) {
|
|
132
|
-
var _this = this;
|
|
133
|
-
this.selectedInstanceSetting = settings;
|
|
134
|
-
this.selectedInstanceSettingItems = [];
|
|
135
|
-
this.selectedInstanceSetting.forEach(function(group) {
|
|
136
|
-
var _this_selectedInstanceSettingItems;
|
|
137
|
-
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
_proto.getSettingItems = function getSettingItems(group) {
|
|
141
|
-
return _instanceof(group, Group) ? group.items : group.items.reduce(function(result, curr) {
|
|
142
|
-
var _result;
|
|
143
|
-
(_result = result).push.apply(_result, _toConsumableArray(curr.items));
|
|
144
|
-
return result;
|
|
145
|
-
}, []);
|
|
146
|
-
};
|
|
147
|
-
_proto.setSelectedFieldItem = function setSelectedFieldItem(fieldItem) {
|
|
148
|
-
this.selectedFieldItem = fieldItem;
|
|
149
|
-
};
|
|
150
|
-
_proto.setMovingInstance = function setMovingInstance(instance) {
|
|
151
|
-
this.movingInstance = instance;
|
|
152
|
-
this.movingInstanceOldParent = instance ? this.getParentBeforeInstanceMove(instance) : null;
|
|
153
|
-
this.movingInstanceOldDataScopeParent = findInstanceDataScopeParent(instance);
|
|
154
|
-
};
|
|
155
|
-
_proto.updateDataFieldCodeMap = function updateDataFieldCodeMap(instance) {
|
|
156
|
-
var scopeParent = findInstanceDataScopeParent(instance);
|
|
157
|
-
if (!scopeParent) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
var map = this.dataFieldCodeMap.get(scopeParent.props.datasourceBind.dataCode);
|
|
161
|
-
if (!map) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
165
|
-
try {
|
|
166
|
-
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
167
|
-
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
168
|
-
if (value.id === instance.id) {
|
|
169
|
-
map.delete(key);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} catch (err) {
|
|
174
|
-
_didIteratorError = true;
|
|
175
|
-
_iteratorError = err;
|
|
176
|
-
} finally{
|
|
177
|
-
try {
|
|
178
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
179
|
-
_iterator.return();
|
|
180
|
-
}
|
|
181
|
-
} finally{
|
|
182
|
-
if (_didIteratorError) {
|
|
183
|
-
throw _iteratorError;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
setInstanceInDataFieldCodeMap(instance, this.dataFieldCodeMap);
|
|
188
|
-
};
|
|
189
|
-
_proto.getFlatInstances = function getFlatInstances() {
|
|
190
|
-
var instances = [];
|
|
191
|
-
var instanceIdMap = new Map();
|
|
192
|
-
var dataFieldCodeMap = new Map();
|
|
193
|
-
loop(this.instance, function(instance) {
|
|
194
|
-
instances.push(instance);
|
|
195
|
-
instanceIdMap.set(instance.id, instance);
|
|
196
|
-
setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap);
|
|
197
|
-
});
|
|
198
|
-
this.flatInstances = instances;
|
|
199
|
-
this.instanceIdMap = instanceIdMap;
|
|
200
|
-
this.dataFieldCodeMap = dataFieldCodeMap;
|
|
201
|
-
};
|
|
202
|
-
_createClass(Store, [
|
|
155
|
+
_create_class(Store, [
|
|
203
156
|
{
|
|
204
157
|
key: "selectedRules",
|
|
205
158
|
get: /**
|
|
@@ -223,6 +176,110 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
223
176
|
// TODO 转换Antd rules
|
|
224
177
|
return rules;
|
|
225
178
|
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: "setInstances",
|
|
182
|
+
value: function setInstances(instances) {
|
|
183
|
+
this.instance = instances;
|
|
184
|
+
this.getFlatInstances();
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
key: "setSelectInstance",
|
|
189
|
+
value: function setSelectInstance(instance) {
|
|
190
|
+
this.selected = instance;
|
|
191
|
+
this.selectedInstanceDataScopeParent = instance ? findInstanceDataScopeParent(instance) : null;
|
|
192
|
+
this.selectedDataScopeFlatInstances = this.selectedInstanceDataScopeParent ? getDataScopeFlatInstances(this.selectedInstanceDataScopeParent) : [];
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: "setSelectInstanceSettings",
|
|
197
|
+
value: function setSelectInstanceSettings(settings) {
|
|
198
|
+
var _this = this;
|
|
199
|
+
this.selectedInstanceSetting = settings;
|
|
200
|
+
this.selectedInstanceSettingItems = [];
|
|
201
|
+
this.selectedInstanceSetting.forEach(function(group) {
|
|
202
|
+
var _this_selectedInstanceSettingItems;
|
|
203
|
+
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _to_consumable_array(_this.getSettingItems(group)));
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "getSettingItems",
|
|
209
|
+
value: function getSettingItems(group) {
|
|
210
|
+
return _instanceof(group, Group) ? group.items : group.items.reduce(function(result, curr) {
|
|
211
|
+
var _result;
|
|
212
|
+
(_result = result).push.apply(_result, _to_consumable_array(curr.items));
|
|
213
|
+
return result;
|
|
214
|
+
}, []);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "setSelectedFieldItem",
|
|
219
|
+
value: function setSelectedFieldItem(fieldItem) {
|
|
220
|
+
this.selectedFieldItem = fieldItem;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
key: "setMovingInstance",
|
|
225
|
+
value: function setMovingInstance(instance) {
|
|
226
|
+
this.movingInstance = instance;
|
|
227
|
+
this.movingInstanceOldParent = instance ? this.getParentBeforeInstanceMove(instance) : null;
|
|
228
|
+
this.movingInstanceOldDataScopeParent = findInstanceDataScopeParent(instance);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
key: "updateDataFieldCodeMap",
|
|
233
|
+
value: function updateDataFieldCodeMap(instance) {
|
|
234
|
+
var scopeParent = findInstanceDataScopeParent(instance);
|
|
235
|
+
if (!scopeParent) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
var map = this.dataFieldCodeMap.get(scopeParent.props.datasourceBind.dataCode);
|
|
239
|
+
if (!map) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
243
|
+
try {
|
|
244
|
+
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
245
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
246
|
+
if (value.id === instance.id) {
|
|
247
|
+
map.delete(key);
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} catch (err) {
|
|
252
|
+
_didIteratorError = true;
|
|
253
|
+
_iteratorError = err;
|
|
254
|
+
} finally{
|
|
255
|
+
try {
|
|
256
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
257
|
+
_iterator.return();
|
|
258
|
+
}
|
|
259
|
+
} finally{
|
|
260
|
+
if (_didIteratorError) {
|
|
261
|
+
throw _iteratorError;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
setInstanceInDataFieldCodeMap(instance, this.dataFieldCodeMap);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "getFlatInstances",
|
|
270
|
+
value: function getFlatInstances() {
|
|
271
|
+
var instances = [];
|
|
272
|
+
var instanceIdMap = new Map();
|
|
273
|
+
var dataFieldCodeMap = new Map();
|
|
274
|
+
loop(this.instance, function(instance) {
|
|
275
|
+
instances.push(instance);
|
|
276
|
+
instanceIdMap.set(instance.id, instance);
|
|
277
|
+
setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap);
|
|
278
|
+
});
|
|
279
|
+
this.flatInstances = instances;
|
|
280
|
+
this.instanceIdMap = instanceIdMap;
|
|
281
|
+
this.dataFieldCodeMap = dataFieldCodeMap;
|
|
282
|
+
}
|
|
226
283
|
}
|
|
227
284
|
]);
|
|
228
285
|
return Store;
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
13
|
try {
|
|
@@ -23,7 +23,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
23
23
|
Promise.resolve(value).then(_next, _throw);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
27
|
return function() {
|
|
28
28
|
var self = this, args = arguments;
|
|
29
29
|
return new Promise(function(resolve, reject) {
|
|
@@ -38,10 +38,10 @@ function _asyncToGenerator(fn) {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _iterable_to_array(iter) {
|
|
42
42
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _iterable_to_array_limit(arr, i) {
|
|
45
45
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
46
46
|
if (_i == null) return;
|
|
47
47
|
var _arr = [];
|
|
@@ -65,27 +65,27 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
65
65
|
}
|
|
66
66
|
return _arr;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function _non_iterable_rest() {
|
|
69
69
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function _non_iterable_spread() {
|
|
72
72
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function _sliced_to_array(arr, i) {
|
|
75
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function _to_consumable_array(arr) {
|
|
78
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
81
81
|
if (!o) return;
|
|
82
|
-
if (typeof o === "string") return
|
|
82
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
83
83
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
84
84
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
85
85
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
86
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
86
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
function _ts_generator(thisArg, body) {
|
|
89
89
|
var f, y, t, g, _ = {
|
|
90
90
|
label: 0,
|
|
91
91
|
sent: function() {
|
|
@@ -179,7 +179,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
179
179
|
done: true
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
}
|
|
183
183
|
import { loopFormControl } from "./designerUtils";
|
|
184
184
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
185
185
|
import Designer from "./Designer";
|
|
@@ -320,9 +320,9 @@ function checkSchema(controls, messages, ignore) {
|
|
|
320
320
|
return _checkSchema.apply(this, arguments);
|
|
321
321
|
}
|
|
322
322
|
function _checkSchema() {
|
|
323
|
-
_checkSchema =
|
|
323
|
+
_checkSchema = _async_to_generator(function(controls, messages, ignore) {
|
|
324
324
|
var result;
|
|
325
|
-
return
|
|
325
|
+
return _ts_generator(this, function(_state) {
|
|
326
326
|
switch(_state.label){
|
|
327
327
|
case 0:
|
|
328
328
|
if (!Array.isArray(controls)) return [
|
|
@@ -403,7 +403,7 @@ function generatePermissions(controls, parent) {
|
|
|
403
403
|
var result = [];
|
|
404
404
|
if (isArray(controls)) {
|
|
405
405
|
var _result;
|
|
406
|
-
(_result = result).push.apply(_result,
|
|
406
|
+
(_result = result).push.apply(_result, _to_consumable_array(controls.map(function(item) {
|
|
407
407
|
return generatePermissions(item, parent);
|
|
408
408
|
}).flat()));
|
|
409
409
|
} else {
|
|
@@ -470,7 +470,7 @@ function generatePermissions(controls, parent) {
|
|
|
470
470
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
471
471
|
// 列表的操作列单独处理
|
|
472
472
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
473
|
-
var _param =
|
|
473
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
474
474
|
var operationItem = controls.props[key];
|
|
475
475
|
if (operationItem && operationItem.isShow) {
|
|
476
476
|
var _parent_controlId;
|
|
@@ -512,7 +512,7 @@ function generatePermissions(controls, parent) {
|
|
|
512
512
|
// }
|
|
513
513
|
if (controls.children) {
|
|
514
514
|
var _result1;
|
|
515
|
-
(_result1 = result).push.apply(_result1,
|
|
515
|
+
(_result1 = result).push.apply(_result1, _to_consumable_array(controls.children.map(function(item) {
|
|
516
516
|
return generatePermissions(item, parent);
|
|
517
517
|
}).flat()));
|
|
518
518
|
}
|
|
@@ -520,7 +520,7 @@ function generatePermissions(controls, parent) {
|
|
|
520
520
|
if (controls.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
521
521
|
var // 明细子表和列表的需要给parentId
|
|
522
522
|
_result2;
|
|
523
|
-
(_result2 = result).push.apply(_result2,
|
|
523
|
+
(_result2 = result).push.apply(_result2, _to_consumable_array(controls.props.headers.map(function(item) {
|
|
524
524
|
return generatePermissions(item, permissionItem);
|
|
525
525
|
}).flat()));
|
|
526
526
|
}
|