@hi-ui/table 5.0.0-experimental.4 → 5.0.0-rc.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +54 -106
  2. package/lib/cjs/SettingDrawer.js +12 -9
  3. package/lib/cjs/hooks/use-async-switch.js +18 -21
  4. package/lib/cjs/hooks/use-col-width.js +2 -1
  5. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -1
  6. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -1
  7. package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.development.js +1 -1
  8. package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
  9. package/lib/cjs/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/index.js +3 -3
  10. package/lib/esm/SettingDrawer.js +12 -9
  11. package/lib/esm/hooks/use-async-switch.js +18 -21
  12. package/lib/esm/hooks/use-col-width.js +2 -1
  13. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -1
  14. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -1
  15. package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.development.js +1 -1
  16. package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
  17. package/lib/esm/node_modules/{rc-resize-observer/node_modules/react-is → react-is}/index.js +3 -3
  18. package/lib/types/Table.d.ts +4 -4
  19. package/lib/types/TableColumnMenu.d.ts +1 -1
  20. package/lib/types/TbodyContent.d.ts +3 -3
  21. package/lib/types/context.d.ts +54 -54
  22. package/lib/types/hooks/use-async-switch.d.ts +3 -3
  23. package/lib/types/hooks/use-check.d.ts +2 -2
  24. package/lib/types/hooks/use-col-frozen.d.ts +1 -1
  25. package/lib/types/hooks/use-col-hidden.d.ts +3 -2
  26. package/lib/types/hooks/use-col-set.d.ts +1 -1
  27. package/lib/types/hooks/use-col-sorter.d.ts +2 -1
  28. package/lib/types/hooks/use-col-width.d.ts +1 -1
  29. package/lib/types/hooks/use-embed-expand.d.ts +1 -1
  30. package/lib/types/hooks/use-expand.d.ts +2 -2
  31. package/lib/types/hooks/use-pagination.d.ts +2 -2
  32. package/lib/types/types.d.ts +12 -12
  33. package/lib/types/use-table.d.ts +8 -8
  34. package/package.json +37 -37
package/CHANGELOG.md CHANGED
@@ -1,65 +1,6 @@
1
1
  # @hi-ui/table
2
2
 
3
- ## 5.0.0-experimental.4
4
-
5
- ### Patch Changes
6
-
7
- - ebd1a6e7a: fix(table): 修复 stretchHeight 模式下冻结列阴影样式问题 (5.0)
8
- - Updated dependencies [d91a8bb0f]
9
- - @hi-ui/core@5.0.0-experimental.3
10
-
11
- ## 5.0.0-experimental.3
12
-
13
- ### Patch Changes
14
-
15
- - 96aeb5a9a: fix(table): fix sorter ui bug (5.0)
16
-
17
- ## 5.0.0-experimental.2
18
-
19
- ### Minor Changes
20
-
21
- - 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
22
-
23
- ### Patch Changes
24
-
25
- - eb17c4697: style: 修复 UI/样式问题 (5.0)
26
- - Updated dependencies [7f204c892]
27
- - Updated dependencies [eb17c4697]
28
- - Updated dependencies [eb17c4697]
29
- - Updated dependencies [c407744fe]
30
- - Updated dependencies [ec647a5ee]
31
- - Updated dependencies [59cef699f]
32
- - @hi-ui/icons@5.0.0-experimental.1
33
- - @hi-ui/core@5.0.0-experimental.1
34
- - @hi-ui/button@5.0.0-experimental.1
35
- - @hi-ui/checkbox@5.0.0-experimental.1
36
- - @hi-ui/drawer@5.0.0-experimental.1
37
- - @hi-ui/empty-state@5.0.0-experimental.1
38
- - @hi-ui/icon-button@5.0.0-experimental.1
39
- - @hi-ui/loading@5.0.0-experimental.1
40
- - @hi-ui/pagination@5.0.0-experimental.1
41
- - @hi-ui/popper@5.0.0-experimental.1
42
- - @hi-ui/radio@5.0.0-experimental.1
43
- - @hi-ui/scrollbar@5.0.0-experimental.1
44
- - @hi-ui/select@5.0.0-experimental.2
45
- - @hi-ui/use-merge-semantic@5.0.0-experimental.0
46
- - @hi-ui/spinner@5.0.0-experimental.1
47
-
48
- ## 5.0.0-experimental.1
49
-
50
- ### Patch Changes
51
-
52
- - dad50a380: style(table): 修改斑马纹颜色为 bgColor token (5.0)
53
- - 18a876ca6: style(table): 扩大排序按钮点击区域 (5.0)
54
- - 发布 hiui experimental 版本
55
- - 3d84a04aa: fix(table): 修复 stretchHeight+bordered 模式下数据为空时左右边框未显示问题 (5.0)
56
- - cfdc94dbc: fix(table): 计算每列 top 值优化,只有在需要 sticky 的场景下才设置该值 (5.0)
57
- - Updated dependencies [8f23e9322]
58
- - Updated dependencies [b27483796]
59
- - Updated dependencies
60
- - @hi-ui/select@5.0.0-experimental.1
61
-
62
- ## 5.0.0-experimental.0
3
+ ## 5.0.0-rc.0
63
4
 
64
5
  ### Major Changes
65
6
 
@@ -72,32 +13,34 @@
72
13
  - aebefd73e: feat(table): add onScroll api (5.0)
73
14
  - 9f4268ee3: feat(table): TableColumnItem 支持泛型 (5.0)
74
15
  - d51de8acc: feat(table): add stretchHeight api (5.0)
16
+ - 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
75
17
 
76
18
  ### Patch Changes
77
19
 
78
20
  - 4a31cea53: style: 统一调整组件 shadow (5.0)
79
21
  - 9b34d99bc: chore: 将代码中 v4 改为 v5 (5.0)
80
- - 1662753e0: style: fix ui bug (5.0)
81
22
  - e5964c571: style(table): 修复虚拟表格中多选列没有居中问题 (5.0)
82
23
  - d2cdb2537: fix(table): 修复在 stretchHeight 模式下,冻结列表头和单元格层级问题 (5.0)
24
+ - dad50a380: style(table): 修改斑马纹颜色为 bgColor token (5.0)
83
25
  - 619e031ab: style(table): update hover and striped row background colors for improved visibility (5.0)
84
26
  - 76cfe571b: style(table): 修复虚拟表格下 align 设置无效问题 (5.0)
85
27
  - 8c0ee78f0: perf: 优化全局 size 配置,对于组件中没有的 size 值,取最接近的尺寸展示 (5.0)
86
28
  - 9b34d99bc: fix: 修复 5.0 UI 问题 (5.0)
29
+ - ebd1a6e7a: fix(table): 修复 stretchHeight 模式下冻结列阴影样式问题 (5.0)
87
30
  - ea9d00628: fix(table): 修复表头分组数据为空时表头显示异常问题,当 data 为空时,使用双表格 (5.0)
88
- - be5a59325: style: 修改样式问题 (5.0)
89
31
  - fc7f381ff: perf(table): add cell class prefix to TbodyContent and adjust useColWidth debounce timing (5.0)
90
- - 71fc15e5c: style: 修改样式问题 (5.0)
91
32
  - b6a389ac1: perf(table): 优化表格列宽更新逻辑,当内容宽度没有超出时再更新列宽 (5.0)
92
33
  - 79ea480f3: feat(global-context): 增加 size api 全局配置 (5.0)
34
+ - 18a876ca6: style(table): 扩大排序按钮点击区域 (5.0)
93
35
  - e2f69cb62: refactor(table): stretchHeight 模式不再使用双表格结构,使用 sticky 实现 (5.0)
94
36
  - 2e56529f7: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
95
37
  - eb718e940: fix: 修改组件问题 (5.0)
96
38
  - 150e813bf: fix(table): 优化 useColSorter 钩子,移除不必要的 columnsLatestRef 引用,直接使用 columns 进行排序计算 (5.0)
39
+ - eb17c4697: style: 修复 UI/样式问题 (5.0)
40
+ - 96aeb5a9a: fix(table): fix sorter ui bug (5.0)
97
41
  - ac15c6141: <br />
98
42
  - fix(table): 修改表格在外层是 scale 时导致列宽计算有误的问题 (5.0)
99
43
  - fix(loading): 修改 loading size 类型,移除 xs 尺寸 (5.0)
100
- - e2d184e74: style: 修改 UI 问题 (5.0)
101
44
  - 6ac7e8eb2: chore(table): export SettingDrawer types (5.0)
102
45
  - ded9bb6d6: <br>
103
46
  - perf(table): 优化列宽更新逻辑,当 columns 长度和 dataKey、width 发生变化时,重新计算列宽 (5.0)
@@ -107,22 +50,23 @@
107
50
  - fix(table): 标题去掉背景,头部加上边框 (5.0)
108
51
  - fix(table): 单元格间距调整 & 设置最小高度 (5.0)
109
52
  - fix(table): 不同尺寸修改 (5.0)
53
+ - 3d84a04aa: fix(table): 修复 stretchHeight+bordered 模式下数据为空时左右边框未显示问题 (5.0)
110
54
  - 33da3144e: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
111
- - 7f3abee55: style: fix ui bug (5.0)
112
55
  - 478b51050: fix(table): 修复标题过长时,列头宽度拉宽后无法缩小的问题 (5.0)
113
- - a0f0c9d6b: style: 修改 UI 问题 (5.0)
114
56
  - e3a854122: refactor(table): 调整列宽计算逻辑,兼容表头分组和单元格合并场景 (5.0)
57
+ - cfdc94dbc: fix(table): 计算每列 top 值优化,只有在需要 sticky 的场景下才设置该值 (5.0)
58
+ - 6ae564d44: fix(table): 修复 SettingDrawer 打开时会触发 onReset 问题 (5.0)
115
59
  - Updated dependencies [20aac2a2f]
116
- - Updated dependencies [6fb223e3a]
117
60
  - Updated dependencies [4a31cea53]
118
61
  - Updated dependencies [0f7aac2f3]
119
62
  - Updated dependencies [1e226cd66]
120
63
  - Updated dependencies [eea29eade]
121
64
  - Updated dependencies [b9989e482]
65
+ - Updated dependencies [7f204c892]
122
66
  - Updated dependencies [6167ad50b]
123
- - Updated dependencies [1662753e0]
124
67
  - Updated dependencies [122d1d859]
125
68
  - Updated dependencies [f1ab51725]
69
+ - Updated dependencies [eb17c4697]
126
70
  - Updated dependencies [cf89262c7]
127
71
  - Updated dependencies [8c0ee78f0]
128
72
  - Updated dependencies [9b34d99bc]
@@ -131,18 +75,20 @@
131
75
  - Updated dependencies [423aab762]
132
76
  - Updated dependencies [fd4c20bbd]
133
77
  - Updated dependencies [08b9d0ecf]
134
- - Updated dependencies [be5a59325]
135
- - Updated dependencies [71fc15e5c]
136
78
  - Updated dependencies [b6a389ac1]
137
79
  - Updated dependencies [f8acad4e1]
138
80
  - Updated dependencies [79ea480f3]
139
81
  - Updated dependencies [2e56529f7]
140
82
  - Updated dependencies [eb718e940]
83
+ - Updated dependencies [3a7186e4b]
141
84
  - Updated dependencies [277c5033a]
142
85
  - Updated dependencies [4e0ed3a31]
143
86
  - Updated dependencies [95abba983]
87
+ - Updated dependencies [8f23e9322]
144
88
  - Updated dependencies [8a92ec660]
89
+ - Updated dependencies [b27483796]
145
90
  - Updated dependencies [1429eced2]
91
+ - Updated dependencies [eb17c4697]
146
92
  - Updated dependencies [ac15c6141]
147
93
  - Updated dependencies [976ec929d]
148
94
  - Updated dependencies [f1ab51725]
@@ -150,57 +96,59 @@
150
96
  - Updated dependencies [de8d058dc]
151
97
  - Updated dependencies [5210770d9]
152
98
  - Updated dependencies [4006b2c8c]
99
+ - Updated dependencies [c407744fe]
100
+ - Updated dependencies [d91a8bb0f]
153
101
  - Updated dependencies [77d969c2e]
154
102
  - Updated dependencies [2f850ad84]
155
103
  - Updated dependencies [3457a6f7d]
156
104
  - Updated dependencies [4006b2c8c]
157
105
  - Updated dependencies [e42e2badf]
106
+ - Updated dependencies [ec647a5ee]
158
107
  - Updated dependencies [33da3144e]
159
- - Updated dependencies [0a8cc07a7]
160
- - Updated dependencies [7f3abee55]
161
108
  - Updated dependencies [0a4e90dbd]
162
109
  - Updated dependencies [58ad82e94]
163
- - Updated dependencies [a0f0c9d6b]
164
110
  - Updated dependencies [4a31cea53]
111
+ - Updated dependencies [95d930354]
165
112
  - Updated dependencies [f2be367e9]
166
113
  - Updated dependencies [1972fd16a]
114
+ - Updated dependencies [59cef699f]
167
115
  - Updated dependencies [99801c2d1]
168
- - Updated dependencies [86910f5e2]
169
116
  - Updated dependencies [cb7b794d0]
170
117
  - Updated dependencies [dd60555d3]
171
118
  - Updated dependencies [f9c4afd14]
172
- - @hi-ui/radio@5.0.0-experimental.0
173
- - @hi-ui/pagination@5.0.0-experimental.0
174
- - @hi-ui/drawer@5.0.0-experimental.0
175
- - @hi-ui/loading@5.0.0-experimental.0
176
- - @hi-ui/popper@5.0.0-experimental.0
177
- - @hi-ui/button@5.0.0-experimental.0
178
- - @hi-ui/select@5.0.0-experimental.0
179
- - @hi-ui/empty-state@5.0.0-experimental.0
180
- - @hi-ui/icons@5.0.0-experimental.0
181
- - @hi-ui/icon-button@5.0.0-experimental.0
182
- - @hi-ui/core@5.0.0-experimental.0
183
- - @hi-ui/use-cache@5.0.0-experimental.0
184
- - @hi-ui/use-check@5.0.0-experimental.0
185
- - @hi-ui/use-check-state@5.0.0-experimental.0
186
- - @hi-ui/use-drag-sorter@5.0.0-experimental.0
187
- - @hi-ui/use-latest@5.0.0-experimental.0
188
- - @hi-ui/use-toggle@5.0.0-experimental.0
189
- - @hi-ui/use-uncontrolled-state@5.0.0-experimental.0
190
- - @hi-ui/use-update-effect@5.0.0-experimental.0
191
- - @hi-ui/checkbox@5.0.0-experimental.0
192
- - @hi-ui/scrollbar@5.0.0-experimental.0
193
- - @hi-ui/spinner@5.0.0-experimental.0
194
- - @hi-ui/array-utils@5.0.0-experimental.0
195
- - @hi-ui/classname@5.0.0-experimental.0
196
- - @hi-ui/dom-utils@5.0.0-experimental.0
197
- - @hi-ui/env@5.0.0-experimental.0
198
- - @hi-ui/func-utils@5.0.0-experimental.0
199
- - @hi-ui/object-utils@5.0.0-experimental.0
200
- - @hi-ui/react-utils@5.0.0-experimental.0
201
- - @hi-ui/times@5.0.0-experimental.0
202
- - @hi-ui/tree-utils@5.0.0-experimental.0
203
- - @hi-ui/type-assertion@5.0.0-experimental.0
119
+ - @hi-ui/radio@5.0.0-rc.0
120
+ - @hi-ui/drawer@5.0.0-rc.0
121
+ - @hi-ui/loading@5.0.0-rc.0
122
+ - @hi-ui/popper@5.0.0-rc.0
123
+ - @hi-ui/button@5.0.0-rc.0
124
+ - @hi-ui/select@5.0.0-rc.0
125
+ - @hi-ui/icons@5.0.0-rc.0
126
+ - @hi-ui/empty-state@5.0.0-rc.0
127
+ - @hi-ui/core@5.0.0-rc.0
128
+ - @hi-ui/pagination@5.0.0-rc.0
129
+ - @hi-ui/use-cache@5.0.0-rc.0
130
+ - @hi-ui/use-check@5.0.0-rc.0
131
+ - @hi-ui/use-check-state@5.0.0-rc.0
132
+ - @hi-ui/use-drag-sorter@5.0.0-rc.0
133
+ - @hi-ui/use-latest@5.0.0-rc.0
134
+ - @hi-ui/use-toggle@5.0.0-rc.0
135
+ - @hi-ui/use-uncontrolled-state@5.0.0-rc.0
136
+ - @hi-ui/use-update-effect@5.0.0-rc.0
137
+ - @hi-ui/checkbox@5.0.0-rc.0
138
+ - @hi-ui/icon-button@5.0.0-rc.0
139
+ - @hi-ui/scrollbar@5.0.0-rc.0
140
+ - @hi-ui/spinner@5.0.0-rc.0
141
+ - @hi-ui/array-utils@5.0.0-rc.0
142
+ - @hi-ui/classname@5.0.0-rc.0
143
+ - @hi-ui/dom-utils@5.0.0-rc.0
144
+ - @hi-ui/env@5.0.0-rc.0
145
+ - @hi-ui/func-utils@5.0.0-rc.0
146
+ - @hi-ui/object-utils@5.0.0-rc.0
147
+ - @hi-ui/react-utils@5.0.0-rc.0
148
+ - @hi-ui/times@5.0.0-rc.0
149
+ - @hi-ui/tree-utils@5.0.0-rc.0
150
+ - @hi-ui/type-assertion@5.0.0-rc.0
151
+ - @hi-ui/use-merge-semantic@5.0.0-rc.0
204
152
 
205
153
  ## 4.12.3
206
154
 
@@ -122,19 +122,22 @@ var SettingDrawer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
122
122
  var _useUncontrolledState = useUncontrolledState.useUncontrolledState(false, visibleProp, _onClose),
123
123
  visible = _useUncontrolledState[0],
124
124
  setVisible = _useUncontrolledState[1];
125
- var resetLatest = useLatest.useLatestCallback(function () {
125
+ var syncCacheLatest = useLatest.useLatestCallback(function () {
126
126
  setCacheHiddenColKeys(hiddenColKeys);
127
127
  setCacheSortedCols(sortedCols);
128
- onReset === null || onReset === void 0 ? void 0 : onReset();
129
128
  });
130
- // visible false 变为 true 时触发
131
- var prevShowPopperRef = React.useRef(!visible);
129
+ // 仅在 visible 真正由 false -> true 时触发,避免首次 visible=true 误触发
130
+ var prevVisibleRef = React.useRef(visible);
132
131
  React.useEffect(function () {
133
- if (!prevShowPopperRef.current && visible) {
134
- resetLatest();
132
+ if (!prevVisibleRef.current && visible) {
133
+ syncCacheLatest();
135
134
  }
136
- prevShowPopperRef.current = visible;
137
- }, [visible, resetLatest]);
135
+ prevVisibleRef.current = visible;
136
+ }, [visible, syncCacheLatest]);
137
+ var handleReset = useLatest.useLatestCallback(function () {
138
+ syncCacheLatest();
139
+ onReset === null || onReset === void 0 ? void 0 : onReset();
140
+ });
138
141
  var onConfirm = function onConfirm() {
139
142
  var newSortKeys = cacheSortedCols.map(function (col) {
140
143
  return col.dataKey;
@@ -184,7 +187,7 @@ var SettingDrawer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
184
187
  }, showCheckAll && CheckAllContent), /*#__PURE__*/React__default["default"].createElement("div", {
185
188
  className: prefixCls + "-footer__action"
186
189
  }, /*#__PURE__*/React__default["default"].createElement(button.Button, {
187
- onClick: resetLatest
190
+ onClick: handleReset
188
191
  }, i18n.get('table.reset')), /*#__PURE__*/React__default["default"].createElement(button.Button, {
189
192
  onClick: onConfirm,
190
193
  type: "primary"
@@ -64,56 +64,53 @@ var useAsyncSwitch = function useAsyncSwitch(_ref) {
64
64
  addLoadingIds = _useCheckState.add,
65
65
  removeLoadingIds = _useCheckState.remove;
66
66
  var onExpandLatest = useLatest.useLatestCallback(onExpand);
67
- var onNodeSwitch = React.useCallback(function (node_1) {
68
- for (var _len = arguments.length, args_1 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
69
- args_1[_key - 1] = arguments[_key];
67
+ var onNodeSwitch = React.useCallback(function (node, onlyExpand) {
68
+ if (onlyExpand === void 0) {
69
+ onlyExpand = false;
70
70
  }
71
- return tslib.__awaiter(void 0, [node_1].concat(args_1), void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(node, onlyExpand) {
71
+ return tslib.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
72
72
  var id, children, isLeaf;
73
73
  return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
74
74
  while (1) {
75
75
  switch (_context2.prev = _context2.next) {
76
76
  case 0:
77
- if (onlyExpand === void 0) {
78
- onlyExpand = false;
79
- }
80
77
  // 直接触发选中该节点
81
78
  onExpandLatest(node, onlyExpand);
82
79
  id = node.id, children = node.children, isLeaf = node.isLeaf;
83
80
  if (!children) {
84
- _context2.next = 5;
81
+ _context2.next = 4;
85
82
  break;
86
83
  }
87
84
  return _context2.abrupt("return");
88
- case 5:
85
+ case 4:
89
86
  if (!isLeaf) {
90
- _context2.next = 7;
87
+ _context2.next = 6;
91
88
  break;
92
89
  }
93
90
  return _context2.abrupt("return");
94
- case 7:
91
+ case 6:
95
92
  if (!onLoadChildren) {
96
- _context2.next = 18;
93
+ _context2.next = 17;
97
94
  break;
98
95
  }
99
96
  addLoadingIds(id);
100
- _context2.prev = 9;
101
- _context2.next = 12;
97
+ _context2.prev = 8;
98
+ _context2.next = 11;
102
99
  return loadChildren(node);
103
- case 12:
100
+ case 11:
104
101
  removeLoadingIds(id);
105
- _context2.next = 18;
102
+ _context2.next = 17;
106
103
  break;
107
- case 15:
108
- _context2.prev = 15;
109
- _context2.t0 = _context2["catch"](9);
104
+ case 14:
105
+ _context2.prev = 14;
106
+ _context2.t0 = _context2["catch"](8);
110
107
  removeLoadingIds(id);
111
- case 18:
108
+ case 17:
112
109
  case "end":
113
110
  return _context2.stop();
114
111
  }
115
112
  }
116
- }, _callee2, null, [[9, 15]]);
113
+ }, _callee2, null, [[8, 14]]);
117
114
  }));
118
115
  }, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
119
116
  var isLoadingId = function isLoadingId(id) {
@@ -187,6 +187,7 @@ var useColWidth = function useColWidth(_ref) {
187
187
  if (headerTableElement) {
188
188
  resizeObserver = new ResizeObserver(function () {
189
189
  var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index$1) {
190
+ var _a;
190
191
  var _getGroupItemWidth2 = index.getGroupItemWidth(columns),
191
192
  colWidths = _getGroupItemWidth2.colWidths,
192
193
  minColWidths = _getGroupItemWidth2.minColWidths;
@@ -199,7 +200,7 @@ var useColWidth = function useColWidth(_ref) {
199
200
  var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
200
201
  var childNode = Array.from(th.childNodes)[0];
201
202
  // 计算真实标题内容宽度
202
- var childNodeWidth = (childNode === null || childNode === void 0 ? void 0 : childNode.offsetWidth) + thPaddingLeft * 2;
203
+ var childNodeWidth = ((_a = childNode) === null || _a === void 0 ? void 0 : _a.offsetWidth) + thPaddingLeft * 2;
203
204
  // 如果设置的标题宽度小于真实内容宽度,则使用设置的宽度,否则使用真实内容宽度
204
205
  if (colWidth && colWidth < childNodeWidth) {
205
206
  return colWidth;
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', {
14
14
  value: true
15
15
  });
16
16
  var React = require('react');
17
- require('../../../react-is/index.js');
17
+ require('../../../../../react-is/index.js');
18
18
  var index = require('../../../../../../_virtual/index2.js');
19
19
  function _interopDefaultCompat(e) {
20
20
  return e && _typeof(e) === 'object' && 'default' in e ? e : {
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', {
14
14
  value: true
15
15
  });
16
16
  var _typeof = require('@babel/runtime/helpers/esm/typeof');
17
- require('../../react-is/index.js');
17
+ require('../../../../react-is/index.js');
18
18
  var index = require('../../../../../_virtual/index2.js');
19
19
  function _interopDefaultCompat(e) {
20
20
  return e && _typeof2(e) === 'object' && 'default' in e ? e : {
@@ -13,7 +13,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
13
13
  Object.defineProperty(exports, '__esModule', {
14
14
  value: true
15
15
  });
16
- var reactIs_development = require('../../../../../_virtual/react-is.development.js');
16
+ var reactIs_development = require('../../../_virtual/react-is.development.js');
17
17
 
18
18
  /** @license React v16.13.1
19
19
  * react-is.development.js
@@ -13,7 +13,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
13
13
  Object.defineProperty(exports, '__esModule', {
14
14
  value: true
15
15
  });
16
- var reactIs_production_min = require('../../../../../_virtual/react-is.production.min.js');
16
+ var reactIs_production_min = require('../../../_virtual/react-is.production.min.js');
17
17
 
18
18
  /** @license React v16.13.1
19
19
  * react-is.production.min.js
@@ -9,11 +9,11 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
- var index = require('../../../../_virtual/index2.js');
12
+ var index = require('../../_virtual/index2.js');
13
13
  require('./cjs/react-is.production.min.js');
14
14
  require('./cjs/react-is.development.js');
15
- var reactIs_production_min = require('../../../../_virtual/react-is.production.min.js');
16
- var reactIs_development = require('../../../../_virtual/react-is.development.js');
15
+ var reactIs_production_min = require('../../_virtual/react-is.production.min.js');
16
+ var reactIs_development = require('../../_virtual/react-is.development.js');
17
17
  if (process.env.NODE_ENV === 'production') {
18
18
  index.reactIs.exports = reactIs_production_min.__exports;
19
19
  } else {
@@ -109,19 +109,22 @@ var SettingDrawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
109
109
  var _useUncontrolledState = useUncontrolledState(false, visibleProp, _onClose),
110
110
  visible = _useUncontrolledState[0],
111
111
  setVisible = _useUncontrolledState[1];
112
- var resetLatest = useLatestCallback(function () {
112
+ var syncCacheLatest = useLatestCallback(function () {
113
113
  setCacheHiddenColKeys(hiddenColKeys);
114
114
  setCacheSortedCols(sortedCols);
115
- onReset === null || onReset === void 0 ? void 0 : onReset();
116
115
  });
117
- // visible false 变为 true 时触发
118
- var prevShowPopperRef = useRef(!visible);
116
+ // 仅在 visible 真正由 false -> true 时触发,避免首次 visible=true 误触发
117
+ var prevVisibleRef = useRef(visible);
119
118
  useEffect(function () {
120
- if (!prevShowPopperRef.current && visible) {
121
- resetLatest();
119
+ if (!prevVisibleRef.current && visible) {
120
+ syncCacheLatest();
122
121
  }
123
- prevShowPopperRef.current = visible;
124
- }, [visible, resetLatest]);
122
+ prevVisibleRef.current = visible;
123
+ }, [visible, syncCacheLatest]);
124
+ var handleReset = useLatestCallback(function () {
125
+ syncCacheLatest();
126
+ onReset === null || onReset === void 0 ? void 0 : onReset();
127
+ });
125
128
  var onConfirm = function onConfirm() {
126
129
  var newSortKeys = cacheSortedCols.map(function (col) {
127
130
  return col.dataKey;
@@ -171,7 +174,7 @@ var SettingDrawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
171
174
  }, showCheckAll && CheckAllContent), /*#__PURE__*/React__default.createElement("div", {
172
175
  className: prefixCls + "-footer__action"
173
176
  }, /*#__PURE__*/React__default.createElement(Button, {
174
- onClick: resetLatest
177
+ onClick: handleReset
175
178
  }, i18n.get('table.reset')), /*#__PURE__*/React__default.createElement(Button, {
176
179
  onClick: onConfirm,
177
180
  type: "primary"
@@ -52,56 +52,53 @@ var useAsyncSwitch = function useAsyncSwitch(_ref) {
52
52
  addLoadingIds = _useCheckState.add,
53
53
  removeLoadingIds = _useCheckState.remove;
54
54
  var onExpandLatest = useLatestCallback(onExpand);
55
- var onNodeSwitch = useCallback(function (node_1) {
56
- for (var _len = arguments.length, args_1 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
57
- args_1[_key - 1] = arguments[_key];
55
+ var onNodeSwitch = useCallback(function (node, onlyExpand) {
56
+ if (onlyExpand === void 0) {
57
+ onlyExpand = false;
58
58
  }
59
- return __awaiter(void 0, [node_1].concat(args_1), void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(node, onlyExpand) {
59
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
60
60
  var id, children, isLeaf;
61
61
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
62
62
  while (1) {
63
63
  switch (_context2.prev = _context2.next) {
64
64
  case 0:
65
- if (onlyExpand === void 0) {
66
- onlyExpand = false;
67
- }
68
65
  // 直接触发选中该节点
69
66
  onExpandLatest(node, onlyExpand);
70
67
  id = node.id, children = node.children, isLeaf = node.isLeaf;
71
68
  if (!children) {
72
- _context2.next = 5;
69
+ _context2.next = 4;
73
70
  break;
74
71
  }
75
72
  return _context2.abrupt("return");
76
- case 5:
73
+ case 4:
77
74
  if (!isLeaf) {
78
- _context2.next = 7;
75
+ _context2.next = 6;
79
76
  break;
80
77
  }
81
78
  return _context2.abrupt("return");
82
- case 7:
79
+ case 6:
83
80
  if (!onLoadChildren) {
84
- _context2.next = 18;
81
+ _context2.next = 17;
85
82
  break;
86
83
  }
87
84
  addLoadingIds(id);
88
- _context2.prev = 9;
89
- _context2.next = 12;
85
+ _context2.prev = 8;
86
+ _context2.next = 11;
90
87
  return loadChildren(node);
91
- case 12:
88
+ case 11:
92
89
  removeLoadingIds(id);
93
- _context2.next = 18;
90
+ _context2.next = 17;
94
91
  break;
95
- case 15:
96
- _context2.prev = 15;
97
- _context2.t0 = _context2["catch"](9);
92
+ case 14:
93
+ _context2.prev = 14;
94
+ _context2.t0 = _context2["catch"](8);
98
95
  removeLoadingIds(id);
99
- case 18:
96
+ case 17:
100
97
  case "end":
101
98
  return _context2.stop();
102
99
  }
103
100
  }
104
- }, _callee2, null, [[9, 15]]);
101
+ }, _callee2, null, [[8, 14]]);
105
102
  }));
106
103
  }, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
107
104
  var isLoadingId = function isLoadingId(id) {
@@ -175,6 +175,7 @@ var useColWidth = function useColWidth(_ref) {
175
175
  if (headerTableElement) {
176
176
  resizeObserver = new ResizeObserver(function () {
177
177
  var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index) {
178
+ var _a;
178
179
  var _getGroupItemWidth2 = getGroupItemWidth(columns),
179
180
  colWidths = _getGroupItemWidth2.colWidths,
180
181
  minColWidths = _getGroupItemWidth2.minColWidths;
@@ -187,7 +188,7 @@ var useColWidth = function useColWidth(_ref) {
187
188
  var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
188
189
  var childNode = Array.from(th.childNodes)[0];
189
190
  // 计算真实标题内容宽度
190
- var childNodeWidth = (childNode === null || childNode === void 0 ? void 0 : childNode.offsetWidth) + thPaddingLeft * 2;
191
+ var childNodeWidth = ((_a = childNode) === null || _a === void 0 ? void 0 : _a.offsetWidth) + thPaddingLeft * 2;
191
192
  // 如果设置的标题宽度小于真实内容宽度,则使用设置的宽度,否则使用真实内容宽度
192
193
  if (colWidth && colWidth < childNodeWidth) {
193
194
  return colWidth;
@@ -8,7 +8,7 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import React__default from 'react';
11
- import '../../../react-is/index.js';
11
+ import '../../../../../react-is/index.js';
12
12
  import { r as reactIs } from '../../../../../../_virtual/index2.js';
13
13
  function toArray(children) {
14
14
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -8,7 +8,7 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import _typeof from '@babel/runtime/helpers/esm/typeof';
11
- import '../../react-is/index.js';
11
+ import '../../../../react-is/index.js';
12
12
  import { r as reactIs } from '../../../../../_virtual/index2.js';
13
13
  function fillRef(ref, node) {
14
14
  if (typeof ref === 'function') {
@@ -8,7 +8,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
- import { __exports as reactIs_development } from '../../../../../_virtual/react-is.development.js';
11
+ import { __exports as reactIs_development } from '../../../_virtual/react-is.development.js';
12
12
 
13
13
  /** @license React v16.13.1
14
14
  * react-is.development.js
@@ -8,7 +8,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
- import { __exports as reactIs_production_min } from '../../../../../_virtual/react-is.production.min.js';
11
+ import { __exports as reactIs_production_min } from '../../../_virtual/react-is.production.min.js';
12
12
 
13
13
  /** @license React v16.13.1
14
14
  * react-is.production.min.js
@@ -7,11 +7,11 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- import { r as reactIs } from '../../../../_virtual/index2.js';
10
+ import { r as reactIs } from '../../_virtual/index2.js';
11
11
  import './cjs/react-is.production.min.js';
12
12
  import './cjs/react-is.development.js';
13
- import { __exports as reactIs_production_min } from '../../../../_virtual/react-is.production.min.js';
14
- import { __exports as reactIs_development } from '../../../../_virtual/react-is.development.js';
13
+ import { __exports as reactIs_production_min } from '../../_virtual/react-is.production.min.js';
14
+ import { __exports as reactIs_development } from '../../_virtual/react-is.development.js';
15
15
  if (process.env.NODE_ENV === 'production') {
16
16
  reactIs.exports = reactIs_production_min;
17
17
  } else {