@douyinfe/semi-ui 2.19.1-alpha.1 → 2.19.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (846) hide show
  1. package/dist/css/semi.css +88 -148
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +327 -128
  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/_base/base.css +1 -0
  8. package/lib/cjs/anchor/index.d.ts +4 -0
  9. package/lib/cjs/anchor/index.js +36 -1
  10. package/lib/cjs/anchor/link.d.ts +2 -0
  11. package/lib/cjs/anchor/link.js +8 -2
  12. package/lib/cjs/avatar/index.d.ts +1 -0
  13. package/lib/cjs/avatar/index.js +2 -1
  14. package/lib/cjs/button/Button.d.ts +1 -1
  15. package/lib/cjs/button/buttonGroup.d.ts +1 -0
  16. package/lib/cjs/button/buttonGroup.js +42 -3
  17. package/lib/cjs/button/index.d.ts +2 -1
  18. package/lib/cjs/button/index.js +1 -0
  19. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  20. package/lib/cjs/checkbox/checkbox.js +19 -10
  21. package/lib/cjs/checkbox/checkboxGroup.js +2 -1
  22. package/lib/cjs/dropdown/index.js +5 -1
  23. package/lib/cjs/form/baseForm.d.ts +1 -1
  24. package/lib/cjs/form/field.d.ts +1 -1
  25. package/lib/cjs/popconfirm/index.d.ts +4 -2
  26. package/lib/cjs/popconfirm/index.js +49 -31
  27. package/lib/cjs/radio/radio.d.ts +1 -0
  28. package/lib/cjs/radio/radio.js +22 -13
  29. package/lib/cjs/radio/radioGroup.js +1 -1
  30. package/lib/cjs/tag/group.js +14 -12
  31. package/lib/cjs/tag/index.d.ts +1 -1
  32. package/lib/cjs/tag/index.js +1 -1
  33. package/lib/cjs/tooltip/index.js +2 -2
  34. package/lib/cjs/typography/base.d.ts +1 -1
  35. package/lib/cjs/typography/paragraph.d.ts +1 -1
  36. package/lib/cjs/typography/text.d.ts +1 -1
  37. package/lib/cjs/typography/title.d.ts +2 -2
  38. package/lib/es/_base/base.css +1 -0
  39. package/lib/es/anchor/index.d.ts +4 -0
  40. package/lib/es/anchor/index.js +35 -1
  41. package/lib/es/anchor/link.d.ts +2 -0
  42. package/lib/es/anchor/link.js +8 -2
  43. package/lib/es/avatar/index.d.ts +1 -0
  44. package/lib/es/avatar/index.js +2 -1
  45. package/lib/es/button/Button.d.ts +1 -1
  46. package/lib/es/button/buttonGroup.d.ts +1 -0
  47. package/lib/es/button/buttonGroup.js +41 -1
  48. package/lib/es/button/index.d.ts +2 -1
  49. package/lib/es/button/index.js +1 -0
  50. package/lib/es/checkbox/checkbox.d.ts +1 -0
  51. package/lib/es/checkbox/checkbox.js +19 -10
  52. package/lib/es/checkbox/checkboxGroup.js +2 -1
  53. package/lib/es/dropdown/index.js +7 -1
  54. package/lib/es/form/baseForm.d.ts +1 -1
  55. package/lib/es/form/field.d.ts +1 -1
  56. package/lib/es/popconfirm/index.d.ts +4 -2
  57. package/lib/es/popconfirm/index.js +49 -31
  58. package/lib/es/radio/radio.d.ts +1 -0
  59. package/lib/es/radio/radio.js +22 -13
  60. package/lib/es/radio/radioGroup.js +1 -1
  61. package/lib/es/tag/group.js +14 -12
  62. package/lib/es/tag/index.d.ts +1 -1
  63. package/lib/es/tag/index.js +1 -1
  64. package/lib/es/tooltip/index.js +2 -2
  65. package/lib/es/typography/base.d.ts +1 -1
  66. package/lib/es/typography/paragraph.d.ts +1 -1
  67. package/lib/es/typography/text.d.ts +1 -1
  68. package/lib/es/typography/title.d.ts +2 -2
  69. package/package.json +12 -8
  70. package/_base/_story/a11y.jsx +0 -1302
  71. package/_base/_story/a11y.scss +0 -48
  72. package/_base/_story/index.scss +0 -11
  73. package/_base/_story/index.stories.js +0 -116
  74. package/_base/_story/index.stories.tsx +0 -55
  75. package/_base/base.scss +0 -3
  76. package/_base/base.ts +0 -36
  77. package/_base/baseComponent.tsx +0 -79
  78. package/_base/reactUtils.ts +0 -43
  79. package/_portal/_story/portal.stories.js +0 -13
  80. package/_portal/index.tsx +0 -113
  81. package/_test_/utils/dom/index.js +0 -9
  82. package/_test_/utils/function/index.js +0 -1
  83. package/_test_/utils/function/sleep.js +0 -9
  84. package/_test_/utils/index.js +0 -4
  85. package/_test_/utils/table/index.js +0 -310
  86. package/_test_/utils/tooltip/index.js +0 -39
  87. package/_utils/hooks/usePrevFocus.ts +0 -17
  88. package/_utils/index.ts +0 -198
  89. package/anchor/__test__/anchor.test.js +0 -60
  90. package/anchor/_story/anchor.stories.js +0 -288
  91. package/anchor/_story/anchor.stories.tsx +0 -165
  92. package/anchor/anchor-context.ts +0 -13
  93. package/anchor/index.tsx +0 -300
  94. package/anchor/link.tsx +0 -161
  95. package/autoComplete/__test__/autoComplete.test.js +0 -456
  96. package/autoComplete/_story/CustomTrigger/index.jsx +0 -106
  97. package/autoComplete/_story/autoComplete.stories.js +0 -348
  98. package/autoComplete/_story/autoComplete.stories.tsx +0 -87
  99. package/autoComplete/index.tsx +0 -504
  100. package/autoComplete/option.tsx +0 -164
  101. package/avatar/__test__/avatar.test.js +0 -363
  102. package/avatar/__test__/avatarGroup.test.js +0 -193
  103. package/avatar/_story/Demo.tsx +0 -22
  104. package/avatar/_story/avatar.stories.js +0 -248
  105. package/avatar/_story/avatar.stories.tsx +0 -7
  106. package/avatar/avatarGroup.tsx +0 -93
  107. package/avatar/index.tsx +0 -236
  108. package/avatar/interface.ts +0 -51
  109. package/backtop/__test__/backtop.test.js +0 -49
  110. package/backtop/_story/backtop.stories.js +0 -37
  111. package/backtop/_story/backtop.stories.tsx +0 -30
  112. package/backtop/index.tsx +0 -117
  113. package/badge/__test__/badge.test.js +0 -123
  114. package/badge/_story/Demo.tsx +0 -16
  115. package/badge/_story/badge.stories.js +0 -123
  116. package/badge/_story/badge.stories.tsx +0 -8
  117. package/badge/index.tsx +0 -91
  118. package/banner/__test__/banner.test.js +0 -58
  119. package/banner/_story/Demo.tsx +0 -14
  120. package/banner/_story/banner.stories.js +0 -106
  121. package/banner/_story/banner.stories.tsx +0 -8
  122. package/banner/index.tsx +0 -174
  123. package/breadcrumb/__test__/breadcrumb.test.js +0 -219
  124. package/breadcrumb/_story/Demo.tsx +0 -24
  125. package/breadcrumb/_story/breadcrumb.stories.js +0 -331
  126. package/breadcrumb/_story/breadcrumb.stories.tsx +0 -45
  127. package/breadcrumb/bread-context.tsx +0 -13
  128. package/breadcrumb/index.tsx +0 -302
  129. package/breadcrumb/item.tsx +0 -215
  130. package/button/Button.tsx +0 -133
  131. package/button/__test__/button.test.js +0 -71
  132. package/button/_story/Demo.tsx +0 -51
  133. package/button/_story/button.stories.js +0 -293
  134. package/button/_story/button.stories.tsx +0 -10
  135. package/button/buttonGroup.tsx +0 -56
  136. package/button/index.tsx +0 -38
  137. package/button/splitButtonGroup.tsx +0 -30
  138. package/calendar/__test__/calendar.test.js +0 -182
  139. package/calendar/_story/Demo.tsx +0 -20
  140. package/calendar/_story/calendar.stories.js +0 -560
  141. package/calendar/_story/calendar.stories.tsx +0 -5
  142. package/calendar/dayCalendar.tsx +0 -191
  143. package/calendar/dayCol.tsx +0 -156
  144. package/calendar/index.tsx +0 -63
  145. package/calendar/interface.ts +0 -43
  146. package/calendar/monthCalendar.tsx +0 -400
  147. package/calendar/rangeCalendar.tsx +0 -270
  148. package/calendar/timeCol.tsx +0 -64
  149. package/calendar/weekCalendar.tsx +0 -271
  150. package/card/__test__/card.test.js +0 -202
  151. package/card/_story/card.stories.js +0 -562
  152. package/card/_story/card.stories.tsx +0 -103
  153. package/card/cardGroup.tsx +0 -64
  154. package/card/index.tsx +0 -249
  155. package/card/meta.tsx +0 -73
  156. package/carousel/CarouselArrow.tsx +0 -64
  157. package/carousel/CarouselIndicator.tsx +0 -83
  158. package/carousel/__test__/carousel.test.js +0 -159
  159. package/carousel/_story/carousel.stories.js +0 -486
  160. package/carousel/index.tsx +0 -293
  161. package/carousel/interface.ts +0 -63
  162. package/cascader/__test__/cascader.test.js +0 -1356
  163. package/cascader/_story/CustomTrigger/index.jsx +0 -63
  164. package/cascader/_story/Demo.tsx +0 -63
  165. package/cascader/_story/cascader.stories.js +0 -1585
  166. package/cascader/_story/cascader.stories.tsx +0 -6
  167. package/cascader/index.tsx +0 -999
  168. package/cascader/item.tsx +0 -328
  169. package/checkbox/__test__/checkbox.test.js +0 -85
  170. package/checkbox/__test__/checkboxGroup.test.js +0 -180
  171. package/checkbox/_story/Demo.tsx +0 -27
  172. package/checkbox/_story/checkbox.stories.js +0 -1022
  173. package/checkbox/_story/checkbox.stories.tsx +0 -8
  174. package/checkbox/checkbox.tsx +0 -290
  175. package/checkbox/checkboxGroup.tsx +0 -197
  176. package/checkbox/checkboxInner.tsx +0 -129
  177. package/checkbox/context.ts +0 -14
  178. package/checkbox/index.tsx +0 -19
  179. package/collapse/__test__/collapse.test.js +0 -168
  180. package/collapse/_story/Demo.tsx +0 -28
  181. package/collapse/_story/accordion.stories.js +0 -143
  182. package/collapse/_story/accordion.stories.tsx +0 -8
  183. package/collapse/collapse-context.tsx +0 -18
  184. package/collapse/index.tsx +0 -120
  185. package/collapse/item.tsx +0 -163
  186. package/collapsible/_story/Demo.tsx +0 -41
  187. package/collapsible/_story/Nested/index.js +0 -101
  188. package/collapsible/_story/collapsible.stories.js +0 -588
  189. package/collapsible/_story/collapsible.stories.tsx +0 -7
  190. package/collapsible/index.tsx +0 -165
  191. package/configProvider/_story/ChangeTimeZone/index.js +0 -183
  192. package/configProvider/_story/GetPopupContainer/index.js +0 -194
  193. package/configProvider/_story/RTLDirection/RTLForm.jsx +0 -313
  194. package/configProvider/_story/RTLDirection/RTLTable.jsx +0 -94
  195. package/configProvider/_story/RTLDirection/RTLWrapper.tsx +0 -27
  196. package/configProvider/_story/configProvider.stories.js +0 -30
  197. package/configProvider/_story/configProvider.stories.tsx +0 -27
  198. package/configProvider/context.tsx +0 -14
  199. package/configProvider/index.tsx +0 -48
  200. package/datePicker/__test__/datePicker.test.js +0 -1065
  201. package/datePicker/_story/AllTypes/index.js +0 -19
  202. package/datePicker/_story/AutoSwitchDate/index.jsx +0 -14
  203. package/datePicker/_story/Autofocus/index.js +0 -11
  204. package/datePicker/_story/BetterRangePicker/index.jsx +0 -172
  205. package/datePicker/_story/Callbacks/index.jsx +0 -24
  206. package/datePicker/_story/ControlledDemo/index.js +0 -149
  207. package/datePicker/_story/CustomTrigger/index.jsx +0 -36
  208. package/datePicker/_story/Cycled/index.jsx +0 -11
  209. package/datePicker/_story/DateOffset/index.js +0 -83
  210. package/datePicker/_story/DatePickerSlot/index.jsx +0 -83
  211. package/datePicker/_story/DatePickerSlot/index.scss +0 -7
  212. package/datePicker/_story/DatePickerTimeZone/index.jsx +0 -27
  213. package/datePicker/_story/Density/index.jsx +0 -69
  214. package/datePicker/_story/DisabledDate/index.js +0 -189
  215. package/datePicker/_story/ExceptionDemo/index.js +0 -20
  216. package/datePicker/_story/Multiple/index.jsx +0 -24
  217. package/datePicker/_story/NeedConfirm/index.jsx +0 -94
  218. package/datePicker/_story/OnChangeWithDateFirst/index.jsx +0 -37
  219. package/datePicker/_story/OverPopover/index.jsx +0 -22
  220. package/datePicker/_story/RenderDate/index.js +0 -31
  221. package/datePicker/_story/RenderFullDate/index.js +0 -78
  222. package/datePicker/_story/RenderFullDate/index.scss +0 -23
  223. package/datePicker/_story/SyncSwitchMonth/index.js +0 -45
  224. package/datePicker/_story/TimePickerOpts/index.jsx +0 -16
  225. package/datePicker/_story/datePicker.stories.js +0 -1016
  226. package/datePicker/_story/datePicker.stories.tsx +0 -230
  227. package/datePicker/_story/v2/AutoFillTime.jsx +0 -37
  228. package/datePicker/_story/v2/FixDefaultPickerValue.jsx +0 -31
  229. package/datePicker/_story/v2/FixInputRangeFocus.jsx +0 -25
  230. package/datePicker/_story/v2/FixTriggerRender.tsx +0 -36
  231. package/datePicker/_story/v2/InputFormat.jsx +0 -29
  232. package/datePicker/_story/v2/InputFormatConfirm.jsx +0 -44
  233. package/datePicker/_story/v2/InputFormatDisabled.jsx +0 -27
  234. package/datePicker/_story/v2/InsetInput.jsx +0 -104
  235. package/datePicker/_story/v2/InsetInputE2E.jsx +0 -69
  236. package/datePicker/_story/v2/PanelOpen.jsx +0 -39
  237. package/datePicker/_story/v2/YearButton.jsx +0 -17
  238. package/datePicker/_story/v2/index.js +0 -11
  239. package/datePicker/dateInput.tsx +0 -455
  240. package/datePicker/datePicker.tsx +0 -796
  241. package/datePicker/footer.tsx +0 -29
  242. package/datePicker/index.tsx +0 -86
  243. package/datePicker/insetInput.tsx +0 -76
  244. package/datePicker/month.tsx +0 -395
  245. package/datePicker/monthsGrid.tsx +0 -649
  246. package/datePicker/navigation.tsx +0 -150
  247. package/datePicker/quickControl.tsx +0 -101
  248. package/datePicker/yearAndMonth.tsx +0 -254
  249. package/descriptions/__test__/descriptions.test.js +0 -193
  250. package/descriptions/_story/Demo.tsx +0 -36
  251. package/descriptions/_story/descriptions.stories.js +0 -145
  252. package/descriptions/_story/descriptions.stories.tsx +0 -6
  253. package/descriptions/descriptions-context.ts +0 -11
  254. package/descriptions/index.tsx +0 -82
  255. package/descriptions/item.tsx +0 -66
  256. package/divider/__test__/divider.test.js +0 -72
  257. package/divider/_story/Demo.tsx +0 -16
  258. package/divider/_story/divider.stories.js +0 -41
  259. package/divider/_story/divider.stories.tsx +0 -8
  260. package/divider/index.tsx +0 -76
  261. package/dropdown/__test__/dropdown.test.js +0 -308
  262. package/dropdown/_story/AutoClose/index.js +0 -120
  263. package/dropdown/_story/DisabledItem/index.js +0 -31
  264. package/dropdown/_story/InHoverElements/index.js +0 -25
  265. package/dropdown/_story/InHoverElements/index.scss +0 -16
  266. package/dropdown/_story/MultiDropdown/index.js +0 -34
  267. package/dropdown/_story/WrapAvatar/index.jsx +0 -10
  268. package/dropdown/_story/dropdown.stories.js +0 -331
  269. package/dropdown/_story/dropdown.stories.tsx +0 -28
  270. package/dropdown/_story/inTable/index.js +0 -194
  271. package/dropdown/context.ts +0 -13
  272. package/dropdown/dropdownDivider.tsx +0 -23
  273. package/dropdown/dropdownItem.tsx +0 -106
  274. package/dropdown/dropdownMenu.tsx +0 -51
  275. package/dropdown/dropdownTitle.tsx +0 -37
  276. package/dropdown/index.tsx +0 -257
  277. package/empty/__test__/empty.test.js +0 -63
  278. package/empty/_story/Demo.tsx +0 -10
  279. package/empty/_story/empty.stories.js +0 -53
  280. package/empty/_story/empty.stories.tsx +0 -8
  281. package/empty/index.tsx +0 -135
  282. package/form/__test__/arrayField.test.js +0 -204
  283. package/form/__test__/baseForm/baseForm.test.js +0 -628
  284. package/form/__test__/baseForm/onChange.test.js +0 -144
  285. package/form/__test__/errorMessage.test.js +0 -59
  286. package/form/__test__/field.test.js +0 -426
  287. package/form/__test__/formApi.test.js +0 -604
  288. package/form/__test__/group.test.js +0 -108
  289. package/form/__test__/hoc.test.js +0 -24
  290. package/form/__test__/label.test.js +0 -69
  291. package/form/__test__/section.test.js +0 -49
  292. package/form/__test__/slot.test.js +0 -108
  293. package/form/_story/Debug/bugDemo.jsx +0 -219
  294. package/form/_story/Debug/childDidMount.jsx +0 -30
  295. package/form/_story/Debug/myRadio.jsx +0 -32
  296. package/form/_story/DynamicField/arrayFieldDemo.jsx +0 -320
  297. package/form/_story/DynamicField/nestArrayField.jsx +0 -159
  298. package/form/_story/FieldProps/bigNumberFieldPath.jsx +0 -73
  299. package/form/_story/FieldProps/convert.jsx +0 -100
  300. package/form/_story/FieldProps/fieldRef.jsx +0 -74
  301. package/form/_story/FieldProps/helpAndExtra.jsx +0 -136
  302. package/form/_story/FieldProps/labelOptional.jsx +0 -30
  303. package/form/_story/FieldProps/pureField.jsx +0 -0
  304. package/form/_story/FieldProps/rulesUpdateDemo.js +0 -116
  305. package/form/_story/FormApi/arrayDemo.jsx +0 -94
  306. package/form/_story/FormApi/formApiDemo.jsx +0 -83
  307. package/form/_story/FormApi/resetDemo.jsx +0 -41
  308. package/form/_story/FormApi/setValuesDemo.jsx +0 -133
  309. package/form/_story/FormSubmit/index.tsx +0 -45
  310. package/form/_story/HOC/displayName.jsx +0 -19
  311. package/form/_story/HOC/withFieldDemo.jsx +0 -216
  312. package/form/_story/Hook/hookDemo.jsx +0 -195
  313. package/form/_story/Layout/layoutDemo.jsx +0 -348
  314. package/form/_story/Layout/modalFormDemo.jsx +0 -94
  315. package/form/_story/Layout/slotDemo.jsx +0 -126
  316. package/form/_story/Performance/performanceDemo.jsx +0 -440
  317. package/form/_story/Performance/selectUseReactNode.jsx +0 -110
  318. package/form/_story/Reference/inform.test.js +0 -110
  319. package/form/_story/Validate/validateDemo.jsx +0 -421
  320. package/form/_story/demo.jsx +0 -433
  321. package/form/_story/form.stories.js +0 -440
  322. package/form/_story/form.stories.tsx +0 -191
  323. package/form/arrayField.tsx +0 -200
  324. package/form/baseForm.tsx +0 -300
  325. package/form/context.tsx +0 -18
  326. package/form/errorMessage.tsx +0 -91
  327. package/form/field.tsx +0 -79
  328. package/form/group.tsx +0 -93
  329. package/form/hoc/withField.tsx +0 -604
  330. package/form/hoc/withFormApi.tsx +0 -11
  331. package/form/hoc/withFormState.tsx +0 -11
  332. package/form/hooks/index.ts +0 -12
  333. package/form/hooks/useArrayFieldState.tsx +0 -9
  334. package/form/hooks/useFieldApi.tsx +0 -21
  335. package/form/hooks/useFieldState.tsx +0 -18
  336. package/form/hooks/useFormApi.tsx +0 -7
  337. package/form/hooks/useFormState.tsx +0 -9
  338. package/form/hooks/useFormUpdater.tsx +0 -6
  339. package/form/hooks/useStateWithGetter.ts +0 -13
  340. package/form/index.tsx +0 -40
  341. package/form/interface.ts +0 -134
  342. package/form/label.tsx +0 -96
  343. package/form/section.tsx +0 -38
  344. package/form/slot.tsx +0 -167
  345. package/getBabelConfig.js +0 -25
  346. package/grid/__test__/calculateGutter.test.js +0 -50
  347. package/grid/_story/demo.scss +0 -23
  348. package/grid/_story/grid.stories.js +0 -290
  349. package/grid/_story/grid.stories.tsx +0 -15
  350. package/grid/col.tsx +0 -135
  351. package/grid/index.tsx +0 -7
  352. package/grid/row.tsx +0 -178
  353. package/gulpfile.js +0 -119
  354. package/iconButton/_story/iconButton.stories.tsx +0 -16
  355. package/iconButton/index.tsx +0 -134
  356. package/icons/_story/Others/add-template-icon.jsx +0 -0
  357. package/icons/_story/Others/add-template-icon.svg +0 -10
  358. package/icons/_story/Others/hangup.svg +0 -3
  359. package/icons/_story/Others/index.js +0 -24
  360. package/icons/_story/Others/xianglin.svg +0 -3
  361. package/icons/_story/icon.stories.js +0 -63
  362. package/icons/_story/icon.stories.tsx +0 -46
  363. package/icons/index.tsx +0 -5
  364. package/index.ts +0 -97
  365. package/input/__test__/input.test.js +0 -285
  366. package/input/__test__/textArea.test.js +0 -172
  367. package/input/_story/Demo.tsx +0 -33
  368. package/input/_story/TextareaDemo.tsx +0 -27
  369. package/input/_story/input.scss +0 -0
  370. package/input/_story/input.stories.js +0 -961
  371. package/input/_story/input.stories.tsx +0 -11
  372. package/input/index.tsx +0 -515
  373. package/input/inputGroup.tsx +0 -127
  374. package/input/textarea.tsx +0 -339
  375. package/inputNumber/__test__/inputNumber.test.js +0 -434
  376. package/inputNumber/_story/input.stories.tsx +0 -17
  377. package/inputNumber/_story/inputNumber.scss +0 -10
  378. package/inputNumber/_story/inputNumber.stories.js +0 -767
  379. package/inputNumber/index.tsx +0 -518
  380. package/layout/Sider.tsx +0 -122
  381. package/layout/__test__/layout.test.js +0 -51
  382. package/layout/_story/layout.stories.js +0 -305
  383. package/layout/_story/layout.stories.tsx +0 -13
  384. package/layout/index.tsx +0 -129
  385. package/layout/layout-context.ts +0 -18
  386. package/list/__test__/list.test.js +0 -264
  387. package/list/_story/list.stories.js +0 -920
  388. package/list/_story/list.stories.tsx +0 -26
  389. package/list/index.tsx +0 -186
  390. package/list/item.tsx +0 -113
  391. package/list/list-context.ts +0 -15
  392. package/locale/README.md +0 -53
  393. package/locale/_story/locale.stories.js +0 -221
  394. package/locale/_story/locale.stories.tsx +0 -57
  395. package/locale/context.tsx +0 -5
  396. package/locale/interface.ts +0 -155
  397. package/locale/localeConsumer.tsx +0 -58
  398. package/locale/localeProvider.tsx +0 -35
  399. package/locale/source/ar.ts +0 -159
  400. package/locale/source/de.ts +0 -159
  401. package/locale/source/en_GB.ts +0 -159
  402. package/locale/source/en_US.ts +0 -159
  403. package/locale/source/es.ts +0 -163
  404. package/locale/source/fr.ts +0 -159
  405. package/locale/source/id_ID.ts +0 -160
  406. package/locale/source/it.ts +0 -159
  407. package/locale/source/ja_JP.ts +0 -160
  408. package/locale/source/ko_KR.ts +0 -160
  409. package/locale/source/ms_MY.ts +0 -159
  410. package/locale/source/pt_BR.ts +0 -167
  411. package/locale/source/ru_RU.ts +0 -162
  412. package/locale/source/th_TH.ts +0 -163
  413. package/locale/source/tr_TR.ts +0 -159
  414. package/locale/source/vi_VN.ts +0 -162
  415. package/locale/source/zh_CN.ts +0 -160
  416. package/locale/source/zh_TW.ts +0 -160
  417. package/modal/ConfirmModal.tsx +0 -89
  418. package/modal/Modal.tsx +0 -417
  419. package/modal/ModalContent.tsx +0 -337
  420. package/modal/__test__/confirm.test.js +0 -203
  421. package/modal/__test__/modal.test.js +0 -324
  422. package/modal/_story/CollapsibleInModal/index.jsx +0 -100
  423. package/modal/_story/DynamicContext/context.js +0 -8
  424. package/modal/_story/DynamicContext/index.jsx +0 -30
  425. package/modal/_story/__snapshots__/modal.stories.tsx.snap +0 -203
  426. package/modal/_story/modal.stories.js +0 -343
  427. package/modal/_story/modal.stories.tsx +0 -41
  428. package/modal/confirm.tsx +0 -120
  429. package/modal/index.tsx +0 -13
  430. package/modal/useModal/HookModal.tsx +0 -63
  431. package/modal/useModal/index.tsx +0 -80
  432. package/motions/Rotate.tsx +0 -64
  433. package/navigation/CollapseButton.tsx +0 -47
  434. package/navigation/Footer.tsx +0 -74
  435. package/navigation/Header.tsx +0 -82
  436. package/navigation/Item.tsx +0 -293
  437. package/navigation/OpenIconTransition.tsx +0 -58
  438. package/navigation/README.md +0 -10
  439. package/navigation/SubNav.tsx +0 -389
  440. package/navigation/SubNavTransition.tsx +0 -58
  441. package/navigation/__test__/navigation.test.js +0 -274
  442. package/navigation/_story/AutoOpen/index.js +0 -69
  443. package/navigation/_story/ControlledSelectedKeys/index.js +0 -78
  444. package/navigation/_story/DisabledNav/index.js +0 -46
  445. package/navigation/_story/ItemsChange/index.js +0 -41
  446. package/navigation/_story/LinkNav/index.jsx +0 -90
  447. package/navigation/_story/MountUnmount/index.js +0 -57
  448. package/navigation/_story/WithChildren/index.js +0 -119
  449. package/navigation/_story/WithRouter/index.js +0 -111
  450. package/navigation/_story/navigation.stories.js +0 -330
  451. package/navigation/_story/navigation.stories.tsx +0 -101
  452. package/navigation/index.tsx +0 -427
  453. package/navigation/nav-context.ts +0 -30
  454. package/notification/NoticeTransition.tsx +0 -68
  455. package/notification/__test__/notification.test.js +0 -325
  456. package/notification/_story/Demo.tsx +0 -29
  457. package/notification/_story/notification.stories.js +0 -225
  458. package/notification/_story/notification.stories.tsx +0 -6
  459. package/notification/_story/useNotification/context.js +0 -3
  460. package/notification/_story/useNotification/index.jsx +0 -43
  461. package/notification/index.tsx +0 -267
  462. package/notification/notice.tsx +0 -204
  463. package/notification/useNotification/HookNotice.tsx +0 -36
  464. package/notification/useNotification/index.tsx +0 -94
  465. package/overflowList/__test__/overflowList.test.js +0 -31
  466. package/overflowList/_story/Demo.tsx +0 -36
  467. package/overflowList/_story/overflowList.stories.js +0 -400
  468. package/overflowList/_story/overflowList.stories.tsx +0 -7
  469. package/overflowList/index.tsx +0 -279
  470. package/overflowList/intersectionObserver.tsx +0 -94
  471. package/pagination/__test__/pagination.test.js +0 -255
  472. package/pagination/_story/pagination.stories.js +0 -159
  473. package/pagination/_story/pagination.stories.tsx +0 -11
  474. package/pagination/index.tsx +0 -476
  475. package/popconfirm/__test__/popconfirm.test.js +0 -131
  476. package/popconfirm/_story/DynamicDisable/index.jsx +0 -25
  477. package/popconfirm/_story/InTable/index.js +0 -75
  478. package/popconfirm/_story/ShowArrow/index.jsx +0 -141
  479. package/popconfirm/_story/TitlePopconfirm/index.js +0 -130
  480. package/popconfirm/_story/TypesConfirm/index.jsx +0 -121
  481. package/popconfirm/_story/popconfirm.stories.js +0 -170
  482. package/popconfirm/_story/popconfirm.stories.tsx +0 -20
  483. package/popconfirm/index.tsx +0 -249
  484. package/popover/Arrow.tsx +0 -66
  485. package/popover/__test__/popover.test.js +0 -52
  486. package/popover/_story/ArrowPointAtCenter/index.jsx +0 -138
  487. package/popover/_story/BtnClose/index.jsx +0 -80
  488. package/popover/_story/NestedPopover/index.js +0 -41
  489. package/popover/_story/PopRight/index.js +0 -25
  490. package/popover/_story/PopRight/index.scss +0 -25
  491. package/popover/_story/SelectInPopover/index.jsx +0 -38
  492. package/popover/_story/popover.stories.js +0 -684
  493. package/popover/_story/popover.stories.tsx +0 -53
  494. package/popover/index.tsx +0 -182
  495. package/progress/__test__/progress.test.js +0 -127
  496. package/progress/_story/progress.stories.js +0 -71
  497. package/progress/_story/progress.stories.tsx +0 -11
  498. package/progress/index.tsx +0 -283
  499. package/radio/__test__/radio.test.jsx +0 -91
  500. package/radio/__test__/radioGroup.test.jsx +0 -207
  501. package/radio/_story/Demo.tsx +0 -34
  502. package/radio/_story/radio.scss +0 -4
  503. package/radio/_story/radio.stories.js +0 -892
  504. package/radio/_story/radio.stories.tsx +0 -7
  505. package/radio/context.ts +0 -25
  506. package/radio/index.tsx +0 -12
  507. package/radio/radio.tsx +0 -320
  508. package/radio/radioGroup.tsx +0 -240
  509. package/radio/radioInner.tsx +0 -151
  510. package/rating/__test__/rating.test.js +0 -247
  511. package/rating/_story/rating.stories.js +0 -108
  512. package/rating/_story/rating.stories.tsx +0 -11
  513. package/rating/index.tsx +0 -345
  514. package/rating/item.tsx +0 -233
  515. package/resizeObserver/index.tsx +0 -115
  516. package/scripts/compileDist.js +0 -52
  517. package/scripts/compileLib.js +0 -13
  518. package/scripts/compileScss.js +0 -25
  519. package/scrollList/__test__/scrollList.test.js +0 -226
  520. package/scrollList/_story/ScrollList/index.js +0 -69
  521. package/scrollList/_story/SingleWheelList/index.js +0 -72
  522. package/scrollList/_story/WheelList/index.js +0 -119
  523. package/scrollList/_story/scrolllist.stories.js +0 -33
  524. package/scrollList/_story/scrolllist.stories.tsx +0 -131
  525. package/scrollList/index.tsx +0 -81
  526. package/scrollList/scrollItem.tsx +0 -540
  527. package/select/__test__/select.test.js +0 -1323
  528. package/select/_story/CustomTrigger/index.jsx +0 -21
  529. package/select/_story/select.scss +0 -51
  530. package/select/_story/select.stories.js +0 -2988
  531. package/select/_story/select.stories.tsx +0 -195
  532. package/select/index.tsx +0 -1239
  533. package/select/option.tsx +0 -166
  534. package/select/optionGroup.tsx +0 -42
  535. package/select/utils.tsx +0 -76
  536. package/select/virtualRow.tsx +0 -13
  537. package/sideSheet/SideSheetContent.tsx +0 -177
  538. package/sideSheet/SideSheetTransition.tsx +0 -104
  539. package/sideSheet/__test__/sideSheet.test.js +0 -319
  540. package/sideSheet/_story/sideSheet.stories.js +0 -379
  541. package/sideSheet/_story/sideSheet.stories.tsx +0 -48
  542. package/sideSheet/index.tsx +0 -270
  543. package/skeleton/__test__/skeleton.test.js +0 -32
  544. package/skeleton/_story/skeleton.stories.js +0 -82
  545. package/skeleton/_story/skeleton.stories.tsx +0 -61
  546. package/skeleton/index.tsx +0 -62
  547. package/skeleton/item.tsx +0 -82
  548. package/slider/__test__/__snapshots__/slider.test.js.snap +0 -5
  549. package/slider/__test__/slider.test.js +0 -164
  550. package/slider/_story/Demo.scss +0 -3
  551. package/slider/_story/Demo.tsx +0 -28
  552. package/slider/_story/slider.stories.js +0 -428
  553. package/slider/_story/slider.stories.tsx +0 -7
  554. package/slider/index.tsx +0 -635
  555. package/space/__test__/space.test.js +0 -99
  556. package/space/_story/space.stories.js +0 -254
  557. package/space/_story/space.stories.tsx +0 -26
  558. package/space/index.tsx +0 -95
  559. package/space/utils.ts +0 -24
  560. package/spin/__test__/spin.test.js +0 -46
  561. package/spin/_story/Demo.tsx +0 -10
  562. package/spin/_story/spin.stories.js +0 -92
  563. package/spin/_story/spin.stories.tsx +0 -6
  564. package/spin/icon.tsx +0 -55
  565. package/spin/index.tsx +0 -137
  566. package/steps/__test__/steps.test.js +0 -372
  567. package/steps/_story/steps.stories.js +0 -306
  568. package/steps/_story/steps.stories.tsx +0 -17
  569. package/steps/basicStep.tsx +0 -141
  570. package/steps/basicSteps.tsx +0 -111
  571. package/steps/context.ts +0 -7
  572. package/steps/fillStep.tsx +0 -128
  573. package/steps/fillSteps.tsx +0 -98
  574. package/steps/index.tsx +0 -69
  575. package/steps/navStep.tsx +0 -74
  576. package/steps/navSteps.tsx +0 -74
  577. package/steps/step.tsx +0 -37
  578. package/switch/__test__/switch.test.js +0 -128
  579. package/switch/_story/switch.stories.js +0 -161
  580. package/switch/_story/switch.stories.tsx +0 -124
  581. package/switch/index.tsx +0 -185
  582. package/table/Body/BaseRow.tsx +0 -400
  583. package/table/Body/ExpandedRow.tsx +0 -157
  584. package/table/Body/SectionRow.tsx +0 -202
  585. package/table/Body/index.tsx +0 -859
  586. package/table/ColGroup.tsx +0 -66
  587. package/table/Column.tsx +0 -17
  588. package/table/ColumnFilter.tsx +0 -210
  589. package/table/ColumnSelection.tsx +0 -91
  590. package/table/ColumnShape.ts +0 -33
  591. package/table/ColumnSorter.tsx +0 -81
  592. package/table/CustomExpandIcon.tsx +0 -100
  593. package/table/HeadTable.tsx +0 -120
  594. package/table/ResizableHeaderCell.tsx +0 -44
  595. package/table/ResizableTable.tsx +0 -176
  596. package/table/Table.tsx +0 -1413
  597. package/table/TableCell.tsx +0 -367
  598. package/table/TableContextProvider.tsx +0 -53
  599. package/table/TableHeader.tsx +0 -183
  600. package/table/TableHeaderRow.tsx +0 -196
  601. package/table/TablePagination.tsx +0 -52
  602. package/table/__test__/table.test.js +0 -1952
  603. package/table/_story/BetterScrollbar.tsx +0 -115
  604. package/table/_story/ChildrenData/index.js +0 -251
  605. package/table/_story/ChildrenDataInnerSelected/index.js +0 -221
  606. package/table/_story/ChildrenDataSelected/index.js +0 -247
  607. package/table/_story/ControlledPagination/index.jsx +0 -232
  608. package/table/_story/ControlledSortOrder/index.jsx +0 -85
  609. package/table/_story/CustomComponents/index.js +0 -101
  610. package/table/_story/CustomExpandIcons/index.js +0 -97
  611. package/table/_story/CustomFilterDropdownItem/index.jsx +0 -98
  612. package/table/_story/DefaultSortOrder.tsx +0 -120
  613. package/table/_story/Demos/columnRender.jsx +0 -131
  614. package/table/_story/Demos/controlledPagination.jsx +0 -125
  615. package/table/_story/Demos/customFilter.jsx +0 -110
  616. package/table/_story/Demos/default.jsx +0 -82
  617. package/table/_story/Demos/dynamic.jsx +0 -594
  618. package/table/_story/Demos/expand.jsx +0 -114
  619. package/table/_story/Demos/filterAndSorter.jsx +0 -102
  620. package/table/_story/Demos/fixed.jsx +0 -117
  621. package/table/_story/Demos/fullRender.jsx +0 -131
  622. package/table/_story/Demos/group.jsx +0 -109
  623. package/table/_story/Demos/headerMerge.jsx +0 -121
  624. package/table/_story/Demos/headerMergeJSX.jsx +0 -83
  625. package/table/_story/Demos/infiniteScroll.jsx +0 -118
  626. package/table/_story/Demos/onRow.jsx +0 -114
  627. package/table/_story/Demos/pagination.jsx +0 -101
  628. package/table/_story/Demos/resizable copy.jsx +0 -102
  629. package/table/_story/Demos/resizable.jsx +0 -183
  630. package/table/_story/Demos/rowSelection.jsx +0 -130
  631. package/table/_story/Demos/sortTree.jsx +0 -218
  632. package/table/_story/Demos/sortable.jsx +0 -183
  633. package/table/_story/Demos/span.jsx +0 -155
  634. package/table/_story/Demos/tree.jsx +0 -109
  635. package/table/_story/Demos/treeSelect.jsx +0 -196
  636. package/table/_story/Demos/virtualized.jsx +0 -103
  637. package/table/_story/Demos/zebra.jsx +0 -124
  638. package/table/_story/DragableTable/index.jsx +0 -156
  639. package/table/_story/DragableTable/index.scss +0 -7
  640. package/table/_story/DynamicFilters/data.json +0 -105
  641. package/table/_story/DynamicFilters/index.js +0 -78
  642. package/table/_story/DynamicTable/index.jsx +0 -569
  643. package/table/_story/EventTable/index.jsx +0 -76
  644. package/table/_story/Expand/index.js +0 -85
  645. package/table/_story/ExpandAllGroupRows/index.jsx +0 -90
  646. package/table/_story/ExpandAllRows/index.jsx +0 -111
  647. package/table/_story/ExpandRowByClick.jsx +0 -77
  648. package/table/_story/FilterWithNewDataTable/index.jsx +0 -108
  649. package/table/_story/FixAllColumnsWithoutWidth.tsx +0 -52
  650. package/table/_story/FixRenderReturnProps.jsx +0 -105
  651. package/table/_story/FixedExpandedRows/index.js +0 -105
  652. package/table/_story/FixedGroups/index.js +0 -80
  653. package/table/_story/FixedTable/index.js +0 -92
  654. package/table/_story/FnTable/index.js +0 -103
  655. package/table/_story/FullRender/index.jsx +0 -135
  656. package/table/_story/GroupedCols/index.jsx +0 -83
  657. package/table/_story/GroupedColsFixed/index.jsx +0 -95
  658. package/table/_story/GroupedColsFixedJSX/index.jsx +0 -122
  659. package/table/_story/GroupedColsFixedVirtualized/index.jsx +0 -107
  660. package/table/_story/GroupedColsFixedVirtualizedGroups/index.jsx +0 -110
  661. package/table/_story/GroupedRows/index.js +0 -83
  662. package/table/_story/GroupedRowsFixed/index.js +0 -81
  663. package/table/_story/InSideSheet/index.jsx +0 -90
  664. package/table/_story/InfiniteScroll/index.js +0 -115
  665. package/table/_story/JSXAsyncData/index.jsx +0 -47
  666. package/table/_story/JSXColumnPropColumn.jsx +0 -57
  667. package/table/_story/JSXColumnsComplex.jsx +0 -174
  668. package/table/_story/JSXColumnsNest.tsx +0 -74
  669. package/table/_story/JSXColumnsSmiple.jsx +0 -53
  670. package/table/_story/JSXFixedTable/index.js +0 -224
  671. package/table/_story/JSXTitles/index.js +0 -55
  672. package/table/_story/LinkedScroll/index.jsx +0 -137
  673. package/table/_story/LinkedScroll/index.scss +0 -0
  674. package/table/_story/MassiveColumns/index.jsx +0 -109
  675. package/table/_story/MassiveColumns/index.scss +0 -9
  676. package/table/_story/ModalTable/index.jsx +0 -228
  677. package/table/_story/PagintaionTable/index.js +0 -123
  678. package/table/_story/Perf/Render/complex.jsx +0 -191
  679. package/table/_story/Perf/Render/context.jsx +0 -72
  680. package/table/_story/Perf/Render/controlledSelection.jsx +0 -103
  681. package/table/_story/Perf/Render/index.jsx +0 -95
  682. package/table/_story/Perf/Render/onRow.jsx +0 -112
  683. package/table/_story/Perf/Render/resizableSelection.jsx +0 -193
  684. package/table/_story/Perf/Virtualized/index.jsx +0 -71
  685. package/table/_story/Perf/index.js +0 -8
  686. package/table/_story/RTL/AlignScrollBar.jsx +0 -17
  687. package/table/_story/RTL/index.js +0 -2
  688. package/table/_story/RenderPagination/index.jsx +0 -161
  689. package/table/_story/ResizableColumns/index.jsx +0 -95
  690. package/table/_story/ResizableColumns/index.scss +0 -30
  691. package/table/_story/ResizableTable/index.jsx +0 -85
  692. package/table/_story/ScrollBar/index.jsx +0 -71
  693. package/table/_story/SelectedRows/index.js +0 -137
  694. package/table/_story/TableSpan/index.jsx +0 -117
  695. package/table/_story/TabsTable/index.jsx +0 -78
  696. package/table/_story/TestClone/index.js +0 -0
  697. package/table/_story/VirtualTableOnCell/index.jsx +0 -84
  698. package/table/_story/VirtualizedDynamicData/index.jsx +0 -111
  699. package/table/_story/VirtualizedGroupedRows/index.jsx +0 -135
  700. package/table/_story/VirtualizedNotFixed/index.js +0 -89
  701. package/table/_story/VritualizedDataSelected/index.js +0 -273
  702. package/table/_story/WarnColumnWithoutDataIndex.tsx +0 -71
  703. package/table/_story/WithSideSheet/index.js +0 -82
  704. package/table/_story/data/big.json +0 -8205
  705. package/table/_story/data/big2.json +0 -42271
  706. package/table/_story/table.stories.js +0 -596
  707. package/table/_story/table.stories.tsx +0 -382
  708. package/table/_story/v2/FixedColumnsChange/index.jsx +0 -104
  709. package/table/_story/v2/FixedExpandedRow/index.jsx +0 -95
  710. package/table/_story/v2/FixedFilter/index.tsx +0 -106
  711. package/table/_story/v2/FixedHeaderMerge/index.jsx +0 -98
  712. package/table/_story/v2/FixedMemoryLeak/index.jsx +0 -33
  713. package/table/_story/v2/FixedOnHeaderRow/index.jsx +0 -137
  714. package/table/_story/v2/FixedResizable/index.jsx +0 -114
  715. package/table/_story/v2/FixedSorter/index.tsx +0 -102
  716. package/table/_story/v2/FixedVirtualizedEmpty.tsx +0 -76
  717. package/table/_story/v2/FixedZIndex/index.jsx +0 -87
  718. package/table/_story/v2/defaultFilteredValue.tsx +0 -114
  719. package/table/_story/v2/index.js +0 -12
  720. package/table/_story/v2/radioRowSelection.tsx +0 -107
  721. package/table/_story/virtualized/index.js +0 -92
  722. package/table/_story/virtualizedFixed/index.js +0 -131
  723. package/table/getColumns.tsx +0 -34
  724. package/table/index.tsx +0 -44
  725. package/table/interface.ts +0 -321
  726. package/table/table-context.ts +0 -32
  727. package/table/utils.ts +0 -123
  728. package/tabs/TabBar.tsx +0 -264
  729. package/tabs/TabPane.tsx +0 -128
  730. package/tabs/TabPaneTransition.tsx +0 -67
  731. package/tabs/__test__/tabs.test.js +0 -208
  732. package/tabs/_story/Demo.tsx +0 -39
  733. package/tabs/_story/search.jsx +0 -37
  734. package/tabs/_story/tabs.stories.js +0 -905
  735. package/tabs/_story/tabs.stories.tsx +0 -6
  736. package/tabs/index.tsx +0 -302
  737. package/tabs/interface.ts +0 -87
  738. package/tabs/tabs-context.ts +0 -6
  739. package/tag/_story/Demo.tsx +0 -22
  740. package/tag/_story/tag.stories.js +0 -290
  741. package/tag/_story/tag.stories.tsx +0 -6
  742. package/tag/group.tsx +0 -136
  743. package/tag/index.tsx +0 -163
  744. package/tag/interface.ts +0 -56
  745. package/tagInput/__test__/tagInput.test.js +0 -398
  746. package/tagInput/_story/tagInput.stories.js +0 -445
  747. package/tagInput/_story/tagInput.stories.tsx +0 -24
  748. package/tagInput/index.tsx +0 -612
  749. package/timePicker/Combobox.tsx +0 -336
  750. package/timePicker/PanelShape.ts +0 -8
  751. package/timePicker/TimeInput.tsx +0 -207
  752. package/timePicker/TimePicker.tsx +0 -550
  753. package/timePicker/TimeShape.ts +0 -19
  754. package/timePicker/__test__/timePicker.test.js +0 -322
  755. package/timePicker/_story/Callbacks/index.jsx +0 -24
  756. package/timePicker/_story/CustomTrigger/index.jsx +0 -35
  757. package/timePicker/_story/DisabledTime/index.jsx +0 -17
  758. package/timePicker/_story/timepicker.stories.js +0 -301
  759. package/timePicker/_story/timepicker.stories.tsx +0 -18
  760. package/timePicker/index.tsx +0 -47
  761. package/timeline/__test__/timeline.test.js +0 -253
  762. package/timeline/_story/timeline.stories.js +0 -235
  763. package/timeline/_story/timeline.stories.tsx +0 -15
  764. package/timeline/index.tsx +0 -97
  765. package/timeline/item.tsx +0 -83
  766. package/toast/ToastTransition.tsx +0 -43
  767. package/toast/__test__/toast-command-call.test.js +0 -63
  768. package/toast/__test__/toast.test.js +0 -104
  769. package/toast/_story/Demo.tsx +0 -22
  770. package/toast/_story/toast.stories.js +0 -139
  771. package/toast/_story/toast.stories.tsx +0 -7
  772. package/toast/index.tsx +0 -234
  773. package/toast/toast.tsx +0 -152
  774. package/toast/useToast/HookToast.tsx +0 -35
  775. package/toast/useToast/index.tsx +0 -79
  776. package/tooltip/ArrowBoundingShape.ts +0 -8
  777. package/tooltip/TooltipStyledTransition.tsx +0 -31
  778. package/tooltip/TriangleArrow.tsx +0 -12
  779. package/tooltip/TriangleArrowVertical.tsx +0 -12
  780. package/tooltip/__test__/tooltip.test.js +0 -364
  781. package/tooltip/_story/ArrowPointAtCenter/index.jsx +0 -137
  782. package/tooltip/_story/ContainerPosition/index.jsx +0 -15
  783. package/tooltip/_story/ContainerPosition/index.scss +0 -10
  784. package/tooltip/_story/CustomContainer/index.jsx +0 -39
  785. package/tooltip/_story/DangerousHtml/index.js +0 -30
  786. package/tooltip/_story/Edge/index.js +0 -16
  787. package/tooltip/_story/InTable/index.jsx +0 -86
  788. package/tooltip/_story/Safari/autoAdjust.js +0 -23
  789. package/tooltip/_story/ScrollDemo/index.js +0 -65
  790. package/tooltip/_story/story.scss +0 -50
  791. package/tooltip/_story/tooltip.stories.js +0 -1099
  792. package/tooltip/_story/tooltip.stories.tsx +0 -54
  793. package/tooltip/index.tsx +0 -737
  794. package/transfer/__test__/transfer.test.js +0 -324
  795. package/transfer/_story/transfer.scss +0 -124
  796. package/transfer/_story/transfer.stories.js +0 -787
  797. package/transfer/_story/transfer.stories.tsx +0 -80
  798. package/transfer/index.tsx +0 -667
  799. package/tree/__test__/autosizer.test.js +0 -102
  800. package/tree/__test__/tree.test.js +0 -927
  801. package/tree/__test__/treeMultiple.test.js +0 -687
  802. package/tree/__test__/treeNodeProps.test.js +0 -192
  803. package/tree/_story/BigData.jsx +0 -58
  804. package/tree/_story/Demo.tsx +0 -72
  805. package/tree/_story/bigDataGen.jsx +0 -98
  806. package/tree/_story/data.js +0 -3
  807. package/tree/_story/tree.stories.js +0 -2550
  808. package/tree/_story/tree.stories.tsx +0 -7
  809. package/tree/autoSizer.tsx +0 -86
  810. package/tree/collapse.tsx +0 -144
  811. package/tree/index.tsx +0 -798
  812. package/tree/interface.ts +0 -148
  813. package/tree/nodeList.tsx +0 -88
  814. package/tree/treeContext.tsx +0 -49
  815. package/tree/treeNode.tsx +0 -443
  816. package/tree/treeUtil.tsx +0 -14
  817. package/treeSelect/__test__/treeMultiple.test.js +0 -775
  818. package/treeSelect/__test__/treeSelect.test.js +0 -968
  819. package/treeSelect/_story/CustomTrigger/index.jsx +0 -47
  820. package/treeSelect/_story/Demo.tsx +0 -83
  821. package/treeSelect/_story/treeSelect.stories.js +0 -1658
  822. package/treeSelect/_story/treeSelect.stories.tsx +0 -7
  823. package/treeSelect/index.tsx +0 -1417
  824. package/trigger/__test__/trigger.test.js +0 -17
  825. package/trigger/index.tsx +0 -45
  826. package/tsconfig.json +0 -33
  827. package/typography/__test__/typography.test.js +0 -75
  828. package/typography/_story/typography.stories.js +0 -637
  829. package/typography/_story/typography.stories.tsx +0 -175
  830. package/typography/base.tsx +0 -634
  831. package/typography/copyable.tsx +0 -144
  832. package/typography/index.tsx +0 -24
  833. package/typography/interface.ts +0 -27
  834. package/typography/paragraph.tsx +0 -77
  835. package/typography/text.tsx +0 -68
  836. package/typography/title.tsx +0 -74
  837. package/typography/typography.tsx +0 -41
  838. package/typography/util.tsx +0 -140
  839. package/upload/__test__/dragUpload.test.js +0 -122
  840. package/upload/__test__/upload.test.js +0 -947
  841. package/upload/_story/upload.stories.js +0 -1111
  842. package/upload/_story/upload.stories.tsx +0 -16
  843. package/upload/fileCard.tsx +0 -283
  844. package/upload/index.tsx +0 -721
  845. package/upload/interface.ts +0 -64
  846. package/webpack.config.js +0 -96
@@ -1,1952 +0,0 @@
1
- import BaseTable from '../Table';
2
- import Table from '../index';
3
- import Column from '../Column';
4
- import {Tag, Tooltip} from '../../index';
5
- import {
6
- getColumns,
7
- getData,
8
- getGroupColumns,
9
- getGroupData,
10
- getJSXColumns,
11
- getNestColumns,
12
- getNestData,
13
- getRandomNumber,
14
- getTreeData,
15
- mount,
16
- sleep,
17
- } from '../../_test_/utils';
18
- import {BASE_CLASS_PREFIX} from '../../../semi-foundation/base/constants';
19
- import {IconStar} from '@douyinfe/semi-icons';
20
-
21
- /**
22
- * Table 需要测试的使用场景
23
- * ✅ JSX 写法
24
- * ✅ 行选择
25
- * ✅ 分页
26
- * ✅ 固定列
27
- * ✅ 排序
28
- * ✅ 筛选
29
- * ✅ 展开
30
- * ✅ 树形展示
31
- * ✅ 自定义行或单元格
32
- * ✅ 分组
33
- * ✅ 表头合并
34
- * ✅ 更新数据
35
- * ✅ 完全自定义渲染
36
- * ✅ 行列合并
37
- * ❌ 可伸缩列(不好测试)
38
- * ❌ 拖拽排序(不好测试)
39
- * ❌ 虚拟化
40
- */
41
-
42
- const dataTotalSize = 46;
43
- const data = getData(dataTotalSize);
44
- const columns = getColumns();
45
-
46
- function testAppearance(demo, params) {
47
- const {onRow, myCls, myClsIndex} = params; // check table wrapper
48
-
49
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-wrapper`).length).toBe(1); // check if has header
50
-
51
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-title`).length).toBe(1); // check if has footer
52
-
53
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-footer`).length).toBe(1); // check onRow
54
-
55
- expect(onRow.called).toBe(true);
56
- expect(
57
- demo
58
- .find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row`)
59
- .at(0)
60
- .hasClass(myCls)
61
- ).toBe(false);
62
- expect(
63
- demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row`).reduce((prev, item, index) => {
64
- if (item.hasClass(myCls)) {
65
- return index;
66
- } else {
67
- return prev;
68
- }
69
- }, -1)
70
- ).toBe(myClsIndex); // check pagination
71
-
72
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-pagination-outer`).length).toBe(1); // click page 2
73
-
74
- const curPage = 2;
75
- demo.find(`.${BASE_CLASS_PREFIX}-page li`)
76
- .at(curPage)
77
- .simulate('click');
78
- expect(demo.find(BaseTable).state('pagination')).toHaveProperty('currentPage', curPage);
79
- }
80
-
81
- describe(`Table`, () => {
82
- it(`test jsx columns appearance`, async () => {
83
- const myCls = `my-tr-class`;
84
- const myClsIndex = 2;
85
- const onRow = sinon.spy((record, index) => ({
86
- className: index === myClsIndex ? myCls : '',
87
- }));
88
- const columns = getJSXColumns();
89
- const demo = mount(
90
- <Table
91
- dataSource={data}
92
- onRow={onRow}
93
- title={() => 'Table Title'}
94
- footer={() => 'Table Footer'}
95
- children={columns}
96
- />
97
- );
98
- testAppearance(demo, {
99
- onRow,
100
- myCls,
101
- myClsIndex,
102
- });
103
- const newColumns = getJSXColumns();
104
- demo.setProps({
105
- children: newColumns,
106
- });
107
- testAppearance(demo, {
108
- onRow,
109
- myCls,
110
- myClsIndex,
111
- });
112
- demo.unmount();
113
- });
114
- it(`test object columns appearance`, async () => {
115
- const myCls = `my-tr-class`;
116
- const myClsIndex = 2;
117
- const onRow = sinon.spy((record, index) => ({
118
- className: index === myClsIndex ? myCls : '',
119
- }));
120
- const columns = getColumns();
121
- const demo = mount(
122
- <Table
123
- dataSource={data}
124
- onRow={onRow}
125
- title={() => 'Table Title'}
126
- footer={() => 'Table Footer'}
127
- columns={columns}
128
- />
129
- );
130
- testAppearance(demo, {
131
- onRow,
132
- myCls,
133
- myClsIndex,
134
- });
135
- const newColumns = getColumns();
136
- demo.setProps({
137
- columns: newColumns,
138
- });
139
- testAppearance(demo, {
140
- onRow,
141
- myCls,
142
- myClsIndex,
143
- });
144
- });
145
- it(`test dataSource change appearance`, async () => {
146
- const myCls = `my-tr-class`;
147
- const myClsIndex = 2;
148
- const onRow = sinon.spy((record, index) => ({
149
- className: index === myClsIndex ? myCls : '',
150
- }));
151
- const columns = getColumns();
152
- const data = getData(25);
153
- const demo = mount(
154
- <Table
155
- dataSource={data}
156
- onRow={onRow}
157
- title={() => 'Table Title'}
158
- footer={() => 'Table Footer'}
159
- columns={columns}
160
- />
161
- );
162
- testAppearance(demo, {
163
- onRow,
164
- myCls,
165
- myClsIndex,
166
- });
167
- const dataNum = getRandomNumber(100, 40);
168
- const newData = getData(dataNum);
169
- demo.setProps({
170
- dataSource: newData,
171
- });
172
- testAppearance(demo, {
173
- onRow,
174
- myCls,
175
- myClsIndex,
176
- });
177
- });
178
- it(`test selection`, async () => {
179
- const columns = getColumns();
180
- const selectedRowKeys = ['0'];
181
- const rowKey = 'key';
182
- const disabledKeys = ['4'];
183
- let rowSelection = {
184
- onChange: sinon.spy((selectedRowKeys, selectedRows) => {
185
- rowSelection = {...rowSelection, selectedRowKeys: [...selectedRowKeys]};
186
- demo.setProps({
187
- rowSelection,
188
- });
189
- }),
190
- onSelectAll: sinon.spy((selected, selectedRows, changedRows) => {
191
- rowSelection = {...rowSelection, selectedRowKeys: selected ? [...selectedRowKeys] : []};
192
- demo.setProps({
193
- rowSelection,
194
- });
195
- }),
196
- getCheckboxProps: sinon.spy(record => ({
197
- disabled: disabledKeys.includes(record[rowKey]),
198
- // Column configuration not to be checked
199
- name: record.name,
200
- })),
201
- onSelect: sinon.spy((record, selected) => {
202
- }),
203
- selectedRowKeys: ['3'],
204
- defaultSelectedRowKeys: ['0', '1'],
205
- };
206
- const demo = mount(<Table rowKey={rowKey} dataSource={data} columns={columns} rowSelection={rowSelection}/>);
207
- expect(demo.find(`.${BASE_CLASS_PREFIX}-checkbox`).length).toBeGreaterThan(0);
208
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-checkbox-inner-checked`).length).toBe(
209
- rowSelection.selectedRowKeys.length
210
- );
211
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-checkbox-indeterminate`).length).toBe(
212
- 1
213
- );
214
- expect(
215
- demo
216
- .find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-checkbox`)
217
- .map(el => el)
218
- .every((el, index) =>
219
- disabledKeys.includes(index.toString())
220
- ? el.hasClass(`${BASE_CLASS_PREFIX}-checkbox-disabled`)
221
- : true
222
- )
223
- ).toBeTruthy(); // click disabled checkbox
224
-
225
- demo.find(`.${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-checkbox-disabled`).simulate('click');
226
- expect(rowSelection.onSelect.notCalled).toBeTruthy(); // click first row checkbox
227
-
228
- demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-checkbox`)
229
- .at(0)
230
- .simulate('click');
231
- expect(rowSelection.onSelect.calledOnce).toBeTruthy(); // click table header checkbox and select all
232
-
233
- demo.find(
234
- `.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-selection .${BASE_CLASS_PREFIX}-checkbox`
235
- ).simulate('click');
236
- expect(rowSelection.onSelectAll.calledOnce).toBeTruthy();
237
- expect(demo.find(BaseTable).state('rowSelection')).toHaveProperty(
238
- 'selectedRowKeys',
239
- rowSelection.selectedRowKeys
240
- );
241
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-checkbox-inner-checked`).length).toBe(
242
- 1
243
- ); // click table header checkbox and deselect all
244
-
245
- demo.find(
246
- `.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-selection .${BASE_CLASS_PREFIX}-checkbox`
247
- ).simulate('click');
248
- expect(rowSelection.onSelectAll.calledTwice).toBeTruthy();
249
- expect(demo.find(BaseTable).state('rowSelection')).toHaveProperty('selectedRowKeys', []);
250
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-checkbox-inner-checked`).length).toBe(
251
- 0
252
- );
253
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-checkbox-indeterminate`).length).toBe(
254
- 0
255
- );
256
- });
257
- it(`test selection after data change`, async () => {
258
- const columns = getColumns();
259
- const selectedRowKeys = ['0'];
260
- const rowKey = 'key';
261
- const disabledKeys = ['4'];
262
- let rowSelection = {
263
- onSelectAll: sinon.spy((selected, selectedRows, changedRows) => {
264
- rowSelection = {...rowSelection, selectedRowKeys: selected ? [...selectedRowKeys] : []};
265
- demo.setProps({
266
- rowSelection,
267
- });
268
- }),
269
- getCheckboxProps: sinon.spy(record => ({
270
- disabled: disabledKeys.includes(record[rowKey]),
271
- // Column configuration not to be checked
272
- name: record.name,
273
- })),
274
- onSelect: sinon.spy((record, selected) => {
275
- }),
276
- };
277
- const demo = mount(<Table rowKey={rowKey} dataSource={data} columns={columns} rowSelection={rowSelection}/>);
278
- const newData = getData(50);
279
- demo.setProps({
280
- dataSource: newData,
281
- }); // click disabled checkbox
282
-
283
- demo.find(`.${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-checkbox-disabled`).simulate('click');
284
- expect(rowSelection.onSelect.notCalled).toBeTruthy(); // click first row checkbox
285
-
286
- demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-checkbox`)
287
- .at(0)
288
- .simulate('click');
289
- expect(rowSelection.onSelect.calledOnce).toBeTruthy(); // click table header checkbox and select all
290
-
291
- demo.find(
292
- `.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-selection .${BASE_CLASS_PREFIX}-checkbox`
293
- ).simulate('click');
294
- expect(rowSelection.onSelectAll.calledOnce).toBeTruthy(); // click table header checkbox and deselect all
295
-
296
- demo.find(
297
- `.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-selection .${BASE_CLASS_PREFIX}-checkbox`
298
- ).simulate('click');
299
- expect(rowSelection.onSelectAll.calledTwice).toBeTruthy();
300
- });
301
- it(`test expandedRowRender and fixed`, async () => {
302
- const columns = getColumns();
303
- const rowKey = 'key';
304
-
305
- const expandedRowRender = (record, index, expanded) => (
306
- <article
307
- style={{
308
- margin: 0,
309
- }}
310
- >
311
- <p>{record.description}</p>
312
- </article>
313
- );
314
-
315
- const unexpandableKey = '2';
316
- const demo = mount(
317
- <Table
318
- scroll={{
319
- x: '160%',
320
- y: 320,
321
- }}
322
- defaultExpandAllRows
323
- rowKey={rowKey}
324
- expandedRowRender={expandedRowRender}
325
- hideExpandedColumn={false}
326
- expandCellFixed={true}
327
- dataSource={data}
328
- columns={columns}
329
- rowExpandable={record => record[rowKey] !== unexpandableKey}
330
- />
331
- );
332
- const leftFixedCells = demo.find(`.${BASE_CLASS_PREFIX}-table-cell-fixed-left`);
333
- const rightFixedCells = demo.find(`.${BASE_CLASS_PREFIX}-table-cell-fixed-right`);
334
- expect(leftFixedCells.length).toBeGreaterThan(0);
335
- expect(rightFixedCells.length).toBeGreaterThan(0);
336
- expect(
337
- demo.find(`.${BASE_CLASS_PREFIX}-table-cell-fixed-left.${BASE_CLASS_PREFIX}-table-column-expand`).length
338
- ).toBeGreaterThan(0);
339
- const newData = getData(50);
340
- demo.setProps({
341
- dataSource: newData,
342
- });
343
- expect(
344
- demo.find(`.${BASE_CLASS_PREFIX}-table-cell-fixed-left.${BASE_CLASS_PREFIX}-table-column-expand`).length
345
- ).toBeGreaterThan(0);
346
- });
347
- it(`test tree data`, async () => {
348
- const rowKey = 'key';
349
- const childrenRecordName = 'children';
350
- const childrenData = getTreeData();
351
- let expandedRowKeys = [1];
352
- const onExpand = sinon.spy((expanded, record) => {
353
- const keySet = new Set([...expandedRowKeys]);
354
-
355
- if (expanded) {
356
- keySet.add(record[rowKey]);
357
- } else {
358
- keySet.delete(record[rowKey]);
359
- }
360
-
361
- expandedRowKeys = Array.from(keySet);
362
- demo.setProps({
363
- expandedRowKeys,
364
- });
365
- });
366
- const demo = mount(
367
- <Table
368
- rowKey={rowKey}
369
- childrenRecordName={childrenRecordName}
370
- expandedRowKeys={expandedRowKeys}
371
- columns={columns}
372
- dataSource={childrenData}
373
- onExpand={onExpand}
374
- />
375
- );
376
- const table = demo.find(BaseTable);
377
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row`).length).toBe(
378
- childrenData[0].children.length + childrenData.length
379
- ); // click 3rd row to expand row
380
-
381
- table
382
- .find(
383
- `.${BASE_CLASS_PREFIX}-table-body .${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-table-expand-icon`
384
- )
385
- .at(1)
386
- .simulate('click');
387
- expect(onExpand.calledOnce).toBeTruthy();
388
- expect(table.state(`expandedRowKeys`)).toEqual(expandedRowKeys); // click first expand button to collapse row
389
-
390
- table
391
- .find(
392
- `.${BASE_CLASS_PREFIX}-table-body .${BASE_CLASS_PREFIX}-table-row .${BASE_CLASS_PREFIX}-table-expand-icon`
393
- )
394
- .at(0)
395
- .simulate('click');
396
- expect(table.state('expandedRowKeys')).toEqual(expandedRowKeys);
397
- });
398
- it(`test grouped data`, async () => {
399
- const rowKey = record =>
400
- `${record.city && record.city.toLowerCase()}-${record.job && record.job.toLowerCase()}`;
401
-
402
- const data = [
403
- {
404
- city: 'Beijing',
405
- job: 'FE',
406
- department: 'IES',
407
- },
408
- {
409
- city: 'Beijing',
410
- job: 'BE',
411
- department: 'IES',
412
- },
413
- {
414
- city: 'Shanghai',
415
- job: 'Android',
416
- department: 'IES',
417
- },
418
- {
419
- city: 'Tokyo',
420
- job: 'Android',
421
- department: 'IES',
422
- },
423
- {
424
- city: 'Shanghai',
425
- job: 'IOS',
426
- department: 'EE',
427
- },
428
- {
429
- city: 'LA',
430
- job: 'SE',
431
- department: 'EE',
432
- },
433
- {
434
- city: 'Beijing',
435
- job: 'Android',
436
- department: 'EE',
437
- },
438
- {
439
- city: 'Tokyo',
440
- job: 'IOS',
441
- department: 'EE',
442
- },
443
- {
444
- city: 'Tokyo',
445
- job: 'SE',
446
- department: 'DATA',
447
- },
448
- {
449
- city: 'Shanghai',
450
- job: 'BE',
451
- department: 'DATA',
452
- },
453
- {
454
- city: 'LA',
455
- job: 'Android',
456
- department: 'DATA',
457
- },
458
- {
459
- city: 'LA',
460
- job: 'IOS',
461
- department: 'DATA',
462
- },
463
- ];
464
- const columns = [
465
- {
466
- dataIndex: 'city',
467
- title: 'City',
468
- width: 400,
469
- sorter: (a, b) => (a.city > b.city ? 1 : -1),
470
- },
471
- {
472
- dataIndex: 'job',
473
- title: 'Job',
474
- width: 200,
475
- filters: [
476
- {
477
- text: 'IOS',
478
- value: 'IOS',
479
- },
480
- {
481
- text: 'Android',
482
- value: 'Android',
483
- },
484
- ],
485
- onFilter: (value, record) => record.job && record.job.indexOf(value) === 0,
486
- },
487
- {
488
- dataIndex: 'department',
489
- title: 'Department',
490
- },
491
- ];
492
- const groupedRowClick = sinon.spy();
493
- const demo = mount(
494
- <Table
495
- dataSource={data}
496
- rowKey={rowKey}
497
- groupBy={'city'}
498
- columns={columns}
499
- renderGroupSection={groupKey => <strong>Jobs in {groupKey}:</strong>}
500
- onGroupedRow={(group, index) => ({
501
- onClick: groupedRowClick,
502
- })}
503
- clickGroupedRowToExpand
504
- scroll={{
505
- y: 480,
506
- }}
507
- />
508
- );
509
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-row-section`).length).toBe(4);
510
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-body .${BASE_CLASS_PREFIX}-table-row`).length).toBe(0);
511
- demo.find(`.${BASE_CLASS_PREFIX}-table-row-section`)
512
- .at(0)
513
- .simulate('click');
514
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-row`).length).toBeGreaterThan(0);
515
- });
516
- it(`test events: page, filter, sort`, async () => {
517
- const columns = [
518
- {
519
- title: 'Name',
520
- dataIndex: 'name',
521
- width: 150,
522
- filters: [
523
- {
524
- text: '名字包含"1"',
525
- value: '1',
526
- },
527
- {
528
- text: '名字包含"2"',
529
- value: '2',
530
- },
531
- ],
532
- onFilter: (value, record) => record.name.indexOf(value) > -1,
533
- },
534
- {
535
- title: 'Age',
536
- dataIndex: 'age',
537
- width: 150,
538
- sorter: (a, b) => (a.age - b.age > 0 ? 1 : -1),
539
- },
540
- {
541
- title: 'Address',
542
- dataIndex: 'address',
543
- },
544
- {
545
- render: (text, record) => (
546
- <Tooltip content={record.description}>
547
- <Tag color="green">Show Info</Tag>
548
- </Tooltip>
549
- ),
550
- width: 150,
551
- },
552
- ];
553
- let onChangeCalledCount = 0;
554
- const onChange = sinon.spy();
555
- const demo = mount(<Table dataSource={data} columns={columns} onChange={onChange}/>);
556
- demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-filter`).simulate('click');
557
- expect(demo.find(`.${BASE_CLASS_PREFIX}-dropdown`).length).toBe(1);
558
- expect(onChange.callCount).toBe(onChangeCalledCount); // click first filter
559
-
560
- demo.find(`.${BASE_CLASS_PREFIX}-dropdown .${BASE_CLASS_PREFIX}-dropdown-item`)
561
- .at(0)
562
- .find(`.${BASE_CLASS_PREFIX}-checkbox`)
563
- .simulate('click', {
564
- nativeEvent: null,
565
- });
566
- expect(onChange.callCount).toBe(++onChangeCalledCount); // click first filter again
567
-
568
- demo.find(`.${BASE_CLASS_PREFIX}-dropdown .${BASE_CLASS_PREFIX}-dropdown-item`)
569
- .at(0)
570
- .find(`.${BASE_CLASS_PREFIX}-checkbox`)
571
- .simulate('click', {
572
- nativeEvent: null,
573
- });
574
- expect(onChange.callCount).toBe(++onChangeCalledCount); // to page 2
575
-
576
- demo.find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item`)
577
- .at(2)
578
- .simulate('click', {
579
- nativeEvent: null,
580
- });
581
- expect(onChange.callCount).toBe(++onChangeCalledCount); // to page 1
582
-
583
- demo.find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item`)
584
- .at(1)
585
- .simulate('click', {
586
- nativeEvent: null,
587
- });
588
- expect(onChange.callCount).toBe(++onChangeCalledCount); // sort
589
-
590
- demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-sorter`).simulate('click', {
591
- nativeEvent: null,
592
- });
593
- expect(onChange.callCount).toBe(++onChangeCalledCount);
594
- });
595
- it(`test filter, and update dataSource with exist filter`, () => {
596
- const columns = [
597
- {
598
- className: 'name-col',
599
- title: 'Name',
600
- dataIndex: 'name',
601
- width: 150,
602
- filters: [
603
- {
604
- text: '名字包含"1"',
605
- value: '1',
606
- },
607
- {
608
- text: '名字包含"2"',
609
- value: '2',
610
- },
611
- ],
612
- onFilter: (value, record) => record.name.indexOf(value) > -1,
613
- },
614
- {
615
- title: 'Age',
616
- dataIndex: 'age',
617
- width: 150,
618
- sorter: (a, b) => (a.age - b.age > 0 ? 1 : -1),
619
- },
620
- {
621
- title: 'Address',
622
- dataIndex: 'address',
623
- },
624
- ];
625
- const demo = mount(<Table dataSource={data} columns={columns} pagination={false}/>);
626
- demo.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-filter`).simulate('click'); // click first filter
627
-
628
- demo.find(`.${BASE_CLASS_PREFIX}-dropdown .${BASE_CLASS_PREFIX}-dropdown-item`)
629
- .at(0)
630
- .find(`.${BASE_CLASS_PREFIX}-checkbox`)
631
- .simulate('click', {
632
- nativeEvent: null,
633
- });
634
- const nameColList = demo.find('.semi-table-tbody .name-col');
635
- const filteredData = data.filter(item => item.name.indexOf('1') > -1);
636
- expect(nameColList.length).toBe(filteredData.length); // update dataSource with exist filter
637
-
638
- const newData = getData(10);
639
- const newFilteredData = newData.filter(item => item.name.indexOf('1') > -1);
640
- demo.setProps({
641
- dataSource: newData,
642
- });
643
- demo.update();
644
- const newNameColList = demo.find('.semi-table-tbody .name-col');
645
- expect(newNameColList.length).toBe(newFilteredData.length);
646
- });
647
- it(`test controlled dataSource and columns`, async () => {
648
- let pagination = {
649
- currentPage: 1,
650
- total: data.length,
651
- pageSize: 10,
652
- };
653
-
654
- const getPageData = () =>
655
- data.slice(
656
- (pagination.currentPage - 1) * pagination.pageSize,
657
- pagination.currentPage * pagination.pageSize
658
- );
659
-
660
- let currentData = getPageData();
661
- let columns = [
662
- {
663
- title: 'Name',
664
- dataIndex: 'name',
665
- width: 150,
666
- filters: [
667
- {
668
- text: '名字包含"1"',
669
- value: '1',
670
- },
671
- {
672
- text: '名字包含"2"',
673
- value: '2',
674
- },
675
- ],
676
- onFilter: (value, record) => record.name.indexOf(value) > -1,
677
- },
678
- {
679
- title: 'Age',
680
- dataIndex: 'age',
681
- width: 150,
682
- sorter: true,
683
- },
684
- {
685
- title: 'Address',
686
- dataIndex: 'address',
687
- },
688
- {
689
- render: (text, record) => (
690
- <Tooltip content={record.description}>
691
- <Tag color="green">Show Info</Tag>
692
- </Tooltip>
693
- ),
694
- width: 150,
695
- },
696
- ];
697
- const onChange = sinon.spy(({pagination: tablePagination, filters: tableFilters, sorters: tableSorters}) => {
698
- if (tablePagination && tablePagination.currentPage !== pagination.currentPage) {
699
- pagination.currentPage = tablePagination.currentPage;
700
- currentData = getPageData();
701
- columns = [...columns];
702
- demo.setProps({
703
- dataSource: currentData,
704
- columns,
705
- pagination,
706
- });
707
- }
708
- });
709
- const demo = mount(
710
- <Table onChange={onChange} dataSource={currentData} pagination={pagination} columns={columns}/>
711
- );
712
- const table = demo.find(BaseTable);
713
- demo.find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item`)
714
- .at(2)
715
- .simulate('click', {
716
- nativeEvent: null,
717
- });
718
- expect(onChange.called).toBe(true);
719
- expect(
720
- demo
721
- .find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item`)
722
- .at(2)
723
- .hasClass(`${BASE_CLASS_PREFIX}-page-item-active`)
724
- ).toBe(true);
725
- });
726
- it(`test resizable table`, async () => {
727
- let columns = [
728
- {
729
- title: 'Name',
730
- dataIndex: 'name',
731
- width: 150,
732
- filters: [
733
- {
734
- text: '名字包含"1"',
735
- value: '1',
736
- },
737
- {
738
- text: '名字包含"2"',
739
- value: '2',
740
- },
741
- ],
742
- onFilter: (value, record) => record.name.indexOf(value) > -1,
743
- },
744
- {
745
- title: 'Age',
746
- dataIndex: 'age',
747
- width: 150,
748
- sorter: true,
749
- },
750
- {
751
- title: 'Address',
752
- dataIndex: 'address',
753
- width: 300,
754
- },
755
- {
756
- render: (text, record) => (
757
- <Tooltip content={record.description}>
758
- <Tag color="green">Show Info</Tag>
759
- </Tooltip>
760
- ),
761
- },
762
- ];
763
-
764
- const expandedRowRender = (record, index, expanded) => (
765
- <article
766
- style={{
767
- margin: 0,
768
- }}
769
- >
770
- <p>{record.description}</p>
771
- </article>
772
- );
773
-
774
- const demo = mount(
775
- <Table columns={columns} dataSource={data} resizable expandedRowRender={expandedRowRender}/>
776
- );
777
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-thead .react-resizable-handle`).length).toBe(
778
- columns.reduce((count, col) => (typeof col.width === 'number' ? count + 1 : count), 0)
779
- );
780
- });
781
- it('test table sortOrder descend', async () => {
782
- const sortColumns = [
783
- {
784
- title: 'Name',
785
- dataIndex: 'name',
786
- sorter: (a, b) => a.name.length - b.name.length,
787
- sortOrder: 'descend',
788
- },
789
- {
790
- title: 'Age',
791
- dataIndex: 'age',
792
- },
793
- {
794
- title: 'Address',
795
- dataIndex: 'address',
796
- },
797
- ];
798
- const sortData = [
799
- {
800
- key: '1',
801
- name: 'John Brown',
802
- age: 32,
803
- address: 'New York No. 1 Lake Park',
804
- },
805
- {
806
- key: '2',
807
- name: 'Jim Green',
808
- age: 42,
809
- address: 'London No. 1 Lake Park',
810
- },
811
- {
812
- key: '3',
813
- name: 'Joe Black',
814
- age: 32,
815
- address: 'Sidney No. 1 Lake Park',
816
- },
817
- {
818
- key: '4',
819
- name: 'Jim Red',
820
- age: 32,
821
- address: 'London No. 2 Lake Park',
822
- },
823
- ];
824
- const targetData = sortData.reduce((a, b) => (a.name.length > b.name.length ? a : b));
825
- const {name} = targetData;
826
- const sortTable = mount(<Table columns={sortColumns} dataSource={sortData}/>);
827
- const firstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0); // console.log(sortTable.debug({ ignoreProps: true }));
828
-
829
- expect(firstCell.text()).toBe(name);
830
- });
831
- it('test table sortOrder ascend', async () => {
832
- const sortColumns = [
833
- {
834
- title: 'Name',
835
- dataIndex: 'name',
836
- sorter: (a, b) => a.name.length - b.name.length,
837
- sortOrder: 'ascend',
838
- },
839
- {
840
- title: 'Age',
841
- dataIndex: 'age',
842
- },
843
- {
844
- title: 'Address',
845
- dataIndex: 'address',
846
- },
847
- ];
848
- const sortData = [
849
- {
850
- key: '1',
851
- name: 'John Brown',
852
- age: 32,
853
- address: 'New York No. 1 Lake Park',
854
- },
855
- {
856
- key: '2',
857
- name: 'Jim Green',
858
- age: 42,
859
- address: 'London No. 1 Lake Park',
860
- },
861
- {
862
- key: '3',
863
- name: 'Joe Black',
864
- age: 32,
865
- address: 'Sidney No. 1 Lake Park',
866
- },
867
- {
868
- key: '4',
869
- name: 'Jim Red',
870
- age: 32,
871
- address: 'London No. 2 Lake Park',
872
- },
873
- ];
874
- const targetData = sortData.reduce((a, b) => (a.name.length < b.name.length ? a : b));
875
- const {name} = targetData;
876
- const sortTable = mount(<Table columns={sortColumns} dataSource={sortData}/>);
877
- const firstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
878
- expect(firstCell.text()).toBe(name);
879
- });
880
- it('test controlled sortOrder', async () => {
881
- const sortColumns = [
882
- {
883
- title: 'Name',
884
- dataIndex: 'name',
885
- sorter: (a, b) => a.name.length - b.name.length,
886
- sortOrder: 'descend',
887
- },
888
- {
889
- title: 'Age',
890
- dataIndex: 'age',
891
- },
892
- {
893
- title: 'Address',
894
- dataIndex: 'address',
895
- },
896
- ];
897
- const sortData = [
898
- {
899
- key: '1',
900
- name: 'long name',
901
- age: 32,
902
- address: 'New York No. 1 Lake Park',
903
- },
904
- {
905
- key: '2',
906
- name: 'longest name',
907
- age: 42,
908
- address: 'London No. 1 Lake Park',
909
- },
910
- {
911
- key: '3',
912
- name: 'longer name',
913
- age: 32,
914
- address: 'Sidney No. 1 Lake Park',
915
- },
916
- {
917
- key: '4',
918
- name: 'short',
919
- age: 32,
920
- address: 'London No. 2 Lake Park',
921
- },
922
- ];
923
- const targetData = sortData.reduce((a, b) => (a.name.length > b.name.length ? a : b));
924
- const {name} = targetData;
925
- const sortTable = mount(<Table columns={sortColumns} dataSource={sortData}/>);
926
- const firstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
927
- expect(firstCell.text()).toBe(name);
928
- const ascendOrderColumns = [
929
- {
930
- title: 'Name',
931
- dataIndex: 'name',
932
- sorter: (a, b) => a.name.length - b.name.length,
933
- sortOrder: 'ascend',
934
- },
935
- {
936
- title: 'Age',
937
- dataIndex: 'age',
938
- },
939
- {
940
- title: 'Address',
941
- dataIndex: 'address',
942
- },
943
- ]; // test sortOrder: ascend
944
-
945
- sortTable.setProps({
946
- columns: ascendOrderColumns,
947
- });
948
- sortTable.update();
949
- const ascendTargetData = sortData.reduce((a, b) => (a.name.length < b.name.length ? a : b));
950
- const {name: ascendTargetName} = ascendTargetData;
951
- const ascendFirstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
952
- expect(ascendFirstCell.text()).toBe(ascendTargetName); // test sortOrder: false, expect order as given data
953
-
954
- const defaultOrderColumns = [
955
- {
956
- title: 'Name',
957
- dataIndex: 'name',
958
- sorter: (a, b) => a.name.length - b.name.length,
959
- sortOrder: false,
960
- },
961
- {
962
- title: 'Age',
963
- dataIndex: 'age',
964
- },
965
- {
966
- title: 'Address',
967
- dataIndex: 'address',
968
- },
969
- ];
970
- sortTable.setProps({
971
- columns: defaultOrderColumns,
972
- });
973
- sortTable.update();
974
- const defaultTargetData = sortData[0];
975
- const {name: defaultTargetName} = defaultTargetData;
976
- const defaultFirstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
977
- expect(defaultFirstCell.text()).toBe(defaultTargetName);
978
- });
979
- it('test table select all when disabled all rows', async () => {
980
- const columns = [
981
- {
982
- title: 'Name',
983
- dataIndex: 'name',
984
- width: 150,
985
- },
986
- {
987
- title: 'Age',
988
- dataIndex: 'age',
989
- width: 150,
990
- },
991
- {
992
- title: 'Address',
993
- dataIndex: 'address',
994
- },
995
- ];
996
- const rowSelection = {
997
- onSelectAll: sinon.spy(() => {
998
- }),
999
- getCheckboxProps: sinon.spy(record => ({
1000
- disabled: true,
1001
- // disabled all
1002
- name: record.name,
1003
- })),
1004
- };
1005
- const demo = mount(<Table columns={columns} dataSource={data} rowSelection={rowSelection}/>);
1006
- demo.find(
1007
- `.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-selection .${BASE_CLASS_PREFIX}-checkbox`
1008
- ).simulate('click'); // should select 0 rows
1009
-
1010
- expect(rowSelection.onSelectAll.getCall(0).args[1].length).toBe(0);
1011
- });
1012
- it('test jsx async data', async () => {
1013
- const asyncData = [
1014
- {
1015
- key: '1',
1016
- name: 'John Brown',
1017
- age: 32,
1018
- address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
1019
- },
1020
- {
1021
- key: '2',
1022
- name: 'Jim Green',
1023
- age: 42,
1024
- address: 'London No. 1 Lake Park',
1025
- },
1026
- {
1027
- key: '3',
1028
- name: 'Joe Black',
1029
- age: 32,
1030
- address: 'Sidney No. 1 Lake Park',
1031
- },
1032
- {
1033
- key: '4',
1034
- name: 'Michael James',
1035
- age: 99,
1036
- address: 'Sidney No. 1 Lake Park',
1037
- },
1038
- ];
1039
- const demo = mount(
1040
- <Table dataSource={[]}>
1041
- <Column title="Name" dataIndex="name" key="name" render={(text, record, index) => <a>{text}</a>}/>
1042
- <Column title="Age" dataIndex="age" key="age"/>
1043
- <Column title="Address" dataIndex="address" key="address"/>
1044
- </Table>
1045
- );
1046
- setTimeout(() => {
1047
- demo.setProps({
1048
- dataSource: asyncData,
1049
- });
1050
- }, 2000);
1051
- await sleep(3000);
1052
- const baseTable = demo.find(BaseTable);
1053
- expect(baseTable.state('cachedColumns').length).toEqual(3);
1054
- expect(baseTable.state('dataSource').length).toEqual(4);
1055
- });
1056
- it('test cell align', async () => {
1057
- const columns = getColumns();
1058
- const alignRightColumns = columns.map(column => {
1059
- column.align = 'right';
1060
- return column;
1061
- });
1062
- const demo = mount(<Table dataSource={data} columns={alignRightColumns}/>);
1063
- const titleAlignCells = demo.find(`.${BASE_CLASS_PREFIX}-table-align-right`);
1064
- expect(titleAlignCells.length).toBeGreaterThan(0);
1065
- const bodyAlignCells = document.querySelectorAll(`.${BASE_CLASS_PREFIX}-table-row-cell`);
1066
- bodyAlignCells.forEach(cell => {
1067
- expect(cell.style.textAlign).toEqual('right');
1068
- });
1069
- });
1070
- it('test column className', async () => {
1071
- const columns = getColumns();
1072
- const alignRightColumns = columns.map(column => {
1073
- column.className = 'test';
1074
- return column;
1075
- });
1076
- const demo = mount(<Table dataSource={data} columns={alignRightColumns}/>);
1077
- const titleAlignCells = demo.find(`.${BASE_CLASS_PREFIX}-table-row-head`);
1078
- const bodyAlignCells = demo.find(`.${BASE_CLASS_PREFIX}-table-row-cell`);
1079
- titleAlignCells.forEach(cell => {
1080
- expect(cell.hasClass('test')).toBeTruthy();
1081
- });
1082
- bodyAlignCells.forEach(cell => {
1083
- expect(cell.hasClass('test')).toBeTruthy();
1084
- });
1085
- });
1086
- it('test header appearance', async () => {
1087
- // object column
1088
- const columns = getColumns();
1089
- const demo = mount(
1090
- <Table
1091
- dataSource={data}
1092
- columns={columns}
1093
- scroll={{
1094
- y: 500,
1095
- }}
1096
- />
1097
- );
1098
- expect(demo.find('.semi-table-thead').length).toEqual(1);
1099
- demo.setProps({
1100
- showHeader: false,
1101
- });
1102
- expect(demo.find('.semi-table-thead').length).toEqual(0); // jsx column
1103
-
1104
- const jsxColumns = getJSXColumns();
1105
- const demo1 = mount(<Table dataSource={data}>{jsxColumns}</Table>);
1106
- expect(demo1.find('.semi-table-thead').length).toEqual(1);
1107
- demo1.setProps({
1108
- showHeader: false,
1109
- });
1110
- expect(demo1.find('.semi-table-thead').length).toEqual(0);
1111
- });
1112
- it('test ref getCurrentPageData', async () => {
1113
- // object column
1114
- const pageSize = 10;
1115
- const refObj = {
1116
- current: null,
1117
- };
1118
- const columns = getColumns();
1119
- const demo = mount(
1120
- <Table
1121
- dataSource={data}
1122
- ref={refObj}
1123
- columns={columns}
1124
- pagination={{
1125
- pageSize,
1126
- }}
1127
- />
1128
- );
1129
- const {dataSource} = refObj.current.getCurrentPageData();
1130
- expect(dataSource.length).toEqual(pageSize); // jsx column
1131
-
1132
- const jsxColumns = getJSXColumns();
1133
- const jsxRefObj = {
1134
- current: null,
1135
- };
1136
- const jsxDemo = mount(
1137
- <Table
1138
- dataSource={data}
1139
- ref={jsxRefObj}
1140
- pagination={{
1141
- pageSize,
1142
- }}
1143
- >
1144
- {jsxColumns}
1145
- </Table>
1146
- );
1147
- const {dataSource: jsxData} = jsxRefObj.current.getCurrentPageData();
1148
- expect(jsxData.length).toEqual(pageSize);
1149
- });
1150
- it('test render expandIcon', async () => {
1151
- const expandedRowRender = () => <div>Semi Design</div>;
1152
-
1153
- const columns = getColumns();
1154
- const demo = mount(
1155
- <Table
1156
- dataSource={data}
1157
- columns={columns}
1158
- expandedRowRender={expandedRowRender}
1159
- expandIcon={<IconStar size="small"/>}
1160
- />
1161
- );
1162
- expect(demo.find('.semi-icon-star').length).toBeGreaterThan(0);
1163
- const demo2 = mount(
1164
- <Table
1165
- dataSource={data}
1166
- columns={columns}
1167
- expandedRowRender={expandedRowRender}
1168
- defaultExpandAllRows
1169
- expandIcon={expanded => <div>{expanded && <IconStar size="small"/>}</div>}
1170
- />
1171
- );
1172
- expect(demo2.find('.semi-icon-star').length).toBeGreaterThan(0);
1173
- });
1174
- it(`test onRow/onCell`, async () => {
1175
- const onRowClick = sinon.spy(() => {
1176
- });
1177
- const onHeaderRowClick = sinon.spy(() => {
1178
- });
1179
- const onCellClick = sinon.spy(() => {
1180
- });
1181
- const onHeaderCellClick = sinon.spy(() => {
1182
- });
1183
- const onRow = sinon.spy((record, index) => ({
1184
- className: 'test-row',
1185
- onClick: onRowClick,
1186
- }));
1187
- const onHeaderRow = sinon.spy((record, index) => ({
1188
- className: 'test-row',
1189
- onClick: onHeaderRowClick,
1190
- }));
1191
- const columns = getColumns();
1192
- const onCellColumns = columns.map((column, index) => {
1193
- const style =
1194
- index === 0
1195
- ? {
1196
- width: 200,
1197
- height: 60,
1198
- }
1199
- : {};
1200
-
1201
- column.onCell = () => ({
1202
- onClick: onCellClick,
1203
- onCellClick,
1204
- style,
1205
- });
1206
-
1207
- column.onHeaderCell = () => ({
1208
- onClick: onHeaderCellClick,
1209
- style,
1210
- });
1211
-
1212
- return column;
1213
- });
1214
- const demo = mount(<Table dataSource={data} onRow={onRow} onHeaderRow={onHeaderRow} columns={onCellColumns}/>);
1215
- const tableCells = demo.find('.semi-table-body .semi-table-row-cell');
1216
- const tableHeaderCells = demo.find('.semi-table-thead .semi-table-row-head'); // cell style
1217
-
1218
- expect(tableCells.at(0).instance().style.width).toEqual('200px');
1219
- expect(tableCells.at(0).instance().style.height).toEqual('60px');
1220
- expect(tableHeaderCells.at(0).instance().style.width).toEqual('200px');
1221
- expect(tableHeaderCells.at(0).instance().style.height).toEqual('60px'); // body click
1222
-
1223
- tableCells.at(0).simulate('click');
1224
- expect(onCellClick.called).toBeTruthy();
1225
- const tableRows = demo.find('.semi-table-body .semi-table-row');
1226
- tableRows.at(0).simulate('click');
1227
- expect(onRowClick.called).toBeTruthy(); // header click
1228
-
1229
- tableHeaderCells.at(0).simulate('click');
1230
- expect(onHeaderCellClick.called).toBeTruthy();
1231
- const tableHeaderRows = demo.find('.semi-table-thead .semi-table-row');
1232
- tableHeaderRows.at(0).simulate('click');
1233
- expect(onHeaderRowClick.called).toBeTruthy();
1234
- });
1235
- it('test header merge', async () => {
1236
- // 测试头部合并
1237
- function testHeaderMerge(demo, params) {
1238
- const rows = demo.find('.semi-table-thead .semi-table-row');
1239
- expect(rows.length).toEqual(2);
1240
- const firstRow = rows.at(0);
1241
- const secondRow = rows.at(1);
1242
- expect(firstRow.childAt(0).instance().colSpan).toEqual(2);
1243
- expect(firstRow.childAt(1).instance().colSpan).toEqual(2);
1244
- expect(firstRow.childAt(2).instance().colSpan).toEqual(1);
1245
- expect(firstRow.childAt(2).instance().rowSpan).toEqual(2);
1246
- expect(secondRow.childAt(0).instance().colSpan).toEqual(1);
1247
- expect(secondRow.childAt(1).instance().colSpan).toEqual(1);
1248
- expect(secondRow.childAt(2).instance().colSpan).toEqual(1);
1249
- expect(secondRow.childAt(3).instance().colSpan).toEqual(1);
1250
- }
1251
-
1252
- const nestData = getNestData();
1253
- const filters = [
1254
- {
1255
- text: 'Code 45',
1256
- value: '45',
1257
- },
1258
- {
1259
- text: 'King 4',
1260
- value: 'King 4',
1261
- },
1262
- ];
1263
- const jsxDemo = mount(
1264
- <Table dataSource={nestData}>
1265
- <Column title={'Base Information'} dataIndex={'base'} fixed="left">
1266
- <Column
1267
- title={'Name'}
1268
- dataIndex={'name'}
1269
- fixed="left"
1270
- width={200}
1271
- filters={filters}
1272
- onFilter={(value, record) => record.name.includes(value)}
1273
- />
1274
- <Column
1275
- title={'Age'}
1276
- dataIndex={'age'}
1277
- width={100}
1278
- fixed="left"
1279
- sorter={(a, b) => (a.age - b.age > 0 ? 1 : -1)}
1280
- />
1281
- </Column>
1282
- <Column title={'Company Information'} dataIndex={'company'}>
1283
- <Column title={'Company Name'} dataIndex={'company.name'}/>
1284
- <Column title={'Company Address'} dataIndex={'company.address'}/>
1285
- </Column>
1286
- <Column title={'Address'} dataIndex={'address'} width={250} fixed="right"/>
1287
- </Table>
1288
- );
1289
- const columns = getNestColumns();
1290
- const demo = mount(<Table dataSource={nestData} columns={columns}/>);
1291
- testHeaderMerge(jsxDemo);
1292
- testHeaderMerge(demo);
1293
- });
1294
- it('test without columns', async () => {
1295
- const jsxDemo = mount(<Table dataSource={data}></Table>);
1296
- const demo = mount(<Table dataSource={data} columns={[]}/>);
1297
- expect(jsxDemo.find('.semi-table-row-head').length).toBe(0);
1298
- expect(jsxDemo.find('.semi-table-row-cell').length).toBe(0);
1299
- expect(demo.find('.semi-table-row-head').length).toBe(0);
1300
- expect(demo.find('.semi-table-row-cell').length).toBe(0);
1301
- });
1302
- it('test useFullRender', async () => {
1303
- const columns = [
1304
- {
1305
- dataIndex: 'name',
1306
- width: 250,
1307
- filters: [
1308
- {
1309
- text: '名字包含"1"',
1310
- value: '1',
1311
- },
1312
- {
1313
- text: '名字包含"2"',
1314
- value: '2',
1315
- },
1316
- ],
1317
- onFilter: (value, record) => record.name.indexOf(value) > -1,
1318
- sorter: (a, b) => a.name.length - b.name.length,
1319
- // 此处将useFullRender设置为true开启完全自定义渲染
1320
- useFullRender: true,
1321
- // 此处从render的第四个形参中解构出 展开按钮、选择按钮、文本等内容
1322
- render: (text, record, index, {expandIcon, selection, indentText}) => {
1323
- return (
1324
- <span
1325
- className="custom-render"
1326
- style={{
1327
- display: 'inline-flex',
1328
- alignItems: 'center',
1329
- justifyContent: 'center',
1330
- }}
1331
- >
1332
- {indentText}
1333
- {expandIcon}
1334
- {selection}
1335
- <span
1336
- style={{
1337
- marginLeft: 8,
1338
- }}
1339
- >
1340
- {text}
1341
- </span>
1342
- </span>
1343
- );
1344
- },
1345
- title: ({sorter, filter, selection}) => (
1346
- <span
1347
- className="custom-title"
1348
- style={{
1349
- display: 'inline-flex',
1350
- alignItems: 'center',
1351
- paddingLeft: 20,
1352
- }}
1353
- >
1354
- {selection}
1355
- <span
1356
- style={{
1357
- marginLeft: 8,
1358
- }}
1359
- >
1360
- Name
1361
- </span>
1362
- {sorter}
1363
- {filter}
1364
- </span>
1365
- ),
1366
- },
1367
- {
1368
- title: 'Age',
1369
- dataIndex: 'age',
1370
- },
1371
- {
1372
- title: 'Address',
1373
- dataIndex: 'address',
1374
- },
1375
- ];
1376
- const rowSelection = {
1377
- hidden: true,
1378
- fixed: 'left',
1379
- };
1380
- const demo = mount(
1381
- <Table
1382
- rowSelection={rowSelection}
1383
- columns={columns}
1384
- dataSource={data}
1385
- expandedRowRender={record => <article>{record.description}</article>}
1386
- />
1387
- );
1388
- const node = demo.find('.custom-render').at(0);
1389
- expect(node.children().length).toEqual(3);
1390
- expect(node.childAt(0).exists('.semi-table-expand-icon')).toBeTruthy();
1391
- expect(node.childAt(1).exists('.semi-table-selection-wrap')).toBeTruthy();
1392
- const title = demo.find('.custom-title').at(0);
1393
- expect(title.children().length).toEqual(4);
1394
- expect(title.childAt(0).exists('.semi-table-selection-wrap')).toBeTruthy();
1395
- expect(title.childAt(1).text()).toEqual('Name');
1396
- expect(title.childAt(2).exists('.semi-table-column-sorter')).toBeTruthy();
1397
- expect(title.childAt(3).exists('.semi-table-column-filter')).toBeTruthy();
1398
- });
1399
- it('test defaultExpandedRowKeys changed', async () => {
1400
- const expandedRowRender = (record, index) => <div>{`Semi Design ${index}`}</div>;
1401
-
1402
- const pageSize = 20;
1403
- const defaultExpandedRowKeys = Array.from({
1404
- length: getRandomNumber(pageSize),
1405
- }).map((_, i) => String(i));
1406
- const newDefaultExpandedRowKeys = Array.from({
1407
- length: getRandomNumber(pageSize),
1408
- }).map((_, i) => String(i));
1409
- const columns = getColumns();
1410
- const demo = mount(
1411
- <Table
1412
- dataSource={data}
1413
- columns={columns}
1414
- expandedRowRender={expandedRowRender}
1415
- defaultExpandedRowKeys={defaultExpandedRowKeys}
1416
- pagination={{
1417
- pageSize,
1418
- }}
1419
- />
1420
- );
1421
- expect(demo.find(BaseTable).state('expandedRowKeys').length).toEqual(defaultExpandedRowKeys.length);
1422
- demo.setProps({
1423
- defaultExpandedRowKeys: newDefaultExpandedRowKeys,
1424
- });
1425
- // 2.x defaultExpandedRowKeys 不再响应变化
1426
- expect(demo.find(BaseTable).state('expandedRowKeys').length).toEqual(defaultExpandedRowKeys.length);
1427
- });
1428
- it('test getCheckboxProps changed', async () => {
1429
- const defaultGetCheckboxProps = record => ({
1430
- disabled: record.key === '1',
1431
- });
1432
-
1433
- const newGetCheckboxProps = record => ({
1434
- disabled: ['0', '1'].includes(record.key),
1435
- });
1436
-
1437
- const columns = getColumns();
1438
- const demo = mount(
1439
- <Table
1440
- dataSource={getData(20)}
1441
- columns={columns}
1442
- pagination={false}
1443
- rowSelection={{
1444
- getCheckboxProps: defaultGetCheckboxProps,
1445
- }}
1446
- />
1447
- );
1448
- expect(demo.find(BaseTable).state('disabledRowKeys').length).toEqual(1);
1449
- demo.setProps({
1450
- rowSelection: {
1451
- getCheckboxProps: newGetCheckboxProps,
1452
- },
1453
- });
1454
- expect(demo.find(BaseTable).state('disabledRowKeys').length).toEqual(2);
1455
- });
1456
- /**
1457
- * 分页受控场景,更新数据后查看分页器是否保持当前页
1458
- */
1459
- it('test controlled pagination reset when dataSource change', async () => {
1460
- const total = 100;
1461
- const pagination = {
1462
- pageSize: 10,
1463
- currentPage: 2,
1464
- };
1465
- const columns = getColumns();
1466
- const demo = mount(<Table dataSource={getData(total)} columns={columns} pagination={pagination}/>);
1467
-
1468
- const dataNum = getRandomNumber(100, 40);
1469
- const newData = getData(dataNum);
1470
- demo.setProps({
1471
- dataSource: newData,
1472
- });
1473
- await sleep(2000);
1474
- expect(
1475
- demo
1476
- .find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item-active`)
1477
- .getDOMNode().innerHTML
1478
- ).toBe('2');
1479
- });
1480
-
1481
- /**
1482
- * 分页非受控场景,更新数据后查看分页器是否重置
1483
- */
1484
- it('test uncontrolled pagination reset when dataSource change', async () => {
1485
- const total = 100;
1486
- const columns = getColumns();
1487
- const demo = mount(<Table dataSource={getData(total)} columns={columns}/>);
1488
- demo.find(`.${BASE_CLASS_PREFIX}-page .${BASE_CLASS_PREFIX}-page-item`)
1489
- .at(2)
1490
- .simulate('click');
1491
- const dataNum = getRandomNumber(100, 40);
1492
- const newData = getData(dataNum);
1493
- demo.setProps({
1494
- dataSource: newData,
1495
- });
1496
- await sleep(2000);
1497
- demo.update();
1498
- expect(demo.find(`.semi-page .semi-page-item-active`).getDOMNode().innerHTML).toBe('1');
1499
- expect(demo.find(BaseTable).state('pagination')).toHaveProperty('currentPage', 1);
1500
- });
1501
-
1502
- it('test pagination changed', async () => {
1503
- const total = 100;
1504
- const pagination = {
1505
- pageSize: 10,
1506
- currentPage: 2,
1507
- };
1508
- const newPagination = {
1509
- pageSize: 5,
1510
- currentPage: 1,
1511
- };
1512
- const columns = getColumns();
1513
- const demo = mount(<Table dataSource={getData(total)} columns={columns} pagination={pagination}/>);
1514
- const paginationProps = demo.find(BaseTable).state('pagination');
1515
- expect(paginationProps.total).toEqual(total);
1516
- expect(paginationProps.pageSize).toEqual(pagination.pageSize);
1517
- expect(paginationProps.currentPage).toEqual(pagination.currentPage);
1518
- demo.setProps({
1519
- pagination: newPagination,
1520
- });
1521
- await sleep(2000);
1522
- const newPaginationProps = demo.find(BaseTable).state('pagination');
1523
- expect(newPaginationProps.pageSize).toEqual(newPagination.pageSize);
1524
- expect(newPaginationProps.currentPage).toEqual(newPagination.currentPage);
1525
- });
1526
- it(`test grouped data change dataSource`, async () => {
1527
- const data = getGroupData();
1528
- const columns = getGroupColumns();
1529
- const groupedRowClick = sinon.spy();
1530
-
1531
- const rowKey = record =>
1532
- `${record.city && record.city.toLowerCase()}-${record.job && record.job.toLowerCase()}`;
1533
-
1534
- const demo = mount(
1535
- <Table
1536
- dataSource={data}
1537
- rowKey={rowKey}
1538
- groupBy={'city'}
1539
- columns={columns}
1540
- renderGroupSection={groupKey => <strong>Jobs in {groupKey}:</strong>}
1541
- onGroupedRow={(group, index) => ({
1542
- onClick: groupedRowClick,
1543
- })}
1544
- clickGroupedRowToExpand
1545
- scroll={{
1546
- y: 480,
1547
- }}
1548
- />
1549
- );
1550
- const newData = [
1551
- {
1552
- city: 'Tianjin',
1553
- job: 'FE',
1554
- department: 'IES',
1555
- },
1556
- {
1557
- city: 'Tianjin',
1558
- job: 'Android',
1559
- department: 'IES',
1560
- },
1561
- {
1562
- city: 'Wuhan',
1563
- job: 'Android',
1564
- department: 'IES',
1565
- },
1566
- {
1567
- city: 'Wuhan',
1568
- job: 'SE',
1569
- department: 'EE',
1570
- },
1571
- {
1572
- city: 'Chengdu',
1573
- job: 'Android',
1574
- department: 'EE',
1575
- },
1576
- {
1577
- city: 'Chengdu',
1578
- job: 'IOS',
1579
- department: 'EE',
1580
- },
1581
- {
1582
- city: 'Xiamen',
1583
- job: 'SE',
1584
- department: 'DATA',
1585
- },
1586
- {
1587
- city: 'Xiamen',
1588
- job: 'IOS',
1589
- department: 'DATA',
1590
- },
1591
- ];
1592
- demo.setProps({
1593
- dataSource: newData,
1594
- });
1595
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-row-section`).length).toBe(4);
1596
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-body .${BASE_CLASS_PREFIX}-table-row`).length).toBe(0);
1597
- demo.find(`.${BASE_CLASS_PREFIX}-table-row-section`)
1598
- .at(0)
1599
- .simulate('click');
1600
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-row`).length).toBeGreaterThan(0);
1601
- });
1602
- it(`test given object columns and children`, async () => {
1603
- const demo = mount(
1604
- <Table dataSource={data} columns={columns}>
1605
- <Table.Column title="Age" dataIndex="age" key="age"/>
1606
- </Table>
1607
- );
1608
- const test = demo.find(BaseTable); // 同时传columns与children时,columns优先
1609
-
1610
- expect(test.state('cachedColumns')).toEqual(columns);
1611
- expect(test.state('queries').length).toEqual(columns.length);
1612
- });
1613
- it('test header colSpan', async () => {
1614
- const columns = [
1615
- {
1616
- title: 'Name',
1617
- dataIndex: 'name',
1618
- },
1619
- {
1620
- title: 'Age',
1621
- dataIndex: 'age',
1622
- },
1623
- {
1624
- title: 'Home phone',
1625
- colSpan: 2,
1626
- dataIndex: 'tel',
1627
- },
1628
- {
1629
- title: 'Phone',
1630
- colSpan: 0,
1631
- dataIndex: 'phone',
1632
- },
1633
- {
1634
- title: 'Address',
1635
- dataIndex: 'address',
1636
- },
1637
- ];
1638
- const data = [
1639
- {
1640
- key: '1',
1641
- name: 'ZhangSan',
1642
- age: 50,
1643
- tel: '010-20000000',
1644
- phone: 10010,
1645
- address: 'BeiJing No.1 High School',
1646
- },
1647
- {
1648
- key: '2',
1649
- name: 'LiSi',
1650
- tel: '010-30000000',
1651
- phone: 10086,
1652
- age: 40,
1653
- address: 'ShangHai No. 1 High School',
1654
- },
1655
- {
1656
- key: '3',
1657
- name: 'WangWu',
1658
- age: 60,
1659
- tel: '010-40000000',
1660
- phone: 10011,
1661
- address: 'NaiJing No.1 High School',
1662
- },
1663
- {
1664
- key: '4',
1665
- name: 'XiaoMing',
1666
- age: 20,
1667
- tel: '010-50000000',
1668
- phone: 12580,
1669
- address: 'ShiJiaZhuang No.1 High School',
1670
- },
1671
- {
1672
- key: '5',
1673
- name: 'XiaoHong',
1674
- age: 40,
1675
- tel: '010-60000000',
1676
- phone: 12530,
1677
- address: 'TaiBei No.2 High School',
1678
- },
1679
- ];
1680
- const demo = mount(<Table dataSource={data} columns={columns}/>);
1681
- expect(demo.find('.semi-table-row .semi-table-row-head').length).toBe(columns.length - 1);
1682
- });
1683
-
1684
- it('test expandAllRows', async () => {
1685
- const expandedRowRender = () => <div>Semi Design</div>
1686
- const initData = [];
1687
-
1688
- const columns = getColumns();
1689
- const demo = mount(<Table
1690
- dataSource={initData}
1691
- columns={columns}
1692
- expandedRowRender={expandedRowRender}
1693
- pagination={false}
1694
- expandAllRows
1695
- />);
1696
-
1697
- const newData = getData(20);
1698
- demo.setProps({dataSource: newData});
1699
- demo.update();
1700
- const expandedRows = demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-expanded`)
1701
- expect(expandedRows.length).toEqual(newData.length);
1702
- // 动态切换 expandAllRows
1703
- demo.setProps({expandAllRows: false});
1704
- demo.update();
1705
- const newExpandedRows = demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-expanded`)
1706
- expect(newExpandedRows.length).toEqual(0);
1707
- });
1708
-
1709
- it(`test defaultExpandAllGroupRows`, async () => {
1710
- const data = getGroupData();
1711
- const columns = getGroupColumns();
1712
- const rowKey = record => `${record.city && record.city.toLowerCase()}-${record.job && record.job.toLowerCase()}`;
1713
- const groupSize = new Set(data.map(item => item.city)).size;
1714
-
1715
- const demo = mount(
1716
- <Table
1717
- dataSource={data}
1718
- rowKey={rowKey}
1719
- groupBy={'city'}
1720
- columns={columns}
1721
- renderGroupSection={groupKey => <strong>Jobs in {groupKey}:</strong>}
1722
- scroll={{y: 480}}
1723
- defaultExpandAllGroupRows
1724
- />
1725
- );
1726
-
1727
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-section.on`).length).toBe(groupSize);
1728
- });
1729
-
1730
- it(`test expandAllGroupRows`, async () => {
1731
- const data = getGroupData();
1732
- const groupSize = new Set(data.map(item => item.city)).size;
1733
- const columns = getGroupColumns();
1734
- const rowKey = record => `${record.city && record.city.toLowerCase()}-${record.job && record.job.toLowerCase()}`;
1735
-
1736
- const demo = mount(
1737
- <Table
1738
- dataSource={[]}
1739
- rowKey={rowKey}
1740
- groupBy={'city'}
1741
- columns={columns}
1742
- renderGroupSection={groupKey => <strong>Jobs in {groupKey}:</strong>}
1743
- scroll={{y: 480}}
1744
- expandAllGroupRows={true}
1745
- />
1746
- );
1747
-
1748
- demo.setProps({dataSource: data});
1749
- demo.update();
1750
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-section.on`).length).toBe(groupSize);
1751
- demo.setProps({expandAllGroupRows: false});
1752
- demo.update();
1753
- expect(demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-section.on`).length).toBe(0);
1754
- });
1755
-
1756
- it('test defaultSortOrder', async () => {
1757
- const sortColumns = [
1758
- {
1759
- title: 'Name',
1760
- dataIndex: 'name',
1761
- sorter: (a, b) => a.name.length - b.name.length,
1762
- defaultSortOrder: 'descend',
1763
- },
1764
- {
1765
- title: 'Age',
1766
- dataIndex: 'age',
1767
- },
1768
- {
1769
- title: 'Address',
1770
- dataIndex: 'address',
1771
- }
1772
- ];
1773
- const sortData = [
1774
- {
1775
- key: '1',
1776
- name: 'long name',
1777
- age: 32,
1778
- address: 'New York No. 1 Lake Park',
1779
- },
1780
- {
1781
- key: '2',
1782
- name: 'longest name',
1783
- age: 42,
1784
- address: 'London No. 1 Lake Park',
1785
- },
1786
- {
1787
- key: '3',
1788
- name: 'longer name',
1789
- age: 32,
1790
- address: 'Sidney No. 1 Lake Park',
1791
- },
1792
- {
1793
- key: '4',
1794
- name: 'short',
1795
- age: 32,
1796
- address: 'London No. 2 Lake Park',
1797
- },
1798
- ];
1799
- const onChange = sinon.spy(() => {
1800
- });
1801
-
1802
- // test default descend
1803
- const targetData = sortData.reduce((a, b) => a.name.length > b.name.length ? a : b);
1804
- const {name} = targetData;
1805
- const sortTable = mount(<Table columns={sortColumns} dataSource={sortData} onChange={onChange}/>);
1806
- const firstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
1807
- expect(firstCell.text()).toBe(name);
1808
-
1809
- // test default ascend
1810
- const ascendOrderColumns = [
1811
- {
1812
- title: 'Name',
1813
- dataIndex: 'name',
1814
- sorter: (a, b) => a.name.length - b.name.length,
1815
- defaultSortOrder: 'ascend',
1816
- },
1817
- {
1818
- title: 'Age',
1819
- dataIndex: 'age',
1820
- },
1821
- {
1822
- title: 'Address',
1823
- dataIndex: 'address',
1824
- }
1825
- ];
1826
- sortTable.setProps({columns: ascendOrderColumns})
1827
- sortTable.update()
1828
- const ascendTargetData = sortData.reduce((a, b) => a.name.length < b.name.length ? a : b);
1829
- const {name: ascendTargetName} = ascendTargetData;
1830
- const ascendFirstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
1831
- expect(ascendFirstCell.text()).toBe(ascendTargetName);
1832
-
1833
- // test default false
1834
- const defaultOrderColumns = [
1835
- {
1836
- title: 'Name',
1837
- dataIndex: 'name',
1838
- sorter: (a, b) => a.name.length - b.name.length,
1839
- defaultSortOrder: false,
1840
- },
1841
- {
1842
- title: 'Age',
1843
- dataIndex: 'age',
1844
- },
1845
- {
1846
- title: 'Address',
1847
- dataIndex: 'address',
1848
- }
1849
- ]
1850
- sortTable.setProps({columns: defaultOrderColumns})
1851
- sortTable.update()
1852
- const defaultTargetData = sortData[0]
1853
- const {name: defaultTargetName} = defaultTargetData;
1854
- const defaultFirstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
1855
- expect(defaultFirstCell.text()).toBe(defaultTargetName);
1856
-
1857
- // test click sorter
1858
- sortTable.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-sorter`).at(0).simulate('click', {nativeEvent: null});
1859
- expect(onChange.callCount).toBe(1);
1860
- expect(onChange.getCall(0).args[0].sorter.sortOrder).toBe('ascend');
1861
- sortTable.find(`.${BASE_CLASS_PREFIX}-table-thead .${BASE_CLASS_PREFIX}-table-column-sorter`).at(0).simulate('click', {nativeEvent: null});
1862
- expect(onChange.callCount).toBe(2);
1863
- expect(onChange.getCall(1).args[0].sorter.sortOrder).toBe('descend');
1864
-
1865
- // test change data
1866
- const newData = [
1867
- {
1868
- key: '1',
1869
- name: 'longest name',
1870
- age: 18,
1871
- address: 'New York No. 1 Lake Park',
1872
- },
1873
- {
1874
- key: '2',
1875
- name: 'long name',
1876
- age: 20,
1877
- address: 'London No. 1 Lake Park',
1878
- },
1879
- {
1880
- key: '3',
1881
- name: 'longer name',
1882
- age: 16,
1883
- address: 'Sidney No. 1 Lake Park',
1884
- },
1885
- {
1886
- key: '4',
1887
- name: 'short',
1888
- age: 33,
1889
- address: 'London No. 2 Lake Park',
1890
- },
1891
- ];
1892
- sortTable.setProps({dataSource: newData});
1893
- sortTable.update()
1894
- const newDescendTargetData = newData.reduce((a, b) => a.name.length > b.name.length ? a : b);
1895
- const {name: newDescendTargetName} = newDescendTargetData;
1896
- const newDataFirstCell = sortTable.find('.semi-table-tbody .semi-table-row .semi-table-row-cell').at(0);
1897
- expect(newDataFirstCell.text()).toBe(newDescendTargetName);
1898
- });
1899
-
1900
- it(`test expandRowByClick`, async () => {
1901
- const onExpand = sinon.spy();
1902
- const onExpandedRowsChange = sinon.spy();
1903
-
1904
- const demo = mount(
1905
- <Table
1906
- columns={columns}
1907
- dataSource={data}
1908
- onExpand={onExpand}
1909
- onExpandedRowsChange={onExpandedRowsChange}
1910
- expandedRowRender={() => <div>Semi Design</div>}
1911
- expandRowByClick
1912
- />
1913
- );
1914
-
1915
- const table = demo.find(BaseTable);
1916
-
1917
- const rows = demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row`);
1918
- rows.at(0).simulate('click');
1919
- rows.at(1).simulate('click');
1920
- expect(onExpand.calledTwice).toBeTruthy();
1921
- expect(onExpandedRowsChange.calledTwice).toBeTruthy();
1922
- expect(onExpand.getCall(1).args[0]).toEqual(true);
1923
- expect(onExpand.getCall(1).args[1]).toEqual(data[1]);
1924
- expect(onExpand.getCall(1).args[2].constructor.name).toBe('SyntheticEvent');
1925
- expect(onExpandedRowsChange.getCall(1).args[0].length).toEqual(2);
1926
- expect(table.state(`expandedRowKeys`)).toEqual(['0', '1']);
1927
- const expandedRows = demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-expanded`);
1928
- expandedRows.at(0).simulate('click');
1929
- // 查看点击第二次是否折叠
1930
- const newExpandedRows = demo.find(`.${BASE_CLASS_PREFIX}-table-tbody .${BASE_CLASS_PREFIX}-table-row-expanded`)
1931
- expect(newExpandedRows.length).toEqual(1);
1932
- expect(table.state(`expandedRowKeys`)).toEqual(['1']);
1933
- });
1934
-
1935
- it(`test expanded row re-render`, () => {
1936
- const expandedRowRender = sinon.spy(() => <div>Semi Design</div>);
1937
- const demo = mount(
1938
- <Table
1939
- columns={columns}
1940
- dataSource={data}
1941
- expandedRowRender={expandedRowRender}
1942
- />
1943
- );
1944
-
1945
- const table = demo.find(BaseTable);
1946
-
1947
- const expandIcons = demo.find(`.semi-table-tbody .semi-table-row .semi-table-expand-icon`);
1948
- expandIcons.at(0).simulate('click');
1949
- expandIcons.at(1).simulate('click');
1950
- expect(expandedRowRender.calledTwice).toBeTruthy();
1951
- });
1952
- });