@ibiz-template/runtime 0.7.6 → 0.7.7

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 (30) hide show
  1. package/dist/index.esm.js +117 -21
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +29 -1
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/app-hub.js +46 -1
  6. package/out/controller/common/view/view.controller.d.ts +11 -0
  7. package/out/controller/common/view/view.controller.d.ts.map +1 -1
  8. package/out/controller/common/view/view.controller.js +25 -1
  9. package/out/controller/control/dashboard/custom-dashboard.controller.d.ts.map +1 -1
  10. package/out/controller/control/dashboard/custom-dashboard.controller.js +1 -2
  11. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts +1 -2
  12. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts.map +1 -1
  13. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.js +4 -3
  14. package/out/engine/md-view.engine.d.ts.map +1 -1
  15. package/out/engine/md-view.engine.js +4 -1
  16. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +19 -0
  17. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  18. package/out/interface/controller/controller/view/i-view.controller.d.ts +8 -0
  19. package/out/interface/controller/controller/view/i-view.controller.d.ts.map +1 -1
  20. package/out/interface/controller/state/view/i-view.state.d.ts +8 -0
  21. package/out/interface/controller/state/view/i-view.state.d.ts.map +1 -1
  22. package/out/service/de-service-util.d.ts.map +1 -1
  23. package/out/service/de-service-util.js +11 -2
  24. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
  25. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +8 -6
  26. package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
  27. package/out/service/vo/tree-node-data/tree-node-data.js +7 -1
  28. package/out/utils/error-handler/default-error-handler.d.ts.map +1 -1
  29. package/out/utils/error-handler/default-error-handler.js +3 -0
  30. package/package.json +4 -4
package/dist/index.esm.js CHANGED
@@ -97,6 +97,8 @@ var DefaultErrorHandler = class {
97
97
  } else if (error instanceof HttpError) {
98
98
  if (error.status === 401) {
99
99
  ibiz.message.error("\u6CA1\u6709\u6CE8\u518C\u65E0\u6743\u9650\u9519\u8BEF\u5904\u7406\u5668");
100
+ } else if (error.status === 404) {
101
+ ibiz.mc.error.send(error);
100
102
  } else {
101
103
  ibiz.notification.error({
102
104
  title: "",
@@ -6693,10 +6695,12 @@ var DynamicCodeListCache = class {
6693
6695
  */
6694
6696
  this.commonKeys = ["query", "queryconds"];
6695
6697
  this.codeList = codeList;
6696
- this.codelistChange = this.codelistChange.bind(this);
6697
- const { appDataEntityId, appDEDataSetId } = this.codeList;
6698
- if (appDataEntityId && appDEDataSetId) {
6699
- ibiz.mc.command.change.on(this.codelistChange);
6698
+ if (this.codeList.enableCache) {
6699
+ this.codelistChange = this.codelistChange.bind(this);
6700
+ const { appDataEntityId, appDEDataSetId } = this.codeList;
6701
+ if (appDataEntityId && appDEDataSetId) {
6702
+ ibiz.mc.command.change.on(this.codelistChange);
6703
+ }
6700
6704
  }
6701
6705
  }
6702
6706
  /**
@@ -6710,7 +6714,7 @@ var DynamicCodeListCache = class {
6710
6714
  */
6711
6715
  setParams(context, params) {
6712
6716
  if (context) {
6713
- this.context = clone4(context);
6717
+ this.context = IBizContext2.create({}, { ...context });
6714
6718
  }
6715
6719
  if (params) {
6716
6720
  this.params = clone4(params);
@@ -7036,7 +7040,7 @@ var DynamicCodeListCache = class {
7036
7040
  */
7037
7041
  destroy() {
7038
7042
  const { appDataEntityId, appDEDataSetId } = this.codeList;
7039
- if (appDataEntityId && appDEDataSetId) {
7043
+ if (appDataEntityId && appDEDataSetId && this.codeList.enableCache) {
7040
7044
  ibiz.mc.command.change.off(this.codelistChange);
7041
7045
  }
7042
7046
  }
@@ -12589,6 +12593,7 @@ var UtilService = class {
12589
12593
 
12590
12594
  // src/service/vo/tree-node-data/tree-node-data.ts
12591
12595
  import { createUUID as createUUID5 } from "qx-util";
12596
+ import { isBase64Image } from "@ibiz-template/core";
12592
12597
  var TreeNodeData = class {
12593
12598
  constructor(model, parentNodeData, opts) {
12594
12599
  this._uuid = createUUID5();
@@ -12635,7 +12640,11 @@ var TreeNodeData = class {
12635
12640
  icon.imagePath = sysImage.imagePath;
12636
12641
  }
12637
12642
  if (sysImage.rawContent) {
12638
- icon.htmlStr = sysImage.rawContent;
12643
+ if (isBase64Image(sysImage.rawContent)) {
12644
+ icon.imagePath = sysImage.rawContent;
12645
+ } else {
12646
+ icon.htmlStr = sysImage.rawContent;
12647
+ }
12639
12648
  }
12640
12649
  }
12641
12650
  return Object.values(icon).length > 0 ? icon : void 0;
@@ -13482,7 +13491,7 @@ var MqttService = class {
13482
13491
  };
13483
13492
 
13484
13493
  // src/service/de-service-util.ts
13485
- import { RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13494
+ import { HttpError as HttpError6, RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13486
13495
  var _DEServiceUtil = class _DEServiceUtil {
13487
13496
  /**
13488
13497
  * Creates an instance of DEServiceUtil.
@@ -13634,7 +13643,21 @@ var _DEServiceUtil = class _DEServiceUtil {
13634
13643
  */
13635
13644
  async exec(appDataEntityId, methodName, context, params, params2, header) {
13636
13645
  const service = await this.getService(context, appDataEntityId);
13637
- return service.exec(methodName, context, params, params2, header);
13646
+ try {
13647
+ const result = await service.exec(
13648
+ methodName,
13649
+ context,
13650
+ params,
13651
+ params2,
13652
+ header
13653
+ );
13654
+ return result;
13655
+ } catch (error) {
13656
+ if (error instanceof HttpError6) {
13657
+ error.tag = context.srfviewid;
13658
+ }
13659
+ throw error;
13660
+ }
13638
13661
  }
13639
13662
  };
13640
13663
  /**
@@ -14322,7 +14345,11 @@ var TreeGridExNotifyState = /* @__PURE__ */ ((TreeGridExNotifyState2) => {
14322
14345
 
14323
14346
  // src/controller/common/view/view.controller.ts
14324
14347
  import { notNilEmpty as notNilEmpty7 } from "qx-util";
14325
- import { IBizContext as IBizContext3, RuntimeError as RuntimeError34 } from "@ibiz-template/core";
14348
+ import {
14349
+ HttpError as HttpError7,
14350
+ IBizContext as IBizContext3,
14351
+ RuntimeError as RuntimeError34
14352
+ } from "@ibiz-template/core";
14326
14353
  import { isEmpty as isEmpty9, isNil as isNil22, isNotNil as isNotNil2 } from "ramda";
14327
14354
 
14328
14355
  // src/controller/utils/loading/loading.state.ts
@@ -16014,6 +16041,7 @@ var ViewController = class extends BaseController {
16014
16041
  this.modal = new Modal({});
16015
16042
  this.providers = {};
16016
16043
  this.engines = [];
16044
+ this.error = {};
16017
16045
  this.slotProps = {};
16018
16046
  this.counters = {};
16019
16047
  /**
@@ -16037,6 +16065,7 @@ var ViewController = class extends BaseController {
16037
16065
  }
16038
16066
  this.ctx.init(this);
16039
16067
  this.initEngines();
16068
+ this.handleViewError = this.handleViewError.bind(this);
16040
16069
  }
16041
16070
  get _evt() {
16042
16071
  return this.evt;
@@ -16148,6 +16177,7 @@ var ViewController = class extends BaseController {
16148
16177
  this.state.srfactiveviewdata = null;
16149
16178
  this.state.viewMessages = {};
16150
16179
  this.state.isClosing = false;
16180
+ this.state.hasError = false;
16151
16181
  }
16152
16182
  async onCreated() {
16153
16183
  await super.onCreated();
@@ -16192,6 +16222,7 @@ var ViewController = class extends BaseController {
16192
16222
  if (this.engines.length) {
16193
16223
  await Promise.all(this.engines.map((engine2) => engine2.onCreated()));
16194
16224
  }
16225
+ ibiz.mc.error.on(this.handleViewError);
16195
16226
  }
16196
16227
  async onMounted() {
16197
16228
  var _a;
@@ -16218,6 +16249,7 @@ var ViewController = class extends BaseController {
16218
16249
  }
16219
16250
  this.context.destroy();
16220
16251
  ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name, "](").concat(this.model.id, ")\u9500\u6BC1"));
16252
+ ibiz.mc.error.off(this.handleViewError);
16221
16253
  }
16222
16254
  /**
16223
16255
  * 处理上下文和导航参数相关的,如自定义导航参数的处理
@@ -16232,6 +16264,7 @@ var ViewController = class extends BaseController {
16232
16264
  const domain = ibiz.uiDomainManager.create(this.id);
16233
16265
  this.context.srfsessionid = domain.id;
16234
16266
  }
16267
+ this.context.srfviewid = this.id;
16235
16268
  const navContexts = this.model.appViewNavContexts;
16236
16269
  let context = {};
16237
16270
  if (notNilEmpty7(navContexts)) {
@@ -16388,6 +16421,21 @@ var ViewController = class extends BaseController {
16388
16421
  );
16389
16422
  }
16390
16423
  }
16424
+ /**
16425
+ * 处理视图错误
16426
+ *
16427
+ * @author tony001
16428
+ * @date 2024-04-28 12:04:27
16429
+ * @protected
16430
+ * @param {IPortalMessage} msg
16431
+ */
16432
+ handleViewError(msg) {
16433
+ const { type, data } = msg;
16434
+ if (type === "ERROR" && data instanceof HttpError7 && data.tag === this.id) {
16435
+ this.error = data;
16436
+ this.state.hasError = true;
16437
+ }
16438
+ }
16391
16439
  };
16392
16440
 
16393
16441
  // src/controller/common/view/app-data-upload-view.controller.ts
@@ -16708,7 +16756,7 @@ var CodeListEditorController = class extends EditorController {
16708
16756
 
16709
16757
  // src/controller/common/control/control.controller.ts
16710
16758
  import {
16711
- HttpError as HttpError6,
16759
+ HttpError as HttpError8,
16712
16760
  IBizContext as IBizContext4,
16713
16761
  IBizParams,
16714
16762
  NoticeError as NoticeError2,
@@ -17075,7 +17123,7 @@ var ControlController = class extends BaseController {
17075
17123
  return;
17076
17124
  }
17077
17125
  if (opts == null ? void 0 : opts.error) {
17078
- if (opts.error instanceof HttpError6 && opts.error.status !== 500) {
17126
+ if (opts.error instanceof HttpError8 && opts.error.status !== 500) {
17079
17127
  throw opts.error;
17080
17128
  }
17081
17129
  ibiz.log.error(opts.error);
@@ -22250,7 +22298,6 @@ var DashboardController = class extends ControlController {
22250
22298
  };
22251
22299
 
22252
22300
  // src/controller/control/dashboard/custom-dashboard.controller.ts
22253
- import { merge } from "lodash-es";
22254
22301
  var CustomDashboardController = class {
22255
22302
  /**
22256
22303
  * Creates an instance of BaseController.
@@ -22407,7 +22454,7 @@ var CustomDashboardController = class {
22407
22454
  * @Date: 2023-09-20 16:22:49
22408
22455
  */
22409
22456
  async saveCustomModelData(model, config = {}) {
22410
- merge(this.portletConfig, config);
22457
+ Object.assign(this.portletConfig, config);
22411
22458
  let res;
22412
22459
  const data = {
22413
22460
  model,
@@ -22439,7 +22486,7 @@ var CustomDashboardController = class {
22439
22486
  };
22440
22487
 
22441
22488
  // src/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.ts
22442
- import { merge as merge2 } from "lodash-es";
22489
+ import { merge } from "lodash-es";
22443
22490
  import { IBizContext as IBizContext5, IBizParams as IBizParams2 } from "@ibiz-template/core";
22444
22491
 
22445
22492
  // src/controller/control/dashboard/portlet/portlet-part/portlet-part.state.ts
@@ -22581,10 +22628,11 @@ var PortletPartController = class {
22581
22628
  * @memberof PortletPartController
22582
22629
  */
22583
22630
  async setConfig(config) {
22584
- merge2(this.config, config);
22585
- this.state.title = this.config.srftitle;
22586
- delete config.srftitle;
22587
- merge2(this.params, config);
22631
+ this.config = config;
22632
+ if (config.srftitle) {
22633
+ this.state.title = config.srftitle;
22634
+ }
22635
+ merge(this.params, config);
22588
22636
  this.dashboard.evt.emit("onConfigChange", {
22589
22637
  name: this.model.id,
22590
22638
  config: this.config
@@ -37682,6 +37730,15 @@ var AppHub = class {
37682
37730
  * @type {Map<string, IAppView>}
37683
37731
  */
37684
37732
  this.views = /* @__PURE__ */ new Map();
37733
+ /**
37734
+ * 子应用dr部件模型
37735
+ *
37736
+ * @author tony001
37737
+ * @date 2024-04-29 15:04:24
37738
+ * @protected
37739
+ * @type {Map<string, IModel[]>}
37740
+ */
37741
+ this.drcontrols = /* @__PURE__ */ new Map();
37685
37742
  /**
37686
37743
  * 应用实体实例模型
37687
37744
  *
@@ -37746,6 +37803,21 @@ var AppHub = class {
37746
37803
  registerAppView(model) {
37747
37804
  this.views.set(model.codeName.toLowerCase(), model);
37748
37805
  }
37806
+ /**
37807
+ * 注册子应用dedrcontrols模型
37808
+ *
37809
+ * @author tony001
37810
+ * @date 2024-04-29 15:04:36
37811
+ * @param {string} appId
37812
+ * @param {IModel} model
37813
+ */
37814
+ registerSubAppDrControls(appId2, model) {
37815
+ if (!this.drcontrols.has(appId2)) {
37816
+ this.drcontrols.set(appId2, []);
37817
+ }
37818
+ const targetAppDrControls = this.drcontrols.get(appId2);
37819
+ targetAppDrControls == null ? void 0 : targetAppDrControls.push(model);
37820
+ }
37749
37821
  /**
37750
37822
  * 注册应用实体
37751
37823
  *
@@ -37768,9 +37840,12 @@ var AppHub = class {
37768
37840
  * @date 2024-01-15 15:01:41
37769
37841
  * @param {string} tag 视图 codeName 或者视图 id
37770
37842
  * @param {string} [appId=ibiz.env.appId]
37771
- * @param {number} [priority=-1] 视图的优先级,值越小优先级越高。1为最高优先级
37843
+ * @param {number} [priority=-1] 视图的优先级,值越小优先级越高。10为最高优先级
37772
37844
  */
37773
37845
  setAppView(tag, appId2 = ibiz.env.appId, priority = -1) {
37846
+ if (priority <= 0) {
37847
+ priority = 50;
37848
+ }
37774
37849
  const id = this.calcAppViewId(tag);
37775
37850
  if (this.view2appMap.has(id)) {
37776
37851
  const _priority = this.view2appPriorityMap.get(id);
@@ -37833,6 +37908,24 @@ var AppHub = class {
37833
37908
  }
37834
37909
  throw new RuntimeError67("\u89C6\u56FE[".concat(id, "]\u4E0D\u5B58\u5728"));
37835
37910
  }
37911
+ /**
37912
+ * 根据DrControl的名称和子应用标识获取模型
37913
+ *
37914
+ * @author tony001
37915
+ * @date 2024-04-29 15:04:25
37916
+ * @param {string} tag
37917
+ * @param {string} appId
37918
+ * @return {*} {Promise<IModel | undefined>}
37919
+ */
37920
+ getSubAppDrControl(tag, appId2) {
37921
+ if (!this.drcontrols.has(appId2)) {
37922
+ return void 0;
37923
+ }
37924
+ const targetAppDrControls = this.drcontrols.get(appId2);
37925
+ return targetAppDrControls.find((item) => {
37926
+ return item.uniqueTag === tag;
37927
+ });
37928
+ }
37836
37929
  /**
37837
37930
  * 根据视图模型路径,加参数重新计算视图模型
37838
37931
  *
@@ -38507,7 +38600,10 @@ var MDViewEngine = class extends ViewEngineBase {
38507
38600
  * @return {*} {Promise<void>}
38508
38601
  */
38509
38602
  async onXDataActive(event) {
38510
- await this.openData(event);
38603
+ const res = await this.openData(event);
38604
+ if (!res.cancel) {
38605
+ this.refresh();
38606
+ }
38511
38607
  }
38512
38608
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
38513
38609
  async call(key, args) {