@byteluck-fe/model-driven-engine 4.34.0-lx2 → 4.34.0-lx3

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 +10 -15
  3. package/dist/esm/common/DataManager.js +7 -12
  4. package/dist/esm/common/Engine.js +64 -68
  5. package/dist/esm/common/Runtime.js +2 -2
  6. package/dist/esm/common/Store.js +4 -4
  7. package/dist/esm/common/proxyState.js +18 -18
  8. package/dist/esm/plugins/CalcPlugin.js +46 -46
  9. package/dist/esm/plugins/ControlsEventPlugin.js +19 -29
  10. package/dist/esm/plugins/LifecycleEventPlugin.js +18 -29
  11. package/dist/esm/plugins/StylePlugin.js +6 -6
  12. package/dist/index.umd.js +8 -8
  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 +196 -196
  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 +33 -33
  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 +15 -15
  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 +12 -12
  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 +3 -3
@@ -61,31 +61,31 @@ 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) {
66
- /**
67
- * 完全等于
64
+ var DisplayType = /*#__PURE__*/ function(DisplayType) {
65
+ /**
66
+ * 完全等于
68
67
  */ DisplayType["EQ"] = "EQ";
69
- /**
70
- * 包含
68
+ /**
69
+ * 包含
71
70
  * */ DisplayType["IN"] = "IN";
72
- })(DisplayType || (DisplayType = {}));
71
+ return DisplayType;
72
+ }(DisplayType || {});
73
73
  export var CalcPlugin = /*#__PURE__*/ function() {
74
74
  "use strict";
75
75
  function CalcPlugin(options) {
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){
@@ -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, g, _ = {
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,
@@ -207,13 +203,13 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
207
203
  key: "engineAddEventListener",
208
204
  value: function engineAddEventListener(eventKey, controlEventKey) {
209
205
  var _this = this;
210
- this.engine.on(eventKey, /*#__PURE__*/ function() {
211
- var _ref = _async_to_generator(function(payload) {
206
+ this.engine.on(eventKey, function(payload) {
207
+ return _async_to_generator(function() {
212
208
  return _ts_generator(this, function(_state) {
213
209
  switch(_state.label){
214
210
  case 0:
215
211
  // 初始化state的时候不触发change事件,必须在engine mounted以后才触发
216
- if ((eventKey === 'change' || eventKey === 'list-change') && !_this.engine.isMounted) {
212
+ if ((eventKey === 'change' || eventKey === 'list-change') && !this.engine.isMounted) {
217
213
  return [
218
214
  2
219
215
  ];
@@ -224,7 +220,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
224
220
  ];
225
221
  return [
226
222
  4,
227
- _this.callControlEvent(controlEventKey, payload)
223
+ this.callControlEvent(controlEventKey, payload)
228
224
  ];
229
225
  case 1:
230
226
  return [
@@ -237,23 +233,20 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
237
233
  ];
238
234
  }
239
235
  });
240
- });
241
- return function(payload) {
242
- return _ref.apply(this, arguments);
243
- };
244
- }());
236
+ }).call(_this);
237
+ });
245
238
  }
246
239
  },
247
240
  {
248
241
  key: "callControlEvent",
249
242
  value: function callControlEvent(name, payload) {
250
- var _this = this;
251
243
  return _async_to_generator(function() {
252
- var events, result;
244
+ var _this, events, result;
253
245
  return _ts_generator(this, function(_state) {
254
246
  switch(_state.label){
255
247
  case 0:
256
- events = _this.config[payload.instance.id];
248
+ _this = this;
249
+ events = this.config[payload.instance.id];
257
250
  if (!events || !Array.isArray(events[name])) {
258
251
  return [
259
252
  2,
@@ -262,15 +255,15 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
262
255
  }
263
256
  return [
264
257
  4,
265
- Promise.all(events[name].map(/*#__PURE__*/ function() {
266
- var _ref = _async_to_generator(function(eventName) {
258
+ Promise.all(events[name].map(function(eventName) {
259
+ return _async_to_generator(function() {
267
260
  var execResult;
268
261
  return _ts_generator(this, function(_state) {
269
262
  switch(_state.label){
270
263
  case 0:
271
264
  return [
272
265
  4,
273
- _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
266
+ this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
274
267
  // this.engine,
275
268
  // this.engine.getAction().actionUtils, //以前是params,空的
276
269
  payload)
@@ -283,11 +276,8 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
283
276
  ];
284
277
  }
285
278
  });
286
- });
287
- return function(eventName) {
288
- return _ref.apply(this, arguments);
289
- };
290
- }()))
279
+ }).call(_this);
280
+ }))
291
281
  ];
292
282
  case 1:
293
283
  result = _state.sent();
@@ -307,7 +297,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
307
297
  ];
308
298
  }
309
299
  });
310
- })();
300
+ }).call(this);
311
301
  }
312
302
  }
313
303
  ]);
@@ -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, g, _ = {
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
- var _this1 = _this;
227
- engine.on(engineKey, /*#__PURE__*/ function() {
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
- _this1.callLifecycleEvent(lifecycleKey, payload)
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
- return function(payload) {
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
- events = _this.config;
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(/*#__PURE__*/ function() {
282
- var _ref = _async_to_generator(function(eventName) {
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
- _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
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
- return function(eventName) {
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
  ]);
@@ -1,9 +1,9 @@
1
- /*
2
- * @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
3
- * @Date: 2022-04-15 14:06:03
4
- * @LastEditors: zhaoxiaoyang zhaoxiaoyang@byteluck.com
5
- * @LastEditTime: 2023-11-30 16:38:47
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: zhaoxiaoyang zhaoxiaoyang@byteluck.com
5
+ * @LastEditTime: 2023-11-30 16:38:47
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");