@byteluck-fe/model-driven-driven 2.7.0-alpha.24 → 2.7.0-alpha.25
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 +6 -6
- package/dist/esm/Designer.js +50 -50
- package/dist/esm/Driven.js +77 -77
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +38 -38
- package/dist/esm/designerUtils.js +2 -3
- package/dist/esm/utils.js +30 -32
- package/dist/index.umd.js +3 -3
- package/package.json +6 -6
package/dist/esm/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(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 _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(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 _asyncToGenerator(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 _async_to_generator(fn) {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _iterableToArray(iter) {
|
|
42
42
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _iterableToArrayLimit(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 _iterable_to_array_limit(arr, i) {
|
|
|
65
65
|
}
|
|
66
66
|
return _arr;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function _nonIterableRest() {
|
|
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 _nonIterableSpread() {
|
|
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 _slicedToArray(arr, i) {
|
|
75
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function _toConsumableArray(arr) {
|
|
78
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
81
81
|
if (!o) return;
|
|
82
|
-
if (typeof o === "string") return
|
|
82
|
+
if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
89
89
|
var f, y, t, g, _ = {
|
|
90
90
|
label: 0,
|
|
91
91
|
sent: function() {
|
|
@@ -179,7 +179,7 @@ function _ts_generator(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 = _asyncToGenerator(function(controls, messages, ignore) {
|
|
324
324
|
var result;
|
|
325
|
-
return
|
|
325
|
+
return __generator(this, function(_state) {
|
|
326
326
|
switch(_state.label){
|
|
327
327
|
case 0:
|
|
328
328
|
if (!Array.isArray(controls)) return [
|
|
@@ -406,7 +406,7 @@ function generatePermissions(controls, parent) {
|
|
|
406
406
|
var result = [];
|
|
407
407
|
if (isArray(controls)) {
|
|
408
408
|
var _result;
|
|
409
|
-
(_result = result).push.apply(_result,
|
|
409
|
+
(_result = result).push.apply(_result, _toConsumableArray(controls.map(function(item) {
|
|
410
410
|
return generatePermissions(item, parent);
|
|
411
411
|
}).flat()));
|
|
412
412
|
} else {
|
|
@@ -414,14 +414,13 @@ function generatePermissions(controls, parent) {
|
|
|
414
414
|
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
415
415
|
var permissionItem;
|
|
416
416
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
417
|
-
var _parent;
|
|
418
417
|
var _parent_controlId;
|
|
419
418
|
permissionItem = {
|
|
420
419
|
controlId: controls.id,
|
|
421
420
|
caption: caption || content || controls.name,
|
|
422
421
|
type: controls.type,
|
|
423
422
|
controlType: controls.controlType,
|
|
424
|
-
parentId: (_parent_controlId =
|
|
423
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
425
424
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
426
425
|
canRead: true,
|
|
427
426
|
canHide: true,
|
|
@@ -440,8 +439,8 @@ function generatePermissions(controls, parent) {
|
|
|
440
439
|
// ) {
|
|
441
440
|
if (controls.controlType === CONTROL_BASE_TYPE.FORM || controls.controlType === CONTROL_BASE_TYPE.COLUMN) {
|
|
442
441
|
var //@ts-ignore
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
_controls_props1, _controls_props_dataBind, //@ts-ignore
|
|
443
|
+
_controls_props2, _controls_props_dataBind1;
|
|
445
444
|
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) !== "") {
|
|
446
445
|
permissionItem.group = "field";
|
|
447
446
|
}
|
|
@@ -449,13 +448,13 @@ function generatePermissions(controls, parent) {
|
|
|
449
448
|
result.push(permissionItem);
|
|
450
449
|
//追加vue容器权限
|
|
451
450
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
452
|
-
var
|
|
451
|
+
var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
|
|
453
452
|
var vueFormItemGroup = "element";
|
|
454
453
|
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) !== "") {
|
|
455
454
|
vueFormItemGroup = "field";
|
|
456
455
|
}
|
|
457
456
|
var permissions = controls.props["permissions"];
|
|
458
|
-
|
|
457
|
+
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
459
458
|
var _controls_id;
|
|
460
459
|
permissionItem = {
|
|
461
460
|
controlId: item.key,
|
|
@@ -474,10 +473,9 @@ function generatePermissions(controls, parent) {
|
|
|
474
473
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
475
474
|
// 列表的操作列单独处理
|
|
476
475
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
477
|
-
var _param =
|
|
476
|
+
var _param = _slicedToArray(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
478
477
|
var operationItem = controls.props[key];
|
|
479
478
|
if (operationItem && operationItem.isShow) {
|
|
480
|
-
var _parent;
|
|
481
479
|
var _parent_controlId;
|
|
482
480
|
// 只能控制是否显示
|
|
483
481
|
result.push({
|
|
@@ -485,7 +483,7 @@ function generatePermissions(controls, parent) {
|
|
|
485
483
|
caption: caption,
|
|
486
484
|
type: controls.type,
|
|
487
485
|
controlType: controls.controlType,
|
|
488
|
-
parentId: (_parent_controlId =
|
|
486
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
489
487
|
canEdit: false,
|
|
490
488
|
canRead: false,
|
|
491
489
|
canHide: true,
|
|
@@ -517,7 +515,7 @@ function generatePermissions(controls, parent) {
|
|
|
517
515
|
// }
|
|
518
516
|
if (controls.children) {
|
|
519
517
|
var _result1;
|
|
520
|
-
(_result1 = result).push.apply(_result1,
|
|
518
|
+
(_result1 = result).push.apply(_result1, _toConsumableArray(controls.children.map(function(item) {
|
|
521
519
|
return generatePermissions(item, parent);
|
|
522
520
|
}).flat()));
|
|
523
521
|
}
|
|
@@ -525,7 +523,7 @@ function generatePermissions(controls, parent) {
|
|
|
525
523
|
if (controls.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
526
524
|
var // 明细子表和列表的需要给parentId
|
|
527
525
|
_result2;
|
|
528
|
-
(_result2 = result).push.apply(_result2,
|
|
526
|
+
(_result2 = result).push.apply(_result2, _toConsumableArray(controls.props.headers.map(function(item) {
|
|
529
527
|
return generatePermissions(item, permissionItem);
|
|
530
528
|
}).flat()));
|
|
531
529
|
}
|