@ibiz-template/runtime 0.5.1 → 0.5.2

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/dist/index.esm.js CHANGED
@@ -21863,7 +21863,6 @@ var EditFormController = class extends FormController {
21863
21863
  )
21864
21864
  );
21865
21865
  }
21866
- await awaitTimeout(2e3);
21867
21866
  } finally {
21868
21867
  if (showBusyIndicator) {
21869
21868
  this.endLoading();
@@ -29966,6 +29965,27 @@ var AppHub = class {
29966
29965
  }
29967
29966
  throw new RuntimeError61("\u89C6\u56FE[".concat(id, "]\u4E0D\u5B58\u5728"));
29968
29967
  }
29968
+ /**
29969
+ * 根据视图模型路径,加参数重新计算视图模型
29970
+ *
29971
+ * @author chitanda
29972
+ * @date 2024-01-08 11:01:54
29973
+ * @param {string} appId
29974
+ * @param {string} modelPath
29975
+ * @param {IParams} params
29976
+ * @return {*} {Promise<IAppView>}
29977
+ */
29978
+ async loadAppView(appId2, modelPath, params) {
29979
+ if (this.modelLoaderProvider) {
29980
+ const model = await this.modelLoaderProvider.loadAppView(
29981
+ appId2,
29982
+ modelPath,
29983
+ params
29984
+ );
29985
+ return model;
29986
+ }
29987
+ throw new RuntimeError61("\u89C6\u56FE[".concat(modelPath, "]\u4E0D\u5B58\u5728"));
29988
+ }
29969
29989
  /**
29970
29990
  * 根据应用实体代码名称查找应用视图
29971
29991
  *
@@ -31544,7 +31564,13 @@ var AppUILogicExecutor = class extends LogicExecutor {
31544
31564
  rest
31545
31565
  );
31546
31566
  if (enableBatchAdd && result.data) {
31547
- await this.doBatchAdd(appUILogic, result.data, context, newViewRef);
31567
+ await this.doBatchAdd(
31568
+ appUILogic,
31569
+ result.data,
31570
+ context,
31571
+ newViewRef,
31572
+ parameters.view
31573
+ );
31548
31574
  }
31549
31575
  return result;
31550
31576
  }
@@ -31605,7 +31631,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
31605
31631
  * @param {IAppUILogicRefViewBase} newViewRef
31606
31632
  * @return {*} {Promise<void>}
31607
31633
  */
31608
- async doBatchAdd(appUILogic, selections, context, newViewRef) {
31634
+ async doBatchAdd(appUILogic, selections, context, newViewRef, view) {
31609
31635
  var _a;
31610
31636
  if (selections == null ? void 0 : selections.length) {
31611
31637
  const selfDe = await ibiz.hub.getAppDataEntity(
@@ -31617,45 +31643,43 @@ var AppUILogicExecutor = class extends LogicExecutor {
31617
31643
  if (!minorDERs) {
31618
31644
  throw new RuntimeModelError69(selfDe, "\u5B9E\u4F53\u6CA1\u6709\u4ECE\u5173\u7CFB\u96C6\u5408\uFF01");
31619
31645
  }
31620
- let pickParentFieldName;
31646
+ let pickParentFieldName = "";
31621
31647
  minorDERs == null ? void 0 : minorDERs.forEach((item) => {
31622
31648
  const majorDeName = calcDeCodeNameById(item.majorAppDataEntityId);
31623
31649
  if (pickParentDeName === majorDeName) {
31624
31650
  pickParentFieldName = item.parentAppDEFieldId;
31625
31651
  }
31626
31652
  });
31627
- const openViewKeyParam = (_a = newViewRef.navigateParams) == null ? void 0 : _a.find((navParam) => {
31628
- return navParam.key === "keymapping";
31629
- });
31630
- let addData = [];
31631
- if (openViewKeyParam) {
31632
- const keyValuePairs = openViewKeyParam.value.split(";");
31633
- const keyMapping = {};
31653
+ if (pickParentFieldName === void 0) {
31654
+ throw new RuntimeError67(
31655
+ "\u6CA1\u6709\u627E\u5230".concat(pickParentDeName, "\u5728\u5F53\u524D\u5B9E\u4F53\u7684\u5916\u952E\u5C5E\u6027")
31656
+ );
31657
+ }
31658
+ const keyMapping = {
31659
+ srfkey: pickParentFieldName
31660
+ };
31661
+ const propertyMap = (_a = view.model.appViewParams) == null ? void 0 : _a.find(
31662
+ (item) => item.key.toLowerCase() === "PROPERTYMAP".toLowerCase()
31663
+ );
31664
+ if (propertyMap) {
31665
+ const keyValuePairs = propertyMap.value.split(",");
31634
31666
  for (const pair of keyValuePairs) {
31635
31667
  const [sourceKey, targetKey] = pair.split(":");
31636
31668
  if (sourceKey && targetKey) {
31637
31669
  keyMapping[sourceKey] = targetKey;
31638
31670
  }
31639
31671
  }
31640
- addData = selections.map((item) => {
31641
- const tempData = {
31642
- [pickParentFieldName]: item.srfkey
31643
- };
31644
- for (const key in keyMapping) {
31645
- if (Object.prototype.hasOwnProperty.call(keyMapping, key)) {
31646
- const targetKey = keyMapping[key];
31647
- if (Object.prototype.hasOwnProperty.call(item, key)) {
31648
- tempData[targetKey] = item[key];
31649
- }
31650
- }
31651
- }
31652
- return tempData;
31653
- });
31654
- } else {
31655
- addData = selections.map((item) => ({
31656
- [pickParentFieldName]: item.srfkey
31657
- }));
31658
31672
  }
31673
+ ibiz.log.debug("\u6279\u91CF\u65B0\u5EFA\u8F6C\u6362\u6620\u5C04\u5C5E\u6027", keyMapping);
31674
+ const addData = selections.map((item) => {
31675
+ const tempData = {};
31676
+ Object.keys(keyMapping).forEach((key) => {
31677
+ const targetKey = keyMapping[key];
31678
+ tempData[targetKey] = item[key];
31679
+ });
31680
+ return tempData;
31681
+ });
31682
+ ibiz.log.debug("\u6279\u91CF\u65B0\u5EFA\u521B\u5EFA\u6570\u636E", addData);
31659
31683
  const service = ibiz.hub.getApp(context.srfappid).deService;
31660
31684
  await service.exec(selfDe.id, "Create", context, addData);
31661
31685
  }