@ibiz-template/runtime 0.7.16-alpha.0 → 0.7.16

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
@@ -8179,6 +8179,37 @@ async function getToolbarItemProvider(model) {
8179
8179
  return provider;
8180
8180
  }
8181
8181
 
8182
+ // src/register/helper/ac-item-register.ts
8183
+ var AC_ITEM_PROVIDER_PREFIX = "AC_ITEM";
8184
+ function registerAcItemProvider(key, callback) {
8185
+ ibiz.register.register("".concat(AC_ITEM_PROVIDER_PREFIX, "_").concat(key), callback);
8186
+ }
8187
+ function getProvider18(key) {
8188
+ return ibiz.register.get(
8189
+ "".concat(AC_ITEM_PROVIDER_PREFIX, "_").concat(key)
8190
+ );
8191
+ }
8192
+ async function getAcItemProvider(model) {
8193
+ let provider;
8194
+ const { itemSysPFPluginId, appId: appId2 } = model;
8195
+ if (itemSysPFPluginId) {
8196
+ const pluginKey = await getPluginRegisterKey(itemSysPFPluginId, appId2);
8197
+ if (pluginKey) {
8198
+ provider = getProvider18(pluginKey);
8199
+ }
8200
+ if (!provider) {
8201
+ ibiz.log.error(
8202
+ ibiz.i18n.t("runtime.register.helper.acItem", {
8203
+ pluginKey
8204
+ })
8205
+ );
8206
+ } else {
8207
+ return provider;
8208
+ }
8209
+ }
8210
+ return provider;
8211
+ }
8212
+
8182
8213
  // src/service/utils/app-counter/app-counter.ts
8183
8214
  import { IBizContext, RuntimeError as RuntimeError15 } from "@ibiz-template/core";
8184
8215
  import { notNilEmpty as notNilEmpty5, QXEvent as QXEvent3 } from "qx-util";
@@ -9608,6 +9639,23 @@ function convertToObject(input) {
9608
9639
  }
9609
9640
  return result;
9610
9641
  }
9642
+ function convertArrayToListMap(arr) {
9643
+ const result = {};
9644
+ arr.forEach((obj) => {
9645
+ result[obj.srflistmapfield] = obj;
9646
+ delete obj.srflistmapfield;
9647
+ });
9648
+ return result;
9649
+ }
9650
+ function convertListMapToArray(obj) {
9651
+ const result = [];
9652
+ Object.keys(obj).forEach((key) => {
9653
+ const temp = obj[key];
9654
+ temp.srflistmapfield = key;
9655
+ result.push(temp);
9656
+ });
9657
+ return result;
9658
+ }
9611
9659
 
9612
9660
  // src/service/utils/dyna-sys-params/dyna-sys-params.ts
9613
9661
  async function calcDynaSysParams(appDataEntityId, context, opts = {}) {
@@ -10561,33 +10609,6 @@ var MethodDto = class {
10561
10609
  this.fields = [];
10562
10610
  }
10563
10611
  }
10564
- /**
10565
- * 转换数组成ListMap
10566
- *
10567
- * @param {IData[]} arr
10568
- * @return {*} listMap
10569
- */
10570
- convertArrayToListMap(arr) {
10571
- const result = {};
10572
- arr.forEach((obj, index) => {
10573
- result[index + 1] = obj;
10574
- });
10575
- return result;
10576
- }
10577
- /**
10578
- * 转换ListMap成数组
10579
- *
10580
- * @param {listMap} obj
10581
- * @return {*} IData[]
10582
- */
10583
- convertListMapToArray(obj) {
10584
- const result = [];
10585
- Object.keys(obj).forEach((key) => {
10586
- const index = parseInt(key, 10);
10587
- result[index - 1] = obj[index];
10588
- });
10589
- return result;
10590
- }
10591
10612
  /**
10592
10613
  * 请求参数组合 DTO
10593
10614
  *
@@ -10615,7 +10636,7 @@ var MethodDto = class {
10615
10636
  case "DTOS": {
10616
10637
  if (field.listMap) {
10617
10638
  if (data[key]) {
10618
- params[key] = data[key].length === 0 ? null : this.convertArrayToListMap(data[key]);
10639
+ params[key] = data[key].length === 0 ? null : convertArrayToListMap(data[key]);
10619
10640
  }
10620
10641
  } else {
10621
10642
  if (data[key] !== void 0 && ignore === false) {
@@ -10701,7 +10722,7 @@ var MethodDto = class {
10701
10722
  const all = this.fields.filter((field) => field.type === "DTOS").map(async (field) => {
10702
10723
  const key = field.codeName.toLowerCase();
10703
10724
  if (field.listMap && typeof datum[key] === "object") {
10704
- datum[key] = this.convertListMapToArray(datum[key]);
10725
+ datum[key] = convertListMapToArray(datum[key]);
10705
10726
  } else {
10706
10727
  if (!field.refAppDataEntityId) {
10707
10728
  return;
@@ -10773,6 +10794,26 @@ var MethodDto = class {
10773
10794
  }
10774
10795
  }
10775
10796
  }
10797
+ /**
10798
+ * 格式化数据
10799
+ *
10800
+ * @author tony001
10801
+ * @date 2024-05-21 23:05:18
10802
+ * @param {IContext} context
10803
+ * @param {IData} data
10804
+ * @return {*} {IData[]}
10805
+ */
10806
+ format(context, data) {
10807
+ const params = {};
10808
+ for (let i = 0; i < this.fields.length; i++) {
10809
+ const field = this.fields[i];
10810
+ const key = field.codeName.toLowerCase();
10811
+ if (field.type === "DTOS" && field.listMap && typeof data[key] === "object") {
10812
+ params[key] = convertListMapToArray(data[key]);
10813
+ }
10814
+ }
10815
+ return { ...data, ...params };
10816
+ }
10776
10817
  /**
10777
10818
  * 获取子属性 DTO
10778
10819
  *
@@ -12242,6 +12283,21 @@ var MethodInput = class {
12242
12283
  }
12243
12284
  return data;
12244
12285
  }
12286
+ /**
12287
+ * 格式化本地模式入参
12288
+ *
12289
+ * @author tony001
12290
+ * @date 2024-05-21 23:05:38
12291
+ * @param {IContext} context
12292
+ * @param {IData} data
12293
+ * @return {*} {Promise<IData>}
12294
+ */
12295
+ async format(context, data) {
12296
+ if (this.dto) {
12297
+ return this.dto.format(context, data);
12298
+ }
12299
+ return data;
12300
+ }
12245
12301
  };
12246
12302
 
12247
12303
  // src/service/service/entity/method/method-renturn.ts
@@ -12451,6 +12507,24 @@ var DEActionMethod = class extends Method {
12451
12507
  }
12452
12508
  return this.input.handle(context, data);
12453
12509
  }
12510
+ /**
12511
+ * 格式化输入参数
12512
+ *
12513
+ * @author tony001
12514
+ * @date 2024-05-21 23:05:26
12515
+ * @param {IContext} context
12516
+ * @param {(IData | IData[])} data
12517
+ * @return {*} {(Promise<IData | IData[]>)}
12518
+ */
12519
+ async inputFormat(context, data) {
12520
+ const handleListMap = (arg) => {
12521
+ return this.input.format(context, arg);
12522
+ };
12523
+ if (Array.isArray(data)) {
12524
+ return data.map((item) => handleListMap(item));
12525
+ }
12526
+ return handleListMap(data);
12527
+ }
12454
12528
  async exec(context, data, params, header) {
12455
12529
  let result;
12456
12530
  if (data && !["READ", "GETDRAFT"].includes(this.method.actionMode)) {
@@ -12466,8 +12540,12 @@ var DEActionMethod = class extends Method {
12466
12540
  }
12467
12541
  result = await execDELogicAction(deLogic, context, data, params);
12468
12542
  } else {
12469
- if (data && !this.isLocalMode) {
12470
- data = await this.inputHandle(context, data);
12543
+ if (data) {
12544
+ if (!this.isLocalMode) {
12545
+ data = await this.inputHandle(context, data);
12546
+ } else {
12547
+ data = await this.inputFormat(context, data);
12548
+ }
12471
12549
  }
12472
12550
  const methodTag = this.method.actionTag ? this.method.actionTag.toUpperCase() : this.method.codeName.toUpperCase();
12473
12551
  switch (methodTag) {
@@ -42604,6 +42682,7 @@ var RemotePluginItem = class {
42604
42682
  }
42605
42683
  };
42606
42684
  export {
42685
+ AC_ITEM_PROVIDER_PREFIX,
42607
42686
  APPMENUITEM_PROVIDER_PREFIX,
42608
42687
  APP_COUNTER_PROVIDER_PREFIX,
42609
42688
  ASYNC_ACTION_PROVIDER_PREFIX,
@@ -42891,6 +42970,7 @@ export {
42891
42970
  formatMultiData,
42892
42971
  generateEditorRules,
42893
42972
  generateRules,
42973
+ getAcItemProvider,
42894
42974
  getAllPanelField,
42895
42975
  getAppCounterProvider,
42896
42976
  getAppMenuItemProvider,
@@ -42957,6 +43037,7 @@ export {
42957
43037
  presetAppCounterProvider,
42958
43038
  presetDEMethodProvider,
42959
43039
  presetUIActionProvider,
43040
+ registerAcItemProvider,
42960
43041
  registerAppCounterProvider,
42961
43042
  registerAppMenuItemProvider,
42962
43043
  registerAsyncActionProvider,