@byteluck-fe/model-driven-driven 2.4.1-beta.0 → 2.4.1-beta.2
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 +9 -22
- package/dist/esm/Designer.js +72 -176
- package/dist/esm/Driven.js +111 -129
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +41 -75
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +6 -5
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +92 -193
- package/dist/index.umd.js +3 -3
- package/dist/types/Driven.d.ts +2 -2
- package/dist/types/Store.d.ts +1 -1
- 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,35 +23,22 @@ 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 _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
|
-
}
|
|
44
31
|
function _instanceof(left, right) {
|
|
45
32
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
46
|
-
return
|
|
33
|
+
return right[Symbol.hasInstance](left);
|
|
47
34
|
} else {
|
|
48
35
|
return left instanceof right;
|
|
49
36
|
}
|
|
50
37
|
}
|
|
51
|
-
function
|
|
38
|
+
function _iterableToArray(iter) {
|
|
52
39
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
40
|
}
|
|
54
|
-
function
|
|
41
|
+
function _iterableToArrayLimit(arr, i) {
|
|
55
42
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
56
43
|
if (_i == null) return;
|
|
57
44
|
var _arr = [];
|
|
@@ -75,84 +62,63 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
75
62
|
}
|
|
76
63
|
return _arr;
|
|
77
64
|
}
|
|
78
|
-
function
|
|
65
|
+
function _nonIterableRest() {
|
|
79
66
|
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
67
|
}
|
|
81
|
-
function
|
|
68
|
+
function _nonIterableSpread() {
|
|
82
69
|
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
70
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
71
|
+
function _slicedToArray(arr, i) {
|
|
72
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
86
73
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
74
|
+
function _toConsumableArray(arr) {
|
|
75
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
89
76
|
}
|
|
90
|
-
function
|
|
77
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
91
78
|
if (!o) return;
|
|
92
|
-
if (typeof o === "string") return
|
|
79
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
93
80
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
94
81
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
95
82
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
96
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
83
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
97
84
|
}
|
|
98
|
-
import { DataBind } from
|
|
99
|
-
import { hasChildrenControl, hasHeaderControl } from
|
|
100
|
-
import { Group } from
|
|
101
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
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';
|
|
102
89
|
// 维护当前selected,。。 selectedControlSetting
|
|
103
90
|
export var Store = /*#__PURE__*/ function() {
|
|
104
91
|
"use strict";
|
|
105
92
|
function Store(options) {
|
|
106
|
-
|
|
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);
|
|
93
|
+
_classCallCheck(this, Store);
|
|
127
94
|
/**
|
|
128
95
|
* 当前选中的控件
|
|
129
|
-
* */
|
|
96
|
+
* */ this.selected = null;
|
|
130
97
|
/**
|
|
131
98
|
* 当前选中的数据作用域控件
|
|
132
|
-
* */
|
|
133
|
-
|
|
99
|
+
* */ this.selectedInstanceDataScopeParent = null;
|
|
100
|
+
this.selectedDataScopeFlatInstances = [];
|
|
134
101
|
/**
|
|
135
102
|
* 当前选中控件的setting
|
|
136
|
-
* */
|
|
137
|
-
|
|
103
|
+
* */ this.selectedInstanceSetting = [];
|
|
104
|
+
this.selectedInstanceSettingItems = [];
|
|
138
105
|
/**
|
|
139
106
|
* 当前选中控件的数据模型
|
|
140
|
-
* */
|
|
107
|
+
* */ this.selectedFieldItem = null;
|
|
141
108
|
/**
|
|
142
109
|
* 扩展字段,比如appId,dataCode等
|
|
143
|
-
* */
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
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) {
|
|
150
116
|
return instance.parent;
|
|
151
117
|
};
|
|
152
118
|
this.instance = options.instance;
|
|
153
119
|
this.getFlatInstances();
|
|
154
120
|
}
|
|
155
|
-
|
|
121
|
+
_createClass(Store, [
|
|
156
122
|
{
|
|
157
123
|
key: "selectedRules",
|
|
158
124
|
get: /**
|
|
@@ -199,8 +165,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
199
165
|
this.selectedInstanceSetting = settings;
|
|
200
166
|
this.selectedInstanceSettingItems = [];
|
|
201
167
|
this.selectedInstanceSetting.forEach(function(group) {
|
|
202
|
-
var
|
|
203
|
-
(
|
|
168
|
+
var _selectedInstanceSettingItems;
|
|
169
|
+
(_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
|
|
204
170
|
});
|
|
205
171
|
}
|
|
206
172
|
},
|
|
@@ -209,7 +175,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
209
175
|
value: function getSettingItems(group) {
|
|
210
176
|
return _instanceof(group, Group) ? group.items : group.items.reduce(function(result, curr) {
|
|
211
177
|
var _result;
|
|
212
|
-
(_result = result).push.apply(_result,
|
|
178
|
+
(_result = result).push.apply(_result, _toConsumableArray(curr.items));
|
|
213
179
|
return result;
|
|
214
180
|
}, []);
|
|
215
181
|
}
|
|
@@ -242,7 +208,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
242
208
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
243
209
|
try {
|
|
244
210
|
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
245
|
-
var
|
|
211
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
246
212
|
if (value.id === instance.id) {
|
|
247
213
|
map.delete(key);
|
|
248
214
|
break;
|
|
@@ -324,7 +290,7 @@ export function isDataScopeInstance(instance) {
|
|
|
324
290
|
return [
|
|
325
291
|
CONTROL_TYPE.SUBTABLE,
|
|
326
292
|
CONTROL_TYPE.DATA_VIEW,
|
|
327
|
-
CONTROL_TYPE.LIST_VIEW
|
|
293
|
+
CONTROL_TYPE.LIST_VIEW,
|
|
328
294
|
].includes(instance.type);
|
|
329
295
|
}
|
|
330
296
|
export function findInstanceDataScopeParent(instance) {
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { CONTROL_TYPE, FieldTypes } from
|
|
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
|
|
1
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from '@byteluck-fe/model-driven-shared';
|
|
2
2
|
export function hasChildrenControl(instance) {
|
|
3
|
-
return
|
|
3
|
+
return 'children' in instance && isArray(instance.children);
|
|
4
4
|
}
|
|
5
5
|
export function hasHeaderControl(instance) {
|
|
6
|
-
return
|
|
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,8 +14,9 @@ export function loopFormControl(control, callback) {
|
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
loopFormControl(item.props.headers, callback);
|
|
16
16
|
} else if (hasChildrenControl(item)) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var // @ts-ignore
|
|
18
|
+
ref;
|
|
19
|
+
loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
19
20
|
// @ts-ignore
|
|
20
21
|
// } else if (item instanceof DesignerFormControl) {
|
|
21
22
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Designer from
|
|
1
|
+
import Designer from './Designer';
|
|
2
2
|
export { Designer };
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
3
|
+
export * from './utils';
|
|
4
|
+
export * from './Builder';
|
|
5
|
+
export * from './designerUtils';
|
|
6
|
+
export * from './Driven';
|
|
7
|
+
export * from './Store';
|