@ibiz-template/runtime 0.7.41-alpha.133 → 0.7.41-alpha.135

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
@@ -22638,7 +22638,7 @@ var ScriptFunction = class {
22638
22638
  */
22639
22639
  formatCode(scriptCode, options) {
22640
22640
  let code = scriptCode;
22641
- if (options.singleRowReturn && !code.includes("return")) {
22641
+ if (options.singleRowReturn) {
22642
22642
  code = "return (".concat(code, ")");
22643
22643
  }
22644
22644
  if (options.isAsync) {
@@ -26973,7 +26973,7 @@ var ViewMsgController = class _ViewMsgController {
26973
26973
  testScriptCode,
26974
26974
  {
26975
26975
  isAsync: false,
26976
- singleRowReturn: true
26976
+ singleRowReturn: !testScriptCode.includes("return")
26977
26977
  }
26978
26978
  );
26979
26979
  return !!result;
@@ -47728,6 +47728,7 @@ var EditFormController = class extends FormController {
47728
47728
  this.initAnchorData();
47729
47729
  this.service = new EditFormService(this.model);
47730
47730
  await this.service.init(this.context);
47731
+ this.state.data = this.service.toUIData({});
47731
47732
  this.autoSave = debounce(this.autoSave.bind(this), 500, {
47732
47733
  trailing: true
47733
47734
  });
@@ -49231,6 +49232,13 @@ async function newRowDynamic(c) {
49231
49232
  var GridController = class extends MDControlController {
49232
49233
  constructor() {
49233
49234
  super(...arguments);
49235
+ /**
49236
+ * @description 行状态索引缓存
49237
+ * @protected
49238
+ * @type {Map<string, number>}
49239
+ * @memberof GridController
49240
+ */
49241
+ this.rowStateIndexMap = /* @__PURE__ */ new Map();
49234
49242
  /**
49235
49243
  * 是否有配置宽度自适应列
49236
49244
  *
@@ -49805,6 +49813,7 @@ var GridController = class extends MDControlController {
49805
49813
  * @param rows
49806
49814
  */
49807
49815
  async updateRows(rows) {
49816
+ this.rowStateIndexMap.clear();
49808
49817
  for (const row of rows) {
49809
49818
  await Promise.all([
49810
49819
  ...Object.values(row.uaColStates).map(
@@ -50813,8 +50822,11 @@ var GridController = class extends MDControlController {
50813
50822
  findRowStateIndex(data) {
50814
50823
  const isCreate = data.srfuf === 0 /* CREATE */;
50815
50824
  const compareKey = isCreate ? "tempsrfkey" : "srfkey";
50825
+ if (data[compareKey] && this.rowStateIndexMap.has(data[compareKey])) {
50826
+ return this.rowStateIndexMap.get(data[compareKey]);
50827
+ }
50816
50828
  const unionKeys = this.controlParams.unionkeys ? this.controlParams.unionkeys.split("|") : void 0;
50817
- return this.state.rows.findIndex((item) => {
50829
+ const index = this.state.rows.findIndex((item) => {
50818
50830
  if (unionKeys) {
50819
50831
  let result = item.data[compareKey] === data[compareKey];
50820
50832
  if (!result)
@@ -50830,6 +50842,10 @@ var GridController = class extends MDControlController {
50830
50842
  }
50831
50843
  return item.data[compareKey] === data[compareKey];
50832
50844
  });
50845
+ if (data[compareKey]) {
50846
+ this.rowStateIndexMap.set(data[compareKey], index);
50847
+ }
50848
+ return index;
50833
50849
  }
50834
50850
  /**
50835
50851
  * 查找rowState
@@ -85701,23 +85717,53 @@ var AppHub = class {
85701
85717
  return targetCodeListMap == null ? void 0 : targetCodeListMap.get(id);
85702
85718
  }
85703
85719
  /**
85704
- * @description 加载扩展插件
85720
+ * @description 加载主应用扩展插件
85705
85721
  * @public
85706
- * @param {string} appId
85707
85722
  * @returns {*} {Promise<void>}
85708
85723
  * @memberof AppHub
85709
85724
  */
85710
- async loadExtensionPlugin(appId2) {
85725
+ async loadMainExtensionPlugin() {
85726
+ let index = 1;
85727
+ let success = true;
85728
+ do {
85729
+ const suffix = index === 1 ? "" : "".concat(index);
85730
+ const targetUrl = "".concat(ibiz.env.baseUrl, "/").concat(ibiz.env.appId).concat(ibiz.env.remoteModelUrl, "/ext").concat(suffix);
85731
+ try {
85732
+ await ibiz.plugin.loadPlugin({
85733
+ runtimeObject: true,
85734
+ rtobjectName: "ExtensionPlugin".concat(suffix),
85735
+ rtobjectRepo: targetUrl
85736
+ });
85737
+ index += 1;
85738
+ success = true;
85739
+ } catch (error) {
85740
+ ibiz.log.warn(
85741
+ ibiz.i18n.t("runtime.hub.noExtensionPlugin", {
85742
+ targetUrl
85743
+ })
85744
+ );
85745
+ success = false;
85746
+ }
85747
+ } while (success);
85748
+ }
85749
+ /**
85750
+ * @description 加载指定子应用扩展插件
85751
+ * @param {string} appId 应用标识
85752
+ * @returns {*} {Promise<void>}
85753
+ * @memberof AppHub
85754
+ */
85755
+ async loadSubExtensionPlugin(appId2) {
85756
+ const targetUrl = "".concat(ibiz.env.baseUrl, "/").concat(ibiz.env.appId).concat(ibiz.env.remoteModelUrl, "/subapps/").concat(appId2, "/ext");
85711
85757
  try {
85712
85758
  await ibiz.plugin.loadPlugin({
85713
85759
  runtimeObject: true,
85714
- rtobjectName: "ExtensionPlugin",
85715
- rtobjectRepo: "".concat(ibiz.env.baseUrl, "/").concat(appId2).concat(ibiz.env.remoteModelUrl, "/ext")
85760
+ rtobjectName: "".concat(appId2, "_ExtensionPlugin"),
85761
+ rtobjectRepo: targetUrl
85716
85762
  });
85717
85763
  } catch (error) {
85718
85764
  ibiz.log.warn(
85719
- ibiz.i18n.t("runtime.application.noExtensionPlugin", {
85720
- appId: ibiz.env.appId
85765
+ ibiz.i18n.t("runtime.hub.noExtensionPlugin", {
85766
+ targetUrl
85721
85767
  })
85722
85768
  );
85723
85769
  }
@@ -85738,7 +85784,7 @@ var AppHub = class {
85738
85784
  throw new RuntimeError73(ibiz.i18n.t("runtime.utils.firstregister"));
85739
85785
  }
85740
85786
  if (id !== ibiz.env.appId) {
85741
- await this.loadExtensionPlugin(id);
85787
+ await this.loadSubExtensionPlugin(id);
85742
85788
  }
85743
85789
  const appModel = await this.modelLoaderProvider.getApp(id);
85744
85790
  const subAppRef = await this.modelLoaderProvider.getSubAppRef(id);
@@ -92510,7 +92556,7 @@ var en = {
92510
92556
  hub: {
92511
92557
  failedParse: "View parameter {paramsName} failed to parse: {error}",
92512
92558
  noExist: "View [{id}] does not exist",
92513
- noExtensionPlugin: "Attempted to load application [{appId}] extension plugin, but no extension plugin was found"
92559
+ noExtensionPlugin: "Attempted to load the extension plugin from path [{targetUrl}], but no extension plugin was found"
92514
92560
  },
92515
92561
  logicScheduler: {
92516
92562
  executor: {
@@ -93224,7 +93270,7 @@ var zhCn = {
93224
93270
  hub: {
93225
93271
  failedParse: "\u89C6\u56FE\u53C2\u6570 {paramsName} \u89E3\u6790\u5931\u8D25\uFF1A{error}",
93226
93272
  noExist: "\u89C6\u56FE[{id}]\u4E0D\u5B58\u5728",
93227
- noExtensionPlugin: "\u5C1D\u8BD5\u52A0\u8F7D\u5E94\u7528[{appId}]\u6269\u5C55\u63D2\u4EF6\uFF0C\u6682\u672A\u627E\u5230\u6269\u5C55\u63D2\u4EF6"
93273
+ noExtensionPlugin: "\u5C1D\u8BD5\u52A0\u8F7D\u8DEF\u5F84[{targetUrl}]\u6269\u5C55\u63D2\u4EF6\uFF0C\u6682\u672A\u627E\u5230\u6269\u5C55\u63D2\u4EF6"
93228
93274
  },
93229
93275
  logicScheduler: {
93230
93276
  executor: {