@ibiz-template/runtime 0.2.13 → 0.2.15

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 (33) hide show
  1. package/dist/index.esm.js +97 -67
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/control/md-control.controller.js +1 -1
  5. package/out/controller/control/form/edit-form/edit-form.controller.d.ts +1 -1
  6. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  7. package/out/controller/control/form/edit-form/edit-form.controller.js +14 -6
  8. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  9. package/out/controller/control/grid/grid/grid.controller.js +0 -4
  10. package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts +3 -8
  11. package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts.map +1 -1
  12. package/out/controller/control/medit-view-panel/medit-view-panel.controller.js +28 -39
  13. package/out/controller/control/wizard-panel/wizard-panel.controller.d.ts +8 -0
  14. package/out/controller/control/wizard-panel/wizard-panel.controller.d.ts.map +1 -1
  15. package/out/controller/control/wizard-panel/wizard-panel.controller.js +58 -15
  16. package/out/interface/common/i-data-ability-params/i-data-ability-params.d.ts +7 -0
  17. package/out/interface/common/i-data-ability-params/i-data-ability-params.d.ts.map +1 -1
  18. package/out/interface/controller/controller/control/i-md-control.controller.d.ts +7 -0
  19. package/out/interface/controller/controller/control/i-md-control.controller.d.ts.map +1 -1
  20. package/out/interface/controller/controller/control/i-medit-view-panel.controller.d.ts +6 -0
  21. package/out/interface/controller/controller/control/i-medit-view-panel.controller.d.ts.map +1 -1
  22. package/out/interface/controller/state/control/i-medit-view-panel.state.d.ts +5 -0
  23. package/out/interface/controller/state/control/i-medit-view-panel.state.d.ts.map +1 -1
  24. package/package.json +6 -6
  25. package/src/controller/common/control/md-control.controller.ts +1 -1
  26. package/src/controller/control/form/edit-form/edit-form.controller.ts +16 -7
  27. package/src/controller/control/grid/grid/grid.controller.ts +0 -3
  28. package/src/controller/control/medit-view-panel/medit-view-panel.controller.ts +30 -46
  29. package/src/controller/control/wizard-panel/wizard-panel.controller.ts +67 -18
  30. package/src/interface/common/i-data-ability-params/i-data-ability-params.ts +8 -0
  31. package/src/interface/controller/controller/control/i-md-control.controller.ts +8 -0
  32. package/src/interface/controller/controller/control/i-medit-view-panel.controller.ts +8 -1
  33. package/src/interface/controller/state/control/i-medit-view-panel.state.ts +6 -0
package/dist/index.esm.js CHANGED
@@ -29644,7 +29644,7 @@ var MDControlController = class extends ControlController {
29644
29644
  default: "\u6570\u636E[".concat(data.map((item) => item.srfmajortext).join("\u3001"), "]\u5220\u9664\u6210\u529F!")
29645
29645
  });
29646
29646
  }
29647
- if (needRefresh) {
29647
+ if (needRefresh && !(args == null ? void 0 : args.notRefresh)) {
29648
29648
  await this.refresh();
29649
29649
  }
29650
29650
  } catch (error) {
@@ -36914,6 +36914,7 @@ var EditFormController = class extends FormController {
36914
36914
  * @date 2022-08-31 22:08:40
36915
36915
  */
36916
36916
  async save(args) {
36917
+ const silent = (args == null ? void 0 : args.silent) === true;
36917
36918
  if (this.state.processing) {
36918
36919
  const data2 = await awaitTimeout(500, this.save.bind(this));
36919
36920
  return data2;
@@ -36922,7 +36923,9 @@ var EditFormController = class extends FormController {
36922
36923
  if (!isValid) {
36923
36924
  throw new RuntimeError45("\u8BF7\u68C0\u67E5\u8868\u5355\u586B\u5199\uFF01");
36924
36925
  }
36925
- await this.startLoading();
36926
+ if (!silent) {
36927
+ await this.startLoading();
36928
+ }
36926
36929
  await this.evt.emit("onBeforeSave", void 0);
36927
36930
  const { context, data } = this.handlerAbilityParams(args);
36928
36931
  const saveData = data[0];
@@ -36937,7 +36940,9 @@ var EditFormController = class extends FormController {
36937
36940
  });
36938
36941
  throw error;
36939
36942
  } finally {
36940
- await this.endLoading();
36943
+ if (!silent) {
36944
+ await this.endLoading();
36945
+ }
36941
36946
  }
36942
36947
  if (res.data) {
36943
36948
  mergeInLeft(this.data, res.data);
@@ -36946,9 +36951,11 @@ var EditFormController = class extends FormController {
36946
36951
  this.state.modified = false;
36947
36952
  await this.evt.emit("onSaveSuccess", void 0);
36948
36953
  this.formStateNotify("SAVE" /* SAVE */);
36949
- this.actionNotification("".concat(isCreate ? "CREATE" : "UPDATE", "SUCCESS"), {
36950
- default: "".concat(this.data.srfmajortext || "", "\u4FDD\u5B58\u6210\u529F")
36951
- });
36954
+ if (!silent) {
36955
+ this.actionNotification("".concat(isCreate ? "CREATE" : "UPDATE", "SUCCESS"), {
36956
+ default: "".concat(this.data.srfmajortext || "", "\u4FDD\u5B58\u6210\u529F")
36957
+ });
36958
+ }
36952
36959
  if (this.view.modal.mode === "ROUTE") {
36953
36960
  ibiz.mc.command.send(
36954
36961
  this.data.$origin,
@@ -37018,6 +37025,7 @@ var EditFormController = class extends FormController {
37018
37025
  if (res.data) {
37019
37026
  mergeInLeft(this.data, res.data);
37020
37027
  }
37028
+ return this.data;
37021
37029
  }
37022
37030
  /**
37023
37031
  * 表单项更新
@@ -37141,7 +37149,7 @@ var EditFormController = class extends FormController {
37141
37149
  async autoSave() {
37142
37150
  if (this.model.enableAutoSave) {
37143
37151
  try {
37144
- await this.save();
37152
+ await this.save({ silent: true });
37145
37153
  } catch (error) {
37146
37154
  ibiz.log.error(error);
37147
37155
  }
@@ -38653,7 +38661,6 @@ var GridController = class extends MDControlController {
38653
38661
  if (!isValid) {
38654
38662
  throw new RuntimeError47("\u884C\u6570\u636E\u6821\u9A8C\u4E0D\u901A\u8FC7\uFF0C\u4FDD\u5B58\u53D6\u6D88");
38655
38663
  }
38656
- await this.startLoading();
38657
38664
  let res;
38658
38665
  const deName = calcDeCodeNameById(this.model.appDataEntityId);
38659
38666
  const tempContext = this.context.clone();
@@ -38667,8 +38674,6 @@ var GridController = class extends MDControlController {
38667
38674
  data: rowState.data
38668
38675
  });
38669
38676
  throw error;
38670
- } finally {
38671
- await this.endLoading();
38672
38677
  }
38673
38678
  const index = this.findRowStateIndex(data);
38674
38679
  this.state.items.splice(index, 1, res.data);
@@ -41871,6 +41876,29 @@ var WizardPanelController = class extends ControlController {
41871
41876
  this.context[deName] = data.srfkey;
41872
41877
  }
41873
41878
  }
41879
+ /**
41880
+ * 根据tag获取应该激活的向导表单
41881
+ * @param {string} tag
41882
+ * @return {*}
41883
+ * @author: zhujiamin
41884
+ * @Date: 2023-11-10 18:35:37
41885
+ */
41886
+ getWizardFormByTag(tag) {
41887
+ var _a;
41888
+ if (!((_a = this.model.dewizard) == null ? void 0 : _a.dewizardForms)) {
41889
+ throw new RuntimeError50("\u6CA1\u6709\u914D\u7F6E\u5411\u5BFC\u8868\u5355\u96C6\u5408");
41890
+ return;
41891
+ }
41892
+ const wizardForm = this.model.dewizard.dewizardForms.find(
41893
+ (form) => {
41894
+ return form.formTag === tag;
41895
+ }
41896
+ );
41897
+ if (!wizardForm) {
41898
+ throw new RuntimeError50("\u627E\u4E0D\u5230\u6807\u8BC6\u4E3A".concat(tag, "\u7684\u5411\u5BFC\u8868\u5355"));
41899
+ }
41900
+ return wizardForm;
41901
+ }
41874
41902
  /**
41875
41903
  * 执行初始化操作,存在初始化实体行为的时候加载数据并把主键放入上下文
41876
41904
  *
@@ -41886,8 +41914,16 @@ var WizardPanelController = class extends ControlController {
41886
41914
  if (res.data && res.data.srfkey) {
41887
41915
  this.context[deName] = res.data.srfkey;
41888
41916
  }
41917
+ if (res.data && this.model.stateAppDEFieldId && res.data[this.model.stateAppDEFieldId]) {
41918
+ const activeForm = this.getWizardFormByTag(
41919
+ res.data[this.model.stateAppDEFieldId]
41920
+ );
41921
+ if (activeForm) {
41922
+ this.state.activeFormTag = activeForm.formTag;
41923
+ }
41924
+ }
41889
41925
  }
41890
- if (this.firstForm) {
41926
+ if (!this.state.activeFormTag && this.firstForm) {
41891
41927
  this.state.activeFormTag = this.firstForm.formTag;
41892
41928
  this.tagHistory.push(this.firstForm.formTag);
41893
41929
  }
@@ -41912,9 +41948,19 @@ var WizardPanelController = class extends ControlController {
41912
41948
  * @memberof WizardPanelController
41913
41949
  */
41914
41950
  async onPrevClick() {
41915
- await this.activeFormController.goBack();
41916
- this.tagHistory.pop();
41917
- const prevTag = this.tagHistory[this.tagHistory.length - 1];
41951
+ const data = await this.activeFormController.goBack();
41952
+ let prevTag;
41953
+ if (this.model.stateAppDEFieldId && data[this.model.stateAppDEFieldId]) {
41954
+ const wizardForm = this.getWizardFormByTag(
41955
+ data[this.model.stateAppDEFieldId]
41956
+ );
41957
+ if (wizardForm) {
41958
+ prevTag = data[this.model.stateAppDEFieldId];
41959
+ }
41960
+ } else {
41961
+ prevTag = this.tagHistory[this.tagHistory.length - 1];
41962
+ this.tagHistory.pop();
41963
+ }
41918
41964
  if (!prevTag) {
41919
41965
  throw new RuntimeError50("\u6CA1\u6709\u4E0A\u4E00\u4E2A\u8868\u5355");
41920
41966
  }
@@ -41931,15 +41977,18 @@ var WizardPanelController = class extends ControlController {
41931
41977
  const data = await this.activeFormController.save();
41932
41978
  let nextTag;
41933
41979
  if (data.srfnextform) {
41934
- const wizardForm = this.model.dewizard.dewizardForms.find(
41935
- (_wizardForm) => {
41936
- return _wizardForm.formTag === data.srfnextform;
41937
- }
41980
+ const wizardForm = this.getWizardFormByTag(data.srfnextform);
41981
+ if (wizardForm) {
41982
+ nextTag = data.srfnextform;
41983
+ this.tagHistory.push(nextTag);
41984
+ }
41985
+ } else if (this.model.stateAppDEFieldId && data[this.model.stateAppDEFieldId]) {
41986
+ const wizardForm = this.getWizardFormByTag(
41987
+ data[this.model.stateAppDEFieldId]
41938
41988
  );
41939
- if (!wizardForm) {
41940
- throw new RuntimeError50("\u627E\u4E0D\u5230\u6807\u8BC6\u4E3A".concat(data.srfnextform, "\u7684\u5411\u5BFC\u8868\u5355"));
41989
+ if (wizardForm) {
41990
+ nextTag = data[this.model.stateAppDEFieldId];
41941
41991
  }
41942
- nextTag = data.srfnextform;
41943
41992
  } else {
41944
41993
  const { formTag } = this.activeWizardForm;
41945
41994
  const wizardSteps = this.model.dewizard.dewizardSteps;
@@ -41951,12 +42000,8 @@ var WizardPanelController = class extends ControlController {
41951
42000
  if (!nextWizardStep) {
41952
42001
  throw new RuntimeError50("\u627E\u4E0D\u5230\u4E0B\u4E00\u4E2A\u5411\u5BFC\u6B65\u9AA4");
41953
42002
  }
41954
- const nextWizardForm = this.model.dewizard.dewizardForms.find(
41955
- (wizardForm) => {
41956
- return wizardForm.formTag === nextWizardStep.stepTag;
41957
- }
41958
- );
41959
- if (nextWizardForm) {
42003
+ const nextWizardForm = this.getWizardFormByTag(nextWizardStep.stepTag);
42004
+ if (nextWizardForm && nextWizardForm.formTag) {
41960
42005
  nextTag = nextWizardForm.formTag;
41961
42006
  }
41962
42007
  }
@@ -42910,11 +42955,6 @@ var MEditViewPanelService = class extends MDControlService {
42910
42955
  var MEditViewPanelController = class extends MDControlController {
42911
42956
  constructor() {
42912
42957
  super(...arguments);
42913
- /**
42914
- * 是否显示底部按钮
42915
- *
42916
- */
42917
- this.showButton = true;
42918
42958
  /**
42919
42959
  * 当前应用视图参数对象
42920
42960
  *
@@ -42932,6 +42972,7 @@ var MEditViewPanelController = class extends MDControlController {
42932
42972
  this.state.panelUiItems = [];
42933
42973
  this.state.activeTab = "";
42934
42974
  this.state.size = 1e3;
42975
+ this.state.isNeedScroll = false;
42935
42976
  }
42936
42977
  /**
42937
42978
  * 初始化嵌入应用视图及实体参数对象
@@ -42971,9 +43012,12 @@ var MEditViewPanelController = class extends MDControlController {
42971
43012
  */
42972
43013
  async afterLoad(args, items) {
42973
43014
  await super.afterLoad(args, items);
43015
+ const tempPanelUiItems = this.state.panelUiItems.filter((UiItem) => {
43016
+ return UiItem.id.startsWith("mockId:");
43017
+ });
42974
43018
  this.state.panelUiItems = [];
42975
- this.doItems(items);
42976
- if (this.model.panelStyle === "TAB_TOP" && this.state.panelUiItems.length > 0) {
43019
+ this.doItems(items, tempPanelUiItems);
43020
+ if (this.model.panelStyle === "TAB_TOP" && this.state.panelUiItems.length > 0 && tempPanelUiItems.length === 0) {
42977
43021
  this.state.activeTab = this.state.panelUiItems[0].id;
42978
43022
  }
42979
43023
  return items;
@@ -43017,11 +43061,14 @@ var MEditViewPanelController = class extends MDControlController {
43017
43061
  * @author: zhujiamin
43018
43062
  * @Date: 2023-10-16 15:00:02
43019
43063
  */
43020
- doItems(datas) {
43064
+ doItems(datas, tempPanelUiItems) {
43021
43065
  datas.forEach((arg) => {
43022
43066
  const item = this.handlePanelItemParams(arg);
43023
43067
  this.state.panelUiItems.push(item);
43024
43068
  });
43069
+ if (tempPanelUiItems) {
43070
+ this.state.panelUiItems.push(...tempPanelUiItems);
43071
+ }
43025
43072
  }
43026
43073
  /**
43027
43074
  * 处理添加
@@ -43030,6 +43077,7 @@ var MEditViewPanelController = class extends MDControlController {
43030
43077
  * @Date: 2023-10-16 15:18:01
43031
43078
  */
43032
43079
  async handleAdd() {
43080
+ this.state.isNeedScroll = true;
43033
43081
  this.doItems([{ srfuf: 0 }]);
43034
43082
  if (this.model.panelStyle === "TAB_TOP") {
43035
43083
  this.state.activeTab = this.state.panelUiItems[this.state.panelUiItems.length - 1].id;
@@ -43043,13 +43091,14 @@ var MEditViewPanelController = class extends MDControlController {
43043
43091
  * @Date: 2023-10-16 15:23:59
43044
43092
  */
43045
43093
  async handleDelete(item) {
43094
+ this.state.isNeedScroll = false;
43046
43095
  if (item.data.srfuf === 0) {
43047
43096
  const index = this.state.panelUiItems.findIndex((value) => {
43048
43097
  return value === item;
43049
43098
  });
43050
43099
  this.state.panelUiItems.splice(index, 1);
43051
43100
  } else {
43052
- await this.remove({ data: [item.data] });
43101
+ await this.remove({ data: [item.data], notRefresh: true });
43053
43102
  }
43054
43103
  }
43055
43104
  /**
@@ -43096,50 +43145,31 @@ var MEditViewPanelController = class extends MDControlController {
43096
43145
  */
43097
43146
  onViewDataChange(args, id) {
43098
43147
  if (args.eventName === "onSaveSuccess") {
43099
- this.save(args.data[0], id);
43148
+ this.handleDataChange(args.data[0], id);
43100
43149
  }
43101
43150
  }
43102
43151
  /**
43103
- * 保存
43152
+ * 处理数据变化
43104
43153
  *
43105
43154
  * @param {ControlVO} data
43106
43155
  * @returns {*} {Promise<void>}
43107
43156
  */
43108
- async save(data, id) {
43157
+ async handleDataChange(data, id) {
43109
43158
  const panelUiItemIndex = this.state.panelUiItems.findIndex(
43110
43159
  (item) => item.id === id
43111
43160
  );
43112
- if (!panelUiItemIndex) {
43161
+ if (panelUiItemIndex < 0) {
43113
43162
  throw new RuntimeError52("\u7F16\u8F91\u89C6\u56FE\u9762\u677F\u90E8\u4EF6UI\u6570\u636E\u4E0D\u5B58\u5728");
43114
43163
  }
43115
- await this.startLoading();
43116
- let res;
43117
- const isCreate = data.srfuf === 0 /* CREATE */;
43118
- const deName = calcDeCodeNameById(this.model.appDataEntityId);
43119
- const tempContext = this.context.clone();
43120
- tempContext[deName] = data.srfkey;
43121
- try {
43122
- res = isCreate ? await this.service.create(tempContext, data) : await this.service.update(tempContext, data);
43123
- } catch (error) {
43124
- await this.evt.emit("onSaveError", void 0);
43125
- this.actionNotification("".concat(isCreate ? "CREATE" : "UPDATE", "ERROR"), {
43126
- error,
43127
- data: this.state.panelUiItems[panelUiItemIndex].data
43128
- });
43129
- throw error;
43130
- } finally {
43131
- await this.endLoading();
43164
+ const tempUiItem = this.state.panelUiItems[panelUiItemIndex];
43165
+ if (tempUiItem.id.startsWith("mockId:")) {
43166
+ this.state.panelUiItems[panelUiItemIndex] = this.handlePanelItemParams(data);
43167
+ } else {
43168
+ tempUiItem.srfmajortext = data.srfmajortext;
43169
+ }
43170
+ if (this.model.panelStyle === "TAB_TOP") {
43171
+ this.state.activeTab = this.state.panelUiItems[panelUiItemIndex].id;
43132
43172
  }
43133
- const index = this.state.items.findIndex(
43134
- (item) => item.srfkey === data.srfkey
43135
- );
43136
- this.state.items.splice(index, 1, res.data);
43137
- this.state.panelUiItems.splice(
43138
- panelUiItemIndex,
43139
- 1,
43140
- this.handlePanelItemParams(res.data)
43141
- );
43142
- await this.evt.emit("onSaveSuccess", void 0);
43143
43173
  }
43144
43174
  };
43145
43175