@douyinfe/semi-ui 2.8.0-beta.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/_base/_story/index.scss +0 -1
  2. package/_base/baseComponent.tsx +2 -1
  3. package/_portal/index.tsx +2 -1
  4. package/anchor/index.tsx +2 -1
  5. package/anchor/link.tsx +2 -1
  6. package/autoComplete/index.tsx +2 -2
  7. package/avatar/interface.ts +2 -2
  8. package/backtop/index.tsx +1 -0
  9. package/badge/index.tsx +4 -2
  10. package/banner/index.tsx +1 -0
  11. package/breadcrumb/bread-context.tsx +2 -2
  12. package/breadcrumb/index.tsx +2 -2
  13. package/breadcrumb/item.tsx +11 -3
  14. package/button/Button.tsx +2 -1
  15. package/button/buttonGroup.tsx +2 -1
  16. package/calendar/_story/Demo.tsx +3 -3
  17. package/card/cardGroup.tsx +1 -0
  18. package/card/index.tsx +1 -0
  19. package/cascader/index.tsx +3 -2
  20. package/cascader/item.tsx +3 -1
  21. package/checkbox/checkbox.tsx +4 -2
  22. package/checkbox/checkboxGroup.tsx +1 -1
  23. package/checkbox/context.ts +3 -3
  24. package/collapse/index.tsx +1 -0
  25. package/collapse/item.tsx +3 -0
  26. package/collapsible/index.tsx +2 -2
  27. package/configProvider/context.tsx +1 -1
  28. package/datePicker/datePicker.tsx +2 -1
  29. package/descriptions/index.tsx +3 -2
  30. package/descriptions/item.tsx +4 -1
  31. package/dist/css/semi.css +1 -1
  32. package/dist/css/semi.min.css +1 -1
  33. package/dist/umd/semi-ui.js +81 -44
  34. package/dist/umd/semi-ui.js.map +1 -1
  35. package/dist/umd/semi-ui.min.js +1 -1
  36. package/dist/umd/semi-ui.min.js.map +1 -1
  37. package/dropdown/context.ts +6 -1
  38. package/dropdown/dropdownItem.tsx +2 -1
  39. package/dropdown/dropdownTitle.tsx +2 -1
  40. package/dropdown/index.tsx +3 -1
  41. package/empty/index.tsx +1 -1
  42. package/form/arrayField.tsx +1 -0
  43. package/form/baseForm.tsx +3 -2
  44. package/form/group.tsx +2 -0
  45. package/form/hoc/withField.tsx +1 -1
  46. package/form/label.tsx +1 -0
  47. package/form/section.tsx +1 -1
  48. package/form/slot.tsx +2 -0
  49. package/grid/col.tsx +3 -1
  50. package/grid/row.tsx +5 -1
  51. package/layout/Sider.tsx +3 -1
  52. package/layout/index.tsx +2 -0
  53. package/layout/layout-context.ts +1 -1
  54. package/lib/cjs/_base/baseComponent.d.ts +2 -1
  55. package/lib/cjs/_portal/index.d.ts +3 -1
  56. package/lib/cjs/anchor/index.d.ts +2 -1
  57. package/lib/cjs/anchor/link.d.ts +3 -2
  58. package/lib/cjs/autoComplete/index.d.ts +2 -2
  59. package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
  60. package/lib/cjs/avatar/interface.d.ts +2 -2
  61. package/lib/cjs/backtop/index.d.ts +1 -0
  62. package/lib/cjs/badge/index.d.ts +4 -2
  63. package/lib/cjs/banner/index.d.ts +2 -1
  64. package/lib/cjs/breadcrumb/bread-context.d.ts +2 -2
  65. package/lib/cjs/breadcrumb/index.d.ts +2 -2
  66. package/lib/cjs/breadcrumb/item.d.ts +15 -3
  67. package/lib/cjs/button/Button.d.ts +2 -1
  68. package/lib/cjs/button/buttonGroup.d.ts +1 -0
  69. package/lib/cjs/calendar/timeCol.d.ts +1 -1
  70. package/lib/cjs/card/cardGroup.d.ts +1 -0
  71. package/lib/cjs/card/index.d.ts +2 -1
  72. package/lib/cjs/cascader/index.d.ts +5 -3
  73. package/lib/cjs/cascader/item.d.ts +3 -1
  74. package/lib/cjs/checkbox/checkbox.d.ts +5 -11
  75. package/lib/cjs/checkbox/checkbox.js +1 -1
  76. package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
  77. package/lib/cjs/checkbox/checkboxInner.d.ts +1 -10
  78. package/lib/cjs/checkbox/context.d.ts +3 -3
  79. package/lib/cjs/collapse/index.d.ts +1 -0
  80. package/lib/cjs/collapse/item.d.ts +2 -0
  81. package/lib/cjs/collapsible/index.d.ts +1 -1
  82. package/lib/cjs/configProvider/index.d.ts +1 -1
  83. package/lib/cjs/datePicker/datePicker.d.ts +3 -1
  84. package/lib/cjs/datePicker/insetInput.d.ts +1 -0
  85. package/lib/cjs/descriptions/index.d.ts +3 -2
  86. package/lib/cjs/descriptions/item.d.ts +4 -1
  87. package/lib/cjs/dropdown/context.d.ts +5 -3
  88. package/lib/cjs/dropdown/dropdownItem.d.ts +3 -3
  89. package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -0
  90. package/lib/cjs/dropdown/dropdownTitle.d.ts +3 -3
  91. package/lib/cjs/dropdown/index.d.ts +3 -3
  92. package/lib/cjs/empty/index.d.ts +1 -1
  93. package/lib/cjs/form/arrayField.d.ts +1 -0
  94. package/lib/cjs/form/baseForm.d.ts +1 -1
  95. package/lib/cjs/form/baseForm.js +1 -1
  96. package/lib/cjs/form/group.d.ts +3 -1
  97. package/lib/cjs/form/label.d.ts +1 -0
  98. package/lib/cjs/form/section.d.ts +1 -1
  99. package/lib/cjs/form/slot.js +2 -0
  100. package/lib/cjs/grid/col.d.ts +3 -3
  101. package/lib/cjs/grid/row.d.ts +4 -3
  102. package/lib/cjs/inputNumber/index.d.ts +1 -1
  103. package/lib/cjs/layout/Sider.d.ts +4 -1
  104. package/lib/cjs/layout/index.d.ts +2 -0
  105. package/lib/cjs/list/index.d.ts +1 -0
  106. package/lib/cjs/list/item.d.ts +5 -1
  107. package/lib/cjs/list/item.js +5 -1
  108. package/lib/cjs/modal/Modal.d.ts +1 -0
  109. package/lib/cjs/modal/ModalContent.d.ts +7 -2
  110. package/lib/cjs/modal/confirm.d.ts +5 -0
  111. package/lib/cjs/modal/useModal/index.d.ts +1 -0
  112. package/lib/cjs/navigation/Footer.d.ts +3 -5
  113. package/lib/cjs/navigation/Header.d.ts +3 -5
  114. package/lib/cjs/navigation/Item.d.ts +4 -6
  115. package/lib/cjs/navigation/OpenIconTransition.d.ts +2 -1
  116. package/lib/cjs/navigation/SubNav.d.ts +3 -5
  117. package/lib/cjs/navigation/SubNav.js +2 -2
  118. package/lib/cjs/navigation/SubNavTransition.d.ts +1 -1
  119. package/lib/cjs/navigation/nav-context.d.ts +21 -5
  120. package/lib/cjs/notification/NoticeTransition.d.ts +2 -2
  121. package/lib/cjs/notification/index.d.ts +3 -1
  122. package/lib/cjs/notification/notice.d.ts +3 -1
  123. package/lib/cjs/notification/useNotification/index.d.ts +1 -0
  124. package/lib/cjs/overflowList/intersectionObserver.d.ts +3 -2
  125. package/lib/cjs/pagination/index.d.ts +3 -1
  126. package/lib/cjs/pagination/index.js +15 -11
  127. package/lib/cjs/popconfirm/index.d.ts +4 -2
  128. package/lib/cjs/popover/index.d.ts +3 -1
  129. package/lib/cjs/radio/radio.d.ts +1 -0
  130. package/lib/cjs/radio/radioGroup.d.ts +1 -0
  131. package/lib/cjs/select/index.d.ts +3 -1
  132. package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
  133. package/lib/cjs/sideSheet/SideSheetTransition.d.ts +1 -1
  134. package/lib/cjs/sideSheet/index.d.ts +3 -1
  135. package/lib/cjs/table/Body/ExpandedRow.d.ts +3 -1
  136. package/lib/cjs/table/Body/SectionRow.d.ts +3 -1
  137. package/lib/cjs/table/Table.d.ts +5 -3
  138. package/lib/cjs/table/TableCell.d.ts +5 -3
  139. package/lib/cjs/table/TableHeaderRow.d.ts +3 -1
  140. package/lib/cjs/table/table-context.d.ts +7 -6
  141. package/lib/cjs/tabs/TabPane.d.ts +3 -1
  142. package/lib/cjs/tabs/interface.d.ts +2 -1
  143. package/lib/cjs/tag/group.d.ts +1 -1
  144. package/lib/cjs/timePicker/Combobox.d.ts +1 -0
  145. package/lib/cjs/timeline/index.d.ts +2 -1
  146. package/lib/cjs/timeline/item.d.ts +1 -0
  147. package/lib/cjs/toast/ToastTransition.d.ts +1 -1
  148. package/lib/cjs/toast/index.d.ts +8 -16
  149. package/lib/cjs/toast/toast.d.ts +4 -2
  150. package/lib/cjs/toast/useToast/index.d.ts +1 -0
  151. package/lib/cjs/tooltip/index.d.ts +3 -1
  152. package/lib/cjs/transfer/index.d.ts +3 -3
  153. package/lib/cjs/transfer/index.js +2 -1
  154. package/lib/cjs/tree/index.d.ts +13 -11
  155. package/lib/cjs/tree/nodeList.d.ts +1 -1
  156. package/lib/cjs/tree/treeContext.d.ts +10 -10
  157. package/lib/cjs/tree/treeNode.d.ts +11 -9
  158. package/lib/cjs/tree/treeNode.js +2 -0
  159. package/lib/cjs/treeSelect/index.d.ts +7 -5
  160. package/lib/cjs/typography/copyable.d.ts +1 -1
  161. package/lib/cjs/upload/index.d.ts +2 -2
  162. package/lib/es/_base/baseComponent.d.ts +2 -1
  163. package/lib/es/_portal/index.d.ts +3 -1
  164. package/lib/es/anchor/index.d.ts +2 -1
  165. package/lib/es/anchor/link.d.ts +3 -2
  166. package/lib/es/autoComplete/index.d.ts +2 -2
  167. package/lib/es/avatar/avatarGroup.d.ts +1 -1
  168. package/lib/es/avatar/interface.d.ts +2 -2
  169. package/lib/es/backtop/index.d.ts +1 -0
  170. package/lib/es/badge/index.d.ts +4 -2
  171. package/lib/es/banner/index.d.ts +2 -1
  172. package/lib/es/breadcrumb/bread-context.d.ts +2 -2
  173. package/lib/es/breadcrumb/index.d.ts +2 -2
  174. package/lib/es/breadcrumb/item.d.ts +15 -3
  175. package/lib/es/button/Button.d.ts +2 -1
  176. package/lib/es/button/buttonGroup.d.ts +1 -0
  177. package/lib/es/calendar/timeCol.d.ts +1 -1
  178. package/lib/es/card/cardGroup.d.ts +1 -0
  179. package/lib/es/card/index.d.ts +2 -1
  180. package/lib/es/cascader/index.d.ts +5 -3
  181. package/lib/es/cascader/item.d.ts +3 -1
  182. package/lib/es/checkbox/checkbox.d.ts +5 -11
  183. package/lib/es/checkbox/checkbox.js +1 -1
  184. package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
  185. package/lib/es/checkbox/checkboxInner.d.ts +1 -10
  186. package/lib/es/checkbox/context.d.ts +3 -3
  187. package/lib/es/collapse/index.d.ts +1 -0
  188. package/lib/es/collapse/item.d.ts +2 -0
  189. package/lib/es/collapsible/index.d.ts +1 -1
  190. package/lib/es/configProvider/index.d.ts +1 -1
  191. package/lib/es/datePicker/datePicker.d.ts +3 -1
  192. package/lib/es/datePicker/insetInput.d.ts +1 -0
  193. package/lib/es/descriptions/index.d.ts +3 -2
  194. package/lib/es/descriptions/item.d.ts +4 -1
  195. package/lib/es/dropdown/context.d.ts +5 -3
  196. package/lib/es/dropdown/dropdownItem.d.ts +3 -3
  197. package/lib/es/dropdown/dropdownMenu.d.ts +1 -0
  198. package/lib/es/dropdown/dropdownTitle.d.ts +3 -3
  199. package/lib/es/dropdown/index.d.ts +3 -3
  200. package/lib/es/empty/index.d.ts +1 -1
  201. package/lib/es/form/arrayField.d.ts +1 -0
  202. package/lib/es/form/baseForm.d.ts +1 -1
  203. package/lib/es/form/baseForm.js +1 -1
  204. package/lib/es/form/group.d.ts +3 -1
  205. package/lib/es/form/label.d.ts +1 -0
  206. package/lib/es/form/section.d.ts +1 -1
  207. package/lib/es/form/slot.js +2 -0
  208. package/lib/es/grid/col.d.ts +3 -3
  209. package/lib/es/grid/row.d.ts +4 -3
  210. package/lib/es/inputNumber/index.d.ts +1 -1
  211. package/lib/es/layout/Sider.d.ts +4 -1
  212. package/lib/es/layout/index.d.ts +2 -0
  213. package/lib/es/list/index.d.ts +1 -0
  214. package/lib/es/list/item.d.ts +5 -1
  215. package/lib/es/list/item.js +5 -1
  216. package/lib/es/modal/Modal.d.ts +1 -0
  217. package/lib/es/modal/ModalContent.d.ts +7 -2
  218. package/lib/es/modal/confirm.d.ts +5 -0
  219. package/lib/es/modal/useModal/index.d.ts +1 -0
  220. package/lib/es/navigation/Footer.d.ts +3 -5
  221. package/lib/es/navigation/Header.d.ts +3 -5
  222. package/lib/es/navigation/Item.d.ts +4 -6
  223. package/lib/es/navigation/OpenIconTransition.d.ts +2 -1
  224. package/lib/es/navigation/SubNav.d.ts +3 -5
  225. package/lib/es/navigation/SubNav.js +2 -2
  226. package/lib/es/navigation/SubNavTransition.d.ts +1 -1
  227. package/lib/es/navigation/nav-context.d.ts +21 -5
  228. package/lib/es/notification/NoticeTransition.d.ts +2 -2
  229. package/lib/es/notification/index.d.ts +3 -1
  230. package/lib/es/notification/notice.d.ts +3 -1
  231. package/lib/es/notification/useNotification/index.d.ts +1 -0
  232. package/lib/es/overflowList/intersectionObserver.d.ts +3 -2
  233. package/lib/es/pagination/index.d.ts +3 -1
  234. package/lib/es/pagination/index.js +15 -11
  235. package/lib/es/popconfirm/index.d.ts +4 -2
  236. package/lib/es/popover/index.d.ts +3 -1
  237. package/lib/es/radio/radio.d.ts +1 -0
  238. package/lib/es/radio/radioGroup.d.ts +1 -0
  239. package/lib/es/select/index.d.ts +3 -1
  240. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
  241. package/lib/es/sideSheet/SideSheetTransition.d.ts +1 -1
  242. package/lib/es/sideSheet/index.d.ts +3 -1
  243. package/lib/es/table/Body/ExpandedRow.d.ts +3 -1
  244. package/lib/es/table/Body/SectionRow.d.ts +3 -1
  245. package/lib/es/table/Table.d.ts +5 -3
  246. package/lib/es/table/TableCell.d.ts +5 -3
  247. package/lib/es/table/TableHeaderRow.d.ts +3 -1
  248. package/lib/es/table/table-context.d.ts +7 -6
  249. package/lib/es/tabs/TabPane.d.ts +3 -1
  250. package/lib/es/tabs/interface.d.ts +2 -1
  251. package/lib/es/tag/group.d.ts +1 -1
  252. package/lib/es/timePicker/Combobox.d.ts +1 -0
  253. package/lib/es/timeline/index.d.ts +2 -1
  254. package/lib/es/timeline/item.d.ts +1 -0
  255. package/lib/es/toast/ToastTransition.d.ts +1 -1
  256. package/lib/es/toast/index.d.ts +8 -16
  257. package/lib/es/toast/toast.d.ts +4 -2
  258. package/lib/es/toast/useToast/index.d.ts +1 -0
  259. package/lib/es/tooltip/index.d.ts +3 -1
  260. package/lib/es/transfer/index.d.ts +3 -3
  261. package/lib/es/transfer/index.js +3 -1
  262. package/lib/es/tree/index.d.ts +13 -11
  263. package/lib/es/tree/nodeList.d.ts +1 -1
  264. package/lib/es/tree/treeContext.d.ts +10 -10
  265. package/lib/es/tree/treeNode.d.ts +11 -9
  266. package/lib/es/tree/treeNode.js +2 -0
  267. package/lib/es/treeSelect/index.d.ts +7 -5
  268. package/lib/es/typography/copyable.d.ts +1 -1
  269. package/lib/es/upload/index.d.ts +2 -2
  270. package/list/index.tsx +1 -0
  271. package/list/item.tsx +6 -1
  272. package/modal/Modal.tsx +1 -0
  273. package/modal/ModalContent.tsx +9 -3
  274. package/navigation/Footer.tsx +3 -1
  275. package/navigation/Header.tsx +3 -1
  276. package/navigation/Item.tsx +4 -3
  277. package/navigation/OpenIconTransition.tsx +2 -1
  278. package/navigation/SubNav.tsx +4 -3
  279. package/navigation/SubNavTransition.tsx +1 -1
  280. package/navigation/nav-context.ts +22 -1
  281. package/notification/NoticeTransition.tsx +1 -1
  282. package/notification/index.tsx +3 -1
  283. package/notification/notice.tsx +3 -1
  284. package/overflowList/intersectionObserver.tsx +2 -1
  285. package/package.json +11 -11
  286. package/pagination/index.tsx +4 -1
  287. package/popconfirm/index.tsx +3 -1
  288. package/popover/index.tsx +3 -1
  289. package/radio/radio.tsx +1 -0
  290. package/radio/radioGroup.tsx +1 -0
  291. package/select/__test__/select.test.js +16 -0
  292. package/select/index.tsx +2 -1
  293. package/select/utils.tsx +1 -1
  294. package/sideSheet/SideSheetContent.tsx +1 -0
  295. package/sideSheet/SideSheetTransition.tsx +1 -1
  296. package/sideSheet/index.tsx +3 -2
  297. package/slider/index.tsx +1 -1
  298. package/table/Body/ExpandedRow.tsx +3 -1
  299. package/table/Body/SectionRow.tsx +3 -1
  300. package/table/Body/index.tsx +3 -2
  301. package/table/Table.tsx +4 -3
  302. package/table/TableCell.tsx +6 -4
  303. package/table/TableHeaderRow.tsx +3 -1
  304. package/table/table-context.ts +10 -6
  305. package/tabs/TabPane.tsx +2 -0
  306. package/tabs/index.tsx +2 -2
  307. package/tabs/interface.ts +2 -1
  308. package/tag/group.tsx +5 -5
  309. package/timePicker/TimePicker.tsx +1 -1
  310. package/timeline/index.tsx +1 -0
  311. package/timeline/item.tsx +1 -0
  312. package/toast/ToastTransition.tsx +1 -1
  313. package/toast/toast.tsx +3 -1
  314. package/tooltip/index.tsx +2 -1
  315. package/transfer/index.tsx +3 -1
  316. package/tree/index.tsx +12 -11
  317. package/tree/treeContext.tsx +10 -10
  318. package/tree/treeNode.tsx +10 -7
  319. package/treeSelect/index.tsx +5 -4
  320. package/upload/_story/upload.stories.js +2 -3
  321. package/upload/index.tsx +1 -1
@@ -23,6 +23,7 @@ export interface SideSheetContentProps {
23
23
  style: CSSProperties;
24
24
  bodyStyle?: CSSProperties;
25
25
  className: string;
26
+ children?: React.ReactNode | undefined;
26
27
  footer?: React.ReactNode;
27
28
  'aria-label'?: string;
28
29
  }
@@ -4,7 +4,7 @@ import React, { CSSProperties } from 'react';
4
4
  import { Motion } from '../_base/base';
5
5
 
6
6
  export interface SideSheetTransitionProps{
7
- children?: React.ReactChildren | React.JSXElementConstructor<any>;
7
+ children?: React.ReactNode | ((TransitionProps: any) => React.ReactNode);
8
8
  motion?: Motion<SideSheetTransitionProps>;
9
9
  controlled?: boolean;
10
10
  visible?: boolean;
@@ -4,7 +4,7 @@ import BaseComponent from '../_base/baseComponent';
4
4
  import PropTypes from 'prop-types';
5
5
  import Portal from '../_portal';
6
6
  import cls from 'classnames';
7
- import ConfigContext from '../configProvider/context';
7
+ import ConfigContext, { ContextValue } from '../configProvider/context';
8
8
  import { cssClasses, strings } from '@douyinfe/semi-foundation/sideSheet/constants';
9
9
  import SideSheetTransition from './SideSheetTransition';
10
10
  import SideSheetContent from './SideSheetContent';
@@ -32,7 +32,6 @@ export interface SideSheetReactProps extends SideSheetProps {
32
32
  footer?: React.ReactNode;
33
33
  children?: React.ReactNode;
34
34
  onCancel?: (e: React.MouseEvent | React.KeyboardEvent) => void;
35
-
36
35
  }
37
36
 
38
37
  export {
@@ -93,6 +92,8 @@ export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSh
93
92
  this._active = false;
94
93
  }
95
94
 
95
+ context: ContextValue;
96
+
96
97
  get adapter(): SideSheetAdapter {
97
98
  return {
98
99
  ...super.adapter,
package/slider/index.tsx CHANGED
@@ -300,7 +300,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
300
300
  const maxClass = cls(cssClasses.HANDLE, {
301
301
  [`${cssClasses.HANDLE}-clicked`]: chooseMovePos === 'max' && isDrag,
302
302
  });
303
- const {min, max, currentValue} = this.state;
303
+ const { min, max, currentValue } = this.state;
304
304
 
305
305
  const commonAria = {
306
306
  'aria-label': ariaLabel,
@@ -7,7 +7,7 @@ import { get, set, isNull } from 'lodash';
7
7
  import { cssClasses, strings } from '@douyinfe/semi-foundation/table/constants';
8
8
  import { arrayAdd, filterColumns } from '@douyinfe/semi-foundation/table/utils';
9
9
  import Store from '@douyinfe/semi-foundation/utils/Store';
10
- import TableContext from '../table-context';
10
+ import TableContext, { TableContextProps } from '../table-context';
11
11
  import TableRow from './BaseRow';
12
12
  import { amendTableWidth } from '../utils';
13
13
  import { ColumnProps, ExpandIcon, TableComponents, Virtualized, Fixed } from '../interface';
@@ -68,6 +68,8 @@ export default class TableExpandedRow extends PureComponent<TableExpandedRowProp
68
68
  prefixCls: cssClasses.PREFIX,
69
69
  };
70
70
 
71
+ context: TableContextProps;
72
+
71
73
  render() {
72
74
  const {
73
75
  record,
@@ -10,7 +10,7 @@ import Store from '@douyinfe/semi-foundation/utils/Store';
10
10
  import { cssClasses, strings } from '@douyinfe/semi-foundation/table/constants';
11
11
  import { filterColumns } from '@douyinfe/semi-foundation/table/utils';
12
12
  import BaseRow from './BaseRow';
13
- import TableContext from '../table-context';
13
+ import TableContext, { TableContextProps } from '../table-context';
14
14
  import {
15
15
  ColumnProps,
16
16
  RenderGroupSection,
@@ -79,6 +79,8 @@ class SectionRow extends PureComponent<SectionRowProps> {
79
79
  },
80
80
  };
81
81
 
82
+ context: TableContextProps;
83
+
82
84
  onRow = (...args: any[]): OnRowReturnObject => {
83
85
  const { onGroupedRow, clickGroupedRowToExpand, onExpand, groupKey, expanded } = this.props;
84
86
  const rowProps: { onClick?: (e: React.MouseEvent) => void } = {};
@@ -30,7 +30,7 @@ import ExpandedRow from './ExpandedRow';
30
30
  import SectionRow from './SectionRow';
31
31
  import TableHeader from '../TableHeader';
32
32
  import ConfigContext from '../../configProvider/context';
33
- import TableContext from '../table-context';
33
+ import TableContext, { TableContextProps } from '../table-context';
34
34
  import {
35
35
  ExpandedRowRender,
36
36
  Virtualized,
@@ -132,6 +132,7 @@ class Body extends BaseComponent<BodyProps, BodyState> {
132
132
  foundation: BodyFoundation;
133
133
  cellWidths: number[];
134
134
  flattenedColumns: ColumnProps[];
135
+ context: TableContextProps;
135
136
  constructor(props: BodyProps, context: BodyContext) {
136
137
  super(props);
137
138
  this.ref = React.createRef();
@@ -271,7 +272,7 @@ class Body extends BaseComponent<BodyProps, BodyState> {
271
272
 
272
273
  itemKey = (index: number, data: Array<FlattenData | GroupFlattenData>) => get(data, [index, 'key'], index);
273
274
 
274
- handleRowClick = (rowKey: RowKey<any>, e: React.MouseEvent, expand: boolean) => {
275
+ handleRowClick = (rowKey: RowKey<any>, e: React.MouseEvent<HTMLElement>, expand: boolean) => {
275
276
  const { handleRowExpanded } = this.context;
276
277
  handleRowExpanded(!expand, rowKey, e);
277
278
  };
package/table/Table.tsx CHANGED
@@ -353,6 +353,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
353
353
  scrollPosition!: BodyScrollPosition;
354
354
  position!: BodyScrollPosition;
355
355
  foundation: TableFoundation<RecordType>;
356
+ context: TableContextProps;
356
357
  constructor(props: NormalTableProps<RecordType>, context: TableContextProps) {
357
358
  super(props);
358
359
  this.foundation = new TableFoundation<RecordType>(this.adapter);
@@ -789,7 +790,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
789
790
  }
790
791
  };
791
792
 
792
- renderSelection = (record: RecordType = {} as RecordType, inHeader = false): React.ReactNode => {
793
+ renderSelection = (record = {} as any, inHeader = false): React.ReactNode => {
793
794
  const { rowSelection, disabledRowKeysSet } = this.state;
794
795
 
795
796
  if (rowSelection && typeof rowSelection === 'object') {
@@ -1005,7 +1006,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
1005
1006
  );
1006
1007
  };
1007
1008
 
1008
- renderTitle = (props: { title?: ReactNode; prefixCls?: string; dataSource?: any[] } = {}) => {
1009
+ renderTitle = (props: { title?: ReactNode | ((dataSource?: RecordType[]) => ReactNode); prefixCls?: string; dataSource?: any[] } = {}) => {
1009
1010
  let { title } = props;
1010
1011
  const { prefixCls, dataSource } = props;
1011
1012
 
@@ -1038,7 +1039,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
1038
1039
  );
1039
1040
  };
1040
1041
 
1041
- renderFooter = (props: { footer?: ReactNode; prefixCls?: string; dataSource?: RecordType[] } = {}) => {
1042
+ renderFooter = (props: { footer?: ReactNode | ((dataSource?: RecordType[]) => ReactNode); prefixCls?: string; dataSource?: RecordType[] } = {}) => {
1042
1043
  let { footer } = props;
1043
1044
  const { prefixCls, dataSource } = props;
1044
1045
 
@@ -10,9 +10,9 @@ import TableCellFoundation, { TableCellAdapter } from '@douyinfe/semi-foundation
10
10
  import { isSelectionColumn, isExpandedColumn } from '@douyinfe/semi-foundation/table/utils';
11
11
 
12
12
  import BaseComponent, { BaseProps } from '../_base/baseComponent';
13
- import Context from './table-context';
13
+ import Context, { TableContextProps } from './table-context';
14
14
  import { amendTableWidth } from './utils';
15
- import { Align, ColumnProps } from './interface';
15
+ import { Align, ColumnProps, ExpandIcon } from './interface';
16
16
 
17
17
  export interface TableCellProps extends BaseProps {
18
18
  record?: Record<string, any>;
@@ -30,7 +30,7 @@ export interface TableCellProps extends BaseProps {
30
30
  * When hideExpandedColumn is true or isSection is true
31
31
  * expandIcon is a custom icon or true
32
32
  */
33
- expandIcon?: ReactNode | boolean;
33
+ expandIcon?: ExpandIcon;
34
34
  renderExpandIcon?: (record: Record<string, any>) => ReactNode;
35
35
  hideExpandedColumn?: boolean;
36
36
  component?: any;
@@ -100,6 +100,8 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
100
100
  }
101
101
 
102
102
  ref: React.MutableRefObject<any>;
103
+ context: TableContextProps;
104
+
103
105
  constructor(props: TableCellProps) {
104
106
  super(props);
105
107
  this.ref = createRef();
@@ -242,7 +244,7 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
242
244
  ) : null;
243
245
 
244
246
  // column.render
245
- const realExpandIcon = typeof renderExpandIcon === 'function' ? renderExpandIcon(record) : expandIcon;
247
+ const realExpandIcon = (typeof renderExpandIcon === 'function' ? renderExpandIcon(record) : expandIcon) as React.ReactNode;
246
248
  if (render) {
247
249
  const renderOptions = {
248
250
  expandIcon: realExpandIcon,
@@ -14,7 +14,7 @@ import {
14
14
  sliceColumnsByLevel
15
15
  } from '@douyinfe/semi-foundation/table/utils';
16
16
  import BaseComponent from '../_base/baseComponent';
17
- import TableContext from './table-context';
17
+ import TableContext, { TableContextProps } from './table-context';
18
18
  import { TableComponents, OnHeaderRow, Fixed } from './interface';
19
19
 
20
20
  export interface TableHeaderRowProps {
@@ -64,6 +64,8 @@ export default class TableHeaderRow extends BaseComponent<TableHeaderRowProps, R
64
64
  }
65
65
 
66
66
  headerNode: HTMLElement;
67
+ context: TableContextProps;
68
+
67
69
  constructor(props: TableHeaderRowProps) {
68
70
  super(props);
69
71
  this.headerNode = null;
@@ -1,20 +1,24 @@
1
1
  /* eslint-disable max-len */
2
2
  import React from 'react';
3
3
  import { noop } from 'lodash';
4
- import { ColumnProps, GetVirtualizedListRef } from './interface';
4
+ import { ColumnProps, GetVirtualizedListRef, RowKey } from './interface';
5
+ import {
6
+ BaseRowKeyType,
7
+ BaseHeadWidth,
8
+ } from '@douyinfe/semi-foundation/table/foundation';
5
9
 
6
10
  export interface TableContextProps {
7
11
  children?: React.ReactNode;
8
12
  anyColumnFixed?: boolean;
9
13
  flattenedColumns?: ColumnProps[];
10
- tableWidth?: number[];
11
- headWidths?: number[];
12
- setHeadWidths?: (headWidth?: number[], index?: number) => void;
14
+ tableWidth?: number;
15
+ headWidths?: BaseHeadWidth[][];
16
+ setHeadWidths?: (headWidth?: BaseHeadWidth[], index?: number) => void;
13
17
  getHeadWidths?: (index?: number) => number[];
14
18
  getCellWidths?: (flattenColumns: ColumnProps[], flattenedWidths?: number[], ignoreScrollBarKey?: boolean) => number[];
15
- handleRowExpanded?: (expanded: boolean, realKey: string, domEvent: React.MouseEvent<HTMLElement>) => void;
19
+ handleRowExpanded?: (expanded: boolean, realKey: RowKey<any>, domEvent: React.MouseEvent<HTMLElement>) => void;
16
20
  renderExpandIcon?: (record: Record<string, any>, isNested?: boolean, groupKey?: string | number) => React.ReactNode;
17
- renderSelection?: (record: Record<string, any>, isHeader?: boolean) => React.ReactNode;
21
+ renderSelection?: (record?: Record<string, any>, isHeader?: boolean) => React.ReactNode;
18
22
  getVirtualizedListRef?: GetVirtualizedListRef;
19
23
  setBodyHasScrollbar?: (bodyHasScrollBar: boolean) => void;
20
24
  }
package/tabs/TabPane.tsx CHANGED
@@ -4,6 +4,7 @@ import cls from 'classnames';
4
4
  import { cssClasses } from '@douyinfe/semi-foundation/tabs/constants';
5
5
  import getDataAttr from '@douyinfe/semi-foundation/utils/getDataAttr';
6
6
  import TabsContext from './tabs-context';
7
+ import { TabContextValue } from './interface';
7
8
  import TabPaneTransition from './TabPaneTransition';
8
9
  import { PlainTab, TabPaneProps } from './interface';
9
10
 
@@ -27,6 +28,7 @@ class TabPane extends PureComponent<TabPaneProps> {
27
28
  ref = createRef<HTMLDivElement>();
28
29
  isAnimating: boolean;
29
30
  _active: boolean;
31
+ context: TabContextValue;
30
32
 
31
33
  componentDidMount(): void {
32
34
  this.lastActiveKey = this.context.activeKey;
package/tabs/index.tsx CHANGED
@@ -119,9 +119,9 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
119
119
  }
120
120
  if (panes.findIndex(p => p.itemKey === activeKey) === -1){
121
121
  if (panes.length>0){
122
- this.setState({activeKey: panes[0].itemKey});
122
+ this.setState({ activeKey: panes[0].itemKey });
123
123
  } else {
124
- this.setState({activeKey: ''});
124
+ this.setState({ activeKey: '' });
125
125
  }
126
126
  }
127
127
 
package/tabs/interface.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ComponentType, CSSProperties, MouseEvent, ReactNode } from 'react';
1
+ import React, { ComponentType, CSSProperties, MouseEvent, ReactNode } from 'react';
2
2
  import { Motion } from '../_base/base';
3
3
 
4
4
  export type TabType = 'line' | 'card' | 'button';
@@ -57,6 +57,7 @@ export interface TabBarProps {
57
57
 
58
58
  export interface TabPaneProps {
59
59
  className?: string;
60
+ children?: React.ReactNode | undefined;
60
61
  disabled?: boolean;
61
62
  icon?: ReactNode;
62
63
  itemKey?: string;
package/tag/group.tsx CHANGED
@@ -45,7 +45,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
45
45
  avatarShape: PropTypes.oneOf(avatarShapeSet),
46
46
  };
47
47
 
48
- renderNTag(n: number, restTags: (Tag | React.ReactNode)[]) {
48
+ renderNTag(n: number, restTags: React.ReactNode) {
49
49
  const { size, showPopover, popoverProps } = this.props;
50
50
  let nTag = (
51
51
  <Tag
@@ -84,7 +84,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
84
84
  let renderTags: (Tag | React.ReactNode)[] = tags;
85
85
 
86
86
  const normalTags: (Tag | React.ReactNode)[] = tags.slice(0, maxTagCount);
87
- const restTags = tags.slice(maxTagCount);
87
+ const restTags = tags.slice(maxTagCount) as React.ReactNode;
88
88
  let nTag = null;
89
89
  if (n > 0) {
90
90
  nTag = this.renderNTag(n, restTags);
@@ -96,9 +96,9 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
96
96
 
97
97
  renderAllTags() {
98
98
  const { tagList, size, mode, avatarShape } = this.props;
99
- const renderTags: (Tag | React.ReactNode)[] = tagList.map((tag, index): (Tag | React.ReactNode) => {
99
+ const renderTags = tagList.map((tag, index): (Tag | React.ReactNode) => {
100
100
  if (mode === 'custom') {
101
- return tag;
101
+ return tag as React.ReactNode;
102
102
  }
103
103
  if (!(tag as TagProps).size) {
104
104
  (tag as TagProps).size = size;
@@ -122,7 +122,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
122
122
  }, className);
123
123
 
124
124
  const tags = this.renderAllTags();
125
- const tagContents = typeof maxTagCount === 'undefined' ? tags : this.renderMergeTags(tags);
125
+ const tagContents = (typeof maxTagCount === 'undefined' ? tags : this.renderMergeTags(tags)) as React.ReactNode;
126
126
 
127
127
  return (
128
128
  <div style={style} className={groupCls}>
@@ -323,7 +323,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
323
323
  index,
324
324
  isNullOrUndefined(panelHeader) ? get(defaultHeaderMap, index, null) : panelHeader
325
325
  );
326
- panelProps.panelFooter = get(panels, index, panelFooter);
326
+ panelProps.panelFooter = get(panels, index, panelFooter) as React.ReactNode;
327
327
  }
328
328
 
329
329
  return panelProps;
@@ -17,6 +17,7 @@ export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'>
17
17
  className?: string;
18
18
  style?: React.CSSProperties;
19
19
  dataSource?: Data[];
20
+ children?: React.ReactNode | undefined;
20
21
  }
21
22
 
22
23
  const prefixCls = cssClasses.PREFIX;
package/timeline/item.tsx CHANGED
@@ -7,6 +7,7 @@ import '@douyinfe/semi-foundation/timeline/timeline.scss';
7
7
 
8
8
  export interface TimelineItemProps {
9
9
  color?: string;
10
+ children?: React.ReactNode | undefined;
10
11
  time?: React.ReactNode;
11
12
  type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
12
13
  dot?: React.ReactNode;
@@ -6,7 +6,7 @@ import React, { CSSProperties } from 'react';
6
6
 
7
7
  export interface ToastTransitionProps{
8
8
  motion?: Motion<ToastTransitionProps>;
9
- children?: React.ReactChildren | React.JSXElementConstructor<any>;
9
+ children?: React.ReactNode | ((TransitionProps: any) => any)
10
10
  }
11
11
 
12
12
 
package/toast/toast.tsx CHANGED
@@ -2,7 +2,7 @@
2
2
  import React, { CSSProperties } from 'react';
3
3
  import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
- import ConfigContext from '../configProvider/context';
5
+ import ConfigContext, { ContextValue } from '../configProvider/context';
6
6
  import ToastFoundation, { ToastAdapter, ToastState, ToastProps } from '@douyinfe/semi-foundation/toast/toastFoundation';
7
7
  import { numbers, cssClasses, strings } from '@douyinfe/semi-foundation/toast/constants';
8
8
  import BaseComponent from '../_base/baseComponent';
@@ -52,6 +52,8 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
52
52
  this.foundation = new ToastFoundation(this.adapter);
53
53
  }
54
54
 
55
+ context: ContextValue;
56
+
55
57
  get adapter(): ToastAdapter {
56
58
  return {
57
59
  ...super.adapter,
package/tooltip/index.tsx CHANGED
@@ -19,7 +19,7 @@ import BaseComponent, { BaseProps } from '../_base/baseComponent';
19
19
  import { isHTMLElement } from '../_base/reactUtils';
20
20
  import { getActiveElement, getFocusableElements, stopPropagation } from '../_utils';
21
21
  import Portal from '../_portal/index';
22
- import ConfigContext from '../configProvider/context';
22
+ import ConfigContext, { ContextValue } from '../configProvider/context';
23
23
  import TriangleArrow from './TriangleArrow';
24
24
  import TriangleArrowVertical from './TriangleArrowVertical';
25
25
  import TooltipTransition from './TooltipStyledTransition';
@@ -173,6 +173,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
173
173
  getPopupContainer: () => HTMLElement;
174
174
  containerPosition: string;
175
175
  foundation: TooltipFoundation;
176
+ context: ContextValue;
176
177
 
177
178
  constructor(props: TooltipProps) {
178
179
  super(props);
@@ -558,18 +558,20 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
558
558
  renderRightSortableList(selectedData: Array<ResolvedDataItem>) {
559
559
  // when choose some items && draggable is true
560
560
  const SortableItem = SortableElement((
561
- (item: ResolvedDataItem) => this.renderRightItem(item)) as React.SFC<ResolvedDataItem>
561
+ (item: ResolvedDataItem) => this.renderRightItem(item)) as React.FC<ResolvedDataItem>
562
562
  );
563
563
  const SortableList = SortableContainer(({ items }: { items: Array<ResolvedDataItem> }) => (
564
564
  <div className={`${prefixcls}-right-list`} role="list" aria-label="Selected list">
565
565
  {items.map((item, index: number) => (
566
566
  // sortableElement will take over the property 'key', so use another '_optionKey' to pass
567
+ // @ts-ignore skip SortableItem type check
567
568
  <SortableItem key={item.label} index={index} {...item} _optionKey={item.key} />
568
569
  ))}
569
570
  </div>
570
571
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
571
572
  // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
572
573
  ), { distance: 10 });
574
+ // @ts-ignore skip SortableItem type check
573
575
  const sortList = <SortableList useDragHandle onSortEnd={this.onSortEnd} items={selectedData} />;
574
576
  return sortList;
575
577
  }
package/tree/index.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable max-lines-per-function */
2
- import React, { MouseEvent } from 'react';
2
+ import React, { MouseEvent, KeyboardEvent } from 'react';
3
3
  import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
- import ConfigContext from '../configProvider/context';
5
+ import ConfigContext, { ContextValue } from '../configProvider/context';
6
6
  import TreeFoundation, { TreeAdapter } from '@douyinfe/semi-foundation/tree/foundation';
7
7
  import {
8
8
  convertDataToEntities,
@@ -143,6 +143,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
143
143
  dragNode: any;
144
144
  onNodeClick: any;
145
145
  onMotionEnd: any;
146
+ context: ContextValue;
146
147
 
147
148
  constructor(props: TreeProps) {
148
149
  super(props);
@@ -545,7 +546,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
545
546
  }
546
547
  };
547
548
 
548
- onNodeSelect = (e: MouseEvent, treeNode: TreeNodeProps) => {
549
+ onNodeSelect = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
549
550
  this.foundation.handleNodeSelect(e, treeNode);
550
551
  };
551
552
 
@@ -558,11 +559,11 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
558
559
  })
559
560
  );
560
561
 
561
- onNodeCheck = (e: MouseEvent, treeNode: TreeNodeProps) => {
562
+ onNodeCheck = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
562
563
  this.foundation.handleNodeSelect(e, treeNode);
563
564
  };
564
565
 
565
- onNodeExpand = (e: MouseEvent, treeNode: TreeNodeProps) => {
566
+ onNodeExpand = (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => {
566
567
  this.foundation.handleNodeExpand(e, treeNode);
567
568
  };
568
569
 
@@ -574,27 +575,27 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
574
575
  this.foundation.handleNodeDoubleClick(e, treeNode);
575
576
  };
576
577
 
577
- onNodeDragStart = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
578
+ onNodeDragStart = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
578
579
  this.foundation.handleNodeDragStart(e, treeNode);
579
580
  };
580
581
 
581
- onNodeDragEnter = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
582
+ onNodeDragEnter = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
582
583
  this.foundation.handleNodeDragEnter(e, treeNode, this.dragNode);
583
584
  };
584
585
 
585
- onNodeDragOver = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
586
+ onNodeDragOver = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
586
587
  this.foundation.handleNodeDragOver(e, treeNode, this.dragNode);
587
588
  };
588
589
 
589
- onNodeDragLeave = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
590
+ onNodeDragLeave = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
590
591
  this.foundation.handleNodeDragLeave(e, treeNode);
591
592
  };
592
593
 
593
- onNodeDragEnd = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
594
+ onNodeDragEnd = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
594
595
  this.foundation.handleNodeDragEnd(e, treeNode);
595
596
  };
596
597
 
597
- onNodeDrop = (e: React.DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => {
598
+ onNodeDrop = (e: React.DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => {
598
599
  this.foundation.handleNodeDrop(e, treeNode, this.dragNode);
599
600
  };
600
601
 
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, MouseEvent, DragEvent } from 'react';
1
+ import React, { ReactNode, MouseEvent, DragEvent, KeyboardEvent } from 'react';
2
2
  import { Virtualize, ExpandAction } from '@douyinfe/semi-foundation/tree/foundation';
3
3
  import {
4
4
  TreeNodeData,
@@ -17,18 +17,18 @@ export interface TreeContextValue {
17
17
  filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string) => void);
18
18
  keyEntities?: KeyEntities;
19
19
  onNodeClick?: any;
20
- onNodeExpand?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
21
- onNodeSelect?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
22
- onNodeCheck?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
20
+ onNodeExpand?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
21
+ onNodeSelect?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
22
+ onNodeCheck?: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
23
23
  onNodeRightClick?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
24
24
  onNodeDoubleClick?: (e: MouseEvent, treeNode: TreeNodeProps) => void;
25
25
  renderTreeNode?: (treeNode: FlattenNode, ind?: number, style?: React.CSSProperties) => ReactNode;
26
- onNodeDragStart?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
27
- onNodeDragEnter?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
28
- onNodeDragOver?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
29
- onNodeDragLeave?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
30
- onNodeDragEnd?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
31
- onNodeDrop?: (e: DragEvent<HTMLDivElement>, treeNode: TreeNodeProps) => void;
26
+ onNodeDragStart?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
27
+ onNodeDragEnter?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
28
+ onNodeDragOver?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
29
+ onNodeDragLeave?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
30
+ onNodeDragEnd?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
31
+ onNodeDrop?: (e: DragEvent<HTMLLIElement>, treeNode: TreeNodeProps) => void;
32
32
  expandAction?: ExpandAction;
33
33
  directory?: boolean;
34
34
  multiple?: boolean;
package/tree/treeNode.tsx CHANGED
@@ -6,7 +6,7 @@ import isEnterPress from '@douyinfe/semi-foundation/utils/isEnterPress';
6
6
  import { debounce, isFunction, isString, get, isEmpty } from 'lodash';
7
7
  import { IconTreeTriangleDown, IconFile, IconFolder, IconFolderOpen } from '@douyinfe/semi-icons';
8
8
  import { Checkbox } from '../checkbox';
9
- import TreeContext from './treeContext';
9
+ import TreeContext, { TreeContextValue } from './treeContext';
10
10
  import Spin from '../spin';
11
11
  import { TreeNodeProps, TreeNodeState } from './interface';
12
12
 
@@ -42,6 +42,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
42
42
 
43
43
  debounceSelect: any;
44
44
  refNode: HTMLElement;
45
+ context: TreeContextValue;
45
46
 
46
47
  constructor(props: TreeNodeProps) {
47
48
  super(props);
@@ -121,7 +122,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
121
122
  }
122
123
  };
123
124
 
124
- onDragStart = (e: React.DragEvent) => {
125
+ onDragStart = (e: React.DragEvent<HTMLLIElement>) => {
125
126
  const { onNodeDragStart } = this.context;
126
127
  e.stopPropagation();
127
128
  onNodeDragStart(e, { ...this.props, nodeInstance: this.refNode });
@@ -135,33 +136,33 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
135
136
  }
136
137
  };
137
138
 
138
- onDragEnter = (e: React.DragEvent) => {
139
+ onDragEnter = (e: React.DragEvent<HTMLLIElement>) => {
139
140
  const { onNodeDragEnter } = this.context;
140
141
  e.preventDefault();
141
142
  e.stopPropagation();
142
143
  onNodeDragEnter(e, { ...this.props, nodeInstance: this.refNode });
143
144
  };
144
145
 
145
- onDragOver = (e: React.DragEvent) => {
146
+ onDragOver = (e: React.DragEvent<HTMLLIElement>) => {
146
147
  const { onNodeDragOver } = this.context;
147
148
  e.preventDefault();
148
149
  e.stopPropagation();
149
150
  onNodeDragOver(e, { ...this.props, nodeInstance: this.refNode });
150
151
  };
151
152
 
152
- onDragLeave = (e: React.DragEvent) => {
153
+ onDragLeave = (e: React.DragEvent<HTMLLIElement>) => {
153
154
  const { onNodeDragLeave } = this.context;
154
155
  e.stopPropagation();
155
156
  onNodeDragLeave(e, { ...this.props, nodeInstance: this.refNode });
156
157
  };
157
158
 
158
- onDragEnd = (e: React.DragEvent) => {
159
+ onDragEnd = (e: React.DragEvent<HTMLLIElement>) => {
159
160
  const { onNodeDragEnd } = this.context;
160
161
  e.stopPropagation();
161
162
  onNodeDragEnd(e, { ...this.props, nodeInstance: this.refNode });
162
163
  };
163
164
 
164
- onDrop = (e: React.DragEvent) => {
165
+ onDrop = (e: React.DragEvent<HTMLLIElement>) => {
165
166
  const { onNodeDrop } = this.context;
166
167
  e.preventDefault();
167
168
  e.stopPropagation();
@@ -387,6 +388,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
387
388
  if (renderFullLabel) {
388
389
  const customLabel = renderFullLabel({ ...labelProps });
389
390
  if (draggable) {
391
+ // @ts-ignore skip cloneElement type check
390
392
  return React.cloneElement(customLabel, {
391
393
  ref: this.setRef,
392
394
  ...dragProps
@@ -396,6 +398,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
396
398
  return customLabel;
397
399
  } else {
398
400
  // In virtualization, props.style will contain location information
401
+ // @ts-ignore skip cloneElement type check
399
402
  return React.cloneElement(customLabel, {
400
403
  style: { ...get(customLabel, ['props', 'style']), ...style }
401
404
  });