@byteluck-fe/model-driven-engine 2.22.3-beta.8 → 2.22.4-beta.10
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 +22 -16
- 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 +9 -8
- package/dist/index.umd.js +41 -9
- package/package.json +9 -6
|
@@ -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,
|
|
@@ -409,6 +405,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
409
405
|
{
|
|
410
406
|
key: "mount",
|
|
411
407
|
value: function mount() {
|
|
408
|
+
// @i18n-translate-ignore
|
|
412
409
|
this.debugLog("engine的mount方法开始调用");
|
|
413
410
|
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
414
411
|
this._handlerProxyState();
|
|
@@ -416,6 +413,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
416
413
|
this.applyPlugins();
|
|
417
414
|
// 触发所有控件的默认值的change事件
|
|
418
415
|
this.setStates(this.getState());
|
|
416
|
+
// @i18n-translate-ignore
|
|
419
417
|
this.debugLog("engine的mount方法调用结束");
|
|
420
418
|
if (this.debug && typeof window !== 'undefined') {
|
|
421
419
|
// @ts-ignore
|
|
@@ -778,19 +776,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
778
776
|
3,
|
|
779
777
|
3
|
|
780
778
|
];
|
|
781
|
-
if (
|
|
779
|
+
if (this.isMounted) {
|
|
782
780
|
warn('The engine-mounted life cycle can only be triggered once');
|
|
783
781
|
return [
|
|
784
782
|
2,
|
|
785
783
|
Promise.resolve([])
|
|
786
784
|
];
|
|
787
785
|
}
|
|
788
|
-
if (!
|
|
786
|
+
if (!this._jobTasks.length) return [
|
|
789
787
|
3,
|
|
790
788
|
2
|
|
791
789
|
];
|
|
792
790
|
console.time('engine-mounted need wait');
|
|
793
|
-
needWait = _to_consumable_array(
|
|
791
|
+
needWait = _to_consumable_array(this._jobTasks);
|
|
794
792
|
return [
|
|
795
793
|
4,
|
|
796
794
|
Promise.all(needWait)
|
|
@@ -800,15 +798,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
800
798
|
console.timeEnd('engine-mounted need wait');
|
|
801
799
|
_state.label = 2;
|
|
802
800
|
case 2:
|
|
803
|
-
|
|
801
|
+
this.isMounted = true;
|
|
804
802
|
_state.label = 3;
|
|
805
803
|
case 3:
|
|
806
804
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
807
|
-
if (!
|
|
805
|
+
if (!this.isMounted) {
|
|
808
806
|
promise = new Promise(function(resolve) {
|
|
809
807
|
promiseResolver = resolve;
|
|
810
808
|
});
|
|
811
|
-
|
|
809
|
+
this._jobTasks.push(promise);
|
|
812
810
|
}
|
|
813
811
|
return [
|
|
814
812
|
4,
|
|
@@ -819,7 +817,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
819
817
|
if (promiseResolver && promise) {
|
|
820
818
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
821
819
|
promiseResolver();
|
|
822
|
-
|
|
820
|
+
this._jobTasks.splice(this._jobTasks.indexOf(promise), 1);
|
|
823
821
|
}
|
|
824
822
|
return [
|
|
825
823
|
2,
|
|
@@ -827,7 +825,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
827
825
|
];
|
|
828
826
|
}
|
|
829
827
|
});
|
|
830
|
-
})();
|
|
828
|
+
}).call(this);
|
|
831
829
|
}
|
|
832
830
|
},
|
|
833
831
|
{
|
|
@@ -962,8 +960,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
962
960
|
key: "setState",
|
|
963
961
|
value: function setState(controlId, value, rowIndex, options) {
|
|
964
962
|
eventOptionsTemp = options;
|
|
963
|
+
// @i18n-translate-ignore
|
|
965
964
|
this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
|
|
966
965
|
this.store.setState(controlId, value, rowIndex);
|
|
966
|
+
// @i18n-translate-ignore
|
|
967
967
|
this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
|
|
968
968
|
eventOptionsTemp = null;
|
|
969
969
|
}
|
|
@@ -1248,6 +1248,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1248
1248
|
*/ key: "setData",
|
|
1249
1249
|
value: function setData(dataSet, options) {
|
|
1250
1250
|
var _this = this;
|
|
1251
|
+
// @i18n-translate-ignore
|
|
1251
1252
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1252
1253
|
var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
|
|
1253
1254
|
var newState = this.store.defaultState;
|
|
@@ -1369,15 +1370,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1369
1370
|
}
|
|
1370
1371
|
}
|
|
1371
1372
|
});
|
|
1373
|
+
// @i18n-translate-ignore
|
|
1372
1374
|
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1373
1375
|
}
|
|
1374
1376
|
}
|
|
1375
1377
|
});
|
|
1378
|
+
// @i18n-translate-ignore
|
|
1376
1379
|
this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
|
|
1377
1380
|
this.setStates(newState, undefined, _object_spread({
|
|
1378
1381
|
setData: true
|
|
1379
1382
|
}, options));
|
|
1380
1383
|
this.runtime.getFlatInstances();
|
|
1384
|
+
// @i18n-translate-ignore
|
|
1381
1385
|
this.debugLog("engine setData方法执行完成。");
|
|
1382
1386
|
}
|
|
1383
1387
|
},
|
|
@@ -1508,6 +1512,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1508
1512
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1509
1513
|
instances.map(function(_instance) {
|
|
1510
1514
|
if (_instance) {
|
|
1515
|
+
// @i18n-translate-ignore
|
|
1511
1516
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1512
1517
|
updateValueFromKeys(_instance.props, props, value);
|
|
1513
1518
|
_this.schemaEvent('schema-change', {
|
|
@@ -1528,6 +1533,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1528
1533
|
if (!_instance) {
|
|
1529
1534
|
return;
|
|
1530
1535
|
}
|
|
1536
|
+
// @i18n-translate-ignore
|
|
1531
1537
|
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1532
1538
|
updateValueFromKeys(_instance.props, props, value);
|
|
1533
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)) {
|
|
@@ -36,6 +36,8 @@ function _define_property(obj, key, value) {
|
|
|
36
36
|
}
|
|
37
37
|
return obj;
|
|
38
38
|
}
|
|
39
|
+
import postcss from 'postcss';
|
|
40
|
+
import prefixSelector from 'postcss-prefix-selector';
|
|
39
41
|
export var StylePlugin = /*#__PURE__*/ function() {
|
|
40
42
|
"use strict";
|
|
41
43
|
function StylePlugin(config) {
|
|
@@ -51,7 +53,7 @@ export var StylePlugin = /*#__PURE__*/ function() {
|
|
|
51
53
|
{
|
|
52
54
|
key: "apply",
|
|
53
55
|
value: function apply(engine) {
|
|
54
|
-
var _this_config;
|
|
56
|
+
var _this_config, _this_engine;
|
|
55
57
|
this.engine = engine;
|
|
56
58
|
var _this_config_source;
|
|
57
59
|
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 : '';
|
|
@@ -59,12 +61,11 @@ export var StylePlugin = /*#__PURE__*/ function() {
|
|
|
59
61
|
style.className = 'edit-css-' + engine.id;
|
|
60
62
|
var dom = document.querySelector('head');
|
|
61
63
|
dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
|
|
62
|
-
var cssStyleText
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
64
|
+
var cssStyleText = postcss([
|
|
65
|
+
prefixSelector({
|
|
66
|
+
prefix: ".render-engine-".concat((_this_engine = this.engine) === null || _this_engine === void 0 ? void 0 : _this_engine.id)
|
|
67
|
+
})
|
|
68
|
+
]).process(compiledStyle).css;
|
|
68
69
|
style.appendChild(document.createTextNode(cssStyleText));
|
|
69
70
|
}
|
|
70
71
|
}
|