funda-ui 4.7.620 → 4.7.624

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 (562) hide show
  1. package/.gitattributes +2 -0
  2. package/README.md +116 -2
  3. package/README_PUBLISH.md +328 -0
  4. package/lib/cjs/DynamicFields/index.js +11 -3
  5. package/lib/esm/DynamicFields/index.tsx +9 -4
  6. package/logo.png +0 -0
  7. package/package.json +591 -1
  8. package/preview.png +0 -0
  9. package/{DynamicFields → publish/DynamicFields}/index.js +11 -3
  10. package/publish/LICENSE +21 -0
  11. package/publish/README.md +328 -0
  12. package/publish/lib/cjs/Accordion/index.d.ts +2 -0
  13. package/publish/lib/cjs/Accordion/index.js +667 -0
  14. package/publish/lib/cjs/BackToTop/index.d.ts +17 -0
  15. package/publish/lib/cjs/BackToTop/index.js +904 -0
  16. package/publish/lib/cjs/CascadingSelect/index.d.ts +80 -0
  17. package/publish/lib/cjs/CascadingSelect/index.js +3383 -0
  18. package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +91 -0
  19. package/publish/lib/cjs/CascadingSelectE2E/index.js +3988 -0
  20. package/publish/lib/cjs/Chatbox/index.d.ts +101 -0
  21. package/publish/lib/cjs/Chatbox/index.js +7037 -0
  22. package/publish/lib/cjs/Checkbox/index.d.ts +28 -0
  23. package/publish/lib/cjs/Checkbox/index.js +673 -0
  24. package/publish/lib/cjs/ColorPicker/index.d.ts +27 -0
  25. package/publish/lib/cjs/ColorPicker/index.js +662 -0
  26. package/publish/lib/cjs/Date/index.d.ts +70 -0
  27. package/publish/lib/cjs/Date/index.js +6368 -0
  28. package/publish/lib/cjs/DigitalClock/index.d.ts +7 -0
  29. package/publish/lib/cjs/DigitalClock/index.js +402 -0
  30. package/publish/lib/cjs/DragDropList/index.d.ts +45 -0
  31. package/publish/lib/cjs/DragDropList/index.js +1586 -0
  32. package/publish/lib/cjs/DropdownMenu/index.d.ts +38 -0
  33. package/publish/lib/cjs/DropdownMenu/index.js +1507 -0
  34. package/publish/lib/cjs/DynamicFields/index.d.ts +40 -0
  35. package/publish/lib/cjs/DynamicFields/index.js +818 -0
  36. package/publish/lib/cjs/EventCalendar/index.d.ts +61 -0
  37. package/publish/lib/cjs/EventCalendar/index.js +3789 -0
  38. package/publish/lib/cjs/EventCalendarTimeline/index.d.ts +100 -0
  39. package/publish/lib/cjs/EventCalendarTimeline/index.js +6141 -0
  40. package/publish/lib/cjs/File/index.d.ts +40 -0
  41. package/publish/lib/cjs/File/index.js +1751 -0
  42. package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +14 -0
  43. package/publish/lib/cjs/HorizontalScrollContent/index.js +426 -0
  44. package/publish/lib/cjs/Input/index.d.ts +59 -0
  45. package/publish/lib/cjs/Input/index.js +1486 -0
  46. package/publish/lib/cjs/LiveSearch/index.d.ts +70 -0
  47. package/publish/lib/cjs/LiveSearch/index.js +4180 -0
  48. package/publish/lib/cjs/MasonryLayout/index.d.ts +14 -0
  49. package/publish/lib/cjs/MasonryLayout/index.js +689 -0
  50. package/publish/lib/cjs/ModalDialog/index.d.ts +83 -0
  51. package/publish/lib/cjs/ModalDialog/index.js +1719 -0
  52. package/publish/lib/cjs/ModeSwitch/index.d.ts +17 -0
  53. package/publish/lib/cjs/ModeSwitch/index.js +202 -0
  54. package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +20 -0
  55. package/publish/lib/cjs/MultilevelDropdownMenu/index.js +930 -0
  56. package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +66 -0
  57. package/publish/lib/cjs/MultipleCheckboxes/index.js +2337 -0
  58. package/publish/lib/cjs/MultipleSelect/index.d.ts +65 -0
  59. package/publish/lib/cjs/MultipleSelect/index.js +4197 -0
  60. package/publish/lib/cjs/NativeSelect/index.d.ts +37 -0
  61. package/publish/lib/cjs/NativeSelect/index.js +2052 -0
  62. package/publish/lib/cjs/NumberInput/index.d.ts +40 -0
  63. package/publish/lib/cjs/NumberInput/index.js +1191 -0
  64. package/publish/lib/cjs/Pagination/index.d.ts +51 -0
  65. package/publish/lib/cjs/Pagination/index.js +612 -0
  66. package/publish/lib/cjs/Radio/index.d.ts +45 -0
  67. package/publish/lib/cjs/Radio/index.js +1838 -0
  68. package/publish/lib/cjs/RangeSlider/index.d.ts +22 -0
  69. package/publish/lib/cjs/RangeSlider/index.js +2696 -0
  70. package/publish/lib/cjs/Refresher/index.d.ts +22 -0
  71. package/publish/lib/cjs/Refresher/index.js +564 -0
  72. package/publish/lib/cjs/RootPortal/index.d.ts +9 -0
  73. package/publish/lib/cjs/RootPortal/index.js +148 -0
  74. package/publish/lib/cjs/ScrollReveal/index.d.ts +21 -0
  75. package/publish/lib/cjs/ScrollReveal/index.js +401 -0
  76. package/publish/lib/cjs/Scrollbar/index.d.ts +17 -0
  77. package/publish/lib/cjs/Scrollbar/index.js +1107 -0
  78. package/publish/lib/cjs/SearchBar/index.d.ts +41 -0
  79. package/publish/lib/cjs/SearchBar/index.js +701 -0
  80. package/publish/lib/cjs/Select/index.d.ts +107 -0
  81. package/publish/lib/cjs/Select/index.js +6540 -0
  82. package/publish/lib/cjs/ShowMoreLess/index.d.ts +36 -0
  83. package/publish/lib/cjs/ShowMoreLess/index.js +387 -0
  84. package/publish/lib/cjs/SplitterPanel/index.d.ts +20 -0
  85. package/publish/lib/cjs/SplitterPanel/index.js +800 -0
  86. package/publish/lib/cjs/Stepper/index.d.ts +26 -0
  87. package/publish/lib/cjs/Stepper/index.js +568 -0
  88. package/publish/lib/cjs/Switch/index.d.ts +25 -0
  89. package/publish/lib/cjs/Switch/index.js +630 -0
  90. package/publish/lib/cjs/Table/index.d.ts +12 -0
  91. package/publish/lib/cjs/Table/index.js +2311 -0
  92. package/publish/lib/cjs/Tabs/index.d.ts +3 -0
  93. package/publish/lib/cjs/Tabs/index.js +771 -0
  94. package/publish/lib/cjs/TagInput/index.d.ts +37 -0
  95. package/publish/lib/cjs/TagInput/index.js +1227 -0
  96. package/publish/lib/cjs/Textarea/index.d.ts +50 -0
  97. package/publish/lib/cjs/Textarea/index.js +1795 -0
  98. package/publish/lib/cjs/Toast/index.d.ts +3 -0
  99. package/publish/lib/cjs/Toast/index.js +1345 -0
  100. package/publish/lib/cjs/Tooltip/index.d.ts +38 -0
  101. package/publish/lib/cjs/Tooltip/index.js +1778 -0
  102. package/publish/lib/cjs/Tree/index.d.ts +78 -0
  103. package/publish/lib/cjs/Tree/index.js +2330 -0
  104. package/publish/lib/cjs/Utils/anim.d.ts +11 -0
  105. package/publish/lib/cjs/Utils/anim.js +846 -0
  106. package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +8 -0
  107. package/publish/lib/cjs/Utils/bodyScrollLock.js +311 -0
  108. package/publish/lib/cjs/Utils/buffer.d.ts +67 -0
  109. package/publish/lib/cjs/Utils/buffer.js +343 -0
  110. package/publish/lib/cjs/Utils/cls.d.ts +15 -0
  111. package/publish/lib/cjs/Utils/cls.js +124 -0
  112. package/publish/lib/cjs/Utils/convert.d.ts +25 -0
  113. package/publish/lib/cjs/Utils/convert.js +109 -0
  114. package/publish/lib/cjs/Utils/date.d.ts +227 -0
  115. package/publish/lib/cjs/Utils/date.js +587 -0
  116. package/publish/lib/cjs/Utils/dom.d.ts +13 -0
  117. package/publish/lib/cjs/Utils/dom.js +215 -0
  118. package/publish/lib/cjs/Utils/easing.d.ts +29 -0
  119. package/publish/lib/cjs/Utils/easing.js +221 -0
  120. package/publish/lib/cjs/Utils/extract.d.ts +66 -0
  121. package/publish/lib/cjs/Utils/extract.js +195 -0
  122. package/publish/lib/cjs/Utils/format-string.d.ts +65 -0
  123. package/publish/lib/cjs/Utils/format-string.js +167 -0
  124. package/publish/lib/cjs/Utils/formdata.d.ts +13 -0
  125. package/publish/lib/cjs/Utils/formdata.js +131 -0
  126. package/publish/lib/cjs/Utils/getElementProperty.d.ts +52 -0
  127. package/publish/lib/cjs/Utils/getElementProperty.js +189 -0
  128. package/publish/lib/cjs/Utils/guid.d.ts +7 -0
  129. package/publish/lib/cjs/Utils/guid.js +67 -0
  130. package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +10 -0
  131. package/publish/lib/cjs/Utils/initDefaultOptions.js +607 -0
  132. package/publish/lib/cjs/Utils/inputsCalculation.d.ts +28 -0
  133. package/publish/lib/cjs/Utils/inputsCalculation.js +188 -0
  134. package/publish/lib/cjs/Utils/math.d.ts +77 -0
  135. package/publish/lib/cjs/Utils/math.js +305 -0
  136. package/publish/lib/cjs/Utils/object.d.ts +18 -0
  137. package/publish/lib/cjs/Utils/object.js +120 -0
  138. package/publish/lib/cjs/Utils/os.d.ts +2 -0
  139. package/publish/lib/cjs/Utils/os.js +104 -0
  140. package/publish/lib/cjs/Utils/performance.d.ts +3 -0
  141. package/publish/lib/cjs/Utils/performance.js +94 -0
  142. package/publish/lib/cjs/Utils/sanitize.d.ts +14 -0
  143. package/publish/lib/cjs/Utils/sanitize.js +87 -0
  144. package/publish/lib/cjs/Utils/time.d.ts +40 -0
  145. package/publish/lib/cjs/Utils/time.js +177 -0
  146. package/publish/lib/cjs/Utils/tree.d.ts +40 -0
  147. package/publish/lib/cjs/Utils/tree.js +195 -0
  148. package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +10 -0
  149. package/publish/lib/cjs/Utils/useAutosizeTextArea.js +231 -0
  150. package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +125 -0
  151. package/publish/lib/cjs/Utils/useBoundedDrag.js +380 -0
  152. package/publish/lib/cjs/Utils/useClickOutside.d.ts +33 -0
  153. package/publish/lib/cjs/Utils/useClickOutside.js +166 -0
  154. package/publish/lib/cjs/Utils/useComId.d.ts +6 -0
  155. package/publish/lib/cjs/Utils/useComId.js +114 -0
  156. package/publish/lib/cjs/Utils/useDebounce.d.ts +20 -0
  157. package/publish/lib/cjs/Utils/useDebounce.js +138 -0
  158. package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +166 -0
  159. package/publish/lib/cjs/Utils/useDragDropPosition.js +453 -0
  160. package/publish/lib/cjs/Utils/useDraggable.d.ts +62 -0
  161. package/publish/lib/cjs/Utils/useDraggable.js +348 -0
  162. package/publish/lib/cjs/Utils/useHistoryTracker.d.ts +166 -0
  163. package/publish/lib/cjs/Utils/useHistoryTracker.js +649 -0
  164. package/publish/lib/cjs/Utils/useInterval.d.ts +5 -0
  165. package/publish/lib/cjs/Utils/useInterval.js +168 -0
  166. package/publish/lib/cjs/Utils/useIsMobile.d.ts +2 -0
  167. package/publish/lib/cjs/Utils/useIsMobile.js +232 -0
  168. package/publish/lib/cjs/Utils/useKeyPress.d.ts +44 -0
  169. package/publish/lib/cjs/Utils/useKeyPress.js +200 -0
  170. package/publish/lib/cjs/Utils/useSessionStorageListener.d.ts +2 -0
  171. package/publish/lib/cjs/Utils/useSessionStorageListener.js +157 -0
  172. package/publish/lib/cjs/Utils/useStreamController.d.ts +71 -0
  173. package/publish/lib/cjs/Utils/useStreamController.js +494 -0
  174. package/publish/lib/cjs/Utils/useThrottle.d.ts +2 -0
  175. package/publish/lib/cjs/Utils/useThrottle.js +136 -0
  176. package/publish/lib/cjs/Utils/useWindowScroll.d.ts +12 -0
  177. package/publish/lib/cjs/Utils/useWindowScroll.js +217 -0
  178. package/publish/lib/cjs/Utils/validate.d.ts +53 -0
  179. package/publish/lib/cjs/Utils/validate.js +536 -0
  180. package/publish/lib/cjs/Utils/viewport.d.ts +7 -0
  181. package/publish/lib/cjs/Utils/viewport.js +64 -0
  182. package/publish/lib/cjs/index.d.ts +49 -0
  183. package/publish/lib/cjs/index.js +50 -0
  184. package/publish/lib/css/BackToTop/index.css +34 -0
  185. package/publish/lib/css/CascadingSelect/index.css +245 -0
  186. package/publish/lib/css/CascadingSelectE2E/index.css +245 -0
  187. package/publish/lib/css/Chatbox/index.css +774 -0
  188. package/publish/lib/css/ColorPicker/index.css +58 -0
  189. package/publish/lib/css/Date/index.css +434 -0
  190. package/publish/lib/css/DragDropList/index.css +188 -0
  191. package/publish/lib/css/DropdownMenu/index.css +151 -0
  192. package/publish/lib/css/EventCalendar/index.css +300 -0
  193. package/publish/lib/css/EventCalendarTimeline/index.css +694 -0
  194. package/publish/lib/css/HorizontalScrollContent/index.css +70 -0
  195. package/publish/lib/css/LiveSearch/index.css +88 -0
  196. package/publish/lib/css/MultilevelDropdownMenu/index.css +38 -0
  197. package/publish/lib/css/MultipleSelect/index.css +313 -0
  198. package/publish/lib/css/RangeSlider/index.css +150 -0
  199. package/publish/lib/css/Scrollbar/index.css +176 -0
  200. package/publish/lib/css/Select/index.css +434 -0
  201. package/publish/lib/css/ShowMoreLess/index.css +23 -0
  202. package/publish/lib/css/SplitterPanel/index.css +63 -0
  203. package/publish/lib/css/Stepper/index.css +250 -0
  204. package/publish/lib/css/Table/index.css +584 -0
  205. package/publish/lib/css/TagInput/index.css +91 -0
  206. package/publish/lib/css/Toast/index.css +149 -0
  207. package/publish/lib/css/Tooltip/index.css +198 -0
  208. package/publish/lib/css/Tree/index.css +237 -0
  209. package/publish/lib/esm/Accordion/Accordion.tsx +185 -0
  210. package/publish/lib/esm/Accordion/AccordionItem.tsx +248 -0
  211. package/publish/lib/esm/Accordion/index.tsx +2 -0
  212. package/publish/lib/esm/BackToTop/index.scss +47 -0
  213. package/publish/lib/esm/BackToTop/index.tsx +177 -0
  214. package/publish/lib/esm/CascadingSelect/Group.tsx +83 -0
  215. package/publish/lib/esm/CascadingSelect/index.scss +330 -0
  216. package/publish/lib/esm/CascadingSelect/index.tsx +1397 -0
  217. package/publish/lib/esm/CascadingSelectE2E/Group.tsx +87 -0
  218. package/publish/lib/esm/CascadingSelectE2E/index.scss +333 -0
  219. package/publish/lib/esm/CascadingSelectE2E/index.tsx +1684 -0
  220. package/publish/lib/esm/Chatbox/PureLoader.tsx +47 -0
  221. package/publish/lib/esm/Chatbox/TypingEffect.tsx +56 -0
  222. package/publish/lib/esm/Chatbox/index.scss +966 -0
  223. package/publish/lib/esm/Chatbox/index.tsx +1742 -0
  224. package/publish/lib/esm/Chatbox/utils/func.ts +180 -0
  225. package/publish/lib/esm/Checkbox/index.tsx +206 -0
  226. package/publish/lib/esm/ColorPicker/index.scss +91 -0
  227. package/publish/lib/esm/ColorPicker/index.tsx +204 -0
  228. package/publish/lib/esm/Date/Calendar.tsx +723 -0
  229. package/publish/lib/esm/Date/index.scss +567 -0
  230. package/publish/lib/esm/Date/index.tsx +1797 -0
  231. package/publish/lib/esm/Date/localization/en_US.js +13 -0
  232. package/publish/lib/esm/Date/localization/zh_CN.js +12 -0
  233. package/publish/lib/esm/DigitalClock/index.tsx +74 -0
  234. package/publish/lib/esm/DragDropList/index.scss +245 -0
  235. package/publish/lib/esm/DragDropList/index.tsx +504 -0
  236. package/publish/lib/esm/DropdownMenu/Option.tsx +55 -0
  237. package/publish/lib/esm/DropdownMenu/index.scss +205 -0
  238. package/publish/lib/esm/DropdownMenu/index.tsx +378 -0
  239. package/publish/lib/esm/DynamicFields/index.tsx +409 -0
  240. package/publish/lib/esm/EventCalendar/index.scss +407 -0
  241. package/publish/lib/esm/EventCalendar/index.tsx +1005 -0
  242. package/publish/lib/esm/EventCalendarTimeline/index.scss +926 -0
  243. package/publish/lib/esm/EventCalendarTimeline/index.tsx +2686 -0
  244. package/publish/lib/esm/File/index.tsx +477 -0
  245. package/publish/lib/esm/HorizontalScrollContent/index.scss +87 -0
  246. package/publish/lib/esm/HorizontalScrollContent/index.tsx +171 -0
  247. package/publish/lib/esm/Input/index.tsx +641 -0
  248. package/publish/lib/esm/LiveSearch/index.scss +129 -0
  249. package/publish/lib/esm/LiveSearch/index.tsx +1058 -0
  250. package/publish/lib/esm/MasonryLayout/index.tsx +326 -0
  251. package/publish/lib/esm/ModalDialog/index.tsx +572 -0
  252. package/publish/lib/esm/ModeSwitch/index.tsx +82 -0
  253. package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +265 -0
  254. package/publish/lib/esm/MultilevelDropdownMenu/index.scss +79 -0
  255. package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +77 -0
  256. package/publish/lib/esm/MultipleCheckboxes/index.tsx +849 -0
  257. package/publish/lib/esm/MultipleSelect/index.scss +398 -0
  258. package/publish/lib/esm/MultipleSelect/index.tsx +769 -0
  259. package/publish/lib/esm/MultipleSelect/utils/func.ts +63 -0
  260. package/publish/lib/esm/NativeSelect/index.tsx +396 -0
  261. package/publish/lib/esm/NativeSelect/utils/func.ts +51 -0
  262. package/publish/lib/esm/NumberInput/index.tsx +425 -0
  263. package/publish/lib/esm/Pagination/index.tsx +286 -0
  264. package/publish/lib/esm/Pagination/pagination-navigators.tsx +60 -0
  265. package/publish/lib/esm/Radio/index.tsx +694 -0
  266. package/publish/lib/esm/RangeSlider/index.scss +186 -0
  267. package/publish/lib/esm/RangeSlider/index.tsx +241 -0
  268. package/publish/lib/esm/Refresher/index.tsx +121 -0
  269. package/publish/lib/esm/RootPortal/index.tsx +59 -0
  270. package/publish/lib/esm/ScrollReveal/index.tsx +148 -0
  271. package/publish/lib/esm/Scrollbar/index.scss +221 -0
  272. package/publish/lib/esm/Scrollbar/index.tsx +561 -0
  273. package/publish/lib/esm/SearchBar/index.tsx +252 -0
  274. package/publish/lib/esm/Select/index.scss +639 -0
  275. package/publish/lib/esm/Select/index.tsx +3104 -0
  276. package/publish/lib/esm/Select/utils/func.ts +98 -0
  277. package/publish/lib/esm/ShowMoreLess/index.scss +27 -0
  278. package/publish/lib/esm/ShowMoreLess/index.tsx +145 -0
  279. package/publish/lib/esm/SplitterPanel/index.scss +82 -0
  280. package/publish/lib/esm/SplitterPanel/index.tsx +174 -0
  281. package/publish/lib/esm/Stepper/index.scss +315 -0
  282. package/publish/lib/esm/Stepper/index.tsx +325 -0
  283. package/publish/lib/esm/Switch/index.tsx +149 -0
  284. package/publish/lib/esm/Table/Table.tsx +351 -0
  285. package/publish/lib/esm/Table/TableBody.tsx +41 -0
  286. package/publish/lib/esm/Table/TableCaption.tsx +34 -0
  287. package/publish/lib/esm/Table/TableCell.tsx +126 -0
  288. package/publish/lib/esm/Table/TableColgroup.tsx +38 -0
  289. package/publish/lib/esm/Table/TableContext.tsx +26 -0
  290. package/publish/lib/esm/Table/TableFoot.tsx +28 -0
  291. package/publish/lib/esm/Table/TableHead.tsx +28 -0
  292. package/publish/lib/esm/Table/TableRow.tsx +76 -0
  293. package/publish/lib/esm/Table/index.scss +418 -0
  294. package/publish/lib/esm/Table/index.tsx +14 -0
  295. package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +46 -0
  296. package/publish/lib/esm/Table/utils/SortSprite.tsx +63 -0
  297. package/publish/lib/esm/Table/utils/TableFilter.tsx +56 -0
  298. package/publish/lib/esm/Table/utils/ToggleSelection.tsx +255 -0
  299. package/publish/lib/esm/Table/utils/func.ts +182 -0
  300. package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +342 -0
  301. package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +255 -0
  302. package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +92 -0
  303. package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +187 -0
  304. package/publish/lib/esm/Tabs/TabList.tsx +50 -0
  305. package/publish/lib/esm/Tabs/TabPanel.tsx +44 -0
  306. package/publish/lib/esm/Tabs/Tabs.tsx +282 -0
  307. package/publish/lib/esm/Tabs/index.tsx +3 -0
  308. package/publish/lib/esm/TagInput/index.scss +126 -0
  309. package/publish/lib/esm/TagInput/index.tsx +379 -0
  310. package/publish/lib/esm/Textarea/index.tsx +621 -0
  311. package/publish/lib/esm/Toast/Item.tsx +165 -0
  312. package/publish/lib/esm/Toast/Toast.tsx +391 -0
  313. package/publish/lib/esm/Toast/ToastContext.tsx +104 -0
  314. package/publish/lib/esm/Toast/__toast.vanilla.js +422 -0
  315. package/publish/lib/esm/Toast/index.scss +197 -0
  316. package/publish/lib/esm/Toast/index.tsx +3 -0
  317. package/publish/lib/esm/Toast/types.ts +60 -0
  318. package/publish/lib/esm/Toast/useToast.tsx +72 -0
  319. package/publish/lib/esm/Tooltip/index.scss +272 -0
  320. package/publish/lib/esm/Tooltip/index.tsx +416 -0
  321. package/publish/lib/esm/Tree/TreeList.tsx +600 -0
  322. package/publish/lib/esm/Tree/index.scss +384 -0
  323. package/publish/lib/esm/Tree/index.tsx +661 -0
  324. package/publish/lib/esm/Tree/init-height.tsx +40 -0
  325. package/publish/lib/esm/Tree/utils/func.ts +15 -0
  326. package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +131 -0
  327. package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +301 -0
  328. package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +69 -0
  329. package/publish/lib/esm/Utils/hooks/useComId.tsx +13 -0
  330. package/publish/lib/esm/Utils/hooks/useDebounce.tsx +40 -0
  331. package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +417 -0
  332. package/publish/lib/esm/Utils/hooks/useDraggable.tsx +265 -0
  333. package/publish/lib/esm/Utils/hooks/useHistoryTracker.tsx +554 -0
  334. package/publish/lib/esm/Utils/hooks/useInterval.tsx +74 -0
  335. package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +139 -0
  336. package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +104 -0
  337. package/publish/lib/esm/Utils/hooks/useSessionStorageListener.tsx +45 -0
  338. package/publish/lib/esm/Utils/hooks/useStreamController.tsx +277 -0
  339. package/publish/lib/esm/Utils/hooks/useThrottle.tsx +39 -0
  340. package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +83 -0
  341. package/publish/lib/esm/Utils/libs/anim.ts +96 -0
  342. package/publish/lib/esm/Utils/libs/buffer.ts +262 -0
  343. package/publish/lib/esm/Utils/libs/cls.ts +64 -0
  344. package/publish/lib/esm/Utils/libs/convert.ts +59 -0
  345. package/publish/lib/esm/Utils/libs/date.ts +598 -0
  346. package/publish/lib/esm/Utils/libs/dom.ts +150 -0
  347. package/publish/lib/esm/Utils/libs/easing.ts +201 -0
  348. package/publish/lib/esm/Utils/libs/extract.ts +160 -0
  349. package/publish/lib/esm/Utils/libs/format-string.ts +116 -0
  350. package/publish/lib/esm/Utils/libs/formdata.ts +93 -0
  351. package/publish/lib/esm/Utils/libs/getElementProperty.ts +150 -0
  352. package/publish/lib/esm/Utils/libs/guid.ts +16 -0
  353. package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +43 -0
  354. package/publish/lib/esm/Utils/libs/inputsCalculation.ts +160 -0
  355. package/publish/lib/esm/Utils/libs/math.ts +276 -0
  356. package/publish/lib/esm/Utils/libs/object.ts +68 -0
  357. package/publish/lib/esm/Utils/libs/os.ts +63 -0
  358. package/publish/lib/esm/Utils/libs/performance.ts +47 -0
  359. package/publish/lib/esm/Utils/libs/sanitize.ts +55 -0
  360. package/publish/lib/esm/Utils/libs/time.ts +139 -0
  361. package/publish/lib/esm/Utils/libs/tree.ts +119 -0
  362. package/publish/lib/esm/Utils/libs/validate.ts +434 -0
  363. package/publish/lib/esm/Utils/libs/viewport.ts +20 -0
  364. package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +286 -0
  365. package/publish/lib/esm/index.js +47 -0
  366. package/publish/package.json +1 -0
  367. /package/{Accordion → publish/Accordion}/index.d.ts +0 -0
  368. /package/{Accordion → publish/Accordion}/index.js +0 -0
  369. /package/{BackToTop → publish/BackToTop}/index.css +0 -0
  370. /package/{BackToTop → publish/BackToTop}/index.d.ts +0 -0
  371. /package/{BackToTop → publish/BackToTop}/index.js +0 -0
  372. /package/{CascadingSelect → publish/CascadingSelect}/index.css +0 -0
  373. /package/{CascadingSelect → publish/CascadingSelect}/index.d.ts +0 -0
  374. /package/{CascadingSelect → publish/CascadingSelect}/index.js +0 -0
  375. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.css +0 -0
  376. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.d.ts +0 -0
  377. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.js +0 -0
  378. /package/{Chatbox → publish/Chatbox}/index.css +0 -0
  379. /package/{Chatbox → publish/Chatbox}/index.d.ts +0 -0
  380. /package/{Chatbox → publish/Chatbox}/index.js +0 -0
  381. /package/{Checkbox → publish/Checkbox}/index.d.ts +0 -0
  382. /package/{Checkbox → publish/Checkbox}/index.js +0 -0
  383. /package/{ColorPicker → publish/ColorPicker}/index.css +0 -0
  384. /package/{ColorPicker → publish/ColorPicker}/index.d.ts +0 -0
  385. /package/{ColorPicker → publish/ColorPicker}/index.js +0 -0
  386. /package/{Date → publish/Date}/index.css +0 -0
  387. /package/{Date → publish/Date}/index.d.ts +0 -0
  388. /package/{Date → publish/Date}/index.js +0 -0
  389. /package/{DigitalClock → publish/DigitalClock}/index.d.ts +0 -0
  390. /package/{DigitalClock → publish/DigitalClock}/index.js +0 -0
  391. /package/{DragDropList → publish/DragDropList}/index.css +0 -0
  392. /package/{DragDropList → publish/DragDropList}/index.d.ts +0 -0
  393. /package/{DragDropList → publish/DragDropList}/index.js +0 -0
  394. /package/{DropdownMenu → publish/DropdownMenu}/index.css +0 -0
  395. /package/{DropdownMenu → publish/DropdownMenu}/index.d.ts +0 -0
  396. /package/{DropdownMenu → publish/DropdownMenu}/index.js +0 -0
  397. /package/{DynamicFields → publish/DynamicFields}/index.d.ts +0 -0
  398. /package/{EventCalendar → publish/EventCalendar}/index.css +0 -0
  399. /package/{EventCalendar → publish/EventCalendar}/index.d.ts +0 -0
  400. /package/{EventCalendar → publish/EventCalendar}/index.js +0 -0
  401. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.css +0 -0
  402. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.d.ts +0 -0
  403. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.js +0 -0
  404. /package/{File → publish/File}/index.d.ts +0 -0
  405. /package/{File → publish/File}/index.js +0 -0
  406. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.css +0 -0
  407. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.d.ts +0 -0
  408. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.js +0 -0
  409. /package/{Input → publish/Input}/index.d.ts +0 -0
  410. /package/{Input → publish/Input}/index.js +0 -0
  411. /package/{LiveSearch → publish/LiveSearch}/index.css +0 -0
  412. /package/{LiveSearch → publish/LiveSearch}/index.d.ts +0 -0
  413. /package/{LiveSearch → publish/LiveSearch}/index.js +0 -0
  414. /package/{MasonryLayout → publish/MasonryLayout}/index.d.ts +0 -0
  415. /package/{MasonryLayout → publish/MasonryLayout}/index.js +0 -0
  416. /package/{ModalDialog → publish/ModalDialog}/index.d.ts +0 -0
  417. /package/{ModalDialog → publish/ModalDialog}/index.js +0 -0
  418. /package/{ModeSwitch → publish/ModeSwitch}/index.d.ts +0 -0
  419. /package/{ModeSwitch → publish/ModeSwitch}/index.js +0 -0
  420. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.css +0 -0
  421. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.d.ts +0 -0
  422. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.js +0 -0
  423. /package/{MultipleCheckboxes → publish/MultipleCheckboxes}/index.d.ts +0 -0
  424. /package/{MultipleCheckboxes → publish/MultipleCheckboxes}/index.js +0 -0
  425. /package/{MultipleSelect → publish/MultipleSelect}/index.css +0 -0
  426. /package/{MultipleSelect → publish/MultipleSelect}/index.d.ts +0 -0
  427. /package/{MultipleSelect → publish/MultipleSelect}/index.js +0 -0
  428. /package/{NativeSelect → publish/NativeSelect}/index.d.ts +0 -0
  429. /package/{NativeSelect → publish/NativeSelect}/index.js +0 -0
  430. /package/{NumberInput → publish/NumberInput}/index.d.ts +0 -0
  431. /package/{NumberInput → publish/NumberInput}/index.js +0 -0
  432. /package/{Pagination → publish/Pagination}/index.d.ts +0 -0
  433. /package/{Pagination → publish/Pagination}/index.js +0 -0
  434. /package/{Radio → publish/Radio}/index.d.ts +0 -0
  435. /package/{Radio → publish/Radio}/index.js +0 -0
  436. /package/{RangeSlider → publish/RangeSlider}/index.css +0 -0
  437. /package/{RangeSlider → publish/RangeSlider}/index.d.ts +0 -0
  438. /package/{RangeSlider → publish/RangeSlider}/index.js +0 -0
  439. /package/{Refresher → publish/Refresher}/index.d.ts +0 -0
  440. /package/{Refresher → publish/Refresher}/index.js +0 -0
  441. /package/{RootPortal → publish/RootPortal}/index.d.ts +0 -0
  442. /package/{RootPortal → publish/RootPortal}/index.js +0 -0
  443. /package/{ScrollReveal → publish/ScrollReveal}/index.d.ts +0 -0
  444. /package/{ScrollReveal → publish/ScrollReveal}/index.js +0 -0
  445. /package/{Scrollbar → publish/Scrollbar}/index.css +0 -0
  446. /package/{Scrollbar → publish/Scrollbar}/index.d.ts +0 -0
  447. /package/{Scrollbar → publish/Scrollbar}/index.js +0 -0
  448. /package/{SearchBar → publish/SearchBar}/index.d.ts +0 -0
  449. /package/{SearchBar → publish/SearchBar}/index.js +0 -0
  450. /package/{Select → publish/Select}/index.css +0 -0
  451. /package/{Select → publish/Select}/index.d.ts +0 -0
  452. /package/{Select → publish/Select}/index.js +0 -0
  453. /package/{ShowMoreLess → publish/ShowMoreLess}/index.css +0 -0
  454. /package/{ShowMoreLess → publish/ShowMoreLess}/index.d.ts +0 -0
  455. /package/{ShowMoreLess → publish/ShowMoreLess}/index.js +0 -0
  456. /package/{SplitterPanel → publish/SplitterPanel}/index.css +0 -0
  457. /package/{SplitterPanel → publish/SplitterPanel}/index.d.ts +0 -0
  458. /package/{SplitterPanel → publish/SplitterPanel}/index.js +0 -0
  459. /package/{Stepper → publish/Stepper}/index.css +0 -0
  460. /package/{Stepper → publish/Stepper}/index.d.ts +0 -0
  461. /package/{Stepper → publish/Stepper}/index.js +0 -0
  462. /package/{Switch → publish/Switch}/index.d.ts +0 -0
  463. /package/{Switch → publish/Switch}/index.js +0 -0
  464. /package/{Table → publish/Table}/index.css +0 -0
  465. /package/{Table → publish/Table}/index.d.ts +0 -0
  466. /package/{Table → publish/Table}/index.js +0 -0
  467. /package/{Tabs → publish/Tabs}/index.d.ts +0 -0
  468. /package/{Tabs → publish/Tabs}/index.js +0 -0
  469. /package/{TagInput → publish/TagInput}/index.css +0 -0
  470. /package/{TagInput → publish/TagInput}/index.d.ts +0 -0
  471. /package/{TagInput → publish/TagInput}/index.js +0 -0
  472. /package/{Textarea → publish/Textarea}/index.d.ts +0 -0
  473. /package/{Textarea → publish/Textarea}/index.js +0 -0
  474. /package/{Toast → publish/Toast}/index.css +0 -0
  475. /package/{Toast → publish/Toast}/index.d.ts +0 -0
  476. /package/{Toast → publish/Toast}/index.js +0 -0
  477. /package/{Tooltip → publish/Tooltip}/index.css +0 -0
  478. /package/{Tooltip → publish/Tooltip}/index.d.ts +0 -0
  479. /package/{Tooltip → publish/Tooltip}/index.js +0 -0
  480. /package/{Tree → publish/Tree}/index.css +0 -0
  481. /package/{Tree → publish/Tree}/index.d.ts +0 -0
  482. /package/{Tree → publish/Tree}/index.js +0 -0
  483. /package/{Utils → publish/Utils}/anim.d.ts +0 -0
  484. /package/{Utils → publish/Utils}/anim.js +0 -0
  485. /package/{Utils → publish/Utils}/bodyScrollLock.d.ts +0 -0
  486. /package/{Utils → publish/Utils}/bodyScrollLock.js +0 -0
  487. /package/{Utils → publish/Utils}/buffer.d.ts +0 -0
  488. /package/{Utils → publish/Utils}/buffer.js +0 -0
  489. /package/{Utils → publish/Utils}/cls.d.ts +0 -0
  490. /package/{Utils → publish/Utils}/cls.js +0 -0
  491. /package/{Utils → publish/Utils}/convert.d.ts +0 -0
  492. /package/{Utils → publish/Utils}/convert.js +0 -0
  493. /package/{Utils → publish/Utils}/date.d.ts +0 -0
  494. /package/{Utils → publish/Utils}/date.js +0 -0
  495. /package/{Utils → publish/Utils}/dom.d.ts +0 -0
  496. /package/{Utils → publish/Utils}/dom.js +0 -0
  497. /package/{Utils → publish/Utils}/easing.d.ts +0 -0
  498. /package/{Utils → publish/Utils}/easing.js +0 -0
  499. /package/{Utils → publish/Utils}/extract.d.ts +0 -0
  500. /package/{Utils → publish/Utils}/extract.js +0 -0
  501. /package/{Utils → publish/Utils}/format-string.d.ts +0 -0
  502. /package/{Utils → publish/Utils}/format-string.js +0 -0
  503. /package/{Utils → publish/Utils}/formdata.d.ts +0 -0
  504. /package/{Utils → publish/Utils}/formdata.js +0 -0
  505. /package/{Utils → publish/Utils}/getElementProperty.d.ts +0 -0
  506. /package/{Utils → publish/Utils}/getElementProperty.js +0 -0
  507. /package/{Utils → publish/Utils}/guid.d.ts +0 -0
  508. /package/{Utils → publish/Utils}/guid.js +0 -0
  509. /package/{Utils → publish/Utils}/initDefaultOptions.d.ts +0 -0
  510. /package/{Utils → publish/Utils}/initDefaultOptions.js +0 -0
  511. /package/{Utils → publish/Utils}/inputsCalculation.d.ts +0 -0
  512. /package/{Utils → publish/Utils}/inputsCalculation.js +0 -0
  513. /package/{Utils → publish/Utils}/math.d.ts +0 -0
  514. /package/{Utils → publish/Utils}/math.js +0 -0
  515. /package/{Utils → publish/Utils}/object.d.ts +0 -0
  516. /package/{Utils → publish/Utils}/object.js +0 -0
  517. /package/{Utils → publish/Utils}/os.d.ts +0 -0
  518. /package/{Utils → publish/Utils}/os.js +0 -0
  519. /package/{Utils → publish/Utils}/performance.d.ts +0 -0
  520. /package/{Utils → publish/Utils}/performance.js +0 -0
  521. /package/{Utils → publish/Utils}/sanitize.d.ts +0 -0
  522. /package/{Utils → publish/Utils}/sanitize.js +0 -0
  523. /package/{Utils → publish/Utils}/time.d.ts +0 -0
  524. /package/{Utils → publish/Utils}/time.js +0 -0
  525. /package/{Utils → publish/Utils}/tree.d.ts +0 -0
  526. /package/{Utils → publish/Utils}/tree.js +0 -0
  527. /package/{Utils → publish/Utils}/useAutosizeTextArea.d.ts +0 -0
  528. /package/{Utils → publish/Utils}/useAutosizeTextArea.js +0 -0
  529. /package/{Utils → publish/Utils}/useBoundedDrag.d.ts +0 -0
  530. /package/{Utils → publish/Utils}/useBoundedDrag.js +0 -0
  531. /package/{Utils → publish/Utils}/useClickOutside.d.ts +0 -0
  532. /package/{Utils → publish/Utils}/useClickOutside.js +0 -0
  533. /package/{Utils → publish/Utils}/useComId.d.ts +0 -0
  534. /package/{Utils → publish/Utils}/useComId.js +0 -0
  535. /package/{Utils → publish/Utils}/useDebounce.d.ts +0 -0
  536. /package/{Utils → publish/Utils}/useDebounce.js +0 -0
  537. /package/{Utils → publish/Utils}/useDragDropPosition.d.ts +0 -0
  538. /package/{Utils → publish/Utils}/useDragDropPosition.js +0 -0
  539. /package/{Utils → publish/Utils}/useDraggable.d.ts +0 -0
  540. /package/{Utils → publish/Utils}/useDraggable.js +0 -0
  541. /package/{Utils → publish/Utils}/useHistoryTracker.d.ts +0 -0
  542. /package/{Utils → publish/Utils}/useHistoryTracker.js +0 -0
  543. /package/{Utils → publish/Utils}/useInterval.d.ts +0 -0
  544. /package/{Utils → publish/Utils}/useInterval.js +0 -0
  545. /package/{Utils → publish/Utils}/useIsMobile.d.ts +0 -0
  546. /package/{Utils → publish/Utils}/useIsMobile.js +0 -0
  547. /package/{Utils → publish/Utils}/useKeyPress.d.ts +0 -0
  548. /package/{Utils → publish/Utils}/useKeyPress.js +0 -0
  549. /package/{Utils → publish/Utils}/useSessionStorageListener.d.ts +0 -0
  550. /package/{Utils → publish/Utils}/useSessionStorageListener.js +0 -0
  551. /package/{Utils → publish/Utils}/useStreamController.d.ts +0 -0
  552. /package/{Utils → publish/Utils}/useStreamController.js +0 -0
  553. /package/{Utils → publish/Utils}/useThrottle.d.ts +0 -0
  554. /package/{Utils → publish/Utils}/useThrottle.js +0 -0
  555. /package/{Utils → publish/Utils}/useWindowScroll.d.ts +0 -0
  556. /package/{Utils → publish/Utils}/useWindowScroll.js +0 -0
  557. /package/{Utils → publish/Utils}/validate.d.ts +0 -0
  558. /package/{Utils → publish/Utils}/validate.js +0 -0
  559. /package/{Utils → publish/Utils}/viewport.d.ts +0 -0
  560. /package/{Utils → publish/Utils}/viewport.js +0 -0
  561. /package/{all.d.ts → publish/all.d.ts} +0 -0
  562. /package/{all.js → publish/all.js} +0 -0
@@ -0,0 +1,2311 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["RPB"] = factory(require("react"));
8
+ else
9
+ root["RPB"] = factory(root["React"]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
13
+
14
+ /***/ 188:
15
+ /***/ (function(module, exports, __webpack_require__) {
16
+
17
+ /* module decorator */ module = __webpack_require__.nmd(module);
18
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
19
+ (function webpackUniversalModuleDefinition(root, factory) {
20
+ if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
21
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
22
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
23
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
24
+ })(this, function () {
25
+ return (/******/function () {
26
+ // webpackBootstrap
27
+ /******/
28
+ "use strict";
29
+
30
+ /******/ // The require scope
31
+ /******/
32
+ var __nested_webpack_require_993__ = {};
33
+ /******/
34
+ /************************************************************************/
35
+ /******/ /* webpack/runtime/define property getters */
36
+ /******/
37
+ (function () {
38
+ /******/ // define getter functions for harmony exports
39
+ /******/__nested_webpack_require_993__.d = function (exports, definition) {
40
+ /******/for (var key in definition) {
41
+ /******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
42
+ /******/Object.defineProperty(exports, key, {
43
+ enumerable: true,
44
+ get: definition[key]
45
+ });
46
+ /******/
47
+ }
48
+ /******/
49
+ }
50
+ /******/
51
+ };
52
+ /******/
53
+ })();
54
+ /******/
55
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
56
+ /******/
57
+ (function () {
58
+ /******/__nested_webpack_require_993__.o = function (obj, prop) {
59
+ return Object.prototype.hasOwnProperty.call(obj, prop);
60
+ };
61
+ /******/
62
+ })();
63
+ /******/
64
+ /******/ /* webpack/runtime/make namespace object */
65
+ /******/
66
+ (function () {
67
+ /******/ // define __esModule on exports
68
+ /******/__nested_webpack_require_993__.r = function (exports) {
69
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
70
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
71
+ value: 'Module'
72
+ });
73
+ /******/
74
+ }
75
+ /******/
76
+ Object.defineProperty(exports, '__esModule', {
77
+ value: true
78
+ });
79
+ /******/
80
+ };
81
+ /******/
82
+ })();
83
+ /******/
84
+ /************************************************************************/
85
+ var __webpack_exports__ = {};
86
+ __nested_webpack_require_993__.r(__webpack_exports__);
87
+ /* harmony export */
88
+ __nested_webpack_require_993__.d(__webpack_exports__, {
89
+ /* harmony export */"clsWrite": function clsWrite() {
90
+ return (/* binding */_clsWrite
91
+ );
92
+ },
93
+ /* harmony export */"combinedCls": function combinedCls() {
94
+ return (/* binding */_combinedCls
95
+ );
96
+ }
97
+ /* harmony export */
98
+ });
99
+ function _slicedToArray(arr, i) {
100
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
101
+ }
102
+ function _nonIterableRest() {
103
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
104
+ }
105
+ function _unsupportedIterableToArray(o, minLen) {
106
+ if (!o) return;
107
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
108
+ var n = Object.prototype.toString.call(o).slice(8, -1);
109
+ if (n === "Object" && o.constructor) n = o.constructor.name;
110
+ if (n === "Map" || n === "Set") return Array.from(o);
111
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
112
+ }
113
+ function _arrayLikeToArray(arr, len) {
114
+ if (len == null || len > arr.length) len = arr.length;
115
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
116
+ return arr2;
117
+ }
118
+ function _iterableToArrayLimit(arr, i) {
119
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
120
+ if (null != _i) {
121
+ var _s,
122
+ _e,
123
+ _x,
124
+ _r,
125
+ _arr = [],
126
+ _n = !0,
127
+ _d = !1;
128
+ try {
129
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
130
+ if (Object(_i) !== _i) return;
131
+ _n = !1;
132
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
133
+ } catch (err) {
134
+ _d = !0, _e = err;
135
+ } finally {
136
+ try {
137
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
138
+ } finally {
139
+ if (_d) throw _e;
140
+ }
141
+ }
142
+ return _arr;
143
+ }
144
+ }
145
+ function _arrayWithHoles(arr) {
146
+ if (Array.isArray(arr)) return arr;
147
+ }
148
+ function _typeof(obj) {
149
+ "@babel/helpers - typeof";
150
+
151
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
152
+ return typeof obj;
153
+ } : function (obj) {
154
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
155
+ }, _typeof(obj);
156
+ }
157
+ /**
158
+ * Output of class name
159
+ * @param {*} s - Any
160
+ * @param {String} defaultCls - Default string
161
+ * @param {?*} targetCls - Any
162
+ * @returns {*}
163
+ */
164
+ function _clsWrite(s, defaultCls) {
165
+ var targetCls = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
166
+ return s || s === '' ? typeof targetCls === 'undefined' ? s : targetCls : defaultCls;
167
+ }
168
+
169
+ /**
170
+ * Combined classnames
171
+ * @param {*} args
172
+ * @returns {String|undefined}
173
+ */
174
+ /* Usage:
175
+
176
+ console.log(combinedCls('a-1', 'a-2', 'a-3', {
177
+ 'p-1': null,
178
+ 'p-2': undefined,
179
+ 'p-3': true,
180
+ 'p-4': false,
181
+ 'p-5': 'kkk',
182
+ 'p-6': 0,
183
+ 'p-7': 1,
184
+ 'p-8': '',
185
+ undefined
186
+ })); // a-1 a-2 a-3 p-3 p-5 p-7
187
+ */
188
+ function _combinedCls() {
189
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
190
+ args[_key] = arguments[_key];
191
+ }
192
+ if (args) {
193
+ var classes = [];
194
+ for (var i = 0; i < args.length; i++) {
195
+ var className = args[i];
196
+ if (!className) {
197
+ continue;
198
+ }
199
+ var type = _typeof(className);
200
+ if (type === 'string' || type === 'number') {
201
+ classes.push(className);
202
+ } else if (type === 'object') {
203
+ var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
204
+ var _ref2 = _slicedToArray(_ref, 2),
205
+ key = _ref2[0],
206
+ value = _ref2[1];
207
+ return value ? key : null;
208
+ });
209
+ classes = _classes.length ? classes.concat(_classes.filter(function (c) {
210
+ return !!c;
211
+ })) : classes;
212
+ }
213
+ }
214
+ return classes.join(' ').trim();
215
+ }
216
+ return undefined;
217
+ }
218
+
219
+ /******/
220
+ return __webpack_exports__;
221
+ /******/
222
+ }()
223
+ );
224
+ });
225
+
226
+ /***/ }),
227
+
228
+ /***/ 85:
229
+ /***/ (function(module, exports, __webpack_require__) {
230
+
231
+ /* module decorator */ module = __webpack_require__.nmd(module);
232
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
233
+ (function webpackUniversalModuleDefinition(root, factory) {
234
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
235
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
236
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
237
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
238
+ })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
239
+ return (/******/function () {
240
+ // webpackBootstrap
241
+ /******/
242
+ "use strict";
243
+
244
+ /******/
245
+ var __webpack_modules__ = {
246
+ /***/787: /***/function _(module) {
247
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
248
+
249
+ /***/
250
+ }
251
+
252
+ /******/
253
+ };
254
+ /************************************************************************/
255
+ /******/ // The module cache
256
+ /******/
257
+ var __webpack_module_cache__ = {};
258
+ /******/
259
+ /******/ // The require function
260
+ /******/
261
+ function __nested_webpack_require_1465__(moduleId) {
262
+ /******/ // Check if module is in cache
263
+ /******/var cachedModule = __webpack_module_cache__[moduleId];
264
+ /******/
265
+ if (cachedModule !== undefined) {
266
+ /******/return cachedModule.exports;
267
+ /******/
268
+ }
269
+ /******/ // Create a new module (and put it into the cache)
270
+ /******/
271
+ var module = __webpack_module_cache__[moduleId] = {
272
+ /******/ // no module.id needed
273
+ /******/ // no module.loaded needed
274
+ /******/exports: {}
275
+ /******/
276
+ };
277
+ /******/
278
+ /******/ // Execute the module function
279
+ /******/
280
+ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
281
+ /******/
282
+ /******/ // Return the exports of the module
283
+ /******/
284
+ return module.exports;
285
+ /******/
286
+ }
287
+ /******/
288
+ /************************************************************************/
289
+ /******/ /* webpack/runtime/compat get default export */
290
+ /******/
291
+ (function () {
292
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
293
+ /******/__nested_webpack_require_1465__.n = function (module) {
294
+ /******/var getter = module && module.__esModule ? /******/function () {
295
+ return module['default'];
296
+ } : /******/function () {
297
+ return module;
298
+ };
299
+ /******/
300
+ __nested_webpack_require_1465__.d(getter, {
301
+ a: getter
302
+ });
303
+ /******/
304
+ return getter;
305
+ /******/
306
+ };
307
+ /******/
308
+ })();
309
+ /******/
310
+ /******/ /* webpack/runtime/define property getters */
311
+ /******/
312
+ (function () {
313
+ /******/ // define getter functions for harmony exports
314
+ /******/__nested_webpack_require_1465__.d = function (exports, definition) {
315
+ /******/for (var key in definition) {
316
+ /******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
317
+ /******/Object.defineProperty(exports, key, {
318
+ enumerable: true,
319
+ get: definition[key]
320
+ });
321
+ /******/
322
+ }
323
+ /******/
324
+ }
325
+ /******/
326
+ };
327
+ /******/
328
+ })();
329
+ /******/
330
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
331
+ /******/
332
+ (function () {
333
+ /******/__nested_webpack_require_1465__.o = function (obj, prop) {
334
+ return Object.prototype.hasOwnProperty.call(obj, prop);
335
+ };
336
+ /******/
337
+ })();
338
+ /******/
339
+ /******/ /* webpack/runtime/make namespace object */
340
+ /******/
341
+ (function () {
342
+ /******/ // define __esModule on exports
343
+ /******/__nested_webpack_require_1465__.r = function (exports) {
344
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
345
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
346
+ value: 'Module'
347
+ });
348
+ /******/
349
+ }
350
+ /******/
351
+ Object.defineProperty(exports, '__esModule', {
352
+ value: true
353
+ });
354
+ /******/
355
+ };
356
+ /******/
357
+ })();
358
+ /******/
359
+ /************************************************************************/
360
+ var __webpack_exports__ = {};
361
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
362
+ (function () {
363
+ __nested_webpack_require_1465__.r(__webpack_exports__);
364
+ /* harmony export */
365
+ __nested_webpack_require_1465__.d(__webpack_exports__, {
366
+ /* harmony export */"default": function _default() {
367
+ return __WEBPACK_DEFAULT_EXPORT__;
368
+ }
369
+ /* harmony export */
370
+ });
371
+ /* harmony import */
372
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
373
+ /* harmony import */
374
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
375
+ /**
376
+ * Create an available ID
377
+ *
378
+ */
379
+
380
+ var useComId = function useComId() {
381
+ return "ID-".concat((0, react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-"));
382
+ };
383
+ /* harmony default export */
384
+ var __WEBPACK_DEFAULT_EXPORT__ = useComId;
385
+ })();
386
+
387
+ /******/
388
+ return __webpack_exports__;
389
+ /******/
390
+ }()
391
+ );
392
+ });
393
+
394
+ /***/ }),
395
+
396
+ /***/ 787:
397
+ /***/ ((module) => {
398
+
399
+ "use strict";
400
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
401
+
402
+ /***/ })
403
+
404
+ /******/ });
405
+ /************************************************************************/
406
+ /******/ // The module cache
407
+ /******/ var __webpack_module_cache__ = {};
408
+ /******/
409
+ /******/ // The require function
410
+ /******/ function __webpack_require__(moduleId) {
411
+ /******/ // Check if module is in cache
412
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
413
+ /******/ if (cachedModule !== undefined) {
414
+ /******/ return cachedModule.exports;
415
+ /******/ }
416
+ /******/ // Create a new module (and put it into the cache)
417
+ /******/ var module = __webpack_module_cache__[moduleId] = {
418
+ /******/ id: moduleId,
419
+ /******/ loaded: false,
420
+ /******/ exports: {}
421
+ /******/ };
422
+ /******/
423
+ /******/ // Execute the module function
424
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
425
+ /******/
426
+ /******/ // Flag the module as loaded
427
+ /******/ module.loaded = true;
428
+ /******/
429
+ /******/ // Return the exports of the module
430
+ /******/ return module.exports;
431
+ /******/ }
432
+ /******/
433
+ /************************************************************************/
434
+ /******/ /* webpack/runtime/compat get default export */
435
+ /******/ (() => {
436
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
437
+ /******/ __webpack_require__.n = (module) => {
438
+ /******/ var getter = module && module.__esModule ?
439
+ /******/ () => (module['default']) :
440
+ /******/ () => (module);
441
+ /******/ __webpack_require__.d(getter, { a: getter });
442
+ /******/ return getter;
443
+ /******/ };
444
+ /******/ })();
445
+ /******/
446
+ /******/ /* webpack/runtime/define property getters */
447
+ /******/ (() => {
448
+ /******/ // define getter functions for harmony exports
449
+ /******/ __webpack_require__.d = (exports, definition) => {
450
+ /******/ for(var key in definition) {
451
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
452
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
453
+ /******/ }
454
+ /******/ }
455
+ /******/ };
456
+ /******/ })();
457
+ /******/
458
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
459
+ /******/ (() => {
460
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
461
+ /******/ })();
462
+ /******/
463
+ /******/ /* webpack/runtime/make namespace object */
464
+ /******/ (() => {
465
+ /******/ // define __esModule on exports
466
+ /******/ __webpack_require__.r = (exports) => {
467
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
468
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
469
+ /******/ }
470
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
471
+ /******/ };
472
+ /******/ })();
473
+ /******/
474
+ /******/ /* webpack/runtime/node module decorator */
475
+ /******/ (() => {
476
+ /******/ __webpack_require__.nmd = (module) => {
477
+ /******/ module.paths = [];
478
+ /******/ if (!module.children) module.children = [];
479
+ /******/ return module;
480
+ /******/ };
481
+ /******/ })();
482
+ /******/
483
+ /************************************************************************/
484
+ var __webpack_exports__ = {};
485
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
486
+ (() => {
487
+ "use strict";
488
+ // ESM COMPAT FLAG
489
+ __webpack_require__.r(__webpack_exports__);
490
+
491
+ // EXPORTS
492
+ __webpack_require__.d(__webpack_exports__, {
493
+ "DragHandleSprite": () => (/* reexport */ utils_DragHandleSprite),
494
+ "SortSprite": () => (/* reexport */ utils_SortSprite),
495
+ "Table": () => (/* reexport */ src_Table),
496
+ "TableBody": () => (/* reexport */ src_TableBody),
497
+ "TableCaption": () => (/* reexport */ src_TableCaption),
498
+ "TableCell": () => (/* reexport */ src_TableCell),
499
+ "TableColgroup": () => (/* reexport */ src_TableColgroup),
500
+ "TableFilter": () => (/* reexport */ utils_TableFilter),
501
+ "TableFoot": () => (/* reexport */ src_TableFoot),
502
+ "TableHead": () => (/* reexport */ src_TableHead),
503
+ "TableRow": () => (/* reexport */ src_TableRow),
504
+ "ToggleSelection": () => (/* reexport */ utils_ToggleSelection)
505
+ });
506
+
507
+ // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
508
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
509
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
510
+ // EXTERNAL MODULE: ../Utils/dist/cjs/useComId.js
511
+ var useComId = __webpack_require__(85);
512
+ var useComId_default = /*#__PURE__*/__webpack_require__.n(useComId);
513
+ // EXTERNAL MODULE: ../Utils/dist/cjs/cls.js
514
+ var cls = __webpack_require__(188);
515
+ ;// CONCATENATED MODULE: ./src/TableContext.tsx
516
+
517
+ var TableContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)(undefined);
518
+ var TableProvider = function TableProvider(props) {
519
+ var children = props.children,
520
+ value = props.value;
521
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TableContext.Provider, {
522
+ value: value
523
+ }, children);
524
+ };
525
+
526
+ ;// CONCATENATED MODULE: ./src/utils/func.ts
527
+ function convertMapToArr(setData) {
528
+ var res = [];
529
+ var s = setData;
530
+ for (var it = s.values(), val = null; val = it.next().value;) {
531
+ res.push(val);
532
+ }
533
+ return res;
534
+ }
535
+ function htmlToPlain(input) {
536
+ return input.replace(/(<([^>]+)>)/ig, '');
537
+ }
538
+ function sortDataByIndex(orderArr, data) {
539
+ return Array.isArray(data) ? orderArr.map(function (index) {
540
+ return data[index];
541
+ }) : data;
542
+ }
543
+ function getTbody(root) {
544
+ if (root === null) return null;
545
+ var tbodyRef = root.querySelector('table tbody');
546
+ return tbodyRef;
547
+ }
548
+ function getThead(root) {
549
+ if (root === null) return null;
550
+ var tbodyRef = root.querySelector('table thead');
551
+ return tbodyRef;
552
+ }
553
+ function allRows(root) {
554
+ var tbodyRef = getTbody(root);
555
+ if (tbodyRef === null) return [];
556
+ return [].slice.call(tbodyRef.children);
557
+ }
558
+ function allHeadRows(root) {
559
+ var tbodyRef = getThead(root);
560
+ if (tbodyRef === null) return [];
561
+ return [].slice.call(tbodyRef.children);
562
+ }
563
+ function initOrderProps(rootElem) {
564
+ if (rootElem === null) return;
565
+
566
+ // !!! Execute it only once
567
+ if (typeof rootElem.dataset.customPropsInit !== 'undefined') return;
568
+ rootElem.dataset.customPropsInit = 1;
569
+ var _allRows = allRows(rootElem);
570
+
571
+ // key
572
+ _allRows.forEach(function (node, i) {
573
+ node.dataset.order = "".concat(i);
574
+ });
575
+ }
576
+ function initRowColProps(rootElem) {
577
+ if (rootElem === null) return;
578
+ var _allRows = allRows(rootElem);
579
+ var _allHeadRows = allHeadRows(rootElem);
580
+
581
+ // key
582
+ _allRows.forEach(function (node, i) {
583
+ node.dataset.tableRow = "".concat(i);
584
+
585
+ // columns
586
+ var perCol = [].slice.call(node.children);
587
+ perCol.forEach(function (col, j) {
588
+ col.dataset.tableRow = "".concat(i);
589
+ col.dataset.tableCol = "".concat(j);
590
+ col.classList.add(cellMark(i, j));
591
+ });
592
+ });
593
+ _allHeadRows.forEach(function (node, i) {
594
+ node.dataset.tableRow = "-1";
595
+
596
+ // columns
597
+ var perCol = [].slice.call(node.children);
598
+ perCol.forEach(function (col, j) {
599
+ col.dataset.tableRow = "-1";
600
+ col.dataset.tableCol = "".concat(j);
601
+ col.classList.add(cellMark(-1, j));
602
+ });
603
+ });
604
+ }
605
+ function insertAfter(newNode, existingNode) {
606
+ existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
607
+ }
608
+ function maxDimension(elements) {
609
+ var res = {
610
+ 'height': 0,
611
+ 'width': 0
612
+ };
613
+ var elementHeights = Array.prototype.map.call(elements, function (el) {
614
+ return el.clientHeight;
615
+ });
616
+ var elementWidths = Array.prototype.map.call(elements, function (el) {
617
+ return el.clientWidth;
618
+ });
619
+ var maxHeight = Math.max.apply(null, elementHeights);
620
+ var maxWidth = Math.max.apply(null, elementWidths);
621
+ res = {
622
+ 'height': maxHeight,
623
+ 'width': maxWidth
624
+ };
625
+ return res;
626
+ }
627
+ ;
628
+ function tableElemScrolledInit(root, w) {
629
+ var tbodyRef = getTbody(root);
630
+ if (tbodyRef === null) return;
631
+ if (w <= 768 && tbodyRef.querySelector('tr') !== null) {
632
+ var _loop = function _loop() {
633
+ var tbodyRows = root.querySelectorAll("tbody tr [data-table-col=\"".concat(i, "\"]"));
634
+ var maxHeight = maxDimension(tbodyRows).height;
635
+ if (maxHeight > 0) {
636
+ [].slice.call(tbodyRows).forEach(function (row) {
637
+ row.style.height = maxHeight + 'px';
638
+ });
639
+
640
+ //
641
+ var theadRows = root.querySelectorAll("thead tr [data-table-col=\"".concat(i, "\"]"));
642
+ [].slice.call(theadRows).forEach(function (row) {
643
+ row.style.height = maxHeight + 'px';
644
+ });
645
+ }
646
+ };
647
+ //get maxHeight of per row
648
+ for (var i = 0; i < tbodyRef.querySelector('tr').children.length; i++) {
649
+ _loop();
650
+ }
651
+ } else {
652
+ [].slice.call(root.querySelectorAll('tbody td, tbody th, thead th')).forEach(function (node, i) {
653
+ node.style.removeProperty('height');
654
+ });
655
+ }
656
+ }
657
+ function cellMark(row, col) {
658
+ var isNegative = function isNegative(num) {
659
+ return num < 0;
660
+ };
661
+ return "cell-".concat(isNegative(row) ? 0 : row, "-").concat(isNegative(col) ? 0 : col);
662
+ }
663
+ function removeCellFocusClassName(root) {
664
+ if (root) {
665
+ [].slice.call(root.querySelectorAll('td, th')).forEach(function (el) {
666
+ el.classList.remove('cell-focus');
667
+ });
668
+ }
669
+ }
670
+ function getTableRowsColCount(root) {
671
+ var rows = allRows(root);
672
+ return rows.map(function (row, i) {
673
+ return {
674
+ row: i,
675
+ colCount: row.children.length
676
+ };
677
+ });
678
+ }
679
+ ;// CONCATENATED MODULE: ./src/utils/hooks/useTableResponsive.tsx
680
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
681
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
682
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
683
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
684
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
685
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
686
+ /**
687
+ * Handles the event of responsive table
688
+ *
689
+ * @usage:
690
+
691
+ const App = () => {
692
+
693
+ const responsiveTable = true;
694
+ const rootRef = useRef<any>(null);
695
+
696
+ useTableResponsive({
697
+ enabled: responsiveTable && rootRef.current,
698
+ spyElement: rootRef.current
699
+ }, [rootRef]);
700
+
701
+ return (
702
+ <div
703
+ ref={rootRef}
704
+ >Test</div>
705
+ );
706
+ };
707
+
708
+ */
709
+
710
+
711
+
712
+ function useTableResponsive(_ref, deps) {
713
+ var enabled = _ref.enabled,
714
+ spyElement = _ref.spyElement;
715
+ var debounce = function debounce(fn) {
716
+ var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
717
+ var timer;
718
+ return function () {
719
+ clearTimeout(timer);
720
+ timer = setTimeout(function () {
721
+ fn.apply(this, arguments);
722
+ }, limit);
723
+ };
724
+ };
725
+ var windowResizeUpdate = debounce(handleWindowUpdate, 50);
726
+ var windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0;
727
+ function handleWindowUpdate() {
728
+ // Check window width has actually changed and it's not just iOS triggering a resize event on scroll
729
+ if (window.innerWidth != windowWidth) {
730
+ // Update the window width for next time
731
+ windowWidth = window.innerWidth;
732
+
733
+ // Do stuff here
734
+ tableElemScrolledInit(spyElement, windowWidth);
735
+ }
736
+ }
737
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
738
+ if (enabled) {
739
+ // Initialize custom props of table elements
740
+ initOrderProps(spyElement);
741
+ initRowColProps(spyElement);
742
+
743
+ // With scroll bars
744
+ var _windowWidth = window.innerWidth;
745
+ tableElemScrolledInit(spyElement, _windowWidth);
746
+
747
+ // Add function to the element that should be used as the scrollable area.
748
+ window.removeEventListener('resize', windowResizeUpdate);
749
+ window.addEventListener('resize', windowResizeUpdate);
750
+
751
+ // Remove the global list of events, especially as scroll and interval.
752
+ return function () {
753
+ window.removeEventListener('resize', windowResizeUpdate);
754
+ };
755
+ }
756
+ }, [enabled, spyElement].concat(_toConsumableArray(deps)));
757
+ }
758
+ /* harmony default export */ const hooks_useTableResponsive = (useTableResponsive);
759
+ ;// CONCATENATED MODULE: ./src/utils/hooks/useTableDraggable.tsx
760
+ function useTableDraggable_toConsumableArray(arr) { return useTableDraggable_arrayWithoutHoles(arr) || useTableDraggable_iterableToArray(arr) || useTableDraggable_unsupportedIterableToArray(arr) || useTableDraggable_nonIterableSpread(); }
761
+ function useTableDraggable_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
762
+ function useTableDraggable_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
763
+ function useTableDraggable_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableDraggable_arrayLikeToArray(arr); }
764
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || useTableDraggable_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
765
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
766
+ function useTableDraggable_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useTableDraggable_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useTableDraggable_arrayLikeToArray(o, minLen); }
767
+ function useTableDraggable_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
768
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
769
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
770
+ /**
771
+ * Handles the event of drag-and-drop sorting
772
+ *
773
+ * @usage:
774
+
775
+ const App = () => {
776
+
777
+ const rowDraggable = true;
778
+ const data = [{a: 1}, {b: 2}]
779
+ const rootRef = useRef<any>(null);
780
+
781
+ const {
782
+ handleDragStart,
783
+ handleDragEnd,
784
+ handledragOver,
785
+ handleTbodyEnter
786
+ } = useTableDraggable({
787
+ enabled: rowDraggable && spyElement,
788
+ data: data,
789
+ spyElement: spyElement
790
+ onRowDrag: (dragStart: any, dragEnd: any) => void(0)
791
+ }, [data, rootRef]);
792
+
793
+ return (
794
+ <div
795
+ ref={rootRef}
796
+ >Test</div>
797
+ );
798
+
799
+ };
800
+
801
+ */
802
+
803
+
804
+
805
+ function useTableDraggable(_ref, deps) {
806
+ var enabled = _ref.enabled,
807
+ data = _ref.data,
808
+ spyElement = _ref.spyElement,
809
+ onRowDrag = _ref.onRowDrag;
810
+ // drag & drop
811
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
812
+ _useState2 = _slicedToArray(_useState, 2),
813
+ sortData = _useState2[0],
814
+ setSortData = _useState2[1];
815
+
816
+ // ================================================================
817
+ // drag & drop
818
+ // ================================================================
819
+ var draggedObj = null;
820
+ var overObj = null;
821
+ var placeholderGenerator = function placeholderGenerator(trHeight) {
822
+ var tbodyRef = getTbody(spyElement);
823
+ if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
824
+
825
+ // Insert a row at the "index" of the table
826
+ var newRow = document.createElement('tr');
827
+ newRow.className = 'row-placeholder';
828
+ newRow.dataset.placeholder = 'true';
829
+ newRow.style.height = trHeight + 'px';
830
+
831
+ // Insert a cell in the row at index
832
+ var newCell = newRow.insertCell(0);
833
+ newCell.colSpan = tbodyRef.querySelector('tr').children.length;
834
+
835
+ // Append a text node to the cell
836
+ var newText = document.createTextNode(' ');
837
+ newCell.appendChild(newText);
838
+ return newRow;
839
+ };
840
+ var lastRowGenerator = function lastRowGenerator(trHeight) {
841
+ var tbodyRef = getTbody(spyElement);
842
+ if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
843
+ var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
844
+ if (cloneEl !== null) return;
845
+
846
+ // Insert a row at the "index" of the table
847
+ var newRow = document.createElement('tr');
848
+ newRow.className = 'row-obj row-obj-clonelast';
849
+ newRow.dataset.order = allRows(spyElement).length.toString();
850
+ newRow.style.height = trHeight + 'px';
851
+ newRow.style.display = 'none';
852
+
853
+ // Insert a cell in the row at index
854
+ var newCell = newRow.insertCell(0);
855
+ newCell.colSpan = tbodyRef.querySelector('tr').children.length;
856
+
857
+ // Append a text node to the cell
858
+ var newText = document.createTextNode(' ');
859
+ newCell.appendChild(newText);
860
+ return newRow;
861
+ };
862
+ var removePlaceholder = function removePlaceholder() {
863
+ var tbodyRef = getTbody(spyElement);
864
+ if (tbodyRef === null) return;
865
+
866
+ // Delete row at the "index" of the table
867
+ var placeholder = [].slice.call(tbodyRef.querySelectorAll("[data-placeholder]"));
868
+ placeholder.forEach(function (node) {
869
+ tbodyRef.removeChild(node);
870
+ });
871
+ };
872
+
873
+ // Initialize drag & drop data
874
+ // !!! Execute it only once
875
+ var initDragDropData = function initDragDropData() {
876
+ if (spyElement === null) return;
877
+ if (typeof spyElement.dataset.dragdropDataInit !== 'undefined') return;
878
+ spyElement.dataset.dragdropDataInit = 1;
879
+ var _allRows = allRows(spyElement);
880
+
881
+ // sort list data
882
+ var listIndexes = _allRows.map(function (node, i) {
883
+ return i;
884
+ });
885
+ setSortData(listIndexes);
886
+
887
+ //last placeholder
888
+ if (_allRows.length > 0) {
889
+ var lastEl = lastRowGenerator(_allRows.at(-1).clientHeight);
890
+ if (typeof _allRows.at(-1) !== 'undefined') {
891
+ insertAfter(lastEl, _allRows.at(-1));
892
+ }
893
+ }
894
+ };
895
+ var handleTbodyEnter = function handleTbodyEnter(e) {
896
+ var _table = e.currentTarget.closest('table');
897
+ if (_table === null) return;
898
+ _table.querySelector('tbody').classList.add('drag-trigger-mousedown');
899
+ };
900
+ var handleTbodyLeave = function handleTbodyLeave(e) {
901
+ var tbodyRef = getTbody(spyElement);
902
+ if (tbodyRef === null) return;
903
+ tbodyRef === null || tbodyRef === void 0 ? void 0 : tbodyRef.classList.remove('drag-trigger-mousedown');
904
+ };
905
+
906
+ // events fired on the drop targets
907
+ var handledragOver = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
908
+ var tbodyRef = getTbody(spyElement);
909
+ if (tbodyRef === null) return;
910
+ e.preventDefault();
911
+ if (draggedObj === null) return;
912
+ draggedObj.style.display = 'none';
913
+ if (e.target.classList.contains('row-placeholder')) return;
914
+ var itemsWrapper = e.target.parentNode;
915
+ if (itemsWrapper.classList.contains('row-obj')) {
916
+ overObj = itemsWrapper;
917
+ removePlaceholder();
918
+ if (Number(overObj.dataset.order) === allRows(spyElement).length - 1) {
919
+ tbodyRef.insertBefore(placeholderGenerator(allRows(spyElement).at(-2).clientHeight), overObj);
920
+ } else {
921
+ tbodyRef.insertBefore(placeholderGenerator(overObj.clientHeight), overObj);
922
+ }
923
+ }
924
+ }, [sortData]);
925
+ var handleDragStart = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
926
+ var tbodyRef = getTbody(spyElement);
927
+ if (tbodyRef === null) return;
928
+ draggedObj = e.currentTarget;
929
+ e.dataTransfer.effectAllowed = 'move';
930
+ e.dataTransfer.setData('text/html', draggedObj);
931
+ draggedObj.classList.add('dragging');
932
+ allRows(spyElement).at(-1).style.setProperty('display', 'table-row', "important");
933
+
934
+ // callback
935
+ var dragStart = function dragStart(callback) {
936
+ callback.call(null, draggedObj, sortData, sortDataByIndex(sortData, data));
937
+ };
938
+ onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(dragStart, null);
939
+
940
+ // init clone <tr>
941
+ // !!! It needs to be put at the end of the code to fix the location of the clone element
942
+ var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
943
+ if (cloneEl !== null) {
944
+ cloneEl.style.display = 'none';
945
+ }
946
+ }, [handledragOver]);
947
+ var handleDragEnd = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
948
+ var tbodyRef = getTbody(spyElement);
949
+ if (tbodyRef === null) return;
950
+ draggedObj.style.display = 'table-row';
951
+ removePlaceholder();
952
+ draggedObj.classList.remove('dragging');
953
+ tbodyRef === null || tbodyRef === void 0 ? void 0 : tbodyRef.classList.remove('drag-trigger-mousedown');
954
+ if (overObj === null) return;
955
+
956
+ // update state
957
+ var curData = [];
958
+ curData = JSON.parse(JSON.stringify(sortData));
959
+ var from = Number(draggedObj.dataset.order);
960
+ var to = Number(overObj.dataset.order);
961
+ if (from < to) to--;
962
+
963
+ //sort data
964
+ var newData = [];
965
+
966
+ // console.log('--> data1:', curData);
967
+
968
+ curData.splice(to, 0, curData.splice(from, 1)[0]);
969
+ for (var i = 0; i < curData.length; i++) {
970
+ for (var j = 0; j < curData.length; j++) {
971
+ if (curData[i] === curData[j]) {
972
+ newData.push(curData[j]);
973
+ }
974
+ }
975
+ }
976
+
977
+ // console.log("--> data2: ", newData);
978
+ setSortData(newData);
979
+
980
+ // reset data-id in order to sort data
981
+ newData.forEach(function (curId, order) {
982
+ var _el = spyElement.querySelector('table').querySelector("tbody [data-key=\"row-".concat(curId, "\"]"));
983
+ if (_el !== null) _el.dataset.order = order;
984
+ });
985
+
986
+ // sort elements
987
+ var categoryItemsArray = allRows(spyElement);
988
+ var sorter = function sorter(a, b) {
989
+ var txt1 = Number(a.dataset.order),
990
+ txt2 = Number(b.dataset.order);
991
+ return txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
992
+ };
993
+ var sorted = categoryItemsArray.sort(sorter).reverse();
994
+ sorted.forEach(function (e) {
995
+ return spyElement.querySelector('table').querySelector('tbody').appendChild(e);
996
+ });
997
+
998
+ // callback
999
+ var dragEnd = function dragEnd(callback) {
1000
+ callback.call(null, draggedObj, newData, sortDataByIndex(newData, data));
1001
+ };
1002
+ onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(null, dragEnd);
1003
+
1004
+ // init clone <tr>
1005
+ // !!! It needs to be put at the end of the code to fix the location of the clone element
1006
+ var _allRows = allRows(spyElement);
1007
+ var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
1008
+ if (cloneEl !== null) {
1009
+ if (typeof _allRows.at(-1) !== 'undefined') {
1010
+ insertAfter(cloneEl, _allRows.at(-1));
1011
+ cloneEl.style.display = 'none';
1012
+ }
1013
+ }
1014
+ }, [sortData]);
1015
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1016
+ if (enabled) {
1017
+ if (Array.isArray(data) && data.length > 0) {
1018
+ // !!! REQUIRED "data.length > 0" to avoid data-order cannot be assigned when asynchronous data is empty
1019
+ data.forEach(function (item, i) {
1020
+ item.order = i;
1021
+ });
1022
+
1023
+ // Initialize custom props of table elements
1024
+ initOrderProps(spyElement);
1025
+ initRowColProps(spyElement);
1026
+
1027
+ // Initialize drag & drop data
1028
+ initDragDropData();
1029
+ }
1030
+ }
1031
+ }, [data, enabled, spyElement].concat(useTableDraggable_toConsumableArray(deps)));
1032
+ return {
1033
+ handleDragStart: handleDragStart,
1034
+ handleDragEnd: handleDragEnd,
1035
+ handledragOver: handledragOver,
1036
+ handleTbodyEnter: handleTbodyEnter,
1037
+ handleTbodyLeave: handleTbodyLeave
1038
+ };
1039
+ }
1040
+ /* harmony default export */ const hooks_useTableDraggable = (useTableDraggable);
1041
+ ;// CONCATENATED MODULE: ./src/utils/hooks/useTableKeyPress.tsx
1042
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1043
+ function useTableKeyPress_toConsumableArray(arr) { return useTableKeyPress_arrayWithoutHoles(arr) || useTableKeyPress_iterableToArray(arr) || useTableKeyPress_unsupportedIterableToArray(arr) || useTableKeyPress_nonIterableSpread(); }
1044
+ function useTableKeyPress_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1045
+ function useTableKeyPress_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useTableKeyPress_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useTableKeyPress_arrayLikeToArray(o, minLen); }
1046
+ function useTableKeyPress_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1047
+ function useTableKeyPress_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableKeyPress_arrayLikeToArray(arr); }
1048
+ function useTableKeyPress_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
1049
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
1050
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
1051
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
1052
+ /**
1053
+ * Listens for changes in the pressed state of a given key
1054
+ *
1055
+ * @usage:
1056
+ *
1057
+ const App = () => {
1058
+ const keyboardFocusable = true;
1059
+ const rootRef = useRef<any>(null);
1060
+ // Effective element movement on keystroke
1061
+
1062
+ const refNode = useRef(new Map<string, HTMLTableElement>());
1063
+ const [focusableCellId, setFocusableCellId] = useState<string>('');
1064
+
1065
+ // Count the number of columns per row
1066
+ const rootDataInfo = {"totalRow":2,"totalCol":[{"row":0,"colCount":6},{"row":1,"colCount":6},{"row":2,"colCount":6}]};
1067
+
1068
+ // Example: handle cell key press with edge detection
1069
+ const handleCellKeyPressed = (
1070
+ classname: string,
1071
+ elem: HTMLTableCellElement,
1072
+ event: React.KeyboardEvent<Element>,
1073
+ isLeftEdge: boolean,
1074
+ isRightEdge: boolean,
1075
+ isTopEdge: boolean,
1076
+ isBottomEdge: boolean
1077
+ ) => {
1078
+ if (isLeftEdge) {
1079
+ // Handle when at the leftmost cell
1080
+ }
1081
+ if (isRightEdge) {
1082
+ // Handle when at the rightmost cell
1083
+ }
1084
+ if (isTopEdge) {
1085
+ // Handle when at the topmost cell
1086
+ }
1087
+ if (isBottomEdge) {
1088
+ // Handle when at the bottommost cell
1089
+ }
1090
+ // Your business logic here
1091
+ };
1092
+
1093
+ const { handleKeyPressed } = useTableKeyPress({
1094
+ enabled: keyboardFocusable,
1095
+ data: [{ a: 1, b: 2, c: 3 }],
1096
+ spyElement: rootRef.current,
1097
+ rootDataInfo,
1098
+ refNode,
1099
+ focusableCellId,
1100
+ setFocusableCellId,
1101
+ onCellKeyPressed: handleCellKeyPressed,
1102
+ onCellPressEnter: () => {},
1103
+ }, [rootRef]);
1104
+
1105
+ return (
1106
+ <div
1107
+ ref={rootRef}
1108
+ tabIndex={-1}
1109
+ onKeyDown={handleKeyPressed} // require "tabIndex" attribute
1110
+ >Test</div>
1111
+ );
1112
+ };
1113
+ */
1114
+
1115
+
1116
+ var useTableKeyPress = function useTableKeyPress(_ref, deps) {
1117
+ var enabled = _ref.enabled,
1118
+ data = _ref.data,
1119
+ spyElement = _ref.spyElement,
1120
+ rootDataInfo = _ref.rootDataInfo,
1121
+ refNode = _ref.refNode,
1122
+ focusableCellId = _ref.focusableCellId,
1123
+ setFocusableCellId = _ref.setFocusableCellId,
1124
+ onCellKeyPressed = _ref.onCellKeyPressed,
1125
+ onCellPressEnter = _ref.onCellPressEnter,
1126
+ onKeyDown = _ref.onKeyDown;
1127
+ var focusableCellIdRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(focusableCellId);
1128
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1129
+ focusableCellIdRef.current = focusableCellId;
1130
+ }, [focusableCellId]);
1131
+ var handleKeyPressed = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)( /*#__PURE__*/function () {
1132
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
1133
+ var _focusableCellIdRef$c;
1134
+ var key, isNumLockOn, currentCell, row, col, nextCellSignal, oldCellSignal, _row, _col, move, _nextCellSignal;
1135
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1136
+ while (1) switch (_context.prev = _context.next) {
1137
+ case 0:
1138
+ key = event.code;
1139
+ isNumLockOn = event.getModifierState && event.getModifierState('NumLock'); // If Enter is pressed and keyboard navigation is disabled, just trigger onCellPressEnter
1140
+ if (!((key === 'Enter' || key === 'NumpadEnter') && !enabled)) {
1141
+ _context.next = 9;
1142
+ break;
1143
+ }
1144
+ currentCell = event.target;
1145
+ row = Number(currentCell.getAttribute('data-table-row'));
1146
+ col = Number(currentCell.getAttribute('data-table-col'));
1147
+ nextCellSignal = cellMark(row, col);
1148
+ onCellPressEnter === null || onCellPressEnter === void 0 ? void 0 : onCellPressEnter(nextCellSignal, refNode.current.get(nextCellSignal), event);
1149
+ return _context.abrupt("return");
1150
+ case 9:
1151
+ if (!(!Array.isArray(data) || rootDataInfo === null || spyElement === null || typeof enabled === 'undefined' || enabled === false)) {
1152
+ _context.next = 11;
1153
+ break;
1154
+ }
1155
+ return _context.abrupt("return");
1156
+ case 11:
1157
+ // Parse the current focused cell's row and column
1158
+ oldCellSignal = (_focusableCellIdRef$c = focusableCellIdRef.current) === null || _focusableCellIdRef$c === void 0 ? void 0 : _focusableCellIdRef$c.replace('cell-', '').split('-');
1159
+ _row = Number(oldCellSignal[0]);
1160
+ _col = Number(oldCellSignal[1]); // Move function to handle arrow key navigation
1161
+ move = function move(key) {
1162
+ var isLeftEdge = false;
1163
+ var isRightEdge = false;
1164
+ var isTopEdge = false;
1165
+ var isBottomEdge = false;
1166
+ var maxCol = 0;
1167
+ if (rootDataInfo && Array.isArray(rootDataInfo.totalCol)) {
1168
+ var rowInfo = rootDataInfo.totalCol.find(function (r) {
1169
+ return r.row === _row;
1170
+ });
1171
+ if (rowInfo) {
1172
+ maxCol = rowInfo.colCount;
1173
+ }
1174
+ }
1175
+
1176
+ // Numpad2/4/6/8 trigger direction is allowed only when NumLock is off
1177
+ if (key === 'ArrowLeft' || key === 'Numpad4' && !isNumLockOn) {
1178
+ if (_col - 1 < 0) {
1179
+ isLeftEdge = true;
1180
+ _col = 0;
1181
+ } else {
1182
+ _col = _col - 1;
1183
+ }
1184
+ }
1185
+ if (key === 'ArrowRight' || key === 'Numpad6' && !isNumLockOn) {
1186
+ if (_col + 1 > maxCol - 1) {
1187
+ isRightEdge = true;
1188
+ _col = maxCol - 1;
1189
+ } else {
1190
+ _col = _col + 1;
1191
+ }
1192
+ }
1193
+ if (key === 'ArrowUp' || key === 'Numpad8' && !isNumLockOn) {
1194
+ if (_row - 1 < 0) {
1195
+ isTopEdge = true;
1196
+ _row = 0;
1197
+ } else {
1198
+ _row = _row - 1;
1199
+ }
1200
+ }
1201
+ if (key === 'ArrowDown' || key === 'Numpad2' && !isNumLockOn) {
1202
+ if (_row + 1 > rootDataInfo.totalRow - 1) {
1203
+ isBottomEdge = true;
1204
+ _row = rootDataInfo.totalRow - 1;
1205
+ } else {
1206
+ _row = _row + 1;
1207
+ }
1208
+ }
1209
+ var nextCellSignal = cellMark(_row, _col);
1210
+ // Focus the current cell
1211
+ removeCellFocusClassName(spyElement);
1212
+ var targetCell = refNode.current.get(nextCellSignal);
1213
+ if (typeof targetCell !== 'undefined') {
1214
+ targetCell.classList.add('cell-focus');
1215
+ }
1216
+ setFocusableCellId(nextCellSignal);
1217
+ // Callback with edge detection
1218
+ onCellKeyPressed === null || onCellKeyPressed === void 0 ? void 0 : onCellKeyPressed(nextCellSignal, refNode.current.get(nextCellSignal), event, isLeftEdge, isRightEdge, isTopEdge, isBottomEdge);
1219
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
1220
+ }; // Handle arrow key navigation
1221
+ // Numpad2/4/6/8 trigger direction is allowed only when NumLock is off
1222
+ if (key === 'ArrowLeft' || key === 'Numpad4' && !isNumLockOn) {
1223
+ move('ArrowLeft');
1224
+ }
1225
+ if (key === 'ArrowRight' || key === 'Numpad6' && !isNumLockOn) {
1226
+ move('ArrowRight');
1227
+ }
1228
+ if (key === 'ArrowUp' || key === 'Numpad8' && !isNumLockOn) {
1229
+ move('ArrowUp');
1230
+ }
1231
+ if (key === 'ArrowDown' || key === 'Numpad2' && !isNumLockOn) {
1232
+ move('ArrowDown');
1233
+ }
1234
+
1235
+ // Handle Enter key
1236
+ if (key === 'Enter' || key === 'NumpadEnter') {
1237
+ _nextCellSignal = cellMark(_row, _col);
1238
+ onCellPressEnter === null || onCellPressEnter === void 0 ? void 0 : onCellPressEnter(_nextCellSignal, refNode.current.get(_nextCellSignal), event);
1239
+ }
1240
+ case 20:
1241
+ case "end":
1242
+ return _context.stop();
1243
+ }
1244
+ }, _callee);
1245
+ }));
1246
+ return function (_x) {
1247
+ return _ref2.apply(this, arguments);
1248
+ };
1249
+ }(), [focusableCellId, rootDataInfo, data]);
1250
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1251
+ if (enabled) {
1252
+ // Initialize custom props of table elements (only once)
1253
+ initOrderProps(spyElement);
1254
+ initRowColProps(spyElement);
1255
+ }
1256
+ }, [enabled, spyElement].concat(useTableKeyPress_toConsumableArray(deps)));
1257
+ return {
1258
+ handleKeyPressed: handleKeyPressed,
1259
+ /**
1260
+ * Expose handleKeyPressed for external usage, e.g., via contentRef in Table component.
1261
+ * This allows calling handleKeyPressed programmatically from outside, such as with a custom onCellKeyPressed method.
1262
+ */
1263
+ triggerCellKeyPressed: handleKeyPressed
1264
+ };
1265
+ };
1266
+ /* harmony default export */ const hooks_useTableKeyPress = (useTableKeyPress);
1267
+ ;// CONCATENATED MODULE: ./src/Table.tsx
1268
+ var _excluded = ["contentRef", "children", "wrapperClassName", "tableClassName", "bordered", "colGroup", "cellAutoWidth", "colSortable", "onColSort", "rowDraggable", "onRowDrag", "responsive", "enhancedResponsive", "enhancedResponsiveWithScrollBar", "data", "filterFields", "filterControlClassName", "filterControlPlaceholder", "filterLabel", "onChangeFilter", "dataSelected", "rowSelectable", "onChangeRowSelect", "keyboardFocusable", "onCellKeyPressed", "onCellPressEnter"];
1269
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1270
+ function Table_slicedToArray(arr, i) { return Table_arrayWithHoles(arr) || Table_iterableToArrayLimit(arr, i) || Table_unsupportedIterableToArray(arr, i) || Table_nonIterableRest(); }
1271
+ function Table_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1272
+ function Table_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Table_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Table_arrayLikeToArray(o, minLen); }
1273
+ function Table_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
1274
+ function Table_iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
1275
+ function Table_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1276
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1277
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+ var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1287
+ var contentRef = _ref.contentRef,
1288
+ children = _ref.children,
1289
+ wrapperClassName = _ref.wrapperClassName,
1290
+ tableClassName = _ref.tableClassName,
1291
+ bordered = _ref.bordered,
1292
+ colGroup = _ref.colGroup,
1293
+ cellAutoWidth = _ref.cellAutoWidth,
1294
+ colSortable = _ref.colSortable,
1295
+ onColSort = _ref.onColSort,
1296
+ rowDraggable = _ref.rowDraggable,
1297
+ onRowDrag = _ref.onRowDrag,
1298
+ responsive = _ref.responsive,
1299
+ enhancedResponsive = _ref.enhancedResponsive,
1300
+ enhancedResponsiveWithScrollBar = _ref.enhancedResponsiveWithScrollBar,
1301
+ data = _ref.data,
1302
+ filterFields = _ref.filterFields,
1303
+ filterControlClassName = _ref.filterControlClassName,
1304
+ filterControlPlaceholder = _ref.filterControlPlaceholder,
1305
+ filterLabel = _ref.filterLabel,
1306
+ onChangeFilter = _ref.onChangeFilter,
1307
+ dataSelected = _ref.dataSelected,
1308
+ rowSelectable = _ref.rowSelectable,
1309
+ onChangeRowSelect = _ref.onChangeRowSelect,
1310
+ keyboardFocusable = _ref.keyboardFocusable,
1311
+ onCellKeyPressed = _ref.onCellKeyPressed,
1312
+ onCellPressEnter = _ref.onCellPressEnter,
1313
+ attributes = _objectWithoutProperties(_ref, _excluded);
1314
+ var uniqueID = useComId_default()();
1315
+ var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1316
+
1317
+ // context
1318
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
1319
+ _useState2 = Table_slicedToArray(_useState, 2),
1320
+ instance = _useState2[0],
1321
+ setInstance = _useState2[1];
1322
+
1323
+ // selection
1324
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Set()),
1325
+ _useState4 = Table_slicedToArray(_useState3, 2),
1326
+ selectedItems = _useState4[0],
1327
+ setSelectedItems = _useState4[1];
1328
+
1329
+ // effective element movement on keystroke
1330
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
1331
+ _useState6 = Table_slicedToArray(_useState5, 2),
1332
+ rootDataInfo = _useState6[0],
1333
+ setRootDataInfo = _useState6[1];
1334
+ var refNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Map());
1335
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1336
+ _useState8 = Table_slicedToArray(_useState7, 2),
1337
+ focusableCellId = _useState8[0],
1338
+ setFocusableCellId = _useState8[1];
1339
+
1340
+ // responsive
1341
+ var responsiveClasses = typeof responsive === 'undefined' || responsive === true ? 'table-responsive' : '';
1342
+ var enhancedResponsiveClasses = '';
1343
+ if (enhancedResponsive && !enhancedResponsiveWithScrollBar) enhancedResponsiveClasses += ' table-enhanced-responsive';
1344
+ if (enhancedResponsiveWithScrollBar && !enhancedResponsive) enhancedResponsiveClasses += ' table-enhanced-responsive-scrolled';
1345
+
1346
+ //Set the class names of different styles
1347
+ var tableClasses = '';
1348
+ if (bordered) tableClasses += ' table-bordered';
1349
+ if (colGroup) tableClasses += ' table-colgroup';
1350
+
1351
+ // responsive table initialization
1352
+ hooks_useTableResponsive({
1353
+ enabled: enhancedResponsiveWithScrollBar && rootRef.current,
1354
+ spyElement: rootRef.current
1355
+ }, [rootRef]);
1356
+
1357
+ // initialize drag & drop data
1358
+ var _useTableDraggable = hooks_useTableDraggable({
1359
+ enabled: rowDraggable && rootRef.current,
1360
+ data: data,
1361
+ spyElement: rootRef.current,
1362
+ onRowDrag: onRowDrag
1363
+ }, [data, rootRef]),
1364
+ handleDragStart = _useTableDraggable.handleDragStart,
1365
+ handleDragEnd = _useTableDraggable.handleDragEnd,
1366
+ handledragOver = _useTableDraggable.handledragOver,
1367
+ handleTbodyEnter = _useTableDraggable.handleTbodyEnter;
1368
+ var tableKeyPress = hooks_useTableKeyPress({
1369
+ enabled: keyboardFocusable,
1370
+ data: data,
1371
+ spyElement: rootRef.current,
1372
+ rootDataInfo: rootDataInfo,
1373
+ refNode: refNode,
1374
+ focusableCellId: focusableCellId,
1375
+ setFocusableCellId: setFocusableCellId,
1376
+ onCellKeyPressed: onCellKeyPressed,
1377
+ onCellPressEnter: onCellPressEnter
1378
+ }, [data, rootRef, rootDataInfo, refNode, focusableCellId]);
1379
+ var updateFocusableCell = function updateFocusableCell(row, col) {
1380
+ setFocusableCellId(cellMark(row, col));
1381
+
1382
+ // Find and focus the cell element
1383
+ var targetCell = refNode.current.get(cellMark(row, col));
1384
+ if (typeof targetCell !== 'undefined') {
1385
+ removeCellFocusClassName(rootRef.current);
1386
+ targetCell.classList.add('cell-focus');
1387
+ }
1388
+ };
1389
+
1390
+ // initialize context
1391
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1392
+ setInstance(data);
1393
+ }, [data]);
1394
+
1395
+ // The items are selected by default
1396
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1397
+ if (Array.isArray(data) && Array.isArray(dataSelected) && dataSelected.length > 0) {
1398
+ var newSelectedItems = new Set(selectedItems);
1399
+ dataSelected.forEach(function (s) {
1400
+ newSelectedItems.add(String(s));
1401
+ });
1402
+ setSelectedItems(newSelectedItems);
1403
+ }
1404
+ }, [data, dataSelected]);
1405
+
1406
+ // Synchronous execution, which blocks rendering
1407
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
1408
+ if (rootRef.current) {
1409
+ // Initialize custom props of table elements
1410
+ initRowColProps(rootRef.current);
1411
+
1412
+ // Count the number of columns per row
1413
+ var totalCol = getTableRowsColCount(rootRef.current);
1414
+ setRootDataInfo({
1415
+ totalRow: Array.isArray(data) ? data.length : 0,
1416
+ totalCol: totalCol
1417
+ });
1418
+
1419
+ // Initialize the focused index
1420
+ if (keyboardFocusable) {
1421
+ updateFocusableCell(0, 0);
1422
+ }
1423
+ }
1424
+ }, [data]); // Re-run when data changes
1425
+
1426
+ // exposes the following methods
1427
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
1428
+ return {
1429
+ setFocusableCell: updateFocusableCell,
1430
+ clearAllCellFocus: function clearAllCellFocus() {
1431
+ if (rootRef.current) {
1432
+ removeCellFocusClassName(rootRef.current);
1433
+ var focusedCells = rootRef.current.querySelectorAll('td.cell-focus, th.cell-focus');
1434
+ focusedCells.forEach(function (cell) {
1435
+ if (typeof cell.blur === 'function') cell.blur();
1436
+ if (cell.classList) cell.classList.remove('cell-focus');
1437
+ });
1438
+ }
1439
+ },
1440
+ getCellElement: function getCellElement(row, col) {
1441
+ // Find and focus the cell element
1442
+ var targetCell = refNode.current.get(cellMark(row, col));
1443
+ return typeof targetCell !== 'undefined' ? targetCell : null;
1444
+ },
1445
+ forceFocusCell: function forceFocusCell(row, col) {
1446
+ // Find and focus the cell element
1447
+ var targetCell = refNode.current.get(cellMark(row, col));
1448
+ if (typeof targetCell !== 'undefined') {
1449
+ // After forcing focus, you can use the keyboard to listen directly
1450
+ targetCell.focus();
1451
+ }
1452
+ },
1453
+ triggerCellKeyPressed: tableKeyPress.triggerCellKeyPressed
1454
+ };
1455
+ }, [rootRef, data, rootDataInfo]);
1456
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TableProvider, {
1457
+ value: {
1458
+ originData: data,
1459
+ rootRef: rootRef,
1460
+ // sort
1461
+ colSortable: colSortable,
1462
+ onColSort: onColSort,
1463
+ // drag & drop
1464
+ rowDraggable: rowDraggable,
1465
+ handleDragStart: handleDragStart,
1466
+ handleDragEnd: handleDragEnd,
1467
+ handledragOver: handledragOver,
1468
+ handleTbodyEnter: handleTbodyEnter,
1469
+ // filter
1470
+ filterFields: filterFields,
1471
+ instance: instance,
1472
+ setInstance: setInstance,
1473
+ onChangeFilter: onChangeFilter,
1474
+ // selection
1475
+ dataSelected: dataSelected,
1476
+ rowSelectable: rowSelectable,
1477
+ selectedItems: selectedItems,
1478
+ setSelectedItems: setSelectedItems,
1479
+ onChangeRowSelect: onChangeRowSelect,
1480
+ // key press
1481
+ keyboardFocusable: keyboardFocusable,
1482
+ rootDataInfo: rootDataInfo,
1483
+ setRootDataInfo: setRootDataInfo,
1484
+ refNode: refNode,
1485
+ focusableCellId: focusableCellId,
1486
+ setFocusableCellId: setFocusableCellId,
1487
+ onCellKeyPressed: onCellKeyPressed,
1488
+ onCellPressEnter: onCellPressEnter
1489
+ }
1490
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({}, attributes, {
1491
+ id: uniqueID,
1492
+ ref: function ref(node) {
1493
+ rootRef.current = node;
1494
+ if (typeof externalRef === 'function') {
1495
+ externalRef(node);
1496
+ } else if (externalRef) {
1497
+ externalRef.current = node;
1498
+ }
1499
+ },
1500
+ className: (0,cls.combinedCls)('syntable__wrapper', (0,cls.clsWrite)(wrapperClassName, 'mb-3 position-relative'), responsiveClasses, enhancedResponsiveClasses, {
1501
+ 'has-checkbox': rowSelectable,
1502
+ 'allow-dragdrop': rowDraggable,
1503
+ 'allow-sort': colSortable
1504
+ })
1505
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("table", {
1506
+ className: (0,cls.combinedCls)((0,cls.clsWrite)(tableClassName, 'table'), tableClasses, {
1507
+ 'cell-autowidth': cellAutoWidth
1508
+ })
1509
+ }, children))));
1510
+ });
1511
+ /* harmony default export */ const src_Table = (Table);
1512
+ ;// CONCATENATED MODULE: ./src/TableBody.tsx
1513
+ var TableBody_excluded = ["children", "className"];
1514
+ function TableBody_extends() { TableBody_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableBody_extends.apply(this, arguments); }
1515
+ function TableBody_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableBody_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1516
+ function TableBody_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1517
+
1518
+
1519
+ var TableBody = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1520
+ var children = _ref.children,
1521
+ className = _ref.className,
1522
+ attributes = TableBody_objectWithoutProperties(_ref, TableBody_excluded);
1523
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1524
+ rowDraggable = _useContext.rowDraggable,
1525
+ handledragOver = _useContext.handledragOver;
1526
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("tbody", TableBody_extends({}, attributes, {
1527
+ ref: externalRef,
1528
+ onDragOver: rowDraggable ? handledragOver : function () {
1529
+ return void 0;
1530
+ },
1531
+ className: className || ''
1532
+ }), children));
1533
+ });
1534
+ /* harmony default export */ const src_TableBody = (TableBody);
1535
+ ;// CONCATENATED MODULE: ./src/TableCell.tsx
1536
+ function TableCell_typeof(obj) { "@babel/helpers - typeof"; return TableCell_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, TableCell_typeof(obj); }
1537
+ var TableCell_excluded = ["children", "active", "nowrap", "activeClassName", "className", "colSpan", "style", "scope", "onClick", "onKeyDown"];
1538
+ function TableCell_extends() { TableCell_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableCell_extends.apply(this, arguments); }
1539
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1540
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1541
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1542
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return TableCell_typeof(key) === "symbol" ? key : String(key); }
1543
+ function _toPrimitive(input, hint) { if (TableCell_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (TableCell_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1544
+ function TableCell_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableCell_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1545
+ function TableCell_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+ var TableCell = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1552
+ var children = _ref.children,
1553
+ active = _ref.active,
1554
+ nowrap = _ref.nowrap,
1555
+ activeClassName = _ref.activeClassName,
1556
+ myClassName = _ref.className,
1557
+ colSpan = _ref.colSpan,
1558
+ style = _ref.style,
1559
+ scope = _ref.scope,
1560
+ _onClick = _ref.onClick,
1561
+ onKeyDown = _ref.onKeyDown,
1562
+ attributes = TableCell_objectWithoutProperties(_ref, TableCell_excluded);
1563
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1564
+ originData = _useContext.originData,
1565
+ rootRef = _useContext.rootRef,
1566
+ rootDataInfo = _useContext.rootDataInfo,
1567
+ setRootDataInfo = _useContext.setRootDataInfo,
1568
+ refNode = _useContext.refNode,
1569
+ focusableCellId = _useContext.focusableCellId,
1570
+ setFocusableCellId = _useContext.setFocusableCellId,
1571
+ keyboardFocusable = _useContext.keyboardFocusable,
1572
+ onCellKeyPressed = _useContext.onCellKeyPressed,
1573
+ onCellPressEnter = _useContext.onCellPressEnter;
1574
+ var CellComponent = scope ? 'th' : 'td';
1575
+
1576
+ // key press initialization
1577
+ var _useTableKeyPress = hooks_useTableKeyPress({
1578
+ enabled: keyboardFocusable,
1579
+ data: originData,
1580
+ spyElement: rootRef.current,
1581
+ rootDataInfo: rootDataInfo,
1582
+ refNode: refNode,
1583
+ focusableCellId: focusableCellId,
1584
+ setFocusableCellId: setFocusableCellId,
1585
+ onCellKeyPressed: onCellKeyPressed,
1586
+ onCellPressEnter: onCellPressEnter,
1587
+ onKeyDown: onKeyDown
1588
+ }, [rootRef]),
1589
+ handleKeyPressed = _useTableKeyPress.handleKeyPressed;
1590
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(CellComponent, TableCell_extends({}, attributes, {
1591
+ style: typeof nowrap === 'undefined' ? style : _objectSpread({
1592
+ whiteSpace: (0,cls.clsWrite)(nowrap, 'normal', 'nowrap')
1593
+ }, style),
1594
+ ref: function ref(node) {
1595
+ if (typeof externalRef === 'function') {
1596
+ externalRef(node);
1597
+ } else if (externalRef) {
1598
+ externalRef.current = node;
1599
+ }
1600
+ if (node) {
1601
+ var _row = node.dataset.tableRow;
1602
+ var _col = node.dataset.tableCol;
1603
+ if (typeof _row !== 'undefined' && typeof _col !== 'undefined') {
1604
+ refNode.current.set(cellMark(_row, _col), node);
1605
+ }
1606
+ }
1607
+ },
1608
+ colSpan: colSpan,
1609
+ tabIndex: -1,
1610
+ onKeyDown: handleKeyPressed // require "tabIndex" attribute
1611
+ ,
1612
+ onClick: function onClick(e) {
1613
+ var _el = e.currentTarget;
1614
+
1615
+ // key press initialization
1616
+ if (keyboardFocusable) {
1617
+ var _row = Number(_el.dataset.tableRow);
1618
+ var _col = Number(_el.dataset.tableCol);
1619
+ removeCellFocusClassName(rootRef.current);
1620
+ setFocusableCellId(cellMark(_row, _col));
1621
+ _el.classList.add('cell-focus');
1622
+ }
1623
+
1624
+ // callback
1625
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(e);
1626
+ },
1627
+ className: (0,cls.combinedCls)(myClassName, active ? (0,cls.clsWrite)(activeClassName, 'active') : undefined)
1628
+ }), children));
1629
+ });
1630
+ /* harmony default export */ const src_TableCell = (TableCell);
1631
+ ;// CONCATENATED MODULE: ./src/TableHead.tsx
1632
+ var TableHead_excluded = ["children", "className"];
1633
+ function TableHead_extends() { TableHead_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableHead_extends.apply(this, arguments); }
1634
+ function TableHead_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableHead_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1635
+ function TableHead_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1636
+
1637
+ var TableHead = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1638
+ var children = _ref.children,
1639
+ className = _ref.className,
1640
+ attributes = TableHead_objectWithoutProperties(_ref, TableHead_excluded);
1641
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("thead", TableHead_extends({}, attributes, {
1642
+ ref: externalRef,
1643
+ className: className || ''
1644
+ }), children));
1645
+ });
1646
+ /* harmony default export */ const src_TableHead = (TableHead);
1647
+ ;// CONCATENATED MODULE: ./src/TableFoot.tsx
1648
+ var TableFoot_excluded = ["children", "className"];
1649
+ function TableFoot_extends() { TableFoot_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableFoot_extends.apply(this, arguments); }
1650
+ function TableFoot_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableFoot_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1651
+ function TableFoot_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1652
+
1653
+ var TableFoot = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1654
+ var children = _ref.children,
1655
+ className = _ref.className,
1656
+ attributes = TableFoot_objectWithoutProperties(_ref, TableFoot_excluded);
1657
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("tfoot", TableFoot_extends({}, attributes, {
1658
+ ref: externalRef,
1659
+ className: className || ''
1660
+ }), children));
1661
+ });
1662
+ /* harmony default export */ const src_TableFoot = (TableFoot);
1663
+ ;// CONCATENATED MODULE: ./src/TableRow.tsx
1664
+ var TableRow_excluded = ["children", "active", "activeClassName", "className", "itemData"];
1665
+ function TableRow_extends() { TableRow_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableRow_extends.apply(this, arguments); }
1666
+ function TableRow_typeof(obj) { "@babel/helpers - typeof"; return TableRow_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, TableRow_typeof(obj); }
1667
+ function TableRow_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableRow_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1668
+ function TableRow_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1669
+
1670
+
1671
+
1672
+ var TableRow = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1673
+ var children = _ref.children,
1674
+ active = _ref.active,
1675
+ activeClassName = _ref.activeClassName,
1676
+ className = _ref.className,
1677
+ itemData = _ref.itemData,
1678
+ attributes = TableRow_objectWithoutProperties(_ref, TableRow_excluded);
1679
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1680
+ originData = _useContext.originData,
1681
+ filterFields = _useContext.filterFields,
1682
+ selectedItems = _useContext.selectedItems,
1683
+ instance = _useContext.instance,
1684
+ rowDraggable = _useContext.rowDraggable,
1685
+ handleDragStart = _useContext.handleDragStart,
1686
+ handleDragEnd = _useContext.handleDragEnd;
1687
+
1688
+ // ================================================================
1689
+ // filter
1690
+ // ================================================================
1691
+ var filteredData = instance || [];
1692
+ var filterFieldsData = filterFields || [];
1693
+
1694
+ // ================================================================
1695
+ // selection
1696
+ // ================================================================
1697
+ var _res = convertMapToArr(selectedItems);
1698
+ var filteredSelectedItems = _res.map(function (v) {
1699
+ return Number(v);
1700
+ }).map(function (rowNum) {
1701
+ if (JSON.stringify(itemData) === JSON.stringify(originData[rowNum])) {
1702
+ return originData[rowNum];
1703
+ }
1704
+ }).filter(Boolean);
1705
+ var selectedClassName = activeClassName || 'active';
1706
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("tr", TableRow_extends({}, attributes, {
1707
+ ref: externalRef,
1708
+ draggable: rowDraggable,
1709
+ onDragStart: rowDraggable ? handleDragStart : function () {
1710
+ return void 0;
1711
+ },
1712
+ onDragEnd: rowDraggable ? handleDragEnd : function () {
1713
+ return void 0;
1714
+ },
1715
+ "data-row-data": "".concat(itemData && TableRow_typeof(itemData) === 'object' ? JSON.stringify(itemData) : itemData),
1716
+ className: "row-obj ".concat(className || '', " ").concat(active ? selectedClassName : '', " ").concat(itemData && originData ? filteredData.every(function (item) {
1717
+ return filterFieldsData.some(function (s) {
1718
+ var _item$s, _itemData$s;
1719
+ return !((_item$s = item[s]) !== null && _item$s !== void 0 && _item$s.toLowerCase().includes((_itemData$s = itemData[s]) === null || _itemData$s === void 0 ? void 0 : _itemData$s.toLowerCase()));
1720
+ });
1721
+ }) ? 'd-none' : '' : '', " ").concat(itemData && originData ? filteredSelectedItems.some(function (item) {
1722
+ return JSON.stringify(itemData) === JSON.stringify(item);
1723
+ }) ? selectedClassName : '' : '')
1724
+ }), children));
1725
+ });
1726
+ /* harmony default export */ const src_TableRow = (TableRow);
1727
+ ;// CONCATENATED MODULE: ./src/TableColgroup.tsx
1728
+ var TableColgroup_excluded = ["className", "length"];
1729
+ function TableColgroup_extends() { TableColgroup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableColgroup_extends.apply(this, arguments); }
1730
+ function TableColgroup_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableColgroup_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1731
+ function TableColgroup_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1732
+
1733
+ var TableColgroup = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1734
+ var className = _ref.className,
1735
+ length = _ref.length,
1736
+ attributes = TableColgroup_objectWithoutProperties(_ref, TableColgroup_excluded);
1737
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("colgroup", TableColgroup_extends({}, attributes, {
1738
+ ref: externalRef,
1739
+ className: className || ''
1740
+ }), Array.from({
1741
+ length: length || 0
1742
+ }, function (v, k) {
1743
+ return k; // Return k(ey) as value for this index
1744
+ }).map(function (el, i) {
1745
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("col", {
1746
+ key: i
1747
+ });
1748
+ })));
1749
+ });
1750
+ /* harmony default export */ const src_TableColgroup = (TableColgroup);
1751
+ ;// CONCATENATED MODULE: ./src/TableCaption.tsx
1752
+ var TableCaption_excluded = ["children", "captionSide", "className"];
1753
+ function TableCaption_extends() { TableCaption_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TableCaption_extends.apply(this, arguments); }
1754
+ function TableCaption_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TableCaption_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1755
+ function TableCaption_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1756
+
1757
+ var TableCaption = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1758
+ var children = _ref.children,
1759
+ captionSide = _ref.captionSide,
1760
+ className = _ref.className,
1761
+ attributes = TableCaption_objectWithoutProperties(_ref, TableCaption_excluded);
1762
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("caption", TableCaption_extends({}, attributes, {
1763
+ ref: externalRef,
1764
+ className: "syntable__caption ".concat(className || '', " syntable__caption--").concat(captionSide || 'top')
1765
+ }), children));
1766
+ });
1767
+ /* harmony default export */ const src_TableCaption = (TableCaption);
1768
+ ;// CONCATENATED MODULE: ./src/utils/TableFilter.tsx
1769
+
1770
+
1771
+ var TableFilter = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
1772
+ var className = props.className,
1773
+ placeholder = props.placeholder,
1774
+ label = props.label,
1775
+ _onChange = props.onChange;
1776
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1777
+ originData = _useContext.originData,
1778
+ filterFields = _useContext.filterFields,
1779
+ setInstance = _useContext.setInstance,
1780
+ onChangeFilter = _useContext.onChangeFilter;
1781
+ var filterFieldsData = filterFields || [];
1782
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1783
+ className: "syntable__filter-container"
1784
+ }, label || null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
1785
+ type: "text",
1786
+ ref: externalRef,
1787
+ className: className || '',
1788
+ onChange: function onChange(e) {
1789
+ var filteredData = originData === null || originData === void 0 ? void 0 : originData.filter(function (item) {
1790
+ return filterFieldsData.some(function (s) {
1791
+ var _item$s;
1792
+ return (_item$s = item[s]) === null || _item$s === void 0 ? void 0 : _item$s.toLowerCase().includes(e.target.value.toLowerCase());
1793
+ });
1794
+ });
1795
+ if (e.target.value.trim() === '') {
1796
+ setInstance(originData);
1797
+ onChangeFilter === null || onChangeFilter === void 0 ? void 0 : onChangeFilter(originData);
1798
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(e, originData);
1799
+ } else {
1800
+ setInstance(filteredData);
1801
+ onChangeFilter === null || onChangeFilter === void 0 ? void 0 : onChangeFilter(filteredData);
1802
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(e, filteredData);
1803
+ }
1804
+ },
1805
+ placeholder: placeholder || ''
1806
+ }));
1807
+ });
1808
+ /* harmony default export */ const utils_TableFilter = (TableFilter);
1809
+ ;// CONCATENATED MODULE: ./src/utils/ToggleSelection.tsx
1810
+ var ToggleSelection_excluded = ["contentRef", "row", "useRadio", "className", "indeterminate", "disabled", "name", "value", "onChange", "checked"];
1811
+ function ToggleSelection_extends() { ToggleSelection_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ToggleSelection_extends.apply(this, arguments); }
1812
+ function ToggleSelection_slicedToArray(arr, i) { return ToggleSelection_arrayWithHoles(arr) || ToggleSelection_iterableToArrayLimit(arr, i) || ToggleSelection_unsupportedIterableToArray(arr, i) || ToggleSelection_nonIterableRest(); }
1813
+ function ToggleSelection_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1814
+ function ToggleSelection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ToggleSelection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ToggleSelection_arrayLikeToArray(o, minLen); }
1815
+ function ToggleSelection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
1816
+ function ToggleSelection_iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
1817
+ function ToggleSelection_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1818
+ function ToggleSelection_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = ToggleSelection_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1819
+ function ToggleSelection_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1820
+
1821
+
1822
+
1823
+ var ToggleSelection = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, ref) {
1824
+ var contentRef = props.contentRef,
1825
+ row = props.row,
1826
+ useRadio = props.useRadio,
1827
+ className = props.className,
1828
+ _props$indeterminate = props.indeterminate,
1829
+ indeterminate = _props$indeterminate === void 0 ? false : _props$indeterminate,
1830
+ disabled = props.disabled,
1831
+ name = props.name,
1832
+ value = props.value,
1833
+ onChange = props.onChange,
1834
+ checked = props.checked,
1835
+ attributes = ToggleSelection_objectWithoutProperties(props, ToggleSelection_excluded);
1836
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1837
+ originData = _useContext.originData,
1838
+ rowSelectable = _useContext.rowSelectable,
1839
+ selectedItems = _useContext.selectedItems,
1840
+ setSelectedItems = _useContext.setSelectedItems,
1841
+ onChangeRowSelect = _useContext.onChangeRowSelect;
1842
+ var totalSize = originData.length;
1843
+ var defaultRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
1844
+ var resolvedRef = ref || defaultRef;
1845
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1846
+ _useState2 = ToggleSelection_slicedToArray(_useState, 2),
1847
+ allChecked = _useState2[0],
1848
+ setAllChecked = _useState2[1];
1849
+
1850
+ // exposes the following methods
1851
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
1852
+ return {
1853
+ indeterminate: function indeterminate(value) {
1854
+ resolvedRef.current.indeterminate = value;
1855
+ },
1856
+ setSelectAll: function setSelectAll(value) {
1857
+ setAllChecked(value);
1858
+ },
1859
+ set: function set(check) {
1860
+ var _resolvedRef$current;
1861
+ var s = String((_resolvedRef$current = resolvedRef.current) === null || _resolvedRef$current === void 0 ? void 0 : _resolvedRef$current.dataset.row);
1862
+ setSelectedItems(function (prev) {
1863
+ var _data = new Set(prev);
1864
+ if (check) {
1865
+ _data.add(s);
1866
+ } else {
1867
+ _data["delete"](s);
1868
+ }
1869
+ return _data;
1870
+ });
1871
+ },
1872
+ control: function control() {
1873
+ return resolvedRef.current;
1874
+ }
1875
+ };
1876
+ }, [contentRef, resolvedRef, selectedItems]);
1877
+ function selectTarget(rowIndex) {
1878
+ var _val = String(rowIndex);
1879
+
1880
+ // filter
1881
+ // =================================================================
1882
+ var _selectedIndex = [];
1883
+ var filteredData = [];
1884
+ if (!isNaN(row) && Array.isArray(originData)) {
1885
+ // all
1886
+ if (row === -1) {
1887
+ var _target = Array.from({
1888
+ length: totalSize
1889
+ }, function (v, k) {
1890
+ return String(k);
1891
+ });
1892
+ if (selectedItems.size === 0 || selectedItems.size < totalSize) {
1893
+ _selectedIndex = convertMapToArr(checkedSpecItems(_target, true)).map(function (v) {
1894
+ return Number(v);
1895
+ });
1896
+ setAllChecked(true);
1897
+ } else {
1898
+ _selectedIndex = convertMapToArr(checkedSpecItems(_target, false)).map(function (v) {
1899
+ return Number(v);
1900
+ });
1901
+ setAllChecked(false);
1902
+ }
1903
+ } else {
1904
+ var _newSelectedItems = checkedOneItem(_val);
1905
+ var _res = convertMapToArr(_newSelectedItems);
1906
+ _selectedIndex = _res.map(function (v) {
1907
+ return Number(v);
1908
+ });
1909
+ }
1910
+ filteredData = originData.filter(function (v, i) {
1911
+ return _selectedIndex.includes(i);
1912
+ });
1913
+ }
1914
+ return filteredData;
1915
+ }
1916
+ function selectTargetExclusive(rowIndex) {
1917
+ var _val = String(rowIndex);
1918
+
1919
+ // filter
1920
+ // =================================================================
1921
+ var filteredData = [];
1922
+ if (!isNaN(row) && Array.isArray(originData)) {
1923
+ var newSelectedItems = new Set();
1924
+ newSelectedItems.add(_val);
1925
+ setSelectedItems(newSelectedItems);
1926
+ filteredData = originData.filter(function (v, i) {
1927
+ return Number(_val) === i;
1928
+ });
1929
+ }
1930
+ return filteredData;
1931
+ }
1932
+ function checkedSpecItems(itemKey, check) {
1933
+ // first, make a copy of the original set rather than mutating the original
1934
+ var newSelectedItems = new Set(selectedItems);
1935
+ itemKey.forEach(function (s) {
1936
+ if (check) {
1937
+ newSelectedItems.add(s);
1938
+ } else {
1939
+ newSelectedItems["delete"](s);
1940
+ }
1941
+ });
1942
+ setSelectedItems(newSelectedItems);
1943
+ return newSelectedItems;
1944
+ }
1945
+ function checkedOneItem(itemKey) {
1946
+ // first, make a copy of the original set rather than mutating the original
1947
+ var newSelectedItems = new Set(selectedItems);
1948
+ if (!newSelectedItems.has(itemKey)) {
1949
+ newSelectedItems.add(itemKey);
1950
+ } else {
1951
+ newSelectedItems["delete"](itemKey);
1952
+ }
1953
+ setSelectedItems(newSelectedItems);
1954
+ return newSelectedItems;
1955
+ }
1956
+ function handleChange(event) {
1957
+ var _val = event.target.value;
1958
+ var filteredData = useRadio ? selectTargetExclusive(_val) : selectTarget(_val);
1959
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, event.target.checked, filteredData);
1960
+ onChangeRowSelect === null || onChangeRowSelect === void 0 ? void 0 : onChangeRowSelect(filteredData);
1961
+ }
1962
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1963
+ if (resolvedRef.current) {
1964
+ resolvedRef.current.indeterminate = indeterminate;
1965
+ }
1966
+ }, [resolvedRef, indeterminate]);
1967
+
1968
+ // Handle checked prop - use setSelectedItems to manage selection state
1969
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1970
+ if (checked !== undefined && row !== -1) {
1971
+ var rowKey = String(row);
1972
+ var nextSelectedItems;
1973
+ setSelectedItems(function (prev) {
1974
+ var newSelectedItems = new Set(prev);
1975
+ if (checked) {
1976
+ newSelectedItems.add(rowKey);
1977
+ } else {
1978
+ newSelectedItems["delete"](rowKey);
1979
+ }
1980
+ nextSelectedItems = newSelectedItems;
1981
+
1982
+ //
1983
+ var selectedIndex = nextSelectedItems ? Array.from(nextSelectedItems).map(function (v) {
1984
+ return Number(v);
1985
+ }) : [];
1986
+ var filteredData = Array.isArray(originData) ? originData.filter(function (v, i) {
1987
+ return selectedIndex.includes(i);
1988
+ }) : [];
1989
+ var syntheticEvent = {
1990
+ target: {
1991
+ value: rowKey,
1992
+ checked: checked
1993
+ }
1994
+ };
1995
+ onChange === null || onChange === void 0 ? void 0 : onChange(syntheticEvent, checked, filteredData);
1996
+ onChangeRowSelect === null || onChangeRowSelect === void 0 ? void 0 : onChangeRowSelect(filteredData);
1997
+ return newSelectedItems;
1998
+ });
1999
+ }
2000
+ }, [checked, row, setSelectedItems]);
2001
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, rowSelectable && row === -1 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", ToggleSelection_extends({
2002
+ type: useRadio ? 'radio' : 'checkbox',
2003
+ ref: resolvedRef,
2004
+ className: className || '',
2005
+ name: name,
2006
+ value: "".concat(row),
2007
+ checked: allChecked,
2008
+ onChange: handleChange
2009
+ }, attributes)) : null, rowSelectable && row != -1 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", ToggleSelection_extends({
2010
+ type: useRadio ? 'radio' : 'checkbox',
2011
+ ref: resolvedRef,
2012
+ className: className || '',
2013
+ name: name,
2014
+ value: "".concat(row),
2015
+ "data-row": row,
2016
+ "data-value": originData[row] ? JSON.stringify(originData[row]) : null,
2017
+ checked: selectedItems.has("".concat(row)),
2018
+ onChange: handleChange
2019
+ }, attributes)) : null);
2020
+ });
2021
+ /* harmony default export */ const utils_ToggleSelection = (ToggleSelection);
2022
+ ;// CONCATENATED MODULE: ./src/utils/DragHandleSprite.tsx
2023
+
2024
+
2025
+ var DragHandleSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
2026
+ var className = props.className,
2027
+ icon = props.icon;
2028
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
2029
+ rowDraggable = _useContext.rowDraggable,
2030
+ handleTbodyEnter = _useContext.handleTbodyEnter;
2031
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, rowDraggable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2032
+ ref: externalRef,
2033
+ className: className || 'drag-trigger',
2034
+ onMouseEnter: handleTbodyEnter
2035
+ }, icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2036
+ width: "1em",
2037
+ height: "1em",
2038
+ viewBox: "0 0 24 24",
2039
+ fill: "none"
2040
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2041
+ d: "M18 14C17.4477 14 17 14.4477 17 15C17 15.5523 17.4477 16 18 16C18.5523 16 19 15.5523 19 15C19 14.4477 18.5523 14 18 14Z",
2042
+ stroke: "#000000",
2043
+ strokeWidth: "2",
2044
+ strokeLinecap: "round",
2045
+ strokeLinejoin: "round"
2046
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2047
+ d: "M12 14C11.4477 14 11 14.4477 11 15C11 15.5523 11.4477 16 12 16C12.5523 16 13 15.5523 13 15C13 14.4477 12.5523 14 12 14Z",
2048
+ stroke: "#000000",
2049
+ strokeWidth: "2",
2050
+ strokeLinecap: "round",
2051
+ strokeLinejoin: "round"
2052
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2053
+ d: "M6 14C5.44772 14 5 14.4477 5 15C5 15.5523 5.44772 16 6 16C6.55228 16 7 15.5523 7 15C7 14.4477 6.55228 14 6 14Z",
2054
+ stroke: "#000000",
2055
+ strokeWidth: "2",
2056
+ strokeLinecap: "round",
2057
+ strokeLinejoin: "round"
2058
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2059
+ d: "M18 8C17.4477 8 17 8.44772 17 9C17 9.55228 17.4477 10 18 10C18.5523 10 19 9.55228 19 9C19 8.44772 18.5523 8 18 8Z",
2060
+ stroke: "#000000",
2061
+ strokeWidth: "2",
2062
+ strokeLinecap: "round",
2063
+ strokeLinejoin: "round"
2064
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2065
+ d: "M12 8C11.4477 8 11 8.44772 11 9C11 9.55228 11.4477 10 12 10C12.5523 10 13 9.55228 13 9C13 8.44772 12.5523 8 12 8Z",
2066
+ stroke: "#000000",
2067
+ strokeWidth: "2",
2068
+ strokeLinecap: "round",
2069
+ strokeLinejoin: "round"
2070
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2071
+ d: "M6 8C5.44772 8 5 8.44772 5 9C5 9.55228 5.44772 10 6 10C6.55228 10 7 9.55228 7 9C7 8.44772 6.55228 8 6 8Z",
2072
+ stroke: "#000000",
2073
+ strokeWidth: "2",
2074
+ strokeLinecap: "round",
2075
+ strokeLinejoin: "round"
2076
+ })))) : null);
2077
+ });
2078
+ /* harmony default export */ const utils_DragHandleSprite = (DragHandleSprite);
2079
+ ;// CONCATENATED MODULE: ./src/utils/hooks/useTableSort.tsx
2080
+ function useTableSort_toConsumableArray(arr) { return useTableSort_arrayWithoutHoles(arr) || useTableSort_iterableToArray(arr) || useTableSort_unsupportedIterableToArray(arr) || useTableSort_nonIterableSpread(); }
2081
+ function useTableSort_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2082
+ function useTableSort_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2083
+ function useTableSort_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableSort_arrayLikeToArray(arr); }
2084
+ function useTableSort_slicedToArray(arr, i) { return useTableSort_arrayWithHoles(arr) || useTableSort_iterableToArrayLimit(arr, i) || useTableSort_unsupportedIterableToArray(arr, i) || useTableSort_nonIterableRest(); }
2085
+ function useTableSort_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2086
+ function useTableSort_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useTableSort_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useTableSort_arrayLikeToArray(o, minLen); }
2087
+ function useTableSort_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2088
+ function useTableSort_iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
2089
+ function useTableSort_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2090
+ /**
2091
+ * Handles the event of sortable table
2092
+ *
2093
+ * @usage:
2094
+
2095
+ const App = () => {
2096
+
2097
+ const sortableTable = true;
2098
+ const rootRef = useRef<any>(null);
2099
+
2100
+ useTableSort({
2101
+ enabled: sortableTable && rootRef.current,
2102
+ spyElement: rootRef.current,
2103
+ sortBy: (handleProcess: Function, filterType: string, inverse: boolean) => (a: Element, b: Element) => {
2104
+
2105
+ // Custom comparison logic
2106
+ let v1 = a.textContent, v2 = b.textContent;
2107
+ if (filterType === 'number') {
2108
+ v1 = parseFloat(v1);
2109
+ v2 = parseFloat(v2);
2110
+ }
2111
+
2112
+ let result = 0;
2113
+ if (filterType === 'text') {
2114
+ result = v1.localeCompare(v2);
2115
+ } else {
2116
+ result = v1 - v2;
2117
+ }
2118
+
2119
+ // Apply display animation and status updates
2120
+ handleProcess();
2121
+
2122
+ return inverse ? -result : result;
2123
+ }
2124
+ }, [rootRef]);
2125
+
2126
+ return (
2127
+ <div
2128
+ ref={rootRef}
2129
+ >Test</div>
2130
+ );
2131
+ };
2132
+
2133
+ */
2134
+
2135
+
2136
+ function useTableSort(_ref, deps) {
2137
+ var enabled = _ref.enabled,
2138
+ data = _ref.data,
2139
+ spyElement = _ref.spyElement,
2140
+ fieldType = _ref.fieldType,
2141
+ _ref$isReverse = _ref.isReverse,
2142
+ isReverse = _ref$isReverse === void 0 ? false : _ref$isReverse,
2143
+ onColSort = _ref.onColSort,
2144
+ onClick = _ref.onClick,
2145
+ sortBy = _ref.sortBy;
2146
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
2147
+ _useState2 = useTableSort_slicedToArray(_useState, 2),
2148
+ inverse = _useState2[0],
2149
+ setInverse = _useState2[1];
2150
+ function handleSortList(e) {
2151
+ if (typeof enabled === 'undefined' || enabled === false) return;
2152
+ var tbodyRef = getTbody(spyElement);
2153
+ if (tbodyRef === null) return;
2154
+ var el = e.currentTarget.closest('[data-table-col]');
2155
+ if (el === null) return;
2156
+ var filterType = fieldType || 'text';
2157
+ var curIndex = el.dataset.tableCol;
2158
+ var targetComparator = [].slice.call(tbodyRef.querySelectorAll("[data-table-col=\"".concat(curIndex, "\"]")));
2159
+ var handleProcess = function handleProcess() {
2160
+ allRows(spyElement).forEach(function (node) {
2161
+ node.classList.add('newsort');
2162
+ });
2163
+ setInverse(!inverse);
2164
+ };
2165
+
2166
+ //
2167
+ var defaultSortBy = function defaultSortBy(a, b) {
2168
+ var txt1 = a.innerHTML.replace(/(<([^>]+)>)/ig, '').toLowerCase(),
2169
+ txt2 = b.innerHTML.replace(/(<([^>]+)>)/ig, '').toLowerCase();
2170
+
2171
+ //type of number
2172
+ if (filterType == 'number') {
2173
+ txt1 = parseFloat(txt1.replace(/[^0-9.+-]+/g, ''));
2174
+ txt2 = parseFloat(txt2.replace(/[^0-9.+-]+/g, ''));
2175
+ }
2176
+
2177
+ //type of date
2178
+ if (filterType == 'date') {
2179
+ txt1 = new Date(txt1);
2180
+ txt2 = new Date(txt2);
2181
+ }
2182
+
2183
+ //add filter class
2184
+ handleProcess();
2185
+
2186
+ // result
2187
+ if (filterType == 'text') {
2188
+ return isReverse ? txt1.localeCompare(txt2, 'zh-CN', {
2189
+ sensitivity: 'base'
2190
+ }) : txt2.localeCompare(txt1, 'zh-CN', {
2191
+ sensitivity: 'base'
2192
+ });
2193
+ } else {
2194
+ return isReverse ? txt1 < txt2 ? -1 : txt1 > txt2 ? 1 : 0 : txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
2195
+ }
2196
+ };
2197
+
2198
+ // Use a custom sort method if available, otherwise default is used
2199
+ var sortFn = typeof sortBy === 'function' ? sortBy(handleProcess, filterType, inverse) : defaultSortBy;
2200
+ targetComparator.sort(sortFn);
2201
+
2202
+ //console.log( 'targetComparator:', targetComparator );
2203
+ //console.log( 'inverse:', inverse );
2204
+
2205
+ if (inverse) targetComparator.reverse();
2206
+ allRows(spyElement).forEach(function (node) {
2207
+ node.remove();
2208
+ });
2209
+ for (var i = 0; i < targetComparator.length; i++) {
2210
+ var curRow = targetComparator[i].parentNode;
2211
+ tbodyRef.appendChild(curRow);
2212
+ }
2213
+
2214
+ // get latest order
2215
+ var sortData = [];
2216
+ allRows(spyElement).forEach(function (node) {
2217
+ sortData.push(Number(node.dataset.order));
2218
+ });
2219
+
2220
+ // callback
2221
+ onColSort === null || onColSort === void 0 ? void 0 : onColSort(sortDataByIndex(sortData, data));
2222
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
2223
+ }
2224
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2225
+ if (enabled) {
2226
+ if (Array.isArray(data)) {
2227
+ data.forEach(function (item, i) {
2228
+ item.order = i;
2229
+ });
2230
+
2231
+ // Initialize custom props of table elements
2232
+ initOrderProps(spyElement);
2233
+ initRowColProps(spyElement);
2234
+ }
2235
+ }
2236
+ }, [data, enabled, spyElement].concat(useTableSort_toConsumableArray(deps)));
2237
+ return {
2238
+ handleSortList: handleSortList
2239
+ };
2240
+ }
2241
+ /* harmony default export */ const hooks_useTableSort = (useTableSort);
2242
+ ;// CONCATENATED MODULE: ./src/utils/SortSprite.tsx
2243
+
2244
+
2245
+
2246
+ var SortSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
2247
+ var fieldType = props.fieldType,
2248
+ className = props.className,
2249
+ icon = props.icon,
2250
+ _props$isReverse = props.isReverse,
2251
+ isReverse = _props$isReverse === void 0 ? false : _props$isReverse,
2252
+ onClick = props.onClick,
2253
+ sortBy = props.sortBy;
2254
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
2255
+ originData = _useContext.originData,
2256
+ rootRef = _useContext.rootRef,
2257
+ colSortable = _useContext.colSortable,
2258
+ onColSort = _useContext.onColSort;
2259
+
2260
+ // sortable table initialization
2261
+ var _useTableSort = hooks_useTableSort({
2262
+ enabled: colSortable && rootRef.current,
2263
+ data: originData,
2264
+ spyElement: rootRef.current,
2265
+ fieldType: fieldType,
2266
+ onColSort: onColSort,
2267
+ isReverse: isReverse,
2268
+ onClick: onClick,
2269
+ sortBy: sortBy
2270
+ }, [rootRef]),
2271
+ handleSortList = _useTableSort.handleSortList;
2272
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, colSortable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2273
+ className: className || 'sort-trigger',
2274
+ onClick: handleSortList
2275
+ }, icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2276
+ width: "1em",
2277
+ height: "1em",
2278
+ viewBox: "0 0 18 18"
2279
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
2280
+ stroke: "none",
2281
+ strokeWidth: "1",
2282
+ fill: "none",
2283
+ fillRule: "evenodd"
2284
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2285
+ d: "M9.5,3 L13,8 L6,8 L9.5,3 L9.5,3 Z M6,11 L13,11 L9.5,16 L6,11 L6,11 Z",
2286
+ id: "path",
2287
+ fill: "#000000"
2288
+ })))) : null);
2289
+ });
2290
+ /* harmony default export */ const utils_SortSprite = (SortSprite);
2291
+ ;// CONCATENATED MODULE: ./src/index.tsx
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+ // utils
2302
+
2303
+
2304
+
2305
+
2306
+ })();
2307
+
2308
+ /******/ return __webpack_exports__;
2309
+ /******/ })()
2310
+ ;
2311
+ });