@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/Builder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
2
|
if (!(instance instanceof Constructor)) {
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
@@ -12,20 +12,33 @@ function _defineProperties(target, props) {
|
|
|
12
12
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
16
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
import Designer from "./Designer";
|
|
34
|
+
import { CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
22
35
|
export var Builder = /*#__PURE__*/ function() {
|
|
23
36
|
"use strict";
|
|
24
37
|
function Builder() {
|
|
25
|
-
|
|
26
|
-
this
|
|
38
|
+
_class_call_check(this, Builder);
|
|
39
|
+
_define_property(this, "designer", new Designer());
|
|
27
40
|
}
|
|
28
|
-
|
|
41
|
+
_create_class(Builder, [
|
|
29
42
|
{
|
|
30
43
|
key: "ListPageBuilder",
|
|
31
44
|
value: // @ts-ignore
|
|
@@ -66,7 +79,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
66
79
|
// @ts-ignore
|
|
67
80
|
var listview = this.designer.createControlInstance(// @ts-ignore
|
|
68
81
|
CONTROL_TYPE.LIST_VIEW);
|
|
69
|
-
listview.props.countType =
|
|
82
|
+
listview.props.countType = "async";
|
|
70
83
|
var simpleSearch = this.designer.createControlInstance(// @ts-ignore
|
|
71
84
|
CONTROL_TYPE.SIMPLE_SEARCH);
|
|
72
85
|
var gridTable = this.designer.createControlInstance(// @ts-ignore
|
|
@@ -115,7 +128,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
115
128
|
// @ts-ignore
|
|
116
129
|
vueFormItem.props.isHideCaption = true;
|
|
117
130
|
// @ts-ignore
|
|
118
|
-
vueFormItem.props.controlExportName =
|
|
131
|
+
vueFormItem.props.controlExportName = "VuePage";
|
|
119
132
|
// @ts-ignore
|
|
120
133
|
grid.children.push(vueFormItem);
|
|
121
134
|
return grid;
|
package/dist/esm/Designer.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _assert_this_initialized(self) {
|
|
10
10
|
if (self === void 0) {
|
|
11
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
12
|
}
|
|
@@ -26,7 +26,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
26
26
|
Promise.resolve(value).then(_next, _throw);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _async_to_generator(fn) {
|
|
30
30
|
return function() {
|
|
31
31
|
var self = this, args = arguments;
|
|
32
32
|
return new Promise(function(resolve, reject) {
|
|
@@ -41,7 +41,7 @@ function _asyncToGenerator(fn) {
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _class_call_check(instance, Constructor) {
|
|
45
45
|
if (!(instance instanceof Constructor)) {
|
|
46
46
|
throw new TypeError("Cannot call a class as a function");
|
|
47
47
|
}
|
|
@@ -55,16 +55,29 @@ function _defineProperties(target, props) {
|
|
|
55
55
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
59
59
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
60
60
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
61
61
|
return Constructor;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
63
|
+
function _define_property(obj, key, value) {
|
|
64
|
+
if (key in obj) {
|
|
65
|
+
Object.defineProperty(obj, key, {
|
|
66
|
+
value: value,
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
obj[key] = value;
|
|
73
|
+
}
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
function _get_prototype_of(o) {
|
|
77
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
65
78
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
66
79
|
};
|
|
67
|
-
return
|
|
80
|
+
return _get_prototype_of(o);
|
|
68
81
|
}
|
|
69
82
|
function _inherits(subClass, superClass) {
|
|
70
83
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -77,50 +90,50 @@ function _inherits(subClass, superClass) {
|
|
|
77
90
|
configurable: true
|
|
78
91
|
}
|
|
79
92
|
});
|
|
80
|
-
if (superClass)
|
|
93
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
81
94
|
}
|
|
82
95
|
function _instanceof(left, right) {
|
|
83
96
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
84
|
-
return right[Symbol.hasInstance](left);
|
|
97
|
+
return !!right[Symbol.hasInstance](left);
|
|
85
98
|
} else {
|
|
86
99
|
return left instanceof right;
|
|
87
100
|
}
|
|
88
101
|
}
|
|
89
|
-
function
|
|
102
|
+
function _iterable_to_array(iter) {
|
|
90
103
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
91
104
|
}
|
|
92
|
-
function
|
|
105
|
+
function _non_iterable_spread() {
|
|
93
106
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
94
107
|
}
|
|
95
|
-
function
|
|
96
|
-
if (call && (
|
|
108
|
+
function _possible_constructor_return(self, call) {
|
|
109
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
97
110
|
return call;
|
|
98
111
|
}
|
|
99
|
-
return
|
|
112
|
+
return _assert_this_initialized(self);
|
|
100
113
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
114
|
+
function _set_prototype_of(o, p) {
|
|
115
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
103
116
|
o.__proto__ = p;
|
|
104
117
|
return o;
|
|
105
118
|
};
|
|
106
|
-
return
|
|
119
|
+
return _set_prototype_of(o, p);
|
|
107
120
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
121
|
+
function _to_consumable_array(arr) {
|
|
122
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
110
123
|
}
|
|
111
|
-
|
|
124
|
+
function _type_of(obj) {
|
|
112
125
|
"@swc/helpers - typeof";
|
|
113
126
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
114
|
-
}
|
|
115
|
-
function
|
|
127
|
+
}
|
|
128
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
116
129
|
if (!o) return;
|
|
117
|
-
if (typeof o === "string") return
|
|
130
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
118
131
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
119
132
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
120
133
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
121
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
134
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
122
135
|
}
|
|
123
|
-
function
|
|
136
|
+
function _is_native_reflect_construct() {
|
|
124
137
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
125
138
|
if (Reflect.construct.sham) return false;
|
|
126
139
|
if (typeof Proxy === "function") return true;
|
|
@@ -131,44 +144,138 @@ function _isNativeReflectConstruct() {
|
|
|
131
144
|
return false;
|
|
132
145
|
}
|
|
133
146
|
}
|
|
134
|
-
function
|
|
135
|
-
var hasNativeReflectConstruct =
|
|
147
|
+
function _create_super(Derived) {
|
|
148
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
136
149
|
return function _createSuperInternal() {
|
|
137
|
-
var Super =
|
|
150
|
+
var Super = _get_prototype_of(Derived), result;
|
|
138
151
|
if (hasNativeReflectConstruct) {
|
|
139
|
-
var NewTarget =
|
|
152
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
140
153
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
141
154
|
} else {
|
|
142
155
|
result = Super.apply(this, arguments);
|
|
143
156
|
}
|
|
144
|
-
return
|
|
157
|
+
return _possible_constructor_return(this, result);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function _ts_generator(thisArg, body) {
|
|
161
|
+
var f, y, t, g, _ = {
|
|
162
|
+
label: 0,
|
|
163
|
+
sent: function() {
|
|
164
|
+
if (t[0] & 1) throw t[1];
|
|
165
|
+
return t[1];
|
|
166
|
+
},
|
|
167
|
+
trys: [],
|
|
168
|
+
ops: []
|
|
145
169
|
};
|
|
170
|
+
return g = {
|
|
171
|
+
next: verb(0),
|
|
172
|
+
"throw": verb(1),
|
|
173
|
+
"return": verb(2)
|
|
174
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
175
|
+
return this;
|
|
176
|
+
}), g;
|
|
177
|
+
function verb(n) {
|
|
178
|
+
return function(v) {
|
|
179
|
+
return step([
|
|
180
|
+
n,
|
|
181
|
+
v
|
|
182
|
+
]);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function step(op) {
|
|
186
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
187
|
+
while(_)try {
|
|
188
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
189
|
+
if (y = 0, t) op = [
|
|
190
|
+
op[0] & 2,
|
|
191
|
+
t.value
|
|
192
|
+
];
|
|
193
|
+
switch(op[0]){
|
|
194
|
+
case 0:
|
|
195
|
+
case 1:
|
|
196
|
+
t = op;
|
|
197
|
+
break;
|
|
198
|
+
case 4:
|
|
199
|
+
_.label++;
|
|
200
|
+
return {
|
|
201
|
+
value: op[1],
|
|
202
|
+
done: false
|
|
203
|
+
};
|
|
204
|
+
case 5:
|
|
205
|
+
_.label++;
|
|
206
|
+
y = op[1];
|
|
207
|
+
op = [
|
|
208
|
+
0
|
|
209
|
+
];
|
|
210
|
+
continue;
|
|
211
|
+
case 7:
|
|
212
|
+
op = _.ops.pop();
|
|
213
|
+
_.trys.pop();
|
|
214
|
+
continue;
|
|
215
|
+
default:
|
|
216
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
217
|
+
_ = 0;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
221
|
+
_.label = op[1];
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
225
|
+
_.label = t[1];
|
|
226
|
+
t = op;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (t && _.label < t[2]) {
|
|
230
|
+
_.label = t[2];
|
|
231
|
+
_.ops.push(op);
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
if (t[2]) _.ops.pop();
|
|
235
|
+
_.trys.pop();
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
op = body.call(thisArg, _);
|
|
239
|
+
} catch (e) {
|
|
240
|
+
op = [
|
|
241
|
+
6,
|
|
242
|
+
e
|
|
243
|
+
];
|
|
244
|
+
y = 0;
|
|
245
|
+
} finally{
|
|
246
|
+
f = t = 0;
|
|
247
|
+
}
|
|
248
|
+
if (op[0] & 5) throw op[1];
|
|
249
|
+
return {
|
|
250
|
+
value: op[0] ? op[1] : void 0,
|
|
251
|
+
done: true
|
|
252
|
+
};
|
|
253
|
+
}
|
|
146
254
|
}
|
|
147
|
-
import
|
|
148
|
-
import
|
|
149
|
-
import
|
|
150
|
-
import {
|
|
151
|
-
|
|
152
|
-
var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
255
|
+
import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
|
|
256
|
+
import EventLogic from "./EventLogic";
|
|
257
|
+
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
258
|
+
import { toSchema, getModelBindInfoList, checkSchema } from "./utils";
|
|
259
|
+
var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
153
260
|
"use strict";
|
|
154
|
-
_inherits(
|
|
155
|
-
var _super =
|
|
156
|
-
function
|
|
157
|
-
|
|
261
|
+
_inherits(Designer, RegisterControls);
|
|
262
|
+
var _super = _create_super(Designer);
|
|
263
|
+
function Designer() {
|
|
264
|
+
_class_call_check(this, Designer);
|
|
158
265
|
var _this;
|
|
159
|
-
_this = _super.call(this,
|
|
160
|
-
_this
|
|
161
|
-
_this
|
|
162
|
-
_this
|
|
163
|
-
_this
|
|
164
|
-
_this
|
|
165
|
-
(_instanceof(this,
|
|
166
|
-
var
|
|
167
|
-
_this.controlSettingMap.set(
|
|
266
|
+
_this = _super.call(this, "Designer");
|
|
267
|
+
_define_property(_assert_this_initialized(_this), "toolbox", []);
|
|
268
|
+
_define_property(_assert_this_initialized(_this), "services", {});
|
|
269
|
+
_define_property(_assert_this_initialized(_this), "eventLogic", new EventLogic());
|
|
270
|
+
_define_property(_assert_this_initialized(_this), "fieldTypes", FieldTypes);
|
|
271
|
+
_define_property(_assert_this_initialized(_this), "controlSettingMap", new Map());
|
|
272
|
+
(_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
|
|
273
|
+
var _$Designer = control.Designer, Setting = control.Setting;
|
|
274
|
+
_this.controlSettingMap.set(_$Designer.controlType, Setting);
|
|
168
275
|
});
|
|
169
276
|
return _this;
|
|
170
277
|
}
|
|
171
|
-
|
|
278
|
+
_create_class(Designer, [
|
|
172
279
|
{
|
|
173
280
|
key: "registerControl",
|
|
174
281
|
value: function registerControl(control) {
|
|
@@ -215,7 +322,7 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
215
322
|
function getInitControl() {
|
|
216
323
|
// @ts-ignore
|
|
217
324
|
return [
|
|
218
|
-
this.createControlInstance(
|
|
325
|
+
this.createControlInstance("grid")
|
|
219
326
|
];
|
|
220
327
|
}
|
|
221
328
|
},
|
|
@@ -225,17 +332,14 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
225
332
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
226
333
|
args[_key] = arguments[_key];
|
|
227
334
|
}
|
|
228
|
-
return
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
}, _callee);
|
|
238
|
-
}))();
|
|
335
|
+
return _async_to_generator(function() {
|
|
336
|
+
return _ts_generator(this, function(_state) {
|
|
337
|
+
return [
|
|
338
|
+
2,
|
|
339
|
+
checkSchema.apply(void 0, _to_consumable_array(args))
|
|
340
|
+
];
|
|
341
|
+
});
|
|
342
|
+
})();
|
|
239
343
|
}
|
|
240
344
|
},
|
|
241
345
|
{
|
|
@@ -244,7 +348,7 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
244
348
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
245
349
|
args[_key] = arguments[_key];
|
|
246
350
|
}
|
|
247
|
-
return getModelBindInfoList.apply(void 0,
|
|
351
|
+
return getModelBindInfoList.apply(void 0, _to_consumable_array(args));
|
|
248
352
|
}
|
|
249
353
|
},
|
|
250
354
|
{
|
|
@@ -253,7 +357,7 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
253
357
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
254
358
|
args[_key] = arguments[_key];
|
|
255
359
|
}
|
|
256
|
-
return toSchema.apply(void 0,
|
|
360
|
+
return toSchema.apply(void 0, _to_consumable_array(args));
|
|
257
361
|
}
|
|
258
362
|
},
|
|
259
363
|
{
|
|
@@ -263,12 +367,12 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
263
367
|
args[_key] = arguments[_key];
|
|
264
368
|
}
|
|
265
369
|
var _controlHooksEmitter;
|
|
266
|
-
return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter,
|
|
370
|
+
return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _to_consumable_array(args));
|
|
267
371
|
}
|
|
268
372
|
}
|
|
269
373
|
]);
|
|
270
|
-
return
|
|
374
|
+
return Designer;
|
|
271
375
|
}(RegisterControls);
|
|
272
|
-
|
|
273
|
-
export {
|
|
274
|
-
export {
|
|
376
|
+
_define_property(Designer, "EventLogic", EventLogic);
|
|
377
|
+
export { Designer as default };
|
|
378
|
+
export { Designer };
|