@byteluck-fe/model-driven-engine 2.23.0-beta.9 → 2.23.0

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 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
+ ```
@@ -186,11 +186,11 @@ export var ActionManager = /*#__PURE__*/ function() {
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, [
@@ -329,7 +329,7 @@ function _ts_generator(thisArg, body) {
329
329
  }
330
330
  }
331
331
  import { isDataBind } from '@byteluck-fe/model-driven-core';
332
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
332
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
333
333
  import { Runtime } from './Runtime';
334
334
  import { Store } from './Store';
335
335
  import { findItem, proxyState } from './proxyState';
@@ -360,7 +360,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
360
360
  _this.$options = Object.freeze(props);
361
361
  var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
362
362
  language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug, messagesI18n = _this_$options.messagesI18n, children = _this_$options.children;
363
- RulesMessage.setLocale(language, messagesI18n);
364
363
  _this.debug = debug;
365
364
  _this.runtime = new Runtime({
366
365
  schema: schema,
@@ -576,12 +575,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
576
575
  var subtableData = this.getState(subtable.id);
577
576
  this._handlerSubtableUpdateUid(subtableData);
578
577
  this.runtime.getFlatInstances();
578
+ var rowIndexs = createdNewRows.map(function(item) {
579
+ var _item_children_, _item_children;
580
+ var subControl = item === null || item === void 0 ? void 0 : (_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.children[0];
581
+ return _this.getInstanceRowIndex(subControl);
582
+ });
579
583
  this.emit('list-change', {
580
584
  instance: subtable,
581
585
  value: subtableData,
582
586
  options: Object.assign({}, options, {
583
587
  changed: createdNewRows,
584
588
  data: createdNewRowsData,
589
+ rowIndexs: rowIndexs,
585
590
  deleted: deleted !== null && deleted !== void 0 ? deleted : [],
586
591
  jsonValue: JSON.stringify(subtableData),
587
592
  isDeleteLastOne: isDeleteLastOne,
@@ -610,6 +615,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
610
615
  {
611
616
  key: "_handlerObjectUpdate",
612
617
  value: function _handlerObjectUpdate(state, key, value, oldValue) {
618
+ var _this = this;
613
619
  var instance = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
614
620
  if (!instance) {
615
621
  return;
@@ -637,10 +643,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
637
643
  var deleted = oldValue !== null && oldValue !== void 0 ? oldValue : [];
638
644
  if ((options === null || options === void 0 ? void 0 : options.setData) === true) {
639
645
  deleted = [];
640
- } else {
641
- this.runtime.getFlatInstances();
642
- }
646
+ } else {}
647
+ this.runtime.getFlatInstances();
643
648
  this._handlerSubtableUpdateUid(newValue);
649
+ var rowIndexs = newRows.map(function(item) {
650
+ var _item_children_, _item_children;
651
+ var subControl = item === null || item === void 0 ? void 0 : (_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.children[0];
652
+ return _this.getInstanceRowIndex(subControl);
653
+ });
644
654
  this.emit('list-change', {
645
655
  instance: instance,
646
656
  value: value,
@@ -648,6 +658,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
648
658
  // @ts-ignore
649
659
  changed: newRows,
650
660
  data: newValue,
661
+ rowIndexs: rowIndexs,
651
662
  deleted: deleted,
652
663
  // deleted: oldValue ?? [],
653
664
  type: 'push',
@@ -951,9 +962,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
951
962
  }
952
963
  },
953
964
  {
954
- /**
955
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
956
- * @param options 需要携带的options
965
+ /**
966
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
967
+ * @param options 需要携带的options
957
968
  * */ key: "setPayloadOptions",
958
969
  value: function setPayloadOptions(options) {
959
970
  eventOptionsTemp = options;
@@ -970,9 +981,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
970
981
  }
971
982
  },
972
983
  {
973
- /**
974
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
975
- * @param states
984
+ /**
985
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
986
+ * @param states
976
987
  */ key: "setStates",
977
988
  value: function setStates(states, rowIndex, options) {
978
989
  var _this = this;
@@ -999,11 +1010,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
999
1010
  }
1000
1011
  },
1001
1012
  {
1002
- /**
1003
- * 通过dataCode和fieldCode来获取控件的值
1004
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1005
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1006
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1013
+ /**
1014
+ * 通过dataCode和fieldCode来获取控件的值
1015
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1016
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1017
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1007
1018
  * */ key: "getField",
1008
1019
  value: function getField(dataCode, fieldCode, rowIndex) {
1009
1020
  if (!fieldCode) {
@@ -1118,13 +1129,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1118
1129
  }
1119
1130
  },
1120
1131
  {
1121
- /**
1122
- * 通过dataCode和fieldCode来设置控件的值
1123
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1124
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1125
- * @param value 修改的值
1126
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1127
- * @param options 触发事件携带的参数
1132
+ /**
1133
+ * 通过dataCode和fieldCode来设置控件的值
1134
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1135
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1136
+ * @param value 修改的值
1137
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1138
+ * @param options 触发事件携带的参数
1128
1139
  * */ key: "setField",
1129
1140
  value: function setField(dataCode, fieldCode, value, rowIndex, options) {
1130
1141
  var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
@@ -1152,12 +1163,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1152
1163
  }
1153
1164
  },
1154
1165
  {
1155
- /**
1156
- * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1157
- * @param dataCode 需要赋值的目标模型
1158
- * @param state 赋值对象,以fieldCode为key组成的对象
1159
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1160
- * @param options 触发事件携带的参数
1166
+ /**
1167
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1168
+ * @param dataCode 需要赋值的目标模型
1169
+ * @param state 赋值对象,以fieldCode为key组成的对象
1170
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1171
+ * @param options 触发事件携带的参数
1161
1172
  * */ key: "setFields",
1162
1173
  value: function setFields(dataCode, state, rowIndex, options) {
1163
1174
  var _this = this;
@@ -1198,10 +1209,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1198
1209
  }
1199
1210
  },
1200
1211
  {
1201
- /**
1202
- * 通过dataCode来将state转化为标准的state结构
1203
- * @param dataCode 需要转换的目标模型code
1204
- * @param state 值对象,以fieldCode为key组成的对象
1212
+ /**
1213
+ * 通过dataCode来将state转化为标准的state结构
1214
+ * @param dataCode 需要转换的目标模型code
1215
+ * @param state 值对象,以fieldCode为key组成的对象
1205
1216
  * */ key: "buildFields",
1206
1217
  value: function buildFields(dataCode, state) {
1207
1218
  var _this = this;
@@ -1242,10 +1253,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1242
1253
  }
1243
1254
  },
1244
1255
  {
1245
- /**
1246
- * 向Store设置一组值,并触发事件携带options
1247
- * @param dataSet
1248
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1256
+ /**
1257
+ * 向Store设置一组值,并触发事件携带options
1258
+ * @param dataSet
1259
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1249
1260
  */ key: "setData",
1250
1261
  value: function setData(dataSet, options) {
1251
1262
  var _this = this;
@@ -1383,19 +1394,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1383
1394
  }
1384
1395
  },
1385
1396
  {
1386
- /**
1387
- * 获取控件的dataBind
1388
- * @param controlId
1397
+ /**
1398
+ * 获取控件的dataBind
1399
+ * @param controlId
1389
1400
  * */ key: "getDataBind",
1390
1401
  value: function getDataBind(controlId) {
1391
1402
  return this.store.getDataBind(controlId);
1392
1403
  }
1393
1404
  },
1394
1405
  {
1395
- /**
1396
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1397
- * @param controlId
1398
- * @param rowIndex
1406
+ /**
1407
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1408
+ * @param controlId
1409
+ * @param rowIndex
1399
1410
  */ key: "getInstance",
1400
1411
  value: function getInstance(controlId, rowIndex) {
1401
1412
  var instances = this.getInstances(controlId, rowIndex === -1);
@@ -1414,10 +1425,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1414
1425
  }
1415
1426
  },
1416
1427
  {
1417
- /**
1418
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1419
- * @param controlId
1420
- * @param header 明细表内是否获取表头的控件
1428
+ /**
1429
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1430
+ * @param controlId
1431
+ * @param header 明细表内是否获取表头的控件
1421
1432
  */ // getInstances(
1422
1433
  // controlId?: string,
1423
1434
  // header: boolean = false
@@ -1593,27 +1604,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1593
1604
  },
1594
1605
  {
1595
1606
  key: "assertInstance",
1596
- value: /**
1597
- * 判断控件的类型,返回当前控件的正确类型
1607
+ value: /**
1608
+ * 判断控件的类型,返回当前控件的正确类型
1598
1609
  * */ function assertInstance(instance, types) {
1599
1610
  return isString(types) ? instance.type === types : types.includes(instance.type);
1600
1611
  }
1601
1612
  },
1602
1613
  {
1603
1614
  key: "assertInstanceIsCustomControl",
1604
- value: /**
1605
- * 判断控件或控件类型是一个自定义控件
1615
+ value: /**
1616
+ * 判断控件或控件类型是一个自定义控件
1606
1617
  * */ function assertInstanceIsCustomControl(instance) {
1607
1618
  return !isBuiltInControls(isString(instance) ? instance : instance.type);
1608
1619
  }
1609
1620
  },
1610
1621
  {
1611
1622
  key: "getInstanceRowIndex",
1612
- value: /**
1613
- * 获取控件在明细子表中的行下标,
1614
- * 如果控件在表头内,则返回-1
1615
- * 如果控件在表内,则返回行下标
1616
- * 如果控件不在明细表内,则返回undefined
1623
+ value: /**
1624
+ * 获取控件在明细子表中的行下标,
1625
+ * 如果控件在表头内,则返回-1
1626
+ * 如果控件在表内,则返回行下标
1627
+ * 如果控件不在明细表内,则返回undefined
1617
1628
  * */ // public getInstanceRowIndex(
1618
1629
  // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1619
1630
  // ) {
@@ -289,8 +289,8 @@ function loop(control, parentId, callback) {
289
289
  function hasHeaderOrFooterControl(control, checkType) {
290
290
  return checkType in control.props && isArray(control.props[checkType]);
291
291
  }
292
- /**
293
- * 控件是否在视图中隐藏,遍历查找所有parent
292
+ /**
293
+ * 控件是否在视图中隐藏,遍历查找所有parent
294
294
  * */ function getControlIsHide(control) {
295
295
  if (control.props.isHide) {
296
296
  return true;
@@ -69,10 +69,10 @@ var Store = /*#__PURE__*/ function() {
69
69
  }
70
70
  _create_class(Store, [
71
71
  {
72
- /**
73
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
74
- * @param controlId 组件ID
75
- * @param value
72
+ /**
73
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
74
+ * @param controlId 组件ID
75
+ * @param value
76
76
  */ key: "setState",
77
77
  value: function setState(controlId, value, rowIndex) {
78
78
  var _this = this;
@@ -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){
@@ -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-11-08 11:17:53
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");
@@ -61,7 +61,7 @@ export var StylePlugin = /*#__PURE__*/ function() {
61
61
  dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
62
62
  var cssStyleText;
63
63
  if (this.isPc) {
64
- cssStyleText = "[data-engine-id='".concat(engine.id, "']{ ").concat(compiledStyle, " }");
64
+ cssStyleText = ".render-engine-".concat(engine.id, "{ ").concat(compiledStyle, " }");
65
65
  } else {
66
66
  cssStyleText = compiledStyle;
67
67
  }