@byteluck-fe/model-driven-engine 2.22.3-beta.1 → 2.22.3-beta.11
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 +6 -11
- package/dist/esm/common/DataManager.js +8 -12
- package/dist/esm/common/Engine.js +23 -18
- package/dist/esm/plugins/CalcPlugin.js +3 -3
- package/dist/esm/plugins/ControlsEventPlugin.js +19 -29
- package/dist/esm/plugins/LifecycleEventPlugin.js +18 -29
- package/dist/esm/plugins/StylePlugin.js +2 -2
- package/dist/index.umd.js +9 -9
- package/package.json +4 -4
|
@@ -85,7 +85,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
85
85
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
86
86
|
}
|
|
87
87
|
function _ts_generator(thisArg, body) {
|
|
88
|
-
var f, y, t,
|
|
88
|
+
var f, y, t, _ = {
|
|
89
89
|
label: 0,
|
|
90
90
|
sent: function() {
|
|
91
91
|
if (t[0] & 1) throw t[1];
|
|
@@ -93,12 +93,8 @@ function _ts_generator(thisArg, body) {
|
|
|
93
93
|
},
|
|
94
94
|
trys: [],
|
|
95
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() {
|
|
96
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
97
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
98
|
return this;
|
|
103
99
|
}), g;
|
|
104
100
|
function verb(n) {
|
|
@@ -111,7 +107,7 @@ function _ts_generator(thisArg, body) {
|
|
|
111
107
|
}
|
|
112
108
|
function step(op) {
|
|
113
109
|
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
-
while(_)try {
|
|
110
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
115
111
|
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
112
|
if (y = 0, t) op = [
|
|
117
113
|
op[0] & 2,
|
|
@@ -200,13 +196,12 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
200
196
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
201
197
|
args[_key - 2] = arguments[_key];
|
|
202
198
|
}
|
|
203
|
-
var _this = this;
|
|
204
199
|
return _async_to_generator(function() {
|
|
205
200
|
var action, _action_func, result, e;
|
|
206
201
|
return _ts_generator(this, function(_state) {
|
|
207
202
|
switch(_state.label){
|
|
208
203
|
case 0:
|
|
209
|
-
action =
|
|
204
|
+
action = this.actionMap.get(name);
|
|
210
205
|
if (!action) {
|
|
211
206
|
return [
|
|
212
207
|
2
|
|
@@ -248,7 +243,7 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
248
243
|
];
|
|
249
244
|
}
|
|
250
245
|
});
|
|
251
|
-
})();
|
|
246
|
+
}).call(this);
|
|
252
247
|
}
|
|
253
248
|
},
|
|
254
249
|
{
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t,
|
|
63
|
+
var f, y, t, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,12 +68,8 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
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() {
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
73
|
return this;
|
|
78
74
|
}), g;
|
|
79
75
|
function verb(n) {
|
|
@@ -86,7 +82,7 @@ function _ts_generator(thisArg, body) {
|
|
|
86
82
|
}
|
|
87
83
|
function step(op) {
|
|
88
84
|
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
90
86
|
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
87
|
if (y = 0, t) op = [
|
|
92
88
|
op[0] & 2,
|
|
@@ -186,10 +182,10 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
186
182
|
{
|
|
187
183
|
key: "getRemoteData",
|
|
188
184
|
value: function getRemoteData(payload) {
|
|
189
|
-
var _this = this;
|
|
190
185
|
return _async_to_generator(function() {
|
|
191
186
|
return _ts_generator(this, function(_state) {
|
|
192
|
-
if (
|
|
187
|
+
if (this.executer === undefined) {
|
|
188
|
+
// @i18n-translate-ignore
|
|
193
189
|
logerror('未初始化executer');
|
|
194
190
|
return [
|
|
195
191
|
2,
|
|
@@ -198,14 +194,14 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
198
194
|
} else {
|
|
199
195
|
return [
|
|
200
196
|
2,
|
|
201
|
-
|
|
197
|
+
this.executer(payload)
|
|
202
198
|
];
|
|
203
199
|
}
|
|
204
200
|
return [
|
|
205
201
|
2
|
|
206
202
|
];
|
|
207
203
|
});
|
|
208
|
-
})();
|
|
204
|
+
}).call(this);
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
207
|
]);
|
|
@@ -234,7 +234,7 @@ function _is_native_reflect_construct() {
|
|
|
234
234
|
})();
|
|
235
235
|
}
|
|
236
236
|
function _ts_generator(thisArg, body) {
|
|
237
|
-
var f, y, t,
|
|
237
|
+
var f, y, t, _ = {
|
|
238
238
|
label: 0,
|
|
239
239
|
sent: function() {
|
|
240
240
|
if (t[0] & 1) throw t[1];
|
|
@@ -242,12 +242,8 @@ function _ts_generator(thisArg, body) {
|
|
|
242
242
|
},
|
|
243
243
|
trys: [],
|
|
244
244
|
ops: []
|
|
245
|
-
};
|
|
246
|
-
return g = {
|
|
247
|
-
next: verb(0),
|
|
248
|
-
"throw": verb(1),
|
|
249
|
-
"return": verb(2)
|
|
250
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
245
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
246
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
251
247
|
return this;
|
|
252
248
|
}), g;
|
|
253
249
|
function verb(n) {
|
|
@@ -260,7 +256,7 @@ function _ts_generator(thisArg, body) {
|
|
|
260
256
|
}
|
|
261
257
|
function step(op) {
|
|
262
258
|
if (f) throw new TypeError("Generator is already executing.");
|
|
263
|
-
while(_)try {
|
|
259
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
264
260
|
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;
|
|
265
261
|
if (y = 0, t) op = [
|
|
266
262
|
op[0] & 2,
|
|
@@ -329,7 +325,7 @@ function _ts_generator(thisArg, body) {
|
|
|
329
325
|
}
|
|
330
326
|
}
|
|
331
327
|
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
332
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log,
|
|
328
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
|
|
333
329
|
import { Runtime } from './Runtime';
|
|
334
330
|
import { Store } from './Store';
|
|
335
331
|
import { findItem, proxyState } from './proxyState';
|
|
@@ -360,7 +356,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
360
356
|
_this.$options = Object.freeze(props);
|
|
361
357
|
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
|
|
362
358
|
language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug, messagesI18n = _this_$options.messagesI18n, children = _this_$options.children;
|
|
363
|
-
RulesMessage.setLocale(language, messagesI18n);
|
|
364
359
|
_this.debug = debug;
|
|
365
360
|
_this.runtime = new Runtime({
|
|
366
361
|
schema: schema,
|
|
@@ -410,6 +405,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
410
405
|
{
|
|
411
406
|
key: "mount",
|
|
412
407
|
value: function mount() {
|
|
408
|
+
// @i18n-translate-ignore
|
|
413
409
|
this.debugLog("engine的mount方法开始调用");
|
|
414
410
|
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
415
411
|
this._handlerProxyState();
|
|
@@ -417,6 +413,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
417
413
|
this.applyPlugins();
|
|
418
414
|
// 触发所有控件的默认值的change事件
|
|
419
415
|
this.setStates(this.getState());
|
|
416
|
+
// @i18n-translate-ignore
|
|
420
417
|
this.debugLog("engine的mount方法调用结束");
|
|
421
418
|
if (this.debug && typeof window !== 'undefined') {
|
|
422
419
|
// @ts-ignore
|
|
@@ -779,19 +776,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
779
776
|
3,
|
|
780
777
|
3
|
|
781
778
|
];
|
|
782
|
-
if (
|
|
779
|
+
if (this.isMounted) {
|
|
783
780
|
warn('The engine-mounted life cycle can only be triggered once');
|
|
784
781
|
return [
|
|
785
782
|
2,
|
|
786
783
|
Promise.resolve([])
|
|
787
784
|
];
|
|
788
785
|
}
|
|
789
|
-
if (!
|
|
786
|
+
if (!this._jobTasks.length) return [
|
|
790
787
|
3,
|
|
791
788
|
2
|
|
792
789
|
];
|
|
793
790
|
console.time('engine-mounted need wait');
|
|
794
|
-
needWait = _to_consumable_array(
|
|
791
|
+
needWait = _to_consumable_array(this._jobTasks);
|
|
795
792
|
return [
|
|
796
793
|
4,
|
|
797
794
|
Promise.all(needWait)
|
|
@@ -801,15 +798,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
801
798
|
console.timeEnd('engine-mounted need wait');
|
|
802
799
|
_state.label = 2;
|
|
803
800
|
case 2:
|
|
804
|
-
|
|
801
|
+
this.isMounted = true;
|
|
805
802
|
_state.label = 3;
|
|
806
803
|
case 3:
|
|
807
804
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
808
|
-
if (!
|
|
805
|
+
if (!this.isMounted) {
|
|
809
806
|
promise = new Promise(function(resolve) {
|
|
810
807
|
promiseResolver = resolve;
|
|
811
808
|
});
|
|
812
|
-
|
|
809
|
+
this._jobTasks.push(promise);
|
|
813
810
|
}
|
|
814
811
|
return [
|
|
815
812
|
4,
|
|
@@ -820,7 +817,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
820
817
|
if (promiseResolver && promise) {
|
|
821
818
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
822
819
|
promiseResolver();
|
|
823
|
-
|
|
820
|
+
this._jobTasks.splice(this._jobTasks.indexOf(promise), 1);
|
|
824
821
|
}
|
|
825
822
|
return [
|
|
826
823
|
2,
|
|
@@ -828,7 +825,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
828
825
|
];
|
|
829
826
|
}
|
|
830
827
|
});
|
|
831
|
-
})();
|
|
828
|
+
}).call(this);
|
|
832
829
|
}
|
|
833
830
|
},
|
|
834
831
|
{
|
|
@@ -963,8 +960,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
963
960
|
key: "setState",
|
|
964
961
|
value: function setState(controlId, value, rowIndex, options) {
|
|
965
962
|
eventOptionsTemp = options;
|
|
963
|
+
// @i18n-translate-ignore
|
|
966
964
|
this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
|
|
967
965
|
this.store.setState(controlId, value, rowIndex);
|
|
966
|
+
// @i18n-translate-ignore
|
|
968
967
|
this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
|
|
969
968
|
eventOptionsTemp = null;
|
|
970
969
|
}
|
|
@@ -1249,6 +1248,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1249
1248
|
*/ key: "setData",
|
|
1250
1249
|
value: function setData(dataSet, options) {
|
|
1251
1250
|
var _this = this;
|
|
1251
|
+
// @i18n-translate-ignore
|
|
1252
1252
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1253
1253
|
var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
|
|
1254
1254
|
var newState = this.store.defaultState;
|
|
@@ -1370,15 +1370,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
});
|
|
1373
|
+
// @i18n-translate-ignore
|
|
1373
1374
|
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1374
1375
|
}
|
|
1375
1376
|
}
|
|
1376
1377
|
});
|
|
1378
|
+
// @i18n-translate-ignore
|
|
1377
1379
|
this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
|
|
1378
1380
|
this.setStates(newState, undefined, _object_spread({
|
|
1379
1381
|
setData: true
|
|
1380
1382
|
}, options));
|
|
1381
1383
|
this.runtime.getFlatInstances();
|
|
1384
|
+
// @i18n-translate-ignore
|
|
1382
1385
|
this.debugLog("engine setData方法执行完成。");
|
|
1383
1386
|
}
|
|
1384
1387
|
},
|
|
@@ -1509,6 +1512,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1509
1512
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1510
1513
|
instances.map(function(_instance) {
|
|
1511
1514
|
if (_instance) {
|
|
1515
|
+
// @i18n-translate-ignore
|
|
1512
1516
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1513
1517
|
updateValueFromKeys(_instance.props, props, value);
|
|
1514
1518
|
_this.schemaEvent('schema-change', {
|
|
@@ -1529,6 +1533,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1529
1533
|
if (!_instance) {
|
|
1530
1534
|
return;
|
|
1531
1535
|
}
|
|
1536
|
+
// @i18n-translate-ignore
|
|
1532
1537
|
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1533
1538
|
updateValueFromKeys(_instance.props, props, value);
|
|
1534
1539
|
this.schemaEvent('schema-change', {
|
|
@@ -61,15 +61,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
61
61
|
}
|
|
62
62
|
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
63
63
|
import { format } from 'mathjs';
|
|
64
|
-
var DisplayType
|
|
65
|
-
(function(DisplayType) {
|
|
64
|
+
var DisplayType = /*#__PURE__*/ function(DisplayType) {
|
|
66
65
|
/**
|
|
67
66
|
* 完全等于
|
|
68
67
|
*/ DisplayType["EQ"] = "EQ";
|
|
69
68
|
/**
|
|
70
69
|
* 包含
|
|
71
70
|
* */ DisplayType["IN"] = "IN";
|
|
72
|
-
|
|
71
|
+
return DisplayType;
|
|
72
|
+
}(DisplayType || {});
|
|
73
73
|
export var CalcPlugin = /*#__PURE__*/ function() {
|
|
74
74
|
"use strict";
|
|
75
75
|
function CalcPlugin(options) {
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t,
|
|
63
|
+
var f, y, t, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,12 +68,8 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
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() {
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
73
|
return this;
|
|
78
74
|
}), g;
|
|
79
75
|
function verb(n) {
|
|
@@ -86,7 +82,7 @@ function _ts_generator(thisArg, body) {
|
|
|
86
82
|
}
|
|
87
83
|
function step(op) {
|
|
88
84
|
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
90
86
|
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
87
|
if (y = 0, t) op = [
|
|
92
88
|
op[0] & 2,
|
|
@@ -217,13 +213,13 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
217
213
|
key: "engineAddEventListener",
|
|
218
214
|
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
219
215
|
var _this = this;
|
|
220
|
-
this.engine.on(eventKey,
|
|
221
|
-
|
|
216
|
+
this.engine.on(eventKey, function(payload) {
|
|
217
|
+
return _async_to_generator(function() {
|
|
222
218
|
return _ts_generator(this, function(_state) {
|
|
223
219
|
switch(_state.label){
|
|
224
220
|
case 0:
|
|
225
221
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
226
|
-
if ((eventKey === 'change' || eventKey === 'list-change') && !
|
|
222
|
+
if ((eventKey === 'change' || eventKey === 'list-change') && !this.engine.isMounted) {
|
|
227
223
|
return [
|
|
228
224
|
2
|
|
229
225
|
];
|
|
@@ -234,7 +230,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
234
230
|
];
|
|
235
231
|
return [
|
|
236
232
|
4,
|
|
237
|
-
|
|
233
|
+
this.callControlEvent(controlEventKey, payload)
|
|
238
234
|
];
|
|
239
235
|
case 1:
|
|
240
236
|
return [
|
|
@@ -247,23 +243,20 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
247
243
|
];
|
|
248
244
|
}
|
|
249
245
|
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return _ref.apply(this, arguments);
|
|
253
|
-
};
|
|
254
|
-
}());
|
|
246
|
+
}).call(_this);
|
|
247
|
+
});
|
|
255
248
|
}
|
|
256
249
|
},
|
|
257
250
|
{
|
|
258
251
|
key: "callControlEvent",
|
|
259
252
|
value: function callControlEvent(name, payload) {
|
|
260
|
-
var _this = this;
|
|
261
253
|
return _async_to_generator(function() {
|
|
262
|
-
var events, result;
|
|
254
|
+
var _this, events, result;
|
|
263
255
|
return _ts_generator(this, function(_state) {
|
|
264
256
|
switch(_state.label){
|
|
265
257
|
case 0:
|
|
266
|
-
|
|
258
|
+
_this = this;
|
|
259
|
+
events = this.config[payload.instance.id];
|
|
267
260
|
if (!events || !Array.isArray(events[name])) {
|
|
268
261
|
return [
|
|
269
262
|
2,
|
|
@@ -272,15 +265,15 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
272
265
|
}
|
|
273
266
|
return [
|
|
274
267
|
4,
|
|
275
|
-
Promise.all(events[name].map(
|
|
276
|
-
|
|
268
|
+
Promise.all(events[name].map(function(eventName) {
|
|
269
|
+
return _async_to_generator(function() {
|
|
277
270
|
var execResult;
|
|
278
271
|
return _ts_generator(this, function(_state) {
|
|
279
272
|
switch(_state.label){
|
|
280
273
|
case 0:
|
|
281
274
|
return [
|
|
282
275
|
4,
|
|
283
|
-
|
|
276
|
+
this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
284
277
|
// this.engine,
|
|
285
278
|
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
286
279
|
payload)
|
|
@@ -293,11 +286,8 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
293
286
|
];
|
|
294
287
|
}
|
|
295
288
|
});
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
return _ref.apply(this, arguments);
|
|
299
|
-
};
|
|
300
|
-
}()))
|
|
289
|
+
}).call(_this);
|
|
290
|
+
}))
|
|
301
291
|
];
|
|
302
292
|
case 1:
|
|
303
293
|
result = _state.sent();
|
|
@@ -317,7 +307,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
317
307
|
];
|
|
318
308
|
}
|
|
319
309
|
});
|
|
320
|
-
})();
|
|
310
|
+
}).call(this);
|
|
321
311
|
}
|
|
322
312
|
}
|
|
323
313
|
]);
|
|
@@ -106,7 +106,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
106
106
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
107
107
|
}
|
|
108
108
|
function _ts_generator(thisArg, body) {
|
|
109
|
-
var f, y, t,
|
|
109
|
+
var f, y, t, _ = {
|
|
110
110
|
label: 0,
|
|
111
111
|
sent: function() {
|
|
112
112
|
if (t[0] & 1) throw t[1];
|
|
@@ -114,12 +114,8 @@ function _ts_generator(thisArg, body) {
|
|
|
114
114
|
},
|
|
115
115
|
trys: [],
|
|
116
116
|
ops: []
|
|
117
|
-
};
|
|
118
|
-
return g = {
|
|
119
|
-
next: verb(0),
|
|
120
|
-
"throw": verb(1),
|
|
121
|
-
"return": verb(2)
|
|
122
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
117
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
118
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
123
119
|
return this;
|
|
124
120
|
}), g;
|
|
125
121
|
function verb(n) {
|
|
@@ -132,7 +128,7 @@ function _ts_generator(thisArg, body) {
|
|
|
132
128
|
}
|
|
133
129
|
function step(op) {
|
|
134
130
|
if (f) throw new TypeError("Generator is already executing.");
|
|
135
|
-
while(_)try {
|
|
131
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
136
132
|
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;
|
|
137
133
|
if (y = 0, t) op = [
|
|
138
134
|
op[0] & 2,
|
|
@@ -223,16 +219,15 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
223
219
|
this.engine = engine;
|
|
224
220
|
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
225
221
|
var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var _ref = _async_to_generator(function(payload) {
|
|
222
|
+
engine.on(engineKey, function(payload) {
|
|
223
|
+
return _async_to_generator(function() {
|
|
229
224
|
var result;
|
|
230
225
|
return _ts_generator(this, function(_state) {
|
|
231
226
|
switch(_state.label){
|
|
232
227
|
case 0:
|
|
233
228
|
return [
|
|
234
229
|
4,
|
|
235
|
-
|
|
230
|
+
this.callLifecycleEvent(lifecycleKey, payload)
|
|
236
231
|
];
|
|
237
232
|
case 1:
|
|
238
233
|
result = _state.sent();
|
|
@@ -252,24 +247,21 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
252
247
|
];
|
|
253
248
|
}
|
|
254
249
|
});
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
return _ref.apply(this, arguments);
|
|
258
|
-
};
|
|
259
|
-
}());
|
|
250
|
+
}).call(_this);
|
|
251
|
+
});
|
|
260
252
|
});
|
|
261
253
|
}
|
|
262
254
|
},
|
|
263
255
|
{
|
|
264
256
|
key: "callLifecycleEvent",
|
|
265
257
|
value: function callLifecycleEvent(name, payload) {
|
|
266
|
-
var _this = this;
|
|
267
258
|
return _async_to_generator(function() {
|
|
268
|
-
var events, result;
|
|
259
|
+
var _this, events, result;
|
|
269
260
|
return _ts_generator(this, function(_state) {
|
|
270
261
|
switch(_state.label){
|
|
271
262
|
case 0:
|
|
272
|
-
|
|
263
|
+
_this = this;
|
|
264
|
+
events = this.config;
|
|
273
265
|
if (!events || !Array.isArray(events[name])) {
|
|
274
266
|
return [
|
|
275
267
|
2,
|
|
@@ -278,15 +270,15 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
278
270
|
}
|
|
279
271
|
return [
|
|
280
272
|
4,
|
|
281
|
-
Promise.all(events[name].map(
|
|
282
|
-
|
|
273
|
+
Promise.all(events[name].map(function(eventName) {
|
|
274
|
+
return _async_to_generator(function() {
|
|
283
275
|
var execResult;
|
|
284
276
|
return _ts_generator(this, function(_state) {
|
|
285
277
|
switch(_state.label){
|
|
286
278
|
case 0:
|
|
287
279
|
return [
|
|
288
280
|
4,
|
|
289
|
-
|
|
281
|
+
this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
290
282
|
// this.engine,
|
|
291
283
|
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
292
284
|
payload)
|
|
@@ -299,11 +291,8 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
299
291
|
];
|
|
300
292
|
}
|
|
301
293
|
});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
return _ref.apply(this, arguments);
|
|
305
|
-
};
|
|
306
|
-
}()))
|
|
294
|
+
}).call(_this);
|
|
295
|
+
}))
|
|
307
296
|
];
|
|
308
297
|
case 1:
|
|
309
298
|
result = _state.sent();
|
|
@@ -313,7 +302,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
313
302
|
];
|
|
314
303
|
}
|
|
315
304
|
});
|
|
316
|
-
})();
|
|
305
|
+
}).call(this);
|
|
317
306
|
}
|
|
318
307
|
}
|
|
319
308
|
]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
|
|
3
3
|
* @Date: 2022-04-15 14:06:03
|
|
4
4
|
* @LastEditors: SuperLuckyqi
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2025-04-10 10:23:07
|
|
6
6
|
* @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
|
|
7
7
|
*/ function _class_call_check(instance, Constructor) {
|
|
8
8
|
if (!(instance instanceof Constructor)) {
|
|
@@ -61,7 +61,7 @@ export var StylePlugin = /*#__PURE__*/ function() {
|
|
|
61
61
|
dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
|
|
62
62
|
var cssStyleText;
|
|
63
63
|
if (this.isPc) {
|
|
64
|
-
cssStyleText = "
|
|
64
|
+
cssStyleText = ".render-engine-".concat(engine.id, "{ ").concat(compiledStyle, " }");
|
|
65
65
|
} else {
|
|
66
66
|
cssStyleText = compiledStyle;
|
|
67
67
|
}
|