@hi-ui/table 5.0.0-canary.3 → 5.0.0-canary.30

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 (59) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/lib/cjs/BaseTable.js +76 -40
  3. package/lib/cjs/Table.js +13 -4
  4. package/lib/cjs/TableBody.js +40 -17
  5. package/lib/cjs/TableCell.js +2 -2
  6. package/lib/cjs/TableColumnMenu.js +2 -1
  7. package/lib/cjs/TableSettingMenu.js +1 -0
  8. package/lib/cjs/TbodyContent.js +59 -6
  9. package/lib/cjs/TheadContent.js +22 -5
  10. package/lib/cjs/hooks/use-col-sorter.js +2 -4
  11. package/lib/cjs/hooks/use-col-width.js +86 -62
  12. package/lib/cjs/hooks/use-colgroup.js +1 -1
  13. package/lib/cjs/icons/index.js +3 -1
  14. package/lib/cjs/styles/index.scss.js +1 -1
  15. package/lib/cjs/use-table.js +50 -16
  16. package/lib/cjs/utils/index.js +35 -9
  17. package/lib/esm/BaseTable.js +78 -42
  18. package/lib/esm/Table.js +11 -3
  19. package/lib/esm/TableBody.js +41 -18
  20. package/lib/esm/TableCell.js +2 -2
  21. package/lib/esm/TableColumnMenu.js +2 -1
  22. package/lib/esm/TableSettingMenu.js +1 -0
  23. package/lib/esm/TbodyContent.js +62 -9
  24. package/lib/esm/TheadContent.js +23 -6
  25. package/lib/esm/hooks/use-col-sorter.js +2 -4
  26. package/lib/esm/hooks/use-col-width.js +86 -62
  27. package/lib/esm/hooks/use-colgroup.js +1 -1
  28. package/lib/esm/icons/index.js +3 -1
  29. package/lib/esm/styles/index.scss.js +1 -1
  30. package/lib/esm/use-table.js +51 -17
  31. package/lib/esm/utils/index.js +35 -10
  32. package/lib/types/BaseTable.d.ts +9 -2
  33. package/lib/types/SettingDrawer.d.ts +3 -0
  34. package/lib/types/TableBody.d.ts +4 -1
  35. package/lib/types/context.d.ts +97 -77
  36. package/lib/types/hooks/use-col-frozen.d.ts +1 -1
  37. package/lib/types/hooks/use-col-hidden.d.ts +1 -1
  38. package/lib/types/hooks/use-col-width.d.ts +2 -2
  39. package/lib/types/index.d.ts +1 -1
  40. package/lib/types/types.d.ts +20 -9
  41. package/lib/types/use-table.d.ts +11 -3
  42. package/lib/types/utils/index.d.ts +6 -1
  43. package/package.json +37 -36
  44. package/lib/cjs/packages/ui/radio/lib/esm/Radio.js +0 -100
  45. package/lib/cjs/packages/ui/radio/lib/esm/RadioGroup.js +0 -104
  46. package/lib/cjs/packages/ui/radio/lib/esm/context.js +0 -37
  47. package/lib/cjs/packages/ui/radio/lib/esm/index.js +0 -33
  48. package/lib/cjs/packages/ui/radio/lib/esm/styles/index.scss.js +0 -35
  49. package/lib/cjs/packages/ui/radio/lib/esm/types.js +0 -34
  50. package/lib/cjs/packages/ui/radio/lib/esm/use-radio-group.js +0 -61
  51. package/lib/cjs/packages/ui/radio/lib/esm/use-radio.js +0 -88
  52. package/lib/esm/packages/ui/radio/lib/esm/Radio.js +0 -88
  53. package/lib/esm/packages/ui/radio/lib/esm/RadioGroup.js +0 -92
  54. package/lib/esm/packages/ui/radio/lib/esm/context.js +0 -31
  55. package/lib/esm/packages/ui/radio/lib/esm/index.js +0 -26
  56. package/lib/esm/packages/ui/radio/lib/esm/styles/index.scss.js +0 -23
  57. package/lib/esm/packages/ui/radio/lib/esm/types.js +0 -27
  58. package/lib/esm/packages/ui/radio/lib/esm/use-radio-group.js +0 -56
  59. package/lib/esm/packages/ui/radio/lib/esm/use-radio.js +0 -83
package/CHANGELOG.md CHANGED
@@ -1,5 +1,373 @@
1
1
  # @hi-ui/table
2
2
 
3
+ ## 5.0.0-canary.30
4
+
5
+ ### Patch Changes
6
+
7
+ - dad50a380: style(table): 修改斑马纹颜色为 bgColor token (5.0)
8
+ - 18a876ca6: style(table): 扩大排序按钮点击区域 (5.0)
9
+ - cfdc94dbc: fix(table): 计算每列 top 值优化,只有在需要 sticky 的场景下才设置该值 (5.0)
10
+ - Updated dependencies [8f23e9322]
11
+ - Updated dependencies [b27483796]
12
+ - @hi-ui/select@5.0.0-canary.16
13
+
14
+ ## 5.0.0-canary.29
15
+
16
+ ### Patch Changes
17
+
18
+ - 3d84a04aa: fix(table): 修复 stretchHeight+bordered 模式下数据为空时左右边框未显示问题 (5.0)
19
+
20
+ ## 5.0.0-canary.28
21
+
22
+ ### Minor Changes
23
+
24
+ - df301c0dc: feat(table): 普通表格支持 scrollTo 方法 (5.0)
25
+ - aebefd73e: feat(table): add onScroll api (5.0)
26
+
27
+ ### Patch Changes
28
+
29
+ - e5964c571: style(table): 修复虚拟表格中多选列没有居中问题 (5.0)
30
+ - 76cfe571b: style(table): 修复虚拟表格下 align 设置无效问题 (5.0)
31
+
32
+ ## 5.0.0-canary.27
33
+
34
+ ### Patch Changes
35
+
36
+ - ad4a6d87b: style(table): update hover and striped row background colors for improved visibility (5.0)
37
+ - 0a7a9e236: perf(table): add cell class prefix to TbodyContent and adjust useColWidth debounce timing (5.0)
38
+
39
+ ## 5.0.0-canary.26
40
+
41
+ ### Patch Changes
42
+
43
+ - 56c9f5a2b: fix(table): 修复在 stretchHeight 模式下,冻结列表头和单元格层级问题 (5.0)
44
+ - 50a17ebf2: fix(table): 修复表头分组数据为空时表头显示异常问题,当 data 为空时,使用双表格 (5.0)
45
+ - f95f06844: fix(table): 修复标题过长时,列头宽度拉宽后无法缩小的问题 (5.0)
46
+ - 14fa87a0f: refactor(table): 调整列宽计算逻辑,兼容表头分组和单元格合并场景 (5.0)
47
+
48
+ ## 5.0.0-canary.25
49
+
50
+ ### Patch Changes
51
+
52
+ - d5092f349: refactor(table): stretchHeight 模式不再使用双表格结构,使用 sticky 实现 (5.0)
53
+ - Updated dependencies [c6c0159c4]
54
+ - @hi-ui/icons@5.0.0-canary.9
55
+
56
+ ## 5.0.0-canary.24
57
+
58
+ ### Patch Changes
59
+
60
+ - 732decb61: perf(table): 优化表格列宽更新逻辑,当内容宽度没有超出时再更新列宽 (5.0)
61
+ - Updated dependencies [732decb61]
62
+ - @hi-ui/empty-state@5.0.0-canary.9
63
+
64
+ ## 5.0.0-canary.23
65
+
66
+ ### Patch Changes
67
+
68
+ - d1e7ade1e: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
69
+ - Updated dependencies [d1e7ade1e]
70
+ - Updated dependencies [da16450b4]
71
+ - @hi-ui/button@5.0.0-canary.13
72
+ - @hi-ui/checkbox@5.0.0-canary.7
73
+ - @hi-ui/drawer@5.0.0-canary.9
74
+ - @hi-ui/empty-state@5.0.0-canary.8
75
+ - @hi-ui/icon-button@5.0.0-canary.8
76
+ - @hi-ui/loading@5.0.0-canary.9
77
+ - @hi-ui/pagination@5.0.0-canary.10
78
+ - @hi-ui/popper@5.0.0-canary.12
79
+ - @hi-ui/radio@5.0.0-canary.8
80
+ - @hi-ui/scrollbar@5.0.0-canary.7
81
+ - @hi-ui/select@5.0.0-canary.15
82
+ - @hi-ui/icons@5.0.0-canary.8
83
+
84
+ ## 5.0.0-canary.22
85
+
86
+ ### Patch Changes
87
+
88
+ - 58db39510: style: fix ui bug (5.0)
89
+ - Updated dependencies [627cf6a30]
90
+ - Updated dependencies [58db39510]
91
+ - @hi-ui/empty-state@5.0.0-canary.7
92
+ - @hi-ui/icons@5.0.0-canary.7
93
+ - @hi-ui/icon-button@5.0.0-canary.7
94
+ - @hi-ui/popper@5.0.0-canary.11
95
+ - @hi-ui/radio@5.0.0-canary.7
96
+
97
+ ## 5.0.0-canary.21
98
+
99
+ ### Patch Changes
100
+
101
+ - 0b67f7083: style: 修改 UI 问题 (5.0)
102
+ - Updated dependencies [947edaa7e]
103
+ - Updated dependencies [0b67f7083]
104
+ - @hi-ui/pagination@5.0.0-canary.9
105
+ - @hi-ui/icons@5.0.0-canary.6
106
+ - @hi-ui/icon-button@5.0.0-canary.6
107
+ - @hi-ui/popper@5.0.0-canary.10
108
+
109
+ ## 5.0.0-canary.20
110
+
111
+ ### Patch Changes
112
+
113
+ - 1f9c6e335: perf: 优化全局 size 配置,对于组件中没有的 size 值,取最接近的尺寸展示 (5.0)
114
+ - 22db9cf70: style: fix ui bug (5.0)
115
+ - Updated dependencies [d97cc24eb]
116
+ - Updated dependencies [1f9c6e335]
117
+ - Updated dependencies [22db9cf70]
118
+ - @hi-ui/drawer@5.0.0-canary.8
119
+ - @hi-ui/loading@5.0.0-canary.8
120
+ - @hi-ui/popper@5.0.0-canary.9
121
+ - @hi-ui/core@5.0.0-canary.6
122
+ - @hi-ui/empty-state@5.0.0-canary.6
123
+ - @hi-ui/pagination@5.0.0-canary.8
124
+ - @hi-ui/button@5.0.0-canary.12
125
+ - @hi-ui/checkbox@5.0.0-canary.6
126
+ - @hi-ui/icon-button@5.0.0-canary.5
127
+ - @hi-ui/radio@5.0.0-canary.6
128
+ - @hi-ui/scrollbar@5.0.0-canary.6
129
+ - @hi-ui/select@5.0.0-canary.14
130
+
131
+ ## 5.0.0-canary.19
132
+
133
+ ### Minor Changes
134
+
135
+ - 922686dcc: feat(global-context): 增加 size api 全局配置 (5.0)
136
+
137
+ ### Patch Changes
138
+
139
+ - 86877b241: style: 修改样式问题 (5.0)
140
+ - Updated dependencies [2b706fc6d]
141
+ - Updated dependencies [86877b241]
142
+ - Updated dependencies [922686dcc]
143
+ - Updated dependencies [8e969ad73]
144
+ - @hi-ui/select@5.0.0-canary.13
145
+ - @hi-ui/button@5.0.0-canary.11
146
+ - @hi-ui/checkbox@5.0.0-canary.5
147
+ - @hi-ui/drawer@5.0.0-canary.7
148
+ - @hi-ui/empty-state@5.0.0-canary.5
149
+ - @hi-ui/icon-button@5.0.0-canary.4
150
+ - @hi-ui/loading@5.0.0-canary.6
151
+ - @hi-ui/pagination@5.0.0-canary.7
152
+ - @hi-ui/popper@5.0.0-canary.8
153
+ - @hi-ui/radio@5.0.0-canary.5
154
+ - @hi-ui/scrollbar@5.0.0-canary.5
155
+ - @hi-ui/core@5.0.0-canary.5
156
+ - @hi-ui/icons@5.0.0-canary.5
157
+ - @hi-ui/spinner@5.0.0-canary.5
158
+
159
+ ## 5.0.0-canary.18
160
+
161
+ ### Patch Changes
162
+
163
+ - b265f3a8d: <br />
164
+ - fix(table): 修改表格在外层是 scale 时导致列宽计算有误的问题 (5.0)
165
+ - fix(loading): 修改 loading size 类型,移除 xs 尺寸 (5.0)
166
+ - Updated dependencies [b265f3a8d]
167
+ - @hi-ui/loading@5.0.0-canary.5
168
+
169
+ ## 5.0.0-canary.17
170
+
171
+ ### Patch Changes
172
+
173
+ - 399ea1f0e: <br>
174
+ - perf(table): 优化列宽更新逻辑,当 columns 长度和 dataKey、width 发生变化时,重新计算列宽 (5.0)
175
+ - fix(table): 用于计算真实列宽的行节点,考虑单元格合并的场景 (5.0)
176
+ - fix(table): 修复 stretchHeight 模式下高度变化时虚拟表格高度没有更新问题 (5.0)
177
+ - Updated dependencies [13a222d13]
178
+ - Updated dependencies [839ffd6d8]
179
+ - @hi-ui/select@5.0.0-canary.12
180
+ - @hi-ui/pagination@5.0.0-canary.6
181
+
182
+ ## 5.0.0-canary.16
183
+
184
+ ### Minor Changes
185
+
186
+ - 6160bdc73: feat(table): TableColumnItem 支持泛型 (5.0)
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies [9fa354f31]
191
+ - @hi-ui/button@5.0.0-canary.9
192
+
193
+ ## 5.0.0-canary.15
194
+
195
+ ### Patch Changes
196
+
197
+ - 6e274310f: fix(table): 优化列宽设置逻辑,确保在列变化时准确计算并更新列宽 (#3327)
198
+ - df353062b: fix(table): 修复设置 scrollbar 后冻结列失效问题 (#3329)
199
+ - Updated dependencies [75a3d93a9]
200
+ - @hi-ui/drawer@5.0.0-canary.6
201
+
202
+ ## 5.0.0-canary.14
203
+
204
+ ### Minor Changes
205
+
206
+ - 6316a318e: feat(table): 添加 fixedToRow 功能,支持设置行固定到顶部或底部 (#3304)
207
+
208
+ ### Patch Changes
209
+
210
+ - Updated dependencies [4dc72a186]
211
+ - @hi-ui/popper@5.0.0-canary.7
212
+
213
+ ## 5.0.0-canary.13
214
+
215
+ ### Patch Changes
216
+
217
+ - 864c3a54e: fix(table): 优化 useColSorter 钩子,移除不必要的 columnsLatestRef 引用,直接使用 columns 进行排序计算 (5.0)
218
+
219
+ ## 5.0.0-canary.12
220
+
221
+ ### Minor Changes
222
+
223
+ - a067ee087: feat(table): 支持远程排序 (5.0)
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [efce04a26]
228
+ - Updated dependencies [9106dca82]
229
+ - @hi-ui/checkbox@5.0.0-canary.3
230
+ - @hi-ui/popper@5.0.0-canary.6
231
+ - @hi-ui/radio@5.0.0-canary.4
232
+ - @hi-ui/select@5.0.0-canary.9
233
+ - @hi-ui/core@5.0.0-canary.3
234
+ - @hi-ui/icons@5.0.0-canary.3
235
+ - @hi-ui/button@5.0.0-canary.8
236
+ - @hi-ui/drawer@5.0.0-canary.5
237
+ - @hi-ui/empty-state@5.0.0-canary.3
238
+ - @hi-ui/icon-button@5.0.0-canary.3
239
+ - @hi-ui/loading@5.0.0-canary.3
240
+ - @hi-ui/pagination@5.0.0-canary.5
241
+ - @hi-ui/scrollbar@5.0.0-canary.4
242
+ - @hi-ui/spinner@5.0.0-canary.3
243
+
244
+ ## 5.0.0-canary.11
245
+
246
+ ### Patch Changes
247
+
248
+ - e5b589b86: chore(table): export SettingDrawer types (5.0)
249
+
250
+ ## 5.0.0-canary.10
251
+
252
+ ### Patch Changes
253
+
254
+ - fc1360986: fix(table): 更新 useTable 逻辑以确保滚动位置不超出表格宽度,并添加 @hi-ui/radio 依赖
255
+
256
+ ## 5.0.0-canary.9
257
+
258
+ ### Patch Changes
259
+
260
+ - fix(table): 修复 resizable 模式下列宽计算问题 (5.0)
261
+ - Updated dependencies [bf65028e6]
262
+ - @hi-ui/button@5.0.0-canary.7
263
+ - @hi-ui/popper@5.0.0-canary.4
264
+
265
+ ## 5.0.0-canary.8
266
+
267
+ ### Minor Changes
268
+
269
+ - ca7a945fe: feat(table): TableColumnItem 类型增加 minWidth 参数 (#3216)
270
+
271
+ ### Patch Changes
272
+
273
+ - Updated dependencies [756473045]
274
+ - Updated dependencies [b4cecde83]
275
+ - @hi-ui/scrollbar@5.0.0-canary.3
276
+ - @hi-ui/button@5.0.0-canary.6
277
+
278
+ ## 5.0.0-canary.7
279
+
280
+ ### Patch Changes
281
+
282
+ - chore: rebase master (5.0)
283
+ - Updated dependencies
284
+ - @hi-ui/core@5.0.0-canary.2
285
+ - @hi-ui/use-cache@5.0.0-canary.2
286
+ - @hi-ui/use-check@5.0.0-canary.2
287
+ - @hi-ui/use-check-state@5.0.0-canary.2
288
+ - @hi-ui/use-drag-sorter@5.0.0-canary.2
289
+ - @hi-ui/use-latest@5.0.0-canary.2
290
+ - @hi-ui/use-toggle@5.0.0-canary.2
291
+ - @hi-ui/use-uncontrolled-state@5.0.0-canary.2
292
+ - @hi-ui/use-update-effect@5.0.0-canary.2
293
+ - @hi-ui/icons@5.0.0-canary.2
294
+ - @hi-ui/button@5.0.0-canary.5
295
+ - @hi-ui/checkbox@5.0.0-canary.2
296
+ - @hi-ui/drawer@5.0.0-canary.4
297
+ - @hi-ui/empty-state@5.0.0-canary.2
298
+ - @hi-ui/icon-button@5.0.0-canary.2
299
+ - @hi-ui/loading@5.0.0-canary.2
300
+ - @hi-ui/pagination@5.0.0-canary.4
301
+ - @hi-ui/popper@5.0.0-canary.3
302
+ - @hi-ui/scrollbar@5.0.0-canary.2
303
+ - @hi-ui/select@5.0.0-canary.7
304
+ - @hi-ui/spinner@5.0.0-canary.2
305
+ - @hi-ui/array-utils@5.0.0-canary.2
306
+ - @hi-ui/classname@5.0.0-canary.2
307
+ - @hi-ui/dom-utils@5.0.0-canary.2
308
+ - @hi-ui/env@5.0.0-canary.2
309
+ - @hi-ui/func-utils@5.0.0-canary.2
310
+ - @hi-ui/object-utils@5.0.0-canary.2
311
+ - @hi-ui/react-utils@5.0.0-canary.2
312
+ - @hi-ui/times@5.0.0-canary.2
313
+ - @hi-ui/tree-utils@5.0.0-canary.2
314
+ - @hi-ui/type-assertion@5.0.0-canary.2
315
+
316
+ ## 5.0.0-canary.6
317
+
318
+ ### Patch Changes
319
+
320
+ - ba7c324c2: style: 统一调整组件 shadow (5.0)
321
+ - 4b09e728b: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
322
+ - Updated dependencies [ba7c324c2]
323
+ - Updated dependencies [4b09e728b]
324
+ - Updated dependencies [ba7c324c2]
325
+ - @hi-ui/drawer@5.0.0-canary.3
326
+ - @hi-ui/core@5.0.0-canary.1
327
+ - @hi-ui/use-cache@5.0.0-canary.1
328
+ - @hi-ui/use-check@5.0.0-canary.1
329
+ - @hi-ui/use-check-state@5.0.0-canary.1
330
+ - @hi-ui/use-drag-sorter@5.0.0-canary.1
331
+ - @hi-ui/use-latest@5.0.0-canary.1
332
+ - @hi-ui/use-toggle@5.0.0-canary.1
333
+ - @hi-ui/use-uncontrolled-state@5.0.0-canary.1
334
+ - @hi-ui/use-update-effect@5.0.0-canary.1
335
+ - @hi-ui/icons@5.0.0-canary.1
336
+ - @hi-ui/button@5.0.0-canary.4
337
+ - @hi-ui/checkbox@5.0.0-canary.1
338
+ - @hi-ui/empty-state@5.0.0-canary.1
339
+ - @hi-ui/icon-button@5.0.0-canary.1
340
+ - @hi-ui/loading@5.0.0-canary.1
341
+ - @hi-ui/pagination@5.0.0-canary.3
342
+ - @hi-ui/popper@5.0.0-canary.2
343
+ - @hi-ui/scrollbar@5.0.0-canary.1
344
+ - @hi-ui/select@5.0.0-canary.6
345
+ - @hi-ui/spinner@5.0.0-canary.1
346
+ - @hi-ui/array-utils@5.0.0-canary.1
347
+ - @hi-ui/classname@5.0.0-canary.1
348
+ - @hi-ui/dom-utils@5.0.0-canary.1
349
+ - @hi-ui/env@5.0.0-canary.1
350
+ - @hi-ui/func-utils@5.0.0-canary.1
351
+ - @hi-ui/object-utils@5.0.0-canary.1
352
+ - @hi-ui/react-utils@5.0.0-canary.1
353
+ - @hi-ui/times@5.0.0-canary.1
354
+ - @hi-ui/tree-utils@5.0.0-canary.1
355
+ - @hi-ui/type-assertion@5.0.0-canary.1
356
+
357
+ ## 5.0.0-canary.5
358
+
359
+ ### Patch Changes
360
+
361
+ - a89b3b3ae: fix: 修改组件问题 (5.0)
362
+ - Updated dependencies [a89b3b3ae]
363
+ - @hi-ui/select@5.0.0-canary.4
364
+
365
+ ## 5.0.0-canary.4
366
+
367
+ ### Patch Changes
368
+
369
+ - c3a7005b0: style: 修改 UI 问题 (5.0)
370
+
3
371
  ## 5.0.0-canary.3
4
372
 
5
373
  ### Minor Changes
@@ -46,6 +46,7 @@ var EMBED_DATA_KEY = "TABLE_EMBED_DATA_KEY_" + index.uuid();
46
46
  var DEFAULT_COLUMNS = [];
47
47
  var DEFAULT_DATA = [];
48
48
  var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
49
+ var _b;
49
50
  var _a$prefixCls = _a.prefixCls,
50
51
  prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
51
52
  _a$role = _a.role,
@@ -63,8 +64,7 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
63
64
  expandedEmbedRowKeys = _a.expandedEmbedRowKeys,
64
65
  onEmbedExpand = _a.onEmbedExpand,
65
66
  expandedRender = _a.expandedRender,
66
- _a$size = _a.size,
67
- size = _a$size === void 0 ? 'md' : _a$size,
67
+ sizeProp = _a.size,
68
68
  extra = _a.extra,
69
69
  onRow = _a.onRow,
70
70
  stickyFooter = _a.stickyFooter,
@@ -76,7 +76,15 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
76
76
  virtual = _a.virtual,
77
77
  needDoubleTable = _a.needDoubleTable,
78
78
  onResizeStop = _a.onResizeStop,
79
- rest = tslib.__rest(_a, ["prefixCls", "role", "className", "columns", "data", "striped", "bordered", "rowExpandable", "defaultExpandedEmbedRowKeys", "expandedEmbedRowKeys", "onEmbedExpand", "expandedRender", "size", "extra", "onRow", "onHeaderRow", "stickyFooter", "stickyFooterBottom", "fixedColumnTrigger", "emptyContent", "virtual", "needDoubleTable", "onResizeStop"]);
79
+ fixedToRow = _a.fixedToRow,
80
+ onScroll = _a.onScroll,
81
+ rest = tslib.__rest(_a, ["prefixCls", "role", "className", "columns", "data", "striped", "bordered", "rowExpandable", "defaultExpandedEmbedRowKeys", "expandedEmbedRowKeys", "onEmbedExpand", "expandedRender", "size", "extra", "onRow", "onHeaderRow", "stickyFooter", "stickyFooterBottom", "fixedColumnTrigger", "emptyContent", "virtual", "needDoubleTable", "onResizeStop", "fixedToRow", "onScroll"]);
82
+ var _useGlobalContext = core.useGlobalContext(),
83
+ globalSize = _useGlobalContext.size;
84
+ var size = (_b = sizeProp !== null && sizeProp !== void 0 ? sizeProp : globalSize) !== null && _b !== void 0 ? _b : 'md';
85
+ if (size === 'xs') {
86
+ size = 'sm';
87
+ }
80
88
  // ********************** 内嵌式面板 *********************** //
81
89
  var _useEmbedExpand = useEmbedExpand.useEmbedExpand({
82
90
  defaultExpandedEmbedRowKeys: defaultExpandedEmbedRowKeys,
@@ -99,6 +107,7 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
99
107
  dataKey: EMBED_DATA_KEY,
100
108
  title: '',
101
109
  width: 38,
110
+ fixed: true,
102
111
  className: prefixCls + "__embed-col",
103
112
  align: 'center',
104
113
  render: function render(_, rowItem) {
@@ -131,6 +140,8 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
131
140
  }, [embedExpandable, getEmbedPanelColumn, columns]);
132
141
  var i18n = core.useLocaleContext();
133
142
  var _useMemo = React.useMemo(function () {
143
+ var _a;
144
+ // 确保包含 avg 属性,且值为数字类型的字符串
134
145
  // 确保包含 avg 属性,且值为数字类型的字符串
135
146
  var avgRow = {
136
147
  id: 'avg',
@@ -139,9 +150,15 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
139
150
  }
140
151
  };
141
152
  var hasAvgColumn = false;
142
- columns.forEach(function (column, index$1) {
143
- // 行选中模式下,index=0是checkbox列,index=1才是第一列 ; fix issue: https://github.com/XiaoMi/hiui/issues/2863
144
- if (index$1 === 0 || index$1 === 1 && columns[0].dataKey === Table.SELECTION_DATA_KEY) {
153
+ var flattenedColumns = index.flattenColumns(columns);
154
+ // 找第一个非选择框列
155
+ // 找第一个非选择框列
156
+ var firstDataColumnIndex = 0;
157
+ if (((_a = columns[0]) === null || _a === void 0 ? void 0 : _a.dataKey) === Table.SELECTION_DATA_KEY) {
158
+ firstDataColumnIndex = 1;
159
+ }
160
+ flattenedColumns.forEach(function (column, index$1) {
161
+ if (index$1 === firstDataColumnIndex) {
145
162
  // @ts-ignore
146
163
  avgRow.raw[column.dataKey] = i18n.get('table.average');
147
164
  }
@@ -160,6 +177,8 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
160
177
  avgRow = _useMemo.avgRow,
161
178
  hasAvgColumn = _useMemo.hasAvgColumn;
162
179
  var _useMemo2 = React.useMemo(function () {
180
+ var _a;
181
+ // 确保包含total属性,且值为数字类型的字符串
163
182
  // 确保包含total属性,且值为数字类型的字符串
164
183
  var sumRow = {
165
184
  id: 'sum',
@@ -168,16 +187,19 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
168
187
  }
169
188
  };
170
189
  var hasSumColumn = false;
171
- columns.forEach(function (column, index$1) {
172
- if (index$1 === 0 || index$1 === 1 && columns[0].dataKey === Table.SELECTION_DATA_KEY) {
190
+ var flattenedColumns = index.flattenColumns(columns);
191
+ var firstDataColumnIndex = 0;
192
+ if (((_a = columns[0]) === null || _a === void 0 ? void 0 : _a.dataKey) === Table.SELECTION_DATA_KEY) {
193
+ firstDataColumnIndex = 1;
194
+ }
195
+ flattenedColumns.forEach(function (column, index$1) {
196
+ if (index$1 === firstDataColumnIndex) {
173
197
  // @ts-ignore
174
198
  sumRow.raw[column.dataKey] = i18n.get('table.total');
175
199
  }
176
200
  if (index.checkNeedTotalOrEvg(data, column, 'total')) {
177
201
  hasSumColumn = true;
178
- // 获取当前数据最大小数点个数,并设置最后总和值小数点
179
202
  // @ts-ignore
180
- // 获取当前数据最大小数点个数,并设置最后总和值小数点
181
203
  // @ts-ignore
182
204
  sumRow.raw[column.dataKey] = index.getTotalOrEvgRowData(data, column, false);
183
205
  }
@@ -192,7 +214,8 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
192
214
  var providedValue = useTable.useTable(Object.assign(Object.assign({}, rest), {
193
215
  columns: mergedColumns,
194
216
  data: data,
195
- virtual: virtual
217
+ virtual: virtual,
218
+ onScroll: onScroll
196
219
  }));
197
220
  var rootProps = providedValue.rootProps,
198
221
  bordered = providedValue.bordered,
@@ -216,42 +239,52 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
216
239
  var extraHeader = extra && extra.header;
217
240
  var extraFooter = extra && extra.footer;
218
241
  var alwaysFixedColumn = fixedColumnTrigger === 'always';
242
+ var wrapperRef = React__default["default"].useRef(null);
243
+ var isTableContentExceedWrapperHeight = bodyTableRef.current && wrapperRef.current && bodyTableRef.current.offsetHeight > wrapperRef.current.offsetHeight;
219
244
  var renderTable = function renderTable() {
220
- var singleTableContent = /*#__PURE__*/React__default["default"].createElement("div", {
221
- ref: scrollBodyElementRef,
222
- className: prefixCls + "-content",
223
- onScroll: onTableBodyScroll,
224
- style: {
225
- // 表格宽度大于div宽度才出现横向滚动条
226
- overflowX: canScroll ? 'scroll' : undefined
227
- }
228
- }, /*#__PURE__*/React__default["default"].createElement("table", {
245
+ if (needDoubleTable) {
246
+ var _a2 = getTableHeaderProps(),
247
+ style = _a2.style,
248
+ restTableHeaderProps = tslib.__rest(_a2, ["style"]);
249
+ var doubleTableContent = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", Object.assign({}, restTableHeaderProps, {
250
+ style: Object.assign(Object.assign({}, style), {
251
+ overflow: undefined
252
+ })
253
+ }), /*#__PURE__*/React__default["default"].createElement(TableHeader.TableHeader, null), extraHeader ? ( /*#__PURE__*/React__default["default"].createElement("div", {
254
+ style: {
255
+ position: 'absolute',
256
+ right: 0,
257
+ zIndex: 11,
258
+ bottom: 0,
259
+ top: 0
260
+ }
261
+ }, extraHeader)) : null), /*#__PURE__*/React__default["default"].createElement(TableBody.TableBody, {
262
+ emptyContent: emptyContent
263
+ }));
264
+ return doubleTableContent;
265
+ }
266
+ var tableContent = /*#__PURE__*/React__default["default"].createElement("table", {
229
267
  ref: bodyTableRef,
230
268
  style: {
231
269
  width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
232
270
  }
233
271
  }, /*#__PURE__*/React__default["default"].createElement(ColGroupContent.ColGroupContent, null), /*#__PURE__*/React__default["default"].createElement(TheadContent.TheadContent, null), /*#__PURE__*/React__default["default"].createElement(TbodyContent.TbodyContent, {
234
272
  emptyContent: emptyContent
235
- })));
236
- var _a = getTableHeaderProps(),
237
- style = _a.style,
238
- restTableHeaderProps = tslib.__rest(_a, ["style"]);
239
- var doubleTableContent = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", Object.assign({}, restTableHeaderProps, {
240
- style: Object.assign(Object.assign({}, style), {
241
- overflow: 'unset'
242
- })
243
- }), /*#__PURE__*/React__default["default"].createElement(TableHeader.TableHeader, null), extraHeader ? ( /*#__PURE__*/React__default["default"].createElement("div", {
273
+ }));
274
+ var singleTableContent = /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
275
+ className: prefixCls + "-content"
276
+ }, !scrollbar ? {
277
+ ref: scrollBodyElementRef,
278
+ onScroll: onTableBodyScroll,
244
279
  style: {
245
- position: 'absolute',
246
- right: 0,
247
- zIndex: 11,
248
- bottom: 0,
249
- top: 0
280
+ // 表格宽度大于div宽度才出现横向滚动条
281
+ overflowX: canScroll ? 'scroll' : undefined
250
282
  }
251
- }, extraHeader)) : null), /*#__PURE__*/React__default["default"].createElement(TableBody.TableBody, {
252
- emptyContent: emptyContent
253
- }));
254
- return needDoubleTable ? doubleTableContent : !scrollbar ? singleTableContent : ( /*#__PURE__*/React__default["default"].createElement(Scrollbar__default["default"], Object.assign({}, typeAssertion.isObject(scrollbar) ? scrollbar : null), singleTableContent));
283
+ } : {}), !scrollbar ? tableContent : ( /*#__PURE__*/React__default["default"].createElement(Scrollbar__default["default"], Object.assign({
284
+ ref: scrollBodyElementRef,
285
+ onScroll: onTableBodyScroll
286
+ }, typeAssertion.isObject(scrollbar) ? scrollbar : null), tableContent)));
287
+ return singleTableContent;
255
288
  };
256
289
  var renderFreezeShadow = function renderFreezeShadow() {
257
290
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, (alwaysFixedColumn || scrollSize.scrollLeft > 0) && leftFrozenColKeys.length > 0 ? ( /*#__PURE__*/React__default["default"].createElement("div", {
@@ -279,7 +312,8 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
279
312
  role: role,
280
313
  className: cls
281
314
  }, rootProps), /*#__PURE__*/React__default["default"].createElement("div", {
282
- className: prefixCls + "__wrapper"
315
+ ref: wrapperRef,
316
+ className: classname.cx(prefixCls + "__wrapper", isTableContentExceedWrapperHeight && prefixCls + "--exceed-wrapper-height")
283
317
  }, /*#__PURE__*/React__default["default"].createElement(context.TableProvider, {
284
318
  value: Object.assign(Object.assign({}, providedValue), {
285
319
  striped: striped,
@@ -295,7 +329,9 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function (_a, ref) {
295
329
  sumRow: sumRow,
296
330
  hasSumColumn: hasSumColumn,
297
331
  virtual: virtual,
298
- onResizeStop: onResizeStop
332
+ onScroll: onScroll,
333
+ onResizeStop: onResizeStop,
334
+ fixedToRow: fixedToRow
299
335
  })
300
336
  }, renderTable()), renderFreezeShadow()), tableFooter);
301
337
  });
package/lib/cjs/Table.js CHANGED
@@ -25,7 +25,7 @@ var reactUtils = require('@hi-ui/react-utils');
25
25
  var TableSettingMenu = require('./TableSettingMenu.js');
26
26
  var Loading = require('@hi-ui/loading');
27
27
  var Checkbox = require('@hi-ui/checkbox');
28
- var index$1 = require('./packages/ui/radio/lib/esm/index.js');
28
+ var Radio = require('@hi-ui/radio');
29
29
  var useCheck = require('./hooks/use-check.js');
30
30
  var typeAssertion = require('@hi-ui/type-assertion');
31
31
  var treeUtils = require('@hi-ui/tree-utils');
@@ -41,12 +41,13 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
41
41
  var Pagination__default = /*#__PURE__*/_interopDefaultCompat(Pagination);
42
42
  var Loading__default = /*#__PURE__*/_interopDefaultCompat(Loading);
43
43
  var Checkbox__default = /*#__PURE__*/_interopDefaultCompat(Checkbox);
44
+ var Radio__default = /*#__PURE__*/_interopDefaultCompat(Radio);
44
45
  var _prefix = classname.getPrefixCls('table');
45
46
  /**
46
47
  * 需要使用双表格的场景对应的 API
47
48
  * 这些场景下的功能无法通过单表格实现,故而设计成双表格,即表头和表体分别用一个 table 实现
48
49
  */
49
- var DOUBLE_TABLE_SCENE = ['needDoubleTable', 'maxHeight', 'sticky', 'stickyTop', 'setting', 'virtual', 'stretchHeight'];
50
+ var DOUBLE_TABLE_SCENE = ['needDoubleTable', 'maxHeight', 'sticky', 'stickyTop', 'setting', 'virtual'];
50
51
  var STANDARD_PRESET = {
51
52
  striped: true,
52
53
  bordered: true,
@@ -86,7 +87,8 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
86
87
  extra = _a.extra,
87
88
  _a$data = _a.data,
88
89
  data = _a$data === void 0 ? DEFAULT_DATA : _a$data,
89
- rest = tslib.__rest(_a, ["prefixCls", "standard", "loading", "dataSource", "pagination", "uniqueId", "columns", "hiddenColKeys", "onHiddenColKeysChange", "sortedColKeys", "onSortedColKeysChange", "checkDisabledColKeys", "onSetColKeysChange", "rowSelection", "fieldKey", "extra", "data"]);
90
+ onScroll = _a.onScroll,
91
+ rest = tslib.__rest(_a, ["prefixCls", "standard", "loading", "dataSource", "pagination", "uniqueId", "columns", "hiddenColKeys", "onHiddenColKeysChange", "sortedColKeys", "onSortedColKeysChange", "checkDisabledColKeys", "onSetColKeysChange", "rowSelection", "fieldKey", "extra", "data", "onScroll"]);
90
92
  // 是否需要双表格
91
93
  var needDoubleTable = DOUBLE_TABLE_SCENE.some(function (prop) {
92
94
  return !!rest[prop];
@@ -205,6 +207,12 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
205
207
  var rowKey = getRowKeyField(rowItem);
206
208
  var checked = isCheckedRowKey(rowKey);
207
209
  var disabledCheckbox = checkRowIsDisabledCheckbox(rowItem);
210
+ if (rowItem.key === 'avg' || rowItem.key === 'sum') {
211
+ return {
212
+ node: null,
213
+ checked: false
214
+ };
215
+ }
208
216
  return {
209
217
  node: type === 'checkbox' ? ( /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
210
218
  checked: checked,
@@ -215,7 +223,7 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
215
223
  onClick: function onClick(evt) {
216
224
  evt.stopPropagation();
217
225
  }
218
- })) : ( /*#__PURE__*/React__default["default"].createElement(index$1["default"], {
226
+ })) : ( /*#__PURE__*/React__default["default"].createElement(Radio__default["default"], {
219
227
  checked: checked,
220
228
  disabled: disabledCheckbox,
221
229
  onChange: function onChange(evt) {
@@ -297,6 +305,7 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
297
305
  data: mergedData,
298
306
  fieldKey: fieldKey,
299
307
  virtual: virtual,
308
+ onScroll: onScroll,
300
309
  needDoubleTable: needDoubleTable,
301
310
  extra: Object.assign({
302
311
  header: setting ? ( /*#__PURE__*/React__default["default"].createElement(TableSettingMenu.TableSettingMenu, {