@douyinfe/semi-ui 2.19.1-alpha.2 → 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 (866) 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 +3219 -177
  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/carousel/CarouselIndicator.d.ts +1 -1
  20. package/lib/cjs/carousel/index.d.ts +1 -1
  21. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  22. package/lib/cjs/checkbox/checkbox.js +19 -10
  23. package/lib/cjs/checkbox/checkboxGroup.js +2 -1
  24. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  25. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  26. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  27. package/lib/cjs/dropdown/index.js +5 -1
  28. package/lib/cjs/form/baseForm.d.ts +1 -1
  29. package/lib/cjs/form/field.d.ts +1 -1
  30. package/lib/cjs/popconfirm/index.d.ts +4 -2
  31. package/lib/cjs/popconfirm/index.js +49 -31
  32. package/lib/cjs/radio/radio.d.ts +2 -1
  33. package/lib/cjs/radio/radio.js +22 -13
  34. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  35. package/lib/cjs/radio/radioGroup.js +1 -1
  36. package/lib/cjs/tag/group.js +14 -12
  37. package/lib/cjs/tag/index.d.ts +1 -1
  38. package/lib/cjs/tag/index.js +1 -1
  39. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  40. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  41. package/lib/cjs/timePicker/index.d.ts +2 -2
  42. package/lib/cjs/tooltip/index.js +2 -2
  43. package/lib/cjs/typography/base.d.ts +1 -1
  44. package/lib/cjs/typography/paragraph.d.ts +1 -1
  45. package/lib/cjs/typography/text.d.ts +1 -1
  46. package/lib/cjs/typography/title.d.ts +2 -2
  47. package/lib/cjs/upload/index.d.ts +1 -1
  48. package/lib/es/_base/base.css +1 -0
  49. package/lib/es/anchor/index.d.ts +4 -0
  50. package/lib/es/anchor/index.js +35 -1
  51. package/lib/es/anchor/link.d.ts +2 -0
  52. package/lib/es/anchor/link.js +8 -2
  53. package/lib/es/avatar/index.d.ts +1 -0
  54. package/lib/es/avatar/index.js +2 -1
  55. package/lib/es/button/Button.d.ts +1 -1
  56. package/lib/es/button/buttonGroup.d.ts +1 -0
  57. package/lib/es/button/buttonGroup.js +41 -1
  58. package/lib/es/button/index.d.ts +2 -1
  59. package/lib/es/button/index.js +1 -0
  60. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  61. package/lib/es/carousel/index.d.ts +1 -1
  62. package/lib/es/checkbox/checkbox.d.ts +1 -0
  63. package/lib/es/checkbox/checkbox.js +19 -10
  64. package/lib/es/checkbox/checkboxGroup.js +2 -1
  65. package/lib/es/datePicker/dateInput.d.ts +1 -1
  66. package/lib/es/datePicker/datePicker.d.ts +1 -1
  67. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  68. package/lib/es/dropdown/index.js +7 -1
  69. package/lib/es/form/baseForm.d.ts +1 -1
  70. package/lib/es/form/field.d.ts +1 -1
  71. package/lib/es/popconfirm/index.d.ts +4 -2
  72. package/lib/es/popconfirm/index.js +49 -31
  73. package/lib/es/radio/radio.d.ts +2 -1
  74. package/lib/es/radio/radio.js +22 -13
  75. package/lib/es/radio/radioGroup.d.ts +1 -1
  76. package/lib/es/radio/radioGroup.js +1 -1
  77. package/lib/es/tag/group.js +14 -12
  78. package/lib/es/tag/index.d.ts +1 -1
  79. package/lib/es/tag/index.js +1 -1
  80. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  81. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  82. package/lib/es/timePicker/index.d.ts +2 -2
  83. package/lib/es/tooltip/index.js +2 -2
  84. package/lib/es/typography/base.d.ts +1 -1
  85. package/lib/es/typography/paragraph.d.ts +1 -1
  86. package/lib/es/typography/text.d.ts +1 -1
  87. package/lib/es/typography/title.d.ts +2 -2
  88. package/lib/es/upload/index.d.ts +1 -1
  89. package/package.json +12 -8
  90. package/_base/_story/a11y.jsx +0 -1302
  91. package/_base/_story/a11y.scss +0 -48
  92. package/_base/_story/index.scss +0 -11
  93. package/_base/_story/index.stories.js +0 -116
  94. package/_base/_story/index.stories.tsx +0 -55
  95. package/_base/base.scss +0 -3
  96. package/_base/base.ts +0 -36
  97. package/_base/baseComponent.tsx +0 -79
  98. package/_base/reactUtils.ts +0 -43
  99. package/_portal/_story/portal.stories.js +0 -13
  100. package/_portal/index.tsx +0 -113
  101. package/_test_/utils/dom/index.js +0 -9
  102. package/_test_/utils/function/index.js +0 -1
  103. package/_test_/utils/function/sleep.js +0 -9
  104. package/_test_/utils/index.js +0 -4
  105. package/_test_/utils/table/index.js +0 -310
  106. package/_test_/utils/tooltip/index.js +0 -39
  107. package/_utils/hooks/usePrevFocus.ts +0 -17
  108. package/_utils/index.ts +0 -198
  109. package/anchor/__test__/anchor.test.js +0 -60
  110. package/anchor/_story/anchor.stories.js +0 -288
  111. package/anchor/_story/anchor.stories.tsx +0 -165
  112. package/anchor/anchor-context.ts +0 -13
  113. package/anchor/index.tsx +0 -300
  114. package/anchor/link.tsx +0 -161
  115. package/autoComplete/__test__/autoComplete.test.js +0 -456
  116. package/autoComplete/_story/CustomTrigger/index.jsx +0 -106
  117. package/autoComplete/_story/autoComplete.stories.js +0 -348
  118. package/autoComplete/_story/autoComplete.stories.tsx +0 -87
  119. package/autoComplete/index.tsx +0 -504
  120. package/autoComplete/option.tsx +0 -164
  121. package/avatar/__test__/avatar.test.js +0 -363
  122. package/avatar/__test__/avatarGroup.test.js +0 -193
  123. package/avatar/_story/Demo.tsx +0 -22
  124. package/avatar/_story/avatar.stories.js +0 -248
  125. package/avatar/_story/avatar.stories.tsx +0 -7
  126. package/avatar/avatarGroup.tsx +0 -93
  127. package/avatar/index.tsx +0 -236
  128. package/avatar/interface.ts +0 -51
  129. package/backtop/__test__/backtop.test.js +0 -49
  130. package/backtop/_story/backtop.stories.js +0 -37
  131. package/backtop/_story/backtop.stories.tsx +0 -30
  132. package/backtop/index.tsx +0 -117
  133. package/badge/__test__/badge.test.js +0 -123
  134. package/badge/_story/Demo.tsx +0 -16
  135. package/badge/_story/badge.stories.js +0 -123
  136. package/badge/_story/badge.stories.tsx +0 -8
  137. package/badge/index.tsx +0 -91
  138. package/banner/__test__/banner.test.js +0 -58
  139. package/banner/_story/Demo.tsx +0 -14
  140. package/banner/_story/banner.stories.js +0 -106
  141. package/banner/_story/banner.stories.tsx +0 -8
  142. package/banner/index.tsx +0 -174
  143. package/breadcrumb/__test__/breadcrumb.test.js +0 -219
  144. package/breadcrumb/_story/Demo.tsx +0 -24
  145. package/breadcrumb/_story/breadcrumb.stories.js +0 -331
  146. package/breadcrumb/_story/breadcrumb.stories.tsx +0 -45
  147. package/breadcrumb/bread-context.tsx +0 -13
  148. package/breadcrumb/index.tsx +0 -302
  149. package/breadcrumb/item.tsx +0 -215
  150. package/button/Button.tsx +0 -133
  151. package/button/__test__/button.test.js +0 -71
  152. package/button/_story/Demo.tsx +0 -51
  153. package/button/_story/button.stories.js +0 -293
  154. package/button/_story/button.stories.tsx +0 -10
  155. package/button/buttonGroup.tsx +0 -56
  156. package/button/index.tsx +0 -38
  157. package/button/splitButtonGroup.tsx +0 -30
  158. package/calendar/__test__/calendar.test.js +0 -182
  159. package/calendar/_story/Demo.tsx +0 -20
  160. package/calendar/_story/calendar.stories.js +0 -560
  161. package/calendar/_story/calendar.stories.tsx +0 -5
  162. package/calendar/dayCalendar.tsx +0 -191
  163. package/calendar/dayCol.tsx +0 -156
  164. package/calendar/index.tsx +0 -63
  165. package/calendar/interface.ts +0 -43
  166. package/calendar/monthCalendar.tsx +0 -400
  167. package/calendar/rangeCalendar.tsx +0 -270
  168. package/calendar/timeCol.tsx +0 -64
  169. package/calendar/weekCalendar.tsx +0 -271
  170. package/card/__test__/card.test.js +0 -202
  171. package/card/_story/card.stories.js +0 -562
  172. package/card/_story/card.stories.tsx +0 -103
  173. package/card/cardGroup.tsx +0 -64
  174. package/card/index.tsx +0 -249
  175. package/card/meta.tsx +0 -73
  176. package/carousel/CarouselArrow.tsx +0 -64
  177. package/carousel/CarouselIndicator.tsx +0 -83
  178. package/carousel/__test__/carousel.test.js +0 -159
  179. package/carousel/_story/carousel.stories.js +0 -486
  180. package/carousel/index.tsx +0 -293
  181. package/carousel/interface.ts +0 -63
  182. package/cascader/__test__/cascader.test.js +0 -1356
  183. package/cascader/_story/CustomTrigger/index.jsx +0 -63
  184. package/cascader/_story/Demo.tsx +0 -63
  185. package/cascader/_story/cascader.stories.js +0 -1585
  186. package/cascader/_story/cascader.stories.tsx +0 -6
  187. package/cascader/index.tsx +0 -999
  188. package/cascader/item.tsx +0 -328
  189. package/checkbox/__test__/checkbox.test.js +0 -85
  190. package/checkbox/__test__/checkboxGroup.test.js +0 -180
  191. package/checkbox/_story/Demo.tsx +0 -27
  192. package/checkbox/_story/checkbox.stories.js +0 -1022
  193. package/checkbox/_story/checkbox.stories.tsx +0 -8
  194. package/checkbox/checkbox.tsx +0 -290
  195. package/checkbox/checkboxGroup.tsx +0 -197
  196. package/checkbox/checkboxInner.tsx +0 -129
  197. package/checkbox/context.ts +0 -14
  198. package/checkbox/index.tsx +0 -19
  199. package/collapse/__test__/collapse.test.js +0 -168
  200. package/collapse/_story/Demo.tsx +0 -28
  201. package/collapse/_story/accordion.stories.js +0 -143
  202. package/collapse/_story/accordion.stories.tsx +0 -8
  203. package/collapse/collapse-context.tsx +0 -18
  204. package/collapse/index.tsx +0 -120
  205. package/collapse/item.tsx +0 -163
  206. package/collapsible/_story/Demo.tsx +0 -41
  207. package/collapsible/_story/Nested/index.js +0 -101
  208. package/collapsible/_story/collapsible.stories.js +0 -588
  209. package/collapsible/_story/collapsible.stories.tsx +0 -7
  210. package/collapsible/index.tsx +0 -165
  211. package/configProvider/_story/ChangeTimeZone/index.js +0 -183
  212. package/configProvider/_story/GetPopupContainer/index.js +0 -194
  213. package/configProvider/_story/RTLDirection/RTLForm.jsx +0 -313
  214. package/configProvider/_story/RTLDirection/RTLTable.jsx +0 -94
  215. package/configProvider/_story/RTLDirection/RTLWrapper.tsx +0 -27
  216. package/configProvider/_story/configProvider.stories.js +0 -30
  217. package/configProvider/_story/configProvider.stories.tsx +0 -27
  218. package/configProvider/context.tsx +0 -14
  219. package/configProvider/index.tsx +0 -48
  220. package/datePicker/__test__/datePicker.test.js +0 -1065
  221. package/datePicker/_story/AllTypes/index.js +0 -19
  222. package/datePicker/_story/AutoSwitchDate/index.jsx +0 -14
  223. package/datePicker/_story/Autofocus/index.js +0 -11
  224. package/datePicker/_story/BetterRangePicker/index.jsx +0 -172
  225. package/datePicker/_story/Callbacks/index.jsx +0 -24
  226. package/datePicker/_story/ControlledDemo/index.js +0 -149
  227. package/datePicker/_story/CustomTrigger/index.jsx +0 -36
  228. package/datePicker/_story/Cycled/index.jsx +0 -11
  229. package/datePicker/_story/DateOffset/index.js +0 -83
  230. package/datePicker/_story/DatePickerSlot/index.jsx +0 -83
  231. package/datePicker/_story/DatePickerSlot/index.scss +0 -7
  232. package/datePicker/_story/DatePickerTimeZone/index.jsx +0 -27
  233. package/datePicker/_story/Density/index.jsx +0 -69
  234. package/datePicker/_story/DisabledDate/index.js +0 -189
  235. package/datePicker/_story/ExceptionDemo/index.js +0 -20
  236. package/datePicker/_story/Multiple/index.jsx +0 -24
  237. package/datePicker/_story/NeedConfirm/index.jsx +0 -94
  238. package/datePicker/_story/OnChangeWithDateFirst/index.jsx +0 -37
  239. package/datePicker/_story/OverPopover/index.jsx +0 -22
  240. package/datePicker/_story/RenderDate/index.js +0 -31
  241. package/datePicker/_story/RenderFullDate/index.js +0 -78
  242. package/datePicker/_story/RenderFullDate/index.scss +0 -23
  243. package/datePicker/_story/SyncSwitchMonth/index.js +0 -45
  244. package/datePicker/_story/TimePickerOpts/index.jsx +0 -16
  245. package/datePicker/_story/datePicker.stories.js +0 -1016
  246. package/datePicker/_story/datePicker.stories.tsx +0 -230
  247. package/datePicker/_story/v2/AutoFillTime.jsx +0 -37
  248. package/datePicker/_story/v2/FixDefaultPickerValue.jsx +0 -31
  249. package/datePicker/_story/v2/FixInputRangeFocus.jsx +0 -25
  250. package/datePicker/_story/v2/FixTriggerRender.tsx +0 -36
  251. package/datePicker/_story/v2/InputFormat.jsx +0 -29
  252. package/datePicker/_story/v2/InputFormatConfirm.jsx +0 -44
  253. package/datePicker/_story/v2/InputFormatDisabled.jsx +0 -27
  254. package/datePicker/_story/v2/InsetInput.jsx +0 -104
  255. package/datePicker/_story/v2/InsetInputE2E.jsx +0 -69
  256. package/datePicker/_story/v2/PanelOpen.jsx +0 -39
  257. package/datePicker/_story/v2/YearButton.jsx +0 -17
  258. package/datePicker/_story/v2/index.js +0 -11
  259. package/datePicker/dateInput.tsx +0 -455
  260. package/datePicker/datePicker.tsx +0 -796
  261. package/datePicker/footer.tsx +0 -29
  262. package/datePicker/index.tsx +0 -86
  263. package/datePicker/insetInput.tsx +0 -76
  264. package/datePicker/month.tsx +0 -395
  265. package/datePicker/monthsGrid.tsx +0 -649
  266. package/datePicker/navigation.tsx +0 -150
  267. package/datePicker/quickControl.tsx +0 -101
  268. package/datePicker/yearAndMonth.tsx +0 -254
  269. package/descriptions/__test__/descriptions.test.js +0 -193
  270. package/descriptions/_story/Demo.tsx +0 -36
  271. package/descriptions/_story/descriptions.stories.js +0 -145
  272. package/descriptions/_story/descriptions.stories.tsx +0 -6
  273. package/descriptions/descriptions-context.ts +0 -11
  274. package/descriptions/index.tsx +0 -82
  275. package/descriptions/item.tsx +0 -66
  276. package/divider/__test__/divider.test.js +0 -72
  277. package/divider/_story/Demo.tsx +0 -16
  278. package/divider/_story/divider.stories.js +0 -41
  279. package/divider/_story/divider.stories.tsx +0 -8
  280. package/divider/index.tsx +0 -76
  281. package/dropdown/__test__/dropdown.test.js +0 -308
  282. package/dropdown/_story/AutoClose/index.js +0 -120
  283. package/dropdown/_story/DisabledItem/index.js +0 -31
  284. package/dropdown/_story/InHoverElements/index.js +0 -25
  285. package/dropdown/_story/InHoverElements/index.scss +0 -16
  286. package/dropdown/_story/MultiDropdown/index.js +0 -34
  287. package/dropdown/_story/WrapAvatar/index.jsx +0 -10
  288. package/dropdown/_story/dropdown.stories.js +0 -331
  289. package/dropdown/_story/dropdown.stories.tsx +0 -28
  290. package/dropdown/_story/inTable/index.js +0 -194
  291. package/dropdown/context.ts +0 -13
  292. package/dropdown/dropdownDivider.tsx +0 -23
  293. package/dropdown/dropdownItem.tsx +0 -106
  294. package/dropdown/dropdownMenu.tsx +0 -51
  295. package/dropdown/dropdownTitle.tsx +0 -37
  296. package/dropdown/index.tsx +0 -257
  297. package/empty/__test__/empty.test.js +0 -63
  298. package/empty/_story/Demo.tsx +0 -10
  299. package/empty/_story/empty.stories.js +0 -53
  300. package/empty/_story/empty.stories.tsx +0 -8
  301. package/empty/index.tsx +0 -135
  302. package/form/__test__/arrayField.test.js +0 -204
  303. package/form/__test__/baseForm/baseForm.test.js +0 -628
  304. package/form/__test__/baseForm/onChange.test.js +0 -144
  305. package/form/__test__/errorMessage.test.js +0 -59
  306. package/form/__test__/field.test.js +0 -426
  307. package/form/__test__/formApi.test.js +0 -604
  308. package/form/__test__/group.test.js +0 -108
  309. package/form/__test__/hoc.test.js +0 -24
  310. package/form/__test__/label.test.js +0 -69
  311. package/form/__test__/section.test.js +0 -49
  312. package/form/__test__/slot.test.js +0 -108
  313. package/form/_story/Debug/bugDemo.jsx +0 -219
  314. package/form/_story/Debug/childDidMount.jsx +0 -30
  315. package/form/_story/Debug/myRadio.jsx +0 -32
  316. package/form/_story/DynamicField/arrayFieldDemo.jsx +0 -320
  317. package/form/_story/DynamicField/nestArrayField.jsx +0 -159
  318. package/form/_story/FieldProps/bigNumberFieldPath.jsx +0 -73
  319. package/form/_story/FieldProps/convert.jsx +0 -100
  320. package/form/_story/FieldProps/fieldRef.jsx +0 -74
  321. package/form/_story/FieldProps/helpAndExtra.jsx +0 -136
  322. package/form/_story/FieldProps/labelOptional.jsx +0 -30
  323. package/form/_story/FieldProps/pureField.jsx +0 -0
  324. package/form/_story/FieldProps/rulesUpdateDemo.js +0 -116
  325. package/form/_story/FormApi/arrayDemo.jsx +0 -94
  326. package/form/_story/FormApi/formApiDemo.jsx +0 -83
  327. package/form/_story/FormApi/resetDemo.jsx +0 -41
  328. package/form/_story/FormApi/setValuesDemo.jsx +0 -133
  329. package/form/_story/FormSubmit/index.tsx +0 -45
  330. package/form/_story/HOC/displayName.jsx +0 -19
  331. package/form/_story/HOC/withFieldDemo.jsx +0 -216
  332. package/form/_story/Hook/hookDemo.jsx +0 -195
  333. package/form/_story/Layout/layoutDemo.jsx +0 -348
  334. package/form/_story/Layout/modalFormDemo.jsx +0 -94
  335. package/form/_story/Layout/slotDemo.jsx +0 -126
  336. package/form/_story/Performance/performanceDemo.jsx +0 -440
  337. package/form/_story/Performance/selectUseReactNode.jsx +0 -110
  338. package/form/_story/Reference/inform.test.js +0 -110
  339. package/form/_story/Validate/validateDemo.jsx +0 -421
  340. package/form/_story/demo.jsx +0 -433
  341. package/form/_story/form.stories.js +0 -440
  342. package/form/_story/form.stories.tsx +0 -191
  343. package/form/arrayField.tsx +0 -200
  344. package/form/baseForm.tsx +0 -300
  345. package/form/context.tsx +0 -18
  346. package/form/errorMessage.tsx +0 -91
  347. package/form/field.tsx +0 -79
  348. package/form/group.tsx +0 -93
  349. package/form/hoc/withField.tsx +0 -604
  350. package/form/hoc/withFormApi.tsx +0 -11
  351. package/form/hoc/withFormState.tsx +0 -11
  352. package/form/hooks/index.ts +0 -12
  353. package/form/hooks/useArrayFieldState.tsx +0 -9
  354. package/form/hooks/useFieldApi.tsx +0 -21
  355. package/form/hooks/useFieldState.tsx +0 -18
  356. package/form/hooks/useFormApi.tsx +0 -7
  357. package/form/hooks/useFormState.tsx +0 -9
  358. package/form/hooks/useFormUpdater.tsx +0 -6
  359. package/form/hooks/useStateWithGetter.ts +0 -13
  360. package/form/index.tsx +0 -40
  361. package/form/interface.ts +0 -134
  362. package/form/label.tsx +0 -96
  363. package/form/section.tsx +0 -38
  364. package/form/slot.tsx +0 -167
  365. package/getBabelConfig.js +0 -25
  366. package/grid/__test__/calculateGutter.test.js +0 -50
  367. package/grid/_story/demo.scss +0 -23
  368. package/grid/_story/grid.stories.js +0 -290
  369. package/grid/_story/grid.stories.tsx +0 -15
  370. package/grid/col.tsx +0 -135
  371. package/grid/index.tsx +0 -7
  372. package/grid/row.tsx +0 -178
  373. package/gulpfile.js +0 -119
  374. package/iconButton/_story/iconButton.stories.tsx +0 -16
  375. package/iconButton/index.tsx +0 -134
  376. package/icons/_story/Others/add-template-icon.jsx +0 -0
  377. package/icons/_story/Others/add-template-icon.svg +0 -10
  378. package/icons/_story/Others/hangup.svg +0 -3
  379. package/icons/_story/Others/index.js +0 -24
  380. package/icons/_story/Others/xianglin.svg +0 -3
  381. package/icons/_story/icon.stories.js +0 -63
  382. package/icons/_story/icon.stories.tsx +0 -46
  383. package/icons/index.tsx +0 -5
  384. package/index.ts +0 -97
  385. package/input/__test__/input.test.js +0 -285
  386. package/input/__test__/textArea.test.js +0 -172
  387. package/input/_story/Demo.tsx +0 -33
  388. package/input/_story/TextareaDemo.tsx +0 -27
  389. package/input/_story/input.scss +0 -0
  390. package/input/_story/input.stories.js +0 -961
  391. package/input/_story/input.stories.tsx +0 -11
  392. package/input/index.tsx +0 -515
  393. package/input/inputGroup.tsx +0 -127
  394. package/input/textarea.tsx +0 -339
  395. package/inputNumber/__test__/inputNumber.test.js +0 -434
  396. package/inputNumber/_story/input.stories.tsx +0 -17
  397. package/inputNumber/_story/inputNumber.scss +0 -10
  398. package/inputNumber/_story/inputNumber.stories.js +0 -767
  399. package/inputNumber/index.tsx +0 -518
  400. package/layout/Sider.tsx +0 -122
  401. package/layout/__test__/layout.test.js +0 -51
  402. package/layout/_story/layout.stories.js +0 -305
  403. package/layout/_story/layout.stories.tsx +0 -13
  404. package/layout/index.tsx +0 -129
  405. package/layout/layout-context.ts +0 -18
  406. package/list/__test__/list.test.js +0 -264
  407. package/list/_story/list.stories.js +0 -920
  408. package/list/_story/list.stories.tsx +0 -26
  409. package/list/index.tsx +0 -186
  410. package/list/item.tsx +0 -113
  411. package/list/list-context.ts +0 -15
  412. package/locale/README.md +0 -53
  413. package/locale/_story/locale.stories.js +0 -221
  414. package/locale/_story/locale.stories.tsx +0 -57
  415. package/locale/context.tsx +0 -5
  416. package/locale/interface.ts +0 -155
  417. package/locale/localeConsumer.tsx +0 -58
  418. package/locale/localeProvider.tsx +0 -35
  419. package/locale/source/ar.ts +0 -159
  420. package/locale/source/de.ts +0 -159
  421. package/locale/source/en_GB.ts +0 -159
  422. package/locale/source/en_US.ts +0 -159
  423. package/locale/source/es.ts +0 -163
  424. package/locale/source/fr.ts +0 -159
  425. package/locale/source/id_ID.ts +0 -160
  426. package/locale/source/it.ts +0 -159
  427. package/locale/source/ja_JP.ts +0 -160
  428. package/locale/source/ko_KR.ts +0 -160
  429. package/locale/source/ms_MY.ts +0 -159
  430. package/locale/source/pt_BR.ts +0 -167
  431. package/locale/source/ru_RU.ts +0 -162
  432. package/locale/source/th_TH.ts +0 -163
  433. package/locale/source/tr_TR.ts +0 -159
  434. package/locale/source/vi_VN.ts +0 -162
  435. package/locale/source/zh_CN.ts +0 -160
  436. package/locale/source/zh_TW.ts +0 -160
  437. package/modal/ConfirmModal.tsx +0 -89
  438. package/modal/Modal.tsx +0 -417
  439. package/modal/ModalContent.tsx +0 -337
  440. package/modal/__test__/confirm.test.js +0 -203
  441. package/modal/__test__/modal.test.js +0 -324
  442. package/modal/_story/CollapsibleInModal/index.jsx +0 -100
  443. package/modal/_story/DynamicContext/context.js +0 -8
  444. package/modal/_story/DynamicContext/index.jsx +0 -30
  445. package/modal/_story/__snapshots__/modal.stories.tsx.snap +0 -203
  446. package/modal/_story/modal.stories.js +0 -343
  447. package/modal/_story/modal.stories.tsx +0 -41
  448. package/modal/confirm.tsx +0 -120
  449. package/modal/index.tsx +0 -13
  450. package/modal/useModal/HookModal.tsx +0 -63
  451. package/modal/useModal/index.tsx +0 -80
  452. package/motions/Rotate.tsx +0 -64
  453. package/navigation/CollapseButton.tsx +0 -47
  454. package/navigation/Footer.tsx +0 -74
  455. package/navigation/Header.tsx +0 -82
  456. package/navigation/Item.tsx +0 -293
  457. package/navigation/OpenIconTransition.tsx +0 -58
  458. package/navigation/README.md +0 -10
  459. package/navigation/SubNav.tsx +0 -389
  460. package/navigation/SubNavTransition.tsx +0 -58
  461. package/navigation/__test__/navigation.test.js +0 -274
  462. package/navigation/_story/AutoOpen/index.js +0 -69
  463. package/navigation/_story/ControlledSelectedKeys/index.js +0 -78
  464. package/navigation/_story/DisabledNav/index.js +0 -46
  465. package/navigation/_story/ItemsChange/index.js +0 -41
  466. package/navigation/_story/LinkNav/index.jsx +0 -90
  467. package/navigation/_story/MountUnmount/index.js +0 -57
  468. package/navigation/_story/WithChildren/index.js +0 -119
  469. package/navigation/_story/WithRouter/index.js +0 -111
  470. package/navigation/_story/navigation.stories.js +0 -330
  471. package/navigation/_story/navigation.stories.tsx +0 -101
  472. package/navigation/index.tsx +0 -427
  473. package/navigation/nav-context.ts +0 -30
  474. package/notification/NoticeTransition.tsx +0 -68
  475. package/notification/__test__/notification.test.js +0 -325
  476. package/notification/_story/Demo.tsx +0 -29
  477. package/notification/_story/notification.stories.js +0 -225
  478. package/notification/_story/notification.stories.tsx +0 -6
  479. package/notification/_story/useNotification/context.js +0 -3
  480. package/notification/_story/useNotification/index.jsx +0 -43
  481. package/notification/index.tsx +0 -267
  482. package/notification/notice.tsx +0 -204
  483. package/notification/useNotification/HookNotice.tsx +0 -36
  484. package/notification/useNotification/index.tsx +0 -94
  485. package/overflowList/__test__/overflowList.test.js +0 -31
  486. package/overflowList/_story/Demo.tsx +0 -36
  487. package/overflowList/_story/overflowList.stories.js +0 -400
  488. package/overflowList/_story/overflowList.stories.tsx +0 -7
  489. package/overflowList/index.tsx +0 -279
  490. package/overflowList/intersectionObserver.tsx +0 -94
  491. package/pagination/__test__/pagination.test.js +0 -255
  492. package/pagination/_story/pagination.stories.js +0 -159
  493. package/pagination/_story/pagination.stories.tsx +0 -11
  494. package/pagination/index.tsx +0 -476
  495. package/popconfirm/__test__/popconfirm.test.js +0 -131
  496. package/popconfirm/_story/DynamicDisable/index.jsx +0 -25
  497. package/popconfirm/_story/InTable/index.js +0 -75
  498. package/popconfirm/_story/ShowArrow/index.jsx +0 -141
  499. package/popconfirm/_story/TitlePopconfirm/index.js +0 -130
  500. package/popconfirm/_story/TypesConfirm/index.jsx +0 -121
  501. package/popconfirm/_story/popconfirm.stories.js +0 -170
  502. package/popconfirm/_story/popconfirm.stories.tsx +0 -20
  503. package/popconfirm/index.tsx +0 -249
  504. package/popover/Arrow.tsx +0 -66
  505. package/popover/__test__/popover.test.js +0 -52
  506. package/popover/_story/ArrowPointAtCenter/index.jsx +0 -138
  507. package/popover/_story/BtnClose/index.jsx +0 -80
  508. package/popover/_story/NestedPopover/index.js +0 -41
  509. package/popover/_story/PopRight/index.js +0 -25
  510. package/popover/_story/PopRight/index.scss +0 -25
  511. package/popover/_story/SelectInPopover/index.jsx +0 -38
  512. package/popover/_story/popover.stories.js +0 -684
  513. package/popover/_story/popover.stories.tsx +0 -53
  514. package/popover/index.tsx +0 -182
  515. package/progress/__test__/progress.test.js +0 -127
  516. package/progress/_story/progress.stories.js +0 -71
  517. package/progress/_story/progress.stories.tsx +0 -11
  518. package/progress/index.tsx +0 -283
  519. package/radio/__test__/radio.test.jsx +0 -91
  520. package/radio/__test__/radioGroup.test.jsx +0 -207
  521. package/radio/_story/Demo.tsx +0 -34
  522. package/radio/_story/radio.scss +0 -4
  523. package/radio/_story/radio.stories.js +0 -892
  524. package/radio/_story/radio.stories.tsx +0 -7
  525. package/radio/context.ts +0 -25
  526. package/radio/index.tsx +0 -12
  527. package/radio/radio.tsx +0 -320
  528. package/radio/radioGroup.tsx +0 -240
  529. package/radio/radioInner.tsx +0 -151
  530. package/rating/__test__/rating.test.js +0 -247
  531. package/rating/_story/rating.stories.js +0 -108
  532. package/rating/_story/rating.stories.tsx +0 -11
  533. package/rating/index.tsx +0 -345
  534. package/rating/item.tsx +0 -233
  535. package/resizeObserver/index.tsx +0 -115
  536. package/scripts/compileDist.js +0 -52
  537. package/scripts/compileLib.js +0 -13
  538. package/scripts/compileScss.js +0 -25
  539. package/scrollList/__test__/scrollList.test.js +0 -226
  540. package/scrollList/_story/ScrollList/index.js +0 -69
  541. package/scrollList/_story/SingleWheelList/index.js +0 -72
  542. package/scrollList/_story/WheelList/index.js +0 -119
  543. package/scrollList/_story/scrolllist.stories.js +0 -33
  544. package/scrollList/_story/scrolllist.stories.tsx +0 -131
  545. package/scrollList/index.tsx +0 -81
  546. package/scrollList/scrollItem.tsx +0 -540
  547. package/select/__test__/select.test.js +0 -1323
  548. package/select/_story/CustomTrigger/index.jsx +0 -21
  549. package/select/_story/select.scss +0 -51
  550. package/select/_story/select.stories.js +0 -2988
  551. package/select/_story/select.stories.tsx +0 -195
  552. package/select/index.tsx +0 -1239
  553. package/select/option.tsx +0 -166
  554. package/select/optionGroup.tsx +0 -42
  555. package/select/utils.tsx +0 -76
  556. package/select/virtualRow.tsx +0 -13
  557. package/sideSheet/SideSheetContent.tsx +0 -177
  558. package/sideSheet/SideSheetTransition.tsx +0 -104
  559. package/sideSheet/__test__/sideSheet.test.js +0 -319
  560. package/sideSheet/_story/sideSheet.stories.js +0 -379
  561. package/sideSheet/_story/sideSheet.stories.tsx +0 -48
  562. package/sideSheet/index.tsx +0 -270
  563. package/skeleton/__test__/skeleton.test.js +0 -32
  564. package/skeleton/_story/skeleton.stories.js +0 -82
  565. package/skeleton/_story/skeleton.stories.tsx +0 -61
  566. package/skeleton/index.tsx +0 -62
  567. package/skeleton/item.tsx +0 -82
  568. package/slider/__test__/__snapshots__/slider.test.js.snap +0 -5
  569. package/slider/__test__/slider.test.js +0 -164
  570. package/slider/_story/Demo.scss +0 -3
  571. package/slider/_story/Demo.tsx +0 -28
  572. package/slider/_story/slider.stories.js +0 -428
  573. package/slider/_story/slider.stories.tsx +0 -7
  574. package/slider/index.tsx +0 -635
  575. package/space/__test__/space.test.js +0 -99
  576. package/space/_story/space.stories.js +0 -254
  577. package/space/_story/space.stories.tsx +0 -26
  578. package/space/index.tsx +0 -95
  579. package/space/utils.ts +0 -24
  580. package/spin/__test__/spin.test.js +0 -46
  581. package/spin/_story/Demo.tsx +0 -10
  582. package/spin/_story/spin.stories.js +0 -92
  583. package/spin/_story/spin.stories.tsx +0 -6
  584. package/spin/icon.tsx +0 -55
  585. package/spin/index.tsx +0 -137
  586. package/steps/__test__/steps.test.js +0 -372
  587. package/steps/_story/steps.stories.js +0 -306
  588. package/steps/_story/steps.stories.tsx +0 -17
  589. package/steps/basicStep.tsx +0 -141
  590. package/steps/basicSteps.tsx +0 -111
  591. package/steps/context.ts +0 -7
  592. package/steps/fillStep.tsx +0 -128
  593. package/steps/fillSteps.tsx +0 -98
  594. package/steps/index.tsx +0 -69
  595. package/steps/navStep.tsx +0 -74
  596. package/steps/navSteps.tsx +0 -74
  597. package/steps/step.tsx +0 -37
  598. package/switch/__test__/switch.test.js +0 -128
  599. package/switch/_story/switch.stories.js +0 -161
  600. package/switch/_story/switch.stories.tsx +0 -124
  601. package/switch/index.tsx +0 -185
  602. package/table/Body/BaseRow.tsx +0 -400
  603. package/table/Body/ExpandedRow.tsx +0 -157
  604. package/table/Body/SectionRow.tsx +0 -202
  605. package/table/Body/index.tsx +0 -859
  606. package/table/ColGroup.tsx +0 -66
  607. package/table/Column.tsx +0 -17
  608. package/table/ColumnFilter.tsx +0 -210
  609. package/table/ColumnSelection.tsx +0 -91
  610. package/table/ColumnShape.ts +0 -33
  611. package/table/ColumnSorter.tsx +0 -81
  612. package/table/CustomExpandIcon.tsx +0 -100
  613. package/table/HeadTable.tsx +0 -120
  614. package/table/ResizableHeaderCell.tsx +0 -44
  615. package/table/ResizableTable.tsx +0 -176
  616. package/table/Table.tsx +0 -1413
  617. package/table/TableCell.tsx +0 -367
  618. package/table/TableContextProvider.tsx +0 -53
  619. package/table/TableHeader.tsx +0 -183
  620. package/table/TableHeaderRow.tsx +0 -196
  621. package/table/TablePagination.tsx +0 -52
  622. package/table/__test__/table.test.js +0 -1952
  623. package/table/_story/BetterScrollbar.tsx +0 -115
  624. package/table/_story/ChildrenData/index.js +0 -251
  625. package/table/_story/ChildrenDataInnerSelected/index.js +0 -221
  626. package/table/_story/ChildrenDataSelected/index.js +0 -247
  627. package/table/_story/ControlledPagination/index.jsx +0 -232
  628. package/table/_story/ControlledSortOrder/index.jsx +0 -85
  629. package/table/_story/CustomComponents/index.js +0 -101
  630. package/table/_story/CustomExpandIcons/index.js +0 -97
  631. package/table/_story/CustomFilterDropdownItem/index.jsx +0 -98
  632. package/table/_story/DefaultSortOrder.tsx +0 -120
  633. package/table/_story/Demos/columnRender.jsx +0 -131
  634. package/table/_story/Demos/controlledPagination.jsx +0 -125
  635. package/table/_story/Demos/customFilter.jsx +0 -110
  636. package/table/_story/Demos/default.jsx +0 -82
  637. package/table/_story/Demos/dynamic.jsx +0 -594
  638. package/table/_story/Demos/expand.jsx +0 -114
  639. package/table/_story/Demos/filterAndSorter.jsx +0 -102
  640. package/table/_story/Demos/fixed.jsx +0 -117
  641. package/table/_story/Demos/fullRender.jsx +0 -131
  642. package/table/_story/Demos/group.jsx +0 -109
  643. package/table/_story/Demos/headerMerge.jsx +0 -121
  644. package/table/_story/Demos/headerMergeJSX.jsx +0 -83
  645. package/table/_story/Demos/infiniteScroll.jsx +0 -118
  646. package/table/_story/Demos/onRow.jsx +0 -114
  647. package/table/_story/Demos/pagination.jsx +0 -101
  648. package/table/_story/Demos/resizable copy.jsx +0 -102
  649. package/table/_story/Demos/resizable.jsx +0 -183
  650. package/table/_story/Demos/rowSelection.jsx +0 -130
  651. package/table/_story/Demos/sortTree.jsx +0 -218
  652. package/table/_story/Demos/sortable.jsx +0 -183
  653. package/table/_story/Demos/span.jsx +0 -155
  654. package/table/_story/Demos/tree.jsx +0 -109
  655. package/table/_story/Demos/treeSelect.jsx +0 -196
  656. package/table/_story/Demos/virtualized.jsx +0 -103
  657. package/table/_story/Demos/zebra.jsx +0 -124
  658. package/table/_story/DragableTable/index.jsx +0 -156
  659. package/table/_story/DragableTable/index.scss +0 -7
  660. package/table/_story/DynamicFilters/data.json +0 -105
  661. package/table/_story/DynamicFilters/index.js +0 -78
  662. package/table/_story/DynamicTable/index.jsx +0 -569
  663. package/table/_story/EventTable/index.jsx +0 -76
  664. package/table/_story/Expand/index.js +0 -85
  665. package/table/_story/ExpandAllGroupRows/index.jsx +0 -90
  666. package/table/_story/ExpandAllRows/index.jsx +0 -111
  667. package/table/_story/ExpandRowByClick.jsx +0 -77
  668. package/table/_story/FilterWithNewDataTable/index.jsx +0 -108
  669. package/table/_story/FixAllColumnsWithoutWidth.tsx +0 -52
  670. package/table/_story/FixRenderReturnProps.jsx +0 -105
  671. package/table/_story/FixedExpandedRows/index.js +0 -105
  672. package/table/_story/FixedGroups/index.js +0 -80
  673. package/table/_story/FixedTable/index.js +0 -92
  674. package/table/_story/FnTable/index.js +0 -103
  675. package/table/_story/FullRender/index.jsx +0 -135
  676. package/table/_story/GroupedCols/index.jsx +0 -83
  677. package/table/_story/GroupedColsFixed/index.jsx +0 -95
  678. package/table/_story/GroupedColsFixedJSX/index.jsx +0 -122
  679. package/table/_story/GroupedColsFixedVirtualized/index.jsx +0 -107
  680. package/table/_story/GroupedColsFixedVirtualizedGroups/index.jsx +0 -110
  681. package/table/_story/GroupedRows/index.js +0 -83
  682. package/table/_story/GroupedRowsFixed/index.js +0 -81
  683. package/table/_story/InSideSheet/index.jsx +0 -90
  684. package/table/_story/InfiniteScroll/index.js +0 -115
  685. package/table/_story/JSXAsyncData/index.jsx +0 -47
  686. package/table/_story/JSXColumnPropColumn.jsx +0 -57
  687. package/table/_story/JSXColumnsComplex.jsx +0 -174
  688. package/table/_story/JSXColumnsNest.tsx +0 -74
  689. package/table/_story/JSXColumnsSmiple.jsx +0 -53
  690. package/table/_story/JSXFixedTable/index.js +0 -224
  691. package/table/_story/JSXTitles/index.js +0 -55
  692. package/table/_story/LinkedScroll/index.jsx +0 -137
  693. package/table/_story/LinkedScroll/index.scss +0 -0
  694. package/table/_story/MassiveColumns/index.jsx +0 -109
  695. package/table/_story/MassiveColumns/index.scss +0 -9
  696. package/table/_story/ModalTable/index.jsx +0 -228
  697. package/table/_story/PagintaionTable/index.js +0 -123
  698. package/table/_story/Perf/Render/complex.jsx +0 -191
  699. package/table/_story/Perf/Render/context.jsx +0 -72
  700. package/table/_story/Perf/Render/controlledSelection.jsx +0 -103
  701. package/table/_story/Perf/Render/index.jsx +0 -95
  702. package/table/_story/Perf/Render/onRow.jsx +0 -112
  703. package/table/_story/Perf/Render/resizableSelection.jsx +0 -193
  704. package/table/_story/Perf/Virtualized/index.jsx +0 -71
  705. package/table/_story/Perf/index.js +0 -8
  706. package/table/_story/RTL/AlignScrollBar.jsx +0 -17
  707. package/table/_story/RTL/index.js +0 -2
  708. package/table/_story/RenderPagination/index.jsx +0 -161
  709. package/table/_story/ResizableColumns/index.jsx +0 -95
  710. package/table/_story/ResizableColumns/index.scss +0 -30
  711. package/table/_story/ResizableTable/index.jsx +0 -85
  712. package/table/_story/ScrollBar/index.jsx +0 -71
  713. package/table/_story/SelectedRows/index.js +0 -137
  714. package/table/_story/TableSpan/index.jsx +0 -117
  715. package/table/_story/TabsTable/index.jsx +0 -78
  716. package/table/_story/TestClone/index.js +0 -0
  717. package/table/_story/VirtualTableOnCell/index.jsx +0 -84
  718. package/table/_story/VirtualizedDynamicData/index.jsx +0 -111
  719. package/table/_story/VirtualizedGroupedRows/index.jsx +0 -135
  720. package/table/_story/VirtualizedNotFixed/index.js +0 -89
  721. package/table/_story/VritualizedDataSelected/index.js +0 -273
  722. package/table/_story/WarnColumnWithoutDataIndex.tsx +0 -71
  723. package/table/_story/WithSideSheet/index.js +0 -82
  724. package/table/_story/data/big.json +0 -8205
  725. package/table/_story/data/big2.json +0 -42271
  726. package/table/_story/table.stories.js +0 -596
  727. package/table/_story/table.stories.tsx +0 -382
  728. package/table/_story/v2/FixedColumnsChange/index.jsx +0 -104
  729. package/table/_story/v2/FixedExpandedRow/index.jsx +0 -95
  730. package/table/_story/v2/FixedFilter/index.tsx +0 -106
  731. package/table/_story/v2/FixedHeaderMerge/index.jsx +0 -98
  732. package/table/_story/v2/FixedMemoryLeak/index.jsx +0 -33
  733. package/table/_story/v2/FixedOnHeaderRow/index.jsx +0 -137
  734. package/table/_story/v2/FixedResizable/index.jsx +0 -114
  735. package/table/_story/v2/FixedSorter/index.tsx +0 -102
  736. package/table/_story/v2/FixedVirtualizedEmpty.tsx +0 -76
  737. package/table/_story/v2/FixedZIndex/index.jsx +0 -87
  738. package/table/_story/v2/defaultFilteredValue.tsx +0 -114
  739. package/table/_story/v2/index.js +0 -12
  740. package/table/_story/v2/radioRowSelection.tsx +0 -107
  741. package/table/_story/virtualized/index.js +0 -92
  742. package/table/_story/virtualizedFixed/index.js +0 -131
  743. package/table/getColumns.tsx +0 -34
  744. package/table/index.tsx +0 -44
  745. package/table/interface.ts +0 -321
  746. package/table/table-context.ts +0 -32
  747. package/table/utils.ts +0 -123
  748. package/tabs/TabBar.tsx +0 -264
  749. package/tabs/TabPane.tsx +0 -128
  750. package/tabs/TabPaneTransition.tsx +0 -67
  751. package/tabs/__test__/tabs.test.js +0 -208
  752. package/tabs/_story/Demo.tsx +0 -39
  753. package/tabs/_story/search.jsx +0 -37
  754. package/tabs/_story/tabs.stories.js +0 -905
  755. package/tabs/_story/tabs.stories.tsx +0 -6
  756. package/tabs/index.tsx +0 -302
  757. package/tabs/interface.ts +0 -87
  758. package/tabs/tabs-context.ts +0 -6
  759. package/tag/_story/Demo.tsx +0 -22
  760. package/tag/_story/tag.stories.js +0 -290
  761. package/tag/_story/tag.stories.tsx +0 -6
  762. package/tag/group.tsx +0 -136
  763. package/tag/index.tsx +0 -163
  764. package/tag/interface.ts +0 -56
  765. package/tagInput/__test__/tagInput.test.js +0 -398
  766. package/tagInput/_story/tagInput.stories.js +0 -445
  767. package/tagInput/_story/tagInput.stories.tsx +0 -24
  768. package/tagInput/index.tsx +0 -612
  769. package/timePicker/Combobox.tsx +0 -336
  770. package/timePicker/PanelShape.ts +0 -8
  771. package/timePicker/TimeInput.tsx +0 -207
  772. package/timePicker/TimePicker.tsx +0 -550
  773. package/timePicker/TimeShape.ts +0 -19
  774. package/timePicker/__test__/timePicker.test.js +0 -322
  775. package/timePicker/_story/Callbacks/index.jsx +0 -24
  776. package/timePicker/_story/CustomTrigger/index.jsx +0 -35
  777. package/timePicker/_story/DisabledTime/index.jsx +0 -17
  778. package/timePicker/_story/timepicker.stories.js +0 -301
  779. package/timePicker/_story/timepicker.stories.tsx +0 -18
  780. package/timePicker/index.tsx +0 -47
  781. package/timeline/__test__/timeline.test.js +0 -253
  782. package/timeline/_story/timeline.stories.js +0 -235
  783. package/timeline/_story/timeline.stories.tsx +0 -15
  784. package/timeline/index.tsx +0 -97
  785. package/timeline/item.tsx +0 -83
  786. package/toast/ToastTransition.tsx +0 -43
  787. package/toast/__test__/toast-command-call.test.js +0 -63
  788. package/toast/__test__/toast.test.js +0 -104
  789. package/toast/_story/Demo.tsx +0 -22
  790. package/toast/_story/toast.stories.js +0 -139
  791. package/toast/_story/toast.stories.tsx +0 -7
  792. package/toast/index.tsx +0 -234
  793. package/toast/toast.tsx +0 -152
  794. package/toast/useToast/HookToast.tsx +0 -35
  795. package/toast/useToast/index.tsx +0 -79
  796. package/tooltip/ArrowBoundingShape.ts +0 -8
  797. package/tooltip/TooltipStyledTransition.tsx +0 -31
  798. package/tooltip/TriangleArrow.tsx +0 -12
  799. package/tooltip/TriangleArrowVertical.tsx +0 -12
  800. package/tooltip/__test__/tooltip.test.js +0 -364
  801. package/tooltip/_story/ArrowPointAtCenter/index.jsx +0 -137
  802. package/tooltip/_story/ContainerPosition/index.jsx +0 -15
  803. package/tooltip/_story/ContainerPosition/index.scss +0 -10
  804. package/tooltip/_story/CustomContainer/index.jsx +0 -39
  805. package/tooltip/_story/DangerousHtml/index.js +0 -30
  806. package/tooltip/_story/Edge/index.js +0 -16
  807. package/tooltip/_story/InTable/index.jsx +0 -86
  808. package/tooltip/_story/Safari/autoAdjust.js +0 -23
  809. package/tooltip/_story/ScrollDemo/index.js +0 -65
  810. package/tooltip/_story/story.scss +0 -50
  811. package/tooltip/_story/tooltip.stories.js +0 -1099
  812. package/tooltip/_story/tooltip.stories.tsx +0 -54
  813. package/tooltip/index.tsx +0 -737
  814. package/transfer/__test__/transfer.test.js +0 -324
  815. package/transfer/_story/transfer.scss +0 -124
  816. package/transfer/_story/transfer.stories.js +0 -787
  817. package/transfer/_story/transfer.stories.tsx +0 -80
  818. package/transfer/index.tsx +0 -667
  819. package/tree/__test__/autosizer.test.js +0 -102
  820. package/tree/__test__/tree.test.js +0 -927
  821. package/tree/__test__/treeMultiple.test.js +0 -687
  822. package/tree/__test__/treeNodeProps.test.js +0 -192
  823. package/tree/_story/BigData.jsx +0 -58
  824. package/tree/_story/Demo.tsx +0 -72
  825. package/tree/_story/bigDataGen.jsx +0 -98
  826. package/tree/_story/data.js +0 -3
  827. package/tree/_story/tree.stories.js +0 -2550
  828. package/tree/_story/tree.stories.tsx +0 -7
  829. package/tree/autoSizer.tsx +0 -86
  830. package/tree/collapse.tsx +0 -144
  831. package/tree/index.tsx +0 -798
  832. package/tree/interface.ts +0 -148
  833. package/tree/nodeList.tsx +0 -88
  834. package/tree/treeContext.tsx +0 -49
  835. package/tree/treeNode.tsx +0 -443
  836. package/tree/treeUtil.tsx +0 -14
  837. package/treeSelect/__test__/treeMultiple.test.js +0 -775
  838. package/treeSelect/__test__/treeSelect.test.js +0 -968
  839. package/treeSelect/_story/CustomTrigger/index.jsx +0 -47
  840. package/treeSelect/_story/Demo.tsx +0 -83
  841. package/treeSelect/_story/treeSelect.stories.js +0 -1658
  842. package/treeSelect/_story/treeSelect.stories.tsx +0 -7
  843. package/treeSelect/index.tsx +0 -1417
  844. package/trigger/__test__/trigger.test.js +0 -17
  845. package/trigger/index.tsx +0 -45
  846. package/tsconfig.json +0 -33
  847. package/typography/__test__/typography.test.js +0 -75
  848. package/typography/_story/typography.stories.js +0 -637
  849. package/typography/_story/typography.stories.tsx +0 -175
  850. package/typography/base.tsx +0 -634
  851. package/typography/copyable.tsx +0 -144
  852. package/typography/index.tsx +0 -24
  853. package/typography/interface.ts +0 -27
  854. package/typography/paragraph.tsx +0 -77
  855. package/typography/text.tsx +0 -68
  856. package/typography/title.tsx +0 -74
  857. package/typography/typography.tsx +0 -41
  858. package/typography/util.tsx +0 -140
  859. package/upload/__test__/dragUpload.test.js +0 -122
  860. package/upload/__test__/upload.test.js +0 -947
  861. package/upload/_story/upload.stories.js +0 -1111
  862. package/upload/_story/upload.stories.tsx +0 -16
  863. package/upload/fileCard.tsx +0 -283
  864. package/upload/index.tsx +0 -721
  865. package/upload/interface.ts +0 -64
  866. 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
- });