@ibiz-template/runtime 0.5.0-beta.4 → 0.5.0-beta.5

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 (83) hide show
  1. package/dist/index.esm.js +548 -142
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/app-menu/app-menu.controller.d.ts +34 -1
  4. package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
  5. package/out/controller/control/app-menu/app-menu.controller.js +47 -5
  6. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  7. package/out/controller/control/gantt/gantt.controller.js +3 -3
  8. package/out/controller/control/grid/grid/entity-schema.d.ts +16 -0
  9. package/out/controller/control/grid/grid/entity-schema.d.ts.map +1 -0
  10. package/out/controller/control/grid/grid/entity-schema.js +81 -0
  11. package/out/controller/control/grid/grid/grid.controller.d.ts +14 -0
  12. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  13. package/out/controller/control/grid/grid/grid.controller.js +43 -1
  14. package/out/controller/control/grid/grid/grid.service.js +1 -1
  15. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +1 -1
  16. package/out/controller/control/search-bar/entity-schema.d.ts +13 -0
  17. package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -0
  18. package/out/controller/control/search-bar/entity-schema.js +151 -0
  19. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +9 -0
  20. package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
  21. package/out/controller/control/search-bar/search-bar-filter.controller.js +26 -6
  22. package/out/controller/control/search-bar/search-bar.controller.d.ts +29 -1
  23. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  24. package/out/controller/control/search-bar/search-bar.controller.js +55 -8
  25. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
  26. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +2 -1
  27. package/out/controller/utils/index.d.ts +1 -0
  28. package/out/controller/utils/index.d.ts.map +1 -1
  29. package/out/controller/utils/index.js +1 -0
  30. package/out/controller/utils/jsonschema/entity.d.ts +11 -0
  31. package/out/controller/utils/jsonschema/entity.d.ts.map +1 -0
  32. package/out/controller/utils/jsonschema/entity.js +16 -0
  33. package/out/controller/utils/jsonschema/index.d.ts +2 -0
  34. package/out/controller/utils/jsonschema/index.d.ts.map +1 -0
  35. package/out/controller/utils/jsonschema/index.js +1 -0
  36. package/out/interface/provider/i-app-menu-item.provider.d.ts +31 -0
  37. package/out/interface/provider/i-app-menu-item.provider.d.ts.map +1 -0
  38. package/out/interface/provider/i-app-menu-item.provider.js +1 -0
  39. package/out/interface/provider/index.d.ts +1 -0
  40. package/out/interface/provider/index.d.ts.map +1 -1
  41. package/out/interface/service/i-data-entity/i-data-entity.d.ts +0 -17
  42. package/out/interface/service/i-data-entity/i-data-entity.d.ts.map +1 -1
  43. package/out/register/helper/app-menu-item-register.d.ts +25 -0
  44. package/out/register/helper/app-menu-item-register.d.ts.map +1 -0
  45. package/out/register/helper/app-menu-item-register.js +52 -0
  46. package/out/register/helper/index.d.ts +1 -0
  47. package/out/register/helper/index.d.ts.map +1 -1
  48. package/out/register/helper/index.js +1 -0
  49. package/out/service/app-data-entity/app-data-entity.d.ts +0 -9
  50. package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
  51. package/out/service/app-data-entity/app-data-entity.js +11 -41
  52. package/out/service/de-service-util.js +1 -1
  53. package/out/service/service/entity/method/de-action.d.ts +11 -0
  54. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  55. package/out/service/service/entity/method/de-action.js +31 -4
  56. package/out/service/utils/de-cache/de-cache.js +3 -3
  57. package/out/utils/open-redirect-view/open-redirect-view.d.ts +17 -4
  58. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  59. package/out/utils/open-redirect-view/open-redirect-view.js +20 -4
  60. package/package.json +3 -3
  61. package/src/controller/control/app-menu/app-menu.controller.ts +64 -6
  62. package/src/controller/control/gantt/gantt.controller.ts +3 -3
  63. package/src/controller/control/grid/grid/entity-schema.ts +105 -0
  64. package/src/controller/control/grid/grid/grid.controller.ts +57 -1
  65. package/src/controller/control/grid/grid/grid.service.ts +1 -1
  66. package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +1 -1
  67. package/src/controller/control/search-bar/entity-schema.ts +178 -0
  68. package/src/controller/control/search-bar/search-bar-filter.controller.ts +32 -9
  69. package/src/controller/control/search-bar/search-bar.controller.ts +69 -9
  70. package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +2 -2
  71. package/src/controller/utils/index.ts +1 -0
  72. package/src/controller/utils/jsonschema/entity.ts +19 -0
  73. package/src/controller/utils/jsonschema/index.ts +1 -0
  74. package/src/interface/provider/i-app-menu-item.provider.ts +40 -0
  75. package/src/interface/provider/index.ts +1 -0
  76. package/src/interface/service/i-data-entity/i-data-entity.ts +0 -19
  77. package/src/register/helper/app-menu-item-register.ts +65 -0
  78. package/src/register/helper/index.ts +1 -0
  79. package/src/service/app-data-entity/app-data-entity.ts +11 -46
  80. package/src/service/de-service-util.ts +1 -1
  81. package/src/service/service/entity/method/de-action.ts +44 -4
  82. package/src/service/utils/de-cache/de-cache.ts +3 -3
  83. package/src/utils/open-redirect-view/open-redirect-view.ts +31 -4
package/dist/index.esm.js CHANGED
@@ -776,8 +776,8 @@ function parseUserParams(userParams) {
776
776
  }
777
777
  return { navigateContexts, navigateParams, other };
778
778
  }
779
- function getPFPlugin(id, appId) {
780
- const app = ibiz.hub.getApp(appId);
779
+ function getPFPlugin(id, appId2) {
780
+ const app = ibiz.hub.getApp(appId2);
781
781
  if (!app) {
782
782
  throw new RuntimeModelError2(app, "\u672A\u627E\u5230\u5E94\u7528");
783
783
  }
@@ -997,8 +997,8 @@ function findFieldById(entity, fieldId) {
997
997
  }
998
998
 
999
999
  // src/model/ui-action/ui-action.ts
1000
- async function getUIActionById(id, appId) {
1001
- const app = ibiz.hub.getApp(appId);
1000
+ async function getUIActionById(id, appId2) {
1001
+ const app = ibiz.hub.getApp(appId2);
1002
1002
  return app.getUIAction(id);
1003
1003
  }
1004
1004
 
@@ -1145,6 +1145,16 @@ async function openRedirectView(appView, context, params = {}, opts = {}) {
1145
1145
  );
1146
1146
  }
1147
1147
  async function toLocalOpenWFRedirectView(context, linkUrl, opts = {}) {
1148
+ const toView = await getLocalOpenWFRedirectView(context, linkUrl, opts);
1149
+ await ibiz.commands.execute(
1150
+ OpenAppViewCommand.TAG,
1151
+ toView.viewId,
1152
+ toView.context,
1153
+ toView.params,
1154
+ toView.opts
1155
+ );
1156
+ }
1157
+ async function getLocalOpenWFRedirectView(context, linkUrl, opts = {}) {
1148
1158
  const i = linkUrl.lastIndexOf("?");
1149
1159
  const queryStr = decodeURIComponent(
1150
1160
  linkUrl.substring(i + 1, linkUrl.length)
@@ -1214,7 +1224,7 @@ async function getDERedirectToView(appView, context, params = {}, opts = {}) {
1214
1224
  return { type: "url", url: linkUrl };
1215
1225
  }
1216
1226
  if (linkUrl.startsWith("appredirectview?")) {
1217
- const toView = await toLocalOpenWFRedirectView(
1227
+ const toView = await getLocalOpenWFRedirectView(
1218
1228
  context,
1219
1229
  linkUrl,
1220
1230
  opts
@@ -3371,9 +3381,9 @@ var PSDEDQCondEngine = _PSDEDQCondEngine;
3371
3381
  import { RuntimeError as RuntimeError6 } from "@ibiz-template/core";
3372
3382
 
3373
3383
  // src/register/helper/common-register.ts
3374
- async function getPluginRegisterKey(pluginId, appId) {
3384
+ async function getPluginRegisterKey(pluginId, appId2) {
3375
3385
  var _a;
3376
- const app = ibiz.hub.getApp(appId);
3386
+ const app = ibiz.hub.getApp(appId2);
3377
3387
  const plugin = (_a = app.model.appPFPluginRefs) == null ? void 0 : _a.find(
3378
3388
  (item) => item.pluginCode.toLowerCase() === pluginId
3379
3389
  );
@@ -3397,9 +3407,9 @@ function getProvider(key) {
3397
3407
  }
3398
3408
  async function getAppCounterProvider(model) {
3399
3409
  let provider;
3400
- const { codeName, counterType, sysPFPluginId, appId } = model;
3410
+ const { codeName, counterType, sysPFPluginId, appId: appId2 } = model;
3401
3411
  if (sysPFPluginId) {
3402
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3412
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3403
3413
  if (pluginKey) {
3404
3414
  provider = getProvider(pluginKey);
3405
3415
  }
@@ -3437,9 +3447,9 @@ function getProvider2(key) {
3437
3447
  }
3438
3448
  async function getControlProvider(model) {
3439
3449
  let provider;
3440
- const { controlType, controlStyle, sysPFPluginId, appId } = model;
3450
+ const { controlType, controlStyle, sysPFPluginId, appId: appId2 } = model;
3441
3451
  if (sysPFPluginId) {
3442
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3452
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3443
3453
  if (pluginKey) {
3444
3454
  provider = getProvider2(pluginKey);
3445
3455
  }
@@ -3486,9 +3496,9 @@ function getProvider3(key) {
3486
3496
  }
3487
3497
  async function getEditorProvider(model) {
3488
3498
  let provider;
3489
- const { editorType, editorStyle, predefinedType, sysPFPluginId, appId } = model;
3499
+ const { editorType, editorStyle, predefinedType, sysPFPluginId, appId: appId2 } = model;
3490
3500
  if (sysPFPluginId) {
3491
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3501
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3492
3502
  if (pluginKey) {
3493
3503
  provider = getProvider3(pluginKey);
3494
3504
  }
@@ -3545,9 +3555,9 @@ function getProvider4(key) {
3545
3555
  }
3546
3556
  async function getFormDetailProvider(model) {
3547
3557
  let provider;
3548
- const { detailType, sysPFPluginId, appId } = model;
3558
+ const { detailType, sysPFPluginId, appId: appId2 } = model;
3549
3559
  if (sysPFPluginId) {
3550
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3560
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3551
3561
  if (pluginKey) {
3552
3562
  provider = getProvider4(pluginKey);
3553
3563
  }
@@ -3577,9 +3587,9 @@ function getProvider5(key) {
3577
3587
  }
3578
3588
  async function getGridColumnProvider(model) {
3579
3589
  let provider;
3580
- const { columnType, enableRowEdit, sysPFPluginId, appId } = model;
3590
+ const { columnType, enableRowEdit, sysPFPluginId, appId: appId2 } = model;
3581
3591
  if (sysPFPluginId) {
3582
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3592
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3583
3593
  if (pluginKey) {
3584
3594
  provider = getProvider5(pluginKey);
3585
3595
  }
@@ -3614,9 +3624,9 @@ function getProvider6(key) {
3614
3624
  async function getPanelItemProvider(model) {
3615
3625
  var _a;
3616
3626
  let provider;
3617
- const { itemType, sysPFPluginId, appId } = model;
3627
+ const { itemType, sysPFPluginId, appId: appId2 } = model;
3618
3628
  if (sysPFPluginId) {
3619
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3629
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3620
3630
  if (pluginKey) {
3621
3631
  provider = getProvider6(pluginKey);
3622
3632
  }
@@ -3680,9 +3690,9 @@ function getProvider7(key) {
3680
3690
  }
3681
3691
  async function getPortletProvider(model) {
3682
3692
  let provider;
3683
- const { portletType, sysPFPluginId, appId } = model;
3693
+ const { portletType, sysPFPluginId, appId: appId2 } = model;
3684
3694
  if (sysPFPluginId) {
3685
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3695
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3686
3696
  if (pluginKey) {
3687
3697
  provider = getProvider7(pluginKey);
3688
3698
  }
@@ -3713,9 +3723,9 @@ function getProvider8(key) {
3713
3723
  }
3714
3724
  async function getUIActionProvider(model) {
3715
3725
  let provider;
3716
- const { uiactionMode, sysPFPluginId, appId, uiactionTag } = model;
3726
+ const { uiactionMode, sysPFPluginId, appId: appId2, uiactionTag } = model;
3717
3727
  if (sysPFPluginId) {
3718
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3728
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3719
3729
  if (pluginKey) {
3720
3730
  provider = getProvider8(pluginKey);
3721
3731
  }
@@ -3745,8 +3755,8 @@ function registerUILogicNodeProvider(key, callback) {
3745
3755
  }
3746
3756
  async function getUILogicNodeProvider(model) {
3747
3757
  let provider;
3748
- const { sysPFPluginId, appId } = model;
3749
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3758
+ const { sysPFPluginId, appId: appId2 } = model;
3759
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3750
3760
  if (pluginKey) {
3751
3761
  provider = ibiz.register.get(
3752
3762
  "".concat(UILOGINNODE_PROVIDER_PREFIX, "_").concat(pluginKey)
@@ -3770,9 +3780,9 @@ function getProvider9(key) {
3770
3780
  }
3771
3781
  async function getViewProvider(model) {
3772
3782
  let provider;
3773
- const { viewType, viewStyle, sysPFPluginId, appId } = model;
3783
+ const { viewType, viewStyle, sysPFPluginId, appId: appId2 } = model;
3774
3784
  if (sysPFPluginId) {
3775
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3785
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3776
3786
  if (pluginKey) {
3777
3787
  provider = getProvider9(pluginKey);
3778
3788
  }
@@ -3932,9 +3942,9 @@ function getProvider12(key) {
3932
3942
  }
3933
3943
  async function getDEMethodProvider(model) {
3934
3944
  let provider;
3935
- const { methodType, sysPFPluginId, appId } = model;
3945
+ const { methodType, sysPFPluginId, appId: appId2 } = model;
3936
3946
  if (sysPFPluginId) {
3937
- const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId);
3947
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
3938
3948
  if (pluginKey) {
3939
3949
  provider = getProvider12(pluginKey);
3940
3950
  }
@@ -3967,9 +3977,9 @@ function getProvider13(key) {
3967
3977
  }
3968
3978
  async function getTreeGridExColumnProvider(model) {
3969
3979
  let provider;
3970
- const { columnType, appId, renderSysPFPluginId } = model;
3980
+ const { columnType, appId: appId2, renderSysPFPluginId } = model;
3971
3981
  if (renderSysPFPluginId) {
3972
- const pluginKey = await getPluginRegisterKey(renderSysPFPluginId, appId);
3982
+ const pluginKey = await getPluginRegisterKey(renderSysPFPluginId, appId2);
3973
3983
  if (pluginKey) {
3974
3984
  provider = getProvider13(pluginKey);
3975
3985
  }
@@ -3987,6 +3997,38 @@ async function getTreeGridExColumnProvider(model) {
3987
3997
  }
3988
3998
  }
3989
3999
 
4000
+ // src/register/helper/app-menu-item-register.ts
4001
+ var APPMENUITEM_PROVIDER_PREFIX = "APPMENUITEM";
4002
+ function registerAppMenuItemProvider(key, callback) {
4003
+ ibiz.register.register("".concat(APPMENUITEM_PROVIDER_PREFIX, "_").concat(key), callback);
4004
+ }
4005
+ function getProvider14(key) {
4006
+ return ibiz.register.get(
4007
+ "".concat(APPMENUITEM_PROVIDER_PREFIX, "_").concat(key)
4008
+ );
4009
+ }
4010
+ async function getAppMenuItemProvider(model) {
4011
+ let provider;
4012
+ const { sysPFPluginId, appId: appId2, itemType } = model;
4013
+ if (sysPFPluginId) {
4014
+ const pluginKey = await getPluginRegisterKey(sysPFPluginId, appId2);
4015
+ if (pluginKey) {
4016
+ provider = getProvider14(pluginKey);
4017
+ }
4018
+ if (!provider) {
4019
+ ibiz.log.error("\u627E\u4E0D\u5230\u5E94\u7528\u83DC\u5355\u9879\u63D2\u4EF6".concat(pluginKey, "\u5BF9\u5E94\u7684\u9002\u914D\u5668"));
4020
+ } else {
4021
+ return provider;
4022
+ }
4023
+ }
4024
+ provider = getProvider14(itemType);
4025
+ if (!provider) {
4026
+ ibiz.log.error("\u627E\u4E0D\u5230\u5E94\u7528\u83DC\u5355\u9879\u7C7B\u578B".concat(itemType, "\u5BF9\u5E94\u7684\u9002\u914D\u5668"));
4027
+ } else {
4028
+ return provider;
4029
+ }
4030
+ }
4031
+
3990
4032
  // src/service/utils/app-counter/app-counter.ts
3991
4033
  import { IBizContext, RuntimeError as RuntimeError12 } from "@ibiz-template/core";
3992
4034
  import { notNilEmpty as notNilEmpty5, QXEvent } from "qx-util";
@@ -4941,9 +4983,6 @@ var DECache = class {
4941
4983
  * @date 2023-12-22 13:12:17
4942
4984
  */
4943
4985
  clear() {
4944
- this.cacheMap.forEach((item) => {
4945
- item.destroy();
4946
- });
4947
4986
  this.cacheMap.clear();
4948
4987
  }
4949
4988
  /**
@@ -5291,11 +5330,11 @@ var ConfigService = class {
5291
5330
  * @param {string} folder 定义文件夹
5292
5331
  * @param {string} tag 存储标识
5293
5332
  */
5294
- constructor(appId, folder, tag) {
5295
- this.appId = appId;
5333
+ constructor(appId2, folder, tag) {
5334
+ this.appId = appId2;
5296
5335
  this.folder = folder;
5297
5336
  this.tag = tag;
5298
- this.app = ibiz.hub.getApp(appId);
5337
+ this.app = ibiz.hub.getApp(appId2);
5299
5338
  }
5300
5339
  /**
5301
5340
  * 保存配置
@@ -5755,7 +5794,7 @@ var FileService = class {
5755
5794
 
5756
5795
  // src/service/app-data-entity/app-data-entity.ts
5757
5796
  import { clone as clone5, isNil as isNil7 } from "ramda";
5758
- import { DataTypes, HistoryList } from "@ibiz-template/core";
5797
+ import { DataTypes } from "@ibiz-template/core";
5759
5798
  import { createUUID as createUUID3 } from "qx-util";
5760
5799
 
5761
5800
  // src/service/constant/srfuf.ts
@@ -5779,9 +5818,6 @@ var AppDataEntity = class _AppDataEntity {
5779
5818
  * @param {(IData | AppDataEntity)} [data={}]
5780
5819
  */
5781
5820
  constructor(entity, data = {}) {
5782
- let history = new HistoryList(
5783
- data instanceof _AppDataEntity ? clone5(data._data) : clone5(data)
5784
- );
5785
5821
  Object.defineProperty(this, "_entity", {
5786
5822
  enumerable: false,
5787
5823
  configurable: true,
@@ -5790,19 +5826,7 @@ var AppDataEntity = class _AppDataEntity {
5790
5826
  Object.defineProperty(this, "_data", {
5791
5827
  enumerable: false,
5792
5828
  configurable: true,
5793
- get() {
5794
- return history.data;
5795
- }
5796
- });
5797
- Object.defineProperty(this, "history", {
5798
- enumerable: false,
5799
- configurable: true,
5800
- set(v) {
5801
- history = v;
5802
- },
5803
- get() {
5804
- return history;
5805
- }
5829
+ value: data instanceof _AppDataEntity ? clone5(data._data) : clone5(data)
5806
5830
  });
5807
5831
  Object.defineProperty(this, "srfdeid", {
5808
5832
  get() {
@@ -5875,18 +5899,17 @@ var AppDataEntity = class _AppDataEntity {
5875
5899
  */
5876
5900
  defineProperties() {
5877
5901
  var _a;
5878
- const self = this;
5879
- const { convertVal } = this;
5902
+ const { _data, convertVal } = this;
5880
5903
  const properties = {};
5881
- const keys = Object.keys(this._data);
5904
+ const keys = Object.keys(_data);
5882
5905
  keys.forEach((key) => {
5883
5906
  properties[key] = {
5884
5907
  enumerable: true,
5885
5908
  set(val) {
5886
- self._data[key] = val;
5909
+ _data[key] = val;
5887
5910
  },
5888
5911
  get() {
5889
- return self._data[key];
5912
+ return _data[key];
5890
5913
  }
5891
5914
  };
5892
5915
  });
@@ -5895,13 +5918,13 @@ var AppDataEntity = class _AppDataEntity {
5895
5918
  properties[key] = {
5896
5919
  enumerable: true,
5897
5920
  set(val) {
5898
- self._data[key] = convertVal(val, field.stdDataType);
5921
+ _data[key] = convertVal(val, field.stdDataType);
5899
5922
  },
5900
5923
  get() {
5901
- return self._data[key];
5924
+ return _data[key];
5902
5925
  }
5903
5926
  };
5904
- self._data[key] = convertVal(self._data[key], field.stdDataType);
5927
+ _data[key] = convertVal(_data[key], field.stdDataType);
5905
5928
  });
5906
5929
  Object.defineProperties(this, properties);
5907
5930
  }
@@ -5913,9 +5936,8 @@ var AppDataEntity = class _AppDataEntity {
5913
5936
  * @return {*} {AppDataEntity}
5914
5937
  */
5915
5938
  clone() {
5916
- const entity = new _AppDataEntity(this._entity);
5939
+ const entity = new _AppDataEntity(this._entity, this._data);
5917
5940
  entity.srfkey = this.srfkey;
5918
- entity.history = clone5(this.history);
5919
5941
  return entity;
5920
5942
  }
5921
5943
  /**
@@ -5938,23 +5960,9 @@ var AppDataEntity = class _AppDataEntity {
5938
5960
  delete _data[key];
5939
5961
  }
5940
5962
  });
5941
- this.history.assign(_data);
5963
+ Object.assign(this._data, _data);
5942
5964
  return this;
5943
5965
  }
5944
- /**
5945
- * 实体对象销毁
5946
- *
5947
- * @author chitanda
5948
- * @date 2023-12-28 21:12:24
5949
- */
5950
- destroy() {
5951
- this.history.destroy();
5952
- Object.defineProperty(this, "_entity", {
5953
- enumerable: false,
5954
- configurable: true,
5955
- value: null
5956
- });
5957
- }
5958
5966
  /**
5959
5967
  * 根据属性的数据类型转换值
5960
5968
  * @author lxm
@@ -8506,8 +8514,8 @@ var DELogic = class {
8506
8514
 
8507
8515
  // src/de-logic/index.ts
8508
8516
  var deLogicMap = /* @__PURE__ */ new Map();
8509
- async function findDeLogic(deDELogicId, dataEntityId, appId) {
8510
- const appDataEntity = await ibiz.hub.getAppDataEntity(dataEntityId, appId);
8517
+ async function findDeLogic(deDELogicId, dataEntityId, appId2) {
8518
+ const appDataEntity = await ibiz.hub.getAppDataEntity(dataEntityId, appId2);
8511
8519
  return findDELogic(deDELogicId, appDataEntity);
8512
8520
  }
8513
8521
  async function execDELogic(deDELogic, context, data = {}, params = {}) {
@@ -8781,10 +8789,15 @@ var DEActionMethod = class extends Method {
8781
8789
  let resultData;
8782
8790
  if (isArray6(addData)) {
8783
8791
  resultData = await Promise.all(
8784
- addData.map((item) => this.service.local.add(context, item))
8792
+ addData.map(
8793
+ (item) => this.service.local.add(context, this.attach(context, item))
8794
+ )
8785
8795
  );
8786
8796
  } else {
8787
- resultData = await this.service.local.add(context, addData);
8797
+ resultData = await this.service.local.add(
8798
+ context,
8799
+ this.attach(context, addData)
8800
+ );
8788
8801
  }
8789
8802
  return new HttpResponse3(resultData);
8790
8803
  } catch (err) {
@@ -8852,10 +8865,15 @@ var DEActionMethod = class extends Method {
8852
8865
  let resultData;
8853
8866
  if (isArray6(updateData)) {
8854
8867
  resultData = await Promise.all(
8855
- updateData.map((item) => this.service.local.update(context, item))
8868
+ updateData.map(
8869
+ (item) => this.service.local.update(context, this.attach(context, item))
8870
+ )
8856
8871
  );
8857
8872
  } else {
8858
- resultData = await this.service.local.update(context, updateData);
8873
+ resultData = await this.service.local.update(
8874
+ context,
8875
+ this.attach(context, updateData)
8876
+ );
8859
8877
  }
8860
8878
  if (resultData) {
8861
8879
  return new HttpResponse3(resultData);
@@ -8901,6 +8919,33 @@ var DEActionMethod = class extends Method {
8901
8919
  async removeBatchTemp(_context, _params) {
8902
8920
  return new HttpResponse3(true);
8903
8921
  }
8922
+ /**
8923
+ * 在新建、更新时,根据界面域下的关系,自动填充相关父属性
8924
+ *
8925
+ * @author chitanda
8926
+ * @date 2024-01-02 15:01:30
8927
+ * @protected
8928
+ * @param {IContext} context
8929
+ * @param {IDataEntity} data
8930
+ * @return {*} {IDataEntity}
8931
+ */
8932
+ attach(context, data) {
8933
+ const sandboxId = context.srfsessionid;
8934
+ const uiDomain = ibiz.uiDomainManager.get(sandboxId);
8935
+ const configs = uiDomain.getDERConfig(this.entity.id);
8936
+ if (configs.length > 0) {
8937
+ configs.forEach((config) => {
8938
+ const { majorDECodeName, pickupDEFName } = config;
8939
+ const majorLowerCodeName = majorDECodeName.toLowerCase();
8940
+ const pickupLowerDEFName = pickupDEFName.toLowerCase();
8941
+ const majorkey = context[majorLowerCodeName];
8942
+ if (majorkey) {
8943
+ data[pickupLowerDEFName] = majorkey;
8944
+ }
8945
+ });
8946
+ }
8947
+ return data;
8948
+ }
8904
8949
  };
8905
8950
 
8906
8951
  // src/service/service/entity/method/provider/de-action-de-method.provider.ts
@@ -9752,10 +9797,10 @@ var MqttService = class {
9752
9797
  * @param {string} token
9753
9798
  * @param {string} appId
9754
9799
  */
9755
- constructor(mqttTopic, token, appId) {
9800
+ constructor(mqttTopic, token, appId2) {
9756
9801
  this.mqttTopic = mqttTopic;
9757
9802
  this.token = token;
9758
- this.appId = appId;
9803
+ this.appId = appId2;
9759
9804
  /**
9760
9805
  * 接受消息通知
9761
9806
  *
@@ -9876,7 +9921,7 @@ var _DEServiceUtil = class _DEServiceUtil {
9876
9921
  * @return {*} {Promise<IAppDEService>}
9877
9922
  */
9878
9923
  async getService(context, id) {
9879
- const sandboxId = context.srfsessionid;
9924
+ const sandboxId = context.srfsessionid || "applocation";
9880
9925
  if (!this.cache.has(sandboxId)) {
9881
9926
  this.cache.set(sandboxId, /* @__PURE__ */ new Map());
9882
9927
  }
@@ -10859,7 +10904,7 @@ var ActivityCounter = class extends Counter {
10859
10904
 
10860
10905
  // src/controller/utils/button-state/ui-action-button.state.ts
10861
10906
  var UIActionButtonState = class {
10862
- constructor(name, appId, uiActionId) {
10907
+ constructor(name, appId2, uiActionId) {
10863
10908
  this.disabled = false;
10864
10909
  this.visible = true;
10865
10910
  this.loading = false;
@@ -10895,7 +10940,7 @@ var UIActionButtonState = class {
10895
10940
  this.isInit = false;
10896
10941
  this.name = name;
10897
10942
  this.uiActionId = uiActionId;
10898
- this.appId = appId;
10943
+ this.appId = appId2;
10899
10944
  }
10900
10945
  /**
10901
10946
  * 初始化,没有界面行为id就是普通的buttonState
@@ -11485,6 +11530,15 @@ async function exportData(header, data, fileName) {
11485
11530
  }
11486
11531
  }
11487
11532
 
11533
+ // src/controller/utils/jsonschema/entity.ts
11534
+ async function getEntitySchema(entityId, context) {
11535
+ const app = ibiz.hub.getApp(context.srfappid);
11536
+ const entity = await ibiz.hub.getAppDataEntity(entityId, context.srfappid);
11537
+ const url = "/jsonschema/".concat(entity.name);
11538
+ const res = await app.net.get(url);
11539
+ return res.data;
11540
+ }
11541
+
11488
11542
  // src/controller/common/base.controller.ts
11489
11543
  var SELF_KEY = "__self";
11490
11544
  var BaseController = class {
@@ -13271,6 +13325,17 @@ import {
13271
13325
  RuntimeModelError as RuntimeModelError24
13272
13326
  } from "@ibiz-template/core";
13273
13327
  var AppMenuController = class extends ControlController {
13328
+ constructor(model, context, params, ctx) {
13329
+ super(model, context, params, ctx);
13330
+ /**
13331
+ * 菜单项适配器集合
13332
+ * @author lxm
13333
+ * @date 2023-07-19 04:14:50
13334
+ * @type {{ [key: string]: IProvider }}
13335
+ */
13336
+ this.itemProviders = {};
13337
+ this.flattenAllItems();
13338
+ }
13274
13339
  initState() {
13275
13340
  super.initState();
13276
13341
  this.state.menuItemsState = {};
@@ -13289,10 +13354,28 @@ var AppMenuController = class extends ControlController {
13289
13354
  var _a;
13290
13355
  await super.onCreated();
13291
13356
  this.app = await ibiz.hub.getApp(this.context.srfappid);
13357
+ await this.initAppMenuItemProviders();
13292
13358
  (_a = this.model.appMenuItems) == null ? void 0 : _a.forEach((item) => {
13293
13359
  this.initMenuItemState(item);
13294
13360
  });
13295
13361
  }
13362
+ /**
13363
+ * 初始化菜单项的适配器
13364
+ * @author lxm
13365
+ * @date 2023-12-29 02:50:20
13366
+ * @protected
13367
+ * @return {*} {Promise<void>}
13368
+ */
13369
+ async initAppMenuItemProviders() {
13370
+ await Promise.all(
13371
+ this.allAppMenuItems.map(async (item) => {
13372
+ const provider = await getAppMenuItemProvider(item);
13373
+ if (provider) {
13374
+ this.itemProviders[item.id] = provider;
13375
+ }
13376
+ })
13377
+ );
13378
+ }
13296
13379
  /**
13297
13380
  * 菜单项点击回调,触发对应的应用功能
13298
13381
  *
@@ -13313,6 +13396,10 @@ var AppMenuController = class extends ControlController {
13313
13396
  eventArg: id,
13314
13397
  event
13315
13398
  });
13399
+ const provider = this.itemProviders[id];
13400
+ if (provider && provider.onClick) {
13401
+ return provider.onClick(menuItem, event, this);
13402
+ }
13316
13403
  if (!menuItem.appFuncId) {
13317
13404
  throw new RuntimeModelError24(menuItem, "\u6CA1\u6709\u914D\u7F6E\u5E94\u7528\u529F\u80FD");
13318
13405
  }
@@ -13363,11 +13450,11 @@ var AppMenuController = class extends ControlController {
13363
13450
  }
13364
13451
  /**
13365
13452
  * 所有项平铺
13366
- * @return {*}
13367
- * @author: zhujiamin
13368
- * @Date: 2022-09-09 16:48:21
13453
+ * @author lxm
13454
+ * @date 2023-12-29 02:42:39
13455
+ * @protected
13369
13456
  */
13370
- getAllItems() {
13457
+ flattenAllItems() {
13371
13458
  const result = [];
13372
13459
  const flattenMenus = (menuItems) => {
13373
13460
  menuItems.forEach((item) => {
@@ -13378,7 +13465,16 @@ var AppMenuController = class extends ControlController {
13378
13465
  });
13379
13466
  };
13380
13467
  flattenMenus(this.model.appMenuItems);
13381
- return result;
13468
+ this.allAppMenuItems = result;
13469
+ }
13470
+ /**
13471
+ * 所有项平铺
13472
+ * @return {*}
13473
+ * @author: zhujiamin
13474
+ * @Date: 2022-09-09 16:48:21
13475
+ */
13476
+ getAllItems() {
13477
+ return this.allAppMenuItems;
13382
13478
  }
13383
13479
  /**
13384
13480
  * 根据id去视图控制器里取得计数器对象
@@ -16279,8 +16375,8 @@ var UIActionUtil = class {
16279
16375
  * @param {IUILogicParams} params 界面行为参数
16280
16376
  * @return {*} {Promise<IUIActionResult>}
16281
16377
  */
16282
- static async exec(actionId, params, appId) {
16283
- const action = await getUIActionById(actionId, appId);
16378
+ static async exec(actionId, params, appId2) {
16379
+ const action = await getUIActionById(actionId, appId2);
16284
16380
  if (!action) {
16285
16381
  throw new RuntimeError45("\u6CA1\u627E\u5230".concat(actionId, "\u7684\u754C\u9762\u884C\u4E3A\u6A21\u578B"));
16286
16382
  }
@@ -16301,9 +16397,9 @@ var UIActionUtil = class {
16301
16397
  * @param {string} actionId 界面行为id
16302
16398
  * @param {IUILogicParams} params 界面行为参数
16303
16399
  */
16304
- static async execAndResolved(actionId, params, appId) {
16400
+ static async execAndResolved(actionId, params, appId2) {
16305
16401
  var _a, _b;
16306
- const result = await this.exec(actionId, params, appId);
16402
+ const result = await this.exec(actionId, params, appId2);
16307
16403
  if (result.closeView) {
16308
16404
  params.view.modal.ignoreDismissCheck = true;
16309
16405
  params.view.closeView({ ok: true });
@@ -16443,10 +16539,10 @@ var UIActionProviderBase = class {
16443
16539
  * @param {(IData | undefined)} [opts]
16444
16540
  * @returns {*} {Promise<void>}
16445
16541
  */
16446
- async doNextAction(action, params, appId) {
16542
+ async doNextAction(action, params, appId2) {
16447
16543
  const nextActionId = action.nextId;
16448
16544
  if (nextActionId) {
16449
- return UIActionUtil.exec(nextActionId, params, appId);
16545
+ return UIActionUtil.exec(nextActionId, params, appId2);
16450
16546
  }
16451
16547
  }
16452
16548
  /**
@@ -22120,7 +22216,7 @@ var GridService = class extends MDControlService {
22120
22216
  if (deField) {
22121
22217
  const deFieldKey = deField.toLowerCase();
22122
22218
  const dataItem = dataItems.find(
22123
- (item) => item.appDEFieldId === deField
22219
+ (item) => item.id === column.dataItemName
22124
22220
  );
22125
22221
  if (dataItem) {
22126
22222
  mapField = new UIMapField(uiKey, deFieldKey, {
@@ -22161,6 +22257,82 @@ var GridService = class extends MDControlService {
22161
22257
  }
22162
22258
  };
22163
22259
 
22260
+ // src/controller/control/grid/grid/entity-schema.ts
22261
+ var TypeToDataType = {
22262
+ string: 25,
22263
+ number: 6,
22264
+ integer: 9,
22265
+ date: 5
22266
+ };
22267
+ async function calcColumnModelBySchema(json, c) {
22268
+ var _a;
22269
+ if (!json.properties) {
22270
+ return;
22271
+ }
22272
+ const { properties } = json;
22273
+ if (!(Object.keys(properties).length > 0)) {
22274
+ return;
22275
+ }
22276
+ const addFields = [];
22277
+ Object.keys(properties).forEach((key) => {
22278
+ let type;
22279
+ switch (properties[key].type) {
22280
+ case "string":
22281
+ type = "string";
22282
+ if (properties[key].format === "date-time") {
22283
+ type = "date";
22284
+ }
22285
+ break;
22286
+ case "integer":
22287
+ type = "integer";
22288
+ break;
22289
+ case "number":
22290
+ type = "number";
22291
+ break;
22292
+ default:
22293
+ ibiz.log.error("\u672A\u652F\u6301\u7684\u7C7B\u578B".concat(properties[key].type));
22294
+ return;
22295
+ }
22296
+ addFields.push({
22297
+ key,
22298
+ description: properties[key].description,
22299
+ type
22300
+ });
22301
+ });
22302
+ const codeNameToId = {};
22303
+ const dataEntity = await ibiz.hub.getAppDataEntity(
22304
+ c.model.appDataEntityId,
22305
+ c.model.appId
22306
+ );
22307
+ (_a = dataEntity.appDEFields) == null ? void 0 : _a.forEach((field) => {
22308
+ codeNameToId[field.codeName.toLowerCase()] = field.id;
22309
+ });
22310
+ const addColumns = [];
22311
+ const addDataItems = [];
22312
+ addFields.forEach((item) => {
22313
+ addColumns.push({
22314
+ appId: c.model.appId,
22315
+ appDEFieldId: codeNameToId[item.key],
22316
+ id: item.key,
22317
+ codeName: item.key,
22318
+ columnType: "DEFGRIDCOLUMN",
22319
+ width: 150,
22320
+ widthUnit: "PX",
22321
+ valueType: "SIMPLE",
22322
+ caption: item.description,
22323
+ dataItemName: item.key
22324
+ });
22325
+ addDataItems.push({
22326
+ appId: c.model.appId,
22327
+ appDEFieldId: codeNameToId[item.key],
22328
+ id: item.key,
22329
+ valueType: "SIMPLE",
22330
+ dataType: TypeToDataType[item.type]
22331
+ });
22332
+ });
22333
+ return { degridColumns: addColumns, degridDataItems: addDataItems };
22334
+ }
22335
+
22164
22336
  // src/controller/control/grid/grid/grid.controller.ts
22165
22337
  var GridController = class extends MDControlController {
22166
22338
  constructor() {
@@ -22179,6 +22351,13 @@ var GridController = class extends MDControlController {
22179
22351
  * @type {boolean}
22180
22352
  */
22181
22353
  this.isMultistageHeader = false;
22354
+ /**
22355
+ * 是否添加jsonschema里定义的表格列
22356
+ * @author lxm
22357
+ * @date 2024-01-02 05:27:16
22358
+ * @type {boolean}
22359
+ */
22360
+ this.addSchemaColumn = false;
22182
22361
  /**
22183
22362
  * 所有表格列控制器集合
22184
22363
  *
@@ -22286,6 +22465,7 @@ var GridController = class extends MDControlController {
22286
22465
  * @returns {*} {Promise<void>}
22287
22466
  */
22288
22467
  async onCreated() {
22468
+ await this.initByEntitySchema();
22289
22469
  await super.onCreated();
22290
22470
  this.service = new GridService(this.model);
22291
22471
  await this.service.init(this.context);
@@ -22300,6 +22480,41 @@ var GridController = class extends MDControlController {
22300
22480
  );
22301
22481
  await this.initGroup();
22302
22482
  }
22483
+ /**
22484
+ * 根据jsonschema初始化自定义表格列
22485
+ * @author lxm
22486
+ * @date 2024-01-02 04:41:23
22487
+ * @return {*} {Promise<void>}
22488
+ */
22489
+ async initByEntitySchema() {
22490
+ if (!this.addSchemaColumn) {
22491
+ return;
22492
+ }
22493
+ const json = await getEntitySchema(
22494
+ this.model.appDataEntityId,
22495
+ this.context
22496
+ );
22497
+ if (!json) {
22498
+ return;
22499
+ }
22500
+ const result = await calcColumnModelBySchema(json, this);
22501
+ if (result && result.degridColumns.length > 0) {
22502
+ const { degridColumns, degridDataItems } = result;
22503
+ this.model = clone22(this.model);
22504
+ this.model.degridColumns = [
22505
+ ...(this.model.degridColumns || []).filter((item) => {
22506
+ return degridColumns.findIndex((x) => x.id === item.id) === -1;
22507
+ }),
22508
+ ...degridColumns
22509
+ ];
22510
+ this.model.degridDataItems = [
22511
+ ...(this.model.degridDataItems || []).filter((item) => {
22512
+ return degridDataItems.findIndex((x) => x.id === item.id) === -1;
22513
+ }),
22514
+ ...degridDataItems
22515
+ ];
22516
+ }
22517
+ }
22303
22518
  /**
22304
22519
  * 初始化表格分组
22305
22520
  * @author lxm
@@ -23354,7 +23569,7 @@ var GridFieldColumnController = class extends GridColumnController {
23354
23569
  */
23355
23570
  calcFieldAgg(items) {
23356
23571
  const { aggField, aggMode, aggValueFormat, unitName } = this.model;
23357
- if (aggMode === "NONE") {
23572
+ if (isNil22(aggMode) || aggMode === "NONE") {
23358
23573
  return;
23359
23574
  }
23360
23575
  const fieldName = aggField || this.model.id;
@@ -24684,10 +24899,21 @@ import { isNil as isNil23 } from "ramda";
24684
24899
 
24685
24900
  // src/controller/control/search-bar/search-bar-filter.controller.ts
24686
24901
  import { RuntimeModelError as RuntimeModelError60 } from "@ibiz-template/core";
24902
+ var ExcludeOPs = [
24903
+ "ISNULL" /* IS_NULL */,
24904
+ "ISNOTNULL" /* IS_NOT_NULL */
24905
+ ];
24687
24906
  var SearchBarFilterController = class {
24688
24907
  constructor(model, searchBar) {
24689
24908
  this.model = model;
24690
24909
  this.searchBar = searchBar;
24910
+ /**
24911
+ * 不需要编辑器
24912
+ * @author lxm
24913
+ * @date 2024-01-02 11:08:45
24914
+ * @type {boolean}
24915
+ */
24916
+ this.noEditor = false;
24691
24917
  var _a;
24692
24918
  let field;
24693
24919
  if (model.appDEFieldId) {
@@ -24696,6 +24922,7 @@ var SearchBarFilterController = class {
24696
24922
  this.fieldName = field ? field.codeName.toLowerCase() : model.id;
24697
24923
  this.label = model.caption || (field == null ? void 0 : field.logicName) || model.id;
24698
24924
  this.valueOP = (_a = model.defsearchMode) == null ? void 0 : _a.valueOP;
24925
+ this.noEditor = this.valueOP ? ExcludeOPs.includes(this.valueOP) : !this.model.editor;
24699
24926
  }
24700
24927
  get context() {
24701
24928
  return this.searchBar.context;
@@ -24710,15 +24937,17 @@ var SearchBarFilterController = class {
24710
24937
  * @return {*} {Promise<void>}
24711
24938
  */
24712
24939
  async init() {
24713
- if (!this.model.editor) {
24714
- throw new RuntimeModelError60(this.model, "\u7F3A\u5C11\u7F16\u8F91\u5668\u6A21\u578B");
24715
- }
24716
- this.editorProvider = await getEditorProvider(this.model.editor);
24717
- if (this.editorProvider) {
24718
- this.editor = await this.editorProvider.createController(
24719
- this.model.editor,
24720
- this
24721
- );
24940
+ if (!this.noEditor) {
24941
+ if (!this.model.editor) {
24942
+ throw new RuntimeModelError60(this.model, "\u7F3A\u5C11\u7F16\u8F91\u5668\u6A21\u578B");
24943
+ }
24944
+ this.editorProvider = await getEditorProvider(this.model.editor);
24945
+ if (this.editorProvider) {
24946
+ this.editor = await this.editorProvider.createController(
24947
+ this.model.editor,
24948
+ this
24949
+ );
24950
+ }
24722
24951
  }
24723
24952
  }
24724
24953
  };
@@ -24897,6 +25126,135 @@ var SearchBarService = class {
24897
25126
  }
24898
25127
  };
24899
25128
 
25129
+ // src/controller/control/search-bar/entity-schema.ts
25130
+ var appId = "";
25131
+ var typeToOPs = {
25132
+ string: [
25133
+ "EQ" /* EQ */,
25134
+ "NOTEQ" /* NOT_EQ */,
25135
+ "ISNULL" /* IS_NULL */,
25136
+ "ISNOTNULL" /* IS_NOT_NULL */,
25137
+ "USERLIKE" /* USER_LIKE */,
25138
+ "LIKE" /* LIKE */,
25139
+ "LIFTLIKE" /* LIFT_LIKE */,
25140
+ "RIGHT_LIKE" /* RIGHT_LIKE */
25141
+ ],
25142
+ number: [
25143
+ "EQ" /* EQ */,
25144
+ "GT" /* GT */,
25145
+ "GTANDEQ" /* GT_AND_EQ */,
25146
+ "LT" /* LT */,
25147
+ "LTANDEQ" /* LT_AND_EQ */,
25148
+ "NOTEQ" /* NOT_EQ */,
25149
+ "ISNULL" /* IS_NULL */,
25150
+ "ISNOTNULL" /* IS_NOT_NULL */,
25151
+ "IN" /* IN */,
25152
+ "NOTIN" /* NOT_IN */
25153
+ ],
25154
+ date: [
25155
+ "EQ" /* EQ */,
25156
+ "GT" /* GT */,
25157
+ "GTANDEQ" /* GT_AND_EQ */,
25158
+ "LT" /* LT */,
25159
+ "LTANDEQ" /* LT_AND_EQ */,
25160
+ "NOTEQ" /* NOT_EQ */,
25161
+ "ISNULL" /* IS_NULL */,
25162
+ "ISNOTNULL" /* IS_NOT_NULL */,
25163
+ "IN" /* IN */,
25164
+ "NOTIN" /* NOT_IN */
25165
+ ]
25166
+ };
25167
+ var EditorsMap = {};
25168
+ function initDefaultEditor() {
25169
+ Object.keys(typeToOPs).forEach((type) => {
25170
+ const allowOPs = typeToOPs[type];
25171
+ allowOPs.forEach((op) => {
25172
+ if (ExcludeOPs.includes(op)) {
25173
+ return;
25174
+ }
25175
+ const key = "".concat(type, "_").concat(op);
25176
+ if (EditorsMap[key]) {
25177
+ return;
25178
+ }
25179
+ if (type === "date" && !["IN" /* IN */, "NOTIN" /* NOT_IN */].includes(op)) {
25180
+ EditorsMap[key] = {
25181
+ appId,
25182
+ editorType: "DATEPICKER",
25183
+ id: key
25184
+ };
25185
+ } else {
25186
+ EditorsMap[key] = {
25187
+ appId,
25188
+ editorType: "TEXTBOX",
25189
+ id: key
25190
+ };
25191
+ }
25192
+ });
25193
+ });
25194
+ }
25195
+ initDefaultEditor();
25196
+ function calcFilterModelBySchema(json, c) {
25197
+ var _a;
25198
+ if (!json.properties) {
25199
+ return [];
25200
+ }
25201
+ const { properties } = json;
25202
+ if (!(Object.keys(properties).length > 0)) {
25203
+ return [];
25204
+ }
25205
+ const addFields = [];
25206
+ Object.keys(properties).forEach((key) => {
25207
+ let type;
25208
+ switch (properties[key].type) {
25209
+ case "string":
25210
+ type = "string";
25211
+ if (properties[key].format === "date-time") {
25212
+ type = "date";
25213
+ }
25214
+ break;
25215
+ case "integer":
25216
+ case "number":
25217
+ type = "number";
25218
+ break;
25219
+ default:
25220
+ ibiz.log.error("\u672A\u652F\u6301\u7684\u7C7B\u578B".concat(properties[key].type));
25221
+ return;
25222
+ }
25223
+ addFields.push({
25224
+ key,
25225
+ description: properties[key].description,
25226
+ type
25227
+ });
25228
+ });
25229
+ const codeNameToId = {};
25230
+ (_a = c.appDataEntity.appDEFields) == null ? void 0 : _a.forEach((field) => {
25231
+ codeNameToId[field.codeName.toLowerCase()] = field.id;
25232
+ });
25233
+ const addSearchBarFilters = [];
25234
+ addFields.forEach((item) => {
25235
+ const ops = typeToOPs[item.type];
25236
+ if (!ops) {
25237
+ ibiz.log.error("\u672A\u652F\u6301\u7684\u7C7B\u578B", item.type);
25238
+ return;
25239
+ }
25240
+ ops.forEach((op) => {
25241
+ const editorModel = EditorsMap["".concat(item.type, "_").concat(op)];
25242
+ addSearchBarFilters.push({
25243
+ appId,
25244
+ appDEFieldId: codeNameToId[item.key],
25245
+ id: item.key,
25246
+ caption: item.description,
25247
+ defsearchMode: {
25248
+ appId,
25249
+ valueOP: op
25250
+ },
25251
+ editor: editorModel
25252
+ });
25253
+ });
25254
+ });
25255
+ return addSearchBarFilters;
25256
+ }
25257
+
24900
25258
  // src/controller/control/search-bar/search-bar.controller.ts
24901
25259
  var SearchBarController = class extends ControlController {
24902
25260
  constructor() {
@@ -24929,6 +25287,13 @@ var SearchBarController = class extends ControlController {
24929
25287
  * @Date: 2023-12-21 10:17:43
24930
25288
  */
24931
25289
  this.isBackendSearchGroup = this.model.searchBarStyle === "SEARCHBAR2";
25290
+ /**
25291
+ * 启用自定义过滤项
25292
+ * @author lxm
25293
+ * @date 2023-12-29 04:15:34
25294
+ * @type {boolean}
25295
+ */
25296
+ this.enableFilter = this.model.enableFilter === true;
24932
25297
  }
24933
25298
  /**
24934
25299
  * 表格控制器
@@ -24943,12 +25308,19 @@ var SearchBarController = class extends ControlController {
24943
25308
  super.initState();
24944
25309
  this.state.query = "";
24945
25310
  this.state.selectedGroupItem = null;
24946
- this.state.visible = !!(this.model.enableQuickSearch || this.model.enableGroup || this.model.enableFilter);
24947
- if (this.model.enableFilter) {
24948
- this.resetFilter();
24949
- }
24950
25311
  this.state.searchBarGroups = [];
24951
25312
  this.state.selectedSearchGroupItem = null;
25313
+ this.initFilterState();
25314
+ }
25315
+ /**
25316
+ * 初始化Filter相关的属性
25317
+ * @author lxm
25318
+ * @date 2023-12-29 04:18:02
25319
+ * @protected
25320
+ */
25321
+ initFilterState() {
25322
+ this.resetFilter();
25323
+ this.state.visible = !!(this.model.enableQuickSearch || this.model.enableGroup || this.enableFilter);
24952
25324
  }
24953
25325
  async onCreated() {
24954
25326
  await super.onCreated();
@@ -24964,9 +25336,39 @@ var SearchBarController = class extends ControlController {
24964
25336
  this.service = new SearchBarService(this.model, this.view.model.codeName);
24965
25337
  await this.service.init(this.context);
24966
25338
  }
25339
+ await this.initByEntitySchema();
24967
25340
  await this.initSearchBarFilters();
24968
25341
  await this.initSearBarGroups();
24969
25342
  }
25343
+ /**
25344
+ * 根据实体jsonschema初始化
25345
+ * @author lxm
25346
+ * @date 2023-12-29 04:21:31
25347
+ * @return {*} {Promise<void>}
25348
+ */
25349
+ async initByEntitySchema() {
25350
+ var _a;
25351
+ this.enableFilter = true;
25352
+ const json = await getEntitySchema(this.appDataEntity.id, this.context);
25353
+ if (!json) {
25354
+ return;
25355
+ }
25356
+ const addSearchBarFilters = calcFilterModelBySchema(json, this);
25357
+ const mergeFilters = [];
25358
+ (_a = this.model.searchBarFilters) == null ? void 0 : _a.forEach((filter) => {
25359
+ const findindex = addSearchBarFilters.findIndex(
25360
+ (item) => {
25361
+ var _a2;
25362
+ return item.appDEFieldId === filter.appDEFieldId && (((_a2 = filter.defsearchMode) == null ? void 0 : _a2.valueOP) ? item.defsearchMode.valueOP === filter.defsearchMode.valueOP : true);
25363
+ }
25364
+ );
25365
+ if (findindex === -1) {
25366
+ mergeFilters.push(filter);
25367
+ }
25368
+ });
25369
+ addSearchBarFilters.push(...mergeFilters);
25370
+ this.searchBarFilters = addSearchBarFilters;
25371
+ }
24970
25372
  /**
24971
25373
  * 计算快速搜索的占位
24972
25374
  * @author lxm
@@ -25062,8 +25464,8 @@ var SearchBarController = class extends ControlController {
25062
25464
  */
25063
25465
  async initSearchBarFilters() {
25064
25466
  var _a;
25065
- if ((_a = this.model.searchBarFilters) == null ? void 0 : _a.length) {
25066
- this.model.searchBarFilters.forEach((item) => {
25467
+ if ((_a = this.searchBarFilters) == null ? void 0 : _a.length) {
25468
+ this.searchBarFilters.forEach((item) => {
25067
25469
  const filterController = new SearchBarFilterController(item, this);
25068
25470
  this.filterControllers.push(filterController);
25069
25471
  });
@@ -26190,7 +26592,7 @@ var TreeController = class extends MDControlController {
26190
26592
  * @param {string} appId
26191
26593
  * @return {*} {Promise<void>}
26192
26594
  */
26193
- async doUIAction(uiActionId, nodeData, event, appId) {
26595
+ async doUIAction(uiActionId, nodeData, event, appId2) {
26194
26596
  const eventArgs = this.getEventArgs();
26195
26597
  const nodeParams = this.parseTreeNodeData(nodeData);
26196
26598
  const result = await UIActionUtil.exec(
@@ -26200,7 +26602,7 @@ var TreeController = class extends MDControlController {
26200
26602
  ...nodeParams,
26201
26603
  event
26202
26604
  },
26203
- appId
26605
+ appId2
26204
26606
  );
26205
26607
  if (result.closeView) {
26206
26608
  this.view.closeView();
@@ -27767,12 +28169,13 @@ var TreeGridExController = class extends TreeController {
27767
28169
  initState() {
27768
28170
  super.initState();
27769
28171
  this.state.columnStates = [];
28172
+ this.state.rootNodes = [];
27770
28173
  this.state.rows = {};
27771
28174
  }
27772
28175
  async onCreated() {
27773
28176
  await super.onCreated();
27774
- this.initColumnStates();
27775
28177
  await this.initGridColumns();
28178
+ this.initColumnStates();
27776
28179
  }
27777
28180
  async initService() {
27778
28181
  this.service = new TreeGridExService(this.model);
@@ -29041,7 +29444,6 @@ var GanttController = class extends TreeGridExController {
29041
29444
  */
29042
29445
  initState() {
29043
29446
  super.initState();
29044
- this.state.rootNodes = [];
29045
29447
  this.state.ganttStyle = {};
29046
29448
  }
29047
29449
  /**
@@ -29114,9 +29516,9 @@ var GanttController = class extends TreeGridExController {
29114
29516
  if (nodeModel) {
29115
29517
  const newData = isTransformData ? this.transformNodeDataItem(nodeModel, data) : data;
29116
29518
  if (Object.keys(newData).length > 0) {
29117
- const [, entityCodename] = nodeModel.appDataEntityId.split(".");
29519
+ const deName = calcDeCodeNameById(nodeModel.appDataEntityId);
29118
29520
  const tempContext = Object.assign(this.context.clone(), {
29119
- [entityCodename]: currentNode.srfkey
29521
+ [deName]: currentNode.srfkey
29120
29522
  });
29121
29523
  const response = await this.service.execDeService(
29122
29524
  nodeModel.appDataEntityId,
@@ -29269,11 +29671,11 @@ var AppHub = class {
29269
29671
  * @param {IAppDataEntity} model
29270
29672
  * @param {string} [appId=ibiz.env.appId]
29271
29673
  */
29272
- registerAppDataEntity(model, appId = ibiz.env.appId) {
29273
- if (!this.dataEntities.has(appId)) {
29274
- this.dataEntities.set(appId, /* @__PURE__ */ new Map());
29674
+ registerAppDataEntity(model, appId2 = ibiz.env.appId) {
29675
+ if (!this.dataEntities.has(appId2)) {
29676
+ this.dataEntities.set(appId2, /* @__PURE__ */ new Map());
29275
29677
  }
29276
- const map = this.dataEntities.get(appId);
29678
+ const map = this.dataEntities.get(appId2);
29277
29679
  map.set(model.id, model);
29278
29680
  }
29279
29681
  /**
@@ -29284,9 +29686,9 @@ var AppHub = class {
29284
29686
  * @param {string} tag 视图 codeName 或者视图 id
29285
29687
  * @param {string} [appId=ibiz.env.appId]
29286
29688
  */
29287
- setAppView(tag, appId = ibiz.env.appId) {
29689
+ setAppView(tag, appId2 = ibiz.env.appId) {
29288
29690
  const id = this.calcAppViewId(tag);
29289
- this.view2appMap.set(id, appId);
29691
+ this.view2appMap.set(id, appId2);
29290
29692
  }
29291
29693
  /**
29292
29694
  * 判断应用视图是否存在
@@ -29308,9 +29710,9 @@ var AppHub = class {
29308
29710
  * @param {string} appId
29309
29711
  * @return {*} {(Promise<string | null>)}
29310
29712
  */
29311
- async getAppStyle(appId) {
29713
+ async getAppStyle(appId2) {
29312
29714
  if (this.modelLoaderProvider) {
29313
- return this.modelLoaderProvider.getAppStyle(appId);
29715
+ return this.modelLoaderProvider.getAppStyle(appId2);
29314
29716
  }
29315
29717
  return null;
29316
29718
  }
@@ -29324,15 +29726,15 @@ var AppHub = class {
29324
29726
  */
29325
29727
  async getAppView(tag) {
29326
29728
  const id = this.calcAppViewId(tag);
29327
- const appId = this.view2appMap.get(id) || ibiz.env.appId;
29328
- if (!this.appMap.has(appId)) {
29329
- await this.createApp(appId);
29729
+ const appId2 = this.view2appMap.get(id) || ibiz.env.appId;
29730
+ if (!this.appMap.has(appId2)) {
29731
+ await this.createApp(appId2);
29330
29732
  }
29331
29733
  if (this.views.has(id)) {
29332
29734
  return this.views.get(id);
29333
29735
  }
29334
29736
  if (this.modelLoaderProvider) {
29335
- const appView = await this.modelLoaderProvider.getAppView(appId, id);
29737
+ const appView = await this.modelLoaderProvider.getAppView(appId2, id);
29336
29738
  this.registerAppView(appView);
29337
29739
  return appView;
29338
29740
  }
@@ -29347,9 +29749,9 @@ var AppHub = class {
29347
29749
  * @param {string} [appId=ibiz.env.appId]
29348
29750
  * @return {*} {Promise<IAppDataEntity>}
29349
29751
  */
29350
- async getAppDataEntity(id, appId = ibiz.env.appId) {
29351
- if (this.dataEntities.has(appId)) {
29352
- const map = this.dataEntities.get(appId);
29752
+ async getAppDataEntity(id, appId2 = ibiz.env.appId) {
29753
+ if (this.dataEntities.has(appId2)) {
29754
+ const map = this.dataEntities.get(appId2);
29353
29755
  if (map.has(id)) {
29354
29756
  return map.get(id);
29355
29757
  }
@@ -29357,14 +29759,14 @@ var AppHub = class {
29357
29759
  if (this.modelLoaderProvider) {
29358
29760
  let entity;
29359
29761
  if (id.indexOf(".") !== -1) {
29360
- entity = await this.modelLoaderProvider.getAppDataEntity(appId, id);
29762
+ entity = await this.modelLoaderProvider.getAppDataEntity(appId2, id);
29361
29763
  } else {
29362
29764
  entity = await this.modelLoaderProvider.getAppDataEntityByCodeName(
29363
- appId,
29765
+ appId2,
29364
29766
  id
29365
29767
  );
29366
29768
  }
29367
- this.registerAppDataEntity(entity, appId);
29769
+ this.registerAppDataEntity(entity, appId2);
29368
29770
  return entity;
29369
29771
  }
29370
29772
  throw new RuntimeError61("\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[".concat(id, "]"));
@@ -31258,6 +31660,7 @@ var RemotePluginItem = class {
31258
31660
  }
31259
31661
  };
31260
31662
  export {
31663
+ APPMENUITEM_PROVIDER_PREFIX,
31261
31664
  APP_COUNTER_PROVIDER_PREFIX,
31262
31665
  ASYNC_ACTION_PROVIDER_PREFIX,
31263
31666
  AcFetchMethod,
@@ -31509,6 +31912,7 @@ export {
31509
31912
  generateRules,
31510
31913
  getAllPanelField,
31511
31914
  getAppCounterProvider,
31915
+ getAppMenuItemProvider,
31512
31916
  getAppViewRef,
31513
31917
  getAsyncActionProvider,
31514
31918
  getChildNodeRSs,
@@ -31521,6 +31925,7 @@ export {
31521
31925
  getDeACMode,
31522
31926
  getDefaultValue,
31523
31927
  getEditorProvider,
31928
+ getEntitySchema,
31524
31929
  getFormDetailProvider,
31525
31930
  getGridColumnProvider,
31526
31931
  getMatchResPath,
@@ -31558,6 +31963,7 @@ export {
31558
31963
  presetDEMethodProvider,
31559
31964
  presetUIActionProvider,
31560
31965
  registerAppCounterProvider,
31966
+ registerAppMenuItemProvider,
31561
31967
  registerAsyncActionProvider,
31562
31968
  registerControlProvider,
31563
31969
  registerDEMethodProvider,