@byteluck-fe/model-driven-engine 2.22.2-beta.7 → 2.22.3-beta.1

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.
Files changed (32) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +4 -4
  3. package/dist/esm/common/Engine.js +66 -93
  4. package/dist/esm/common/Runtime.js +14 -30
  5. package/dist/esm/common/Store.js +18 -13
  6. package/dist/esm/common/checkerValue.js +17 -37
  7. package/dist/esm/common/proxyState.js +18 -18
  8. package/dist/esm/plugins/CalcPlugin.js +43 -43
  9. package/dist/esm/plugins/ControlsEventPlugin.js +2 -2
  10. package/dist/esm/plugins/LifecycleEventPlugin.js +2 -2
  11. package/dist/esm/plugins/StylePlugin.js +6 -6
  12. package/dist/index.umd.js +7 -56
  13. package/dist/types/common/ActionManager.d.ts +14 -14
  14. package/dist/types/common/DataManager.d.ts +10 -10
  15. package/dist/types/common/Engine.d.ts +201 -201
  16. package/dist/types/common/OkWorker.d.ts +13 -13
  17. package/dist/types/common/Plugin.d.ts +6 -6
  18. package/dist/types/common/Runtime.d.ts +31 -31
  19. package/dist/types/common/Store.d.ts +54 -54
  20. package/dist/types/common/checkerValue.d.ts +3 -3
  21. package/dist/types/common/index.d.ts +2 -2
  22. package/dist/types/common/proxyState.d.ts +30 -30
  23. package/dist/types/index.d.ts +3 -3
  24. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  25. package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -17
  26. package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
  27. package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
  28. package/dist/types/plugins/StylePlugin.d.ts +13 -13
  29. package/dist/types/plugins/index.d.ts +5 -5
  30. package/dist/types/utils/index.d.ts +1 -1
  31. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  32. package/package.json +4 -4
@@ -105,11 +105,11 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
105
105
  }
106
106
  }
107
107
  }
108
- /**
109
- * 返回proxy操作对象
110
- * @param thisKey 当前对象在上级中的key
111
- * @param callback 需要在修改的时候,触发的回调函数
112
- * @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
108
+ /**
109
+ * 返回proxy操作对象
110
+ * @param thisKey 当前对象在上级中的key
111
+ * @param callback 需要在修改的时候,触发的回调函数
112
+ * @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
113
113
  * */ function handler(thisKey, callback, beforeSetCallback) {
114
114
  return {
115
115
  __engineProxy__: true,
@@ -183,12 +183,12 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
183
183
  }
184
184
  };
185
185
  }
186
- /**
187
- * 代理state数据
188
- * @param state 数据对象
189
- * @param callback 触发set时候的回调函数
190
- * @param beforeSetCallback
191
- * @param prevKey 递归对象的key
186
+ /**
187
+ * 代理state数据
188
+ * @param state 数据对象
189
+ * @param callback 触发set时候的回调函数
190
+ * @param beforeSetCallback
191
+ * @param prevKey 递归对象的key
192
192
  * */ export function proxyState(state, callback, beforeSetCallback) {
193
193
  var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
194
194
  // 冻结的对象不需要再执行proxy,否则会报错
@@ -216,10 +216,10 @@ function flatInstanceForChildren(controls) {
216
216
  });
217
217
  return result;
218
218
  }
219
- /**
220
- * 在flatInstance中通过key查找出对应的instance
221
- * @param flatInstance 拍平的instance数组
222
- * @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
219
+ /**
220
+ * 在flatInstance中通过key查找出对应的instance
221
+ * @param flatInstance 拍平的instance数组
222
+ * @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
223
223
  * */ export function findItem(flatInstance, key, instanceMap) {
224
224
  if (key === '') return undefined;
225
225
  var keys = key.split('.');
@@ -276,9 +276,9 @@ function getArrayNewArgs(type, args, value) {
276
276
  return args.slice(0, 2).concat(value);
277
277
  }
278
278
  }
279
- /**
280
- * TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
281
- * 劫持数组api,达到操作数组api的时候,可以同步操作instance
279
+ /**
280
+ * TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
281
+ * 劫持数组api,达到操作数组api的时候,可以同步操作instance
282
282
  * */ function hijackArrayProperty() {
283
283
  proxyArrayApi.forEach(function(key) {
284
284
  var oldApiHandler = Array.prototype[key];
@@ -63,11 +63,11 @@ import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from '@byteluck-fe
63
63
  import { format } from 'mathjs';
64
64
  var DisplayType;
65
65
  (function(DisplayType) {
66
- /**
67
- * 完全等于
66
+ /**
67
+ * 完全等于
68
68
  */ DisplayType["EQ"] = "EQ";
69
- /**
70
- * 包含
69
+ /**
70
+ * 包含
71
71
  * */ DisplayType["IN"] = "IN";
72
72
  })(DisplayType || (DisplayType = {}));
73
73
  export var CalcPlugin = /*#__PURE__*/ function() {
@@ -76,16 +76,16 @@ export var CalcPlugin = /*#__PURE__*/ function() {
76
76
  _class_call_check(this, CalcPlugin);
77
77
  _define_property(this, "engine", void 0);
78
78
  _define_property(this, "options", void 0);
79
- /**
80
- * 所有的计算公式控件
79
+ /**
80
+ * 所有的计算公式控件
81
81
  * */ // @ts-ignore
82
82
  _define_property(this, "calcControls", []);
83
- /**
84
- * key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
85
- * 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
83
+ /**
84
+ * key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
85
+ * 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
86
86
  * */ _define_property(this, "dependenciesTriggerMap", new Map());
87
- /**
88
- * 隐藏以后需要被计算的控件
87
+ /**
88
+ * 隐藏以后需要被计算的控件
89
89
  * */ _define_property(this, "hideNotRememberControlIds", []);
90
90
  _define_property(this, "dontHasPermissionControlIds", []);
91
91
  _define_property(this, "cacheComputedResult", {});
@@ -96,8 +96,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
96
96
  _create_class(CalcPlugin, [
97
97
  {
98
98
  key: "getNeedHideRememberControlIds",
99
- value: /**
100
- * @description 获取显隐控制的需要被记住值的控件id
99
+ value: /**
100
+ * @description 获取显隐控制的需要被记住值的控件id
101
101
  * */ function getNeedHideRememberControlIds() {
102
102
  var _this_options;
103
103
  if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
@@ -114,8 +114,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
114
114
  },
115
115
  {
116
116
  key: "getDontHasPermissionControlIds",
117
- value: /**
118
- * @description 获取权限控制的隐藏的字段,不需要参与计算
117
+ value: /**
118
+ * @description 获取权限控制的隐藏的字段,不需要参与计算
119
119
  * */ function getDontHasPermissionControlIds() {
120
120
  var _this_options;
121
121
  if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
@@ -131,9 +131,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
131
131
  },
132
132
  {
133
133
  key: "controlNeedComputedValue",
134
- value: /**
135
- * @description 判断控件是否需要被计算
136
- * @param control 控件
134
+ value: /**
135
+ * @description 判断控件是否需要被计算
136
+ * @param control 控件
137
137
  * */ function controlNeedComputedValue(control) {
138
138
  if (!control) {
139
139
  return false;
@@ -153,9 +153,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
153
153
  },
154
154
  {
155
155
  key: "getControlIsHide",
156
- value: /**
157
- * @description 获取控件是否被隐藏
158
- * @param control 控件
156
+ value: /**
157
+ * @description 获取控件是否被隐藏
158
+ * @param control 控件
159
159
  * */ function getControlIsHide(control) {
160
160
  if (control.props.isHide) {
161
161
  return true;
@@ -184,8 +184,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
184
184
  },
185
185
  {
186
186
  key: "resetDependencies",
187
- value: /**
188
- * @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
187
+ value: /**
188
+ * @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
189
189
  * */ function resetDependencies() {
190
190
  this.calcControls = [];
191
191
  this.dependenciesTriggerMap.clear();
@@ -195,8 +195,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
195
195
  },
196
196
  {
197
197
  key: "allCalcControlComputed",
198
- value: /**
199
- * @description 执行所有计算公式控件的计算
198
+ value: /**
199
+ * @description 执行所有计算公式控件的计算
200
200
  * */ function allCalcControlComputed() {
201
201
  var _this = this;
202
202
  this.calcControls.forEach(function(item) {
@@ -210,8 +210,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
210
210
  },
211
211
  {
212
212
  key: "getAllCalcControl",
213
- value: /**
214
- * @description 获取所有的计算公式控件
213
+ value: /**
214
+ * @description 获取所有的计算公式控件
215
215
  * */ function getAllCalcControl() {
216
216
  this.calcControls = this.engine.runtime.flatInstances.filter(// @ts-ignore
217
217
  function(item) {
@@ -221,8 +221,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
221
221
  },
222
222
  {
223
223
  key: "getCalcDependencies",
224
- value: /**
225
- * @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
224
+ value: /**
225
+ * @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
226
226
  * */ function getCalcDependencies() {
227
227
  var _this = this;
228
228
  this.calcControls.forEach(function(item) {
@@ -274,8 +274,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
274
274
  },
275
275
  {
276
276
  key: "watchSchemaHideChange",
277
- value: /**
278
- * @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
277
+ value: /**
278
+ * @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
279
279
  * */ function watchSchemaHideChange() {
280
280
  var _this = this;
281
281
  this.engine.on('schema-change', function(payload) {
@@ -291,8 +291,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
291
291
  },
292
292
  {
293
293
  key: "watchSubtableChange",
294
- value: /**
295
- * @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
294
+ value: /**
295
+ * @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
296
296
  * */ function watchSubtableChange() {
297
297
  var _this = this;
298
298
  this.engine.on('list-change', function(payload) {
@@ -319,8 +319,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
319
319
  },
320
320
  {
321
321
  key: "watchControlChange",
322
- value: /**
323
- * @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
322
+ value: /**
323
+ * @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
324
324
  * */ function watchControlChange() {
325
325
  var _this = this;
326
326
  this.engine.on('change', function(payload) {
@@ -355,8 +355,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
355
355
  },
356
356
  {
357
357
  key: "controlInSubtable",
358
- value: /**
359
- * @description 控件在明细子表内
358
+ value: /**
359
+ * @description 控件在明细子表内
360
360
  * */ function controlInSubtable(control) {
361
361
  var _control_parent;
362
362
  return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
@@ -364,8 +364,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
364
364
  },
365
365
  {
366
366
  key: "computedCalcValue",
367
- value: /**
368
- * @description 执行计算公式的计算
367
+ value: /**
368
+ * @description 执行计算公式的计算
369
369
  * */ // @ts-ignore
370
370
  function computedCalcValue(control) {
371
371
  var _this = this;
@@ -455,8 +455,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
455
455
  },
456
456
  {
457
457
  key: "getNumberValue",
458
- value: /**
459
- * @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
458
+ value: /**
459
+ * @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
460
460
  * */ function getNumberValue(value) {
461
461
  if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value) {
462
462
  if ('result' in value) {
@@ -473,8 +473,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
473
473
  },
474
474
  {
475
475
  key: "getAggregateTypeValue",
476
- value: /**
477
- * 计算明细子表最大值最小值平均值总和
476
+ value: /**
477
+ * 计算明细子表最大值最小值平均值总和
478
478
  * */ function getAggregateTypeValue(values, type) {
479
479
  if (!type || !values || !values.length) return 0;
480
480
  switch(type){
@@ -217,7 +217,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
217
217
  key: "engineAddEventListener",
218
218
  value: function engineAddEventListener(eventKey, controlEventKey) {
219
219
  var _this = this;
220
- this.engine.on(eventKey, function() {
220
+ this.engine.on(eventKey, /*#__PURE__*/ function() {
221
221
  var _ref = _async_to_generator(function(payload) {
222
222
  return _ts_generator(this, function(_state) {
223
223
  switch(_state.label){
@@ -272,7 +272,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
272
272
  }
273
273
  return [
274
274
  4,
275
- Promise.all(events[name].map(function() {
275
+ Promise.all(events[name].map(/*#__PURE__*/ function() {
276
276
  var _ref = _async_to_generator(function(eventName) {
277
277
  var execResult;
278
278
  return _ts_generator(this, function(_state) {
@@ -224,7 +224,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
224
224
  Object.entries(LifecycleEventKeyMap).forEach(function(param) {
225
225
  var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
226
226
  var _this1 = _this;
227
- engine.on(engineKey, function() {
227
+ engine.on(engineKey, /*#__PURE__*/ function() {
228
228
  var _ref = _async_to_generator(function(payload) {
229
229
  var result;
230
230
  return _ts_generator(this, function(_state) {
@@ -278,7 +278,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
278
278
  }
279
279
  return [
280
280
  4,
281
- Promise.all(events[name].map(function() {
281
+ Promise.all(events[name].map(/*#__PURE__*/ function() {
282
282
  var _ref = _async_to_generator(function(eventName) {
283
283
  var execResult;
284
284
  return _ts_generator(this, function(_state) {
@@ -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");