amis-ui 1.0.0-beta.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 (1178) hide show
  1. package/dist/components/404.d.ts +54 -0
  2. package/dist/components/404.js +44 -0
  3. package/dist/components/Alert.d.ts +560 -0
  4. package/dist/components/Alert.js +201 -0
  5. package/dist/components/Alert2.d.ts +66 -0
  6. package/dist/components/Alert2.js +69 -0
  7. package/dist/components/AnchorNav.d.ts +118 -0
  8. package/dist/components/AnchorNav.js +181 -0
  9. package/dist/components/ArrayInput.d.ts +625 -0
  10. package/dist/components/ArrayInput.js +162 -0
  11. package/dist/components/AsideNav.d.ts +142 -0
  12. package/dist/components/AsideNav.js +139 -0
  13. package/dist/components/AssociatedSelection.d.ts +491 -0
  14. package/dist/components/AssociatedSelection.js +113 -0
  15. package/dist/components/Avatar.d.ts +113 -0
  16. package/dist/components/Avatar.js +150 -0
  17. package/dist/components/Badge.d.ts +120 -0
  18. package/dist/components/BaiduMapPicker.d.ts +86 -0
  19. package/dist/components/BarCode.d.ts +58 -0
  20. package/dist/components/Breadcrumb.d.ts +115 -0
  21. package/dist/components/Breadcrumb.js +173 -0
  22. package/dist/components/Button.d.ts +74 -0
  23. package/dist/components/Button.js +73 -0
  24. package/dist/components/CalendarMobile.d.ts +353 -0
  25. package/dist/components/CalendarMobile.js +541 -0
  26. package/dist/components/Card.d.ts +75 -0
  27. package/dist/components/Cascader.d.ts +109 -0
  28. package/dist/components/ChainedSelection.d.ts +480 -0
  29. package/dist/components/ChainedSelection.js +131 -0
  30. package/dist/components/Checkbox.d.ts +69 -0
  31. package/dist/components/Checkbox.js +73 -0
  32. package/dist/components/CityArea.d.ts +307 -0
  33. package/dist/components/CityDB.d.ts +13 -0
  34. package/dist/components/CodeMirror.d.ts +25 -0
  35. package/dist/components/CodeMirror.js +113 -0
  36. package/dist/components/Collapse.d.ts +92 -0
  37. package/dist/components/Collapse.js +166 -0
  38. package/dist/components/CollapseGroup.d.ts +68 -0
  39. package/dist/components/CollapseGroup.js +96 -0
  40. package/dist/components/ColorPicker.d.ts +524 -0
  41. package/dist/components/ContextMenu.d.ts +96 -0
  42. package/dist/components/ContextMenu.js +225 -0
  43. package/dist/components/DatePicker.d.ts +619 -0
  44. package/dist/components/DatePicker.js +534 -0
  45. package/dist/components/DateRangePicker.d.ts +876 -0
  46. package/dist/components/DateRangePicker.js +1050 -0
  47. package/dist/components/Drawer.d.ts +95 -0
  48. package/dist/components/Drawer.js +262 -0
  49. package/dist/components/Editor.d.ts +605 -0
  50. package/dist/components/Editor.js +245 -0
  51. package/dist/components/Form.d.ts +22 -0
  52. package/dist/components/FormField.d.ts +65 -0
  53. package/dist/components/GridNav.d.ts +52 -0
  54. package/dist/components/GroupedSelection.d.ts +467 -0
  55. package/dist/components/GroupedSelection.js +71 -0
  56. package/dist/components/Html.d.ts +83 -0
  57. package/dist/components/Html.js +61 -0
  58. package/dist/components/ImageGallery.d.ts +297 -0
  59. package/dist/components/Input.d.ts +16 -0
  60. package/dist/components/Input.js +70 -0
  61. package/dist/components/InputBox.d.ts +99 -0
  62. package/dist/components/InputBox.js +106 -0
  63. package/dist/components/InputBoxWithSuggestion.d.ts +280 -0
  64. package/dist/components/InputBoxWithSuggestion.js +75 -0
  65. package/dist/components/Layout.d.ts +144 -0
  66. package/dist/components/Layout.js +75 -0
  67. package/dist/components/Link.d.ts +62 -0
  68. package/dist/components/ListGroup.d.ts +76 -0
  69. package/dist/components/ListGroup.js +40 -0
  70. package/dist/components/ListMenu.d.ts +573 -0
  71. package/dist/components/LocationPicker.d.ts +427 -0
  72. package/dist/components/Markdown.d.ts +20 -0
  73. package/dist/components/Modal.d.ts +1278 -0
  74. package/dist/components/Modal.js +159 -0
  75. package/dist/components/ModalManager.d.ts +17 -0
  76. package/dist/components/ModalManager.js +53 -0
  77. package/dist/components/MonthRangePicker.d.ts +748 -0
  78. package/dist/components/NumberInput.d.ts +89 -0
  79. package/dist/components/NumberInput.js +147 -0
  80. package/dist/components/Overlay.d.ts +41 -0
  81. package/dist/components/Overlay.js +218 -0
  82. package/dist/components/Pagination.d.ts +685 -0
  83. package/dist/components/Picker.d.ts +284 -0
  84. package/dist/components/Picker.js +82 -0
  85. package/dist/components/PickerColumn.d.ts +63 -0
  86. package/dist/components/PickerColumn.js +285 -0
  87. package/dist/components/PickerContainer.d.ts +303 -0
  88. package/dist/components/PickerContainer.js +158 -0
  89. package/dist/components/PopOver.d.ts +90 -0
  90. package/dist/components/PopOver.js +98 -0
  91. package/dist/components/PopOverContainer.d.ts +28 -0
  92. package/dist/components/PopOverContainer.js +101 -0
  93. package/dist/components/PopUp.d.ts +578 -0
  94. package/dist/components/PopUp.js +96 -0
  95. package/dist/components/Progress.d.ts +68 -0
  96. package/dist/components/PullRefresh.d.ts +64 -0
  97. package/dist/components/PullRefresh.js +149 -0
  98. package/dist/components/Radios.d.ts +180 -0
  99. package/dist/components/Radios.js +121 -0
  100. package/dist/components/Range.d.ts +122 -0
  101. package/dist/components/Range.js +418 -0
  102. package/dist/components/Rating.d.ts +252 -0
  103. package/dist/components/Rating.js +324 -0
  104. package/dist/components/ResultBox.d.ts +290 -0
  105. package/dist/components/ResultBox.js +156 -0
  106. package/dist/components/ResultList.d.ts +319 -0
  107. package/dist/components/ResultList.js +192 -0
  108. package/dist/components/ResultTableList.d.ts +708 -0
  109. package/dist/components/ResultTableList.js +135 -0
  110. package/dist/components/ResultTreeList.d.ts +308 -0
  111. package/dist/components/ResultTreeList.js +217 -0
  112. package/dist/components/RichText.d.ts +45 -0
  113. package/dist/components/SearchBox.d.ts +504 -0
  114. package/dist/components/SearchBox.js +137 -0
  115. package/dist/components/Select.d.ts +6280 -0
  116. package/dist/components/Select.js +772 -0
  117. package/dist/components/Selection.d.ts +510 -0
  118. package/dist/components/Selection.js +151 -0
  119. package/dist/components/SparkLine.d.ts +403 -0
  120. package/dist/components/SparkLine.js +71 -0
  121. package/dist/components/Spinner.d.ts +174 -0
  122. package/dist/components/Spinner.js +77 -0
  123. package/dist/components/Steps.d.ts +110 -0
  124. package/dist/components/Switch.d.ts +101 -0
  125. package/dist/components/Switch.js +73 -0
  126. package/dist/components/TableSelection.d.ts +695 -0
  127. package/dist/components/TableSelection.js +88 -0
  128. package/dist/components/Tabs.d.ts +210 -0
  129. package/dist/components/Tabs.js +486 -0
  130. package/dist/components/TabsTransfer.d.ts +297 -0
  131. package/dist/components/TabsTransfer.js +220 -0
  132. package/dist/components/TabsTransferPicker.d.ts +273 -0
  133. package/dist/components/Tag.d.ts +104 -0
  134. package/dist/components/Textarea.d.ts +568 -0
  135. package/dist/components/Textarea.js +144 -0
  136. package/dist/components/Timeline.d.ts +47 -0
  137. package/dist/components/TimelineItem.d.ts +297 -0
  138. package/dist/components/Tinymce.d.ts +55 -0
  139. package/dist/components/TitleBar.d.ts +115 -0
  140. package/dist/components/TitleBar.js +57 -0
  141. package/dist/components/Toast.d.ts +358 -0
  142. package/dist/components/Toast.js +260 -0
  143. package/dist/components/Tooltip.d.ts +65 -0
  144. package/dist/components/Tooltip.js +45 -0
  145. package/dist/components/TooltipWrapper.d.ts +155 -0
  146. package/dist/components/TooltipWrapper.js +192 -0
  147. package/dist/components/Transfer.d.ts +1243 -0
  148. package/dist/components/Transfer.js +332 -0
  149. package/dist/components/TransferDropDown.d.ts +271 -0
  150. package/dist/components/TransferPicker.d.ts +277 -0
  151. package/dist/components/TransferSearch.d.ts +292 -0
  152. package/dist/components/TransferSearch.js +104 -0
  153. package/dist/components/Tree.d.ts +1708 -0
  154. package/dist/components/Tree.js +773 -0
  155. package/dist/components/TreeSelection.d.ts +526 -0
  156. package/dist/components/TreeSelection.js +209 -0
  157. package/dist/components/UserSelect.d.ts +500 -0
  158. package/dist/components/UserTabSelect.d.ts +320 -0
  159. package/dist/components/WithRemoteConfig.d.ts +386 -0
  160. package/dist/components/WithRemoteConfig.js +268 -0
  161. package/dist/components/WithStore.d.ts +75 -0
  162. package/dist/components/WithStore.js +57 -0
  163. package/dist/components/calendar/Calendar.d.ts +64 -0
  164. package/dist/components/calendar/Calendar.js +499 -0
  165. package/dist/components/calendar/CalendarContainer.d.ts +10 -0
  166. package/dist/components/calendar/CalendarContainer.js +35 -0
  167. package/dist/components/calendar/DaysView.d.ts +170 -0
  168. package/dist/components/calendar/DaysView.js +453 -0
  169. package/dist/components/calendar/MonthsView.d.ts +128 -0
  170. package/dist/components/calendar/MonthsView.js +168 -0
  171. package/dist/components/calendar/QuartersView.d.ts +92 -0
  172. package/dist/components/calendar/QuartersView.js +93 -0
  173. package/dist/components/calendar/TimeView.d.ts +178 -0
  174. package/dist/components/calendar/TimeView.js +474 -0
  175. package/dist/components/calendar/YearsView.d.ts +102 -0
  176. package/dist/components/calendar/YearsView.js +131 -0
  177. package/dist/components/condition-builder/Expression.d.ts +298 -0
  178. package/dist/components/condition-builder/Field.d.ts +280 -0
  179. package/dist/components/condition-builder/Formula.d.ts +269 -0
  180. package/dist/components/condition-builder/Func.d.ts +279 -0
  181. package/dist/components/condition-builder/Group.d.ts +296 -0
  182. package/dist/components/condition-builder/GroupOrItem.d.ts +72 -0
  183. package/dist/components/condition-builder/InputSwitch.d.ts +47 -0
  184. package/dist/components/condition-builder/Item.d.ts +292 -0
  185. package/dist/components/condition-builder/Value.d.ts +277 -0
  186. package/dist/components/condition-builder/config.d.ts +35 -0
  187. package/dist/components/condition-builder/index.d.ts +303 -0
  188. package/dist/components/condition-builder/types.d.ts +150 -0
  189. package/dist/components/formula/Editor.d.ts +362 -0
  190. package/dist/components/formula/Editor.js +217 -0
  191. package/dist/components/formula/FuncList.d.ts +48 -0
  192. package/dist/components/formula/FuncList.js +57 -0
  193. package/dist/components/formula/Picker.d.ts +440 -0
  194. package/dist/components/formula/Picker.js +231 -0
  195. package/dist/components/formula/VariableList.d.ts +54 -0
  196. package/dist/components/formula/VariableList.js +49 -0
  197. package/dist/components/formula/plugin.d.ts +27 -0
  198. package/dist/components/formula/plugin.js +211 -0
  199. package/dist/components/icons.d.ts +45 -0
  200. package/dist/components/icons.js +270 -0
  201. package/dist/components/index.d.ts +64 -0
  202. package/dist/components/json-schema/Array.d.ts +3 -0
  203. package/dist/components/json-schema/Array.js +136 -0
  204. package/dist/components/json-schema/Item.d.ts +3 -0
  205. package/dist/components/json-schema/Item.js +45 -0
  206. package/dist/components/json-schema/Object.d.ts +3 -0
  207. package/dist/components/json-schema/Object.js +189 -0
  208. package/dist/components/json-schema/index.d.ts +277 -0
  209. package/dist/components/json-schema/index.js +28 -0
  210. package/dist/components/schema-editor/Array.d.ts +11 -0
  211. package/dist/components/schema-editor/Common.d.ts +29 -0
  212. package/dist/components/schema-editor/Item.d.ts +8 -0
  213. package/dist/components/schema-editor/Object.d.ts +44 -0
  214. package/dist/components/schema-editor/SchemaVariableList.d.ts +193 -0
  215. package/dist/components/schema-editor/SchemaVariableList.js +83 -0
  216. package/dist/components/schema-editor/SchemaVariableListPicker.d.ts +186 -0
  217. package/dist/components/schema-editor/SchemaVariableListPicker.js +43 -0
  218. package/dist/components/schema-editor/index.d.ts +303 -0
  219. package/dist/components/table/Cell.d.ts +489 -0
  220. package/dist/components/table/Cell.js +47 -0
  221. package/dist/components/table/HeadCellDropDown.d.ts +293 -0
  222. package/dist/components/table/HeadCellDropDown.js +64 -0
  223. package/dist/components/table/HeadCellFilter.d.ts +419 -0
  224. package/dist/components/table/HeadCellFilter.js +146 -0
  225. package/dist/components/table/HeadCellSelect.d.ts +364 -0
  226. package/dist/components/table/HeadCellSelect.js +57 -0
  227. package/dist/components/table/HeadCellSort.d.ts +278 -0
  228. package/dist/components/table/HeadCellSort.js +83 -0
  229. package/dist/components/table/ItemActionsWrapper.d.ts +10 -0
  230. package/dist/components/table/ItemActionsWrapper.js +37 -0
  231. package/dist/components/table/index.d.ts +794 -0
  232. package/dist/components/table/index.js +1250 -0
  233. package/dist/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  234. package/dist/components/virtual-list/SizeAndPositionManager.js +220 -0
  235. package/dist/components/virtual-list/constants.d.ts +34 -0
  236. package/dist/components/virtual-list/constants.js +53 -0
  237. package/dist/components/virtual-list/index.d.ts +94 -0
  238. package/dist/components/virtual-list/index.js +309 -0
  239. package/dist/hooks/index.d.ts +7 -0
  240. package/dist/hooks/use-set-state.d.ts +2 -0
  241. package/dist/hooks/use-set-state.js +27 -0
  242. package/dist/hooks/use-touch.d.ts +16 -0
  243. package/dist/hooks/use-touch.js +81 -0
  244. package/dist/hooks/use-update-effect.d.ts +3 -0
  245. package/dist/hooks/use-update-effect.js +25 -0
  246. package/dist/hooks/use-validation-resolver.d.ts +2 -0
  247. package/dist/hooks/use-validation-resolver.js +59 -0
  248. package/dist/icons/alert-danger.svg.js +48 -0
  249. package/dist/icons/alert-info.svg.js +48 -0
  250. package/dist/icons/alert-success.svg.js +48 -0
  251. package/dist/icons/alert-warning.svg.js +48 -0
  252. package/dist/icons/back.svg.js +47 -0
  253. package/dist/icons/calendar.svg.js +56 -0
  254. package/dist/icons/caret.svg.js +46 -0
  255. package/dist/icons/check.svg.js +45 -0
  256. package/dist/icons/clock.svg.js +56 -0
  257. package/dist/icons/close-small.svg.js +49 -0
  258. package/dist/icons/close.svg.js +45 -0
  259. package/dist/icons/cloud-upload.svg.js +57 -0
  260. package/dist/icons/column-filter.svg.js +47 -0
  261. package/dist/icons/columns.svg.js +46 -0
  262. package/dist/icons/compress-alt.svg.js +46 -0
  263. package/dist/icons/copy.svg.js +51 -0
  264. package/dist/icons/date.svg.js +52 -0
  265. package/dist/icons/department.svg.js +78 -0
  266. package/dist/icons/desk-empty.svg.js +99 -0
  267. package/dist/icons/dot.svg.js +62 -0
  268. package/dist/icons/down-arrow-bold.svg.js +48 -0
  269. package/dist/icons/download.svg.js +50 -0
  270. package/dist/icons/drag-bar.svg.js +79 -0
  271. package/dist/icons/drag.svg.js +48 -0
  272. package/dist/icons/edit.svg.js +48 -0
  273. package/dist/icons/ellipsis-v.svg.js +47 -0
  274. package/dist/icons/enter.svg.js +45 -0
  275. package/dist/icons/exchange.svg.js +47 -0
  276. package/dist/icons/expand-alt.svg.js +46 -0
  277. package/dist/icons/fail.svg.js +54 -0
  278. package/dist/icons/file.svg.js +47 -0
  279. package/dist/icons/filter.svg.js +46 -0
  280. package/dist/icons/folder.svg.js +49 -0
  281. package/dist/icons/function.svg.js +48 -0
  282. package/dist/icons/home.svg.js +46 -0
  283. package/dist/icons/image.svg.js +45 -0
  284. package/dist/icons/info-circle.svg.js +46 -0
  285. package/dist/icons/info.svg.js +52 -0
  286. package/dist/icons/input-clear.svg.js +48 -0
  287. package/dist/icons/invisible.svg.js +48 -0
  288. package/dist/icons/left-arrow.svg.js +46 -0
  289. package/dist/icons/loading-outline.svg.js +49 -0
  290. package/dist/icons/location.svg.js +46 -0
  291. package/dist/icons/menu.svg.js +48 -0
  292. package/dist/icons/minus.svg.js +46 -0
  293. package/dist/icons/move.svg.js +47 -0
  294. package/dist/icons/mute.svg.js +46 -0
  295. package/dist/icons/pause.svg.js +46 -0
  296. package/dist/icons/pencil.svg.js +46 -0
  297. package/dist/icons/play.svg.js +45 -0
  298. package/dist/icons/plus-cicle.svg.js +47 -0
  299. package/dist/icons/plus-fine.svg.js +48 -0
  300. package/dist/icons/plus.svg.js +47 -0
  301. package/dist/icons/post.svg.js +74 -0
  302. package/dist/icons/question-mark.svg.js +51 -0
  303. package/dist/icons/question.svg.js +46 -0
  304. package/dist/icons/redo.svg.js +46 -0
  305. package/dist/icons/refresh.svg.js +47 -0
  306. package/dist/icons/reload.svg.js +46 -0
  307. package/dist/icons/remove.svg.js +48 -0
  308. package/dist/icons/retry.svg.js +51 -0
  309. package/dist/icons/right-arrow-bold.svg.js +46 -0
  310. package/dist/icons/right-arrow.svg.js +46 -0
  311. package/dist/icons/role.svg.js +69 -0
  312. package/dist/icons/schedule.svg.js +49 -0
  313. package/dist/icons/search.svg.js +45 -0
  314. package/dist/icons/setting.svg.js +47 -0
  315. package/dist/icons/slider-handle-icon.svg.js +48 -0
  316. package/dist/icons/sort-asc.svg.js +46 -0
  317. package/dist/icons/sort-default.svg.js +47 -0
  318. package/dist/icons/sort-desc.svg.js +46 -0
  319. package/dist/icons/star.svg.js +47 -0
  320. package/dist/icons/status-close.svg.js +49 -0
  321. package/dist/icons/status-fail.svg.js +48 -0
  322. package/dist/icons/status-info.svg.js +52 -0
  323. package/dist/icons/status-success.svg.js +48 -0
  324. package/dist/icons/status-warning.svg.js +52 -0
  325. package/dist/icons/success.svg.js +52 -0
  326. package/dist/icons/transparent.svg.js +65 -0
  327. package/dist/icons/trash.svg.js +48 -0
  328. package/dist/icons/tree-down.svg.js +47 -0
  329. package/dist/icons/undo.svg.js +46 -0
  330. package/dist/icons/upload.svg.js +48 -0
  331. package/dist/icons/user-remove.svg.js +59 -0
  332. package/dist/icons/view.svg.js +48 -0
  333. package/dist/icons/volume.svg.js +49 -0
  334. package/dist/icons/warning-mark.svg.js +49 -0
  335. package/dist/icons/warning.svg.js +46 -0
  336. package/dist/icons/window-restore.svg.js +46 -0
  337. package/dist/icons/zoom-in.svg.js +46 -0
  338. package/dist/icons/zoom-out.svg.js +46 -0
  339. package/dist/index.d.ts +10 -0
  340. package/dist/index.js +151 -0
  341. package/dist/locale/de-DE.d.ts +1 -0
  342. package/dist/locale/de-DE.js +344 -0
  343. package/dist/locale/en-US.d.ts +1 -0
  344. package/dist/locale/en-US.js +347 -0
  345. package/dist/locale/zh-CN.d.ts +1 -0
  346. package/dist/locale/zh-CN.js +358 -0
  347. package/dist/themes/ang.d.ts +3 -0
  348. package/dist/themes/ang.js +20 -0
  349. package/dist/themes/antd.d.ts +1 -0
  350. package/dist/themes/antd.js +44 -0
  351. package/dist/themes/cxd.d.ts +3 -0
  352. package/dist/themes/cxd.js +459 -0
  353. package/dist/themes/dark.d.ts +3 -0
  354. package/dist/themes/dark.js +28 -0
  355. package/dist/themes/default.d.ts +4 -0
  356. package/esm-dist/components/404.d.ts +54 -0
  357. package/esm-dist/components/404.js +35 -0
  358. package/esm-dist/components/Alert.d.ts +560 -0
  359. package/esm-dist/components/Alert.js +188 -0
  360. package/esm-dist/components/Alert2.d.ts +66 -0
  361. package/esm-dist/components/Alert2.js +60 -0
  362. package/esm-dist/components/AnchorNav.d.ts +118 -0
  363. package/esm-dist/components/AnchorNav.js +171 -0
  364. package/esm-dist/components/ArrayInput.d.ts +625 -0
  365. package/esm-dist/components/ArrayInput.js +152 -0
  366. package/esm-dist/components/AsideNav.d.ts +142 -0
  367. package/esm-dist/components/AsideNav.js +130 -0
  368. package/esm-dist/components/AssociatedSelection.d.ts +491 -0
  369. package/esm-dist/components/AssociatedSelection.js +104 -0
  370. package/esm-dist/components/Avatar.d.ts +113 -0
  371. package/esm-dist/components/Avatar.js +125 -0
  372. package/esm-dist/components/Badge.d.ts +120 -0
  373. package/esm-dist/components/BaiduMapPicker.d.ts +86 -0
  374. package/esm-dist/components/BarCode.d.ts +58 -0
  375. package/esm-dist/components/Breadcrumb.d.ts +115 -0
  376. package/esm-dist/components/Breadcrumb.js +163 -0
  377. package/esm-dist/components/Button.d.ts +74 -0
  378. package/esm-dist/components/Button.js +64 -0
  379. package/esm-dist/components/CalendarMobile.d.ts +353 -0
  380. package/esm-dist/components/CalendarMobile.js +531 -0
  381. package/esm-dist/components/Card.d.ts +75 -0
  382. package/esm-dist/components/Cascader.d.ts +109 -0
  383. package/esm-dist/components/ChainedSelection.d.ts +480 -0
  384. package/esm-dist/components/ChainedSelection.js +121 -0
  385. package/esm-dist/components/Checkbox.d.ts +69 -0
  386. package/esm-dist/components/Checkbox.js +64 -0
  387. package/esm-dist/components/CityArea.d.ts +307 -0
  388. package/esm-dist/components/CityDB.d.ts +13 -0
  389. package/esm-dist/components/CodeMirror.d.ts +25 -0
  390. package/esm-dist/components/CodeMirror.js +104 -0
  391. package/esm-dist/components/Collapse.d.ts +92 -0
  392. package/esm-dist/components/Collapse.js +156 -0
  393. package/esm-dist/components/CollapseGroup.d.ts +68 -0
  394. package/esm-dist/components/CollapseGroup.js +88 -0
  395. package/esm-dist/components/ColorPicker.d.ts +524 -0
  396. package/esm-dist/components/ContextMenu.d.ts +96 -0
  397. package/esm-dist/components/ContextMenu.js +213 -0
  398. package/esm-dist/components/DatePicker.d.ts +619 -0
  399. package/esm-dist/components/DatePicker.js +524 -0
  400. package/esm-dist/components/DateRangePicker.d.ts +876 -0
  401. package/esm-dist/components/DateRangePicker.js +1038 -0
  402. package/esm-dist/components/Drawer.d.ts +95 -0
  403. package/esm-dist/components/Drawer.js +250 -0
  404. package/esm-dist/components/Editor.d.ts +605 -0
  405. package/esm-dist/components/Editor.js +234 -0
  406. package/esm-dist/components/Form.d.ts +22 -0
  407. package/esm-dist/components/FormField.d.ts +65 -0
  408. package/esm-dist/components/GridNav.d.ts +52 -0
  409. package/esm-dist/components/GroupedSelection.d.ts +467 -0
  410. package/esm-dist/components/GroupedSelection.js +62 -0
  411. package/esm-dist/components/Html.d.ts +83 -0
  412. package/esm-dist/components/Html.js +52 -0
  413. package/esm-dist/components/ImageGallery.d.ts +297 -0
  414. package/esm-dist/components/Input.d.ts +16 -0
  415. package/esm-dist/components/Input.js +62 -0
  416. package/esm-dist/components/InputBox.d.ts +99 -0
  417. package/esm-dist/components/InputBox.js +97 -0
  418. package/esm-dist/components/InputBoxWithSuggestion.d.ts +280 -0
  419. package/esm-dist/components/InputBoxWithSuggestion.js +66 -0
  420. package/esm-dist/components/Layout.d.ts +144 -0
  421. package/esm-dist/components/Layout.js +66 -0
  422. package/esm-dist/components/Link.d.ts +62 -0
  423. package/esm-dist/components/ListGroup.d.ts +76 -0
  424. package/esm-dist/components/ListGroup.js +31 -0
  425. package/esm-dist/components/ListMenu.d.ts +573 -0
  426. package/esm-dist/components/LocationPicker.d.ts +427 -0
  427. package/esm-dist/components/Markdown.d.ts +20 -0
  428. package/esm-dist/components/Modal.d.ts +1278 -0
  429. package/esm-dist/components/Modal.js +148 -0
  430. package/esm-dist/components/ModalManager.d.ts +17 -0
  431. package/esm-dist/components/ModalManager.js +42 -0
  432. package/esm-dist/components/MonthRangePicker.d.ts +748 -0
  433. package/esm-dist/components/NumberInput.d.ts +89 -0
  434. package/esm-dist/components/NumberInput.js +136 -0
  435. package/esm-dist/components/Overlay.d.ts +41 -0
  436. package/esm-dist/components/Overlay.js +207 -0
  437. package/esm-dist/components/Pagination.d.ts +685 -0
  438. package/esm-dist/components/Picker.d.ts +284 -0
  439. package/esm-dist/components/Picker.js +74 -0
  440. package/esm-dist/components/PickerColumn.d.ts +63 -0
  441. package/esm-dist/components/PickerColumn.js +275 -0
  442. package/esm-dist/components/PickerContainer.d.ts +303 -0
  443. package/esm-dist/components/PickerContainer.js +149 -0
  444. package/esm-dist/components/PopOver.d.ts +90 -0
  445. package/esm-dist/components/PopOver.js +89 -0
  446. package/esm-dist/components/PopOverContainer.d.ts +28 -0
  447. package/esm-dist/components/PopOverContainer.js +92 -0
  448. package/esm-dist/components/PopUp.d.ts +578 -0
  449. package/esm-dist/components/PopUp.js +85 -0
  450. package/esm-dist/components/Progress.d.ts +68 -0
  451. package/esm-dist/components/PullRefresh.d.ts +64 -0
  452. package/esm-dist/components/PullRefresh.js +141 -0
  453. package/esm-dist/components/Radios.d.ts +180 -0
  454. package/esm-dist/components/Radios.js +112 -0
  455. package/esm-dist/components/Range.d.ts +122 -0
  456. package/esm-dist/components/Range.js +405 -0
  457. package/esm-dist/components/Rating.d.ts +252 -0
  458. package/esm-dist/components/Rating.js +315 -0
  459. package/esm-dist/components/ResultBox.d.ts +290 -0
  460. package/esm-dist/components/ResultBox.js +146 -0
  461. package/esm-dist/components/ResultList.d.ts +319 -0
  462. package/esm-dist/components/ResultList.js +182 -0
  463. package/esm-dist/components/ResultTableList.d.ts +708 -0
  464. package/esm-dist/components/ResultTableList.js +126 -0
  465. package/esm-dist/components/ResultTreeList.d.ts +308 -0
  466. package/esm-dist/components/ResultTreeList.js +208 -0
  467. package/esm-dist/components/RichText.d.ts +45 -0
  468. package/esm-dist/components/SearchBox.d.ts +504 -0
  469. package/esm-dist/components/SearchBox.js +127 -0
  470. package/esm-dist/components/Select.d.ts +6281 -0
  471. package/esm-dist/components/Select.js +756 -0
  472. package/esm-dist/components/Selection.d.ts +510 -0
  473. package/esm-dist/components/Selection.js +140 -0
  474. package/esm-dist/components/SparkLine.d.ts +403 -0
  475. package/esm-dist/components/SparkLine.js +62 -0
  476. package/esm-dist/components/Spinner.d.ts +174 -0
  477. package/esm-dist/components/Spinner.js +67 -0
  478. package/esm-dist/components/Steps.d.ts +110 -0
  479. package/esm-dist/components/Switch.d.ts +101 -0
  480. package/esm-dist/components/Switch.js +64 -0
  481. package/esm-dist/components/TableSelection.d.ts +695 -0
  482. package/esm-dist/components/TableSelection.js +79 -0
  483. package/esm-dist/components/Tabs.d.ts +210 -0
  484. package/esm-dist/components/Tabs.js +473 -0
  485. package/esm-dist/components/TabsTransfer.d.ts +297 -0
  486. package/esm-dist/components/TabsTransfer.js +210 -0
  487. package/esm-dist/components/TabsTransferPicker.d.ts +273 -0
  488. package/esm-dist/components/Tag.d.ts +104 -0
  489. package/esm-dist/components/Textarea.d.ts +568 -0
  490. package/esm-dist/components/Textarea.js +134 -0
  491. package/esm-dist/components/Timeline.d.ts +47 -0
  492. package/esm-dist/components/TimelineItem.d.ts +297 -0
  493. package/esm-dist/components/Tinymce.d.ts +55 -0
  494. package/esm-dist/components/TitleBar.d.ts +115 -0
  495. package/esm-dist/components/TitleBar.js +48 -0
  496. package/esm-dist/components/Toast.d.ts +358 -0
  497. package/esm-dist/components/Toast.js +247 -0
  498. package/esm-dist/components/Tooltip.d.ts +65 -0
  499. package/esm-dist/components/Tooltip.js +36 -0
  500. package/esm-dist/components/TooltipWrapper.d.ts +155 -0
  501. package/esm-dist/components/TooltipWrapper.js +183 -0
  502. package/esm-dist/components/Transfer.d.ts +1243 -0
  503. package/esm-dist/components/Transfer.js +323 -0
  504. package/esm-dist/components/TransferDropDown.d.ts +271 -0
  505. package/esm-dist/components/TransferPicker.d.ts +277 -0
  506. package/esm-dist/components/TransferSearch.d.ts +292 -0
  507. package/esm-dist/components/TransferSearch.js +95 -0
  508. package/esm-dist/components/Tree.d.ts +1708 -0
  509. package/esm-dist/components/Tree.js +764 -0
  510. package/esm-dist/components/TreeSelection.d.ts +526 -0
  511. package/esm-dist/components/TreeSelection.js +200 -0
  512. package/esm-dist/components/UserSelect.d.ts +500 -0
  513. package/esm-dist/components/UserTabSelect.d.ts +320 -0
  514. package/esm-dist/components/WithRemoteConfig.d.ts +386 -0
  515. package/esm-dist/components/WithRemoteConfig.js +257 -0
  516. package/esm-dist/components/WithStore.d.ts +75 -0
  517. package/esm-dist/components/WithStore.js +48 -0
  518. package/esm-dist/components/calendar/Calendar.d.ts +64 -0
  519. package/esm-dist/components/calendar/Calendar.js +489 -0
  520. package/esm-dist/components/calendar/CalendarContainer.d.ts +10 -0
  521. package/esm-dist/components/calendar/CalendarContainer.js +27 -0
  522. package/esm-dist/components/calendar/DaysView.d.ts +170 -0
  523. package/esm-dist/components/calendar/DaysView.js +440 -0
  524. package/esm-dist/components/calendar/MonthsView.d.ts +128 -0
  525. package/esm-dist/components/calendar/MonthsView.js +158 -0
  526. package/esm-dist/components/calendar/QuartersView.d.ts +92 -0
  527. package/esm-dist/components/calendar/QuartersView.js +83 -0
  528. package/esm-dist/components/calendar/TimeView.d.ts +178 -0
  529. package/esm-dist/components/calendar/TimeView.js +462 -0
  530. package/esm-dist/components/calendar/YearsView.d.ts +102 -0
  531. package/esm-dist/components/calendar/YearsView.js +121 -0
  532. package/esm-dist/components/condition-builder/Expression.d.ts +298 -0
  533. package/esm-dist/components/condition-builder/Field.d.ts +280 -0
  534. package/esm-dist/components/condition-builder/Formula.d.ts +269 -0
  535. package/esm-dist/components/condition-builder/Func.d.ts +279 -0
  536. package/esm-dist/components/condition-builder/Group.d.ts +296 -0
  537. package/esm-dist/components/condition-builder/GroupOrItem.d.ts +72 -0
  538. package/esm-dist/components/condition-builder/InputSwitch.d.ts +47 -0
  539. package/esm-dist/components/condition-builder/Item.d.ts +292 -0
  540. package/esm-dist/components/condition-builder/Value.d.ts +277 -0
  541. package/esm-dist/components/condition-builder/config.d.ts +35 -0
  542. package/esm-dist/components/condition-builder/index.d.ts +303 -0
  543. package/esm-dist/components/condition-builder/types.d.ts +150 -0
  544. package/esm-dist/components/formula/Editor.d.ts +362 -0
  545. package/esm-dist/components/formula/Editor.js +208 -0
  546. package/esm-dist/components/formula/FuncList.d.ts +48 -0
  547. package/esm-dist/components/formula/FuncList.js +48 -0
  548. package/esm-dist/components/formula/Picker.d.ts +440 -0
  549. package/esm-dist/components/formula/Picker.js +222 -0
  550. package/esm-dist/components/formula/VariableList.d.ts +54 -0
  551. package/esm-dist/components/formula/VariableList.js +41 -0
  552. package/esm-dist/components/formula/plugin.d.ts +27 -0
  553. package/esm-dist/components/formula/plugin.js +206 -0
  554. package/esm-dist/components/icons.d.ts +45 -0
  555. package/esm-dist/components/icons.js +249 -0
  556. package/esm-dist/components/index.d.ts +64 -0
  557. package/esm-dist/components/json-schema/Array.d.ts +3 -0
  558. package/esm-dist/components/json-schema/Array.js +128 -0
  559. package/esm-dist/components/json-schema/Item.d.ts +3 -0
  560. package/esm-dist/components/json-schema/Item.js +37 -0
  561. package/esm-dist/components/json-schema/Object.d.ts +3 -0
  562. package/esm-dist/components/json-schema/Object.js +181 -0
  563. package/esm-dist/components/json-schema/index.d.ts +277 -0
  564. package/esm-dist/components/json-schema/index.js +20 -0
  565. package/esm-dist/components/schema-editor/Array.d.ts +11 -0
  566. package/esm-dist/components/schema-editor/Common.d.ts +29 -0
  567. package/esm-dist/components/schema-editor/Item.d.ts +8 -0
  568. package/esm-dist/components/schema-editor/Object.d.ts +44 -0
  569. package/esm-dist/components/schema-editor/SchemaVariableList.d.ts +193 -0
  570. package/esm-dist/components/schema-editor/SchemaVariableList.js +74 -0
  571. package/esm-dist/components/schema-editor/SchemaVariableListPicker.d.ts +186 -0
  572. package/esm-dist/components/schema-editor/SchemaVariableListPicker.js +34 -0
  573. package/esm-dist/components/schema-editor/index.d.ts +303 -0
  574. package/esm-dist/components/table/Cell.d.ts +489 -0
  575. package/esm-dist/components/table/Cell.js +38 -0
  576. package/esm-dist/components/table/HeadCellDropDown.d.ts +293 -0
  577. package/esm-dist/components/table/HeadCellDropDown.js +55 -0
  578. package/esm-dist/components/table/HeadCellFilter.d.ts +419 -0
  579. package/esm-dist/components/table/HeadCellFilter.js +136 -0
  580. package/esm-dist/components/table/HeadCellSelect.d.ts +364 -0
  581. package/esm-dist/components/table/HeadCellSelect.js +48 -0
  582. package/esm-dist/components/table/HeadCellSort.d.ts +278 -0
  583. package/esm-dist/components/table/HeadCellSort.js +74 -0
  584. package/esm-dist/components/table/ItemActionsWrapper.d.ts +10 -0
  585. package/esm-dist/components/table/ItemActionsWrapper.js +29 -0
  586. package/esm-dist/components/table/index.d.ts +794 -0
  587. package/esm-dist/components/table/index.js +1234 -0
  588. package/esm-dist/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  589. package/esm-dist/components/virtual-list/SizeAndPositionManager.js +216 -0
  590. package/esm-dist/components/virtual-list/constants.d.ts +34 -0
  591. package/esm-dist/components/virtual-list/constants.js +45 -0
  592. package/esm-dist/components/virtual-list/index.d.ts +94 -0
  593. package/esm-dist/components/virtual-list/index.js +281 -0
  594. package/esm-dist/hooks/index.d.ts +7 -0
  595. package/esm-dist/hooks/use-set-state.d.ts +2 -0
  596. package/esm-dist/hooks/use-set-state.js +19 -0
  597. package/esm-dist/hooks/use-touch.d.ts +16 -0
  598. package/esm-dist/hooks/use-touch.js +77 -0
  599. package/esm-dist/hooks/use-update-effect.d.ts +3 -0
  600. package/esm-dist/hooks/use-update-effect.js +21 -0
  601. package/esm-dist/hooks/use-validation-resolver.d.ts +2 -0
  602. package/esm-dist/hooks/use-validation-resolver.js +49 -0
  603. package/esm-dist/icons/alert-danger.svg.js +24 -0
  604. package/esm-dist/icons/alert-info.svg.js +24 -0
  605. package/esm-dist/icons/alert-success.svg.js +24 -0
  606. package/esm-dist/icons/alert-warning.svg.js +24 -0
  607. package/esm-dist/icons/back.svg.js +23 -0
  608. package/esm-dist/icons/calendar.svg.js +32 -0
  609. package/esm-dist/icons/caret.svg.js +22 -0
  610. package/esm-dist/icons/check.svg.js +21 -0
  611. package/esm-dist/icons/clock.svg.js +32 -0
  612. package/esm-dist/icons/close-small.svg.js +25 -0
  613. package/esm-dist/icons/close.svg.js +21 -0
  614. package/esm-dist/icons/cloud-upload.svg.js +33 -0
  615. package/esm-dist/icons/column-filter.svg.js +23 -0
  616. package/esm-dist/icons/columns.svg.js +22 -0
  617. package/esm-dist/icons/compress-alt.svg.js +22 -0
  618. package/esm-dist/icons/copy.svg.js +27 -0
  619. package/esm-dist/icons/date.svg.js +28 -0
  620. package/esm-dist/icons/department.svg.js +54 -0
  621. package/esm-dist/icons/desk-empty.svg.js +75 -0
  622. package/esm-dist/icons/dot.svg.js +38 -0
  623. package/esm-dist/icons/down-arrow-bold.svg.js +24 -0
  624. package/esm-dist/icons/download.svg.js +26 -0
  625. package/esm-dist/icons/drag-bar.svg.js +55 -0
  626. package/esm-dist/icons/drag.svg.js +24 -0
  627. package/esm-dist/icons/edit.svg.js +24 -0
  628. package/esm-dist/icons/ellipsis-v.svg.js +23 -0
  629. package/esm-dist/icons/enter.svg.js +21 -0
  630. package/esm-dist/icons/exchange.svg.js +23 -0
  631. package/esm-dist/icons/expand-alt.svg.js +22 -0
  632. package/esm-dist/icons/fail.svg.js +30 -0
  633. package/esm-dist/icons/file.svg.js +23 -0
  634. package/esm-dist/icons/filter.svg.js +22 -0
  635. package/esm-dist/icons/folder.svg.js +25 -0
  636. package/esm-dist/icons/function.svg.js +24 -0
  637. package/esm-dist/icons/home.svg.js +22 -0
  638. package/esm-dist/icons/image.svg.js +21 -0
  639. package/esm-dist/icons/info-circle.svg.js +22 -0
  640. package/esm-dist/icons/info.svg.js +28 -0
  641. package/esm-dist/icons/input-clear.svg.js +24 -0
  642. package/esm-dist/icons/invisible.svg.js +24 -0
  643. package/esm-dist/icons/left-arrow.svg.js +22 -0
  644. package/esm-dist/icons/loading-outline.svg.js +25 -0
  645. package/esm-dist/icons/location.svg.js +22 -0
  646. package/esm-dist/icons/menu.svg.js +24 -0
  647. package/esm-dist/icons/minus.svg.js +22 -0
  648. package/esm-dist/icons/move.svg.js +23 -0
  649. package/esm-dist/icons/mute.svg.js +22 -0
  650. package/esm-dist/icons/pause.svg.js +22 -0
  651. package/esm-dist/icons/pencil.svg.js +22 -0
  652. package/esm-dist/icons/play.svg.js +21 -0
  653. package/esm-dist/icons/plus-cicle.svg.js +23 -0
  654. package/esm-dist/icons/plus-fine.svg.js +24 -0
  655. package/esm-dist/icons/plus.svg.js +23 -0
  656. package/esm-dist/icons/post.svg.js +50 -0
  657. package/esm-dist/icons/question-mark.svg.js +27 -0
  658. package/esm-dist/icons/question.svg.js +22 -0
  659. package/esm-dist/icons/redo.svg.js +22 -0
  660. package/esm-dist/icons/refresh.svg.js +23 -0
  661. package/esm-dist/icons/reload.svg.js +22 -0
  662. package/esm-dist/icons/remove.svg.js +24 -0
  663. package/esm-dist/icons/retry.svg.js +27 -0
  664. package/esm-dist/icons/right-arrow-bold.svg.js +22 -0
  665. package/esm-dist/icons/right-arrow.svg.js +22 -0
  666. package/esm-dist/icons/role.svg.js +45 -0
  667. package/esm-dist/icons/schedule.svg.js +25 -0
  668. package/esm-dist/icons/search.svg.js +21 -0
  669. package/esm-dist/icons/setting.svg.js +23 -0
  670. package/esm-dist/icons/slider-handle-icon.svg.js +24 -0
  671. package/esm-dist/icons/sort-asc.svg.js +22 -0
  672. package/esm-dist/icons/sort-default.svg.js +23 -0
  673. package/esm-dist/icons/sort-desc.svg.js +22 -0
  674. package/esm-dist/icons/star.svg.js +23 -0
  675. package/esm-dist/icons/status-close.svg.js +25 -0
  676. package/esm-dist/icons/status-fail.svg.js +24 -0
  677. package/esm-dist/icons/status-info.svg.js +28 -0
  678. package/esm-dist/icons/status-success.svg.js +24 -0
  679. package/esm-dist/icons/status-warning.svg.js +28 -0
  680. package/esm-dist/icons/success.svg.js +28 -0
  681. package/esm-dist/icons/transparent.svg.js +41 -0
  682. package/esm-dist/icons/trash.svg.js +24 -0
  683. package/esm-dist/icons/tree-down.svg.js +23 -0
  684. package/esm-dist/icons/undo.svg.js +22 -0
  685. package/esm-dist/icons/upload.svg.js +24 -0
  686. package/esm-dist/icons/user-remove.svg.js +35 -0
  687. package/esm-dist/icons/view.svg.js +24 -0
  688. package/esm-dist/icons/volume.svg.js +25 -0
  689. package/esm-dist/icons/warning-mark.svg.js +25 -0
  690. package/esm-dist/icons/warning.svg.js +22 -0
  691. package/esm-dist/icons/window-restore.svg.js +22 -0
  692. package/esm-dist/icons/zoom-in.svg.js +22 -0
  693. package/esm-dist/icons/zoom-out.svg.js +22 -0
  694. package/esm-dist/index.d.ts +10 -0
  695. package/esm-dist/index.js +74 -0
  696. package/esm-dist/locale/de-DE.d.ts +1 -0
  697. package/esm-dist/locale/de-DE.js +342 -0
  698. package/esm-dist/locale/en-US.d.ts +1 -0
  699. package/esm-dist/locale/en-US.js +345 -0
  700. package/esm-dist/locale/zh-CN.d.ts +1 -0
  701. package/esm-dist/locale/zh-CN.js +356 -0
  702. package/esm-dist/themes/ang.d.ts +3 -0
  703. package/esm-dist/themes/ang.js +15 -0
  704. package/esm-dist/themes/antd.d.ts +1 -0
  705. package/esm-dist/themes/antd.js +42 -0
  706. package/esm-dist/themes/cxd.d.ts +3 -0
  707. package/esm-dist/themes/cxd.js +455 -0
  708. package/esm-dist/themes/dark.d.ts +3 -0
  709. package/esm-dist/themes/dark.js +23 -0
  710. package/esm-dist/themes/default.d.ts +4 -0
  711. package/package.json +71 -0
  712. package/rollup.config.js +129 -0
  713. package/scss/README.md +9 -0
  714. package/scss/_functions.scss +101 -0
  715. package/scss/_mixins.scss +472 -0
  716. package/scss/_properties.scss +1702 -0
  717. package/scss/_thirds.scss +8 -0
  718. package/scss/_utilities.scss +1753 -0
  719. package/scss/_variables.scss +417 -0
  720. package/scss/base/_common.scss +3 -0
  721. package/scss/base/_normalize.scss +361 -0
  722. package/scss/base/_reset.scss +18 -0
  723. package/scss/base/_typography.scss +59 -0
  724. package/scss/components/_alert.scss +82 -0
  725. package/scss/components/_anchor-nav.scss +115 -0
  726. package/scss/components/_app.scss +31 -0
  727. package/scss/components/_array-input.scss +101 -0
  728. package/scss/components/_audio.scss +146 -0
  729. package/scss/components/_avatar.scss +55 -0
  730. package/scss/components/_badge.scss +136 -0
  731. package/scss/components/_barcode.scss +6 -0
  732. package/scss/components/_breadcrumb.scss +98 -0
  733. package/scss/components/_button-group.scss +131 -0
  734. package/scss/components/_button.scss +379 -0
  735. package/scss/components/_calendar.scss +395 -0
  736. package/scss/components/_card.scss +359 -0
  737. package/scss/components/_card2.scss +28 -0
  738. package/scss/components/_cards.scss +187 -0
  739. package/scss/components/_carousel.scss +197 -0
  740. package/scss/components/_cascader.scss +102 -0
  741. package/scss/components/_chart.scss +20 -0
  742. package/scss/components/_city-area.scss +29 -0
  743. package/scss/components/_collapse-group.scss +30 -0
  744. package/scss/components/_collapse.scss +120 -0
  745. package/scss/components/_color.scss +18 -0
  746. package/scss/components/_column-toggler.scss +244 -0
  747. package/scss/components/_condition-builder.scss +280 -0
  748. package/scss/components/_context-menu.scss +206 -0
  749. package/scss/components/_copyable.scss +10 -0
  750. package/scss/components/_crud.scss +151 -0
  751. package/scss/components/_debug.scss +170 -0
  752. package/scss/components/_divider.scss +11 -0
  753. package/scss/components/_drawer.scss +314 -0
  754. package/scss/components/_dropdown.scss +144 -0
  755. package/scss/components/_each.scss +7 -0
  756. package/scss/components/_formula.scss +407 -0
  757. package/scss/components/_grid-nav.scss +128 -0
  758. package/scss/components/_icon.scss +4 -0
  759. package/scss/components/_image-gallery.scss +205 -0
  760. package/scss/components/_images.scss +186 -0
  761. package/scss/components/_input-box.scss +74 -0
  762. package/scss/components/_json-schema-editor.scss +126 -0
  763. package/scss/components/_json-schema.scss +124 -0
  764. package/scss/components/_json.scss +7 -0
  765. package/scss/components/_link.scss +6 -0
  766. package/scss/components/_list-menu.scss +74 -0
  767. package/scss/components/_list.scss +249 -0
  768. package/scss/components/_log.scss +141 -0
  769. package/scss/components/_mapping.scss +6 -0
  770. package/scss/components/_markdown.scss +266 -0
  771. package/scss/components/_modal.scss +252 -0
  772. package/scss/components/_nav.scss +310 -0
  773. package/scss/components/_page.scss +144 -0
  774. package/scss/components/_pagination.scss +200 -0
  775. package/scss/components/_panel.scss +229 -0
  776. package/scss/components/_picker-columns.scss +140 -0
  777. package/scss/components/_popover.scss +54 -0
  778. package/scss/components/_popoverable.scss +62 -0
  779. package/scss/components/_popup.scss +160 -0
  780. package/scss/components/_portlet.scss +51 -0
  781. package/scss/components/_progress.scss +142 -0
  782. package/scss/components/_property.scss +47 -0
  783. package/scss/components/_pull-refresh.scss +25 -0
  784. package/scss/components/_quick-edit.scss +56 -0
  785. package/scss/components/_remark.scss +58 -0
  786. package/scss/components/_result-box.scss +246 -0
  787. package/scss/components/_search-box.scss +138 -0
  788. package/scss/components/_service.scss +3 -0
  789. package/scss/components/_sparkline.scss +18 -0
  790. package/scss/components/_spinner.scss +176 -0
  791. package/scss/components/_status.scss +102 -0
  792. package/scss/components/_steps.scss +394 -0
  793. package/scss/components/_table-v2.scss +912 -0
  794. package/scss/components/_table.scss +936 -0
  795. package/scss/components/_tabs.scss +1021 -0
  796. package/scss/components/_tag.scss +177 -0
  797. package/scss/components/_timeline.scss +198 -0
  798. package/scss/components/_toast.scss +272 -0
  799. package/scss/components/_tooltip.scss +339 -0
  800. package/scss/components/_tpl.scss +5 -0
  801. package/scss/components/_video.scss +38 -0
  802. package/scss/components/_wizard.scss +270 -0
  803. package/scss/components/_wrapper.scss +21 -0
  804. package/scss/components/form/_chained-select.scss +5 -0
  805. package/scss/components/form/_checks.scss +513 -0
  806. package/scss/components/form/_city.scss +33 -0
  807. package/scss/components/form/_color.scss +119 -0
  808. package/scss/components/form/_combo.scss +316 -0
  809. package/scss/components/form/_date-range.scss +222 -0
  810. package/scss/components/form/_date.scss +633 -0
  811. package/scss/components/form/_editor.scss +125 -0
  812. package/scss/components/form/_excel.scss +42 -0
  813. package/scss/components/form/_fieldset.scss +136 -0
  814. package/scss/components/form/_file.scss +246 -0
  815. package/scss/components/form/_form.scss +617 -0
  816. package/scss/components/form/_group.scss +116 -0
  817. package/scss/components/form/_icon-picker.scss +107 -0
  818. package/scss/components/form/_image.scss +266 -0
  819. package/scss/components/form/_input-group.scss +150 -0
  820. package/scss/components/form/_list.scss +122 -0
  821. package/scss/components/form/_location.scss +140 -0
  822. package/scss/components/form/_matrix.scss +5 -0
  823. package/scss/components/form/_nested-select.scss +106 -0
  824. package/scss/components/form/_number.scss +312 -0
  825. package/scss/components/form/_picker.scss +101 -0
  826. package/scss/components/form/_qr-code.scss +4 -0
  827. package/scss/components/form/_range.scss +274 -0
  828. package/scss/components/form/_rating.scss +74 -0
  829. package/scss/components/form/_repeat.scss +40 -0
  830. package/scss/components/form/_result-list.scss +87 -0
  831. package/scss/components/form/_rich-text.scss +116 -0
  832. package/scss/components/form/_select.scss +447 -0
  833. package/scss/components/form/_selection.scss +350 -0
  834. package/scss/components/form/_sub-form.scss +118 -0
  835. package/scss/components/form/_switch.scss +102 -0
  836. package/scss/components/form/_tag.scss +92 -0
  837. package/scss/components/form/_text.scss +307 -0
  838. package/scss/components/form/_textarea.scss +62 -0
  839. package/scss/components/form/_tinymce.scss +6 -0
  840. package/scss/components/form/_transfer.scss +320 -0
  841. package/scss/components/form/_tree-select.scss +39 -0
  842. package/scss/components/form/_tree.scss +317 -0
  843. package/scss/components/form/_user-select.scss +422 -0
  844. package/scss/components/react-datetime.scss +247 -0
  845. package/scss/helper/background/_background-color.scss +214 -0
  846. package/scss/helper/border/_border-color.scss +178 -0
  847. package/scss/helper/border/_border-radius.scss +152 -0
  848. package/scss/helper/border/_border-style.scss +40 -0
  849. package/scss/helper/border/_border-width.scss +72 -0
  850. package/scss/helper/box-alignment/_align-content.scss +44 -0
  851. package/scss/helper/box-alignment/_align-items.scss +41 -0
  852. package/scss/helper/box-alignment/_align-self.scss +40 -0
  853. package/scss/helper/box-alignment/_justify-content.scss +44 -0
  854. package/scss/helper/box-alignment/_justify-items.scss +40 -0
  855. package/scss/helper/box-alignment/_justify-self.scss +40 -0
  856. package/scss/helper/box-alignment/_place-content.scss +48 -0
  857. package/scss/helper/box-alignment/_place-items.scss +40 -0
  858. package/scss/helper/box-alignment/_place-self.scss +40 -0
  859. package/scss/helper/effect/_box-shadow.scss +74 -0
  860. package/scss/helper/effect/_opacity.scss +66 -0
  861. package/scss/helper/flex/_direction.scss +41 -0
  862. package/scss/helper/flex/_flex.scss +38 -0
  863. package/scss/helper/flex/_grow.scss +28 -0
  864. package/scss/helper/flex/_order.scss +56 -0
  865. package/scss/helper/flex/_shrink.scss +27 -0
  866. package/scss/helper/flex/_wrap.scss +36 -0
  867. package/scss/helper/grid/_auto-columns.scss +38 -0
  868. package/scss/helper/grid/_auto-flow.scss +38 -0
  869. package/scss/helper/grid/_auto-rows.scss +38 -0
  870. package/scss/helper/grid/_column-start-end.scss +201 -0
  871. package/scss/helper/grid/_columns.scss +74 -0
  872. package/scss/helper/grid/_gap.scss +154 -0
  873. package/scss/helper/grid/_row-start-end.scss +201 -0
  874. package/scss/helper/grid/_rows.scss +50 -0
  875. package/scss/helper/layout/_box-sizing.scss +51 -0
  876. package/scss/helper/layout/_clear.scss +56 -0
  877. package/scss/helper/layout/_display.scss +82 -0
  878. package/scss/helper/layout/_float.scss +71 -0
  879. package/scss/helper/layout/_overflow.scss +85 -0
  880. package/scss/helper/layout/_position.scss +55 -0
  881. package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
  882. package/scss/helper/layout/_visibility.scss +42 -0
  883. package/scss/helper/layout/_z-index.scss +67 -0
  884. package/scss/helper/sizing/_height.scss +161 -0
  885. package/scss/helper/sizing/_width.scss +158 -0
  886. package/scss/helper/spacing/_margin.scss +821 -0
  887. package/scss/helper/spacing/_padding.scss +394 -0
  888. package/scss/helper/spacing/_space-between.scss +224 -0
  889. package/scss/helper/typography/_font-family.scss +28 -0
  890. package/scss/helper/typography/_font-size.scss +40 -0
  891. package/scss/helper/typography/_font-style.scss +31 -0
  892. package/scss/helper/typography/_font-weight.scss +49 -0
  893. package/scss/helper/typography/_letter-spacing.scss +43 -0
  894. package/scss/helper/typography/_line-height.scss +59 -0
  895. package/scss/helper/typography/_list-style-type.scss +43 -0
  896. package/scss/helper/typography/_text-align.scss +34 -0
  897. package/scss/helper/typography/_text-color.scss +184 -0
  898. package/scss/helper/typography/_text-decoration.scss +34 -0
  899. package/scss/helper/typography/_text-overflow.scss +40 -0
  900. package/scss/helper/typography/_text-transform.scss +40 -0
  901. package/scss/helper/typography/_vertical-align.scss +44 -0
  902. package/scss/helper/typography/_whitespace.scss +42 -0
  903. package/scss/helper/typography/_word-break.scss +36 -0
  904. package/scss/helper.scss +70 -0
  905. package/scss/layout/_aside.scss +361 -0
  906. package/scss/layout/_grid.scss +171 -0
  907. package/scss/layout/_hbox.scss +127 -0
  908. package/scss/layout/_header.scss +0 -0
  909. package/scss/layout/_layout.scss +458 -0
  910. package/scss/layout/_vbox.scss +38 -0
  911. package/scss/themes/_ang-variables.scss +132 -0
  912. package/scss/themes/_antd-colors.scss +149 -0
  913. package/scss/themes/_antd-variables.scss +171 -0
  914. package/scss/themes/_common.scss +138 -0
  915. package/scss/themes/_cxd-colors.scss +56 -0
  916. package/scss/themes/_cxd-variables.scss +687 -0
  917. package/scss/themes/_dark-variables.scss +129 -0
  918. package/scss/themes/ang-ie11.scss +1 -0
  919. package/scss/themes/ang.scss +4 -0
  920. package/scss/themes/antd-ie11.scss +1 -0
  921. package/scss/themes/antd.scss +5 -0
  922. package/scss/themes/cxd-ie11.scss +1 -0
  923. package/scss/themes/cxd.scss +426 -0
  924. package/scss/themes/dark-ie11.scss +1 -0
  925. package/scss/themes/dark.scss +3 -0
  926. package/scss/themes/default.scss +2 -0
  927. package/scss/themes/extract-antd-color.py +27 -0
  928. package/src/components/404.tsx +49 -0
  929. package/src/components/Alert.tsx +300 -0
  930. package/src/components/Alert2.tsx +117 -0
  931. package/src/components/AnchorNav.tsx +265 -0
  932. package/src/components/ArrayInput.tsx +234 -0
  933. package/src/components/AsideNav.tsx +280 -0
  934. package/src/components/AssociatedSelection.tsx +243 -0
  935. package/src/components/Avatar.tsx +255 -0
  936. package/src/components/Badge.tsx +300 -0
  937. package/src/components/BaiduMapPicker.tsx +394 -0
  938. package/src/components/BarCode.tsx +50 -0
  939. package/src/components/Breadcrumb.tsx +294 -0
  940. package/src/components/Button.tsx +149 -0
  941. package/src/components/CalendarMobile.tsx +803 -0
  942. package/src/components/Card.tsx +206 -0
  943. package/src/components/Cascader.tsx +596 -0
  944. package/src/components/ChainedSelection.tsx +253 -0
  945. package/src/components/Checkbox.tsx +117 -0
  946. package/src/components/CityArea.tsx +318 -0
  947. package/src/components/CityDB.ts +4109 -0
  948. package/src/components/CodeMirror.tsx +99 -0
  949. package/src/components/Collapse.tsx +253 -0
  950. package/src/components/CollapseGroup.tsx +133 -0
  951. package/src/components/ColorPicker.tsx +374 -0
  952. package/src/components/ContextMenu.tsx +313 -0
  953. package/src/components/DatePicker.tsx +879 -0
  954. package/src/components/DateRangePicker.tsx +1500 -0
  955. package/src/components/Drawer.tsx +357 -0
  956. package/src/components/Editor.tsx +341 -0
  957. package/src/components/Form.tsx +70 -0
  958. package/src/components/FormField.tsx +127 -0
  959. package/src/components/GridNav.tsx +233 -0
  960. package/src/components/GroupedSelection.tsx +123 -0
  961. package/src/components/Html.tsx +75 -0
  962. package/src/components/ImageGallery.tsx +179 -0
  963. package/src/components/Input.tsx +72 -0
  964. package/src/components/InputBox.tsx +126 -0
  965. package/src/components/InputBoxWithSuggestion.tsx +113 -0
  966. package/src/components/Layout.tsx +123 -0
  967. package/src/components/Link.tsx +85 -0
  968. package/src/components/ListGroup.tsx +72 -0
  969. package/src/components/ListMenu.tsx +112 -0
  970. package/src/components/LocationPicker.tsx +213 -0
  971. package/src/components/Markdown.tsx +53 -0
  972. package/src/components/Modal.tsx +294 -0
  973. package/src/components/ModalManager.ts +49 -0
  974. package/src/components/MonthRangePicker.tsx +699 -0
  975. package/src/components/NumberInput.tsx +255 -0
  976. package/src/components/Overlay.tsx +317 -0
  977. package/src/components/Pagination.tsx +526 -0
  978. package/src/components/Picker.tsx +161 -0
  979. package/src/components/PickerColumn.tsx +400 -0
  980. package/src/components/PickerContainer.tsx +178 -0
  981. package/src/components/PopOver.tsx +155 -0
  982. package/src/components/PopOverContainer.tsx +114 -0
  983. package/src/components/PopUp.tsx +161 -0
  984. package/src/components/Progress.tsx +173 -0
  985. package/src/components/PullRefresh.tsx +197 -0
  986. package/src/components/Radios.tsx +198 -0
  987. package/src/components/Range.tsx +561 -0
  988. package/src/components/Rating.tsx +421 -0
  989. package/src/components/ResultBox.tsx +224 -0
  990. package/src/components/ResultList.tsx +300 -0
  991. package/src/components/ResultTableList.tsx +229 -0
  992. package/src/components/ResultTreeList.tsx +312 -0
  993. package/src/components/RichText.tsx +312 -0
  994. package/src/components/SearchBox.tsx +175 -0
  995. package/src/components/Select.tsx +1229 -0
  996. package/src/components/Selection.tsx +232 -0
  997. package/src/components/SparkLine.tsx +111 -0
  998. package/src/components/Spinner.tsx +126 -0
  999. package/src/components/Steps.tsx +221 -0
  1000. package/src/components/Switch.tsx +122 -0
  1001. package/src/components/TableSelection.tsx +183 -0
  1002. package/src/components/Tabs.tsx +747 -0
  1003. package/src/components/TabsTransfer.tsx +422 -0
  1004. package/src/components/TabsTransferPicker.tsx +111 -0
  1005. package/src/components/Tag.tsx +179 -0
  1006. package/src/components/Textarea.tsx +234 -0
  1007. package/src/components/Timeline.tsx +36 -0
  1008. package/src/components/TimelineItem.tsx +140 -0
  1009. package/src/components/Tinymce.tsx +614 -0
  1010. package/src/components/TitleBar.tsx +61 -0
  1011. package/src/components/Toast.tsx +421 -0
  1012. package/src/components/Tooltip.tsx +78 -0
  1013. package/src/components/TooltipWrapper.tsx +366 -0
  1014. package/src/components/Transfer.tsx +755 -0
  1015. package/src/components/TransferDropDown.tsx +136 -0
  1016. package/src/components/TransferPicker.tsx +118 -0
  1017. package/src/components/TransferSearch.tsx +126 -0
  1018. package/src/components/Tree.tsx +1183 -0
  1019. package/src/components/TreeSelection.tsx +315 -0
  1020. package/src/components/UserSelect.tsx +850 -0
  1021. package/src/components/UserTabSelect.tsx +261 -0
  1022. package/src/components/WithRemoteConfig.tsx +406 -0
  1023. package/src/components/WithStore.tsx +73 -0
  1024. package/src/components/calendar/Calendar.tsx +710 -0
  1025. package/src/components/calendar/CalendarContainer.tsx +30 -0
  1026. package/src/components/calendar/DaysView.tsx +812 -0
  1027. package/src/components/calendar/MonthsView.tsx +288 -0
  1028. package/src/components/calendar/QuartersView.tsx +156 -0
  1029. package/src/components/calendar/TimeView.tsx +742 -0
  1030. package/src/components/calendar/YearsView.tsx +214 -0
  1031. package/src/components/condition-builder/Expression.tsx +244 -0
  1032. package/src/components/condition-builder/Field.tsx +152 -0
  1033. package/src/components/condition-builder/Formula.tsx +39 -0
  1034. package/src/components/condition-builder/Func.tsx +141 -0
  1035. package/src/components/condition-builder/Group.tsx +258 -0
  1036. package/src/components/condition-builder/GroupOrItem.tsx +161 -0
  1037. package/src/components/condition-builder/InputSwitch.tsx +51 -0
  1038. package/src/components/condition-builder/Item.tsx +427 -0
  1039. package/src/components/condition-builder/Value.tsx +162 -0
  1040. package/src/components/condition-builder/config.ts +133 -0
  1041. package/src/components/condition-builder/index.tsx +269 -0
  1042. package/src/components/condition-builder/types.ts +218 -0
  1043. package/src/components/formula/Editor.tsx +337 -0
  1044. package/src/components/formula/FuncList.tsx +113 -0
  1045. package/src/components/formula/Picker.tsx +415 -0
  1046. package/src/components/formula/VariableList.tsx +126 -0
  1047. package/src/components/formula/plugin.ts +252 -0
  1048. package/src/components/icons.tsx +267 -0
  1049. package/src/components/index.tsx +133 -0
  1050. package/src/components/json-schema/Array.tsx +216 -0
  1051. package/src/components/json-schema/Item.tsx +47 -0
  1052. package/src/components/json-schema/Object.tsx +339 -0
  1053. package/src/components/json-schema/index.tsx +48 -0
  1054. package/src/components/schema-editor/Array.tsx +99 -0
  1055. package/src/components/schema-editor/Common.tsx +191 -0
  1056. package/src/components/schema-editor/Item.tsx +30 -0
  1057. package/src/components/schema-editor/Object.tsx +302 -0
  1058. package/src/components/schema-editor/SchemaVariableList.tsx +98 -0
  1059. package/src/components/schema-editor/SchemaVariableListPicker.tsx +68 -0
  1060. package/src/components/schema-editor/index.tsx +228 -0
  1061. package/src/components/table/Cell.tsx +71 -0
  1062. package/src/components/table/HeadCellDropDown.tsx +112 -0
  1063. package/src/components/table/HeadCellFilter.tsx +230 -0
  1064. package/src/components/table/HeadCellSelect.tsx +97 -0
  1065. package/src/components/table/HeadCellSort.tsx +99 -0
  1066. package/src/components/table/ItemActionsWrapper.tsx +37 -0
  1067. package/src/components/table/index.tsx +2012 -0
  1068. package/src/components/virtual-list/SizeAndPositionManager.ts +308 -0
  1069. package/src/components/virtual-list/constants.ts +41 -0
  1070. package/src/components/virtual-list/index.tsx +447 -0
  1071. package/src/custom.d.ts +14 -0
  1072. package/src/hooks/index.ts +7 -0
  1073. package/src/hooks/use-set-state.ts +19 -0
  1074. package/src/hooks/use-touch.ts +100 -0
  1075. package/src/hooks/use-update-effect.ts +16 -0
  1076. package/src/hooks/use-validation-resolver.ts +47 -0
  1077. package/src/icons/alert-danger.svg +1 -0
  1078. package/src/icons/alert-info.svg +1 -0
  1079. package/src/icons/alert-success.svg +1 -0
  1080. package/src/icons/alert-warning.svg +1 -0
  1081. package/src/icons/back.svg +11 -0
  1082. package/src/icons/calendar.svg +27 -0
  1083. package/src/icons/caret.svg +7 -0
  1084. package/src/icons/check.svg +9 -0
  1085. package/src/icons/clock.svg +1 -0
  1086. package/src/icons/close-small.svg +5 -0
  1087. package/src/icons/close.svg +4 -0
  1088. package/src/icons/cloud-upload.svg +22 -0
  1089. package/src/icons/column-filter.svg +9 -0
  1090. package/src/icons/columns.svg +7 -0
  1091. package/src/icons/compress-alt.svg +3 -0
  1092. package/src/icons/copy.svg +9 -0
  1093. package/src/icons/date.svg +9 -0
  1094. package/src/icons/department.svg +17 -0
  1095. package/src/icons/desk-empty.svg +25 -0
  1096. package/src/icons/dot.svg +11 -0
  1097. package/src/icons/down-arrow-bold.svg +10 -0
  1098. package/src/icons/download.svg +4 -0
  1099. package/src/icons/drag-bar.svg +13 -0
  1100. package/src/icons/drag.svg +8 -0
  1101. package/src/icons/edit.svg +8 -0
  1102. package/src/icons/ellipsis-v.svg +9 -0
  1103. package/src/icons/enter.svg +4 -0
  1104. package/src/icons/exchange.svg +7 -0
  1105. package/src/icons/expand-alt.svg +3 -0
  1106. package/src/icons/fail.svg +8 -0
  1107. package/src/icons/file.svg +8 -0
  1108. package/src/icons/filter.svg +7 -0
  1109. package/src/icons/folder.svg +9 -0
  1110. package/src/icons/function.svg +4 -0
  1111. package/src/icons/home.svg +7 -0
  1112. package/src/icons/image.svg +1 -0
  1113. package/src/icons/info-circle.svg +7 -0
  1114. package/src/icons/info.svg +8 -0
  1115. package/src/icons/input-clear.svg +1 -0
  1116. package/src/icons/invisible.svg +10 -0
  1117. package/src/icons/left-arrow.svg +7 -0
  1118. package/src/icons/loading-outline.svg +4 -0
  1119. package/src/icons/location.svg +10 -0
  1120. package/src/icons/menu.svg +2 -0
  1121. package/src/icons/minus.svg +7 -0
  1122. package/src/icons/move.svg +8 -0
  1123. package/src/icons/mute.svg +4 -0
  1124. package/src/icons/pause.svg +5 -0
  1125. package/src/icons/pencil.svg +7 -0
  1126. package/src/icons/play.svg +4 -0
  1127. package/src/icons/plus-cicle.svg +9 -0
  1128. package/src/icons/plus-fine.svg +10 -0
  1129. package/src/icons/plus.svg +9 -0
  1130. package/src/icons/post.svg +15 -0
  1131. package/src/icons/question-mark.svg +12 -0
  1132. package/src/icons/question.svg +7 -0
  1133. package/src/icons/redo.svg +7 -0
  1134. package/src/icons/refresh.svg +7 -0
  1135. package/src/icons/reload.svg +6 -0
  1136. package/src/icons/remove.svg +10 -0
  1137. package/src/icons/retry.svg +8 -0
  1138. package/src/icons/right-arrow-bold.svg +7 -0
  1139. package/src/icons/right-arrow.svg +7 -0
  1140. package/src/icons/role.svg +14 -0
  1141. package/src/icons/schedule.svg +9 -0
  1142. package/src/icons/search.svg +4 -0
  1143. package/src/icons/setting.svg +9 -0
  1144. package/src/icons/slider-handle-icon.svg +6 -0
  1145. package/src/icons/sort-asc.svg +7 -0
  1146. package/src/icons/sort-default.svg +9 -0
  1147. package/src/icons/sort-desc.svg +7 -0
  1148. package/src/icons/star.svg +12 -0
  1149. package/src/icons/status-close.svg +10 -0
  1150. package/src/icons/status-fail.svg +10 -0
  1151. package/src/icons/status-info.svg +8 -0
  1152. package/src/icons/status-success.svg +10 -0
  1153. package/src/icons/status-warning.svg +8 -0
  1154. package/src/icons/success.svg +10 -0
  1155. package/src/icons/transparent.svg +11 -0
  1156. package/src/icons/trash.svg +8 -0
  1157. package/src/icons/tree-down.svg +5 -0
  1158. package/src/icons/undo.svg +7 -0
  1159. package/src/icons/upload.svg +9 -0
  1160. package/src/icons/user-remove.svg +12 -0
  1161. package/src/icons/view.svg +10 -0
  1162. package/src/icons/volume.svg +5 -0
  1163. package/src/icons/warning-mark.svg +13 -0
  1164. package/src/icons/warning.svg +7 -0
  1165. package/src/icons/window-restore.svg +7 -0
  1166. package/src/icons/zoom-in.svg +7 -0
  1167. package/src/icons/zoom-out.svg +7 -0
  1168. package/src/index.tsx +11 -0
  1169. package/src/locale/de-DE.ts +357 -0
  1170. package/src/locale/en-US.ts +346 -0
  1171. package/src/locale/zh-CN.ts +351 -0
  1172. package/src/themes/ang.ts +8 -0
  1173. package/src/themes/antd.ts +44 -0
  1174. package/src/themes/cxd.ts +458 -0
  1175. package/src/themes/dark.ts +16 -0
  1176. package/src/themes/default.ts +5 -0
  1177. package/tsconfig.json +14 -0
  1178. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,2012 @@
1
+ /**
2
+ * @file Table
3
+ * @author fex
4
+ */
5
+
6
+ import React from 'react';
7
+ import {findDOMNode} from 'react-dom';
8
+ import findLastIndex from 'lodash/findLastIndex';
9
+ import find from 'lodash/find';
10
+ import isEqual from 'lodash/isEqual';
11
+ import filter from 'lodash/filter';
12
+ import intersection from 'lodash/intersection';
13
+ import cloneDeep from 'lodash/cloneDeep';
14
+ import Sortable from 'sortablejs';
15
+
16
+ import {themeable, ClassNamesFn, ThemeProps} from 'amis-core';
17
+ import {localeable, LocaleProps} from 'amis-core';
18
+ import {isObject, isBreakpoint, guid} from 'amis-core';
19
+ import {Icon} from '../icons';
20
+ import CheckBox from '../Checkbox';
21
+ import Spinner from '../Spinner';
22
+
23
+ import HeadCellSort from './HeadCellSort';
24
+ import HeadCellFilter from './HeadCellFilter';
25
+ import HeadCellSelect from './HeadCellSelect';
26
+ import ItemActionsWrapper from './ItemActionsWrapper';
27
+ import Cell from './Cell';
28
+
29
+ export interface ColumnProps {
30
+ title: string | React.ReactNode | Function;
31
+ key: string;
32
+ className?: Function;
33
+ children?: Array<ColumnProps>;
34
+ render: Function;
35
+ fixed?: boolean | string;
36
+ width?: number | string;
37
+ sorter?: (a: any, b: any) => number | boolean; // 设置为true时,执行onSort,否则执行前端排序
38
+ sortOrder?: string; // 升序ascend、降序descend
39
+ filters?: Array<any>; // 筛选数据源,配置了数据源才展示
40
+ filterMode?: string; // menu/tree 默认menu 先只支持menu
41
+ filterMultiple?: boolean; // 是否支持多选
42
+ filteredValue?: Array<string>;
43
+ filtered?: boolean;
44
+ filterDropdown?: Function | React.ReactNode; // 列筛选 filterDropdown的优先级更高 和filters两者不能并存
45
+ align?: string; // left/right/center
46
+ breakpoint?: '*' | 'xs' | 'sm' | 'md' | 'lg';
47
+ }
48
+
49
+ export interface ThProps extends ColumnProps {
50
+ rowSpan: number;
51
+ colSpan: number;
52
+ groupId: string; // 随机生成表头分组的id
53
+ depth: number; // 表头分组层级
54
+ }
55
+
56
+ export interface TdProps extends ColumnProps {
57
+ rowSpan: number;
58
+ colSpan: number;
59
+ groupId: string; // 随机生成表头分组的id
60
+ }
61
+
62
+ export interface RowSelectionOptionProps {
63
+ key: string;
64
+ text: string;
65
+ onSelect: Function;
66
+ }
67
+
68
+ export interface RowSelectionProps {
69
+ type: string;
70
+ rowClick: boolean; // 点击复选框选中还是点击整行选中
71
+ fixed: boolean; // 只能固定在左边
72
+ selectedRowKeys: Array<string | number>;
73
+ keyField?: string; // 默认是key,可自定义
74
+ columnWidth?: number;
75
+ selections?: Array<RowSelectionOptionProps>;
76
+ onChange?: Function;
77
+ getCheckboxProps: Function;
78
+ }
79
+
80
+ export interface ExpandableProps {
81
+ expandedRowKeys?: Array<string | number>;
82
+ keyField: string; // 默认是key,可自定义
83
+ columnWidth?: number;
84
+ rowExpandable: Function;
85
+ defaultExpandedRowKeys?: Array<string | number>;
86
+ onExpand?: Function;
87
+ onExpandedRowsChange?: Function;
88
+ expandedRowRender?: Function;
89
+ expandedRowClassName?: Function;
90
+ expandIcon?: Function;
91
+ fixed?: boolean;
92
+ }
93
+
94
+ export interface SummaryProps {
95
+ colSpan: number; // 手动控制列合并 先不支持列合并
96
+ fixed: string | boolean; // 手动设置左固定还是右固定
97
+ render: Function | React.ReactNode;
98
+ }
99
+
100
+ export interface OnRowProps {
101
+ onRowMouseEnter?: Function;
102
+ onRowMouseLeave?: Function;
103
+ onRowClick?: Function;
104
+ }
105
+
106
+ export interface SortProps {
107
+ orderBy: string;
108
+ order: string;
109
+ }
110
+
111
+ export interface TableProps extends ThemeProps, LocaleProps {
112
+ title: string | React.ReactNode | Function;
113
+ footer: string | React.ReactNode | Function;
114
+ className?: string;
115
+ dataSource: Array<any>;
116
+ classnames: ClassNamesFn;
117
+ columns: Array<ColumnProps>;
118
+ scroll?: ScrollProps;
119
+ rowSelection?: RowSelectionProps;
120
+ onSort?: Function;
121
+ expandable?: ExpandableProps;
122
+ bordered?: boolean;
123
+ size?: string; // large | default | small
124
+ headSummary?:
125
+ | Function
126
+ | React.ReactNode
127
+ | Array<SummaryProps | Array<SummaryProps>>;
128
+ footSummary?:
129
+ | Function
130
+ | React.ReactNode
131
+ | Array<SummaryProps | Array<SummaryProps>>;
132
+ draggable?: boolean;
133
+ onDrag?: Function;
134
+ resizable?: boolean; // 列宽调整
135
+ placeholder?: string | React.ReactNode | Function; // 数据为空展示
136
+ loading?: boolean | string | React.ReactNode; // 数据加载中
137
+ sticky?: boolean; // 粘性头部
138
+ onFilter?: Function; // 筛选/过滤函数
139
+ childrenColumnName?: string; // 控制数据源哪一列作为嵌套数据,不想支持,就随便设置一个不存在的值,默认是children
140
+ keyField?: string; // 展开嵌套数据的时候,用哪个字段做唯一标识
141
+ indentSize: number; // 树形展示时 设置缩进值
142
+ onRow?: OnRowProps; // 行操作事件
143
+ rowClassName?: Function;
144
+ lineHeight?: string; // 可设置large、middle固定高度,不设置则跟随内容
145
+ showHeader?: boolean; // 是否展示表头
146
+ onSelect?: Function;
147
+ onSelectAll?: Function;
148
+ itemActions?: Function;
149
+ }
150
+
151
+ export interface ScrollProps {
152
+ x: number | string | true;
153
+ y: number | string;
154
+ }
155
+
156
+ export interface TableState {
157
+ selectedRowKeys: Array<string | number>;
158
+ dataSource: Array<any>;
159
+ expandedRowKeys: Array<string | number>;
160
+ colWidths: Array<number>;
161
+ hoverRow: {
162
+ rowIndex?: number;
163
+ record: any;
164
+ target: HTMLTableRowElement;
165
+ } | null;
166
+ }
167
+
168
+ function getMaxLevelThRowSpan(columns: Array<ColumnProps>) {
169
+ let maxLevel = 0;
170
+
171
+ Array.isArray(columns) &&
172
+ columns.forEach(c => {
173
+ const level = getThRowSpan(c);
174
+ if (maxLevel < level) {
175
+ maxLevel = level;
176
+ }
177
+ });
178
+
179
+ return maxLevel;
180
+ }
181
+
182
+ function getThRowSpan(column: ColumnProps) {
183
+ if (!column.children || (column.children && !column.children.length)) {
184
+ return 1;
185
+ }
186
+
187
+ return 1 + getMaxLevelThRowSpan(column.children);
188
+ }
189
+
190
+ function getThColSpan(column: ColumnProps) {
191
+ if (!column.children || (column.children && !column.children.length)) {
192
+ return 1;
193
+ }
194
+
195
+ let childrenLength = 0;
196
+ column.children.forEach(item => (childrenLength += getThColSpan(item)));
197
+
198
+ return childrenLength;
199
+ }
200
+
201
+ function buildColumns(
202
+ columns: Array<ColumnProps> = [],
203
+ thColumns: Array<Array<any>>,
204
+ tdColumns: Array<ColumnProps> = [],
205
+ depth: number = 0,
206
+ id?: string,
207
+ fixed?: boolean | string
208
+ ) {
209
+ const maxLevel = getMaxLevelThRowSpan(columns);
210
+ // 在处理表头时,如果父级column设置了fixed属性,那么所有children保持一致
211
+ Array.isArray(columns) &&
212
+ columns.forEach(column => {
213
+ const groupId = id || guid();
214
+ let childMaxLevel = 0;
215
+ if (column.children) {
216
+ childMaxLevel = getMaxLevelThRowSpan(column.children);
217
+ }
218
+ const newColumn = {
219
+ ...column,
220
+ rowSpan: childMaxLevel ? 1 : maxLevel - childMaxLevel + depth,
221
+ colSpan: getThColSpan(column),
222
+ groupId,
223
+ depth
224
+ };
225
+ const tdColumn = {
226
+ ...column,
227
+ groupId
228
+ };
229
+ if (fixed) {
230
+ newColumn.fixed = fixed;
231
+ tdColumn.fixed = fixed;
232
+ }
233
+
234
+ if (!thColumns[depth]) {
235
+ thColumns[depth] = [];
236
+ }
237
+ thColumns[depth].push(newColumn);
238
+ if (column.children && column.children.length > 0) {
239
+ buildColumns(
240
+ column.children,
241
+ thColumns,
242
+ tdColumns,
243
+ depth + 1,
244
+ groupId,
245
+ column.fixed
246
+ );
247
+ } else {
248
+ const {children, ...rest} = tdColumn;
249
+ tdColumns.push(rest);
250
+ }
251
+ });
252
+ }
253
+
254
+ function isFixedLeftColumn(fixed: boolean | string | undefined) {
255
+ return fixed === true || fixed === 'left';
256
+ }
257
+
258
+ function isFixedRightColumn(fixed: boolean | string | undefined) {
259
+ return fixed === 'right';
260
+ }
261
+
262
+ function getPreviousLeftWidth(
263
+ doms: HTMLCollection,
264
+ index: number,
265
+ columns: Array<ColumnProps>
266
+ ) {
267
+ let width = 0;
268
+ for (let i = 0; i < index; i++) {
269
+ if (columns && columns[i] && isFixedLeftColumn(columns[i].fixed)) {
270
+ const dom = doms[i] as HTMLElement;
271
+ width += dom.offsetWidth;
272
+ }
273
+ }
274
+ return width;
275
+ }
276
+
277
+ function getAfterRightWidth(
278
+ doms: HTMLCollection,
279
+ index: number,
280
+ columns: Array<ColumnProps>
281
+ ) {
282
+ let width = 0;
283
+ for (let i = doms.length - 0; i > index; i--) {
284
+ if (columns && columns[i] && isFixedRightColumn(columns[i].fixed)) {
285
+ const dom = doms[i] as HTMLElement;
286
+ width += dom.offsetWidth;
287
+ }
288
+ }
289
+ return width;
290
+ }
291
+
292
+ function hasFixedColumn(columns: Array<ColumnProps>) {
293
+ return find(columns, column => column.fixed);
294
+ }
295
+
296
+ function getSummaryColumns(summary: Array<SummaryProps>) {
297
+ if (!summary) {
298
+ return [];
299
+ }
300
+ const last: Array<SummaryProps> = [];
301
+ const first: Array<SummaryProps> = [];
302
+ summary.forEach(item => {
303
+ if (isObject(item)) {
304
+ first.push(item);
305
+ } else if (Array.isArray(item)) {
306
+ last.push(item);
307
+ }
308
+ });
309
+ return [first, ...last];
310
+ }
311
+
312
+ const DefaultCellWidth = 40;
313
+
314
+ export class Table extends React.PureComponent<TableProps, TableState> {
315
+ static defaultProps = {
316
+ title: '',
317
+ className: '',
318
+ dataSource: [],
319
+ columns: [],
320
+ indentSize: 15,
321
+ placeholder: '暂无数据',
322
+ showHeader: true
323
+ };
324
+
325
+ constructor(props: TableProps) {
326
+ super(props);
327
+
328
+ this.selectedRows = props.rowSelection
329
+ ? this.getSelectedRows(
330
+ props.dataSource,
331
+ props.rowSelection?.selectedRowKeys
332
+ )
333
+ : [];
334
+
335
+ this.state = {
336
+ selectedRowKeys: props.rowSelection
337
+ ? props.rowSelection.selectedRowKeys.map(key => key) || []
338
+ : [],
339
+ dataSource: props.dataSource || [], // 为了支持前端搜索
340
+ expandedRowKeys: [
341
+ ...(props.expandable ? props.expandable.expandedRowKeys || [] : []),
342
+ ...(props.expandable
343
+ ? props.expandable.defaultExpandedRowKeys || []
344
+ : [])
345
+ ],
346
+ colWidths: [],
347
+ hoverRow: null
348
+ };
349
+
350
+ this.onTableContentScroll = this.onTableContentScroll.bind(this);
351
+ this.getPopOverContainer = this.getPopOverContainer.bind(this);
352
+ }
353
+
354
+ getPopOverContainer() {
355
+ return findDOMNode(this);
356
+ }
357
+
358
+ // 表头配置
359
+ thColumns: Array<Array<ThProps>>;
360
+ // 表格配置
361
+ tdColumns: Array<TdProps>;
362
+ // 表格当前选中行
363
+ selectedRows: Array<any>;
364
+ // 拖拽排序
365
+ sortable: Sortable;
366
+ // 记录点击起始横坐标
367
+ resizeStart: number;
368
+ resizeKey: string;
369
+
370
+ tableDom: React.RefObject<HTMLDivElement> = React.createRef();
371
+ theadDom: React.RefObject<HTMLTableSectionElement> = React.createRef();
372
+ tbodyDom: React.RefObject<HTMLTableSectionElement> = React.createRef();
373
+ contentDom: React.RefObject<HTMLDivElement> = React.createRef();
374
+ headerDom: React.RefObject<HTMLDivElement> = React.createRef();
375
+ bodyDom: React.RefObject<HTMLDivElement> = React.createRef();
376
+ tfootDom: React.RefObject<HTMLTableSectionElement> = React.createRef();
377
+ footDom: React.RefObject<HTMLDivElement> = React.createRef();
378
+
379
+ getColWidths() {
380
+ const childrens = this.tbodyDom.current?.children[0]?.children || [];
381
+ const colWidths: Array<any> = new Array(childrens ? childrens.length : 0);
382
+
383
+ for (let i = 0; i < childrens.length; i++) {
384
+ const child: any = childrens[i];
385
+ colWidths[i] = child ? child.offsetWidth : null;
386
+ }
387
+
388
+ return colWidths;
389
+ }
390
+
391
+ getSelectedRows(
392
+ dataSource: Array<any>,
393
+ selectedRowKeys: Array<string | number>
394
+ ) {
395
+ const selectedRows: Array<any> = [];
396
+ dataSource.forEach(data => {
397
+ if (
398
+ find(
399
+ selectedRowKeys,
400
+ key => key === data[this.getRowSelectionKeyField()]
401
+ )
402
+ ) {
403
+ selectedRows.push(data);
404
+ }
405
+ });
406
+
407
+ return selectedRows;
408
+ }
409
+
410
+ updateTableBodyFixed() {
411
+ const tbodyDom = this.tbodyDom && (this.tbodyDom.current as HTMLElement);
412
+ const tdColumns = [...this.tdColumns];
413
+ this.updateTbodyFixedRow(tbodyDom, tdColumns);
414
+ this.updateHeadSummaryFixedRow(tbodyDom);
415
+ }
416
+
417
+ updateColWidths() {
418
+ this.setState({colWidths: this.getColWidths()}, () => {
419
+ if (hasFixedColumn(this.props.columns)) {
420
+ const theadDom =
421
+ this.theadDom && (this.theadDom.current as HTMLElement);
422
+ const thColumns = this.thColumns;
423
+ this.updateTheadFixedRow(theadDom, thColumns);
424
+ this.updateTableBodyFixed();
425
+ }
426
+ });
427
+ }
428
+
429
+ componentDidMount() {
430
+ if (this.props.loading) {
431
+ return;
432
+ }
433
+
434
+ if (hasFixedColumn(this.props.columns)) {
435
+ const headerDom =
436
+ this.headerDom && (this.headerDom.current as HTMLElement);
437
+ if (headerDom) {
438
+ const headerBody = headerDom.getElementsByTagName('tbody');
439
+ headerBody &&
440
+ headerBody[0] &&
441
+ this.updateHeadSummaryFixedRow(headerBody[0]);
442
+ }
443
+
444
+ const tfootDom = this.tfootDom && (this.tfootDom.current as HTMLElement);
445
+ tfootDom && this.updateFootSummaryFixedRow(tfootDom);
446
+ }
447
+
448
+ let current = null;
449
+ if (this.contentDom && this.contentDom.current) {
450
+ current = this.contentDom.current;
451
+ current.addEventListener('scroll', this.onTableContentScroll.bind(this));
452
+ } else {
453
+ current = this.headerDom?.current;
454
+
455
+ // overflow设置为hidden的情况
456
+ const hiddenDomRefs = [this.headerDom, this.footDom];
457
+ hiddenDomRefs.forEach(
458
+ ref =>
459
+ ref &&
460
+ ref.current &&
461
+ ref.current.addEventListener('wheel', this.onWheel.bind(this))
462
+ );
463
+ // 横向同步滚动
464
+ const scrollDomRefs = [this.bodyDom];
465
+ scrollDomRefs.forEach(
466
+ ref =>
467
+ ref &&
468
+ ref.current &&
469
+ ref.current.addEventListener('scroll', this.onTableScroll.bind(this))
470
+ );
471
+ }
472
+ current && this.updateTableDom(current);
473
+
474
+ if (this.props.draggable) {
475
+ this.initDragging();
476
+ }
477
+
478
+ if (this.props.resizable) {
479
+ this.theadDom.current?.addEventListener(
480
+ 'mouseup',
481
+ this.onResizeMouseUp.bind(this)
482
+ );
483
+ }
484
+
485
+ this.updateStickyHeader();
486
+
487
+ this.updateColWidths();
488
+ }
489
+
490
+ componentDidUpdate(prevProps: TableProps, prevState: TableState) {
491
+ // 数据源发生了变化
492
+ if (!isEqual(prevProps.dataSource, this.props.dataSource)) {
493
+ this.setState({dataSource: [...this.props.dataSource]}, () =>
494
+ this.updateColWidths()
495
+ ); // 异步加载数据需求再更新一次
496
+ }
497
+
498
+ // 选择项发生了变化触发
499
+ if (!isEqual(prevState.selectedRowKeys, this.state.selectedRowKeys)) {
500
+ // 更新保存的已选择行数据
501
+ this.selectedRows = this.getSelectedRows(
502
+ this.state.dataSource,
503
+ this.state.selectedRowKeys
504
+ );
505
+
506
+ const {rowSelection} = this.props;
507
+ rowSelection &&
508
+ rowSelection.onChange &&
509
+ rowSelection.onChange(this.state.selectedRowKeys, this.selectedRows);
510
+
511
+ this.setState({
512
+ selectedRowKeys: this.state.selectedRowKeys.filter(
513
+ (key, i, a) => a.indexOf(key) === i
514
+ )
515
+ });
516
+ }
517
+
518
+ // 外部传入的选择项发生了变化
519
+ if (
520
+ !isEqual(
521
+ prevProps.rowSelection?.selectedRowKeys,
522
+ this.props.rowSelection?.selectedRowKeys
523
+ )
524
+ ) {
525
+ if (this.props.rowSelection) {
526
+ this.setState({
527
+ selectedRowKeys: this.props.rowSelection.selectedRowKeys
528
+ });
529
+ this.selectedRows = this.getSelectedRows(
530
+ this.state.dataSource,
531
+ this.state.selectedRowKeys
532
+ );
533
+ }
534
+ }
535
+
536
+ // 外部传入的展开项发生了变化
537
+ if (
538
+ !isEqual(
539
+ prevProps?.expandable?.expandedRowKeys,
540
+ this.props.expandable?.expandedRowKeys
541
+ )
542
+ ) {
543
+ if (this.props.expandable) {
544
+ this.setState({
545
+ expandedRowKeys: this.props.expandable.expandedRowKeys || []
546
+ });
547
+ }
548
+ }
549
+
550
+ // 展开行变化时触发
551
+ if (!isEqual(prevState.expandedRowKeys, this.state.expandedRowKeys)) {
552
+ if (this.props.expandable) {
553
+ const {onExpandedRowsChange, keyField} = this.props.expandable;
554
+ const expandedRows: Array<any> = [];
555
+ this.state.dataSource.forEach(item => {
556
+ if (
557
+ find(
558
+ this.state.expandedRowKeys,
559
+ key => key == item[keyField || 'key']
560
+ )
561
+ ) {
562
+ expandedRows.push(item);
563
+ }
564
+ });
565
+ onExpandedRowsChange && onExpandedRowsChange(expandedRows);
566
+ }
567
+ }
568
+
569
+ // sticky属性发生了变化
570
+ if (prevProps.sticky !== this.props.sticky) {
571
+ this.updateStickyHeader();
572
+ }
573
+ }
574
+
575
+ componentWillUnmount() {
576
+ this.contentDom &&
577
+ this.contentDom.current &&
578
+ this.contentDom.current.removeEventListener(
579
+ 'scroll',
580
+ this.onTableContentScroll.bind(this)
581
+ );
582
+
583
+ const hiddenDomRefs = [this.headerDom, this.footDom];
584
+ hiddenDomRefs.forEach(
585
+ ref =>
586
+ ref &&
587
+ ref.current &&
588
+ ref.current.removeEventListener('wheel', this.onWheel.bind(this))
589
+ );
590
+
591
+ const scrollDomRefs = [this.bodyDom];
592
+ scrollDomRefs.forEach(
593
+ ref =>
594
+ ref &&
595
+ ref.current &&
596
+ ref.current.removeEventListener('scroll', this.onTableScroll.bind(this))
597
+ );
598
+
599
+ this.destroyDragging();
600
+ }
601
+
602
+ exchange(fromIndex: number, toIndex: number, item: any) {
603
+ const {scroll, headSummary} = this.props;
604
+ // 如果有头部总结行 fromIndex就会+1
605
+ if ((!scroll || (scroll && !scroll.y)) && headSummary) {
606
+ fromIndex = fromIndex - 1;
607
+ }
608
+
609
+ const index = toIndex - fromIndex;
610
+
611
+ const levels = item.getAttribute('row-levels');
612
+ const rowIndex = +item.getAttribute('row-index');
613
+
614
+ const dataSource = cloneDeep(this.state.dataSource);
615
+ const levelsArray = levels ? levels.split(',') : [];
616
+ const childrenColumnName = this.getChildrenColumnName();
617
+ let data: Array<any> = dataSource;
618
+ let i = 0;
619
+ while (i < levelsArray.length) {
620
+ data = data[levelsArray[i]][childrenColumnName];
621
+ i++;
622
+ }
623
+
624
+ if (data && data.length > 0) {
625
+ const row = cloneDeep(data[rowIndex]);
626
+ data.splice(rowIndex, 1);
627
+ data.splice(rowIndex + index, 0, row);
628
+ }
629
+
630
+ return data;
631
+ }
632
+
633
+ initDragging() {
634
+ const {classnames: cx, onDrag} = this.props;
635
+
636
+ this.sortable = new Sortable(this.tbodyDom.current as HTMLElement, {
637
+ group: 'table',
638
+ animation: 150,
639
+ handle: `.${cx('Table-dragCell')}`,
640
+ ghostClass: 'is-dragging',
641
+ onMove: (e: any) => {
642
+ const dragged = e.dragged;
643
+ const related = e.related;
644
+
645
+ if (
646
+ related &&
647
+ related.classList.contains(`${cx('Table-summary-row')}`)
648
+ ) {
649
+ return false;
650
+ }
651
+
652
+ const draggedLevels = dragged.getAttribute('row-levels');
653
+ const relatedLevels = related.getAttribute('row-levels');
654
+
655
+ // 嵌套展示 不属于同一层的 不允许拖动
656
+ // 否则涉及到试图的更新,比如子元素都被拖完了
657
+ if (draggedLevels !== relatedLevels) {
658
+ return false;
659
+ }
660
+
661
+ return true;
662
+ },
663
+ onEnd: async (e: any) => {
664
+ // 没有移动
665
+ if (e.newIndex === e.oldIndex) {
666
+ return;
667
+ }
668
+
669
+ const {onDrag} = this.props;
670
+ if (onDrag) {
671
+ const data = this.exchange(e.oldIndex, e.newIndex, e.item);
672
+ const prevented = await onDrag(data);
673
+ if (prevented) {
674
+ return;
675
+ }
676
+ }
677
+ }
678
+ });
679
+ }
680
+
681
+ destroyDragging() {
682
+ this.sortable && this.sortable.destroy();
683
+ }
684
+
685
+ updateStickyHeader() {
686
+ if (this.props.sticky) {
687
+ // 如果设置了sticky 如果父元素设置了overflow: auto top值还需要考虑padding值
688
+ let parent = this.headerDom?.current?.parentElement;
689
+ setTimeout(() => {
690
+ while (
691
+ parent &&
692
+ window.getComputedStyle(parent, null).getPropertyValue('overflow') !==
693
+ 'auto'
694
+ ) {
695
+ parent = parent.parentElement;
696
+ }
697
+ if (
698
+ parent &&
699
+ window.getComputedStyle(parent, null).getPropertyValue('overflow') ===
700
+ 'auto'
701
+ ) {
702
+ const paddingTop = window
703
+ .getComputedStyle(parent, null)
704
+ .getPropertyValue('padding-top');
705
+ if (paddingTop && this.headerDom && this.headerDom.current) {
706
+ this.headerDom.current.style.top = '-' + paddingTop;
707
+ }
708
+ }
709
+ });
710
+ }
711
+ }
712
+
713
+ // 更新一个tr下的td的left和class
714
+ updateFixedRow(row: HTMLElement, columns: Array<ColumnProps>) {
715
+ const {classnames: cx} = this.props;
716
+
717
+ const children = row.children;
718
+ for (let i = 0; i < children.length; i++) {
719
+ const dom = children[i] as HTMLElement;
720
+ const fixed = columns[i] ? columns[i].fixed || '' : '';
721
+ if (isFixedLeftColumn(fixed)) {
722
+ dom.style.left =
723
+ i > 0 ? getPreviousLeftWidth(children, i, columns) + 'px' : '0';
724
+ } else if (isFixedRightColumn(fixed)) {
725
+ dom.style.right =
726
+ i < children.length - 1
727
+ ? getAfterRightWidth(children, i, columns) + 'px'
728
+ : '0';
729
+ }
730
+ }
731
+ // 最后一个左fixed的添加样式
732
+ let leftIndex = findLastIndex(columns, column =>
733
+ isFixedLeftColumn(column.fixed)
734
+ );
735
+ if (leftIndex > -1) {
736
+ children[leftIndex]?.classList.add(cx('Table-cell-fix-left-last'));
737
+ }
738
+ // 第一个右fixed的添加样式
739
+ let rightIndex = columns.findIndex(column =>
740
+ isFixedRightColumn(column.fixed)
741
+ );
742
+ if (rightIndex > -1) {
743
+ children[rightIndex]?.classList.add(cx('Table-cell-fix-right-first'));
744
+ if (rightIndex > 0) {
745
+ children[rightIndex - 1]?.classList.add(
746
+ cx('Table-cell-fix-right-first-prev')
747
+ );
748
+ }
749
+ }
750
+ }
751
+
752
+ // 在可选、可展开、可拖拽的情况下,补充column,方便fix处理
753
+ prependColumns(columns: Array<any>) {
754
+ const {rowSelection, expandable, draggable} = this.props;
755
+ if (draggable) {
756
+ columns.unshift({});
757
+ } else {
758
+ if (expandable) {
759
+ columns.unshift(expandable);
760
+ }
761
+ if (rowSelection) {
762
+ columns.unshift(rowSelection);
763
+ }
764
+ }
765
+ }
766
+
767
+ updateTheadFixedRow(thead: HTMLElement, columns: Array<any>) {
768
+ const children = thead.children;
769
+ for (let i = 0; i < children.length; i++) {
770
+ const cols = [...columns[i]];
771
+ if (i === 0) {
772
+ this.prependColumns(cols);
773
+ }
774
+
775
+ this.updateFixedRow(children[i] as HTMLElement, cols);
776
+ }
777
+ }
778
+
779
+ updateTbodyFixedRow(tbody: HTMLElement, columns: Array<any>) {
780
+ const {classnames: cx} = this.props;
781
+ const children = filter(
782
+ tbody.children,
783
+ child =>
784
+ !child.classList.contains(cx('Table-summary-row')) &&
785
+ !child.classList.contains(cx('Table-empty-row'))
786
+ );
787
+ this.prependColumns(columns);
788
+ for (let i = 0; i < children.length; i++) {
789
+ this.updateFixedRow(children[i] as HTMLElement, columns);
790
+ }
791
+ }
792
+
793
+ updateSummaryFixedRow(
794
+ children: HTMLCollection | Array<Element>,
795
+ columns: Array<any>
796
+ ) {
797
+ for (let i = 0; i < children.length; i++) {
798
+ this.updateFixedRow(children[i] as HTMLElement, columns[i]);
799
+ }
800
+ }
801
+
802
+ updateFootSummaryFixedRow(tfoot: HTMLElement) {
803
+ const {footSummary} = this.props;
804
+ if (Array.isArray(footSummary)) {
805
+ const columns = getSummaryColumns(footSummary as Array<SummaryProps>);
806
+ this.updateSummaryFixedRow(tfoot.children, columns);
807
+ }
808
+ }
809
+
810
+ updateHeadSummaryFixedRow(tbody: HTMLElement) {
811
+ const {headSummary, classnames: cx} = this.props;
812
+ if (Array.isArray(headSummary)) {
813
+ const columns = getSummaryColumns(headSummary as Array<SummaryProps>);
814
+ const children = filter(tbody.children, child =>
815
+ child.classList.contains(cx('Table-summary-row'))
816
+ );
817
+ this.updateSummaryFixedRow(children, columns);
818
+ }
819
+ }
820
+
821
+ renderColGroup(colWidths?: Array<number>) {
822
+ const {rowSelection, classnames: cx, expandable, draggable} = this.props;
823
+
824
+ const tdColumns = this.tdColumns;
825
+ const isExpandable = this.isExpandableTable();
826
+ const extraCount = this.getExtraColumnCount();
827
+
828
+ return (
829
+ <colgroup>
830
+ {draggable ? (
831
+ <col
832
+ className={cx('Table-drag-col')}
833
+ style={{width: DefaultCellWidth + 'px'}}
834
+ ></col>
835
+ ) : null}
836
+ {!draggable && rowSelection ? (
837
+ <col
838
+ className={cx('Table-selection-col')}
839
+ style={{
840
+ width: (rowSelection.columnWidth || DefaultCellWidth) + 'px'
841
+ }}
842
+ ></col>
843
+ ) : null}
844
+ {!draggable && isExpandable ? (
845
+ <col
846
+ className={cx('Table-expand-col')}
847
+ style={{
848
+ width: (expandable?.columnWidth || DefaultCellWidth) + 'px'
849
+ }}
850
+ ></col>
851
+ ) : null}
852
+ {tdColumns.map((data, index) => {
853
+ const width = colWidths ? colWidths[index + extraCount] : data.width;
854
+ return (
855
+ <col
856
+ key={index}
857
+ style={{width: typeof width === 'number' ? width + 'px' : width}}
858
+ className={
859
+ data.className ? cx(`Table-colgroup-${data.className}`) : ''
860
+ }
861
+ ></col>
862
+ );
863
+ })}
864
+ </colgroup>
865
+ );
866
+ }
867
+
868
+ onResizeMouseDown(event: React.MouseEvent<any>, key: string) {
869
+ // 点击记录起始坐标
870
+ this.resizeStart = event.clientX;
871
+ // 记录点击的列名
872
+ this.resizeKey = key;
873
+ event && event.stopPropagation();
874
+ }
875
+
876
+ onResizeMouseUp(event: React.MouseEvent<any>) {
877
+ // 点击了调整列宽
878
+ if (this.resizeStart && this.resizeKey) {
879
+ // 计算横向移动距离
880
+ const distance = event.clientX - this.resizeStart;
881
+ const tdColumns = [...this.tdColumns];
882
+ let index =
883
+ tdColumns.findIndex(c => c.key === this.resizeKey) +
884
+ this.getExtraColumnCount();
885
+
886
+ const colGroup =
887
+ this.tableDom.current?.getElementsByTagName('colgroup')[0];
888
+ let currentWidth = 0;
889
+ if (colGroup && colGroup.children[index]) {
890
+ const child = colGroup.children[index] as HTMLElement;
891
+ currentWidth = child.offsetWidth;
892
+ }
893
+
894
+ let newWidth = 0;
895
+ if (colGroup) {
896
+ let maxDistance = 0; // 最多可以移动的距离
897
+ // 调宽列
898
+ if (distance > 0) {
899
+ for (let i = 0; i < colGroup.children.length; i++) {
900
+ const child = colGroup.children[i] as HTMLElement;
901
+ // 自适应列 保证有一个最小宽度
902
+ // 如果都设置了固定宽度 那一个都拖不动
903
+ if (!this.tdColumns[i].width) {
904
+ maxDistance += child.offsetWidth - DefaultCellWidth;
905
+ }
906
+ }
907
+ if (colGroup.children[index]) {
908
+ const child = colGroup.children[index] as HTMLElement;
909
+ newWidth = currentWidth + Math.min(distance, maxDistance);
910
+ child.style.width = newWidth + 'px';
911
+ }
912
+ } else {
913
+ // 缩短列
914
+ const autoColumns = [];
915
+ for (let i = 0; i < colGroup.children.length; i++) {
916
+ const child = colGroup.children[i] as HTMLElement;
917
+ // 自适应列 保证有一个最小宽度
918
+ // 如果都设置了固定宽度 那一个都拖不动
919
+ if (!this.tdColumns[i].width) {
920
+ autoColumns.push(child);
921
+ }
922
+ }
923
+ maxDistance = DefaultCellWidth - currentWidth;
924
+ if (colGroup.children[index]) {
925
+ const child = colGroup.children[index] as HTMLElement;
926
+ newWidth = currentWidth + Math.max(distance, maxDistance);
927
+ child.style.width = newWidth + 'px';
928
+ }
929
+ const gap =
930
+ Math.abs(Math.max(distance, maxDistance)) / autoColumns.length;
931
+ autoColumns.forEach(c => {
932
+ c.style.width = c.offsetWidth + gap + 'px';
933
+ });
934
+ }
935
+ }
936
+
937
+ const column = find(tdColumns, c => c.key === this.resizeKey);
938
+ // 只有通过配置设置过的宽度保存到tdColumns
939
+ // 自动分配的不保存
940
+ // 这样可以一直调整了
941
+ if (column && column.width && newWidth) {
942
+ column.width = newWidth;
943
+ }
944
+
945
+ this.tdColumns = tdColumns;
946
+
947
+ this.resizeStart = 0;
948
+ this.resizeKey = '';
949
+ }
950
+ event && event.stopPropagation();
951
+ }
952
+
953
+ renderTHead() {
954
+ const {
955
+ rowSelection,
956
+ dataSource,
957
+ classnames: cx,
958
+ onSort,
959
+ expandable,
960
+ draggable,
961
+ resizable,
962
+ onSelectAll,
963
+ onFilter
964
+ } = this.props;
965
+
966
+ const thColumns = this.thColumns;
967
+ // 获取一行最多th个数
968
+ let maxCount = 0;
969
+ thColumns.forEach(columns => {
970
+ if (columns.length > maxCount) {
971
+ maxCount = columns.length;
972
+ }
973
+ });
974
+ const keyField = this.getRowSelectionKeyField();
975
+ const dataList =
976
+ rowSelection && rowSelection.getCheckboxProps
977
+ ? this.state.dataSource.filter((data, index) => {
978
+ const props = rowSelection.getCheckboxProps(data, index);
979
+ return !props.disabled;
980
+ })
981
+ : this.state.dataSource;
982
+
983
+ const isExpandable = this.isExpandableTable();
984
+
985
+ let allRowKeys: Array<string> = [];
986
+ let allRows: Array<any> = [];
987
+ dataList.forEach(data => {
988
+ allRowKeys.push(data[keyField]);
989
+ allRows.push(data);
990
+ if (!expandable && this.hasChildrenRow(data)) {
991
+ allRowKeys = [...allRowKeys, ...this.getDataChildrenKeys(data)];
992
+ data[this.getChildrenColumnName()].forEach((item: any) =>
993
+ allRows.push(item)
994
+ );
995
+ }
996
+ });
997
+
998
+ return (
999
+ <thead ref={this.theadDom} className={cx('Table-thead')}>
1000
+ {thColumns.map((data, index) => {
1001
+ return (
1002
+ <tr key={'th-cell-' + index}>
1003
+ {draggable && index === 0 ? (
1004
+ <Cell
1005
+ wrapperComponent="th"
1006
+ rowSpan={thColumns.length}
1007
+ className={cx('Table-dragCell')}
1008
+ ></Cell>
1009
+ ) : null}
1010
+ {!draggable && rowSelection && index === 0 ? (
1011
+ <Cell
1012
+ wrapperComponent="th"
1013
+ rowSpan={thColumns.length}
1014
+ fixed={rowSelection.fixed ? 'left' : ''}
1015
+ className={cx('Table-checkCell')}
1016
+ >
1017
+ {rowSelection.type !== 'radio'
1018
+ ? [
1019
+ <CheckBox
1020
+ key="checkAll"
1021
+ partial={
1022
+ this.state.selectedRowKeys.length > 0 &&
1023
+ this.state.selectedRowKeys.length <
1024
+ allRowKeys.length
1025
+ }
1026
+ checked={this.state.selectedRowKeys.length > 0}
1027
+ onChange={async value => {
1028
+ let changeRows;
1029
+ if (value) {
1030
+ changeRows = dataList.filter(
1031
+ data => !this.hasCheckedRows(data)
1032
+ );
1033
+ } else {
1034
+ changeRows = this.selectedRows;
1035
+ }
1036
+ const selectedRows = value ? allRows : [];
1037
+ const selectedRowKeys = value ? allRowKeys : [];
1038
+ if (onSelectAll) {
1039
+ const prevented = await onSelectAll(
1040
+ value,
1041
+ selectedRowKeys,
1042
+ selectedRows,
1043
+ changeRows
1044
+ );
1045
+ if (prevented) {
1046
+ return;
1047
+ }
1048
+ }
1049
+
1050
+ this.setState({selectedRowKeys});
1051
+ }}
1052
+ ></CheckBox>,
1053
+ rowSelection.selections &&
1054
+ rowSelection.selections.length > 0 ? (
1055
+ <HeadCellSelect
1056
+ key="checkSelection"
1057
+ keys={allRowKeys}
1058
+ selections={rowSelection.selections}
1059
+ popOverContainer={this.getPopOverContainer}
1060
+ ></HeadCellSelect>
1061
+ ) : null
1062
+ ]
1063
+ : null}
1064
+ </Cell>
1065
+ ) : null}
1066
+ {!draggable && isExpandable && index === 0 ? (
1067
+ <Cell
1068
+ wrapperComponent="th"
1069
+ rowSpan={thColumns.length}
1070
+ fixed={expandable && expandable.fixed ? 'left' : ''}
1071
+ className={cx('Table-row-expand-icon-cell')}
1072
+ ></Cell>
1073
+ ) : null}
1074
+ {data.map((item, i) => {
1075
+ let sort = null;
1076
+ if (item.sorter) {
1077
+ sort = (
1078
+ <HeadCellSort
1079
+ column={item}
1080
+ onSort={
1081
+ onSort
1082
+ ? onSort
1083
+ : (payload: SortProps) => {
1084
+ if (typeof item.sorter === 'function') {
1085
+ if (payload.orderBy) {
1086
+ const sortList = [...this.state.dataSource];
1087
+ this.setState({
1088
+ dataSource: sortList.sort(
1089
+ item.sorter as (a: any, b: any) => number
1090
+ )
1091
+ });
1092
+ } else {
1093
+ this.setState({dataSource: [...dataSource]});
1094
+ }
1095
+ }
1096
+ }
1097
+ }
1098
+ ></HeadCellSort>
1099
+ );
1100
+ }
1101
+
1102
+ let filter = null;
1103
+ if (item.filterDropdown) {
1104
+ filter = item.filterDropdown;
1105
+ } else if (item.filters && item.filters.length > 0) {
1106
+ filter = (
1107
+ <HeadCellFilter
1108
+ column={item}
1109
+ popOverContainer={this.getPopOverContainer}
1110
+ onFilter={onFilter}
1111
+ ></HeadCellFilter>
1112
+ );
1113
+ }
1114
+
1115
+ const children = (
1116
+ <span>
1117
+ {sort}
1118
+ {filter}
1119
+ {resizable ? (
1120
+ <i
1121
+ className={cx('Table-thead-resizable')}
1122
+ onMouseDown={e => this.onResizeMouseDown(e, item.key)}
1123
+ ></i>
1124
+ ) : null}
1125
+ </span>
1126
+ );
1127
+
1128
+ return (
1129
+ <Cell
1130
+ wrapperComponent="th"
1131
+ rowSpan={item.rowSpan}
1132
+ colSpan={item.colSpan}
1133
+ key={`cell-${i}`}
1134
+ fixed={item.fixed === true ? 'left' : item.fixed}
1135
+ className={cx({
1136
+ 'Table-cell-last':
1137
+ i === maxCount - 1 && i === data.length - 1
1138
+ })}
1139
+ groupId={item.groupId}
1140
+ depth={item.depth}
1141
+ >
1142
+ {typeof item.title === 'function'
1143
+ ? item.title(children)
1144
+ : item.title}
1145
+ </Cell>
1146
+ );
1147
+ })}
1148
+ </tr>
1149
+ );
1150
+ })}
1151
+ </thead>
1152
+ );
1153
+ }
1154
+
1155
+ onRowClick(event: React.ChangeEvent<any>, record?: any, rowIndex?: number) {
1156
+ const {rowSelection, onRow} = this.props;
1157
+
1158
+ if (rowSelection && rowSelection.type && rowSelection.rowClick) {
1159
+ const defaultKey = this.getRowSelectionKeyField();
1160
+
1161
+ const isSelected = !!find(
1162
+ this.state.selectedRowKeys,
1163
+ key => key === record[defaultKey]
1164
+ );
1165
+
1166
+ this.selectedSingleRow(!isSelected, record);
1167
+ }
1168
+
1169
+ if (record && onRow) {
1170
+ onRow.onRowClick && onRow.onRowClick(event, record, rowIndex);
1171
+ }
1172
+ }
1173
+
1174
+ onRowMouseEnter(
1175
+ event: React.ChangeEvent<any>,
1176
+ record?: any,
1177
+ rowIndex?: number
1178
+ ) {
1179
+ const {classnames: cx, onRow} = this.props;
1180
+
1181
+ let parent = event.target;
1182
+ while (parent && parent.tagName !== 'TR') {
1183
+ parent = parent.parentElement;
1184
+ }
1185
+
1186
+ if (parent && !parent.classList.contains(cx('Table-row-disabled'))) {
1187
+ for (let i = 0; i < parent.children.length; i++) {
1188
+ const td = parent.children[i];
1189
+ td.classList.add(cx('Table-cell-row-hover')); // 保证有列fixed的时候样式一致
1190
+ }
1191
+ }
1192
+
1193
+ if (record) {
1194
+ let target = event.target;
1195
+ if (target.tagName !== 'TR') {
1196
+ target = target.closest('tr');
1197
+ }
1198
+
1199
+ this.setState({hoverRow: {target, rowIndex, record}}, () => {
1200
+ if (onRow) {
1201
+ onRow.onRowMouseEnter &&
1202
+ onRow.onRowMouseEnter(event, record, rowIndex);
1203
+ }
1204
+ });
1205
+ }
1206
+ }
1207
+
1208
+ onRowMouseLeave(
1209
+ event: React.ChangeEvent<any>,
1210
+ record?: any,
1211
+ rowIndex?: number
1212
+ ) {
1213
+ const {classnames: cx, onRow} = this.props;
1214
+
1215
+ let parent = event.target;
1216
+ while (parent && parent.tagName !== 'TR') {
1217
+ parent = parent.parentElement;
1218
+ }
1219
+
1220
+ if (parent) {
1221
+ for (let i = 0; i < parent.children.length; i++) {
1222
+ const td = parent.children[i];
1223
+ td.classList.remove(cx('Table-cell-row-hover'));
1224
+ }
1225
+ }
1226
+
1227
+ if (record) {
1228
+ if (onRow) {
1229
+ onRow.onRowMouseLeave && onRow.onRowMouseLeave(event, record, rowIndex);
1230
+ }
1231
+ }
1232
+ }
1233
+
1234
+ onMouseLeave(event: React.ChangeEvent<any>) {
1235
+ this.setState({hoverRow: null});
1236
+ }
1237
+
1238
+ onExpandRow(data: any) {
1239
+ const {expandedRowKeys} = this.state;
1240
+ const {expandable} = this.props;
1241
+ const key = data[this.getExpandableKeyField()];
1242
+ this.setState({expandedRowKeys: [...expandedRowKeys, key]});
1243
+ expandable?.onExpand && expandable?.onExpand(true, data);
1244
+ }
1245
+
1246
+ onCollapseRow(data: any) {
1247
+ const {expandedRowKeys} = this.state;
1248
+ const {expandable} = this.props;
1249
+ const key = data[this.getExpandableKeyField()];
1250
+ // 还是得模糊匹配 否则'3'、3匹配不上
1251
+ this.setState({expandedRowKeys: expandedRowKeys.filter(k => k != key)});
1252
+ expandable?.onExpand && expandable?.onExpand(false, data);
1253
+ }
1254
+
1255
+ getChildrenColumnName() {
1256
+ const {childrenColumnName} = this.props;
1257
+
1258
+ return childrenColumnName || 'children';
1259
+ }
1260
+
1261
+ getRowSelectionKeyField() {
1262
+ const {rowSelection} = this.props;
1263
+
1264
+ return rowSelection ? rowSelection.keyField || 'key' : '';
1265
+ }
1266
+
1267
+ getExpandableKeyField() {
1268
+ const {expandable, keyField} = this.props;
1269
+
1270
+ return expandable?.keyField || keyField || 'key';
1271
+ }
1272
+
1273
+ hasChildrenRow(data: any) {
1274
+ const key = this.getChildrenColumnName();
1275
+ return data[key] && Array.isArray(data[key]) && data[key].length > 0;
1276
+ }
1277
+
1278
+ // 展开和嵌套不能共存
1279
+ isExpandableRow(data: any, rowIndex: number) {
1280
+ const {expandable} = this.props;
1281
+
1282
+ return (
1283
+ expandable &&
1284
+ expandable.rowExpandable &&
1285
+ expandable.rowExpandable(data, rowIndex)
1286
+ );
1287
+ }
1288
+
1289
+ // 获取当前行数据所有子行的key值
1290
+ getDataChildrenKeys(data: any) {
1291
+ let keys: Array<string> = [];
1292
+
1293
+ if (this.hasChildrenRow(data)) {
1294
+ const key = this.getChildrenColumnName();
1295
+ data[key].forEach(
1296
+ (item: any) =>
1297
+ (keys = [
1298
+ ...keys,
1299
+ ...this.getDataChildrenKeys(item),
1300
+ item[this.getRowSelectionKeyField()]
1301
+ ])
1302
+ );
1303
+ }
1304
+
1305
+ return keys;
1306
+ }
1307
+
1308
+ hasCheckedRows(data: any) {
1309
+ const selectedRowKeys = this.state.selectedRowKeys;
1310
+ const childrenKeys = this.getDataChildrenKeys(data);
1311
+
1312
+ return (
1313
+ intersection(selectedRowKeys, [
1314
+ ...childrenKeys,
1315
+ data[this.getRowSelectionKeyField()]
1316
+ ]).length > 0
1317
+ );
1318
+ }
1319
+
1320
+ hasCheckedChildrenRows(data: any) {
1321
+ const selectedRowKeys = this.state.selectedRowKeys;
1322
+ const childrenKeys = this.getDataChildrenKeys(data);
1323
+ const length = intersection(selectedRowKeys, childrenKeys).length;
1324
+
1325
+ return length > 0;
1326
+ }
1327
+
1328
+ getExpandedIcons(isExpanded: boolean, record: any) {
1329
+ const {classnames: cx} = this.props;
1330
+
1331
+ return isExpanded ? (
1332
+ <i
1333
+ className={cx('Table-expandBtn', 'is-active')}
1334
+ onClick={this.onCollapseRow.bind(this, record)}
1335
+ >
1336
+ <Icon icon="right-arrow-bold" className="icon" />
1337
+ </i>
1338
+ ) : (
1339
+ <i
1340
+ className={cx('Table-expandBtn')}
1341
+ onClick={this.onExpandRow.bind(this, record)}
1342
+ >
1343
+ <Icon icon="right-arrow-bold" className="icon" />
1344
+ </i>
1345
+ );
1346
+ }
1347
+
1348
+ async selectedSingleRow(value: boolean, data: any) {
1349
+ const {rowSelection, onSelect} = this.props;
1350
+
1351
+ const defaultKey = this.getRowSelectionKeyField();
1352
+ const isRadio = rowSelection && rowSelection.type === 'radio';
1353
+
1354
+ if (onSelect) {
1355
+ const prevented = await onSelect(
1356
+ data,
1357
+ value,
1358
+ this.selectedRows,
1359
+ this.state.selectedRowKeys
1360
+ );
1361
+ if (prevented) {
1362
+ return;
1363
+ }
1364
+ }
1365
+
1366
+ if (value) {
1367
+ if (isRadio) {
1368
+ this.setState({selectedRowKeys: [data[defaultKey]]});
1369
+ } else {
1370
+ this.setState(prevState => ({
1371
+ selectedRowKeys: [
1372
+ ...prevState.selectedRowKeys,
1373
+ data[defaultKey],
1374
+ ...this.getDataChildrenKeys(data)
1375
+ ].filter((key, i, a) => a.indexOf(key) === i)
1376
+ }));
1377
+ }
1378
+ } else {
1379
+ if (!isRadio) {
1380
+ this.setState({
1381
+ selectedRowKeys: this.state.selectedRowKeys.filter(
1382
+ key =>
1383
+ ![data[defaultKey], ...this.getDataChildrenKeys(data)].includes(
1384
+ key
1385
+ )
1386
+ )
1387
+ });
1388
+ }
1389
+ }
1390
+ }
1391
+
1392
+ renderRow(data: any, rowIndex: number, levels: Array<number>) {
1393
+ const {
1394
+ classnames: cx,
1395
+ rowSelection,
1396
+ expandable,
1397
+ draggable,
1398
+ indentSize,
1399
+ rowClassName,
1400
+ lineHeight // 是否设置了固定行高
1401
+ } = this.props;
1402
+
1403
+ const tdColumns = this.tdColumns;
1404
+ const isExpandable = this.isExpandableTable();
1405
+ const defaultKey = this.getRowSelectionKeyField();
1406
+ const colCount = this.getExtraColumnCount();
1407
+
1408
+ // 当前行是否可展开
1409
+ const isExpandableRow = this.isExpandableRow(data, rowIndex);
1410
+ // 当前行是否有children
1411
+ const hasChildrenRow = this.hasChildrenRow(data);
1412
+
1413
+ const isExpanded = !!find(
1414
+ this.state.expandedRowKeys,
1415
+ key => key == data[this.getExpandableKeyField()]
1416
+ ); // == 匹配 否则'3'、3匹配不上
1417
+
1418
+ // 设置缩进效果
1419
+ const indentDom =
1420
+ levels.length > 0 ? (
1421
+ <span
1422
+ className={cx('Table-row-indent', `indent-level-${levels.length}`)}
1423
+ style={
1424
+ levels.length > 0
1425
+ ? {paddingLeft: indentSize * levels.length + 'px'}
1426
+ : {}
1427
+ }
1428
+ ></span>
1429
+ ) : null;
1430
+
1431
+ const cells = tdColumns.map((item, i) => {
1432
+ const render =
1433
+ item.render && typeof item.render === 'function'
1434
+ ? item.render(data[item.key], data, rowIndex, i)
1435
+ : null;
1436
+ let props = {rowSpan: 1, colSpan: 1};
1437
+ let children = render;
1438
+ if (render && isObject(render)) {
1439
+ props = render.props;
1440
+ children = render.children;
1441
+ // 如果合并行 且有展开行,那么合并行不生效
1442
+ if (props.rowSpan > 1 && isExpandableRow && hasChildrenRow) {
1443
+ props.rowSpan === 1;
1444
+ }
1445
+ }
1446
+
1447
+ const className =
1448
+ typeof item.className === 'function'
1449
+ ? item.className(data, rowIndex)
1450
+ : '';
1451
+ return props.rowSpan === 0 || props.colSpan === 0 ? null : (
1452
+ <Cell
1453
+ key={i}
1454
+ {...props}
1455
+ fixed={item.fixed === true ? 'left' : item.fixed}
1456
+ column={item}
1457
+ groupId={item.groupId}
1458
+ className={cx({
1459
+ [`${className}`]: !!className
1460
+ })}
1461
+ >
1462
+ <div
1463
+ className={cx('Table-cell-wrapper', {
1464
+ [cx('Table-cell-wrapper-prefix')]:
1465
+ i === 0 &&
1466
+ (!!indentDom || (levels.length === 0 && hasChildrenRow)),
1467
+ [cx(`Table-cell-height-${lineHeight}`)]: !!lineHeight
1468
+ })}
1469
+ >
1470
+ {i === 0 && levels.length > 0 ? indentDom : null}
1471
+ {i === 0 && hasChildrenRow
1472
+ ? this.getExpandedIcons(isExpanded, data)
1473
+ : null}
1474
+ {render ? children : data[item.key]}
1475
+ </div>
1476
+ </Cell>
1477
+ );
1478
+ });
1479
+
1480
+ const rowClassNameClass =
1481
+ rowClassName && typeof rowClassName === 'function'
1482
+ ? rowClassName(data, rowIndex)
1483
+ : '';
1484
+
1485
+ // 可展开和嵌套不能同时支持
1486
+ // 设置了expandable 数据源里有children也就不生效了
1487
+ // 拖拽排序 可选、可展开都先不支持了,可以支持嵌套展示
1488
+ const checkboxProps =
1489
+ rowSelection && rowSelection.getCheckboxProps
1490
+ ? rowSelection.getCheckboxProps(data, rowIndex)
1491
+ : {};
1492
+
1493
+ const expandedRowClassName =
1494
+ expandable &&
1495
+ expandable.expandedRowClassName &&
1496
+ typeof expandable.expandedRowClassName === 'function'
1497
+ ? expandable.expandedRowClassName(data, rowIndex)
1498
+ : '';
1499
+ const dataKey = this.getChildrenColumnName();
1500
+
1501
+ const children =
1502
+ !draggable && isExpandableRow && isExpanded ? (
1503
+ <tr
1504
+ key="expanded"
1505
+ className={cx('Table-expanded-row', expandedRowClassName)}
1506
+ >
1507
+ <Cell colSpan={tdColumns.length + colCount}>
1508
+ {expandable &&
1509
+ expandable.expandedRowRender &&
1510
+ typeof expandable.expandedRowRender === 'function'
1511
+ ? expandable.expandedRowRender(data, rowIndex)
1512
+ : null}
1513
+ </Cell>
1514
+ </tr>
1515
+ ) : this.hasChildrenRow(data) && isExpanded ? (
1516
+ data[dataKey].map((item: any, index: number) => {
1517
+ return this.renderRow(item, index, [...levels, rowIndex]);
1518
+ })
1519
+ ) : null;
1520
+
1521
+ const isChecked = !!find(
1522
+ this.state.selectedRowKeys,
1523
+ key => key === data[defaultKey]
1524
+ );
1525
+ const hasChildrenChecked = this.hasCheckedChildrenRows(data);
1526
+
1527
+ return [
1528
+ <tr
1529
+ key={rowIndex}
1530
+ row-index={rowIndex}
1531
+ row-levels={levels.join(',')}
1532
+ className={cx(
1533
+ 'Table-row',
1534
+ `Table-row-level-${levels.length}`,
1535
+ rowClassNameClass,
1536
+ {
1537
+ 'Table-row-disabled': !!checkboxProps.disabled
1538
+ }
1539
+ )}
1540
+ onMouseEnter={e => this.onRowMouseEnter(e, data, rowIndex)}
1541
+ onMouseLeave={e => this.onRowMouseLeave(e, data, rowIndex)}
1542
+ onClick={e => this.onRowClick(e, data, rowIndex)}
1543
+ >
1544
+ {draggable ? (
1545
+ <Cell className={cx('Table-dragCell')}>
1546
+ <Icon icon="drag-bar" className="icon"></Icon>
1547
+ </Cell>
1548
+ ) : null}
1549
+ {!draggable && rowSelection ? (
1550
+ <Cell
1551
+ fixed={rowSelection.fixed ? 'left' : ''}
1552
+ className={cx('Table-checkCell')}
1553
+ >
1554
+ <CheckBox
1555
+ name={'Table-checkbox'}
1556
+ type={rowSelection.type || 'checkbox'}
1557
+ partial={hasChildrenChecked && !isChecked}
1558
+ checked={hasChildrenChecked || isChecked}
1559
+ onChange={(value, shift) => {
1560
+ if (!(rowSelection && rowSelection.rowClick)) {
1561
+ this.selectedSingleRow(value, data);
1562
+ }
1563
+
1564
+ event && event.stopPropagation();
1565
+ }}
1566
+ {...checkboxProps}
1567
+ ></CheckBox>
1568
+ </Cell>
1569
+ ) : null}
1570
+ {!draggable && isExpandable ? (
1571
+ <Cell
1572
+ fixed={expandable && expandable.fixed ? 'left' : ''}
1573
+ className={cx('Table-cell-expand-icon-cell')}
1574
+ >
1575
+ {isExpandableRow || hasChildrenRow
1576
+ ? this.getExpandedIcons(isExpanded, data)
1577
+ : null}
1578
+ </Cell>
1579
+ ) : null}
1580
+ {cells}
1581
+ </tr>,
1582
+ children
1583
+ ];
1584
+ }
1585
+
1586
+ renderTBody() {
1587
+ const {
1588
+ classnames: cx,
1589
+ headSummary,
1590
+ scroll,
1591
+ placeholder,
1592
+ sticky
1593
+ } = this.props;
1594
+
1595
+ const tdColumns = this.tdColumns;
1596
+ const hasScrollY = scroll && scroll.y;
1597
+ const colCount = this.getExtraColumnCount();
1598
+ return (
1599
+ <tbody ref={this.tbodyDom} className={cx('Table-tbody')}>
1600
+ {!hasScrollY && !sticky && headSummary
1601
+ ? this.renderSummaryRow(headSummary)
1602
+ : null}
1603
+ {!this.state.dataSource.length ? (
1604
+ <tr className={cx('Table-row', 'Table-empty-row')}>
1605
+ <Cell colSpan={tdColumns.length + colCount}>
1606
+ <div className={cx('Table-empty')}>
1607
+ {typeof placeholder === 'function'
1608
+ ? placeholder()
1609
+ : placeholder}
1610
+ </div>
1611
+ </Cell>
1612
+ </tr>
1613
+ ) : (
1614
+ this.state.dataSource.map((data, index) => {
1615
+ return this.renderRow(data, index, []);
1616
+ })
1617
+ )}
1618
+ </tbody>
1619
+ );
1620
+ }
1621
+
1622
+ isExpandableTable() {
1623
+ const {expandable} = this.props;
1624
+
1625
+ // 设置了expandable 优先级更高
1626
+ // 就不支持默认嵌套了
1627
+ return !!expandable;
1628
+ }
1629
+
1630
+ isNestedTable() {
1631
+ const {dataSource} = this.props;
1632
+ return !!find(dataSource, item => this.hasChildrenRow(item));
1633
+ }
1634
+
1635
+ getExtraColumnCount() {
1636
+ const {draggable, rowSelection} = this.props;
1637
+
1638
+ let count = 0;
1639
+ if (draggable) {
1640
+ count++;
1641
+ } else {
1642
+ if (this.isExpandableTable()) {
1643
+ count++;
1644
+ }
1645
+ if (rowSelection) {
1646
+ count++;
1647
+ }
1648
+ }
1649
+
1650
+ return count;
1651
+ }
1652
+
1653
+ renderSummaryRow(summary: any) {
1654
+ const {classnames: cx, dataSource} = this.props;
1655
+ const cells: Array<React.ReactNode> = [];
1656
+ const trs: Array<React.ReactNode> = [];
1657
+ let colCount = this.getExtraColumnCount();
1658
+
1659
+ Array.isArray(summary)
1660
+ ? summary.forEach((s, index) => {
1661
+ Array.isArray(s)
1662
+ ? trs.push(
1663
+ <tr
1664
+ onMouseEnter={e => this.onRowMouseEnter(e)}
1665
+ onMouseLeave={e => this.onRowMouseLeave(e)}
1666
+ key={'summary-tr-' + index}
1667
+ className={cx('Table-summary-row')}
1668
+ >
1669
+ {s.map((d, i) => {
1670
+ // 将操作列自动添加到第一列,用户的colSpan只需要关心实际的列数
1671
+ const colSpan =
1672
+ i === 0 ? (d.colSpan || 1) + colCount : d.colSpan;
1673
+ return (
1674
+ <Cell
1675
+ key={'summary-tr-cell-' + i}
1676
+ fixed={d.fixed}
1677
+ colSpan={colSpan}
1678
+ >
1679
+ {typeof d.render === 'function'
1680
+ ? d.render(dataSource)
1681
+ : d.render}
1682
+ </Cell>
1683
+ );
1684
+ })}
1685
+ </tr>
1686
+ )
1687
+ : cells.push(
1688
+ <Cell
1689
+ key={'summary-cell-' + index}
1690
+ fixed={s.fixed}
1691
+ colSpan={
1692
+ cells.length === 0 ? (s.colSpan || 1) + colCount : s.colSpan
1693
+ }
1694
+ >
1695
+ {typeof s.render === 'function'
1696
+ ? s.render(dataSource)
1697
+ : s.render}
1698
+ </Cell>
1699
+ );
1700
+ })
1701
+ : null;
1702
+
1703
+ return summary
1704
+ ? typeof summary === 'function'
1705
+ ? summary(dataSource)
1706
+ : [
1707
+ cells.length > 0 ? (
1708
+ <tr
1709
+ onMouseEnter={e => this.onRowMouseEnter(e)}
1710
+ onMouseLeave={e => this.onRowMouseLeave(e)}
1711
+ key="summary-row"
1712
+ className={cx('Table-summary-row')}
1713
+ >
1714
+ {cells}
1715
+ </tr>
1716
+ ) : null,
1717
+ ...trs
1718
+ ]
1719
+ : null;
1720
+ }
1721
+
1722
+ renderTFoot() {
1723
+ const {classnames: cx, footSummary} = this.props;
1724
+ return (
1725
+ <tfoot ref={this.tfootDom} className={cx('Table-summary')}>
1726
+ {this.renderSummaryRow(footSummary)}
1727
+ </tfoot>
1728
+ );
1729
+ }
1730
+
1731
+ updateTableDom(dom: HTMLElement) {
1732
+ const {classnames: cx} = this.props;
1733
+ const {scrollLeft, scrollWidth, offsetWidth} = dom;
1734
+ const table = this.tableDom.current;
1735
+
1736
+ const leftCalss = cx('Table-ping-left');
1737
+ if (scrollLeft > 0) {
1738
+ table?.classList.add(leftCalss);
1739
+ } else {
1740
+ table?.classList.remove(leftCalss);
1741
+ }
1742
+
1743
+ const rightClass = cx('Table-ping-right');
1744
+ if (scrollLeft + offsetWidth < scrollWidth) {
1745
+ table?.classList.add(rightClass);
1746
+ } else {
1747
+ table?.classList.remove(rightClass);
1748
+ }
1749
+ }
1750
+
1751
+ onTableContentScroll(event: React.ChangeEvent<any>) {
1752
+ this.updateTableDom(event.target);
1753
+ }
1754
+
1755
+ onWheel(event: WheelEvent) {
1756
+ const {currentTarget, deltaX} =
1757
+ event as unknown as React.WheelEvent<HTMLDivElement>;
1758
+ if (deltaX) {
1759
+ this.onTableScroll({
1760
+ target: currentTarget,
1761
+ scrollLeft: currentTarget.scrollLeft + deltaX
1762
+ });
1763
+
1764
+ event.preventDefault();
1765
+ }
1766
+ }
1767
+
1768
+ onTableScroll(event: {target: HTMLDivElement; scrollLeft?: number}) {
1769
+ const scrollDomRefs = [this.headerDom, this.bodyDom, this.footDom];
1770
+
1771
+ const {target, scrollLeft} = event;
1772
+
1773
+ scrollDomRefs.forEach(ref => {
1774
+ const current = ref && ref.current;
1775
+ if (current && current !== target) {
1776
+ current.scrollLeft = scrollLeft || target.scrollLeft;
1777
+ }
1778
+ });
1779
+
1780
+ this.updateTableDom(target);
1781
+ }
1782
+
1783
+ renderLoading() {
1784
+ const {classnames: cx, loading} = this.props;
1785
+ return (
1786
+ <div className={cx('Table-loading')}>
1787
+ {typeof loading === 'boolean' ? <Spinner></Spinner> : loading}
1788
+ </div>
1789
+ );
1790
+ }
1791
+
1792
+ renderTable() {
1793
+ const {
1794
+ scroll,
1795
+ footSummary,
1796
+ loading,
1797
+ showHeader,
1798
+ itemActions,
1799
+ classnames: cx
1800
+ } = this.props;
1801
+
1802
+ // 设置了横向滚动轴 则table的table-layout为fixed
1803
+ const hasScrollX = scroll && scroll.x;
1804
+ const hoverRow = this.state.hoverRow;
1805
+
1806
+ return (
1807
+ <div
1808
+ ref={this.contentDom}
1809
+ className={cx('Table-content')}
1810
+ style={hasScrollX ? {overflow: 'auto hidden'} : {}}
1811
+ onMouseLeave={this.onMouseLeave.bind(this)}
1812
+ >
1813
+ {itemActions && hoverRow ? (
1814
+ <ItemActionsWrapper dom={hoverRow.target} classnames={cx}>
1815
+ {typeof itemActions === 'function'
1816
+ ? itemActions(hoverRow.record, hoverRow.rowIndex)
1817
+ : null}
1818
+ </ItemActionsWrapper>
1819
+ ) : null}
1820
+ <table
1821
+ style={
1822
+ hasScrollX
1823
+ ? {width: scroll.x + 'px', tableLayout: 'fixed'}
1824
+ : {tableLayout: 'auto'}
1825
+ }
1826
+ className={cx('Table-table')}
1827
+ >
1828
+ {this.renderColGroup()}
1829
+ {showHeader ? this.renderTHead() : null}
1830
+ {!loading ? this.renderTBody() : null}
1831
+ {!loading && footSummary ? this.renderTFoot() : null}
1832
+ </table>
1833
+ {loading ? this.renderLoading() : null}
1834
+ </div>
1835
+ );
1836
+ }
1837
+
1838
+ renderScrollTableHeader() {
1839
+ const {
1840
+ scroll,
1841
+ headSummary,
1842
+ sticky,
1843
+ showHeader,
1844
+ classnames: cx
1845
+ } = this.props;
1846
+
1847
+ const style = {overflow: 'hidden'};
1848
+ if (!!sticky) {
1849
+ Object.assign(style, {top: 0});
1850
+ }
1851
+
1852
+ const tableStyle = {};
1853
+ if (scroll && (scroll.y || scroll.x)) {
1854
+ Object.assign(tableStyle, {
1855
+ width: scroll && scroll.x ? scroll.x + 'px' : '100%',
1856
+ tableLayout: 'fixed'
1857
+ });
1858
+ }
1859
+
1860
+ return (
1861
+ <div
1862
+ ref={this.headerDom}
1863
+ className={cx('Table-header', {
1864
+ [cx('Table-sticky-holder')]: !!sticky
1865
+ })}
1866
+ style={style}
1867
+ >
1868
+ <table className={cx('Table-table')} style={tableStyle}>
1869
+ {this.renderColGroup(this.state.colWidths)}
1870
+ {showHeader ? this.renderTHead() : null}
1871
+ {headSummary ? (
1872
+ <tbody>{this.renderSummaryRow(headSummary)}</tbody>
1873
+ ) : null}
1874
+ </table>
1875
+ </div>
1876
+ );
1877
+ }
1878
+
1879
+ renderScrollTableBody() {
1880
+ const {scroll, itemActions, classnames: cx} = this.props;
1881
+
1882
+ const style = {};
1883
+ const tableStyle = {};
1884
+ if (scroll && (scroll.y || scroll.x)) {
1885
+ Object.assign(style, {
1886
+ overflow: 'auto scroll',
1887
+ maxHeight: scroll.y
1888
+ });
1889
+
1890
+ Object.assign(tableStyle, {
1891
+ width: scroll && scroll.x ? scroll.x + 'px' : '100%',
1892
+ tableLayout: 'fixed'
1893
+ });
1894
+ }
1895
+
1896
+ const hoverRow = this.state.hoverRow;
1897
+
1898
+ return (
1899
+ <div
1900
+ ref={this.bodyDom}
1901
+ className={cx('Table-body')}
1902
+ style={style}
1903
+ onMouseLeave={this.onMouseLeave.bind(this)}
1904
+ >
1905
+ {itemActions && hoverRow ? (
1906
+ <ItemActionsWrapper dom={hoverRow.target} classnames={cx}>
1907
+ {typeof itemActions === 'function'
1908
+ ? itemActions(hoverRow.record, hoverRow.rowIndex)
1909
+ : null}
1910
+ </ItemActionsWrapper>
1911
+ ) : null}
1912
+ <table className={cx('Table-table')} style={tableStyle}>
1913
+ {this.renderColGroup()}
1914
+ {this.renderTBody()}
1915
+ </table>
1916
+ </div>
1917
+ );
1918
+ }
1919
+
1920
+ renderScrollTableFoot() {
1921
+ const {scroll, classnames: cx} = this.props;
1922
+
1923
+ return (
1924
+ <div
1925
+ ref={this.footDom}
1926
+ className={cx('Table-summary')}
1927
+ style={{overflow: 'hidden'}}
1928
+ >
1929
+ <table
1930
+ className={cx('Table-table')}
1931
+ style={{width: scroll?.x + 'px' || '100%', tableLayout: 'fixed'}}
1932
+ >
1933
+ {this.renderTFoot()}
1934
+ </table>
1935
+ </div>
1936
+ );
1937
+ }
1938
+
1939
+ renderScrollTable() {
1940
+ const {footSummary, loading, classnames: cx} = this.props;
1941
+
1942
+ return (
1943
+ <div className={cx('Table-container')}>
1944
+ {this.renderScrollTableHeader()}
1945
+ {!loading ? this.renderScrollTableBody() : null}
1946
+ {!loading && footSummary ? this.renderScrollTableFoot() : null}
1947
+ {loading ? this.renderLoading() : null}
1948
+ </div>
1949
+ );
1950
+ }
1951
+
1952
+ render() {
1953
+ const {
1954
+ title,
1955
+ footer,
1956
+ className,
1957
+ scroll,
1958
+ size,
1959
+ bordered,
1960
+ resizable,
1961
+ columns,
1962
+ sticky,
1963
+ classnames: cx
1964
+ } = this.props;
1965
+
1966
+ // 过滤掉设置了breakpoint属性的列
1967
+ const filterColumns = columns.filter(
1968
+ item => !item.breakpoint || !isBreakpoint(item.breakpoint)
1969
+ );
1970
+
1971
+ this.thColumns = [];
1972
+ this.tdColumns = [];
1973
+ buildColumns(filterColumns, this.thColumns, this.tdColumns);
1974
+
1975
+ // 是否设置了纵向滚动
1976
+ const hasScrollY = scroll && scroll.y;
1977
+ // 是否设置了横向滚动
1978
+ const hasScrollX = scroll && scroll.x;
1979
+
1980
+ return (
1981
+ <div
1982
+ ref={this.tableDom}
1983
+ className={cx('Table-v2', className, {
1984
+ [cx('Table-scroll-horizontal')]: hasScrollX,
1985
+ [cx(`Table-${size}`)]: size,
1986
+ [cx('Table-bordered')]: bordered,
1987
+ [cx('Table-resizable')]: resizable
1988
+ })}
1989
+ >
1990
+ {title ? (
1991
+ <div className={cx('Table-title')}>
1992
+ {typeof title === 'function' ? title() : title}
1993
+ </div>
1994
+ ) : null}
1995
+
1996
+ {hasScrollY || sticky ? (
1997
+ this.renderScrollTable()
1998
+ ) : (
1999
+ <div className={cx('Table-container')}>{this.renderTable()}</div>
2000
+ )}
2001
+
2002
+ {footer ? (
2003
+ <div className={cx('Table-footer')}>
2004
+ {typeof footer === 'function' ? footer() : footer}
2005
+ </div>
2006
+ ) : null}
2007
+ </div>
2008
+ );
2009
+ }
2010
+ }
2011
+
2012
+ export default themeable(localeable(Table));