@byteluck-fe/model-driven-engine 2.7.0-alpha.2 → 2.7.0-alpha.21
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/common/ActionManager.js +114 -79
- package/dist/esm/common/DataManager.js +80 -39
- package/dist/esm/common/Engine.js +1205 -985
- package/dist/esm/common/OkWorker.js +121 -76
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +66 -45
- package/dist/esm/common/Store.js +168 -137
- package/dist/esm/common/checkerValue.js +383 -299
- package/dist/esm/common/proxyState.js +18 -17
- package/dist/esm/plugins/CalcPlugin.js +406 -321
- package/dist/esm/plugins/ControlsEventPlugin.js +174 -135
- package/dist/esm/plugins/ES6ModulePlugin.js +77 -43
- package/dist/esm/plugins/LifecycleEventPlugin.js +134 -98
- package/dist/esm/plugins/StylePlugin.js +48 -15
- package/dist/esm/utils/runtimeUtils.js +6 -3
- package/dist/index.umd.js +11 -11
- package/dist/types/common/Engine.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
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
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -20,7 +20,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
20
20
|
Promise.resolve(value).then(_next, _throw);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _async_to_generator(fn) {
|
|
24
24
|
return function() {
|
|
25
25
|
var self = this, args = arguments;
|
|
26
26
|
return new Promise(function(resolve, reject) {
|
|
@@ -35,12 +35,39 @@ function _asyncToGenerator(fn) {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function _class_call_check(instance, Constructor) {
|
|
39
39
|
if (!(instance instanceof Constructor)) {
|
|
40
40
|
throw new TypeError("Cannot call a class as a function");
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function _defineProperties(target, props) {
|
|
44
|
+
for(var i = 0; i < props.length; i++){
|
|
45
|
+
var descriptor = props[i];
|
|
46
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
47
|
+
descriptor.configurable = true;
|
|
48
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
49
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
53
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
+
return Constructor;
|
|
56
|
+
}
|
|
57
|
+
function _define_property(obj, key, value) {
|
|
58
|
+
if (key in obj) {
|
|
59
|
+
Object.defineProperty(obj, key, {
|
|
60
|
+
value: value,
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
obj[key] = value;
|
|
67
|
+
}
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
function _iterable_to_array_limit(arr, i) {
|
|
44
71
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
72
|
if (_i == null) return;
|
|
46
73
|
var _arr = [];
|
|
@@ -64,21 +91,21 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
64
91
|
}
|
|
65
92
|
return _arr;
|
|
66
93
|
}
|
|
67
|
-
function
|
|
94
|
+
function _non_iterable_rest() {
|
|
68
95
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
69
96
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
97
|
+
function _sliced_to_array(arr, i) {
|
|
98
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
72
99
|
}
|
|
73
|
-
function
|
|
100
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
74
101
|
if (!o) return;
|
|
75
|
-
if (typeof o === "string") return
|
|
102
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
76
103
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
77
104
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
78
105
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
79
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
106
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
80
107
|
}
|
|
81
|
-
|
|
108
|
+
function _ts_generator(thisArg, body) {
|
|
82
109
|
var f, y, t, g, _ = {
|
|
83
110
|
label: 0,
|
|
84
111
|
sent: function() {
|
|
@@ -172,7 +199,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
172
199
|
done: true
|
|
173
200
|
};
|
|
174
201
|
}
|
|
175
|
-
}
|
|
202
|
+
}
|
|
176
203
|
var LifecycleEventKeyMap = {
|
|
177
204
|
"engine-mounted": "did_mount",
|
|
178
205
|
"engine-submit": "will_submit",
|
|
@@ -182,103 +209,112 @@ var LifecycleEventKeyMap = {
|
|
|
182
209
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
183
210
|
"use strict";
|
|
184
211
|
function LifecycleEventPlugin(config) {
|
|
185
|
-
|
|
212
|
+
_class_call_check(this, LifecycleEventPlugin);
|
|
213
|
+
_define_property(this, "config", void 0);
|
|
214
|
+
_define_property(this, "engine", void 0);
|
|
186
215
|
this.config = config;
|
|
187
216
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
217
|
+
_create_class(LifecycleEventPlugin, [
|
|
218
|
+
{
|
|
219
|
+
key: "apply",
|
|
220
|
+
value: function apply(engine) {
|
|
221
|
+
var _this = this;
|
|
222
|
+
this.engine = engine;
|
|
223
|
+
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
224
|
+
var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
225
|
+
var _this1 = _this;
|
|
226
|
+
engine.on(engineKey, function() {
|
|
227
|
+
var _ref = _async_to_generator(function(payload) {
|
|
228
|
+
var result;
|
|
229
|
+
return _ts_generator(this, function(_state) {
|
|
230
|
+
switch(_state.label){
|
|
231
|
+
case 0:
|
|
232
|
+
return [
|
|
233
|
+
4,
|
|
234
|
+
_this1.callLifecycleEvent(lifecycleKey, payload)
|
|
235
|
+
];
|
|
236
|
+
case 1:
|
|
237
|
+
result = _state.sent();
|
|
238
|
+
if (result.includes(false)) {
|
|
239
|
+
return [
|
|
240
|
+
2,
|
|
241
|
+
false
|
|
242
|
+
];
|
|
243
|
+
} else {
|
|
244
|
+
return [
|
|
245
|
+
2,
|
|
246
|
+
result
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
return [
|
|
250
|
+
2
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
return function(payload) {
|
|
256
|
+
return _ref.apply(this, arguments);
|
|
257
|
+
};
|
|
258
|
+
}());
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: "callLifecycleEvent",
|
|
264
|
+
value: function callLifecycleEvent(name, payload) {
|
|
265
|
+
var _this = this;
|
|
266
|
+
return _async_to_generator(function() {
|
|
267
|
+
var events, result;
|
|
268
|
+
return _ts_generator(this, function(_state) {
|
|
199
269
|
switch(_state.label){
|
|
200
270
|
case 0:
|
|
271
|
+
events = _this.config;
|
|
272
|
+
if (!events || !Array.isArray(events[name])) {
|
|
273
|
+
return [
|
|
274
|
+
2,
|
|
275
|
+
[]
|
|
276
|
+
];
|
|
277
|
+
}
|
|
201
278
|
return [
|
|
202
279
|
4,
|
|
203
|
-
|
|
280
|
+
Promise.all(events[name].map(function() {
|
|
281
|
+
var _ref = _async_to_generator(function(eventName) {
|
|
282
|
+
var execResult;
|
|
283
|
+
return _ts_generator(this, function(_state) {
|
|
284
|
+
switch(_state.label){
|
|
285
|
+
case 0:
|
|
286
|
+
return [
|
|
287
|
+
4,
|
|
288
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
289
|
+
// this.engine,
|
|
290
|
+
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
291
|
+
payload)
|
|
292
|
+
];
|
|
293
|
+
case 1:
|
|
294
|
+
execResult = _state.sent();
|
|
295
|
+
return [
|
|
296
|
+
2,
|
|
297
|
+
execResult
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
return function(eventName) {
|
|
303
|
+
return _ref.apply(this, arguments);
|
|
304
|
+
};
|
|
305
|
+
}()))
|
|
204
306
|
];
|
|
205
307
|
case 1:
|
|
206
308
|
result = _state.sent();
|
|
207
|
-
if (result.includes(false)) {
|
|
208
|
-
return [
|
|
209
|
-
2,
|
|
210
|
-
false
|
|
211
|
-
];
|
|
212
|
-
} else {
|
|
213
|
-
return [
|
|
214
|
-
2,
|
|
215
|
-
result
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
309
|
return [
|
|
219
|
-
2
|
|
310
|
+
2,
|
|
311
|
+
result
|
|
220
312
|
];
|
|
221
313
|
}
|
|
222
314
|
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}());
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
_proto.callLifecycleEvent = function callLifecycleEvent(name, payload) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
return _asyncToGenerator(function() {
|
|
233
|
-
var events, result;
|
|
234
|
-
return __generator(this, function(_state) {
|
|
235
|
-
switch(_state.label){
|
|
236
|
-
case 0:
|
|
237
|
-
events = _this.config;
|
|
238
|
-
if (!events || !Array.isArray(events[name])) {
|
|
239
|
-
return [
|
|
240
|
-
2,
|
|
241
|
-
[]
|
|
242
|
-
];
|
|
243
|
-
}
|
|
244
|
-
return [
|
|
245
|
-
4,
|
|
246
|
-
Promise.all(events[name].map(function() {
|
|
247
|
-
var _ref = _asyncToGenerator(function(eventName) {
|
|
248
|
-
var execResult;
|
|
249
|
-
return __generator(this, function(_state) {
|
|
250
|
-
switch(_state.label){
|
|
251
|
-
case 0:
|
|
252
|
-
return [
|
|
253
|
-
4,
|
|
254
|
-
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
255
|
-
// this.engine,
|
|
256
|
-
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
257
|
-
payload)
|
|
258
|
-
];
|
|
259
|
-
case 1:
|
|
260
|
-
execResult = _state.sent();
|
|
261
|
-
return [
|
|
262
|
-
2,
|
|
263
|
-
execResult
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
return function(eventName) {
|
|
269
|
-
return _ref.apply(this, arguments);
|
|
270
|
-
};
|
|
271
|
-
}()))
|
|
272
|
-
];
|
|
273
|
-
case 1:
|
|
274
|
-
result = _state.sent();
|
|
275
|
-
return [
|
|
276
|
-
2,
|
|
277
|
-
result
|
|
278
|
-
];
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
})();
|
|
282
|
-
};
|
|
315
|
+
})();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]);
|
|
283
319
|
return LifecycleEventPlugin;
|
|
284
320
|
}();
|
|
@@ -1,26 +1,59 @@
|
|
|
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
|
}
|
|
5
5
|
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
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
|
+
}
|
|
6
33
|
export var StylePlugin = /*#__PURE__*/ function() {
|
|
7
34
|
"use strict";
|
|
8
35
|
function StylePlugin(config) {
|
|
9
|
-
|
|
36
|
+
_class_call_check(this, StylePlugin);
|
|
37
|
+
_define_property(this, "config", void 0);
|
|
38
|
+
_define_property(this, "engine", void 0);
|
|
10
39
|
this.config = config;
|
|
11
40
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
_create_class(StylePlugin, [
|
|
42
|
+
{
|
|
43
|
+
key: "apply",
|
|
44
|
+
value: function apply(engine) {
|
|
45
|
+
var _this_config;
|
|
46
|
+
this.engine = engine;
|
|
47
|
+
var _this_config_source;
|
|
48
|
+
var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : "";
|
|
49
|
+
var style = document.createElement("style");
|
|
50
|
+
style.className = "edit-css";
|
|
51
|
+
style.type = "text/css";
|
|
52
|
+
style.innerHTML = compiledStyle;
|
|
53
|
+
var dom = document.querySelector("head");
|
|
54
|
+
dom.appendChild(style);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]);
|
|
25
58
|
return StylePlugin;
|
|
26
59
|
}();
|
|
@@ -8,10 +8,12 @@ export function loopFormControl(control, callback) {
|
|
|
8
8
|
//TODO 此处需要再抽象一层 datagrid/datalist
|
|
9
9
|
if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
10
10
|
// @ts-ignore
|
|
11
|
-
var children = item.getChildrenFormControl()
|
|
11
|
+
var children = []//item.getChildrenFormControl() as RuntimeFormControl[]
|
|
12
|
+
;
|
|
12
13
|
callback(item, children);
|
|
13
14
|
} else if (hasChildrenControl(item)) {
|
|
14
|
-
|
|
15
|
+
var _item;
|
|
16
|
+
loopFormControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
15
17
|
// @ts-ignore
|
|
16
18
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
17
19
|
callback(item);
|
|
@@ -26,8 +28,9 @@ callback) {
|
|
|
26
28
|
if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
|
|
27
29
|
callback(item);
|
|
28
30
|
} else if (hasChildrenControl(item)) {
|
|
31
|
+
var _item;
|
|
29
32
|
// @ts-ignore
|
|
30
|
-
loopDataViewControl(item === null ||
|
|
33
|
+
loopDataViewControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
31
34
|
}
|
|
32
35
|
});
|
|
33
36
|
}
|