@byteluck-fe/model-driven-driven 2.7.0-alpha.30 → 2.7.0-alpha.31b
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/README.md +13 -13
- package/dist/esm/Builder.js +9 -22
- package/dist/esm/Designer.js +73 -177
- package/dist/esm/Driven.js +131 -148
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +57 -91
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +7 -6
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +98 -199
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +5 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- package/package.json +6 -6
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,28 +23,15 @@ 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
|
|
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
|
-
function _iterable_to_array(iter) {
|
|
31
|
+
function _iterableToArray(iter) {
|
|
45
32
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
46
33
|
}
|
|
47
|
-
function
|
|
34
|
+
function _iterableToArrayLimit(arr, i) {
|
|
48
35
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
49
36
|
if (_i == null) return;
|
|
50
37
|
var _arr = [];
|
|
@@ -68,87 +55,66 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
68
55
|
}
|
|
69
56
|
return _arr;
|
|
70
57
|
}
|
|
71
|
-
function
|
|
58
|
+
function _nonIterableRest() {
|
|
72
59
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
73
60
|
}
|
|
74
|
-
function
|
|
61
|
+
function _nonIterableSpread() {
|
|
75
62
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
76
63
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
64
|
+
function _slicedToArray(arr, i) {
|
|
65
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
79
66
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
67
|
+
function _toConsumableArray(arr) {
|
|
68
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
82
69
|
}
|
|
83
|
-
function
|
|
70
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
84
71
|
if (!o) return;
|
|
85
|
-
if (typeof o === "string") return
|
|
72
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
86
73
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
74
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
75
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
89
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
76
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
90
77
|
}
|
|
91
|
-
import { isDataBind } from
|
|
92
|
-
import { hasChildrenControl, hasFooterControl, hasHeaderControl } from
|
|
93
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
78
|
+
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
79
|
+
import { hasChildrenControl, hasFooterControl, hasHeaderControl } from './designerUtils';
|
|
80
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
94
81
|
// 维护当前selected,。。 selectedControlSetting
|
|
95
82
|
export var Store = /*#__PURE__*/ function() {
|
|
96
83
|
"use strict";
|
|
97
84
|
function Store(options) {
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* */
|
|
102
|
-
/**
|
|
103
|
-
*
|
|
104
|
-
* */
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
124
|
-
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
|
-
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
128
|
-
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
|
-
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
132
|
-
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
135
|
-
* */ _define_property(this, "external", {});
|
|
136
|
-
_define_property(this, "movingInstance", null);
|
|
137
|
-
_define_property(this, "movingInstanceOldParent", null);
|
|
138
|
-
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
139
|
-
_define_property(this, "getParentBeforeInstanceMove", void 0);
|
|
140
|
-
var _options_getParentBeforeInstanceMove;
|
|
141
|
-
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
85
|
+
_classCallCheck(this, Store);
|
|
86
|
+
/**
|
|
87
|
+
* 当前选中的控件
|
|
88
|
+
* */ this.selected = null;
|
|
89
|
+
/**
|
|
90
|
+
* 当前选中的数据作用域控件
|
|
91
|
+
* */ this.selectedInstanceDataScopeParent = null;
|
|
92
|
+
this.selectedDataScopeFlatInstances = [];
|
|
93
|
+
/**
|
|
94
|
+
* 当前选中控件的setting
|
|
95
|
+
* */ this.selectedInstanceSetting = [];
|
|
96
|
+
this.selectedInstanceSettingItems = [];
|
|
97
|
+
/**
|
|
98
|
+
* 当前选中控件的数据模型
|
|
99
|
+
* */ this.selectedFieldItem = null;
|
|
100
|
+
/**
|
|
101
|
+
* 扩展字段,比如appId,dataCode等
|
|
102
|
+
* */ this.external = {};
|
|
103
|
+
this.movingInstance = null;
|
|
104
|
+
this.movingInstanceOldParent = null;
|
|
105
|
+
this.movingInstanceOldDataScopeParent = null;
|
|
106
|
+
var _getParentBeforeInstanceMove;
|
|
107
|
+
this.getParentBeforeInstanceMove = (_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _getParentBeforeInstanceMove !== void 0 ? _getParentBeforeInstanceMove : function(instance) {
|
|
142
108
|
return instance.parent;
|
|
143
109
|
};
|
|
144
110
|
this.instance = options.instance;
|
|
145
111
|
this.getFlatInstances();
|
|
146
112
|
}
|
|
147
|
-
|
|
113
|
+
_createClass(Store, [
|
|
148
114
|
{
|
|
149
115
|
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
116
|
+
get: /**
|
|
117
|
+
* 当前选中控件的rules
|
|
152
118
|
* */ function get() {
|
|
153
119
|
if (!this.selected) {
|
|
154
120
|
return null;
|
|
@@ -158,8 +124,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
158
124
|
},
|
|
159
125
|
{
|
|
160
126
|
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
127
|
+
get: /**
|
|
128
|
+
* 当前选中控件的antd rules
|
|
163
129
|
* */ function get() {
|
|
164
130
|
var rules = this.selectedRules;
|
|
165
131
|
if (!rules) {
|
|
@@ -191,8 +157,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
191
157
|
this.selectedInstanceSetting = settings;
|
|
192
158
|
this.selectedInstanceSettingItems = [];
|
|
193
159
|
this.selectedInstanceSetting.forEach(function(group) {
|
|
194
|
-
var
|
|
195
|
-
(
|
|
160
|
+
var _selectedInstanceSettingItems;
|
|
161
|
+
(_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
|
|
196
162
|
});
|
|
197
163
|
}
|
|
198
164
|
},
|
|
@@ -200,9 +166,9 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
200
166
|
key: "getSettingItems",
|
|
201
167
|
value: function getSettingItems(group) {
|
|
202
168
|
// return group instanceof Group
|
|
203
|
-
return group.type ===
|
|
169
|
+
return group.type === 'group' ? group.items : group.items.reduce(function(result, curr) {
|
|
204
170
|
var _result;
|
|
205
|
-
(_result = result).push.apply(_result,
|
|
171
|
+
(_result = result).push.apply(_result, _toConsumableArray(curr.items));
|
|
206
172
|
return result;
|
|
207
173
|
}, []);
|
|
208
174
|
}
|
|
@@ -235,7 +201,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
235
201
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
236
202
|
try {
|
|
237
203
|
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
238
|
-
var
|
|
204
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
239
205
|
if (value.id === instance.id) {
|
|
240
206
|
map.delete(key);
|
|
241
207
|
break;
|
|
@@ -313,9 +279,9 @@ export function loop(instances, callback) {
|
|
|
313
279
|
loop(item.props.headers, callback);
|
|
314
280
|
}
|
|
315
281
|
if (hasFooterControl(item)) {
|
|
316
|
-
var
|
|
317
|
-
var
|
|
318
|
-
loop((
|
|
282
|
+
var ref;
|
|
283
|
+
var ref1;
|
|
284
|
+
loop((ref1 = (ref = item.props) === null || ref === void 0 ? void 0 : ref.footers) !== null && ref1 !== void 0 ? ref1 : [], callback);
|
|
319
285
|
}
|
|
320
286
|
});
|
|
321
287
|
}
|
|
@@ -323,7 +289,7 @@ export function isDataScopeInstance(instance) {
|
|
|
323
289
|
return [
|
|
324
290
|
CONTROL_TYPE.SUBTABLE,
|
|
325
291
|
CONTROL_TYPE.DATA_VIEW,
|
|
326
|
-
CONTROL_TYPE.LIST_VIEW
|
|
292
|
+
CONTROL_TYPE.LIST_VIEW,
|
|
327
293
|
].includes(instance.type);
|
|
328
294
|
}
|
|
329
295
|
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,12 +1,12 @@
|
|
|
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 hasFooterControl(instance) {
|
|
9
|
-
return
|
|
9
|
+
return 'footers' in instance.props && isArray(instance.props.footers);
|
|
10
10
|
}
|
|
11
11
|
export function loopFormControl(control, callback) {
|
|
12
12
|
if (Array.isArray(control)) {
|
|
@@ -17,8 +17,9 @@ export function loopFormControl(control, callback) {
|
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
loopFormControl(item.props.headers, callback);
|
|
19
19
|
} else if (hasChildrenControl(item)) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
var // @ts-ignore
|
|
21
|
+
ref;
|
|
22
|
+
loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
22
23
|
// @ts-ignore
|
|
23
24
|
// } else if (item instanceof DesignerFormControl) {
|
|
24
25
|
} 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';
|