@byteluck-fe/model-driven-engine 2.22.2-beta.3 → 2.22.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +106 -106
- 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 +56 -52
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +61 -57
- 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 -201
- 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 +4 -4
|
@@ -47,6 +47,10 @@ 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
|
+
}
|
|
50
54
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
51
55
|
if (!o) return;
|
|
52
56
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -55,15 +59,15 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
55
59
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
56
60
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
57
61
|
}
|
|
58
|
-
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from
|
|
59
|
-
import { format } from
|
|
62
|
+
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
63
|
+
import { format } from 'mathjs';
|
|
60
64
|
var DisplayType;
|
|
61
65
|
(function(DisplayType) {
|
|
62
|
-
/**
|
|
63
|
-
* 完全等于
|
|
66
|
+
/**
|
|
67
|
+
* 完全等于
|
|
64
68
|
*/ DisplayType["EQ"] = "EQ";
|
|
65
|
-
/**
|
|
66
|
-
* 包含
|
|
69
|
+
/**
|
|
70
|
+
* 包含
|
|
67
71
|
* */ DisplayType["IN"] = "IN";
|
|
68
72
|
})(DisplayType || (DisplayType = {}));
|
|
69
73
|
export var CalcPlugin = /*#__PURE__*/ function() {
|
|
@@ -72,16 +76,16 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
72
76
|
_class_call_check(this, CalcPlugin);
|
|
73
77
|
_define_property(this, "engine", void 0);
|
|
74
78
|
_define_property(this, "options", void 0);
|
|
75
|
-
/**
|
|
76
|
-
* 所有的计算公式控件
|
|
79
|
+
/**
|
|
80
|
+
* 所有的计算公式控件
|
|
77
81
|
* */ // @ts-ignore
|
|
78
82
|
_define_property(this, "calcControls", []);
|
|
79
|
-
/**
|
|
80
|
-
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
81
|
-
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
83
|
+
/**
|
|
84
|
+
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
85
|
+
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
82
86
|
* */ _define_property(this, "dependenciesTriggerMap", new Map());
|
|
83
|
-
/**
|
|
84
|
-
* 隐藏以后需要被计算的控件
|
|
87
|
+
/**
|
|
88
|
+
* 隐藏以后需要被计算的控件
|
|
85
89
|
* */ _define_property(this, "hideNotRememberControlIds", []);
|
|
86
90
|
_define_property(this, "dontHasPermissionControlIds", []);
|
|
87
91
|
_define_property(this, "cacheComputedResult", {});
|
|
@@ -92,8 +96,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
92
96
|
_create_class(CalcPlugin, [
|
|
93
97
|
{
|
|
94
98
|
key: "getNeedHideRememberControlIds",
|
|
95
|
-
value: /**
|
|
96
|
-
* @description 获取显隐控制的需要被记住值的控件id
|
|
99
|
+
value: /**
|
|
100
|
+
* @description 获取显隐控制的需要被记住值的控件id
|
|
97
101
|
* */ function getNeedHideRememberControlIds() {
|
|
98
102
|
var _this_options;
|
|
99
103
|
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
|
|
@@ -110,8 +114,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
110
114
|
},
|
|
111
115
|
{
|
|
112
116
|
key: "getDontHasPermissionControlIds",
|
|
113
|
-
value: /**
|
|
114
|
-
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
117
|
+
value: /**
|
|
118
|
+
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
115
119
|
* */ function getDontHasPermissionControlIds() {
|
|
116
120
|
var _this_options;
|
|
117
121
|
if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
|
|
@@ -127,9 +131,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
127
131
|
},
|
|
128
132
|
{
|
|
129
133
|
key: "controlNeedComputedValue",
|
|
130
|
-
value: /**
|
|
131
|
-
* @description 判断控件是否需要被计算
|
|
132
|
-
* @param control 控件
|
|
134
|
+
value: /**
|
|
135
|
+
* @description 判断控件是否需要被计算
|
|
136
|
+
* @param control 控件
|
|
133
137
|
* */ function controlNeedComputedValue(control) {
|
|
134
138
|
if (!control) {
|
|
135
139
|
return false;
|
|
@@ -149,9 +153,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
149
153
|
},
|
|
150
154
|
{
|
|
151
155
|
key: "getControlIsHide",
|
|
152
|
-
value: /**
|
|
153
|
-
* @description 获取控件是否被隐藏
|
|
154
|
-
* @param control 控件
|
|
156
|
+
value: /**
|
|
157
|
+
* @description 获取控件是否被隐藏
|
|
158
|
+
* @param control 控件
|
|
155
159
|
* */ function getControlIsHide(control) {
|
|
156
160
|
if (control.props.isHide) {
|
|
157
161
|
return true;
|
|
@@ -170,7 +174,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
170
174
|
this.watchControlChange();
|
|
171
175
|
this.watchSubtableChange();
|
|
172
176
|
this.watchSchemaHideChange();
|
|
173
|
-
this.engine.on(
|
|
177
|
+
this.engine.on('engine-mounted', function() {
|
|
174
178
|
requestAnimationFrame(function() {
|
|
175
179
|
_this.resetDependencies();
|
|
176
180
|
_this.allCalcControlComputed();
|
|
@@ -180,8 +184,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
180
184
|
},
|
|
181
185
|
{
|
|
182
186
|
key: "resetDependencies",
|
|
183
|
-
value: /**
|
|
184
|
-
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
187
|
+
value: /**
|
|
188
|
+
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
185
189
|
* */ function resetDependencies() {
|
|
186
190
|
this.calcControls = [];
|
|
187
191
|
this.dependenciesTriggerMap.clear();
|
|
@@ -191,8 +195,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
191
195
|
},
|
|
192
196
|
{
|
|
193
197
|
key: "allCalcControlComputed",
|
|
194
|
-
value: /**
|
|
195
|
-
* @description 执行所有计算公式控件的计算
|
|
198
|
+
value: /**
|
|
199
|
+
* @description 执行所有计算公式控件的计算
|
|
196
200
|
* */ function allCalcControlComputed() {
|
|
197
201
|
var _this = this;
|
|
198
202
|
this.calcControls.forEach(function(item) {
|
|
@@ -206,8 +210,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
206
210
|
},
|
|
207
211
|
{
|
|
208
212
|
key: "getAllCalcControl",
|
|
209
|
-
value: /**
|
|
210
|
-
* @description 获取所有的计算公式控件
|
|
213
|
+
value: /**
|
|
214
|
+
* @description 获取所有的计算公式控件
|
|
211
215
|
* */ function getAllCalcControl() {
|
|
212
216
|
this.calcControls = this.engine.runtime.flatInstances.filter(// @ts-ignore
|
|
213
217
|
function(item) {
|
|
@@ -217,8 +221,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
217
221
|
},
|
|
218
222
|
{
|
|
219
223
|
key: "getCalcDependencies",
|
|
220
|
-
value: /**
|
|
221
|
-
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
224
|
+
value: /**
|
|
225
|
+
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
222
226
|
* */ function getCalcDependencies() {
|
|
223
227
|
var _this = this;
|
|
224
228
|
this.calcControls.forEach(function(item) {
|
|
@@ -270,12 +274,12 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
270
274
|
},
|
|
271
275
|
{
|
|
272
276
|
key: "watchSchemaHideChange",
|
|
273
|
-
value: /**
|
|
274
|
-
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
277
|
+
value: /**
|
|
278
|
+
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
275
279
|
* */ function watchSchemaHideChange() {
|
|
276
280
|
var _this = this;
|
|
277
|
-
this.engine.on(
|
|
278
|
-
if (payload.props ===
|
|
281
|
+
this.engine.on('schema-change', function(payload) {
|
|
282
|
+
if (payload.props === 'isHide') {
|
|
279
283
|
var _this_dependenciesTriggerMap_get;
|
|
280
284
|
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
281
285
|
calcControls.forEach(function(calc) {
|
|
@@ -287,11 +291,11 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
287
291
|
},
|
|
288
292
|
{
|
|
289
293
|
key: "watchSubtableChange",
|
|
290
|
-
value: /**
|
|
291
|
-
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
294
|
+
value: /**
|
|
295
|
+
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
292
296
|
* */ function watchSubtableChange() {
|
|
293
297
|
var _this = this;
|
|
294
|
-
this.engine.on(
|
|
298
|
+
this.engine.on('list-change', function(payload) {
|
|
295
299
|
var _payload_options;
|
|
296
300
|
// 初始化前是批量操作。不做处理
|
|
297
301
|
if (_this.engine.isMounted === false) return;
|
|
@@ -315,11 +319,11 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
315
319
|
},
|
|
316
320
|
{
|
|
317
321
|
key: "watchControlChange",
|
|
318
|
-
value: /**
|
|
319
|
-
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
322
|
+
value: /**
|
|
323
|
+
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
320
324
|
* */ function watchControlChange() {
|
|
321
325
|
var _this = this;
|
|
322
|
-
this.engine.on(
|
|
326
|
+
this.engine.on('change', function(payload) {
|
|
323
327
|
// 初始化前是批量操作。不做处理
|
|
324
328
|
if (_this.engine.isMounted === false) return;
|
|
325
329
|
var instance = payload.instance;
|
|
@@ -351,8 +355,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
351
355
|
},
|
|
352
356
|
{
|
|
353
357
|
key: "controlInSubtable",
|
|
354
|
-
value: /**
|
|
355
|
-
* @description 控件在明细子表内
|
|
358
|
+
value: /**
|
|
359
|
+
* @description 控件在明细子表内
|
|
356
360
|
* */ function controlInSubtable(control) {
|
|
357
361
|
var _control_parent;
|
|
358
362
|
return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
|
|
@@ -360,8 +364,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
360
364
|
},
|
|
361
365
|
{
|
|
362
366
|
key: "computedCalcValue",
|
|
363
|
-
value: /**
|
|
364
|
-
* @description 执行计算公式的计算
|
|
367
|
+
value: /**
|
|
368
|
+
* @description 执行计算公式的计算
|
|
365
369
|
* */ // @ts-ignore
|
|
366
370
|
function computedCalcValue(control) {
|
|
367
371
|
var _this = this;
|
|
@@ -416,7 +420,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
416
420
|
result += 0;
|
|
417
421
|
}
|
|
418
422
|
return result;
|
|
419
|
-
},
|
|
423
|
+
}, '');
|
|
420
424
|
var value;
|
|
421
425
|
// 有缓存的话取缓存,没有缓存再执行eval
|
|
422
426
|
if (this.cacheComputedResult[scriptText] !== undefined) {
|
|
@@ -437,7 +441,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
437
441
|
}
|
|
438
442
|
}
|
|
439
443
|
var oldValue = this.engine.getState(control.id, rowIndex);
|
|
440
|
-
var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision ===
|
|
444
|
+
var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision === '' ? value : Number(value.toFixed(control.props.precision));
|
|
441
445
|
// 如果值没变的话,不触发修改
|
|
442
446
|
if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
|
|
443
447
|
return;
|
|
@@ -445,23 +449,23 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
445
449
|
var _oldValue_unit;
|
|
446
450
|
this.engine.setState(control.id, {
|
|
447
451
|
result: result,
|
|
448
|
-
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit :
|
|
452
|
+
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ''
|
|
449
453
|
}, rowIndex);
|
|
450
454
|
}
|
|
451
455
|
},
|
|
452
456
|
{
|
|
453
457
|
key: "getNumberValue",
|
|
454
|
-
value: /**
|
|
455
|
-
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
458
|
+
value: /**
|
|
459
|
+
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
456
460
|
* */ function getNumberValue(value) {
|
|
457
|
-
if (typeof value === "
|
|
458
|
-
if (
|
|
461
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value) {
|
|
462
|
+
if ('result' in value) {
|
|
459
463
|
return value.result;
|
|
460
|
-
} else if (
|
|
464
|
+
} else if ('amount' in value) {
|
|
461
465
|
return value.amount;
|
|
462
466
|
}
|
|
463
467
|
}
|
|
464
|
-
if (typeof value ===
|
|
468
|
+
if (typeof value === 'number') {
|
|
465
469
|
return value;
|
|
466
470
|
}
|
|
467
471
|
return 0;
|
|
@@ -469,8 +473,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
469
473
|
},
|
|
470
474
|
{
|
|
471
475
|
key: "getAggregateTypeValue",
|
|
472
|
-
value: /**
|
|
473
|
-
* 计算明细子表最大值最小值平均值总和
|
|
476
|
+
value: /**
|
|
477
|
+
* 计算明细子表最大值最小值平均值总和
|
|
474
478
|
* */ function getAggregateTypeValue(values, type) {
|
|
475
479
|
if (!type || !values || !values.length) return 0;
|
|
476
480
|
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
|
}
|