@byteluck-fe/model-driven-engine 1.7.0 → 1.7.3
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 +136 -33
- package/dist/esm/common/DataManager.js +113 -18
- package/dist/esm/common/Engine.js +174 -75
- package/dist/esm/common/OkWorker.js +5 -5
- package/dist/esm/common/Store.js +10 -10
- package/dist/esm/common/checkerValue.js +2 -2
- package/dist/esm/common/proxyState.js +9 -9
- package/dist/esm/plugins/CalcPlugin.js +17 -17
- package/dist/esm/plugins/ControlsEventPlugin.js +175 -67
- package/dist/esm/plugins/ES6ModulePlugin.js +2 -2
- package/dist/esm/plugins/LifecycleEventPlugin.js +165 -61
- package/dist/esm/plugins/StylePlugin.js +3 -3
- package/dist/esm/utils/runtimeUtils.js +2 -4
- package/dist/index.umd.js +8 -8
- 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 +6 -6
- 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
|
@@ -64,8 +64,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
64
64
|
/**
|
|
65
65
|
* @description 获取显隐控制的需要被记住值的控件id
|
|
66
66
|
* */ _proto.getNeedHideRememberControlIds = function getNeedHideRememberControlIds() {
|
|
67
|
-
var
|
|
68
|
-
if (!((
|
|
67
|
+
var _this_options;
|
|
68
|
+
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
this.hideNotRememberControlIds = this.options.displayBoList.reduce(function(result, current) {
|
|
@@ -79,8 +79,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
79
79
|
/**
|
|
80
80
|
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
81
81
|
* */ _proto.getDontHasPermissionControlIds = function getDontHasPermissionControlIds() {
|
|
82
|
-
var
|
|
83
|
-
if (!((
|
|
82
|
+
var _this_options;
|
|
83
|
+
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
this.dontHasPermissionControlIds = this.options.behavior.reduce(function(result, current) {
|
|
@@ -206,8 +206,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
206
206
|
var _this = this;
|
|
207
207
|
this.engine.on("schema-change", function(payload) {
|
|
208
208
|
if (payload.props === "isHide") {
|
|
209
|
-
var
|
|
210
|
-
var calcControls = (
|
|
209
|
+
var _this_dependenciesTriggerMap_get;
|
|
210
|
+
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
211
211
|
calcControls.forEach(function(calc) {
|
|
212
212
|
_this.computedCalcValue(calc);
|
|
213
213
|
});
|
|
@@ -219,18 +219,18 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
219
219
|
* */ _proto.watchSubtableChange = function watchSubtableChange() {
|
|
220
220
|
var _this = this;
|
|
221
221
|
this.engine.on("list-change", function(payload) {
|
|
222
|
-
var
|
|
222
|
+
var _payload_options;
|
|
223
223
|
_this.resetDependencies();
|
|
224
|
-
var
|
|
225
|
-
var changedRows = (
|
|
224
|
+
var _payload_options_changed;
|
|
225
|
+
var changedRows = (_payload_options_changed = (_payload_options = payload.options) === null || _payload_options === void 0 ? void 0 : _payload_options.changed) !== null && _payload_options_changed !== void 0 ? _payload_options_changed : [];
|
|
226
226
|
// 对发生改变的行进行重新计算
|
|
227
227
|
var changedCalc = _this.getCalcControlsFromSubtableRows(changedRows);
|
|
228
228
|
// @ts-ignore
|
|
229
229
|
changedCalc.forEach(function(calcControl) {
|
|
230
230
|
_this.computedCalcValue(calcControl);
|
|
231
231
|
});
|
|
232
|
-
var
|
|
233
|
-
var calcControls = (
|
|
232
|
+
var _this_dependenciesTriggerMap_get;
|
|
233
|
+
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
234
234
|
// @ts-ignore
|
|
235
235
|
calcControls.forEach(function(calcControl) {
|
|
236
236
|
_this.computedCalcValue(calcControl);
|
|
@@ -246,8 +246,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
246
246
|
if (!_this.dependenciesTriggerMap.has(instance.id)) {
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
var
|
|
250
|
-
var calcControls = (
|
|
249
|
+
var _this_dependenciesTriggerMap_get;
|
|
250
|
+
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
251
251
|
// 在明细子表中的控件,如果计算公式也在明细子表,那只触发同一行的计算公式的计算
|
|
252
252
|
if (payload.rowIndex !== undefined && payload.rowIndex > -1) {
|
|
253
253
|
// @ts-ignore
|
|
@@ -271,8 +271,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
271
271
|
/**
|
|
272
272
|
* @description 控件在明细子表内
|
|
273
273
|
* */ _proto.controlInSubtable = function controlInSubtable(control) {
|
|
274
|
-
var
|
|
275
|
-
return ((
|
|
274
|
+
var _control_parent;
|
|
275
|
+
return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
|
|
276
276
|
};
|
|
277
277
|
/**
|
|
278
278
|
* @description 执行计算公式的计算
|
|
@@ -352,10 +352,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
352
352
|
if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
var
|
|
355
|
+
var _oldValue_unit;
|
|
356
356
|
this.engine.setState(control.id, {
|
|
357
357
|
result: result,
|
|
358
|
-
unit: (
|
|
358
|
+
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ""
|
|
359
359
|
}, rowIndex);
|
|
360
360
|
};
|
|
361
361
|
/**
|
|
@@ -32,7 +32,101 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
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
|
+
};
|
|
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
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
36
130
|
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
37
131
|
// type EventKeyMap = {
|
|
38
132
|
// [eventKey in EventKeys]?: string
|
|
@@ -80,30 +174,36 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
80
174
|
_proto.engineAddEventListener = function engineAddEventListener(eventKey, controlEventKey) {
|
|
81
175
|
var _this = this;
|
|
82
176
|
this.engine.on(eventKey, function() {
|
|
83
|
-
var _ref = _asyncToGenerator(
|
|
84
|
-
return
|
|
85
|
-
|
|
177
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
178
|
+
return __generator(this, function(_state) {
|
|
179
|
+
switch(_state.label){
|
|
86
180
|
case 0:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
181
|
+
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
182
|
+
if (eventKey === "change" && !_this.engine.isMounted) {
|
|
183
|
+
return [
|
|
184
|
+
2
|
|
185
|
+
];
|
|
90
186
|
}
|
|
91
|
-
|
|
187
|
+
if (!(payload.instance !== undefined)) return [
|
|
188
|
+
3,
|
|
189
|
+
2
|
|
190
|
+
];
|
|
191
|
+
return [
|
|
192
|
+
4,
|
|
193
|
+
_this.callControlEvent(controlEventKey, payload)
|
|
194
|
+
];
|
|
195
|
+
case 1:
|
|
196
|
+
return [
|
|
197
|
+
2,
|
|
198
|
+
_state.sent()
|
|
199
|
+
];
|
|
92
200
|
case 2:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
_ctx.next = 5;
|
|
98
|
-
return _this.callControlEvent(controlEventKey, payload);
|
|
99
|
-
case 5:
|
|
100
|
-
return _ctx.abrupt("return", _ctx.sent);
|
|
101
|
-
case 6:
|
|
102
|
-
case "end":
|
|
103
|
-
return _ctx.stop();
|
|
201
|
+
return [
|
|
202
|
+
2
|
|
203
|
+
];
|
|
104
204
|
}
|
|
105
|
-
}
|
|
106
|
-
})
|
|
205
|
+
});
|
|
206
|
+
});
|
|
107
207
|
return function(payload) {
|
|
108
208
|
return _ref.apply(this, arguments);
|
|
109
209
|
};
|
|
@@ -111,58 +211,66 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
111
211
|
};
|
|
112
212
|
_proto.callControlEvent = function callControlEvent(name, payload) {
|
|
113
213
|
var _this = this;
|
|
114
|
-
return _asyncToGenerator(
|
|
214
|
+
return _asyncToGenerator(function() {
|
|
115
215
|
var events, result;
|
|
116
|
-
return
|
|
117
|
-
|
|
216
|
+
return __generator(this, function(_state) {
|
|
217
|
+
switch(_state.label){
|
|
118
218
|
case 0:
|
|
119
219
|
events = _this.config[payload.instance.id];
|
|
120
|
-
if (!
|
|
121
|
-
|
|
122
|
-
|
|
220
|
+
if (!events || !Array.isArray(events[name])) {
|
|
221
|
+
return [
|
|
222
|
+
2,
|
|
223
|
+
[]
|
|
224
|
+
];
|
|
123
225
|
}
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
226
|
+
return [
|
|
227
|
+
4,
|
|
228
|
+
Promise.all(events[name].map(function() {
|
|
229
|
+
var _ref = _asyncToGenerator(function(eventName) {
|
|
230
|
+
var execResult;
|
|
231
|
+
return __generator(this, function(_state) {
|
|
232
|
+
switch(_state.label){
|
|
233
|
+
case 0:
|
|
234
|
+
return [
|
|
235
|
+
4,
|
|
236
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
237
|
+
// this.engine,
|
|
238
|
+
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
239
|
+
payload)
|
|
240
|
+
];
|
|
241
|
+
case 1:
|
|
242
|
+
execResult = _state.sent();
|
|
243
|
+
return [
|
|
244
|
+
2,
|
|
245
|
+
execResult
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
return function(eventName) {
|
|
251
|
+
return _ref.apply(this, arguments);
|
|
252
|
+
};
|
|
253
|
+
}()))
|
|
254
|
+
];
|
|
255
|
+
case 1:
|
|
256
|
+
result = _state.sent();
|
|
257
|
+
if (result.includes(false)) {
|
|
258
|
+
return [
|
|
259
|
+
2,
|
|
260
|
+
false
|
|
261
|
+
];
|
|
262
|
+
} else {
|
|
263
|
+
return [
|
|
264
|
+
2,
|
|
265
|
+
result
|
|
266
|
+
];
|
|
156
267
|
}
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
case 11:
|
|
161
|
-
case "end":
|
|
162
|
-
return _ctx.stop();
|
|
268
|
+
return [
|
|
269
|
+
2
|
|
270
|
+
];
|
|
163
271
|
}
|
|
164
|
-
}
|
|
165
|
-
})
|
|
272
|
+
});
|
|
273
|
+
})();
|
|
166
274
|
};
|
|
167
275
|
return ControlsEventPlugin;
|
|
168
276
|
}();
|
|
@@ -71,7 +71,7 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
71
71
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
72
72
|
try {
|
|
73
73
|
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
74
|
-
var
|
|
74
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
75
75
|
actionManager.addAction(key, value);
|
|
76
76
|
}
|
|
77
77
|
} catch (err) {
|
|
@@ -117,7 +117,7 @@ export function parseModule(action, engine) {
|
|
|
117
117
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
118
118
|
try {
|
|
119
119
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
120
|
-
var
|
|
120
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
121
121
|
if (typeof value === "function") {
|
|
122
122
|
funcMap[key] = value;
|
|
123
123
|
} else {
|
|
@@ -41,7 +41,7 @@ function _classCallCheck(instance, Constructor) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function _iterableToArrayLimit(arr, i) {
|
|
44
|
-
var _i = arr == null ? null :
|
|
44
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
45
|
if (_i == null) return;
|
|
46
46
|
var _arr = [];
|
|
47
47
|
var _n = true;
|
|
@@ -78,7 +78,101 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
78
78
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
79
79
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
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
|
+
};
|
|
82
176
|
var LifecycleEventKeyMap = {
|
|
83
177
|
"engine-mounted": "did_mount",
|
|
84
178
|
"engine-submit": "will_submit",
|
|
@@ -99,28 +193,34 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
99
193
|
var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
100
194
|
var _this1 = _this;
|
|
101
195
|
engine.on(engineKey, function() {
|
|
102
|
-
var _ref = _asyncToGenerator(
|
|
196
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
103
197
|
var result;
|
|
104
|
-
return
|
|
105
|
-
|
|
198
|
+
return __generator(this, function(_state) {
|
|
199
|
+
switch(_state.label){
|
|
106
200
|
case 0:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
201
|
+
return [
|
|
202
|
+
4,
|
|
203
|
+
_this1.callLifecycleEvent(lifecycleKey, payload)
|
|
204
|
+
];
|
|
205
|
+
case 1:
|
|
206
|
+
result = _state.sent();
|
|
207
|
+
if (result.includes(false)) {
|
|
208
|
+
return [
|
|
209
|
+
2,
|
|
210
|
+
false
|
|
211
|
+
];
|
|
212
|
+
} else {
|
|
213
|
+
return [
|
|
214
|
+
2,
|
|
215
|
+
result
|
|
216
|
+
];
|
|
114
217
|
}
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
case 8:
|
|
119
|
-
case "end":
|
|
120
|
-
return _ctx.stop();
|
|
218
|
+
return [
|
|
219
|
+
2
|
|
220
|
+
];
|
|
121
221
|
}
|
|
122
|
-
}
|
|
123
|
-
})
|
|
222
|
+
});
|
|
223
|
+
});
|
|
124
224
|
return function(payload) {
|
|
125
225
|
return _ref.apply(this, arguments);
|
|
126
226
|
};
|
|
@@ -129,52 +229,56 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
129
229
|
};
|
|
130
230
|
_proto.callLifecycleEvent = function callLifecycleEvent(name, payload) {
|
|
131
231
|
var _this = this;
|
|
132
|
-
return _asyncToGenerator(
|
|
232
|
+
return _asyncToGenerator(function() {
|
|
133
233
|
var events, result;
|
|
134
|
-
return
|
|
135
|
-
|
|
234
|
+
return __generator(this, function(_state) {
|
|
235
|
+
switch(_state.label){
|
|
136
236
|
case 0:
|
|
137
237
|
events = _this.config;
|
|
138
|
-
if (!
|
|
139
|
-
|
|
140
|
-
|
|
238
|
+
if (!events || !Array.isArray(events[name])) {
|
|
239
|
+
return [
|
|
240
|
+
2,
|
|
241
|
+
[]
|
|
242
|
+
];
|
|
141
243
|
}
|
|
142
|
-
return
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
244
|
+
return [
|
|
245
|
+
4,
|
|
246
|
+
Promise.all(events[name].map(function() {
|
|
247
|
+
var _ref = _asyncToGenerator(function(eventName) {
|
|
248
|
+
var execResult;
|
|
249
|
+
return __generator(this, function(_state) {
|
|
250
|
+
switch(_state.label){
|
|
251
|
+
case 0:
|
|
252
|
+
return [
|
|
253
|
+
4,
|
|
254
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
255
|
+
// this.engine,
|
|
256
|
+
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
257
|
+
payload)
|
|
258
|
+
];
|
|
259
|
+
case 1:
|
|
260
|
+
execResult = _state.sent();
|
|
261
|
+
return [
|
|
262
|
+
2,
|
|
263
|
+
execResult
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
return function(eventName) {
|
|
269
|
+
return _ref.apply(this, arguments);
|
|
270
|
+
};
|
|
271
|
+
}()))
|
|
272
|
+
];
|
|
273
|
+
case 1:
|
|
274
|
+
result = _state.sent();
|
|
275
|
+
return [
|
|
276
|
+
2,
|
|
277
|
+
result
|
|
278
|
+
];
|
|
175
279
|
}
|
|
176
|
-
}
|
|
177
|
-
})
|
|
280
|
+
});
|
|
281
|
+
})();
|
|
178
282
|
};
|
|
179
283
|
return LifecycleEventPlugin;
|
|
180
284
|
}();
|
|
@@ -11,10 +11,10 @@ export var StylePlugin = /*#__PURE__*/ function() {
|
|
|
11
11
|
}
|
|
12
12
|
var _proto = StylePlugin.prototype;
|
|
13
13
|
_proto.apply = function apply(engine) {
|
|
14
|
-
var
|
|
14
|
+
var _this_config;
|
|
15
15
|
this.engine = engine;
|
|
16
|
-
var
|
|
17
|
-
var compiledStyle = (
|
|
16
|
+
var _this_config_source;
|
|
17
|
+
var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : "";
|
|
18
18
|
var style = document.createElement("style");
|
|
19
19
|
style.className = "edit-css";
|
|
20
20
|
style.type = "text/css";
|