@douyinfe/semi-ui 2.36.0-beta.0 → 2.36.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 (698) hide show
  1. package/dist/umd/semi-ui.js +45123 -59672
  2. package/dist/umd/semi-ui.js.map +1 -1
  3. package/dist/umd/semi-ui.min.js +1 -1
  4. package/dist/umd/semi-ui.min.js.LICENSE.txt +3 -3
  5. package/dist/umd/semi-ui.min.js.map +1 -1
  6. package/lib/cjs/_base/base.d.ts +3 -3
  7. package/lib/cjs/_base/baseComponent.d.ts +1 -1
  8. package/lib/cjs/_base/baseComponent.js +5 -16
  9. package/lib/cjs/_base/reactUtils.js +3 -9
  10. package/lib/cjs/_cssAnimation/index.js +4 -25
  11. package/lib/cjs/_portal/index.js +0 -31
  12. package/lib/cjs/_utils/hooks/usePrevFocus.js +0 -6
  13. package/lib/cjs/_utils/index.js +6 -45
  14. package/lib/cjs/anchor/anchor-context.d.ts +1 -1
  15. package/lib/cjs/anchor/anchor-context.js +0 -4
  16. package/lib/cjs/anchor/index.js +2 -48
  17. package/lib/cjs/anchor/link.js +4 -36
  18. package/lib/cjs/autoComplete/index.d.ts +1 -1
  19. package/lib/cjs/autoComplete/index.js +3 -42
  20. package/lib/cjs/autoComplete/option.js +26 -54
  21. package/lib/cjs/avatar/avatarGroup.js +9 -42
  22. package/lib/cjs/avatar/index.js +15 -56
  23. package/lib/cjs/avatar/interface.d.ts +6 -6
  24. package/lib/cjs/backtop/index.js +9 -34
  25. package/lib/cjs/badge/index.d.ts +3 -3
  26. package/lib/cjs/badge/index.js +16 -38
  27. package/lib/cjs/banner/index.d.ts +1 -1
  28. package/lib/cjs/banner/index.js +3 -31
  29. package/lib/cjs/breadcrumb/bread-context.js +0 -4
  30. package/lib/cjs/breadcrumb/index.d.ts +1 -1
  31. package/lib/cjs/breadcrumb/index.js +1 -45
  32. package/lib/cjs/breadcrumb/item.d.ts +1 -1
  33. package/lib/cjs/breadcrumb/item.js +16 -56
  34. package/lib/cjs/button/Button.d.ts +4 -4
  35. package/lib/cjs/button/Button.js +18 -37
  36. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  37. package/lib/cjs/button/buttonGroup.js +10 -35
  38. package/lib/cjs/button/index.js +0 -9
  39. package/lib/cjs/button/splitButtonGroup.js +0 -11
  40. package/lib/cjs/calendar/dayCalendar.js +0 -29
  41. package/lib/cjs/calendar/dayCol.js +1 -28
  42. package/lib/cjs/calendar/index.js +4 -22
  43. package/lib/cjs/calendar/interface.d.ts +5 -5
  44. package/lib/cjs/calendar/monthCalendar.js +6 -62
  45. package/lib/cjs/calendar/rangeCalendar.js +1 -34
  46. package/lib/cjs/calendar/timeCol.js +0 -20
  47. package/lib/cjs/calendar/weekCalendar.js +0 -35
  48. package/lib/cjs/card/cardGroup.d.ts +1 -1
  49. package/lib/cjs/card/cardGroup.js +8 -24
  50. package/lib/cjs/card/index.d.ts +1 -1
  51. package/lib/cjs/card/index.js +7 -38
  52. package/lib/cjs/card/meta.d.ts +1 -1
  53. package/lib/cjs/card/meta.js +8 -27
  54. package/lib/cjs/carousel/CarouselArrow.d.ts +2 -2
  55. package/lib/cjs/carousel/CarouselArrow.js +1 -13
  56. package/lib/cjs/carousel/CarouselIndicator.js +9 -33
  57. package/lib/cjs/carousel/index.js +1 -49
  58. package/lib/cjs/cascader/index.d.ts +2 -2
  59. package/lib/cjs/cascader/index.js +12 -144
  60. package/lib/cjs/cascader/item.js +2 -63
  61. package/lib/cjs/checkbox/checkbox.d.ts +1 -1
  62. package/lib/cjs/checkbox/checkbox.js +21 -55
  63. package/lib/cjs/checkbox/checkboxGroup.d.ts +4 -4
  64. package/lib/cjs/checkbox/checkboxGroup.js +9 -29
  65. package/lib/cjs/checkbox/checkboxInner.js +1 -15
  66. package/lib/cjs/checkbox/context.d.ts +1 -1
  67. package/lib/cjs/checkbox/context.js +0 -4
  68. package/lib/cjs/checkbox/index.js +0 -5
  69. package/lib/cjs/collapse/collapse-context.js +0 -4
  70. package/lib/cjs/collapse/index.js +14 -42
  71. package/lib/cjs/collapse/item.js +13 -41
  72. package/lib/cjs/collapsible/index.js +0 -34
  73. package/lib/cjs/configProvider/context.js +0 -4
  74. package/lib/cjs/configProvider/index.js +5 -21
  75. package/lib/cjs/datePicker/dateInput.js +39 -93
  76. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  77. package/lib/cjs/datePicker/datePicker.js +11 -119
  78. package/lib/cjs/datePicker/footer.js +0 -6
  79. package/lib/cjs/datePicker/index.js +2 -17
  80. package/lib/cjs/datePicker/insetInput.js +0 -9
  81. package/lib/cjs/datePicker/month.d.ts +1 -1
  82. package/lib/cjs/datePicker/month.js +25 -90
  83. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  84. package/lib/cjs/datePicker/monthsGrid.js +21 -96
  85. package/lib/cjs/datePicker/navigation.js +7 -24
  86. package/lib/cjs/datePicker/quickControl.js +1 -17
  87. package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
  88. package/lib/cjs/datePicker/yearAndMonth.js +6 -52
  89. package/lib/cjs/descriptions/descriptions-context.d.ts +1 -1
  90. package/lib/cjs/descriptions/descriptions-context.js +0 -4
  91. package/lib/cjs/descriptions/index.d.ts +1 -1
  92. package/lib/cjs/descriptions/index.js +0 -15
  93. package/lib/cjs/descriptions/item.js +0 -14
  94. package/lib/cjs/divider/index.js +9 -23
  95. package/lib/cjs/dropdown/context.js +0 -4
  96. package/lib/cjs/dropdown/dropdownDivider.d.ts +1 -1
  97. package/lib/cjs/dropdown/dropdownDivider.js +0 -8
  98. package/lib/cjs/dropdown/dropdownItem.d.ts +1 -1
  99. package/lib/cjs/dropdown/dropdownItem.js +0 -21
  100. package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -1
  101. package/lib/cjs/dropdown/dropdownMenu.js +6 -24
  102. package/lib/cjs/dropdown/dropdownTitle.d.ts +1 -1
  103. package/lib/cjs/dropdown/dropdownTitle.js +0 -12
  104. package/lib/cjs/dropdown/index.d.ts +1 -1
  105. package/lib/cjs/dropdown/index.js +21 -62
  106. package/lib/cjs/empty/index.js +0 -20
  107. package/lib/cjs/form/arrayField.js +15 -47
  108. package/lib/cjs/form/baseForm.js +26 -72
  109. package/lib/cjs/form/context.js +1 -10
  110. package/lib/cjs/form/errorMessage.d.ts +1 -1
  111. package/lib/cjs/form/errorMessage.js +1 -20
  112. package/lib/cjs/form/field.js +4 -23
  113. package/lib/cjs/form/group.js +11 -48
  114. package/lib/cjs/form/hoc/withField.js +69 -144
  115. package/lib/cjs/form/hoc/withFormApi.js +0 -7
  116. package/lib/cjs/form/hoc/withFormState.js +0 -7
  117. package/lib/cjs/form/hooks/index.js +0 -8
  118. package/lib/cjs/form/hooks/useArrayFieldState.js +0 -4
  119. package/lib/cjs/form/hooks/useFieldApi.js +0 -5
  120. package/lib/cjs/form/hooks/useFieldState.js +0 -8
  121. package/lib/cjs/form/hooks/useFormApi.js +0 -3
  122. package/lib/cjs/form/hooks/useFormState.js +0 -4
  123. package/lib/cjs/form/hooks/useFormUpdater.js +0 -3
  124. package/lib/cjs/form/hooks/useStateWithGetter.js +0 -5
  125. package/lib/cjs/form/index.js +0 -9
  126. package/lib/cjs/form/interface.d.ts +4 -4
  127. package/lib/cjs/form/interface.js +1 -8
  128. package/lib/cjs/form/label.js +0 -16
  129. package/lib/cjs/form/section.js +1 -11
  130. package/lib/cjs/form/slot.js +10 -51
  131. package/lib/cjs/grid/col.js +10 -29
  132. package/lib/cjs/grid/index.js +0 -3
  133. package/lib/cjs/grid/row.d.ts +2 -2
  134. package/lib/cjs/grid/row.js +10 -34
  135. package/lib/cjs/highlight/index.js +0 -11
  136. package/lib/cjs/iconButton/index.d.ts +1 -1
  137. package/lib/cjs/iconButton/index.js +18 -42
  138. package/lib/cjs/icons/index.js +0 -3
  139. package/lib/cjs/image/image.d.ts +0 -3
  140. package/lib/cjs/image/image.js +19 -88
  141. package/lib/cjs/image/index.js +0 -6
  142. package/lib/cjs/image/interface.d.ts +1 -1
  143. package/lib/cjs/image/preview.d.ts +4 -0
  144. package/lib/cjs/image/preview.js +53 -61
  145. package/lib/cjs/image/previewContext.js +0 -2
  146. package/lib/cjs/image/previewFooter.js +9 -62
  147. package/lib/cjs/image/previewHeader.js +0 -13
  148. package/lib/cjs/image/previewImage.js +46 -79
  149. package/lib/cjs/image/previewInner.js +70 -126
  150. package/lib/cjs/index.js +0 -86
  151. package/lib/cjs/input/index.d.ts +3 -3
  152. package/lib/cjs/input/index.js +35 -103
  153. package/lib/cjs/input/inputGroup.d.ts +1 -1
  154. package/lib/cjs/input/inputGroup.js +20 -44
  155. package/lib/cjs/input/textarea.d.ts +1 -1
  156. package/lib/cjs/input/textarea.js +33 -77
  157. package/lib/cjs/inputNumber/index.js +127 -199
  158. package/lib/cjs/layout/Sider.js +7 -32
  159. package/lib/cjs/layout/index.js +16 -40
  160. package/lib/cjs/layout/layout-context.js +0 -5
  161. package/lib/cjs/list/index.js +0 -26
  162. package/lib/cjs/list/item.js +6 -30
  163. package/lib/cjs/list/list-context.js +0 -4
  164. package/lib/cjs/locale/context.js +0 -4
  165. package/lib/cjs/locale/localeConsumer.d.ts +1 -1
  166. package/lib/cjs/locale/localeConsumer.js +0 -16
  167. package/lib/cjs/locale/localeProvider.js +0 -11
  168. package/lib/cjs/locale/source/ar.js +2 -4
  169. package/lib/cjs/locale/source/de.js +2 -4
  170. package/lib/cjs/locale/source/en_GB.js +2 -4
  171. package/lib/cjs/locale/source/en_US.js +2 -4
  172. package/lib/cjs/locale/source/es.js +0 -2
  173. package/lib/cjs/locale/source/fr.js +2 -4
  174. package/lib/cjs/locale/source/id_ID.js +2 -4
  175. package/lib/cjs/locale/source/it.js +2 -4
  176. package/lib/cjs/locale/source/ja_JP.js +2 -4
  177. package/lib/cjs/locale/source/ko_KR.js +2 -4
  178. package/lib/cjs/locale/source/ms_MY.js +2 -4
  179. package/lib/cjs/locale/source/nl_NL.js +0 -2
  180. package/lib/cjs/locale/source/pl_PL.js +0 -2
  181. package/lib/cjs/locale/source/pt_BR.js +2 -4
  182. package/lib/cjs/locale/source/ro.js +0 -2
  183. package/lib/cjs/locale/source/ru_RU.js +2 -4
  184. package/lib/cjs/locale/source/sv_SE.js +0 -2
  185. package/lib/cjs/locale/source/th_TH.js +2 -4
  186. package/lib/cjs/locale/source/tr_TR.js +2 -4
  187. package/lib/cjs/locale/source/vi_VN.js +2 -4
  188. package/lib/cjs/locale/source/zh_CN.js +2 -4
  189. package/lib/cjs/locale/source/zh_TW.js +2 -4
  190. package/lib/cjs/modal/ConfirmModal.js +9 -29
  191. package/lib/cjs/modal/Modal.d.ts +2 -2
  192. package/lib/cjs/modal/Modal.js +17 -80
  193. package/lib/cjs/modal/ModalContent.js +13 -72
  194. package/lib/cjs/modal/confirm.d.ts +9 -3
  195. package/lib/cjs/modal/confirm.js +4 -28
  196. package/lib/cjs/modal/index.d.ts +1 -1
  197. package/lib/cjs/modal/index.js +0 -4
  198. package/lib/cjs/modal/useModal/HookModal.js +4 -18
  199. package/lib/cjs/modal/useModal/index.d.ts +1 -1
  200. package/lib/cjs/modal/useModal/index.js +4 -18
  201. package/lib/cjs/navigation/CollapseButton.js +0 -11
  202. package/lib/cjs/navigation/Footer.js +0 -20
  203. package/lib/cjs/navigation/Header.d.ts +1 -1
  204. package/lib/cjs/navigation/Header.js +0 -18
  205. package/lib/cjs/navigation/Item.js +3 -51
  206. package/lib/cjs/navigation/SubNav.js +7 -67
  207. package/lib/cjs/navigation/index.d.ts +2 -2
  208. package/lib/cjs/navigation/index.js +5 -60
  209. package/lib/cjs/navigation/nav-context.js +0 -4
  210. package/lib/cjs/notification/index.d.ts +1 -1
  211. package/lib/cjs/notification/index.js +4 -56
  212. package/lib/cjs/notification/notice.js +24 -58
  213. package/lib/cjs/notification/useNotification/HookNotice.js +3 -18
  214. package/lib/cjs/notification/useNotification/index.js +4 -25
  215. package/lib/cjs/overflowList/index.d.ts +41 -24
  216. package/lib/cjs/overflowList/index.js +7 -65
  217. package/lib/cjs/overflowList/intersectionObserver.js +2 -21
  218. package/lib/cjs/pagination/index.d.ts +2 -2
  219. package/lib/cjs/pagination/index.js +7 -59
  220. package/lib/cjs/popconfirm/index.js +9 -54
  221. package/lib/cjs/popover/Arrow.js +6 -19
  222. package/lib/cjs/popover/index.js +11 -38
  223. package/lib/cjs/progress/index.js +8 -48
  224. package/lib/cjs/radio/context.d.ts +2 -2
  225. package/lib/cjs/radio/context.js +0 -4
  226. package/lib/cjs/radio/index.js +0 -5
  227. package/lib/cjs/radio/radio.d.ts +3 -3
  228. package/lib/cjs/radio/radio.js +1 -36
  229. package/lib/cjs/radio/radioGroup.d.ts +2 -2
  230. package/lib/cjs/radio/radioGroup.js +0 -24
  231. package/lib/cjs/radio/radioInner.d.ts +1 -1
  232. package/lib/cjs/radio/radioInner.js +0 -21
  233. package/lib/cjs/rating/index.js +4 -51
  234. package/lib/cjs/rating/item.d.ts +1 -1
  235. package/lib/cjs/rating/item.js +2 -27
  236. package/lib/cjs/resizeObserver/index.js +4 -28
  237. package/lib/cjs/scrollList/index.js +0 -13
  238. package/lib/cjs/scrollList/scrollItem.js +15 -113
  239. package/lib/cjs/select/index.d.ts +6 -6
  240. package/lib/cjs/select/index.js +27 -164
  241. package/lib/cjs/select/option.js +27 -55
  242. package/lib/cjs/select/optionGroup.js +0 -12
  243. package/lib/cjs/select/utils.js +8 -24
  244. package/lib/cjs/select/virtualRow.js +0 -2
  245. package/lib/cjs/sideSheet/SideSheetContent.js +2 -40
  246. package/lib/cjs/sideSheet/index.js +21 -66
  247. package/lib/cjs/skeleton/index.js +9 -28
  248. package/lib/cjs/skeleton/item.d.ts +2 -2
  249. package/lib/cjs/skeleton/item.js +8 -29
  250. package/lib/cjs/slider/index.js +7 -68
  251. package/lib/cjs/space/index.d.ts +3 -3
  252. package/lib/cjs/space/index.js +0 -20
  253. package/lib/cjs/space/utils.js +0 -9
  254. package/lib/cjs/spin/icon.js +4 -17
  255. package/lib/cjs/spin/index.d.ts +1 -1
  256. package/lib/cjs/spin/index.js +0 -20
  257. package/lib/cjs/steps/basicStep.d.ts +2 -2
  258. package/lib/cjs/steps/basicStep.js +0 -22
  259. package/lib/cjs/steps/basicSteps.d.ts +3 -3
  260. package/lib/cjs/steps/basicSteps.js +0 -15
  261. package/lib/cjs/steps/context.js +0 -4
  262. package/lib/cjs/steps/fillStep.d.ts +1 -1
  263. package/lib/cjs/steps/fillStep.js +0 -19
  264. package/lib/cjs/steps/fillSteps.d.ts +2 -2
  265. package/lib/cjs/steps/fillSteps.js +0 -17
  266. package/lib/cjs/steps/index.d.ts +1 -1
  267. package/lib/cjs/steps/index.js +4 -26
  268. package/lib/cjs/steps/navStep.js +0 -11
  269. package/lib/cjs/steps/navSteps.d.ts +1 -1
  270. package/lib/cjs/steps/navSteps.js +0 -13
  271. package/lib/cjs/steps/step.d.ts +1 -1
  272. package/lib/cjs/steps/step.js +0 -15
  273. package/lib/cjs/switch/index.js +1 -22
  274. package/lib/cjs/table/Body/BaseRow.d.ts +1 -1
  275. package/lib/cjs/table/Body/BaseRow.js +37 -101
  276. package/lib/cjs/table/Body/ExpandedRow.d.ts +1 -1
  277. package/lib/cjs/table/Body/ExpandedRow.js +5 -30
  278. package/lib/cjs/table/Body/SectionRow.js +8 -46
  279. package/lib/cjs/table/Body/index.js +38 -153
  280. package/lib/cjs/table/ColGroup.js +2 -14
  281. package/lib/cjs/table/Column.js +0 -7
  282. package/lib/cjs/table/ColumnFilter.js +4 -30
  283. package/lib/cjs/table/ColumnSelection.js +5 -24
  284. package/lib/cjs/table/ColumnShape.js +0 -4
  285. package/lib/cjs/table/ColumnSorter.js +0 -13
  286. package/lib/cjs/table/CustomExpandIcon.js +0 -16
  287. package/lib/cjs/table/HeadTable.js +0 -23
  288. package/lib/cjs/table/ResizableHeaderCell.d.ts +1 -1
  289. package/lib/cjs/table/ResizableHeaderCell.js +9 -20
  290. package/lib/cjs/table/ResizableTable.js +5 -47
  291. package/lib/cjs/table/Table.d.ts +2 -2
  292. package/lib/cjs/table/Table.js +534 -771
  293. package/lib/cjs/table/TableCell.js +20 -81
  294. package/lib/cjs/table/TableContextProvider.js +0 -7
  295. package/lib/cjs/table/TableHeader.js +5 -33
  296. package/lib/cjs/table/TableHeaderRow.js +8 -45
  297. package/lib/cjs/table/TablePagination.js +1 -12
  298. package/lib/cjs/table/getColumns.js +0 -11
  299. package/lib/cjs/table/index.js +2 -20
  300. package/lib/cjs/table/interface.d.ts +58 -58
  301. package/lib/cjs/table/table-context.js +1 -5
  302. package/lib/cjs/table/utils.js +6 -30
  303. package/lib/cjs/tabs/TabBar.js +13 -61
  304. package/lib/cjs/tabs/TabItem.js +18 -31
  305. package/lib/cjs/tabs/TabPane.js +10 -35
  306. package/lib/cjs/tabs/index.js +20 -83
  307. package/lib/cjs/tabs/interface.d.ts +3 -3
  308. package/lib/cjs/tabs/tabs-context.js +0 -4
  309. package/lib/cjs/tag/group.js +0 -27
  310. package/lib/cjs/tag/index.js +23 -60
  311. package/lib/cjs/tag/interface.d.ts +5 -5
  312. package/lib/cjs/tagInput/index.d.ts +3 -3
  313. package/lib/cjs/tagInput/index.js +2 -77
  314. package/lib/cjs/timePicker/Combobox.d.ts +2 -2
  315. package/lib/cjs/timePicker/Combobox.js +7 -54
  316. package/lib/cjs/timePicker/PanelShape.js +0 -3
  317. package/lib/cjs/timePicker/TimeInput.d.ts +1 -1
  318. package/lib/cjs/timePicker/TimeInput.js +32 -64
  319. package/lib/cjs/timePicker/TimePicker.d.ts +3 -3
  320. package/lib/cjs/timePicker/TimePicker.js +39 -99
  321. package/lib/cjs/timePicker/TimeShape.js +0 -5
  322. package/lib/cjs/timePicker/index.d.ts +1 -1
  323. package/lib/cjs/timePicker/index.js +0 -9
  324. package/lib/cjs/timeline/index.js +0 -27
  325. package/lib/cjs/timeline/item.js +0 -13
  326. package/lib/cjs/toast/index.js +5 -59
  327. package/lib/cjs/toast/toast.js +1 -29
  328. package/lib/cjs/toast/useToast/HookToast.js +3 -18
  329. package/lib/cjs/toast/useToast/index.js +2 -17
  330. package/lib/cjs/tooltip/ArrowBoundingShape.js +0 -4
  331. package/lib/cjs/tooltip/TriangleArrow.js +4 -12
  332. package/lib/cjs/tooltip/TriangleArrowVertical.js +4 -12
  333. package/lib/cjs/tooltip/index.d.ts +2 -2
  334. package/lib/cjs/tooltip/index.js +24 -134
  335. package/lib/cjs/transfer/index.d.ts +5 -5
  336. package/lib/cjs/transfer/index.js +10 -93
  337. package/lib/cjs/tree/autoSizer.js +4 -24
  338. package/lib/cjs/tree/index.js +31 -122
  339. package/lib/cjs/tree/interface.d.ts +2 -2
  340. package/lib/cjs/tree/nodeCollapsible.js +4 -15
  341. package/lib/cjs/tree/nodeList.js +0 -22
  342. package/lib/cjs/tree/treeContext.js +0 -4
  343. package/lib/cjs/tree/treeNode.js +21 -94
  344. package/lib/cjs/tree/treeUtil.js +0 -6
  345. package/lib/cjs/treeSelect/index.d.ts +6 -6
  346. package/lib/cjs/treeSelect/index.js +46 -196
  347. package/lib/cjs/trigger/index.js +5 -16
  348. package/lib/cjs/typography/base.js +35 -130
  349. package/lib/cjs/typography/copyable.js +2 -30
  350. package/lib/cjs/typography/index.d.ts +1 -1
  351. package/lib/cjs/typography/index.js +0 -9
  352. package/lib/cjs/typography/interface.d.ts +9 -9
  353. package/lib/cjs/typography/numeral.d.ts +1 -1
  354. package/lib/cjs/typography/numeral.js +4 -20
  355. package/lib/cjs/typography/paragraph.d.ts +1 -1
  356. package/lib/cjs/typography/paragraph.js +0 -12
  357. package/lib/cjs/typography/text.d.ts +1 -1
  358. package/lib/cjs/typography/text.js +0 -10
  359. package/lib/cjs/typography/title.d.ts +2 -2
  360. package/lib/cjs/typography/title.js +6 -20
  361. package/lib/cjs/typography/typography.js +7 -23
  362. package/lib/cjs/typography/util.js +22 -50
  363. package/lib/cjs/upload/fileCard.js +2 -52
  364. package/lib/cjs/upload/index.js +1 -70
  365. package/lib/cjs/upload/interface.d.ts +5 -5
  366. package/lib/es/_base/base.d.ts +3 -3
  367. package/lib/es/_base/baseComponent.d.ts +1 -1
  368. package/lib/es/_base/baseComponent.js +4 -11
  369. package/lib/es/_base/reactUtils.js +4 -8
  370. package/lib/es/_cssAnimation/index.js +4 -22
  371. package/lib/es/_portal/index.js +0 -23
  372. package/lib/es/_utils/hooks/usePrevFocus.js +0 -2
  373. package/lib/es/_utils/index.js +6 -28
  374. package/lib/es/anchor/anchor-context.d.ts +1 -1
  375. package/lib/es/anchor/index.js +2 -32
  376. package/lib/es/anchor/link.js +4 -24
  377. package/lib/es/autoComplete/index.d.ts +1 -1
  378. package/lib/es/autoComplete/index.js +3 -25
  379. package/lib/es/autoComplete/option.js +26 -45
  380. package/lib/es/avatar/avatarGroup.js +9 -28
  381. package/lib/es/avatar/index.js +15 -41
  382. package/lib/es/avatar/interface.d.ts +6 -6
  383. package/lib/es/backtop/index.js +9 -22
  384. package/lib/es/badge/index.d.ts +3 -3
  385. package/lib/es/badge/index.js +16 -24
  386. package/lib/es/banner/index.d.ts +1 -1
  387. package/lib/es/banner/index.js +2 -15
  388. package/lib/es/breadcrumb/index.d.ts +1 -1
  389. package/lib/es/breadcrumb/index.js +0 -31
  390. package/lib/es/breadcrumb/item.d.ts +1 -1
  391. package/lib/es/breadcrumb/item.js +16 -38
  392. package/lib/es/button/Button.d.ts +4 -4
  393. package/lib/es/button/Button.js +18 -27
  394. package/lib/es/button/buttonGroup.d.ts +1 -1
  395. package/lib/es/button/buttonGroup.js +10 -24
  396. package/lib/es/button/index.js +0 -5
  397. package/lib/es/button/splitButtonGroup.js +0 -1
  398. package/lib/es/calendar/dayCalendar.js +0 -13
  399. package/lib/es/calendar/dayCol.js +0 -14
  400. package/lib/es/calendar/index.js +6 -12
  401. package/lib/es/calendar/interface.d.ts +5 -5
  402. package/lib/es/calendar/monthCalendar.js +6 -41
  403. package/lib/es/calendar/rangeCalendar.js +2 -18
  404. package/lib/es/calendar/timeCol.js +0 -7
  405. package/lib/es/calendar/weekCalendar.js +0 -17
  406. package/lib/es/card/cardGroup.d.ts +1 -1
  407. package/lib/es/card/cardGroup.js +8 -15
  408. package/lib/es/card/index.d.ts +1 -1
  409. package/lib/es/card/index.js +7 -23
  410. package/lib/es/card/meta.d.ts +1 -1
  411. package/lib/es/card/meta.js +8 -15
  412. package/lib/es/carousel/CarouselArrow.d.ts +2 -2
  413. package/lib/es/carousel/CarouselArrow.js +0 -8
  414. package/lib/es/carousel/CarouselIndicator.js +9 -27
  415. package/lib/es/carousel/index.js +0 -34
  416. package/lib/es/cascader/index.d.ts +2 -2
  417. package/lib/es/cascader/index.js +12 -105
  418. package/lib/es/cascader/item.js +2 -44
  419. package/lib/es/checkbox/checkbox.d.ts +1 -1
  420. package/lib/es/checkbox/checkbox.js +20 -42
  421. package/lib/es/checkbox/checkboxGroup.d.ts +4 -4
  422. package/lib/es/checkbox/checkboxGroup.js +8 -20
  423. package/lib/es/checkbox/checkboxInner.js +0 -6
  424. package/lib/es/checkbox/context.d.ts +1 -1
  425. package/lib/es/checkbox/index.js +0 -2
  426. package/lib/es/collapse/index.js +14 -31
  427. package/lib/es/collapse/item.js +13 -27
  428. package/lib/es/collapsible/index.js +0 -25
  429. package/lib/es/configProvider/index.js +5 -13
  430. package/lib/es/datePicker/dateInput.js +41 -81
  431. package/lib/es/datePicker/datePicker.d.ts +1 -1
  432. package/lib/es/datePicker/datePicker.js +10 -103
  433. package/lib/es/datePicker/index.js +2 -8
  434. package/lib/es/datePicker/insetInput.js +0 -6
  435. package/lib/es/datePicker/month.d.ts +1 -1
  436. package/lib/es/datePicker/month.js +24 -78
  437. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  438. package/lib/es/datePicker/monthsGrid.js +20 -76
  439. package/lib/es/datePicker/navigation.js +8 -13
  440. package/lib/es/datePicker/quickControl.js +0 -6
  441. package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
  442. package/lib/es/datePicker/yearAndMonth.js +5 -36
  443. package/lib/es/descriptions/descriptions-context.d.ts +1 -1
  444. package/lib/es/descriptions/index.d.ts +1 -1
  445. package/lib/es/descriptions/index.js +0 -3
  446. package/lib/es/descriptions/item.js +0 -3
  447. package/lib/es/divider/index.js +9 -17
  448. package/lib/es/dropdown/dropdownDivider.d.ts +1 -1
  449. package/lib/es/dropdown/dropdownDivider.js +0 -2
  450. package/lib/es/dropdown/dropdownItem.d.ts +1 -1
  451. package/lib/es/dropdown/dropdownItem.js +0 -11
  452. package/lib/es/dropdown/dropdownMenu.d.ts +1 -1
  453. package/lib/es/dropdown/dropdownMenu.js +6 -15
  454. package/lib/es/dropdown/dropdownTitle.d.ts +1 -1
  455. package/lib/es/dropdown/dropdownTitle.js +0 -3
  456. package/lib/es/dropdown/index.d.ts +1 -1
  457. package/lib/es/dropdown/index.js +21 -47
  458. package/lib/es/empty/index.js +0 -10
  459. package/lib/es/form/arrayField.js +14 -41
  460. package/lib/es/form/baseForm.js +26 -49
  461. package/lib/es/form/errorMessage.d.ts +1 -1
  462. package/lib/es/form/errorMessage.js +0 -9
  463. package/lib/es/form/field.js +4 -4
  464. package/lib/es/form/group.js +11 -29
  465. package/lib/es/form/hoc/withField.js +68 -125
  466. package/lib/es/form/hoc/withFormApi.js +0 -3
  467. package/lib/es/form/hoc/withFormState.js +0 -3
  468. package/lib/es/form/hooks/index.js +2 -2
  469. package/lib/es/form/hooks/useArrayFieldState.js +0 -2
  470. package/lib/es/form/hooks/useFieldApi.js +0 -3
  471. package/lib/es/form/hooks/useFieldState.js +0 -3
  472. package/lib/es/form/hooks/useFormState.js +0 -2
  473. package/lib/es/form/hooks/useStateWithGetter.js +2 -5
  474. package/lib/es/form/index.js +4 -4
  475. package/lib/es/form/interface.d.ts +4 -4
  476. package/lib/es/form/interface.js +0 -1
  477. package/lib/es/form/label.js +0 -1
  478. package/lib/es/form/section.js +0 -1
  479. package/lib/es/form/slot.js +10 -39
  480. package/lib/es/grid/col.js +10 -23
  481. package/lib/es/grid/row.d.ts +2 -2
  482. package/lib/es/grid/row.js +10 -25
  483. package/lib/es/highlight/index.js +0 -3
  484. package/lib/es/iconButton/index.d.ts +1 -1
  485. package/lib/es/iconButton/index.js +18 -31
  486. package/lib/es/image/image.d.ts +0 -3
  487. package/lib/es/image/image.js +19 -70
  488. package/lib/es/image/interface.d.ts +1 -1
  489. package/lib/es/image/preview.d.ts +4 -0
  490. package/lib/es/image/preview.js +51 -48
  491. package/lib/es/image/previewFooter.js +9 -34
  492. package/lib/es/image/previewHeader.js +0 -4
  493. package/lib/es/image/previewImage.js +46 -69
  494. package/lib/es/image/previewInner.js +69 -110
  495. package/lib/es/index.js +0 -1
  496. package/lib/es/input/index.d.ts +3 -3
  497. package/lib/es/input/index.js +35 -88
  498. package/lib/es/input/inputGroup.d.ts +1 -1
  499. package/lib/es/input/inputGroup.js +20 -33
  500. package/lib/es/input/textarea.d.ts +1 -1
  501. package/lib/es/input/textarea.js +34 -65
  502. package/lib/es/inputNumber/index.js +127 -181
  503. package/lib/es/layout/Sider.js +7 -23
  504. package/lib/es/layout/index.js +16 -31
  505. package/lib/es/list/index.js +0 -11
  506. package/lib/es/list/item.js +6 -18
  507. package/lib/es/locale/localeConsumer.d.ts +1 -1
  508. package/lib/es/locale/localeConsumer.js +0 -7
  509. package/lib/es/locale/localeProvider.js +0 -2
  510. package/lib/es/locale/source/ar.js +2 -2
  511. package/lib/es/locale/source/de.js +2 -2
  512. package/lib/es/locale/source/en_GB.js +2 -2
  513. package/lib/es/locale/source/en_US.js +2 -2
  514. package/lib/es/locale/source/es.js +0 -1
  515. package/lib/es/locale/source/fr.js +2 -2
  516. package/lib/es/locale/source/id_ID.js +2 -2
  517. package/lib/es/locale/source/it.js +2 -2
  518. package/lib/es/locale/source/ja_JP.js +2 -2
  519. package/lib/es/locale/source/ko_KR.js +2 -2
  520. package/lib/es/locale/source/ms_MY.js +2 -2
  521. package/lib/es/locale/source/nl_NL.js +0 -1
  522. package/lib/es/locale/source/pl_PL.js +0 -1
  523. package/lib/es/locale/source/pt_BR.js +2 -2
  524. package/lib/es/locale/source/ro.js +0 -1
  525. package/lib/es/locale/source/ru_RU.js +2 -2
  526. package/lib/es/locale/source/sv_SE.js +0 -1
  527. package/lib/es/locale/source/th_TH.js +2 -2
  528. package/lib/es/locale/source/tr_TR.js +2 -2
  529. package/lib/es/locale/source/vi_VN.js +2 -2
  530. package/lib/es/locale/source/zh_CN.js +2 -2
  531. package/lib/es/locale/source/zh_TW.js +2 -2
  532. package/lib/es/modal/ConfirmModal.js +9 -20
  533. package/lib/es/modal/Modal.d.ts +2 -2
  534. package/lib/es/modal/Modal.js +17 -63
  535. package/lib/es/modal/ModalContent.js +14 -54
  536. package/lib/es/modal/confirm.d.ts +9 -3
  537. package/lib/es/modal/confirm.js +4 -11
  538. package/lib/es/modal/index.d.ts +1 -1
  539. package/lib/es/modal/useModal/HookModal.js +6 -14
  540. package/lib/es/modal/useModal/index.d.ts +1 -1
  541. package/lib/es/modal/useModal/index.js +4 -9
  542. package/lib/es/navigation/CollapseButton.js +0 -4
  543. package/lib/es/navigation/Footer.js +0 -7
  544. package/lib/es/navigation/Header.d.ts +1 -1
  545. package/lib/es/navigation/Header.js +0 -5
  546. package/lib/es/navigation/Item.js +2 -35
  547. package/lib/es/navigation/SubNav.js +6 -45
  548. package/lib/es/navigation/index.d.ts +2 -2
  549. package/lib/es/navigation/index.js +5 -38
  550. package/lib/es/notification/index.d.ts +1 -1
  551. package/lib/es/notification/index.js +4 -39
  552. package/lib/es/notification/notice.js +24 -46
  553. package/lib/es/notification/useNotification/HookNotice.js +3 -11
  554. package/lib/es/notification/useNotification/index.js +6 -16
  555. package/lib/es/overflowList/index.d.ts +41 -24
  556. package/lib/es/overflowList/index.js +6 -46
  557. package/lib/es/overflowList/intersectionObserver.js +2 -13
  558. package/lib/es/pagination/index.d.ts +2 -2
  559. package/lib/es/pagination/index.js +7 -37
  560. package/lib/es/popconfirm/index.js +9 -37
  561. package/lib/es/popover/Arrow.js +6 -18
  562. package/lib/es/popover/index.js +11 -27
  563. package/lib/es/progress/index.js +8 -37
  564. package/lib/es/radio/context.d.ts +2 -2
  565. package/lib/es/radio/index.js +0 -2
  566. package/lib/es/radio/radio.d.ts +3 -3
  567. package/lib/es/radio/radio.js +0 -23
  568. package/lib/es/radio/radioGroup.d.ts +2 -2
  569. package/lib/es/radio/radioGroup.js +0 -14
  570. package/lib/es/radio/radioInner.d.ts +1 -1
  571. package/lib/es/radio/radioInner.js +0 -11
  572. package/lib/es/rating/index.js +4 -36
  573. package/lib/es/rating/item.d.ts +1 -1
  574. package/lib/es/rating/item.js +2 -16
  575. package/lib/es/resizeObserver/index.js +4 -19
  576. package/lib/es/scrollList/index.js +2 -5
  577. package/lib/es/scrollList/scrollItem.js +15 -104
  578. package/lib/es/select/index.d.ts +6 -6
  579. package/lib/es/select/index.js +27 -123
  580. package/lib/es/select/option.js +27 -46
  581. package/lib/es/select/optionGroup.js +0 -5
  582. package/lib/es/select/utils.js +8 -19
  583. package/lib/es/select/virtualRow.js +0 -1
  584. package/lib/es/sideSheet/SideSheetContent.js +2 -28
  585. package/lib/es/sideSheet/index.js +21 -52
  586. package/lib/es/skeleton/index.js +9 -18
  587. package/lib/es/skeleton/item.d.ts +2 -2
  588. package/lib/es/skeleton/item.js +8 -17
  589. package/lib/es/slider/index.js +6 -53
  590. package/lib/es/space/index.d.ts +3 -3
  591. package/lib/es/space/index.js +0 -6
  592. package/lib/es/space/utils.js +0 -2
  593. package/lib/es/spin/icon.js +4 -15
  594. package/lib/es/spin/index.d.ts +1 -1
  595. package/lib/es/spin/index.js +0 -10
  596. package/lib/es/steps/basicStep.d.ts +2 -2
  597. package/lib/es/steps/basicStep.js +0 -15
  598. package/lib/es/steps/basicSteps.d.ts +3 -3
  599. package/lib/es/steps/basicSteps.js +0 -6
  600. package/lib/es/steps/fillStep.d.ts +1 -1
  601. package/lib/es/steps/fillStep.js +0 -13
  602. package/lib/es/steps/fillSteps.d.ts +2 -2
  603. package/lib/es/steps/fillSteps.js +0 -6
  604. package/lib/es/steps/index.d.ts +1 -1
  605. package/lib/es/steps/index.js +4 -15
  606. package/lib/es/steps/navStep.js +0 -5
  607. package/lib/es/steps/navSteps.d.ts +1 -1
  608. package/lib/es/steps/navSteps.js +0 -3
  609. package/lib/es/steps/step.d.ts +1 -1
  610. package/lib/es/steps/step.js +0 -7
  611. package/lib/es/switch/index.js +0 -13
  612. package/lib/es/table/Body/BaseRow.d.ts +1 -1
  613. package/lib/es/table/Body/BaseRow.js +37 -85
  614. package/lib/es/table/Body/ExpandedRow.d.ts +1 -1
  615. package/lib/es/table/Body/ExpandedRow.js +5 -18
  616. package/lib/es/table/Body/SectionRow.js +8 -35
  617. package/lib/es/table/Body/index.js +38 -149
  618. package/lib/es/table/ColGroup.js +2 -7
  619. package/lib/es/table/Column.js +0 -2
  620. package/lib/es/table/ColumnFilter.js +3 -20
  621. package/lib/es/table/ColumnSelection.js +5 -15
  622. package/lib/es/table/ColumnSorter.js +0 -1
  623. package/lib/es/table/CustomExpandIcon.js +0 -6
  624. package/lib/es/table/HeadTable.js +0 -15
  625. package/lib/es/table/ResizableHeaderCell.d.ts +1 -1
  626. package/lib/es/table/ResizableHeaderCell.js +9 -17
  627. package/lib/es/table/ResizableTable.js +5 -37
  628. package/lib/es/table/Table.d.ts +2 -2
  629. package/lib/es/table/Table.js +457 -664
  630. package/lib/es/table/TableCell.js +19 -65
  631. package/lib/es/table/TableContextProvider.js +0 -2
  632. package/lib/es/table/TableHeader.js +4 -23
  633. package/lib/es/table/TableHeaderRow.js +8 -39
  634. package/lib/es/table/TablePagination.js +0 -4
  635. package/lib/es/table/getColumns.js +0 -4
  636. package/lib/es/table/index.js +2 -10
  637. package/lib/es/table/interface.d.ts +58 -58
  638. package/lib/es/table/table-context.js +0 -1
  639. package/lib/es/table/utils.js +6 -19
  640. package/lib/es/tabs/TabBar.js +13 -46
  641. package/lib/es/tabs/TabItem.js +18 -24
  642. package/lib/es/tabs/TabPane.js +10 -25
  643. package/lib/es/tabs/index.js +20 -59
  644. package/lib/es/tabs/interface.d.ts +3 -3
  645. package/lib/es/tag/group.js +0 -14
  646. package/lib/es/tag/index.js +23 -45
  647. package/lib/es/tag/interface.d.ts +5 -5
  648. package/lib/es/tagInput/index.d.ts +3 -3
  649. package/lib/es/tagInput/index.js +2 -54
  650. package/lib/es/timePicker/Combobox.d.ts +2 -2
  651. package/lib/es/timePicker/Combobox.js +6 -42
  652. package/lib/es/timePicker/TimeInput.d.ts +1 -1
  653. package/lib/es/timePicker/TimeInput.js +32 -56
  654. package/lib/es/timePicker/TimePicker.d.ts +3 -3
  655. package/lib/es/timePicker/TimePicker.js +39 -80
  656. package/lib/es/timePicker/TimeShape.js +0 -1
  657. package/lib/es/timePicker/index.d.ts +1 -1
  658. package/lib/es/timePicker/index.js +0 -1
  659. package/lib/es/timeline/index.js +0 -16
  660. package/lib/es/timeline/item.js +0 -1
  661. package/lib/es/toast/index.js +4 -41
  662. package/lib/es/toast/toast.js +0 -17
  663. package/lib/es/toast/useToast/HookToast.js +3 -11
  664. package/lib/es/toast/useToast/index.js +4 -13
  665. package/lib/es/tooltip/TriangleArrow.js +4 -10
  666. package/lib/es/tooltip/TriangleArrowVertical.js +4 -10
  667. package/lib/es/tooltip/index.d.ts +2 -2
  668. package/lib/es/tooltip/index.js +24 -112
  669. package/lib/es/transfer/index.d.ts +5 -5
  670. package/lib/es/transfer/index.js +10 -67
  671. package/lib/es/tree/autoSizer.js +4 -13
  672. package/lib/es/tree/index.js +30 -96
  673. package/lib/es/tree/interface.d.ts +2 -2
  674. package/lib/es/tree/nodeCollapsible.js +4 -10
  675. package/lib/es/tree/nodeList.js +0 -14
  676. package/lib/es/tree/treeNode.js +21 -76
  677. package/lib/es/tree/treeUtil.js +0 -1
  678. package/lib/es/treeSelect/index.d.ts +6 -6
  679. package/lib/es/treeSelect/index.js +46 -156
  680. package/lib/es/trigger/index.js +5 -13
  681. package/lib/es/typography/base.js +35 -113
  682. package/lib/es/typography/copyable.js +2 -14
  683. package/lib/es/typography/index.d.ts +1 -1
  684. package/lib/es/typography/interface.d.ts +9 -9
  685. package/lib/es/typography/numeral.d.ts +1 -1
  686. package/lib/es/typography/numeral.js +4 -10
  687. package/lib/es/typography/paragraph.d.ts +1 -1
  688. package/lib/es/typography/paragraph.js +0 -1
  689. package/lib/es/typography/text.d.ts +1 -1
  690. package/lib/es/typography/text.js +0 -1
  691. package/lib/es/typography/title.d.ts +2 -2
  692. package/lib/es/typography/title.js +6 -11
  693. package/lib/es/typography/typography.js +7 -14
  694. package/lib/es/typography/util.js +22 -45
  695. package/lib/es/upload/fileCard.js +2 -31
  696. package/lib/es/upload/index.js +0 -57
  697. package/lib/es/upload/interface.d.ts +5 -5
  698. package/package.json +8 -8
@@ -4,294 +4,438 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
9
-
10
8
  var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
11
-
12
9
  var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
13
-
14
10
  var _difference2 = _interopRequireDefault(require("lodash/difference"));
15
-
16
11
  var _omit2 = _interopRequireDefault(require("lodash/omit"));
17
-
18
12
  var _each2 = _interopRequireDefault(require("lodash/each"));
19
-
20
13
  var _flattenDeep2 = _interopRequireDefault(require("lodash/flattenDeep"));
21
-
22
14
  var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
23
-
24
15
  var _some2 = _interopRequireDefault(require("lodash/some"));
25
-
26
16
  var _findIndex2 = _interopRequireDefault(require("lodash/findIndex"));
27
-
28
17
  var _find2 = _interopRequireDefault(require("lodash/find"));
29
-
30
18
  var _includes2 = _interopRequireDefault(require("lodash/includes"));
31
-
32
19
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
33
-
34
20
  var _get2 = _interopRequireDefault(require("lodash/get"));
35
-
36
21
  var _react = _interopRequireWildcard(require("react"));
37
-
38
22
  var _propTypes = _interopRequireDefault(require("prop-types"));
39
-
40
23
  var _classnames = _interopRequireDefault(require("classnames"));
41
-
42
24
  var _utils = require("@douyinfe/semi-foundation/lib/cjs/table/utils");
43
-
44
25
  var _Store = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/Store"));
45
-
46
26
  var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/table/foundation"));
47
-
48
27
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/table/constants");
49
-
50
28
  require("@douyinfe/semi-foundation/lib/cjs/table/table.css");
51
-
52
29
  var _spin = _interopRequireDefault(require("../spin"));
53
-
54
30
  var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
55
-
56
31
  var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
57
-
58
32
  var _ColumnShape = _interopRequireDefault(require("./ColumnShape"));
59
-
60
33
  var _getColumns = _interopRequireDefault(require("./getColumns"));
61
-
62
34
  var _tableContext = _interopRequireDefault(require("./table-context"));
63
-
64
35
  var _TableContextProvider = _interopRequireDefault(require("./TableContextProvider"));
65
-
66
36
  var _ColumnSelection = _interopRequireDefault(require("./ColumnSelection"));
67
-
68
37
  var _TablePagination = _interopRequireDefault(require("./TablePagination"));
69
-
70
38
  var _ColumnFilter = _interopRequireDefault(require("./ColumnFilter"));
71
-
72
39
  var _ColumnSorter = _interopRequireDefault(require("./ColumnSorter"));
73
-
74
40
  var _CustomExpandIcon = _interopRequireDefault(require("./CustomExpandIcon"));
75
-
76
41
  var _HeadTable = _interopRequireDefault(require("./HeadTable"));
77
-
78
42
  var _Body = _interopRequireDefault(require("./Body"));
79
-
80
43
  var _utils2 = require("./utils");
81
-
82
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
83
-
84
45
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
85
-
86
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
87
-
88
47
  var __rest = void 0 && (void 0).__rest || function (s, e) {
89
48
  var t = {};
90
-
91
49
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
92
-
93
50
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
94
51
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
95
52
  }
96
53
  return t;
97
54
  };
98
55
  /* eslint-disable no-nested-ternary */
99
-
100
56
  /* eslint-disable prefer-const */
101
-
102
57
  /* eslint-disable prefer-destructuring */
103
-
104
58
  /* eslint-disable no-shadow */
105
-
106
59
  /* eslint-disable no-param-reassign */
107
-
108
60
  /* eslint-disable max-len */
109
-
110
61
  /* eslint-disable react/no-did-update-set-state */
111
-
112
62
  /* eslint-disable eqeqeq */
113
-
114
63
  /* eslint-disable max-lines-per-function */
115
-
116
-
117
64
  class Table extends _baseComponent.default {
118
- constructor(props, context) {
119
- var _this;
120
-
121
- super(props);
122
- _this = this;
123
-
124
- // TODO: notify when data don't have key
125
- this._warnIfNoKey = () => {
126
- if ((this.props.rowSelection || this.props.expandedRowRender) && (0, _some2.default)(this.props.dataSource, record => this.foundation.getRecordKey(record) == null)) {
127
- _utils2.logger.error('You must specify a key for each element in the dataSource or use "rowKey" to specify an attribute name as the primary key!');
128
- }
129
- };
130
-
131
- this._invokeRowSelection = function (funcName) {
132
- const func = (0, _get2.default)(_this.state, ['rowSelection', funcName]);
133
-
134
- if (typeof func === 'function') {
135
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
136
- args[_key - 1] = arguments[_key];
137
- }
138
-
139
- func(...args);
140
- }
141
- };
142
-
143
- this._invokeColumnFn = function (key, funcName) {
144
- if (key && funcName) {
145
- const column = _this.foundation.getQuery(key);
146
-
147
- const func = (0, _get2.default)(column, funcName, null);
148
-
149
- if (typeof func === 'function') {
150
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
151
- args[_key2 - 2] = arguments[_key2];
152
- }
153
-
154
- func(...args);
155
- }
156
- }
157
- };
158
-
159
- this._cacheHeaderRef = node => {
160
- this.headerWrapRef.current = node;
161
- };
162
-
163
- this.getCurrentPageData = () => {
164
- const pageData = this.foundation.getCurrentPageData();
165
- const retObj = ['dataSource', 'groups'].reduce((result, key) => {
166
- if (pageData[key]) {
167
- result[key] = pageData[key];
65
+ get adapter() {
66
+ var _this = this;
67
+ return Object.assign(Object.assign({}, super.adapter), {
68
+ resetScrollY: () => {
69
+ if (this.bodyWrapRef.current) {
70
+ this.bodyWrapRef.current.scrollTop = 0;
168
71
  }
169
-
170
- return result;
171
- }, {});
172
- return (0, _utils2.cloneDeep)(retObj);
173
- };
174
-
175
- this.getColumns = (columns, children) => !Array.isArray(columns) || !columns || !columns.length ? (0, _getColumns.default)(children) : columns; // @ts-ignore
176
-
177
-
178
- this.getCellWidths = function () {
179
- return _this.foundation.getCellWidths(...arguments);
180
- }; // @ts-ignore
181
-
182
-
183
- this.setHeadWidths = function () {
184
- return _this.foundation.setHeadWidths(...arguments);
185
- }; // @ts-ignore
186
-
187
-
188
- this.getHeadWidths = function () {
189
- return _this.foundation.getHeadWidths(...arguments);
190
- }; // @ts-ignore
191
-
192
-
193
- this.mergedRowExpandable = function () {
194
- return _this.foundation.mergedRowExpandable(...arguments);
195
- }; // @ts-ignore
196
-
197
-
198
- this.setBodyHasScrollbar = function () {
199
- return _this.foundation.setBodyHasScrollbar(...arguments);
200
- };
201
-
202
- this.handleWheel = event => {
203
- const {
204
- scroll = {}
205
- } = this.props;
206
-
207
- if (window.navigator.userAgent.match(/Trident\/7\./) && scroll.y) {
208
- event.preventDefault();
209
- const wd = event.deltaY;
72
+ },
73
+ setSelectedRowKeys: selectedRowKeys => {
74
+ this.setState({
75
+ rowSelection: Object.assign(Object.assign({}, this.state.rowSelection), {
76
+ selectedRowKeys: [...selectedRowKeys],
77
+ selectedRowKeysSet: new Set(selectedRowKeys)
78
+ })
79
+ });
80
+ },
81
+ setDisabledRowKeys: disabledRowKeys => {
82
+ this.setState({
83
+ disabledRowKeys,
84
+ disabledRowKeysSet: new Set(disabledRowKeys)
85
+ });
86
+ },
87
+ setCurrentPage: currentPage => {
210
88
  const {
211
- target
212
- } = event; // const { bodyTable, fixedColumnsBodyLeft, fixedColumnsBodyRight } = this;
213
-
214
- const bodyTable = this.bodyWrapRef.current;
215
- let scrollTop = 0;
216
-
217
- if (this.lastScrollTop) {
218
- scrollTop = this.lastScrollTop + wd;
89
+ pagination
90
+ } = this.state;
91
+ if (typeof pagination === 'object') {
92
+ this.setState({
93
+ pagination: Object.assign(Object.assign({}, pagination), {
94
+ currentPage
95
+ })
96
+ });
219
97
  } else {
220
- scrollTop = wd;
98
+ this.setState({
99
+ pagination: {
100
+ currentPage
101
+ }
102
+ });
221
103
  }
222
-
223
- if (bodyTable && target !== bodyTable) {
224
- bodyTable.scrollTop = scrollTop;
104
+ },
105
+ setPagination: pagination => this.setState({
106
+ pagination
107
+ }),
108
+ setGroups: groups => this.setState({
109
+ groups
110
+ }),
111
+ setDataSource: dataSource => this.setState({
112
+ dataSource
113
+ }),
114
+ setExpandedRowKeys: expandedRowKeys => this.setState({
115
+ expandedRowKeys: [...expandedRowKeys]
116
+ }),
117
+ setQuery: function () {
118
+ let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
119
+ let queries = [..._this.state.queries];
120
+ queries = (0, _utils.mergeQueries)(query, queries);
121
+ _this.setState({
122
+ queries
123
+ });
124
+ },
125
+ // Update queries when filtering or sorting
126
+ setQueries: queries => this.setState({
127
+ queries
128
+ }),
129
+ setFlattenData: flattenData => this.setState({
130
+ flattenData
131
+ }),
132
+ setAllRowKeys: allRowKeys => this.setState({
133
+ allRowKeys
134
+ }),
135
+ setHoveredRowKey: hoveredRowKey => {
136
+ this.store.setState({
137
+ hoveredRowKey
138
+ });
139
+ },
140
+ setCachedFilteredSortedDataSource: filteredSortedDataSource => {
141
+ this.cachedFilteredSortedDataSource = filteredSortedDataSource;
142
+ },
143
+ setCachedFilteredSortedRowKeys: filteredSortedRowKeys => {
144
+ this.cachedFilteredSortedRowKeys = filteredSortedRowKeys;
145
+ this.cachedFilteredSortedRowKeysSet = new Set(filteredSortedRowKeys);
146
+ },
147
+ setAllDisabledRowKeys: allDisabledRowKeys => {
148
+ const allDisabledRowKeysSet = new Set(allDisabledRowKeys);
149
+ this.setState({
150
+ allDisabledRowKeys,
151
+ allDisabledRowKeysSet
152
+ });
153
+ },
154
+ getCurrentPage: () => (0, _get2.default)(this.state, 'pagination.currentPage', 1),
155
+ getCurrentPageSize: () => (0, _get2.default)(this.state, 'pagination.pageSize', _constants.numbers.DEFAULT_PAGE_SIZE),
156
+ getCachedFilteredSortedDataSource: () => this.cachedFilteredSortedDataSource,
157
+ getCachedFilteredSortedRowKeys: () => this.cachedFilteredSortedRowKeys,
158
+ getCachedFilteredSortedRowKeysSet: () => this.cachedFilteredSortedRowKeysSet,
159
+ getAllDisabledRowKeys: () => this.state.allDisabledRowKeys,
160
+ getAllDisabledRowKeysSet: () => this.state.allDisabledRowKeysSet,
161
+ notifyFilterDropdownVisibleChange: (visible, dataIndex) => this._invokeColumnFn(dataIndex, 'onFilterDropdownVisibleChange', visible),
162
+ notifyChange: function () {
163
+ return _this.props.onChange(...arguments);
164
+ },
165
+ notifyExpand: function () {
166
+ return _this.props.onExpand(...arguments);
167
+ },
168
+ notifyExpandedRowsChange: function () {
169
+ return _this.props.onExpandedRowsChange(...arguments);
170
+ },
171
+ notifySelect: function () {
172
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
173
+ args[_key] = arguments[_key];
225
174
  }
226
- }
227
- };
228
-
229
- this.handleBodyScrollLeft = e => {
230
- if (e.currentTarget !== e.target) {
231
- return;
232
- }
233
-
234
- const {
235
- target
236
- } = e; // const { headTable, bodyTable } = this;
237
-
238
- const headTable = this.headerWrapRef.current;
239
- const bodyTable = this.bodyWrapRef.current;
240
-
241
- if (target.scrollLeft !== this.lastScrollLeft) {
242
- if (target === bodyTable && headTable) {
243
- headTable.scrollLeft = target.scrollLeft;
244
- } else if (target === headTable && bodyTable) {
245
- bodyTable.scrollLeft = target.scrollLeft;
175
+ return _this._invokeRowSelection('onSelect', ...args);
176
+ },
177
+ notifySelectAll: function () {
178
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
179
+ args[_key2] = arguments[_key2];
180
+ }
181
+ return _this._invokeRowSelection('onSelectAll', ...args);
182
+ },
183
+ notifySelectInvert: function () {
184
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
185
+ args[_key3] = arguments[_key3];
186
+ }
187
+ return _this._invokeRowSelection('onSelectInvert', ...args);
188
+ },
189
+ notifySelectionChange: function () {
190
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
191
+ args[_key4] = arguments[_key4];
192
+ }
193
+ return _this._invokeRowSelection('onChange', ...args);
194
+ },
195
+ isAnyColumnFixed: columns => (0, _some2.default)(this.getColumns(columns || this.props.columns, this.props.children), column => Boolean(column.fixed)),
196
+ useFixedHeader: () => {
197
+ const {
198
+ scroll,
199
+ sticky
200
+ } = this.props;
201
+ if ((0, _get2.default)(scroll, 'y')) {
202
+ return true;
203
+ }
204
+ if (sticky) {
205
+ return true;
206
+ }
207
+ return false;
208
+ },
209
+ getTableLayout: () => {
210
+ let isFixed = false;
211
+ const {
212
+ flattenColumns
213
+ } = this.state;
214
+ if (Array.isArray(flattenColumns)) {
215
+ isFixed = flattenColumns.some(column => Boolean(column.ellipsis) || Boolean(column.fixed));
216
+ }
217
+ return isFixed ? 'fixed' : 'auto';
218
+ },
219
+ setHeadWidths: function (headWidths) {
220
+ let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
221
+ if (!(0, _utils.equalWith)(_this.state.headWidths[index], headWidths)) {
222
+ // The map call depends on the last state
223
+ _this.setState(state => {
224
+ const newHeadWidths = [...state.headWidths];
225
+ newHeadWidths[index] = [...headWidths];
226
+ return {
227
+ headWidths: newHeadWidths
228
+ };
229
+ });
230
+ }
231
+ },
232
+ getHeadWidths: function () {
233
+ let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
234
+ if (_this.state.headWidths.length && typeof index === 'number') {
235
+ const configs = _this.state.headWidths[index] || [];
236
+ return configs.map(item => item.width);
237
+ }
238
+ return [];
239
+ },
240
+ // This method is called by row rendering function
241
+ getCellWidths: function (flattenedColumns) {
242
+ let flattenedWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
243
+ let ignoreScrollBarKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
244
+ if (Array.isArray(flattenedColumns) && flattenedColumns.length) {
245
+ flattenedWidths = flattenedWidths == null && _this.state.headWidths.length ? (0, _flattenDeep2.default)(_this.state.headWidths) : [];
246
+ if (Array.isArray(flattenedWidths) && flattenedWidths.length) {
247
+ return flattenedColumns.reduce((result, column) => {
248
+ const found = column.key === _constants.strings.DEFAULT_KEY_COLUMN_SCROLLBAR && ignoreScrollBarKey ? null : (0, _find2.default)(flattenedWidths, item => item && item.key != null && item.key === column.key);
249
+ if (found) {
250
+ result.push(found.width);
251
+ }
252
+ return result;
253
+ }, []);
254
+ }
255
+ }
256
+ return [];
257
+ },
258
+ mergedRowExpandable: record => {
259
+ const {
260
+ expandedRowRender,
261
+ childrenRecordName,
262
+ rowExpandable
263
+ } = this.props;
264
+ const children = (0, _get2.default)(record, childrenRecordName);
265
+ const hasExpandedRowRender = typeof expandedRowRender === 'function';
266
+ const hasRowExpandable = typeof rowExpandable === 'function';
267
+ const hasChildren = Array.isArray(children) && children.length;
268
+ const strictExpandableResult = hasRowExpandable && rowExpandable(record);
269
+ const looseExpandableResult = !hasRowExpandable || strictExpandableResult;
270
+ return (hasExpandedRowRender || hasChildren) && looseExpandableResult || !(hasExpandedRowRender || hasChildren) && strictExpandableResult;
271
+ },
272
+ isAnyColumnUseFullRender: columns => (0, _some2.default)(columns, column => Boolean(column.useFullRender)),
273
+ getNormalizeColumns: () => this.normalizeColumns,
274
+ getHandleColumns: () => this.handleColumns,
275
+ getMergePagination: () => this.mergePagination,
276
+ setBodyHasScrollbar: bodyHasScrollBar => {
277
+ if (bodyHasScrollBar !== this.state.bodyHasScrollBar) {
278
+ this.setState({
279
+ bodyHasScrollBar
280
+ });
281
+ }
282
+ },
283
+ stopPropagation(e) {
284
+ // The event definition here is not very accurate for now, it belongs to a broad structure definition
285
+ if (e && typeof e === 'object') {
286
+ if (typeof e.stopPropagation === 'function') {
287
+ e.stopPropagation();
288
+ }
289
+ if (e.nativeEvent && typeof e.nativeEvent.stopPropagation === 'function') {
290
+ e.nativeEvent.stopPropagation();
291
+ } else if (typeof e.stopImmediatePropagation === 'function') {
292
+ e.stopImmediatePropagation();
293
+ }
294
+ }
295
+ }
296
+ });
297
+ }
298
+ constructor(props, context) {
299
+ var _this2;
300
+ // TODO: notify when data don't have key
301
+ super(props);
302
+ _this2 = this;
303
+ this._warnIfNoKey = () => {
304
+ if ((this.props.rowSelection || this.props.expandedRowRender) && (0, _some2.default)(this.props.dataSource, record => this.foundation.getRecordKey(record) == null)) {
305
+ _utils2.logger.error('You must specify a key for each element in the dataSource or use "rowKey" to specify an attribute name as the primary key!');
306
+ }
307
+ };
308
+ this._invokeRowSelection = function (funcName) {
309
+ const func = (0, _get2.default)(_this2.state, ['rowSelection', funcName]);
310
+ if (typeof func === 'function') {
311
+ for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
312
+ args[_key5 - 1] = arguments[_key5];
313
+ }
314
+ func(...args);
315
+ }
316
+ };
317
+ this._invokeColumnFn = function (key, funcName) {
318
+ if (key && funcName) {
319
+ const column = _this2.foundation.getQuery(key);
320
+ const func = (0, _get2.default)(column, funcName, null);
321
+ if (typeof func === 'function') {
322
+ for (var _len6 = arguments.length, args = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
323
+ args[_key6 - 2] = arguments[_key6];
324
+ }
325
+ func(...args);
326
+ }
327
+ }
328
+ };
329
+ this._cacheHeaderRef = node => {
330
+ this.headerWrapRef.current = node;
331
+ };
332
+ this.getCurrentPageData = () => {
333
+ const pageData = this.foundation.getCurrentPageData();
334
+ const retObj = ['dataSource', 'groups'].reduce((result, key) => {
335
+ if (pageData[key]) {
336
+ result[key] = pageData[key];
337
+ }
338
+ return result;
339
+ }, {});
340
+ return (0, _utils2.cloneDeep)(retObj);
341
+ };
342
+ this.getColumns = (columns, children) => !Array.isArray(columns) || !columns || !columns.length ? (0, _getColumns.default)(children) : columns;
343
+ // @ts-ignore
344
+ this.getCellWidths = function () {
345
+ return _this2.foundation.getCellWidths(...arguments);
346
+ };
347
+ // @ts-ignore
348
+ this.setHeadWidths = function () {
349
+ return _this2.foundation.setHeadWidths(...arguments);
350
+ };
351
+ // @ts-ignore
352
+ this.getHeadWidths = function () {
353
+ return _this2.foundation.getHeadWidths(...arguments);
354
+ };
355
+ // @ts-ignore
356
+ this.mergedRowExpandable = function () {
357
+ return _this2.foundation.mergedRowExpandable(...arguments);
358
+ };
359
+ // @ts-ignore
360
+ this.setBodyHasScrollbar = function () {
361
+ return _this2.foundation.setBodyHasScrollbar(...arguments);
362
+ };
363
+ this.handleWheel = event => {
364
+ const {
365
+ scroll = {}
366
+ } = this.props;
367
+ if (window.navigator.userAgent.match(/Trident\/7\./) && scroll.y) {
368
+ event.preventDefault();
369
+ const wd = event.deltaY;
370
+ const {
371
+ target
372
+ } = event;
373
+ // const { bodyTable, fixedColumnsBodyLeft, fixedColumnsBodyRight } = this;
374
+ const bodyTable = this.bodyWrapRef.current;
375
+ let scrollTop = 0;
376
+ if (this.lastScrollTop) {
377
+ scrollTop = this.lastScrollTop + wd;
378
+ } else {
379
+ scrollTop = wd;
380
+ }
381
+ if (bodyTable && target !== bodyTable) {
382
+ bodyTable.scrollTop = scrollTop;
383
+ }
384
+ }
385
+ };
386
+ this.handleBodyScrollLeft = e => {
387
+ if (e.currentTarget !== e.target) {
388
+ return;
389
+ }
390
+ const {
391
+ target
392
+ } = e;
393
+ // const { headTable, bodyTable } = this;
394
+ const headTable = this.headerWrapRef.current;
395
+ const bodyTable = this.bodyWrapRef.current;
396
+ if (target.scrollLeft !== this.lastScrollLeft) {
397
+ if (target === bodyTable && headTable) {
398
+ headTable.scrollLeft = target.scrollLeft;
399
+ } else if (target === headTable && bodyTable) {
400
+ bodyTable.scrollLeft = target.scrollLeft;
246
401
  }
247
-
248
402
  this.setScrollPositionClassName();
249
- } // Remember last scrollLeft for scroll direction detecting.
250
-
251
-
403
+ }
404
+ // Remember last scrollLeft for scroll direction detecting.
252
405
  this.lastScrollLeft = target.scrollLeft;
253
406
  };
254
-
255
407
  this.handleWindowResize = () => {
256
408
  this.syncTableWidth();
257
409
  this.setScrollPositionClassName();
258
410
  };
259
-
260
411
  this.handleBodyScrollTop = e => {
261
412
  const {
262
413
  target
263
414
  } = e;
264
-
265
415
  if (e.currentTarget !== target) {
266
416
  return;
267
417
  }
268
-
269
418
  const {
270
419
  scroll = {}
271
- } = this.props; // const { headTable, bodyTable, fixedColumnsBodyLeft, fixedColumnsBodyRight } = this;
272
-
420
+ } = this.props;
421
+ // const { headTable, bodyTable, fixedColumnsBodyLeft, fixedColumnsBodyRight } = this;
273
422
  const headTable = this.headerWrapRef.current;
274
423
  const bodyTable = this.bodyWrapRef.current;
275
-
276
424
  if (target.scrollTop !== this.lastScrollTop && scroll.y && target !== headTable) {
277
425
  const {
278
426
  scrollTop
279
427
  } = target;
280
-
281
428
  if (bodyTable && target !== bodyTable) {
282
429
  bodyTable.scrollTop = scrollTop;
283
430
  }
284
- } // Remember last scrollTop for scroll direction detecting.
285
-
286
-
431
+ }
432
+ // Remember last scrollTop for scroll direction detecting.
287
433
  this.lastScrollTop = target.scrollTop;
288
434
  };
289
-
290
435
  this.handleBodyScroll = e => {
291
436
  this.handleBodyScrollLeft(e);
292
437
  this.handleBodyScrollTop(e);
293
438
  };
294
-
295
439
  this.setScrollPosition = position => {
296
440
  const {
297
441
  prefixCls
@@ -299,7 +443,6 @@ class Table extends _baseComponent.default {
299
443
  const positionAll = [`${prefixCls}-scroll-position-both`, `${prefixCls}-scroll-position-middle`, `${prefixCls}-scroll-position-left`, `${prefixCls}-scroll-position-right`];
300
444
  this.scrollPosition = position;
301
445
  const tableNode = this.wrapRef.current;
302
-
303
446
  if (tableNode && tableNode.nodeType) {
304
447
  if (position === 'both') {
305
448
  const acceptPosition = [`${prefixCls}-scroll-position-left`, `${prefixCls}-scroll-position-right`];
@@ -312,15 +455,12 @@ class Table extends _baseComponent.default {
312
455
  }
313
456
  }
314
457
  };
315
-
316
458
  this.setScrollPositionClassName = () => {
317
459
  const node = this.bodyWrapRef.current;
318
-
319
460
  if (node && node.children && node.children.length) {
320
- const scrollToLeft = node.scrollLeft === 0; // why use Math.abs? @see https://bugzilla.mozilla.org/show_bug.cgi?id=1447743
321
-
461
+ const scrollToLeft = node.scrollLeft === 0;
462
+ // why use Math.abs? @see https://bugzilla.mozilla.org/show_bug.cgi?id=1447743
322
463
  const scrollToRight = Math.abs(node.scrollLeft) + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
323
-
324
464
  if (scrollToLeft && scrollToRight) {
325
465
  this.setScrollPosition('both');
326
466
  } else if (scrollToLeft) {
@@ -332,7 +472,6 @@ class Table extends _baseComponent.default {
332
472
  }
333
473
  }
334
474
  };
335
-
336
475
  this.syncTableWidth = () => {
337
476
  if (this.rootWrapRef && this.rootWrapRef.current) {
338
477
  this.setState({
@@ -340,15 +479,13 @@ class Table extends _baseComponent.default {
340
479
  });
341
480
  }
342
481
  };
343
-
344
482
  this.renderSelection = function () {
345
483
  let record = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
346
484
  let inHeader = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
347
485
  const {
348
486
  rowSelection,
349
487
  allDisabledRowKeysSet
350
- } = _this.state;
351
-
488
+ } = _this2.state;
352
489
  if (rowSelection && typeof rowSelection === 'object') {
353
490
  const {
354
491
  selectedRowKeys = [],
@@ -356,16 +493,12 @@ class Table extends _baseComponent.default {
356
493
  getCheckboxProps,
357
494
  disabled
358
495
  } = rowSelection;
359
-
360
496
  if (inHeader) {
361
497
  const columnKey = (0, _get2.default)(rowSelection, 'key', _constants.strings.DEFAULT_KEY_COLUMN_SELECTION);
362
- const allRowKeys = _this.cachedFilteredSortedRowKeys;
363
- const allRowKeysSet = _this.cachedFilteredSortedRowKeysSet;
364
-
365
- const allIsSelected = _this.foundation.allIsSelected(selectedRowKeysSet, allDisabledRowKeysSet, allRowKeys);
366
-
367
- const hasRowSelected = _this.foundation.hasRowSelected(selectedRowKeys, allRowKeysSet);
368
-
498
+ const allRowKeys = _this2.cachedFilteredSortedRowKeys;
499
+ const allRowKeysSet = _this2.cachedFilteredSortedRowKeysSet;
500
+ const allIsSelected = _this2.foundation.allIsSelected(selectedRowKeysSet, allDisabledRowKeysSet, allRowKeys);
501
+ const hasRowSelected = _this2.foundation.hasRowSelected(selectedRowKeys, allRowKeysSet);
369
502
  return /*#__PURE__*/_react.default.createElement(_ColumnSelection.default, {
370
503
  "aria-label": `${allIsSelected ? 'Deselect' : 'Select'} all rows`,
371
504
  disabled: disabled,
@@ -373,35 +506,28 @@ class Table extends _baseComponent.default {
373
506
  selected: allIsSelected,
374
507
  indeterminate: hasRowSelected && !allIsSelected,
375
508
  onChange: (selected, e) => {
376
- _this.toggleSelectAllRow(selected, e);
509
+ _this2.toggleSelectAllRow(selected, e);
377
510
  }
378
511
  });
379
512
  } else {
380
- const key = _this.foundation.getRecordKey(record);
381
-
513
+ const key = _this2.foundation.getRecordKey(record);
382
514
  const selected = selectedRowKeysSet.has(key);
383
-
384
515
  const checkboxPropsFn = () => typeof getCheckboxProps === 'function' ? getCheckboxProps(record) : {};
385
-
386
516
  return /*#__PURE__*/_react.default.createElement(_ColumnSelection.default, {
387
517
  "aria-label": `${selected ? 'Deselect' : 'Select'} this row`,
388
518
  getCheckboxProps: checkboxPropsFn,
389
519
  selected: selected,
390
- onChange: (status, e) => _this.toggleSelectRow(status, key, e)
520
+ onChange: (status, e) => _this2.toggleSelectRow(status, key, e)
391
521
  });
392
522
  }
393
523
  }
394
-
395
524
  return null;
396
525
  };
397
-
398
526
  this.renderRowSelectionCallback = function (text) {
399
527
  let record = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
400
- return _this.renderSelection(record);
528
+ return _this2.renderSelection(record);
401
529
  };
402
-
403
530
  this.renderTitleSelectionCallback = () => this.renderSelection(null, true);
404
-
405
531
  this.normalizeSelectionColumn = function () {
406
532
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
407
533
  const {
@@ -409,26 +535,21 @@ class Table extends _baseComponent.default {
409
535
  prefixCls
410
536
  } = props;
411
537
  let column = {};
412
-
413
538
  if (rowSelection) {
414
539
  const needOmitSelectionKey = ['selectedRowKeys', 'selectedRowKeysSet'];
415
540
  column = {
416
541
  key: _constants.strings.DEFAULT_KEY_COLUMN_SELECTION
417
542
  };
418
-
419
543
  if ((0, _isObject2.default)(rowSelection)) {
420
544
  column = Object.assign(Object.assign({}, column), (0, _omit2.default)(rowSelection, needOmitSelectionKey));
421
545
  }
422
-
423
546
  column.className = (0, _classnames.default)(column.className, `${prefixCls}-column-selection`);
424
- column.title = _this.renderTitleSelectionCallback;
425
- column.render = _this.renderRowSelectionCallback;
547
+ column.title = _this2.renderTitleSelectionCallback;
548
+ column.render = _this2.renderRowSelectionCallback;
426
549
  }
427
-
428
550
  return column;
429
- }; // If there is a scroll bar, manually construct a column and insert it into the header
430
-
431
-
551
+ };
552
+ // If there is a scroll bar, manually construct a column and insert it into the header
432
553
  this.normalizeScrollbarColumn = function () {
433
554
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
434
555
  const {
@@ -447,33 +568,29 @@ class Table extends _baseComponent.default {
447
568
  * @param {String} groupKey
448
569
  * @returns {ReactNode}
449
570
  */
450
-
451
-
452
571
  this.renderExpandIcon = function () {
453
572
  let record = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
454
573
  let isNested = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
455
574
  let groupKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
456
575
  const {
457
576
  expandedRowKeys
458
- } = _this.state;
577
+ } = _this2.state;
459
578
  const {
460
579
  expandIcon
461
- } = _this.props;
462
- const key = typeof groupKey === 'string' || typeof groupKey === 'number' ? groupKey : _this.foundation.getRecordKey(record);
580
+ } = _this2.props;
581
+ const key = typeof groupKey === 'string' || typeof groupKey === 'number' ? groupKey : _this2.foundation.getRecordKey(record);
463
582
  return /*#__PURE__*/_react.default.createElement(_CustomExpandIcon.default, {
464
583
  key: key,
465
584
  componentType: isNested ? 'tree' : 'expand',
466
585
  expanded: (0, _includes2.default)(expandedRowKeys, key),
467
586
  expandIcon: expandIcon,
468
- onClick: (expanded, e) => _this.handleRowExpanded(expanded, key, e)
587
+ onClick: (expanded, e) => _this2.handleRowExpanded(expanded, key, e)
469
588
  });
470
- }; // @ts-ignore
471
-
472
-
589
+ };
590
+ // @ts-ignore
473
591
  this.handleRowExpanded = function () {
474
- return _this.foundation.handleRowExpanded(...arguments);
592
+ return _this2.foundation.handleRowExpanded(...arguments);
475
593
  };
476
-
477
594
  this.normalizeExpandColumn = function () {
478
595
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
479
596
  let column = null;
@@ -491,7 +608,7 @@ class Table extends _baseComponent.default {
491
608
  let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
492
609
  let record = arguments.length > 1 ? arguments[1] : undefined;
493
610
  let index = arguments.length > 2 ? arguments[2] : undefined;
494
- return _this.adapter.mergedRowExpandable(record) ? _this.renderExpandIcon(record) : null;
611
+ return _this2.adapter.mergedRowExpandable(record) ? _this2.renderExpandIcon(record) : null;
495
612
  } : () => null;
496
613
  return column;
497
614
  };
@@ -500,14 +617,11 @@ class Table extends _baseComponent.default {
500
617
  * Title support function, passing parameters as {filter: node, sorter: node, selection: node}
501
618
  * @param {*} column
502
619
  */
503
-
504
-
505
620
  this.addFnsInColumn = function () {
506
621
  let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
507
622
  const {
508
623
  prefixCls
509
- } = _this.props;
510
-
624
+ } = _this2.props;
511
625
  if (column && (column.sorter || column.filters || column.useFullRender)) {
512
626
  let hasSorterOrFilter = false;
513
627
  const {
@@ -515,62 +629,52 @@ class Table extends _baseComponent.default {
515
629
  title: rawTitle,
516
630
  useFullRender
517
631
  } = column;
518
-
519
- const curQuery = _this.foundation.getQuery(dataIndex);
520
-
632
+ const curQuery = _this2.foundation.getQuery(dataIndex);
521
633
  const titleMap = {};
522
- const titleArr = []; // useFullRender adds select buttons to each column
523
-
634
+ const titleArr = [];
635
+ // useFullRender adds select buttons to each column
524
636
  if (useFullRender) {
525
- titleMap.selection = _this.renderSelection(null, true);
637
+ titleMap.selection = _this2.renderSelection(null, true);
526
638
  }
527
-
528
639
  const stateSortOrder = (0, _get2.default)(curQuery, 'sortOrder');
529
640
  const defaultSortOrder = (0, _get2.default)(curQuery, 'defaultSortOrder', false);
530
- const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
641
+ const sortOrder = _this2.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
531
642
  const showEllipsisTitle = (0, _utils.shouldShowEllipsisTitle)(column.ellipsis);
532
-
533
643
  const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement("span", {
534
644
  className: `${prefixCls}-row-head-title`,
535
645
  key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE,
536
646
  title: showEllipsisTitle && typeof rawTitle === 'string' ? rawTitle : undefined
537
647
  }, rawTitle);
538
-
539
648
  if (typeof column.sorter === 'function' || column.sorter === true) {
540
649
  // In order to increase the click hot area of ​​sorting, when sorting is required & useFullRender is false,
541
650
  // both the title and sorting areas are used as the click hot area for sorting。
542
651
  const sorter = /*#__PURE__*/_react.default.createElement(_ColumnSorter.default, {
543
652
  key: _constants.strings.DEFAULT_KEY_COLUMN_SORTER,
544
653
  sortOrder: sortOrder,
545
- onClick: e => _this.foundation.handleSort(column, e),
654
+ onClick: e => _this2.foundation.handleSort(column, e),
546
655
  title: TitleNode
547
656
  });
548
-
549
657
  useFullRender && (titleMap.sorter = sorter);
550
658
  hasSorterOrFilter = true;
551
659
  titleArr.push(sorter);
552
660
  } else {
553
661
  titleArr.push(TitleNode);
554
662
  }
555
-
556
663
  const stateFilteredValue = (0, _get2.default)(curQuery, 'filteredValue');
557
664
  const defaultFilteredValue = (0, _get2.default)(curQuery, 'defaultFilteredValue');
558
665
  const filteredValue = stateFilteredValue ? stateFilteredValue : defaultFilteredValue;
559
-
560
666
  if (Array.isArray(column.filters) && column.filters.length || /*#__PURE__*/(0, _react.isValidElement)(column.filterDropdown)) {
561
667
  const filter = /*#__PURE__*/_react.default.createElement(_ColumnFilter.default, Object.assign({
562
668
  key: _constants.strings.DEFAULT_KEY_COLUMN_FILTER
563
669
  }, curQuery, {
564
670
  filteredValue: filteredValue,
565
- onFilterDropdownVisibleChange: visible => _this.foundation.toggleShowFilter(dataIndex, visible),
566
- onSelect: data => _this.foundation.handleFilterSelect(dataIndex, data)
671
+ onFilterDropdownVisibleChange: visible => _this2.foundation.toggleShowFilter(dataIndex, visible),
672
+ onSelect: data => _this2.foundation.handleFilterSelect(dataIndex, data)
567
673
  }));
568
-
569
674
  useFullRender && (titleMap.filter = filter);
570
675
  hasSorterOrFilter = true;
571
676
  titleArr.push(filter);
572
677
  }
573
-
574
678
  const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : hasSorterOrFilter ? /*#__PURE__*/_react.default.createElement("div", {
575
679
  className: `${prefixCls}-operate-wrapper`
576
680
  }, titleArr) : titleArr;
@@ -578,14 +682,11 @@ class Table extends _baseComponent.default {
578
682
  title: newTitle
579
683
  });
580
684
  }
581
-
582
685
  return column;
583
686
  };
584
-
585
687
  this.toggleSelectRow = (selected, realKey, e) => {
586
688
  this.foundation.handleSelectRow(realKey, selected, e);
587
689
  };
588
-
589
690
  this.toggleSelectAllRow = (selected, e) => {
590
691
  this.foundation.handleSelectAllRow(selected, e);
591
692
  };
@@ -594,14 +695,11 @@ class Table extends _baseComponent.default {
594
695
  * @param {object} pagination
595
696
  * @param {object} propRenderPagination
596
697
  */
597
-
598
-
599
698
  this.renderPagination = (pagination, propRenderPagination) => {
600
699
  if (!pagination) {
601
700
  return null;
602
- } // use memoized pagination
603
-
604
-
701
+ }
702
+ // use memoized pagination
605
703
  const mergedPagination = this.foundation.memoizedPagination(pagination);
606
704
  return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
607
705
  componentName: "Table"
@@ -614,7 +712,6 @@ class Table extends _baseComponent.default {
614
712
  });
615
713
  });
616
714
  };
617
-
618
715
  this.renderTitle = function () {
619
716
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
620
717
  let {
@@ -624,17 +721,14 @@ class Table extends _baseComponent.default {
624
721
  prefixCls,
625
722
  dataSource
626
723
  } = props;
627
-
628
724
  if (typeof title === 'function') {
629
725
  title = title(dataSource);
630
726
  }
631
-
632
727
  return /*#__PURE__*/(0, _react.isValidElement)(title) || typeof title === 'string' ? /*#__PURE__*/_react.default.createElement("div", {
633
728
  className: `${prefixCls}-title`,
634
729
  "x-semi-prop": "title"
635
730
  }, title) : null;
636
731
  };
637
-
638
732
  this.renderEmpty = function () {
639
733
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
640
734
  const {
@@ -643,13 +737,10 @@ class Table extends _baseComponent.default {
643
737
  dataSource
644
738
  } = props;
645
739
  const wrapCls = `${prefixCls}-placeholder`;
646
-
647
- const isEmpty = _this.foundation.isEmpty(dataSource);
648
-
740
+ const isEmpty = _this2.foundation.isEmpty(dataSource);
649
741
  if (!isEmpty) {
650
742
  return null;
651
743
  }
652
-
653
744
  return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
654
745
  componentName: "Table",
655
746
  key: 'emptyText'
@@ -660,7 +751,6 @@ class Table extends _baseComponent.default {
660
751
  "x-semi-prop": "empty"
661
752
  }, empty || locale.emptyText)));
662
753
  };
663
-
664
754
  this.renderFooter = function () {
665
755
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
666
756
  let {
@@ -670,18 +760,15 @@ class Table extends _baseComponent.default {
670
760
  prefixCls,
671
761
  dataSource
672
762
  } = props;
673
-
674
763
  if (typeof footer === 'function') {
675
764
  footer = footer(dataSource);
676
765
  }
677
-
678
766
  return /*#__PURE__*/(0, _react.isValidElement)(footer) || typeof footer === 'string' ? /*#__PURE__*/_react.default.createElement("div", {
679
767
  className: `${prefixCls}-footer`,
680
768
  key: "footer",
681
769
  "x-semi-prop": "footer"
682
770
  }, footer) : null;
683
771
  };
684
-
685
772
  this.renderMainTable = props => {
686
773
  const useFixedHeader = this.adapter.useFixedHeader();
687
774
  const emptySlot = this.renderEmpty(props);
@@ -695,7 +782,6 @@ class Table extends _baseComponent.default {
695
782
  })), this.renderFooter(props)];
696
783
  return table;
697
784
  };
698
-
699
785
  this.renderTable = props => {
700
786
  const {
701
787
  columns,
@@ -736,7 +822,6 @@ class Table extends _baseComponent.default {
736
822
  bodyHasScrollBar: bodyHasScrollBar,
737
823
  sticky: sticky
738
824
  }) : null;
739
-
740
825
  const bodyTable = /*#__PURE__*/_react.default.createElement(_Body.default, Object.assign({}, (0, _omit2.default)(props, ['rowSelection', 'headWidths']), {
741
826
  key: "body",
742
827
  ref: bodyRef,
@@ -755,7 +840,6 @@ class Table extends _baseComponent.default {
755
840
  selectedRowKeysSet: selectedRowKeysSet,
756
841
  disabledRowKeysSet: disabledRowKeysSet
757
842
  }));
758
-
759
843
  return [headTable, bodyTable];
760
844
  };
761
845
  /**
@@ -775,419 +859,140 @@ class Table extends _baseComponent.default {
775
859
  * @param {Array} cachedColumns
776
860
  * @returns columns after adding extended functions
777
861
  */
778
-
779
-
780
862
  this.handleColumns = (queries, cachedColumns) => {
781
863
  const {
782
- hideExpandedColumn,
783
- scroll,
784
- prefixCls,
785
- expandCellFixed,
786
- expandIcon,
787
- rowSelection
788
- } = this.props;
789
- const childrenColumnName = 'children';
790
- let columns = (0, _utils2.cloneDeep)(cachedColumns); // eslint-disable-next-line @typescript-eslint/no-shadow
791
-
792
- const addFns = function () {
793
- let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
794
-
795
- if (Array.isArray(columns) && columns.length) {
796
- (0, _each2.default)(columns, (column, index, originColumns) => {
797
- const newColumn = _this.addFnsInColumn(column);
798
-
799
- const children = column[childrenColumnName];
800
-
801
- if (Array.isArray(children) && children.length) {
802
- const newChildren = [...children];
803
- addFns(newChildren);
804
- newColumn[childrenColumnName] = newChildren;
805
- }
806
-
807
- originColumns[index] = newColumn;
808
- });
809
- }
810
- };
811
-
812
- addFns(columns); // hideExpandedColumn=false render expand column separately
813
-
814
- if (!hideExpandedColumn) {
815
- const column = this.normalizeExpandColumn({
816
- prefixCls,
817
- expandCellFixed,
818
- expandIcon
819
- });
820
- const destIndex = (0, _findIndex2.default)(columns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_EXPAND);
821
-
822
- if (column) {
823
- if (destIndex > -1) {
824
- columns[destIndex] = Object.assign(Object.assign({}, column), columns[destIndex]);
825
- } else if (column.fixed === 'right') {
826
- columns = [...columns, column];
827
- } else {
828
- columns = [column, ...columns];
829
- }
830
- }
831
- } // selection column
832
-
833
-
834
- if (rowSelection && !(0, _get2.default)(rowSelection, 'hidden')) {
835
- const destIndex = (0, _findIndex2.default)(columns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_SELECTION);
836
- const column = this.normalizeSelectionColumn({
837
- rowSelection,
838
- prefixCls
839
- });
840
-
841
- if (destIndex > -1) {
842
- columns[destIndex] = Object.assign(Object.assign({}, column), columns[destIndex]);
843
- } else if (column.fixed === 'right') {
844
- columns = [...columns, column];
845
- } else {
846
- columns = [column, ...columns];
847
- }
848
- }
849
-
850
- (0, _utils.assignColumnKeys)(columns);
851
- return columns;
852
- };
853
- /**
854
- * Convert children to columns object
855
- * @param {Array} columns
856
- * @param {ReactNode} children
857
- * @returns {Array}
858
- */
859
-
860
-
861
- this.normalizeColumns = (columns, children) => {
862
- const normalColumns = (0, _utils2.cloneDeep)(this.getColumns(columns, children));
863
- return normalColumns;
864
- };
865
- /**
866
- * Combine pagination and table paging processing functions
867
- */
868
-
869
-
870
- this.mergePagination = pagination => {
871
- const newPagination = Object.assign({
872
- onChange: this.foundation.setPage
873
- }, pagination);
874
- return newPagination;
875
- };
876
-
877
- this.foundation = new _foundation.default(this.adapter); // columns cannot be deepClone, otherwise the comparison will be false
878
-
879
- const columns = this.getColumns(props.columns, props.children);
880
- const cachedflattenColumns = (0, _utils.flattenColumns)(columns);
881
-
882
- const queries = _foundation.default.initColumnsFilteredValueAndSorterOrder((0, _utils2.cloneDeep)(cachedflattenColumns));
883
-
884
- const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(this.props.dataSource, queries);
885
- const newPagination = (0, _isPlainObject2.default)(this.props.pagination) ? this.props.pagination : {};
886
- const pageData = this.foundation.getCurrentPageData(filteredSortedDataSource, newPagination, queries);
887
- this.state = {
888
- /**
889
- * Cached props
890
- */
891
- cachedColumns: columns,
892
- cachedChildren: props.children,
893
- flattenColumns: cachedflattenColumns,
894
- components: (0, _utils2.mergeComponents)(props.components, props.virtualized),
895
-
896
- /**
897
- * State calculated based on prop
898
- */
899
- queries,
900
- dataSource: pageData.dataSource,
901
- flattenData: [],
902
- expandedRowKeys: [...(props.expandedRowKeys || []), ...(props.defaultExpandedRowKeys || [])],
903
- rowSelection: props.rowSelection ? (0, _isObject2.default)(props.rowSelection) ? Object.assign({}, props.rowSelection) : {} : null,
904
- pagination: pageData.pagination,
905
-
906
- /**
907
- * Internal state
908
- */
909
- groups: null,
910
- allRowKeys: [],
911
- disabledRowKeys: [],
912
- disabledRowKeysSet: new Set(),
913
- allDisabledRowKeys: [],
914
- allDisabledRowKeysSet: new Set(),
915
- headWidths: [],
916
- bodyHasScrollBar: false,
917
- prePropRowSelection: undefined,
918
- prePagination: undefined
919
- };
920
- this.rootWrapRef = /*#__PURE__*/(0, _react.createRef)();
921
- this.wrapRef = /*#__PURE__*/(0, _react.createRef)(); // table's outside wrap
922
-
923
- this.bodyWrapRef = /*#__PURE__*/(0, _react.createRef)();
924
- this.headerWrapRef = /*#__PURE__*/(0, _react.createRef)();
925
- this.store = new _Store.default({
926
- hoveredRowKey: null
927
- });
928
- this.debouncedWindowResize = (0, _debounce2.default)(this.handleWindowResize, 150);
929
- this.cachedFilteredSortedDataSource = [];
930
- this.cachedFilteredSortedRowKeys = [];
931
- this.cachedFilteredSortedRowKeysSet = new Set();
932
- }
933
-
934
- get adapter() {
935
- var _this2 = this;
936
-
937
- return Object.assign(Object.assign({}, super.adapter), {
938
- resetScrollY: () => {
939
- if (this.bodyWrapRef.current) {
940
- this.bodyWrapRef.current.scrollTop = 0;
941
- }
942
- },
943
- setSelectedRowKeys: selectedRowKeys => {
944
- this.setState({
945
- rowSelection: Object.assign(Object.assign({}, this.state.rowSelection), {
946
- selectedRowKeys: [...selectedRowKeys],
947
- selectedRowKeysSet: new Set(selectedRowKeys)
948
- })
949
- });
950
- },
951
- setDisabledRowKeys: disabledRowKeys => {
952
- this.setState({
953
- disabledRowKeys,
954
- disabledRowKeysSet: new Set(disabledRowKeys)
955
- });
956
- },
957
- setCurrentPage: currentPage => {
958
- const {
959
- pagination
960
- } = this.state;
961
-
962
- if (typeof pagination === 'object') {
963
- this.setState({
964
- pagination: Object.assign(Object.assign({}, pagination), {
965
- currentPage
966
- })
967
- });
968
- } else {
969
- this.setState({
970
- pagination: {
971
- currentPage
972
- }
973
- });
974
- }
975
- },
976
- setPagination: pagination => this.setState({
977
- pagination
978
- }),
979
- setGroups: groups => this.setState({
980
- groups
981
- }),
982
- setDataSource: dataSource => this.setState({
983
- dataSource
984
- }),
985
- setExpandedRowKeys: expandedRowKeys => this.setState({
986
- expandedRowKeys: [...expandedRowKeys]
987
- }),
988
- setQuery: function () {
989
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
990
- let queries = [..._this2.state.queries];
991
- queries = (0, _utils.mergeQueries)(query, queries);
992
-
993
- _this2.setState({
994
- queries
995
- });
996
- },
997
- // Update queries when filtering or sorting
998
- setQueries: queries => this.setState({
999
- queries
1000
- }),
1001
- setFlattenData: flattenData => this.setState({
1002
- flattenData
1003
- }),
1004
- setAllRowKeys: allRowKeys => this.setState({
1005
- allRowKeys
1006
- }),
1007
- setHoveredRowKey: hoveredRowKey => {
1008
- this.store.setState({
1009
- hoveredRowKey
1010
- });
1011
- },
1012
- setCachedFilteredSortedDataSource: filteredSortedDataSource => {
1013
- this.cachedFilteredSortedDataSource = filteredSortedDataSource;
1014
- },
1015
- setCachedFilteredSortedRowKeys: filteredSortedRowKeys => {
1016
- this.cachedFilteredSortedRowKeys = filteredSortedRowKeys;
1017
- this.cachedFilteredSortedRowKeysSet = new Set(filteredSortedRowKeys);
1018
- },
1019
- setAllDisabledRowKeys: allDisabledRowKeys => {
1020
- const allDisabledRowKeysSet = new Set(allDisabledRowKeys);
1021
- this.setState({
1022
- allDisabledRowKeys,
1023
- allDisabledRowKeysSet
1024
- });
1025
- },
1026
- getCurrentPage: () => (0, _get2.default)(this.state, 'pagination.currentPage', 1),
1027
- getCurrentPageSize: () => (0, _get2.default)(this.state, 'pagination.pageSize', _constants.numbers.DEFAULT_PAGE_SIZE),
1028
- getCachedFilteredSortedDataSource: () => this.cachedFilteredSortedDataSource,
1029
- getCachedFilteredSortedRowKeys: () => this.cachedFilteredSortedRowKeys,
1030
- getCachedFilteredSortedRowKeysSet: () => this.cachedFilteredSortedRowKeysSet,
1031
- getAllDisabledRowKeys: () => this.state.allDisabledRowKeys,
1032
- getAllDisabledRowKeysSet: () => this.state.allDisabledRowKeysSet,
1033
- notifyFilterDropdownVisibleChange: (visible, dataIndex) => this._invokeColumnFn(dataIndex, 'onFilterDropdownVisibleChange', visible),
1034
- notifyChange: function () {
1035
- return _this2.props.onChange(...arguments);
1036
- },
1037
- notifyExpand: function () {
1038
- return _this2.props.onExpand(...arguments);
1039
- },
1040
- notifyExpandedRowsChange: function () {
1041
- return _this2.props.onExpandedRowsChange(...arguments);
1042
- },
1043
- notifySelect: function () {
1044
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1045
- args[_key3] = arguments[_key3];
1046
- }
1047
-
1048
- return _this2._invokeRowSelection('onSelect', ...args);
1049
- },
1050
- notifySelectAll: function () {
1051
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1052
- args[_key4] = arguments[_key4];
1053
- }
1054
-
1055
- return _this2._invokeRowSelection('onSelectAll', ...args);
1056
- },
1057
- notifySelectInvert: function () {
1058
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1059
- args[_key5] = arguments[_key5];
1060
- }
1061
-
1062
- return _this2._invokeRowSelection('onSelectInvert', ...args);
1063
- },
1064
- notifySelectionChange: function () {
1065
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1066
- args[_key6] = arguments[_key6];
1067
- }
1068
-
1069
- return _this2._invokeRowSelection('onChange', ...args);
1070
- },
1071
- isAnyColumnFixed: columns => (0, _some2.default)(this.getColumns(columns || this.props.columns, this.props.children), column => Boolean(column.fixed)),
1072
- useFixedHeader: () => {
1073
- const {
1074
- scroll,
1075
- sticky
1076
- } = this.props;
1077
-
1078
- if ((0, _get2.default)(scroll, 'y')) {
1079
- return true;
1080
- }
1081
-
1082
- if (sticky) {
1083
- return true;
1084
- }
1085
-
1086
- return false;
1087
- },
1088
- getTableLayout: () => {
1089
- let isFixed = false;
1090
- const {
1091
- flattenColumns
1092
- } = this.state;
1093
-
1094
- if (Array.isArray(flattenColumns)) {
1095
- isFixed = flattenColumns.some(column => Boolean(column.ellipsis) || Boolean(column.fixed));
1096
- }
1097
-
1098
- return isFixed ? 'fixed' : 'auto';
1099
- },
1100
- setHeadWidths: function (headWidths) {
1101
- let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1102
-
1103
- if (!(0, _utils.equalWith)(_this2.state.headWidths[index], headWidths)) {
1104
- // The map call depends on the last state
1105
- _this2.setState(state => {
1106
- const newHeadWidths = [...state.headWidths];
1107
- newHeadWidths[index] = [...headWidths];
1108
- return {
1109
- headWidths: newHeadWidths
1110
- };
864
+ hideExpandedColumn,
865
+ scroll,
866
+ prefixCls,
867
+ expandCellFixed,
868
+ expandIcon,
869
+ rowSelection
870
+ } = this.props;
871
+ const childrenColumnName = 'children';
872
+ let columns = (0, _utils2.cloneDeep)(cachedColumns);
873
+ // eslint-disable-next-line @typescript-eslint/no-shadow
874
+ const addFns = function () {
875
+ let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
876
+ if (Array.isArray(columns) && columns.length) {
877
+ (0, _each2.default)(columns, (column, index, originColumns) => {
878
+ const newColumn = _this2.addFnsInColumn(column);
879
+ const children = column[childrenColumnName];
880
+ if (Array.isArray(children) && children.length) {
881
+ const newChildren = [...children];
882
+ addFns(newChildren);
883
+ newColumn[childrenColumnName] = newChildren;
884
+ }
885
+ originColumns[index] = newColumn;
1111
886
  });
1112
887
  }
1113
- },
1114
- getHeadWidths: function () {
1115
- let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1116
-
1117
- if (_this2.state.headWidths.length && typeof index === 'number') {
1118
- const configs = _this2.state.headWidths[index] || [];
1119
- return configs.map(item => item.width);
1120
- }
1121
-
1122
- return [];
1123
- },
1124
- // This method is called by row rendering function
1125
- getCellWidths: function (flattenedColumns) {
1126
- let flattenedWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1127
- let ignoreScrollBarKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1128
-
1129
- if (Array.isArray(flattenedColumns) && flattenedColumns.length) {
1130
- flattenedWidths = flattenedWidths == null && _this2.state.headWidths.length ? (0, _flattenDeep2.default)(_this2.state.headWidths) : [];
1131
-
1132
- if (Array.isArray(flattenedWidths) && flattenedWidths.length) {
1133
- return flattenedColumns.reduce((result, column) => {
1134
- const found = column.key === _constants.strings.DEFAULT_KEY_COLUMN_SCROLLBAR && ignoreScrollBarKey ? null : (0, _find2.default)(flattenedWidths, item => item && item.key != null && item.key === column.key);
1135
-
1136
- if (found) {
1137
- result.push(found.width);
1138
- }
1139
-
1140
- return result;
1141
- }, []);
888
+ };
889
+ addFns(columns);
890
+ // hideExpandedColumn=false render expand column separately
891
+ if (!hideExpandedColumn) {
892
+ const column = this.normalizeExpandColumn({
893
+ prefixCls,
894
+ expandCellFixed,
895
+ expandIcon
896
+ });
897
+ const destIndex = (0, _findIndex2.default)(columns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_EXPAND);
898
+ if (column) {
899
+ if (destIndex > -1) {
900
+ columns[destIndex] = Object.assign(Object.assign({}, column), columns[destIndex]);
901
+ } else if (column.fixed === 'right') {
902
+ columns = [...columns, column];
903
+ } else {
904
+ columns = [column, ...columns];
1142
905
  }
1143
906
  }
1144
-
1145
- return [];
1146
- },
1147
- mergedRowExpandable: record => {
1148
- const {
1149
- expandedRowRender,
1150
- childrenRecordName,
1151
- rowExpandable
1152
- } = this.props;
1153
- const children = (0, _get2.default)(record, childrenRecordName);
1154
- const hasExpandedRowRender = typeof expandedRowRender === 'function';
1155
- const hasRowExpandable = typeof rowExpandable === 'function';
1156
- const hasChildren = Array.isArray(children) && children.length;
1157
- const strictExpandableResult = hasRowExpandable && rowExpandable(record);
1158
- const looseExpandableResult = !hasRowExpandable || strictExpandableResult;
1159
- return (hasExpandedRowRender || hasChildren) && looseExpandableResult || !(hasExpandedRowRender || hasChildren) && strictExpandableResult;
1160
- },
1161
- isAnyColumnUseFullRender: columns => (0, _some2.default)(columns, column => Boolean(column.useFullRender)),
1162
- getNormalizeColumns: () => this.normalizeColumns,
1163
- getHandleColumns: () => this.handleColumns,
1164
- getMergePagination: () => this.mergePagination,
1165
- setBodyHasScrollbar: bodyHasScrollBar => {
1166
- if (bodyHasScrollBar !== this.state.bodyHasScrollBar) {
1167
- this.setState({
1168
- bodyHasScrollBar
1169
- });
1170
- }
1171
- },
1172
-
1173
- stopPropagation(e) {
1174
- // The event definition here is not very accurate for now, it belongs to a broad structure definition
1175
- if (e && typeof e === 'object') {
1176
- if (typeof e.stopPropagation === 'function') {
1177
- e.stopPropagation();
1178
- }
1179
-
1180
- if (e.nativeEvent && typeof e.nativeEvent.stopPropagation === 'function') {
1181
- e.nativeEvent.stopPropagation();
1182
- } else if (typeof e.stopImmediatePropagation === 'function') {
1183
- e.stopImmediatePropagation();
1184
- }
907
+ }
908
+ // selection column
909
+ if (rowSelection && !(0, _get2.default)(rowSelection, 'hidden')) {
910
+ const destIndex = (0, _findIndex2.default)(columns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_SELECTION);
911
+ const column = this.normalizeSelectionColumn({
912
+ rowSelection,
913
+ prefixCls
914
+ });
915
+ if (destIndex > -1) {
916
+ columns[destIndex] = Object.assign(Object.assign({}, column), columns[destIndex]);
917
+ } else if (column.fixed === 'right') {
918
+ columns = [...columns, column];
919
+ } else {
920
+ columns = [column, ...columns];
1185
921
  }
1186
922
  }
1187
-
923
+ (0, _utils.assignColumnKeys)(columns);
924
+ return columns;
925
+ };
926
+ /**
927
+ * Convert children to columns object
928
+ * @param {Array} columns
929
+ * @param {ReactNode} children
930
+ * @returns {Array}
931
+ */
932
+ this.normalizeColumns = (columns, children) => {
933
+ const normalColumns = (0, _utils2.cloneDeep)(this.getColumns(columns, children));
934
+ return normalColumns;
935
+ };
936
+ /**
937
+ * Combine pagination and table paging processing functions
938
+ */
939
+ this.mergePagination = pagination => {
940
+ const newPagination = Object.assign({
941
+ onChange: this.foundation.setPage
942
+ }, pagination);
943
+ return newPagination;
944
+ };
945
+ this.foundation = new _foundation.default(this.adapter);
946
+ // columns cannot be deepClone, otherwise the comparison will be false
947
+ const columns = this.getColumns(props.columns, props.children);
948
+ const cachedflattenColumns = (0, _utils.flattenColumns)(columns);
949
+ const queries = _foundation.default.initColumnsFilteredValueAndSorterOrder((0, _utils2.cloneDeep)(cachedflattenColumns));
950
+ const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(this.props.dataSource, queries);
951
+ const newPagination = (0, _isPlainObject2.default)(this.props.pagination) ? this.props.pagination : {};
952
+ const pageData = this.foundation.getCurrentPageData(filteredSortedDataSource, newPagination, queries);
953
+ this.state = {
954
+ /**
955
+ * Cached props
956
+ */
957
+ cachedColumns: columns,
958
+ cachedChildren: props.children,
959
+ flattenColumns: cachedflattenColumns,
960
+ components: (0, _utils2.mergeComponents)(props.components, props.virtualized),
961
+ /**
962
+ * State calculated based on prop
963
+ */
964
+ queries,
965
+ dataSource: pageData.dataSource,
966
+ flattenData: [],
967
+ expandedRowKeys: [...(props.expandedRowKeys || []), ...(props.defaultExpandedRowKeys || [])],
968
+ rowSelection: props.rowSelection ? (0, _isObject2.default)(props.rowSelection) ? Object.assign({}, props.rowSelection) : {} : null,
969
+ pagination: pageData.pagination,
970
+ /**
971
+ * Internal state
972
+ */
973
+ groups: null,
974
+ allRowKeys: [],
975
+ disabledRowKeys: [],
976
+ disabledRowKeysSet: new Set(),
977
+ allDisabledRowKeys: [],
978
+ allDisabledRowKeysSet: new Set(),
979
+ headWidths: [],
980
+ bodyHasScrollBar: false,
981
+ prePropRowSelection: undefined,
982
+ prePagination: undefined
983
+ };
984
+ this.rootWrapRef = /*#__PURE__*/(0, _react.createRef)();
985
+ this.wrapRef = /*#__PURE__*/(0, _react.createRef)(); // table's outside wrap
986
+ this.bodyWrapRef = /*#__PURE__*/(0, _react.createRef)();
987
+ this.headerWrapRef = /*#__PURE__*/(0, _react.createRef)();
988
+ this.store = new _Store.default({
989
+ hoveredRowKey: null
1188
990
  });
991
+ this.debouncedWindowResize = (0, _debounce2.default)(this.handleWindowResize, 150);
992
+ this.cachedFilteredSortedDataSource = [];
993
+ this.cachedFilteredSortedRowKeys = [];
994
+ this.cachedFilteredSortedRowKeysSet = new Set();
1189
995
  }
1190
-
1191
996
  static getDerivedStateFromProps(props, state) {
1192
997
  const willUpdateStates = {};
1193
998
  const {
@@ -1198,7 +1003,6 @@ class Table extends _baseComponent.default {
1198
1003
  pagination
1199
1004
  } = props;
1200
1005
  props.columns && props.children && _utils2.logger.warn('columns should not given by object and children at the same time');
1201
-
1202
1006
  if (props.columns && props.columns !== state.cachedColumns) {
1203
1007
  const newFlattenColumns = (0, _utils.flattenColumns)(props.columns);
1204
1008
  willUpdateStates.flattenColumns = newFlattenColumns;
@@ -1213,28 +1017,22 @@ class Table extends _baseComponent.default {
1213
1017
  willUpdateStates.queries = [...columns];
1214
1018
  willUpdateStates.cachedColumns = [...newNestedColumns];
1215
1019
  willUpdateStates.cachedChildren = props.children;
1216
- } // Update controlled selection column
1217
-
1218
-
1020
+ }
1021
+ // Update controlled selection column
1219
1022
  if (rowSelection !== state.prePropRowSelection) {
1220
1023
  let newSelectionStates = {};
1221
-
1222
1024
  if ((0, _isObject2.default)(state.rowSelection)) {
1223
1025
  newSelectionStates = Object.assign(Object.assign({}, newSelectionStates), state.rowSelection);
1224
1026
  }
1225
-
1226
1027
  if ((0, _isObject2.default)(rowSelection)) {
1227
1028
  newSelectionStates = Object.assign(Object.assign({}, newSelectionStates), rowSelection);
1228
1029
  }
1229
-
1230
1030
  const selectedRowKeys = (0, _get2.default)(rowSelection, 'selectedRowKeys');
1231
1031
  const getCheckboxProps = (0, _get2.default)(rowSelection, 'getCheckboxProps');
1232
-
1233
1032
  if (selectedRowKeys && Array.isArray(selectedRowKeys)) {
1234
1033
  newSelectionStates.selectedRowKeysSet = new Set(selectedRowKeys);
1235
- } // The return value of getCheckboxProps affects the disabled rows
1236
-
1237
-
1034
+ }
1035
+ // The return value of getCheckboxProps affects the disabled rows
1238
1036
  if ((0, _isFunction2.default)(getCheckboxProps)) {
1239
1037
  const disabledRowKeys = (0, _utils.getAllDisabledRowKeys)({
1240
1038
  dataSource,
@@ -1248,40 +1046,31 @@ class Table extends _baseComponent.default {
1248
1046
  willUpdateStates.allDisabledRowKeys = disabledRowKeys;
1249
1047
  willUpdateStates.allDisabledRowKeysSet = disabledRowKeysSet;
1250
1048
  }
1251
-
1252
1049
  willUpdateStates.rowSelection = newSelectionStates;
1253
1050
  willUpdateStates.prePropRowSelection = rowSelection;
1254
1051
  }
1255
-
1256
1052
  if (pagination !== state.prePagination) {
1257
1053
  let newPagination = {};
1258
-
1259
1054
  if ((0, _isObject2.default)(state.pagination)) {
1260
1055
  newPagination = Object.assign(Object.assign({}, newPagination), state.pagination);
1261
1056
  }
1262
-
1263
1057
  if ((0, _isObject2.default)(pagination)) {
1264
1058
  newPagination = Object.assign(Object.assign({}, newPagination), pagination);
1265
1059
  }
1266
-
1267
1060
  willUpdateStates.pagination = newPagination;
1268
1061
  willUpdateStates.prePagination = pagination;
1269
1062
  }
1270
-
1271
1063
  return willUpdateStates;
1272
1064
  }
1273
-
1274
1065
  componentDidMount() {
1275
1066
  super.componentDidMount();
1276
1067
  this.setScrollPosition('left');
1277
-
1278
1068
  if (this.adapter.isAnyColumnFixed() || this.props.showHeader && this.adapter.useFixedHeader()) {
1279
1069
  this.handleWindowResize();
1280
1070
  window.addEventListener('resize', this.debouncedWindowResize);
1281
1071
  }
1282
- } // TODO: Extract the setState operation to the adapter or getDerivedStateFromProps function
1283
-
1284
-
1072
+ }
1073
+ // TODO: Extract the setState operation to the adapter or getDerivedStateFromProps function
1285
1074
  componentDidUpdate(prevProps, prevState) {
1286
1075
  const {
1287
1076
  dataSource,
@@ -1309,30 +1098,24 @@ class Table extends _baseComponent.default {
1309
1098
  * @param allRowKeys
1310
1099
  * @param queries
1311
1100
  */
1312
-
1313
1101
  const states = {};
1314
-
1315
1102
  this._warnIfNoKey();
1316
1103
  /**
1317
1104
  * The state that needs to be updated after props changes
1318
1105
  */
1319
1106
  // Update controlled expand column
1320
-
1321
-
1322
1107
  if (Array.isArray(expandedRowKeys) && expandedRowKeys !== prevProps.expandedRowKeys) {
1323
1108
  this.setState({
1324
1109
  expandedRowKeys
1325
1110
  });
1326
- } // Update components
1327
-
1328
-
1111
+ }
1112
+ // Update components
1329
1113
  if (components !== prevProps.components || virtualized !== prevProps.virtualized) {
1330
1114
  this.setState({
1331
1115
  components: (0, _utils2.mergeComponents)(components, virtualized)
1332
1116
  });
1333
- } // Update the default expanded column
1334
-
1335
-
1117
+ }
1118
+ // Update the default expanded column
1336
1119
  if (expandAllRows !== prevProps.expandAllRows || expandAllGroupRows !== prevProps.expandAllGroupRows) {
1337
1120
  this.foundation.initExpandedRowKeys({
1338
1121
  groups: stateGroups
@@ -1343,8 +1126,6 @@ class Table extends _baseComponent.default {
1343
1126
  * 1. Cache filtered sorted data and a collection of data rows, stored in this
1344
1127
  * 2. Update pager and group, stored in state
1345
1128
  */
1346
-
1347
-
1348
1129
  if (dataSource !== prevProps.dataSource || stateCachedColumns !== prevState.cachedColumns || stateCachedChildren !== prevState.cachedChildren) {
1349
1130
  // TODO: foundation.getFilteredSortedDataSource has side effects and will be modified to the dataSource reference
1350
1131
  // Temporarily use _dataSource=[...dataSource] for processing
@@ -1354,19 +1135,16 @@ class Table extends _baseComponent.default {
1354
1135
  this.foundation.setCachedFilteredSortedDataSource(filteredSortedDataSource);
1355
1136
  this.foundation.setAllDisabledRowKeys(allDataDisabledRowKeys);
1356
1137
  states.dataSource = filteredSortedDataSource;
1357
-
1358
1138
  if (this.props.groupBy) {
1359
1139
  states.groups = null;
1360
1140
  }
1361
- } // when dataSource has change, should reset currentPage
1362
-
1363
-
1141
+ }
1142
+ // when dataSource has change, should reset currentPage
1364
1143
  if (dataSource !== prevProps.dataSource) {
1365
1144
  states.pagination = (0, _isObject2.default)(statePagination) ? Object.assign(Object.assign({}, statePagination), {
1366
1145
  currentPage: (0, _isObject2.default)(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
1367
1146
  }) : statePagination;
1368
1147
  }
1369
-
1370
1148
  if (Object.keys(states).length) {
1371
1149
  const {
1372
1150
  // eslint-disable-next-line @typescript-eslint/no-shadow
@@ -1374,66 +1152,57 @@ class Table extends _baseComponent.default {
1374
1152
  queries: stateQueries = null,
1375
1153
  dataSource: stateDataSource = null
1376
1154
  } = states;
1377
- const handledProps = this.foundation.getCurrentPageData(stateDataSource, mergedStatePagination, stateQueries); // After the pager is updated, reset allRowKeys of the current page
1378
-
1155
+ const handledProps = this.foundation.getCurrentPageData(stateDataSource, mergedStatePagination, stateQueries);
1156
+ // After the pager is updated, reset allRowKeys of the current page
1379
1157
  this.adapter.setAllRowKeys(handledProps.allRowKeys);
1380
1158
  this.adapter.setDisabledRowKeys(handledProps.disabledRowKeys);
1381
-
1382
1159
  if ('dataSource' in states) {
1383
1160
  if (this.props.defaultExpandAllRows && handledProps.groups && handledProps.groups.size || this.props.expandAllRows || this.props.expandAllGroupRows) {
1384
1161
  this.foundation.initExpandedRowKeys(handledProps);
1385
1162
  }
1386
-
1387
1163
  states.pagination = handledProps.pagination;
1388
- } // Centrally update paging related state
1389
-
1390
-
1164
+ }
1165
+ // Centrally update paging related state
1391
1166
  const statesKeys = Object.keys(states);
1392
-
1393
1167
  for (const k of statesKeys) {
1394
1168
  this.setState({
1395
1169
  [k]: handledProps[k]
1396
1170
  });
1397
1171
  }
1398
1172
  }
1399
-
1400
1173
  if (this.adapter.isAnyColumnFixed() || this.props.showHeader && this.adapter.useFixedHeader()) {
1401
1174
  if (!this.debouncedWindowResize) {
1402
1175
  window.addEventListener('resize', this.debouncedWindowResize);
1403
1176
  }
1404
1177
  }
1405
1178
  }
1406
-
1407
1179
  componentWillUnmount() {
1408
1180
  super.componentWillUnmount();
1409
-
1410
1181
  if (this.debouncedWindowResize) {
1411
1182
  window.removeEventListener('resize', this.debouncedWindowResize);
1412
1183
  this.debouncedWindowResize.cancel();
1413
1184
  this.debouncedWindowResize = null;
1414
1185
  }
1415
1186
  }
1416
-
1417
1187
  render() {
1418
1188
  let _a = this.props,
1419
- {
1420
- scroll,
1421
- prefixCls,
1422
- className,
1423
- style: wrapStyle = {},
1424
- bordered,
1425
- id,
1426
- pagination: propPagination,
1427
- virtualized,
1428
- size,
1429
- renderPagination: propRenderPagination,
1430
- getVirtualizedListRef,
1431
- loading,
1432
- hideExpandedColumn,
1433
- rowSelection: propRowSelection
1434
- } = _a,
1435
- rest = __rest(_a, ["scroll", "prefixCls", "className", "style", "bordered", "id", "pagination", "virtualized", "size", "renderPagination", "getVirtualizedListRef", "loading", "hideExpandedColumn", "rowSelection"]);
1436
-
1189
+ {
1190
+ scroll,
1191
+ prefixCls,
1192
+ className,
1193
+ style: wrapStyle = {},
1194
+ bordered,
1195
+ id,
1196
+ pagination: propPagination,
1197
+ virtualized,
1198
+ size,
1199
+ renderPagination: propRenderPagination,
1200
+ getVirtualizedListRef,
1201
+ loading,
1202
+ hideExpandedColumn,
1203
+ rowSelection: propRowSelection
1204
+ } = _a,
1205
+ rest = __rest(_a, ["scroll", "prefixCls", "className", "style", "bordered", "id", "pagination", "virtualized", "size", "renderPagination", "getVirtualizedListRef", "loading", "hideExpandedColumn", "rowSelection"]);
1437
1206
  let {
1438
1207
  rowSelection,
1439
1208
  expandedRowKeys,
@@ -1463,15 +1232,14 @@ class Table extends _baseComponent.default {
1463
1232
  * useFullRender需要传给用户selection ReactNode,因此需要每次selectedRowKeys变化时重新计算columns
1464
1233
  * TODO: 未来可以将传给用户的selection改为函数类型,让用户执行函数获取selection title的实时状态
1465
1234
  */
1466
-
1467
1235
  if (!this.adapter.isAnyColumnUseFullRender(queries)) {
1468
1236
  const rowSelectionUpdate = propRowSelection && !(0, _get2.default)(propRowSelection, 'hidden');
1469
- columns = this.foundation.memoizedWithFnsColumns(queries, cachedColumns, rowSelectionUpdate, hideExpandedColumn, // Update the columns after the body scrollbar changes to ensure that the head and body are aligned
1237
+ columns = this.foundation.memoizedWithFnsColumns(queries, cachedColumns, rowSelectionUpdate, hideExpandedColumn,
1238
+ // Update the columns after the body scrollbar changes to ensure that the head and body are aligned
1470
1239
  bodyHasScrollBar);
1471
1240
  } else {
1472
1241
  columns = this.handleColumns(queries, cachedColumns);
1473
1242
  }
1474
-
1475
1243
  const filteredColumns = this.foundation.memoizedFilterColumns(columns);
1476
1244
  const flattenFnsColumns = this.foundation.memoizedFlattenFnsColumns(columns);
1477
1245
  const anyColumnFixed = this.adapter.isAnyColumnFixed(columns);
@@ -1487,7 +1255,6 @@ class Table extends _baseComponent.default {
1487
1255
  // dataSource = pageData.dataSource;
1488
1256
  // pagination = pageData.pagination;
1489
1257
  // }
1490
-
1491
1258
  const props = Object.assign(Object.assign(Object.assign({}, rest), this.state), {
1492
1259
  // props not in rest
1493
1260
  virtualized,
@@ -1509,13 +1276,11 @@ class Table extends _baseComponent.default {
1509
1276
  });
1510
1277
  const x = (0, _get2.default)(scroll, 'x');
1511
1278
  const y = (0, _get2.default)(scroll, 'y');
1512
-
1513
1279
  if (virtualized) {
1514
1280
  if (typeof wrapStyle.width !== 'number') {
1515
1281
  wrapStyle.width = x;
1516
1282
  }
1517
1283
  }
1518
-
1519
1284
  const wrapCls = (0, _classnames.default)({
1520
1285
  [`${prefixCls}-${_constants.strings.SIZE_SMALL}`]: size === _constants.strings.SIZE_SMALL,
1521
1286
  [`${prefixCls}-${_constants.strings.SIZE_MIDDLE}`]: size === _constants.strings.SIZE_MIDDLE,
@@ -1524,8 +1289,8 @@ class Table extends _baseComponent.default {
1524
1289
  [`${prefixCls}-fixed-header`]: Boolean(y),
1525
1290
  [`${prefixCls}-scroll-position-left`]: ['both', 'left'].includes(this.position),
1526
1291
  [`${prefixCls}-scroll-position-right`]: ['both', 'right'].includes(this.position)
1527
- }); // pagination
1528
-
1292
+ });
1293
+ // pagination
1529
1294
  const tablePagination = pagination && propPagination ? this.renderPagination(pagination, propRenderPagination) : null;
1530
1295
  const paginationPosition = (0, _get2.default)(propPagination, 'position', 'bottom');
1531
1296
  const tableContextValue = Object.assign(Object.assign({}, this.context), {
@@ -1568,9 +1333,7 @@ class Table extends _baseComponent.default {
1568
1333
  key: 'pagination-bottom'
1569
1334
  }, ['bottom', 'both'].includes(paginationPosition) ? tablePagination : null)))));
1570
1335
  }
1571
-
1572
1336
  }
1573
-
1574
1337
  Table.contextType = _tableContext.default;
1575
1338
  Table.propTypes = {
1576
1339
  className: _propTypes.default.string,
@@ -1622,8 +1385,8 @@ Table.propTypes = {
1622
1385
  dropdownPrefixCls: _propTypes.default.string,
1623
1386
  expandRowByClick: _propTypes.default.bool,
1624
1387
  getVirtualizedListRef: _propTypes.default.func // TODO: future api
1625
-
1626
1388
  };
1389
+
1627
1390
  Table.defaultProps = {
1628
1391
  // rowExpandable: stubTrue,
1629
1392
  tableLayout: '',