@ibiz-template/runtime 0.7.41-alpha.21 → 0.7.41-alpha.22

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 (23) hide show
  1. package/dist/index.esm.js +89 -74
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts.map +1 -1
  4. package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.js +1 -3
  5. package/out/controller/control/grid/grid/grid.controller.d.ts +0 -14
  6. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  7. package/out/controller/control/grid/grid/grid.controller.js +1 -58
  8. package/out/controller/control/panel/panel/panel-item.controller.d.ts +22 -1
  9. package/out/controller/control/panel/panel/panel-item.controller.d.ts.map +1 -1
  10. package/out/controller/control/panel/panel/panel-item.controller.js +39 -1
  11. package/out/controller/control/panel/panel/panel-item.state.d.ts +1 -0
  12. package/out/controller/control/panel/panel/panel-item.state.d.ts.map +1 -1
  13. package/out/controller/control/panel/panel/panel-item.state.js +1 -0
  14. package/out/controller/control/panel/panel/panel.controller.d.ts +18 -2
  15. package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
  16. package/out/controller/control/panel/panel/panel.controller.js +32 -1
  17. package/out/interface/api/state/control/panel-item/i-api-panel-item.state.d.ts +7 -1
  18. package/out/interface/api/state/control/panel-item/i-api-panel-item.state.d.ts.map +1 -1
  19. package/out/interface/controller/controller/control/i-panel.controller.d.ts +9 -0
  20. package/out/interface/controller/controller/control/i-panel.controller.d.ts.map +1 -1
  21. package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts +7 -0
  22. package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts.map +1 -1
  23. package/package.json +2 -2
package/dist/index.esm.js CHANGED
@@ -47457,9 +47457,7 @@ var PortletPartController = class {
47457
47457
  calcDynaClass(data) {
47458
47458
  if (this.model.dynaClass) {
47459
47459
  const dynaClass = calcDynaClass(this.model.dynaClass, data);
47460
- if (dynaClass.length) {
47461
- this.state.class.containerDyna = dynaClass;
47462
- }
47460
+ this.state.class.containerDyna = dynaClass;
47463
47461
  }
47464
47462
  }
47465
47463
  /**
@@ -56654,7 +56652,7 @@ import {
56654
56652
  mergeDefaultInLeft as mergeDefaultInLeft2,
56655
56653
  debounceAndAsyncMerge as debounceAndAsyncMerge2
56656
56654
  } from "@ibiz-template/core";
56657
- import { clone as clone43, isNil as isNil33 } from "ramda";
56655
+ import { clone as clone43 } from "ramda";
56658
56656
  import dayjs5 from "dayjs";
56659
56657
 
56660
56658
  // src/controller/control/grid/grid/grid.service.ts
@@ -57596,36 +57594,7 @@ var GridController = class extends MDControlController {
57596
57594
  }
57597
57595
  this.calcColumnFixed();
57598
57596
  }
57599
- /**
57600
- * 本地排序items
57601
- * @author zzq
57602
- * @date 2024-04-22 19:30:55
57603
- * @param {IData[]} items
57604
- */
57605
- sortItems(items) {
57606
- const sortField = this.model.orderValueAppDEFieldId;
57607
- if (!sortField || !this.enableRowEditOrder) {
57608
- return;
57609
- }
57610
- items.forEach((item) => {
57611
- const sortValue = item[sortField];
57612
- if (isNil33(sortValue)) {
57613
- item[sortField] = 0;
57614
- } else {
57615
- const toNum = Number(sortValue);
57616
- if (Number.isNaN(toNum)) {
57617
- throw new RuntimeError55(
57618
- ibiz.i18n.t("runtime.controller.control.grid.convertedValue", {
57619
- srfmajortext: item.srfmajortext
57620
- })
57621
- );
57622
- }
57623
- }
57624
- });
57625
- items.sort((a, b) => a[sortField] - b[sortField]);
57626
- }
57627
57597
  async afterLoad(args, items) {
57628
- this.sortItems(this.state.items);
57629
57598
  await super.afterLoad(args, items);
57630
57599
  await handleAllSettled(
57631
57600
  Object.values(this.fieldColumns).map(async (fieldColumn) => {
@@ -58840,32 +58809,6 @@ var GridController = class extends MDControlController {
58840
58809
  await this.refresh();
58841
58810
  }
58842
58811
  }
58843
- /**
58844
- * 更新改变项数据
58845
- * @author: zzq
58846
- * @date 2024-04-22 17:12:58
58847
- * @return {*} {Promise<void>}
58848
- */
58849
- async updateChangedItems(changedItems) {
58850
- try {
58851
- await Promise.all(
58852
- changedItems.map(async (item) => {
58853
- const deName = calcDeCodeNameById(this.model.appDataEntityId);
58854
- const tempContext = this.context.clone();
58855
- tempContext[deName] = item.srfkey;
58856
- const res = await this.service.update(tempContext, item);
58857
- if (res.data) {
58858
- const index = this.state.items.findIndex(
58859
- (x) => x.srfkey === item.srfkey
58860
- );
58861
- this.state.items.splice(index, 1, res.data);
58862
- }
58863
- })
58864
- );
58865
- } finally {
58866
- await this.afterLoad({}, this.state.items);
58867
- }
58868
- }
58869
58812
  /**
58870
58813
  * 计算统计数据
58871
58814
  * @author: zzq
@@ -58951,7 +58894,7 @@ import {
58951
58894
  } from "@ibiz-template/core";
58952
58895
  import dayjs6 from "dayjs";
58953
58896
  import { debounce as debounce2 } from "lodash-es";
58954
- import { clone as clone44, isNil as isNil34 } from "ramda";
58897
+ import { clone as clone44, isNil as isNil33 } from "ramda";
58955
58898
  import { isNilOrEmpty as isNilOrEmpty8 } from "qx-util";
58956
58899
  var GridFieldColumnController = class extends GridColumnController {
58957
58900
  constructor() {
@@ -59241,10 +59184,10 @@ var GridFieldColumnController = class extends GridColumnController {
59241
59184
  }
59242
59185
  aggValue = this.grid.state.remoteAggResult[fieldName] || "";
59243
59186
  } else {
59244
- if (isNil34(aggMode) || aggMode === "NONE") {
59187
+ if (isNil33(aggMode) || aggMode === "NONE") {
59245
59188
  return;
59246
59189
  }
59247
- items = items.filter((item) => !isNil34(item[fieldName]));
59190
+ items = items.filter((item) => !isNil33(item[fieldName]));
59248
59191
  if (this.grid.model.aggMode === "PAGE") {
59249
59192
  switch (aggMode) {
59250
59193
  case "SUM":
@@ -59704,7 +59647,7 @@ var GridGroupColumnController = class extends GridColumnController {
59704
59647
 
59705
59648
  // src/controller/control/list/list.controller.ts
59706
59649
  import { createUUID as createUUID16, isBoolean as isBoolean3 } from "qx-util";
59707
- import { isNil as isNil35 } from "ramda";
59650
+ import { isNil as isNil34 } from "ramda";
59708
59651
  import {
59709
59652
  clone as clone46,
59710
59653
  DataTypes as DataTypes7,
@@ -60113,7 +60056,7 @@ var ListController = class extends MDControlController {
60113
60056
  if (dayjs7(groupVal).isSame(dayjs7(), "day"))
60114
60057
  groupVal = ibiz.i18n.t("runtime.controller.common.md.today");
60115
60058
  }
60116
- if (isNil35(groupVal)) {
60059
+ if (isNil34(groupVal)) {
60117
60060
  unclassified.children.push(item);
60118
60061
  return;
60119
60062
  }
@@ -60244,7 +60187,7 @@ var ListController = class extends MDControlController {
60244
60187
  const isAsc = minorSortDir === "ASC";
60245
60188
  items.forEach((item) => {
60246
60189
  const sortValue = item[minorSortAppDEFieldId];
60247
- if (isNil35(sortValue))
60190
+ if (isNil34(sortValue))
60248
60191
  item[minorSortAppDEFieldId] = 0;
60249
60192
  });
60250
60193
  items.sort(
@@ -60508,9 +60451,9 @@ var ListController = class extends MDControlController {
60508
60451
 
60509
60452
  // src/controller/control/panel/panel/panel.controller.ts
60510
60453
  import {
60454
+ RuntimeError as RuntimeError57,
60511
60455
  recursiveExecute,
60512
- recursiveIterate as recursiveIterate11,
60513
- RuntimeError as RuntimeError57
60456
+ recursiveIterate as recursiveIterate11
60514
60457
  } from "@ibiz-template/core";
60515
60458
  import { AsyncSeriesHook as AsyncSeriesHook2 } from "qx-util";
60516
60459
  var PanelController = class extends ControlController {
@@ -60540,6 +60483,12 @@ var PanelController = class extends ControlController {
60540
60483
  * @type {{ [key: string]: IPanelItemProvider | IControlProvider}}
60541
60484
  */
60542
60485
  this.providers = {};
60486
+ /**
60487
+ * @description 计数器对象
60488
+ * @type {AppCounter}
60489
+ * @memberof PanelController
60490
+ */
60491
+ this.counters = {};
60543
60492
  this.container = container;
60544
60493
  }
60545
60494
  get _evt() {
@@ -60569,6 +60518,7 @@ var PanelController = class extends ControlController {
60569
60518
  async onCreated() {
60570
60519
  var _a3;
60571
60520
  await super.onCreated();
60521
+ await this.initCounter();
60572
60522
  await this.initPanelItemControllers();
60573
60523
  if ((_a3 = this.scheduler) == null ? void 0 : _a3.hasControlEventTrigger) {
60574
60524
  this._evt.on("onPanelItemEvent", (event) => {
@@ -60584,6 +60534,32 @@ var PanelController = class extends ControlController {
60584
60534
  await super.onMounted();
60585
60535
  this.load();
60586
60536
  }
60537
+ /**
60538
+ * @description 初始化计数器
60539
+ * @protected
60540
+ * @returns {*} {Promise<void>}
60541
+ * @memberof PanelController
60542
+ */
60543
+ async initCounter() {
60544
+ this.counters = {};
60545
+ const { appCounterRefs } = this.model;
60546
+ if (appCounterRefs && appCounterRefs.length > 0) {
60547
+ try {
60548
+ await Promise.all(
60549
+ appCounterRefs.map(async (counterRef) => {
60550
+ const counter = await CounterService.getCounterByRef(
60551
+ counterRef,
60552
+ this.context,
60553
+ { ...this.params }
60554
+ );
60555
+ this.counters[counterRef.id] = counter;
60556
+ })
60557
+ );
60558
+ } catch (error) {
60559
+ console.error(error);
60560
+ }
60561
+ }
60562
+ }
60587
60563
  /**
60588
60564
  * 生命周期-销毁完成
60589
60565
  *
@@ -60595,6 +60571,7 @@ var PanelController = class extends ControlController {
60595
60571
  var _a3, _b2;
60596
60572
  await super.onDestroyed();
60597
60573
  (_b2 = (_a3 = this.data).destroy) == null ? void 0 : _b2.call(_a3);
60574
+ Object.values(this.counters).forEach((counter) => counter.destroy());
60598
60575
  this.hooks.validate.clear();
60599
60576
  Object.values(this.panelItems).forEach((item) => {
60600
60577
  item.destroy();
@@ -60867,6 +60844,7 @@ var PanelItemState = class {
60867
60844
  constructor(parent) {
60868
60845
  this.parent = parent;
60869
60846
  this.disabled = false;
60847
+ this.counterData = {};
60870
60848
  this.layout = {
60871
60849
  width: "",
60872
60850
  height: "",
@@ -61051,8 +61029,45 @@ var PanelItemController = class {
61051
61029
  if (labelSysCss == null ? void 0 : labelSysCss.cssName) {
61052
61030
  this.state.class.label.push(labelSysCss.cssName);
61053
61031
  }
61032
+ this.initCounter();
61033
+ }
61034
+ /**
61035
+ * @description 初始化计数器
61036
+ * @protected
61037
+ * @returns {*} {void}
61038
+ * @memberof PanelItemController
61039
+ */
61040
+ initCounter() {
61041
+ var _a3;
61042
+ const { counters } = this.panel;
61043
+ const { appCounterRefId } = this.model;
61044
+ this.handleCounterChange = this.handleCounterChange.bind(this);
61045
+ if (appCounterRefId) {
61046
+ this.counter = counters[appCounterRefId];
61047
+ (_a3 = this.counter) == null ? void 0 : _a3.onChange(this.handleCounterChange);
61048
+ }
61049
+ }
61050
+ /**
61051
+ * @description 处理计数器改变,并根据计数器模式计算显示状态
61052
+ * @protected
61053
+ * @param {IData} data
61054
+ * @memberof PanelItemController
61055
+ */
61056
+ handleCounterChange(data) {
61057
+ var _a3;
61058
+ this.state.counterData = data;
61059
+ let state = true;
61060
+ const { counterId, counterMode } = this.model;
61061
+ if (counterId) {
61062
+ const count = (_a3 = this.counter) == null ? void 0 : _a3.getCounter(counterId);
61063
+ if (counterMode === 1 && count === 0)
61064
+ state = false;
61065
+ this.state.visible = state;
61066
+ }
61054
61067
  }
61055
61068
  destroy() {
61069
+ var _a3;
61070
+ (_a3 = this.counter) == null ? void 0 : _a3.offChange(this.handleCounterChange);
61056
61071
  }
61057
61072
  /**
61058
61073
  * 值校验
@@ -61637,7 +61652,7 @@ import {
61637
61652
  recursiveIterate as recursiveIterate12,
61638
61653
  RuntimeModelError as RuntimeModelError68
61639
61654
  } from "@ibiz-template/core";
61640
- import { isNil as isNil36 } from "ramda";
61655
+ import { isNil as isNil35 } from "ramda";
61641
61656
  import { isBoolean as isBoolean4 } from "qx-util";
61642
61657
 
61643
61658
  // src/controller/control/tree/tree.service.ts
@@ -63294,7 +63309,7 @@ var TreeController = class extends MDControlController {
63294
63309
  * @return {*} {void}
63295
63310
  */
63296
63311
  onDEDataChange(msg) {
63297
- if (!isNil36(msg.triggerKey) && msg.triggerKey === this.triggerKey) {
63312
+ if (!isNil35(msg.triggerKey) && msg.triggerKey === this.triggerKey) {
63298
63313
  return;
63299
63314
  }
63300
63315
  if (msg.subtype === "OBJECTCREATED") {
@@ -64019,7 +64034,7 @@ var WizardPanelController = class extends ControlController {
64019
64034
 
64020
64035
  // src/controller/control/md-ctrl/md-ctrl.controller.ts
64021
64036
  import { RuntimeModelError as RuntimeModelError69 } from "@ibiz-template/core";
64022
- import { isNil as isNil37 } from "ramda";
64037
+ import { isNil as isNil36 } from "ramda";
64023
64038
 
64024
64039
  // src/controller/control/md-ctrl/md-ctrl.service.ts
64025
64040
  var MDCtrlService = class extends MDControlService {
@@ -64282,7 +64297,7 @@ var MDCtrlController = class extends MDControlController {
64282
64297
  const groupMap = /* @__PURE__ */ new Map();
64283
64298
  items.forEach((item) => {
64284
64299
  const groupVal = item[groupAppDEFieldId];
64285
- if (isNil37(groupVal)) {
64300
+ if (isNil36(groupVal)) {
64286
64301
  return;
64287
64302
  }
64288
64303
  if (!groupMap.has(groupVal)) {
@@ -77990,7 +78005,7 @@ import { QXEvent as QXEvent14 } from "qx-util";
77990
78005
  // src/controller/notification/async-action.controller.ts
77991
78006
  import { QXEvent as QXEvent12 } from "qx-util";
77992
78007
  import { clone as clone54 } from "ramda";
77993
- import { isNil as isNil38, isNumber as isNumber5 } from "lodash-es";
78008
+ import { isNil as isNil37, isNumber as isNumber5 } from "lodash-es";
77994
78009
  import dayjs10 from "dayjs";
77995
78010
  var AsyncActionController = class {
77996
78011
  constructor() {
@@ -78068,14 +78083,14 @@ var AsyncActionController = class {
78068
78083
  data[key] = dayjs10(data[key]).format("YYYY-MM-DD HH:mm:ss");
78069
78084
  }
78070
78085
  });
78071
- if (!isNil38(data.actionresult)) {
78086
+ if (!isNil37(data.actionresult)) {
78072
78087
  try {
78073
78088
  const json = JSON.parse(data.actionresult);
78074
78089
  data.actionresult = json;
78075
78090
  } catch (error) {
78076
78091
  }
78077
78092
  }
78078
- if (!isNil38(data.completionrate)) {
78093
+ if (!isNil37(data.completionrate)) {
78079
78094
  const num = Number(data.completionrate);
78080
78095
  if (Number.isNaN(num)) {
78081
78096
  data.completionrate = void 0;