@ibiz-template/runtime 0.1.24 → 0.1.26

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 (80) hide show
  1. package/dist/index.esm.js +222 -54
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/config/global-config.d.ts.map +1 -1
  5. package/out/config/global-config.js +1 -0
  6. package/out/controller/common/control/control.controller.d.ts +4 -4
  7. package/out/controller/common/control/control.controller.d.ts.map +1 -1
  8. package/out/controller/common/control/control.controller.js +2 -2
  9. package/out/controller/control/exp-bar/calendar-exp-bar.controller.d.ts.map +1 -1
  10. package/out/controller/control/exp-bar/calendar-exp-bar.controller.js +1 -0
  11. package/out/controller/control/exp-bar/exp-bar.controller.d.ts +10 -0
  12. package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
  13. package/out/controller/control/exp-bar/exp-bar.controller.js +32 -7
  14. package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
  15. package/out/controller/control/exp-bar/tree-exp-bar.controller.js +1 -0
  16. package/out/de-logic/de-logic-node/end-node/end-node.js +1 -1
  17. package/out/de-logic/utils/handle-src-val.js +1 -1
  18. package/out/global/global-util/global-util.d.ts +8 -1
  19. package/out/global/global-util/global-util.d.ts.map +1 -1
  20. package/out/global/global-util/global-util.js +8 -1
  21. package/out/interface/common/i-global-config/i-global-view-config.d.ts +8 -0
  22. package/out/interface/common/i-global-config/i-global-view-config.d.ts.map +1 -1
  23. package/out/interface/controller/controller/control/i-exp-bar-control.controller.d.ts +10 -0
  24. package/out/interface/controller/controller/control/i-exp-bar-control.controller.d.ts.map +1 -1
  25. package/out/interface/provider/i-control.provider.d.ts +15 -0
  26. package/out/interface/provider/i-control.provider.d.ts.map +1 -1
  27. package/out/interface/provider/i-view.provider.d.ts +15 -0
  28. package/out/interface/provider/i-view.provider.d.ts.map +1 -1
  29. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts +13 -1
  30. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
  31. package/out/logic-scheduler/executor/app-ui-logic-executor.js +106 -24
  32. package/out/service/service/control/control.service.d.ts.map +1 -1
  33. package/out/service/service/control/control.service.js +1 -1
  34. package/out/service/service/entity/de.service.d.ts.map +1 -1
  35. package/out/service/service/entity/de.service.js +1 -1
  36. package/out/service/service/entity/method/de-action.d.ts +1 -1
  37. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  38. package/out/service/service/entity/method/de-action.js +7 -7
  39. package/out/service/service/entity/method/method.d.ts +2 -2
  40. package/out/service/service/entity/method/method.d.ts.map +1 -1
  41. package/out/service/vo/control.vo.d.ts.map +1 -1
  42. package/out/service/vo/control.vo.js +9 -12
  43. package/out/service/vo/ui-map-field.d.ts +7 -0
  44. package/out/service/vo/ui-map-field.d.ts.map +1 -1
  45. package/out/service/vo/ui-map-field.js +24 -0
  46. package/out/types.d.ts +11 -0
  47. package/out/types.d.ts.map +1 -1
  48. package/out/ui-logic/ui-logic-node/end-node/end-node.js +1 -1
  49. package/out/ui-logic/utils/handle-src-val.js +1 -1
  50. package/out/utils/index.d.ts +1 -0
  51. package/out/utils/index.d.ts.map +1 -1
  52. package/out/utils/index.js +1 -0
  53. package/out/utils/raw-value-util/raw-value-util.d.ts +23 -0
  54. package/out/utils/raw-value-util/raw-value-util.d.ts.map +1 -0
  55. package/out/utils/raw-value-util/raw-value-util.js +37 -0
  56. package/package.json +4 -4
  57. package/src/config/global-config.ts +1 -0
  58. package/src/controller/common/control/control.controller.ts +4 -4
  59. package/src/controller/control/exp-bar/calendar-exp-bar.controller.ts +1 -0
  60. package/src/controller/control/exp-bar/exp-bar.controller.ts +35 -7
  61. package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +1 -0
  62. package/src/de-logic/de-logic-node/end-node/end-node.ts +1 -1
  63. package/src/de-logic/utils/handle-src-val.ts +1 -1
  64. package/src/global/global-util/global-util.ts +14 -1
  65. package/src/interface/common/i-global-config/i-global-view-config.ts +9 -0
  66. package/src/interface/controller/controller/control/i-exp-bar-control.controller.ts +8 -0
  67. package/src/interface/provider/i-control.provider.ts +22 -0
  68. package/src/interface/provider/i-view.provider.ts +22 -0
  69. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +129 -30
  70. package/src/service/service/control/control.service.ts +2 -2
  71. package/src/service/service/entity/de.service.ts +2 -2
  72. package/src/service/service/entity/method/de-action.ts +18 -12
  73. package/src/service/service/entity/method/method.ts +6 -6
  74. package/src/service/vo/control.vo.ts +10 -15
  75. package/src/service/vo/ui-map-field.ts +28 -0
  76. package/src/types.ts +12 -0
  77. package/src/ui-logic/ui-logic-node/end-node/end-node.ts +1 -1
  78. package/src/ui-logic/utils/handle-src-val.ts +1 -1
  79. package/src/utils/index.ts +1 -0
  80. package/src/utils/raw-value-util/raw-value-util.ts +37 -0
package/dist/index.esm.js CHANGED
@@ -6158,7 +6158,8 @@ var GlobalConfig = class {
6158
6158
  constructor() {
6159
6159
  // 全局视图配置
6160
6160
  this.view = {
6161
- enableDataInfoBar: true
6161
+ enableDataInfoBar: true,
6162
+ enableExpCache: true
6162
6163
  };
6163
6164
  // 全局表格配置
6164
6165
  this.grid = {
@@ -8578,6 +8579,36 @@ var TextUtil = class {
8578
8579
  }
8579
8580
  };
8580
8581
 
8582
+ // src/utils/raw-value-util/raw-value-util.ts
8583
+ var RawValueUtil = class {
8584
+ /**
8585
+ * 字符串是否完全由整数/浮点数组成
8586
+ *
8587
+ * @param {string} str
8588
+ * @return {*}
8589
+ */
8590
+ isNumber(str) {
8591
+ return /^-?\d+(\.\d+)?$/.test(str);
8592
+ }
8593
+ /**
8594
+ * 转换直接值
8595
+ *
8596
+ * @param {string} val
8597
+ * @return {*}
8598
+ */
8599
+ format(val) {
8600
+ let tempVal = val;
8601
+ if (val !== void 0) {
8602
+ if (val === "true" || val === "false") {
8603
+ tempVal = val === "true";
8604
+ } else if (this.isNumber(val)) {
8605
+ tempVal = parseFloat(val);
8606
+ }
8607
+ }
8608
+ return tempVal;
8609
+ }
8610
+ };
8611
+
8581
8612
  // src/command/app/open-app-view/open-app-view.ts
8582
8613
  import { ModelError as ModelError3, RuntimeError as RuntimeError4 } from "@ibiz-template/core";
8583
8614
  var _OpenAppViewCommand = class _OpenAppViewCommand {
@@ -12017,7 +12048,7 @@ var EndNode = class extends DELogicNode {
12017
12048
  ctx.result = null;
12018
12049
  break;
12019
12050
  case "SRCVALUE":
12020
- ctx.result = rawValue;
12051
+ ctx.result = ibiz.util.rawValue.format(rawValue);
12021
12052
  break;
12022
12053
  case "LOGICPARAM":
12023
12054
  ctx.result = ctx.params[returnParamId];
@@ -12055,7 +12086,7 @@ function handleSrcVal(ctx, srcValParams) {
12055
12086
  case "NONEVALUE":
12056
12087
  return void 0;
12057
12088
  case "SRCVALUE":
12058
- return srcValue;
12089
+ return ibiz.util.rawValue.format(srcValue);
12059
12090
  case "WEBCONTEXT":
12060
12091
  case "VIEWPARAM":
12061
12092
  value = ctx.viewParams;
@@ -12683,18 +12714,18 @@ var DEActionMethod = class extends Method {
12683
12714
  if (!deLogic) {
12684
12715
  throw new RuntimeModelError18(this.method, "\u7F3A\u5C11\u5B9E\u4F53\u5904\u7406\u903B\u8F91");
12685
12716
  }
12686
- return execDELogicAction(deLogic, context, data, params);
12717
+ return execDELogicAction(deLogic, context, data || {}, params || {});
12687
12718
  }
12688
- if (!this.isLocalMode) {
12719
+ if (data && !this.isLocalMode) {
12689
12720
  data = await this.input.handle(context, data);
12690
12721
  }
12691
- if (!["READ", "GETDRAFT"].includes(this.method.actionMode)) {
12692
- await execFieldLogics(this.entity, "change", context, data, params);
12722
+ if (data && !["READ", "GETDRAFT"].includes(this.method.actionMode)) {
12723
+ await execFieldLogics(this.entity, "change", context, data, params || {});
12693
12724
  }
12694
12725
  let result;
12695
12726
  switch (this.method.codeName) {
12696
12727
  case "Create":
12697
- result = await this.create(context, data, params);
12728
+ result = await this.create(context, data, params || {});
12698
12729
  break;
12699
12730
  case "Get":
12700
12731
  result = await this.get(context, params);
@@ -12726,14 +12757,20 @@ var DEActionMethod = class extends Method {
12726
12757
  default: {
12727
12758
  let path2 = this.calcPath(context);
12728
12759
  if (this.method.needResourceKey) {
12729
- path2 = "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()] || data[this.entity.keyAppDEFieldId]);
12760
+ path2 = "".concat(path2, "/").concat(context[this.entity.codeName.toLowerCase()] || (data == null ? void 0 : data[this.entity.keyAppDEFieldId]));
12730
12761
  }
12731
12762
  const res = await this.request(path2, context, data, params);
12732
12763
  res.data = await this.result.handle(context, res.data);
12733
12764
  result = res;
12734
12765
  }
12735
12766
  }
12736
- await execFieldLogics(this.entity, "compute", context, result.data, params);
12767
+ await execFieldLogics(
12768
+ this.entity,
12769
+ "compute",
12770
+ context,
12771
+ result.data,
12772
+ params || {}
12773
+ );
12737
12774
  return result;
12738
12775
  }
12739
12776
  /**
@@ -13212,7 +13249,7 @@ var DEService = class {
13212
13249
  * @param {IParams} [params2={}] 查询参数
13213
13250
  * @return {*} {Promise<IHttpResponse>}
13214
13251
  */
13215
- exec(id, context, params = {}, params2 = {}) {
13252
+ exec(id, context, params, params2) {
13216
13253
  const method = this.getMethod(id);
13217
13254
  if (method) {
13218
13255
  return method.exec(context, params, params2);
@@ -13222,7 +13259,6 @@ var DEService = class {
13222
13259
  };
13223
13260
 
13224
13261
  // src/service/vo/control.vo.ts
13225
- import { DataTypes } from "@ibiz-template/core";
13226
13262
  import { clone as clone10, isNil as isNil8 } from "ramda";
13227
13263
  var ControlVO = class _ControlVO {
13228
13264
  /**
@@ -13318,8 +13354,7 @@ var ControlVO = class _ControlVO {
13318
13354
  });
13319
13355
  this.$dataUIMap.forEach((mapField, key) => {
13320
13356
  const value = mapField.dataKey;
13321
- const forceNumber = mapField.dataType !== void 0 && DataTypes.isNumber(mapField.dataType);
13322
- this.linkProperty(key, value, mapField.isOriginField, forceNumber);
13357
+ this.linkProperty(key, value, mapField);
13323
13358
  });
13324
13359
  Object.keys($origin).forEach((value) => {
13325
13360
  if (!Object.prototype.hasOwnProperty.call(this, value)) {
@@ -13339,7 +13374,8 @@ var ControlVO = class _ControlVO {
13339
13374
  * @param {boolean} [forceNumber=false] 是否强制转换成数值,是的话set的时候转成数值
13340
13375
  * @returns {*}
13341
13376
  */
13342
- linkProperty(uiKey, dataKey, isOriginField = true, forceNumber = false) {
13377
+ linkProperty(uiKey, dataKey, mapField) {
13378
+ const isOriginField = mapField ? mapField.isOriginField : true;
13343
13379
  if (uiKey === "srfuf") {
13344
13380
  return;
13345
13381
  }
@@ -13351,14 +13387,12 @@ var ControlVO = class _ControlVO {
13351
13387
  return uiKey === "srfkey" ? this.$origin[dataKey] || this.$origin[uiKey] : this.$origin[dataKey];
13352
13388
  },
13353
13389
  set(val) {
13354
- let val2 = forceNumber && !isNil8(val) && val !== "" ? Number(val) : val;
13355
- if (Number.isNaN(val2)) {
13356
- val2 = val;
13357
- ibiz.log.error("".concat(val, "\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57"));
13358
- }
13359
- this.$origin[dataKey] = val2;
13390
+ this.$origin[dataKey] = mapField ? mapField.convertVal(val) : val;
13360
13391
  }
13361
13392
  });
13393
+ if (mapField) {
13394
+ this[uiKey] = mapField.convertVal(this.$origin[dataKey]);
13395
+ }
13362
13396
  } else {
13363
13397
  Object.defineProperty(this, uiKey, {
13364
13398
  enumerable: true,
@@ -13454,7 +13488,7 @@ var ControlService = class {
13454
13488
  * @param {IParams} [params={}] 视图参数或数据
13455
13489
  * @returns {*} {Promise<IHttpResponse>}
13456
13490
  */
13457
- async exec(methodName, context, data = {}, params = {}) {
13491
+ async exec(methodName, context, data, params) {
13458
13492
  const res = await this.app.deService.exec(
13459
13493
  this.model.appDataEntityId,
13460
13494
  methodName,
@@ -14037,6 +14071,7 @@ var TreeStaticNodeData = class extends TreeNodeData {
14037
14071
  };
14038
14072
 
14039
14073
  // src/service/vo/ui-map-field.ts
14074
+ import { DataTypes } from "@ibiz-template/core";
14040
14075
  import { isNil as isNil9 } from "ramda";
14041
14076
  var UIMapField = class {
14042
14077
  constructor(uiKey, dataKey, opts = {}) {
@@ -14065,6 +14100,26 @@ var UIMapField = class {
14065
14100
  this.dataType = opts.dataType;
14066
14101
  }
14067
14102
  }
14103
+ /**
14104
+ * 值转换
14105
+ * @author lxm
14106
+ * @date 2023-09-14 06:45:44
14107
+ * @param {unknown} value 原值
14108
+ */
14109
+ convertVal(value) {
14110
+ if (!this.dataType) {
14111
+ return value;
14112
+ }
14113
+ if (DataTypes.isNumber(this.dataType)) {
14114
+ const numVal = !isNil9(value) && value !== "" ? Number(value) : value;
14115
+ if (Number.isNaN(numVal)) {
14116
+ ibiz.log.debug("".concat(value, "\u4E0D\u80FD\u8F6C\u6362\u6210\u6570\u5B57"));
14117
+ return value;
14118
+ }
14119
+ return numVal;
14120
+ }
14121
+ return value;
14122
+ }
14068
14123
  };
14069
14124
 
14070
14125
  // src/service/vo/calendar-item-data/calendar-item-data.ts
@@ -15887,10 +15942,10 @@ var ControlController = class extends BaseController {
15887
15942
  constructor(model, context, params, ctx) {
15888
15943
  super(model, context, params, ctx);
15889
15944
  /**
15890
- * 子部件适配器
15945
+ * 子适配器
15891
15946
  * @author lxm
15892
15947
  * @date 2023-07-19 04:14:50
15893
- * @type {{ [key: string]: IControlProvider }}
15948
+ * @type {{ [key: string]: IProvider }}
15894
15949
  */
15895
15950
  this.providers = {};
15896
15951
  this.registerToCtx();
@@ -18369,7 +18424,7 @@ var EndNode2 = class extends UILogicNode {
18369
18424
  ctx.result = null;
18370
18425
  break;
18371
18426
  case "SRCVALUE":
18372
- ctx.result = rawValue;
18427
+ ctx.result = ibiz.util.rawValue.format(rawValue);
18373
18428
  break;
18374
18429
  case "LOGICPARAM":
18375
18430
  ctx.result = ctx.params[returnParamId];
@@ -18405,7 +18460,7 @@ function handleSrcVal2(ctx, srcValParams) {
18405
18460
  case "NONEVALUE":
18406
18461
  return void 0;
18407
18462
  case "SRCVALUE":
18408
- return srcValue;
18463
+ return ibiz.util.rawValue.format(srcValue);
18409
18464
  case "WEBCONTEXT":
18410
18465
  case "VIEWPARAM":
18411
18466
  value = ctx.viewParams;
@@ -20543,13 +20598,20 @@ var ExpBarControlController = class extends ControlController {
20543
20598
  const selectItem = (_a = this.xDataController) == null ? void 0 : _a.state.items.find(
20544
20599
  (item) => item[this.navKeyName] === this.state.srfnav
20545
20600
  );
20546
- if (selectItem) {
20601
+ const routeAndHasSub = this.routeDepth && window.location.hash.split("/").length > this.routeDepth * 2 + 2;
20602
+ console.log("routeAndHasSub", routeAndHasSub);
20603
+ if (routeAndHasSub) {
20604
+ if (selectItem) {
20605
+ this.xDataController.setSelection([selectItem]);
20606
+ }
20607
+ this._evt.emit("onNavViewChange", {
20608
+ navViewMsg: { key: this.state.srfnav },
20609
+ context: this.context
20610
+ });
20611
+ } else if (selectItem) {
20612
+ this.xDataController.setActive(selectItem);
20547
20613
  this.xDataController.setSelection([selectItem]);
20548
20614
  }
20549
- this._evt.emit("onNavViewChange", {
20550
- navViewMsg: { key: this.state.srfnav },
20551
- context: this.context
20552
- });
20553
20615
  }
20554
20616
  /**
20555
20617
  * 导航页面首次打开且没有回显时,
@@ -20562,6 +20624,7 @@ var ExpBarControlController = class extends ControlController {
20562
20624
  defaultNavByFirstItem() {
20563
20625
  const data = this.xDataController.state.items[0];
20564
20626
  if (!data) {
20627
+ this.state.srfnav = "";
20565
20628
  this._evt.emit("onNavViewChange", { navViewMsg: { key: "" } });
20566
20629
  return;
20567
20630
  }
@@ -20614,6 +20677,7 @@ var ExpBarControlController = class extends ControlController {
20614
20677
  const tempContext = Object.assign(context.clone(), resultContext, {
20615
20678
  currentSrfNav: data[this.navKeyName]
20616
20679
  });
20680
+ this.state.srfnav = data[this.navKeyName];
20617
20681
  const tempParams = { ...resultParams };
20618
20682
  return { context: tempContext, params: tempParams };
20619
20683
  }
@@ -20680,6 +20744,18 @@ var ExpBarControlController = class extends ControlController {
20680
20744
  }
20681
20745
  });
20682
20746
  }
20747
+ /**
20748
+ * 路由变更处理回调
20749
+ * @author lxm
20750
+ * @date 2023-09-14 07:03:39
20751
+ * @param {{ srfnav?: string; path: string }} info 当前系统的路由的从一级到最后一级的所有路径。
20752
+ */
20753
+ onRouterChange(info) {
20754
+ if (this.state.srfnav !== info.srfnav) {
20755
+ this.state.srfnav = info.srfnav;
20756
+ this.defaultNavBySrfnav();
20757
+ }
20758
+ }
20683
20759
  };
20684
20760
 
20685
20761
  // src/controller/control/exp-bar/calendar-exp-bar.controller.ts
@@ -20743,6 +20819,7 @@ var CalendarExpBarController = class extends ExpBarControlController {
20743
20819
  this.params
20744
20820
  );
20745
20821
  context.currentSrfNav = item.navId;
20822
+ this.state.srfnav = item.navId;
20746
20823
  return {
20747
20824
  key: item.navId,
20748
20825
  context,
@@ -20838,6 +20915,7 @@ var TreeExpBarController = class extends ExpBarControlController {
20838
20915
  }
20839
20916
  const result = this.prepareParams(nodeModel, deData, context, params);
20840
20917
  result.context.currentSrfNav = nodeId;
20918
+ this.state.srfnav = nodeId;
20841
20919
  return {
20842
20920
  key: nodeId,
20843
20921
  viewId: nodeModel.navAppViewId,
@@ -28732,6 +28810,13 @@ var GlobalUtil = class {
28732
28810
  * @date 2023-08-28 23:08:59
28733
28811
  */
28734
28812
  this.hbs = new HandlebarsUtil();
28813
+ /**
28814
+ * 直接值工具
28815
+ *
28816
+ * @author zhujiamin
28817
+ * @date 2023-08-24 11:08:28
28818
+ */
28819
+ this.rawValue = new RawValueUtil();
28735
28820
  }
28736
28821
  /**
28737
28822
  * 显示应用级别的加载提示
@@ -29436,6 +29521,29 @@ var AppUILogicExecutor = class extends LogicExecutor {
29436
29521
  rest
29437
29522
  );
29438
29523
  }
29524
+ async calcOpenViewRef(appUILogic, parameters) {
29525
+ const appDataEntityId = parameters.view.model.appDataEntityId;
29526
+ const formTypeName = await getFormTypeFieldName(appDataEntityId);
29527
+ if (!formTypeName) {
29528
+ throw new RuntimeModelError56(
29529
+ appUILogic,
29530
+ "".concat(appDataEntityId, "\u5B9E\u4F53\u7F3A\u5C11\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027")
29531
+ );
29532
+ }
29533
+ const { data } = parameters;
29534
+ const formTypeValue = data[0][formTypeName];
29535
+ if (!formTypeValue) {
29536
+ throw new RuntimeModelError56(appUILogic, "\u6570\u636E\u6E90\u65E0\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027\u503C");
29537
+ }
29538
+ const openViewRefs = appUILogic.openDataAppViews;
29539
+ const findView = openViewRefs == null ? void 0 : openViewRefs.find((item) => item.refMode === formTypeValue);
29540
+ if (!findView) {
29541
+ throw new RuntimeError52(
29542
+ "\u6CA1\u6709\u627E\u5230\u4E0E\u8868\u5355\u7C7B\u578B".concat(formTypeValue, "\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE")
29543
+ );
29544
+ }
29545
+ return findView;
29546
+ }
29439
29547
  /**
29440
29548
  * 执行应用预置界面逻辑newdata
29441
29549
  *
@@ -29450,7 +29558,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
29450
29558
  */
29451
29559
  async executeNewDataAppUILogic(appUILogic, parameters) {
29452
29560
  const { context, params, ...rest } = parameters;
29453
- const { data } = parameters;
29561
+ const { data, view } = parameters;
29454
29562
  const { enableWizardAdd, enableBatchAdd, batchAddOnly, newDataAppView } = appUILogic;
29455
29563
  let newViewRef;
29456
29564
  if (enableWizardAdd) {
@@ -29459,7 +29567,19 @@ var AppUILogicExecutor = class extends LogicExecutor {
29459
29567
  return { ok: false };
29460
29568
  }
29461
29569
  } else if (enableBatchAdd) {
29462
- throw new ModelError30(appUILogic, "enableBatchAdd\u6682\u672A\u652F\u6301");
29570
+ const parentDeName = calcDeCodeNameById(
29571
+ view.parentView.model.appDataEntityId
29572
+ );
29573
+ const batchViews = appUILogic.batchAddAppViews;
29574
+ newViewRef = batchViews == null ? void 0 : batchViews.find((viewRef) => {
29575
+ return viewRef.refMode.toLowerCase() !== parentDeName;
29576
+ });
29577
+ if (!newViewRef) {
29578
+ throw new RuntimeModelError56(
29579
+ appUILogic,
29580
+ "\u6CA1\u6709\u627E\u5230\u6279\u6DFB\u52A0\u9700\u8981\u6253\u5F00\u7684\u9009\u62E9\u89C6\u56FE"
29581
+ );
29582
+ }
29463
29583
  } else if (batchAddOnly) {
29464
29584
  throw new ModelError30(appUILogic, "batchAddOnly\u6682\u672A\u652F\u6301");
29465
29585
  } else {
@@ -29487,13 +29607,17 @@ var AppUILogicExecutor = class extends LogicExecutor {
29487
29607
  _data.srfkey = void 0;
29488
29608
  tempParams = Object.assign(tempParams, _data.$origin);
29489
29609
  }
29490
- return ibiz.commands.execute(
29610
+ const result = await ibiz.commands.execute(
29491
29611
  OpenAppViewCommand.TAG,
29492
29612
  newViewRef.refAppViewId,
29493
29613
  tempContext,
29494
29614
  tempParams,
29495
29615
  rest
29496
29616
  );
29617
+ if (enableBatchAdd && result.data) {
29618
+ await this.doBatchAdd(appUILogic, result.data, context, newViewRef);
29619
+ }
29620
+ return result;
29497
29621
  }
29498
29622
  /**
29499
29623
  * 获取向导新建视图引用
@@ -29536,28 +29660,71 @@ var AppUILogicExecutor = class extends LogicExecutor {
29536
29660
  }
29537
29661
  return findView;
29538
29662
  }
29539
- async calcOpenViewRef(appUILogic, parameters) {
29540
- const appDataEntityId = parameters.view.model.appDataEntityId;
29541
- const formTypeName = await getFormTypeFieldName(appDataEntityId);
29542
- if (!formTypeName) {
29543
- throw new RuntimeModelError56(
29544
- appUILogic,
29545
- "".concat(appDataEntityId, "\u5B9E\u4F53\u7F3A\u5C11\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027")
29546
- );
29547
- }
29548
- const { data } = parameters;
29549
- const formTypeValue = data[0][formTypeName];
29550
- if (!formTypeValue) {
29551
- throw new RuntimeModelError56(appUILogic, "\u6570\u636E\u6E90\u65E0\u8868\u5355\u7C7B\u578B\u5E94\u7528\u5B9E\u4F53\u5C5E\u6027\u503C");
29552
- }
29553
- const openViewRefs = appUILogic.openDataAppViews;
29554
- const findView = openViewRefs == null ? void 0 : openViewRefs.find((item) => item.refMode === formTypeValue);
29555
- if (!findView) {
29556
- throw new RuntimeError52(
29557
- "\u6CA1\u6709\u627E\u5230\u4E0E\u8868\u5355\u7C7B\u578B".concat(formTypeValue, "\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE")
29663
+ /**
29664
+ * 拿选中的数据做批添加新建
29665
+ * @author lxm
29666
+ * @date 2023-09-15 05:20:02
29667
+ * @protected
29668
+ * @param {IAppUIOpenDataLogic} appUILogic
29669
+ * @param {IData[]} selections
29670
+ * @param {IContext} context
29671
+ * @param {IAppUILogicRefViewBase} newViewRef
29672
+ * @return {*} {Promise<void>}
29673
+ */
29674
+ async doBatchAdd(appUILogic, selections, context, newViewRef) {
29675
+ var _a;
29676
+ if (selections == null ? void 0 : selections.length) {
29677
+ const selfDe = await ibiz.hub.getAppDataEntity(
29678
+ appUILogic.appDataEntityId,
29679
+ context.srfappid
29558
29680
  );
29681
+ const minorDERs = selfDe.minorAppDERSs;
29682
+ const pickParentDeName = newViewRef.refMode.toLowerCase();
29683
+ if (!minorDERs) {
29684
+ throw new RuntimeModelError56(selfDe, "\u5B9E\u4F53\u6CA1\u6709\u4ECE\u5173\u7CFB\u96C6\u5408\uFF01");
29685
+ }
29686
+ let pickParentFieldName;
29687
+ minorDERs == null ? void 0 : minorDERs.forEach((item) => {
29688
+ const majorDeName = calcDeCodeNameById(item.majorAppDataEntityId);
29689
+ if (pickParentDeName === majorDeName) {
29690
+ pickParentFieldName = item.parentAppDEFieldId;
29691
+ }
29692
+ });
29693
+ const openViewKeyParam = (_a = newViewRef.navigateParams) == null ? void 0 : _a.find((navParam) => {
29694
+ return navParam.key === "keymapping";
29695
+ });
29696
+ let addData = [];
29697
+ if (openViewKeyParam) {
29698
+ const keyValuePairs = openViewKeyParam.value.split(";");
29699
+ const keyMapping = {};
29700
+ for (const pair of keyValuePairs) {
29701
+ const [sourceKey, targetKey] = pair.split(":");
29702
+ if (sourceKey && targetKey) {
29703
+ keyMapping[sourceKey] = targetKey;
29704
+ }
29705
+ }
29706
+ addData = selections.map((item) => {
29707
+ const tempData = {
29708
+ [pickParentFieldName]: item.srfkey
29709
+ };
29710
+ for (const key in keyMapping) {
29711
+ if (Object.prototype.hasOwnProperty.call(keyMapping, key)) {
29712
+ const targetKey = keyMapping[key];
29713
+ if (Object.prototype.hasOwnProperty.call(item, key)) {
29714
+ tempData[targetKey] = item[key];
29715
+ }
29716
+ }
29717
+ }
29718
+ return tempData;
29719
+ });
29720
+ } else {
29721
+ addData = selections.map((item) => ({
29722
+ [pickParentFieldName]: item.srfkey
29723
+ }));
29724
+ }
29725
+ const service = ibiz.hub.getApp(context.srfappid).deService;
29726
+ await service.exec(selfDe.id, "Create", context, addData);
29559
29727
  }
29560
- return findView;
29561
29728
  }
29562
29729
  };
29563
29730
 
@@ -29885,6 +30052,7 @@ export {
29885
30052
  PortletPartController,
29886
30053
  PortletPartState,
29887
30054
  QXEventEx,
30055
+ RawValueUtil,
29888
30056
  RegisterCenter,
29889
30057
  RemotePluginItem,
29890
30058
  ScriptFactory,