@byteluck-fe/model-driven-engine 2.7.0-alpha.0 → 2.7.0-alpha.2
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 +154 -72
- package/dist/esm/common/DataManager.js +128 -60
- package/dist/esm/common/Engine.js +1060 -1111
- package/dist/esm/common/OkWorker.js +75 -106
- package/dist/esm/common/Runtime.js +27 -29
- package/dist/esm/common/Store.js +149 -181
- package/dist/esm/common/checkerValue.js +253 -328
- 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 +306 -382
- package/dist/esm/plugins/ControlsEventPlugin.js +225 -141
- package/dist/esm/plugins/ES6ModulePlugin.js +38 -56
- package/dist/esm/plugins/LifecycleEventPlugin.js +190 -107
- package/dist/esm/plugins/StylePlugin.js +13 -31
- 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 +9 -9
- 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 +4 -4
|
@@ -40,20 +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
43
|
function _iterableToArray(iter) {
|
|
58
44
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
59
45
|
}
|
|
@@ -71,8 +57,102 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
71
57
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
72
58
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
59
|
}
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
61
|
+
var f, y, t, g, _ = {
|
|
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";
|
|
76
156
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
77
157
|
"use strict";
|
|
78
158
|
function ActionManager() {
|
|
@@ -86,71 +166,73 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
86
166
|
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
87
167
|
*/ this.sources = {};
|
|
88
168
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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();
|
|
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
|
+
];
|
|
127
185
|
}
|
|
128
|
-
|
|
129
|
-
|
|
186
|
+
_state.label = 1;
|
|
187
|
+
case 1:
|
|
188
|
+
_state.trys.push([
|
|
189
|
+
1,
|
|
130
190
|
3,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
+
];
|
|
142
219
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
220
|
+
});
|
|
221
|
+
})();
|
|
222
|
+
};
|
|
223
|
+
_proto.addAction = function addAction(name, func) {
|
|
224
|
+
if (this.actionMap.has(name)) {
|
|
225
|
+
error("duplicated action key");
|
|
146
226
|
}
|
|
147
|
-
|
|
227
|
+
var action = new Action(name, func);
|
|
228
|
+
this.actionMap.set(name, action);
|
|
229
|
+
};
|
|
148
230
|
return ActionManager;
|
|
149
231
|
}();
|
|
150
232
|
var Action = function Action(id, func) {
|
|
151
233
|
"use strict";
|
|
152
234
|
_classCallCheck(this, Action);
|
|
153
|
-
this.id =
|
|
235
|
+
this.id = "";
|
|
154
236
|
this.id = id;
|
|
155
237
|
this.func = func;
|
|
156
238
|
};
|
|
@@ -32,22 +32,102 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
36
|
+
var f, y, t, g, _ = {
|
|
37
|
+
label: 0,
|
|
38
|
+
sent: function() {
|
|
39
|
+
if (t[0] & 1) throw t[1];
|
|
40
|
+
return t[1];
|
|
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
|
+
};
|
|
42
59
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
|
|
51
131
|
export var DataManager = /*#__PURE__*/ function() {
|
|
52
132
|
"use strict";
|
|
53
133
|
function DataManager(callbackExecuter) {
|
|
@@ -55,50 +135,38 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
55
135
|
this._dataStore = new Map();
|
|
56
136
|
this.executer = callbackExecuter;
|
|
57
137
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
]);
|
|
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
|
+
};
|
|
103
171
|
return DataManager;
|
|
104
172
|
}();
|