funda-ui 4.5.712 → 4.5.766

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 (501) hide show
  1. package/Chatbox/index.d.ts +54 -0
  2. package/{publish/lib/cjs/Date → Chatbox}/index.js +2465 -3802
  3. package/README.md +4 -105
  4. package/Utils/useStreamController.d.ts +71 -0
  5. package/Utils/useStreamController.js +494 -0
  6. package/{publish/all.d.ts → all.d.ts} +1 -0
  7. package/{publish/all.js → all.js} +1 -0
  8. package/lib/cjs/Chatbox/index.d.ts +54 -0
  9. package/lib/cjs/Chatbox/index.js +4863 -0
  10. package/lib/cjs/Utils/useStreamController.d.ts +71 -0
  11. package/lib/cjs/Utils/useStreamController.js +494 -0
  12. package/lib/cjs/index.d.ts +1 -0
  13. package/lib/cjs/index.js +1 -0
  14. package/lib/esm/Chatbox/PureLoader.tsx +45 -0
  15. package/lib/esm/Chatbox/TypingEffect.tsx +32 -0
  16. package/lib/esm/Chatbox/index.scss +502 -0
  17. package/lib/esm/Chatbox/index.tsx +1171 -0
  18. package/lib/esm/Chatbox/useStreamController.tsx +277 -0
  19. package/lib/esm/Chatbox/utils/func.ts +107 -0
  20. package/lib/esm/Textarea/index.tsx +1 -0
  21. package/lib/esm/Utils/hooks/useStreamController.tsx +277 -0
  22. package/lib/esm/index.js +1 -0
  23. package/package.json +44 -41
  24. package/.gitattributes +0 -2
  25. package/README_PUBLISH.md +0 -126
  26. package/logo.png +0 -0
  27. package/preview.png +0 -0
  28. package/publish/LICENSE +0 -21
  29. package/publish/README.md +0 -126
  30. package/publish/lib/cjs/Accordion/index.d.ts +0 -2
  31. package/publish/lib/cjs/Accordion/index.js +0 -1035
  32. package/publish/lib/cjs/BackToTop/index.d.ts +0 -17
  33. package/publish/lib/cjs/BackToTop/index.js +0 -904
  34. package/publish/lib/cjs/CascadingSelect/index.d.ts +0 -60
  35. package/publish/lib/cjs/CascadingSelect/index.js +0 -2943
  36. package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +0 -71
  37. package/publish/lib/cjs/CascadingSelectE2E/index.js +0 -3540
  38. package/publish/lib/cjs/Checkbox/index.d.ts +0 -28
  39. package/publish/lib/cjs/Checkbox/index.js +0 -662
  40. package/publish/lib/cjs/ColorPicker/index.d.ts +0 -27
  41. package/publish/lib/cjs/ColorPicker/index.js +0 -662
  42. package/publish/lib/cjs/Date/index.d.ts +0 -70
  43. package/publish/lib/cjs/DigitalClock/index.d.ts +0 -7
  44. package/publish/lib/cjs/DigitalClock/index.js +0 -402
  45. package/publish/lib/cjs/DragDropList/index.d.ts +0 -44
  46. package/publish/lib/cjs/DragDropList/index.js +0 -1587
  47. package/publish/lib/cjs/DropdownMenu/index.d.ts +0 -38
  48. package/publish/lib/cjs/DropdownMenu/index.js +0 -1498
  49. package/publish/lib/cjs/DynamicFields/index.d.ts +0 -40
  50. package/publish/lib/cjs/DynamicFields/index.js +0 -810
  51. package/publish/lib/cjs/EventCalendar/index.d.ts +0 -61
  52. package/publish/lib/cjs/EventCalendar/index.js +0 -3740
  53. package/publish/lib/cjs/EventCalendarTimeline/index.d.ts +0 -100
  54. package/publish/lib/cjs/EventCalendarTimeline/index.js +0 -6084
  55. package/publish/lib/cjs/File/index.d.ts +0 -40
  56. package/publish/lib/cjs/File/index.js +0 -1751
  57. package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +0 -14
  58. package/publish/lib/cjs/HorizontalScrollContent/index.js +0 -426
  59. package/publish/lib/cjs/Input/index.d.ts +0 -59
  60. package/publish/lib/cjs/Input/index.js +0 -1455
  61. package/publish/lib/cjs/LiveSearch/index.d.ts +0 -69
  62. package/publish/lib/cjs/LiveSearch/index.js +0 -3626
  63. package/publish/lib/cjs/MasonryLayout/index.d.ts +0 -14
  64. package/publish/lib/cjs/MasonryLayout/index.js +0 -689
  65. package/publish/lib/cjs/ModalDialog/index.d.ts +0 -79
  66. package/publish/lib/cjs/ModalDialog/index.js +0 -1695
  67. package/publish/lib/cjs/ModeSwitch/index.d.ts +0 -17
  68. package/publish/lib/cjs/ModeSwitch/index.js +0 -202
  69. package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +0 -20
  70. package/publish/lib/cjs/MultilevelDropdownMenu/index.js +0 -930
  71. package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +0 -41
  72. package/publish/lib/cjs/MultipleCheckboxes/index.js +0 -1717
  73. package/publish/lib/cjs/MultipleSelect/index.d.ts +0 -65
  74. package/publish/lib/cjs/MultipleSelect/index.js +0 -3704
  75. package/publish/lib/cjs/NativeSelect/index.d.ts +0 -37
  76. package/publish/lib/cjs/NativeSelect/index.js +0 -1631
  77. package/publish/lib/cjs/NumberInput/index.d.ts +0 -40
  78. package/publish/lib/cjs/NumberInput/index.js +0 -1188
  79. package/publish/lib/cjs/Pagination/index.d.ts +0 -51
  80. package/publish/lib/cjs/Pagination/index.js +0 -612
  81. package/publish/lib/cjs/Radio/index.d.ts +0 -45
  82. package/publish/lib/cjs/Radio/index.js +0 -1391
  83. package/publish/lib/cjs/RangeSlider/index.d.ts +0 -22
  84. package/publish/lib/cjs/RangeSlider/index.js +0 -2665
  85. package/publish/lib/cjs/RootPortal/index.d.ts +0 -8
  86. package/publish/lib/cjs/RootPortal/index.js +0 -141
  87. package/publish/lib/cjs/ScrollReveal/index.d.ts +0 -21
  88. package/publish/lib/cjs/ScrollReveal/index.js +0 -401
  89. package/publish/lib/cjs/Scrollbar/index.d.ts +0 -17
  90. package/publish/lib/cjs/Scrollbar/index.js +0 -1107
  91. package/publish/lib/cjs/SearchBar/index.d.ts +0 -41
  92. package/publish/lib/cjs/SearchBar/index.js +0 -701
  93. package/publish/lib/cjs/Select/index.d.ts +0 -99
  94. package/publish/lib/cjs/Select/index.js +0 -5697
  95. package/publish/lib/cjs/ShowMoreLess/index.d.ts +0 -36
  96. package/publish/lib/cjs/ShowMoreLess/index.js +0 -387
  97. package/publish/lib/cjs/Switch/index.d.ts +0 -25
  98. package/publish/lib/cjs/Switch/index.js +0 -628
  99. package/publish/lib/cjs/Table/index.d.ts +0 -12
  100. package/publish/lib/cjs/Table/index.js +0 -2062
  101. package/publish/lib/cjs/Tabs/index.d.ts +0 -3
  102. package/publish/lib/cjs/Tabs/index.js +0 -771
  103. package/publish/lib/cjs/TagInput/index.d.ts +0 -31
  104. package/publish/lib/cjs/TagInput/index.js +0 -1144
  105. package/publish/lib/cjs/Textarea/index.d.ts +0 -50
  106. package/publish/lib/cjs/Textarea/index.js +0 -1784
  107. package/publish/lib/cjs/Toast/index.d.ts +0 -34
  108. package/publish/lib/cjs/Toast/index.js +0 -861
  109. package/publish/lib/cjs/Tooltip/index.d.ts +0 -23
  110. package/publish/lib/cjs/Tooltip/index.js +0 -1674
  111. package/publish/lib/cjs/Tree/index.d.ts +0 -62
  112. package/publish/lib/cjs/Tree/index.js +0 -1960
  113. package/publish/lib/cjs/Utils/anim.d.ts +0 -11
  114. package/publish/lib/cjs/Utils/anim.js +0 -400
  115. package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +0 -8
  116. package/publish/lib/cjs/Utils/bodyScrollLock.js +0 -311
  117. package/publish/lib/cjs/Utils/buffer.d.ts +0 -67
  118. package/publish/lib/cjs/Utils/buffer.js +0 -343
  119. package/publish/lib/cjs/Utils/cls.d.ts +0 -15
  120. package/publish/lib/cjs/Utils/cls.js +0 -124
  121. package/publish/lib/cjs/Utils/convert.d.ts +0 -25
  122. package/publish/lib/cjs/Utils/convert.js +0 -109
  123. package/publish/lib/cjs/Utils/date.d.ts +0 -217
  124. package/publish/lib/cjs/Utils/date.js +0 -567
  125. package/publish/lib/cjs/Utils/dom.d.ts +0 -13
  126. package/publish/lib/cjs/Utils/dom.js +0 -215
  127. package/publish/lib/cjs/Utils/easing.d.ts +0 -29
  128. package/publish/lib/cjs/Utils/easing.js +0 -221
  129. package/publish/lib/cjs/Utils/extract.d.ts +0 -28
  130. package/publish/lib/cjs/Utils/extract.js +0 -130
  131. package/publish/lib/cjs/Utils/getElementProperty.d.ts +0 -52
  132. package/publish/lib/cjs/Utils/getElementProperty.js +0 -189
  133. package/publish/lib/cjs/Utils/guid.d.ts +0 -7
  134. package/publish/lib/cjs/Utils/guid.js +0 -67
  135. package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +0 -21
  136. package/publish/lib/cjs/Utils/initDefaultOptions.js +0 -131
  137. package/publish/lib/cjs/Utils/inputsCalculation.d.ts +0 -28
  138. package/publish/lib/cjs/Utils/inputsCalculation.js +0 -188
  139. package/publish/lib/cjs/Utils/math.d.ts +0 -77
  140. package/publish/lib/cjs/Utils/math.js +0 -305
  141. package/publish/lib/cjs/Utils/object.d.ts +0 -18
  142. package/publish/lib/cjs/Utils/object.js +0 -120
  143. package/publish/lib/cjs/Utils/os.d.ts +0 -2
  144. package/publish/lib/cjs/Utils/os.js +0 -104
  145. package/publish/lib/cjs/Utils/performance.d.ts +0 -3
  146. package/publish/lib/cjs/Utils/performance.js +0 -94
  147. package/publish/lib/cjs/Utils/tree.d.ts +0 -40
  148. package/publish/lib/cjs/Utils/tree.js +0 -195
  149. package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +0 -10
  150. package/publish/lib/cjs/Utils/useAutosizeTextArea.js +0 -227
  151. package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +0 -125
  152. package/publish/lib/cjs/Utils/useBoundedDrag.js +0 -380
  153. package/publish/lib/cjs/Utils/useClickOutside.d.ts +0 -33
  154. package/publish/lib/cjs/Utils/useClickOutside.js +0 -166
  155. package/publish/lib/cjs/Utils/useComId.d.ts +0 -6
  156. package/publish/lib/cjs/Utils/useComId.js +0 -114
  157. package/publish/lib/cjs/Utils/useDebounce.d.ts +0 -20
  158. package/publish/lib/cjs/Utils/useDebounce.js +0 -138
  159. package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +0 -169
  160. package/publish/lib/cjs/Utils/useDragDropPosition.js +0 -456
  161. package/publish/lib/cjs/Utils/useDraggable.d.ts +0 -62
  162. package/publish/lib/cjs/Utils/useDraggable.js +0 -348
  163. package/publish/lib/cjs/Utils/useInterval.d.ts +0 -5
  164. package/publish/lib/cjs/Utils/useInterval.js +0 -168
  165. package/publish/lib/cjs/Utils/useIsMobile.d.ts +0 -2
  166. package/publish/lib/cjs/Utils/useIsMobile.js +0 -168
  167. package/publish/lib/cjs/Utils/useKeyPress.d.ts +0 -44
  168. package/publish/lib/cjs/Utils/useKeyPress.js +0 -200
  169. package/publish/lib/cjs/Utils/useThrottle.d.ts +0 -2
  170. package/publish/lib/cjs/Utils/useThrottle.js +0 -136
  171. package/publish/lib/cjs/Utils/useWindowScroll.d.ts +0 -12
  172. package/publish/lib/cjs/Utils/useWindowScroll.js +0 -217
  173. package/publish/lib/cjs/Utils/viewport.d.ts +0 -7
  174. package/publish/lib/cjs/Utils/viewport.js +0 -64
  175. package/publish/lib/cjs/index.d.ts +0 -45
  176. package/publish/lib/cjs/index.js +0 -46
  177. package/publish/lib/css/BackToTop/index.css +0 -34
  178. package/publish/lib/css/CascadingSelect/index.css +0 -216
  179. package/publish/lib/css/CascadingSelectE2E/index.css +0 -216
  180. package/publish/lib/css/ColorPicker/index.css +0 -58
  181. package/publish/lib/css/Date/index.css +0 -434
  182. package/publish/lib/css/DragDropList/index.css +0 -188
  183. package/publish/lib/css/DropdownMenu/index.css +0 -151
  184. package/publish/lib/css/EventCalendar/index.css +0 -300
  185. package/publish/lib/css/EventCalendarTimeline/index.css +0 -694
  186. package/publish/lib/css/HorizontalScrollContent/index.css +0 -70
  187. package/publish/lib/css/LiveSearch/index.css +0 -55
  188. package/publish/lib/css/MultilevelDropdownMenu/index.css +0 -38
  189. package/publish/lib/css/MultipleSelect/index.css +0 -313
  190. package/publish/lib/css/RangeSlider/index.css +0 -150
  191. package/publish/lib/css/Scrollbar/index.css +0 -176
  192. package/publish/lib/css/Select/index.css +0 -368
  193. package/publish/lib/css/ShowMoreLess/index.css +0 -23
  194. package/publish/lib/css/Table/index.css +0 -584
  195. package/publish/lib/css/TagInput/index.css +0 -91
  196. package/publish/lib/css/Toast/index.css +0 -201
  197. package/publish/lib/css/Tooltip/index.css +0 -197
  198. package/publish/lib/css/Tree/index.css +0 -232
  199. package/publish/lib/esm/Accordion/Accordion.tsx +0 -184
  200. package/publish/lib/esm/Accordion/AccordionItem.tsx +0 -143
  201. package/publish/lib/esm/Accordion/index.tsx +0 -2
  202. package/publish/lib/esm/BackToTop/index.scss +0 -47
  203. package/publish/lib/esm/BackToTop/index.tsx +0 -177
  204. package/publish/lib/esm/CascadingSelect/Group.tsx +0 -82
  205. package/publish/lib/esm/CascadingSelect/index.scss +0 -291
  206. package/publish/lib/esm/CascadingSelect/index.tsx +0 -1203
  207. package/publish/lib/esm/CascadingSelectE2E/Group.tsx +0 -83
  208. package/publish/lib/esm/CascadingSelectE2E/index.scss +0 -293
  209. package/publish/lib/esm/CascadingSelectE2E/index.tsx +0 -1471
  210. package/publish/lib/esm/Checkbox/index.tsx +0 -193
  211. package/publish/lib/esm/ColorPicker/index.scss +0 -91
  212. package/publish/lib/esm/ColorPicker/index.tsx +0 -204
  213. package/publish/lib/esm/Date/Calendar.tsx +0 -723
  214. package/publish/lib/esm/Date/index.scss +0 -567
  215. package/publish/lib/esm/Date/index.tsx +0 -1683
  216. package/publish/lib/esm/Date/localization/en_US.js +0 -13
  217. package/publish/lib/esm/Date/localization/zh_CN.js +0 -12
  218. package/publish/lib/esm/DigitalClock/index.tsx +0 -74
  219. package/publish/lib/esm/DragDropList/index.scss +0 -245
  220. package/publish/lib/esm/DragDropList/index.tsx +0 -494
  221. package/publish/lib/esm/DropdownMenu/Option.tsx +0 -55
  222. package/publish/lib/esm/DropdownMenu/index.scss +0 -205
  223. package/publish/lib/esm/DropdownMenu/index.tsx +0 -377
  224. package/publish/lib/esm/DynamicFields/index.tsx +0 -404
  225. package/publish/lib/esm/EventCalendar/index.scss +0 -407
  226. package/publish/lib/esm/EventCalendar/index.tsx +0 -1004
  227. package/publish/lib/esm/EventCalendarTimeline/index.scss +0 -926
  228. package/publish/lib/esm/EventCalendarTimeline/index.tsx +0 -2683
  229. package/publish/lib/esm/File/index.tsx +0 -477
  230. package/publish/lib/esm/HorizontalScrollContent/index.scss +0 -87
  231. package/publish/lib/esm/HorizontalScrollContent/index.tsx +0 -171
  232. package/publish/lib/esm/Input/index.tsx +0 -614
  233. package/publish/lib/esm/LiveSearch/index.scss +0 -82
  234. package/publish/lib/esm/LiveSearch/index.tsx +0 -960
  235. package/publish/lib/esm/MasonryLayout/index.tsx +0 -326
  236. package/publish/lib/esm/ModalDialog/index.tsx +0 -552
  237. package/publish/lib/esm/ModeSwitch/index.tsx +0 -82
  238. package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +0 -265
  239. package/publish/lib/esm/MultilevelDropdownMenu/index.scss +0 -79
  240. package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +0 -77
  241. package/publish/lib/esm/MultipleCheckboxes/index.tsx +0 -669
  242. package/publish/lib/esm/MultipleSelect/index.scss +0 -398
  243. package/publish/lib/esm/MultipleSelect/index.tsx +0 -766
  244. package/publish/lib/esm/MultipleSelect/utils/func.ts +0 -61
  245. package/publish/lib/esm/NativeSelect/index.tsx +0 -396
  246. package/publish/lib/esm/NativeSelect/utils/func.ts +0 -49
  247. package/publish/lib/esm/NumberInput/index.tsx +0 -385
  248. package/publish/lib/esm/Pagination/index.tsx +0 -286
  249. package/publish/lib/esm/Pagination/pagination-navigators.tsx +0 -60
  250. package/publish/lib/esm/Radio/index.tsx +0 -670
  251. package/publish/lib/esm/RangeSlider/index.scss +0 -186
  252. package/publish/lib/esm/RangeSlider/index.tsx +0 -241
  253. package/publish/lib/esm/RootPortal/index.tsx +0 -53
  254. package/publish/lib/esm/ScrollReveal/index.tsx +0 -148
  255. package/publish/lib/esm/Scrollbar/index.scss +0 -221
  256. package/publish/lib/esm/Scrollbar/index.tsx +0 -561
  257. package/publish/lib/esm/SearchBar/index.tsx +0 -253
  258. package/publish/lib/esm/Select/index.scss +0 -553
  259. package/publish/lib/esm/Select/index.tsx +0 -2816
  260. package/publish/lib/esm/Select/utils/func.ts +0 -106
  261. package/publish/lib/esm/ShowMoreLess/index.scss +0 -27
  262. package/publish/lib/esm/ShowMoreLess/index.tsx +0 -145
  263. package/publish/lib/esm/Switch/index.tsx +0 -147
  264. package/publish/lib/esm/Table/Table.tsx +0 -257
  265. package/publish/lib/esm/Table/TableBody.tsx +0 -41
  266. package/publish/lib/esm/Table/TableCaption.tsx +0 -34
  267. package/publish/lib/esm/Table/TableCell.tsx +0 -123
  268. package/publish/lib/esm/Table/TableColgroup.tsx +0 -38
  269. package/publish/lib/esm/Table/TableContext.tsx +0 -26
  270. package/publish/lib/esm/Table/TableFoot.tsx +0 -28
  271. package/publish/lib/esm/Table/TableHead.tsx +0 -28
  272. package/publish/lib/esm/Table/TableRow.tsx +0 -76
  273. package/publish/lib/esm/Table/index.scss +0 -418
  274. package/publish/lib/esm/Table/index.tsx +0 -14
  275. package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +0 -46
  276. package/publish/lib/esm/Table/utils/SortSprite.tsx +0 -57
  277. package/publish/lib/esm/Table/utils/TableFilter.tsx +0 -56
  278. package/publish/lib/esm/Table/utils/ToggleSelection.tsx +0 -225
  279. package/publish/lib/esm/Table/utils/func.ts +0 -171
  280. package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +0 -342
  281. package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +0 -154
  282. package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +0 -92
  283. package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +0 -143
  284. package/publish/lib/esm/Tabs/TabList.tsx +0 -50
  285. package/publish/lib/esm/Tabs/TabPanel.tsx +0 -44
  286. package/publish/lib/esm/Tabs/Tabs.tsx +0 -282
  287. package/publish/lib/esm/Tabs/index.tsx +0 -3
  288. package/publish/lib/esm/TagInput/index.scss +0 -126
  289. package/publish/lib/esm/TagInput/index.tsx +0 -352
  290. package/publish/lib/esm/Textarea/index.tsx +0 -608
  291. package/publish/lib/esm/Toast/Item.tsx +0 -124
  292. package/publish/lib/esm/Toast/index.scss +0 -269
  293. package/publish/lib/esm/Toast/index.tsx +0 -374
  294. package/publish/lib/esm/Tooltip/index.scss +0 -269
  295. package/publish/lib/esm/Tooltip/index.tsx +0 -312
  296. package/publish/lib/esm/Tree/TreeList.tsx +0 -616
  297. package/publish/lib/esm/Tree/index.scss +0 -386
  298. package/publish/lib/esm/Tree/index.tsx +0 -396
  299. package/publish/lib/esm/Tree/init-height.tsx +0 -27
  300. package/publish/lib/esm/Tree/utils/func.ts +0 -15
  301. package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +0 -125
  302. package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +0 -301
  303. package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +0 -69
  304. package/publish/lib/esm/Utils/hooks/useComId.tsx +0 -13
  305. package/publish/lib/esm/Utils/hooks/useDebounce.tsx +0 -40
  306. package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -420
  307. package/publish/lib/esm/Utils/hooks/useDraggable.tsx +0 -265
  308. package/publish/lib/esm/Utils/hooks/useInterval.tsx +0 -74
  309. package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +0 -56
  310. package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +0 -104
  311. package/publish/lib/esm/Utils/hooks/useThrottle.tsx +0 -39
  312. package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +0 -83
  313. package/publish/lib/esm/Utils/libs/anim.ts +0 -96
  314. package/publish/lib/esm/Utils/libs/buffer.ts +0 -262
  315. package/publish/lib/esm/Utils/libs/cls.ts +0 -64
  316. package/publish/lib/esm/Utils/libs/convert.ts +0 -59
  317. package/publish/lib/esm/Utils/libs/date.ts +0 -578
  318. package/publish/lib/esm/Utils/libs/dom.ts +0 -150
  319. package/publish/lib/esm/Utils/libs/easing.ts +0 -201
  320. package/publish/lib/esm/Utils/libs/extract.ts +0 -86
  321. package/publish/lib/esm/Utils/libs/getElementProperty.ts +0 -150
  322. package/publish/lib/esm/Utils/libs/guid.ts +0 -16
  323. package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +0 -104
  324. package/publish/lib/esm/Utils/libs/inputsCalculation.ts +0 -160
  325. package/publish/lib/esm/Utils/libs/math.ts +0 -276
  326. package/publish/lib/esm/Utils/libs/object.ts +0 -68
  327. package/publish/lib/esm/Utils/libs/os.ts +0 -63
  328. package/publish/lib/esm/Utils/libs/performance.ts +0 -47
  329. package/publish/lib/esm/Utils/libs/tree.ts +0 -119
  330. package/publish/lib/esm/Utils/libs/viewport.ts +0 -20
  331. package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +0 -286
  332. package/publish/lib/esm/index.js +0 -43
  333. package/publish/package.json +0 -1
  334. /package/{publish/Accordion → Accordion}/index.d.ts +0 -0
  335. /package/{publish/Accordion → Accordion}/index.js +0 -0
  336. /package/{publish/BackToTop → BackToTop}/index.css +0 -0
  337. /package/{publish/BackToTop → BackToTop}/index.d.ts +0 -0
  338. /package/{publish/BackToTop → BackToTop}/index.js +0 -0
  339. /package/{publish/CascadingSelect → CascadingSelect}/index.css +0 -0
  340. /package/{publish/CascadingSelect → CascadingSelect}/index.d.ts +0 -0
  341. /package/{publish/CascadingSelect → CascadingSelect}/index.js +0 -0
  342. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.css +0 -0
  343. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.d.ts +0 -0
  344. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.js +0 -0
  345. /package/{publish/Checkbox → Checkbox}/index.d.ts +0 -0
  346. /package/{publish/Checkbox → Checkbox}/index.js +0 -0
  347. /package/{publish/ColorPicker → ColorPicker}/index.css +0 -0
  348. /package/{publish/ColorPicker → ColorPicker}/index.d.ts +0 -0
  349. /package/{publish/ColorPicker → ColorPicker}/index.js +0 -0
  350. /package/{publish/Date → Date}/index.css +0 -0
  351. /package/{publish/Date → Date}/index.d.ts +0 -0
  352. /package/{publish/Date → Date}/index.js +0 -0
  353. /package/{publish/DigitalClock → DigitalClock}/index.d.ts +0 -0
  354. /package/{publish/DigitalClock → DigitalClock}/index.js +0 -0
  355. /package/{publish/DragDropList → DragDropList}/index.css +0 -0
  356. /package/{publish/DragDropList → DragDropList}/index.d.ts +0 -0
  357. /package/{publish/DragDropList → DragDropList}/index.js +0 -0
  358. /package/{publish/DropdownMenu → DropdownMenu}/index.css +0 -0
  359. /package/{publish/DropdownMenu → DropdownMenu}/index.d.ts +0 -0
  360. /package/{publish/DropdownMenu → DropdownMenu}/index.js +0 -0
  361. /package/{publish/DynamicFields → DynamicFields}/index.d.ts +0 -0
  362. /package/{publish/DynamicFields → DynamicFields}/index.js +0 -0
  363. /package/{publish/EventCalendar → EventCalendar}/index.css +0 -0
  364. /package/{publish/EventCalendar → EventCalendar}/index.d.ts +0 -0
  365. /package/{publish/EventCalendar → EventCalendar}/index.js +0 -0
  366. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.css +0 -0
  367. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.d.ts +0 -0
  368. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.js +0 -0
  369. /package/{publish/File → File}/index.d.ts +0 -0
  370. /package/{publish/File → File}/index.js +0 -0
  371. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.css +0 -0
  372. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.d.ts +0 -0
  373. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.js +0 -0
  374. /package/{publish/Input → Input}/index.d.ts +0 -0
  375. /package/{publish/Input → Input}/index.js +0 -0
  376. /package/{publish/LiveSearch → LiveSearch}/index.css +0 -0
  377. /package/{publish/LiveSearch → LiveSearch}/index.d.ts +0 -0
  378. /package/{publish/LiveSearch → LiveSearch}/index.js +0 -0
  379. /package/{publish/MasonryLayout → MasonryLayout}/index.d.ts +0 -0
  380. /package/{publish/MasonryLayout → MasonryLayout}/index.js +0 -0
  381. /package/{publish/ModalDialog → ModalDialog}/index.d.ts +0 -0
  382. /package/{publish/ModalDialog → ModalDialog}/index.js +0 -0
  383. /package/{publish/ModeSwitch → ModeSwitch}/index.d.ts +0 -0
  384. /package/{publish/ModeSwitch → ModeSwitch}/index.js +0 -0
  385. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.css +0 -0
  386. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.d.ts +0 -0
  387. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.js +0 -0
  388. /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.d.ts +0 -0
  389. /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.js +0 -0
  390. /package/{publish/MultipleSelect → MultipleSelect}/index.css +0 -0
  391. /package/{publish/MultipleSelect → MultipleSelect}/index.d.ts +0 -0
  392. /package/{publish/MultipleSelect → MultipleSelect}/index.js +0 -0
  393. /package/{publish/NativeSelect → NativeSelect}/index.d.ts +0 -0
  394. /package/{publish/NativeSelect → NativeSelect}/index.js +0 -0
  395. /package/{publish/NumberInput → NumberInput}/index.d.ts +0 -0
  396. /package/{publish/NumberInput → NumberInput}/index.js +0 -0
  397. /package/{publish/Pagination → Pagination}/index.d.ts +0 -0
  398. /package/{publish/Pagination → Pagination}/index.js +0 -0
  399. /package/{publish/Radio → Radio}/index.d.ts +0 -0
  400. /package/{publish/Radio → Radio}/index.js +0 -0
  401. /package/{publish/RangeSlider → RangeSlider}/index.css +0 -0
  402. /package/{publish/RangeSlider → RangeSlider}/index.d.ts +0 -0
  403. /package/{publish/RangeSlider → RangeSlider}/index.js +0 -0
  404. /package/{publish/RootPortal → RootPortal}/index.d.ts +0 -0
  405. /package/{publish/RootPortal → RootPortal}/index.js +0 -0
  406. /package/{publish/ScrollReveal → ScrollReveal}/index.d.ts +0 -0
  407. /package/{publish/ScrollReveal → ScrollReveal}/index.js +0 -0
  408. /package/{publish/Scrollbar → Scrollbar}/index.css +0 -0
  409. /package/{publish/Scrollbar → Scrollbar}/index.d.ts +0 -0
  410. /package/{publish/Scrollbar → Scrollbar}/index.js +0 -0
  411. /package/{publish/SearchBar → SearchBar}/index.d.ts +0 -0
  412. /package/{publish/SearchBar → SearchBar}/index.js +0 -0
  413. /package/{publish/Select → Select}/index.css +0 -0
  414. /package/{publish/Select → Select}/index.d.ts +0 -0
  415. /package/{publish/Select → Select}/index.js +0 -0
  416. /package/{publish/ShowMoreLess → ShowMoreLess}/index.css +0 -0
  417. /package/{publish/ShowMoreLess → ShowMoreLess}/index.d.ts +0 -0
  418. /package/{publish/ShowMoreLess → ShowMoreLess}/index.js +0 -0
  419. /package/{publish/Switch → Switch}/index.d.ts +0 -0
  420. /package/{publish/Switch → Switch}/index.js +0 -0
  421. /package/{publish/Table → Table}/index.css +0 -0
  422. /package/{publish/Table → Table}/index.d.ts +0 -0
  423. /package/{publish/Table → Table}/index.js +0 -0
  424. /package/{publish/Tabs → Tabs}/index.d.ts +0 -0
  425. /package/{publish/Tabs → Tabs}/index.js +0 -0
  426. /package/{publish/TagInput → TagInput}/index.css +0 -0
  427. /package/{publish/TagInput → TagInput}/index.d.ts +0 -0
  428. /package/{publish/TagInput → TagInput}/index.js +0 -0
  429. /package/{publish/Textarea → Textarea}/index.d.ts +0 -0
  430. /package/{publish/Textarea → Textarea}/index.js +0 -0
  431. /package/{publish/Toast → Toast}/index.css +0 -0
  432. /package/{publish/Toast → Toast}/index.d.ts +0 -0
  433. /package/{publish/Toast → Toast}/index.js +0 -0
  434. /package/{publish/Tooltip → Tooltip}/index.css +0 -0
  435. /package/{publish/Tooltip → Tooltip}/index.d.ts +0 -0
  436. /package/{publish/Tooltip → Tooltip}/index.js +0 -0
  437. /package/{publish/Tree → Tree}/index.css +0 -0
  438. /package/{publish/Tree → Tree}/index.d.ts +0 -0
  439. /package/{publish/Tree → Tree}/index.js +0 -0
  440. /package/{publish/Utils → Utils}/anim.d.ts +0 -0
  441. /package/{publish/Utils → Utils}/anim.js +0 -0
  442. /package/{publish/Utils → Utils}/bodyScrollLock.d.ts +0 -0
  443. /package/{publish/Utils → Utils}/bodyScrollLock.js +0 -0
  444. /package/{publish/Utils → Utils}/buffer.d.ts +0 -0
  445. /package/{publish/Utils → Utils}/buffer.js +0 -0
  446. /package/{publish/Utils → Utils}/cls.d.ts +0 -0
  447. /package/{publish/Utils → Utils}/cls.js +0 -0
  448. /package/{publish/Utils → Utils}/convert.d.ts +0 -0
  449. /package/{publish/Utils → Utils}/convert.js +0 -0
  450. /package/{publish/Utils → Utils}/date.d.ts +0 -0
  451. /package/{publish/Utils → Utils}/date.js +0 -0
  452. /package/{publish/Utils → Utils}/dom.d.ts +0 -0
  453. /package/{publish/Utils → Utils}/dom.js +0 -0
  454. /package/{publish/Utils → Utils}/easing.d.ts +0 -0
  455. /package/{publish/Utils → Utils}/easing.js +0 -0
  456. /package/{publish/Utils → Utils}/extract.d.ts +0 -0
  457. /package/{publish/Utils → Utils}/extract.js +0 -0
  458. /package/{publish/Utils → Utils}/getElementProperty.d.ts +0 -0
  459. /package/{publish/Utils → Utils}/getElementProperty.js +0 -0
  460. /package/{publish/Utils → Utils}/guid.d.ts +0 -0
  461. /package/{publish/Utils → Utils}/guid.js +0 -0
  462. /package/{publish/Utils → Utils}/initDefaultOptions.d.ts +0 -0
  463. /package/{publish/Utils → Utils}/initDefaultOptions.js +0 -0
  464. /package/{publish/Utils → Utils}/inputsCalculation.d.ts +0 -0
  465. /package/{publish/Utils → Utils}/inputsCalculation.js +0 -0
  466. /package/{publish/Utils → Utils}/math.d.ts +0 -0
  467. /package/{publish/Utils → Utils}/math.js +0 -0
  468. /package/{publish/Utils → Utils}/object.d.ts +0 -0
  469. /package/{publish/Utils → Utils}/object.js +0 -0
  470. /package/{publish/Utils → Utils}/os.d.ts +0 -0
  471. /package/{publish/Utils → Utils}/os.js +0 -0
  472. /package/{publish/Utils → Utils}/performance.d.ts +0 -0
  473. /package/{publish/Utils → Utils}/performance.js +0 -0
  474. /package/{publish/Utils → Utils}/tree.d.ts +0 -0
  475. /package/{publish/Utils → Utils}/tree.js +0 -0
  476. /package/{publish/Utils → Utils}/useAutosizeTextArea.d.ts +0 -0
  477. /package/{publish/Utils → Utils}/useAutosizeTextArea.js +0 -0
  478. /package/{publish/Utils → Utils}/useBoundedDrag.d.ts +0 -0
  479. /package/{publish/Utils → Utils}/useBoundedDrag.js +0 -0
  480. /package/{publish/Utils → Utils}/useClickOutside.d.ts +0 -0
  481. /package/{publish/Utils → Utils}/useClickOutside.js +0 -0
  482. /package/{publish/Utils → Utils}/useComId.d.ts +0 -0
  483. /package/{publish/Utils → Utils}/useComId.js +0 -0
  484. /package/{publish/Utils → Utils}/useDebounce.d.ts +0 -0
  485. /package/{publish/Utils → Utils}/useDebounce.js +0 -0
  486. /package/{publish/Utils → Utils}/useDragDropPosition.d.ts +0 -0
  487. /package/{publish/Utils → Utils}/useDragDropPosition.js +0 -0
  488. /package/{publish/Utils → Utils}/useDraggable.d.ts +0 -0
  489. /package/{publish/Utils → Utils}/useDraggable.js +0 -0
  490. /package/{publish/Utils → Utils}/useInterval.d.ts +0 -0
  491. /package/{publish/Utils → Utils}/useInterval.js +0 -0
  492. /package/{publish/Utils → Utils}/useIsMobile.d.ts +0 -0
  493. /package/{publish/Utils → Utils}/useIsMobile.js +0 -0
  494. /package/{publish/Utils → Utils}/useKeyPress.d.ts +0 -0
  495. /package/{publish/Utils → Utils}/useKeyPress.js +0 -0
  496. /package/{publish/Utils → Utils}/useThrottle.d.ts +0 -0
  497. /package/{publish/Utils → Utils}/useThrottle.js +0 -0
  498. /package/{publish/Utils → Utils}/useWindowScroll.d.ts +0 -0
  499. /package/{publish/Utils → Utils}/useWindowScroll.js +0 -0
  500. /package/{publish/Utils → Utils}/viewport.d.ts +0 -0
  501. /package/{publish/Utils → Utils}/viewport.js +0 -0
@@ -1,2062 +0,0 @@
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(col, row) {
658
- return "cell-".concat(col, "-").concat(row);
659
- }
660
- function removeCellFocusClassName(root) {
661
- if (root) {
662
- [].slice.call(root.querySelectorAll('td, th')).forEach(function (el) {
663
- el.classList.remove('cell-focus');
664
- });
665
- }
666
- }
667
- ;// CONCATENATED MODULE: ./src/utils/hooks/useTableResponsive.tsx
668
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
669
- 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."); }
670
- 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); }
671
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
672
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
673
- 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; }
674
- /**
675
- * Handles the event of responsive table
676
- *
677
- * @usage:
678
-
679
- const App = () => {
680
-
681
- const responsiveTable = true;
682
- const rootRef = useRef<any>(null);
683
-
684
- useTableResponsive({
685
- enabled: responsiveTable && rootRef.current,
686
- spyElement: rootRef.current
687
- }, [rootRef]);
688
-
689
- return (
690
- <div
691
- ref={rootRef}
692
- >Test</div>
693
- );
694
- };
695
-
696
- */
697
-
698
-
699
-
700
- function useTableResponsive(_ref, deps) {
701
- var enabled = _ref.enabled,
702
- spyElement = _ref.spyElement;
703
- var debounce = function debounce(fn) {
704
- var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
705
- var timer;
706
- return function () {
707
- clearTimeout(timer);
708
- timer = setTimeout(function () {
709
- fn.apply(this, arguments);
710
- }, limit);
711
- };
712
- };
713
- var windowResizeUpdate = debounce(handleWindowUpdate, 50);
714
- var windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0;
715
- function handleWindowUpdate() {
716
- // Check window width has actually changed and it's not just iOS triggering a resize event on scroll
717
- if (window.innerWidth != windowWidth) {
718
- // Update the window width for next time
719
- windowWidth = window.innerWidth;
720
-
721
- // Do stuff here
722
- tableElemScrolledInit(spyElement, windowWidth);
723
- }
724
- }
725
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
726
- if (enabled) {
727
- // Initialize custom props of table elements
728
- initOrderProps(spyElement);
729
- initRowColProps(spyElement);
730
-
731
- // With scroll bars
732
- var _windowWidth = window.innerWidth;
733
- tableElemScrolledInit(spyElement, _windowWidth);
734
-
735
- // Add function to the element that should be used as the scrollable area.
736
- window.removeEventListener('resize', windowResizeUpdate);
737
- window.addEventListener('resize', windowResizeUpdate);
738
-
739
- // Remove the global list of events, especially as scroll and interval.
740
- return function () {
741
- window.removeEventListener('resize', windowResizeUpdate);
742
- };
743
- }
744
- }, [enabled, spyElement].concat(_toConsumableArray(deps)));
745
- }
746
- /* harmony default export */ const hooks_useTableResponsive = (useTableResponsive);
747
- ;// CONCATENATED MODULE: ./src/utils/hooks/useTableDraggable.tsx
748
- function useTableDraggable_toConsumableArray(arr) { return useTableDraggable_arrayWithoutHoles(arr) || useTableDraggable_iterableToArray(arr) || useTableDraggable_unsupportedIterableToArray(arr) || useTableDraggable_nonIterableSpread(); }
749
- 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."); }
750
- function useTableDraggable_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
751
- function useTableDraggable_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableDraggable_arrayLikeToArray(arr); }
752
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || useTableDraggable_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
753
- 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."); }
754
- 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); }
755
- 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; }
756
- 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; } }
757
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
758
- /**
759
- * Handles the event of drag-and-drop sorting
760
- *
761
- * @usage:
762
-
763
- const App = () => {
764
-
765
- const rowDraggable = true;
766
- const data = [{a: 1}, {b: 2}]
767
- const rootRef = useRef<any>(null);
768
-
769
- const {
770
- handleDragStart,
771
- handleDragEnd,
772
- handledragOver,
773
- handleTbodyEnter
774
- } = useTableDraggable({
775
- enabled: rowDraggable && spyElement,
776
- data: data,
777
- spyElement: spyElement
778
- onRowDrag: (dragStart: any, dragEnd: any) => void(0)
779
- }, [data, rootRef]);
780
-
781
- return (
782
- <div
783
- ref={rootRef}
784
- >Test</div>
785
- );
786
-
787
- };
788
-
789
- */
790
-
791
-
792
-
793
- function useTableDraggable(_ref, deps) {
794
- var enabled = _ref.enabled,
795
- data = _ref.data,
796
- spyElement = _ref.spyElement,
797
- onRowDrag = _ref.onRowDrag;
798
- // drag & drop
799
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
800
- _useState2 = _slicedToArray(_useState, 2),
801
- sortData = _useState2[0],
802
- setSortData = _useState2[1];
803
-
804
- // ================================================================
805
- // drag & drop
806
- // ================================================================
807
- var draggedObj = null;
808
- var overObj = null;
809
- var placeholderGenerator = function placeholderGenerator(trHeight) {
810
- var tbodyRef = getTbody(spyElement);
811
- if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
812
-
813
- // Insert a row at the "index" of the table
814
- var newRow = document.createElement('tr');
815
- newRow.className = 'row-placeholder';
816
- newRow.dataset.placeholder = 'true';
817
- newRow.style.height = trHeight + 'px';
818
-
819
- // Insert a cell in the row at index
820
- var newCell = newRow.insertCell(0);
821
- newCell.colSpan = tbodyRef.querySelector('tr').children.length;
822
-
823
- // Append a text node to the cell
824
- var newText = document.createTextNode(' ');
825
- newCell.appendChild(newText);
826
- return newRow;
827
- };
828
- var lastRowGenerator = function lastRowGenerator(trHeight) {
829
- var tbodyRef = getTbody(spyElement);
830
- if (tbodyRef === null || tbodyRef.querySelector('tr') === null) return;
831
- var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
832
- if (cloneEl !== null) return;
833
-
834
- // Insert a row at the "index" of the table
835
- var newRow = document.createElement('tr');
836
- newRow.className = 'row-obj row-obj-clonelast';
837
- newRow.dataset.order = allRows(spyElement).length.toString();
838
- newRow.style.height = trHeight + 'px';
839
- newRow.style.display = 'none';
840
-
841
- // Insert a cell in the row at index
842
- var newCell = newRow.insertCell(0);
843
- newCell.colSpan = tbodyRef.querySelector('tr').children.length;
844
-
845
- // Append a text node to the cell
846
- var newText = document.createTextNode(' ');
847
- newCell.appendChild(newText);
848
- return newRow;
849
- };
850
- var removePlaceholder = function removePlaceholder() {
851
- var tbodyRef = getTbody(spyElement);
852
- if (tbodyRef === null) return;
853
-
854
- // Delete row at the "index" of the table
855
- var placeholder = [].slice.call(tbodyRef.querySelectorAll("[data-placeholder]"));
856
- placeholder.forEach(function (node) {
857
- tbodyRef.removeChild(node);
858
- });
859
- };
860
-
861
- // Initialize drag & drop data
862
- // !!! Execute it only once
863
- var initDragDropData = function initDragDropData() {
864
- if (spyElement === null) return;
865
- if (typeof spyElement.dataset.dragdropDataInit !== 'undefined') return;
866
- spyElement.dataset.dragdropDataInit = 1;
867
- var _allRows = allRows(spyElement);
868
-
869
- // sort list data
870
- var listIndexes = _allRows.map(function (node, i) {
871
- return i;
872
- });
873
- setSortData(listIndexes);
874
-
875
- //last placeholder
876
- if (_allRows.length > 0) {
877
- var lastEl = lastRowGenerator(_allRows.at(-1).clientHeight);
878
- if (typeof _allRows.at(-1) !== 'undefined') {
879
- insertAfter(lastEl, _allRows.at(-1));
880
- }
881
- }
882
- };
883
- var handleTbodyEnter = function handleTbodyEnter(e) {
884
- var _table = e.currentTarget.closest('table');
885
- if (_table === null) return;
886
- _table.querySelector('tbody').classList.add('drag-trigger-mousedown');
887
- };
888
- var handleTbodyLeave = function handleTbodyLeave(e) {
889
- var tbodyRef = getTbody(spyElement);
890
- if (tbodyRef === null) return;
891
- tbodyRef === null || tbodyRef === void 0 ? void 0 : tbodyRef.classList.remove('drag-trigger-mousedown');
892
- };
893
-
894
- // events fired on the drop targets
895
- var handledragOver = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
896
- var tbodyRef = getTbody(spyElement);
897
- if (tbodyRef === null) return;
898
- e.preventDefault();
899
- if (draggedObj === null) return;
900
- draggedObj.style.display = 'none';
901
- if (e.target.classList.contains('row-placeholder')) return;
902
- var itemsWrapper = e.target.parentNode;
903
- if (itemsWrapper.classList.contains('row-obj')) {
904
- overObj = itemsWrapper;
905
- removePlaceholder();
906
- if (Number(overObj.dataset.order) === allRows(spyElement).length - 1) {
907
- tbodyRef.insertBefore(placeholderGenerator(allRows(spyElement).at(-2).clientHeight), overObj);
908
- } else {
909
- tbodyRef.insertBefore(placeholderGenerator(overObj.clientHeight), overObj);
910
- }
911
- }
912
- }, [sortData]);
913
- var handleDragStart = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
914
- var tbodyRef = getTbody(spyElement);
915
- if (tbodyRef === null) return;
916
- draggedObj = e.currentTarget;
917
- e.dataTransfer.effectAllowed = 'move';
918
- e.dataTransfer.setData('text/html', draggedObj);
919
- draggedObj.classList.add('dragging');
920
- allRows(spyElement).at(-1).style.setProperty('display', 'table-row', "important");
921
-
922
- // callback
923
- var dragStart = function dragStart(callback) {
924
- callback.call(null, draggedObj, sortData, sortDataByIndex(sortData, data));
925
- };
926
- onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(dragStart, null);
927
-
928
- // init clone <tr>
929
- // !!! It needs to be put at the end of the code to fix the location of the clone element
930
- var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
931
- if (cloneEl !== null) {
932
- cloneEl.style.display = 'none';
933
- }
934
- }, [handledragOver]);
935
- var handleDragEnd = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
936
- var tbodyRef = getTbody(spyElement);
937
- if (tbodyRef === null) return;
938
- draggedObj.style.display = 'table-row';
939
- removePlaceholder();
940
- draggedObj.classList.remove('dragging');
941
- tbodyRef === null || tbodyRef === void 0 ? void 0 : tbodyRef.classList.remove('drag-trigger-mousedown');
942
- if (overObj === null) return;
943
-
944
- // update state
945
- var curData = [];
946
- curData = JSON.parse(JSON.stringify(sortData));
947
- var from = Number(draggedObj.dataset.order);
948
- var to = Number(overObj.dataset.order);
949
- if (from < to) to--;
950
-
951
- //sort data
952
- var newData = [];
953
-
954
- // console.log('--> data1:', curData);
955
-
956
- curData.splice(to, 0, curData.splice(from, 1)[0]);
957
- for (var i = 0; i < curData.length; i++) {
958
- for (var j = 0; j < curData.length; j++) {
959
- if (curData[i] === curData[j]) {
960
- newData.push(curData[j]);
961
- }
962
- }
963
- }
964
-
965
- // console.log("--> data2: ", newData);
966
- setSortData(newData);
967
-
968
- // reset data-id in order to sort data
969
- newData.forEach(function (curId, order) {
970
- var _el = spyElement.querySelector('table').querySelector("tbody [data-key=\"row-".concat(curId, "\"]"));
971
- if (_el !== null) _el.dataset.order = order;
972
- });
973
-
974
- // sort elements
975
- var categoryItemsArray = allRows(spyElement);
976
- var sorter = function sorter(a, b) {
977
- var txt1 = Number(a.dataset.order),
978
- txt2 = Number(b.dataset.order);
979
- return txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
980
- };
981
- var sorted = categoryItemsArray.sort(sorter).reverse();
982
- sorted.forEach(function (e) {
983
- return spyElement.querySelector('table').querySelector('tbody').appendChild(e);
984
- });
985
-
986
- // callback
987
- var dragEnd = function dragEnd(callback) {
988
- callback.call(null, draggedObj, newData, sortDataByIndex(newData, data));
989
- };
990
- onRowDrag === null || onRowDrag === void 0 ? void 0 : onRowDrag(null, dragEnd);
991
-
992
- // init clone <tr>
993
- // !!! It needs to be put at the end of the code to fix the location of the clone element
994
- var _allRows = allRows(spyElement);
995
- var cloneEl = tbodyRef.querySelector('.row-obj-clonelast');
996
- if (cloneEl !== null) {
997
- if (typeof _allRows.at(-1) !== 'undefined') {
998
- insertAfter(cloneEl, _allRows.at(-1));
999
- cloneEl.style.display = 'none';
1000
- }
1001
- }
1002
- }, [sortData]);
1003
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1004
- if (enabled) {
1005
- if (Array.isArray(data) && data.length > 0) {
1006
- // !!! REQUIRED "data.length > 0" to avoid data-order cannot be assigned when asynchronous data is empty
1007
- data.forEach(function (item, i) {
1008
- item.order = i;
1009
- });
1010
-
1011
- // Initialize custom props of table elements
1012
- initOrderProps(spyElement);
1013
- initRowColProps(spyElement);
1014
-
1015
- // Initialize drag & drop data
1016
- initDragDropData();
1017
- }
1018
- }
1019
- }, [data, enabled, spyElement].concat(useTableDraggable_toConsumableArray(deps)));
1020
- return {
1021
- handleDragStart: handleDragStart,
1022
- handleDragEnd: handleDragEnd,
1023
- handledragOver: handledragOver,
1024
- handleTbodyEnter: handleTbodyEnter,
1025
- handleTbodyLeave: handleTbodyLeave
1026
- };
1027
- }
1028
- /* harmony default export */ const hooks_useTableDraggable = (useTableDraggable);
1029
- ;// CONCATENATED MODULE: ./src/Table.tsx
1030
- var _excluded = ["children", "wrapperClassName", "tableClassName", "bordered", "colGroup", "cellAutoWidth", "colSortable", "onColSort", "rowDraggable", "onRowDrag", "responsive", "enhancedResponsive", "enhancedResponsiveWithScrollBar", "data", "filterFields", "filterControlClassName", "filterControlPlaceholder", "filterLabel", "onChangeFilter", "dataSelected", "rowSelectable", "onChangeRowSelect", "keyboardFocusable", "onCellKeyPressed"];
1031
- 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); }
1032
- function Table_slicedToArray(arr, i) { return Table_arrayWithHoles(arr) || Table_iterableToArrayLimit(arr, i) || Table_unsupportedIterableToArray(arr, i) || Table_nonIterableRest(); }
1033
- 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."); }
1034
- 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); }
1035
- 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; }
1036
- 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; } }
1037
- function Table_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1038
- 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; }
1039
- 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; }
1040
-
1041
-
1042
-
1043
-
1044
-
1045
-
1046
- var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1047
- var children = _ref.children,
1048
- wrapperClassName = _ref.wrapperClassName,
1049
- tableClassName = _ref.tableClassName,
1050
- bordered = _ref.bordered,
1051
- colGroup = _ref.colGroup,
1052
- cellAutoWidth = _ref.cellAutoWidth,
1053
- colSortable = _ref.colSortable,
1054
- onColSort = _ref.onColSort,
1055
- rowDraggable = _ref.rowDraggable,
1056
- onRowDrag = _ref.onRowDrag,
1057
- responsive = _ref.responsive,
1058
- enhancedResponsive = _ref.enhancedResponsive,
1059
- enhancedResponsiveWithScrollBar = _ref.enhancedResponsiveWithScrollBar,
1060
- data = _ref.data,
1061
- filterFields = _ref.filterFields,
1062
- filterControlClassName = _ref.filterControlClassName,
1063
- filterControlPlaceholder = _ref.filterControlPlaceholder,
1064
- filterLabel = _ref.filterLabel,
1065
- onChangeFilter = _ref.onChangeFilter,
1066
- dataSelected = _ref.dataSelected,
1067
- rowSelectable = _ref.rowSelectable,
1068
- onChangeRowSelect = _ref.onChangeRowSelect,
1069
- keyboardFocusable = _ref.keyboardFocusable,
1070
- onCellKeyPressed = _ref.onCellKeyPressed,
1071
- attributes = _objectWithoutProperties(_ref, _excluded);
1072
- var uniqueID = useComId_default()();
1073
- var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1074
-
1075
- // context
1076
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
1077
- _useState2 = Table_slicedToArray(_useState, 2),
1078
- instance = _useState2[0],
1079
- setInstance = _useState2[1];
1080
-
1081
- // selection
1082
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Set()),
1083
- _useState4 = Table_slicedToArray(_useState3, 2),
1084
- selectedItems = _useState4[0],
1085
- setSelectedItems = _useState4[1];
1086
-
1087
- // effective element movement on keystroke
1088
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
1089
- _useState6 = Table_slicedToArray(_useState5, 2),
1090
- rootDataInfo = _useState6[0],
1091
- setRootDataInfo = _useState6[1];
1092
- var refNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Map());
1093
- var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1094
- _useState8 = Table_slicedToArray(_useState7, 2),
1095
- focusableCellId = _useState8[0],
1096
- setFocusableCellId = _useState8[1];
1097
-
1098
- // responsive
1099
- var responsiveClasses = typeof responsive === 'undefined' || responsive === true ? 'table-responsive' : '';
1100
- var enhancedResponsiveClasses = '';
1101
- if (enhancedResponsive && !enhancedResponsiveWithScrollBar) enhancedResponsiveClasses += ' table-enhanced-responsive';
1102
- if (enhancedResponsiveWithScrollBar && !enhancedResponsive) enhancedResponsiveClasses += ' table-enhanced-responsive-scrolled';
1103
-
1104
- //Set the class names of different styles
1105
- var tableClasses = '';
1106
- if (bordered) tableClasses += ' table-bordered';
1107
- if (colGroup) tableClasses += ' table-colgroup';
1108
-
1109
- // responsive table initialization
1110
- hooks_useTableResponsive({
1111
- enabled: enhancedResponsiveWithScrollBar && rootRef.current,
1112
- spyElement: rootRef.current
1113
- }, [rootRef]);
1114
-
1115
- // initialize drag & drop data
1116
- var _useTableDraggable = hooks_useTableDraggable({
1117
- enabled: rowDraggable && rootRef.current,
1118
- data: data,
1119
- spyElement: rootRef.current,
1120
- onRowDrag: onRowDrag
1121
- }, [data, rootRef]),
1122
- handleDragStart = _useTableDraggable.handleDragStart,
1123
- handleDragEnd = _useTableDraggable.handleDragEnd,
1124
- handledragOver = _useTableDraggable.handledragOver,
1125
- handleTbodyEnter = _useTableDraggable.handleTbodyEnter;
1126
-
1127
- // initialize context
1128
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1129
- setInstance(data);
1130
- }, [data]);
1131
-
1132
- // The items are selected by default
1133
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1134
- if (Array.isArray(data) && Array.isArray(dataSelected) && dataSelected.length > 0) {
1135
- var newSelectedItems = new Set(selectedItems);
1136
- dataSelected.forEach(function (s) {
1137
- newSelectedItems.add(String(s));
1138
- });
1139
- setSelectedItems(newSelectedItems);
1140
- }
1141
- }, [data, dataSelected]);
1142
- 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, {
1143
- value: {
1144
- originData: data,
1145
- rootRef: rootRef,
1146
- // sort
1147
- colSortable: colSortable,
1148
- onColSort: onColSort,
1149
- // drag & drop
1150
- rowDraggable: rowDraggable,
1151
- handleDragStart: handleDragStart,
1152
- handleDragEnd: handleDragEnd,
1153
- handledragOver: handledragOver,
1154
- handleTbodyEnter: handleTbodyEnter,
1155
- // filter
1156
- filterFields: filterFields,
1157
- instance: instance,
1158
- setInstance: setInstance,
1159
- onChangeFilter: onChangeFilter,
1160
- // selection
1161
- dataSelected: dataSelected,
1162
- rowSelectable: rowSelectable,
1163
- selectedItems: selectedItems,
1164
- setSelectedItems: setSelectedItems,
1165
- onChangeRowSelect: onChangeRowSelect,
1166
- // key press
1167
- keyboardFocusable: keyboardFocusable,
1168
- rootDataInfo: rootDataInfo,
1169
- setRootDataInfo: setRootDataInfo,
1170
- refNode: refNode,
1171
- focusableCellId: focusableCellId,
1172
- setFocusableCellId: setFocusableCellId,
1173
- onCellKeyPressed: onCellKeyPressed
1174
- }
1175
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({}, attributes, {
1176
- id: uniqueID,
1177
- ref: function ref(node) {
1178
- rootRef.current = node;
1179
- if (typeof externalRef === 'function') {
1180
- externalRef(node);
1181
- } else if (externalRef) {
1182
- externalRef.current = node;
1183
- }
1184
- },
1185
- className: (0,cls.combinedCls)('syntable__wrapper', (0,cls.clsWrite)(wrapperClassName, 'mb-3 position-relative'), responsiveClasses, enhancedResponsiveClasses, {
1186
- 'has-checkbox': rowSelectable,
1187
- 'allow-dragdrop': rowDraggable,
1188
- 'allow-sort': colSortable
1189
- })
1190
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("table", {
1191
- className: (0,cls.combinedCls)((0,cls.clsWrite)(tableClassName, 'table'), tableClasses, {
1192
- 'cell-autowidth': cellAutoWidth
1193
- })
1194
- }, children))));
1195
- });
1196
- /* harmony default export */ const src_Table = (Table);
1197
- ;// CONCATENATED MODULE: ./src/TableBody.tsx
1198
- var TableBody_excluded = ["children", "className"];
1199
- 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); }
1200
- 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; }
1201
- 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; }
1202
-
1203
-
1204
- var TableBody = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1205
- var children = _ref.children,
1206
- className = _ref.className,
1207
- attributes = TableBody_objectWithoutProperties(_ref, TableBody_excluded);
1208
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1209
- rowDraggable = _useContext.rowDraggable,
1210
- handledragOver = _useContext.handledragOver;
1211
- 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, {
1212
- ref: externalRef,
1213
- onDragOver: rowDraggable ? handledragOver : function () {
1214
- return void 0;
1215
- },
1216
- className: className || ''
1217
- }), children));
1218
- });
1219
- /* harmony default export */ const src_TableBody = (TableBody);
1220
- ;// CONCATENATED MODULE: ./src/utils/hooks/useTableKeyPress.tsx
1221
- 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); }
1222
- function useTableKeyPress_toConsumableArray(arr) { return useTableKeyPress_arrayWithoutHoles(arr) || useTableKeyPress_iterableToArray(arr) || useTableKeyPress_unsupportedIterableToArray(arr) || useTableKeyPress_nonIterableSpread(); }
1223
- 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."); }
1224
- 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); }
1225
- function useTableKeyPress_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1226
- function useTableKeyPress_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableKeyPress_arrayLikeToArray(arr); }
1227
- 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; }
1228
- 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; }
1229
- 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); } }
1230
- 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); }); }; }
1231
- /**
1232
- * Listens for changes in the pressed state of a given key
1233
- *
1234
- * @usage:
1235
-
1236
- const App = () => {
1237
-
1238
- const keyboardFocusable = true;
1239
- const rootRef = useRef<any>(null);
1240
-
1241
- // effective element movement on keystroke
1242
- const [rootDataInfo, setRootDataInfo] = useState<null | {totalRow: number}>(null);
1243
- const refNode = useRef(new Map<string, HTMLTableElement>());
1244
- const [focusableCellId, setFocusableCellId] = useState<string>('');
1245
-
1246
- const { handleKeyPressed } = useTableKeyPress({
1247
- enabled: keyboardFocusable,
1248
- data: [{a: 1, b: 2, c: 3}],
1249
- spyElement: rootRef.current,
1250
- rootDataInfo,
1251
- setRootDataInfo,
1252
- refNode,
1253
- focusableCellId,
1254
- setFocusableCellId,
1255
- onCellKeyPressed
1256
- }, [rootRef]);
1257
-
1258
-
1259
- return (
1260
- <div
1261
- ref={rootRef}
1262
- tabIndex={-1}
1263
- onKeyDown={handleKeyPressed} // require "tabIndex" attribute
1264
- >Test</div>
1265
- );
1266
- };
1267
-
1268
- */
1269
-
1270
-
1271
- var useTableKeyPress = function useTableKeyPress(_ref, deps) {
1272
- var enabled = _ref.enabled,
1273
- data = _ref.data,
1274
- spyElement = _ref.spyElement,
1275
- rootDataInfo = _ref.rootDataInfo,
1276
- setRootDataInfo = _ref.setRootDataInfo,
1277
- refNode = _ref.refNode,
1278
- focusableCellId = _ref.focusableCellId,
1279
- setFocusableCellId = _ref.setFocusableCellId,
1280
- onCellKeyPressed = _ref.onCellKeyPressed,
1281
- onKeyDown = _ref.onKeyDown;
1282
- var handleKeyPressed = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)( /*#__PURE__*/function () {
1283
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
1284
- var key, oldCellSignal, _row, _col, move;
1285
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1286
- while (1) switch (_context.prev = _context.next) {
1287
- case 0:
1288
- if (!(!Array.isArray(data) || rootDataInfo === null || spyElement === null || typeof enabled === 'undefined' || enabled === false)) {
1289
- _context.next = 2;
1290
- break;
1291
- }
1292
- return _context.abrupt("return");
1293
- case 2:
1294
- key = event.code;
1295
- oldCellSignal = focusableCellId === null || focusableCellId === void 0 ? void 0 : focusableCellId.replace('cell-', '').split('-');
1296
- _row = Number(oldCellSignal[0]);
1297
- _col = Number(oldCellSignal[1]);
1298
- move = function move(key) {
1299
- var _spyElement$querySele;
1300
- switch (key) {
1301
- case 'ArrowLeft':
1302
- _col = _col - 1 < 0 ? 0 : _col - 1;
1303
- break;
1304
- case 'ArrowRight':
1305
- _col = _col + 1 > data.length - 1 ? data.length - 1 : _col + 1;
1306
- break;
1307
- case 'ArrowUp':
1308
- _row = _row - 1 < 0 ? 0 : _row - 1;
1309
- break;
1310
- case 'ArrowDown':
1311
- _row = _row + 1 > rootDataInfo.totalRow - 1 ? rootDataInfo.totalRow - 1 : _row + 1;
1312
- break;
1313
- }
1314
- var nextCellSignal = cellMark(_row, _col);
1315
-
1316
- // focus current cell
1317
- removeCellFocusClassName(spyElement);
1318
- (_spyElement$querySele = spyElement.querySelector(".".concat(nextCellSignal))) === null || _spyElement$querySele === void 0 ? void 0 : _spyElement$querySele.classList.add('cell-focus');
1319
-
1320
- //
1321
- setFocusableCellId(nextCellSignal);
1322
-
1323
- // callback
1324
- onCellKeyPressed === null || onCellKeyPressed === void 0 ? void 0 : onCellKeyPressed(nextCellSignal, refNode.current.get(nextCellSignal), event);
1325
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
1326
- };
1327
- if (key === 'ArrowLeft') {
1328
- move('ArrowLeft');
1329
- }
1330
- if (key === 'ArrowRight') {
1331
- move('ArrowRight');
1332
- }
1333
- if (key === 'ArrowUp') {
1334
- move('ArrowUp');
1335
- }
1336
- if (key === 'ArrowDown') {
1337
- move('ArrowDown');
1338
- }
1339
- case 11:
1340
- case "end":
1341
- return _context.stop();
1342
- }
1343
- }, _callee);
1344
- }));
1345
- return function (_x) {
1346
- return _ref2.apply(this, arguments);
1347
- };
1348
- }(), [focusableCellId]);
1349
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1350
- if (enabled) {
1351
- // Initialize custom props of table elements
1352
- initOrderProps(spyElement);
1353
- initRowColProps(spyElement);
1354
-
1355
- // Update cell ids
1356
- if (Array.isArray(data)) {
1357
- setRootDataInfo({
1358
- totalRow: data.length
1359
- });
1360
- }
1361
- }
1362
- }, [enabled, spyElement].concat(useTableKeyPress_toConsumableArray(deps)));
1363
- return {
1364
- handleKeyPressed: handleKeyPressed
1365
- };
1366
- };
1367
- /* harmony default export */ const hooks_useTableKeyPress = (useTableKeyPress);
1368
- ;// CONCATENATED MODULE: ./src/TableCell.tsx
1369
- 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); }
1370
- var TableCell_excluded = ["children", "active", "nowrap", "activeClassName", "className", "colSpan", "style", "scope", "onClick", "onKeyDown"];
1371
- 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); }
1372
- 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; }
1373
- 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; }
1374
- 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; }
1375
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return TableCell_typeof(key) === "symbol" ? key : String(key); }
1376
- 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); }
1377
- 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; }
1378
- 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; }
1379
-
1380
-
1381
-
1382
-
1383
-
1384
- var TableCell = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1385
- var children = _ref.children,
1386
- active = _ref.active,
1387
- nowrap = _ref.nowrap,
1388
- activeClassName = _ref.activeClassName,
1389
- myClassName = _ref.className,
1390
- colSpan = _ref.colSpan,
1391
- style = _ref.style,
1392
- scope = _ref.scope,
1393
- _onClick = _ref.onClick,
1394
- onKeyDown = _ref.onKeyDown,
1395
- attributes = TableCell_objectWithoutProperties(_ref, TableCell_excluded);
1396
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1397
- originData = _useContext.originData,
1398
- rootRef = _useContext.rootRef,
1399
- rootDataInfo = _useContext.rootDataInfo,
1400
- setRootDataInfo = _useContext.setRootDataInfo,
1401
- refNode = _useContext.refNode,
1402
- focusableCellId = _useContext.focusableCellId,
1403
- setFocusableCellId = _useContext.setFocusableCellId,
1404
- keyboardFocusable = _useContext.keyboardFocusable,
1405
- onCellKeyPressed = _useContext.onCellKeyPressed;
1406
- var CellComponent = scope ? 'th' : 'td';
1407
-
1408
- // key press initialization
1409
- var _useTableKeyPress = hooks_useTableKeyPress({
1410
- enabled: keyboardFocusable,
1411
- data: originData,
1412
- spyElement: rootRef.current,
1413
- rootDataInfo: rootDataInfo,
1414
- setRootDataInfo: setRootDataInfo,
1415
- refNode: refNode,
1416
- focusableCellId: focusableCellId,
1417
- setFocusableCellId: setFocusableCellId,
1418
- onCellKeyPressed: onCellKeyPressed,
1419
- onKeyDown: onKeyDown
1420
- }, [rootRef]),
1421
- handleKeyPressed = _useTableKeyPress.handleKeyPressed;
1422
- 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, {
1423
- style: typeof nowrap === 'undefined' ? style : _objectSpread({
1424
- whiteSpace: (0,cls.clsWrite)(nowrap, 'normal', 'nowrap')
1425
- }, style),
1426
- ref: function ref(node) {
1427
- if (typeof externalRef === 'function') {
1428
- externalRef(node);
1429
- } else if (externalRef) {
1430
- externalRef.current = node;
1431
- }
1432
- if (node) {
1433
- var _row = node.dataset.tableRow;
1434
- var _col = node.dataset.tableCol;
1435
- refNode.current.set(cellMark(_row, _col), node);
1436
- }
1437
- },
1438
- colSpan: colSpan,
1439
- tabIndex: -1,
1440
- onKeyDown: handleKeyPressed // require "tabIndex" attribute
1441
- ,
1442
- onClick: function onClick(e) {
1443
- var _el = e.currentTarget;
1444
-
1445
- // key press initialization
1446
- if (keyboardFocusable) {
1447
- var _row = Number(_el.dataset.tableRow);
1448
- var _col = Number(_el.dataset.tableCol);
1449
- removeCellFocusClassName(rootRef.current);
1450
- setFocusableCellId(cellMark(_row, _col));
1451
- _el.classList.add('cell-focus');
1452
- }
1453
-
1454
- // callback
1455
- _onClick === null || _onClick === void 0 ? void 0 : _onClick(e);
1456
- },
1457
- className: (0,cls.combinedCls)(myClassName, active ? (0,cls.clsWrite)(activeClassName, 'active') : undefined)
1458
- }), children));
1459
- });
1460
- /* harmony default export */ const src_TableCell = (TableCell);
1461
- ;// CONCATENATED MODULE: ./src/TableHead.tsx
1462
- var TableHead_excluded = ["children", "className"];
1463
- 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); }
1464
- 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; }
1465
- 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; }
1466
-
1467
- var TableHead = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1468
- var children = _ref.children,
1469
- className = _ref.className,
1470
- attributes = TableHead_objectWithoutProperties(_ref, TableHead_excluded);
1471
- 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, {
1472
- ref: externalRef,
1473
- className: className || ''
1474
- }), children));
1475
- });
1476
- /* harmony default export */ const src_TableHead = (TableHead);
1477
- ;// CONCATENATED MODULE: ./src/TableFoot.tsx
1478
- var TableFoot_excluded = ["children", "className"];
1479
- 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); }
1480
- 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; }
1481
- 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; }
1482
-
1483
- var TableFoot = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1484
- var children = _ref.children,
1485
- className = _ref.className,
1486
- attributes = TableFoot_objectWithoutProperties(_ref, TableFoot_excluded);
1487
- 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, {
1488
- ref: externalRef,
1489
- className: className || ''
1490
- }), children));
1491
- });
1492
- /* harmony default export */ const src_TableFoot = (TableFoot);
1493
- ;// CONCATENATED MODULE: ./src/TableRow.tsx
1494
- var TableRow_excluded = ["children", "active", "activeClassName", "className", "itemData"];
1495
- 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); }
1496
- 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); }
1497
- 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; }
1498
- 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; }
1499
-
1500
-
1501
-
1502
- var TableRow = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1503
- var children = _ref.children,
1504
- active = _ref.active,
1505
- activeClassName = _ref.activeClassName,
1506
- className = _ref.className,
1507
- itemData = _ref.itemData,
1508
- attributes = TableRow_objectWithoutProperties(_ref, TableRow_excluded);
1509
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1510
- originData = _useContext.originData,
1511
- filterFields = _useContext.filterFields,
1512
- selectedItems = _useContext.selectedItems,
1513
- instance = _useContext.instance,
1514
- rowDraggable = _useContext.rowDraggable,
1515
- handleDragStart = _useContext.handleDragStart,
1516
- handleDragEnd = _useContext.handleDragEnd;
1517
-
1518
- // ================================================================
1519
- // filter
1520
- // ================================================================
1521
- var filteredData = instance || [];
1522
- var filterFieldsData = filterFields || [];
1523
-
1524
- // ================================================================
1525
- // selection
1526
- // ================================================================
1527
- var _res = convertMapToArr(selectedItems);
1528
- var filteredSelectedItems = _res.map(function (v) {
1529
- return Number(v);
1530
- }).map(function (rowNum) {
1531
- if (JSON.stringify(itemData) === JSON.stringify(originData[rowNum])) {
1532
- return originData[rowNum];
1533
- }
1534
- }).filter(Boolean);
1535
- var selectedClassName = activeClassName || 'active';
1536
- 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, {
1537
- ref: externalRef,
1538
- draggable: rowDraggable,
1539
- onDragStart: rowDraggable ? handleDragStart : function () {
1540
- return void 0;
1541
- },
1542
- onDragEnd: rowDraggable ? handleDragEnd : function () {
1543
- return void 0;
1544
- },
1545
- "data-row-data": "".concat(itemData && TableRow_typeof(itemData) === 'object' ? JSON.stringify(itemData) : itemData),
1546
- className: "row-obj ".concat(className || '', " ").concat(active ? selectedClassName : '', " ").concat(itemData && originData ? filteredData.every(function (item) {
1547
- return filterFieldsData.some(function (s) {
1548
- var _item$s, _itemData$s;
1549
- 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()));
1550
- });
1551
- }) ? 'd-none' : '' : '', " ").concat(itemData && originData ? filteredSelectedItems.some(function (item) {
1552
- return JSON.stringify(itemData) === JSON.stringify(item);
1553
- }) ? selectedClassName : '' : '')
1554
- }), children));
1555
- });
1556
- /* harmony default export */ const src_TableRow = (TableRow);
1557
- ;// CONCATENATED MODULE: ./src/TableColgroup.tsx
1558
- var TableColgroup_excluded = ["className", "length"];
1559
- 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); }
1560
- 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; }
1561
- 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; }
1562
-
1563
- var TableColgroup = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1564
- var className = _ref.className,
1565
- length = _ref.length,
1566
- attributes = TableColgroup_objectWithoutProperties(_ref, TableColgroup_excluded);
1567
- 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, {
1568
- ref: externalRef,
1569
- className: className || ''
1570
- }), Array.from({
1571
- length: length || 0
1572
- }, function (v, k) {
1573
- return k; // Return k(ey) as value for this index
1574
- }).map(function (el, i) {
1575
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("col", {
1576
- key: i
1577
- });
1578
- })));
1579
- });
1580
- /* harmony default export */ const src_TableColgroup = (TableColgroup);
1581
- ;// CONCATENATED MODULE: ./src/TableCaption.tsx
1582
- var TableCaption_excluded = ["children", "captionSide", "className"];
1583
- 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); }
1584
- 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; }
1585
- 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; }
1586
-
1587
- var TableCaption = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
1588
- var children = _ref.children,
1589
- captionSide = _ref.captionSide,
1590
- className = _ref.className,
1591
- attributes = TableCaption_objectWithoutProperties(_ref, TableCaption_excluded);
1592
- 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, {
1593
- ref: externalRef,
1594
- className: "syntable__caption ".concat(className || '', " syntable__caption--").concat(captionSide || 'top')
1595
- }), children));
1596
- });
1597
- /* harmony default export */ const src_TableCaption = (TableCaption);
1598
- ;// CONCATENATED MODULE: ./src/utils/TableFilter.tsx
1599
-
1600
-
1601
- var TableFilter = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
1602
- var className = props.className,
1603
- placeholder = props.placeholder,
1604
- label = props.label,
1605
- _onChange = props.onChange;
1606
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1607
- originData = _useContext.originData,
1608
- filterFields = _useContext.filterFields,
1609
- setInstance = _useContext.setInstance,
1610
- onChangeFilter = _useContext.onChangeFilter;
1611
- var filterFieldsData = filterFields || [];
1612
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1613
- className: "syntable__filter-container"
1614
- }, label || null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
1615
- type: "text",
1616
- ref: externalRef,
1617
- className: className || '',
1618
- onChange: function onChange(e) {
1619
- var filteredData = originData === null || originData === void 0 ? void 0 : originData.filter(function (item) {
1620
- return filterFieldsData.some(function (s) {
1621
- var _item$s;
1622
- return (_item$s = item[s]) === null || _item$s === void 0 ? void 0 : _item$s.toLowerCase().includes(e.target.value.toLowerCase());
1623
- });
1624
- });
1625
- if (e.target.value.trim() === '') {
1626
- setInstance(originData);
1627
- onChangeFilter === null || onChangeFilter === void 0 ? void 0 : onChangeFilter(originData);
1628
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(e, originData);
1629
- } else {
1630
- setInstance(filteredData);
1631
- onChangeFilter === null || onChangeFilter === void 0 ? void 0 : onChangeFilter(filteredData);
1632
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(e, filteredData);
1633
- }
1634
- },
1635
- placeholder: placeholder || ''
1636
- }));
1637
- });
1638
- /* harmony default export */ const utils_TableFilter = (TableFilter);
1639
- ;// CONCATENATED MODULE: ./src/utils/ToggleSelection.tsx
1640
- var ToggleSelection_excluded = ["contentRef", "row", "useRadio", "className", "indeterminate", "disabled", "name", "value", "onChange", "checked"];
1641
- 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); }
1642
- function ToggleSelection_slicedToArray(arr, i) { return ToggleSelection_arrayWithHoles(arr) || ToggleSelection_iterableToArrayLimit(arr, i) || ToggleSelection_unsupportedIterableToArray(arr, i) || ToggleSelection_nonIterableRest(); }
1643
- 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."); }
1644
- 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); }
1645
- 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; }
1646
- 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; } }
1647
- function ToggleSelection_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1648
- 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; }
1649
- 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; }
1650
-
1651
-
1652
-
1653
- var ToggleSelection = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, ref) {
1654
- var contentRef = props.contentRef,
1655
- row = props.row,
1656
- useRadio = props.useRadio,
1657
- className = props.className,
1658
- _props$indeterminate = props.indeterminate,
1659
- indeterminate = _props$indeterminate === void 0 ? false : _props$indeterminate,
1660
- disabled = props.disabled,
1661
- name = props.name,
1662
- value = props.value,
1663
- onChange = props.onChange,
1664
- checked = props.checked,
1665
- attributes = ToggleSelection_objectWithoutProperties(props, ToggleSelection_excluded);
1666
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1667
- originData = _useContext.originData,
1668
- rowSelectable = _useContext.rowSelectable,
1669
- selectedItems = _useContext.selectedItems,
1670
- setSelectedItems = _useContext.setSelectedItems,
1671
- onChangeRowSelect = _useContext.onChangeRowSelect;
1672
- var totalSize = originData.length;
1673
- var defaultRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
1674
- var resolvedRef = ref || defaultRef;
1675
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1676
- _useState2 = ToggleSelection_slicedToArray(_useState, 2),
1677
- allChecked = _useState2[0],
1678
- setAllChecked = _useState2[1];
1679
-
1680
- // exposes the following methods
1681
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
1682
- return {
1683
- indeterminate: function indeterminate(value) {
1684
- resolvedRef.current.indeterminate = value;
1685
- },
1686
- setSelectAll: function setSelectAll(value) {
1687
- setAllChecked(value);
1688
- },
1689
- set: function set(check) {
1690
- var _resolvedRef$current;
1691
- var s = String((_resolvedRef$current = resolvedRef.current) === null || _resolvedRef$current === void 0 ? void 0 : _resolvedRef$current.dataset.row);
1692
- setSelectedItems(function (prev) {
1693
- var _data = new Set(prev);
1694
- if (check) {
1695
- _data.add(s);
1696
- } else {
1697
- _data["delete"](s);
1698
- }
1699
- return _data;
1700
- });
1701
- },
1702
- control: function control() {
1703
- return resolvedRef.current;
1704
- }
1705
- };
1706
- }, [contentRef, resolvedRef, selectedItems]);
1707
- function selectTarget(rowIndex) {
1708
- var _val = String(rowIndex);
1709
-
1710
- // filter
1711
- // =================================================================
1712
- var _selectedIndex = [];
1713
- var filteredData = [];
1714
- if (!isNaN(row) && Array.isArray(originData)) {
1715
- // all
1716
- if (row === -1) {
1717
- var _target = Array.from({
1718
- length: totalSize
1719
- }, function (v, k) {
1720
- return String(k);
1721
- });
1722
- if (selectedItems.size === 0 || selectedItems.size < totalSize) {
1723
- _selectedIndex = convertMapToArr(checkedSpecItems(_target, true)).map(function (v) {
1724
- return Number(v);
1725
- });
1726
- setAllChecked(true);
1727
- } else {
1728
- _selectedIndex = convertMapToArr(checkedSpecItems(_target, false)).map(function (v) {
1729
- return Number(v);
1730
- });
1731
- setAllChecked(false);
1732
- }
1733
- } else {
1734
- var _newSelectedItems = checkedOneItem(_val);
1735
- var _res = convertMapToArr(_newSelectedItems);
1736
- _selectedIndex = _res.map(function (v) {
1737
- return Number(v);
1738
- });
1739
- }
1740
- filteredData = originData.filter(function (v, i) {
1741
- return _selectedIndex.includes(i);
1742
- });
1743
- }
1744
- return filteredData;
1745
- }
1746
- function selectTargetExclusive(rowIndex) {
1747
- var _val = String(rowIndex);
1748
-
1749
- // filter
1750
- // =================================================================
1751
- var filteredData = [];
1752
- if (!isNaN(row) && Array.isArray(originData)) {
1753
- var newSelectedItems = new Set();
1754
- newSelectedItems.add(_val);
1755
- setSelectedItems(newSelectedItems);
1756
- filteredData = originData.filter(function (v, i) {
1757
- return Number(_val) === i;
1758
- });
1759
- }
1760
- return filteredData;
1761
- }
1762
- function checkedSpecItems(itemKey, check) {
1763
- // first, make a copy of the original set rather than mutating the original
1764
- var newSelectedItems = new Set(selectedItems);
1765
- itemKey.forEach(function (s) {
1766
- if (check) {
1767
- newSelectedItems.add(s);
1768
- } else {
1769
- newSelectedItems["delete"](s);
1770
- }
1771
- });
1772
- setSelectedItems(newSelectedItems);
1773
- return newSelectedItems;
1774
- }
1775
- function checkedOneItem(itemKey) {
1776
- // first, make a copy of the original set rather than mutating the original
1777
- var newSelectedItems = new Set(selectedItems);
1778
- if (!newSelectedItems.has(itemKey)) {
1779
- newSelectedItems.add(itemKey);
1780
- } else {
1781
- newSelectedItems["delete"](itemKey);
1782
- }
1783
- setSelectedItems(newSelectedItems);
1784
- return newSelectedItems;
1785
- }
1786
- function handleChange(event) {
1787
- var _val = event.target.value;
1788
- var filteredData = useRadio ? selectTargetExclusive(_val) : selectTarget(_val);
1789
- onChange === null || onChange === void 0 ? void 0 : onChange(event, event.target.checked, filteredData);
1790
- onChangeRowSelect === null || onChangeRowSelect === void 0 ? void 0 : onChangeRowSelect(filteredData);
1791
- }
1792
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1793
- if (resolvedRef.current) {
1794
- resolvedRef.current.indeterminate = indeterminate;
1795
- }
1796
- }, [resolvedRef, indeterminate]);
1797
- 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({
1798
- type: useRadio ? 'radio' : 'checkbox',
1799
- ref: resolvedRef,
1800
- className: className || '',
1801
- name: name,
1802
- value: "".concat(row),
1803
- checked: allChecked,
1804
- onChange: handleChange
1805
- }, attributes)) : null, rowSelectable && row != -1 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", ToggleSelection_extends({
1806
- type: useRadio ? 'radio' : 'checkbox',
1807
- ref: resolvedRef,
1808
- className: className || '',
1809
- name: name,
1810
- value: "".concat(row),
1811
- "data-row": row,
1812
- "data-value": originData[row] ? JSON.stringify(originData[row]) : null,
1813
- checked: selectedItems.has("".concat(row)),
1814
- onChange: handleChange
1815
- }, attributes)) : null);
1816
- });
1817
- /* harmony default export */ const utils_ToggleSelection = (ToggleSelection);
1818
- ;// CONCATENATED MODULE: ./src/utils/DragHandleSprite.tsx
1819
-
1820
-
1821
- var DragHandleSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
1822
- var className = props.className,
1823
- icon = props.icon;
1824
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
1825
- rowDraggable = _useContext.rowDraggable,
1826
- handleTbodyEnter = _useContext.handleTbodyEnter;
1827
- 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", {
1828
- ref: externalRef,
1829
- className: className || 'drag-trigger',
1830
- onMouseEnter: handleTbodyEnter
1831
- }, icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
1832
- width: "1em",
1833
- height: "1em",
1834
- viewBox: "0 0 24 24",
1835
- fill: "none"
1836
- }, /*#__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", {
1837
- 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",
1838
- stroke: "#000000",
1839
- strokeWidth: "2",
1840
- strokeLinecap: "round",
1841
- strokeLinejoin: "round"
1842
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1843
- 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",
1844
- stroke: "#000000",
1845
- strokeWidth: "2",
1846
- strokeLinecap: "round",
1847
- strokeLinejoin: "round"
1848
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1849
- 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",
1850
- stroke: "#000000",
1851
- strokeWidth: "2",
1852
- strokeLinecap: "round",
1853
- strokeLinejoin: "round"
1854
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1855
- 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",
1856
- stroke: "#000000",
1857
- strokeWidth: "2",
1858
- strokeLinecap: "round",
1859
- strokeLinejoin: "round"
1860
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1861
- 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",
1862
- stroke: "#000000",
1863
- strokeWidth: "2",
1864
- strokeLinecap: "round",
1865
- strokeLinejoin: "round"
1866
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1867
- 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",
1868
- stroke: "#000000",
1869
- strokeWidth: "2",
1870
- strokeLinecap: "round",
1871
- strokeLinejoin: "round"
1872
- })))) : null);
1873
- });
1874
- /* harmony default export */ const utils_DragHandleSprite = (DragHandleSprite);
1875
- ;// CONCATENATED MODULE: ./src/utils/hooks/useTableSort.tsx
1876
- function useTableSort_toConsumableArray(arr) { return useTableSort_arrayWithoutHoles(arr) || useTableSort_iterableToArray(arr) || useTableSort_unsupportedIterableToArray(arr) || useTableSort_nonIterableSpread(); }
1877
- 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."); }
1878
- function useTableSort_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1879
- function useTableSort_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useTableSort_arrayLikeToArray(arr); }
1880
- function useTableSort_slicedToArray(arr, i) { return useTableSort_arrayWithHoles(arr) || useTableSort_iterableToArrayLimit(arr, i) || useTableSort_unsupportedIterableToArray(arr, i) || useTableSort_nonIterableRest(); }
1881
- 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."); }
1882
- 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); }
1883
- 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; }
1884
- 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; } }
1885
- function useTableSort_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1886
- /**
1887
- * Handles the event of sortable table
1888
- *
1889
- * @usage:
1890
-
1891
- const App = () => {
1892
-
1893
- const sortableTable = true;
1894
- const rootRef = useRef<any>(null);
1895
-
1896
- useTableSort({
1897
- enabled: sortableTable && rootRef.current,
1898
- spyElement: rootRef.current
1899
- }, [rootRef]);
1900
-
1901
- return (
1902
- <div
1903
- ref={rootRef}
1904
- >Test</div>
1905
- );
1906
- };
1907
-
1908
- */
1909
-
1910
-
1911
- function useTableSort(_ref, deps) {
1912
- var enabled = _ref.enabled,
1913
- data = _ref.data,
1914
- spyElement = _ref.spyElement,
1915
- fieldType = _ref.fieldType,
1916
- onColSort = _ref.onColSort,
1917
- onClick = _ref.onClick;
1918
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1919
- _useState2 = useTableSort_slicedToArray(_useState, 2),
1920
- inverse = _useState2[0],
1921
- setInverse = _useState2[1];
1922
- function handleSortList(e) {
1923
- if (typeof enabled === 'undefined' || enabled === false) return;
1924
- var tbodyRef = getTbody(spyElement);
1925
- if (tbodyRef === null) return;
1926
- var el = e.currentTarget.closest('[data-table-col]');
1927
- if (el === null) return;
1928
- var filterType = fieldType || 'text';
1929
- var curIndex = el.dataset.tableCol;
1930
- var targetComparator = [].slice.call(tbodyRef.querySelectorAll("[data-table-col=\"".concat(curIndex, "\"]")));
1931
-
1932
- //sort of HTML elements
1933
- var sortBy = function sortBy(a, b) {
1934
- var txt1 = a.innerHTML.replace(/(<([^>]+)>)/ig, '').toLowerCase(),
1935
- txt2 = b.innerHTML.replace(/(<([^>]+)>)/ig, '').toLowerCase();
1936
-
1937
- //type of number
1938
- if (filterType == 'number') {
1939
- txt1 = Number(txt1.replace(/[^0-9.-]+/g, ''));
1940
- txt2 = Number(txt2.replace(/[^0-9.-]+/g, ''));
1941
- }
1942
-
1943
- //type of date
1944
- if (filterType == 'date') {
1945
- txt1 = new Date(txt1);
1946
- txt2 = new Date(txt2);
1947
- }
1948
-
1949
- //add filter class
1950
- allRows(spyElement).forEach(function (node) {
1951
- node.classList.add('newsort');
1952
- });
1953
- setInverse(!inverse);
1954
- return txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
1955
- };
1956
- targetComparator.sort(sortBy);
1957
-
1958
- //console.log( 'targetComparator:', targetComparator );
1959
- //console.log( 'inverse:', inverse );
1960
-
1961
- if (inverse) targetComparator.reverse();
1962
- allRows(spyElement).forEach(function (node) {
1963
- node.remove();
1964
- });
1965
- for (var i = 0; i < targetComparator.length; i++) {
1966
- var curRow = targetComparator[i].parentNode;
1967
- tbodyRef.appendChild(curRow);
1968
- }
1969
-
1970
- // get latest order
1971
- var sortData = [];
1972
- allRows(spyElement).forEach(function (node) {
1973
- sortData.push(Number(node.dataset.order));
1974
- });
1975
-
1976
- // callback
1977
- onColSort === null || onColSort === void 0 ? void 0 : onColSort(sortDataByIndex(sortData, data));
1978
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
1979
- }
1980
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1981
- if (enabled) {
1982
- if (Array.isArray(data)) {
1983
- data.forEach(function (item, i) {
1984
- item.order = i;
1985
- });
1986
-
1987
- // Initialize custom props of table elements
1988
- initOrderProps(spyElement);
1989
- initRowColProps(spyElement);
1990
- }
1991
- }
1992
- }, [data, enabled, spyElement].concat(useTableSort_toConsumableArray(deps)));
1993
- return {
1994
- handleSortList: handleSortList
1995
- };
1996
- }
1997
- /* harmony default export */ const hooks_useTableSort = (useTableSort);
1998
- ;// CONCATENATED MODULE: ./src/utils/SortSprite.tsx
1999
-
2000
-
2001
-
2002
- var SortSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
2003
- var fieldType = props.fieldType,
2004
- className = props.className,
2005
- icon = props.icon,
2006
- onClick = props.onClick;
2007
- var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
2008
- originData = _useContext.originData,
2009
- rootRef = _useContext.rootRef,
2010
- colSortable = _useContext.colSortable,
2011
- onColSort = _useContext.onColSort;
2012
-
2013
- // sortable table initialization
2014
- var _useTableSort = hooks_useTableSort({
2015
- enabled: colSortable && rootRef.current,
2016
- data: originData,
2017
- spyElement: rootRef.current,
2018
- fieldType: fieldType,
2019
- onColSort: onColSort,
2020
- onClick: onClick
2021
- }, [rootRef]),
2022
- handleSortList = _useTableSort.handleSortList;
2023
- 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", {
2024
- className: className || 'sort-trigger',
2025
- onClick: handleSortList
2026
- }, icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2027
- width: "1em",
2028
- height: "1em",
2029
- viewBox: "0 0 18 18"
2030
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
2031
- stroke: "none",
2032
- strokeWidth: "1",
2033
- fill: "none",
2034
- fillRule: "evenodd"
2035
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2036
- 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",
2037
- id: "path",
2038
- fill: "#000000"
2039
- })))) : null);
2040
- });
2041
- /* harmony default export */ const utils_SortSprite = (SortSprite);
2042
- ;// CONCATENATED MODULE: ./src/index.tsx
2043
-
2044
-
2045
-
2046
-
2047
-
2048
-
2049
-
2050
-
2051
-
2052
- // utils
2053
-
2054
-
2055
-
2056
-
2057
- })();
2058
-
2059
- /******/ return __webpack_exports__;
2060
- /******/ })()
2061
- ;
2062
- });