@byteluck-fe/model-driven-driven 2.7.0-alpha.7 → 2.7.0-alpha.8

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/Store.js CHANGED
@@ -28,9 +28,22 @@ function _createClass(Constructor, protoProps, staticProps) {
28
28
  if (staticProps) _defineProperties(Constructor, staticProps);
29
29
  return Constructor;
30
30
  }
31
+ function _defineProperty(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
- return right[Symbol.hasInstance](left);
46
+ return !!right[Symbol.hasInstance](left);
34
47
  } else {
35
48
  return left instanceof right;
36
49
  }
@@ -82,37 +95,58 @@ function _unsupportedIterableToArray(o, minLen) {
82
95
  if (n === "Map" || n === "Set") return Array.from(n);
83
96
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
84
97
  }
85
- import { DataBind } from '@byteluck-fe/model-driven-core';
86
- import { hasChildrenControl, hasHeaderControl } from './designerUtils';
87
- import { Group } from '@byteluck-fe/model-driven-settings';
88
- import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
98
+ import { DataBind } from "@byteluck-fe/model-driven-core";
99
+ import { hasChildrenControl, hasHeaderControl } from "./designerUtils";
100
+ import { Group } from "@byteluck-fe/model-driven-settings";
101
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
89
102
  // 维护当前selected,。。 selectedControlSetting
90
103
  export var Store = /*#__PURE__*/ function() {
91
104
  "use strict";
92
105
  function Store(options) {
93
106
  _classCallCheck(this, Store);
94
107
  /**
108
+ * 页面控件实例树
109
+ * */ _defineProperty(this, "instance", void 0);
110
+ /**
111
+ * 拍平的控件数组
112
+ * */ _defineProperty(this, "flatInstances", void 0);
113
+ /**
114
+ * 控件id组成的map
115
+ * */ _defineProperty(this, "instanceIdMap", void 0);
116
+ /**
117
+ * dataCode和fieldCode组成的map
118
+ * {
119
+ * [主表dataCode]: {
120
+ * [fieldCode]: 控件
121
+ * },
122
+ * [子表dataCode]: {
123
+ * [fieldCode]: 控件
124
+ * }
125
+ * }
126
+ * */ _defineProperty(this, "dataFieldCodeMap", void 0);
127
+ /**
95
128
  * 当前选中的控件
96
- * */ this.selected = null;
129
+ * */ _defineProperty(this, "selected", null);
97
130
  /**
98
131
  * 当前选中的数据作用域控件
99
- * */ this.selectedInstanceDataScopeParent = null;
100
- this.selectedDataScopeFlatInstances = [];
132
+ * */ _defineProperty(this, "selectedInstanceDataScopeParent", null);
133
+ _defineProperty(this, "selectedDataScopeFlatInstances", []);
101
134
  /**
102
135
  * 当前选中控件的setting
103
- * */ this.selectedInstanceSetting = [];
104
- this.selectedInstanceSettingItems = [];
136
+ * */ _defineProperty(this, "selectedInstanceSetting", []);
137
+ _defineProperty(this, "selectedInstanceSettingItems", []);
105
138
  /**
106
139
  * 当前选中控件的数据模型
107
- * */ this.selectedFieldItem = null;
140
+ * */ _defineProperty(this, "selectedFieldItem", null);
108
141
  /**
109
142
  * 扩展字段,比如appId,dataCode等
110
- * */ this.external = {};
111
- this.movingInstance = null;
112
- this.movingInstanceOldParent = null;
113
- this.movingInstanceOldDataScopeParent = null;
114
- var _getParentBeforeInstanceMove;
115
- this.getParentBeforeInstanceMove = (_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _getParentBeforeInstanceMove !== void 0 ? _getParentBeforeInstanceMove : function(instance) {
143
+ * */ _defineProperty(this, "external", {});
144
+ _defineProperty(this, "movingInstance", null);
145
+ _defineProperty(this, "movingInstanceOldParent", null);
146
+ _defineProperty(this, "movingInstanceOldDataScopeParent", null);
147
+ _defineProperty(this, "getParentBeforeInstanceMove", void 0);
148
+ var _options_getParentBeforeInstanceMove;
149
+ this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
116
150
  return instance.parent;
117
151
  };
118
152
  this.instance = options.instance;
@@ -165,8 +199,8 @@ export var Store = /*#__PURE__*/ function() {
165
199
  this.selectedInstanceSetting = settings;
166
200
  this.selectedInstanceSettingItems = [];
167
201
  this.selectedInstanceSetting.forEach(function(group) {
168
- var _selectedInstanceSettingItems;
169
- (_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
202
+ var _this_selectedInstanceSettingItems;
203
+ (_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
170
204
  });
171
205
  }
172
206
  },
@@ -208,7 +242,7 @@ export var Store = /*#__PURE__*/ function() {
208
242
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
209
243
  try {
210
244
  for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
211
- var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
245
+ var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
212
246
  if (value.id === instance.id) {
213
247
  map.delete(key);
214
248
  break;
@@ -290,7 +324,7 @@ export function isDataScopeInstance(instance) {
290
324
  return [
291
325
  CONTROL_TYPE.SUBTABLE,
292
326
  CONTROL_TYPE.DATA_VIEW,
293
- CONTROL_TYPE.LIST_VIEW,
327
+ CONTROL_TYPE.LIST_VIEW
294
328
  ].includes(instance.type);
295
329
  }
296
330
  export function findInstanceDataScopeParent(instance) {
@@ -1,33 +1,33 @@
1
- import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
1
+ import { CONTROL_TYPE, FieldTypes } from "@byteluck-fe/model-driven-shared";
2
2
  // 使用ObjectDataBind 的控件
3
3
  export var objectDataBindControlTypes = [
4
4
  CONTROL_TYPE.AMOUNT,
5
5
  CONTROL_TYPE.CALC,
6
- CONTROL_TYPE.DATE_RANGE,
6
+ CONTROL_TYPE.DATE_RANGE
7
7
  ];
8
8
  export var objectDataBindKeyToFieldType = {
9
9
  amount: {
10
- caption: '金额',
10
+ caption: "金额",
11
11
  fieldType: FieldTypes.DECIMAL
12
12
  },
13
13
  currency: {
14
- caption: '币种',
14
+ caption: "币种",
15
15
  fieldType: FieldTypes.VARCHAR
16
16
  },
17
17
  result: {
18
- caption: '结果',
18
+ caption: "结果",
19
19
  fieldType: FieldTypes.DECIMAL
20
20
  },
21
21
  unit: {
22
- caption: '单位',
22
+ caption: "单位",
23
23
  fieldType: FieldTypes.VARCHAR
24
24
  },
25
25
  min: {
26
- caption: '开始时间',
26
+ caption: "开始时间",
27
27
  fieldType: FieldTypes.TIMESTAMP
28
28
  },
29
29
  max: {
30
- caption: '结束时间',
30
+ caption: "结束时间",
31
31
  fieldType: FieldTypes.TIMESTAMP
32
32
  }
33
33
  };
@@ -1,9 +1,9 @@
1
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from '@byteluck-fe/model-driven-shared';
1
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from "@byteluck-fe/model-driven-shared";
2
2
  export function hasChildrenControl(instance) {
3
- return 'children' in instance && isArray(instance.children);
3
+ return "children" in instance && isArray(instance.children);
4
4
  }
5
5
  export function hasHeaderControl(instance) {
6
- return 'headers' in instance.props && isArray(instance.props.headers);
6
+ return "headers" in instance.props && isArray(instance.props.headers);
7
7
  }
8
8
  export function loopFormControl(control, callback) {
9
9
  if (Array.isArray(control)) {
@@ -14,9 +14,8 @@ export function loopFormControl(control, callback) {
14
14
  // @ts-ignore
15
15
  loopFormControl(item.props.headers, callback);
16
16
  } else if (hasChildrenControl(item)) {
17
- var // @ts-ignore
18
- ref;
19
- loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
17
+ loopFormControl(// @ts-ignore
18
+ item === null || item === void 0 ? void 0 : item.children, callback);
20
19
  // @ts-ignore
21
20
  // } else if (item instanceof DesignerFormControl) {
22
21
  } else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import Designer from './Designer';
1
+ import Designer from "./Designer";
2
2
  export { Designer };
3
- export * from './utils';
4
- export * from './Builder';
5
- export * from './designerUtils';
6
- export * from './Driven';
7
- export * from './Store';
3
+ export * from "./utils";
4
+ export * from "./Builder";
5
+ export * from "./designerUtils";
6
+ export * from "./Driven";
7
+ export * from "./Store";
package/dist/esm/utils.js CHANGED
@@ -85,11 +85,105 @@ function _unsupportedIterableToArray(o, minLen) {
85
85
  if (n === "Map" || n === "Set") return Array.from(n);
86
86
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
87
87
  }
88
- import regeneratorRuntime from "regenerator-runtime";
89
- import { loopFormControl } from './designerUtils';
90
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from '@byteluck-fe/model-driven-shared';
91
- import Designer from './Designer';
92
- import { objectDataBindControlTypes, objectDataBindKeyToFieldType } from './constants';
88
+ var __generator = this && this.__generator || function(thisArg, body) {
89
+ var f, y, t, g, _ = {
90
+ label: 0,
91
+ sent: function() {
92
+ if (t[0] & 1) throw t[1];
93
+ return t[1];
94
+ },
95
+ trys: [],
96
+ ops: []
97
+ };
98
+ return g = {
99
+ next: verb(0),
100
+ "throw": verb(1),
101
+ "return": verb(2)
102
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
103
+ return this;
104
+ }), g;
105
+ function verb(n) {
106
+ return function(v) {
107
+ return step([
108
+ n,
109
+ v
110
+ ]);
111
+ };
112
+ }
113
+ function step(op) {
114
+ if (f) throw new TypeError("Generator is already executing.");
115
+ while(_)try {
116
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
117
+ if (y = 0, t) op = [
118
+ op[0] & 2,
119
+ t.value
120
+ ];
121
+ switch(op[0]){
122
+ case 0:
123
+ case 1:
124
+ t = op;
125
+ break;
126
+ case 4:
127
+ _.label++;
128
+ return {
129
+ value: op[1],
130
+ done: false
131
+ };
132
+ case 5:
133
+ _.label++;
134
+ y = op[1];
135
+ op = [
136
+ 0
137
+ ];
138
+ continue;
139
+ case 7:
140
+ op = _.ops.pop();
141
+ _.trys.pop();
142
+ continue;
143
+ default:
144
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
145
+ _ = 0;
146
+ continue;
147
+ }
148
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
149
+ _.label = op[1];
150
+ break;
151
+ }
152
+ if (op[0] === 6 && _.label < t[1]) {
153
+ _.label = t[1];
154
+ t = op;
155
+ break;
156
+ }
157
+ if (t && _.label < t[2]) {
158
+ _.label = t[2];
159
+ _.ops.push(op);
160
+ break;
161
+ }
162
+ if (t[2]) _.ops.pop();
163
+ _.trys.pop();
164
+ continue;
165
+ }
166
+ op = body.call(thisArg, _);
167
+ } catch (e) {
168
+ op = [
169
+ 6,
170
+ e
171
+ ];
172
+ y = 0;
173
+ } finally{
174
+ f = t = 0;
175
+ }
176
+ if (op[0] & 5) throw op[1];
177
+ return {
178
+ value: op[0] ? op[1] : void 0,
179
+ done: true
180
+ };
181
+ }
182
+ };
183
+ import { loopFormControl } from "./designerUtils";
184
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
185
+ import Designer from "./Designer";
186
+ import { objectDataBindControlTypes, objectDataBindKeyToFieldType } from "./constants";
93
187
  export function getMasterFormControls(controls) {
94
188
  var formctls = [];
95
189
  // @ts-ignore
@@ -105,7 +199,7 @@ export function getMasterFormControls(controls) {
105
199
  * @description 给modelBindInfoList中填充fieldCode和dataCode
106
200
  * @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
107
201
  * */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
108
- var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
202
+ var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
109
203
  if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
110
204
  return modelBindInfoList.map(function(item) {
111
205
  if (!item.dataBind) return item;
@@ -116,7 +210,7 @@ export function getMasterFormControls(controls) {
116
210
  Object.keys(objectDataBind).forEach(function(key) {
117
211
  var dataBind = objectDataBind[key];
118
212
  // 如果是ObjectDataBind的话,需要将id拼接当前的key作为元素的fieldCode
119
- var fieldCode = item.controlId + '_' + key;
213
+ var fieldCode = item.controlId + "_" + key;
120
214
  dataBind.fieldCode = fieldCodeBeforeAddPrefix(fieldCode);
121
215
  dataBind.dataCode = dataCode;
122
216
  });
@@ -128,7 +222,7 @@ export function getMasterFormControls(controls) {
128
222
  });
129
223
  }
130
224
  function fieldCodeBeforeAddPrefix(fieldCode) {
131
- var prefix = 'field_';
225
+ var prefix = "field_";
132
226
  if (fieldCode.startsWith(prefix)) {
133
227
  return fieldCode;
134
228
  }
@@ -158,7 +252,7 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
158
252
  // 当前key对应的fieldType
159
253
  var fieldType = objectDataBindKeyToFieldType[key].fieldType;
160
254
  // 拼接当前列的caption
161
- var caption = item.caption + '_' + objectDataBindKeyToFieldType[key].caption;
255
+ var caption = item.caption + "_" + objectDataBindKeyToFieldType[key].caption;
162
256
  // 通过fieldType获取列类型
163
257
  var controlType = getColumnTypeFromFiledType(fieldType);
164
258
  if (!controlType) return;
@@ -166,8 +260,8 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
166
260
  caption: caption,
167
261
  dataBind: dataBind
168
262
  };
169
- if (key === 'currency') {
170
- props.optionConfig = 'datasource';
263
+ if (key === "currency") {
264
+ props.optionConfig = "datasource";
171
265
  props.datasourceBind = datasourceBind;
172
266
  }
173
267
  // @ts-ignore
@@ -177,17 +271,17 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
177
271
  column && columns.push(column);
178
272
  });
179
273
  } else {
180
- var controlType1 = getColumnTypeFromFiledType(item.fieldType);
181
- if (!controlType1) return;
274
+ var controlType = getColumnTypeFromFiledType(item.fieldType);
275
+ if (!controlType) return;
182
276
  // @ts-ignore
183
- var column1 = designer.createControlInstance(controlType1, {
277
+ var column = designer.createControlInstance(controlType, {
184
278
  props: {
185
279
  caption: item.caption,
186
280
  dataBind: item.dataBind,
187
281
  datasourceBind: item.datasourceBind
188
282
  }
189
283
  });
190
- column1 && columns.push(column1);
284
+ column && columns.push(column);
191
285
  }
192
286
  });
193
287
  return columns;
@@ -226,35 +320,42 @@ function checkSchema(controls, messages, ignore) {
226
320
  return _checkSchema.apply(this, arguments);
227
321
  }
228
322
  function _checkSchema() {
229
- _checkSchema = _asyncToGenerator(regeneratorRuntime.mark(function _callee(controls, messages, ignore) {
323
+ _checkSchema = _asyncToGenerator(function(controls, messages, ignore) {
230
324
  var result;
231
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
232
- while(1)switch(_ctx.prev = _ctx.next){
325
+ return __generator(this, function(_state) {
326
+ switch(_state.label){
233
327
  case 0:
234
- if (!Array.isArray(controls)) {
235
- _ctx.next = 5;
236
- break;
237
- }
238
- _ctx.next = 3;
239
- return Promise.all(controls.map(function(control) {
240
- return control.validate(messages, ignore);
241
- }));
328
+ if (!Array.isArray(controls)) return [
329
+ 3,
330
+ 2
331
+ ];
332
+ return [
333
+ 4,
334
+ Promise.all(controls.map(function(control) {
335
+ return control.validate(messages, ignore);
336
+ }))
337
+ ];
338
+ case 1:
339
+ result = _state.sent();
340
+ return [
341
+ 2,
342
+ result.every(function(state) {
343
+ return state;
344
+ })
345
+ ];
346
+ case 2:
347
+ return [
348
+ 4,
349
+ controls.validate(messages, ignore)
350
+ ];
242
351
  case 3:
243
- result = _ctx.sent;
244
- return _ctx.abrupt("return", result.every(function(state) {
245
- return state;
246
- }));
247
- case 5:
248
- _ctx.next = 7;
249
- return controls.validate(messages, ignore);
250
- case 7:
251
- return _ctx.abrupt("return", _ctx.sent);
252
- case 8:
253
- case "end":
254
- return _ctx.stop();
352
+ return [
353
+ 2,
354
+ _state.sent()
355
+ ];
255
356
  }
256
- }, _callee);
257
- }));
357
+ });
358
+ });
258
359
  return _checkSchema.apply(this, arguments);
259
360
  }
260
361
  // 不可以被权限控制的控件
@@ -286,46 +387,46 @@ var cannotEditControlTypes = [
286
387
  // 列表操作列单独处理三个按钮的权限
287
388
  var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
288
389
  check: {
289
- id: 'listPageCheckBtnId',
290
- caption: '查看'
390
+ id: "listPageCheckBtnId",
391
+ caption: "查看"
291
392
  },
292
393
  edit: {
293
- id: 'listPageEditBtnId',
294
- caption: '编辑'
394
+ id: "listPageEditBtnId",
395
+ caption: "编辑"
295
396
  },
296
397
  delete: {
297
- id: 'listPageDeleteBtnId',
298
- caption: '删除'
398
+ id: "listPageDeleteBtnId",
399
+ caption: "删除"
299
400
  }
300
401
  };
301
402
  // 生成权限字段
302
403
  function generatePermissions(controls, parent) {
303
- var result1 = [];
404
+ var result = [];
304
405
  if (isArray(controls)) {
305
406
  var _result;
306
- (_result = result1).push.apply(_result, _toConsumableArray(controls.map(function(item) {
407
+ (_result = result).push.apply(_result, _toConsumableArray(controls.map(function(item) {
307
408
  return generatePermissions(item, parent);
308
409
  }).flat()));
309
410
  } else {
310
411
  var type = controls.type;
311
- var _props = controls.props, caption1 = _props.caption, content = _props.content;
412
+ var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
312
413
  var permissionItem;
313
414
  if (!PermissionExcludeControlTypes.includes(type)) {
314
- var ref;
415
+ var _parent_controlId;
315
416
  permissionItem = {
316
417
  controlId: controls.id,
317
- caption: caption1 || content || controls.name,
418
+ caption: caption || content || controls.name,
318
419
  type: controls.type,
319
420
  controlType: controls.controlType,
320
- parentId: (ref = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && ref !== void 0 ? ref : null,
421
+ parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
321
422
  canEdit: !cannotEditControlTypes.includes(type),
322
423
  canRead: true,
323
424
  canHide: true,
324
- group: 'element'
425
+ group: "element"
325
426
  };
326
427
  if (parent && parent.type === CONTROL_TYPE.SUBTABLE) {
327
428
  // 如果有parent,则利用下划线拼接caption
328
- permissionItem.caption = parent.caption + '_' + permissionItem.caption;
429
+ permissionItem.caption = parent.caption + "_" + permissionItem.caption;
329
430
  }
330
431
  if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
331
432
  permissionItem.caption = controls.props.controlExportName || controls.name;
@@ -336,59 +437,59 @@ function generatePermissions(controls, parent) {
336
437
  // ) {
337
438
  if (controls.controlType === CONTROL_BASE_TYPE.FORM || controls.controlType === CONTROL_BASE_TYPE.COLUMN) {
338
439
  var //@ts-ignore
339
- ref1, ref2, //@ts-ignore
340
- ref3, ref4;
341
- if (((ref1 = controls.props) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.dataBind) === null || ref2 === void 0 ? void 0 : ref2.fieldCode) !== undefined && ((ref3 = controls.props) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.dataBind) === null || ref4 === void 0 ? void 0 : ref4.fieldCode) !== '') {
342
- permissionItem.group = 'field';
440
+ _controls_props1, _controls_props_dataBind, //@ts-ignore
441
+ _controls_props2, _controls_props_dataBind1;
442
+ 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
+ permissionItem.group = "field";
343
444
  }
344
445
  }
345
- result1.push(permissionItem);
446
+ result.push(permissionItem);
346
447
  //追加vue容器权限
347
448
  if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
348
- var ref5, ref6, ref7, ref8;
349
- var vueFormItemGroup = 'element';
350
- if (((ref5 = controls.props) === null || ref5 === void 0 ? void 0 : (ref6 = ref5.dataBind) === null || ref6 === void 0 ? void 0 : ref6.fieldCode) !== undefined && ((ref7 = controls.props) === null || ref7 === void 0 ? void 0 : (ref8 = ref7.dataBind) === null || ref8 === void 0 ? void 0 : ref8.fieldCode) !== '') {
351
- vueFormItemGroup = 'field';
449
+ var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
450
+ var vueFormItemGroup = "element";
451
+ 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
+ vueFormItemGroup = "field";
352
453
  }
353
- var permissions = controls.props['permissions'];
454
+ var permissions = controls.props["permissions"];
354
455
  permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
355
- var _id;
456
+ var _controls_id;
356
457
  permissionItem = {
357
458
  controlId: item.key,
358
459
  caption: item.caption,
359
460
  type: controls.type,
360
461
  controlType: controls.controlType,
361
- parentId: (_id = controls.id) !== null && _id !== void 0 ? _id : null,
462
+ parentId: (_controls_id = controls.id) !== null && _controls_id !== void 0 ? _controls_id : null,
362
463
  canEdit: true,
363
464
  canRead: true,
364
465
  canHide: true,
365
466
  group: vueFormItemGroup
366
467
  };
367
- result1.push(permissionItem);
468
+ result.push(permissionItem);
368
469
  });
369
470
  }
370
471
  } else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
371
472
  // 列表的操作列单独处理
372
473
  Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
373
- var _param = _slicedToArray(param, 2), key = _param[0], ref = _param[1], caption = ref.caption, controlId = ref.id;
474
+ var _param = _slicedToArray(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
374
475
  var operationItem = controls.props[key];
375
476
  if (operationItem && operationItem.isShow) {
376
- var ref9;
477
+ var _parent_controlId;
377
478
  // 只能控制是否显示
378
479
  result.push({
379
480
  controlId: controlId,
380
481
  caption: caption,
381
482
  type: controls.type,
382
483
  controlType: controls.controlType,
383
- parentId: (ref9 = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && ref9 !== void 0 ? ref9 : null,
484
+ parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
384
485
  canEdit: false,
385
486
  canRead: false,
386
487
  canHide: true,
387
- group: 'element'
488
+ group: "element"
388
489
  });
389
490
  }
390
491
  return result;
391
- }, result1);
492
+ }, result);
392
493
  }
393
494
  // else if (type === CONTROL_TYPE.CUSTOM_COLUMN) {
394
495
  // //追加自定义列上的vue容器权限
@@ -412,7 +513,7 @@ function generatePermissions(controls, parent) {
412
513
  // }
413
514
  if (controls.children) {
414
515
  var _result1;
415
- (_result1 = result1).push.apply(_result1, _toConsumableArray(controls.children.map(function(item) {
516
+ (_result1 = result).push.apply(_result1, _toConsumableArray(controls.children.map(function(item) {
416
517
  return generatePermissions(item, parent);
417
518
  }).flat()));
418
519
  }
@@ -420,11 +521,11 @@ function generatePermissions(controls, parent) {
420
521
  if (controls.controlType === CONTROL_BASE_TYPE.LIST) {
421
522
  var // 明细子表和列表的需要给parentId
422
523
  _result2;
423
- (_result2 = result1).push.apply(_result2, _toConsumableArray(controls.props.headers.map(function(item) {
524
+ (_result2 = result).push.apply(_result2, _toConsumableArray(controls.props.headers.map(function(item) {
424
525
  return generatePermissions(item, permissionItem);
425
526
  }).flat()));
426
527
  }
427
528
  }
428
- return result1;
529
+ return result;
429
530
  }
430
531
  export { toSchema, getModelBindInfoList, checkSchema, generatePermissions };