@byteluck-fe/model-driven-engine 2.5.0-alpha.9 → 2.5.0-beta.1
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 +63 -98
- package/dist/esm/common/DataManager.js +34 -75
- package/dist/esm/common/Engine.js +931 -1100
- package/dist/esm/common/OkWorker.js +74 -119
- package/dist/esm/common/Runtime.js +21 -38
- package/dist/esm/common/Store.js +141 -152
- package/dist/esm/common/checkerValue.js +241 -316
- package/dist/esm/plugins/CalcPlugin.js +309 -389
- package/dist/esm/plugins/ControlsEventPlugin.js +130 -169
- package/dist/esm/plugins/ES6ModulePlugin.js +31 -65
- package/dist/esm/plugins/LifecycleEventPlugin.js +83 -119
- package/dist/esm/plugins/StylePlugin.js +13 -46
- package/dist/index.umd.js +8 -8
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +180 -180
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +25 -25
- package/dist/types/common/Store.d.ts +50 -49
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
- package/dist/types/plugins/ES6ModulePlugin.d.ts +26 -26
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
- package/dist/types/plugins/StylePlugin.d.ts +12 -12
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +4 -4
|
@@ -40,33 +40,6 @@ 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
|
-
}
|
|
70
43
|
function _iterableToArray(iter) {
|
|
71
44
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
45
|
}
|
|
@@ -184,90 +157,82 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
184
157
|
"use strict";
|
|
185
158
|
function ActionManager() {
|
|
186
159
|
_classCallCheck(this, ActionManager);
|
|
187
|
-
|
|
188
|
-
|
|
160
|
+
this.actionMap = new Map();
|
|
161
|
+
this.buildinActions = {};
|
|
189
162
|
/**
|
|
190
163
|
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
191
|
-
*/
|
|
164
|
+
*/ this.actionUtils = {};
|
|
192
165
|
/**
|
|
193
166
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
194
|
-
*/
|
|
167
|
+
*/ this.sources = {};
|
|
195
168
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
];
|
|
169
|
+
var _proto = ActionManager.prototype;
|
|
170
|
+
_proto.execAction = function execAction(name, context) {
|
|
171
|
+
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
172
|
+
args[_key - 2] = arguments[_key];
|
|
173
|
+
}
|
|
174
|
+
var _this = this;
|
|
175
|
+
return _asyncToGenerator(function() {
|
|
176
|
+
var action, _action_func, result, e;
|
|
177
|
+
return __generator(this, function(_state) {
|
|
178
|
+
switch(_state.label){
|
|
179
|
+
case 0:
|
|
180
|
+
action = _this.actionMap.get(name);
|
|
181
|
+
if (!action) {
|
|
182
|
+
return [
|
|
183
|
+
2
|
|
184
|
+
];
|
|
248
185
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
186
|
+
_state.label = 1;
|
|
187
|
+
case 1:
|
|
188
|
+
_state.trys.push([
|
|
189
|
+
1,
|
|
190
|
+
3,
|
|
191
|
+
,
|
|
192
|
+
4
|
|
193
|
+
]);
|
|
194
|
+
return [
|
|
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
|
+
];
|
|
258
219
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
220
|
+
});
|
|
221
|
+
})();
|
|
222
|
+
};
|
|
223
|
+
_proto.addAction = function addAction(name, func) {
|
|
224
|
+
if (this.actionMap.has(name)) {
|
|
225
|
+
error("duplicated action key");
|
|
262
226
|
}
|
|
263
|
-
|
|
227
|
+
var action = new Action(name, func);
|
|
228
|
+
this.actionMap.set(name, action);
|
|
229
|
+
};
|
|
264
230
|
return ActionManager;
|
|
265
231
|
}();
|
|
266
232
|
var Action = function Action(id, func) {
|
|
267
233
|
"use strict";
|
|
268
234
|
_classCallCheck(this, Action);
|
|
269
|
-
|
|
270
|
-
_defineProperty(this, "id", "");
|
|
235
|
+
this.id = "";
|
|
271
236
|
this.id = id;
|
|
272
237
|
this.func = func;
|
|
273
238
|
};
|
|
@@ -32,33 +32,6 @@ 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
|
-
}
|
|
62
35
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
63
36
|
var f, y, t, g, _ = {
|
|
64
37
|
label: 0,
|
|
@@ -159,55 +132,41 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
159
132
|
"use strict";
|
|
160
133
|
function DataManager(callbackExecuter) {
|
|
161
134
|
_classCallCheck(this, DataManager);
|
|
162
|
-
|
|
163
|
-
_defineProperty(this, "executer", void 0);
|
|
135
|
+
this._dataStore = new Map();
|
|
164
136
|
this.executer = callbackExecuter;
|
|
165
137
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return [
|
|
200
|
-
2,
|
|
201
|
-
_this.executer(payload)
|
|
202
|
-
];
|
|
203
|
-
}
|
|
204
|
-
return [
|
|
205
|
-
2
|
|
206
|
-
];
|
|
207
|
-
});
|
|
208
|
-
})();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
]);
|
|
138
|
+
var _proto = DataManager.prototype;
|
|
139
|
+
_proto.add = function add(key, data) {
|
|
140
|
+
this._dataStore.set(key, data);
|
|
141
|
+
};
|
|
142
|
+
_proto.get = function get(key) {
|
|
143
|
+
var result = this._dataStore.get(key);
|
|
144
|
+
return JSONCopy(result);
|
|
145
|
+
};
|
|
146
|
+
_proto.remove = function remove(key) {
|
|
147
|
+
this._dataStore.delete(key);
|
|
148
|
+
};
|
|
149
|
+
_proto.getRemoteData = function getRemoteData(payload) {
|
|
150
|
+
var _this = this;
|
|
151
|
+
return _asyncToGenerator(function() {
|
|
152
|
+
return __generator(this, function(_state) {
|
|
153
|
+
if (_this.executer === undefined) {
|
|
154
|
+
logerror("未初始化executer");
|
|
155
|
+
return [
|
|
156
|
+
2,
|
|
157
|
+
[]
|
|
158
|
+
];
|
|
159
|
+
} else {
|
|
160
|
+
return [
|
|
161
|
+
2,
|
|
162
|
+
_this.executer(payload)
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
return [
|
|
166
|
+
2
|
|
167
|
+
];
|
|
168
|
+
});
|
|
169
|
+
})();
|
|
170
|
+
};
|
|
212
171
|
return DataManager;
|
|
213
172
|
}();
|