@douyinfe/semi-ui 2.22.0-beta.0 → 2.22.0-beta.2

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 (337) hide show
  1. package/dist/css/semi.css +438 -38
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +4084 -5300
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/_cssAnimation/index.d.ts +39 -0
  8. package/lib/cjs/_cssAnimation/index.js +133 -0
  9. package/lib/cjs/anchor/index.d.ts +3 -3
  10. package/lib/cjs/anchor/link.d.ts +1 -1
  11. package/lib/cjs/autoComplete/index.d.ts +7 -8
  12. package/lib/cjs/autoComplete/option.d.ts +1 -1
  13. package/lib/cjs/banner/index.d.ts +2 -2
  14. package/lib/cjs/breadcrumb/index.d.ts +3 -3
  15. package/lib/cjs/breadcrumb/item.d.ts +3 -3
  16. package/lib/cjs/button/index.d.ts +2 -2
  17. package/lib/cjs/calendar/dayCalendar.d.ts +2 -2
  18. package/lib/cjs/calendar/index.d.ts +2 -2
  19. package/lib/cjs/calendar/monthCalendar.d.ts +2 -2
  20. package/lib/cjs/calendar/rangeCalendar.d.ts +2 -2
  21. package/lib/cjs/calendar/weekCalendar.d.ts +2 -2
  22. package/lib/cjs/card/cardGroup.d.ts +1 -1
  23. package/lib/cjs/carousel/index.d.ts +1 -1
  24. package/lib/cjs/cascader/index.d.ts +7 -8
  25. package/lib/cjs/cascader/index.js +8 -6
  26. package/lib/cjs/collapse/collapse-context.d.ts +1 -2
  27. package/lib/cjs/collapse/index.d.ts +3 -3
  28. package/lib/cjs/collapse/item.d.ts +2 -2
  29. package/lib/cjs/collapsible/index.d.ts +32 -19
  30. package/lib/cjs/collapsible/index.js +157 -121
  31. package/lib/cjs/configProvider/index.d.ts +1 -1
  32. package/lib/cjs/datePicker/dateInput.d.ts +3 -3
  33. package/lib/cjs/datePicker/datePicker.d.ts +12 -9
  34. package/lib/cjs/datePicker/datePicker.js +11 -13
  35. package/lib/cjs/datePicker/month.d.ts +1 -1
  36. package/lib/cjs/datePicker/month.js +5 -1
  37. package/lib/cjs/datePicker/monthsGrid.d.ts +7 -6
  38. package/lib/cjs/datePicker/monthsGrid.js +9 -26
  39. package/lib/cjs/datePicker/quickControl.d.ts +1 -1
  40. package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
  41. package/lib/cjs/datePicker/yearAndMonth.js +13 -8
  42. package/lib/cjs/descriptions/index.d.ts +1 -1
  43. package/lib/cjs/dropdown/dropdownItem.d.ts +2 -1
  44. package/lib/cjs/dropdown/dropdownItem.js +3 -1
  45. package/lib/cjs/dropdown/index.d.ts +5 -6
  46. package/lib/cjs/form/baseForm.d.ts +7 -5
  47. package/lib/cjs/form/errorMessage.d.ts +1 -1
  48. package/lib/cjs/form/field.d.ts +4 -2
  49. package/lib/cjs/form/label.d.ts +1 -1
  50. package/lib/cjs/grid/col.d.ts +6 -6
  51. package/lib/cjs/grid/row.d.ts +1 -1
  52. package/lib/cjs/iconButton/index.d.ts +2 -2
  53. package/lib/cjs/image/image.d.ts +4 -4
  54. package/lib/cjs/image/preview.d.ts +1 -1
  55. package/lib/cjs/image/previewInner.d.ts +1 -1
  56. package/lib/cjs/index.d.ts +1 -0
  57. package/lib/cjs/index.js +8 -0
  58. package/lib/cjs/inputNumber/index.d.ts +2 -2
  59. package/lib/cjs/locale/source/ro.d.ts +3 -3
  60. package/lib/cjs/modal/Modal.d.ts +6 -6
  61. package/lib/cjs/modal/Modal.js +80 -56
  62. package/lib/cjs/modal/ModalContent.js +6 -5
  63. package/lib/cjs/modal/confirm.d.ts +10 -10
  64. package/lib/cjs/modal/confirm.js +1 -15
  65. package/lib/cjs/modal/useModal/HookModal.d.ts +0 -2
  66. package/lib/cjs/modal/useModal/HookModal.js +6 -18
  67. package/lib/cjs/navigation/Footer.d.ts +1 -1
  68. package/lib/cjs/navigation/Header.d.ts +3 -3
  69. package/lib/cjs/navigation/Item.d.ts +4 -4
  70. package/lib/cjs/navigation/Item.js +11 -5
  71. package/lib/cjs/navigation/OpenIconTransition.d.ts +1 -15
  72. package/lib/cjs/navigation/OpenIconTransition.js +1 -82
  73. package/lib/cjs/navigation/SubNav.d.ts +4 -4
  74. package/lib/cjs/navigation/SubNav.js +43 -27
  75. package/lib/cjs/navigation/index.d.ts +8 -11
  76. package/lib/cjs/notification/index.d.ts +0 -1
  77. package/lib/cjs/notification/index.js +25 -15
  78. package/lib/cjs/notification/notice.d.ts +3 -1
  79. package/lib/cjs/notification/notice.js +3 -1
  80. package/lib/cjs/popconfirm/index.d.ts +4 -5
  81. package/lib/cjs/popover/index.d.ts +8 -8
  82. package/lib/cjs/popover/index.js +1 -1
  83. package/lib/cjs/progress/index.d.ts +4 -4
  84. package/lib/cjs/rating/index.d.ts +1 -1
  85. package/lib/cjs/rating/item.d.ts +1 -1
  86. package/lib/cjs/scrollList/index.d.ts +1 -1
  87. package/lib/cjs/scrollList/scrollItem.d.ts +3 -3
  88. package/lib/cjs/scrollList/scrollItem.js +2 -2
  89. package/lib/cjs/select/index.d.ts +11 -6
  90. package/lib/cjs/select/index.js +108 -60
  91. package/lib/cjs/select/option.d.ts +1 -1
  92. package/lib/cjs/select/optionGroup.d.ts +1 -1
  93. package/lib/cjs/sideSheet/SideSheetContent.d.ts +8 -0
  94. package/lib/cjs/sideSheet/SideSheetContent.js +10 -6
  95. package/lib/cjs/sideSheet/index.d.ts +4 -4
  96. package/lib/cjs/sideSheet/index.js +69 -39
  97. package/lib/cjs/space/index.d.ts +1 -1
  98. package/lib/cjs/spin/index.js +1 -4
  99. package/lib/cjs/table/Body/BaseRow.d.ts +5 -5
  100. package/lib/cjs/table/Body/ExpandedRow.d.ts +3 -3
  101. package/lib/cjs/table/Body/SectionRow.d.ts +3 -3
  102. package/lib/cjs/table/Column.d.ts +4 -4
  103. package/lib/cjs/table/ColumnShape.d.ts +4 -4
  104. package/lib/cjs/table/ColumnSorter.d.ts +1 -1
  105. package/lib/cjs/table/CustomExpandIcon.d.ts +1 -1
  106. package/lib/cjs/table/CustomExpandIcon.js +13 -5
  107. package/lib/cjs/table/Table.d.ts +16 -16
  108. package/lib/cjs/table/TableCell.d.ts +4 -4
  109. package/lib/cjs/table/TableHeaderRow.d.ts +2 -2
  110. package/lib/cjs/table/TablePagination.d.ts +1 -1
  111. package/lib/cjs/table/index.d.ts +15 -15
  112. package/lib/cjs/tabs/TabPane.d.ts +2 -8
  113. package/lib/cjs/tabs/TabPane.js +40 -38
  114. package/lib/cjs/tabs/index.d.ts +5 -3
  115. package/lib/cjs/tabs/index.js +26 -4
  116. package/lib/cjs/tabs/interface.d.ts +2 -0
  117. package/lib/cjs/tag/group.d.ts +1 -0
  118. package/lib/cjs/tag/group.js +6 -3
  119. package/lib/cjs/tag/index.d.ts +1 -1
  120. package/lib/cjs/tag/index.js +1 -0
  121. package/lib/cjs/tag/interface.d.ts +3 -1
  122. package/lib/cjs/tagInput/index.d.ts +3 -3
  123. package/lib/cjs/timePicker/Combobox.js +4 -8
  124. package/lib/cjs/timePicker/PanelShape.d.ts +2 -2
  125. package/lib/cjs/timePicker/TimePicker.d.ts +11 -11
  126. package/lib/cjs/timePicker/TimePicker.js +3 -1
  127. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  128. package/lib/cjs/timePicker/index.d.ts +10 -9
  129. package/lib/cjs/timeline/index.d.ts +1 -1
  130. package/lib/cjs/toast/index.d.ts +2 -4
  131. package/lib/cjs/toast/index.js +29 -14
  132. package/lib/cjs/toast/toast.d.ts +4 -2
  133. package/lib/cjs/toast/toast.js +3 -1
  134. package/lib/cjs/tooltip/index.d.ts +8 -9
  135. package/lib/cjs/tooltip/index.js +30 -37
  136. package/lib/cjs/transfer/index.d.ts +1 -1
  137. package/lib/cjs/tree/autoSizer.d.ts +2 -2
  138. package/lib/cjs/tree/index.d.ts +5 -5
  139. package/lib/cjs/tree/nodeCollapsible.d.ts +11 -0
  140. package/lib/cjs/tree/nodeCollapsible.js +50 -0
  141. package/lib/cjs/tree/nodeList.js +6 -5
  142. package/lib/cjs/tree/treeNode.d.ts +1 -1
  143. package/lib/cjs/treeSelect/index.d.ts +12 -9
  144. package/lib/cjs/treeSelect/index.js +23 -9
  145. package/lib/cjs/trigger/index.d.ts +1 -1
  146. package/lib/cjs/typography/base.d.ts +8 -8
  147. package/lib/cjs/typography/index.d.ts +2 -0
  148. package/lib/cjs/typography/index.js +3 -0
  149. package/lib/cjs/typography/interface.d.ts +2 -0
  150. package/lib/cjs/typography/numeral.d.ts +68 -0
  151. package/lib/cjs/typography/numeral.js +106 -0
  152. package/lib/cjs/typography/paragraph.d.ts +3 -3
  153. package/lib/cjs/typography/text.d.ts +4 -4
  154. package/lib/cjs/typography/title.d.ts +4 -4
  155. package/lib/cjs/upload/fileCard.d.ts +1 -1
  156. package/lib/es/_cssAnimation/index.d.ts +39 -0
  157. package/lib/es/_cssAnimation/index.js +122 -0
  158. package/lib/es/anchor/index.d.ts +3 -3
  159. package/lib/es/anchor/link.d.ts +1 -1
  160. package/lib/es/autoComplete/index.d.ts +7 -8
  161. package/lib/es/autoComplete/option.d.ts +1 -1
  162. package/lib/es/banner/index.d.ts +2 -2
  163. package/lib/es/breadcrumb/index.d.ts +3 -3
  164. package/lib/es/breadcrumb/item.d.ts +3 -3
  165. package/lib/es/button/index.d.ts +2 -2
  166. package/lib/es/calendar/dayCalendar.d.ts +2 -2
  167. package/lib/es/calendar/index.d.ts +2 -2
  168. package/lib/es/calendar/monthCalendar.d.ts +2 -2
  169. package/lib/es/calendar/rangeCalendar.d.ts +2 -2
  170. package/lib/es/calendar/weekCalendar.d.ts +2 -2
  171. package/lib/es/card/cardGroup.d.ts +1 -1
  172. package/lib/es/carousel/index.d.ts +1 -1
  173. package/lib/es/cascader/index.d.ts +7 -8
  174. package/lib/es/cascader/index.js +8 -6
  175. package/lib/es/collapse/collapse-context.d.ts +1 -2
  176. package/lib/es/collapse/index.d.ts +3 -3
  177. package/lib/es/collapse/item.d.ts +2 -2
  178. package/lib/es/collapsible/index.d.ts +32 -19
  179. package/lib/es/collapsible/index.js +158 -119
  180. package/lib/es/configProvider/index.d.ts +1 -1
  181. package/lib/es/datePicker/dateInput.d.ts +3 -3
  182. package/lib/es/datePicker/datePicker.d.ts +12 -9
  183. package/lib/es/datePicker/datePicker.js +11 -13
  184. package/lib/es/datePicker/month.d.ts +1 -1
  185. package/lib/es/datePicker/month.js +5 -1
  186. package/lib/es/datePicker/monthsGrid.d.ts +7 -6
  187. package/lib/es/datePicker/monthsGrid.js +9 -26
  188. package/lib/es/datePicker/quickControl.d.ts +1 -1
  189. package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
  190. package/lib/es/datePicker/yearAndMonth.js +13 -8
  191. package/lib/es/descriptions/index.d.ts +1 -1
  192. package/lib/es/dropdown/dropdownItem.d.ts +2 -1
  193. package/lib/es/dropdown/dropdownItem.js +3 -1
  194. package/lib/es/dropdown/index.d.ts +5 -6
  195. package/lib/es/form/baseForm.d.ts +7 -5
  196. package/lib/es/form/errorMessage.d.ts +1 -1
  197. package/lib/es/form/field.d.ts +4 -2
  198. package/lib/es/form/label.d.ts +1 -1
  199. package/lib/es/grid/col.d.ts +6 -6
  200. package/lib/es/grid/row.d.ts +1 -1
  201. package/lib/es/iconButton/index.d.ts +2 -2
  202. package/lib/es/image/image.d.ts +4 -4
  203. package/lib/es/image/preview.d.ts +1 -1
  204. package/lib/es/image/previewInner.d.ts +1 -1
  205. package/lib/es/index.d.ts +1 -0
  206. package/lib/es/index.js +1 -0
  207. package/lib/es/inputNumber/index.d.ts +2 -2
  208. package/lib/es/locale/source/ro.d.ts +3 -3
  209. package/lib/es/modal/Modal.d.ts +6 -6
  210. package/lib/es/modal/Modal.js +79 -56
  211. package/lib/es/modal/ModalContent.js +6 -5
  212. package/lib/es/modal/confirm.d.ts +10 -10
  213. package/lib/es/modal/confirm.js +1 -14
  214. package/lib/es/modal/useModal/HookModal.d.ts +0 -2
  215. package/lib/es/modal/useModal/HookModal.js +7 -19
  216. package/lib/es/navigation/Footer.d.ts +1 -1
  217. package/lib/es/navigation/Header.d.ts +3 -3
  218. package/lib/es/navigation/Item.d.ts +4 -4
  219. package/lib/es/navigation/Item.js +11 -5
  220. package/lib/es/navigation/OpenIconTransition.d.ts +1 -15
  221. package/lib/es/navigation/OpenIconTransition.js +1 -66
  222. package/lib/es/navigation/SubNav.d.ts +4 -4
  223. package/lib/es/navigation/SubNav.js +43 -28
  224. package/lib/es/navigation/index.d.ts +8 -11
  225. package/lib/es/notification/index.d.ts +0 -1
  226. package/lib/es/notification/index.js +24 -14
  227. package/lib/es/notification/notice.d.ts +3 -1
  228. package/lib/es/notification/notice.js +3 -1
  229. package/lib/es/popconfirm/index.d.ts +4 -5
  230. package/lib/es/popover/index.d.ts +8 -8
  231. package/lib/es/popover/index.js +1 -1
  232. package/lib/es/progress/index.d.ts +4 -4
  233. package/lib/es/rating/index.d.ts +1 -1
  234. package/lib/es/rating/item.d.ts +1 -1
  235. package/lib/es/scrollList/index.d.ts +1 -1
  236. package/lib/es/scrollList/scrollItem.d.ts +3 -3
  237. package/lib/es/scrollList/scrollItem.js +3 -3
  238. package/lib/es/select/index.d.ts +11 -6
  239. package/lib/es/select/index.js +108 -60
  240. package/lib/es/select/option.d.ts +1 -1
  241. package/lib/es/select/optionGroup.d.ts +1 -1
  242. package/lib/es/sideSheet/SideSheetContent.d.ts +8 -0
  243. package/lib/es/sideSheet/SideSheetContent.js +10 -6
  244. package/lib/es/sideSheet/index.d.ts +4 -4
  245. package/lib/es/sideSheet/index.js +67 -37
  246. package/lib/es/space/index.d.ts +1 -1
  247. package/lib/es/spin/index.js +1 -4
  248. package/lib/es/table/Body/BaseRow.d.ts +5 -5
  249. package/lib/es/table/Body/ExpandedRow.d.ts +3 -3
  250. package/lib/es/table/Body/SectionRow.d.ts +3 -3
  251. package/lib/es/table/Column.d.ts +4 -4
  252. package/lib/es/table/ColumnShape.d.ts +4 -4
  253. package/lib/es/table/ColumnSorter.d.ts +1 -1
  254. package/lib/es/table/CustomExpandIcon.d.ts +1 -1
  255. package/lib/es/table/CustomExpandIcon.js +13 -5
  256. package/lib/es/table/Table.d.ts +16 -16
  257. package/lib/es/table/TableCell.d.ts +4 -4
  258. package/lib/es/table/TableHeaderRow.d.ts +2 -2
  259. package/lib/es/table/TablePagination.d.ts +1 -1
  260. package/lib/es/table/index.d.ts +15 -15
  261. package/lib/es/tabs/TabPane.d.ts +2 -8
  262. package/lib/es/tabs/TabPane.js +40 -38
  263. package/lib/es/tabs/index.d.ts +5 -3
  264. package/lib/es/tabs/index.js +26 -4
  265. package/lib/es/tabs/interface.d.ts +2 -0
  266. package/lib/es/tag/group.d.ts +1 -0
  267. package/lib/es/tag/group.js +6 -3
  268. package/lib/es/tag/index.d.ts +1 -1
  269. package/lib/es/tag/index.js +1 -0
  270. package/lib/es/tag/interface.d.ts +3 -1
  271. package/lib/es/tagInput/index.d.ts +3 -3
  272. package/lib/es/timePicker/Combobox.js +4 -8
  273. package/lib/es/timePicker/PanelShape.d.ts +2 -2
  274. package/lib/es/timePicker/TimePicker.d.ts +11 -11
  275. package/lib/es/timePicker/TimePicker.js +3 -1
  276. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  277. package/lib/es/timePicker/index.d.ts +10 -9
  278. package/lib/es/timeline/index.d.ts +1 -1
  279. package/lib/es/toast/index.d.ts +2 -4
  280. package/lib/es/toast/index.js +27 -13
  281. package/lib/es/toast/toast.d.ts +4 -2
  282. package/lib/es/toast/toast.js +3 -1
  283. package/lib/es/tooltip/index.d.ts +8 -9
  284. package/lib/es/tooltip/index.js +27 -36
  285. package/lib/es/transfer/index.d.ts +1 -1
  286. package/lib/es/tree/autoSizer.d.ts +2 -2
  287. package/lib/es/tree/index.d.ts +5 -5
  288. package/lib/es/tree/nodeCollapsible.d.ts +11 -0
  289. package/lib/es/tree/nodeCollapsible.js +35 -0
  290. package/lib/es/tree/nodeList.js +6 -5
  291. package/lib/es/tree/treeNode.d.ts +1 -1
  292. package/lib/es/treeSelect/index.d.ts +12 -9
  293. package/lib/es/treeSelect/index.js +22 -8
  294. package/lib/es/trigger/index.d.ts +1 -1
  295. package/lib/es/typography/base.d.ts +8 -8
  296. package/lib/es/typography/index.d.ts +2 -0
  297. package/lib/es/typography/index.js +2 -0
  298. package/lib/es/typography/interface.d.ts +2 -0
  299. package/lib/es/typography/numeral.d.ts +68 -0
  300. package/lib/es/typography/numeral.js +86 -0
  301. package/lib/es/typography/paragraph.d.ts +3 -3
  302. package/lib/es/typography/text.d.ts +4 -4
  303. package/lib/es/typography/title.d.ts +4 -4
  304. package/lib/es/upload/fileCard.d.ts +1 -1
  305. package/package.json +7 -7
  306. package/lib/cjs/motions/Rotate.d.ts +0 -23
  307. package/lib/cjs/motions/Rotate.js +0 -76
  308. package/lib/cjs/navigation/SubNavTransition.d.ts +0 -17
  309. package/lib/cjs/navigation/SubNavTransition.js +0 -83
  310. package/lib/cjs/notification/NoticeTransition.d.ts +0 -10
  311. package/lib/cjs/notification/NoticeTransition.js +0 -85
  312. package/lib/cjs/sideSheet/SideSheetTransition.d.ts +0 -12
  313. package/lib/cjs/sideSheet/SideSheetTransition.js +0 -115
  314. package/lib/cjs/tabs/TabPaneTransition.d.ts +0 -4
  315. package/lib/cjs/tabs/TabPaneTransition.js +0 -114
  316. package/lib/cjs/toast/ToastTransition.d.ts +0 -7
  317. package/lib/cjs/toast/ToastTransition.js +0 -66
  318. package/lib/cjs/tooltip/TooltipStyledTransition.d.ts +0 -9
  319. package/lib/cjs/tooltip/TooltipStyledTransition.js +0 -52
  320. package/lib/cjs/tree/collapse.d.ts +0 -29
  321. package/lib/cjs/tree/collapse.js +0 -155
  322. package/lib/es/motions/Rotate.d.ts +0 -23
  323. package/lib/es/motions/Rotate.js +0 -60
  324. package/lib/es/navigation/SubNavTransition.d.ts +0 -17
  325. package/lib/es/navigation/SubNavTransition.js +0 -66
  326. package/lib/es/notification/NoticeTransition.d.ts +0 -10
  327. package/lib/es/notification/NoticeTransition.js +0 -74
  328. package/lib/es/sideSheet/SideSheetTransition.d.ts +0 -12
  329. package/lib/es/sideSheet/SideSheetTransition.js +0 -102
  330. package/lib/es/tabs/TabPaneTransition.d.ts +0 -4
  331. package/lib/es/tabs/TabPaneTransition.js +0 -103
  332. package/lib/es/toast/ToastTransition.d.ts +0 -7
  333. package/lib/es/toast/ToastTransition.js +0 -55
  334. package/lib/es/tooltip/TooltipStyledTransition.d.ts +0 -9
  335. package/lib/es/tooltip/TooltipStyledTransition.js +0 -38
  336. package/lib/es/tree/collapse.d.ts +0 -29
  337. package/lib/es/tree/collapse.js +0 -136
@@ -23,10 +23,10 @@ declare const _default: {
23
23
  renderFilterDropdownItem: PropTypes.Requireable<(...args: any[]) => any>;
24
24
  sortChildrenRecord: PropTypes.Requireable<boolean>;
25
25
  sortDirections: PropTypes.Requireable<string[]>;
26
- sortOrder: PropTypes.Requireable<string | boolean>;
27
- sorter: PropTypes.Requireable<boolean | ((...args: any[]) => any)>;
28
- title: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
26
+ sortOrder: PropTypes.Requireable<NonNullable<string | boolean>>;
27
+ sorter: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any)>>;
28
+ title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
29
29
  useFullRender: PropTypes.Requireable<boolean>;
30
- width: PropTypes.Requireable<string | number>;
30
+ width: PropTypes.Requireable<NonNullable<string | number>>;
31
31
  };
32
32
  export default _default;
@@ -15,7 +15,7 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
15
15
  style: PropTypes.Requireable<object>;
16
16
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
17
17
  prefixCls: PropTypes.Requireable<string>;
18
- sortOrder: PropTypes.Requireable<string | boolean>;
18
+ sortOrder: PropTypes.Requireable<NonNullable<string | boolean>>;
19
19
  };
20
20
  static defaultProps: {
21
21
  prefixCls: "semi-table";
@@ -21,7 +21,7 @@ declare namespace CustomExpandIcon {
21
21
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
22
22
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
23
23
  onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
24
- expandIcon: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
24
+ expandIcon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
25
25
  prefixCls: PropTypes.Requireable<string>;
26
26
  motion: PropTypes.Requireable<boolean>;
27
27
  };
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { IconChevronRight, IconChevronDown, IconTreeTriangleDown, IconTreeTriangleRight } from '@douyinfe/semi-icons';
7
7
  import { cssClasses } from '@douyinfe/semi-foundation/lib/es/table/constants';
8
8
  import isEnterPress from '@douyinfe/semi-foundation/lib/es/utils/isEnterPress';
9
- import Rotate from '../motions/Rotate';
9
+ import CSSAnimation from "../_cssAnimation";
10
10
  /**
11
11
  * render expand icon
12
12
  */
@@ -45,10 +45,18 @@ export default function CustomExpandIcon(props) {
45
45
  }, [expanded]);
46
46
 
47
47
  if (motion) {
48
- icon = /*#__PURE__*/React.createElement(Rotate, {
49
- isOpen: expanded,
50
- enterDeg: 90
51
- }, icon);
48
+ const originIcon = icon;
49
+ icon = /*#__PURE__*/React.createElement(CSSAnimation, {
50
+ animationState: expanded ? "enter" : "leave",
51
+ startClassName: "".concat(cssClasses.PREFIX, "-expandedIcon-").concat(expanded ? 'show' : "hide")
52
+ }, _ref => {
53
+ let {
54
+ animationClassName
55
+ } = _ref;
56
+ return /*#__PURE__*/React.cloneElement(originIcon, {
57
+ className: (originIcon.props.className || "") + " " + animationClassName
58
+ });
59
+ });
52
60
  }
53
61
 
54
62
  return /*#__PURE__*/React.createElement("span", {
@@ -78,21 +78,21 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
78
78
  renderFilterDropdownItem: PropTypes.Requireable<(...args: any[]) => any>;
79
79
  sortChildrenRecord: PropTypes.Requireable<boolean>;
80
80
  sortDirections: PropTypes.Requireable<string[]>;
81
- sortOrder: PropTypes.Requireable<string | boolean>;
82
- sorter: PropTypes.Requireable<boolean | ((...args: any[]) => any)>;
83
- title: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
81
+ sortOrder: PropTypes.Requireable<NonNullable<string | boolean>>;
82
+ sorter: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any)>>;
83
+ title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
84
84
  useFullRender: PropTypes.Requireable<boolean>;
85
- width: PropTypes.Requireable<string | number>;
85
+ width: PropTypes.Requireable<NonNullable<string | number>>;
86
86
  }>[]>;
87
87
  hideExpandedColumn: PropTypes.Requireable<boolean>;
88
88
  id: PropTypes.Requireable<string>;
89
- expandIcon: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
89
+ expandIcon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
90
90
  expandCellFixed: PropTypes.Requireable<boolean | "left" | "right">;
91
- title: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
91
+ title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
92
92
  onHeaderRow: PropTypes.Requireable<(...args: any[]) => any>;
93
93
  showHeader: PropTypes.Requireable<boolean>;
94
94
  indentSize: PropTypes.Requireable<number>;
95
- rowKey: PropTypes.Requireable<string | number | ((...args: any[]) => any)>;
95
+ rowKey: PropTypes.Requireable<NonNullable<string | number | ((...args: any[]) => any)>>;
96
96
  onRow: PropTypes.Requireable<(...args: any[]) => any>;
97
97
  onExpandedRowsChange: PropTypes.Requireable<(...args: any[]) => any>;
98
98
  onExpand: PropTypes.Requireable<(...args: any[]) => any>;
@@ -104,23 +104,23 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
104
104
  defaultExpandAllGroupRows: PropTypes.Requireable<boolean>;
105
105
  expandAllGroupRows: PropTypes.Requireable<boolean>;
106
106
  defaultExpandedRowKeys: PropTypes.Requireable<any[]>;
107
- pagination: PropTypes.Requireable<boolean | object>;
107
+ pagination: PropTypes.Requireable<NonNullable<boolean | object>>;
108
108
  renderPagination: PropTypes.Requireable<(...args: any[]) => any>;
109
- footer: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
109
+ footer: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
110
110
  empty: PropTypes.Requireable<PropTypes.ReactNodeLike>;
111
111
  dataSource: PropTypes.Requireable<any[]>;
112
112
  childrenRecordName: PropTypes.Requireable<string>;
113
- rowSelection: PropTypes.Requireable<boolean | object>;
113
+ rowSelection: PropTypes.Requireable<NonNullable<boolean | object>>;
114
114
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
115
115
  scroll: PropTypes.Requireable<PropTypes.InferProps<{
116
- x: PropTypes.Requireable<string | number | boolean>;
117
- y: PropTypes.Requireable<string | number>;
116
+ x: PropTypes.Requireable<NonNullable<string | number | boolean>>;
117
+ y: PropTypes.Requireable<NonNullable<string | number>>;
118
118
  }>>;
119
- groupBy: PropTypes.Requireable<string | number | ((...args: any[]) => any)>;
119
+ groupBy: PropTypes.Requireable<NonNullable<string | number | ((...args: any[]) => any)>>;
120
120
  renderGroupSection: PropTypes.Requireable<(...args: any[]) => any>;
121
121
  onGroupedRow: PropTypes.Requireable<(...args: any[]) => any>;
122
122
  clickGroupedRowToExpand: PropTypes.Requireable<boolean>;
123
- virtualized: PropTypes.Requireable<boolean | object>;
123
+ virtualized: PropTypes.Requireable<NonNullable<boolean | object>>;
124
124
  dropdownPrefixCls: PropTypes.Requireable<string>;
125
125
  expandRowByClick: PropTypes.Requireable<boolean>;
126
126
  getVirtualizedListRef: PropTypes.Requireable<(...args: any[]) => any>;
@@ -294,13 +294,13 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
294
294
  defaultCurrentPage?: number;
295
295
  onPageChange?: (currentPage: number) => void;
296
296
  onPageSizeChange?: (newPageSize: number) => void;
297
- onChange: ((currentPage: number, pageSize: number) => void) | ((currentPage: number, currentPageSize: number) => void);
297
+ onChange: (currentPage: number, pageSize: number) => void;
298
298
  prevText?: React.ReactNode;
299
299
  nextText?: React.ReactNode;
300
300
  showSizeChanger?: boolean;
301
301
  showQuickJumper?: boolean;
302
302
  popoverZIndex?: number;
303
- popoverPosition?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
303
+ popoverPosition?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
304
304
  hideOnSinglePage?: boolean;
305
305
  hoverShowPageSelect?: boolean;
306
306
  };
@@ -49,9 +49,9 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
49
49
  record: PropTypes.Requireable<object>;
50
50
  prefixCls: PropTypes.Requireable<string>;
51
51
  index: PropTypes.Requireable<number>;
52
- fixedLeft: PropTypes.Requireable<number | boolean>;
52
+ fixedLeft: PropTypes.Requireable<NonNullable<number | boolean>>;
53
53
  lastFixedLeft: PropTypes.Requireable<boolean>;
54
- fixedRight: PropTypes.Requireable<number | boolean>;
54
+ fixedRight: PropTypes.Requireable<NonNullable<number | boolean>>;
55
55
  firstFixedRight: PropTypes.Requireable<boolean>;
56
56
  indent: PropTypes.Requireable<number>;
57
57
  indentSize: PropTypes.Requireable<number>;
@@ -63,8 +63,8 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
63
63
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
64
64
  onDidUpdate: PropTypes.Requireable<(...args: any[]) => any>;
65
65
  isSection: PropTypes.Requireable<boolean>;
66
- width: PropTypes.Requireable<string | number>;
67
- height: PropTypes.Requireable<string | number>;
66
+ width: PropTypes.Requireable<NonNullable<string | number>>;
67
+ height: PropTypes.Requireable<NonNullable<string | number>>;
68
68
  selected: PropTypes.Requireable<boolean>;
69
69
  expanded: PropTypes.Requireable<boolean>;
70
70
  colIndex: PropTypes.Requireable<number>;
@@ -21,10 +21,10 @@ export default class TableHeaderRow extends BaseComponent<TableHeaderRowProps, R
21
21
  row: PropTypes.Requireable<any[]>;
22
22
  prefixCls: PropTypes.Requireable<string>;
23
23
  onHeaderRow: PropTypes.Requireable<(...args: any[]) => any>;
24
- index: PropTypes.Requireable<string | number>;
24
+ index: PropTypes.Requireable<NonNullable<string | number>>;
25
25
  style: PropTypes.Requireable<object>;
26
26
  columns: PropTypes.Requireable<any[]>;
27
- fixed: PropTypes.Requireable<string | boolean>;
27
+ fixed: PropTypes.Requireable<NonNullable<string | boolean>>;
28
28
  selectedRowKeysSet: PropTypes.Validator<Set<unknown>>;
29
29
  };
30
30
  static defaultProps: {
@@ -13,7 +13,7 @@ export default class TablePagination extends PureComponent<TablePaginationProps>
13
13
  style: PropTypes.Requireable<object>;
14
14
  prefixCls: PropTypes.Requireable<string>;
15
15
  pagination: PropTypes.Requireable<object>;
16
- info: PropTypes.Requireable<PropTypes.ReactNodeLike>;
16
+ info: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
17
17
  renderPagination: PropTypes.Requireable<(...args: any[]) => any>;
18
18
  };
19
19
  static defaultProps: {
@@ -8,7 +8,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
8
8
  static DEFAULT_KEY_COLUMN_SELECTION: "column-selection";
9
9
  static DEFAULT_KEY_COLUMN_EXPAND: "column-expand";
10
10
  static propTypes: {
11
- resizable: PropTypes.Requireable<boolean | object>;
11
+ resizable: PropTypes.Requireable<NonNullable<boolean | object>>;
12
12
  className: PropTypes.Requireable<string>;
13
13
  style: PropTypes.Requireable<object>;
14
14
  prefixCls: PropTypes.Requireable<string>;
@@ -41,21 +41,21 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
41
41
  renderFilterDropdownItem: PropTypes.Requireable<(...args: any[]) => any>;
42
42
  sortChildrenRecord: PropTypes.Requireable<boolean>;
43
43
  sortDirections: PropTypes.Requireable<string[]>;
44
- sortOrder: PropTypes.Requireable<string | boolean>;
45
- sorter: PropTypes.Requireable<boolean | ((...args: any[]) => any)>;
46
- title: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
44
+ sortOrder: PropTypes.Requireable<NonNullable<string | boolean>>;
45
+ sorter: PropTypes.Requireable<NonNullable<boolean | ((...args: any[]) => any)>>;
46
+ title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
47
47
  useFullRender: PropTypes.Requireable<boolean>;
48
- width: PropTypes.Requireable<string | number>;
48
+ width: PropTypes.Requireable<NonNullable<string | number>>;
49
49
  }>[]>;
50
50
  hideExpandedColumn: PropTypes.Requireable<boolean>;
51
51
  id: PropTypes.Requireable<string>;
52
- expandIcon: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
52
+ expandIcon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
53
53
  expandCellFixed: PropTypes.Requireable<boolean | "left" | "right">;
54
- title: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
54
+ title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
55
55
  onHeaderRow: PropTypes.Requireable<(...args: any[]) => any>;
56
56
  showHeader: PropTypes.Requireable<boolean>;
57
57
  indentSize: PropTypes.Requireable<number>;
58
- rowKey: PropTypes.Requireable<string | number | ((...args: any[]) => any)>;
58
+ rowKey: PropTypes.Requireable<NonNullable<string | number | ((...args: any[]) => any)>>;
59
59
  onRow: PropTypes.Requireable<(...args: any[]) => any>;
60
60
  onExpandedRowsChange: PropTypes.Requireable<(...args: any[]) => any>;
61
61
  onExpand: PropTypes.Requireable<(...args: any[]) => any>;
@@ -67,23 +67,23 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
67
67
  defaultExpandAllGroupRows: PropTypes.Requireable<boolean>;
68
68
  expandAllGroupRows: PropTypes.Requireable<boolean>;
69
69
  defaultExpandedRowKeys: PropTypes.Requireable<any[]>;
70
- pagination: PropTypes.Requireable<boolean | object>;
70
+ pagination: PropTypes.Requireable<NonNullable<boolean | object>>;
71
71
  renderPagination: PropTypes.Requireable<(...args: any[]) => any>;
72
- footer: PropTypes.Requireable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>;
72
+ footer: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
73
73
  empty: PropTypes.Requireable<PropTypes.ReactNodeLike>;
74
74
  dataSource: PropTypes.Requireable<any[]>;
75
75
  childrenRecordName: PropTypes.Requireable<string>;
76
- rowSelection: PropTypes.Requireable<boolean | object>;
76
+ rowSelection: PropTypes.Requireable<NonNullable<boolean | object>>;
77
77
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
78
78
  scroll: PropTypes.Requireable<PropTypes.InferProps<{
79
- x: PropTypes.Requireable<string | number | boolean>;
80
- y: PropTypes.Requireable<string | number>;
79
+ x: PropTypes.Requireable<NonNullable<string | number | boolean>>;
80
+ y: PropTypes.Requireable<NonNullable<string | number>>;
81
81
  }>>;
82
- groupBy: PropTypes.Requireable<string | number | ((...args: any[]) => any)>;
82
+ groupBy: PropTypes.Requireable<NonNullable<string | number | ((...args: any[]) => any)>>;
83
83
  renderGroupSection: PropTypes.Requireable<(...args: any[]) => any>;
84
84
  onGroupedRow: PropTypes.Requireable<(...args: any[]) => any>;
85
85
  clickGroupedRowToExpand: PropTypes.Requireable<boolean>;
86
- virtualized: PropTypes.Requireable<boolean | object>;
86
+ virtualized: PropTypes.Requireable<NonNullable<boolean | object>>;
87
87
  dropdownPrefixCls: PropTypes.Requireable<string>;
88
88
  expandRowByClick: PropTypes.Requireable<boolean>;
89
89
  getVirtualizedListRef: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1,7 +1,6 @@
1
1
  import React, { PureComponent, ReactNode } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { TabContextValue } from './interface';
4
- import { PlainTab, TabPaneProps } from './interface';
3
+ import { PlainTab, TabContextValue, TabPaneProps } from './interface';
5
4
  declare class TabPane extends PureComponent<TabPaneProps> {
6
5
  static isTabPane: boolean;
7
6
  static contextType: React.Context<TabContextValue>;
@@ -15,15 +14,10 @@ declare class TabPane extends PureComponent<TabPaneProps> {
15
14
  icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
16
15
  closable: PropTypes.Requireable<boolean>;
17
16
  };
18
- lastActiveKey: string;
19
17
  ref: React.RefObject<HTMLDivElement>;
20
- isAnimating: boolean;
21
18
  _active: boolean;
22
19
  context: TabContextValue;
23
- componentDidMount(): void;
24
- getDirection: (activeKey: string, itemKey: string, panes: Array<PlainTab>) => boolean;
25
- hideScroll: () => void;
26
- autoScroll: () => void;
20
+ getDirection: (activeKey: string, itemKey: string, panes: Array<PlainTab>, lastActiveKey: string) => boolean;
27
21
  shouldRender: () => boolean;
28
22
  render(): ReactNode;
29
23
  }
@@ -15,20 +15,18 @@ import cls from 'classnames';
15
15
  import { cssClasses } from '@douyinfe/semi-foundation/lib/es/tabs/constants';
16
16
  import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
17
17
  import TabsContext from './tabs-context';
18
- import TabPaneTransition from './TabPaneTransition';
18
+ import CSSAnimation from "../_cssAnimation";
19
19
 
20
20
  class TabPane extends PureComponent {
21
21
  constructor() {
22
22
  super(...arguments);
23
- this.lastActiveKey = null;
24
23
  this.ref = /*#__PURE__*/createRef(); // get direction from current item key to activeKey
25
24
 
26
- this.getDirection = (activeKey, itemKey, panes) => {
25
+ this.getDirection = (activeKey, itemKey, panes, lastActiveKey) => {
27
26
  if (itemKey !== null && activeKey !== null && Array.isArray(panes) && panes.length) {
28
27
  const activeIndex = panes.findIndex(pane => pane.itemKey === activeKey);
29
28
  const itemIndex = panes.findIndex(pane => pane.itemKey === itemKey);
30
- const lastActiveIndex = panes.findIndex(pane => pane.itemKey === this.lastActiveKey);
31
- this.lastActiveKey = activeKey;
29
+ const lastActiveIndex = panes.findIndex(pane => pane.itemKey === lastActiveKey);
32
30
 
33
31
  if (activeIndex === itemIndex) {
34
32
  return lastActiveIndex > activeIndex;
@@ -39,24 +37,6 @@ class TabPane extends PureComponent {
39
37
 
40
38
  return false;
41
39
  };
42
- /* istanbul ignore next */
43
-
44
-
45
- this.hideScroll = () => {
46
- if (this.ref && this.ref.current) {
47
- this.ref.current.style.overflow = 'hidden';
48
- this.isAnimating = true;
49
- }
50
- };
51
- /* istanbul ignore next */
52
-
53
-
54
- this.autoScroll = () => {
55
- if (this.ref && this.ref.current) {
56
- this.ref.current.style.overflow = '';
57
- this.isAnimating = false;
58
- }
59
- };
60
40
 
61
41
  this.shouldRender = () => {
62
42
  const {
@@ -72,14 +52,11 @@ class TabPane extends PureComponent {
72
52
  };
73
53
  }
74
54
 
75
- componentDidMount() {
76
- this.lastActiveKey = this.context.activeKey;
77
- }
78
-
79
55
  render() {
80
56
  const {
81
57
  tabPaneMotion: motion,
82
- tabPosition
58
+ tabPosition,
59
+ prevActiveKey
83
60
  } = this.context;
84
61
 
85
62
  const _a = this.props,
@@ -98,6 +75,27 @@ class TabPane extends PureComponent {
98
75
  [cssClasses.TABS_PANE]: true
99
76
  });
100
77
  const shouldRender = this.shouldRender();
78
+
79
+ const startClassName = (() => {
80
+ const direction = this.getDirection(this.context.activeKey, itemKey, this.context.panes, prevActiveKey);
81
+
82
+ if (tabPosition === 'top') {
83
+ if (direction) {
84
+ return cssClasses.TABS_PANE_ANIMATE_RIGHT_SHOW;
85
+ } else {
86
+ return cssClasses.TABS_PANE_ANIMATE_LEFT_SHOW;
87
+ }
88
+ } else {
89
+ if (direction) {
90
+ return cssClasses.TABS_PANE_ANIMATE_BOTTOM_SHOW;
91
+ } else {
92
+ return cssClasses.TABS_PANE_ANIMATE_TOP_SHOW;
93
+ }
94
+ }
95
+ })();
96
+
97
+ const isActivatedBecauseOtherTabPaneRemoved = !this.context.panes.find(tabPane => tabPane.itemKey === prevActiveKey);
98
+ const hasMotion = motion && active && !isActivatedBecauseOtherTabPaneRemoved && !this.context.forceDisableMotion;
101
99
  return /*#__PURE__*/React.createElement("div", Object.assign({
102
100
  ref: this.ref,
103
101
  role: "tabpanel",
@@ -109,16 +107,20 @@ class TabPane extends PureComponent {
109
107
  tabIndex: 0
110
108
  }, getDataAttr(restProps), {
111
109
  "x-semi-prop": "children"
112
- }), motion ? /*#__PURE__*/React.createElement(TabPaneTransition, {
113
- direction: this.getDirection(this.context.activeKey, itemKey, this.context.panes),
114
- motion: motion,
115
- mode: tabPosition === 'top' ? 'horizontal' : 'vertical',
116
- state: active ? 'enter' : 'leave'
117
- }, transitionStyle => /*#__PURE__*/React.createElement("div", {
118
- className: "".concat(cssClasses.TABS_PANE_MOTION_OVERLAY),
119
- style: Object.assign({}, transitionStyle),
120
- "x-semi-prop": "children"
121
- }, shouldRender ? children : null)) : shouldRender ? children : null);
110
+ }), /*#__PURE__*/React.createElement(CSSAnimation, {
111
+ motion: hasMotion,
112
+ animationState: active ? "enter" : "leave",
113
+ startClassName: startClassName
114
+ }, _ref => {
115
+ let {
116
+ animationClassName,
117
+ animationEventsNeedBind
118
+ } = _ref;
119
+ return /*#__PURE__*/React.createElement("div", Object.assign({
120
+ className: "".concat(cssClasses.TABS_PANE_MOTION_OVERLAY, " ").concat(animationClassName),
121
+ "x-semi-prop": "children"
122
+ }, animationEventsNeedBind), shouldRender ? children : null);
123
+ }));
122
124
  }
123
125
 
124
126
  }
@@ -4,11 +4,13 @@ import TabsFoundation, { TabsAdapter } from '@douyinfe/semi-foundation/lib/es/ta
4
4
  import BaseComponent from '../_base/baseComponent';
5
5
  import '@douyinfe/semi-foundation/lib/es/tabs/tabs.css';
6
6
  import TabPane from './TabPane';
7
- import { TabsProps, PlainTab } from './interface';
7
+ import { PlainTab, TabsProps } from './interface';
8
8
  export * from './interface';
9
9
  export interface TabsState {
10
10
  activeKey: string;
11
11
  panes: Array<PlainTab>;
12
+ prevActiveKey: string | null;
13
+ forceDisableMotion: boolean;
12
14
  }
13
15
  declare class Tabs extends BaseComponent<TabsProps, TabsState> {
14
16
  static TabPane: typeof TabPane;
@@ -29,7 +31,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
29
31
  tabBarExtraContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
30
32
  tabBarStyle: PropTypes.Requireable<object>;
31
33
  tabList: PropTypes.Requireable<any[]>;
32
- tabPaneMotion: PropTypes.Requireable<boolean | object>;
34
+ tabPaneMotion: PropTypes.Requireable<boolean>;
33
35
  tabPosition: PropTypes.Requireable<string>;
34
36
  type: PropTypes.Requireable<string>;
35
37
  onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
@@ -42,7 +44,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
42
44
  constructor(props: TabsProps);
43
45
  get adapter(): TabsAdapter<TabsProps, TabsState>;
44
46
  static getDerivedStateFromProps(props: TabsProps, state: TabsState): Partial<TabsState>;
45
- componentDidUpdate(prevProps: TabsProps): void;
47
+ componentDidUpdate(prevProps: TabsProps, prevState: TabsState): void;
46
48
  setContentRef: RefCallback<HTMLDivElement>;
47
49
  onTabClick: (activeKey: string, event: MouseEvent<HTMLDivElement>) => void;
48
50
  rePosChildren: (children: ReactElement[], activeKey: string) => ReactElement[];
@@ -85,7 +85,9 @@ class Tabs extends BaseComponent {
85
85
  this.foundation = new TabsFoundation(this.adapter);
86
86
  this.state = {
87
87
  activeKey: this.foundation.getDefaultActiveKey(),
88
- panes: []
88
+ panes: [],
89
+ prevActiveKey: null,
90
+ forceDisableMotion: false
89
91
  };
90
92
  this.contentRef = /*#__PURE__*/createRef();
91
93
  this.contentHeight = 'auto';
@@ -218,13 +220,14 @@ class Tabs extends BaseComponent {
218
220
  const states = {};
219
221
 
220
222
  if (!isNullOrUndefined(props.activeKey) && props.activeKey !== state.activeKey) {
223
+ state.prevActiveKey = state.activeKey;
221
224
  states.activeKey = props.activeKey;
222
225
  }
223
226
 
224
227
  return states;
225
228
  }
226
229
 
227
- componentDidUpdate(prevProps) {
230
+ componentDidUpdate(prevProps, prevState) {
228
231
  // Panes state acts on tab bar, no need to compare TabPane children
229
232
  const prevChildrenProps = React.Children.toArray(prevProps.children).map(child => _pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
230
233
  const nowChildrenProps = React.Children.toArray(this.props.children).map(child => _pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
@@ -232,6 +235,23 @@ class Tabs extends BaseComponent {
232
235
 
233
236
  if (!_isEqual(this.props.tabList, prevProps.tabList)) {
234
237
  this.foundation.handleTabListChange();
238
+ }
239
+
240
+ if (prevState.activeKey !== this.state.activeKey && prevState.activeKey !== this.state.prevActiveKey) {
241
+ this.setState({
242
+ prevActiveKey: prevState.activeKey
243
+ });
244
+ }
245
+
246
+ if (prevProps.activeKey !== this.props.activeKey) {
247
+ const newAddedPanelItemKey = (() => {
248
+ const prevItemKeys = new Set(prevChildrenProps.map(p => p.itemKey));
249
+ return nowChildrenProps.map(p => p.itemKey).filter(itemKey => !prevItemKeys.has(itemKey));
250
+ })();
251
+
252
+ this.setState({
253
+ forceDisableMotion: newAddedPanelItemKey.includes(this.props.activeKey)
254
+ });
235
255
  } // children变化,tabList方式使用时,啥也不用做
236
256
  // children变化,非tabList方式使用,需要重新取activeKey。TabPane可能是异步更新的,若不重新取,未设activeKey时,第一个不会自动激活
237
257
  // children changed: do nothing in tabList case
@@ -301,7 +321,9 @@ class Tabs extends BaseComponent {
301
321
  lazyRender,
302
322
  panes,
303
323
  tabPaneMotion,
304
- tabPosition
324
+ tabPosition,
325
+ prevActiveKey: this.state.prevActiveKey,
326
+ forceDisableMotion: this.state.forceDisableMotion
305
327
  }
306
328
  }, /*#__PURE__*/React.createElement("div", {
307
329
  ref: this.setContentRef,
@@ -330,7 +352,7 @@ Tabs.propTypes = {
330
352
  tabBarExtraContent: PropTypes.node,
331
353
  tabBarStyle: PropTypes.object,
332
354
  tabList: PropTypes.array,
333
- tabPaneMotion: PropTypes.oneOfType([PropTypes.bool, PropTypes.object, PropTypes.func]),
355
+ tabPaneMotion: PropTypes.bool,
334
356
  tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
335
357
  type: PropTypes.oneOf(strings.TYPE_MAP),
336
358
  onTabClose: PropTypes.func,
@@ -78,4 +78,6 @@ export interface TabContextValue {
78
78
  panes?: Array<PlainTab>;
79
79
  tabPaneMotion?: boolean;
80
80
  tabPosition?: TabPosition;
81
+ prevActiveKey?: string | null;
82
+ forceDisableMotion?: boolean;
81
83
  }
@@ -9,6 +9,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
9
9
  size: string;
10
10
  avatarShape: string;
11
11
  onTagClose: () => any;
12
+ onPlusNMouseEnter: () => any;
12
13
  };
13
14
  static propTypes: {
14
15
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -12,7 +12,8 @@ export default class TagGroup extends PureComponent {
12
12
  const {
13
13
  size,
14
14
  showPopover,
15
- popoverProps
15
+ popoverProps,
16
+ onPlusNMouseEnter
16
17
  } = this.props;
17
18
  let nTag = /*#__PURE__*/React.createElement(Tag, {
18
19
  closable: false,
@@ -21,7 +22,8 @@ export default class TagGroup extends PureComponent {
21
22
  style: {
22
23
  backgroundColor: 'transparent'
23
24
  },
24
- key: "_+n"
25
+ key: "_+n",
26
+ onMouseEnter: onPlusNMouseEnter
25
27
  }, "+", n);
26
28
 
27
29
  if (showPopover) {
@@ -133,7 +135,8 @@ TagGroup.defaultProps = {
133
135
  className: '',
134
136
  size: tagSize[0],
135
137
  avatarShape: 'square',
136
- onTagClose: () => undefined
138
+ onTagClose: () => undefined,
139
+ onPlusNMouseEnter: () => undefined
137
140
  };
138
141
  TagGroup.propTypes = {
139
142
  children: PropTypes.node,
@@ -10,7 +10,7 @@ export default class Tag extends Component<TagProps, TagState> {
10
10
  static defaultProps: TagProps;
11
11
  static propTypes: {
12
12
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
13
- tagKey: PropTypes.Requireable<string | number>;
13
+ tagKey: PropTypes.Requireable<NonNullable<string | number>>;
14
14
  size: PropTypes.Requireable<string>;
15
15
  color: PropTypes.Requireable<string>;
16
16
  type: PropTypes.Requireable<string>;
@@ -184,6 +184,7 @@ Tag.defaultProps = {
184
184
  type: tagType[0],
185
185
  onClose: () => undefined,
186
186
  onClick: () => undefined,
187
+ onMouseEnter: () => undefined,
187
188
  style: {},
188
189
  className: '',
189
190
  shape: 'square',
@@ -23,6 +23,7 @@ export interface TagProps {
23
23
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
24
24
  'aria-label'?: React.AriaAttributes['aria-label'];
25
25
  tabIndex?: number;
26
+ onMouseEnter?: () => void;
26
27
  }
27
28
  export interface TagGroupProps<T> {
28
29
  style?: React.CSSProperties;
@@ -35,5 +36,6 @@ export interface TagGroupProps<T> {
35
36
  popoverProps?: PopoverProps;
36
37
  avatarShape?: AvatarShape;
37
38
  mode?: string;
38
- onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
39
+ onTagClose?: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
40
+ onPlusNMouseEnter?: () => void;
39
41
  }
@@ -73,7 +73,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
73
73
  value: PropTypes.Requireable<any[]>;
74
74
  inputValue: PropTypes.Requireable<string>;
75
75
  placeholder: PropTypes.Requireable<string>;
76
- separator: PropTypes.Requireable<string | any[]>;
76
+ separator: PropTypes.Requireable<NonNullable<string | any[]>>;
77
77
  showClear: PropTypes.Requireable<boolean>;
78
78
  addOnBlur: PropTypes.Requireable<boolean>;
79
79
  draggable: PropTypes.Requireable<boolean>;
@@ -91,8 +91,8 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
91
91
  onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
92
92
  size: PropTypes.Requireable<"default" | "small" | "large">;
93
93
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
94
- prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
95
- suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
94
+ prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
95
+ suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
96
96
  'aria-label': PropTypes.Requireable<string>;
97
97
  preventScroll: PropTypes.Requireable<boolean>;
98
98
  };