amis-rev-ui 6.13.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 (783) hide show
  1. package/LICENSE +201 -0
  2. package/esm/HTMLFilterContext.d.ts +3 -0
  3. package/esm/HTMLFilterContext.js +10 -0
  4. package/esm/components/404.js +35 -0
  5. package/esm/components/Alert.js +266 -0
  6. package/esm/components/Alert2.js +58 -0
  7. package/esm/components/AlphabetIndexer.d.ts +11 -0
  8. package/esm/components/AlphabetIndexer.js +48 -0
  9. package/esm/components/AnchorNav.js +153 -0
  10. package/esm/components/AnchorNavSection.d.ts +2 -0
  11. package/esm/components/AnchorNavSection.js +7 -0
  12. package/esm/components/ArrayInput.js +146 -0
  13. package/esm/components/AsideNav.js +133 -0
  14. package/esm/components/AssociatedSelection.js +107 -0
  15. package/esm/components/AutoFoldedList.js +124 -0
  16. package/esm/components/AutoSizer.d.ts +2 -0
  17. package/esm/components/AutoSizer.js +8 -0
  18. package/esm/components/Avatar.js +126 -0
  19. package/esm/components/Badge.d.ts +20 -0
  20. package/esm/components/Badge.js +154 -0
  21. package/esm/components/BaiduMapPicker.js +366 -0
  22. package/esm/components/BarCode.js +42 -0
  23. package/esm/components/Breadcrumb.js +160 -0
  24. package/esm/components/Button.js +64 -0
  25. package/esm/components/CalendarMobile.js +538 -0
  26. package/esm/components/Card.js +88 -0
  27. package/esm/components/Cascader.js +515 -0
  28. package/esm/components/ChainedDropdownSelection.js +104 -0
  29. package/esm/components/ChainedSelection.js +184 -0
  30. package/esm/components/Checkbox.js +87 -0
  31. package/esm/components/CityArea.js +190 -0
  32. package/esm/components/CityDB.d.ts +13 -0
  33. package/esm/components/CityDB.js +3942 -0
  34. package/esm/components/CodeMirror.d.ts +29 -0
  35. package/esm/components/CodeMirror.js +140 -0
  36. package/esm/components/Collapse.js +184 -0
  37. package/esm/components/CollapseGroup.js +117 -0
  38. package/esm/components/ColorPicker.js +259 -0
  39. package/esm/components/Combo.js +212 -0
  40. package/esm/components/ConditionBuilder.d.ts +2 -0
  41. package/esm/components/ConditionBuilder.js +7 -0
  42. package/esm/components/ConfirmBox.js +128 -0
  43. package/esm/components/ContextMenu.js +310 -0
  44. package/esm/components/DatePicker.js +716 -0
  45. package/esm/components/DateRangePicker.js +1385 -0
  46. package/esm/components/DiffEditor.d.ts +21 -0
  47. package/esm/components/DiffEditor.js +119 -0
  48. package/esm/components/DndContainer.js +25 -0
  49. package/esm/components/Drawer.js +272 -0
  50. package/esm/components/DropDownSelection.js +77 -0
  51. package/esm/components/DropdownContextMenus.js +93 -0
  52. package/esm/components/Editor.js +238 -0
  53. package/esm/components/Form.d.ts +31 -0
  54. package/esm/components/Form.js +84 -0
  55. package/esm/components/FormField.js +78 -0
  56. package/esm/components/FormulaPicker.d.ts +2 -0
  57. package/esm/components/FormulaPicker.js +7 -0
  58. package/esm/components/GaodeMapPicker.js +204 -0
  59. package/esm/components/GridNav.d.ts +53 -0
  60. package/esm/components/GridNav.js +125 -0
  61. package/esm/components/GridNavItem.d.ts +2 -0
  62. package/esm/components/GridNavItem.js +7 -0
  63. package/esm/components/GroupedSelection.js +138 -0
  64. package/esm/components/HeadCellDropDown.d.ts +2 -0
  65. package/esm/components/HeadCellDropDown.js +7 -0
  66. package/esm/components/HorizontalScroll.d.ts +74 -0
  67. package/esm/components/HorizontalScroll.js +271 -0
  68. package/esm/components/Html.js +55 -0
  69. package/esm/components/Icon.d.ts +2 -0
  70. package/esm/components/Icon.js +7 -0
  71. package/esm/components/ImageGallery.js +396 -0
  72. package/esm/components/Input.d.ts +18 -0
  73. package/esm/components/Input.js +75 -0
  74. package/esm/components/InputBox.js +99 -0
  75. package/esm/components/InputBoxWithSuggestion.js +70 -0
  76. package/esm/components/InputJSONSchema.d.ts +2 -0
  77. package/esm/components/InputJSONSchema.js +7 -0
  78. package/esm/components/InputTable.js +176 -0
  79. package/esm/components/JSONSchemaEditor.d.ts +2 -0
  80. package/esm/components/JSONSchemaEditor.js +7 -0
  81. package/esm/components/Layout.js +60 -0
  82. package/esm/components/Link.js +44 -0
  83. package/esm/components/ListGroup.js +31 -0
  84. package/esm/components/ListMenu.js +62 -0
  85. package/esm/components/LocationPicker.js +208 -0
  86. package/esm/components/Markdown.d.ts +25 -0
  87. package/esm/components/Markdown.js +70 -0
  88. package/esm/components/Menu.d.ts +2 -0
  89. package/esm/components/Menu.js +7 -0
  90. package/esm/components/MixedInput.js +88 -0
  91. package/esm/components/MobileDevTool.d.ts +12 -0
  92. package/esm/components/MobileDevTool.js +312 -0
  93. package/esm/components/Modal.js +261 -0
  94. package/esm/components/ModalManager.d.ts +16 -0
  95. package/esm/components/ModalManager.js +42 -0
  96. package/esm/components/MultilineText.js +90 -0
  97. package/esm/components/NumberInput.js +274 -0
  98. package/esm/components/OverflowTpl.js +100 -0
  99. package/esm/components/Pagination.js +377 -0
  100. package/esm/components/PdfViewer.js +83 -0
  101. package/esm/components/Picker.js +73 -0
  102. package/esm/components/PickerColumn.js +276 -0
  103. package/esm/components/PickerContainer.js +157 -0
  104. package/esm/components/PopOverContainer.d.ts +59 -0
  105. package/esm/components/PopOverContainer.js +148 -0
  106. package/esm/components/PopUp.js +85 -0
  107. package/esm/components/Progress.js +136 -0
  108. package/esm/components/PullRefresh.js +172 -0
  109. package/esm/components/Radios.js +129 -0
  110. package/esm/components/Range.js +516 -0
  111. package/esm/components/Rating.js +341 -0
  112. package/esm/components/ResultBox.js +195 -0
  113. package/esm/components/ResultList.js +253 -0
  114. package/esm/components/ResultTableList.js +152 -0
  115. package/esm/components/ResultTreeList.js +241 -0
  116. package/esm/components/RichText.d.ts +48 -0
  117. package/esm/components/RichText.js +271 -0
  118. package/esm/components/SearchBox.js +298 -0
  119. package/esm/components/Select.js +814 -0
  120. package/esm/components/SelectMobile.d.ts +38 -0
  121. package/esm/components/SelectMobile.js +369 -0
  122. package/esm/components/Selection.js +166 -0
  123. package/esm/components/Shape.js +429 -0
  124. package/esm/components/Signature.js +294 -0
  125. package/esm/components/Slider.js +140 -0
  126. package/esm/components/SparkLine.js +62 -0
  127. package/esm/components/Spinner.js +202 -0
  128. package/esm/components/Steps.js +76 -0
  129. package/esm/components/Switch.js +73 -0
  130. package/esm/components/Tab.d.ts +2 -0
  131. package/esm/components/Tab.js +7 -0
  132. package/esm/components/Table.d.ts +2 -0
  133. package/esm/components/Table.js +7 -0
  134. package/esm/components/TableSelection.js +169 -0
  135. package/esm/components/Tabs.js +607 -0
  136. package/esm/components/TabsTransfer.js +221 -0
  137. package/esm/components/TabsTransferPicker.js +81 -0
  138. package/esm/components/Tag.js +137 -0
  139. package/esm/components/Textarea.js +146 -0
  140. package/esm/components/Timeline.js +60 -0
  141. package/esm/components/TimelineItem.js +101 -0
  142. package/esm/components/Tinymce.d.ts +66 -0
  143. package/esm/components/Tinymce.js +634 -0
  144. package/esm/components/TitleBar.js +48 -0
  145. package/esm/components/Toast.js +247 -0
  146. package/esm/components/Tooltip.js +36 -0
  147. package/esm/components/TooltipWrapper.js +180 -0
  148. package/esm/components/Transfer.js +485 -0
  149. package/esm/components/TransferDropDown.js +98 -0
  150. package/esm/components/TransferPicker.js +98 -0
  151. package/esm/components/TransferSearch.js +100 -0
  152. package/esm/components/Tree.js +1256 -0
  153. package/esm/components/TreeSelection.js +201 -0
  154. package/esm/components/UserSelect.js +674 -0
  155. package/esm/components/UserTabSelect.js +227 -0
  156. package/esm/components/VerificationCode.js +172 -0
  157. package/esm/components/VirtualList.d.ts +2 -0
  158. package/esm/components/VirtualList.js +7 -0
  159. package/esm/components/WithRemoteConfig.d.ts +70 -0
  160. package/esm/components/WithRemoteConfig.js +301 -0
  161. package/esm/components/WithStore.d.ts +13 -0
  162. package/esm/components/WithStore.js +48 -0
  163. package/esm/components/calendar/Calendar.d.ts +83 -0
  164. package/esm/components/calendar/Calendar.js +529 -0
  165. package/esm/components/calendar/CalendarContainer.d.ts +10 -0
  166. package/esm/components/calendar/CalendarContainer.js +27 -0
  167. package/esm/components/calendar/DaysView.js +528 -0
  168. package/esm/components/calendar/MonthsView.js +175 -0
  169. package/esm/components/calendar/QuartersView.js +125 -0
  170. package/esm/components/calendar/TimeView.js +559 -0
  171. package/esm/components/calendar/YearsView.js +122 -0
  172. package/esm/components/condition-builder/Expression.js +121 -0
  173. package/esm/components/condition-builder/Field.js +32 -0
  174. package/esm/components/condition-builder/Func.js +75 -0
  175. package/esm/components/condition-builder/Group.js +196 -0
  176. package/esm/components/condition-builder/GroupOrItem.js +107 -0
  177. package/esm/components/condition-builder/InputSwitch.js +28 -0
  178. package/esm/components/condition-builder/Item.js +233 -0
  179. package/esm/components/condition-builder/Value.js +115 -0
  180. package/esm/components/condition-builder/config.d.ts +36 -0
  181. package/esm/components/condition-builder/config.js +120 -0
  182. package/esm/components/condition-builder/index.js +242 -0
  183. package/esm/components/condition-builder/types.d.ts +116 -0
  184. package/esm/components/formula/CodeEditor.js +99 -0
  185. package/esm/components/formula/Editor.js +446 -0
  186. package/esm/components/formula/FuncList.js +64 -0
  187. package/esm/components/formula/Input.js +141 -0
  188. package/esm/components/formula/Picker.js +454 -0
  189. package/esm/components/formula/VariableList.js +185 -0
  190. package/esm/components/formula/plugin.d.ts +51 -0
  191. package/esm/components/formula/plugin.js +445 -0
  192. package/esm/components/icons.d.ts +61 -0
  193. package/esm/components/icons.js +458 -0
  194. package/esm/components/index.d.ts +138 -0
  195. package/esm/components/json-schema/Array.d.ts +3 -0
  196. package/esm/components/json-schema/Array.js +129 -0
  197. package/esm/components/json-schema/Item.d.ts +5 -0
  198. package/esm/components/json-schema/Item.js +63 -0
  199. package/esm/components/json-schema/Object.d.ts +5 -0
  200. package/esm/components/json-schema/Object.js +272 -0
  201. package/esm/components/json-schema/index.js +29 -0
  202. package/esm/components/menu/MenuContext.d.ts +82 -0
  203. package/esm/components/menu/MenuContext.js +25 -0
  204. package/esm/components/menu/MenuItem.js +112 -0
  205. package/esm/components/menu/PanelMenu.js +68 -0
  206. package/esm/components/menu/SubMenu.js +137 -0
  207. package/esm/components/menu/index.js +368 -0
  208. package/esm/components/schema-editor/Array.d.ts +11 -0
  209. package/esm/components/schema-editor/Array.js +84 -0
  210. package/esm/components/schema-editor/Common.d.ts +61 -0
  211. package/esm/components/schema-editor/Common.js +162 -0
  212. package/esm/components/schema-editor/Item.d.ts +8 -0
  213. package/esm/components/schema-editor/Item.js +24 -0
  214. package/esm/components/schema-editor/Object.d.ts +51 -0
  215. package/esm/components/schema-editor/Object.js +294 -0
  216. package/esm/components/schema-editor/SchemaVariableList.js +74 -0
  217. package/esm/components/schema-editor/SchemaVariableListPicker.js +34 -0
  218. package/esm/components/schema-editor/index.js +122 -0
  219. package/esm/components/table/Cell.d.ts +36 -0
  220. package/esm/components/table/Cell.js +43 -0
  221. package/esm/components/table/ColGroup.d.ts +24 -0
  222. package/esm/components/table/ColGroup.js +77 -0
  223. package/esm/components/table/Head.d.ts +45 -0
  224. package/esm/components/table/Head.js +150 -0
  225. package/esm/components/table/HeadCellDropDown.js +54 -0
  226. package/esm/components/table/HeadCellFilter.js +130 -0
  227. package/esm/components/table/HeadCellSelect.js +51 -0
  228. package/esm/components/table/HeadCellSort.js +88 -0
  229. package/esm/components/table/ItemActionsWrapper.d.ts +10 -0
  230. package/esm/components/table/ItemActionsWrapper.js +29 -0
  231. package/esm/components/table/Row.d.ts +56 -0
  232. package/esm/components/table/Row.js +224 -0
  233. package/esm/components/table/SummaryRow.d.ts +28 -0
  234. package/esm/components/table/SummaryRow.js +73 -0
  235. package/esm/components/table/index.js +1095 -0
  236. package/esm/components/table/util.d.ts +25 -0
  237. package/esm/components/table/util.js +279 -0
  238. package/esm/components/virtual-list/AutoSizer.d.ts +19 -0
  239. package/esm/components/virtual-list/AutoSizer.js +48 -0
  240. package/esm/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  241. package/esm/components/virtual-list/SizeAndPositionManager.js +216 -0
  242. package/esm/components/virtual-list/constants.d.ts +34 -0
  243. package/esm/components/virtual-list/constants.js +45 -0
  244. package/esm/components/virtual-list/index.d.ts +98 -0
  245. package/esm/components/virtual-list/index.js +288 -0
  246. package/esm/components/withBadge.d.ts +2 -0
  247. package/esm/components/withBadge.js +7 -0
  248. package/esm/hooks/index.d.ts +8 -0
  249. package/esm/hooks/use-click-away.d.ts +12 -0
  250. package/esm/hooks/use-click-away.js +55 -0
  251. package/esm/hooks/use-on-screen.d.ts +2 -0
  252. package/esm/hooks/use-on-screen.js +28 -0
  253. package/esm/hooks/use-set-state.d.ts +2 -0
  254. package/esm/hooks/use-set-state.js +19 -0
  255. package/esm/hooks/use-sub-form.d.ts +4 -0
  256. package/esm/hooks/use-sub-form.js +39 -0
  257. package/esm/hooks/use-touch.d.ts +16 -0
  258. package/esm/hooks/use-touch.js +77 -0
  259. package/esm/hooks/use-update-effect.d.ts +3 -0
  260. package/esm/hooks/use-update-effect.js +21 -0
  261. package/esm/hooks/use-validation-resolver.d.ts +7 -0
  262. package/esm/hooks/use-validation-resolver.js +115 -0
  263. package/esm/icons/alert-danger.svg.js +22 -0
  264. package/esm/icons/alert-info.svg.js +22 -0
  265. package/esm/icons/alert-success.svg.js +22 -0
  266. package/esm/icons/alert-warning.svg.js +22 -0
  267. package/esm/icons/arrow-double-left.svg.js +24 -0
  268. package/esm/icons/arrow-double-right.svg.js +24 -0
  269. package/esm/icons/back.svg.js +21 -0
  270. package/esm/icons/calendar.svg.js +31 -0
  271. package/esm/icons/caret.svg.js +21 -0
  272. package/esm/icons/check.svg.js +21 -0
  273. package/esm/icons/clock.svg.js +29 -0
  274. package/esm/icons/close-small.svg.js +24 -0
  275. package/esm/icons/close.svg.js +21 -0
  276. package/esm/icons/cloud-upload.svg.js +22 -0
  277. package/esm/icons/column-filter.svg.js +22 -0
  278. package/esm/icons/columns.svg.js +21 -0
  279. package/esm/icons/compress-alt.svg.js +21 -0
  280. package/esm/icons/copy.svg.js +26 -0
  281. package/esm/icons/date.svg.js +26 -0
  282. package/esm/icons/department.svg.js +52 -0
  283. package/esm/icons/desk-empty.svg.js +73 -0
  284. package/esm/icons/dot.svg.js +36 -0
  285. package/esm/icons/down-arrow-bold.svg.js +22 -0
  286. package/esm/icons/down.svg.js +23 -0
  287. package/esm/icons/download.svg.js +24 -0
  288. package/esm/icons/drag-bar.svg.js +53 -0
  289. package/esm/icons/drag.svg.js +22 -0
  290. package/esm/icons/edit.svg.js +21 -0
  291. package/esm/icons/ellipsis-v.svg.js +21 -0
  292. package/esm/icons/enter.svg.js +20 -0
  293. package/esm/icons/exchange.svg.js +21 -0
  294. package/esm/icons/expand-alt.svg.js +21 -0
  295. package/esm/icons/fail.svg.js +31 -0
  296. package/esm/icons/file.svg.js +22 -0
  297. package/esm/icons/filter.svg.js +21 -0
  298. package/esm/icons/folder.svg.js +24 -0
  299. package/esm/icons/fullscreen.svg.js +21 -0
  300. package/esm/icons/function.svg.js +21 -0
  301. package/esm/icons/home.svg.js +21 -0
  302. package/esm/icons/if.svg.js +21 -0
  303. package/esm/icons/image.svg.js +20 -0
  304. package/esm/icons/info-circle.svg.js +21 -0
  305. package/esm/icons/info.svg.js +27 -0
  306. package/esm/icons/input-clear.svg.js +20 -0
  307. package/esm/icons/invisible.svg.js +22 -0
  308. package/esm/icons/left-arrow.svg.js +23 -0
  309. package/esm/icons/loading-outline.svg.js +21 -0
  310. package/esm/icons/location.svg.js +20 -0
  311. package/esm/icons/menu.svg.js +20 -0
  312. package/esm/icons/minus.svg.js +21 -0
  313. package/esm/icons/move.svg.js +22 -0
  314. package/esm/icons/mute.svg.js +21 -0
  315. package/esm/icons/new-edit.svg.js +22 -0
  316. package/esm/icons/pause.svg.js +21 -0
  317. package/esm/icons/pencil.svg.js +21 -0
  318. package/esm/icons/play.svg.js +20 -0
  319. package/esm/icons/plus-cicle.svg.js +20 -0
  320. package/esm/icons/plus-fine.svg.js +21 -0
  321. package/esm/icons/plus.svg.js +21 -0
  322. package/esm/icons/post.svg.js +48 -0
  323. package/esm/icons/question-mark.svg.js +26 -0
  324. package/esm/icons/question.svg.js +21 -0
  325. package/esm/icons/question2.svg.js +34 -0
  326. package/esm/icons/redo.svg.js +21 -0
  327. package/esm/icons/refresh.svg.js +21 -0
  328. package/esm/icons/reload.svg.js +21 -0
  329. package/esm/icons/remove.svg.js +21 -0
  330. package/esm/icons/retry.svg.js +24 -0
  331. package/esm/icons/right-arrow-bold.svg.js +21 -0
  332. package/esm/icons/right-arrow.svg.js +23 -0
  333. package/esm/icons/right-double-arrow.svg.js +22 -0
  334. package/esm/icons/role.svg.js +43 -0
  335. package/esm/icons/rotate-left.svg.js +22 -0
  336. package/esm/icons/rotate-right.svg.js +22 -0
  337. package/esm/icons/rotate-screen.svg.js +21 -0
  338. package/esm/icons/scale-origin.svg.js +24 -0
  339. package/esm/icons/schedule.svg.js +24 -0
  340. package/esm/icons/search.svg.js +21 -0
  341. package/esm/icons/setting.svg.js +21 -0
  342. package/esm/icons/slider-handle-icon.svg.js +22 -0
  343. package/esm/icons/sort-asc.svg.js +21 -0
  344. package/esm/icons/sort-default.svg.js +21 -0
  345. package/esm/icons/sort-desc.svg.js +21 -0
  346. package/esm/icons/star.svg.js +21 -0
  347. package/esm/icons/status-close.svg.js +23 -0
  348. package/esm/icons/steps-finsh.svg.js +22 -0
  349. package/esm/icons/sub-plus.svg.js +20 -0
  350. package/esm/icons/success.svg.js +29 -0
  351. package/esm/icons/transparent.svg.js +38 -0
  352. package/esm/icons/trash.svg.js +22 -0
  353. package/esm/icons/tree-down.svg.js +21 -0
  354. package/esm/icons/undo-normal.svg.js +25 -0
  355. package/esm/icons/undo.svg.js +21 -0
  356. package/esm/icons/unfullscreen.svg.js +21 -0
  357. package/esm/icons/upload.svg.js +21 -0
  358. package/esm/icons/user-remove.svg.js +33 -0
  359. package/esm/icons/view.svg.js +22 -0
  360. package/esm/icons/volume.svg.js +24 -0
  361. package/esm/icons/warning-mark.svg.js +22 -0
  362. package/esm/icons/warning.svg.js +21 -0
  363. package/esm/icons/window-restore.svg.js +21 -0
  364. package/esm/icons/zoom-in.svg.js +21 -0
  365. package/esm/icons/zoom-out.svg.js +21 -0
  366. package/esm/index.d.ts +16 -0
  367. package/esm/index.js +157 -0
  368. package/esm/locale/de-DE.d.ts +1 -0
  369. package/esm/locale/de-DE.js +423 -0
  370. package/esm/locale/en-US.d.ts +1 -0
  371. package/esm/locale/en-US.js +429 -0
  372. package/esm/locale/zh-CN.d.ts +1 -0
  373. package/esm/locale/zh-CN.js +438 -0
  374. package/esm/themes/ang.d.ts +3 -0
  375. package/esm/themes/ang.js +15 -0
  376. package/esm/themes/antd.d.ts +1 -0
  377. package/esm/themes/antd.js +42 -0
  378. package/esm/themes/cxd.d.ts +3 -0
  379. package/esm/themes/cxd.js +455 -0
  380. package/esm/themes/dark.d.ts +3 -0
  381. package/esm/themes/dark.js +23 -0
  382. package/esm/themes/default.d.ts +4 -0
  383. package/esm/utils/index.d.ts +2 -0
  384. package/esm/utils/smoothSignature.d.ts +86 -0
  385. package/esm/utils/vectorComputed.d.ts +20 -0
  386. package/esm/utils/vectorComputed.js +75 -0
  387. package/esm/withRemoteConfig.d.ts +2 -0
  388. package/esm/withRemoteConfig.js +7 -0
  389. package/esm/withStore.d.ts +2 -0
  390. package/esm/withStore.js +7 -0
  391. package/lib/HTMLFilterContext.d.ts +3 -0
  392. package/lib/components/AlphabetIndexer.d.ts +11 -0
  393. package/lib/components/AnchorNavSection.d.ts +2 -0
  394. package/lib/components/AutoSizer.d.ts +2 -0
  395. package/lib/components/Badge.d.ts +20 -0
  396. package/lib/components/BarCode.js +44 -0
  397. package/lib/components/CityDB.d.ts +13 -0
  398. package/lib/components/CityDB.js +3945 -0
  399. package/lib/components/CodeMirror.d.ts +29 -0
  400. package/lib/components/ColorPicker.js +267 -0
  401. package/lib/components/ConditionBuilder.d.ts +2 -0
  402. package/lib/components/DiffEditor.d.ts +21 -0
  403. package/lib/components/Form.d.ts +31 -0
  404. package/lib/components/FormulaPicker.d.ts +2 -0
  405. package/lib/components/GridNav.d.ts +53 -0
  406. package/lib/components/GridNavItem.d.ts +2 -0
  407. package/lib/components/HeadCellDropDown.d.ts +2 -0
  408. package/lib/components/HorizontalScroll.d.ts +74 -0
  409. package/lib/components/Icon.d.ts +2 -0
  410. package/lib/components/Input.d.ts +18 -0
  411. package/lib/components/InputJSONSchema.d.ts +2 -0
  412. package/lib/components/JSONSchemaEditor.d.ts +2 -0
  413. package/lib/components/Markdown.d.ts +25 -0
  414. package/lib/components/Markdown.js +76 -0
  415. package/lib/components/Menu.d.ts +2 -0
  416. package/lib/components/MobileDevTool.d.ts +12 -0
  417. package/lib/components/ModalManager.d.ts +16 -0
  418. package/lib/components/PdfViewer.js +83 -0
  419. package/lib/components/PopOverContainer.d.ts +59 -0
  420. package/lib/components/RichText.d.ts +48 -0
  421. package/lib/components/RichText.js +275 -0
  422. package/lib/components/SelectMobile.d.ts +38 -0
  423. package/lib/components/Tab.d.ts +2 -0
  424. package/lib/components/Table.d.ts +2 -0
  425. package/lib/components/Tinymce.d.ts +66 -0
  426. package/lib/components/Tinymce.js +641 -0
  427. package/lib/components/VirtualList.d.ts +2 -0
  428. package/lib/components/WithRemoteConfig.d.ts +70 -0
  429. package/lib/components/WithStore.d.ts +13 -0
  430. package/lib/components/calendar/Calendar.d.ts +83 -0
  431. package/lib/components/calendar/CalendarContainer.d.ts +10 -0
  432. package/lib/components/condition-builder/config.d.ts +36 -0
  433. package/lib/components/condition-builder/types.d.ts +116 -0
  434. package/lib/components/formula/plugin.d.ts +51 -0
  435. package/lib/components/icons.d.ts +61 -0
  436. package/lib/components/index.d.ts +138 -0
  437. package/lib/components/json-schema/Array.d.ts +3 -0
  438. package/lib/components/json-schema/Item.d.ts +5 -0
  439. package/lib/components/json-schema/Object.d.ts +5 -0
  440. package/lib/components/menu/MenuContext.d.ts +82 -0
  441. package/lib/components/schema-editor/Array.d.ts +11 -0
  442. package/lib/components/schema-editor/Common.d.ts +61 -0
  443. package/lib/components/schema-editor/Item.d.ts +8 -0
  444. package/lib/components/schema-editor/Object.d.ts +51 -0
  445. package/lib/components/table/Cell.d.ts +36 -0
  446. package/lib/components/table/ColGroup.d.ts +24 -0
  447. package/lib/components/table/Head.d.ts +45 -0
  448. package/lib/components/table/ItemActionsWrapper.d.ts +10 -0
  449. package/lib/components/table/Row.d.ts +56 -0
  450. package/lib/components/table/SummaryRow.d.ts +28 -0
  451. package/lib/components/table/util.d.ts +25 -0
  452. package/lib/components/virtual-list/AutoSizer.d.ts +19 -0
  453. package/lib/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  454. package/lib/components/virtual-list/constants.d.ts +34 -0
  455. package/lib/components/virtual-list/index.d.ts +98 -0
  456. package/lib/components/withBadge.d.ts +2 -0
  457. package/lib/helper.css +47762 -0
  458. package/lib/hooks/index.d.ts +8 -0
  459. package/lib/hooks/use-click-away.d.ts +12 -0
  460. package/lib/hooks/use-on-screen.d.ts +2 -0
  461. package/lib/hooks/use-set-state.d.ts +2 -0
  462. package/lib/hooks/use-sub-form.d.ts +4 -0
  463. package/lib/hooks/use-touch.d.ts +16 -0
  464. package/lib/hooks/use-update-effect.d.ts +3 -0
  465. package/lib/hooks/use-validation-resolver.d.ts +7 -0
  466. package/lib/index.d.ts +16 -0
  467. package/lib/index.js +28 -0
  468. package/lib/locale/de-DE.d.ts +1 -0
  469. package/lib/locale/en-US.d.ts +1 -0
  470. package/lib/locale/zh-CN.d.ts +1 -0
  471. package/lib/scss/helper.scss.js +12 -0
  472. package/lib/scss/themes/ang.scss.js +12 -0
  473. package/lib/scss/themes/antd.scss.js +12 -0
  474. package/lib/scss/themes/cxd.scss.js +12 -0
  475. package/lib/scss/themes/dark.scss.js +12 -0
  476. package/lib/scss/themes/default.scss.js +12 -0
  477. package/lib/themes/ang.css +45895 -0
  478. package/lib/themes/ang.d.ts +3 -0
  479. package/lib/themes/antd.css +45882 -0
  480. package/lib/themes/antd.d.ts +1 -0
  481. package/lib/themes/cxd.css +45871 -0
  482. package/lib/themes/cxd.d.ts +3 -0
  483. package/lib/themes/dark.css +45902 -0
  484. package/lib/themes/dark.d.ts +3 -0
  485. package/lib/themes/default.css +45871 -0
  486. package/lib/themes/default.d.ts +4 -0
  487. package/lib/utils/index.d.ts +2 -0
  488. package/lib/utils/smoothSignature.d.ts +86 -0
  489. package/lib/utils/vectorComputed.d.ts +20 -0
  490. package/lib/withRemoteConfig.d.ts +2 -0
  491. package/lib/withStore.d.ts +2 -0
  492. package/package.json +158 -0
  493. package/scss/README.md +9 -0
  494. package/scss/_components.scss +4346 -0
  495. package/scss/_functions.scss +137 -0
  496. package/scss/_mixins.scss +805 -0
  497. package/scss/_properties.scss +898 -0
  498. package/scss/_thirds.scss +12 -0
  499. package/scss/_utilities.scss +1757 -0
  500. package/scss/_variables.scss +439 -0
  501. package/scss/base/_animate.scss +84 -0
  502. package/scss/base/_common.scss +19 -0
  503. package/scss/base/_normalize.scss +376 -0
  504. package/scss/base/_reset.scss +18 -0
  505. package/scss/base/_typography.scss +79 -0
  506. package/scss/components/_alert.scss +123 -0
  507. package/scss/components/_anchor-nav.scss +158 -0
  508. package/scss/components/_app.scss +46 -0
  509. package/scss/components/_array-input.scss +107 -0
  510. package/scss/components/_audio.scss +146 -0
  511. package/scss/components/_auto-folder.scss +40 -0
  512. package/scss/components/_avatar.scss +55 -0
  513. package/scss/components/_badge.scss +145 -0
  514. package/scss/components/_barcode.scss +6 -0
  515. package/scss/components/_breadcrumb.scss +110 -0
  516. package/scss/components/_button-group.scss +165 -0
  517. package/scss/components/_button.scss +871 -0
  518. package/scss/components/_calendar.scss +442 -0
  519. package/scss/components/_card.scss +389 -0
  520. package/scss/components/_card2.scss +28 -0
  521. package/scss/components/_cards.scss +221 -0
  522. package/scss/components/_carousel.scss +292 -0
  523. package/scss/components/_cascader.scss +157 -0
  524. package/scss/components/_chart.scss +22 -0
  525. package/scss/components/_city-area.scss +37 -0
  526. package/scss/components/_code.scss +10 -0
  527. package/scss/components/_collapse-group.scss +83 -0
  528. package/scss/components/_collapse.scss +245 -0
  529. package/scss/components/_color.scss +17 -0
  530. package/scss/components/_column-toggler.scss +261 -0
  531. package/scss/components/_condition-builder.scss +521 -0
  532. package/scss/components/_context-menu.scss +204 -0
  533. package/scss/components/_copyable.scss +10 -0
  534. package/scss/components/_crud.scss +195 -0
  535. package/scss/components/_crud2.scss +345 -0
  536. package/scss/components/_debug.scss +259 -0
  537. package/scss/components/_divider.scss +81 -0
  538. package/scss/components/_drawer.scss +393 -0
  539. package/scss/components/_dropdown-context-menus.scss +27 -0
  540. package/scss/components/_dropdown.scss +159 -0
  541. package/scss/components/_each.scss +7 -0
  542. package/scss/components/_formula.scss +723 -0
  543. package/scss/components/_grid-nav.scss +128 -0
  544. package/scss/components/_horizontal-scroll.scss +51 -0
  545. package/scss/components/_icon.scss +4 -0
  546. package/scss/components/_image-gallery.scss +331 -0
  547. package/scss/components/_images.scss +650 -0
  548. package/scss/components/_input-box.scss +111 -0
  549. package/scss/components/_json-schema-editor.scss +149 -0
  550. package/scss/components/_json-schema.scss +166 -0
  551. package/scss/components/_json.scss +7 -0
  552. package/scss/components/_link.scss +22 -0
  553. package/scss/components/_list-menu.scss +114 -0
  554. package/scss/components/_list.scss +313 -0
  555. package/scss/components/_log.scss +169 -0
  556. package/scss/components/_mapping.scss +6 -0
  557. package/scss/components/_markdown.scss +266 -0
  558. package/scss/components/_menu.scss +795 -0
  559. package/scss/components/_mobile-dev-tool.scss +175 -0
  560. package/scss/components/_modal.scss +282 -0
  561. package/scss/components/_multiline-text.scss +20 -0
  562. package/scss/components/_nav.scss +45 -0
  563. package/scss/components/_overflow-tpl.scss +5 -0
  564. package/scss/components/_page.scss +198 -0
  565. package/scss/components/_pagination.scss +403 -0
  566. package/scss/components/_panel.scss +263 -0
  567. package/scss/components/_pdf_viewer.scss +47 -0
  568. package/scss/components/_picker-columns.scss +140 -0
  569. package/scss/components/_popover.scss +54 -0
  570. package/scss/components/_popoverable.scss +100 -0
  571. package/scss/components/_popup.scss +171 -0
  572. package/scss/components/_portlet.scss +51 -0
  573. package/scss/components/_print.scss +13 -0
  574. package/scss/components/_progress.scss +165 -0
  575. package/scss/components/_property.scss +47 -0
  576. package/scss/components/_pull-refresh.scss +30 -0
  577. package/scss/components/_quick-edit.scss +53 -0
  578. package/scss/components/_remark.scss +58 -0
  579. package/scss/components/_result-box.scss +380 -0
  580. package/scss/components/_search-box.scss +267 -0
  581. package/scss/components/_service.scss +3 -0
  582. package/scss/components/_shape.scss +19 -0
  583. package/scss/components/_signature.scss +98 -0
  584. package/scss/components/_slider.scss +27 -0
  585. package/scss/components/_sparkline.scss +18 -0
  586. package/scss/components/_spinner.scss +214 -0
  587. package/scss/components/_status.scss +118 -0
  588. package/scss/components/_steps.scss +481 -0
  589. package/scss/components/_table.scss +1234 -0
  590. package/scss/components/_table2.scss +1066 -0
  591. package/scss/components/_tabs.scss +1410 -0
  592. package/scss/components/_tag.scss +191 -0
  593. package/scss/components/_timeline.scss +572 -0
  594. package/scss/components/_toast.scss +342 -0
  595. package/scss/components/_tooltip.scss +340 -0
  596. package/scss/components/_tpl.scss +51 -0
  597. package/scss/components/_verificationCode.scss +33 -0
  598. package/scss/components/_video.scss +38 -0
  599. package/scss/components/_wizard.scss +287 -0
  600. package/scss/components/_wrapper.scss +26 -0
  601. package/scss/components/form/_chained-select.scss +10 -0
  602. package/scss/components/form/_checks.scss +433 -0
  603. package/scss/components/form/_city.scss +33 -0
  604. package/scss/components/form/_color.scss +148 -0
  605. package/scss/components/form/_combo.scss +360 -0
  606. package/scss/components/form/_date-range.scss +332 -0
  607. package/scss/components/form/_date.scss +807 -0
  608. package/scss/components/form/_editor.scss +139 -0
  609. package/scss/components/form/_excel.scss +150 -0
  610. package/scss/components/form/_fieldset.scss +202 -0
  611. package/scss/components/form/_file.scss +308 -0
  612. package/scss/components/form/_form.scss +936 -0
  613. package/scss/components/form/_group.scss +116 -0
  614. package/scss/components/form/_icon-picker.scss +113 -0
  615. package/scss/components/form/_icon-select.scss +245 -0
  616. package/scss/components/form/_image.scss +359 -0
  617. package/scss/components/form/_input-group.scss +213 -0
  618. package/scss/components/form/_input-table.scss +17 -0
  619. package/scss/components/form/_list.scss +225 -0
  620. package/scss/components/form/_location.scss +210 -0
  621. package/scss/components/form/_matrix.scss +7 -0
  622. package/scss/components/form/_nested-select.scss +149 -0
  623. package/scss/components/form/_number.scss +633 -0
  624. package/scss/components/form/_picker.scss +237 -0
  625. package/scss/components/form/_qr-code.scss +4 -0
  626. package/scss/components/form/_range.scss +438 -0
  627. package/scss/components/form/_rating.scss +94 -0
  628. package/scss/components/form/_repeat.scss +40 -0
  629. package/scss/components/form/_result-list.scss +98 -0
  630. package/scss/components/form/_rich-text.scss +163 -0
  631. package/scss/components/form/_select.scss +712 -0
  632. package/scss/components/form/_selection.scss +485 -0
  633. package/scss/components/form/_sub-form.scss +118 -0
  634. package/scss/components/form/_switch.scss +228 -0
  635. package/scss/components/form/_tag.scss +146 -0
  636. package/scss/components/form/_text.scss +508 -0
  637. package/scss/components/form/_textarea.scss +78 -0
  638. package/scss/components/form/_tinymce.scss +6 -0
  639. package/scss/components/form/_transfer.scss +624 -0
  640. package/scss/components/form/_tree-select.scss +47 -0
  641. package/scss/components/form/_tree.scss +458 -0
  642. package/scss/components/form/_user-select.scss +643 -0
  643. package/scss/components/react-datetime.scss +267 -0
  644. package/scss/helper/background/_background-color.md +131 -0
  645. package/scss/helper/background/_background-color.scss +214 -0
  646. package/scss/helper/border/_border-color.md +109 -0
  647. package/scss/helper/border/_border-color.scss +178 -0
  648. package/scss/helper/border/_border-radius.md +86 -0
  649. package/scss/helper/border/_border-radius.scss +152 -0
  650. package/scss/helper/border/_border-style.md +11 -0
  651. package/scss/helper/border/_border-style.scss +40 -0
  652. package/scss/helper/border/_border-width.md +31 -0
  653. package/scss/helper/border/_border-width.scss +72 -0
  654. package/scss/helper/box-alignment/_align-content.md +12 -0
  655. package/scss/helper/box-alignment/_align-content.scss +44 -0
  656. package/scss/helper/box-alignment/_align-items.md +11 -0
  657. package/scss/helper/box-alignment/_align-items.scss +41 -0
  658. package/scss/helper/box-alignment/_align-self.md +11 -0
  659. package/scss/helper/box-alignment/_align-self.scss +40 -0
  660. package/scss/helper/box-alignment/_justify-content.md +12 -0
  661. package/scss/helper/box-alignment/_justify-content.scss +44 -0
  662. package/scss/helper/box-alignment/_justify-items.md +11 -0
  663. package/scss/helper/box-alignment/_justify-items.scss +40 -0
  664. package/scss/helper/box-alignment/_justify-self.md +11 -0
  665. package/scss/helper/box-alignment/_justify-self.scss +40 -0
  666. package/scss/helper/box-alignment/_place-content.md +13 -0
  667. package/scss/helper/box-alignment/_place-content.scss +48 -0
  668. package/scss/helper/box-alignment/_place-items.md +11 -0
  669. package/scss/helper/box-alignment/_place-items.scss +40 -0
  670. package/scss/helper/box-alignment/_place-self.md +11 -0
  671. package/scss/helper/box-alignment/_place-self.scss +40 -0
  672. package/scss/helper/effect/_box-shadow.md +16 -0
  673. package/scss/helper/effect/_box-shadow.scss +74 -0
  674. package/scss/helper/effect/_opacity.md +21 -0
  675. package/scss/helper/effect/_opacity.scss +66 -0
  676. package/scss/helper/flex/_direction.md +10 -0
  677. package/scss/helper/flex/_direction.scss +41 -0
  678. package/scss/helper/flex/_flex.md +10 -0
  679. package/scss/helper/flex/_flex.scss +38 -0
  680. package/scss/helper/flex/_grow.md +8 -0
  681. package/scss/helper/flex/_grow.scss +28 -0
  682. package/scss/helper/flex/_order.md +20 -0
  683. package/scss/helper/flex/_order.scss +56 -0
  684. package/scss/helper/flex/_shrink.md +8 -0
  685. package/scss/helper/flex/_shrink.scss +27 -0
  686. package/scss/helper/flex/_wrap.md +9 -0
  687. package/scss/helper/flex/_wrap.scss +36 -0
  688. package/scss/helper/grid/_auto-columns.md +10 -0
  689. package/scss/helper/grid/_auto-columns.scss +38 -0
  690. package/scss/helper/grid/_auto-flow.md +10 -0
  691. package/scss/helper/grid/_auto-flow.scss +38 -0
  692. package/scss/helper/grid/_auto-rows.md +10 -0
  693. package/scss/helper/grid/_auto-rows.scss +38 -0
  694. package/scss/helper/grid/_column-start-end.md +48 -0
  695. package/scss/helper/grid/_column-start-end.scss +201 -0
  696. package/scss/helper/grid/_columns.md +19 -0
  697. package/scss/helper/grid/_columns.scss +74 -0
  698. package/scss/helper/grid/_gap.md +117 -0
  699. package/scss/helper/grid/_gap.scss +154 -0
  700. package/scss/helper/grid/_row-start-end.md +48 -0
  701. package/scss/helper/grid/_row-start-end.scss +201 -0
  702. package/scss/helper/grid/_rows.md +13 -0
  703. package/scss/helper/grid/_rows.scss +50 -0
  704. package/scss/helper/layout/_box-sizing.md +35 -0
  705. package/scss/helper/layout/_box-sizing.scss +51 -0
  706. package/scss/helper/layout/_clear.md +27 -0
  707. package/scss/helper/layout/_clear.scss +56 -0
  708. package/scss/helper/layout/_display.md +41 -0
  709. package/scss/helper/layout/_display.scss +82 -0
  710. package/scss/helper/layout/_float.md +47 -0
  711. package/scss/helper/layout/_float.scss +71 -0
  712. package/scss/helper/layout/_overflow.md +34 -0
  713. package/scss/helper/layout/_overflow.scss +85 -0
  714. package/scss/helper/layout/_position.md +27 -0
  715. package/scss/helper/layout/_position.scss +55 -0
  716. package/scss/helper/layout/_top-right-bottom-left.md +150 -0
  717. package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
  718. package/scss/helper/layout/_visibility.md +21 -0
  719. package/scss/helper/layout/_visibility.scss +42 -0
  720. package/scss/helper/layout/_z-index.md +37 -0
  721. package/scss/helper/layout/_z-index.scss +67 -0
  722. package/scss/helper/sizing/_height.md +103 -0
  723. package/scss/helper/sizing/_height.scss +161 -0
  724. package/scss/helper/sizing/_width.md +109 -0
  725. package/scss/helper/sizing/_width.scss +174 -0
  726. package/scss/helper/spacing/_margin.md +527 -0
  727. package/scss/helper/spacing/_margin.scss +821 -0
  728. package/scss/helper/spacing/_padding.md +265 -0
  729. package/scss/helper/spacing/_padding.scss +394 -0
  730. package/scss/helper/spacing/_space-between.md +155 -0
  731. package/scss/helper/spacing/_space-between.scss +224 -0
  732. package/scss/helper/typography/_font-family.md +9 -0
  733. package/scss/helper/typography/_font-family.scss +28 -0
  734. package/scss/helper/typography/_font-size.md +19 -0
  735. package/scss/helper/typography/_font-size.scss +40 -0
  736. package/scss/helper/typography/_font-style.md +8 -0
  737. package/scss/helper/typography/_font-style.scss +31 -0
  738. package/scss/helper/typography/_font-weight.md +15 -0
  739. package/scss/helper/typography/_font-weight.scss +49 -0
  740. package/scss/helper/typography/_letter-spacing.md +12 -0
  741. package/scss/helper/typography/_letter-spacing.scss +43 -0
  742. package/scss/helper/typography/_line-height.md +20 -0
  743. package/scss/helper/typography/_line-height.scss +59 -0
  744. package/scss/helper/typography/_list-style-type.md +11 -0
  745. package/scss/helper/typography/_list-style-type.scss +43 -0
  746. package/scss/helper/typography/_text-align.md +10 -0
  747. package/scss/helper/typography/_text-align.scss +34 -0
  748. package/scss/helper/typography/_text-color.md +110 -0
  749. package/scss/helper/typography/_text-color.scss +184 -0
  750. package/scss/helper/typography/_text-decoration.md +9 -0
  751. package/scss/helper/typography/_text-decoration.scss +34 -0
  752. package/scss/helper/typography/_text-overflow.md +9 -0
  753. package/scss/helper/typography/_text-overflow.scss +40 -0
  754. package/scss/helper/typography/_text-transform.md +10 -0
  755. package/scss/helper/typography/_text-transform.scss +40 -0
  756. package/scss/helper/typography/_vertical-align.md +12 -0
  757. package/scss/helper/typography/_vertical-align.scss +44 -0
  758. package/scss/helper/typography/_whitespace.md +11 -0
  759. package/scss/helper/typography/_whitespace.scss +42 -0
  760. package/scss/helper/typography/_word-break.md +9 -0
  761. package/scss/helper/typography/_word-break.scss +36 -0
  762. package/scss/helper.scss +72 -0
  763. package/scss/layout/_aside.scss +361 -0
  764. package/scss/layout/_grid.scss +173 -0
  765. package/scss/layout/_hbox.scss +127 -0
  766. package/scss/layout/_header.scss +0 -0
  767. package/scss/layout/_layout.scss +492 -0
  768. package/scss/layout/_vbox.scss +38 -0
  769. package/scss/themes/_ang-variables.scss +224 -0
  770. package/scss/themes/_antd-variables.scss +238 -0
  771. package/scss/themes/_common.scss +157 -0
  772. package/scss/themes/_cxd-variables.scss +222 -0
  773. package/scss/themes/_dark-variables.scss +229 -0
  774. package/scss/themes/ang-ie11.scss +1 -0
  775. package/scss/themes/ang.scss +27 -0
  776. package/scss/themes/antd-ie11.scss +1 -0
  777. package/scss/themes/antd.scss +5 -0
  778. package/scss/themes/cxd-ie11.scss +1 -0
  779. package/scss/themes/cxd.scss +5 -0
  780. package/scss/themes/dark-ie11.scss +1 -0
  781. package/scss/themes/dark.scss +34 -0
  782. package/scss/themes/default.scss +2 -0
  783. package/scss/themes/extract-antd-color.py +27 -0
@@ -0,0 +1,1095 @@
1
+ /**
2
+ * amis-rev-ui v6.13.0
3
+ * Copyright 2018-2026 fex
4
+ */
5
+
6
+ import { __extends, __spreadArray, __read, __awaiter, __generator, __assign, __decorate, __metadata } from 'tslib';
7
+ import React__default from 'react';
8
+ import { findDomCompat, resizeSensor, offset, getScrollParent, position, getStyleNumber, isObject, filterTree, autobind, themeable, localeable } from 'amis-rev-core';
9
+ import find from 'lodash/find';
10
+ import isEqual from 'lodash/isEqual';
11
+ import debounce from 'lodash/debounce';
12
+ import intersection from 'lodash/intersection';
13
+ import Sortable from 'sortablejs';
14
+ import Spinner from '../Spinner.js';
15
+ import ItemActionsWrapper from './ItemActionsWrapper.js';
16
+ import BodyCell from './Cell.js';
17
+ import ColGroup from './ColGroup.js';
18
+ import LazyRow from './Row.js';
19
+ import Head from './Head.js';
20
+ import SummaryRows from './SummaryRow.js';
21
+ import { getRowsByKeys, levelsSplit, getDataChildrenKeys, checkChildrenRow, getSortData, getBuildColumns } from './util.js';
22
+
23
+ /**
24
+ * @file Table
25
+ * @author fex
26
+ */
27
+ var DefaultCellWidth = 40;
28
+ var Table = /** @class */ (function (_super) {
29
+ __extends(Table, _super);
30
+ function Table(props) {
31
+ var _this = _super.call(this, props) || this;
32
+ _this.tableDom = React__default.createRef();
33
+ _this.tbodyDom = React__default.createRef();
34
+ _this.contentDom = React__default.createRef();
35
+ _this.headerDom = React__default.createRef();
36
+ _this.footDom = React__default.createRef();
37
+ _this.containerDom = React__default.createRef();
38
+ _this.toDispose = [];
39
+ _this.updateTableInfoLazy = debounce(_this.updateTableInfo.bind(_this), 250, {
40
+ trailing: true,
41
+ leading: false
42
+ });
43
+ _this.updateAutoFillHeightLazy = debounce(_this.updateAutoFillHeight.bind(_this), 250, {
44
+ trailing: true,
45
+ leading: false
46
+ });
47
+ _this.state = {
48
+ selectedRowKeys: props.rowSelection
49
+ ? props.rowSelection.selectedRowKeys.map(function (key) { return key; }) || []
50
+ : [],
51
+ expandedRowKeys: __spreadArray(__spreadArray([], __read((props.expandable ? props.expandable.expandedRowKeys || [] : [])), false), __read((props.expandable
52
+ ? props.expandable.defaultExpandedRowKeys || []
53
+ : [])), false),
54
+ colWidths: {},
55
+ widthReady: false,
56
+ hoverRow: null
57
+ };
58
+ return _this;
59
+ }
60
+ Table.prototype.getPopOverContainer = function () {
61
+ return findDomCompat(this);
62
+ };
63
+ Table.prototype.componentDidMount = function () {
64
+ var _this = this;
65
+ var _a, _b, _c, _d, _e;
66
+ (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.onRef) === null || _b === void 0 ? void 0 : _b.call(_a, this);
67
+ if ((_c = this.headerDom) === null || _c === void 0 ? void 0 : _c.current) {
68
+ // overflow设置为hidden的情况
69
+ var hiddenDomRefs = [this.headerDom, this.footDom];
70
+ hiddenDomRefs.forEach(function (ref) {
71
+ return ref &&
72
+ ref.current &&
73
+ ref.current.addEventListener('wheel', _this.onWheel.bind(_this));
74
+ });
75
+ }
76
+ var current = (_d = this.contentDom) === null || _d === void 0 ? void 0 : _d.current;
77
+ current && this.updateTableDom(current);
78
+ if (this.props.draggable && ((_e = this.tbodyDom) === null || _e === void 0 ? void 0 : _e.current)) {
79
+ this.initDragging();
80
+ }
81
+ this.updateStickyHeader();
82
+ var currentNode = findDomCompat(this);
83
+ if (this.props.autoFillHeight) {
84
+ this.toDispose.push(resizeSensor(currentNode.parentElement, this.updateAutoFillHeightLazy, false, 'height'));
85
+ this.updateAutoFillHeight();
86
+ }
87
+ this.toDispose.push(resizeSensor(currentNode, this.updateTableInfoLazy, false, 'width'));
88
+ };
89
+ Table.prototype.componentDidUpdate = function (prevProps, prevState) {
90
+ var _a, _b, _c, _d;
91
+ if (prevProps.autoFillHeight !== this.props.autoFillHeight ||
92
+ (prevProps.loading !== this.props.loading && this.props.autoFillHeight)) {
93
+ this.updateAutoFillHeight();
94
+ }
95
+ // 选择项发生了变化触发
96
+ if (!isEqual(prevState.selectedRowKeys, this.state.selectedRowKeys)) {
97
+ var rowSelectionKeyField = this.getRowSelectionKeyField();
98
+ var childrenColumnName = this.getChildrenColumnName();
99
+ // 更新保存的已选择行数据
100
+ var selectedResult = getRowsByKeys(this.props.dataSource, this.state.selectedRowKeys, rowSelectionKeyField, childrenColumnName);
101
+ var rowSelection = this.props.rowSelection;
102
+ rowSelection &&
103
+ rowSelection.onChange &&
104
+ rowSelection.onChange(this.state.selectedRowKeys, selectedResult.selectedRows);
105
+ }
106
+ // 外部传入的选择项发生了变化
107
+ if (!isEqual((_a = prevProps.rowSelection) === null || _a === void 0 ? void 0 : _a.selectedRowKeys, (_b = this.props.rowSelection) === null || _b === void 0 ? void 0 : _b.selectedRowKeys)) {
108
+ if (this.props.rowSelection) {
109
+ this.setState({
110
+ selectedRowKeys: this.props.rowSelection.selectedRowKeys
111
+ });
112
+ }
113
+ }
114
+ // 外部传入的展开项发生了变化
115
+ if (!isEqual((_c = prevProps === null || prevProps === void 0 ? void 0 : prevProps.expandable) === null || _c === void 0 ? void 0 : _c.expandedRowKeys, (_d = this.props.expandable) === null || _d === void 0 ? void 0 : _d.expandedRowKeys)) {
116
+ if (this.props.expandable) {
117
+ this.setState({
118
+ expandedRowKeys: this.props.expandable.expandedRowKeys || []
119
+ });
120
+ }
121
+ }
122
+ // 展开行变化时触发
123
+ if (!isEqual(prevState.expandedRowKeys, this.state.expandedRowKeys)) {
124
+ if (this.props.expandable) {
125
+ var childrenColumnName = this.getChildrenColumnName();
126
+ var expandableKeyField = this.getExpandableKeyField();
127
+ var onExpandedRowsChange = this.props.expandable.onExpandedRowsChange;
128
+ var expandedResult = getRowsByKeys(this.props.dataSource, this.state.selectedRowKeys, expandableKeyField, childrenColumnName);
129
+ onExpandedRowsChange &&
130
+ onExpandedRowsChange(expandedResult.selectedRows);
131
+ }
132
+ }
133
+ // sticky属性发生了变化
134
+ if (prevProps.sticky !== this.props.sticky) {
135
+ this.updateStickyHeader();
136
+ }
137
+ if (prevProps.columns !== this.props.columns) {
138
+ this.syncTableWidth();
139
+ }
140
+ };
141
+ Table.prototype.componentWillUnmount = function () {
142
+ var _this = this;
143
+ var hiddenDomRefs = [this.headerDom, this.footDom];
144
+ hiddenDomRefs.forEach(function (ref) {
145
+ return ref &&
146
+ ref.current &&
147
+ ref.current.removeEventListener('wheel', _this.onWheel.bind(_this));
148
+ });
149
+ this.destroyDragging();
150
+ this.toDispose.forEach(function (fn) { return fn(); });
151
+ this.toDispose = [];
152
+ this.updateTableInfoLazy.cancel();
153
+ this.updateAutoFillHeightLazy.cancel();
154
+ };
155
+ /**
156
+ * 自动设置表格高度占满界面剩余区域
157
+ * 用 css 实现有点麻烦,要改很多结构,所以先用 dom hack 了,避免对之前的功能有影响
158
+ */
159
+ Table.prototype.updateAutoFillHeight = function () {
160
+ var tableContent = this.containerDom.current;
161
+ if (!tableContent) {
162
+ return;
163
+ }
164
+ tableContent.removeAttribute('style');
165
+ var autoFillHeight = this.props.autoFillHeight;
166
+ if (!autoFillHeight) {
167
+ return;
168
+ }
169
+ // 计算 table-content 在 dom 中的位置
170
+ var viewportHeight = window.innerHeight;
171
+ var tableContentTop = offset(tableContent).top;
172
+ var parent = getScrollParent(tableContent.parentElement);
173
+ if (parent && parent !== document.body) {
174
+ viewportHeight = parent.clientHeight - 1;
175
+ tableContentTop = position(tableContent, parent).top;
176
+ }
177
+ var tableContentBottom = 0;
178
+ var selfNode = tableContent;
179
+ var parentNode = selfNode.parentElement;
180
+ while (parentNode) {
181
+ var paddingBottom = getStyleNumber(parentNode, 'padding-bottom');
182
+ var borderBottom = getStyleNumber(parentNode, 'border-bottom-width');
183
+ var nextSiblingHeight = 0;
184
+ var nextSibling = selfNode.nextElementSibling;
185
+ while (nextSibling) {
186
+ var positon = getComputedStyle(nextSibling).position;
187
+ if (positon !== 'absolute' && positon !== 'fixed') {
188
+ nextSiblingHeight +=
189
+ nextSibling.offsetHeight +
190
+ getStyleNumber(nextSibling, 'margin-bottom');
191
+ }
192
+ nextSibling = nextSibling.nextElementSibling;
193
+ }
194
+ var marginBottom = getStyleNumber(selfNode, 'margin-bottom');
195
+ tableContentBottom +=
196
+ paddingBottom + borderBottom + marginBottom + nextSiblingHeight;
197
+ selfNode = parentNode;
198
+ parentNode = selfNode.parentElement;
199
+ if (parent && parent !== document.body && parent === selfNode) {
200
+ break;
201
+ }
202
+ }
203
+ var heightField = autoFillHeight && autoFillHeight.maxHeight
204
+ ? 'maxHeight'
205
+ : 'height';
206
+ var heightValue = isObject(autoFillHeight)
207
+ ? autoFillHeight[heightField]
208
+ : 0;
209
+ var tableContentHeight = heightValue
210
+ ? heightValue
211
+ : Math.round(viewportHeight - tableContentTop - tableContentBottom);
212
+ if (tableContentHeight > 0) {
213
+ tableContent.style[heightField] = "".concat(tableContentHeight, "px");
214
+ tableContent.style['overflow'] = 'auto';
215
+ tableContent.classList.add('is-autoFillHeight');
216
+ }
217
+ };
218
+ Table.prototype.initDragging = function () {
219
+ var _this = this;
220
+ var _a;
221
+ var _b = this.props, cx = _b.classnames, onDrag = _b.onDrag;
222
+ this.sortable = new Sortable((_a = this.tbodyDom) === null || _a === void 0 ? void 0 : _a.current, {
223
+ group: 'table',
224
+ animation: 150,
225
+ handle: ".".concat(cx('Table-dragCell')),
226
+ ghostClass: 'is-dragging',
227
+ onMove: function (e) {
228
+ var dragged = e.dragged;
229
+ var related = e.related;
230
+ if (related &&
231
+ related.classList.contains("".concat(cx('Table-summary-row')))) {
232
+ return false;
233
+ }
234
+ var draggedLevels = dragged.getAttribute('row-levels');
235
+ var relatedLevels = related.getAttribute('row-levels');
236
+ // 嵌套展示 不属于同一层的 不允许拖动
237
+ // 否则涉及到试图的更新,比如子元素都被拖完了
238
+ if (draggedLevels !== relatedLevels) {
239
+ return false;
240
+ }
241
+ return true;
242
+ },
243
+ onEnd: function (e) { return __awaiter(_this, void 0, void 0, function () {
244
+ var oldIndex, newIndex, rowLevels, i;
245
+ return __generator(this, function (_a) {
246
+ // 没有移动
247
+ if (e.newIndex === e.oldIndex) {
248
+ return [2 /*return*/];
249
+ }
250
+ oldIndex = e.oldIndex;
251
+ newIndex = e.newIndex;
252
+ rowLevels = levelsSplit(e.item.getAttribute('row-levels'));
253
+ if (rowLevels.length) {
254
+ i = 0;
255
+ while (i < rowLevels.length) {
256
+ oldIndex = oldIndex - rowLevels[i] - 1;
257
+ newIndex = newIndex - rowLevels[i] - 1;
258
+ i++;
259
+ }
260
+ }
261
+ onDrag && onDrag(oldIndex, newIndex, rowLevels);
262
+ return [2 /*return*/];
263
+ });
264
+ }); }
265
+ });
266
+ };
267
+ Table.prototype.destroyDragging = function () {
268
+ this.sortable && this.sortable.destroy();
269
+ this.sortable = null;
270
+ };
271
+ Table.prototype.updateStickyHeader = function () {
272
+ var _this = this;
273
+ var _a, _b;
274
+ if (this.props.sticky) {
275
+ // 如果设置了sticky 如果父元素设置了overflow: auto top值还需要考虑padding值
276
+ var parent_1 = (_b = (_a = this.headerDom) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.parentElement;
277
+ setTimeout(function () {
278
+ while (parent_1 &&
279
+ window.getComputedStyle(parent_1, null).getPropertyValue('overflow') !==
280
+ 'auto') {
281
+ parent_1 = parent_1.parentElement;
282
+ }
283
+ if (parent_1 &&
284
+ window.getComputedStyle(parent_1, null).getPropertyValue('overflow') ===
285
+ 'auto') {
286
+ var paddingTop = window
287
+ .getComputedStyle(parent_1, null)
288
+ .getPropertyValue('padding-top');
289
+ if (paddingTop && _this.headerDom && _this.headerDom.current) {
290
+ _this.headerDom.current.style.top = '-' + paddingTop;
291
+ }
292
+ }
293
+ });
294
+ }
295
+ };
296
+ Table.prototype.renderColGroup = function (showReal, watchWidthChange) {
297
+ if (showReal === void 0) { showReal = false; }
298
+ if (watchWidthChange === void 0) { watchWidthChange = true; }
299
+ var _a = this.props, scroll = _a.scroll, tableLayout = _a.tableLayout, columns = _a.columns, rowSelection = _a.rowSelection, expandable = _a.expandable, draggable = _a.draggable;
300
+ var isFixed = !!((scroll && scroll.x) || tableLayout === 'fixed');
301
+ return (React__default.createElement(ColGroup, { columns: columns, colWidths: this.state.colWidths, isFixed: isFixed, syncTableWidth: watchWidthChange ? this.syncTableWidth : undefined, initTableWidth: watchWidthChange ? this.initTableWidth : undefined, selectable: !!rowSelection, expandable: !!expandable, draggable: !!draggable, rowSelectionColumnWidth: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.columnWidth) || DefaultCellWidth, expandableColumnWidth: (expandable === null || expandable === void 0 ? void 0 : expandable.columnWidth) || DefaultCellWidth, isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), showReal: showReal }));
302
+ };
303
+ Table.prototype.onResizeMouseDown = function (event, index) {
304
+ // 点击记录起始坐标
305
+ this.resizeStart = event.clientX;
306
+ this.resizeTarget = event.currentTarget;
307
+ this.resizeIndex = index;
308
+ var th = this.resizeTarget.closest('th,td');
309
+ var colIndex = th.cellIndex;
310
+ var colWidth = this.state.colWidths[colIndex];
311
+ this.resizeWidth = colWidth.width || colWidth.realWidth;
312
+ this.resizeTarget.classList.add('is-resizing');
313
+ document.addEventListener('mousemove', this.onResizeMouseMove);
314
+ document.addEventListener('mouseup', this.onResizeMouseUp);
315
+ event && event.stopPropagation();
316
+ };
317
+ Table.prototype.onResizeMouseMove = function (event) {
318
+ // 点击了调整列宽
319
+ if (this.resizeTarget) {
320
+ // 计算横向移动距离
321
+ var distance = event.clientX - this.resizeStart;
322
+ var column = this.tdColumns[this.resizeIndex];
323
+ var newWidth = 0;
324
+ if (distance > 0) {
325
+ newWidth = this.resizeWidth + distance;
326
+ }
327
+ else {
328
+ // 缩短列
329
+ newWidth = Math.max(this.resizeWidth + distance, DefaultCellWidth, column.minWidth || 0);
330
+ }
331
+ var th = this.resizeTarget.closest('th,td');
332
+ var colIndex = th.cellIndex;
333
+ var colWidths = this.state.colWidths;
334
+ colWidths[colIndex].width = newWidth;
335
+ this.setState({ colWidths: __assign({}, colWidths) });
336
+ }
337
+ event && event.stopPropagation();
338
+ };
339
+ Table.prototype.onResizeMouseUp = function (event) {
340
+ this.resizeTarget.classList.remove('is-resizing');
341
+ document.removeEventListener('mousemove', this.onResizeMouseMove);
342
+ document.removeEventListener('mouseup', this.onResizeMouseUp);
343
+ this.resizeStart = -1;
344
+ this.resizeWidth = 0;
345
+ delete this.resizeTarget;
346
+ };
347
+ Table.prototype.renderHead = function () {
348
+ var _this = this;
349
+ var _a;
350
+ var _b = this.props, columns = _b.columns, cx = _b.classnames, classPrefix = _b.classPrefix, expandable = _b.expandable, rowSelection = _b.rowSelection, draggable = _b.draggable, resizable = _b.resizable, dataSource = _b.dataSource, onSort = _b.onSort, onSelectAll = _b.onSelectAll, onFilter = _b.onFilter, testIdBuilder = _b.testIdBuilder, headerClassName = _b.headerClassName, sticky = _b.sticky, autoFillHeight = _b.autoFillHeight; _b.scroll;
351
+ var rowSelectionKeyField = this.getRowSelectionKeyField();
352
+ var dataList = rowSelection && rowSelection.getCheckboxProps
353
+ ? filterTree(dataSource, function (data, index, level) {
354
+ var props = rowSelection.getCheckboxProps(data, index);
355
+ return !props.disabled;
356
+ })
357
+ : dataSource;
358
+ var selfSticky = !!(sticky && autoFillHeight);
359
+ return (React__default.createElement(Head, { key: "thead", selfSticky: selfSticky, columns: columns, draggable: !!draggable, selectable: !!rowSelection, rowSelectionFixed: !!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.fixed), rowSelectionType: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type, selections: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selections, rowSelectionKeyField: rowSelectionKeyField, maxSelectedLength: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.maxSelectedLength, isExpandable: this.isExpandableTable(), isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), selectedRowKeys: this.state.selectedRowKeys, dataSource: dataList, resizable: resizable, expandable: !!expandable, expandableFixed: expandable === null || expandable === void 0 ? void 0 : expandable.fixed, childrenColumnName: this.getChildrenColumnName(), orderBy: (_a = this.state.sort) === null || _a === void 0 ? void 0 : _a.orderBy, popOverContainer: this.getPopOverContainer, classnames: cx, className: headerClassName, classPrefix: classPrefix, onSort: function (payload, column) {
360
+ _this.setState({
361
+ sort: payload
362
+ });
363
+ onSort && onSort(payload);
364
+ }, onSelectAll: function (value, selectedRowKeys, selectedRows, restSelectedKeys) { return __awaiter(_this, void 0, void 0, function () {
365
+ var prevented, keys;
366
+ return __generator(this, function (_a) {
367
+ switch (_a.label) {
368
+ case 0:
369
+ if (!onSelectAll) return [3 /*break*/, 2];
370
+ return [4 /*yield*/, onSelectAll(selectedRows, value ? selectedRowKeys : [], value ? [] : selectedRows)];
371
+ case 1:
372
+ prevented = _a.sent();
373
+ if (prevented) {
374
+ return [2 /*return*/];
375
+ }
376
+ _a.label = 2;
377
+ case 2:
378
+ keys = __spreadArray(__spreadArray([], __read(selectedRowKeys), false), __read(restSelectedKeys // 更新数据要把非当前页的数据也加上
379
+ ), false);
380
+ if (!isEqual(keys, this.state.selectedRowKeys)) {
381
+ this.setState({ selectedRowKeys: keys });
382
+ }
383
+ return [2 /*return*/];
384
+ }
385
+ });
386
+ }); }, onFilter: onFilter, onResizeMouseDown: this.onResizeMouseDown.bind(this), testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('head') }));
387
+ };
388
+ Table.prototype.onRowClick = function (event, record, rowIndex) {
389
+ return __awaiter(this, void 0, void 0, function () {
390
+ var _a, rowSelection, onRow, prevented, defaultKey_1, isSelected;
391
+ return __generator(this, function (_b) {
392
+ switch (_b.label) {
393
+ case 0:
394
+ _a = this.props, rowSelection = _a.rowSelection, onRow = _a.onRow;
395
+ if (!(onRow && onRow.onRowClick)) return [3 /*break*/, 2];
396
+ return [4 /*yield*/, onRow.onRowClick(event, record, rowIndex)];
397
+ case 1:
398
+ prevented = _b.sent();
399
+ if (prevented) {
400
+ return [2 /*return*/];
401
+ }
402
+ _b.label = 2;
403
+ case 2:
404
+ if (rowSelection && rowSelection.type && rowSelection.rowClick) {
405
+ defaultKey_1 = this.getRowSelectionKeyField();
406
+ isSelected = !!find(this.state.selectedRowKeys, function (key) { return key === record[defaultKey_1]; });
407
+ this.selectedSingleRow(!isSelected, record);
408
+ }
409
+ return [2 /*return*/];
410
+ }
411
+ });
412
+ });
413
+ };
414
+ Table.prototype.onRowDbClick = function (event, record, rowIndex) {
415
+ return __awaiter(this, void 0, void 0, function () {
416
+ var onRow, prevented;
417
+ return __generator(this, function (_a) {
418
+ switch (_a.label) {
419
+ case 0:
420
+ onRow = this.props.onRow;
421
+ if (!(onRow && onRow.onRowDbClick)) return [3 /*break*/, 2];
422
+ return [4 /*yield*/, onRow.onRowDbClick(event, record, rowIndex)];
423
+ case 1:
424
+ prevented = _a.sent();
425
+ if (prevented === false) {
426
+ return [2 /*return*/];
427
+ }
428
+ _a.label = 2;
429
+ case 2: return [2 /*return*/];
430
+ }
431
+ });
432
+ });
433
+ };
434
+ Table.prototype.onRowMouseEnter = function (event, record, rowIndex) {
435
+ return __awaiter(this, void 0, void 0, function () {
436
+ var _a, onRow, itemActions, prevented, target;
437
+ return __generator(this, function (_b) {
438
+ switch (_b.label) {
439
+ case 0:
440
+ _a = this.props, onRow = _a.onRow, itemActions = _a.itemActions;
441
+ if (!(onRow && onRow.onRowMouseEnter)) return [3 /*break*/, 2];
442
+ return [4 /*yield*/, onRow.onRowMouseEnter(event, record, rowIndex)];
443
+ case 1:
444
+ prevented = _b.sent();
445
+ if (prevented) {
446
+ return [2 /*return*/];
447
+ }
448
+ _b.label = 2;
449
+ case 2:
450
+ if (record && itemActions) {
451
+ target = event.target;
452
+ if ((target === null || target === void 0 ? void 0 : target.tagName) !== 'TR') {
453
+ target = target === null || target === void 0 ? void 0 : target.closest('tr');
454
+ }
455
+ this.setState({ hoverRow: { target: target, rowIndex: rowIndex, record: record } });
456
+ }
457
+ return [2 /*return*/];
458
+ }
459
+ });
460
+ });
461
+ };
462
+ Table.prototype.onRowMouseLeave = function (event, record, rowIndex) {
463
+ return __awaiter(this, void 0, void 0, function () {
464
+ var onRow;
465
+ return __generator(this, function (_a) {
466
+ onRow = this.props.onRow;
467
+ onRow &&
468
+ onRow.onRowMouseLeave &&
469
+ onRow.onRowMouseLeave(event, record, rowIndex);
470
+ return [2 /*return*/];
471
+ });
472
+ });
473
+ };
474
+ Table.prototype.onMouseLeave = function () {
475
+ var itemActions = this.props.itemActions;
476
+ itemActions && this.setState({ hoverRow: null });
477
+ };
478
+ Table.prototype.onExpandRows = function (data) {
479
+ var _this = this;
480
+ var expandedRowKeys = this.state.expandedRowKeys;
481
+ var expandable = this.props.expandable;
482
+ var keys = data.map(function (d) { return d[_this.getExpandableKeyField()]; });
483
+ this.setState({ expandedRowKeys: __spreadArray(__spreadArray([], __read(expandedRowKeys), false), __read(keys), false) });
484
+ (expandable === null || expandable === void 0 ? void 0 : expandable.onExpand) && (expandable === null || expandable === void 0 ? void 0 : expandable.onExpand(true, data));
485
+ };
486
+ Table.prototype.onCollapseRows = function (data) {
487
+ var _this = this;
488
+ var expandedRowKeys = this.state.expandedRowKeys;
489
+ var expandable = this.props.expandable;
490
+ var keys = data.map(function (d) { return d[_this.getExpandableKeyField()]; });
491
+ this.setState({
492
+ expandedRowKeys: expandedRowKeys.filter(function (k) { return !keys.find(function (v) { return v == k; }); } // 模糊匹配 否则'3'、3匹配不上
493
+ )
494
+ });
495
+ (expandable === null || expandable === void 0 ? void 0 : expandable.onExpand) && (expandable === null || expandable === void 0 ? void 0 : expandable.onExpand(true, data));
496
+ };
497
+ Table.prototype.getChildrenColumnName = function () {
498
+ var childrenColumnName = this.props.childrenColumnName;
499
+ return childrenColumnName || 'children';
500
+ };
501
+ Table.prototype.getRowSelectionKeyField = function () {
502
+ var _a = this.props, rowSelection = _a.rowSelection, keyField = _a.keyField;
503
+ return (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.keyField) || keyField || 'key';
504
+ };
505
+ Table.prototype.getExpandableKeyField = function () {
506
+ var _a = this.props, expandable = _a.expandable, keyField = _a.keyField;
507
+ return (expandable === null || expandable === void 0 ? void 0 : expandable.keyField) || keyField || 'key';
508
+ };
509
+ Table.prototype.hasCheckedChildrenRows = function (data) {
510
+ var selectedRowKeys = this.state.selectedRowKeys;
511
+ var childrenColumnName = this.getChildrenColumnName();
512
+ var rowSelectionKeyField = this.getRowSelectionKeyField();
513
+ var childrenKeys = getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField);
514
+ var length = intersection(selectedRowKeys, childrenKeys).length;
515
+ return length > 0;
516
+ };
517
+ Table.prototype.getSelectedRowKeys = function (isSelected, data) {
518
+ var rowSelection = this.props.rowSelection;
519
+ var rowSelectionKeyField = this.getRowSelectionKeyField();
520
+ var childrenColumnName = this.getChildrenColumnName();
521
+ var isRadio = rowSelection && rowSelection.type === 'radio';
522
+ var selected = [];
523
+ if (isSelected) {
524
+ if (isRadio) {
525
+ selected = [data[rowSelectionKeyField]];
526
+ }
527
+ else {
528
+ selected = __spreadArray(__spreadArray(__spreadArray([], __read(this.state.selectedRowKeys), false), [
529
+ data[rowSelectionKeyField]
530
+ ], false), __read(getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField)), false).filter(function (key, i, a) { return a.indexOf(key) === i; });
531
+ }
532
+ }
533
+ else {
534
+ if (!isRadio) {
535
+ selected = this.state.selectedRowKeys.filter(function (key) {
536
+ return !__spreadArray([
537
+ data[rowSelectionKeyField]
538
+ ], __read(getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField)), false).includes(key);
539
+ });
540
+ }
541
+ }
542
+ return selected;
543
+ };
544
+ Table.prototype.selectedSingleRow = function (value, data) {
545
+ return __awaiter(this, void 0, void 0, function () {
546
+ var _a, onSelect, dataSource, selectedRowKeys, rowSelectionKeyField, childrenColumnName, selectedResult, prevented;
547
+ return __generator(this, function (_b) {
548
+ switch (_b.label) {
549
+ case 0:
550
+ _a = this.props, onSelect = _a.onSelect, dataSource = _a.dataSource;
551
+ selectedRowKeys = this.getSelectedRowKeys(value, data);
552
+ if (!onSelect) return [3 /*break*/, 2];
553
+ rowSelectionKeyField = this.getRowSelectionKeyField();
554
+ childrenColumnName = this.getChildrenColumnName();
555
+ selectedResult = getRowsByKeys(dataSource, selectedRowKeys, rowSelectionKeyField, childrenColumnName);
556
+ return [4 /*yield*/, onSelect(selectedResult.selectedRows, selectedRowKeys, selectedResult.unSelectedRows)];
557
+ case 1:
558
+ prevented = _b.sent();
559
+ if (prevented) {
560
+ return [2 /*return*/];
561
+ }
562
+ _b.label = 2;
563
+ case 2:
564
+ if (!isEqual(this.state.selectedRowKeys, selectedRowKeys)) {
565
+ this.setState({ selectedRowKeys: selectedRowKeys });
566
+ }
567
+ return [2 /*return*/];
568
+ }
569
+ });
570
+ });
571
+ };
572
+ // 展开和嵌套不能共存
573
+ Table.prototype.isExpandableRow = function (data, rowIndex) {
574
+ var expandable = this.props.expandable;
575
+ return (expandable &&
576
+ (!expandable.rowExpandable ||
577
+ (expandable.rowExpandable && expandable.rowExpandable(data, rowIndex))));
578
+ };
579
+ Table.prototype.isExpanded = function (record) {
580
+ var expandableKeyField = this.getExpandableKeyField();
581
+ return !!find(this.state.expandedRowKeys, function (key) { return key == record[expandableKeyField]; }); // == 匹配 否则'3'、3匹配不上
582
+ };
583
+ Table.prototype.renderRow = function (data, rowIndex, levels) {
584
+ var _this = this;
585
+ var _a = this.props, rowSelection = _a.rowSelection, expandable = _a.expandable, indentSize = _a.indentSize, lineHeight = _a.lineHeight, draggable = _a.draggable, rowClassName = _a.rowClassName, keyField = _a.keyField, columns = _a.columns, lazyRenderAfter = _a.lazyRenderAfter, classPrefix = _a.classPrefix, cx = _a.classnames, testIdBuilder = _a.testIdBuilder;
586
+ var rowSelectionKeyField = this.getRowSelectionKeyField();
587
+ var isChecked = !!find(this.state.selectedRowKeys, function (key) { return key === data[rowSelectionKeyField]; });
588
+ var rowTIDBuilder = testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild("row-".concat(rowIndex));
589
+ var childrenColumnName = this.getChildrenColumnName();
590
+ // 当前行是否可展开
591
+ var isExpandableRow = this.isExpandableRow(data, rowIndex);
592
+ var hasChildrenRow = checkChildrenRow(data, childrenColumnName);
593
+ var hasChildrenChecked = !!rowSelection && hasChildrenRow && this.hasCheckedChildrenRows(data);
594
+ var expandedRowClassName = expandable &&
595
+ expandable.expandedRowClassName &&
596
+ typeof expandable.expandedRowClassName === 'function'
597
+ ? expandable.expandedRowClassName(data, rowIndex)
598
+ : '';
599
+ var isExpanded = this.isExpanded(data);
600
+ var checkboxProps = rowSelection && rowSelection.getCheckboxProps
601
+ ? rowSelection.getCheckboxProps(data, rowIndex)
602
+ : {};
603
+ var children = !expandable && childrenColumnName && hasChildrenRow && isExpanded
604
+ ? data[childrenColumnName].map(function (item, index) {
605
+ return _this.renderRow(item, index, __spreadArray(__spreadArray([], __read(levels), false), [rowIndex], false));
606
+ })
607
+ : null;
608
+ return [
609
+ React__default.createElement(LazyRow, __assign({ key: "row-".concat(rowIndex), data: data, rowIndex: rowIndex, levels: levels.join(','), columns: columns, selectable: !!rowSelection, rowSelectionFixed: !!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.fixed), rowSelectionType: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) || 'checkbox', rowClickIgControl: !!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.rowClickIgControl), expandable: !!expandable, expandableFixed: expandable === null || expandable === void 0 ? void 0 : expandable.fixed, expandedRowClassName: expandedRowClassName, expandedRowRender: expandable === null || expandable === void 0 ? void 0 : expandable.expandedRowRender, isExpanded: isExpanded, hasChildrenRow: hasChildrenRow, hasChildrenChecked: hasChildrenChecked, indentSize: indentSize, lineHeight: lineHeight, draggable: !!draggable, isExpandable: this.isExpandableTable(), isExpandableRow: isExpandableRow, colCount: this.getExtraColumnCount(), isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), isChecked: isChecked, rowClassName: rowClassName, onExpand: this.onExpandRows, onCollapse: this.onCollapseRows, onMouseEnter: this.onRowMouseEnter, onMouseLeave: this.onRowMouseLeave, onClick: this.onRowClick, onDoubleClick: this.onRowDbClick, onChange: this.onRowChange, childrenColumnName: this.getChildrenColumnName(), keyField: keyField, lazyRenderAfter: lazyRenderAfter, classnames: cx, classPrefix: classPrefix, testIdBuilder: rowTIDBuilder }, checkboxProps)),
610
+ children
611
+ ];
612
+ };
613
+ Table.prototype.onRowChange = function (value, record) {
614
+ var rowSelection = this.props.rowSelection;
615
+ if (!(rowSelection && rowSelection.rowClick)) {
616
+ this.selectedSingleRow(value, record);
617
+ }
618
+ };
619
+ Table.prototype.renderBody = function () {
620
+ var _this = this;
621
+ var _a = this.props, cx = _a.classnames, headSummary = _a.headSummary, scroll = _a.scroll, placeholder = _a.placeholder, sticky = _a.sticky, loading = _a.loading, loadingConfig = _a.loadingConfig, classPrefix = _a.classPrefix;
622
+ var tdColumns = this.tdColumns;
623
+ var hasScrollY = scroll && scroll.y;
624
+ var colCount = this.getExtraColumnCount();
625
+ var childrenColumnName = this.getChildrenColumnName();
626
+ var dataSource = getSortData(this.props.dataSource, tdColumns, childrenColumnName, this.state.sort);
627
+ return (React__default.createElement("tbody", { ref: this.tbodyDom, className: cx('Table-tbody') },
628
+ dataSource.map(function (data, index) { return _this.renderRow(data, index, []); }),
629
+ !hasScrollY && !sticky && headSummary
630
+ ? this.renderSummaryRow(headSummary)
631
+ : null,
632
+ !!loading ? (React__default.createElement("tr", { className: cx('Table-row', 'Table-loading-row') },
633
+ React__default.createElement(BodyCell, { classnames: cx, classPrefix: classPrefix, colSpan: tdColumns.length + colCount },
634
+ React__default.createElement("div", { className: cx('Table-loading') }, typeof loading === 'boolean' ? (React__default.createElement(Spinner, { overlay: true, show: loading, loadingConfig: loadingConfig })) : React__default.isValidElement(loading) ? (loading) : null)))) : !dataSource.length ? (React__default.createElement("tr", { className: cx('Table-row', 'Table-empty-row') },
635
+ React__default.createElement(BodyCell, { classnames: cx, classPrefix: classPrefix, colSpan: tdColumns.length + colCount },
636
+ React__default.createElement("div", { className: cx('Table-empty') }, typeof placeholder === 'function'
637
+ ? placeholder()
638
+ : placeholder)))) : null));
639
+ };
640
+ Table.prototype.isExpandableTable = function () {
641
+ var expandable = this.props.expandable;
642
+ // 设置了expandable 优先级更高
643
+ // 就不支持默认嵌套了
644
+ return !!expandable;
645
+ };
646
+ // 展开列放到右侧 会影响之前的一些合并的规则
647
+ Table.prototype.isRightExpandable = function () {
648
+ var expandable = this.props.expandable;
649
+ return expandable && expandable.position === 'right';
650
+ };
651
+ // 展开列放到左侧 还有一种情况是position为none 无展开按钮
652
+ Table.prototype.isLeftExpandable = function () {
653
+ var expandable = this.props.expandable;
654
+ return (expandable && (!expandable.position || expandable.position === 'left'));
655
+ };
656
+ // 计算自动增加的列数
657
+ // 选择、拖拽、展开
658
+ Table.prototype.getExtraColumnCount = function () {
659
+ var _a = this.props, draggable = _a.draggable, rowSelection = _a.rowSelection, expandable = _a.expandable;
660
+ var count = 0;
661
+ if (draggable) {
662
+ count++;
663
+ }
664
+ else {
665
+ if (this.isExpandableTable() && (expandable === null || expandable === void 0 ? void 0 : expandable.position) !== 'none') {
666
+ count++;
667
+ }
668
+ if (rowSelection) {
669
+ count++;
670
+ }
671
+ }
672
+ return count;
673
+ };
674
+ Table.prototype.renderSummaryRow = function (summary) {
675
+ var _a = this.props, cx = _a.classnames, classPrefix = _a.classPrefix, dataSource = _a.dataSource;
676
+ if (typeof summary === 'function') {
677
+ return summary(dataSource);
678
+ }
679
+ if (React__default.isValidElement(summary)) {
680
+ return summary;
681
+ }
682
+ return (React__default.createElement(SummaryRows, { summary: summary, colCount: this.getExtraColumnCount(), isRightExpandable: this.isRightExpandable(), classnames: cx, classPrefix: classPrefix, dataSource: dataSource, onMouseEnter: this.onRowMouseEnter, onMouseLeave: this.onRowMouseLeave }));
683
+ };
684
+ Table.prototype.renderFoot = function () {
685
+ var _a = this.props, cx = _a.classnames, footSummary = _a.footSummary;
686
+ return (React__default.createElement("tfoot", { className: cx('Table-summary') }, this.renderSummaryRow(footSummary)));
687
+ };
688
+ Table.prototype.updateTableDom = function (dom) {
689
+ var cx = this.props.classnames;
690
+ var scrollLeft = dom.scrollLeft, scrollWidth = dom.scrollWidth, offsetWidth = dom.offsetWidth;
691
+ var table = this.tableDom.current;
692
+ var leftCalss = cx('Table-ping-left');
693
+ if (scrollLeft > 0) {
694
+ table === null || table === void 0 ? void 0 : table.classList.add(leftCalss);
695
+ }
696
+ else {
697
+ table === null || table === void 0 ? void 0 : table.classList.remove(leftCalss);
698
+ }
699
+ var rightClass = cx('Table-ping-right');
700
+ if (scrollLeft + offsetWidth < scrollWidth) {
701
+ table === null || table === void 0 ? void 0 : table.classList.add(rightClass);
702
+ }
703
+ else {
704
+ table === null || table === void 0 ? void 0 : table.classList.remove(rightClass);
705
+ }
706
+ if (this.contentDom.current && table) {
707
+ var scrollBarWidth = this.contentDom.current.offsetWidth -
708
+ this.contentDom.current.clientWidth;
709
+ table.style.cssText += "--Table-scrollbar-width: ".concat(scrollBarWidth, "px;");
710
+ }
711
+ };
712
+ Table.prototype.onTableContentScroll = function (event) {
713
+ this.updateTableDom(event.target);
714
+ };
715
+ Table.prototype.onWheel = function (event) {
716
+ var _a = event, currentTarget = _a.currentTarget, deltaX = _a.deltaX;
717
+ if (deltaX) {
718
+ this.onTableScroll({
719
+ target: currentTarget,
720
+ scrollLeft: currentTarget.scrollLeft + deltaX
721
+ });
722
+ event.preventDefault();
723
+ }
724
+ };
725
+ Table.prototype.onTableScroll = function (event) {
726
+ var scrollDomRefs = [this.headerDom, this.contentDom, this.footDom];
727
+ var target = event.target, scrollLeft = event.scrollLeft;
728
+ scrollDomRefs.forEach(function (ref) {
729
+ var current = ref && ref.current;
730
+ if (current && current !== target) {
731
+ current.scrollLeft = scrollLeft || target.scrollLeft;
732
+ }
733
+ });
734
+ this.updateTableDom(target);
735
+ };
736
+ Table.prototype.renderTable = function () {
737
+ var _a = this.props, scroll = _a.scroll, footSummary = _a.footSummary, showHeader = _a.showHeader, itemActions = _a.itemActions, tableLayout = _a.tableLayout, cx = _a.classnames, bodyClassname = _a.bodyClassname;
738
+ var hasScrollX = scroll && scroll.x;
739
+ var hoverRow = this.state.hoverRow;
740
+ var tableStyle = hasScrollX
741
+ ? { width: scroll.x + 'px', tableLayout: 'fixed' }
742
+ : {};
743
+ return (React__default.createElement("div", { ref: this.contentDom, className: cx('Table-content'), style: hasScrollX ? { overflow: 'auto hidden' } : {}, onMouseLeave: this.onMouseLeave, onScroll: this.onTableContentScroll.bind(this) },
744
+ itemActions && hoverRow ? (React__default.createElement(ItemActionsWrapper, { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
745
+ ? itemActions(hoverRow.record, hoverRow.rowIndex)
746
+ : null)) : null,
747
+ React__default.createElement("table", { style: __assign(__assign({}, tableStyle), { tableLayout: tableLayout === 'fixed' ? 'fixed' : 'auto' }), className: cx('Table-table', bodyClassname) },
748
+ this.renderColGroup(),
749
+ showHeader ? this.renderHead() : null,
750
+ this.renderBody(),
751
+ footSummary ? this.renderFoot() : null)));
752
+ };
753
+ Table.prototype.renderScrollTableHeader = function () {
754
+ var _a;
755
+ var _b = this.props, scroll = _b.scroll, headSummary = _b.headSummary, sticky = _b.sticky, showHeader = _b.showHeader, cx = _b.classnames, headerClassName = _b.headerClassName;
756
+ var style = {};
757
+ if (!!sticky) {
758
+ Object.assign(style, { top: 0 });
759
+ }
760
+ var widthReady = this.state.widthReady;
761
+ var tableStyle = {};
762
+ if (scroll && (scroll.y || scroll.x)) {
763
+ Object.assign(tableStyle, {
764
+ width: scroll && scroll.x
765
+ ? typeof scroll.x === 'number'
766
+ ? scroll.x + 'px'
767
+ : scroll.x
768
+ : '100%'
769
+ });
770
+ }
771
+ return (React__default.createElement("div", { ref: this.headerDom, className: cx('Table-header', 'Table-header--affixed', (_a = {},
772
+ _a[cx('Table-sticky-holder')] = !!sticky,
773
+ _a), headerClassName), style: style },
774
+ React__default.createElement("table", { className: cx('Table-table', widthReady ? 'Table-table--fixed' : ''), style: __assign({}, tableStyle) },
775
+ this.renderColGroup(true, false),
776
+ showHeader ? this.renderHead() : null,
777
+ headSummary ? (React__default.createElement("tbody", null, this.renderSummaryRow(headSummary))) : null)));
778
+ };
779
+ Table.prototype.renderScrollTableBody = function () {
780
+ var _a = this.props, scroll = _a.scroll, itemActions = _a.itemActions, cx = _a.classnames, bodyClassname = _a.bodyClassname;
781
+ var style = {};
782
+ var tableStyle = {};
783
+ if (scroll && (scroll.y || scroll.x)) {
784
+ Object.assign(style, {
785
+ overflow: 'auto scroll',
786
+ maxHeight: scroll.y
787
+ });
788
+ Object.assign(tableStyle, {
789
+ width: scroll && scroll.x
790
+ ? typeof scroll.x === 'number'
791
+ ? scroll.x + 'px'
792
+ : scroll.x
793
+ : '100%'
794
+ });
795
+ }
796
+ var hoverRow = this.state.hoverRow;
797
+ return (React__default.createElement("div", { ref: this.contentDom, className: cx('Table-body'), style: style, onMouseLeave: this.onMouseLeave, onScroll: this.onTableScroll },
798
+ itemActions && hoverRow ? (React__default.createElement(ItemActionsWrapper, { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
799
+ ? itemActions(hoverRow.record, hoverRow.rowIndex)
800
+ : null)) : null,
801
+ React__default.createElement("table", { className: cx('Table-table', bodyClassname), style: __assign({}, tableStyle) },
802
+ this.renderColGroup(),
803
+ this.renderBody())));
804
+ };
805
+ Table.prototype.renderScrollTableFoot = function () {
806
+ var _a = this.props, scroll = _a.scroll, cx = _a.classnames;
807
+ return (React__default.createElement("div", { ref: this.footDom, className: cx('Table-summary'), style: { overflow: 'hidden' } },
808
+ React__default.createElement("table", { className: cx('Table-table', this.state.widthReady ? 'Table-table--fixed' : ''), style: { width: (scroll === null || scroll === void 0 ? void 0 : scroll.x) + 'px' || '100%' } },
809
+ this.renderColGroup(true, false),
810
+ this.renderFoot())));
811
+ };
812
+ Table.prototype.renderScrollTable = function () {
813
+ // todo 这个模式有个很大的问题就是依赖 tablelayout 的 fixed 模式,这就意味这列的宽度都得配置
814
+ var _a = this.props, footSummary = _a.footSummary, cx = _a.classnames;
815
+ return (React__default.createElement("div", { className: cx('Table-container'), ref: this.containerDom },
816
+ this.renderScrollTableHeader(),
817
+ this.renderScrollTableBody(),
818
+ footSummary ? this.renderScrollTableFoot() : null));
819
+ };
820
+ Table.prototype.syncTableWidth = function () {
821
+ var _this = this;
822
+ var _a;
823
+ var tbodyDom = this.tbodyDom.current;
824
+ if (!tbodyDom || this.resizeTarget) {
825
+ return;
826
+ }
827
+ var colgroup = (_a = tbodyDom.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(':scope>colgroup');
828
+ if (!colgroup) {
829
+ return;
830
+ }
831
+ var cols = [].slice.call(colgroup === null || colgroup === void 0 ? void 0 : colgroup.querySelectorAll(':scope>col'));
832
+ var colWidths = {};
833
+ cols.forEach(function (col, colIndex) {
834
+ var index = parseInt(col.getAttribute('data-col'), 10);
835
+ var column = _this.tdColumns[index];
836
+ var item = _this.state.colWidths[colIndex];
837
+ colWidths[colIndex] = {
838
+ width: (item === null || item === void 0 ? void 0 : item.originWidth) !== (column === null || column === void 0 ? void 0 : column.width) ? column === null || column === void 0 ? void 0 : column.width : item === null || item === void 0 ? void 0 : item.width,
839
+ minWidth: column === null || column === void 0 ? void 0 : column.minWidth,
840
+ realWidth: col.getBoundingClientRect().width,
841
+ originWidth: column === null || column === void 0 ? void 0 : column.width
842
+ };
843
+ });
844
+ if (!isEqual(colWidths, this.state.colWidths)) {
845
+ this.setState({ colWidths: colWidths, widthReady: true });
846
+ }
847
+ };
848
+ Table.prototype.initTableWidth = function () {
849
+ var _this = this;
850
+ var tableWrapperDom = this.contentDom.current;
851
+ if (!tableWrapperDom || this.resizeTarget) {
852
+ return;
853
+ }
854
+ var _a = this.props, scroll = _a.scroll, tableLayout = _a.tableLayout;
855
+ var table = tableWrapperDom.querySelector('table');
856
+ var thead = tableWrapperDom.querySelector('thead');
857
+ if (!thead) {
858
+ if (this.headerDom.current) {
859
+ thead = this.headerDom.current.querySelector('thead');
860
+ }
861
+ }
862
+ var tableWidth = scroll && scroll.x ? scroll.x : tableWrapperDom.offsetWidth;
863
+ var tbody = null;
864
+ var htmls = [];
865
+ var isFixed = tableLayout === 'fixed' || (scroll && scroll.x);
866
+ var someSettedWidth = this.tdColumns.some(function (column) { return column.width; });
867
+ var minWidths = {};
868
+ // fixed 模式需要参考 auto 获得列最小宽度
869
+ if (isFixed) {
870
+ tbody = (table === null || table === void 0 ? void 0 : table.querySelector(':scope>tbody')) || null;
871
+ htmls.push("<table style=\"table-layout:auto!important;width:0!important;min-width:0!important;\" class=\"".concat(table === null || table === void 0 ? void 0 : table.className, "\">").concat(thead === null || thead === void 0 ? void 0 : thead.outerHTML, "</table>"));
872
+ }
873
+ if (someSettedWidth || isFixed) {
874
+ htmls.push("<table style=\"table-layout:auto!important;min-width:".concat(tableWidth, "px!important;width:").concat(tableWidth, "px!important;\" class=\"").concat(table === null || table === void 0 ? void 0 : table.className, "\">").concat(thead ? thead.outerHTML : '').concat(tbody ? "<tbody>".concat(tbody.innerHTML, "</tbody>") : '', "</table>"));
875
+ }
876
+ if (!htmls.length) {
877
+ return;
878
+ }
879
+ var div = document.createElement('div');
880
+ div.className = 'amis-scope'; // jssdk 里面 css 会在这一层
881
+ div.style.cssText += "visibility: hidden!important;";
882
+ div.innerHTML = htmls.join('');
883
+ var ths1 = [];
884
+ var ths2 = [];
885
+ if (isFixed) {
886
+ ths1 = [].slice.call(div.querySelectorAll(':scope>table:first-child>thead>tr>th[data-col]'));
887
+ }
888
+ if (someSettedWidth || isFixed) {
889
+ ths2 = [].slice.call(div.querySelectorAll(':scope>table:last-child>thead>tr>th[data-col]'));
890
+ }
891
+ ths1.forEach(function (th) {
892
+ th.style.cssText += 'width: 0';
893
+ });
894
+ ths2.forEach(function (th, index) {
895
+ var column = _this.tdColumns[index];
896
+ th.style.cssText += "".concat(typeof (column === null || column === void 0 ? void 0 : column.width) === 'number'
897
+ ? "width: ".concat(column === null || column === void 0 ? void 0 : column.width, "px;")
898
+ : (column === null || column === void 0 ? void 0 : column.width)
899
+ ? "width: ".concat(column === null || column === void 0 ? void 0 : column.width, ";")
900
+ : '');
901
+ });
902
+ document.body.appendChild(div);
903
+ var colWidths = {};
904
+ ths1.forEach(function (th) {
905
+ var colIndex = th.cellIndex;
906
+ minWidths[colIndex] = th.clientWidth;
907
+ if (colWidths[colIndex]) {
908
+ colWidths[colIndex].minWidth = th.clientWidth;
909
+ }
910
+ else {
911
+ colWidths[colIndex] = { minWidth: th.clientWidth };
912
+ }
913
+ });
914
+ ths2.forEach(function (col) {
915
+ var colIndex = col.cellIndex;
916
+ var index = parseInt(col.getAttribute('data-col'), 10);
917
+ var column = _this.tdColumns[index];
918
+ if (column && (column.width || isFixed)) {
919
+ var width = Math.max(typeof column.width === 'number' ? column.width : col.clientWidth, minWidths[index] || 0);
920
+ if (colWidths[colIndex]) {
921
+ colWidths[colIndex].width = width;
922
+ }
923
+ else {
924
+ colWidths[colIndex] = { width: width };
925
+ }
926
+ if (column.width) {
927
+ colWidths[colIndex].originWidth = column.width;
928
+ }
929
+ }
930
+ });
931
+ if (!isEqual(colWidths, this.state.colWidths)) {
932
+ this.setState({ colWidths: colWidths }, this.syncTableWidth);
933
+ }
934
+ document.body.removeChild(div);
935
+ };
936
+ Table.prototype.updateTableInfo = function () {
937
+ this.syncTableWidth();
938
+ this.initTableWidth();
939
+ };
940
+ Table.prototype.render = function () {
941
+ var _a, _b;
942
+ var _this = this;
943
+ var _c = this.props, title = _c.title, footer = _c.footer, className = _c.className, scroll = _c.scroll, size = _c.size, bordered = _c.bordered, resizable = _c.resizable, columns = _c.columns, sticky = _c.sticky, autoFillHeight = _c.autoFillHeight, cx = _c.classnames;
944
+ var _d = getBuildColumns(columns), thColumns = _d.thColumns, tdColumns = _d.tdColumns;
945
+ this.thColumns = thColumns;
946
+ this.tdColumns = tdColumns;
947
+ // 是否设置了纵向滚动
948
+ var hasScrollY = scroll && scroll.y;
949
+ // 是否设置了横向滚动
950
+ var hasScrollX = scroll && scroll.x;
951
+ var style = {};
952
+ if (hasScrollY) {
953
+ Object.assign(style, {
954
+ maxHeight: scroll.y
955
+ });
956
+ }
957
+ var mainStyle = __assign({}, this.props.style);
958
+ if (this.state.widthReady) {
959
+ Object.keys(this.state.colWidths).forEach(function (key, index, list) {
960
+ var _a;
961
+ var width = (_a = _this.state.colWidths[index]) === null || _a === void 0 ? void 0 : _a.realWidth;
962
+ if (width) {
963
+ mainStyle["--Table-column-".concat(key, "-width")] = "".concat(width, "px");
964
+ }
965
+ });
966
+ if (this.contentDom.current) {
967
+ // 严格来说不应该这么写,但是不想折腾了
968
+ var scrollBarWidth = this.contentDom.current.offsetWidth -
969
+ this.contentDom.current.clientWidth;
970
+ mainStyle['--Table-scrollbar-width'] = scrollBarWidth + 'px';
971
+ }
972
+ }
973
+ return (React__default.createElement("div", { ref: this.tableDom, className: cx('Table2', className, (_a = {},
974
+ _a[cx('Table-scroll-horizontal')] = hasScrollX,
975
+ _a[cx("Table-".concat(size))] = size,
976
+ _a[cx('Table-bordered')] = bordered,
977
+ _a[cx('Table-resizable')] = resizable,
978
+ _a)), style: mainStyle },
979
+ title ? (React__default.createElement("div", { className: cx('Table-title') }, typeof title === 'function' ? title() : title)) : null,
980
+ hasScrollY && !autoFillHeight ? (this.renderScrollTable()) : (React__default.createElement("div", { className: cx('Table-container', (_b = {},
981
+ _b[cx('Table-container-self-sticky')] = hasScrollY || (sticky && autoFillHeight),
982
+ _b)), onScroll: this.onTableScroll, style: style, ref: this.containerDom }, this.renderTable())),
983
+ footer ? (React__default.createElement("div", { className: cx('Table-footer') }, typeof footer === 'function' ? footer() : footer)) : null));
984
+ };
985
+ Table.defaultProps = {
986
+ title: '',
987
+ className: '',
988
+ dataSource: [],
989
+ columns: [],
990
+ indentSize: 15,
991
+ placeholder: '暂无数据',
992
+ showHeader: true,
993
+ tableLayout: 'auto'
994
+ };
995
+ __decorate([
996
+ autobind,
997
+ __metadata("design:type", Function),
998
+ __metadata("design:paramtypes", []),
999
+ __metadata("design:returntype", void 0)
1000
+ ], Table.prototype, "getPopOverContainer", null);
1001
+ __decorate([
1002
+ autobind,
1003
+ __metadata("design:type", Function),
1004
+ __metadata("design:paramtypes", []),
1005
+ __metadata("design:returntype", void 0)
1006
+ ], Table.prototype, "updateAutoFillHeight", null);
1007
+ __decorate([
1008
+ autobind,
1009
+ __metadata("design:type", Function),
1010
+ __metadata("design:paramtypes", [Object]),
1011
+ __metadata("design:returntype", void 0)
1012
+ ], Table.prototype, "onResizeMouseMove", null);
1013
+ __decorate([
1014
+ autobind,
1015
+ __metadata("design:type", Function),
1016
+ __metadata("design:paramtypes", [MouseEvent]),
1017
+ __metadata("design:returntype", void 0)
1018
+ ], Table.prototype, "onResizeMouseUp", null);
1019
+ __decorate([
1020
+ autobind,
1021
+ __metadata("design:type", Function),
1022
+ __metadata("design:paramtypes", [Object, Object, Number]),
1023
+ __metadata("design:returntype", Promise)
1024
+ ], Table.prototype, "onRowClick", null);
1025
+ __decorate([
1026
+ autobind,
1027
+ __metadata("design:type", Function),
1028
+ __metadata("design:paramtypes", [Object, Object, Number]),
1029
+ __metadata("design:returntype", Promise)
1030
+ ], Table.prototype, "onRowDbClick", null);
1031
+ __decorate([
1032
+ autobind,
1033
+ __metadata("design:type", Function),
1034
+ __metadata("design:paramtypes", [Object, Object, Number]),
1035
+ __metadata("design:returntype", Promise)
1036
+ ], Table.prototype, "onRowMouseEnter", null);
1037
+ __decorate([
1038
+ autobind,
1039
+ __metadata("design:type", Function),
1040
+ __metadata("design:paramtypes", [Object, Object, Number]),
1041
+ __metadata("design:returntype", Promise)
1042
+ ], Table.prototype, "onRowMouseLeave", null);
1043
+ __decorate([
1044
+ autobind,
1045
+ __metadata("design:type", Function),
1046
+ __metadata("design:paramtypes", []),
1047
+ __metadata("design:returntype", void 0)
1048
+ ], Table.prototype, "onMouseLeave", null);
1049
+ __decorate([
1050
+ autobind,
1051
+ __metadata("design:type", Function),
1052
+ __metadata("design:paramtypes", [Array]),
1053
+ __metadata("design:returntype", void 0)
1054
+ ], Table.prototype, "onExpandRows", null);
1055
+ __decorate([
1056
+ autobind,
1057
+ __metadata("design:type", Function),
1058
+ __metadata("design:paramtypes", [Array]),
1059
+ __metadata("design:returntype", void 0)
1060
+ ], Table.prototype, "onCollapseRows", null);
1061
+ __decorate([
1062
+ autobind,
1063
+ __metadata("design:type", Function),
1064
+ __metadata("design:paramtypes", [Boolean, Object]),
1065
+ __metadata("design:returntype", void 0)
1066
+ ], Table.prototype, "onRowChange", null);
1067
+ __decorate([
1068
+ autobind,
1069
+ __metadata("design:type", Function),
1070
+ __metadata("design:paramtypes", [Object]),
1071
+ __metadata("design:returntype", void 0)
1072
+ ], Table.prototype, "onTableScroll", null);
1073
+ __decorate([
1074
+ autobind,
1075
+ __metadata("design:type", Function),
1076
+ __metadata("design:paramtypes", []),
1077
+ __metadata("design:returntype", void 0)
1078
+ ], Table.prototype, "syncTableWidth", null);
1079
+ __decorate([
1080
+ autobind,
1081
+ __metadata("design:type", Function),
1082
+ __metadata("design:paramtypes", []),
1083
+ __metadata("design:returntype", void 0)
1084
+ ], Table.prototype, "initTableWidth", null);
1085
+ __decorate([
1086
+ autobind,
1087
+ __metadata("design:type", Function),
1088
+ __metadata("design:paramtypes", []),
1089
+ __metadata("design:returntype", void 0)
1090
+ ], Table.prototype, "updateTableInfo", null);
1091
+ return Table;
1092
+ }(React__default.PureComponent));
1093
+ var Table$1 = themeable(localeable(Table));
1094
+
1095
+ export { DefaultCellWidth, Table, Table$1 as default };