@byteluck-fe/model-driven-engine 2.7.0-alpha.2 → 2.7.0-alpha.3
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 +98 -63
- package/dist/esm/common/DataManager.js +75 -34
- package/dist/esm/common/Engine.js +1106 -928
- package/dist/esm/common/OkWorker.js +119 -74
- package/dist/esm/common/Runtime.js +38 -21
- package/dist/esm/common/Store.js +149 -116
- package/dist/esm/common/checkerValue.js +316 -241
- package/dist/esm/plugins/CalcPlugin.js +393 -309
- package/dist/esm/plugins/ControlsEventPlugin.js +169 -130
- package/dist/esm/plugins/ES6ModulePlugin.js +65 -31
- package/dist/esm/plugins/LifecycleEventPlugin.js +119 -83
- package/dist/esm/plugins/StylePlugin.js +46 -13
- package/dist/index.umd.js +9 -9
- package/package.json +3 -3
|
@@ -40,6 +40,33 @@ function _classCallCheck(instance, Constructor) {
|
|
|
40
40
|
throw new TypeError("Cannot call a class as a function");
|
|
41
41
|
}
|
|
42
42
|
}
|
|
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 _createClass(Constructor, protoProps, staticProps) {
|
|
53
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
+
return Constructor;
|
|
56
|
+
}
|
|
57
|
+
function _defineProperty(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
|
+
}
|
|
43
70
|
function _iterableToArray(iter) {
|
|
44
71
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
45
72
|
}
|
|
@@ -157,82 +184,90 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
157
184
|
"use strict";
|
|
158
185
|
function ActionManager() {
|
|
159
186
|
_classCallCheck(this, ActionManager);
|
|
160
|
-
this
|
|
161
|
-
this
|
|
187
|
+
_defineProperty(this, "actionMap", new Map());
|
|
188
|
+
_defineProperty(this, "buildinActions", {});
|
|
162
189
|
/**
|
|
163
190
|
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
164
|
-
*/ this
|
|
191
|
+
*/ _defineProperty(this, "actionUtils", {});
|
|
165
192
|
/**
|
|
166
193
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
167
|
-
*/ this
|
|
194
|
+
*/ _defineProperty(this, "sources", {});
|
|
168
195
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
_createClass(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 _asyncToGenerator(function() {
|
|
205
|
+
var action, _action_func, result, e;
|
|
206
|
+
return __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(_toConsumableArray(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
268
|
_classCallCheck(this, Action);
|
|
235
|
-
this
|
|
269
|
+
_defineProperty(this, "func", void 0);
|
|
270
|
+
_defineProperty(this, "id", "");
|
|
236
271
|
this.id = id;
|
|
237
272
|
this.func = func;
|
|
238
273
|
};
|
|
@@ -32,6 +32,33 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
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 _createClass(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _defineProperty(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
|
+
}
|
|
35
62
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
36
63
|
var f, y, t, g, _ = {
|
|
37
64
|
label: 0,
|
|
@@ -132,41 +159,55 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
132
159
|
"use strict";
|
|
133
160
|
function DataManager(callbackExecuter) {
|
|
134
161
|
_classCallCheck(this, DataManager);
|
|
135
|
-
this
|
|
162
|
+
_defineProperty(this, "_dataStore", new Map());
|
|
163
|
+
_defineProperty(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
|
+
_createClass(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 _asyncToGenerator(function() {
|
|
191
|
+
return __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
|
}();
|