@byteluck-fe/model-driven-driven 2.7.0-alpha.9 → 2.7.0-beta
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 +22 -9
- package/dist/esm/Designer.js +176 -72
- package/dist/esm/Driven.js +131 -135
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +75 -41
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +5 -5
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +196 -94
- 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 +6 -6
package/dist/esm/Store.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
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
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
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,35 @@ function _defineProperties(target, props) {
|
|
|
23
23
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
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 _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
|
+
}
|
|
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
|
}
|
|
37
50
|
}
|
|
38
|
-
function
|
|
51
|
+
function _iterable_to_array(iter) {
|
|
39
52
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
40
53
|
}
|
|
41
|
-
function
|
|
54
|
+
function _iterable_to_array_limit(arr, i) {
|
|
42
55
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
43
56
|
if (_i == null) return;
|
|
44
57
|
var _arr = [];
|
|
@@ -62,63 +75,84 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
62
75
|
}
|
|
63
76
|
return _arr;
|
|
64
77
|
}
|
|
65
|
-
function
|
|
78
|
+
function _non_iterable_rest() {
|
|
66
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.");
|
|
67
80
|
}
|
|
68
|
-
function
|
|
81
|
+
function _non_iterable_spread() {
|
|
69
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.");
|
|
70
83
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
84
|
+
function _sliced_to_array(arr, i) {
|
|
85
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
73
86
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
87
|
+
function _to_consumable_array(arr) {
|
|
88
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
76
89
|
}
|
|
77
|
-
function
|
|
90
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
78
91
|
if (!o) return;
|
|
79
|
-
if (typeof o === "string") return
|
|
92
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
80
93
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
81
94
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
82
95
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
83
|
-
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 _array_like_to_array(o, minLen);
|
|
84
97
|
}
|
|
85
|
-
import { DataBind } from
|
|
86
|
-
import { hasChildrenControl, hasHeaderControl } from
|
|
87
|
-
import { Group } from
|
|
88
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
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
|
+
_class_call_check(this, Store);
|
|
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);
|
|
94
127
|
/**
|
|
95
128
|
* 当前选中的控件
|
|
96
|
-
* */ this
|
|
129
|
+
* */ _define_property(this, "selected", null);
|
|
97
130
|
/**
|
|
98
131
|
* 当前选中的数据作用域控件
|
|
99
|
-
* */ this
|
|
100
|
-
this
|
|
132
|
+
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
133
|
+
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
101
134
|
/**
|
|
102
135
|
* 当前选中控件的setting
|
|
103
|
-
* */ this
|
|
104
|
-
this
|
|
136
|
+
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
137
|
+
_define_property(this, "selectedInstanceSettingItems", []);
|
|
105
138
|
/**
|
|
106
139
|
* 当前选中控件的数据模型
|
|
107
|
-
* */ this
|
|
140
|
+
* */ _define_property(this, "selectedFieldItem", null);
|
|
108
141
|
/**
|
|
109
142
|
* 扩展字段,比如appId,dataCode等
|
|
110
|
-
* */ this
|
|
111
|
-
this
|
|
112
|
-
this
|
|
113
|
-
this
|
|
114
|
-
|
|
115
|
-
|
|
143
|
+
* */ _define_property(this, "external", {});
|
|
144
|
+
_define_property(this, "movingInstance", null);
|
|
145
|
+
_define_property(this, "movingInstanceOldParent", null);
|
|
146
|
+
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
147
|
+
_define_property(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;
|
|
119
153
|
this.getFlatInstances();
|
|
120
154
|
}
|
|
121
|
-
|
|
155
|
+
_create_class(Store, [
|
|
122
156
|
{
|
|
123
157
|
key: "selectedRules",
|
|
124
158
|
get: /**
|
|
@@ -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
|
|
169
|
-
(
|
|
202
|
+
var _this_selectedInstanceSettingItems;
|
|
203
|
+
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _to_consumable_array(_this.getSettingItems(group)));
|
|
170
204
|
});
|
|
171
205
|
}
|
|
172
206
|
},
|
|
@@ -175,7 +209,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
175
209
|
value: function getSettingItems(group) {
|
|
176
210
|
return _instanceof(group, Group) ? group.items : group.items.reduce(function(result, curr) {
|
|
177
211
|
var _result;
|
|
178
|
-
(_result = result).push.apply(_result,
|
|
212
|
+
(_result = result).push.apply(_result, _to_consumable_array(curr.items));
|
|
179
213
|
return result;
|
|
180
214
|
}, []);
|
|
181
215
|
}
|
|
@@ -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
|
|
245
|
+
var _step_value = _sliced_to_array(_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) {
|
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)) {
|
|
@@ -15,8 +15,8 @@ export function loopFormControl(control, callback) {
|
|
|
15
15
|
loopFormControl(item.props.headers, callback);
|
|
16
16
|
} else if (hasChildrenControl(item)) {
|
|
17
17
|
var // @ts-ignore
|
|
18
|
-
|
|
19
|
-
loopFormControl((
|
|
18
|
+
_item;
|
|
19
|
+
loopFormControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
// } else if (item instanceof DesignerFormControl) {
|
|
22
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";
|