@byteluck-fe/model-driven-engine 2.5.0-beta.1 → 2.5.0-beta.4
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 +1111 -1060
- package/dist/esm/common/OkWorker.js +106 -75
- package/dist/esm/common/Runtime.js +29 -27
- package/dist/esm/common/Store.js +181 -149
- package/dist/esm/common/checkerValue.js +328 -253
- 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 +7 -5
- 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 -50
- 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,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 _iterableToArrayLimit(arr, i) {
|
|
44
58
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
59
|
if (_i == null) return;
|
|
@@ -78,106 +92,12 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
78
92
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
79
93
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
80
94
|
}
|
|
81
|
-
|
|
82
|
-
var f, y, t, g, _ = {
|
|
83
|
-
label: 0,
|
|
84
|
-
sent: function() {
|
|
85
|
-
if (t[0] & 1) throw t[1];
|
|
86
|
-
return t[1];
|
|
87
|
-
},
|
|
88
|
-
trys: [],
|
|
89
|
-
ops: []
|
|
90
|
-
};
|
|
91
|
-
return(g = {
|
|
92
|
-
next: verb(0),
|
|
93
|
-
"throw": verb(1),
|
|
94
|
-
"return": verb(2)
|
|
95
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
96
|
-
return this;
|
|
97
|
-
}), g);
|
|
98
|
-
function verb(n) {
|
|
99
|
-
return function(v) {
|
|
100
|
-
return step([
|
|
101
|
-
n,
|
|
102
|
-
v
|
|
103
|
-
]);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function step(op) {
|
|
107
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
108
|
-
while(_)try {
|
|
109
|
-
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;
|
|
110
|
-
if (y = 0, t) op = [
|
|
111
|
-
op[0] & 2,
|
|
112
|
-
t.value
|
|
113
|
-
];
|
|
114
|
-
switch(op[0]){
|
|
115
|
-
case 0:
|
|
116
|
-
case 1:
|
|
117
|
-
t = op;
|
|
118
|
-
break;
|
|
119
|
-
case 4:
|
|
120
|
-
_.label++;
|
|
121
|
-
return {
|
|
122
|
-
value: op[1],
|
|
123
|
-
done: false
|
|
124
|
-
};
|
|
125
|
-
case 5:
|
|
126
|
-
_.label++;
|
|
127
|
-
y = op[1];
|
|
128
|
-
op = [
|
|
129
|
-
0
|
|
130
|
-
];
|
|
131
|
-
continue;
|
|
132
|
-
case 7:
|
|
133
|
-
op = _.ops.pop();
|
|
134
|
-
_.trys.pop();
|
|
135
|
-
continue;
|
|
136
|
-
default:
|
|
137
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
138
|
-
_ = 0;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
142
|
-
_.label = op[1];
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
146
|
-
_.label = t[1];
|
|
147
|
-
t = op;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
if (t && _.label < t[2]) {
|
|
151
|
-
_.label = t[2];
|
|
152
|
-
_.ops.push(op);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
if (t[2]) _.ops.pop();
|
|
156
|
-
_.trys.pop();
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
op = body.call(thisArg, _);
|
|
160
|
-
} catch (e) {
|
|
161
|
-
op = [
|
|
162
|
-
6,
|
|
163
|
-
e
|
|
164
|
-
];
|
|
165
|
-
y = 0;
|
|
166
|
-
} finally{
|
|
167
|
-
f = t = 0;
|
|
168
|
-
}
|
|
169
|
-
if (op[0] & 5) throw op[1];
|
|
170
|
-
return {
|
|
171
|
-
value: op[0] ? op[1] : void 0,
|
|
172
|
-
done: true
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
};
|
|
95
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
176
96
|
var LifecycleEventKeyMap = {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
97
|
+
'engine-mounted': 'did_mount',
|
|
98
|
+
'engine-submit': 'will_submit',
|
|
99
|
+
'engine-submit-params': 'do_submit',
|
|
100
|
+
'engine-submitted': 'did_submit'
|
|
181
101
|
};
|
|
182
102
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
183
103
|
"use strict";
|
|
@@ -185,100 +105,97 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
185
105
|
_classCallCheck(this, LifecycleEventPlugin);
|
|
186
106
|
this.config = config;
|
|
187
107
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
108
|
+
_createClass(LifecycleEventPlugin, [
|
|
109
|
+
{
|
|
110
|
+
key: "apply",
|
|
111
|
+
value: function apply(engine) {
|
|
112
|
+
var _this = this;
|
|
113
|
+
this.engine = engine;
|
|
114
|
+
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
115
|
+
var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
116
|
+
var _this1 = _this;
|
|
117
|
+
engine.on(engineKey, function() {
|
|
118
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(payload) {
|
|
119
|
+
var result;
|
|
120
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
121
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
122
|
+
case 0:
|
|
123
|
+
_ctx.next = 2;
|
|
124
|
+
return _this1.callLifecycleEvent(lifecycleKey, payload);
|
|
125
|
+
case 2:
|
|
126
|
+
result = _ctx.sent;
|
|
127
|
+
if (!result.includes(false)) {
|
|
128
|
+
_ctx.next = 7;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
return _ctx.abrupt("return", false);
|
|
132
|
+
case 7:
|
|
133
|
+
return _ctx.abrupt("return", result);
|
|
134
|
+
case 8:
|
|
135
|
+
case "end":
|
|
136
|
+
return _ctx.stop();
|
|
217
137
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
138
|
+
}, _callee);
|
|
139
|
+
}));
|
|
140
|
+
return function(payload) {
|
|
141
|
+
return _ref.apply(this, arguments);
|
|
142
|
+
};
|
|
143
|
+
}());
|
|
223
144
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
case 0:
|
|
252
|
-
return [
|
|
253
|
-
4,
|
|
254
|
-
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: "callLifecycleEvent",
|
|
149
|
+
value: function callLifecycleEvent(name, payload) {
|
|
150
|
+
var _this = this;
|
|
151
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee1() {
|
|
152
|
+
var events, result;
|
|
153
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx1) {
|
|
154
|
+
while(1)switch(_ctx1.prev = _ctx1.next){
|
|
155
|
+
case 0:
|
|
156
|
+
events = _this.config;
|
|
157
|
+
if (!(!events || !Array.isArray(events[name]))) {
|
|
158
|
+
_ctx1.next = 3;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
return _ctx1.abrupt("return", []);
|
|
162
|
+
case 3:
|
|
163
|
+
_ctx1.next = 5;
|
|
164
|
+
return Promise.all(events[name].map(function() {
|
|
165
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(eventName) {
|
|
166
|
+
var execResult;
|
|
167
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
168
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
169
|
+
case 0:
|
|
170
|
+
_ctx.next = 2;
|
|
171
|
+
return _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
255
172
|
// this.engine,
|
|
256
173
|
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
257
|
-
payload)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
174
|
+
payload);
|
|
175
|
+
case 2:
|
|
176
|
+
execResult = _ctx.sent;
|
|
177
|
+
return _ctx.abrupt("return", execResult);
|
|
178
|
+
case 4:
|
|
179
|
+
case "end":
|
|
180
|
+
return _ctx.stop();
|
|
181
|
+
}
|
|
182
|
+
}, _callee);
|
|
183
|
+
}));
|
|
184
|
+
return function(eventName) {
|
|
185
|
+
return _ref.apply(this, arguments);
|
|
186
|
+
};
|
|
187
|
+
}()));
|
|
188
|
+
case 5:
|
|
189
|
+
result = _ctx1.sent;
|
|
190
|
+
return _ctx1.abrupt("return", result);
|
|
191
|
+
case 7:
|
|
192
|
+
case "end":
|
|
193
|
+
return _ctx1.stop();
|
|
194
|
+
}
|
|
195
|
+
}, _callee1);
|
|
196
|
+
}))();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
]);
|
|
283
200
|
return LifecycleEventPlugin;
|
|
284
201
|
}();
|
|
@@ -3,24 +3,42 @@ function _classCallCheck(instance, Constructor) {
|
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
6
20
|
export var StylePlugin = /*#__PURE__*/ function() {
|
|
7
21
|
"use strict";
|
|
8
22
|
function StylePlugin(config) {
|
|
9
23
|
_classCallCheck(this, StylePlugin);
|
|
10
24
|
this.config = config;
|
|
11
25
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
_createClass(StylePlugin, [
|
|
27
|
+
{
|
|
28
|
+
key: "apply",
|
|
29
|
+
value: function apply(engine) {
|
|
30
|
+
var ref;
|
|
31
|
+
this.engine = engine;
|
|
32
|
+
var ref1;
|
|
33
|
+
var compiledStyle = (ref1 = (ref = this.config) === null || ref === void 0 ? void 0 : ref.source) !== null && ref1 !== void 0 ? ref1 : '';
|
|
34
|
+
var style = document.createElement('style');
|
|
35
|
+
style.className = 'edit-css';
|
|
36
|
+
style.type = 'text/css';
|
|
37
|
+
style.innerHTML = compiledStyle;
|
|
38
|
+
var dom = document.querySelector('head');
|
|
39
|
+
dom.appendChild(style);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]);
|
|
25
43
|
return StylePlugin;
|
|
26
44
|
}();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './ES6ModulePlugin';
|
|
2
|
+
export * from './LifecycleEventPlugin';
|
|
3
|
+
export * from './ControlsEventPlugin';
|
|
4
|
+
export * from './CalcPlugin';
|
|
5
|
+
export * from './StylePlugin';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './runtimeUtils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
1
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
2
2
|
export function hasChildrenControl(instance) {
|
|
3
3
|
return instance.controlType === CONTROL_BASE_TYPE.LAYOUT || instance.controlType === CONTROL_BASE_TYPE.WRAP || instance.controlType === CONTROL_BASE_TYPE.LIST || instance.controlType === CONTROL_BASE_TYPE.SEARCH;
|
|
4
4
|
}
|
|
@@ -11,7 +11,8 @@ export function loopFormControl(control, callback) {
|
|
|
11
11
|
var children = item.getChildrenFormControl();
|
|
12
12
|
callback(item, children);
|
|
13
13
|
} else if (hasChildrenControl(item)) {
|
|
14
|
-
|
|
14
|
+
var ref;
|
|
15
|
+
loopFormControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
15
16
|
// @ts-ignore
|
|
16
17
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
17
18
|
callback(item);
|
|
@@ -26,8 +27,9 @@ callback) {
|
|
|
26
27
|
if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
|
|
27
28
|
callback(item);
|
|
28
29
|
} else if (hasChildrenControl(item)) {
|
|
30
|
+
var ref;
|
|
29
31
|
// @ts-ignore
|
|
30
|
-
loopDataViewControl(item === null ||
|
|
32
|
+
loopDataViewControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
35
|
}
|
|
@@ -35,9 +37,9 @@ callback) {
|
|
|
35
37
|
var unique = 0;
|
|
36
38
|
// uuid生成
|
|
37
39
|
export function buildUUID() {
|
|
38
|
-
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
40
|
+
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
|
|
39
41
|
var time = Date.now();
|
|
40
42
|
var random = Math.floor(Math.random() * 1000000000);
|
|
41
43
|
unique++;
|
|
42
|
-
return prefix +
|
|
44
|
+
return prefix + '_' + random + unique + String(time);
|
|
43
45
|
}
|