@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,10 +1,10 @@
|
|
|
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
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
10
|
try {
|
|
@@ -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,29 +35,56 @@ 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(iter) {
|
|
44
71
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
45
72
|
}
|
|
46
|
-
function
|
|
73
|
+
function _non_iterable_spread() {
|
|
47
74
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
75
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
76
|
+
function _to_consumable_array(arr) {
|
|
77
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
51
78
|
}
|
|
52
|
-
function
|
|
79
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
53
80
|
if (!o) return;
|
|
54
|
-
if (typeof o === "string") return
|
|
81
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
55
82
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
56
83
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
57
84
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
58
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
85
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
59
86
|
}
|
|
60
|
-
|
|
87
|
+
function _ts_generator(thisArg, body) {
|
|
61
88
|
var f, y, t, g, _ = {
|
|
62
89
|
label: 0,
|
|
63
90
|
sent: function() {
|
|
@@ -151,88 +178,96 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
151
178
|
done: true
|
|
152
179
|
};
|
|
153
180
|
}
|
|
154
|
-
}
|
|
181
|
+
}
|
|
155
182
|
import { error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
156
183
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
157
184
|
"use strict";
|
|
158
185
|
function ActionManager() {
|
|
159
|
-
|
|
160
|
-
this
|
|
161
|
-
this
|
|
186
|
+
_class_call_check(this, ActionManager);
|
|
187
|
+
_define_property(this, "actionMap", new Map());
|
|
188
|
+
_define_property(this, "buildinActions", {});
|
|
162
189
|
/**
|
|
163
190
|
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
164
|
-
*/ this
|
|
191
|
+
*/ _define_property(this, "actionUtils", {});
|
|
165
192
|
/**
|
|
166
193
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
167
|
-
*/ this
|
|
194
|
+
*/ _define_property(this, "sources", {});
|
|
168
195
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
_create_class(ActionManager, [
|
|
197
|
+
{
|
|
198
|
+
key: "execAction",
|
|
199
|
+
value: function execAction(name, context) {
|
|
200
|
+
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
201
|
+
args[_key - 2] = arguments[_key];
|
|
202
|
+
}
|
|
203
|
+
var _this = this;
|
|
204
|
+
return _async_to_generator(function() {
|
|
205
|
+
var action, _action_func, result, e;
|
|
206
|
+
return _ts_generator(this, function(_state) {
|
|
207
|
+
switch(_state.label){
|
|
208
|
+
case 0:
|
|
209
|
+
action = _this.actionMap.get(name);
|
|
210
|
+
if (!action) {
|
|
211
|
+
return [
|
|
212
|
+
2
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
_state.label = 1;
|
|
216
|
+
case 1:
|
|
217
|
+
_state.trys.push([
|
|
218
|
+
1,
|
|
219
|
+
3,
|
|
220
|
+
,
|
|
221
|
+
4
|
|
222
|
+
]);
|
|
223
|
+
return [
|
|
224
|
+
4,
|
|
225
|
+
(_action_func = action.func).call.apply(_action_func, [
|
|
226
|
+
null,
|
|
227
|
+
context
|
|
228
|
+
].concat(_to_consumable_array(args)))
|
|
229
|
+
];
|
|
230
|
+
case 2:
|
|
231
|
+
result = _state.sent();
|
|
232
|
+
return [
|
|
233
|
+
2,
|
|
234
|
+
result
|
|
235
|
+
];
|
|
236
|
+
case 3:
|
|
237
|
+
e = _state.sent();
|
|
238
|
+
// 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
|
|
239
|
+
logerror("".concat(action.id, " Exception during calling action: ").concat(e));
|
|
240
|
+
return [
|
|
241
|
+
3,
|
|
242
|
+
4
|
|
243
|
+
];
|
|
244
|
+
case 4:
|
|
245
|
+
return [
|
|
246
|
+
2
|
|
247
|
+
];
|
|
185
248
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
4,
|
|
196
|
-
(_action_func = action.func).call.apply(_action_func, [
|
|
197
|
-
null,
|
|
198
|
-
context
|
|
199
|
-
].concat(_toConsumableArray(args)))
|
|
200
|
-
];
|
|
201
|
-
case 2:
|
|
202
|
-
result = _state.sent();
|
|
203
|
-
return [
|
|
204
|
-
2,
|
|
205
|
-
result
|
|
206
|
-
];
|
|
207
|
-
case 3:
|
|
208
|
-
e = _state.sent();
|
|
209
|
-
// 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
|
|
210
|
-
logerror("".concat(action.id, " Exception during calling action: ").concat(e));
|
|
211
|
-
return [
|
|
212
|
-
3,
|
|
213
|
-
4
|
|
214
|
-
];
|
|
215
|
-
case 4:
|
|
216
|
-
return [
|
|
217
|
-
2
|
|
218
|
-
];
|
|
249
|
+
});
|
|
250
|
+
})();
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
key: "addAction",
|
|
255
|
+
value: function addAction(name, func) {
|
|
256
|
+
if (this.actionMap.has(name)) {
|
|
257
|
+
error("duplicated action key");
|
|
219
258
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
_proto.addAction = function addAction(name, func) {
|
|
224
|
-
if (this.actionMap.has(name)) {
|
|
225
|
-
error("duplicated action key");
|
|
259
|
+
var action = new Action(name, func);
|
|
260
|
+
this.actionMap.set(name, action);
|
|
261
|
+
}
|
|
226
262
|
}
|
|
227
|
-
|
|
228
|
-
this.actionMap.set(name, action);
|
|
229
|
-
};
|
|
263
|
+
]);
|
|
230
264
|
return ActionManager;
|
|
231
265
|
}();
|
|
232
266
|
var Action = function Action(id, func) {
|
|
233
267
|
"use strict";
|
|
234
|
-
|
|
235
|
-
this
|
|
268
|
+
_class_call_check(this, Action);
|
|
269
|
+
_define_property(this, "func", void 0);
|
|
270
|
+
_define_property(this, "id", "");
|
|
236
271
|
this.id = id;
|
|
237
272
|
this.func = func;
|
|
238
273
|
};
|
|
@@ -12,7 +12,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
12
12
|
Promise.resolve(value).then(_next, _throw);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
16
|
return function() {
|
|
17
17
|
var self = this, args = arguments;
|
|
18
18
|
return new Promise(function(resolve, reject) {
|
|
@@ -27,12 +27,39 @@ function _asyncToGenerator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
31
|
if (!(instance instanceof Constructor)) {
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
36
63
|
var f, y, t, g, _ = {
|
|
37
64
|
label: 0,
|
|
38
65
|
sent: function() {
|
|
@@ -126,47 +153,61 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
126
153
|
done: true
|
|
127
154
|
};
|
|
128
155
|
}
|
|
129
|
-
}
|
|
156
|
+
}
|
|
130
157
|
import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
|
|
131
158
|
export var DataManager = /*#__PURE__*/ function() {
|
|
132
159
|
"use strict";
|
|
133
160
|
function DataManager(callbackExecuter) {
|
|
134
|
-
|
|
135
|
-
this
|
|
161
|
+
_class_call_check(this, DataManager);
|
|
162
|
+
_define_property(this, "_dataStore", new Map());
|
|
163
|
+
_define_property(this, "executer", void 0);
|
|
136
164
|
this.executer = callbackExecuter;
|
|
137
165
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
_create_class(DataManager, [
|
|
167
|
+
{
|
|
168
|
+
key: "add",
|
|
169
|
+
value: function add(key, data) {
|
|
170
|
+
this._dataStore.set(key, data);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: "get",
|
|
175
|
+
value: function get(key) {
|
|
176
|
+
var result = this._dataStore.get(key);
|
|
177
|
+
return JSONCopy(result);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: "remove",
|
|
182
|
+
value: function remove(key) {
|
|
183
|
+
this._dataStore.delete(key);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: "getRemoteData",
|
|
188
|
+
value: function getRemoteData(payload) {
|
|
189
|
+
var _this = this;
|
|
190
|
+
return _async_to_generator(function() {
|
|
191
|
+
return _ts_generator(this, function(_state) {
|
|
192
|
+
if (_this.executer === undefined) {
|
|
193
|
+
logerror("未初始化executer");
|
|
194
|
+
return [
|
|
195
|
+
2,
|
|
196
|
+
[]
|
|
197
|
+
];
|
|
198
|
+
} else {
|
|
199
|
+
return [
|
|
200
|
+
2,
|
|
201
|
+
_this.executer(payload)
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
return [
|
|
205
|
+
2
|
|
206
|
+
];
|
|
207
|
+
});
|
|
208
|
+
})();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]);
|
|
171
212
|
return DataManager;
|
|
172
213
|
}();
|