@byteluck-fe/model-driven-engine 2.7.0-alpha.1 → 2.7.0-alpha.12
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 +72 -154
- package/dist/esm/common/DataManager.js +60 -128
- package/dist/esm/common/Engine.js +1145 -1066
- package/dist/esm/common/OkWorker.js +106 -75
- package/dist/esm/common/Runtime.js +34 -28
- package/dist/esm/common/Store.js +186 -157
- package/dist/esm/common/checkerValue.js +341 -259
- 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 +382 -306
- package/dist/esm/plugins/ControlsEventPlugin.js +141 -225
- package/dist/esm/plugins/ES6ModulePlugin.js +56 -38
- package/dist/esm/plugins/LifecycleEventPlugin.js +107 -190
- package/dist/esm/plugins/StylePlugin.js +31 -13
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +9 -6
- package/dist/index.umd.js +11 -11
- package/dist/types/common/Engine.d.ts +7 -7
- 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 +4 -4
|
@@ -40,6 +40,20 @@ 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
|
+
}
|
|
43
57
|
function _iterableToArray(iter) {
|
|
44
58
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
45
59
|
}
|
|
@@ -57,102 +71,8 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
57
71
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
58
72
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
59
73
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
label: 0,
|
|
63
|
-
sent: function() {
|
|
64
|
-
if (t[0] & 1) throw t[1];
|
|
65
|
-
return t[1];
|
|
66
|
-
},
|
|
67
|
-
trys: [],
|
|
68
|
-
ops: []
|
|
69
|
-
};
|
|
70
|
-
return g = {
|
|
71
|
-
next: verb(0),
|
|
72
|
-
"throw": verb(1),
|
|
73
|
-
"return": verb(2)
|
|
74
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
75
|
-
return this;
|
|
76
|
-
}), g;
|
|
77
|
-
function verb(n) {
|
|
78
|
-
return function(v) {
|
|
79
|
-
return step([
|
|
80
|
-
n,
|
|
81
|
-
v
|
|
82
|
-
]);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function step(op) {
|
|
86
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
87
|
-
while(_)try {
|
|
88
|
-
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;
|
|
89
|
-
if (y = 0, t) op = [
|
|
90
|
-
op[0] & 2,
|
|
91
|
-
t.value
|
|
92
|
-
];
|
|
93
|
-
switch(op[0]){
|
|
94
|
-
case 0:
|
|
95
|
-
case 1:
|
|
96
|
-
t = op;
|
|
97
|
-
break;
|
|
98
|
-
case 4:
|
|
99
|
-
_.label++;
|
|
100
|
-
return {
|
|
101
|
-
value: op[1],
|
|
102
|
-
done: false
|
|
103
|
-
};
|
|
104
|
-
case 5:
|
|
105
|
-
_.label++;
|
|
106
|
-
y = op[1];
|
|
107
|
-
op = [
|
|
108
|
-
0
|
|
109
|
-
];
|
|
110
|
-
continue;
|
|
111
|
-
case 7:
|
|
112
|
-
op = _.ops.pop();
|
|
113
|
-
_.trys.pop();
|
|
114
|
-
continue;
|
|
115
|
-
default:
|
|
116
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
117
|
-
_ = 0;
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
121
|
-
_.label = op[1];
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
125
|
-
_.label = t[1];
|
|
126
|
-
t = op;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
if (t && _.label < t[2]) {
|
|
130
|
-
_.label = t[2];
|
|
131
|
-
_.ops.push(op);
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
if (t[2]) _.ops.pop();
|
|
135
|
-
_.trys.pop();
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
op = body.call(thisArg, _);
|
|
139
|
-
} catch (e) {
|
|
140
|
-
op = [
|
|
141
|
-
6,
|
|
142
|
-
e
|
|
143
|
-
];
|
|
144
|
-
y = 0;
|
|
145
|
-
} finally{
|
|
146
|
-
f = t = 0;
|
|
147
|
-
}
|
|
148
|
-
if (op[0] & 5) throw op[1];
|
|
149
|
-
return {
|
|
150
|
-
value: op[0] ? op[1] : void 0,
|
|
151
|
-
done: true
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
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';
|
|
156
76
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
157
77
|
"use strict";
|
|
158
78
|
function ActionManager() {
|
|
@@ -166,73 +86,71 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
166
86
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
167
87
|
*/ this.sources = {};
|
|
168
88
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
89
|
+
_createClass(ActionManager, [
|
|
90
|
+
{
|
|
91
|
+
key: "execAction",
|
|
92
|
+
value: function execAction(name, context) {
|
|
93
|
+
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
94
|
+
args[_key - 2] = arguments[_key];
|
|
95
|
+
}
|
|
96
|
+
var _this = this;
|
|
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){
|
|
101
|
+
case 0:
|
|
102
|
+
action = _this.actionMap.get(name);
|
|
103
|
+
if (action) {
|
|
104
|
+
_ctx.next = 3;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
return _ctx.abrupt("return");
|
|
108
|
+
case 3:
|
|
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);
|
|
122
|
+
// 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
|
|
123
|
+
logerror("".concat(action.id, " Exception during calling action: ").concat(_ctx.t0));
|
|
124
|
+
case 14:
|
|
125
|
+
case "end":
|
|
126
|
+
return _ctx.stop();
|
|
185
127
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
_state.trys.push([
|
|
189
|
-
1,
|
|
128
|
+
}, _callee, null, [
|
|
129
|
+
[
|
|
190
130
|
3,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
];
|
|
131
|
+
11
|
|
132
|
+
]
|
|
133
|
+
]);
|
|
134
|
+
}))();
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: "addAction",
|
|
139
|
+
value: function addAction(name, func) {
|
|
140
|
+
if (this.actionMap.has(name)) {
|
|
141
|
+
error('duplicated action key');
|
|
219
142
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
_proto.addAction = function addAction(name, func) {
|
|
224
|
-
if (this.actionMap.has(name)) {
|
|
225
|
-
error("duplicated action key");
|
|
143
|
+
var action = new Action(name, func);
|
|
144
|
+
this.actionMap.set(name, action);
|
|
145
|
+
}
|
|
226
146
|
}
|
|
227
|
-
|
|
228
|
-
this.actionMap.set(name, action);
|
|
229
|
-
};
|
|
147
|
+
]);
|
|
230
148
|
return ActionManager;
|
|
231
149
|
}();
|
|
232
150
|
var Action = function Action(id, func) {
|
|
233
151
|
"use strict";
|
|
234
152
|
_classCallCheck(this, Action);
|
|
235
|
-
this.id =
|
|
153
|
+
this.id = '';
|
|
236
154
|
this.id = id;
|
|
237
155
|
this.func = func;
|
|
238
156
|
};
|
|
@@ -32,102 +32,22 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: []
|
|
44
|
-
};
|
|
45
|
-
return g = {
|
|
46
|
-
next: verb(0),
|
|
47
|
-
"throw": verb(1),
|
|
48
|
-
"return": verb(2)
|
|
49
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
50
|
-
return this;
|
|
51
|
-
}), g;
|
|
52
|
-
function verb(n) {
|
|
53
|
-
return function(v) {
|
|
54
|
-
return step([
|
|
55
|
-
n,
|
|
56
|
-
v
|
|
57
|
-
]);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function step(op) {
|
|
61
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
-
while(_)try {
|
|
63
|
-
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;
|
|
64
|
-
if (y = 0, t) op = [
|
|
65
|
-
op[0] & 2,
|
|
66
|
-
t.value
|
|
67
|
-
];
|
|
68
|
-
switch(op[0]){
|
|
69
|
-
case 0:
|
|
70
|
-
case 1:
|
|
71
|
-
t = op;
|
|
72
|
-
break;
|
|
73
|
-
case 4:
|
|
74
|
-
_.label++;
|
|
75
|
-
return {
|
|
76
|
-
value: op[1],
|
|
77
|
-
done: false
|
|
78
|
-
};
|
|
79
|
-
case 5:
|
|
80
|
-
_.label++;
|
|
81
|
-
y = op[1];
|
|
82
|
-
op = [
|
|
83
|
-
0
|
|
84
|
-
];
|
|
85
|
-
continue;
|
|
86
|
-
case 7:
|
|
87
|
-
op = _.ops.pop();
|
|
88
|
-
_.trys.pop();
|
|
89
|
-
continue;
|
|
90
|
-
default:
|
|
91
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
92
|
-
_ = 0;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
96
|
-
_.label = op[1];
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
100
|
-
_.label = t[1];
|
|
101
|
-
t = op;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (t && _.label < t[2]) {
|
|
105
|
-
_.label = t[2];
|
|
106
|
-
_.ops.push(op);
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (t[2]) _.ops.pop();
|
|
110
|
-
_.trys.pop();
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
op = body.call(thisArg, _);
|
|
114
|
-
} catch (e) {
|
|
115
|
-
op = [
|
|
116
|
-
6,
|
|
117
|
-
e
|
|
118
|
-
];
|
|
119
|
-
y = 0;
|
|
120
|
-
} finally{
|
|
121
|
-
f = t = 0;
|
|
122
|
-
}
|
|
123
|
-
if (op[0] & 5) throw op[1];
|
|
124
|
-
return {
|
|
125
|
-
value: op[0] ? op[1] : void 0,
|
|
126
|
-
done: true
|
|
127
|
-
};
|
|
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);
|
|
128
42
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
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
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
50
|
+
import { JSONCopy, logerror } from '@byteluck-fe/model-driven-shared';
|
|
131
51
|
export var DataManager = /*#__PURE__*/ function() {
|
|
132
52
|
"use strict";
|
|
133
53
|
function DataManager(callbackExecuter) {
|
|
@@ -135,38 +55,50 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
135
55
|
this._dataStore = new Map();
|
|
136
56
|
this.executer = callbackExecuter;
|
|
137
57
|
}
|
|
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
|
-
|
|
58
|
+
_createClass(DataManager, [
|
|
59
|
+
{
|
|
60
|
+
key: "add",
|
|
61
|
+
value: function add(key, data) {
|
|
62
|
+
this._dataStore.set(key, data);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "get",
|
|
67
|
+
value: function get(key) {
|
|
68
|
+
var result = this._dataStore.get(key);
|
|
69
|
+
return JSONCopy(result);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: "remove",
|
|
74
|
+
value: function remove(key) {
|
|
75
|
+
this._dataStore.delete(key);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: "getRemoteData",
|
|
80
|
+
value: function getRemoteData(payload) {
|
|
81
|
+
var _this = this;
|
|
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();
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}))();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]);
|
|
171
103
|
return DataManager;
|
|
172
104
|
}();
|