@byteluck-fe/model-driven-engine 2.7.0-alpha.14 → 2.7.0-alpha.15
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 +157 -40
- package/dist/esm/common/DataManager.js +129 -20
- package/dist/esm/common/Engine.js +338 -211
- package/dist/esm/common/OkWorker.js +27 -13
- package/dist/esm/common/Runtime.js +26 -11
- package/dist/esm/common/Store.js +51 -50
- 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 +67 -59
- package/dist/esm/plugins/ControlsEventPlugin.js +191 -68
- package/dist/esm/plugins/ES6ModulePlugin.js +24 -8
- package/dist/esm/plugins/LifecycleEventPlugin.js +183 -64
- package/dist/esm/plugins/StylePlugin.js +22 -7
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +5 -7
- package/dist/index.umd.js +10 -10
- package/dist/types/common/Engine.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +1 -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 +3 -3
|
@@ -54,6 +54,19 @@ 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
|
+
}
|
|
57
70
|
function _iterableToArray(iter) {
|
|
58
71
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
59
72
|
}
|
|
@@ -71,20 +84,114 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
71
84
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
72
85
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
86
|
}
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
88
|
+
var f, y, t, g, _ = {
|
|
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";
|
|
76
183
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
77
184
|
"use strict";
|
|
78
185
|
function ActionManager() {
|
|
79
186
|
_classCallCheck(this, ActionManager);
|
|
80
|
-
this
|
|
81
|
-
this
|
|
187
|
+
_defineProperty(this, "actionMap", new Map());
|
|
188
|
+
_defineProperty(this, "buildinActions", {});
|
|
82
189
|
/**
|
|
83
190
|
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
84
|
-
*/ this
|
|
191
|
+
*/ _defineProperty(this, "actionUtils", {});
|
|
85
192
|
/**
|
|
86
193
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
87
|
-
*/ this
|
|
194
|
+
*/ _defineProperty(this, "sources", {});
|
|
88
195
|
}
|
|
89
196
|
_createClass(ActionManager, [
|
|
90
197
|
{
|
|
@@ -94,51 +201,60 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
94
201
|
args[_key - 2] = arguments[_key];
|
|
95
202
|
}
|
|
96
203
|
var _this = this;
|
|
97
|
-
return _asyncToGenerator(
|
|
98
|
-
var action,
|
|
99
|
-
return
|
|
100
|
-
|
|
204
|
+
return _asyncToGenerator(function() {
|
|
205
|
+
var action, _action_func, result, e;
|
|
206
|
+
return __generator(this, function(_state) {
|
|
207
|
+
switch(_state.label){
|
|
101
208
|
case 0:
|
|
102
209
|
action = _this.actionMap.get(name);
|
|
103
|
-
if (action) {
|
|
104
|
-
|
|
105
|
-
|
|
210
|
+
if (!action) {
|
|
211
|
+
return [
|
|
212
|
+
2
|
|
213
|
+
];
|
|
106
214
|
}
|
|
107
|
-
|
|
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
|
+
];
|
|
108
236
|
case 3:
|
|
109
|
-
|
|
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);
|
|
237
|
+
e = _state.sent();
|
|
122
238
|
// 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
|
|
123
|
-
logerror("".concat(action.id, " Exception during calling action: ").concat(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+
];
|
|
127
248
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
3,
|
|
131
|
-
11
|
|
132
|
-
]
|
|
133
|
-
]);
|
|
134
|
-
}))();
|
|
249
|
+
});
|
|
250
|
+
})();
|
|
135
251
|
}
|
|
136
252
|
},
|
|
137
253
|
{
|
|
138
254
|
key: "addAction",
|
|
139
255
|
value: function addAction(name, func) {
|
|
140
256
|
if (this.actionMap.has(name)) {
|
|
141
|
-
error(
|
|
257
|
+
error("duplicated action key");
|
|
142
258
|
}
|
|
143
259
|
var action = new Action(name, func);
|
|
144
260
|
this.actionMap.set(name, action);
|
|
@@ -150,7 +266,8 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
150
266
|
var Action = function Action(id, func) {
|
|
151
267
|
"use strict";
|
|
152
268
|
_classCallCheck(this, Action);
|
|
153
|
-
this
|
|
269
|
+
_defineProperty(this, "func", void 0);
|
|
270
|
+
_defineProperty(this, "id", "");
|
|
154
271
|
this.id = id;
|
|
155
272
|
this.func = func;
|
|
156
273
|
};
|
|
@@ -46,13 +46,121 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
46
46
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
47
|
return Constructor;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
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";
|
|
51
158
|
export var DataManager = /*#__PURE__*/ function() {
|
|
52
159
|
"use strict";
|
|
53
160
|
function DataManager(callbackExecuter) {
|
|
54
161
|
_classCallCheck(this, DataManager);
|
|
55
|
-
this
|
|
162
|
+
_defineProperty(this, "_dataStore", new Map());
|
|
163
|
+
_defineProperty(this, "executer", void 0);
|
|
56
164
|
this.executer = callbackExecuter;
|
|
57
165
|
}
|
|
58
166
|
_createClass(DataManager, [
|
|
@@ -79,24 +187,25 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
79
187
|
key: "getRemoteData",
|
|
80
188
|
value: function getRemoteData(payload) {
|
|
81
189
|
var _this = this;
|
|
82
|
-
return _asyncToGenerator(
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
case "end":
|
|
96
|
-
return _ctx.stop();
|
|
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
|
+
];
|
|
97
203
|
}
|
|
98
|
-
|
|
99
|
-
|
|
204
|
+
return [
|
|
205
|
+
2
|
|
206
|
+
];
|
|
207
|
+
});
|
|
208
|
+
})();
|
|
100
209
|
}
|
|
101
210
|
}
|
|
102
211
|
]);
|