@ibiz-template/runtime 0.6.17 → 0.6.18

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
@@ -6210,7 +6210,7 @@ var AppCounter = class {
6210
6210
  const data = msg.data;
6211
6211
  if (this.model.appDataEntityId) {
6212
6212
  const codeName = calcDeCodeNameById(this.model.appDataEntityId);
6213
- if (data && data.srfdecodename === codeName) {
6213
+ if (data && data.srfdecodename && data.srfdecodename.toLowerCase() === codeName) {
6214
6214
  this.refresh();
6215
6215
  }
6216
6216
  }
@@ -18581,6 +18581,13 @@ var UILogicContext = class {
18581
18581
  constructor(deLogicParams, parameters) {
18582
18582
  this.deLogicParams = deLogicParams;
18583
18583
  this.parameters = parameters;
18584
+ /**
18585
+ * 逻辑操作的会话变量
18586
+ * @author lxm
18587
+ * @date 2024-04-07 11:55:01
18588
+ * @type {IParams}
18589
+ */
18590
+ this.session = {};
18584
18591
  /**
18585
18592
  * 界面逻辑参数
18586
18593
  *
@@ -19774,13 +19781,17 @@ var UILogicParam = class {
19774
19781
  } else if (m.activeViewParam) {
19775
19782
  ctx.params[tag] = parameters.view;
19776
19783
  } else if (m.appGlobalParam) {
19777
- ctx.params[tag] = ibiz.env;
19784
+ let value = ibiz.util.getGlobalParam();
19785
+ if (m.paramFieldName) {
19786
+ value = value[m.paramFieldName];
19787
+ }
19788
+ ctx.params[tag] = value;
19778
19789
  } else if (m.applicationParam) {
19779
19790
  ctx.params[tag] = app;
19780
19791
  } else if (m.entityListParam) {
19781
19792
  ctx.params[tag] = [];
19782
19793
  } else if (m.entityPageParam) {
19783
- ctx.params[tag] = {};
19794
+ ctx.params[tag] = [];
19784
19795
  } else if (m.entityParam) {
19785
19796
  ctx.params[tag] = {};
19786
19797
  } else if (m.lastReturnParam) {
@@ -19788,7 +19799,7 @@ var UILogicParam = class {
19788
19799
  } else if (m.navContextParam) {
19789
19800
  ctx.params[tag] = context;
19790
19801
  } else if (m.navViewParamParam) {
19791
- throw new ModelError24(m, "\u672A\u652F\u6301\u7684\u903B\u8F91\u53C2\u6570\u7C7B\u578B: \u89C6\u56FE\u8DEF\u7531\u53C2\u6570");
19802
+ ctx.params[tag] = ibiz.util.getRouterParams();
19792
19803
  } else if (m.routeViewSessionParam) {
19793
19804
  let value = parameters.view.getTopView().state;
19794
19805
  if (m.paramFieldName) {
@@ -19809,6 +19820,10 @@ var UILogicParam = class {
19809
19820
  ctx.params[tag] = value;
19810
19821
  } else if (m.filterParam) {
19811
19822
  ctx.params[tag] = {};
19823
+ } else if (m.envParam) {
19824
+ ctx.params[tag] = ibiz.env;
19825
+ } else if (m.sessionParam) {
19826
+ ctx.params[tag] = ctx.session;
19812
19827
  }
19813
19828
  ibiz.log.debug("\u8BA1\u7B97\u754C\u9762\u903B\u8F91\u53C2\u6570\uFF0C\u6807\u8BC6\uFF1A".concat(tag), "-\u503C\uFF1A", ctx.params[tag]);
19814
19829
  }
@@ -20820,7 +20835,6 @@ var FrontUIActionProvider = class extends UIActionProviderBase {
20820
20835
  * @return {*} {IUIActionResult}
20821
20836
  */
20822
20837
  async openEditForm(action, args) {
20823
- console.log(action.deeditForm, args);
20824
20838
  const actionResult = {};
20825
20839
  const { context, params, data, event } = args;
20826
20840
  if (!event) {
@@ -22784,7 +22798,8 @@ import { RuntimeError as RuntimeError53 } from "@ibiz-template/core";
22784
22798
  import {
22785
22799
  RuntimeModelError as RuntimeModelError57,
22786
22800
  debounceAndAsyncMerge,
22787
- recursiveIterate as recursiveIterate3
22801
+ recursiveIterate as recursiveIterate3,
22802
+ EntityError
22788
22803
  } from "@ibiz-template/core";
22789
22804
  var FormController = class extends ControlController {
22790
22805
  constructor() {
@@ -22999,7 +23014,21 @@ var FormController = class extends ControlController {
22999
23014
  );
23000
23015
  return values.findIndex((value) => !value) === -1;
23001
23016
  }
23017
+ /**
23018
+ * 执行对应部件行为消息提示
23019
+ * @author zzq
23020
+ * @date 2024-04-03 15:51:21
23021
+ * @param {string} tag
23022
+ * @param {({ default?: string; data?: IData | IData[]; error?: Error })} [opts]
23023
+ * @return {*} {void}
23024
+ */
23002
23025
  actionNotification(tag, opts) {
23026
+ if ((opts == null ? void 0 : opts.error) && opts.error instanceof EntityError) {
23027
+ const { details } = opts.error;
23028
+ details.forEach((detail) => {
23029
+ this.setDetailError(detail.name, detail.errorInfo);
23030
+ });
23031
+ }
23003
23032
  super.actionNotification(tag, { data: this.data, ...opts || {} });
23004
23033
  }
23005
23034
  /**
@@ -23054,6 +23083,20 @@ var FormController = class extends ControlController {
23054
23083
  }
23055
23084
  }
23056
23085
  }
23086
+ /**
23087
+ * 设置表单项错误信息
23088
+ * @author zzq
23089
+ * @date 2024-04-03 18:12:02
23090
+ * @protected
23091
+ * @return {*} {void}
23092
+ */
23093
+ setDetailError(name, message) {
23094
+ const detail = this.details[name];
23095
+ const state = detail == null ? void 0 : detail.state;
23096
+ if (state && state.error) {
23097
+ state.error = message;
23098
+ }
23099
+ }
23057
23100
  };
23058
23101
 
23059
23102
  // src/controller/control/form/search-form/search-form.service.ts
@@ -26004,11 +26047,13 @@ var EditFormController = class extends FormController {
26004
26047
  if (!isNil27(msg.triggerKey) && msg.triggerKey === this.triggerKey) {
26005
26048
  return;
26006
26049
  }
26007
- const dename = calcDeCodeNameById(this.model.appDataEntityId);
26008
- if (!msg.data || ((_a = msg.data.srfdecodename) == null ? void 0 : _a.toLowerCase()) !== dename || msg.data.srfkey !== this.data.srfkey) {
26009
- return;
26050
+ if (this.model.appDataEntityId) {
26051
+ const dename = calcDeCodeNameById(this.model.appDataEntityId);
26052
+ if (!msg.data || ((_a = msg.data.srfdecodename) == null ? void 0 : _a.toLowerCase()) !== dename || msg.data.srfkey !== this.data.srfkey) {
26053
+ return;
26054
+ }
26055
+ this.doNextActive(() => this.load(), { key: "load" });
26010
26056
  }
26011
- this.doNextActive(() => this.load(), { key: "load" });
26012
26057
  }
26013
26058
  };
26014
26059
 
@@ -26250,6 +26295,7 @@ var GridRowState = class {
26250
26295
  import {
26251
26296
  awaitTimeout as awaitTimeout2,
26252
26297
  debounceAndAsyncMerge as debounceAndAsyncMerge2,
26298
+ EntityError as EntityError2,
26253
26299
  mergeDefaultInLeft,
26254
26300
  recursiveIterate as recursiveIterate7,
26255
26301
  RuntimeError as RuntimeError56,
@@ -26947,7 +26993,8 @@ var GridController = class extends MDControlController {
26947
26993
  await this._evt.emit("onSaveError", void 0);
26948
26994
  this.actionNotification("".concat(isCreate ? "CREATE" : "UPDATE", "ERROR"), {
26949
26995
  error,
26950
- data: rowState.data
26996
+ data: rowState.data,
26997
+ rowState
26951
26998
  });
26952
26999
  throw error;
26953
27000
  }
@@ -27570,6 +27617,24 @@ var GridController = class extends MDControlController {
27570
27617
  JSON.stringify(storageColumnStates)
27571
27618
  );
27572
27619
  }
27620
+ /**
27621
+ * 执行对应部件行为消息提示
27622
+ * @author zzq
27623
+ * @date 2024-04-03 15:51:21
27624
+ * @param {string} tag
27625
+ * @param {({ default?: string; data?: IData | IData[]; error?: Error; rowState?: IGridRowState })} [opts]
27626
+ * @return {*} {void}
27627
+ */
27628
+ actionNotification(tag, opts) {
27629
+ if ((opts == null ? void 0 : opts.error) && (opts == null ? void 0 : opts.rowState) && opts.error instanceof EntityError2) {
27630
+ const { details } = opts.error;
27631
+ const { errors } = opts.rowState;
27632
+ details.forEach((detail) => {
27633
+ errors[detail.name] = detail.errorInfo;
27634
+ });
27635
+ }
27636
+ super.actionNotification(tag, { ...opts || {} });
27637
+ }
27573
27638
  };
27574
27639
 
27575
27640
  // src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts
@@ -36972,6 +37037,7 @@ var MDViewEngine = class extends ViewEngineBase {
36972
37037
  };
36973
37038
 
36974
37039
  // src/global/global-util/global-util.ts
37040
+ import { RuntimeError as RuntimeError70 } from "@ibiz-template/core";
36975
37041
  var sourceTitle = document.title;
36976
37042
  var GlobalUtil = class {
36977
37043
  constructor() {
@@ -37097,10 +37163,28 @@ var GlobalUtil = class {
37097
37163
  document.title = tabTitle;
37098
37164
  }
37099
37165
  }
37166
+ /**
37167
+ * 获取应用全局变量
37168
+ * @author lxm
37169
+ * @date 2024-04-01 11:24:58
37170
+ * @return {*} {IParams}
37171
+ */
37172
+ getGlobalParam() {
37173
+ throw new RuntimeError70("\u83B7\u53D6\u5E94\u7528\u5168\u5C40\u53D8\u91CF\u6CA1\u6709\u5B9E\u73B0");
37174
+ }
37175
+ /**
37176
+ * 获取视图路由参数变量,数组类型,基于路由解析出来的,每一个对象里面都有context和params
37177
+ * @author lxm
37178
+ * @date 2024-04-01 11:24:58
37179
+ * @return {*} {IParams}
37180
+ */
37181
+ getRouterParams() {
37182
+ throw new RuntimeError70("\u83B7\u53D6\u89C6\u56FE\u8DEF\u7531\u53C2\u6570\u53D8\u91CF\u6CA1\u6709\u5B9E\u73B0");
37183
+ }
37100
37184
  };
37101
37185
 
37102
37186
  // src/logic-scheduler/executor/logic-executor.ts
37103
- import { RuntimeError as RuntimeError70 } from "@ibiz-template/core";
37187
+ import { RuntimeError as RuntimeError71 } from "@ibiz-template/core";
37104
37188
  var LogicExecutor = class {
37105
37189
  /**
37106
37190
  * @author lxm
@@ -37121,7 +37205,7 @@ var LogicExecutor = class {
37121
37205
  */
37122
37206
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37123
37207
  execute(_executeParams) {
37124
- throw new RuntimeError70("Method not implemented.");
37208
+ throw new RuntimeError71("Method not implemented.");
37125
37209
  }
37126
37210
  /**
37127
37211
  * 销毁方法
@@ -37558,7 +37642,7 @@ var LogicSchedulerCenter = class {
37558
37642
  };
37559
37643
 
37560
37644
  // src/logic-scheduler/trigger/logic-trigger.ts
37561
- import { RuntimeError as RuntimeError71 } from "@ibiz-template/core";
37645
+ import { RuntimeError as RuntimeError72 } from "@ibiz-template/core";
37562
37646
  var LogicTrigger = class {
37563
37647
  /**
37564
37648
  * @author lxm
@@ -37618,7 +37702,7 @@ var LogicTrigger = class {
37618
37702
  if (this.executor) {
37619
37703
  return this.executor.execute(executeParams);
37620
37704
  }
37621
- throw new RuntimeError71("".concat(this.logic.id, "\u6CA1\u6709\u7ED1\u5B9Aexecutor"));
37705
+ throw new RuntimeError72("".concat(this.logic.id, "\u6CA1\u6709\u7ED1\u5B9Aexecutor"));
37622
37706
  }
37623
37707
  /**
37624
37708
  * 销毁方法
@@ -37635,12 +37719,12 @@ var CustomTrigger = class extends LogicTrigger {
37635
37719
  };
37636
37720
 
37637
37721
  // src/logic-scheduler/trigger/item-dyna-logic-trigger.ts
37638
- import { RuntimeError as RuntimeError72 } from "@ibiz-template/core";
37722
+ import { RuntimeError as RuntimeError73 } from "@ibiz-template/core";
37639
37723
  var ItemDynaLogicTrigger = class extends LogicTrigger {
37640
37724
  bindExecutor(executor) {
37641
37725
  super.bindExecutor(executor);
37642
37726
  if (this.executor.type !== "SCRIPT") {
37643
- throw new RuntimeError72(
37727
+ throw new RuntimeError73(
37644
37728
  "\u9884\u5B9A\u4E49\u903B\u8F91\u7C7B\u578B".concat(this.type, "\u7684\u89E6\u53D1\u5668\u7C7B\u578B\u53EA\u80FD\u662F\u811A\u672C")
37645
37729
  );
37646
37730
  }
@@ -37677,7 +37761,7 @@ var ItemDynaLogicTrigger = class extends LogicTrigger {
37677
37761
  };
37678
37762
 
37679
37763
  // src/logic-scheduler/trigger/timer-trigger.ts
37680
- import { RuntimeError as RuntimeError73, RuntimeModelError as RuntimeModelError74 } from "@ibiz-template/core";
37764
+ import { RuntimeError as RuntimeError74, RuntimeModelError as RuntimeModelError74 } from "@ibiz-template/core";
37681
37765
  var TimerTrigger = class extends LogicTrigger {
37682
37766
  constructor() {
37683
37767
  super(...arguments);
@@ -37689,7 +37773,7 @@ var TimerTrigger = class extends LogicTrigger {
37689
37773
  }
37690
37774
  this.timer = setInterval(() => {
37691
37775
  if (!this.scheduler.defaultParamsCb) {
37692
- throw new RuntimeError73("\u5B9A\u65F6\u5668\u7F3A\u5C11\u9ED8\u8BA4\u53C2\u6570\u56DE\u8C03");
37776
+ throw new RuntimeError74("\u5B9A\u65F6\u5668\u7F3A\u5C11\u9ED8\u8BA4\u53C2\u6570\u56DE\u8C03");
37693
37777
  }
37694
37778
  const params = this.scheduler.defaultParamsCb();
37695
37779
  this.executor.execute(params);
@@ -37706,7 +37790,7 @@ var TimerTrigger = class extends LogicTrigger {
37706
37790
  // src/logic-scheduler/executor/app-ui-logic-executor.ts
37707
37791
  import {
37708
37792
  ModelError as ModelError34,
37709
- RuntimeError as RuntimeError74,
37793
+ RuntimeError as RuntimeError75,
37710
37794
  RuntimeModelError as RuntimeModelError75
37711
37795
  } from "@ibiz-template/core";
37712
37796
  import { notNilEmpty as notNilEmpty9 } from "qx-util";
@@ -37744,7 +37828,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
37744
37828
  const { context, params, ...rest } = parameters;
37745
37829
  const { data } = parameters;
37746
37830
  if (!(data == null ? void 0 : data[0])) {
37747
- throw new RuntimeError74("opendata\u6CA1\u6709\u53EF\u64CD\u4F5C\u6570\u636E\uFF01");
37831
+ throw new RuntimeError75("opendata\u6CA1\u6709\u53EF\u64CD\u4F5C\u6570\u636E\uFF01");
37748
37832
  }
37749
37833
  const openViewRefs = appUILogic.openDataAppViews;
37750
37834
  let openViewRef;
@@ -37804,7 +37888,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
37804
37888
  const openViewRefs = appUILogic.openDataAppViews;
37805
37889
  const findView = openViewRefs == null ? void 0 : openViewRefs.find((item) => item.refMode === formTypeValue);
37806
37890
  if (!findView) {
37807
- throw new RuntimeError74(
37891
+ throw new RuntimeError75(
37808
37892
  "\u6CA1\u6709\u627E\u5230\u4E0E\u8868\u5355\u7C7B\u578B".concat(formTypeValue, "\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE")
37809
37893
  );
37810
37894
  }
@@ -37929,7 +38013,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
37929
38013
  }
37930
38014
  const selectData = (_a = result.data) == null ? void 0 : _a[0];
37931
38015
  if (!selectData) {
37932
- throw new RuntimeError74("\u8BF7\u9009\u4E2D\u4E00\u6761\u6570\u636E");
38016
+ throw new RuntimeError75("\u8BF7\u9009\u4E2D\u4E00\u6761\u6570\u636E");
37933
38017
  }
37934
38018
  const indexType = selectData.srfkey;
37935
38019
  const findView = newDataAppViews == null ? void 0 : newDataAppViews.find(
@@ -37939,7 +38023,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
37939
38023
  }
37940
38024
  );
37941
38025
  if (!findView) {
37942
- throw new RuntimeError74(
38026
+ throw new RuntimeError75(
37943
38027
  "\u6CA1\u6709\u627E\u5230\u4E0E\u7D22\u5F15\u7C7B\u578B".concat(indexType, "\u76F8\u5173\u7684\u5B9E\u4F53\u7684\u7F16\u8F91\u89C6\u56FE")
37944
38028
  );
37945
38029
  }
@@ -37976,7 +38060,7 @@ var AppUILogicExecutor = class extends LogicExecutor {
37976
38060
  }
37977
38061
  });
37978
38062
  if (pickParentFieldName === void 0) {
37979
- throw new RuntimeError74(
38063
+ throw new RuntimeError75(
37980
38064
  "\u6CA1\u6709\u627E\u5230".concat(pickParentDeName, "\u5728\u5F53\u524D\u5B9E\u4F53\u7684\u5916\u952E\u5C5E\u6027")
37981
38065
  );
37982
38066
  }