react-kui 3.1.2 → 3.2.1

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 (398) hide show
  1. package/README.zh-CN.md +3 -1
  2. package/ai/kui-components.json +918 -324
  3. package/es/_virtual/_rolldown/runtime.js +1 -1
  4. package/es/affix/index.js +1 -1
  5. package/es/alert/index.js +11 -4
  6. package/es/anchor/anchor-context.js +1 -1
  7. package/es/anchor/anchor-link.js +1 -1
  8. package/es/anchor/anchor.js +1 -1
  9. package/es/auto-complete/index.js +371 -347
  10. package/es/avatar/avatar-group-context.js +1 -1
  11. package/es/avatar/avatar-group.js +1 -1
  12. package/es/avatar/avatar.js +1 -1
  13. package/es/back-top/index.js +1 -1
  14. package/es/badge/index.js +10 -8
  15. package/es/base/teleport.js +1 -1
  16. package/es/base/transition-props.js +1 -1
  17. package/es/base/transition.js +1 -1
  18. package/es/breadcrumb/breadcrumb-context.js +1 -1
  19. package/es/breadcrumb/breadcrumb-item.js +1 -1
  20. package/es/breadcrumb/breadcrumb.js +1 -1
  21. package/es/button/button-group-context.js +1 -1
  22. package/es/button/button-group.js +1 -1
  23. package/es/button/button.js +13 -6
  24. package/es/calendar/index.js +20 -6
  25. package/es/card/index.js +11 -4
  26. package/es/carousel/carousel-context.js +1 -1
  27. package/es/carousel/carousel-item.js +1 -1
  28. package/es/carousel/carousel.js +1 -1
  29. package/es/carousel/drag.js +1 -1
  30. package/es/cascader/index.js +13 -10
  31. package/es/check-card/check-card-group.js +3 -3
  32. package/es/check-card/check-card.js +155 -141
  33. package/es/check-card/context.js +1 -1
  34. package/es/checkbox/checkbox-group-context.js +1 -1
  35. package/es/checkbox/checkbox-group.js +3 -3
  36. package/es/checkbox/checkbox.js +64 -244
  37. package/es/checkbox/index.js +1 -1
  38. package/es/collapse/collapse-panel.js +1 -1
  39. package/es/collapse/collapse.js +96 -82
  40. package/es/color-picker/alpha.js +1 -1
  41. package/es/color-picker/hue.js +1 -1
  42. package/es/color-picker/index.js +7 -7
  43. package/es/color-picker/mode.js +2 -2
  44. package/es/color-picker/paint.js +1 -1
  45. package/es/color-picker/presets.js +1 -1
  46. package/es/components.js +4 -4
  47. package/es/config/config-context.js +16 -3
  48. package/es/config/context.js +29 -2
  49. package/es/config/index.js +31 -12
  50. package/es/config/popup-host.js +106 -0
  51. package/es/config/size-context.js +1 -1
  52. package/es/config/use-config-appearance.js +62 -2
  53. package/es/const/var.js +6 -2
  54. package/es/date-picker/index.js +404 -885
  55. package/es/descriptions/descriptions-item.js +1 -1
  56. package/es/descriptions/descriptions.js +1 -1
  57. package/es/divider/index.js +1 -1
  58. package/es/drawer/index.js +328 -240
  59. package/es/dropdown/dropdown-button.js +69 -51
  60. package/es/dropdown/dropdown-context.js +1 -1
  61. package/es/dropdown/dropdown.js +137 -93
  62. package/es/dropdown/trigger.js +85 -33
  63. package/es/empty/index.js +3 -4
  64. package/es/feature-card/index.js +15 -4
  65. package/es/feedback-panel/index.js +95 -81
  66. package/es/flame-wrap/index.js +116 -109
  67. package/es/flame-wrap/types.js +54 -6
  68. package/es/flex/index.js +1 -1
  69. package/es/form/field-context.js +16 -2
  70. package/es/form/form-context.js +1 -1
  71. package/es/form/form-item.js +7 -6
  72. package/es/form/form.js +1 -1
  73. package/es/form/utils.js +1 -1
  74. package/es/grid/grid-item.js +1 -1
  75. package/es/grid/grid.js +1 -1
  76. package/es/grid/useBreakpoint.js +1 -1
  77. package/es/icon/index.js +1 -1
  78. package/es/image/group.js +1 -1
  79. package/es/image/image-group-context.js +1 -1
  80. package/es/image/image.js +137 -123
  81. package/es/image/instance.js +1 -1
  82. package/es/image/preview.js +1 -1
  83. package/es/image/utils.js +1 -1
  84. package/es/index.js +3 -3
  85. package/es/input/index.js +3 -3
  86. package/es/input/input-base.js +7 -7
  87. package/es/input/input-box.js +2 -2
  88. package/es/input/input-group.js +43 -127
  89. package/es/input/input.js +1 -1
  90. package/es/input/textarea.js +28 -114
  91. package/es/input-number/index.js +7 -5
  92. package/es/input-otp/index.js +5 -5
  93. package/es/input-tag/index.js +5 -5
  94. package/es/kanban/index.js +79 -63
  95. package/es/layout/index.js +1 -1
  96. package/es/layout/layout-context.js +1 -1
  97. package/es/list-panel/index.js +96 -83
  98. package/es/loading/index.js +1 -1
  99. package/es/loading/loading-bar.js +1 -1
  100. package/es/locale/de.js +10 -2
  101. package/es/locale/el.js +10 -2
  102. package/es/locale/en.js +10 -2
  103. package/es/locale/fr.js +10 -2
  104. package/es/locale/it.js +10 -2
  105. package/es/locale/ja.js +10 -2
  106. package/es/locale/ko.js +10 -2
  107. package/es/locale/ru.js +10 -2
  108. package/es/locale/th.js +10 -2
  109. package/es/locale/uk.js +10 -2
  110. package/es/locale/vi.js +10 -2
  111. package/es/locale/zh-CN.js +10 -2
  112. package/es/locale/zh-TW.js +10 -2
  113. package/es/mentions/index.js +291 -286
  114. package/es/menu/menu-context.js +1 -1
  115. package/es/menu/menu-divider.js +1 -1
  116. package/es/menu/menu-group.js +1 -1
  117. package/es/menu/menu-item.js +1 -1
  118. package/es/menu/menu-keyboard.js +41 -2
  119. package/es/menu/menu.js +268 -222
  120. package/es/menu/recursive-menu.js +1 -1
  121. package/es/menu/sub-menu.js +81 -23
  122. package/es/message/index.js +1 -1
  123. package/es/modal/api.js +46 -12
  124. package/es/modal/modal.js +441 -345
  125. package/es/modal/toast.js +177 -64
  126. package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
  127. package/es/notice/container.js +1 -1
  128. package/es/notice/content.js +1 -1
  129. package/es/notice/index.js +1 -1
  130. package/es/notice/instance.js +1 -1
  131. package/es/page/index.js +13 -8
  132. package/es/page/responsive.js +1 -1
  133. package/es/page-header/index.js +1 -1
  134. package/es/popconfirm/index.js +36 -35
  135. package/es/poptip/index.js +47 -45
  136. package/es/popup/index.js +5 -2
  137. package/es/popup/layers.js +11 -2
  138. package/es/progress/index.js +1 -1
  139. package/es/qrcode/index.js +13 -7
  140. package/es/radio/radio-button.js +51 -44
  141. package/es/radio/radio-group-context.js +1 -1
  142. package/es/radio/radio-group.js +49 -52
  143. package/es/radio/radio.js +46 -197
  144. package/es/rate/index.js +1 -1
  145. package/es/rate/star.js +1 -1
  146. package/es/result/index.js +1 -1
  147. package/es/ripple/index.js +104 -97
  148. package/es/ripple/types.js +71 -18
  149. package/es/row-col/col.js +1 -1
  150. package/es/row-col/row.js +1 -1
  151. package/es/segmented/index.js +112 -92
  152. package/es/select/option.js +1 -1
  153. package/es/select/select.js +29 -29
  154. package/es/skeleton/skeleton-avatar.js +1 -1
  155. package/es/skeleton/skeleton-button.js +1 -1
  156. package/es/skeleton/skeleton-image.js +1 -1
  157. package/es/skeleton/skeleton-text.js +1 -1
  158. package/es/skeleton/skeleton.js +1 -1
  159. package/es/skeleton/use-skeleton-loading.js +1 -1
  160. package/es/slider/index.js +1 -1
  161. package/es/slider/thumb.js +1 -1
  162. package/es/space/index.js +1 -1
  163. package/es/spin/index.js +1 -1
  164. package/es/splitter/splitter-panel.js +1 -1
  165. package/es/splitter/splitter.js +1 -1
  166. package/es/stat-card/countup.js +2 -2
  167. package/es/stat-card/rollup.js +1 -1
  168. package/es/stat-card/stat-card.js +16 -7
  169. package/es/stat-card/stat-number.js +4 -3
  170. package/es/stat-card/utils/countup.js +1 -1
  171. package/es/stat-card/utils/odometer.js +1 -1
  172. package/es/stat-card/utils/stat-item-key.js +22 -0
  173. package/es/steps/index.js +1 -1
  174. package/es/switch/index.js +3 -3
  175. package/es/table/column-setting.js +104 -115
  176. package/es/table/index.js +556 -207
  177. package/es/table/utils.js +140 -3
  178. package/es/tabs/tab-panel.js +1 -1
  179. package/es/tabs/tabs.js +1 -1
  180. package/es/tag/index.js +12 -5
  181. package/es/time-line/timeline-item.js +1 -1
  182. package/es/time-line/timeline.js +1 -1
  183. package/es/tooltip/index.js +114 -94
  184. package/es/tour/index.js +1 -1
  185. package/es/transfer/index.js +190 -172
  186. package/es/tree/index.js +55 -44
  187. package/es/tree/utils.js +1 -1
  188. package/es/tree-select/index.js +259 -781
  189. package/es/typography/index.js +1 -1
  190. package/es/upload/file-list.js +1 -1
  191. package/es/upload/index.js +5 -6
  192. package/es/upload/picture-sort.js +1 -1
  193. package/es/upload/selector.js +1 -1
  194. package/es/utils/checked.js +1 -1
  195. package/es/utils/color.js +25 -2
  196. package/es/utils/css.js +19 -0
  197. package/es/utils/focus.js +63 -0
  198. package/es/utils/number.js +1 -1
  199. package/es/utils/overlay-order.js +18 -0
  200. package/es/utils/overlay-stack.js +33 -0
  201. package/es/utils/placement.js +1 -1
  202. package/es/utils/popup.js +1 -1
  203. package/es/utils/promise.js +18 -0
  204. package/es/utils/react-node.js +55 -30
  205. package/es/utils/selection-tags.js +6 -4
  206. package/es/utils/share.js +5 -2
  207. package/es/utils/theme.js +1 -1
  208. package/es/utils/transition.js +1 -1
  209. package/es/utils/use-value.js +1 -1
  210. package/es/virtual-list/index.js +1 -1
  211. package/es/virtual-list/range.js +3 -2
  212. package/es/watermark/index.js +1 -1
  213. package/lib/index.cjs +2 -2
  214. package/lib/locale/de.cjs +2 -2
  215. package/lib/locale/el.cjs +2 -2
  216. package/lib/locale/en.cjs +2 -2
  217. package/lib/locale/fr.cjs +2 -2
  218. package/lib/locale/it.cjs +2 -2
  219. package/lib/locale/ja.cjs +2 -2
  220. package/lib/locale/ko.cjs +2 -2
  221. package/lib/locale/ru.cjs +2 -2
  222. package/lib/locale/th.cjs +2 -2
  223. package/lib/locale/uk.cjs +2 -2
  224. package/lib/locale/vi.cjs +2 -2
  225. package/lib/locale/zh-CN.cjs +2 -2
  226. package/lib/locale/zh-TW.cjs +2 -2
  227. package/package.json +4 -3
  228. package/readme.md +3 -1
  229. package/style/base.css +2 -2
  230. package/style/components.css +2 -2
  231. package/style/index.css +2 -2
  232. package/style/theme.css +2 -2
  233. package/types/alert/index.d.cts +2 -2
  234. package/types/alert/index.d.ts +2 -2
  235. package/types/auto-complete/index.d.cts +7 -1
  236. package/types/auto-complete/index.d.ts +7 -1
  237. package/types/badge/index.d.cts +2 -1
  238. package/types/badge/index.d.ts +2 -1
  239. package/types/button/button.d.cts +2 -2
  240. package/types/button/button.d.ts +2 -2
  241. package/types/card/index.d.cts +3 -3
  242. package/types/card/index.d.ts +3 -3
  243. package/types/cascader/index.d.cts +1 -1
  244. package/types/cascader/index.d.ts +1 -1
  245. package/types/cascader/types.d.cts +2 -0
  246. package/types/cascader/types.d.ts +2 -0
  247. package/types/check-card/context.d.cts +4 -3
  248. package/types/check-card/context.d.ts +4 -3
  249. package/types/check-card/index.d.cts +1 -1
  250. package/types/check-card/index.d.ts +1 -1
  251. package/types/check-card/types.d.cts +3 -4
  252. package/types/check-card/types.d.ts +3 -4
  253. package/types/checkbox/checkbox-group.d.cts +2 -2
  254. package/types/checkbox/checkbox-group.d.ts +2 -2
  255. package/types/checkbox/checkbox.d.cts +2 -2
  256. package/types/checkbox/checkbox.d.ts +2 -2
  257. package/types/collapse/collapse.d.cts +3 -3
  258. package/types/collapse/collapse.d.ts +3 -3
  259. package/types/color-picker/index.d.cts +3 -1
  260. package/types/color-picker/index.d.ts +3 -1
  261. package/types/components.d.cts +2 -2
  262. package/types/components.d.ts +2 -2
  263. package/types/config/config-context.d.cts +15 -2
  264. package/types/config/config-context.d.ts +15 -2
  265. package/types/config/context.d.cts +6 -0
  266. package/types/config/context.d.ts +6 -0
  267. package/types/config/popup-host.d.cts +16 -0
  268. package/types/config/popup-host.d.ts +16 -0
  269. package/types/config/use-config-appearance.d.cts +41 -2
  270. package/types/config/use-config-appearance.d.ts +41 -2
  271. package/types/const/types.d.cts +30 -1
  272. package/types/const/types.d.ts +30 -1
  273. package/types/const/var.d.cts +6 -1
  274. package/types/const/var.d.ts +6 -1
  275. package/types/date-picker/index.d.cts +3 -1
  276. package/types/date-picker/index.d.ts +3 -1
  277. package/types/descriptions/descriptions.d.cts +2 -2
  278. package/types/descriptions/descriptions.d.ts +2 -2
  279. package/types/drawer/index.d.cts +1 -0
  280. package/types/drawer/index.d.ts +1 -0
  281. package/types/dropdown/dropdown-button.d.cts +5 -2
  282. package/types/dropdown/dropdown-button.d.ts +5 -2
  283. package/types/dropdown/dropdown-context.d.cts +6 -0
  284. package/types/dropdown/dropdown-context.d.ts +6 -0
  285. package/types/dropdown/dropdown.d.cts +2 -0
  286. package/types/dropdown/dropdown.d.ts +2 -0
  287. package/types/feature-card/index.d.cts +3 -3
  288. package/types/feature-card/index.d.ts +3 -3
  289. package/types/feedback-panel/index.d.cts +3 -3
  290. package/types/feedback-panel/index.d.ts +3 -3
  291. package/types/flame-wrap/types.d.cts +18 -0
  292. package/types/flame-wrap/types.d.ts +18 -0
  293. package/types/form/field-context.d.cts +2 -0
  294. package/types/form/field-context.d.ts +2 -0
  295. package/types/image/image.d.cts +2 -2
  296. package/types/image/image.d.ts +2 -2
  297. package/types/input/input-group.d.cts +2 -2
  298. package/types/input/input-group.d.ts +2 -2
  299. package/types/input-number/index.d.cts +2 -0
  300. package/types/input-number/index.d.ts +2 -0
  301. package/types/kanban/index.d.cts +3 -2
  302. package/types/kanban/index.d.ts +3 -2
  303. package/types/list-panel/index.d.cts +3 -3
  304. package/types/list-panel/index.d.ts +3 -3
  305. package/types/locale/de.d.cts +6 -0
  306. package/types/locale/de.d.ts +6 -0
  307. package/types/locale/el.d.cts +6 -0
  308. package/types/locale/el.d.ts +6 -0
  309. package/types/locale/en.d.cts +6 -0
  310. package/types/locale/en.d.ts +6 -0
  311. package/types/locale/fr.d.cts +6 -0
  312. package/types/locale/fr.d.ts +6 -0
  313. package/types/locale/it.d.cts +6 -0
  314. package/types/locale/it.d.ts +6 -0
  315. package/types/locale/ja.d.cts +6 -0
  316. package/types/locale/ja.d.ts +6 -0
  317. package/types/locale/ko.d.cts +6 -0
  318. package/types/locale/ko.d.ts +6 -0
  319. package/types/locale/ru.d.cts +6 -0
  320. package/types/locale/ru.d.ts +6 -0
  321. package/types/locale/th.d.cts +6 -0
  322. package/types/locale/th.d.ts +6 -0
  323. package/types/locale/uk.d.cts +6 -0
  324. package/types/locale/uk.d.ts +6 -0
  325. package/types/locale/vi.d.cts +6 -0
  326. package/types/locale/vi.d.ts +6 -0
  327. package/types/locale/zh-CN.d.cts +6 -0
  328. package/types/locale/zh-CN.d.ts +6 -0
  329. package/types/locale/zh-TW.d.cts +6 -0
  330. package/types/locale/zh-TW.d.ts +6 -0
  331. package/types/mentions/index.d.cts +2 -0
  332. package/types/mentions/index.d.ts +2 -0
  333. package/types/menu/menu-keyboard.d.cts +23 -0
  334. package/types/menu/menu-keyboard.d.ts +23 -0
  335. package/types/modal/api.d.cts +6 -1
  336. package/types/modal/api.d.ts +6 -1
  337. package/types/modal/modal.d.cts +1 -0
  338. package/types/modal/modal.d.ts +1 -0
  339. package/types/modal/toast.d.cts +8 -2
  340. package/types/modal/toast.d.ts +8 -2
  341. package/types/page/index.d.cts +2 -2
  342. package/types/page/index.d.ts +2 -2
  343. package/types/popconfirm/index.d.cts +2 -0
  344. package/types/popconfirm/index.d.ts +2 -0
  345. package/types/poptip/index.d.cts +2 -0
  346. package/types/poptip/index.d.ts +2 -0
  347. package/types/popup/layers.d.cts +2 -0
  348. package/types/popup/layers.d.ts +2 -0
  349. package/types/qrcode/index.d.cts +2 -2
  350. package/types/qrcode/index.d.ts +2 -2
  351. package/types/radio/radio-button.d.cts +2 -2
  352. package/types/radio/radio-button.d.ts +2 -2
  353. package/types/radio/radio-group.d.cts +2 -2
  354. package/types/radio/radio-group.d.ts +2 -2
  355. package/types/radio/radio.d.cts +2 -2
  356. package/types/radio/radio.d.ts +2 -2
  357. package/types/ripple/types.d.cts +18 -0
  358. package/types/ripple/types.d.ts +18 -0
  359. package/types/segmented/index.d.cts +2 -1
  360. package/types/segmented/index.d.ts +2 -1
  361. package/types/select/select.d.cts +2 -0
  362. package/types/select/select.d.ts +2 -0
  363. package/types/stat-card/stat-card.d.cts +3 -3
  364. package/types/stat-card/stat-card.d.ts +3 -3
  365. package/types/stat-card/utils/stat-item-key.d.cts +11 -0
  366. package/types/stat-card/utils/stat-item-key.d.ts +11 -0
  367. package/types/table/column-setting.d.cts +4 -4
  368. package/types/table/column-setting.d.ts +4 -4
  369. package/types/table/index.d.cts +2 -2
  370. package/types/table/index.d.ts +2 -2
  371. package/types/table/types.d.cts +21 -2
  372. package/types/table/types.d.ts +21 -2
  373. package/types/table/utils.d.cts +75 -0
  374. package/types/table/utils.d.ts +75 -0
  375. package/types/tag/index.d.cts +2 -2
  376. package/types/tag/index.d.ts +2 -2
  377. package/types/tooltip/index.d.cts +2 -0
  378. package/types/tooltip/index.d.ts +2 -0
  379. package/types/transfer/index.d.cts +3 -2
  380. package/types/transfer/index.d.ts +3 -2
  381. package/types/tree-select/index.d.cts +3 -1
  382. package/types/tree-select/index.d.ts +3 -1
  383. package/types/utils/checked.d.cts +1 -1
  384. package/types/utils/checked.d.ts +1 -1
  385. package/types/utils/color.d.cts +13 -0
  386. package/types/utils/color.d.ts +13 -0
  387. package/types/utils/css.d.cts +2 -0
  388. package/types/utils/css.d.ts +2 -0
  389. package/types/utils/focus.d.cts +5 -0
  390. package/types/utils/focus.d.ts +5 -0
  391. package/types/utils/overlay-order.d.cts +6 -0
  392. package/types/utils/overlay-order.d.ts +6 -0
  393. package/types/utils/overlay-stack.d.cts +13 -0
  394. package/types/utils/overlay-stack.d.ts +13 -0
  395. package/types/utils/promise.d.cts +5 -0
  396. package/types/utils/promise.d.ts +5 -0
  397. package/types/utils/react-node.d.cts +10 -0
  398. package/types/utils/react-node.d.ts +10 -0
package/es/table/index.js CHANGED
@@ -1,47 +1,274 @@
1
1
  /*!
2
- * react-kui v3.1.2
2
+ * react-kui v3.2.1
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
6
6
  * Author: Qiu / https://chuchur.com
7
7
  */
8
8
 
9
+ import { ConfigContext, DEFAULT_LOCALE } from "../config/config-context.js";
9
10
  import { normalizeSurfaceShape, useConfigAppearance } from "../config/use-config-appearance.js";
10
11
  import { ChevronDown, ChevronRight, Triangle } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
11
12
  import Icon from "../icon/index.js";
12
13
  import { useValue } from "../utils/use-value.js";
13
14
  import Empty from "../empty/index.js";
14
15
  import checkbox_default from "../checkbox/checkbox.js";
16
+ import Tooltip from "../tooltip/index.js";
15
17
  import { getVirtualRange } from "../virtual-list/range.js";
16
18
  import Spin from "../spin/index.js";
17
- import { countColumnLeaves, flattenColumns, flattenTreeData, getRecordValue } from "./utils.js";
19
+ import { compareSortValues, countColumnLeaves, flattenColumns, flattenTreeData, getRecordValue, inheritColumnFixed, mergeExpandAllRows, resolveCellEllipsis, resolveRowKey } from "./utils.js";
18
20
  import { TableColumnSetting } from "./column-setting.js";
21
+ import { c } from "react/compiler-runtime";
19
22
  import clsx from "clsx";
20
- import { useEffect, useMemo, useRef, useState } from "react";
23
+ import { isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
21
24
  import { jsx, jsxs } from "react/jsx-runtime";
22
25
  import { flushSync } from "react-dom";
23
26
  //#region components/table/index.tsx
24
- function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKey = "key", childrenColumnName = "children", expandedKeys, expandAllRows = false, expandRowByClick = false, indentSize = 20, scroll = {}, size: sizeProp, striped, bordered = false, shape: shapeProp, checkable, loading, emptyText, header, footer, virtual = false, itemHeight = 44, overscan = 5, hiddenColumnKeys = [], onSort, onRowClick, onSelect, onSelectAll, onSelectedKeysChange, onExpand, onExpandedKeysChange, className, ...rest }) {
27
+ /**
28
+ * 默认值必须是稳定引用。每次渲染都新建的 `[]` / `{}` 会让
29
+ * `visibleColumns → leaves → sortRecords → rows → matrix` 这条 memo 链整段失效,
30
+ * 等于每次无关重渲染都重新扁平化、重新排序、重新铺合并矩阵。
31
+ */
32
+ var EMPTY_DATA = [];
33
+ var EMPTY_COLUMNS = [];
34
+ var EMPTY_KEYS = [];
35
+ var EMPTY_SCROLL = {};
36
+ /**
37
+ * 列宽基准,与 kui-vue `components/table/index.tsx` 的同名常量保持一致。
38
+ *
39
+ * 规矩只有一条:**`<col>` 落地的宽度、算 sticky 偏移的宽度、表格内容的最小宽度,三处都从同一个
40
+ * `width ?? 150` 出发**。写了 `width` 的列(固定与否都一样)照原值写进 colgroup,偏移也按原值累加;
41
+ * 没写 `width` 的固定列按 150 落地;没写 `width` 的普通列在 colgroup 上留 `auto` 去吸收容器撑出来的
42
+ * 多余宽度,但在最小宽度里按 150 计——容器比这份下限还窄时先出横向滚动条,而不是把 `auto` 列一路压到
43
+ * 表头一个字一行。反过来把带宽度的普通列也写成 `auto` 是不行的——`table-layout: fixed`
44
+ * 下它们会被固定列的确切宽度挤到 0 宽,横向能滚的距离也一并消失,固定列就"看着没生效"。
45
+ */
46
+ var DEFAULT_COLUMN_WIDTH = 150;
47
+ /** 勾选列宽度:colgroup、行内单元格样式和固定列的左偏移三处共用 */
48
+ var SELECTION_COLUMN_WIDTH = 50;
49
+ /** 一列的宽度基准:写了 `width` 照原值,没写按 150。sticky 偏移和表格最小宽度都走它。 */
50
+ var widthBasisOf = (column) => column.width ?? DEFAULT_COLUMN_WIDTH;
51
+ /** colgroup 落地的宽度:有 `width` 照写,缺宽度的固定列按 150,缺宽度的普通列交给 `auto`。 */
52
+ var colgroupWidthOf = (column) => column.width ?? (column.fixed ? DEFAULT_COLUMN_WIDTH : "auto");
53
+ /**
54
+ * 分栏表头要按真实滚动条宽度给表头容器让出一条槽位(见 `styles/index.less` 的 `k-table-split-header`),
55
+ * 这个值只能量、不能写死:新内核走 `.k-scroll` 的 `::-webkit-scrollbar { width }` 拿到 8px,
56
+ * Firefox 走 `scrollbar-width`(不认长度值的旧版退回 `thin` 的约 11px),更老的 Safari/Windows 是 15/17px。
57
+ * 探针必须带 `k-scroll` 类——量裸 `div` 得到的是浏览器默认滚动条宽度,不是库自己那套。
58
+ * 顺带一提 `overflow: scroll` 让两条轴都出滚动条,`offsetWidth - clientWidth` 才是纵向那一条的宽度。
59
+ *
60
+ * kui-react 与 kui-vue 的 `components/table/index.tsx` 里是逐字节相同的副本,改一边必须同步另一边。
61
+ */
62
+ var measureScrollbarWidth = () => {
63
+ if (typeof document === "undefined") return 0;
64
+ const probe = document.createElement("div");
65
+ probe.className = "k-scroll";
66
+ probe.style.cssText = "position:absolute;top:-9999px;left:-9999px;width:100px;height:100px;overflow:scroll";
67
+ document.body.appendChild(probe);
68
+ const width = probe.offsetWidth - probe.clientWidth;
69
+ probe.remove();
70
+ return width;
71
+ };
72
+ /**
73
+ * 单元格省略号。`rows` 是截断行数,`tooltip` 决定悬停提示:省略或 `true` 用被截断的那段文本,
74
+ * 传内容则换成指定的提示,`false` 关掉。
75
+ *
76
+ * 提示只在**真的被截断**时才弹——判定放在 hover 那一刻量 `scrollWidth` / `scrollHeight`,
77
+ * 于是既不用给每格挂观察器,也不会给没截断的格子凭空多出一个气泡。
78
+ * `Tooltip` 在关闭时不产出任何 DOM,所以整表开启时每格挂一份也不吃亏。
79
+ */
80
+ var EllipsisCell = (t0) => {
81
+ const $ = c(19);
82
+ const { rows, tooltip, className, children } = t0;
83
+ const innerRef = useRef(null);
84
+ const [tip, setTip] = useState(null);
85
+ const multiRows = rows > 1;
86
+ let t1;
87
+ if ($[0] !== multiRows || $[1] !== tooltip) {
88
+ t1 = () => {
89
+ const element = innerRef.current;
90
+ if (!element || tooltip === false) return;
91
+ if (!(multiRows ? element.scrollHeight > element.clientHeight + 1 : element.scrollWidth > element.clientWidth + 1)) return;
92
+ if (tooltip === void 0 || tooltip === true) {
93
+ setTip(element.textContent?.replace(/\s+/g, " ").trim() || null);
94
+ return;
95
+ }
96
+ setTip(tooltip);
97
+ };
98
+ $[0] = multiRows;
99
+ $[1] = tooltip;
100
+ $[2] = t1;
101
+ } else t1 = $[2];
102
+ const enter = t1;
103
+ const t2 = multiRows && "k-table-cell-ellipsis-rows";
104
+ let t3;
105
+ if ($[3] !== className || $[4] !== t2) {
106
+ t3 = clsx("k-table-cell-ellipsis", t2, className);
107
+ $[3] = className;
108
+ $[4] = t2;
109
+ $[5] = t3;
110
+ } else t3 = $[5];
111
+ let t4;
112
+ if ($[6] !== multiRows || $[7] !== rows) {
113
+ t4 = multiRows ? { WebkitLineClamp: rows } : void 0;
114
+ $[6] = multiRows;
115
+ $[7] = rows;
116
+ $[8] = t4;
117
+ } else t4 = $[8];
118
+ let t5;
119
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
120
+ t5 = () => setTip(null);
121
+ $[9] = t5;
122
+ } else t5 = $[9];
123
+ let t6;
124
+ if ($[10] !== children || $[11] !== enter || $[12] !== t3 || $[13] !== t4) {
125
+ t6 = /* @__PURE__ */ jsx("span", {
126
+ ref: innerRef,
127
+ className: t3,
128
+ style: t4,
129
+ onMouseEnter: enter,
130
+ onMouseLeave: t5,
131
+ children
132
+ });
133
+ $[10] = children;
134
+ $[11] = enter;
135
+ $[12] = t3;
136
+ $[13] = t4;
137
+ $[14] = t6;
138
+ } else t6 = $[14];
139
+ const node = t6;
140
+ if (tooltip === false) return node;
141
+ const t7 = Boolean(tip);
142
+ let t8;
143
+ if ($[15] !== node || $[16] !== t7 || $[17] !== tip) {
144
+ t8 = /* @__PURE__ */ jsx(Tooltip, {
145
+ trigger: "manual",
146
+ open: t7,
147
+ title: tip,
148
+ children: node
149
+ });
150
+ $[15] = node;
151
+ $[16] = t7;
152
+ $[17] = tip;
153
+ $[18] = t8;
154
+ } else t8 = $[18];
155
+ return t8;
156
+ };
157
+ /**
158
+ * 单元格原始值的渲染兜底,与 kui-vue 同口径(vue 的渲染器会把对象子节点转成文本:普通对象与
159
+ * `Date` 调 `String()`,数组逐项展开)。React 遇到同样的对象会直接抛
160
+ * "Objects are not valid as a React child" 把整张表打崩,所以先在这一层转掉。
161
+ * React 元素原样保留,数组继续按子节点序列交给 React(`[1, 2]` 两边都渲染成 "12")。
162
+ */
163
+ var renderRawValue = (value) => {
164
+ if (Array.isArray(value)) return value.map(renderRawValue);
165
+ if (value !== null && typeof value === "object" && !isValidElement(value)) return String(value);
166
+ return value;
167
+ };
168
+ /**
169
+ * 行展开状态。`expandedKeys` 提供时完全受控;否则 `expandAllRows` 决定初始是否全部展开,
170
+ * 并且此后 `data` 变化只补“新出现的父行”(见 `mergeExpandAllRows`),
171
+ * 用户手动展开或折叠过的行不会被异步到达的数据覆盖。
172
+ * “新出现”以本次数据里的父行为准,所以从数据里消失又回来的父行算新行、会重新展开,
173
+ * 组件不记住它曾被折叠(kui-vue 同口径)。
174
+ */
175
+ function useRowExpansion(t0) {
176
+ const $ = c(21);
177
+ const { parentKeys, expandedKeys, expandAllRows } = t0;
178
+ let t1;
179
+ if ($[0] !== expandAllRows || $[1] !== expandedKeys) {
180
+ t1 = {
181
+ expandedKeys,
182
+ expandAllRows
183
+ };
184
+ $[0] = expandAllRows;
185
+ $[1] = expandedKeys;
186
+ $[2] = t1;
187
+ } else t1 = $[2];
188
+ const controlSource = t1;
189
+ let t2;
190
+ if ($[3] !== controlSource || $[4] !== expandAllRows || $[5] !== expandedKeys || $[6] !== parentKeys) {
191
+ t2 = () => ({
192
+ controlSource,
193
+ parentKeys,
194
+ keys: new Set(expandedKeys ?? (expandAllRows ? parentKeys : []))
195
+ });
196
+ $[3] = controlSource;
197
+ $[4] = expandAllRows;
198
+ $[5] = expandedKeys;
199
+ $[6] = parentKeys;
200
+ $[7] = t2;
201
+ } else t2 = $[7];
202
+ const [state, setState] = useState(t2);
203
+ let keys = state.keys;
204
+ if (!Object.is(state.controlSource, controlSource)) {
205
+ let t3;
206
+ if ($[8] !== expandAllRows || $[9] !== expandedKeys || $[10] !== parentKeys) {
207
+ t3 = expandedKeys ?? (expandAllRows ? parentKeys : []);
208
+ $[8] = expandAllRows;
209
+ $[9] = expandedKeys;
210
+ $[10] = parentKeys;
211
+ $[11] = t3;
212
+ } else t3 = $[11];
213
+ let t4;
214
+ if ($[12] !== t3) {
215
+ t4 = new Set(t3);
216
+ $[12] = t3;
217
+ $[13] = t4;
218
+ } else t4 = $[13];
219
+ keys = t4;
220
+ setState({
221
+ controlSource,
222
+ parentKeys,
223
+ keys
224
+ });
225
+ } else if (expandedKeys === void 0 && expandAllRows) {
226
+ let t3;
227
+ if ($[14] !== parentKeys || $[15] !== state.keys || $[16] !== state.parentKeys) {
228
+ t3 = mergeExpandAllRows(state.parentKeys, parentKeys, state.keys);
229
+ $[14] = parentKeys;
230
+ $[15] = state.keys;
231
+ $[16] = state.parentKeys;
232
+ $[17] = t3;
233
+ } else t3 = $[17];
234
+ const merged = t3;
235
+ if (state.parentKeys !== parentKeys || merged.changed) {
236
+ keys = merged.changed ? merged.keys : state.keys;
237
+ setState({
238
+ controlSource,
239
+ parentKeys,
240
+ keys
241
+ });
242
+ }
243
+ }
244
+ let t3;
245
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
246
+ t3 = (next) => setState((previous) => ({
247
+ ...previous,
248
+ keys: next
249
+ }));
250
+ $[18] = t3;
251
+ } else t3 = $[18];
252
+ let t4;
253
+ if ($[19] !== keys) {
254
+ t4 = [keys, t3];
255
+ $[19] = keys;
256
+ $[20] = t4;
257
+ } else t4 = $[20];
258
+ return t4;
259
+ }
260
+ function Table({ data = EMPTY_DATA, columns = EMPTY_COLUMNS, ellipsis: tableEllipsis, selectedKeys, disabledKeys = EMPTY_KEYS, rowKey = "key", childrenColumnName = "children", expandedKeys, expandAllRows = false, expandRowByClick = false, indentSize = 20, scroll = EMPTY_SCROLL, size: sizeProp, striped, bordered = false, shape: shapeProp, checkable, loading, emptyText, header, footer, virtual = false, itemHeight = 44, overscan = 5, hiddenColumnKeys = EMPTY_KEYS, onSort, onRowClick, onSelect, onSelectAll, onSelectedKeysChange, onExpand, onExpandedKeysChange, className, ...rest }) {
25
261
  const inheritedAppearance = useConfigAppearance();
262
+ const tableLocale = (useContext(ConfigContext)?.locale || DEFAULT_LOCALE)?.k?.table;
26
263
  const size = sizeProp ?? inheritedAppearance.size;
27
264
  const shape = normalizeSurfaceShape(shapeProp ?? inheritedAppearance.shape ?? "round");
28
- const headerRef = useRef(null);
265
+ const rootRef = useRef(null);
29
266
  const bodyRef = useRef(null);
267
+ const headerWrapperRef = useRef(null);
268
+ /** 分栏表头里真正承担裁剪与横向同步的是内层(见 `styles/index.less` 的 `.k-table-thead-inner`)。 */
269
+ const headerScrollRef = useRef(null);
30
270
  const scrollFrameRef = useRef(0);
31
271
  const [innerSelected, setInnerSelected] = useValue(selectedKeys, (next) => new Set(next ?? []));
32
- const expansionSource = useMemo(() => ({
33
- expandedKeys,
34
- expandAllRows
35
- }), [expandedKeys, expandAllRows]);
36
- const [innerExpanded, setInnerExpanded] = useValue(expansionSource, (source) => new Set(source.expandedKeys ?? (source.expandAllRows ? flattenTreeData({
37
- data,
38
- childrenColumnName,
39
- getKey: (record) => {
40
- if (typeof rowKey === "function") return rowKey(record);
41
- const key = getRecordValue(record, rowKey);
42
- return typeof key === "string" || typeof key === "number" ? key : "";
43
- }
44
- }).filter((row) => row.hasChildren).map((row_0) => typeof rowKey === "function" ? rowKey(row_0.record) : getRecordValue(row_0.record, rowKey) ?? "") : [])));
45
272
  const [sort, setSort] = useState({
46
273
  key: "",
47
274
  order: null
@@ -50,11 +277,9 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
50
277
  left: false,
51
278
  right: false
52
279
  });
53
- const [scrollbarWidth, setScrollbarWidth] = useState(0);
54
280
  const [scrollTop, setScrollTop] = useState(0);
55
281
  const [viewportHeight, setViewportHeight] = useState(0);
56
282
  const selected = innerSelected;
57
- const currentExpanded = innerExpanded;
58
283
  const visibleColumns = useMemo(() => {
59
284
  const filter = (items) => items.flatMap((column) => {
60
285
  if (hiddenColumnKeys.includes(column.key)) return [];
@@ -67,65 +292,127 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
67
292
  });
68
293
  return filter(columns);
69
294
  }, [columns, hiddenColumnKeys]);
70
- const leaves = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);
71
- const split = scroll.y != null;
72
- const virtualEnabled = virtual && split;
73
- const keyOf = (record_0) => {
74
- if (typeof rowKey === "function") return rowKey(record_0);
75
- const key_0 = getRecordValue(record_0, rowKey);
76
- return typeof key_0 === "string" || typeof key_0 === "number" ? key_0 : "";
77
- };
78
- const isDisabled = (key_1) => disabledKeys.includes(key_1);
295
+ const inheritedColumns = useMemo(() => inheritColumnFixed(visibleColumns), [visibleColumns]);
296
+ const leaves = useMemo(() => flattenColumns(inheritedColumns), [inheritedColumns]);
297
+ /**
298
+ * 表格内容的最小宽度:每列的宽度基准之和(没写 `width` 的普通列按 150 计),再加勾选列的 50。
299
+ * `<col>` 上它们仍是 `auto`,宽容器里照旧平摊多余空间;这一份只是下限,容器比它还窄就出横向
300
+ * 滚动条。`scroll.x` 显式给了则照旧以 `scroll.x` 为准。
301
+ */
302
+ const contentMinWidth = useMemo(() => leaves.reduce((sum, column_0) => sum + widthBasisOf(column_0), 0) + (checkable ? SELECTION_COLUMN_WIDTH : 0), [leaves, checkable]);
303
+ const cellEllipsis = useMemo(() => {
304
+ const map = /* @__PURE__ */ new Map();
305
+ leaves.forEach((column_1) => map.set(column_1.key, resolveCellEllipsis(column_1.ellipsis, tableEllipsis)));
306
+ return map;
307
+ }, [leaves, tableEllipsis]);
308
+ const splitHeader = scroll.y != null;
309
+ const virtualEnabled = virtual && splitHeader;
310
+ const rawId = useId();
311
+ const headCellIds = useMemo(() => {
312
+ const ids = /* @__PURE__ */ new Map();
313
+ if (!splitHeader) return ids;
314
+ const prefix = `k-table-${rawId.replace(/[^a-zA-Z0-9_-]/g, "")}-`;
315
+ const visit = (items_0) => items_0.forEach((item) => {
316
+ ids.set(item.key, `${prefix}${ids.size}`);
317
+ if (item.children?.length) visit(item.children);
318
+ });
319
+ visit(inheritedColumns);
320
+ return ids;
321
+ }, [
322
+ splitHeader,
323
+ rawId,
324
+ inheritedColumns
325
+ ]);
326
+ const keyOf = useCallback((record) => resolveRowKey(record, rowKey), [rowKey]);
327
+ const isDisabled = (key) => disabledKeys.includes(key);
328
+ const allRows = useMemo(() => flattenTreeData({
329
+ data,
330
+ childrenColumnName,
331
+ getKey: keyOf
332
+ }), [
333
+ data,
334
+ childrenColumnName,
335
+ keyOf
336
+ ]);
337
+ const [currentExpanded, setInnerExpanded] = useRowExpansion({
338
+ parentKeys: useMemo(() => new Set(allRows.filter((row) => row.hasChildren).map((row_0) => resolveRowKey(row_0.record, rowKey))), [allRows, rowKey]),
339
+ expandedKeys,
340
+ expandAllRows
341
+ });
79
342
  const headerInfo = useMemo(() => {
80
343
  let maxDepth = 1;
81
- const depth = (items_0, level = 1) => items_0.forEach((item) => item.children?.length ? depth(item.children, level + 1) : maxDepth = Math.max(maxDepth, level));
82
- depth(visibleColumns);
344
+ const depth = (items_1, level = 1) => items_1.forEach((item_0) => item_0.children?.length ? depth(item_0.children, level + 1) : maxDepth = Math.max(maxDepth, level));
345
+ depth(inheritedColumns);
346
+ const fixedDirectionOf = (leafStart, leafCount) => {
347
+ const direction = leaves[leafStart]?.fixed;
348
+ if (!direction) return void 0;
349
+ for (let index = leafStart + 1; index < leafStart + leafCount; index += 1) if (leaves[index]?.fixed !== direction) return void 0;
350
+ return direction;
351
+ };
83
352
  const headerRows = [];
84
- const visit = (items_1, level_0) => {
353
+ const visit_0 = (items_2, level_0, startAt) => {
85
354
  headerRows[level_0] ??= [];
86
- items_1.forEach((item_0) => {
355
+ let cursor = startAt;
356
+ items_2.forEach((item_1) => {
357
+ const leafStart_0 = cursor;
358
+ const headerColSpan = countColumnLeaves(item_1);
87
359
  headerRows[level_0].push({
88
- ...item_0,
89
- headerColSpan: countColumnLeaves(item_0),
90
- headerRowSpan: item_0.children?.length ? 1 : maxDepth - level_0
360
+ ...item_1,
361
+ headerColSpan,
362
+ headerRowSpan: item_1.children?.length ? 1 : maxDepth - level_0,
363
+ leafStart: leafStart_0,
364
+ headerFixed: fixedDirectionOf(leafStart_0, headerColSpan)
91
365
  });
92
- if (item_0.children?.length) visit(item_0.children, level_0 + 1);
366
+ cursor += headerColSpan;
367
+ if (item_1.children?.length) visit_0(item_1.children, level_0 + 1, leafStart_0);
93
368
  });
94
369
  };
95
- visit(visibleColumns, 0);
370
+ visit_0(inheritedColumns, 0, 0);
96
371
  return {
97
372
  rows: headerRows,
98
373
  maxDepth
99
374
  };
100
- }, [visibleColumns]);
375
+ }, [inheritedColumns, leaves]);
101
376
  const fixed = useMemo(() => {
102
377
  const header_0 = {};
103
378
  const body = {};
104
- let left = checkable ? 50 : 0;
105
- leaves.forEach((column_0) => {
106
- if (column_0.fixed === "left") {
107
- const style = {
379
+ const leftBefore = [];
380
+ const rightAfter = [];
381
+ let left = checkable ? SELECTION_COLUMN_WIDTH : 0;
382
+ leaves.forEach((column_2, index_0) => {
383
+ leftBefore[index_0] = left;
384
+ if (column_2.fixed === "left") {
385
+ body[column_2.key] = {
108
386
  position: "sticky",
109
387
  left
110
388
  };
111
- header_0[column_0.key] = style;
112
- body[column_0.key] = style;
113
- left += column_0.width ?? 150;
389
+ left += widthBasisOf(column_2);
114
390
  }
115
391
  });
116
392
  let right = 0;
117
- [...leaves].reverse().forEach((column_1) => {
118
- if (column_1.fixed === "right") {
119
- body[column_1.key] = {
393
+ for (let index_1 = leaves.length - 1; index_1 >= 0; index_1 -= 1) {
394
+ rightAfter[index_1] = right;
395
+ const column_3 = leaves[index_1];
396
+ if (column_3.fixed === "right") {
397
+ body[column_3.key] = {
120
398
  position: "sticky",
121
399
  right
122
400
  };
123
- header_0[column_1.key] = {
401
+ right += widthBasisOf(column_3);
402
+ }
403
+ }
404
+ headerInfo.rows.forEach((row_1) => {
405
+ row_1.forEach((cell) => {
406
+ const lastLeaf = cell.leafStart + cell.headerColSpan - 1;
407
+ if (cell.headerFixed === "left") header_0[cell.key] = {
408
+ position: "sticky",
409
+ left: leftBefore[cell.leafStart] ?? 0
410
+ };
411
+ else if (cell.headerFixed === "right") header_0[cell.key] = {
124
412
  position: "sticky",
125
- right: split ? right + scrollbarWidth : right
413
+ right: rightAfter[lastLeaf] ?? 0
126
414
  };
127
- right += column_1.width ?? 150;
128
- }
415
+ });
129
416
  });
130
417
  return {
131
418
  header: header_0,
@@ -134,39 +421,52 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
134
421
  }, [
135
422
  checkable,
136
423
  leaves,
137
- scrollbarWidth,
138
- split
424
+ headerInfo
139
425
  ]);
140
- const fixedClass = (column_2, index) => clsx({
141
- "k-table-cell-fix-left": column_2.fixed === "left",
142
- "k-table-cell-fix-left-last": column_2.fixed === "left" && leaves[index + 1]?.fixed !== "left",
143
- "k-table-cell-fix-right": column_2.fixed === "right",
144
- "k-table-cell-fix-right-first": column_2.fixed === "right" && leaves[index - 1]?.fixed !== "right",
145
- "k-table-cell-sorter": column_2.sorter
426
+ const fixedClass = (column_4, index_2, colSpan = 1) => clsx({
427
+ "k-table-cell-fix-left": column_4.fixed === "left",
428
+ "k-table-cell-fix-left-last": column_4.fixed === "left" && leaves[index_2 + colSpan]?.fixed !== "left",
429
+ "k-table-cell-fix-right": column_4.fixed === "right",
430
+ "k-table-cell-fix-right-first": column_4.fixed === "right" && leaves[index_2 - 1]?.fixed !== "right",
431
+ "k-table-cell-sorter": column_4.sorter,
432
+ "k-table-cell-last-column": index_2 + colSpan === leaves.length
433
+ });
434
+ /**
435
+ * 表头格的固定类按它覆盖的叶子区间判断。`*-last`/`*-first` 决定横向滚动时 ping 阴影画在哪一格的
436
+ * 边沿上,分组表头若改用叶子下标去查会拿到 `-1`,把不该画阴影的父格标成最后一列固定格。
437
+ *
438
+ * `k-table-cell-last-column` 同理必须按区间末尾算:bordered 时只有真的盖到最后一列的格子才让出
439
+ * 右边框。表头每一行的格数不一样(分组格占 `colSpan`),行末那一格往往并不是最后一列。
440
+ */
441
+ const headerFixedClass = (cell_0) => clsx({
442
+ "k-table-cell-fix-left": cell_0.headerFixed === "left",
443
+ "k-table-cell-fix-left-last": cell_0.headerFixed === "left" && leaves[cell_0.leafStart + cell_0.headerColSpan]?.fixed !== "left",
444
+ "k-table-cell-fix-right": cell_0.headerFixed === "right",
445
+ "k-table-cell-fix-right-first": cell_0.headerFixed === "right" && leaves[cell_0.leafStart - 1]?.fixed !== "right",
446
+ "k-table-cell-sorter": cell_0.sorter,
447
+ "k-table-cell-last-column": cell_0.leafStart + cell_0.headerColSpan === leaves.length
146
448
  });
147
- const leafIndexOf = (column_3) => leaves.findIndex((item_1) => item_1.key === column_3.key);
148
- const sortRecords = (records) => {
449
+ const sortRecords = useCallback((records) => {
149
450
  const result = [...records];
150
- if (sort.key && sort.order && leaves.find((column_4) => column_4.key === sort.key)?.sorter === true) result.sort((a, b) => {
151
- const first = getRecordValue(a, sort.key), second = getRecordValue(b, sort.key);
152
- if (first === second) return 0;
153
- const comparison = typeof first === "number" && typeof second === "number" || typeof first === "string" && typeof second === "string" ? first > second ? 1 : -1 : 0;
451
+ if (sort.key && sort.order && leaves.find((column_5) => column_5.key === sort.key)?.sorter === true) result.sort((a, b) => {
452
+ const comparison = compareSortValues(getRecordValue(a, sort.key), getRecordValue(b, sort.key));
154
453
  return sort.order === "asc" ? comparison : -comparison;
155
454
  });
156
455
  return result;
157
- };
158
- const allRows = flattenTreeData({
159
- data,
160
- childrenColumnName,
161
- getKey: keyOf
162
- });
163
- const rows = flattenTreeData({
456
+ }, [leaves, sort]);
457
+ const rows = useMemo(() => flattenTreeData({
164
458
  data,
165
459
  childrenColumnName,
166
460
  expandedKeys: currentExpanded,
167
461
  getKey: keyOf,
168
462
  sortRecords
169
- });
463
+ }), [
464
+ data,
465
+ childrenColumnName,
466
+ currentExpanded,
467
+ keyOf,
468
+ sortRecords
469
+ ]);
170
470
  const virtualRange = useMemo(() => {
171
471
  if (!virtualEnabled) return {
172
472
  start: 0,
@@ -189,38 +489,46 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
189
489
  itemHeight,
190
490
  overscan
191
491
  ]);
192
- const treeEnabled = allRows.some((row_1) => row_1.hasChildren);
492
+ const treeEnabled = useMemo(() => allRows.some((row_2) => row_2.hasChildren), [allRows]);
193
493
  const matrix = useMemo(() => {
194
- if (!leaves.some((column_5) => column_5.rowSpan !== void 0 || column_5.colSpan !== void 0)) return [];
494
+ if (!leaves.some((column_6) => column_6.rowSpan !== void 0 || column_6.colSpan !== void 0)) return [];
195
495
  const result_0 = rows.map(() => leaves.map(() => ({
196
496
  rowSpan: 1,
197
497
  colSpan: 1,
198
498
  show: true
199
499
  })));
200
- rows.forEach(({ record: record_1 }, row_2) => leaves.forEach((column_6, col) => {
201
- if (!result_0[row_2][col].show) return;
202
- const rowSpan = typeof column_6.rowSpan === "function" ? column_6.rowSpan(record_1, row_2) : column_6.rowSpan ?? 1;
203
- const colSpan = typeof column_6.colSpan === "function" ? column_6.colSpan(record_1, row_2) : column_6.colSpan ?? 1;
500
+ rows.forEach(({ record: record_0 }, row_3) => leaves.forEach((column_7, col) => {
501
+ if (!result_0[row_3][col].show) return;
502
+ const rowSpan = typeof column_7.rowSpan === "function" ? column_7.rowSpan(record_0, row_3) : column_7.rowSpan ?? 1;
503
+ const colSpan_0 = typeof column_7.colSpan === "function" ? column_7.colSpan(record_0, row_3) : column_7.colSpan ?? 1;
204
504
  const normalizedRowSpan = Number.isFinite(rowSpan) ? Math.max(0, Math.floor(rowSpan)) : 1;
205
- const normalizedColSpan = Number.isFinite(colSpan) ? Math.max(0, Math.floor(colSpan)) : 1;
505
+ const normalizedColSpan = Number.isFinite(colSpan_0) ? Math.max(0, Math.floor(colSpan_0)) : 1;
206
506
  if (normalizedRowSpan === 0 || normalizedColSpan === 0) {
207
- result_0[row_2][col].show = false;
507
+ result_0[row_3][col].show = false;
208
508
  return;
209
509
  }
210
- result_0[row_2][col] = {
510
+ result_0[row_3][col] = {
211
511
  rowSpan: normalizedRowSpan,
212
512
  colSpan: normalizedColSpan,
213
513
  show: true
214
514
  };
215
515
  for (let r = 0; r < normalizedRowSpan; r++) for (let c = 0; c < normalizedColSpan; c++) if (r || c) {
216
- const cell = result_0[row_2 + r]?.[col + c];
217
- if (cell) cell.show = false;
516
+ const cell_1 = result_0[row_3 + r]?.[col + c];
517
+ if (cell_1) cell_1.show = false;
218
518
  }
219
519
  }));
220
520
  return result_0;
221
521
  }, [leaves, rows]);
222
- const enabled = allRows.map((row_3) => row_3.record).filter((record_2) => !isDisabled(keyOf(record_2)));
223
- const checkedCount = enabled.filter((record_3) => selected.has(keyOf(record_3))).length;
522
+ const enabled = useMemo(() => allRows.map((row_4) => row_4.record).filter((record_1) => !disabledKeys.includes(keyOf(record_1))), [
523
+ allRows,
524
+ disabledKeys,
525
+ keyOf
526
+ ]);
527
+ const checkedCount = useMemo(() => enabled.filter((record_2) => selected.has(keyOf(record_2))).length, [
528
+ enabled,
529
+ selected,
530
+ keyOf
531
+ ]);
224
532
  const allChecked = enabled.length > 0 && checkedCount === enabled.length;
225
533
  const indeterminate = checkedCount > 0 && checkedCount < enabled.length;
226
534
  const commitSelection = (next_0) => {
@@ -231,52 +539,51 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
231
539
  };
232
540
  const toggleAll = ({ checked }) => {
233
541
  const next_1 = new Set(selected);
234
- allRows.forEach(({ record: record_4 }) => {
235
- const key_2 = keyOf(record_4);
236
- if (!isDisabled(key_2)) {
237
- if (checked) next_1.add(key_2);
238
- else next_1.delete(key_2);
542
+ allRows.forEach(({ record: record_3 }) => {
543
+ const key_0 = keyOf(record_3);
544
+ if (!isDisabled(key_0)) {
545
+ if (checked) next_1.add(key_0);
546
+ else next_1.delete(key_0);
239
547
  }
240
548
  });
241
549
  const keys_0 = commitSelection(next_1);
242
550
  onSelectAll?.(checked, keys_0);
243
551
  };
244
- const toggleOne = (event, record_5) => {
245
- const key_3 = keyOf(record_5);
246
- if (isDisabled(key_3)) return;
552
+ const toggleOne = (event, record_4) => {
553
+ const key_1 = keyOf(record_4);
554
+ if (isDisabled(key_1)) return;
247
555
  const next_2 = new Set(selected);
248
- if (event.checked) next_2.add(key_3);
249
- else next_2.delete(key_3);
556
+ if (event.checked) next_2.add(key_1);
557
+ else next_2.delete(key_1);
250
558
  const keys_1 = commitSelection(next_2);
251
- onSelect?.(record_5, event.checked, keys_1);
559
+ onSelect?.(record_4, event.checked, keys_1);
252
560
  };
253
- const toggleExpand = (record_6) => {
254
- const key_4 = keyOf(record_6);
561
+ const toggleExpand = (record_5) => {
562
+ const key_2 = keyOf(record_5);
255
563
  const next_3 = new Set(currentExpanded);
256
- const nextExpanded = !next_3.has(key_4);
257
- if (nextExpanded) next_3.add(key_4);
258
- else next_3.delete(key_4);
564
+ const nextExpanded = !next_3.has(key_2);
565
+ if (nextExpanded) next_3.add(key_2);
566
+ else next_3.delete(key_2);
259
567
  setInnerExpanded(next_3);
260
568
  onExpandedKeysChange?.([...next_3]);
261
- onExpand?.(nextExpanded, record_6);
569
+ onExpand?.(nextExpanded, record_5);
262
570
  };
263
- const changeSort = (column_7) => {
264
- if (!column_7.sorter) return;
571
+ const changeSort = (column_8) => {
572
+ if (!column_8.sorter) return;
265
573
  const next_4 = {
266
- key: column_7.key,
267
- order: sort.key !== column_7.key ? "asc" : sort.order === "asc" ? "desc" : sort.order === "desc" ? null : "asc"
574
+ key: column_8.key,
575
+ order: sort.key !== column_8.key ? "asc" : sort.order === "asc" ? "desc" : sort.order === "desc" ? null : "asc"
268
576
  };
269
577
  setSort(next_4);
270
- if (typeof column_7.sorter === "function") column_7.sorter(next_4);
578
+ if (typeof column_8.sorter === "function") column_8.sorter(next_4);
271
579
  onSort?.(next_4);
272
580
  };
273
581
  const handleScroll = (event_0) => {
274
- const target = event_0.currentTarget;
582
+ const body_0 = bodyRef.current ?? event_0.currentTarget;
583
+ if (splitHeader && headerScrollRef.current) headerScrollRef.current.scrollLeft = body_0.scrollLeft;
275
584
  if (scrollFrameRef.current) return;
276
585
  scrollFrameRef.current = requestAnimationFrame(() => {
277
586
  scrollFrameRef.current = 0;
278
- const body_0 = bodyRef.current ?? target;
279
- if (split && headerRef.current) headerRef.current.scrollLeft = body_0.scrollLeft;
280
587
  const max = Math.max(0, body_0.scrollWidth - body_0.clientWidth);
281
588
  const update = () => {
282
589
  if (virtualEnabled) setScrollTop(body_0.scrollTop);
@@ -294,7 +601,6 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
294
601
  const body_1 = bodyRef.current;
295
602
  if (!body_1) return;
296
603
  const measure = () => {
297
- setScrollbarWidth(split ? Math.max(0, body_1.offsetWidth - body_1.clientWidth - (bordered ? 1 : 0)) : 0);
298
604
  setViewportHeight(body_1.clientHeight);
299
605
  const max_0 = Math.max(0, body_1.scrollWidth - body_1.clientWidth);
300
606
  const nextPing_0 = {
@@ -313,63 +619,82 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
313
619
  };
314
620
  }
315
621
  return () => cancelAnimationFrame(scrollFrameRef.current);
316
- }, [bordered, split]);
317
- const colgroup = (headerTable = false) => /* @__PURE__ */ jsxs("colgroup", { children: [
318
- checkable && /* @__PURE__ */ jsx("col", { style: { width: 50 } }),
319
- leaves.map((column_8) => /* @__PURE__ */ jsx("col", { style: {
320
- width: column_8.width ?? 150,
321
- minWidth: column_8.width ?? 150
322
- } }, column_8.key)),
323
- headerTable && split && /* @__PURE__ */ jsx("col", { style: { width: scrollbarWidth } })
324
- ] });
325
- const thead = /* @__PURE__ */ jsx("thead", { children: headerInfo.rows.map((row_4, rowIndex) => /* @__PURE__ */ jsxs("tr", { children: [
326
- checkable && rowIndex === 0 && /* @__PURE__ */ jsx("th", {
327
- rowSpan: headerInfo.maxDepth,
328
- className: clsx("k-table-cell-fix-left", { "k-table-cell-fix-left-last": ping.left }),
329
- style: {
330
- left: 0,
331
- zIndex: 3
332
- },
333
- children: /* @__PURE__ */ jsx(checkbox_default, {
334
- checked: allChecked,
335
- indeterminate,
336
- onChange: toggleAll,
337
- disabled: !enabled.length
338
- })
622
+ }, []);
623
+ useLayoutEffect(() => {
624
+ const root = rootRef.current;
625
+ if (!root) return;
626
+ root.style.setProperty("--k-table-scrollbar-width", splitHeader ? `${measureScrollbarWidth()}px` : "");
627
+ }, [splitHeader]);
628
+ useEffect(() => {
629
+ const wrapper = headerWrapperRef.current;
630
+ const body_2 = bodyRef.current;
631
+ if (!splitHeader || !wrapper || !body_2) return;
632
+ const onWheel = (event_1) => {
633
+ const unit = event_1.deltaMode === 1 ? 16 : event_1.deltaMode === 2 ? body_2.clientHeight : 1;
634
+ const maxTop = Math.max(0, body_2.scrollHeight - body_2.clientHeight);
635
+ const maxLeft = Math.max(0, body_2.scrollWidth - body_2.clientWidth);
636
+ const nextTop = Math.min(maxTop, Math.max(0, body_2.scrollTop + event_1.deltaY * unit));
637
+ const nextLeft = Math.min(maxLeft, Math.max(0, body_2.scrollLeft + event_1.deltaX * unit));
638
+ if (nextTop === body_2.scrollTop && nextLeft === body_2.scrollLeft) return;
639
+ event_1.preventDefault();
640
+ body_2.scrollTo({
641
+ top: nextTop,
642
+ left: nextLeft
643
+ });
644
+ };
645
+ wrapper.addEventListener("wheel", onWheel, { passive: false });
646
+ return () => wrapper.removeEventListener("wheel", onWheel);
647
+ }, [splitHeader]);
648
+ const colgroup = /* @__PURE__ */ jsxs("colgroup", { children: [checkable && /* @__PURE__ */ jsx("col", { style: { width: SELECTION_COLUMN_WIDTH } }), leaves.map((column_9) => /* @__PURE__ */ jsx("col", { style: { width: colgroupWidthOf(column_9) } }, column_9.key))] });
649
+ const thead = /* @__PURE__ */ jsx("thead", { children: headerInfo.rows.map((row_5, rowIndex) => /* @__PURE__ */ jsxs("tr", { children: [checkable && rowIndex === 0 && /* @__PURE__ */ jsx("th", {
650
+ rowSpan: headerInfo.maxDepth,
651
+ className: clsx("k-table-cell-fix-left", {
652
+ "k-table-cell-fix-left-last": ping.left && leaves[0]?.fixed !== "left",
653
+ "k-table-cell-last-column": !leaves.length
339
654
  }),
340
- row_4.map((column_9, index_0) => /* @__PURE__ */ jsx("th", {
341
- colSpan: column_9.headerColSpan,
342
- rowSpan: column_9.headerRowSpan,
343
- className: fixedClass(column_9, leafIndexOf(column_9)),
344
- style: fixed.header[column_9.key],
345
- onClick: () => changeSort(column_9),
346
- children: /* @__PURE__ */ jsxs("div", {
347
- className: "k-table-header-col",
348
- children: [column_9.renderHeader?.(column_9, index_0) ?? column_9.title, column_9.sorter && /* @__PURE__ */ jsxs("span", {
349
- className: "k-table-sorter",
350
- children: [/* @__PURE__ */ jsx(Icon, {
351
- type: Triangle,
352
- reverseFill: true,
353
- className: clsx("k-table-sorter-up", { "k-table-sorter-active": sort.key === column_9.key && sort.order === "asc" })
354
- }), /* @__PURE__ */ jsx(Icon, {
355
- type: Triangle,
356
- reverseFill: true,
357
- className: clsx("k-table-sorter-down", { "k-table-sorter-active": sort.key === column_9.key && sort.order === "desc" })
358
- })]
655
+ style: { left: 0 },
656
+ children: /* @__PURE__ */ jsx(checkbox_default, {
657
+ checked: allChecked,
658
+ indeterminate,
659
+ onChange: toggleAll,
660
+ disabled: !enabled.length,
661
+ "aria-label": tableLocale?.selectAllRows || "Select all"
662
+ })
663
+ }), row_5.map((column_10, index_3) => /* @__PURE__ */ jsx("th", {
664
+ id: splitHeader ? headCellIds.get(column_10.key) : void 0,
665
+ colSpan: column_10.headerColSpan,
666
+ rowSpan: column_10.headerRowSpan,
667
+ className: headerFixedClass(column_10),
668
+ style: fixed.header[column_10.key],
669
+ tabIndex: column_10.sorter ? 0 : void 0,
670
+ "aria-sort": !column_10.sorter ? void 0 : sort.key !== column_10.key || !sort.order ? "none" : sort.order === "asc" ? "ascending" : "descending",
671
+ onClick: () => changeSort(column_10),
672
+ onKeyDown: (event_2) => {
673
+ if (!column_10.sorter || event_2.key !== "Enter" && event_2.key !== " ") return;
674
+ event_2.preventDefault();
675
+ changeSort(column_10);
676
+ },
677
+ children: /* @__PURE__ */ jsxs("div", {
678
+ className: "k-table-header-col",
679
+ children: [column_10.renderHeader?.(column_10, index_3) ?? column_10.title, column_10.sorter && /* @__PURE__ */ jsxs("span", {
680
+ className: "k-table-sorter",
681
+ children: [/* @__PURE__ */ jsx(Icon, {
682
+ type: Triangle,
683
+ reverseFill: true,
684
+ className: clsx("k-table-sorter-up", { "k-table-sorter-active": sort.key === column_10.key && sort.order === "asc" })
685
+ }), /* @__PURE__ */ jsx(Icon, {
686
+ type: Triangle,
687
+ reverseFill: true,
688
+ className: clsx("k-table-sorter-down", { "k-table-sorter-active": sort.key === column_10.key && sort.order === "desc" })
359
689
  })]
360
- })
361
- }, column_9.key)),
362
- split && rowIndex === 0 && /* @__PURE__ */ jsx("th", {
363
- rowSpan: headerInfo.maxDepth,
364
- className: "k-table-scrollbar-patch",
365
- style: { width: scrollbarWidth }
690
+ })]
366
691
  })
367
- ] }, rowIndex)) });
692
+ }, column_10.key))] }, rowIndex)) });
368
693
  const renderedRows = useMemo(() => {
369
694
  const start = virtualRange.start;
370
695
  const end = virtualRange.end;
371
- return rows.slice(start, end).map((row_5, idx) => ({
372
- ...row_5,
696
+ return rows.slice(start, end).map((row_6, idx) => ({
697
+ ...row_6,
373
698
  rowIndex: start + idx
374
699
  }));
375
700
  }, [rows, virtualRange]);
@@ -378,65 +703,82 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
378
703
  className: "k-table-virtual-spacer k-table-virtual-spacer-top",
379
704
  "aria-hidden": "true",
380
705
  children: /* @__PURE__ */ jsx("td", {
706
+ className: "k-table-cell-last-column",
381
707
  colSpan: leaves.length + (checkable ? 1 : 0),
382
708
  style: { height: virtualRange.offset }
383
709
  })
384
710
  }),
385
- renderedRows.map(({ record: record_7, depth: depth_0, hasChildren, rowIndex: rowIndex_0 }) => /* @__PURE__ */ jsxs("tr", {
711
+ renderedRows.map(({ record: record_6, depth: depth_0, hasChildren, rowIndex: rowIndex_0 }) => /* @__PURE__ */ jsxs("tr", {
386
712
  className: virtualEnabled && rowIndex_0 % 2 === 1 ? "k-table-row-even" : void 0,
387
713
  style: virtualEnabled ? { height: itemHeight } : void 0,
388
- onClick: (event_1) => {
389
- if (event_1.target.closest(".k-checkbox, .k-table-tree-toggle")) return;
390
- if (expandRowByClick && hasChildren) toggleExpand(record_7);
391
- onRowClick?.(record_7, rowIndex_0);
714
+ onClick: (event_3) => {
715
+ if (event_3.target.closest(".k-checkbox, .k-table-tree-toggle")) return;
716
+ if (expandRowByClick && hasChildren) toggleExpand(record_6);
717
+ onRowClick?.(record_6, rowIndex_0);
392
718
  },
393
719
  children: [checkable && /* @__PURE__ */ jsx("td", {
394
- className: clsx("k-table-cell-fix-left", { "k-table-cell-fix-left-last": ping.left }),
720
+ className: clsx("k-table-cell-fix-left", {
721
+ "k-table-cell-fix-left-last": ping.left && leaves[0]?.fixed !== "left",
722
+ "k-table-cell-last-column": !leaves.length
723
+ }),
395
724
  style: {
396
- width: 50,
725
+ width: SELECTION_COLUMN_WIDTH,
397
726
  left: 0
398
727
  },
399
728
  children: /* @__PURE__ */ jsx(checkbox_default, {
400
- checked: selected.has(keyOf(record_7)),
401
- disabled: isDisabled(keyOf(record_7)),
402
- onChange: (event_2) => toggleOne(event_2, record_7)
729
+ checked: selected.has(keyOf(record_6)),
730
+ disabled: isDisabled(keyOf(record_6)),
731
+ onChange: (event_4) => toggleOne(event_4, record_6),
732
+ "aria-label": tableLocale?.selectRow || "Select row"
403
733
  })
404
- }), leaves.map((column_10, colIndex) => {
405
- const cell_0 = matrix[rowIndex_0]?.[colIndex] ?? {
734
+ }), leaves.map((column_11, colIndex) => {
735
+ const cell_2 = matrix[rowIndex_0]?.[colIndex] ?? {
406
736
  rowSpan: 1,
407
737
  colSpan: 1,
408
738
  show: true
409
739
  };
410
- if (!cell_0.show) return null;
411
- const value = getRecordValue(record_7, column_10.key);
412
- const content = column_10.render?.(value, record_7, rowIndex_0, column_10) ?? value;
740
+ if (!cell_2.show) return null;
741
+ const value = getRecordValue(record_6, column_11.key);
742
+ const content = column_11.render?.(value, record_6, rowIndex_0, column_11) ?? renderRawValue(value);
743
+ const ellipsis = cellEllipsis.get(column_11.key);
413
744
  return /* @__PURE__ */ jsx("td", {
414
- rowSpan: cell_0.rowSpan > 1 ? cell_0.rowSpan : void 0,
415
- colSpan: cell_0.colSpan > 1 ? cell_0.colSpan : void 0,
416
- className: fixedClass(column_10, colIndex),
417
- style: fixed.body[column_10.key],
745
+ "aria-labelledby": splitHeader ? headCellIds.get(column_11.key) : void 0,
746
+ rowSpan: cell_2.rowSpan > 1 ? cell_2.rowSpan : void 0,
747
+ colSpan: cell_2.colSpan > 1 ? cell_2.colSpan : void 0,
748
+ className: fixedClass(column_11, colIndex, cell_2.colSpan),
749
+ style: fixed.body[column_11.key],
418
750
  children: treeEnabled && colIndex === 0 ? /* @__PURE__ */ jsxs("div", {
419
751
  className: "k-table-tree-cell",
420
752
  style: { paddingLeft: depth_0 * indentSize },
421
753
  children: [hasChildren ? /* @__PURE__ */ jsx("button", {
422
754
  type: "button",
423
755
  className: "k-table-tree-toggle",
424
- "aria-label": currentExpanded.has(keyOf(record_7)) ? "Collapse row" : "Expand row",
425
- "aria-expanded": currentExpanded.has(keyOf(record_7)),
426
- onClick: () => toggleExpand(record_7),
427
- children: /* @__PURE__ */ jsx(Icon, { type: currentExpanded.has(keyOf(record_7)) ? ChevronDown : ChevronRight })
428
- }) : /* @__PURE__ */ jsx("span", { className: "k-table-tree-indent" }), /* @__PURE__ */ jsx("span", {
756
+ "aria-label": currentExpanded.has(keyOf(record_6)) ? tableLocale?.collapseRow || "Collapse row" : tableLocale?.expandRow || "Expand row",
757
+ "aria-expanded": currentExpanded.has(keyOf(record_6)),
758
+ onClick: () => toggleExpand(record_6),
759
+ children: /* @__PURE__ */ jsx(Icon, { type: currentExpanded.has(keyOf(record_6)) ? ChevronDown : ChevronRight })
760
+ }) : /* @__PURE__ */ jsx("span", { className: "k-table-tree-indent" }), ellipsis ? /* @__PURE__ */ jsx(EllipsisCell, {
761
+ rows: ellipsis.rows,
762
+ tooltip: ellipsis.tooltip,
763
+ className: "k-table-tree-content",
764
+ children: content
765
+ }) : /* @__PURE__ */ jsx("span", {
429
766
  className: "k-table-tree-content",
430
767
  children: content
431
768
  })]
769
+ }) : ellipsis ? /* @__PURE__ */ jsx(EllipsisCell, {
770
+ rows: ellipsis.rows,
771
+ tooltip: ellipsis.tooltip,
772
+ children: content
432
773
  }) : content
433
- }, column_10.key);
774
+ }, column_11.key);
434
775
  })]
435
- }, keyOf(record_7))),
776
+ }, keyOf(record_6))),
436
777
  virtualEnabled && virtualRange.offset + (virtualRange.end - virtualRange.start) * itemHeight < virtualRange.total && /* @__PURE__ */ jsx("tr", {
437
778
  className: "k-table-virtual-spacer k-table-virtual-spacer-bottom",
438
779
  "aria-hidden": "true",
439
780
  children: /* @__PURE__ */ jsx("td", {
781
+ className: "k-table-cell-last-column",
440
782
  colSpan: leaves.length + (checkable ? 1 : 0),
441
783
  style: { height: virtualRange.total - virtualRange.offset - (virtualRange.end - virtualRange.start) * itemHeight }
442
784
  })
@@ -444,26 +786,20 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
444
786
  ] });
445
787
  const tableStyle = {
446
788
  width: "100%",
447
- minWidth: typeof scroll.x === "number" ? scroll.x : scroll.x || "100%",
789
+ minWidth: scroll.x || (contentMinWidth ? `${contentMinWidth}px` : "100%"),
448
790
  tableLayout: "fixed"
449
791
  };
450
- const renderTable = (showHeader, showBody, headerTable_0 = false) => /* @__PURE__ */ jsxs("table", {
451
- style: tableStyle,
452
- children: [
453
- colgroup(headerTable_0),
454
- showHeader && thead,
455
- showBody && tbody
456
- ]
457
- });
458
792
  const empty = !rows.length || !visibleColumns.length;
459
793
  return /* @__PURE__ */ jsxs("div", {
460
794
  ...rest,
795
+ ref: rootRef,
461
796
  className: clsx("k-table", {
462
797
  "k-table-striped": striped,
463
798
  "k-table-sm": size === "small",
464
799
  "k-table-lg": size === "large",
465
800
  "k-table-bordered": bordered,
466
801
  "k-table-has-footer": !!footer,
802
+ "k-table-split-header": splitHeader,
467
803
  [`k-table-${shape}`]: shape,
468
804
  "k-table-ping-left": ping.left,
469
805
  "k-table-ping-right": ping.right,
@@ -474,28 +810,41 @@ function Table({ data = [], columns = [], selectedKeys, disabledKeys = [], rowKe
474
810
  className: "k-table-header",
475
811
  children: header
476
812
  }),
477
- split && /* @__PURE__ */ jsx("div", {
813
+ splitHeader && /* @__PURE__ */ jsx("div", {
478
814
  className: "k-table-thead",
479
- ref: headerRef,
480
- style: { overflow: "hidden" },
481
- children: renderTable(true, false, true)
815
+ ref: headerWrapperRef,
816
+ children: /* @__PURE__ */ jsx("div", {
817
+ className: "k-table-thead-inner",
818
+ ref: headerScrollRef,
819
+ children: /* @__PURE__ */ jsxs("table", {
820
+ style: tableStyle,
821
+ children: [colgroup, thead]
822
+ })
823
+ })
482
824
  }),
483
825
  /* @__PURE__ */ jsxs("div", {
484
826
  className: "k-table-body k-scroll",
485
827
  ref: bodyRef,
486
828
  style: {
487
829
  overflowY: scroll.y ? "scroll" : "auto",
488
- overflowX: data.length ? "auto" : "hidden",
830
+ overflowX: "auto",
489
831
  maxHeight: scroll.y
490
832
  },
491
833
  onScroll: handleScroll,
492
834
  children: [
493
- renderTable(!split, true),
835
+ /* @__PURE__ */ jsxs("table", {
836
+ style: tableStyle,
837
+ children: [
838
+ colgroup,
839
+ !splitHeader && thead,
840
+ tbody
841
+ ]
842
+ }),
494
843
  empty && loading && /* @__PURE__ */ jsx("div", {
495
844
  className: "k-table-loading-placeholder",
496
845
  "aria-hidden": "true"
497
846
  }),
498
- empty && !loading && /* @__PURE__ */ jsx(Empty, { description: emptyText })
847
+ empty && !loading && /* @__PURE__ */ jsx(Empty, { description: emptyText || tableLocale?.emptyText })
499
848
  ]
500
849
  }),
501
850
  footer && /* @__PURE__ */ jsx("div", {