@byteluck-fe/model-driven-engine 2.7.0-alpha.15 → 2.7.0-alpha.15b
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 +40 -157
- package/dist/esm/common/DataManager.js +20 -129
- package/dist/esm/common/Engine.js +324 -412
- package/dist/esm/common/OkWorker.js +13 -27
- package/dist/esm/common/Runtime.js +78 -54
- package/dist/esm/common/Store.js +50 -51
- package/dist/esm/common/checkerValue.js +39 -39
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +59 -67
- package/dist/esm/plugins/ControlsEventPlugin.js +68 -191
- package/dist/esm/plugins/ES6ModulePlugin.js +8 -24
- package/dist/esm/plugins/LifecycleEventPlugin.js +64 -183
- package/dist/esm/plugins/StylePlugin.js +7 -22
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -5
- package/dist/index.umd.js +10 -10
- package/dist/types/common/Engine.d.ts +10 -9
- package/dist/types/common/Runtime.d.ts +2 -1
- package/dist/types/common/Store.d.ts +5 -5
- package/dist/types/common/proxyState.d.ts +3 -3
- package/dist/types/plugins/ControlsEventPlugin.d.ts +1 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +4 -4
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +1 -1
- package/dist/types/plugins/StylePlugin.d.ts +1 -1
- package/package.json +4 -4
|
@@ -54,19 +54,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
54
54
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
55
|
return Constructor;
|
|
56
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
57
|
function _iterableToArray(iter) {
|
|
71
58
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
59
|
}
|
|
@@ -84,114 +71,20 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
84
71
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
85
72
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
86
73
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
label: 0,
|
|
90
|
-
sent: function() {
|
|
91
|
-
if (t[0] & 1) throw t[1];
|
|
92
|
-
return t[1];
|
|
93
|
-
},
|
|
94
|
-
trys: [],
|
|
95
|
-
ops: []
|
|
96
|
-
};
|
|
97
|
-
return g = {
|
|
98
|
-
next: verb(0),
|
|
99
|
-
"throw": verb(1),
|
|
100
|
-
"return": verb(2)
|
|
101
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
|
-
return this;
|
|
103
|
-
}), g;
|
|
104
|
-
function verb(n) {
|
|
105
|
-
return function(v) {
|
|
106
|
-
return step([
|
|
107
|
-
n,
|
|
108
|
-
v
|
|
109
|
-
]);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function step(op) {
|
|
113
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
-
while(_)try {
|
|
115
|
-
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;
|
|
116
|
-
if (y = 0, t) op = [
|
|
117
|
-
op[0] & 2,
|
|
118
|
-
t.value
|
|
119
|
-
];
|
|
120
|
-
switch(op[0]){
|
|
121
|
-
case 0:
|
|
122
|
-
case 1:
|
|
123
|
-
t = op;
|
|
124
|
-
break;
|
|
125
|
-
case 4:
|
|
126
|
-
_.label++;
|
|
127
|
-
return {
|
|
128
|
-
value: op[1],
|
|
129
|
-
done: false
|
|
130
|
-
};
|
|
131
|
-
case 5:
|
|
132
|
-
_.label++;
|
|
133
|
-
y = op[1];
|
|
134
|
-
op = [
|
|
135
|
-
0
|
|
136
|
-
];
|
|
137
|
-
continue;
|
|
138
|
-
case 7:
|
|
139
|
-
op = _.ops.pop();
|
|
140
|
-
_.trys.pop();
|
|
141
|
-
continue;
|
|
142
|
-
default:
|
|
143
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
144
|
-
_ = 0;
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
148
|
-
_.label = op[1];
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
-
_.label = t[1];
|
|
153
|
-
t = op;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
if (t && _.label < t[2]) {
|
|
157
|
-
_.label = t[2];
|
|
158
|
-
_.ops.push(op);
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (t[2]) _.ops.pop();
|
|
162
|
-
_.trys.pop();
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
op = body.call(thisArg, _);
|
|
166
|
-
} catch (e) {
|
|
167
|
-
op = [
|
|
168
|
-
6,
|
|
169
|
-
e
|
|
170
|
-
];
|
|
171
|
-
y = 0;
|
|
172
|
-
} finally{
|
|
173
|
-
f = t = 0;
|
|
174
|
-
}
|
|
175
|
-
if (op[0] & 5) throw op[1];
|
|
176
|
-
return {
|
|
177
|
-
value: op[0] ? op[1] : void 0,
|
|
178
|
-
done: true
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
import { error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
74
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
75
|
+
import { error, logerror } from '@byteluck-fe/model-driven-shared';
|
|
183
76
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
184
77
|
"use strict";
|
|
185
78
|
function ActionManager() {
|
|
186
79
|
_classCallCheck(this, ActionManager);
|
|
187
|
-
|
|
188
|
-
|
|
80
|
+
this.actionMap = new Map();
|
|
81
|
+
this.buildinActions = {};
|
|
189
82
|
/**
|
|
190
83
|
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
191
|
-
*/
|
|
84
|
+
*/ this.actionUtils = {};
|
|
192
85
|
/**
|
|
193
86
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
194
|
-
*/
|
|
87
|
+
*/ this.sources = {};
|
|
195
88
|
}
|
|
196
89
|
_createClass(ActionManager, [
|
|
197
90
|
{
|
|
@@ -201,60 +94,51 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
201
94
|
args[_key - 2] = arguments[_key];
|
|
202
95
|
}
|
|
203
96
|
var _this = this;
|
|
204
|
-
return _asyncToGenerator(function() {
|
|
205
|
-
var action,
|
|
206
|
-
return
|
|
207
|
-
switch(
|
|
97
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
98
|
+
var action, _func, result;
|
|
99
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
100
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
208
101
|
case 0:
|
|
209
102
|
action = _this.actionMap.get(name);
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
];
|
|
103
|
+
if (action) {
|
|
104
|
+
_ctx.next = 3;
|
|
105
|
+
break;
|
|
214
106
|
}
|
|
215
|
-
|
|
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
|
-
];
|
|
107
|
+
return _ctx.abrupt("return");
|
|
236
108
|
case 3:
|
|
237
|
-
|
|
109
|
+
_ctx.prev = 3;
|
|
110
|
+
;
|
|
111
|
+
_ctx.next = 7;
|
|
112
|
+
return (_func = action.func).call.apply(_func, [
|
|
113
|
+
null,
|
|
114
|
+
context
|
|
115
|
+
].concat(_toConsumableArray(args)));
|
|
116
|
+
case 7:
|
|
117
|
+
result = _ctx.sent;
|
|
118
|
+
return _ctx.abrupt("return", result);
|
|
119
|
+
case 11:
|
|
120
|
+
_ctx.prev = 11;
|
|
121
|
+
_ctx.t0 = _ctx["catch"](3);
|
|
238
122
|
// 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
|
|
239
|
-
logerror("".concat(action.id, " Exception during calling action: ").concat(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
];
|
|
244
|
-
case 4:
|
|
245
|
-
return [
|
|
246
|
-
2
|
|
247
|
-
];
|
|
123
|
+
logerror("".concat(action.id, " Exception during calling action: ").concat(_ctx.t0));
|
|
124
|
+
case 14:
|
|
125
|
+
case "end":
|
|
126
|
+
return _ctx.stop();
|
|
248
127
|
}
|
|
249
|
-
}
|
|
250
|
-
|
|
128
|
+
}, _callee, null, [
|
|
129
|
+
[
|
|
130
|
+
3,
|
|
131
|
+
11
|
|
132
|
+
]
|
|
133
|
+
]);
|
|
134
|
+
}))();
|
|
251
135
|
}
|
|
252
136
|
},
|
|
253
137
|
{
|
|
254
138
|
key: "addAction",
|
|
255
139
|
value: function addAction(name, func) {
|
|
256
140
|
if (this.actionMap.has(name)) {
|
|
257
|
-
error(
|
|
141
|
+
error('duplicated action key');
|
|
258
142
|
}
|
|
259
143
|
var action = new Action(name, func);
|
|
260
144
|
this.actionMap.set(name, action);
|
|
@@ -266,8 +150,7 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
266
150
|
var Action = function Action(id, func) {
|
|
267
151
|
"use strict";
|
|
268
152
|
_classCallCheck(this, Action);
|
|
269
|
-
|
|
270
|
-
_defineProperty(this, "id", "");
|
|
153
|
+
this.id = '';
|
|
271
154
|
this.id = id;
|
|
272
155
|
this.func = func;
|
|
273
156
|
};
|
|
@@ -46,121 +46,13 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
46
46
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
47
|
return Constructor;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
var __generator = this && this.__generator || function(thisArg, body) {
|
|
63
|
-
var f, y, t, g, _ = {
|
|
64
|
-
label: 0,
|
|
65
|
-
sent: function() {
|
|
66
|
-
if (t[0] & 1) throw t[1];
|
|
67
|
-
return t[1];
|
|
68
|
-
},
|
|
69
|
-
trys: [],
|
|
70
|
-
ops: []
|
|
71
|
-
};
|
|
72
|
-
return g = {
|
|
73
|
-
next: verb(0),
|
|
74
|
-
"throw": verb(1),
|
|
75
|
-
"return": verb(2)
|
|
76
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
|
-
return this;
|
|
78
|
-
}), g;
|
|
79
|
-
function verb(n) {
|
|
80
|
-
return function(v) {
|
|
81
|
-
return step([
|
|
82
|
-
n,
|
|
83
|
-
v
|
|
84
|
-
]);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function step(op) {
|
|
88
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
90
|
-
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;
|
|
91
|
-
if (y = 0, t) op = [
|
|
92
|
-
op[0] & 2,
|
|
93
|
-
t.value
|
|
94
|
-
];
|
|
95
|
-
switch(op[0]){
|
|
96
|
-
case 0:
|
|
97
|
-
case 1:
|
|
98
|
-
t = op;
|
|
99
|
-
break;
|
|
100
|
-
case 4:
|
|
101
|
-
_.label++;
|
|
102
|
-
return {
|
|
103
|
-
value: op[1],
|
|
104
|
-
done: false
|
|
105
|
-
};
|
|
106
|
-
case 5:
|
|
107
|
-
_.label++;
|
|
108
|
-
y = op[1];
|
|
109
|
-
op = [
|
|
110
|
-
0
|
|
111
|
-
];
|
|
112
|
-
continue;
|
|
113
|
-
case 7:
|
|
114
|
-
op = _.ops.pop();
|
|
115
|
-
_.trys.pop();
|
|
116
|
-
continue;
|
|
117
|
-
default:
|
|
118
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
119
|
-
_ = 0;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
123
|
-
_.label = op[1];
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
127
|
-
_.label = t[1];
|
|
128
|
-
t = op;
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
if (t && _.label < t[2]) {
|
|
132
|
-
_.label = t[2];
|
|
133
|
-
_.ops.push(op);
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
if (t[2]) _.ops.pop();
|
|
137
|
-
_.trys.pop();
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
op = body.call(thisArg, _);
|
|
141
|
-
} catch (e) {
|
|
142
|
-
op = [
|
|
143
|
-
6,
|
|
144
|
-
e
|
|
145
|
-
];
|
|
146
|
-
y = 0;
|
|
147
|
-
} finally{
|
|
148
|
-
f = t = 0;
|
|
149
|
-
}
|
|
150
|
-
if (op[0] & 5) throw op[1];
|
|
151
|
-
return {
|
|
152
|
-
value: op[0] ? op[1] : void 0,
|
|
153
|
-
done: true
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
|
|
49
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
50
|
+
import { JSONCopy, logerror } from '@byteluck-fe/model-driven-shared';
|
|
158
51
|
export var DataManager = /*#__PURE__*/ function() {
|
|
159
52
|
"use strict";
|
|
160
53
|
function DataManager(callbackExecuter) {
|
|
161
54
|
_classCallCheck(this, DataManager);
|
|
162
|
-
|
|
163
|
-
_defineProperty(this, "executer", void 0);
|
|
55
|
+
this._dataStore = new Map();
|
|
164
56
|
this.executer = callbackExecuter;
|
|
165
57
|
}
|
|
166
58
|
_createClass(DataManager, [
|
|
@@ -187,25 +79,24 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
187
79
|
key: "getRemoteData",
|
|
188
80
|
value: function getRemoteData(payload) {
|
|
189
81
|
var _this = this;
|
|
190
|
-
return _asyncToGenerator(function() {
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
_this.executer(payload)
|
|
202
|
-
|
|
82
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
83
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
84
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
85
|
+
case 0:
|
|
86
|
+
if (!(_this.executer === undefined)) {
|
|
87
|
+
_ctx.next = 5;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
logerror('未初始化executer');
|
|
91
|
+
return _ctx.abrupt("return", []);
|
|
92
|
+
case 5:
|
|
93
|
+
return _ctx.abrupt("return", _this.executer(payload));
|
|
94
|
+
case 6:
|
|
95
|
+
case "end":
|
|
96
|
+
return _ctx.stop();
|
|
203
97
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
];
|
|
207
|
-
});
|
|
208
|
-
})();
|
|
98
|
+
}, _callee);
|
|
99
|
+
}))();
|
|
209
100
|
}
|
|
210
101
|
}
|
|
211
102
|
]);
|