@kdcloudjs/table 1.2.2-canary.16 → 1.2.2-canary.18

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.
@@ -119,23 +119,46 @@ function multiSelect() {
119
119
  var key = _internals.internals.safeGetRowKey(primaryKey, row, rowIndex);
120
120
  var selectValueSet = pipeline.getFeatureOptions(selectValueSetKey) || new _set.default();
121
121
  var checked = selectValueSet.has(key);
122
- return /*#__PURE__*/_react.default.createElement(Checkbox, {
123
- checked: checked,
124
- disabled: isDisabled(row, rowIndex),
125
- onChange: clickArea === 'checkbox' ? function (arg1, arg2) {
126
- var _a;
127
- // 这里要同时兼容 antd 和 fusion 的用法
128
- // fusion: arg2?.nativeEvent
129
- // antd: arg1.nativeEvent
130
- var nativeEvent = (_a = arg2 === null || arg2 === void 0 ? void 0 : arg2.nativeEvent) !== null && _a !== void 0 ? _a : arg1.nativeEvent;
131
- if (nativeEvent) {
132
- if (opts.stopClickEventPropagation) {
133
- nativeEvent.stopPropagation();
134
- }
135
- onCheckboxChange(checked, key, nativeEvent.shiftKey);
122
+ var disabled = isDisabled(row, rowIndex);
123
+ var defaultOnChange = clickArea === 'checkbox' ? function (arg1, arg2) {
124
+ var _a;
125
+ // 这里要同时兼容 antd fusion 的用法
126
+ // fusion: arg2?.nativeEvent
127
+ // antd: arg1.nativeEvent
128
+ var nativeEvent = (_a = arg2 === null || arg2 === void 0 ? void 0 : arg2.nativeEvent) !== null && _a !== void 0 ? _a : arg1.nativeEvent;
129
+ if (nativeEvent) {
130
+ if (opts.stopClickEventPropagation) {
131
+ nativeEvent.stopPropagation();
136
132
  }
137
- } : undefined
133
+ onCheckboxChange(checked, key, nativeEvent.shiftKey);
134
+ }
135
+ } : undefined;
136
+ var defaultElement = /*#__PURE__*/_react.default.createElement(Checkbox, {
137
+ checked: checked,
138
+ disabled: disabled,
139
+ onChange: defaultOnChange
138
140
  });
141
+ var ctx = {
142
+ type: 'multi',
143
+ row: row,
144
+ rowIndex: rowIndex,
145
+ rowKey: key,
146
+ checked: checked,
147
+ disabled: disabled,
148
+ defaultElement: defaultElement,
149
+ actions: {
150
+ select: function select() {
151
+ if (!checked) onCheckboxChange(false, key, false);
152
+ },
153
+ toggle: function toggle(batch) {
154
+ return onCheckboxChange(checked, key, !!batch);
155
+ }
156
+ }
157
+ };
158
+ if (opts.customRender) {
159
+ return opts.customRender(ctx);
160
+ }
161
+ return defaultElement;
139
162
  },
140
163
  features: (0, _extends3.default)((0, _extends3.default)({}, (_l = opts.checkboxColumn) === null || _l === void 0 ? void 0 : _l.features), (0, _defineProperty2.default)({}, _utils.MULTI_SELECT_MARK_PROPNAME, true))
141
164
  });
@@ -1,4 +1,5 @@
1
- import { ArtColumn } from '../../interfaces';
1
+ import React from 'react';
2
+ import { ArtColumn, selectRenderProps } from '../../interfaces';
2
3
  import { TablePipeline } from '../pipeline';
3
4
  export interface SingleSelectFeatureOptions {
4
5
  /** 是否高亮被选中的行 */
@@ -19,5 +20,6 @@ export interface SingleSelectFeatureOptions {
19
20
  radioPlacement?: 'start' | 'end';
20
21
  /** 是否对触发 onChange 的 click 事件调用 event.stopPropagation() */
21
22
  stopClickEventPropagation?: boolean;
23
+ customRender?: (ctx: selectRenderProps) => React.ReactNode;
22
24
  }
23
25
  export declare function singleSelect(opts?: SingleSelectFeatureOptions): (pipeline: TablePipeline) => TablePipeline;
@@ -61,18 +61,42 @@ function singleSelect() {
61
61
  return null;
62
62
  }
63
63
  var rowKey = _internals.internals.safeGetRowKey(primaryKey, row, rowIndex);
64
- return /*#__PURE__*/_react.default.createElement(Radio, {
65
- checked: value === rowKey,
66
- disabled: isDisabled(row, rowIndex),
67
- onChange: clickArea === 'radio' ? function (arg1, arg2) {
68
- var _a;
69
- var nativeEvent = (_a = arg2 === null || arg2 === void 0 ? void 0 : arg2.nativeEvent) !== null && _a !== void 0 ? _a : arg1 === null || arg1 === void 0 ? void 0 : arg1.nativeEvent;
70
- if (nativeEvent && opts.stopClickEventPropagation) {
71
- nativeEvent.stopPropagation();
72
- }
73
- onChange(rowKey);
74
- } : undefined
64
+ var checked = value === rowKey;
65
+ var disabled = isDisabled(row, rowIndex);
66
+ var defaultOnChange = clickArea === 'radio' ? function (arg1, arg2) {
67
+ var _a;
68
+ var nativeEvent = (_a = arg2 === null || arg2 === void 0 ? void 0 : arg2.nativeEvent) !== null && _a !== void 0 ? _a : arg1 === null || arg1 === void 0 ? void 0 : arg1.nativeEvent;
69
+ if (nativeEvent && opts.stopClickEventPropagation) {
70
+ nativeEvent.stopPropagation();
71
+ }
72
+ onChange(rowKey);
73
+ } : undefined;
74
+ var defaultElement = /*#__PURE__*/_react.default.createElement(Radio, {
75
+ checked: checked,
76
+ disabled: disabled,
77
+ onChange: defaultOnChange
75
78
  });
79
+ var ctx = {
80
+ type: 'single',
81
+ row: row,
82
+ rowIndex: rowIndex,
83
+ rowKey: rowKey,
84
+ checked: checked,
85
+ disabled: disabled,
86
+ defaultElement: defaultElement,
87
+ actions: {
88
+ select: function select() {
89
+ return onChange(rowKey);
90
+ },
91
+ toggle: function toggle() {
92
+ return onChange(rowKey);
93
+ }
94
+ }
95
+ };
96
+ if (opts.customRender) {
97
+ return opts.customRender(ctx);
98
+ }
99
+ return defaultElement;
76
100
  },
77
101
  features: (0, _extends3.default)((0, _extends3.default)({}, (_e = opts.radioColumn) === null || _e === void 0 ? void 0 : _e.features), (0, _defineProperty2.default)({}, _utils.SINGLE_SELECT_MARK_PROPNAME, true))
78
102
  });
@@ -19,12 +19,15 @@ function getTreeDepth(nodes) {
19
19
  dfs(nodes, 0);
20
20
  return maxDepth;
21
21
  function dfs(columns, depth) {
22
+ var _a;
22
23
  var _iterator = _createForOfIteratorHelper(columns),
23
24
  _step;
24
25
  try {
25
26
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
27
  var column = _step.value;
27
- if ((0, _isLeafNode.default)(column)) {
28
+ var isHeaderMerge = ((_a = column) === null || _a === void 0 ? void 0 : _a.isHeaderMerge) === true;
29
+ // 当列配置了 isHeaderMerge 时,将其视作“可视叶子”,不再深入子层计算深度
30
+ if ((0, _isLeafNode.default)(column) || isHeaderMerge) {
28
31
  maxDepth = Math.max(maxDepth, depth);
29
32
  } else {
30
33
  dfs(column.children, depth + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/table",
3
- "version": "1.2.2-canary.16",
3
+ "version": "1.2.2-canary.18",
4
4
  "description": "金蝶 react table 组件",
5
5
  "title": "table",
6
6
  "keywords": [
@@ -56,6 +56,7 @@
56
56
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --skip-unstable",
57
57
  "pub": "npm run test:all && npm run build && cross-env PUB_ENV=pub np --no-cleanup --no-tests",
58
58
  "pub:canary": "npm run build && cross-env PUB_ENV=pub np --no-cleanup --anyBranch --no-tests --tag=canary",
59
+ "pub:canary-hotfix": "npm run build && cross-env PUB_ENV=pub np --no-cleanup --anyBranch --no-tests --tag=canaryHotFix",
59
60
  "new": "node scripts/create-component.js",
60
61
  "kd-ui": "npm install @kingdee-ui/kui --registry http://npm.kingdee.com/"
61
62
  },