@ibiz-template/runtime 0.1.30 → 0.1.32

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
@@ -8385,6 +8385,7 @@ var ViewCallTag = /* @__PURE__ */ ((ViewCallTag2) => {
8385
8385
  ViewCallTag2["LOAD"] = "Load";
8386
8386
  ViewCallTag2["GET_DATA"] = "GetData";
8387
8387
  ViewCallTag2["GET_ALL_DATA"] = "GetAllData";
8388
+ ViewCallTag2["VALIDATE"] = "Validate";
8388
8389
  return ViewCallTag2;
8389
8390
  })(ViewCallTag || {});
8390
8391
 
@@ -10471,7 +10472,8 @@ var CodeListService = class {
10471
10472
  value: isValueNumber ? Number(codeItem.value) : codeItem.value,
10472
10473
  color: codeItem.color,
10473
10474
  id: codeItem.codeName,
10474
- textCls: codeItem.textCls
10475
+ textCls: codeItem.textCls,
10476
+ disableSelect: codeItem.disableSelect
10475
10477
  };
10476
10478
  if ((_a = codeItem.codeItems) == null ? void 0 : _a.length) {
10477
10479
  _codeItem.children = this.formatStaticItems(
@@ -19802,6 +19804,12 @@ var UIActionUtil = class {
19802
19804
  if (!action) {
19803
19805
  throw new RuntimeError36("\u6CA1\u627E\u5230".concat(actionId, "\u7684\u754C\u9762\u884C\u4E3A\u6A21\u578B"));
19804
19806
  }
19807
+ if (action.actionTarget === "SINGLEDATA") {
19808
+ const validateResult = await params.view.call("Validate" /* VALIDATE */);
19809
+ if (validateResult === false) {
19810
+ return { cancel: true };
19811
+ }
19812
+ }
19805
19813
  const provider = await getUIActionProvider(action);
19806
19814
  return provider.exec(action, params);
19807
19815
  }
@@ -25902,7 +25910,7 @@ var GridController = class extends MDControlController {
25902
25910
  // src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts
25903
25911
  import { DataTypes as DataTypes3, ModelError as ModelError26 } from "@ibiz-template/core";
25904
25912
  import dayjs4 from "dayjs";
25905
- import { clone as clone18 } from "ramda";
25913
+ import { clone as clone18, isNil as isNil19 } from "ramda";
25906
25914
  var GridFieldColumnController = class extends GridColumnController {
25907
25915
  constructor() {
25908
25916
  super(...arguments);
@@ -26072,6 +26080,7 @@ var GridFieldColumnController = class extends GridColumnController {
26072
26080
  return;
26073
26081
  }
26074
26082
  const fieldName = aggField || this.model.id;
26083
+ items = items.filter((item) => !isNil19(item[fieldName]));
26075
26084
  let aggValue;
26076
26085
  if (this.grid.model.aggMode === "PAGE") {
26077
26086
  switch (aggMode) {
@@ -27917,10 +27926,12 @@ var TreeController = class extends MDControlController {
27917
27926
  initState() {
27918
27927
  super.initState();
27919
27928
  this.state.defaultExpandedKeys = [];
27929
+ this.state.expandedKeys = [];
27920
27930
  this.state.size = 0;
27921
27931
  }
27922
27932
  async onCreated() {
27923
27933
  await super.onCreated();
27934
+ this.state.expandedKeys = [...this.state.defaultExpandedKeys];
27924
27935
  this.service = new TreeService(this.model);
27925
27936
  await this.service.init(this.context);
27926
27937
  this.model.detreeNodes.forEach((node) => {
@@ -27946,8 +27957,17 @@ var TreeController = class extends MDControlController {
27946
27957
  */
27947
27958
  async load(args = {}) {
27948
27959
  const isInitialLoad = args.isInitialLoad === true;
27949
- const nodes = await this.loadNodes();
27950
- this.state.expandedKeys = this.calcExpandedKeys(nodes);
27960
+ if (isInitialLoad) {
27961
+ await this.startLoading();
27962
+ }
27963
+ let nodes;
27964
+ try {
27965
+ nodes = await this.loadNodes();
27966
+ } finally {
27967
+ if (isInitialLoad) {
27968
+ await this.endLoading();
27969
+ }
27970
+ }
27951
27971
  await this.afterLoad(args, nodes);
27952
27972
  this.state.isLoaded = true;
27953
27973
  await this.evt.emit("onLoadSuccess", {
@@ -27965,19 +27985,12 @@ var TreeController = class extends MDControlController {
27965
27985
  async loadNodes(parentNode) {
27966
27986
  const params = await this.getFetchParams();
27967
27987
  const hasQuery = !!params.query;
27968
- const defaultExpandedKeys = !parentNode ? this.state.defaultExpandedKeys : void 0;
27969
- await this.startLoading();
27970
- let nodes;
27971
- try {
27972
- nodes = await this.service.fetchChildNodes(parentNode, {
27973
- context: this.context.clone(),
27974
- params,
27975
- hasQuery,
27976
- defaultExpandedKeys
27977
- }) || [];
27978
- } finally {
27979
- await this.endLoading();
27980
- }
27988
+ const nodes = await this.service.fetchChildNodes(parentNode, {
27989
+ context: this.context.clone(),
27990
+ params,
27991
+ hasQuery,
27992
+ defaultExpandedKeys: this.state.expandedKeys
27993
+ }) || [];
27981
27994
  if (parentNode) {
27982
27995
  parentNode.children = nodes;
27983
27996
  } else {
@@ -27990,6 +28003,7 @@ var TreeController = class extends MDControlController {
27990
28003
  this.state.items.push(node);
27991
28004
  }
27992
28005
  );
28006
+ this.state.expandedKeys = this.calcExpandedKeys(nodes);
27993
28007
  return nodes;
27994
28008
  }
27995
28009
  /**
@@ -28015,6 +28029,24 @@ var TreeController = class extends MDControlController {
28015
28029
  await this.setActive(nodeData);
28016
28030
  }
28017
28031
  }
28032
+ /**
28033
+ * 树节点数据变更事件处理
28034
+ * @author lxm
28035
+ * @date 2023-09-28 01:48:05
28036
+ * @param {ITreeNodeData} nodeData
28037
+ * @param {boolean} isExpand true为展开,false为折叠
28038
+ */
28039
+ onExpandChange(nodeData, isExpand) {
28040
+ const hasKey = this.state.expandedKeys.includes(nodeData.id);
28041
+ if (isExpand && !hasKey) {
28042
+ this.state.expandedKeys.push(nodeData.id);
28043
+ } else if (!isExpand && hasKey) {
28044
+ const index = this.state.expandedKeys.indexOf(nodeData.id);
28045
+ if (index !== -1) {
28046
+ this.state.expandedKeys.splice(index, 1);
28047
+ }
28048
+ }
28049
+ }
28018
28050
  /**
28019
28051
  * 树节点双击事件
28020
28052
  * @author lxm
@@ -28098,7 +28130,7 @@ var TreeController = class extends MDControlController {
28098
28130
  };
28099
28131
  }
28100
28132
  /**
28101
- * 计算展开节点集合
28133
+ * 计算展开节点集合(根据加载的子节点计算所有的展开节点标识集合)
28102
28134
  * @author lxm
28103
28135
  * @date 2023-08-09 05:19:36
28104
28136
  * @param {ITreeNodeData[]} nodes
@@ -28106,17 +28138,14 @@ var TreeController = class extends MDControlController {
28106
28138
  * @return {*} {string[]}
28107
28139
  */
28108
28140
  calcExpandedKeys(nodes) {
28109
- let expandedKeys = [];
28141
+ let expandedKeys = [...this.state.expandedKeys];
28110
28142
  recursiveIterate6({ children: nodes }, (node) => {
28111
28143
  var _a;
28112
28144
  if ((_a = node.children) == null ? void 0 : _a.length) {
28113
28145
  expandedKeys.push(node.id);
28114
28146
  }
28115
28147
  });
28116
- if (this.state.defaultExpandedKeys.length) {
28117
- expandedKeys.push(...this.state.defaultExpandedKeys);
28118
- expandedKeys = Array.from(new Set(expandedKeys));
28119
- }
28148
+ expandedKeys = Array.from(new Set(expandedKeys));
28120
28149
  return expandedKeys;
28121
28150
  }
28122
28151
  /**
@@ -28664,7 +28693,7 @@ var MDCtrlController = class extends MDControlController {
28664
28693
 
28665
28694
  // src/controller/control/kanban/kanban.controller.ts
28666
28695
  import { RuntimeError as RuntimeError47, RuntimeModelError as RuntimeModelError54 } from "@ibiz-template/core";
28667
- import { isNil as isNil19 } from "ramda";
28696
+ import { isNil as isNil20 } from "ramda";
28668
28697
 
28669
28698
  // src/controller/control/kanban/kanban.service.ts
28670
28699
  var KanbanService = class extends DataViewControlService {
@@ -28746,7 +28775,7 @@ var KanbanController = class extends DataViewControlController {
28746
28775
  const isAsc = minorSortDir === "ASC";
28747
28776
  items.forEach((item) => {
28748
28777
  const sortValue = item[sortField];
28749
- if (isNil19(sortValue)) {
28778
+ if (isNil20(sortValue)) {
28750
28779
  item[sortField] = 0;
28751
28780
  } else {
28752
28781
  const toNum = Number(sortValue);