@ibiz-template/runtime 0.7.6 → 0.7.7-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -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: "",
@@ -12589,6 +12591,7 @@ var UtilService = class {
12589
12591
 
12590
12592
  // src/service/vo/tree-node-data/tree-node-data.ts
12591
12593
  import { createUUID as createUUID5 } from "qx-util";
12594
+ import { isBase64Image } from "@ibiz-template/core";
12592
12595
  var TreeNodeData = class {
12593
12596
  constructor(model, parentNodeData, opts) {
12594
12597
  this._uuid = createUUID5();
@@ -12635,7 +12638,11 @@ var TreeNodeData = class {
12635
12638
  icon.imagePath = sysImage.imagePath;
12636
12639
  }
12637
12640
  if (sysImage.rawContent) {
12638
- icon.htmlStr = sysImage.rawContent;
12641
+ if (isBase64Image(sysImage.rawContent)) {
12642
+ icon.imagePath = sysImage.rawContent;
12643
+ } else {
12644
+ icon.htmlStr = sysImage.rawContent;
12645
+ }
12639
12646
  }
12640
12647
  }
12641
12648
  return Object.values(icon).length > 0 ? icon : void 0;
@@ -13482,7 +13489,7 @@ var MqttService = class {
13482
13489
  };
13483
13490
 
13484
13491
  // src/service/de-service-util.ts
13485
- import { RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13492
+ import { HttpError as HttpError6, RuntimeError as RuntimeError24 } from "@ibiz-template/core";
13486
13493
  var _DEServiceUtil = class _DEServiceUtil {
13487
13494
  /**
13488
13495
  * Creates an instance of DEServiceUtil.
@@ -13634,7 +13641,21 @@ var _DEServiceUtil = class _DEServiceUtil {
13634
13641
  */
13635
13642
  async exec(appDataEntityId, methodName, context, params, params2, header) {
13636
13643
  const service = await this.getService(context, appDataEntityId);
13637
- return service.exec(methodName, context, params, params2, header);
13644
+ try {
13645
+ const result = await service.exec(
13646
+ methodName,
13647
+ context,
13648
+ params,
13649
+ params2,
13650
+ header
13651
+ );
13652
+ return result;
13653
+ } catch (error) {
13654
+ if (error instanceof HttpError6) {
13655
+ error.tag = context.srfviewid;
13656
+ }
13657
+ throw error;
13658
+ }
13638
13659
  }
13639
13660
  };
13640
13661
  /**
@@ -14322,7 +14343,11 @@ var TreeGridExNotifyState = /* @__PURE__ */ ((TreeGridExNotifyState2) => {
14322
14343
 
14323
14344
  // src/controller/common/view/view.controller.ts
14324
14345
  import { notNilEmpty as notNilEmpty7 } from "qx-util";
14325
- import { IBizContext as IBizContext3, RuntimeError as RuntimeError34 } from "@ibiz-template/core";
14346
+ import {
14347
+ HttpError as HttpError7,
14348
+ IBizContext as IBizContext3,
14349
+ RuntimeError as RuntimeError34
14350
+ } from "@ibiz-template/core";
14326
14351
  import { isEmpty as isEmpty9, isNil as isNil22, isNotNil as isNotNil2 } from "ramda";
14327
14352
 
14328
14353
  // src/controller/utils/loading/loading.state.ts
@@ -16014,6 +16039,7 @@ var ViewController = class extends BaseController {
16014
16039
  this.modal = new Modal({});
16015
16040
  this.providers = {};
16016
16041
  this.engines = [];
16042
+ this.error = {};
16017
16043
  this.slotProps = {};
16018
16044
  this.counters = {};
16019
16045
  /**
@@ -16037,6 +16063,7 @@ var ViewController = class extends BaseController {
16037
16063
  }
16038
16064
  this.ctx.init(this);
16039
16065
  this.initEngines();
16066
+ this.handleViewError = this.handleViewError.bind(this);
16040
16067
  }
16041
16068
  get _evt() {
16042
16069
  return this.evt;
@@ -16148,6 +16175,7 @@ var ViewController = class extends BaseController {
16148
16175
  this.state.srfactiveviewdata = null;
16149
16176
  this.state.viewMessages = {};
16150
16177
  this.state.isClosing = false;
16178
+ this.state.hasError = false;
16151
16179
  }
16152
16180
  async onCreated() {
16153
16181
  await super.onCreated();
@@ -16192,6 +16220,7 @@ var ViewController = class extends BaseController {
16192
16220
  if (this.engines.length) {
16193
16221
  await Promise.all(this.engines.map((engine2) => engine2.onCreated()));
16194
16222
  }
16223
+ ibiz.mc.error.on(this.handleViewError);
16195
16224
  }
16196
16225
  async onMounted() {
16197
16226
  var _a;
@@ -16218,6 +16247,7 @@ var ViewController = class extends BaseController {
16218
16247
  }
16219
16248
  this.context.destroy();
16220
16249
  ibiz.log.debug("\u89C6\u56FE[".concat(this.model.name, "](").concat(this.model.id, ")\u9500\u6BC1"));
16250
+ ibiz.mc.error.off(this.handleViewError);
16221
16251
  }
16222
16252
  /**
16223
16253
  * 处理上下文和导航参数相关的,如自定义导航参数的处理
@@ -16232,6 +16262,7 @@ var ViewController = class extends BaseController {
16232
16262
  const domain = ibiz.uiDomainManager.create(this.id);
16233
16263
  this.context.srfsessionid = domain.id;
16234
16264
  }
16265
+ this.context.srfviewid = this.id;
16235
16266
  const navContexts = this.model.appViewNavContexts;
16236
16267
  let context = {};
16237
16268
  if (notNilEmpty7(navContexts)) {
@@ -16388,6 +16419,21 @@ var ViewController = class extends BaseController {
16388
16419
  );
16389
16420
  }
16390
16421
  }
16422
+ /**
16423
+ * 处理视图错误
16424
+ *
16425
+ * @author tony001
16426
+ * @date 2024-04-28 12:04:27
16427
+ * @protected
16428
+ * @param {IPortalMessage} msg
16429
+ */
16430
+ handleViewError(msg) {
16431
+ const { type, data } = msg;
16432
+ if (type === "ERROR" && data instanceof HttpError7 && data.tag === this.id) {
16433
+ this.error = data;
16434
+ this.state.hasError = true;
16435
+ }
16436
+ }
16391
16437
  };
16392
16438
 
16393
16439
  // src/controller/common/view/app-data-upload-view.controller.ts
@@ -16708,7 +16754,7 @@ var CodeListEditorController = class extends EditorController {
16708
16754
 
16709
16755
  // src/controller/common/control/control.controller.ts
16710
16756
  import {
16711
- HttpError as HttpError6,
16757
+ HttpError as HttpError8,
16712
16758
  IBizContext as IBizContext4,
16713
16759
  IBizParams,
16714
16760
  NoticeError as NoticeError2,
@@ -17075,7 +17121,7 @@ var ControlController = class extends BaseController {
17075
17121
  return;
17076
17122
  }
17077
17123
  if (opts == null ? void 0 : opts.error) {
17078
- if (opts.error instanceof HttpError6 && opts.error.status !== 500) {
17124
+ if (opts.error instanceof HttpError8 && opts.error.status !== 500) {
17079
17125
  throw opts.error;
17080
17126
  }
17081
17127
  ibiz.log.error(opts.error);
@@ -38507,7 +38553,10 @@ var MDViewEngine = class extends ViewEngineBase {
38507
38553
  * @return {*} {Promise<void>}
38508
38554
  */
38509
38555
  async onXDataActive(event) {
38510
- await this.openData(event);
38556
+ const res = await this.openData(event);
38557
+ if (!res.cancel) {
38558
+ this.refresh();
38559
+ }
38511
38560
  }
38512
38561
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
38513
38562
  async call(key, args) {