@byteluck-fe/model-driven-engine 2.22.2-beta.1 → 2.22.2-beta.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/README.md +30 -30
- package/dist/esm/common/ActionManager.js +7 -7
- package/dist/esm/common/DataManager.js +2 -2
- package/dist/esm/common/Engine.js +130 -124
- package/dist/esm/common/OkWorker.js +8 -8
- package/dist/esm/common/Runtime.js +17 -17
- package/dist/esm/common/Store.js +13 -13
- package/dist/esm/common/checkerValue.js +22 -22
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +52 -56
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +57 -61
- package/dist/esm/plugins/ControlsEventPlugin.js +4 -4
- package/dist/esm/plugins/ES6ModulePlugin.js +6 -6
- package/dist/esm/plugins/LifecycleEventPlugin.js +5 -5
- package/dist/esm/plugins/StylePlugin.js +10 -10
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +3 -3
- package/dist/index.umd.js +25 -25
- 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 +201 -195
- 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 +31 -31
- package/dist/types/common/Store.d.ts +54 -54
- 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 +17 -17
- package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
- package/dist/types/plugins/StylePlugin.d.ts +13 -13
- 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 +2 -2
|
@@ -47,10 +47,6 @@ function _non_iterable_spread() {
|
|
|
47
47
|
function _to_consumable_array(arr) {
|
|
48
48
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
49
49
|
}
|
|
50
|
-
function _type_of(obj) {
|
|
51
|
-
"@swc/helpers - typeof";
|
|
52
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
53
|
-
}
|
|
54
50
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
55
51
|
if (!o) return;
|
|
56
52
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -59,15 +55,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
59
55
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
60
56
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
61
57
|
}
|
|
62
|
-
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from
|
|
63
|
-
import { format } from
|
|
58
|
+
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
59
|
+
import { format } from "mathjs";
|
|
64
60
|
var DisplayType;
|
|
65
61
|
(function(DisplayType) {
|
|
66
|
-
/**
|
|
67
|
-
* 完全等于
|
|
62
|
+
/**
|
|
63
|
+
* 完全等于
|
|
68
64
|
*/ DisplayType["EQ"] = "EQ";
|
|
69
|
-
/**
|
|
70
|
-
* 包含
|
|
65
|
+
/**
|
|
66
|
+
* 包含
|
|
71
67
|
* */ DisplayType["IN"] = "IN";
|
|
72
68
|
})(DisplayType || (DisplayType = {}));
|
|
73
69
|
export var CalcPlugin = /*#__PURE__*/ function() {
|
|
@@ -76,16 +72,16 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
76
72
|
_class_call_check(this, CalcPlugin);
|
|
77
73
|
_define_property(this, "engine", void 0);
|
|
78
74
|
_define_property(this, "options", void 0);
|
|
79
|
-
/**
|
|
80
|
-
* 所有的计算公式控件
|
|
75
|
+
/**
|
|
76
|
+
* 所有的计算公式控件
|
|
81
77
|
* */ // @ts-ignore
|
|
82
78
|
_define_property(this, "calcControls", []);
|
|
83
|
-
/**
|
|
84
|
-
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
85
|
-
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
79
|
+
/**
|
|
80
|
+
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
81
|
+
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
86
82
|
* */ _define_property(this, "dependenciesTriggerMap", new Map());
|
|
87
|
-
/**
|
|
88
|
-
* 隐藏以后需要被计算的控件
|
|
83
|
+
/**
|
|
84
|
+
* 隐藏以后需要被计算的控件
|
|
89
85
|
* */ _define_property(this, "hideNotRememberControlIds", []);
|
|
90
86
|
_define_property(this, "dontHasPermissionControlIds", []);
|
|
91
87
|
_define_property(this, "cacheComputedResult", {});
|
|
@@ -96,8 +92,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
96
92
|
_create_class(CalcPlugin, [
|
|
97
93
|
{
|
|
98
94
|
key: "getNeedHideRememberControlIds",
|
|
99
|
-
value: /**
|
|
100
|
-
* @description 获取显隐控制的需要被记住值的控件id
|
|
95
|
+
value: /**
|
|
96
|
+
* @description 获取显隐控制的需要被记住值的控件id
|
|
101
97
|
* */ function getNeedHideRememberControlIds() {
|
|
102
98
|
var _this_options;
|
|
103
99
|
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
|
|
@@ -114,8 +110,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
114
110
|
},
|
|
115
111
|
{
|
|
116
112
|
key: "getDontHasPermissionControlIds",
|
|
117
|
-
value: /**
|
|
118
|
-
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
113
|
+
value: /**
|
|
114
|
+
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
119
115
|
* */ function getDontHasPermissionControlIds() {
|
|
120
116
|
var _this_options;
|
|
121
117
|
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
|
|
@@ -131,9 +127,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
131
127
|
},
|
|
132
128
|
{
|
|
133
129
|
key: "controlNeedComputedValue",
|
|
134
|
-
value: /**
|
|
135
|
-
* @description 判断控件是否需要被计算
|
|
136
|
-
* @param control 控件
|
|
130
|
+
value: /**
|
|
131
|
+
* @description 判断控件是否需要被计算
|
|
132
|
+
* @param control 控件
|
|
137
133
|
* */ function controlNeedComputedValue(control) {
|
|
138
134
|
if (!control) {
|
|
139
135
|
return false;
|
|
@@ -153,9 +149,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
153
149
|
},
|
|
154
150
|
{
|
|
155
151
|
key: "getControlIsHide",
|
|
156
|
-
value: /**
|
|
157
|
-
* @description 获取控件是否被隐藏
|
|
158
|
-
* @param control 控件
|
|
152
|
+
value: /**
|
|
153
|
+
* @description 获取控件是否被隐藏
|
|
154
|
+
* @param control 控件
|
|
159
155
|
* */ function getControlIsHide(control) {
|
|
160
156
|
if (control.props.isHide) {
|
|
161
157
|
return true;
|
|
@@ -174,7 +170,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
174
170
|
this.watchControlChange();
|
|
175
171
|
this.watchSubtableChange();
|
|
176
172
|
this.watchSchemaHideChange();
|
|
177
|
-
this.engine.on(
|
|
173
|
+
this.engine.on("engine-mounted", function() {
|
|
178
174
|
requestAnimationFrame(function() {
|
|
179
175
|
_this.resetDependencies();
|
|
180
176
|
_this.allCalcControlComputed();
|
|
@@ -184,8 +180,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
184
180
|
},
|
|
185
181
|
{
|
|
186
182
|
key: "resetDependencies",
|
|
187
|
-
value: /**
|
|
188
|
-
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
183
|
+
value: /**
|
|
184
|
+
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
189
185
|
* */ function resetDependencies() {
|
|
190
186
|
this.calcControls = [];
|
|
191
187
|
this.dependenciesTriggerMap.clear();
|
|
@@ -195,8 +191,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
195
191
|
},
|
|
196
192
|
{
|
|
197
193
|
key: "allCalcControlComputed",
|
|
198
|
-
value: /**
|
|
199
|
-
* @description 执行所有计算公式控件的计算
|
|
194
|
+
value: /**
|
|
195
|
+
* @description 执行所有计算公式控件的计算
|
|
200
196
|
* */ function allCalcControlComputed() {
|
|
201
197
|
var _this = this;
|
|
202
198
|
this.calcControls.forEach(function(item) {
|
|
@@ -210,8 +206,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
210
206
|
},
|
|
211
207
|
{
|
|
212
208
|
key: "getAllCalcControl",
|
|
213
|
-
value: /**
|
|
214
|
-
* @description 获取所有的计算公式控件
|
|
209
|
+
value: /**
|
|
210
|
+
* @description 获取所有的计算公式控件
|
|
215
211
|
* */ function getAllCalcControl() {
|
|
216
212
|
this.calcControls = this.engine.runtime.flatInstances.filter(// @ts-ignore
|
|
217
213
|
function(item) {
|
|
@@ -221,8 +217,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
221
217
|
},
|
|
222
218
|
{
|
|
223
219
|
key: "getCalcDependencies",
|
|
224
|
-
value: /**
|
|
225
|
-
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
220
|
+
value: /**
|
|
221
|
+
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
226
222
|
* */ function getCalcDependencies() {
|
|
227
223
|
var _this = this;
|
|
228
224
|
this.calcControls.forEach(function(item) {
|
|
@@ -274,12 +270,12 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
274
270
|
},
|
|
275
271
|
{
|
|
276
272
|
key: "watchSchemaHideChange",
|
|
277
|
-
value: /**
|
|
278
|
-
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
273
|
+
value: /**
|
|
274
|
+
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
279
275
|
* */ function watchSchemaHideChange() {
|
|
280
276
|
var _this = this;
|
|
281
|
-
this.engine.on(
|
|
282
|
-
if (payload.props ===
|
|
277
|
+
this.engine.on("schema-change", function(payload) {
|
|
278
|
+
if (payload.props === "isHide") {
|
|
283
279
|
var _this_dependenciesTriggerMap_get;
|
|
284
280
|
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
285
281
|
calcControls.forEach(function(calc) {
|
|
@@ -291,11 +287,11 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
291
287
|
},
|
|
292
288
|
{
|
|
293
289
|
key: "watchSubtableChange",
|
|
294
|
-
value: /**
|
|
295
|
-
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
290
|
+
value: /**
|
|
291
|
+
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
296
292
|
* */ function watchSubtableChange() {
|
|
297
293
|
var _this = this;
|
|
298
|
-
this.engine.on(
|
|
294
|
+
this.engine.on("list-change", function(payload) {
|
|
299
295
|
var _payload_options;
|
|
300
296
|
// 初始化前是批量操作。不做处理
|
|
301
297
|
if (_this.engine.isMounted === false) return;
|
|
@@ -319,11 +315,11 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
319
315
|
},
|
|
320
316
|
{
|
|
321
317
|
key: "watchControlChange",
|
|
322
|
-
value: /**
|
|
323
|
-
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
318
|
+
value: /**
|
|
319
|
+
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
324
320
|
* */ function watchControlChange() {
|
|
325
321
|
var _this = this;
|
|
326
|
-
this.engine.on(
|
|
322
|
+
this.engine.on("change", function(payload) {
|
|
327
323
|
// 初始化前是批量操作。不做处理
|
|
328
324
|
if (_this.engine.isMounted === false) return;
|
|
329
325
|
var instance = payload.instance;
|
|
@@ -355,8 +351,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
355
351
|
},
|
|
356
352
|
{
|
|
357
353
|
key: "controlInSubtable",
|
|
358
|
-
value: /**
|
|
359
|
-
* @description 控件在明细子表内
|
|
354
|
+
value: /**
|
|
355
|
+
* @description 控件在明细子表内
|
|
360
356
|
* */ function controlInSubtable(control) {
|
|
361
357
|
var _control_parent;
|
|
362
358
|
return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
|
|
@@ -364,8 +360,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
364
360
|
},
|
|
365
361
|
{
|
|
366
362
|
key: "computedCalcValue",
|
|
367
|
-
value: /**
|
|
368
|
-
* @description 执行计算公式的计算
|
|
363
|
+
value: /**
|
|
364
|
+
* @description 执行计算公式的计算
|
|
369
365
|
* */ // @ts-ignore
|
|
370
366
|
function computedCalcValue(control) {
|
|
371
367
|
var _this = this;
|
|
@@ -420,7 +416,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
420
416
|
result += 0;
|
|
421
417
|
}
|
|
422
418
|
return result;
|
|
423
|
-
},
|
|
419
|
+
}, "");
|
|
424
420
|
var value;
|
|
425
421
|
// 有缓存的话取缓存,没有缓存再执行eval
|
|
426
422
|
if (this.cacheComputedResult[scriptText] !== undefined) {
|
|
@@ -441,7 +437,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
441
437
|
}
|
|
442
438
|
}
|
|
443
439
|
var oldValue = this.engine.getState(control.id, rowIndex);
|
|
444
|
-
var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision ===
|
|
440
|
+
var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision === "" ? value : Number(value.toFixed(control.props.precision));
|
|
445
441
|
// 如果值没变的话,不触发修改
|
|
446
442
|
if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
|
|
447
443
|
return;
|
|
@@ -449,23 +445,23 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
449
445
|
var _oldValue_unit;
|
|
450
446
|
this.engine.setState(control.id, {
|
|
451
447
|
result: result,
|
|
452
|
-
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit :
|
|
448
|
+
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ""
|
|
453
449
|
}, rowIndex);
|
|
454
450
|
}
|
|
455
451
|
},
|
|
456
452
|
{
|
|
457
453
|
key: "getNumberValue",
|
|
458
|
-
value: /**
|
|
459
|
-
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
454
|
+
value: /**
|
|
455
|
+
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
460
456
|
* */ function getNumberValue(value) {
|
|
461
|
-
if (
|
|
462
|
-
if (
|
|
457
|
+
if (typeof value === "object" && value) {
|
|
458
|
+
if ("result" in value) {
|
|
463
459
|
return value.result;
|
|
464
|
-
} else if (
|
|
460
|
+
} else if ("amount" in value) {
|
|
465
461
|
return value.amount;
|
|
466
462
|
}
|
|
467
463
|
}
|
|
468
|
-
if (typeof value ===
|
|
464
|
+
if (typeof value === "number") {
|
|
469
465
|
return value;
|
|
470
466
|
}
|
|
471
467
|
return 0;
|
|
@@ -473,8 +469,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
473
469
|
},
|
|
474
470
|
{
|
|
475
471
|
key: "getAggregateTypeValue",
|
|
476
|
-
value: /**
|
|
477
|
-
* 计算明细子表最大值最小值平均值总和
|
|
472
|
+
value: /**
|
|
473
|
+
* 计算明细子表最大值最小值平均值总和
|
|
478
474
|
* */ function getAggregateTypeValue(values, type) {
|
|
479
475
|
if (!type || !values || !values.length) return 0;
|
|
480
476
|
switch(type){
|
|
@@ -154,7 +154,7 @@ function _ts_generator(thisArg, body) {
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
import { EventLogic } from
|
|
157
|
+
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
158
158
|
// type EventKeyMap = {
|
|
159
159
|
// [eventKey in EventKeys]?: string
|
|
160
160
|
// }
|
|
@@ -206,8 +206,8 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
206
206
|
//注册自定义组件事件
|
|
207
207
|
this.customEvents.map(function(item) {
|
|
208
208
|
var key = item.key;
|
|
209
|
-
if (item.namespace !== undefined && item.namespace !== null && item.namespace !==
|
|
210
|
-
key = item.namespace +
|
|
209
|
+
if (item.namespace !== undefined && item.namespace !== null && item.namespace !== "") {
|
|
210
|
+
key = item.namespace + ":" + item.key;
|
|
211
211
|
}
|
|
212
212
|
_this.engineAddEventListener(key, key);
|
|
213
213
|
});
|
|
@@ -223,7 +223,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
223
223
|
switch(_state.label){
|
|
224
224
|
case 0:
|
|
225
225
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
226
|
-
if ((eventKey ===
|
|
226
|
+
if ((eventKey === "change" || eventKey === "list-change") && !_this.engine.isMounted) {
|
|
227
227
|
return [
|
|
228
228
|
2
|
|
229
229
|
];
|
|
@@ -76,7 +76,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
76
76
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
77
77
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
78
78
|
}
|
|
79
|
-
import { error } from
|
|
79
|
+
import { error } from "@byteluck-fe/model-driven-shared";
|
|
80
80
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
81
81
|
"use strict";
|
|
82
82
|
function ES6ModulePlugin(config, env, eventJs) {
|
|
@@ -170,11 +170,11 @@ export function parseModule(action, engine, env) {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
try {
|
|
173
|
-
new Function(
|
|
173
|
+
new Function("module", "exports", compiled).call(module, module, module.exports);
|
|
174
174
|
} catch (e) {
|
|
175
|
-
error(e.message +
|
|
176
|
-
if (process.env.NODE_ENV !==
|
|
177
|
-
error(
|
|
175
|
+
error(e.message + ". fail to parse the module");
|
|
176
|
+
if (process.env.NODE_ENV !== "production") {
|
|
177
|
+
error("fail to parse the module");
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
var funcMap = {};
|
|
@@ -183,7 +183,7 @@ export function parseModule(action, engine, env) {
|
|
|
183
183
|
try {
|
|
184
184
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
185
185
|
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
186
|
-
if (typeof value ===
|
|
186
|
+
if (typeof value === "function") {
|
|
187
187
|
funcMap[key] = value;
|
|
188
188
|
} else {
|
|
189
189
|
variables[key] = value;
|
|
@@ -201,11 +201,11 @@ function _ts_generator(thisArg, body) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
var LifecycleEventKeyMap = {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
"engine-initialized": "did_init",
|
|
205
|
+
"engine-mounted": "did_mount",
|
|
206
|
+
"engine-submit": "will_submit",
|
|
207
|
+
"engine-submit-params": "do_submit",
|
|
208
|
+
"engine-submitted": "did_submit"
|
|
209
209
|
};
|
|
210
210
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
211
211
|
"use strict";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
|
|
3
|
-
* @Date: 2022-04-15 14:06:03
|
|
4
|
-
* @LastEditors: SuperLuckyqi
|
|
5
|
-
* @LastEditTime: 2024-07-24 11:38:32
|
|
6
|
-
* @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
|
|
1
|
+
/*
|
|
2
|
+
* @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
|
|
3
|
+
* @Date: 2022-04-15 14:06:03
|
|
4
|
+
* @LastEditors: SuperLuckyqi
|
|
5
|
+
* @LastEditTime: 2024-07-24 11:38:32
|
|
6
|
+
* @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
|
|
7
7
|
*/ function _class_call_check(instance, Constructor) {
|
|
8
8
|
if (!(instance instanceof Constructor)) {
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -54,10 +54,10 @@ export var StylePlugin = /*#__PURE__*/ function() {
|
|
|
54
54
|
var _this_config;
|
|
55
55
|
this.engine = engine;
|
|
56
56
|
var _this_config_source;
|
|
57
|
-
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 :
|
|
58
|
-
var style = document.createElement(
|
|
59
|
-
style.className =
|
|
60
|
-
var dom = document.querySelector(
|
|
57
|
+
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 : "";
|
|
58
|
+
var style = document.createElement("style");
|
|
59
|
+
style.className = "edit-css-" + engine.id;
|
|
60
|
+
var dom = document.querySelector("head");
|
|
61
61
|
dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
|
|
62
62
|
var cssStyleText;
|
|
63
63
|
if (this.isPc) {
|
|
@@ -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 || instance.controlType === CONTROL_BASE_TYPE.COLUMN && instance.type !== CONTROL_TYPE.OPERATION_COLUMN;
|
|
4
4
|
}
|
|
@@ -37,9 +37,9 @@ callback) {
|
|
|
37
37
|
var unique = 0;
|
|
38
38
|
// uuid生成
|
|
39
39
|
export function buildUUID() {
|
|
40
|
-
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
40
|
+
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
41
41
|
var time = Date.now();
|
|
42
42
|
var random = Math.floor(Math.random() * 1000000000);
|
|
43
43
|
unique++;
|
|
44
|
-
return prefix +
|
|
44
|
+
return prefix + "_" + random + unique + String(time);
|
|
45
45
|
}
|