@ibiz-template/runtime 0.7.10 → 0.7.11

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 (53) hide show
  1. package/dist/index.esm.js +657 -259
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +8 -0
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/application.d.ts +2 -2
  6. package/out/application.d.ts.map +1 -1
  7. package/out/application.js +11 -4
  8. package/out/controller/common/view/view.controller.d.ts.map +1 -1
  9. package/out/controller/common/view/view.controller.js +23 -13
  10. package/out/controller/control/app-menu/custom-app-menu.controller.d.ts +124 -0
  11. package/out/controller/control/app-menu/custom-app-menu.controller.d.ts.map +1 -0
  12. package/out/controller/control/app-menu/custom-app-menu.controller.js +136 -0
  13. package/out/controller/control/app-menu/index.d.ts +1 -0
  14. package/out/controller/control/app-menu/index.d.ts.map +1 -1
  15. package/out/controller/control/app-menu/index.js +1 -0
  16. package/out/controller/control/chart/generator/chart-options-generator.d.ts.map +1 -1
  17. package/out/controller/control/chart/generator/chart-options-generator.js +27 -1
  18. package/out/controller/control/dashboard/custom-dashboard.controller.d.ts +8 -13
  19. package/out/controller/control/dashboard/custom-dashboard.controller.d.ts.map +1 -1
  20. package/out/controller/control/dashboard/custom-dashboard.controller.js +7 -6
  21. package/out/controller/control/gantt/gantt.controller.d.ts +28 -0
  22. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  23. package/out/controller/control/gantt/gantt.controller.js +82 -1
  24. package/out/controller/utils/index.d.ts +1 -0
  25. package/out/controller/utils/index.d.ts.map +1 -1
  26. package/out/controller/utils/index.js +1 -0
  27. package/out/controller/utils/view-msg/view-msg-controller.d.ts +39 -0
  28. package/out/controller/utils/view-msg/view-msg-controller.d.ts.map +1 -1
  29. package/out/controller/utils/view-msg/view-msg-controller.js +108 -8
  30. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +8 -0
  31. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  32. package/out/interface/common/i-app-service/i-app-service.d.ts +5 -4
  33. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  34. package/out/interface/controller/common/custom-design/i-custom-design.d.ts +37 -0
  35. package/out/interface/controller/common/custom-design/i-custom-design.d.ts.map +1 -0
  36. package/out/interface/controller/common/custom-design/i-custom-design.js +1 -0
  37. package/out/interface/controller/common/index.d.ts +1 -0
  38. package/out/interface/controller/common/index.d.ts.map +1 -1
  39. package/out/interface/controller/common/index.js +1 -0
  40. package/out/interface/controller/common/view-message/i-view-message.d.ts +33 -1
  41. package/out/interface/controller/common/view-message/i-view-message.d.ts.map +1 -1
  42. package/out/interface/controller/controller/view/i-view.controller.d.ts +9 -1
  43. package/out/interface/controller/controller/view/i-view.controller.d.ts.map +1 -1
  44. package/out/interface/controller/event/control/i-gantt.event.d.ts +9 -1
  45. package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
  46. package/out/interface/util/i-render-util/i-render-util.d.ts +44 -0
  47. package/out/interface/util/i-render-util/i-render-util.d.ts.map +1 -0
  48. package/out/interface/util/i-render-util/i-render-util.js +1 -0
  49. package/out/interface/util/index.d.ts +1 -0
  50. package/out/interface/util/index.d.ts.map +1 -1
  51. package/out/types.d.ts +10 -1
  52. package/out/types.d.ts.map +1 -1
  53. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -14089,12 +14089,17 @@ var Application = class {
14089
14089
  * @author tony001
14090
14090
  * @date 2024-04-23 11:04:27
14091
14091
  * @param {string} id
14092
- * @return {*} {(IAppUtil | null)}
14092
+ * @return {*} {(IAppUtil | undefined)}
14093
14093
  */
14094
- getAppUtil(id) {
14094
+ getAppUtil(id, type = "DEFAULT") {
14095
14095
  const appUtils = this.model.appUtils || [];
14096
- const appUtil = appUtils.find((item) => item.id === id);
14097
- return appUtil || null;
14096
+ let appUtil;
14097
+ if (type === "CUSTOM") {
14098
+ appUtil = appUtils.find((item) => item.utilTag === id);
14099
+ } else {
14100
+ appUtil = appUtils.find((item) => item.id === id);
14101
+ }
14102
+ return appUtil;
14098
14103
  }
14099
14104
  /**
14100
14105
  * 获取界面行为模型
@@ -14361,6 +14366,7 @@ import { notNilEmpty as notNilEmpty7 } from "qx-util";
14361
14366
  import {
14362
14367
  HttpError as HttpError7,
14363
14368
  IBizContext as IBizContext3,
14369
+ Namespace,
14364
14370
  RuntimeError as RuntimeError34
14365
14371
  } from "@ibiz-template/core";
14366
14372
  import { isEmpty as isEmpty9, isNil as isNil22, isNotNil as isNotNil2 } from "ramda";
@@ -15601,6 +15607,365 @@ async function getEntitySchema(entityId, context) {
15601
15607
  return res.data;
15602
15608
  }
15603
15609
 
15610
+ // src/controller/utils/view-msg/view-msg-controller.ts
15611
+ import { RuntimeError as RuntimeError33, RuntimeModelError as RuntimeModelError24 } from "@ibiz-template/core";
15612
+ import { isNil as isNil21, mergeRight as mergeRight3 } from "ramda";
15613
+ var VIEW_MSG_PREFIX = "VIEW_MSG";
15614
+ var ViewMsgController = class _ViewMsgController {
15615
+ constructor(msgGroupId, tag = "") {
15616
+ this.msgGroupId = msgGroupId;
15617
+ /**
15618
+ * 视图消息map
15619
+ * @author lxm
15620
+ * @date 2023-09-22 05:38:03
15621
+ */
15622
+ this.viewMsgMap = /* @__PURE__ */ new Map();
15623
+ /**
15624
+ * 视图消息tag
15625
+ *
15626
+ * @author zhanghengfeng
15627
+ * @date 2024-04-23 19:04:58
15628
+ */
15629
+ this.tag = "";
15630
+ this.tag = "".concat(VIEW_MSG_PREFIX, "_").concat(tag);
15631
+ }
15632
+ /**
15633
+ * 初始化方法,从全局获取视图消息组和视图消息的模型
15634
+ * @author lxm
15635
+ * @date 2023-09-22 05:41:08
15636
+ * @param {IContext} context
15637
+ * @return {*} {Promise<void>}
15638
+ */
15639
+ async init(context) {
15640
+ var _a, _b;
15641
+ const appModel = ibiz.hub.getApp(context.srfappid).model;
15642
+ const msgGroup = (_a = appModel.appViewMsgGroups) == null ? void 0 : _a.find(
15643
+ (item) => item.id === this.msgGroupId
15644
+ );
15645
+ if (!msgGroup) {
15646
+ throw new RuntimeError33(
15647
+ ibiz.i18n.t("runtime.controller.utils.viewMsg.message", {
15648
+ msgGroupId: this.msgGroupId
15649
+ })
15650
+ );
15651
+ }
15652
+ this.msgGroup = msgGroup;
15653
+ const msgDetailsViewMsgIds = msgGroup.appViewMsgGroupDetails.map(
15654
+ (item) => item.appViewMsgId
15655
+ );
15656
+ (_b = appModel.appViewMsgs) == null ? void 0 : _b.forEach((item) => {
15657
+ const index = msgDetailsViewMsgIds.indexOf(item.id);
15658
+ if (index !== -1) {
15659
+ this.viewMsgMap.set(item.id, item);
15660
+ msgDetailsViewMsgIds.splice(index, 1);
15661
+ }
15662
+ });
15663
+ if (msgDetailsViewMsgIds.length) {
15664
+ throw new RuntimeError33(
15665
+ ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound", {
15666
+ message: msgDetailsViewMsgIds.join(",")
15667
+ })
15668
+ );
15669
+ }
15670
+ }
15671
+ /**
15672
+ * 通过属性id获取属性的name属性
15673
+ *
15674
+ * @author tony001
15675
+ * @date 2024-05-08 15:05:03
15676
+ * @param {IAppDataEntity} appDataEntity
15677
+ * @param {string} [fieldId]
15678
+ * @return {*} {(string | undefined)}
15679
+ */
15680
+ getDeFieldName(appDataEntity, fieldId) {
15681
+ var _a, _b;
15682
+ if (!fieldId) {
15683
+ return;
15684
+ }
15685
+ return (_b = (_a = findFieldById(appDataEntity, fieldId)) == null ? void 0 : _a.name) == null ? void 0 : _b.toLowerCase();
15686
+ }
15687
+ /**
15688
+ * 查询并获取指定实体的数据集数据
15689
+ * @author lxm
15690
+ * @date 2023-09-20 08:10:57
15691
+ * @static
15692
+ * @param {IPSAppDEDataSetViewMsg} msgModel
15693
+ * @param {IParams} [context={}]
15694
+ * @param {IParams} [params={}]
15695
+ * @return {*} {Promise<IData[]>}
15696
+ */
15697
+ static async fetchDataSet(msgModel, context, params) {
15698
+ const { appDataEntityId, appDEDataSetId } = msgModel;
15699
+ if (!appDEDataSetId) {
15700
+ throw new RuntimeModelError24(msgModel, "\u672A\u914D\u7F6E\u5B9E\u4F53\u6570\u636E\u96C6");
15701
+ }
15702
+ const res = await ibiz.hub.getApp(context.srfappid).deService.exec(appDataEntityId, appDEDataSetId, context, params);
15703
+ if (res.data.length) {
15704
+ return res.data;
15705
+ }
15706
+ return [];
15707
+ }
15708
+ /**
15709
+ * 获取视图消息删除模式存储
15710
+ *
15711
+ * @author zhanghengfeng
15712
+ * @date 2024-05-09 16:05:59
15713
+ * @param {IViewMessage} item
15714
+ * @return {*} {(string | null)}
15715
+ */
15716
+ getMsgRemoveModeStorage(item) {
15717
+ if (item.removeMode !== 1) {
15718
+ return null;
15719
+ }
15720
+ return localStorage.getItem(item.key);
15721
+ }
15722
+ /**
15723
+ * 设置视图消息删除模式存储
15724
+ *
15725
+ * @author zhanghengfeng
15726
+ * @date 2024-05-09 16:05:21
15727
+ * @param {IViewMessage} item
15728
+ * @return {*} {void}
15729
+ */
15730
+ setMsgRemoveModeStorage(item) {
15731
+ if (item.removeMode !== 1) {
15732
+ return;
15733
+ }
15734
+ localStorage.setItem(item.key, "1");
15735
+ }
15736
+ /**
15737
+ * 计算视图消息是否显示
15738
+ *
15739
+ * @author zhanghengfeng
15740
+ * @date 2024-05-09 16:05:34
15741
+ * @param {IAppViewMsg} model
15742
+ * @param {IData} data
15743
+ * @param {IContext} context
15744
+ * @param {IParams} params
15745
+ * @return {*} {Promise<boolean>}
15746
+ */
15747
+ async calcViewMsgVisible(model, data, context, params) {
15748
+ const {
15749
+ enableMode,
15750
+ dataAccessAction,
15751
+ appDataEntityId,
15752
+ appId: appId2,
15753
+ testAppDELogicId,
15754
+ testScriptCode
15755
+ } = model;
15756
+ if (enableMode === "DEOPPRIV" && dataAccessAction) {
15757
+ const app = ibiz.hub.getApp(context.srfappid);
15758
+ const result = await app.authority.calcByDataAccessAction(
15759
+ dataAccessAction,
15760
+ context,
15761
+ data,
15762
+ appDataEntityId
15763
+ );
15764
+ return !!result;
15765
+ }
15766
+ if (enableMode === "DELOGIC" && appDataEntityId && appId2 && testAppDELogicId) {
15767
+ const entityModel = await ibiz.hub.getAppDataEntity(
15768
+ appDataEntityId,
15769
+ appId2
15770
+ );
15771
+ const deLogic = findDELogic(testAppDELogicId, entityModel);
15772
+ if (deLogic) {
15773
+ const result = await execDELogicAction(deLogic, context, data, params);
15774
+ return !!result.data;
15775
+ }
15776
+ }
15777
+ if (enableMode === "SCRIPT" && testScriptCode) {
15778
+ const result = ScriptFactory.execScriptFn(
15779
+ {
15780
+ data,
15781
+ context,
15782
+ params
15783
+ },
15784
+ testScriptCode,
15785
+ {
15786
+ isAsync: false,
15787
+ singleRowReturn: true
15788
+ }
15789
+ );
15790
+ return !!result;
15791
+ }
15792
+ return true;
15793
+ }
15794
+ /**
15795
+ * 计算视图信息呈现数据
15796
+ * @author lxm
15797
+ * @date 2023-09-20 09:16:59
15798
+ * @param {IContext} context
15799
+ * @param {IParams} params
15800
+ * @return {*} {IViewMessage[]}
15801
+ */
15802
+ async calcViewMessages(context, params) {
15803
+ const details = this.msgGroup.appViewMsgGroupDetails;
15804
+ const result = [];
15805
+ if (details == null ? void 0 : details.length) {
15806
+ await Promise.all(
15807
+ details.map(async (detail) => {
15808
+ const msgModel = this.viewMsgMap.get(detail.appViewMsgId);
15809
+ if (msgModel.dynamicMode === 1) {
15810
+ const msgs = await this.calcDynaMsgs(detail, context, params);
15811
+ await Promise.all(
15812
+ msgs.map(async (msg) => {
15813
+ msg.visible = await this.calcViewMsgVisible(
15814
+ msgModel,
15815
+ msg.data || {},
15816
+ context,
15817
+ params
15818
+ );
15819
+ })
15820
+ );
15821
+ result.push(...msgs);
15822
+ } else {
15823
+ const msg = this.calcStaticMsg(detail);
15824
+ msg.visible = await this.calcViewMsgVisible(
15825
+ msgModel,
15826
+ msg.data || {},
15827
+ context,
15828
+ params
15829
+ );
15830
+ result.push(msg);
15831
+ }
15832
+ })
15833
+ );
15834
+ }
15835
+ return result.filter(
15836
+ (item) => item.visible && !this.getMsgRemoveModeStorage(item)
15837
+ );
15838
+ }
15839
+ /**
15840
+ * 计算静态消息数据(或者动态的里面静态的配置)
15841
+ * @author lxm
15842
+ * @date 2023-09-20 09:46:45
15843
+ * @protected
15844
+ * @param {IPSAppViewMsgGroupDetail} detail
15845
+ * @return {*} {IViewMessage}
15846
+ */
15847
+ calcStaticMsg(detail) {
15848
+ const { position: position1 } = detail;
15849
+ const viewMsg = this.viewMsgMap.get(detail.appViewMsgId);
15850
+ const {
15851
+ codeName,
15852
+ title,
15853
+ message,
15854
+ removeMode,
15855
+ position: position2,
15856
+ messageType,
15857
+ layoutPanel,
15858
+ sysCss
15859
+ } = viewMsg;
15860
+ const { userTag, userTag2, userTag3, userTag4 } = viewMsg;
15861
+ const position = position1 || position2;
15862
+ const msg = {
15863
+ key: "".concat(this.tag, "_").concat(codeName),
15864
+ title,
15865
+ message,
15866
+ position,
15867
+ messageType,
15868
+ removeMode,
15869
+ visible: true,
15870
+ layoutPanel,
15871
+ sysCss,
15872
+ // 额外参数
15873
+ extraParams: {
15874
+ userTag,
15875
+ userTag2,
15876
+ userTag3,
15877
+ userTag4
15878
+ }
15879
+ };
15880
+ msg.data = {
15881
+ env: msg
15882
+ };
15883
+ return msg;
15884
+ }
15885
+ /**
15886
+ * 计算动态视图消息数据
15887
+ * @author lxm
15888
+ * @date 2023-09-20 09:46:26
15889
+ * @protected
15890
+ * @param {IPSAppViewMsgGroupDetail} detail
15891
+ * @param {IContext} context
15892
+ * @param {IParams} params
15893
+ * @return {*} {Promise<IViewMessage[]>}
15894
+ */
15895
+ async calcDynaMsgs(detail, context, params) {
15896
+ const msgModel = this.viewMsgMap.get(
15897
+ detail.appViewMsgId
15898
+ );
15899
+ const {
15900
+ appDataEntityId,
15901
+ orderValueAppDEFieldId,
15902
+ titleAppDEFieldId,
15903
+ removeFlagAppDEFieldId,
15904
+ msgTypeAppDEFieldId,
15905
+ contentAppDEFieldId,
15906
+ msgPosAppDEFieldId,
15907
+ layoutPanel
15908
+ } = msgModel;
15909
+ if (!appDataEntityId) {
15910
+ throw new RuntimeModelError24(msgModel, "\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");
15911
+ }
15912
+ const entity = await ibiz.hub.getAppDataEntity(
15913
+ appDataEntityId,
15914
+ context.srfappid
15915
+ );
15916
+ const fetchParams = { ...params };
15917
+ const sortField = this.getDeFieldName(entity, orderValueAppDEFieldId);
15918
+ if (sortField) {
15919
+ fetchParams.sort = "".concat(sortField, ",asc");
15920
+ }
15921
+ const dataSet = await _ViewMsgController.fetchDataSet(
15922
+ msgModel,
15923
+ context,
15924
+ fetchParams
15925
+ );
15926
+ if (!dataSet.length) {
15927
+ return [];
15928
+ }
15929
+ const basicMsg = this.calcStaticMsg(detail);
15930
+ const titleField = this.getDeFieldName(entity, titleAppDEFieldId);
15931
+ const positionField = this.getDeFieldName(entity, msgPosAppDEFieldId);
15932
+ const messageField = this.getDeFieldName(entity, contentAppDEFieldId);
15933
+ const typeField = this.getDeFieldName(entity, msgTypeAppDEFieldId);
15934
+ const removeModeField = this.getDeFieldName(entity, removeFlagAppDEFieldId);
15935
+ const deViewMessages = dataSet.map((item) => {
15936
+ const message = {};
15937
+ if (positionField && !isNil21(item[positionField])) {
15938
+ message.position = item[positionField];
15939
+ }
15940
+ if (titleField && !isNil21(item[titleField])) {
15941
+ message.title = item[titleField];
15942
+ }
15943
+ if (messageField && !isNil21(item[messageField])) {
15944
+ message.message = item[messageField];
15945
+ }
15946
+ if (typeField && !isNil21(item[typeField])) {
15947
+ message.messageType = item[typeField];
15948
+ }
15949
+ if (removeModeField && !isNil21(item[removeModeField])) {
15950
+ message.removeMode = item[removeModeField];
15951
+ }
15952
+ if (!isNil21(item.srfkey)) {
15953
+ message.key = "".concat(this.tag, "_").concat(item.srfkey);
15954
+ }
15955
+ if (layoutPanel) {
15956
+ message.layoutPanel = layoutPanel;
15957
+ }
15958
+ const msg = mergeRight3(basicMsg, message);
15959
+ msg.data = {
15960
+ ...item,
15961
+ env: msg
15962
+ };
15963
+ return msg;
15964
+ });
15965
+ return deViewMessages;
15966
+ }
15967
+ };
15968
+
15604
15969
  // src/controller/common/base.controller.ts
15605
15970
  var SELF_KEY = "__self";
15606
15971
  var BaseController = class {
@@ -15832,240 +16197,10 @@ var BaseController = class {
15832
16197
  /**
15833
16198
  * 转换各类多语言
15834
16199
  *
15835
- * @date 2023-05-18 02:57:00
15836
- * @protected
15837
- */
15838
- convertMultipleLanguages() {
15839
- }
15840
- };
15841
-
15842
- // src/controller/utils/view-msg/view-msg-controller.ts
15843
- import { RuntimeError as RuntimeError33, RuntimeModelError as RuntimeModelError24 } from "@ibiz-template/core";
15844
- import { isNil as isNil21, mergeRight as mergeRight3 } from "ramda";
15845
- var VIEW_MSG_PREFIX = "VIEW_MSG";
15846
- var ViewMsgController = class _ViewMsgController {
15847
- constructor(msgGroupId, tag = "") {
15848
- this.msgGroupId = msgGroupId;
15849
- /**
15850
- * 视图消息map
15851
- * @author lxm
15852
- * @date 2023-09-22 05:38:03
15853
- */
15854
- this.viewMsgMap = /* @__PURE__ */ new Map();
15855
- /**
15856
- * 视图消息tag
15857
- *
15858
- * @author zhanghengfeng
15859
- * @date 2024-04-23 19:04:58
15860
- */
15861
- this.tag = "";
15862
- this.tag = "".concat(VIEW_MSG_PREFIX, "_").concat(tag);
15863
- }
15864
- /**
15865
- * 初始化方法,从全局获取视图消息组和视图消息的模型
15866
- * @author lxm
15867
- * @date 2023-09-22 05:41:08
15868
- * @param {IContext} context
15869
- * @return {*} {Promise<void>}
15870
- */
15871
- async init(context) {
15872
- var _a, _b;
15873
- const appModel = ibiz.hub.getApp(context.srfappid).model;
15874
- const msgGroup = (_a = appModel.appViewMsgGroups) == null ? void 0 : _a.find(
15875
- (item) => item.id === this.msgGroupId
15876
- );
15877
- if (!msgGroup) {
15878
- throw new RuntimeError33(
15879
- ibiz.i18n.t("runtime.controller.utils.viewMsg.message", {
15880
- msgGroupId: this.msgGroupId
15881
- })
15882
- );
15883
- }
15884
- this.msgGroup = msgGroup;
15885
- const msgDetailsViewMsgIds = msgGroup.appViewMsgGroupDetails.map(
15886
- (item) => item.appViewMsgId
15887
- );
15888
- (_b = appModel.appViewMsgs) == null ? void 0 : _b.forEach((item) => {
15889
- const index = msgDetailsViewMsgIds.indexOf(item.id);
15890
- if (index !== -1) {
15891
- this.viewMsgMap.set(item.id, item);
15892
- msgDetailsViewMsgIds.splice(index, 1);
15893
- }
15894
- });
15895
- if (msgDetailsViewMsgIds.length) {
15896
- throw new RuntimeError33(
15897
- ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound", {
15898
- message: msgDetailsViewMsgIds.join(",")
15899
- })
15900
- );
15901
- }
15902
- }
15903
- getDeFieldName(appDataEntity, fieldId) {
15904
- var _a, _b;
15905
- if (!fieldId) {
15906
- return;
15907
- }
15908
- return (_b = (_a = findFieldById(appDataEntity, fieldId)) == null ? void 0 : _a.name) == null ? void 0 : _b.toLowerCase();
15909
- }
15910
- /**
15911
- * 查询并获取指定实体的数据集数据
15912
- * @author lxm
15913
- * @date 2023-09-20 08:10:57
15914
- * @static
15915
- * @param {IPSAppDEDataSetViewMsg} msgModel
15916
- * @param {IParams} [context={}]
15917
- * @param {IParams} [params={}]
15918
- * @return {*} {Promise<IData[]>}
15919
- */
15920
- static async fetchDataSet(msgModel, context, params) {
15921
- const { appDataEntityId, appDEDataSetId } = msgModel;
15922
- if (!appDEDataSetId) {
15923
- throw new RuntimeModelError24(msgModel, "\u672A\u914D\u7F6E\u5B9E\u4F53\u6570\u636E\u96C6");
15924
- }
15925
- const res = await ibiz.hub.getApp(context.srfappid).deService.exec(appDataEntityId, appDEDataSetId, context, params);
15926
- if (res.data.length) {
15927
- return res.data;
15928
- }
15929
- return [];
15930
- }
15931
- /**
15932
- * 计算视图信息呈现数据
15933
- * @author lxm
15934
- * @date 2023-09-20 09:16:59
15935
- * @param {IContext} context
15936
- * @param {IParams} params
15937
- * @return {*} {IViewMessage[]}
15938
- */
15939
- async calcViewMessages(context, params) {
15940
- const details = this.msgGroup.appViewMsgGroupDetails;
15941
- const result = [];
15942
- if (details == null ? void 0 : details.length) {
15943
- await Promise.all(
15944
- details.map(async (detail) => {
15945
- const msgModel = this.viewMsgMap.get(detail.appViewMsgId);
15946
- if (msgModel.dynamicMode === 1) {
15947
- const msgs = await this.calcDynaMsgs(detail, context, params);
15948
- result.push(...msgs);
15949
- } else {
15950
- const msgData = this.calcStaticMsg(detail);
15951
- result.push(msgData);
15952
- }
15953
- })
15954
- );
15955
- }
15956
- return result.filter(
15957
- (item) => !(item.removeMode === 1 && localStorage.getItem(item.key))
15958
- );
15959
- }
15960
- /**
15961
- * 计算静态消息数据(或者动态的里面静态的配置)
15962
- * @author lxm
15963
- * @date 2023-09-20 09:46:45
15964
- * @protected
15965
- * @param {IPSAppViewMsgGroupDetail} detail
15966
- * @return {*} {IViewMessage}
15967
- */
15968
- calcStaticMsg(detail) {
15969
- const { position: position1 } = detail;
15970
- const viewMsg = this.viewMsgMap.get(detail.appViewMsgId);
15971
- const {
15972
- codeName,
15973
- title,
15974
- message,
15975
- removeMode,
15976
- position: position2,
15977
- messageType
15978
- } = viewMsg;
15979
- const { userTag, userTag2, userTag3, userTag4 } = viewMsg;
15980
- const position = position1 || position2;
15981
- return {
15982
- key: "".concat(this.tag, "_").concat(codeName),
15983
- title,
15984
- message,
15985
- position,
15986
- messageType,
15987
- removeMode,
15988
- // 额外参数
15989
- extraParams: {
15990
- userTag,
15991
- userTag2,
15992
- userTag3,
15993
- userTag4
15994
- }
15995
- };
15996
- }
15997
- /**
15998
- * 计算动态视图消息数据
15999
- * @author lxm
16000
- * @date 2023-09-20 09:46:26
16001
- * @protected
16002
- * @param {IPSAppViewMsgGroupDetail} detail
16003
- * @param {IContext} context
16004
- * @param {IParams} params
16005
- * @return {*} {Promise<IViewMessage[]>}
16200
+ * @date 2023-05-18 02:57:00
16201
+ * @protected
16006
16202
  */
16007
- async calcDynaMsgs(detail, context, params) {
16008
- const msgModel = this.viewMsgMap.get(
16009
- detail.appViewMsgId
16010
- );
16011
- const {
16012
- appDataEntityId,
16013
- orderValueAppDEFieldId,
16014
- titleAppDEFieldId,
16015
- removeFlagAppDEFieldId,
16016
- msgTypeAppDEFieldId,
16017
- contentAppDEFieldId,
16018
- msgPosAppDEFieldId
16019
- } = msgModel;
16020
- if (!appDataEntityId) {
16021
- throw new RuntimeModelError24(msgModel, "\u672A\u914D\u7F6E\u5E94\u7528\u5B9E\u4F53");
16022
- }
16023
- const entity = await ibiz.hub.getAppDataEntity(
16024
- appDataEntityId,
16025
- context.srfappid
16026
- );
16027
- const fetchParams = { ...params };
16028
- const sortField = this.getDeFieldName(entity, orderValueAppDEFieldId);
16029
- if (sortField) {
16030
- fetchParams.sort = "".concat(sortField, ",asc");
16031
- }
16032
- const dataSet = await _ViewMsgController.fetchDataSet(
16033
- msgModel,
16034
- context,
16035
- fetchParams
16036
- );
16037
- if (!dataSet.length) {
16038
- return [];
16039
- }
16040
- const basicMsg = this.calcStaticMsg(detail);
16041
- const titleField = this.getDeFieldName(entity, titleAppDEFieldId);
16042
- const positionField = this.getDeFieldName(entity, msgPosAppDEFieldId);
16043
- const messageField = this.getDeFieldName(entity, contentAppDEFieldId);
16044
- const typeField = this.getDeFieldName(entity, msgTypeAppDEFieldId);
16045
- const removeModeField = this.getDeFieldName(entity, removeFlagAppDEFieldId);
16046
- const deViewMessages = dataSet.map((item) => {
16047
- const message = {};
16048
- if (positionField && !isNil21(item[positionField])) {
16049
- message.position = item[positionField];
16050
- }
16051
- if (titleField && !isNil21(item[titleField])) {
16052
- message.title = item[titleField];
16053
- }
16054
- if (messageField && !isNil21(item[messageField])) {
16055
- message.message = item[messageField];
16056
- }
16057
- if (typeField && !isNil21(item[typeField])) {
16058
- message.messageType = item[typeField];
16059
- }
16060
- if (removeModeField && !isNil21(item[removeModeField])) {
16061
- message.removeMode = item[removeModeField];
16062
- }
16063
- if (!isNil21(item.srfkey)) {
16064
- message.key = "".concat(this.tag, "_").concat(item.srfkey);
16065
- }
16066
- return mergeRight3(basicMsg, message);
16067
- });
16068
- return deViewMessages;
16203
+ convertMultipleLanguages() {
16069
16204
  }
16070
16205
  };
16071
16206
 
@@ -16445,6 +16580,7 @@ var ViewController = class extends BaseController {
16445
16580
  * @return {*} {Promise<void>}
16446
16581
  */
16447
16582
  async alertViewMessage(messages) {
16583
+ var _a, _b;
16448
16584
  const [message, ...rest] = messages;
16449
16585
  const modalParams = {
16450
16586
  title: message.title,
@@ -16452,24 +16588,36 @@ var ViewController = class extends BaseController {
16452
16588
  options: {
16453
16589
  showClose: message.removeMode !== 0,
16454
16590
  showConfirmButton: message.removeMode !== 0,
16455
- callback: () => {
16456
- if (message.removeMode === 1) {
16457
- localStorage.setItem(message.key, "1");
16458
- }
16459
- }
16591
+ customClass: ((_a = message.sysCss) == null ? void 0 : _a.cssName) || ""
16460
16592
  }
16461
16593
  };
16594
+ if (message.layoutPanel && modalParams.options) {
16595
+ const alertClass = new Namespace("view-message").m("alert");
16596
+ modalParams.options.customClass = "".concat(modalParams.options.customClass || "", " ").concat(alertClass);
16597
+ modalParams.options.message = () => {
16598
+ return ibiz.render.renderCtrlShell(
16599
+ message.layoutPanel,
16600
+ this.context,
16601
+ this.params,
16602
+ { data: message.data }
16603
+ );
16604
+ };
16605
+ }
16462
16606
  if (message.extraParams.userTag) {
16463
16607
  Object.assign(modalParams, {
16464
16608
  confirmButtonText: message.extraParams.userTag
16465
16609
  });
16466
16610
  }
16467
- if (message.messageType === "WARN") {
16468
- await ibiz.modal.warning(modalParams);
16469
- } else if (message.messageType === "ERROR") {
16470
- await ibiz.modal.error(modalParams);
16471
- } else {
16472
- await ibiz.modal.info(modalParams);
16611
+ try {
16612
+ if (message.messageType === "WARN") {
16613
+ await ibiz.modal.warning(modalParams);
16614
+ } else if (message.messageType === "ERROR") {
16615
+ await ibiz.modal.error(modalParams);
16616
+ } else {
16617
+ await ibiz.modal.info(modalParams);
16618
+ }
16619
+ } finally {
16620
+ (_b = this.viewMsgController) == null ? void 0 : _b.setMsgRemoveModeStorage(message);
16473
16621
  }
16474
16622
  if (rest.length) {
16475
16623
  this.alertViewMessage(rest);
@@ -17973,6 +18121,149 @@ var AppMenuController = class extends ControlController {
17973
18121
  }
17974
18122
  };
17975
18123
 
18124
+ // src/controller/control/app-menu/custom-app-menu.controller.ts
18125
+ var CustomAppMenuController = class {
18126
+ /**
18127
+ * Creates an instance of CustomAppMenuController.
18128
+ * @author tony001
18129
+ * @date 2024-05-09 15:05:33
18130
+ * @param {IAppMenu} model
18131
+ * @param {AppMenuController} menu
18132
+ */
18133
+ constructor(model, menu) {
18134
+ this.model = model;
18135
+ this.menu = menu;
18136
+ /**
18137
+ *自定义定制范围类型(public:公开,personal:个人,data:数据,默认是按照个人区分,配置了应用功能组件才生效)
18138
+ *
18139
+ * @author tony001
18140
+ * @date 2024-05-09 17:05:43
18141
+ * @type {('public' | 'personal' | 'data')}
18142
+ */
18143
+ this.type = "personal";
18144
+ /**
18145
+ *所属数据类型(仅限自定义定制为data类型时生效,配置了应用功能组件才生效)
18146
+ *
18147
+ * @author tony001
18148
+ * @date 2024-05-09 17:05:55
18149
+ * @type {string}
18150
+ */
18151
+ this.ownerType = "";
18152
+ /**
18153
+ *所属数据标识(仅限自定义定制为data类型时生效,配置了应用功能组件才生效)
18154
+ *
18155
+ * @author tony001
18156
+ * @date 2024-05-09 17:05:10
18157
+ * @type {string}
18158
+ */
18159
+ this.ownerId = "";
18160
+ this.context = menu.context;
18161
+ this.params = menu.params;
18162
+ this.init();
18163
+ }
18164
+ /**
18165
+ * 初始化
18166
+ *
18167
+ * @author tony001
18168
+ * @date 2024-05-09 15:05:40
18169
+ * @private
18170
+ */
18171
+ init() {
18172
+ var _a;
18173
+ this.type = "personal";
18174
+ this.ownerId = this.context.srfpersonid;
18175
+ const app = ibiz.hub.getApp(this.context.srfappid);
18176
+ const menuUtil = app.getAppUtil("DYNAMENU", "CUSTOM");
18177
+ if (menuUtil) {
18178
+ this.util = new UtilService(menuUtil);
18179
+ } else {
18180
+ this.config = new ConfigService(
18181
+ this.model.appId,
18182
+ "menu",
18183
+ "menu_".concat(this.menu.view.name.toLowerCase(), "_").concat((_a = this.model.codeName) == null ? void 0 : _a.toLowerCase())
18184
+ );
18185
+ }
18186
+ }
18187
+ /**
18188
+ * 获取资源标识(仅用于功能组件服务)
18189
+ *
18190
+ * @author tony001
18191
+ * @date 2024-05-09 16:05:48
18192
+ * @private
18193
+ * @return {*} {string}
18194
+ */
18195
+ getResourceTag() {
18196
+ var _a;
18197
+ const base = "".concat(this.context.srfappid, "_menu_").concat(this.menu.view.name.toLowerCase(), "_").concat((_a = this.model.codeName) == null ? void 0 : _a.toLowerCase());
18198
+ switch (this.type) {
18199
+ case "personal":
18200
+ return "".concat(base, "_").concat(this.context.srfpersonid);
18201
+ case "data":
18202
+ return "".concat(base, "_").concat(this.ownerType, "_").concat(this.ownerId);
18203
+ default:
18204
+ return base;
18205
+ }
18206
+ }
18207
+ /**
18208
+ * 加载自定义模型
18209
+ *
18210
+ * @author tony001
18211
+ * @date 2024-05-09 17:05:57
18212
+ * @return {*} {Promise<IData>}
18213
+ */
18214
+ async loadCustomModelData() {
18215
+ let res;
18216
+ if (this.util) {
18217
+ res = await this.util.load(
18218
+ this.getResourceTag(),
18219
+ this.context,
18220
+ this.params
18221
+ );
18222
+ } else {
18223
+ res = await this.config.load();
18224
+ }
18225
+ return res;
18226
+ }
18227
+ /**
18228
+ * 重置自定义模型
18229
+ *
18230
+ * @author tony001
18231
+ * @date 2024-05-09 17:05:14
18232
+ * @return {*} {Promise<IData>}
18233
+ */
18234
+ async resetCustomModelData() {
18235
+ return {};
18236
+ }
18237
+ /**
18238
+ * 保存自定义模型
18239
+ *
18240
+ * @author tony001
18241
+ * @date 2024-05-09 17:05:51
18242
+ * @param {IData[]} model
18243
+ * @param {IData} [opts={}]
18244
+ * @return {*} {Promise<IData>}
18245
+ */
18246
+ async saveCustomModelData(model, opts = {}) {
18247
+ if (this.util) {
18248
+ await this.util.save(
18249
+ this.getResourceTag(),
18250
+ this.context,
18251
+ {
18252
+ ...this.params,
18253
+ type: this.type,
18254
+ ownerType: this.ownerType,
18255
+ ownerId: this.ownerId,
18256
+ modelId: this.model.id
18257
+ },
18258
+ model
18259
+ );
18260
+ } else {
18261
+ await this.config.save(model);
18262
+ }
18263
+ return model;
18264
+ }
18265
+ };
18266
+
17976
18267
  // src/controller/control/app-menu-icon-view/app-menu-icon-view.controller.ts
17977
18268
  import {
17978
18269
  findRecursiveChild as findRecursiveChild2,
@@ -18371,6 +18662,7 @@ import { RuntimeError as RuntimeError41 } from "@ibiz-template/core";
18371
18662
 
18372
18663
  // src/controller/control/chart/generator/chart-options-generator.ts
18373
18664
  import { mergeDeepRight as mergeDeepRight3 } from "ramda";
18665
+ import { isObject as isObject2, isString as isString2 } from "qx-util";
18374
18666
  import { RuntimeError as RuntimeError40 } from "@ibiz-template/core";
18375
18667
 
18376
18668
  // src/controller/control/chart/generator/line-series-generator.ts
@@ -19088,6 +19380,21 @@ var RadarSeriesGenerator = class extends BaseSeriesGenerator {
19088
19380
  };
19089
19381
 
19090
19382
  // src/controller/control/chart/generator/chart-options-generator.ts
19383
+ var convertStringFunc = (option) => {
19384
+ const regex = /function\s*\(\s*|\s*function\s*\(\s*/;
19385
+ const result = {};
19386
+ Object.keys(option).forEach((key) => {
19387
+ if (isString2(option[key]) && regex.test(option[key])) {
19388
+ const strFunction = "return ".concat(option[key]);
19389
+ result[key] = new Function(strFunction)();
19390
+ } else if (isObject2(option[key])) {
19391
+ result[key] = convertStringFunc(option[key]);
19392
+ } else {
19393
+ result[key] = option[key];
19394
+ }
19395
+ });
19396
+ return result;
19397
+ };
19091
19398
  function parseUserParams2(userParams) {
19092
19399
  const option = {};
19093
19400
  if (userParams) {
@@ -19106,7 +19413,7 @@ function parseUserParams2(userParams) {
19106
19413
  }
19107
19414
  });
19108
19415
  }
19109
- return option;
19416
+ return convertStringFunc(option);
19110
19417
  }
19111
19418
  var ChartOptionsGenerator2 = class {
19112
19419
  constructor(model) {
@@ -22466,6 +22773,8 @@ var CustomDashboardController = class {
22466
22773
  * @param {CTX} ctx 跨组件上下文环境,内部机制不暴露
22467
22774
  */
22468
22775
  constructor(model, dashboard) {
22776
+ this.model = model;
22777
+ this.dashboard = dashboard;
22469
22778
  /**
22470
22779
  * 自定义布局模型数据
22471
22780
  *
@@ -22518,7 +22827,6 @@ var CustomDashboardController = class {
22518
22827
  * @type {string}
22519
22828
  */
22520
22829
  this.ownerId = "";
22521
- this.model = model;
22522
22830
  this.context = dashboard.context;
22523
22831
  this.params = dashboard.params;
22524
22832
  this.init(dashboard.controlParams);
@@ -22557,7 +22865,7 @@ var CustomDashboardController = class {
22557
22865
  }
22558
22866
  }
22559
22867
  /**
22560
- * 获取资源标识
22868
+ * 获取资源标识(仅用于功能组件服务)
22561
22869
  *
22562
22870
  * @author tony001
22563
22871
  * @date 2024-04-24 14:04:55
@@ -22584,7 +22892,7 @@ var CustomDashboardController = class {
22584
22892
  */
22585
22893
  async loadCustomModelData() {
22586
22894
  let res;
22587
- if (this.model.appDynaDashboardUtilId) {
22895
+ if (this.util) {
22588
22896
  res = await this.util.load(
22589
22897
  this.getResourceTag(),
22590
22898
  this.context,
@@ -22622,8 +22930,8 @@ var CustomDashboardController = class {
22622
22930
  * @author: zhujiamin
22623
22931
  * @Date: 2023-09-20 16:22:49
22624
22932
  */
22625
- async saveCustomModelData(model, config = {}) {
22626
- Object.assign(this.portletConfig, config);
22933
+ async saveCustomModelData(model, opts = {}) {
22934
+ Object.assign(this.portletConfig, opts);
22627
22935
  let res;
22628
22936
  const data = {
22629
22937
  model,
@@ -22631,7 +22939,7 @@ var CustomDashboardController = class {
22631
22939
  rowH: this.layoutRowH,
22632
22940
  config: this.portletConfig
22633
22941
  };
22634
- if (this.model.appDynaDashboardUtilId) {
22942
+ if (this.util) {
22635
22943
  res = await this.util.save(
22636
22944
  this.getResourceTag(),
22637
22945
  this.context,
@@ -31052,7 +31360,7 @@ var PickupViewPanelController = class extends ControlController {
31052
31360
  // src/controller/control/search-bar/search-bar.controller.ts
31053
31361
  import { mergeInLeft as mergeInLeft3, recursiveIterate as recursiveIterate10 } from "@ibiz-template/core";
31054
31362
  import { clone as clone30 } from "ramda";
31055
- import { isString as isString2 } from "lodash-es";
31363
+ import { isString as isString3 } from "lodash-es";
31056
31364
 
31057
31365
  // src/controller/control/search-bar/search-bar-filter.controller.ts
31058
31366
  import { RuntimeModelError as RuntimeModelError65 } from "@ibiz-template/core";
@@ -32236,7 +32544,7 @@ var SearchBarController = class extends ControlController {
32236
32544
  }
32237
32545
  const searchconds = calcSearchConds(this.state.filterNodes, {
32238
32546
  after: (node, cond) => {
32239
- if (node.nodeType === "FIELD" && isString2(node.value)) {
32547
+ if (node.nodeType === "FIELD" && isString3(node.value)) {
32240
32548
  if (ScriptValueRegex2.test(node.value)) {
32241
32549
  cond.value = ScriptFactory.execSingleLine(
32242
32550
  "`".concat(node.value, "`"),
@@ -32433,7 +32741,7 @@ var SearchBarController = class extends ControlController {
32433
32741
  }
32434
32742
  recursiveIterate10(this.state.filterNodes[0], (node) => {
32435
32743
  if (node.nodeType === "FIELD") {
32436
- if (node.field && node.valueOP && isString2(node.value) && ScriptValueRegex2.test(node.value)) {
32744
+ if (node.field && node.valueOP && isString3(node.value) && ScriptValueRegex2.test(node.value)) {
32437
32745
  node.disabled = true;
32438
32746
  }
32439
32747
  }
@@ -37493,6 +37801,91 @@ var GanttController = class extends TreeGridExController {
37493
37801
  this.refreshNodeChildren(nodeParams.data[0], true);
37494
37802
  }
37495
37803
  }
37804
+ /**
37805
+ * 部件刷新,走初始加载(规避预置后续刷新和通知刷新同时进行)
37806
+ *
37807
+ * @author ljx
37808
+ * @date 2024-05-06 20:28:59
37809
+ * @return {*} {Promise<void>}
37810
+ */
37811
+ async refresh() {
37812
+ this.doNextActive(
37813
+ async () => {
37814
+ const nodes = await this.load({
37815
+ isInitialLoad: false
37816
+ });
37817
+ const children = this.model.rootVisible ? nodes : nodes[0]._children;
37818
+ if (children) {
37819
+ const state = await this.handleDefaultExpandNodes(children);
37820
+ if (state) {
37821
+ this._evt.emit("onDefaultExpand", {
37822
+ nodes: children
37823
+ });
37824
+ }
37825
+ }
37826
+ },
37827
+ {
37828
+ key: "refresh"
37829
+ }
37830
+ );
37831
+ }
37832
+ /**
37833
+ * 刷新指定树节点的子节点数据
37834
+ *
37835
+ * @param {(ITreeNodeData | IData)} nodeData 指定树节点数据,可以是节点数据,也可以是对应的实体数据
37836
+ * @param {boolean} [refreshParent=false] 是否是刷新给定节点数据的父节点的子节点数据
37837
+ * @return {*} {Promise<void>}
37838
+ */
37839
+ async refreshNodeChildren(nodeData, refreshParent = false) {
37840
+ const key = nodeData.srfkey ? "srfkey" : "_id";
37841
+ const currentNode = this.state.items.find(
37842
+ (item) => item[key] === nodeData[key]
37843
+ );
37844
+ if (!currentNode) {
37845
+ ibiz.log.error(
37846
+ ibiz.i18n.t("runtime.controller.control.tree.notFoundTreeData"),
37847
+ nodeData
37848
+ );
37849
+ return;
37850
+ }
37851
+ if (refreshParent) {
37852
+ const { _parent } = currentNode;
37853
+ if (!_parent || !this.model.rootVisible && this.state.rootNodes.includes(_parent)) {
37854
+ await this.refresh();
37855
+ return;
37856
+ }
37857
+ }
37858
+ const targetNode = refreshParent ? currentNode._parent : currentNode;
37859
+ const nodes = await this.loadNodes(targetNode);
37860
+ const state = await this.handleDefaultExpandNodes(nodes);
37861
+ if (state) {
37862
+ this._evt.emit("onDefaultExpand", {
37863
+ nodes
37864
+ });
37865
+ }
37866
+ this._evt.emit("onAfterRefreshParent", {
37867
+ parentNode: targetNode,
37868
+ children: nodes
37869
+ });
37870
+ }
37871
+ /**
37872
+ * 处理已展开节点子节点数据
37873
+ *
37874
+ * @param {ITreeNodeData[]} data 子节点数据
37875
+ * @return {*} {Promise<void>}
37876
+ */
37877
+ async handleDefaultExpandNodes(data) {
37878
+ let state = false;
37879
+ for (let i = 0; i < data.length; i++) {
37880
+ const nodeData = data[i];
37881
+ if (this.state.expandedKeys.includes(nodeData._id)) {
37882
+ state = true;
37883
+ const nodes = await this.loadNodes(nodeData);
37884
+ await this.handleDefaultExpandNodes(nodes);
37885
+ }
37886
+ }
37887
+ return state;
37888
+ }
37496
37889
  /**
37497
37890
  * 打开编辑数据视图
37498
37891
  *
@@ -37530,7 +37923,7 @@ var GanttController = class extends TreeGridExController {
37530
37923
  );
37531
37924
  } else {
37532
37925
  return {
37533
- cancel: result ? result.ok : true
37926
+ cancel: !result.ok
37534
37927
  };
37535
37928
  }
37536
37929
  }
@@ -37839,6 +38232,8 @@ var GanttController = class extends TreeGridExController {
37839
38232
  }
37840
38233
  }
37841
38234
  }
38235
+ onDEDataChange(msg) {
38236
+ }
37842
38237
  };
37843
38238
 
37844
38239
  // src/controller/hub.controller.ts
@@ -40746,6 +41141,7 @@ export {
40746
41141
  ControllerEvent,
40747
41142
  Counter,
40748
41143
  CounterService,
41144
+ CustomAppMenuController,
40749
41145
  CustomDashboardController,
40750
41146
  DEActionMethod,
40751
41147
  DECache,
@@ -40918,6 +41314,7 @@ export {
40918
41314
  UIMapField,
40919
41315
  UtilService,
40920
41316
  V7AuthService,
41317
+ VIEW_MSG_PREFIX,
40921
41318
  VIEW_PROVIDER_PREFIX,
40922
41319
  ValueExUtil,
40923
41320
  ValueOP,
@@ -40926,6 +41323,7 @@ export {
40926
41323
  ViewEngineBase,
40927
41324
  ViewLayoutPanelController,
40928
41325
  ViewMode,
41326
+ ViewMsgController,
40929
41327
  ViewPortletController,
40930
41328
  ViewStack,
40931
41329
  ViewType,