@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.
Files changed (40) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +7 -7
  3. package/dist/esm/common/DataManager.js +2 -2
  4. package/dist/esm/common/Engine.js +106 -106
  5. package/dist/esm/common/OkWorker.js +8 -8
  6. package/dist/esm/common/Runtime.js +17 -17
  7. package/dist/esm/common/Store.js +13 -13
  8. package/dist/esm/common/checkerValue.js +22 -22
  9. package/dist/esm/common/index.js +2 -2
  10. package/dist/esm/common/proxyState.js +56 -52
  11. package/dist/esm/index.js +3 -3
  12. package/dist/esm/plugins/CalcPlugin.js +61 -57
  13. package/dist/esm/plugins/ControlsEventPlugin.js +4 -4
  14. package/dist/esm/plugins/ES6ModulePlugin.js +6 -6
  15. package/dist/esm/plugins/LifecycleEventPlugin.js +5 -5
  16. package/dist/esm/plugins/StylePlugin.js +10 -10
  17. package/dist/esm/plugins/index.js +5 -5
  18. package/dist/esm/utils/index.js +1 -1
  19. package/dist/esm/utils/runtimeUtils.js +3 -3
  20. package/dist/index.umd.js +25 -25
  21. package/dist/types/common/ActionManager.d.ts +14 -14
  22. package/dist/types/common/DataManager.d.ts +10 -10
  23. package/dist/types/common/Engine.d.ts +201 -201
  24. package/dist/types/common/OkWorker.d.ts +13 -13
  25. package/dist/types/common/Plugin.d.ts +6 -6
  26. package/dist/types/common/Runtime.d.ts +31 -31
  27. package/dist/types/common/Store.d.ts +54 -54
  28. package/dist/types/common/checkerValue.d.ts +3 -3
  29. package/dist/types/common/index.d.ts +2 -2
  30. package/dist/types/common/proxyState.d.ts +30 -30
  31. package/dist/types/index.d.ts +3 -3
  32. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  33. package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -17
  34. package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
  35. package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
  36. package/dist/types/plugins/StylePlugin.d.ts +13 -13
  37. package/dist/types/plugins/index.d.ts +5 -5
  38. package/dist/types/utils/index.d.ts +1 -1
  39. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  40. package/package.json +4 -4
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
- # Engine
2
- 运行态引擎
3
-
4
- ```
5
- │ index.ts // 入口文件
6
-
7
- ├─common // 引擎相关
8
- │ ActionManager.ts // utils操作管理
9
- │ checkerValue.ts // 表单值校验器
10
- │ DataManager.ts // 数据源容器
11
- │ Engine.ts // 引擎
12
- │ index.ts // 入口
13
- │ OkWorker.ts // 无用
14
- │ Plugin.ts // 插件
15
- │ proxyState.ts // 劫持引擎表单数据
16
- │ Runtime.ts // 控件注册和创建
17
- │ Store.ts // 数据管理
18
-
19
- ├─plugins
20
- │ CalcPlugin.ts // 计算公式插件
21
- │ ControlsEventPlugin.ts // 控件二开事件插件
22
- │ ES6ModulePlugin.ts //
23
- │ index.ts
24
- │ LifecycleEventPlugin.ts // 页面生命周期事件
25
- │ StylePlugin.ts // css二开
26
-
27
- └─utils
28
- index.ts
29
- runtimeUtils.ts // 工具函数
30
- ```
1
+ # Engine
2
+ 运行态引擎
3
+
4
+ ```
5
+ │ index.ts // 入口文件
6
+
7
+ ├─common // 引擎相关
8
+ │ ActionManager.ts // utils操作管理
9
+ │ checkerValue.ts // 表单值校验器
10
+ │ DataManager.ts // 数据源容器
11
+ │ Engine.ts // 引擎
12
+ │ index.ts // 入口
13
+ │ OkWorker.ts // 无用
14
+ │ Plugin.ts // 插件
15
+ │ proxyState.ts // 劫持引擎表单数据
16
+ │ Runtime.ts // 控件注册和创建
17
+ │ Store.ts // 数据管理
18
+
19
+ ├─plugins
20
+ │ CalcPlugin.ts // 计算公式插件
21
+ │ ControlsEventPlugin.ts // 控件二开事件插件
22
+ │ ES6ModulePlugin.ts //
23
+ │ index.ts
24
+ │ LifecycleEventPlugin.ts // 页面生命周期事件
25
+ │ StylePlugin.ts // css二开
26
+
27
+ └─utils
28
+ index.ts
29
+ runtimeUtils.ts // 工具函数
30
+ ```
@@ -179,18 +179,18 @@ function _ts_generator(thisArg, body) {
179
179
  };
180
180
  }
181
181
  }
182
- import { error, logerror } from "@byteluck-fe/model-driven-shared";
182
+ import { error, logerror } from '@byteluck-fe/model-driven-shared';
183
183
  export var ActionManager = /*#__PURE__*/ function() {
184
184
  "use strict";
185
185
  function ActionManager() {
186
186
  _class_call_check(this, ActionManager);
187
187
  _define_property(this, "actionMap", new Map());
188
188
  _define_property(this, "buildinActions", {});
189
- /**
190
- * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
189
+ /**
190
+ * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
191
191
  */ _define_property(this, "actionUtils", {});
192
- /**
193
- * 用于存储es module解析出来的源码,CustomVueControlPlugin
192
+ /**
193
+ * 用于存储es module解析出来的源码,CustomVueControlPlugin
194
194
  */ _define_property(this, "sources", {});
195
195
  }
196
196
  _create_class(ActionManager, [
@@ -255,7 +255,7 @@ export var ActionManager = /*#__PURE__*/ function() {
255
255
  key: "addAction",
256
256
  value: function addAction(name, func) {
257
257
  if (this.actionMap.has(name)) {
258
- error("duplicated action key");
258
+ error('duplicated action key');
259
259
  }
260
260
  var action = new Action(name, func);
261
261
  this.actionMap.set(name, action);
@@ -268,7 +268,7 @@ var Action = function Action(id, func) {
268
268
  "use strict";
269
269
  _class_call_check(this, Action);
270
270
  _define_property(this, "func", void 0);
271
- _define_property(this, "id", "");
271
+ _define_property(this, "id", '');
272
272
  this.id = id;
273
273
  this.func = func;
274
274
  };
@@ -154,7 +154,7 @@ function _ts_generator(thisArg, body) {
154
154
  };
155
155
  }
156
156
  }
157
- import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
157
+ import { JSONCopy, logerror } from '@byteluck-fe/model-driven-shared';
158
158
  export var DataManager = /*#__PURE__*/ function() {
159
159
  "use strict";
160
160
  function DataManager(callbackExecuter) {
@@ -190,7 +190,7 @@ export var DataManager = /*#__PURE__*/ function() {
190
190
  return _async_to_generator(function() {
191
191
  return _ts_generator(this, function(_state) {
192
192
  if (_this.executer === undefined) {
193
- logerror("未初始化executer");
193
+ logerror('未初始化executer');
194
194
  return [
195
195
  2,
196
196
  []
@@ -340,23 +340,23 @@ function _ts_generator(thisArg, body) {
340
340
  };
341
341
  }
342
342
  }
343
- import { isDataBind } from "@byteluck-fe/model-driven-core";
344
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from "@byteluck-fe/model-driven-shared";
345
- import { Runtime } from "./Runtime";
346
- import { Store } from "./Store";
347
- import { findItem, proxyState } from "./proxyState";
348
- import { ActionManager } from "./ActionManager";
349
- import { DataManager } from "./DataManager";
350
- import { checkerSubtableValue, checkerValue } from "./checkerValue";
351
- import { buildUUID } from "../utils/runtimeUtils";
352
- if (typeof window !== "undefined") {
343
+ import { isDataBind } from '@byteluck-fe/model-driven-core';
344
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
345
+ import { Runtime } from './Runtime';
346
+ import { Store } from './Store';
347
+ import { findItem, proxyState } from './proxyState';
348
+ import { ActionManager } from './ActionManager';
349
+ import { DataManager } from './DataManager';
350
+ import { checkerSubtableValue, checkerValue } from './checkerValue';
351
+ import { buildUUID } from '../utils/runtimeUtils';
352
+ if (typeof window !== 'undefined') {
353
353
  // @ts-ignore
354
354
  window.engines = {};
355
355
  }
356
356
  // setState的时候,存储options中转变量
357
357
  var eventOptionsTemp = null;
358
358
  // 当前正在注册的插件名称
359
- var applyingPluginName = "";
359
+ var applyingPluginName = '';
360
360
  // 整体渲染引擎 并且 提供发布订阅能力
361
361
  var Engine = /*#__PURE__*/ function(Watcher) {
362
362
  "use strict";
@@ -399,7 +399,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
399
399
  _this.store = new Store({
400
400
  instance: _this.runtime.instance
401
401
  });
402
- _this.debugLog("engine is Instantiation complete");
402
+ _this.debugLog('engine is Instantiation complete');
403
403
  // 自动执行挂载完成,也可以手动调用mount方法
404
404
  autoMount && _this.mount();
405
405
  return _this;
@@ -446,7 +446,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
446
446
  // 触发所有控件的默认值的change事件
447
447
  this.setStates(this.getState());
448
448
  this.debugLog("engine的mount方法调用结束");
449
- if (this.debug && typeof window !== "undefined") {
449
+ if (this.debug && typeof window !== 'undefined') {
450
450
  // @ts-ignore
451
451
  window.engines[this.id] = this;
452
452
  }
@@ -455,7 +455,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
455
455
  {
456
456
  key: "destroy",
457
457
  value: function destroy() {
458
- if (this.debug && typeof window !== "undefined") {
458
+ if (this.debug && typeof window !== 'undefined') {
459
459
  // @ts-ignore
460
460
  delete window.engines[this.id];
461
461
  }
@@ -496,7 +496,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
496
496
  checkerSubtableValue(fieldTypeMap, row, emptyState));
497
497
  });
498
498
  }
499
- var keys = key.split(".");
499
+ var keys = key.split('.');
500
500
  var lastKey = keys[keys.length - 1];
501
501
  try {
502
502
  return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
@@ -529,7 +529,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
529
529
  var newRows = [];
530
530
  for(var i = 0; i < len; i++){
531
531
  // @ts-ignore
532
- var row = _this.listControlCreateRow(subtable, "subtable-row");
532
+ var row = _this.listControlCreateRow(subtable, 'subtable-row');
533
533
  row && newRows.push(row);
534
534
  }
535
535
  // @ts-ignore
@@ -544,15 +544,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
544
544
  if (type && args) {
545
545
  // const subtableOldLength = subtable.children.length
546
546
  switch(type){
547
- case "push":
548
- case "unshift":
547
+ case 'push':
548
+ case 'unshift':
549
549
  var _subtable_children;
550
550
  var newRowLengths = args.length;
551
551
  createdNewRows = createRows(newRowLengths);
552
552
  createdNewRowsData = args;
553
553
  (_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
554
554
  break;
555
- case "splice":
555
+ case 'splice':
556
556
  if (args.length > 2) {
557
557
  var // @ts-ignore
558
558
  _subtable_children1;
@@ -591,11 +591,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
591
591
  (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
592
592
  break;
593
593
  }
594
- if (type === "splice") {
594
+ if (type === 'splice') {
595
595
  deleted = result;
596
596
  } else if ([
597
- "pop",
598
- "shift"
597
+ 'pop',
598
+ 'shift'
599
599
  ].includes(type)) {
600
600
  deleted = [
601
601
  result
@@ -604,7 +604,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
604
604
  var subtableData = this.getState(subtable.id);
605
605
  this._handlerSubtableUpdateUid(subtableData);
606
606
  this.runtime.getFlatInstances();
607
- this.emit("list-change", {
607
+ this.emit('list-change', {
608
608
  instance: subtable,
609
609
  value: subtableData,
610
610
  options: Object.assign({}, options, {
@@ -628,7 +628,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
628
628
  subtableData.forEach(function(item) {
629
629
  if (!item.uid) {
630
630
  Object.assign(item, {
631
- uid: "new:" + buildUUID("uid")
631
+ uid: 'new:' + buildUUID('uid')
632
632
  });
633
633
  }
634
634
  });
@@ -653,7 +653,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
653
653
  var newRows = [];
654
654
  for(var i = 0; i < newValue.length; i++){
655
655
  // @ts-ignore
656
- var row = this.listControlCreateRow(instance, "subtable-row");
656
+ var row = this.listControlCreateRow(instance, 'subtable-row');
657
657
  row && newRows.push(row);
658
658
  }
659
659
  (_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
@@ -668,7 +668,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
668
668
  this.runtime.getFlatInstances();
669
669
  }
670
670
  this._handlerSubtableUpdateUid(newValue);
671
- this.emit("list-change", {
671
+ this.emit('list-change', {
672
672
  instance: instance,
673
673
  value: value,
674
674
  options: _object_spread_props(_object_spread({}, options), {
@@ -677,12 +677,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
677
677
  data: newValue,
678
678
  deleted: deleted,
679
679
  // deleted: oldValue ?? [],
680
- type: "push",
680
+ type: 'push',
681
681
  jsonValue: JSON.stringify(newValue)
682
682
  })
683
683
  });
684
684
  } else {
685
- this.emit("change", {
685
+ this.emit('change', {
686
686
  instance: instance,
687
687
  value: this.getState(instance.id, index),
688
688
  rowIndex: index,
@@ -706,7 +706,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
706
706
  } catch (e) {
707
707
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
708
708
  } finally{
709
- applyingPluginName = "";
709
+ applyingPluginName = '';
710
710
  }
711
711
  });
712
712
  this.__pluginsApplied = true;
@@ -716,20 +716,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
716
716
  key: "listControlCreateRow",
717
717
  value: function listControlCreateRow(instance, rowType) {
718
718
  var row;
719
- if (rowType === "subtable-row") {
719
+ if (rowType === 'subtable-row') {
720
720
  row = {
721
721
  children: [],
722
722
  controlType: CONTROL_BASE_TYPE.LAYOUT,
723
723
  id: genNonDuplicateId(),
724
- type: "subtable-row",
724
+ type: 'subtable-row',
725
725
  props: {
726
- caption: "",
726
+ caption: '',
727
727
  isHide: false,
728
728
  style: {
729
- height: "",
730
- heightConfig: "fill",
731
- width: "",
732
- widthConfig: "fill"
729
+ height: '',
730
+ heightConfig: 'fill',
731
+ width: '',
732
+ widthConfig: 'fill'
733
733
  }
734
734
  },
735
735
  fieldType: undefined,
@@ -783,7 +783,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
783
783
  key: "listControlAddRow",
784
784
  value: function listControlAddRow(instance) {
785
785
  var // @ts-ignore
786
- rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
786
+ rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
787
787
  var row = this.listControlCreateRow(instance, rowType);
788
788
  if (!row) return;
789
789
  instance.children.push(row);
@@ -802,12 +802,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
802
802
  return _ts_generator(this, function(_state) {
803
803
  switch(_state.label){
804
804
  case 0:
805
- if (!(eventKey === "engine-mounted")) return [
805
+ if (!(eventKey === 'engine-mounted')) return [
806
806
  3,
807
807
  3
808
808
  ];
809
809
  if (_this1.isMounted) {
810
- warn("The engine-mounted life cycle can only be triggered once");
810
+ warn('The engine-mounted life cycle can only be triggered once');
811
811
  return [
812
812
  2,
813
813
  Promise.resolve([])
@@ -817,7 +817,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
817
817
  3,
818
818
  2
819
819
  ];
820
- console.time("engine-mounted need wait");
820
+ console.time('engine-mounted need wait');
821
821
  needWait = _to_consumable_array(_this1._jobTasks);
822
822
  return [
823
823
  4,
@@ -825,7 +825,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
825
825
  ];
826
826
  case 1:
827
827
  _state.sent();
828
- console.timeEnd("engine-mounted need wait");
828
+ console.timeEnd('engine-mounted need wait');
829
829
  _state.label = 2;
830
830
  case 2:
831
831
  _this1.isMounted = true;
@@ -978,9 +978,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
978
978
  }
979
979
  },
980
980
  {
981
- /**
982
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
983
- * @param options 需要携带的options
981
+ /**
982
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
983
+ * @param options 需要携带的options
984
984
  * */ key: "setPayloadOptions",
985
985
  value: function setPayloadOptions(options) {
986
986
  eventOptionsTemp = options;
@@ -990,16 +990,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
990
990
  key: "setState",
991
991
  value: function setState(controlId, value, rowIndex, options) {
992
992
  eventOptionsTemp = options;
993
- this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
993
+ this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
994
994
  this.store.setState(controlId, value, rowIndex);
995
- this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
995
+ this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
996
996
  eventOptionsTemp = null;
997
997
  }
998
998
  },
999
999
  {
1000
- /**
1001
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
1002
- * @param states
1000
+ /**
1001
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
1002
+ * @param states
1003
1003
  */ key: "setStates",
1004
1004
  value: function setStates(states, rowIndex, options) {
1005
1005
  var _this = this;
@@ -1026,11 +1026,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1026
1026
  }
1027
1027
  },
1028
1028
  {
1029
- /**
1030
- * 通过dataCode和fieldCode来获取控件的值
1031
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1032
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1033
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1029
+ /**
1030
+ * 通过dataCode和fieldCode来获取控件的值
1031
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1032
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1033
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1034
1034
  * */ key: "getField",
1035
1035
  value: function getField(dataCode, fieldCode, rowIndex) {
1036
1036
  if (!fieldCode) {
@@ -1079,7 +1079,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1079
1079
  var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId;
1080
1080
  var fieldCode = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : (_controlIdMapping_controlId_children_key = _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode;
1081
1081
  //未绑定字段的控件,直接抛弃
1082
- if (fieldCode !== "") {
1082
+ if (fieldCode !== '') {
1083
1083
  var _controlIdMapping_controlId1;
1084
1084
  if (fieldCode) {
1085
1085
  obj[fieldCode] = item[key];
@@ -1113,7 +1113,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1113
1113
  var _controlIdMapping_key_children_keyChi;
1114
1114
  var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
1115
1115
  //未绑定字段的控件,直接抛弃
1116
- if (fieldCode !== "") {
1116
+ if (fieldCode !== '') {
1117
1117
  if (fieldCode) {
1118
1118
  objChi[fieldCode] = item[keyChi];
1119
1119
  } else {
@@ -1145,13 +1145,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1145
1145
  }
1146
1146
  },
1147
1147
  {
1148
- /**
1149
- * 通过dataCode和fieldCode来设置控件的值
1150
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1151
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1152
- * @param value 修改的值
1153
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1154
- * @param options 触发事件携带的参数
1148
+ /**
1149
+ * 通过dataCode和fieldCode来设置控件的值
1150
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1151
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1152
+ * @param value 修改的值
1153
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1154
+ * @param options 触发事件携带的参数
1155
1155
  * */ key: "setField",
1156
1156
  value: function setField(dataCode, fieldCode, value, rowIndex, options) {
1157
1157
  var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
@@ -1179,12 +1179,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1179
1179
  }
1180
1180
  },
1181
1181
  {
1182
- /**
1183
- * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1184
- * @param dataCode 需要赋值的目标模型
1185
- * @param state 赋值对象,以fieldCode为key组成的对象
1186
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1187
- * @param options 触发事件携带的参数
1182
+ /**
1183
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1184
+ * @param dataCode 需要赋值的目标模型
1185
+ * @param state 赋值对象,以fieldCode为key组成的对象
1186
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1187
+ * @param options 触发事件携带的参数
1188
1188
  * */ key: "setFields",
1189
1189
  value: function setFields(dataCode, state, rowIndex, options) {
1190
1190
  var _this = this;
@@ -1225,10 +1225,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1225
1225
  }
1226
1226
  },
1227
1227
  {
1228
- /**
1229
- * 通过dataCode来将state转化为标准的state结构
1230
- * @param dataCode 需要转换的目标模型code
1231
- * @param state 值对象,以fieldCode为key组成的对象
1228
+ /**
1229
+ * 通过dataCode来将state转化为标准的state结构
1230
+ * @param dataCode 需要转换的目标模型code
1231
+ * @param state 值对象,以fieldCode为key组成的对象
1232
1232
  * */ key: "buildFields",
1233
1233
  value: function buildFields(dataCode, state) {
1234
1234
  var _this = this;
@@ -1269,10 +1269,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1269
1269
  }
1270
1270
  },
1271
1271
  {
1272
- /**
1273
- * 向Store设置一组值,并触发事件携带options
1274
- * @param dataSet
1275
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1272
+ /**
1273
+ * 向Store设置一组值,并触发事件携带options
1274
+ * @param dataSet
1275
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1276
1276
  */ key: "setData",
1277
1277
  value: function setData(dataSet, options) {
1278
1278
  var _this = this;
@@ -1335,9 +1335,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1335
1335
  });
1336
1336
  newRow[fieldMapping.controlId] = objValue;
1337
1337
  }
1338
- } else if (fieldCode === "uid" && row.uid !== undefined) {
1338
+ } else if (fieldCode === 'uid' && row.uid !== undefined) {
1339
1339
  newRow.uid = row.uid;
1340
- } else if (fieldCode === "virtualStore" && row.virtualStore !== undefined) {
1340
+ } else if (fieldCode === 'virtualStore' && row.virtualStore !== undefined) {
1341
1341
  newRow.virtualStore = Object.freeze(row.virtualStore);
1342
1342
  }
1343
1343
  });
@@ -1389,7 +1389,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1389
1389
  var _newState_newMapping_controlId;
1390
1390
  var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
1391
1391
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1392
- if (!mainStateKeys.includes(key) && key !== "uid" && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1392
+ if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1393
1393
  if (Object.keys(newState).length) {
1394
1394
  Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _define_property({}, key, mappingValue[key]));
1395
1395
  } else {
@@ -1410,19 +1410,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1410
1410
  }
1411
1411
  },
1412
1412
  {
1413
- /**
1414
- * 获取控件的dataBind
1415
- * @param controlId
1413
+ /**
1414
+ * 获取控件的dataBind
1415
+ * @param controlId
1416
1416
  * */ key: "getDataBind",
1417
1417
  value: function getDataBind(controlId) {
1418
1418
  return this.store.getDataBind(controlId);
1419
1419
  }
1420
1420
  },
1421
1421
  {
1422
- /**
1423
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1424
- * @param controlId
1425
- * @param rowIndex
1422
+ /**
1423
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1424
+ * @param controlId
1425
+ * @param rowIndex
1426
1426
  */ key: "getInstance",
1427
1427
  value: function getInstance(controlId, rowIndex) {
1428
1428
  var instances = this.getInstances(controlId, rowIndex === -1);
@@ -1441,10 +1441,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1441
1441
  }
1442
1442
  },
1443
1443
  {
1444
- /**
1445
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1446
- * @param controlId
1447
- * @param header 明细表内是否获取表头的控件
1444
+ /**
1445
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1446
+ * @param controlId
1447
+ * @param header 明细表内是否获取表头的控件
1448
1448
  */ // getInstances(
1449
1449
  // controlId?: string,
1450
1450
  // header: boolean = false
@@ -1531,14 +1531,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1531
1531
  value: function setInstance(instance, props, value, rowIndex) {
1532
1532
  var _this = this;
1533
1533
  try {
1534
- if (typeof instance === "string" && rowIndex === -1) {
1534
+ if (typeof instance === 'string' && rowIndex === -1) {
1535
1535
  //修改明细表整列属性的逻辑
1536
1536
  var instances = this.getInstances(instance, rowIndex === -1);
1537
1537
  instances.map(function(_instance) {
1538
1538
  if (_instance) {
1539
1539
  _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1540
1540
  updateValueFromKeys(_instance.props, props, value);
1541
- _this.schemaEvent("schema-change", {
1541
+ _this.schemaEvent('schema-change', {
1542
1542
  instance: _instance,
1543
1543
  props: props,
1544
1544
  value: value,
@@ -1548,7 +1548,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1548
1548
  });
1549
1549
  } else {
1550
1550
  var _instance;
1551
- if (typeof instance === "string") {
1551
+ if (typeof instance === 'string') {
1552
1552
  _instance = this.getInstance(instance, rowIndex);
1553
1553
  } else {
1554
1554
  _instance = instance;
@@ -1558,7 +1558,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1558
1558
  }
1559
1559
  this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1560
1560
  updateValueFromKeys(_instance.props, props, value);
1561
- this.schemaEvent("schema-change", {
1561
+ this.schemaEvent('schema-change', {
1562
1562
  instance: _instance,
1563
1563
  props: props,
1564
1564
  value: value,
@@ -1620,27 +1620,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1620
1620
  },
1621
1621
  {
1622
1622
  key: "assertInstance",
1623
- value: /**
1624
- * 判断控件的类型,返回当前控件的正确类型
1623
+ value: /**
1624
+ * 判断控件的类型,返回当前控件的正确类型
1625
1625
  * */ function assertInstance(instance, types) {
1626
1626
  return isString(types) ? instance.type === types : types.includes(instance.type);
1627
1627
  }
1628
1628
  },
1629
1629
  {
1630
1630
  key: "assertInstanceIsCustomControl",
1631
- value: /**
1632
- * 判断控件或控件类型是一个自定义控件
1631
+ value: /**
1632
+ * 判断控件或控件类型是一个自定义控件
1633
1633
  * */ function assertInstanceIsCustomControl(instance) {
1634
1634
  return !isBuiltInControls(isString(instance) ? instance : instance.type);
1635
1635
  }
1636
1636
  },
1637
1637
  {
1638
1638
  key: "getInstanceRowIndex",
1639
- value: /**
1640
- * 获取控件在明细子表中的行下标,
1641
- * 如果控件在表头内,则返回-1
1642
- * 如果控件在表内,则返回行下标
1643
- * 如果控件不在明细表内,则返回undefined
1639
+ value: /**
1640
+ * 获取控件在明细子表中的行下标,
1641
+ * 如果控件在表头内,则返回-1
1642
+ * 如果控件在表内,则返回行下标
1643
+ * 如果控件不在明细表内,则返回undefined
1644
1644
  * */ // public getInstanceRowIndex(
1645
1645
  // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1646
1646
  // ) {
@@ -1685,7 +1685,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1685
1685
  CONTROL_TYPE.SUBTABLE_COLUMN);
1686
1686
  if (isColumnChild) {
1687
1687
  var instanceList = this.runtime.instanceMap[instance.id];
1688
- if (Object.prototype.toString.call(instanceList) === "[object Array]") {
1688
+ if (Object.prototype.toString.call(instanceList) === '[object Array]') {
1689
1689
  var index = instanceList.findIndex(function(item) {
1690
1690
  return item === instance;
1691
1691
  });
@@ -1791,7 +1791,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1791
1791
  key: "register",
1792
1792
  value: // 注册外部控件
1793
1793
  function register(control) {
1794
- return Runtime.register(control, "Runtime");
1794
+ return Runtime.register(control, 'Runtime');
1795
1795
  }
1796
1796
  },
1797
1797
  {