@ibiz-template/runtime 0.6.3 → 0.6.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 (46) hide show
  1. package/dist/index.esm.js +127 -28
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  4. package/out/controller/common/control/md-control.controller.js +3 -0
  5. package/out/controller/control/toolbar/toolbar.controllerr.d.ts.map +1 -1
  6. package/out/controller/control/toolbar/toolbar.controllerr.js +12 -0
  7. package/out/controller/notification/internal-message.controller.d.ts +4 -2
  8. package/out/controller/notification/internal-message.controller.d.ts.map +1 -1
  9. package/out/controller/notification/internal-message.controller.js +6 -6
  10. package/out/controller/utils/data-file-util/data-file-util.d.ts +2 -2
  11. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
  12. package/out/controller/utils/data-file-util/data-file-util.js +13 -4
  13. package/out/engine/view-base.engine.d.ts.map +1 -1
  14. package/out/engine/view-base.engine.js +6 -1
  15. package/out/interface/common/i-modal/i-modal.d.ts +1 -1
  16. package/out/interface/common/i-modal/i-modal.d.ts.map +1 -1
  17. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +16 -1
  18. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -1
  19. package/out/interface/provider/i-internal-message.provider.d.ts +8 -0
  20. package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
  21. package/out/interface/util/i-notification-util/i-notification-util.d.ts +7 -0
  22. package/out/interface/util/i-notification-util/i-notification-util.d.ts.map +1 -1
  23. package/out/logic-scheduler/trigger/item-dyna-logic-trigger.d.ts.map +1 -1
  24. package/out/logic-scheduler/trigger/item-dyna-logic-trigger.js +3 -2
  25. package/out/service/dto/method.dto.js +2 -2
  26. package/out/service/service/authority/de-authority.service.d.ts.map +1 -1
  27. package/out/service/service/authority/de-authority.service.js +7 -2
  28. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  29. package/out/service/service/entity/method/de-action.js +15 -0
  30. package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
  31. package/out/service/service/entity/method/method-renturn.js +1 -0
  32. package/out/service/service/entity/method/method.d.ts.map +1 -1
  33. package/out/service/service/entity/method/method.js +1 -1
  34. package/out/service/utils/app-counter/app-counter.d.ts +10 -0
  35. package/out/service/utils/app-counter/app-counter.d.ts.map +1 -1
  36. package/out/service/utils/app-counter/app-counter.js +23 -0
  37. package/out/service/utils/util/util.d.ts +8 -0
  38. package/out/service/utils/util/util.d.ts.map +1 -1
  39. package/out/service/utils/util/util.js +19 -0
  40. package/out/utils/modal/modal.d.ts +1 -1
  41. package/out/utils/modal/modal.d.ts.map +1 -1
  42. package/out/utils/modal/modal.js +2 -2
  43. package/out/utils/ui-domain/ui-domain.d.ts +22 -2
  44. package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
  45. package/out/utils/ui-domain/ui-domain.js +26 -2
  46. package/package.json +2 -2
package/dist/index.esm.js CHANGED
@@ -2720,11 +2720,11 @@ var Modal = class {
2720
2720
  this._dismiss = dismiss;
2721
2721
  }
2722
2722
  async dismiss(data = { ok: false, data: [] }) {
2723
- const context = { allowClose: true };
2723
+ const context = {};
2724
2724
  if (this.ignoreDismissCheck !== true) {
2725
2725
  await this.hooks.shouldDismiss.call(context);
2726
2726
  }
2727
- if (!context.allowClose) {
2727
+ if (context.allowClose === false) {
2728
2728
  ibiz.log.debug("shouldDismiss\u7ED3\u679C\u4E3Afalse,\u5173\u95ED\u4E2D\u65AD\u3002");
2729
2729
  return false;
2730
2730
  }
@@ -2985,8 +2985,7 @@ var UIDomain = class {
2985
2985
  * Creates an instance of UIDomain.
2986
2986
  *
2987
2987
  * @author chitanda
2988
- * @date 2023-12-22 16:12:03
2989
- * @param {string} appId
2988
+ * @date 2024-03-04 13:03:29
2990
2989
  * @param {string} [id]
2991
2990
  */
2992
2991
  constructor(id) {
@@ -3024,12 +3023,37 @@ var UIDomain = class {
3024
3023
  * @type {Transaction}
3025
3024
  */
3026
3025
  this.transaction = new Transaction();
3026
+ /**
3027
+ * 界面域是否发生数据变更,在域下数据修改后改为 true ,在数据提交后改为 false
3028
+ *
3029
+ * @author chitanda
3030
+ * @date 2024-03-04 13:03:08
3031
+ */
3032
+ this.dataModification = false;
3027
3033
  if (id) {
3028
3034
  this.id = id;
3029
3035
  } else {
3030
3036
  this.id = createUUID();
3031
3037
  }
3032
3038
  }
3039
+ /**
3040
+ * 界面域数据发生变更
3041
+ *
3042
+ * @author chitanda
3043
+ * @date 2024-03-04 14:03:06
3044
+ */
3045
+ dataChange() {
3046
+ this.dataModification = true;
3047
+ }
3048
+ /**
3049
+ * 界面域数据变更已提交
3050
+ *
3051
+ * @author chitanda
3052
+ * @date 2024-03-04 14:03:15
3053
+ */
3054
+ dataChangeCompleted() {
3055
+ this.dataModification = false;
3056
+ }
3033
3057
  /**
3034
3058
  * 设置当前界面域下,指定实体的相关父关系以及属性。在 DTO 包解析时设置此参数,销毁时清空
3035
3059
  *
@@ -6077,6 +6101,7 @@ var AppCounter = class {
6077
6101
  * @type {IData}
6078
6102
  */
6079
6103
  this.data = {};
6104
+ this.countChange = this.countChange.bind(this);
6080
6105
  }
6081
6106
  /**
6082
6107
  * 计数器是否已经销毁
@@ -6101,6 +6126,26 @@ var AppCounter = class {
6101
6126
  this.setParams(context, params);
6102
6127
  this.interval();
6103
6128
  await this.load();
6129
+ if (this.model.appDataEntityId) {
6130
+ ibiz.mc.command.change.on(this.countChange);
6131
+ }
6132
+ }
6133
+ /**
6134
+ * 接受计数器实体数据变更,刷新计数器
6135
+ *
6136
+ * @author chitanda
6137
+ * @date 2024-03-07 14:03:00
6138
+ * @protected
6139
+ * @param {IPortalMessage} msg
6140
+ */
6141
+ countChange(msg) {
6142
+ const data = msg.data;
6143
+ if (this.model.appDataEntityId) {
6144
+ const codeName = calcDeCodeNameById(this.model.appDataEntityId);
6145
+ if (data && data.srfdecodename === codeName) {
6146
+ this.refresh();
6147
+ }
6148
+ }
6104
6149
  }
6105
6150
  /**
6106
6151
  * 设置上下文以及查询参数
@@ -6217,6 +6262,7 @@ var AppCounter = class {
6217
6262
  this.context.destroy();
6218
6263
  this.destroyInterval();
6219
6264
  this.evt.reset();
6265
+ ibiz.mc.command.change.on(this.countChange);
6220
6266
  }
6221
6267
  };
6222
6268
 
@@ -7249,6 +7295,20 @@ function fieldValueToBoolean(value) {
7249
7295
  return !!value;
7250
7296
  }
7251
7297
  }
7298
+ function convertToObject(input) {
7299
+ const result = {};
7300
+ if (!input) {
7301
+ return result;
7302
+ }
7303
+ const pairs = input.split(",");
7304
+ if (pairs && pairs.length > 0) {
7305
+ pairs.forEach((pair) => {
7306
+ const [key, value] = pair.split(":");
7307
+ result[key] = parseInt(value, 10);
7308
+ });
7309
+ }
7310
+ return result;
7311
+ }
7252
7312
 
7253
7313
  // src/service/utils/dyna-sys-params/dyna-sys-params.ts
7254
7314
  async function calcDynaSysParams(appDataEntityId, context, opts = {}) {
@@ -8177,7 +8237,7 @@ var MethodDto = class {
8177
8237
  * @return {*} {Promise<IData>}
8178
8238
  */
8179
8239
  async get(context, data, ignore = false) {
8180
- if (context.srfsimple === true) {
8240
+ if (context.srfsimple === true && this.isLocalMode === false) {
8181
8241
  return data;
8182
8242
  }
8183
8243
  const params = {};
@@ -8264,7 +8324,7 @@ var MethodDto = class {
8264
8324
  * @return {*} {Promise<IDataEntity[]>}
8265
8325
  */
8266
8326
  async sets(context, data) {
8267
- if (context.srfsimple === true) {
8327
+ if (context.srfsimple === true && this.isLocalMode === false) {
8268
8328
  if (data && data.length > 0) {
8269
8329
  return data.map((item) => {
8270
8330
  return this.service.createEntity(item);
@@ -9112,8 +9172,11 @@ var DeAuthorityService = class {
9112
9172
  * @return {*} {Promise<boolean>}
9113
9173
  */
9114
9174
  async calcByDataAccessAction(dataAccessAction, data) {
9115
- if (data.srfopprivs && !data.srfopprivs.includes(dataAccessAction)) {
9116
- return false;
9175
+ if (data.srfdataaccaction) {
9176
+ const dataAccactions = convertToObject(data.srfdataaccaction);
9177
+ if (!dataAccactions[dataAccessAction]) {
9178
+ return false;
9179
+ }
9117
9180
  }
9118
9181
  const mainStateResult = await this.calcByDeMainState(
9119
9182
  dataAccessAction,
@@ -9585,6 +9648,7 @@ var MethodReturn = class {
9585
9648
  uiDomain.calcParentRs();
9586
9649
  uiDomain.state.rsInit = true;
9587
9650
  }
9651
+ uiDomain.dataChangeCompleted();
9588
9652
  app.deService.clearTempCacheByRs(
9589
9653
  {
9590
9654
  srfappid: app.appId,
@@ -9644,6 +9708,7 @@ var Method = class {
9644
9708
  res = await this.app.net.post(
9645
9709
  this.mergeRequestPath(path2, methodName),
9646
9710
  data || params || {},
9711
+ {},
9647
9712
  header
9648
9713
  );
9649
9714
  break;
@@ -11137,6 +11202,10 @@ var DEActionMethod = class extends Method {
11137
11202
  this.attach(context, addData)
11138
11203
  );
11139
11204
  }
11205
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
11206
+ if (uiDomain) {
11207
+ uiDomain.dataChange();
11208
+ }
11140
11209
  return new HttpResponse3(resultData);
11141
11210
  } catch (err) {
11142
11211
  throw new HttpError5(err);
@@ -11189,6 +11258,10 @@ var DEActionMethod = class extends Method {
11189
11258
  }
11190
11259
  const data = this.service.local.delete(context, key);
11191
11260
  if (data) {
11261
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
11262
+ if (uiDomain) {
11263
+ uiDomain.dataChange();
11264
+ }
11192
11265
  return new HttpResponse3(data);
11193
11266
  }
11194
11267
  return new HttpResponse3(data, 500);
@@ -11316,6 +11389,10 @@ var DEActionMethod = class extends Method {
11316
11389
  );
11317
11390
  }
11318
11391
  if (resultData) {
11392
+ const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
11393
+ if (uiDomain) {
11394
+ uiDomain.dataChange();
11395
+ }
11319
11396
  return new HttpResponse3(resultData);
11320
11397
  }
11321
11398
  return new HttpResponse3(resultData, 500);
@@ -14303,13 +14380,17 @@ function listenAsyncAction(id) {
14303
14380
  ibiz.mc.command.asyncAction.on(callBack);
14304
14381
  });
14305
14382
  }
14306
- async function asyncImportData(file, appDataEntity, dataImport) {
14383
+ async function asyncImportData(file, appDataEntity, dataImport, context) {
14307
14384
  const data = new FormData();
14308
14385
  data.append("file", file);
14309
- let url = "".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(asyncImportUrl);
14386
+ let url = "/".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(asyncImportUrl);
14310
14387
  if (dataImport == null ? void 0 : dataImport.codeName) {
14311
14388
  url += "?srfimporttag=".concat(dataImport.codeName);
14312
14389
  }
14390
+ if (context) {
14391
+ const resPath = calcResPath(context, appDataEntity);
14392
+ url = resPath + url;
14393
+ }
14313
14394
  const res = await ibiz.net.request(url, {
14314
14395
  method: "post",
14315
14396
  data,
@@ -14321,13 +14402,17 @@ async function asyncImportData(file, appDataEntity, dataImport) {
14321
14402
  "OBJECTCREATED"
14322
14403
  );
14323
14404
  }
14324
- async function importData(file, appDataEntity, dataImport) {
14405
+ async function importData(file, appDataEntity, dataImport, context) {
14325
14406
  const data = new FormData();
14326
14407
  data.append("file", file);
14327
- let url = "".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(importUrl);
14408
+ let url = "/".concat(appDataEntity.codeName2.toLowerCase(), "/").concat(importUrl);
14328
14409
  if (dataImport == null ? void 0 : dataImport.codeName) {
14329
14410
  url += "?srfimporttag=".concat(dataImport.codeName);
14330
14411
  }
14412
+ if (context) {
14413
+ const resPath = calcResPath(context, appDataEntity);
14414
+ url = resPath + url;
14415
+ }
14331
14416
  const res = await ibiz.net.request(url, {
14332
14417
  method: "post",
14333
14418
  data,
@@ -16235,7 +16320,10 @@ var MDControlController = class extends ControlController {
16235
16320
  importName,
16236
16321
  {
16237
16322
  dismiss: () => modal.dismiss(),
16238
- appDataEntity
16323
+ dataImport,
16324
+ appDataEntity,
16325
+ context: this.context,
16326
+ params: this.params
16239
16327
  },
16240
16328
  {
16241
16329
  width: "auto",
@@ -20387,6 +20475,16 @@ var ToolbarController = class extends ControlController {
20387
20475
  );
20388
20476
  this.state.buttonsState.addState(uiItem.id, buttonState);
20389
20477
  }
20478
+ if (item.controlLogics) {
20479
+ for (let i = 0; i < item.controlLogics.length; i++) {
20480
+ const controlLogic = item.controlLogics[i];
20481
+ const itemState = this.state.buttonsState[item.id];
20482
+ if (controlLogic.itemName === item.id && controlLogic.triggerType === "ITEMVISIBLE") {
20483
+ itemState.visible = false;
20484
+ break;
20485
+ }
20486
+ }
20487
+ }
20390
20488
  },
20391
20489
  { childrenFields: ["detoolbarItems"] }
20392
20490
  );
@@ -34590,9 +34688,6 @@ var AsyncActionController = class {
34590
34688
  };
34591
34689
 
34592
34690
  // src/controller/notification/internal-message.controller.ts
34593
- import {
34594
- IBizContext as IBizContext4
34595
- } from "@ibiz-template/core";
34596
34691
  import { QXEvent as QXEvent8 } from "qx-util";
34597
34692
  function isHTML(str) {
34598
34693
  if (str === "")
@@ -34616,6 +34711,8 @@ var InternalMessageController = class {
34616
34711
  this.messages = [];
34617
34712
  this.unreadOnly = false;
34618
34713
  this.service = new InternalMessageService();
34714
+ this.ns = null;
34715
+ this.provider = null;
34619
34716
  }
34620
34717
  async init() {
34621
34718
  this.listenMqtt();
@@ -34699,6 +34796,7 @@ var InternalMessageController = class {
34699
34796
  */
34700
34797
  listenMqtt() {
34701
34798
  ibiz.mc.command.internalMessage.on(async (msg) => {
34799
+ var _a;
34702
34800
  ibiz.log.debug("mqtt internalMessage: ", msg);
34703
34801
  if (msg.subtype !== "INTERNALMESSAGE") {
34704
34802
  return;
@@ -34708,16 +34806,11 @@ var InternalMessageController = class {
34708
34806
  isHtmlDesc: isHTML(msg.content),
34709
34807
  desc: msg.content,
34710
34808
  position: "bottom-right",
34809
+ class: (_a = this.ns) == null ? void 0 : _a.b("notice"),
34711
34810
  onClick: () => {
34712
34811
  const redirectUrl = ibiz.env.isMob ? msg.mobileurl : msg.url;
34713
- if (redirectUrl) {
34714
- const { viewId, context, params } = parseViewProtocol(redirectUrl);
34715
- ibiz.commands.execute(
34716
- OpenAppViewCommand.TAG,
34717
- viewId,
34718
- IBizContext4.create(context),
34719
- params
34720
- );
34812
+ if (this.provider) {
34813
+ this.provider.openViewByUrl(redirectUrl);
34721
34814
  }
34722
34815
  }
34723
34816
  });
@@ -35258,7 +35351,12 @@ var ViewEngineBase = class {
35258
35351
  init() {
35259
35352
  }
35260
35353
  async onCreated() {
35261
- const { childNames } = this.view;
35354
+ const { childNames, modal } = this.view;
35355
+ modal.hooks.shouldDismiss.tapPromise(async (context) => {
35356
+ if (this.view.state.isLoading) {
35357
+ context.allowClose = false;
35358
+ }
35359
+ });
35262
35360
  childNames.push("captionbar", "toolbar");
35263
35361
  this.calcDynamicLayout();
35264
35362
  }
@@ -36517,14 +36615,15 @@ var ItemDynaLogicTrigger = class extends LogicTrigger {
36517
36615
  }
36518
36616
  bindScriptExecutor(executor) {
36519
36617
  executor.init(
36520
- ["context", "viewparams", "data", "env"],
36618
+ ["context", "viewparams", "data", "env", "view"],
36521
36619
  (executeParams) => {
36522
- const { context, params, data } = executeParams;
36620
+ const { context, params, data, view } = executeParams;
36523
36621
  return {
36524
36622
  context,
36525
36623
  params,
36526
36624
  data: (data == null ? void 0 : data[0]) || {},
36527
- env: ibiz.env
36625
+ env: ibiz.env,
36626
+ view
36528
36627
  };
36529
36628
  },
36530
36629
  {