naive-ui 2.21.2 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/es/_internal/close/src/styles/index.cssr.js +6 -5
  2. package/es/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
  3. package/es/_internal/scrollbar/src/ScrollBar.js +13 -7
  4. package/es/_internal/selection/src/Selection.js +11 -9
  5. package/es/_internal/selection/src/styles/index.cssr.js +6 -2
  6. package/es/alert/src/Alert.d.ts +20 -20
  7. package/es/alert/src/Alert.js +22 -22
  8. package/es/alert/src/styles/index.cssr.js +45 -45
  9. package/es/anchor/src/AnchorAdapter.js +12 -12
  10. package/es/anchor/src/styles/index.cssr.js +41 -41
  11. package/es/avatar/src/Avatar.d.ts +5 -3
  12. package/es/avatar/src/Avatar.js +7 -5
  13. package/es/avatar/src/styles/index.cssr.js +3 -5
  14. package/es/button/src/Button.d.ts +60 -60
  15. package/es/button/src/Button.js +107 -106
  16. package/es/button/src/styles/button.cssr.js +83 -80
  17. package/es/button/styles/dark.js +3 -3
  18. package/es/button/styles/light.d.ts +3 -3
  19. package/es/button/styles/light.js +1 -1
  20. package/es/calendar/src/Calendar.d.ts +37 -30
  21. package/es/calendar/styles/light.d.ts +3 -3
  22. package/es/cascader/src/Cascader.d.ts +135 -0
  23. package/es/cascader/src/Cascader.js +2 -4
  24. package/es/cascader/src/CascaderMenu.d.ts +345 -0
  25. package/es/cascader/src/CascaderMenu.js +6 -5
  26. package/es/cascader/src/CascaderOption.d.ts +18 -0
  27. package/es/cascader/src/CascaderSelectMenu.d.ts +18 -0
  28. package/es/cascader/src/CascaderSubmenu.d.ts +18 -0
  29. package/es/cascader/styles/dark.js +3 -1
  30. package/es/cascader/styles/light.d.ts +13 -0
  31. package/es/cascader/styles/light.js +3 -1
  32. package/es/color-picker/src/ColorInputUnit.d.ts +3 -3
  33. package/es/color-picker/src/ColorPicker.d.ts +27 -27
  34. package/es/color-picker/styles/light.d.ts +3 -3
  35. package/es/config-provider/src/ConfigProvider.d.ts +21 -0
  36. package/es/data-table/src/DataTable.d.ts +30 -30
  37. package/es/data-table/src/DataTable.js +7 -14
  38. package/es/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
  39. package/es/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
  40. package/es/data-table/src/MainTable.js +2 -3
  41. package/es/data-table/src/TableParts/Body.d.ts +18 -7
  42. package/es/data-table/src/TableParts/Body.js +80 -28
  43. package/es/data-table/src/TableParts/Cell.d.ts +6 -6
  44. package/es/data-table/src/TableParts/Header.d.ts +3 -3
  45. package/es/data-table/src/TableParts/Header.js +1 -1
  46. package/es/data-table/src/interface.d.ts +4 -1
  47. package/es/data-table/src/styles/index.cssr.js +9 -12
  48. package/es/data-table/src/use-check.js +6 -2
  49. package/es/data-table/src/use-scroll.d.ts +2 -0
  50. package/es/data-table/src/use-scroll.js +34 -4
  51. package/es/data-table/src/use-table-data.js +4 -1
  52. package/es/data-table/styles/_common.js +1 -1
  53. package/es/data-table/styles/light.d.ts +3 -3
  54. package/es/date-picker/src/DatePicker.d.ts +94 -69
  55. package/es/date-picker/src/DatePicker.js +47 -20
  56. package/es/date-picker/src/config.d.ts +1 -9
  57. package/es/date-picker/src/config.js +0 -8
  58. package/es/date-picker/src/interface.d.ts +2 -1
  59. package/es/date-picker/src/panel/date.d.ts +23 -10
  60. package/es/date-picker/src/panel/date.js +2 -2
  61. package/es/date-picker/src/panel/daterange.d.ts +21 -9
  62. package/es/date-picker/src/panel/daterange.js +2 -2
  63. package/es/date-picker/src/panel/datetime.d.ts +23 -16
  64. package/es/date-picker/src/panel/datetime.js +2 -2
  65. package/es/date-picker/src/panel/datetimerange.d.ts +21 -9
  66. package/es/date-picker/src/panel/datetimerange.js +2 -2
  67. package/es/date-picker/src/panel/month.d.ts +27 -20
  68. package/es/date-picker/src/panel/month.js +23 -12
  69. package/es/date-picker/src/panel/use-calendar.d.ts +25 -43
  70. package/es/date-picker/src/panel/use-calendar.js +35 -18
  71. package/es/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
  72. package/es/date-picker/src/panel/use-dual-calendar.js +23 -8
  73. package/es/date-picker/src/panel/use-panel-common.d.ts +21 -36
  74. package/es/date-picker/src/panel/use-panel-common.js +2 -2
  75. package/es/date-picker/src/utils.d.ts +19 -3
  76. package/es/date-picker/src/utils.js +40 -5
  77. package/es/date-picker/styles/_common.d.ts +2 -0
  78. package/es/date-picker/styles/_common.js +3 -1
  79. package/es/date-picker/styles/light.d.ts +10 -6
  80. package/es/dialog/src/Dialog.d.ts +21 -21
  81. package/es/dialog/src/styles/index.cssr.js +1 -0
  82. package/es/dialog/styles/light.d.ts +3 -3
  83. package/es/dynamic-input/src/DynamicInput.d.ts +30 -30
  84. package/es/dynamic-input/src/InputPreset.d.ts +3 -3
  85. package/es/dynamic-input/src/PairPreset.d.ts +3 -3
  86. package/es/dynamic-input/styles/light.d.ts +3 -3
  87. package/es/dynamic-tags/src/DynamicTags.d.ts +30 -30
  88. package/es/dynamic-tags/styles/light.d.ts +3 -3
  89. package/es/element/index.d.ts +1 -0
  90. package/es/element/index.js +1 -0
  91. package/es/form/src/interface.d.ts +5 -4
  92. package/es/image/src/Image.d.ts +25 -16
  93. package/es/image/src/Image.js +35 -11
  94. package/es/image/src/ImageGroup.js +2 -2
  95. package/es/image/src/styles/index.cssr.js +4 -3
  96. package/es/input/src/Input.js +2 -0
  97. package/es/input/src/styles/input.cssr.js +2 -1
  98. package/es/input-number/src/InputNumber.d.ts +30 -30
  99. package/es/input-number/src/InputNumber.js +10 -5
  100. package/es/input-number/src/utils.d.ts +1 -0
  101. package/es/input-number/src/utils.js +4 -0
  102. package/es/input-number/styles/light.d.ts +3 -3
  103. package/es/locales/common/deDE.js +8 -0
  104. package/es/locales/common/enUS.d.ts +7 -0
  105. package/es/locales/common/enUS.js +8 -1
  106. package/es/locales/common/frFR.d.ts +3 -0
  107. package/es/locales/common/frFR.js +101 -0
  108. package/es/locales/common/idID.d.ts +2 -93
  109. package/es/locales/common/idID.js +8 -0
  110. package/es/locales/common/jaJP.js +8 -0
  111. package/es/locales/common/nbNO.js +8 -0
  112. package/es/locales/common/ruRU.js +8 -0
  113. package/es/locales/common/ukUA.js +8 -0
  114. package/es/locales/common/zhCN.js +7 -0
  115. package/es/locales/common/zhTW.d.ts +3 -0
  116. package/es/locales/common/zhTW.js +100 -0
  117. package/es/locales/date/frFR.d.ts +3 -0
  118. package/es/locales/date/frFR.js +6 -0
  119. package/es/locales/date/idID.d.ts +1 -6
  120. package/es/locales/date/zhTW.d.ts +3 -0
  121. package/es/locales/date/zhTW.js +6 -0
  122. package/es/locales/index.d.ts +4 -0
  123. package/es/locales/index.js +4 -0
  124. package/es/modal/src/BodyWrapper.d.ts +6 -6
  125. package/es/modal/src/Modal.d.ts +36 -36
  126. package/es/modal/styles/light.d.ts +3 -3
  127. package/es/page-header/src/PageHeader.js +3 -3
  128. package/es/page-header/src/styles/index.cssr.js +2 -4
  129. package/es/popconfirm/src/Popconfirm.d.ts +30 -30
  130. package/es/popconfirm/styles/light.d.ts +3 -3
  131. package/es/popover/src/Popover.js +4 -1
  132. package/es/popover/src/PopoverBody.js +3 -3
  133. package/es/popselect/src/Popselect.d.ts +2 -11
  134. package/es/popselect/src/Popselect.js +2 -2
  135. package/es/popselect/src/PopselectPanel.d.ts +3 -11
  136. package/es/popselect/src/PopselectPanel.js +17 -11
  137. package/es/radio/src/Radio.js +3 -3
  138. package/es/radio/src/RadioButton.js +4 -5
  139. package/es/radio/src/styles/radio-group.cssr.js +8 -4
  140. package/es/radio/src/styles/radio.cssr.js +8 -4
  141. package/es/radio/src/use-radio.d.ts +0 -3
  142. package/es/radio/src/use-radio.js +1 -26
  143. package/es/switch/src/Switch.d.ts +16 -1
  144. package/es/switch/src/Switch.js +17 -4
  145. package/es/switch/src/styles/index.cssr.js +1 -1
  146. package/es/tabs/src/styles/index.cssr.js +1 -0
  147. package/es/tag/src/styles/index.cssr.js +1 -1
  148. package/es/theme-editor/src/ThemeEditor.js +9 -2
  149. package/es/time-picker/src/Panel.d.ts +3 -3
  150. package/es/time-picker/src/TimePicker.d.ts +30 -30
  151. package/es/time-picker/styles/light.d.ts +3 -3
  152. package/es/transfer/src/Transfer.d.ts +30 -30
  153. package/es/transfer/src/TransferFilter.d.ts +3 -3
  154. package/es/transfer/src/TransferList.d.ts +3 -3
  155. package/es/transfer/src/TransferListItem.d.ts +3 -3
  156. package/es/transfer/styles/light.d.ts +3 -3
  157. package/es/tree/src/Tree.d.ts +8 -4
  158. package/es/tree/src/Tree.js +32 -6
  159. package/es/tree-select/src/TreeSelect.d.ts +38 -1
  160. package/es/tree-select/src/TreeSelect.js +25 -10
  161. package/es/tree-select/src/styles/index.cssr.js +11 -2
  162. package/es/tree-select/styles/light.d.ts +6 -0
  163. package/es/tree-select/styles/light.js +5 -2
  164. package/es/upload/src/Upload.d.ts +41 -30
  165. package/es/upload/src/Upload.js +33 -23
  166. package/es/upload/src/UploadFile.d.ts +4 -4
  167. package/es/upload/src/UploadFileList.js +4 -2
  168. package/es/upload/src/UploadProgress.d.ts +3 -3
  169. package/es/upload/src/interface.d.ts +1 -0
  170. package/es/upload/src/styles/index.cssr.js +2 -3
  171. package/es/upload/styles/light.d.ts +3 -3
  172. package/es/version.d.ts +1 -1
  173. package/es/version.js +1 -1
  174. package/lib/_internal/close/src/styles/index.cssr.js +6 -5
  175. package/lib/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
  176. package/lib/_internal/scrollbar/src/ScrollBar.js +13 -7
  177. package/lib/_internal/selection/src/Selection.js +11 -9
  178. package/lib/_internal/selection/src/styles/index.cssr.js +6 -2
  179. package/lib/alert/src/Alert.d.ts +20 -20
  180. package/lib/alert/src/Alert.js +22 -22
  181. package/lib/alert/src/styles/index.cssr.js +45 -45
  182. package/lib/anchor/src/AnchorAdapter.js +12 -12
  183. package/lib/anchor/src/styles/index.cssr.js +41 -41
  184. package/lib/avatar/src/Avatar.d.ts +5 -3
  185. package/lib/avatar/src/Avatar.js +7 -5
  186. package/lib/avatar/src/styles/index.cssr.js +3 -5
  187. package/lib/button/src/Button.d.ts +60 -60
  188. package/lib/button/src/Button.js +107 -106
  189. package/lib/button/src/styles/button.cssr.js +83 -80
  190. package/lib/button/styles/dark.js +3 -3
  191. package/lib/button/styles/light.d.ts +3 -3
  192. package/lib/button/styles/light.js +1 -1
  193. package/lib/calendar/src/Calendar.d.ts +37 -30
  194. package/lib/calendar/styles/light.d.ts +3 -3
  195. package/lib/cascader/src/Cascader.d.ts +135 -0
  196. package/lib/cascader/src/Cascader.js +2 -4
  197. package/lib/cascader/src/CascaderMenu.d.ts +345 -0
  198. package/lib/cascader/src/CascaderMenu.js +6 -5
  199. package/lib/cascader/src/CascaderOption.d.ts +18 -0
  200. package/lib/cascader/src/CascaderSelectMenu.d.ts +18 -0
  201. package/lib/cascader/src/CascaderSubmenu.d.ts +18 -0
  202. package/lib/cascader/styles/dark.js +3 -1
  203. package/lib/cascader/styles/light.d.ts +13 -0
  204. package/lib/cascader/styles/light.js +3 -1
  205. package/lib/color-picker/src/ColorInputUnit.d.ts +3 -3
  206. package/lib/color-picker/src/ColorPicker.d.ts +27 -27
  207. package/lib/color-picker/styles/light.d.ts +3 -3
  208. package/lib/config-provider/src/ConfigProvider.d.ts +21 -0
  209. package/lib/data-table/src/DataTable.d.ts +30 -30
  210. package/lib/data-table/src/DataTable.js +6 -13
  211. package/lib/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
  212. package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
  213. package/lib/data-table/src/MainTable.js +1 -2
  214. package/lib/data-table/src/TableParts/Body.d.ts +18 -7
  215. package/lib/data-table/src/TableParts/Body.js +78 -26
  216. package/lib/data-table/src/TableParts/Cell.d.ts +6 -6
  217. package/lib/data-table/src/TableParts/Header.d.ts +3 -3
  218. package/lib/data-table/src/TableParts/Header.js +1 -1
  219. package/lib/data-table/src/interface.d.ts +4 -1
  220. package/lib/data-table/src/styles/index.cssr.js +9 -12
  221. package/lib/data-table/src/use-check.js +6 -2
  222. package/lib/data-table/src/use-scroll.d.ts +2 -0
  223. package/lib/data-table/src/use-scroll.js +34 -4
  224. package/lib/data-table/src/use-table-data.js +4 -1
  225. package/lib/data-table/styles/_common.js +1 -1
  226. package/lib/data-table/styles/light.d.ts +3 -3
  227. package/lib/date-picker/src/DatePicker.d.ts +94 -69
  228. package/lib/date-picker/src/DatePicker.js +46 -19
  229. package/lib/date-picker/src/config.d.ts +1 -9
  230. package/lib/date-picker/src/config.js +1 -9
  231. package/lib/date-picker/src/interface.d.ts +2 -1
  232. package/lib/date-picker/src/panel/date.d.ts +23 -10
  233. package/lib/date-picker/src/panel/date.js +1 -1
  234. package/lib/date-picker/src/panel/daterange.d.ts +21 -9
  235. package/lib/date-picker/src/panel/daterange.js +1 -1
  236. package/lib/date-picker/src/panel/datetime.d.ts +23 -16
  237. package/lib/date-picker/src/panel/datetime.js +1 -1
  238. package/lib/date-picker/src/panel/datetimerange.d.ts +21 -9
  239. package/lib/date-picker/src/panel/datetimerange.js +2 -2
  240. package/lib/date-picker/src/panel/month.d.ts +27 -20
  241. package/lib/date-picker/src/panel/month.js +23 -12
  242. package/lib/date-picker/src/panel/use-calendar.d.ts +25 -43
  243. package/lib/date-picker/src/panel/use-calendar.js +34 -16
  244. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
  245. package/lib/date-picker/src/panel/use-dual-calendar.js +22 -6
  246. package/lib/date-picker/src/panel/use-panel-common.d.ts +21 -36
  247. package/lib/date-picker/src/panel/use-panel-common.js +3 -2
  248. package/lib/date-picker/src/utils.d.ts +19 -3
  249. package/lib/date-picker/src/utils.js +41 -4
  250. package/lib/date-picker/styles/_common.d.ts +2 -0
  251. package/lib/date-picker/styles/_common.js +3 -1
  252. package/lib/date-picker/styles/light.d.ts +10 -6
  253. package/lib/dialog/src/Dialog.d.ts +21 -21
  254. package/lib/dialog/src/styles/index.cssr.js +1 -0
  255. package/lib/dialog/styles/light.d.ts +3 -3
  256. package/lib/dynamic-input/src/DynamicInput.d.ts +30 -30
  257. package/lib/dynamic-input/src/InputPreset.d.ts +3 -3
  258. package/lib/dynamic-input/src/PairPreset.d.ts +3 -3
  259. package/lib/dynamic-input/styles/light.d.ts +3 -3
  260. package/lib/dynamic-tags/src/DynamicTags.d.ts +30 -30
  261. package/lib/dynamic-tags/styles/light.d.ts +3 -3
  262. package/lib/element/index.d.ts +1 -0
  263. package/lib/element/index.js +3 -1
  264. package/lib/form/src/interface.d.ts +5 -4
  265. package/lib/image/src/Image.d.ts +25 -16
  266. package/lib/image/src/Image.js +34 -10
  267. package/lib/image/src/ImageGroup.js +2 -2
  268. package/lib/image/src/styles/index.cssr.js +3 -2
  269. package/lib/input/src/Input.js +2 -0
  270. package/lib/input/src/styles/input.cssr.js +2 -1
  271. package/lib/input-number/src/InputNumber.d.ts +30 -30
  272. package/lib/input-number/src/InputNumber.js +9 -4
  273. package/lib/input-number/src/utils.d.ts +1 -0
  274. package/lib/input-number/src/utils.js +6 -1
  275. package/lib/input-number/styles/light.d.ts +3 -3
  276. package/lib/locales/common/deDE.js +8 -0
  277. package/lib/locales/common/enUS.d.ts +7 -0
  278. package/lib/locales/common/enUS.js +8 -1
  279. package/lib/locales/common/frFR.d.ts +3 -0
  280. package/lib/locales/common/frFR.js +103 -0
  281. package/lib/locales/common/idID.d.ts +2 -93
  282. package/lib/locales/common/idID.js +8 -0
  283. package/lib/locales/common/jaJP.js +8 -0
  284. package/lib/locales/common/nbNO.js +8 -0
  285. package/lib/locales/common/ruRU.js +8 -0
  286. package/lib/locales/common/ukUA.js +8 -0
  287. package/lib/locales/common/zhCN.js +7 -0
  288. package/lib/locales/common/zhTW.d.ts +3 -0
  289. package/lib/locales/common/zhTW.js +102 -0
  290. package/lib/locales/date/frFR.d.ts +3 -0
  291. package/lib/locales/date/frFR.js +11 -0
  292. package/lib/locales/date/idID.d.ts +1 -6
  293. package/lib/locales/date/zhTW.d.ts +3 -0
  294. package/lib/locales/date/zhTW.js +11 -0
  295. package/lib/locales/index.d.ts +4 -0
  296. package/lib/locales/index.js +9 -1
  297. package/lib/modal/src/BodyWrapper.d.ts +6 -6
  298. package/lib/modal/src/Modal.d.ts +36 -36
  299. package/lib/modal/styles/light.d.ts +3 -3
  300. package/lib/page-header/src/PageHeader.js +3 -3
  301. package/lib/page-header/src/styles/index.cssr.js +2 -4
  302. package/lib/popconfirm/src/Popconfirm.d.ts +30 -30
  303. package/lib/popconfirm/styles/light.d.ts +3 -3
  304. package/lib/popover/src/Popover.js +4 -1
  305. package/lib/popover/src/PopoverBody.js +3 -3
  306. package/lib/popselect/src/Popselect.d.ts +2 -11
  307. package/lib/popselect/src/Popselect.js +2 -2
  308. package/lib/popselect/src/PopselectPanel.d.ts +3 -11
  309. package/lib/popselect/src/PopselectPanel.js +16 -10
  310. package/lib/radio/src/Radio.js +3 -3
  311. package/lib/radio/src/RadioButton.js +4 -5
  312. package/lib/radio/src/styles/radio-group.cssr.js +8 -4
  313. package/lib/radio/src/styles/radio.cssr.js +8 -4
  314. package/lib/radio/src/use-radio.d.ts +0 -3
  315. package/lib/radio/src/use-radio.js +1 -26
  316. package/lib/switch/src/Switch.d.ts +16 -1
  317. package/lib/switch/src/Switch.js +17 -4
  318. package/lib/switch/src/styles/index.cssr.js +1 -1
  319. package/lib/tabs/src/styles/index.cssr.js +1 -0
  320. package/lib/tag/src/styles/index.cssr.js +1 -1
  321. package/lib/theme-editor/src/ThemeEditor.js +9 -2
  322. package/lib/time-picker/src/Panel.d.ts +3 -3
  323. package/lib/time-picker/src/TimePicker.d.ts +30 -30
  324. package/lib/time-picker/styles/light.d.ts +3 -3
  325. package/lib/transfer/src/Transfer.d.ts +30 -30
  326. package/lib/transfer/src/TransferFilter.d.ts +3 -3
  327. package/lib/transfer/src/TransferList.d.ts +3 -3
  328. package/lib/transfer/src/TransferListItem.d.ts +3 -3
  329. package/lib/transfer/styles/light.d.ts +3 -3
  330. package/lib/tree/src/Tree.d.ts +8 -4
  331. package/lib/tree/src/Tree.js +32 -6
  332. package/lib/tree-select/src/TreeSelect.d.ts +38 -1
  333. package/lib/tree-select/src/TreeSelect.js +24 -9
  334. package/lib/tree-select/src/styles/index.cssr.js +11 -2
  335. package/lib/tree-select/styles/light.d.ts +6 -0
  336. package/lib/tree-select/styles/light.js +5 -2
  337. package/lib/upload/src/Upload.d.ts +41 -30
  338. package/lib/upload/src/Upload.js +33 -23
  339. package/lib/upload/src/UploadFile.d.ts +4 -4
  340. package/lib/upload/src/UploadFileList.js +4 -2
  341. package/lib/upload/src/UploadProgress.d.ts +3 -3
  342. package/lib/upload/src/interface.d.ts +1 -0
  343. package/lib/upload/src/styles/index.cssr.js +2 -3
  344. package/lib/upload/styles/light.d.ts +3 -3
  345. package/lib/version.d.ts +1 -1
  346. package/lib/version.js +1 -1
  347. package/package.json +5 -4
  348. package/web-types.json +99 -7
@@ -1,16 +1,18 @@
1
1
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- import { h, ref, defineComponent, inject, watchEffect, onUnmounted, computed } from 'vue';
2
+ import { h, ref, defineComponent, inject, watchEffect, onUnmounted, computed, renderSlot, Fragment } from 'vue';
3
3
  import { pxfy, repeat } from 'seemly';
4
- import { VirtualList } from 'vueuc';
4
+ import { VirtualList, VResizeObserver } from 'vueuc';
5
5
  import { c } from '../../../_utils/cssr';
6
6
  import { NScrollbar } from '../../../_internal';
7
7
  import { formatLength } from '../../../_utils';
8
+ import { NEmpty } from '../../../empty';
8
9
  import { dataTableInjectionKey } from '../interface';
9
10
  import { createRowClassName, getColKey, isColumnSorting } from '../utils';
10
11
  import Cell from './Cell';
11
12
  import ExpandTrigger from './ExpandTrigger';
12
13
  import RenderSafeCheckbox from './BodyCheckbox';
13
14
  import TableHeader from './Header';
15
+ import { useMemo } from 'vooks';
14
16
  function flatten(rowInfos, expandedRowKeys) {
15
17
  const fRows = [];
16
18
  function traverse(rs) {
@@ -70,14 +72,24 @@ export default defineComponent({
70
72
  props: {
71
73
  onResize: Function,
72
74
  showHeader: Boolean,
73
- flexHeight: Boolean
75
+ flexHeight: Boolean,
76
+ bodyStyle: Object
74
77
  },
75
78
  setup(props) {
76
- const { mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, rightActiveFixedColKeyRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, scrollPartRef, mergedTableLayoutRef, hasChildrenRef, firstContentfulColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck
79
+ const { slots: dataTableSlots, mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, leftActiveFixedChildrenColKeysRef, rightActiveFixedColKeyRef, rightActiveFixedChildrenColKeysRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, scrollPartRef, mergedTableLayoutRef, hasChildrenRef, firstContentfulColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, loadingRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck
77
80
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
78
81
  } = inject(dataTableInjectionKey);
79
82
  const scrollbarInstRef = ref(null);
80
83
  const virtualListRef = ref(null);
84
+ const emptyElRef = ref(null);
85
+ const emptyRef = useMemo(() => paginatedDataRef.value.length === 0);
86
+ // If header is not inside & empty is displayed, no table part would be
87
+ // shown. So to collect a body width, we need to put a ref on empty element
88
+ const shouldDisplaySomeTablePartRef = useMemo(() => props.showHeader || !emptyRef.value);
89
+ // If no body is shown, we shouldn't show scrollbar
90
+ const bodyShowHeaderOnlyRef = useMemo(() => {
91
+ return props.showHeader || emptyRef.value;
92
+ });
81
93
  let lastSelectedKey = '';
82
94
  const mergedExpandedRowKeySetRef = computed(() => {
83
95
  return new Set(mergedExpandedRowKeysRef.value);
@@ -114,6 +126,15 @@ export default defineComponent({
114
126
  lastSelectedKey = tmNode.key;
115
127
  }
116
128
  function getScrollContainer() {
129
+ if (!shouldDisplaySomeTablePartRef.value) {
130
+ const { value: emptyEl } = emptyElRef;
131
+ if (emptyEl) {
132
+ return emptyEl;
133
+ }
134
+ else {
135
+ return null;
136
+ }
137
+ }
117
138
  if (virtualScrollRef.value) {
118
139
  return virtualListContainer();
119
140
  }
@@ -165,36 +186,47 @@ export default defineComponent({
165
186
  };
166
187
  // manually control shadow style to avoid rerender
167
188
  const style = c([
168
- ({ props: cProps }) => c([
169
- cProps.leftActiveFixedColKey === null
170
- ? null
171
- : c(`[data-n-id="${cProps.componentId}"] [data-col-key="${cProps.leftActiveFixedColKey}"]::after`, {
172
- boxShadow: 'var(--box-shadow-after)'
173
- }),
174
- cProps.rightActiveFixedColKey === null
175
- ? null
176
- : c(`[data-n-id="${cProps.componentId}"] [data-col-key="${cProps.rightActiveFixedColKey}"]::before`, {
177
- boxShadow: 'var(--box-shadow-before)'
178
- })
179
- ])
189
+ ({ props: cProps }) => {
190
+ const createActiveLeftFixedStyle = (leftActiveFixedColKey) => {
191
+ if (leftActiveFixedColKey === null)
192
+ return null;
193
+ return c(`[data-n-id="${cProps.componentId}"] [data-col-key="${leftActiveFixedColKey}"]::after`, { boxShadow: 'var(--box-shadow-after)' });
194
+ };
195
+ const createActiveRightFixedStyle = (rightActiveFixedColKey) => {
196
+ if (rightActiveFixedColKey === null)
197
+ return null;
198
+ return c(`[data-n-id="${cProps.componentId}"] [data-col-key="${rightActiveFixedColKey}"]::before`, { boxShadow: 'var(--box-shadow-before)' });
199
+ };
200
+ return c([
201
+ createActiveLeftFixedStyle(cProps.leftActiveFixedColKey),
202
+ createActiveRightFixedStyle(cProps.rightActiveFixedColKey),
203
+ cProps.leftActiveFixedChildrenColKeys.map((leftActiveFixedColKey) => createActiveLeftFixedStyle(leftActiveFixedColKey)),
204
+ cProps.rightActiveFixedChildrenColKeys.map((rightActiveFixedColKey) => createActiveRightFixedStyle(rightActiveFixedColKey))
205
+ ]);
206
+ }
180
207
  ]);
181
208
  let fixedStyleMounted = false;
182
209
  watchEffect(() => {
183
210
  const { value: leftActiveFixedColKey } = leftActiveFixedColKeyRef;
211
+ const { value: leftActiveFixedChildrenColKeys } = leftActiveFixedChildrenColKeysRef;
184
212
  const { value: rightActiveFixedColKey } = rightActiveFixedColKeyRef;
213
+ const { value: rightActiveFixedChildrenColKeys } = rightActiveFixedChildrenColKeysRef;
185
214
  if (!fixedStyleMounted &&
186
215
  leftActiveFixedColKey === null &&
187
216
  rightActiveFixedColKey === null) {
188
217
  return;
189
218
  }
219
+ const cProps = {
220
+ leftActiveFixedColKey,
221
+ leftActiveFixedChildrenColKeys,
222
+ rightActiveFixedColKey,
223
+ rightActiveFixedChildrenColKeys,
224
+ componentId
225
+ };
190
226
  style.mount({
191
227
  id: `n-${componentId}`,
192
228
  force: true,
193
- props: {
194
- leftActiveFixedColKey,
195
- rightActiveFixedColKey,
196
- componentId
197
- }
229
+ props: cProps
198
230
  });
199
231
  fixedStyleMounted = true;
200
232
  });
@@ -203,9 +235,11 @@ export default defineComponent({
203
235
  id: `n-${componentId}`
204
236
  });
205
237
  });
206
- return Object.assign({ componentId,
238
+ return Object.assign({ dataTableSlots,
239
+ componentId,
207
240
  scrollbarInstRef,
208
- virtualListRef, summary: summaryRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: mergedThemeRef, scrollX: scrollXRef, cols: colsRef, paginatedData: computed(() => {
241
+ virtualListRef,
242
+ emptyElRef, summary: summaryRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: mergedThemeRef, scrollX: scrollXRef, cols: colsRef, loading: loadingRef, bodyShowHeaderOnly: bodyShowHeaderOnlyRef, shouldDisplaySomeTablePart: shouldDisplaySomeTablePartRef, empty: emptyRef, paginatedData: computed(() => {
209
243
  const { value: striped } = stripedRef;
210
244
  return paginatedDataRef.value.map(striped
211
245
  ? (tmNode, index) => {
@@ -247,13 +281,13 @@ export default defineComponent({
247
281
  };
248
282
  if (scrollX)
249
283
  contentStyle.width = '100%';
250
- return (h(NScrollbar, { ref: "scrollbarInstRef", scrollable: scrollable || isBasicAutoLayout, class: `${mergedClsPrefix}-data-table-base-table-body`, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, contentStyle: contentStyle, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, horizontalRailStyle: { zIndex: 3 }, verticalRailStyle: { zIndex: 3 }, xScrollable: xScrollable, onScroll: virtualScroll ? undefined : this.handleTableBodyScroll, internalOnUpdateScrollLeft: setHeaderScrollLeft, onResize: onResize }, {
284
+ const tableNode = (h(NScrollbar, { ref: "scrollbarInstRef", scrollable: scrollable || isBasicAutoLayout, showScrollbar: !this.bodyShowHeaderOnly, class: `${mergedClsPrefix}-data-table-base-table-body`, style: this.bodyStyle, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, contentStyle: contentStyle, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, horizontalRailStyle: { zIndex: 3 }, verticalRailStyle: { zIndex: 3 }, xScrollable: xScrollable, onScroll: virtualScroll ? undefined : this.handleTableBodyScroll, internalOnUpdateScrollLeft: setHeaderScrollLeft, onResize: onResize }, {
251
285
  default: () => {
252
286
  // coordinate to pass if there are cells that cross row & col
253
287
  const cordToPass = {};
254
288
  // coordinate to related hover keys
255
289
  const cordKey = {};
256
- const { cols, paginatedData, mergedTheme, fixedColumnLeftMap, fixedColumnRightMap, currentPage, rowClassName, mergedSortState, mergedExpandedRowKeySet, componentId, showHeader, hasChildren, firstContentfulColIndex, rowProps, handleMouseenterTable, handleMouseleaveTable, renderExpand, summary, handleCheckboxUpdateChecked, handleUpdateExpanded } = this;
290
+ const { cols, paginatedData, mergedTheme, fixedColumnLeftMap, fixedColumnRightMap, currentPage, rowClassName, mergedSortState, mergedExpandedRowKeySet, componentId, hasChildren, firstContentfulColIndex, rowProps, handleMouseenterTable, handleMouseleaveTable, renderExpand, summary, handleCheckboxUpdateChecked, handleUpdateExpanded } = this;
257
291
  const { length: colCount } = cols;
258
292
  let mergedData;
259
293
  // if there is children in data, we should expand mergedData first
@@ -338,6 +372,7 @@ export default defineComponent({
338
372
  this.hoverKey = rowKey;
339
373
  }, key: rowKey, class: [
340
374
  `${mergedClsPrefix}-data-table-tr`,
375
+ isSummary && `${mergedClsPrefix}-data-table-tr--summary`,
341
376
  striped && `${mergedClsPrefix}-data-table-tr--striped`,
342
377
  mergedRowClassName
343
378
  ] }, props), cols.map((col, colIndex) => {
@@ -436,10 +471,10 @@ export default defineComponent({
436
471
  tableLayout: this.mergedTableLayout
437
472
  } },
438
473
  h("colgroup", null, cols.map((col) => (h("col", { key: col.key, style: col.style })))),
439
- showHeader ? h(TableHeader, { discrete: false }) : null,
440
- h("tbody", { "data-n-id": componentId, class: `${mergedClsPrefix}-data-table-tbody` }, displayedData.map((rowInfo, rowIndex) => {
474
+ this.showHeader ? h(TableHeader, { discrete: false }) : null,
475
+ !this.empty ? (h("tbody", { "data-n-id": componentId, class: `${mergedClsPrefix}-data-table-tbody` }, displayedData.map((rowInfo, rowIndex) => {
441
476
  return renderRow(rowInfo, rowIndex, false);
442
- }))));
477
+ }))) : null));
443
478
  }
444
479
  else {
445
480
  return (h(VirtualList, { ref: "virtualListRef", items: displayedData, itemSize: 28, visibleItemsTag: VirtualListItemWrapper, visibleItemsProps: {
@@ -454,5 +489,22 @@ export default defineComponent({
454
489
  }
455
490
  }
456
491
  }));
492
+ if (this.empty) {
493
+ const createEmptyNode = () => (h("div", { class: [
494
+ `${mergedClsPrefix}-data-table-empty`,
495
+ this.loading && `${mergedClsPrefix}-data-table-empty--hide`
496
+ ], style: this.bodyStyle, ref: "emptyElRef" }, renderSlot(this.dataTableSlots, 'empty', undefined, () => [
497
+ h(NEmpty, { theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty })
498
+ ])));
499
+ if (this.shouldDisplaySomeTablePart) {
500
+ return (h(Fragment, null,
501
+ tableNode,
502
+ createEmptyNode()));
503
+ }
504
+ else {
505
+ return (h(VResizeObserver, { onResize: this.onResize }, { default: createEmptyNode }));
506
+ }
507
+ }
508
+ return tableNode;
457
509
  }
458
510
  });
@@ -183,9 +183,9 @@ declare const _default: import("vue").DefineComponent<{
183
183
  fontSizeMedium: string;
184
184
  fontSizeLarge: string;
185
185
  opacityDisabled: string;
186
- colorOpacitySecondary: number;
187
- colorOpacitySecondaryHover: number;
188
- colorOpacitySecondaryPressed: number;
186
+ colorOpacitySecondary: string;
187
+ colorOpacitySecondaryHover: string;
188
+ colorOpacitySecondaryPressed: string;
189
189
  colorSecondary: string;
190
190
  colorSecondaryHover: string;
191
191
  colorSecondaryPressed: string;
@@ -1147,9 +1147,9 @@ declare const _default: import("vue").DefineComponent<{
1147
1147
  fontSizeMedium: string;
1148
1148
  fontSizeLarge: string;
1149
1149
  opacityDisabled: string;
1150
- colorOpacitySecondary: number;
1151
- colorOpacitySecondaryHover: number;
1152
- colorOpacitySecondaryPressed: number;
1150
+ colorOpacitySecondary: string;
1151
+ colorOpacitySecondaryHover: string;
1152
+ colorOpacitySecondaryPressed: string;
1153
1153
  colorSecondary: string;
1154
1154
  colorSecondaryHover: string;
1155
1155
  colorSecondaryPressed: string;
@@ -190,9 +190,9 @@ declare const _default: import("vue").DefineComponent<{
190
190
  fontSizeMedium: string;
191
191
  fontSizeLarge: string;
192
192
  opacityDisabled: string;
193
- colorOpacitySecondary: number;
194
- colorOpacitySecondaryHover: number;
195
- colorOpacitySecondaryPressed: number;
193
+ colorOpacitySecondary: string;
194
+ colorOpacitySecondaryHover: string;
195
+ colorOpacitySecondaryPressed: string;
196
196
  colorSecondary: string;
197
197
  colorSecondaryHover: string;
198
198
  colorSecondaryPressed: string;
@@ -26,7 +26,7 @@ export default defineComponent({
26
26
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
27
27
  } = inject(dataTableInjectionKey);
28
28
  function handleCheckboxUpdateChecked() {
29
- if (someRowsCheckedRef.value || allRowsCheckedRef.value) {
29
+ if (allRowsCheckedRef.value) {
30
30
  doUncheckAll();
31
31
  }
32
32
  else {
@@ -1,5 +1,5 @@
1
1
  import { TreeNode } from 'treemate';
2
- import { CSSProperties, InjectionKey, Ref, VNodeChild, HTMLAttributes } from 'vue';
2
+ import { CSSProperties, InjectionKey, Ref, VNodeChild, HTMLAttributes, Slots } from 'vue';
3
3
  import { EllipsisProps } from '../../ellipsis/src/Ellipsis';
4
4
  import { NLocale } from '../../locales';
5
5
  import { MergedTheme } from '../../_mixins';
@@ -100,6 +100,7 @@ export declare type DataTableSelectionOptions = Array<DataTableSelectionOption |
100
100
  onSelect: () => void;
101
101
  }>;
102
102
  export interface DataTableInjection {
103
+ slots: Slots;
103
104
  indentRef: Ref<number>;
104
105
  hasChildrenRef: Ref<boolean>;
105
106
  firstContentfulColIndexRef: Ref<number>;
@@ -115,7 +116,9 @@ export interface DataTableInjection {
115
116
  leftFixedColumnsRef: Ref<TableColumns>;
116
117
  rightFixedColumnsRef: Ref<TableColumns>;
117
118
  leftActiveFixedColKeyRef: Ref<ColumnKey | null>;
119
+ leftActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
118
120
  rightActiveFixedColKeyRef: Ref<ColumnKey | null>;
121
+ rightActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
119
122
  fixedColumnLeftMapRef: Ref<Record<ColumnKey, {
120
123
  start: number;
121
124
  end: number;
@@ -53,11 +53,11 @@ export default c([cB('data-table', `
53
53
  --merged-th-color-hover: var(--th-color-hover);
54
54
  --merged-td-color-hover: var(--td-color-hover);
55
55
  --merged-td-color-striped: var(--td-color-striped);
56
- `, [cM('flex-height', [c('>', [cB('data-table-wrapper', `
56
+ `, [cB('data-table-wrapper', `
57
57
  flex-grow: 1;
58
58
  display: flex;
59
59
  flex-direction: column;
60
- `, [c('>', [cB('data-table-base-table', `
60
+ `), cM('flex-height', [c('>', [cB('data-table-wrapper', [c('>', [cB('data-table-base-table', `
61
61
  display: flex;
62
62
  flex-direction: column;
63
63
  flex-grow: 1;
@@ -93,7 +93,7 @@ c('&:last-child', 'flex-grow: 1;')])])])])])])]), c('>', [cB('base-loading', `
93
93
  box-sizing: border-box;
94
94
  background-clip: padding-box;
95
95
  transition: background-color .3s var(--bezier);
96
- `, [cM('striped', 'background-color: var(--merged-td-color-striped);', [cB('data-table-td', 'background-color: var(--merged-td-color-striped);')]), c('&:hover', 'background-color: var(--merged-td-color-hover);', [cB('data-table-td', 'background-color: var(--merged-td-color-hover);')])]), cB('data-table-th', `
96
+ `, [cM('striped', 'background-color: var(--merged-td-color-striped);', [cB('data-table-td', 'background-color: var(--merged-td-color-striped);')]), cNotM('summary', [c('&:hover', 'background-color: var(--merged-td-color-hover);', [cB('data-table-td', 'background-color: var(--merged-td-color-hover);')])])]), cB('data-table-th', `
97
97
  padding: var(--th-padding);
98
98
  position: relative;
99
99
  text-align: start;
@@ -203,6 +203,7 @@ c('&::after', {
203
203
  padding: 0;
204
204
  line-height: 0;
205
205
  `), fixedColumnStyle]), cB('data-table-empty', `
206
+ box-sizing: border-box;
206
207
  padding: var(--empty-padding);
207
208
  flex-grow: 1;
208
209
  flex-shrink: 0;
@@ -236,15 +237,11 @@ c('&::after', {
236
237
  borderRight: '1px solid var(--merged-border-color)'
237
238
  }, [cM('last-col', {
238
239
  borderRight: '0 solid var(--merged-border-color)'
239
- })])]), cM('bordered', [cB('data-table-wrapper', {
240
- border: '1px solid var(--merged-border-color)',
241
- borderBottomLeftRadius: 'var(--border-radius)',
242
- borderBottomRightRadius: 'var(--border-radius)'
243
- }), cB('data-table-td', [cM('last-row', {
244
- borderBottom: '0 solid var(--merged-border-color)'
245
- })]), cB('data-table-base-table-body', `
246
- border-bottom-left-radius: calc(var(--border-radius) - 1px);
247
- border-bottom-right-radius: calc(var(--border-radius) - 1px);
240
+ })])]), cM('bordered', [cB('data-table-wrapper', `
241
+ border: 1px solid var(--merged-border-color);
242
+ border-bottom-left-radius: var(--border-radius);
243
+ border-bottom-right-radius: var(--border-radius);
244
+ overflow: hidden;
248
245
  `)]), cB('data-table-base-table', [cM('transition-disabled', [cB('data-table-th', [c('&::after, &::before', {
249
246
  transition: 'none'
250
247
  })]), cB('data-table-td', [c('&::after, &::before', {
@@ -58,18 +58,22 @@ export function useCheck(props, data) {
58
58
  uncontrolledCheckedRowKeysRef.value = keys;
59
59
  }
60
60
  function doCheck(rowKey) {
61
+ if (props.loading)
62
+ return;
61
63
  doUpdateCheckedRowKeys(treeMateRef.value.check(rowKey, mergedCheckedRowKeysRef.value, {
62
64
  cascade: props.cascade
63
65
  }).checkedKeys);
64
66
  }
65
67
  function doUncheck(rowKey) {
68
+ if (props.loading)
69
+ return;
66
70
  doUpdateCheckedRowKeys(treeMateRef.value.uncheck(rowKey, mergedCheckedRowKeysRef.value, {
67
71
  cascade: props.cascade
68
72
  }).checkedKeys);
69
73
  }
70
74
  function doCheckAll(checkWholeTable = false) {
71
75
  const { value: column } = selectionColumnRef;
72
- if (!column)
76
+ if (!column || props.loading)
73
77
  return;
74
78
  const rowKeysToCheck = [];
75
79
  (checkWholeTable
@@ -86,7 +90,7 @@ export function useCheck(props, data) {
86
90
  }
87
91
  function doUncheckAll(checkWholeTable = false) {
88
92
  const { value: column } = selectionColumnRef;
89
- if (!column)
93
+ if (!column || props.loading)
90
94
  return;
91
95
  const rowKeysToUncheck = [];
92
96
  (checkWholeTable
@@ -19,7 +19,9 @@ export declare function useScroll(props: DataTableSetupProps, { mainTableInstRef
19
19
  leftFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
20
20
  rightFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
21
21
  leftActiveFixedColKeyRef: Ref<ColumnKey | null>;
22
+ leftActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
22
23
  rightActiveFixedColKeyRef: Ref<ColumnKey | null>;
24
+ rightActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
23
25
  syncScrollState: () => void;
24
26
  handleTableBodyScroll: () => void;
25
27
  handleTableHeaderScroll: () => void;
@@ -6,7 +6,9 @@ import { getColWidth, getColKey } from './utils';
6
6
  export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyWidthRef, scrollPartRef }) {
7
7
  let scrollLeft = 0;
8
8
  const leftActiveFixedColKeyRef = ref(null);
9
+ const leftActiveFixedChildrenColKeysRef = ref([]);
9
10
  const rightActiveFixedColKeyRef = ref(null);
11
+ const rightActiveFixedChildrenColKeysRef = ref([]);
10
12
  const styleScrollXRef = computed(() => {
11
13
  return formatLength(props.scrollX);
12
14
  });
@@ -40,7 +42,8 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
40
42
  const columns = {};
41
43
  let right = 0;
42
44
  function traverse(cols) {
43
- cols.forEach((col) => {
45
+ for (let i = cols.length - 1; i >= 0; --i) {
46
+ const col = cols[i];
44
47
  const positionInfo = { start: right, end: 0 };
45
48
  columns[getColKey(col)] = positionInfo;
46
49
  if ('children' in col) {
@@ -51,9 +54,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
51
54
  right += getColWidth(col) || 0;
52
55
  positionInfo.end = right;
53
56
  }
54
- });
57
+ }
55
58
  }
56
- traverse(rightFixedColumnsRef.value.reverse());
59
+ traverse(rightFixedColumnsRef.value);
57
60
  return columns;
58
61
  });
59
62
  function deriveActiveLeftFixedColumn() {
@@ -75,6 +78,18 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
75
78
  }
76
79
  leftActiveFixedColKeyRef.value = leftActiveFixedColKey;
77
80
  }
81
+ function deriveActiveLeftFixedChildrenColumns() {
82
+ leftActiveFixedChildrenColKeysRef.value = [];
83
+ let activeLeftFixedColumn = props.columns.find((col) => getColKey(col) === leftActiveFixedColKeyRef.value);
84
+ while (activeLeftFixedColumn && 'children' in activeLeftFixedColumn) {
85
+ const length = activeLeftFixedColumn.children.length;
86
+ if (length === 0)
87
+ break;
88
+ const nextActiveLeftFixedColumn = activeLeftFixedColumn.children[length - 1];
89
+ leftActiveFixedChildrenColKeysRef.value.push(getColKey(nextActiveLeftFixedColumn));
90
+ activeLeftFixedColumn = nextActiveLeftFixedColumn;
91
+ }
92
+ }
78
93
  function deriveActiveRightFixedColumn() {
79
94
  var _a, _b;
80
95
  // target is header element
@@ -86,7 +101,7 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
86
101
  let rightWidth = 0;
87
102
  let rightActiveFixedColKey = null;
88
103
  const { value: fixedColumnRightMap } = fixedColumnRightMapRef;
89
- for (let i = 0; i < rightFixedColumns.length; ++i) {
104
+ for (let i = rightFixedColumns.length - 1; i >= 0; --i) {
90
105
  const key = getColKey(rightFixedColumns[i]);
91
106
  if (Math.round(scrollLeft +
92
107
  (((_a = fixedColumnRightMap[key]) === null || _a === void 0 ? void 0 : _a.start) || 0) +
@@ -101,6 +116,17 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
101
116
  }
102
117
  rightActiveFixedColKeyRef.value = rightActiveFixedColKey;
103
118
  }
119
+ function deriveActiveRightFixedChildrenColumns() {
120
+ rightActiveFixedChildrenColKeysRef.value = [];
121
+ let activeRightFixedColumn = props.columns.find((col) => getColKey(col) === rightActiveFixedColKeyRef.value);
122
+ while (activeRightFixedColumn &&
123
+ 'children' in activeRightFixedColumn &&
124
+ activeRightFixedColumn.children.length) {
125
+ const nextActiveRightFixedColumn = activeRightFixedColumn.children[0];
126
+ rightActiveFixedChildrenColKeysRef.value.push(getColKey(nextActiveRightFixedColumn));
127
+ activeRightFixedColumn = nextActiveRightFixedColumn;
128
+ }
129
+ }
104
130
  function getScrollElements() {
105
131
  const header = mainTableInstRef.value
106
132
  ? mainTableInstRef.value.getHeaderElement()
@@ -157,7 +183,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
157
183
  scrollLeft = body.scrollLeft;
158
184
  }
159
185
  deriveActiveLeftFixedColumn();
186
+ deriveActiveLeftFixedChildrenColumns();
160
187
  deriveActiveRightFixedColumn();
188
+ deriveActiveRightFixedChildrenColumns();
161
189
  }
162
190
  function setHeaderScrollLeft(left) {
163
191
  const { header } = getScrollElements();
@@ -176,7 +204,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
176
204
  leftFixedColumnsRef,
177
205
  rightFixedColumnsRef,
178
206
  leftActiveFixedColKeyRef,
207
+ leftActiveFixedChildrenColKeysRef,
179
208
  rightActiveFixedColKeyRef,
209
+ rightActiveFixedChildrenColKeysRef,
180
210
  syncScrollState,
181
211
  handleTableBodyScroll,
182
212
  handleTableHeaderScroll,
@@ -18,6 +18,7 @@ export function useTableData(props, { dataRelatedColsRef }) {
18
18
  const treeMateRef = computed(() => {
19
19
  const { childrenKey } = props;
20
20
  return createTreeMate(props.data, {
21
+ ignoreEmptyChildren: true,
21
22
  getKey: props.rowKey,
22
23
  getChildren: (rowData) => rowData[childrenKey],
23
24
  getDisabled: (rowData) => {
@@ -185,11 +186,13 @@ export function useTableData(props, { dataRelatedColsRef }) {
185
186
  function mergedOnUpdatePageSize(pageSize) {
186
187
  const { pagination } = props;
187
188
  if (pagination) {
188
- const { onPageSizeChange, 'onUpdate:pageSize': onUpdatePageSize } = pagination;
189
+ const { onPageSizeChange, 'onUpdate:pageSize': _onUpdatePageSize, onUpdatePageSize } = pagination;
189
190
  if (onPageSizeChange)
190
191
  call(onPageSizeChange, pageSize);
191
192
  if (onUpdatePageSize)
192
193
  call(onUpdatePageSize, pageSize);
194
+ if (_onUpdatePageSize)
195
+ call(_onUpdatePageSize, pageSize);
193
196
  doUpdatePageSize(pageSize);
194
197
  }
195
198
  }
@@ -8,7 +8,7 @@ export default {
8
8
  sorterSize: '15px',
9
9
  filterSize: '15px',
10
10
  paginationMargin: '12px 0 0 0',
11
- emptyPadding: '16px 0',
11
+ emptyPadding: '48px 0',
12
12
  actionPadding: '8px 12px',
13
13
  actionButtonMargin: '0 8px 0 0'
14
14
  };
@@ -112,9 +112,9 @@ declare const dataTableLight: import("../../_mixins").Theme<"DataTable", {
112
112
  fontSizeMedium: string;
113
113
  fontSizeLarge: string;
114
114
  opacityDisabled: string;
115
- colorOpacitySecondary: number;
116
- colorOpacitySecondaryHover: number;
117
- colorOpacitySecondaryPressed: number;
115
+ colorOpacitySecondary: string;
116
+ colorOpacitySecondaryHover: string;
117
+ colorOpacitySecondaryPressed: string;
118
118
  colorSecondary: string;
119
119
  colorSecondaryHover: string;
120
120
  colorSecondaryPressed: string;