@byteluck-fe/model-driven-driven 2.7.0-alpha.2 → 2.7.0-alpha.21

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.
@@ -1,10 +1,10 @@
1
- function _classCallCheck(instance, Constructor) {
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
- _classCallCheck(this, Plugin);
8
+ _class_call_check(this, Plugin);
9
9
  };
10
10
  export { Plugin };
package/dist/esm/Store.js CHANGED
@@ -1,15 +1,15 @@
1
- function _arrayLikeToArray(arr, len) {
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 _arrayWithHoles(arr) {
6
+ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
- function _classCallCheck(instance, Constructor) {
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,22 +23,28 @@ function _defineProperties(target, props) {
23
23
  Object.defineProperty(target, descriptor.key, descriptor);
24
24
  }
25
25
  }
26
- function _createClass(Constructor, protoProps, staticProps) {
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 _instanceof(left, right) {
32
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
33
- return !!right[Symbol.hasInstance](left);
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
+ });
34
39
  } else {
35
- return left instanceof right;
40
+ obj[key] = value;
36
41
  }
42
+ return obj;
37
43
  }
38
- function _iterableToArray(iter) {
44
+ function _iterable_to_array(iter) {
39
45
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
40
46
  }
41
- function _iterableToArrayLimit(arr, i) {
47
+ function _iterable_to_array_limit(arr, i) {
42
48
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
43
49
  if (_i == null) return;
44
50
  var _arr = [];
@@ -62,55 +68,75 @@ function _iterableToArrayLimit(arr, i) {
62
68
  }
63
69
  return _arr;
64
70
  }
65
- function _nonIterableRest() {
71
+ function _non_iterable_rest() {
66
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.");
67
73
  }
68
- function _nonIterableSpread() {
74
+ function _non_iterable_spread() {
69
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.");
70
76
  }
71
- function _slicedToArray(arr, i) {
72
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
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();
73
79
  }
74
- function _toConsumableArray(arr) {
75
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
80
+ function _to_consumable_array(arr) {
81
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
76
82
  }
77
- function _unsupportedIterableToArray(o, minLen) {
83
+ function _unsupported_iterable_to_array(o, minLen) {
78
84
  if (!o) return;
79
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
85
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
80
86
  var n = Object.prototype.toString.call(o).slice(8, -1);
81
87
  if (n === "Object" && o.constructor) n = o.constructor.name;
82
88
  if (n === "Map" || n === "Set") return Array.from(n);
83
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
89
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
84
90
  }
85
- import { DataBind } from "@byteluck-fe/model-driven-core";
86
- import { hasChildrenControl, hasHeaderControl } from "./designerUtils";
87
- import { Group } from "@byteluck-fe/model-driven-settings";
91
+ import { isDataBind } from "@byteluck-fe/model-driven-core";
92
+ import { hasChildrenControl, hasFooterControl, hasHeaderControl } from "./designerUtils";
88
93
  import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
89
94
  // 维护当前selected,。。 selectedControlSetting
90
95
  export var Store = /*#__PURE__*/ function() {
91
96
  "use strict";
92
97
  function Store(options) {
93
- _classCallCheck(this, Store);
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);
94
119
  /**
95
120
  * 当前选中的控件
96
- * */ this.selected = null;
121
+ * */ _define_property(this, "selected", null);
97
122
  /**
98
123
  * 当前选中的数据作用域控件
99
- * */ this.selectedInstanceDataScopeParent = null;
100
- this.selectedDataScopeFlatInstances = [];
124
+ * */ _define_property(this, "selectedInstanceDataScopeParent", null);
125
+ _define_property(this, "selectedDataScopeFlatInstances", []);
101
126
  /**
102
127
  * 当前选中控件的setting
103
- * */ this.selectedInstanceSetting = [];
104
- this.selectedInstanceSettingItems = [];
128
+ * */ _define_property(this, "selectedInstanceSetting", []);
129
+ _define_property(this, "selectedInstanceSettingItems", []);
105
130
  /**
106
131
  * 当前选中控件的数据模型
107
- * */ this.selectedFieldItem = null;
132
+ * */ _define_property(this, "selectedFieldItem", null);
108
133
  /**
109
134
  * 扩展字段,比如appId,dataCode等
110
- * */ this.external = {};
111
- this.movingInstance = null;
112
- this.movingInstanceOldParent = null;
113
- this.movingInstanceOldDataScopeParent = null;
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);
114
140
  var _options_getParentBeforeInstanceMove;
115
141
  this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
116
142
  return instance.parent;
@@ -118,88 +144,7 @@ export var Store = /*#__PURE__*/ function() {
118
144
  this.instance = options.instance;
119
145
  this.getFlatInstances();
120
146
  }
121
- var _proto = Store.prototype;
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, [
147
+ _create_class(Store, [
203
148
  {
204
149
  key: "selectedRules",
205
150
  get: /**
@@ -223,6 +168,111 @@ export var Store = /*#__PURE__*/ function() {
223
168
  // TODO 转换Antd rules
224
169
  return rules;
225
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
+ }
226
276
  }
227
277
  ]);
228
278
  return Store;
@@ -240,7 +290,8 @@ function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
240
290
  // if (instance instanceof DesignerFormControl) {
241
291
  if (instance.controlType === CONTROL_BASE_TYPE.FORM) {
242
292
  var dataBind = instance.props.dataBind;
243
- if (_instanceof(dataBind, DataBind)) {
293
+ //if (dataBind instanceof DataBind) {
294
+ if (isDataBind(dataBind)) {
244
295
  setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
245
296
  } else {
246
297
  Object.values(dataBind).forEach(function(subDataBind) {
@@ -261,6 +312,11 @@ export function loop(instances, callback) {
261
312
  if (hasHeaderControl(item)) {
262
313
  loop(item.props.headers, callback);
263
314
  }
315
+ if (hasFooterControl(item)) {
316
+ var _item_props;
317
+ var _item_props_footers;
318
+ loop((_item_props_footers = (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.footers) !== null && _item_props_footers !== void 0 ? _item_props_footers : [], callback);
319
+ }
264
320
  });
265
321
  }
266
322
  export function isDataScopeInstance(instance) {
@@ -5,6 +5,9 @@ export function hasChildrenControl(instance) {
5
5
  export function hasHeaderControl(instance) {
6
6
  return "headers" in instance.props && isArray(instance.props.headers);
7
7
  }
8
+ export function hasFooterControl(instance) {
9
+ return "footers" in instance.props && isArray(instance.props.footers);
10
+ }
8
11
  export function loopFormControl(control, callback) {
9
12
  if (Array.isArray(control)) {
10
13
  control.map(function(item) {
@@ -14,8 +17,9 @@ export function loopFormControl(control, callback) {
14
17
  // @ts-ignore
15
18
  loopFormControl(item.props.headers, callback);
16
19
  } else if (hasChildrenControl(item)) {
17
- loopFormControl(// @ts-ignore
18
- item === null || item === void 0 ? void 0 : item.children, callback);
20
+ var // @ts-ignore
21
+ _item;
22
+ loopFormControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
19
23
  // @ts-ignore
20
24
  // } else if (item instanceof DesignerFormControl) {
21
25
  } else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
package/dist/esm/utils.js CHANGED
@@ -1,13 +1,13 @@
1
- function _arrayLikeToArray(arr, len) {
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 _arrayWithHoles(arr) {
6
+ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
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 _asyncToGenerator(fn) {
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 _iterableToArray(iter) {
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 _iterableToArrayLimit(arr, i) {
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 _nonIterableRest() {
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 _nonIterableSpread() {
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 _slicedToArray(arr, i) {
75
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
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 _toConsumableArray(arr) {
78
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
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 _unsupportedIterableToArray(o, minLen) {
80
+ function _unsupported_iterable_to_array(o, minLen) {
81
81
  if (!o) return;
82
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
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 _arrayLikeToArray(o, minLen);
86
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
87
87
  }
88
- var __generator = this && this.__generator || function(thisArg, body) {
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 = _asyncToGenerator(function(controls, messages, ignore) {
323
+ _checkSchema = _async_to_generator(function(controls, messages, ignore) {
324
324
  var result;
325
- return __generator(this, function(_state) {
325
+ return _ts_generator(this, function(_state) {
326
326
  switch(_state.label){
327
327
  case 0:
328
328
  if (!Array.isArray(controls)) return [
@@ -378,7 +378,9 @@ var PermissionExcludeControlTypes = [
378
378
  CONTROL_TYPE.TAB_PANE,
379
379
  CONTROL_TYPE.TAB,
380
380
  CONTROL_TYPE.CARD_GROUP,
381
- CONTROL_TYPE.ACTION_BAR
381
+ CONTROL_TYPE.ACTION_BAR,
382
+ CONTROL_TYPE.GRID_LAYOUT_CONTAINER,
383
+ CONTROL_TYPE.GRID_LAYOUT_WRAP
382
384
  ];
383
385
  // 不可以编辑的控件
384
386
  var cannotEditControlTypes = [
@@ -404,7 +406,7 @@ function generatePermissions(controls, parent) {
404
406
  var result = [];
405
407
  if (isArray(controls)) {
406
408
  var _result;
407
- (_result = result).push.apply(_result, _toConsumableArray(controls.map(function(item) {
409
+ (_result = result).push.apply(_result, _to_consumable_array(controls.map(function(item) {
408
410
  return generatePermissions(item, parent);
409
411
  }).flat()));
410
412
  } else {
@@ -412,13 +414,14 @@ function generatePermissions(controls, parent) {
412
414
  var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
413
415
  var permissionItem;
414
416
  if (!PermissionExcludeControlTypes.includes(type)) {
417
+ var _parent;
415
418
  var _parent_controlId;
416
419
  permissionItem = {
417
420
  controlId: controls.id,
418
421
  caption: caption || content || controls.name,
419
422
  type: controls.type,
420
423
  controlType: controls.controlType,
421
- parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
424
+ parentId: (_parent_controlId = (_parent = parent) === null || _parent === void 0 ? void 0 : _parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
422
425
  canEdit: !cannotEditControlTypes.includes(type),
423
426
  canRead: true,
424
427
  canHide: true,
@@ -437,8 +440,8 @@ function generatePermissions(controls, parent) {
437
440
  // ) {
438
441
  if (controls.controlType === CONTROL_BASE_TYPE.FORM || controls.controlType === CONTROL_BASE_TYPE.COLUMN) {
439
442
  var //@ts-ignore
440
- _controls_props1, _controls_props_dataBind, //@ts-ignore
441
- _controls_props2, _controls_props_dataBind1;
443
+ _controls_props_dataBind, _controls_props1, //@ts-ignore
444
+ _controls_props_dataBind1, _controls_props2;
442
445
  if (((_controls_props1 = controls.props) === null || _controls_props1 === void 0 ? void 0 : (_controls_props_dataBind = _controls_props1.dataBind) === null || _controls_props_dataBind === void 0 ? void 0 : _controls_props_dataBind.fieldCode) !== undefined && ((_controls_props2 = controls.props) === null || _controls_props2 === void 0 ? void 0 : (_controls_props_dataBind1 = _controls_props2.dataBind) === null || _controls_props_dataBind1 === void 0 ? void 0 : _controls_props_dataBind1.fieldCode) !== "") {
443
446
  permissionItem.group = "field";
444
447
  }
@@ -446,13 +449,13 @@ function generatePermissions(controls, parent) {
446
449
  result.push(permissionItem);
447
450
  //追加vue容器权限
448
451
  if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
449
- var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
452
+ var _controls_props_dataBind2, _controls_props3, _controls_props_dataBind3, _controls_props4, _permissions;
450
453
  var vueFormItemGroup = "element";
451
454
  if (((_controls_props3 = controls.props) === null || _controls_props3 === void 0 ? void 0 : (_controls_props_dataBind2 = _controls_props3.dataBind) === null || _controls_props_dataBind2 === void 0 ? void 0 : _controls_props_dataBind2.fieldCode) !== undefined && ((_controls_props4 = controls.props) === null || _controls_props4 === void 0 ? void 0 : (_controls_props_dataBind3 = _controls_props4.dataBind) === null || _controls_props_dataBind3 === void 0 ? void 0 : _controls_props_dataBind3.fieldCode) !== "") {
452
455
  vueFormItemGroup = "field";
453
456
  }
454
457
  var permissions = controls.props["permissions"];
455
- permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
458
+ (_permissions = permissions) === null || _permissions === void 0 ? void 0 : _permissions.map(function(item) {
456
459
  var _controls_id;
457
460
  permissionItem = {
458
461
  controlId: item.key,
@@ -471,9 +474,10 @@ function generatePermissions(controls, parent) {
471
474
  } else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
472
475
  // 列表的操作列单独处理
473
476
  Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
474
- var _param = _slicedToArray(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
477
+ var _param = _sliced_to_array(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
475
478
  var operationItem = controls.props[key];
476
479
  if (operationItem && operationItem.isShow) {
480
+ var _parent;
477
481
  var _parent_controlId;
478
482
  // 只能控制是否显示
479
483
  result.push({
@@ -481,7 +485,7 @@ function generatePermissions(controls, parent) {
481
485
  caption: caption,
482
486
  type: controls.type,
483
487
  controlType: controls.controlType,
484
- parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
488
+ parentId: (_parent_controlId = (_parent = parent) === null || _parent === void 0 ? void 0 : _parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
485
489
  canEdit: false,
486
490
  canRead: false,
487
491
  canHide: true,
@@ -513,7 +517,7 @@ function generatePermissions(controls, parent) {
513
517
  // }
514
518
  if (controls.children) {
515
519
  var _result1;
516
- (_result1 = result).push.apply(_result1, _toConsumableArray(controls.children.map(function(item) {
520
+ (_result1 = result).push.apply(_result1, _to_consumable_array(controls.children.map(function(item) {
517
521
  return generatePermissions(item, parent);
518
522
  }).flat()));
519
523
  }
@@ -521,7 +525,7 @@ function generatePermissions(controls, parent) {
521
525
  if (controls.controlType === CONTROL_BASE_TYPE.LIST) {
522
526
  var // 明细子表和列表的需要给parentId
523
527
  _result2;
524
- (_result2 = result).push.apply(_result2, _toConsumableArray(controls.props.headers.map(function(item) {
528
+ (_result2 = result).push.apply(_result2, _to_consumable_array(controls.props.headers.map(function(item) {
525
529
  return generatePermissions(item, permissionItem);
526
530
  }).flat()));
527
531
  }