@byteluck-fe/model-driven-driven 2.5.0-alpha.4 → 2.5.0-alpha.6
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 +47 -47
- package/dist/esm/Driven.js +75 -75
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +38 -38
- package/dist/esm/utils.js +21 -21
- package/dist/index.umd.js +3 -3
- package/package.json +5 -5
package/dist/esm/Store.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
function
|
|
12
|
+
function _classCallCheck(instance, Constructor) {
|
|
13
13
|
if (!(instance instanceof Constructor)) {
|
|
14
14
|
throw new TypeError("Cannot call a class as a function");
|
|
15
15
|
}
|
|
@@ -23,12 +23,12 @@ function _defineProperties(target, props) {
|
|
|
23
23
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _createClass(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
|
|
31
|
+
function _defineProperty(obj, key, value) {
|
|
32
32
|
if (key in obj) {
|
|
33
33
|
Object.defineProperty(obj, key, {
|
|
34
34
|
value: value,
|
|
@@ -48,10 +48,10 @@ function _instanceof(left, right) {
|
|
|
48
48
|
return left instanceof right;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function _iterableToArray(iter) {
|
|
52
52
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function _iterableToArrayLimit(arr, i) {
|
|
55
55
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
56
56
|
if (_i == null) return;
|
|
57
57
|
var _arr = [];
|
|
@@ -75,25 +75,25 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
75
75
|
}
|
|
76
76
|
return _arr;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function _nonIterableRest() {
|
|
79
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.");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function _nonIterableSpread() {
|
|
82
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.");
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function _slicedToArray(arr, i) {
|
|
85
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
87
|
+
function _toConsumableArray(arr) {
|
|
88
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
91
91
|
if (!o) return;
|
|
92
|
-
if (typeof o === "string") return
|
|
92
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
93
93
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
94
94
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
95
95
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
96
|
-
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 _arrayLikeToArray(o, minLen);
|
|
97
97
|
}
|
|
98
98
|
import { DataBind } from "@byteluck-fe/model-driven-core";
|
|
99
99
|
import { hasChildrenControl, hasHeaderControl } from "./designerUtils";
|
|
@@ -103,16 +103,16 @@ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-share
|
|
|
103
103
|
export var Store = /*#__PURE__*/ function() {
|
|
104
104
|
"use strict";
|
|
105
105
|
function Store(options) {
|
|
106
|
-
|
|
106
|
+
_classCallCheck(this, Store);
|
|
107
107
|
/**
|
|
108
108
|
* 页面控件实例树
|
|
109
|
-
* */
|
|
109
|
+
* */ _defineProperty(this, "instance", void 0);
|
|
110
110
|
/**
|
|
111
111
|
* 拍平的控件数组
|
|
112
|
-
* */
|
|
112
|
+
* */ _defineProperty(this, "flatInstances", void 0);
|
|
113
113
|
/**
|
|
114
114
|
* 控件id组成的map
|
|
115
|
-
* */
|
|
115
|
+
* */ _defineProperty(this, "instanceIdMap", void 0);
|
|
116
116
|
/**
|
|
117
117
|
* dataCode和fieldCode组成的map
|
|
118
118
|
* {
|
|
@@ -123,28 +123,28 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
123
123
|
* [fieldCode]: 控件
|
|
124
124
|
* }
|
|
125
125
|
* }
|
|
126
|
-
* */
|
|
126
|
+
* */ _defineProperty(this, "dataFieldCodeMap", void 0);
|
|
127
127
|
/**
|
|
128
128
|
* 当前选中的控件
|
|
129
|
-
* */
|
|
129
|
+
* */ _defineProperty(this, "selected", null);
|
|
130
130
|
/**
|
|
131
131
|
* 当前选中的数据作用域控件
|
|
132
|
-
* */
|
|
133
|
-
|
|
132
|
+
* */ _defineProperty(this, "selectedInstanceDataScopeParent", null);
|
|
133
|
+
_defineProperty(this, "selectedDataScopeFlatInstances", []);
|
|
134
134
|
/**
|
|
135
135
|
* 当前选中控件的setting
|
|
136
|
-
* */
|
|
137
|
-
|
|
136
|
+
* */ _defineProperty(this, "selectedInstanceSetting", []);
|
|
137
|
+
_defineProperty(this, "selectedInstanceSettingItems", []);
|
|
138
138
|
/**
|
|
139
139
|
* 当前选中控件的数据模型
|
|
140
|
-
* */
|
|
140
|
+
* */ _defineProperty(this, "selectedFieldItem", null);
|
|
141
141
|
/**
|
|
142
142
|
* 扩展字段,比如appId,dataCode等
|
|
143
|
-
* */
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
148
|
var _options_getParentBeforeInstanceMove;
|
|
149
149
|
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
150
150
|
return instance.parent;
|
|
@@ -152,7 +152,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
152
152
|
this.instance = options.instance;
|
|
153
153
|
this.getFlatInstances();
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
_createClass(Store, [
|
|
156
156
|
{
|
|
157
157
|
key: "selectedRules",
|
|
158
158
|
get: /**
|
|
@@ -200,7 +200,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
200
200
|
this.selectedInstanceSettingItems = [];
|
|
201
201
|
this.selectedInstanceSetting.forEach(function(group) {
|
|
202
202
|
var _this_selectedInstanceSettingItems;
|
|
203
|
-
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems,
|
|
203
|
+
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
},
|
|
@@ -209,7 +209,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
209
209
|
value: function getSettingItems(group) {
|
|
210
210
|
return _instanceof(group, Group) ? group.items : group.items.reduce(function(result, curr) {
|
|
211
211
|
var _result;
|
|
212
|
-
(_result = result).push.apply(_result,
|
|
212
|
+
(_result = result).push.apply(_result, _toConsumableArray(curr.items));
|
|
213
213
|
return result;
|
|
214
214
|
}, []);
|
|
215
215
|
}
|
|
@@ -242,7 +242,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
242
242
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
243
243
|
try {
|
|
244
244
|
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
245
|
-
var _step_value =
|
|
245
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
246
246
|
if (value.id === instance.id) {
|
|
247
247
|
map.delete(key);
|
|
248
248
|
break;
|
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,25 +65,25 @@ 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
88
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
89
89
|
var f, y, t, g, _ = {
|
|
@@ -320,7 +320,7 @@ 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
325
|
return __generator(this, function(_state) {
|
|
326
326
|
switch(_state.label){
|
|
@@ -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, _toConsumableArray(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 = _slicedToArray(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, _toConsumableArray(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, _toConsumableArray(controls.props.headers.map(function(item) {
|
|
524
524
|
return generatePermissions(item, permissionItem);
|
|
525
525
|
}).flat()));
|
|
526
526
|
}
|