@ioca/react 1.3.3 → 1.3.5

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 (763) hide show
  1. package/lib/cjs/components/affix/affix.js +63 -0
  2. package/lib/cjs/components/affix/affix.js.map +1 -0
  3. package/lib/cjs/components/affix/index.js +10 -0
  4. package/lib/cjs/components/affix/index.js.map +1 -0
  5. package/lib/cjs/components/affix/totop.js +18 -0
  6. package/lib/cjs/components/affix/totop.js.map +1 -0
  7. package/lib/cjs/components/badge/badge.js +17 -0
  8. package/lib/cjs/components/badge/badge.js.map +1 -0
  9. package/lib/cjs/components/badge/index.js +10 -0
  10. package/lib/cjs/components/badge/index.js.map +1 -0
  11. package/lib/cjs/components/button/button.js +62 -0
  12. package/lib/cjs/components/button/button.js.map +1 -0
  13. package/lib/cjs/components/button/group.js +25 -0
  14. package/lib/cjs/components/button/group.js.map +1 -0
  15. package/lib/cjs/components/button/index.js +13 -0
  16. package/lib/cjs/components/button/index.js.map +1 -0
  17. package/lib/cjs/components/button/toggle.js +50 -0
  18. package/lib/cjs/components/button/toggle.js.map +1 -0
  19. package/lib/cjs/components/card/card.js +17 -0
  20. package/lib/cjs/components/card/card.js.map +1 -0
  21. package/lib/cjs/components/card/index.js +10 -0
  22. package/lib/cjs/components/card/index.js.map +1 -0
  23. package/lib/cjs/components/checkbox/checkbox.js +46 -0
  24. package/lib/cjs/components/checkbox/checkbox.js.map +1 -0
  25. package/lib/cjs/components/checkbox/index.js +10 -0
  26. package/lib/cjs/components/checkbox/index.js.map +1 -0
  27. package/lib/cjs/components/checkbox/item.js +40 -0
  28. package/lib/cjs/components/checkbox/item.js.map +1 -0
  29. package/lib/cjs/components/collapse/collapse.js +78 -0
  30. package/lib/cjs/components/collapse/collapse.js.map +1 -0
  31. package/lib/cjs/components/collapse/index.js +10 -0
  32. package/lib/cjs/components/collapse/index.js.map +1 -0
  33. package/lib/cjs/components/collapse/item.js +12 -0
  34. package/lib/cjs/components/collapse/item.js.map +1 -0
  35. package/lib/cjs/components/datagrid/cell.js +27 -0
  36. package/lib/cjs/components/datagrid/cell.js.map +1 -0
  37. package/lib/cjs/components/datagrid/datagrid.js +117 -0
  38. package/lib/cjs/components/datagrid/datagrid.js.map +1 -0
  39. package/lib/cjs/components/datagrid/index.js +10 -0
  40. package/lib/cjs/components/datagrid/index.js.map +1 -0
  41. package/lib/cjs/components/datagrid/resize.js +45 -0
  42. package/lib/cjs/components/datagrid/resize.js.map +1 -0
  43. package/lib/cjs/components/datagrid/row.js +37 -0
  44. package/lib/cjs/components/datagrid/row.js.map +1 -0
  45. package/lib/cjs/components/datagrid/sorter.js +17 -0
  46. package/lib/cjs/components/datagrid/sorter.js.map +1 -0
  47. package/lib/cjs/components/description/description.js +32 -0
  48. package/lib/cjs/components/description/description.js.map +1 -0
  49. package/lib/cjs/components/description/index.js +10 -0
  50. package/lib/cjs/components/description/index.js.map +1 -0
  51. package/lib/cjs/components/drawer/drawer.js +66 -0
  52. package/lib/cjs/components/drawer/drawer.js.map +1 -0
  53. package/lib/cjs/components/drawer/index.js +10 -0
  54. package/lib/cjs/components/drawer/index.js.map +1 -0
  55. package/lib/cjs/components/dropdown/dropdown.js +17 -0
  56. package/lib/cjs/components/dropdown/dropdown.js.map +1 -0
  57. package/lib/cjs/components/dropdown/index.js +10 -0
  58. package/lib/cjs/components/dropdown/index.js.map +1 -0
  59. package/lib/cjs/components/dropdown/item.js +22 -0
  60. package/lib/cjs/components/dropdown/item.js.map +1 -0
  61. package/lib/cjs/components/editor/controls.js +87 -0
  62. package/lib/cjs/components/editor/controls.js.map +1 -0
  63. package/lib/cjs/components/editor/editor.js +83 -0
  64. package/lib/cjs/components/editor/editor.js.map +1 -0
  65. package/lib/cjs/components/editor/index.js +10 -0
  66. package/lib/cjs/components/editor/index.js.map +1 -0
  67. package/lib/cjs/components/flex/flex.js +32 -0
  68. package/lib/cjs/components/flex/flex.js.map +1 -0
  69. package/lib/cjs/components/flex/index.js +10 -0
  70. package/lib/cjs/components/flex/index.js.map +1 -0
  71. package/lib/cjs/components/form/context.js +10 -0
  72. package/lib/cjs/components/form/context.js.map +1 -0
  73. package/lib/cjs/components/form/field.js +77 -0
  74. package/lib/cjs/components/form/field.js.map +1 -0
  75. package/lib/cjs/components/form/form.js +57 -0
  76. package/lib/cjs/components/form/form.js.map +1 -0
  77. package/lib/cjs/components/form/index.js +10 -0
  78. package/lib/cjs/components/form/index.js.map +1 -0
  79. package/lib/cjs/components/form/useForm.js +130 -0
  80. package/lib/cjs/components/form/useForm.js.map +1 -0
  81. package/lib/cjs/components/icon/icon.js +27 -0
  82. package/lib/cjs/components/icon/icon.js.map +1 -0
  83. package/lib/cjs/components/icon/index.js +10 -0
  84. package/lib/cjs/components/icon/index.js.map +1 -0
  85. package/lib/cjs/components/image/image.js +76 -0
  86. package/lib/cjs/components/image/image.js.map +1 -0
  87. package/lib/cjs/components/image/index.js +11 -0
  88. package/lib/cjs/components/image/index.js.map +1 -0
  89. package/lib/cjs/components/image/list.js +47 -0
  90. package/lib/cjs/components/image/list.js.map +1 -0
  91. package/lib/cjs/components/input/container.js +18 -0
  92. package/lib/cjs/components/input/container.js.map +1 -0
  93. package/lib/cjs/components/input/index.js +15 -0
  94. package/lib/cjs/components/input/index.js.map +1 -0
  95. package/lib/cjs/components/input/input.js +67 -0
  96. package/lib/cjs/components/input/input.js.map +1 -0
  97. package/lib/cjs/components/input/number.js +58 -0
  98. package/lib/cjs/components/input/number.js.map +1 -0
  99. package/lib/cjs/components/input/range.js +71 -0
  100. package/lib/cjs/components/input/range.js.map +1 -0
  101. package/lib/cjs/components/input/textarea.js +51 -0
  102. package/lib/cjs/components/input/textarea.js.map +1 -0
  103. package/lib/cjs/components/list/index.js +10 -0
  104. package/lib/cjs/components/list/index.js.map +1 -0
  105. package/lib/cjs/components/list/item.js +18 -0
  106. package/lib/cjs/components/list/item.js.map +1 -0
  107. package/lib/cjs/components/list/list.js +28 -0
  108. package/lib/cjs/components/list/list.js.map +1 -0
  109. package/lib/cjs/components/loading/index.js +10 -0
  110. package/lib/cjs/components/loading/index.js.map +1 -0
  111. package/lib/cjs/components/loading/loading.js +21 -0
  112. package/lib/cjs/components/loading/loading.js.map +1 -0
  113. package/lib/cjs/components/message/index.js +10 -0
  114. package/lib/cjs/components/message/index.js.map +1 -0
  115. package/lib/cjs/components/message/message.js +178 -0
  116. package/lib/cjs/components/message/message.js.map +1 -0
  117. package/lib/cjs/components/modal/hookModal.js +31 -0
  118. package/lib/cjs/components/modal/hookModal.js.map +1 -0
  119. package/lib/cjs/components/modal/index.js +11 -0
  120. package/lib/cjs/components/modal/index.js.map +1 -0
  121. package/lib/cjs/components/modal/modal.js +108 -0
  122. package/lib/cjs/components/modal/modal.js.map +1 -0
  123. package/lib/cjs/components/modal/useModal.js +38 -0
  124. package/lib/cjs/components/modal/useModal.js.map +1 -0
  125. package/lib/cjs/components/pagination/index.js +10 -0
  126. package/lib/cjs/components/pagination/index.js.map +1 -0
  127. package/lib/cjs/components/pagination/page.js +28 -0
  128. package/lib/cjs/components/pagination/page.js.map +1 -0
  129. package/lib/cjs/components/pagination/pagination.js +48 -0
  130. package/lib/cjs/components/pagination/pagination.js.map +1 -0
  131. package/lib/cjs/components/picker/colors/footer.js +44 -0
  132. package/lib/cjs/components/picker/colors/footer.js.map +1 -0
  133. package/lib/cjs/components/picker/colors/handle.js +14 -0
  134. package/lib/cjs/components/picker/colors/handle.js.map +1 -0
  135. package/lib/cjs/components/picker/colors/index.js +61 -0
  136. package/lib/cjs/components/picker/colors/index.js.map +1 -0
  137. package/lib/cjs/components/picker/dates/dates.js +50 -0
  138. package/lib/cjs/components/picker/dates/dates.js.map +1 -0
  139. package/lib/cjs/components/picker/dates/index.js +66 -0
  140. package/lib/cjs/components/picker/dates/index.js.map +1 -0
  141. package/lib/cjs/components/picker/dates/panel.js +81 -0
  142. package/lib/cjs/components/picker/dates/panel.js.map +1 -0
  143. package/lib/cjs/components/picker/time/index.js +50 -0
  144. package/lib/cjs/components/picker/time/index.js.map +1 -0
  145. package/lib/cjs/components/picker/time/item.js +19 -0
  146. package/lib/cjs/components/picker/time/item.js.map +1 -0
  147. package/lib/cjs/components/picker/time/panel.js +87 -0
  148. package/lib/cjs/components/picker/time/panel.js.map +1 -0
  149. package/lib/cjs/components/popconfirm/index.js +10 -0
  150. package/lib/cjs/components/popconfirm/index.js.map +1 -0
  151. package/lib/cjs/components/popconfirm/popconfirm.js +58 -0
  152. package/lib/cjs/components/popconfirm/popconfirm.js.map +1 -0
  153. package/lib/cjs/components/popup/content.js +44 -0
  154. package/lib/cjs/components/popup/content.js.map +1 -0
  155. package/lib/cjs/components/popup/index.js +10 -0
  156. package/lib/cjs/components/popup/index.js.map +1 -0
  157. package/lib/cjs/components/popup/popup.js +223 -0
  158. package/lib/cjs/components/popup/popup.js.map +1 -0
  159. package/lib/cjs/components/progress/circle.js +17 -0
  160. package/lib/cjs/components/progress/circle.js.map +1 -0
  161. package/lib/cjs/components/progress/index.js +10 -0
  162. package/lib/cjs/components/progress/index.js.map +1 -0
  163. package/lib/cjs/components/progress/line.js +18 -0
  164. package/lib/cjs/components/progress/line.js.map +1 -0
  165. package/lib/cjs/components/progress/progress.js +87 -0
  166. package/lib/cjs/components/progress/progress.js.map +1 -0
  167. package/lib/cjs/components/radio/index.js +10 -0
  168. package/lib/cjs/components/radio/index.js.map +1 -0
  169. package/lib/cjs/components/radio/item.js +21 -0
  170. package/lib/cjs/components/radio/item.js.map +1 -0
  171. package/lib/cjs/components/radio/radio.js +39 -0
  172. package/lib/cjs/components/radio/radio.js.map +1 -0
  173. package/lib/cjs/components/resizable/index.js +10 -0
  174. package/lib/cjs/components/resizable/index.js.map +1 -0
  175. package/lib/cjs/components/resizable/resizable.js +65 -0
  176. package/lib/cjs/components/resizable/resizable.js.map +1 -0
  177. package/lib/cjs/components/select/index.js +10 -0
  178. package/lib/cjs/components/select/index.js.map +1 -0
  179. package/lib/cjs/components/select/options.js +51 -0
  180. package/lib/cjs/components/select/options.js.map +1 -0
  181. package/lib/cjs/components/select/select.js +97 -0
  182. package/lib/cjs/components/select/select.js.map +1 -0
  183. package/lib/cjs/components/step/divider.js +12 -0
  184. package/lib/cjs/components/step/divider.js.map +1 -0
  185. package/lib/cjs/components/step/index.js +10 -0
  186. package/lib/cjs/components/step/index.js.map +1 -0
  187. package/lib/cjs/components/step/item.js +26 -0
  188. package/lib/cjs/components/step/item.js.map +1 -0
  189. package/lib/cjs/components/step/step.js +40 -0
  190. package/lib/cjs/components/step/step.js.map +1 -0
  191. package/lib/cjs/components/swiper/index.js +10 -0
  192. package/lib/cjs/components/swiper/index.js.map +1 -0
  193. package/lib/cjs/components/swiper/item.js +29 -0
  194. package/lib/cjs/components/swiper/item.js.map +1 -0
  195. package/lib/cjs/components/swiper/swiper.js +238 -0
  196. package/lib/cjs/components/swiper/swiper.js.map +1 -0
  197. package/lib/cjs/components/tabs/index.js +10 -0
  198. package/lib/cjs/components/tabs/index.js.map +1 -0
  199. package/lib/cjs/components/tabs/item.js +12 -0
  200. package/lib/cjs/components/tabs/item.js.map +1 -0
  201. package/lib/cjs/components/tabs/tabs.js +215 -0
  202. package/lib/cjs/components/tabs/tabs.js.map +1 -0
  203. package/lib/cjs/components/tag/index.js +10 -0
  204. package/lib/cjs/components/tag/index.js.map +1 -0
  205. package/lib/cjs/components/tag/tag.js +22 -0
  206. package/lib/cjs/components/tag/tag.js.map +1 -0
  207. package/lib/cjs/components/text/highlight.js +32 -0
  208. package/lib/cjs/components/text/highlight.js.map +1 -0
  209. package/lib/cjs/components/text/index.js +15 -0
  210. package/lib/cjs/components/text/index.js.map +1 -0
  211. package/lib/cjs/components/text/number.js +31 -0
  212. package/lib/cjs/components/text/number.js.map +1 -0
  213. package/lib/cjs/components/text/text.js +32 -0
  214. package/lib/cjs/components/text/text.js.map +1 -0
  215. package/lib/cjs/components/text/time.js +24 -0
  216. package/lib/cjs/components/text/time.js.map +1 -0
  217. package/lib/cjs/components/tree/index.js +10 -0
  218. package/lib/cjs/components/tree/index.js.map +1 -0
  219. package/lib/cjs/components/tree/item.js +76 -0
  220. package/lib/cjs/components/tree/item.js.map +1 -0
  221. package/lib/cjs/components/tree/tree.js +136 -0
  222. package/lib/cjs/components/tree/tree.js.map +1 -0
  223. package/lib/cjs/components/upload/index.js +10 -0
  224. package/lib/cjs/components/upload/index.js.map +1 -0
  225. package/lib/cjs/components/upload/renderFile.js +66 -0
  226. package/lib/cjs/components/upload/renderFile.js.map +1 -0
  227. package/lib/cjs/components/upload/upload.js +127 -0
  228. package/lib/cjs/components/upload/upload.js.map +1 -0
  229. package/lib/cjs/components/utils/empty/index.js +15 -0
  230. package/lib/cjs/components/utils/empty/index.js.map +1 -0
  231. package/lib/cjs/components/utils/helpericon/helpericon.js +28 -0
  232. package/lib/cjs/components/utils/helpericon/helpericon.js.map +1 -0
  233. package/lib/cjs/components/utils/helpericon/index.js +10 -0
  234. package/lib/cjs/components/utils/helpericon/index.js.map +1 -0
  235. package/lib/cjs/components/video/index.js +10 -0
  236. package/lib/cjs/components/video/index.js.map +1 -0
  237. package/lib/cjs/components/video/video.js +175 -0
  238. package/lib/cjs/components/video/video.js.map +1 -0
  239. package/lib/cjs/index.js +89 -0
  240. package/lib/cjs/index.js.map +1 -0
  241. package/lib/cjs/js/hooks.js +115 -0
  242. package/lib/cjs/js/hooks.js.map +1 -0
  243. package/lib/cjs/js/usePreview/content.js +148 -0
  244. package/lib/cjs/js/usePreview/content.js.map +1 -0
  245. package/lib/cjs/js/usePreview/index.js +27 -0
  246. package/lib/cjs/js/usePreview/index.js.map +1 -0
  247. package/lib/cjs/js/usePreview/renderFile.js +24 -0
  248. package/lib/cjs/js/usePreview/renderFile.js.map +1 -0
  249. package/lib/cjs/js/usePreview/type.js +13 -0
  250. package/lib/cjs/js/usePreview/type.js.map +1 -0
  251. package/lib/cjs/js/useRipple/index.js +47 -0
  252. package/lib/cjs/js/useRipple/index.js.map +1 -0
  253. package/lib/cjs/js/utils.js +281 -0
  254. package/lib/cjs/js/utils.js.map +1 -0
  255. package/lib/css/index.css +1 -1
  256. package/lib/css/index.css.map +1 -1
  257. package/lib/es/components/affix/affix.js +59 -0
  258. package/lib/es/components/affix/affix.js.map +1 -0
  259. package/lib/es/components/affix/index.js +6 -0
  260. package/lib/{components/badge → es/components/affix}/index.js.map +1 -1
  261. package/lib/es/components/affix/totop.js +14 -0
  262. package/lib/es/components/affix/totop.js.map +1 -0
  263. package/lib/es/components/badge/badge.js +13 -0
  264. package/lib/es/components/badge/badge.js.map +1 -0
  265. package/lib/es/components/badge/index.js +6 -0
  266. package/lib/{components/checkbox → es/components/badge}/index.js.map +1 -1
  267. package/lib/es/components/button/button.js +58 -0
  268. package/lib/es/components/button/button.js.map +1 -0
  269. package/lib/es/components/button/group.js +21 -0
  270. package/lib/es/components/button/group.js.map +1 -0
  271. package/lib/es/components/button/index.js +9 -0
  272. package/lib/es/components/button/index.js.map +1 -0
  273. package/lib/es/components/button/toggle.js +46 -0
  274. package/lib/es/components/button/toggle.js.map +1 -0
  275. package/lib/es/components/card/card.js +13 -0
  276. package/lib/es/components/card/card.js.map +1 -0
  277. package/lib/es/components/card/index.js +6 -0
  278. package/lib/{components → es/components}/card/index.js.map +1 -1
  279. package/lib/es/components/checkbox/checkbox.js +42 -0
  280. package/lib/es/components/checkbox/checkbox.js.map +1 -0
  281. package/lib/es/components/checkbox/index.js +6 -0
  282. package/lib/{components/affix → es/components/checkbox}/index.js.map +1 -1
  283. package/lib/es/components/checkbox/item.js +36 -0
  284. package/lib/es/components/checkbox/item.js.map +1 -0
  285. package/lib/es/components/collapse/collapse.js +74 -0
  286. package/lib/es/components/collapse/collapse.js.map +1 -0
  287. package/lib/es/components/collapse/index.js +6 -0
  288. package/lib/es/components/collapse/index.js.map +1 -0
  289. package/lib/es/components/collapse/item.js +8 -0
  290. package/lib/es/components/collapse/item.js.map +1 -0
  291. package/lib/es/components/datagrid/cell.js +24 -0
  292. package/lib/es/components/datagrid/cell.js.map +1 -0
  293. package/lib/es/components/datagrid/datagrid.js +113 -0
  294. package/lib/es/components/datagrid/datagrid.js.map +1 -0
  295. package/lib/es/components/datagrid/index.js +6 -0
  296. package/lib/es/components/datagrid/index.js.map +1 -0
  297. package/lib/es/components/datagrid/resize.js +41 -0
  298. package/lib/es/components/datagrid/resize.js.map +1 -0
  299. package/lib/es/components/datagrid/row.js +32 -0
  300. package/lib/es/components/datagrid/row.js.map +1 -0
  301. package/lib/es/components/datagrid/sorter.js +13 -0
  302. package/lib/es/components/datagrid/sorter.js.map +1 -0
  303. package/lib/es/components/description/description.js +28 -0
  304. package/lib/es/components/description/description.js.map +1 -0
  305. package/lib/es/components/description/index.js +6 -0
  306. package/lib/es/components/description/index.js.map +1 -0
  307. package/lib/es/components/drawer/drawer.js +62 -0
  308. package/lib/es/components/drawer/drawer.js.map +1 -0
  309. package/lib/es/components/drawer/index.js +6 -0
  310. package/lib/es/components/drawer/index.js.map +1 -0
  311. package/lib/es/components/dropdown/dropdown.js +13 -0
  312. package/lib/es/components/dropdown/dropdown.js.map +1 -0
  313. package/lib/es/components/dropdown/index.js +6 -0
  314. package/lib/es/components/dropdown/index.js.map +1 -0
  315. package/lib/es/components/dropdown/item.js +18 -0
  316. package/lib/es/components/dropdown/item.js.map +1 -0
  317. package/lib/es/components/editor/controls.js +81 -0
  318. package/lib/es/components/editor/controls.js.map +1 -0
  319. package/lib/es/components/editor/editor.js +79 -0
  320. package/lib/es/components/editor/editor.js.map +1 -0
  321. package/lib/es/components/editor/index.js +6 -0
  322. package/lib/es/components/editor/index.js.map +1 -0
  323. package/lib/es/components/flex/flex.js +28 -0
  324. package/lib/es/components/flex/flex.js.map +1 -0
  325. package/lib/es/components/flex/index.js +6 -0
  326. package/lib/es/components/flex/index.js.map +1 -0
  327. package/lib/es/components/form/context.js +6 -0
  328. package/lib/es/components/form/context.js.map +1 -0
  329. package/lib/es/components/form/field.js +73 -0
  330. package/lib/es/components/form/field.js.map +1 -0
  331. package/lib/es/components/form/form.js +53 -0
  332. package/lib/es/components/form/form.js.map +1 -0
  333. package/lib/es/components/form/index.js +6 -0
  334. package/lib/es/components/form/index.js.map +1 -0
  335. package/lib/es/components/form/useForm.js +125 -0
  336. package/lib/es/components/form/useForm.js.map +1 -0
  337. package/lib/es/components/icon/icon.js +23 -0
  338. package/lib/es/components/icon/icon.js.map +1 -0
  339. package/lib/es/components/icon/index.js +6 -0
  340. package/lib/es/components/icon/index.js.map +1 -0
  341. package/lib/es/components/image/image.js +72 -0
  342. package/lib/es/components/image/image.js.map +1 -0
  343. package/lib/es/components/image/index.js +7 -0
  344. package/lib/es/components/image/index.js.map +1 -0
  345. package/lib/es/components/image/list.js +43 -0
  346. package/lib/es/components/image/list.js.map +1 -0
  347. package/lib/es/components/input/container.js +14 -0
  348. package/lib/es/components/input/container.js.map +1 -0
  349. package/lib/es/components/input/index.js +11 -0
  350. package/lib/es/components/input/index.js.map +1 -0
  351. package/lib/es/components/input/input.js +63 -0
  352. package/lib/es/components/input/input.js.map +1 -0
  353. package/lib/es/components/input/number.js +54 -0
  354. package/lib/es/components/input/number.js.map +1 -0
  355. package/lib/es/components/input/range.js +67 -0
  356. package/lib/es/components/input/range.js.map +1 -0
  357. package/lib/es/components/input/textarea.js +47 -0
  358. package/lib/es/components/input/textarea.js.map +1 -0
  359. package/lib/es/components/list/index.js +6 -0
  360. package/lib/es/components/list/index.js.map +1 -0
  361. package/lib/es/components/list/item.js +14 -0
  362. package/lib/es/components/list/item.js.map +1 -0
  363. package/lib/es/components/list/list.js +24 -0
  364. package/lib/es/components/list/list.js.map +1 -0
  365. package/lib/es/components/loading/index.js +6 -0
  366. package/lib/es/components/loading/index.js.map +1 -0
  367. package/lib/es/components/loading/loading.js +17 -0
  368. package/lib/es/components/loading/loading.js.map +1 -0
  369. package/lib/es/components/message/index.js +6 -0
  370. package/lib/es/components/message/index.js.map +1 -0
  371. package/lib/es/components/message/message.js +174 -0
  372. package/lib/es/components/message/message.js.map +1 -0
  373. package/lib/es/components/modal/hookModal.js +27 -0
  374. package/lib/es/components/modal/hookModal.js.map +1 -0
  375. package/lib/es/components/modal/index.js +7 -0
  376. package/lib/es/components/modal/index.js.map +1 -0
  377. package/lib/es/components/modal/modal.js +104 -0
  378. package/lib/es/components/modal/modal.js.map +1 -0
  379. package/lib/es/components/modal/useModal.js +34 -0
  380. package/lib/es/components/modal/useModal.js.map +1 -0
  381. package/lib/es/components/pagination/index.js +6 -0
  382. package/lib/es/components/pagination/index.js.map +1 -0
  383. package/lib/es/components/pagination/page.js +24 -0
  384. package/lib/es/components/pagination/page.js.map +1 -0
  385. package/lib/es/components/pagination/pagination.js +44 -0
  386. package/lib/es/components/pagination/pagination.js.map +1 -0
  387. package/lib/es/components/picker/colors/footer.js +39 -0
  388. package/lib/es/components/picker/colors/footer.js.map +1 -0
  389. package/lib/es/components/picker/colors/handle.js +10 -0
  390. package/lib/es/components/picker/colors/handle.js.map +1 -0
  391. package/lib/es/components/picker/colors/index.js +57 -0
  392. package/lib/es/components/picker/colors/index.js.map +1 -0
  393. package/lib/es/components/picker/dates/dates.js +46 -0
  394. package/lib/es/components/picker/dates/dates.js.map +1 -0
  395. package/lib/es/components/picker/dates/index.js +62 -0
  396. package/lib/es/components/picker/dates/index.js.map +1 -0
  397. package/lib/es/components/picker/dates/panel.js +77 -0
  398. package/lib/es/components/picker/dates/panel.js.map +1 -0
  399. package/lib/es/components/picker/time/index.js +46 -0
  400. package/lib/es/components/picker/time/index.js.map +1 -0
  401. package/lib/es/components/picker/time/item.js +15 -0
  402. package/lib/es/components/picker/time/item.js.map +1 -0
  403. package/lib/es/components/picker/time/panel.js +83 -0
  404. package/lib/es/components/picker/time/panel.js.map +1 -0
  405. package/lib/es/components/popconfirm/index.js +6 -0
  406. package/lib/es/components/popconfirm/index.js.map +1 -0
  407. package/lib/es/components/popconfirm/popconfirm.js +54 -0
  408. package/lib/es/components/popconfirm/popconfirm.js.map +1 -0
  409. package/lib/es/components/popup/content.js +40 -0
  410. package/lib/es/components/popup/content.js.map +1 -0
  411. package/lib/es/components/popup/index.js +6 -0
  412. package/lib/es/components/popup/index.js.map +1 -0
  413. package/lib/es/components/popup/popup.js +219 -0
  414. package/lib/es/components/popup/popup.js.map +1 -0
  415. package/lib/es/components/progress/circle.js +13 -0
  416. package/lib/es/components/progress/circle.js.map +1 -0
  417. package/lib/es/components/progress/index.js +6 -0
  418. package/lib/es/components/progress/index.js.map +1 -0
  419. package/lib/es/components/progress/line.js +14 -0
  420. package/lib/es/components/progress/line.js.map +1 -0
  421. package/lib/es/components/progress/progress.js +83 -0
  422. package/lib/es/components/progress/progress.js.map +1 -0
  423. package/lib/es/components/radio/index.js +6 -0
  424. package/lib/es/components/radio/index.js.map +1 -0
  425. package/lib/es/components/radio/item.js +17 -0
  426. package/lib/es/components/radio/item.js.map +1 -0
  427. package/lib/es/components/radio/radio.js +35 -0
  428. package/lib/es/components/radio/radio.js.map +1 -0
  429. package/lib/es/components/resizable/index.js +6 -0
  430. package/lib/es/components/resizable/index.js.map +1 -0
  431. package/lib/es/components/resizable/resizable.js +61 -0
  432. package/lib/es/components/resizable/resizable.js.map +1 -0
  433. package/lib/es/components/select/index.js +6 -0
  434. package/lib/es/components/select/index.js.map +1 -0
  435. package/lib/es/components/select/options.js +47 -0
  436. package/lib/es/components/select/options.js.map +1 -0
  437. package/lib/es/components/select/select.js +93 -0
  438. package/lib/es/components/select/select.js.map +1 -0
  439. package/lib/es/components/step/divider.js +8 -0
  440. package/lib/es/components/step/divider.js.map +1 -0
  441. package/lib/es/components/step/index.js +6 -0
  442. package/lib/es/components/step/index.js.map +1 -0
  443. package/lib/es/components/step/item.js +22 -0
  444. package/lib/es/components/step/item.js.map +1 -0
  445. package/lib/es/components/step/step.js +36 -0
  446. package/lib/es/components/step/step.js.map +1 -0
  447. package/lib/es/components/swiper/index.js +6 -0
  448. package/lib/es/components/swiper/index.js.map +1 -0
  449. package/lib/es/components/swiper/item.js +25 -0
  450. package/lib/es/components/swiper/item.js.map +1 -0
  451. package/lib/es/components/swiper/swiper.js +234 -0
  452. package/lib/es/components/swiper/swiper.js.map +1 -0
  453. package/lib/es/components/tabs/index.js +6 -0
  454. package/lib/es/components/tabs/index.js.map +1 -0
  455. package/lib/es/components/tabs/item.js +8 -0
  456. package/lib/es/components/tabs/item.js.map +1 -0
  457. package/lib/es/components/tabs/tabs.js +211 -0
  458. package/lib/es/components/tabs/tabs.js.map +1 -0
  459. package/lib/es/components/tag/index.js +6 -0
  460. package/lib/es/components/tag/index.js.map +1 -0
  461. package/lib/es/components/tag/tag.js +18 -0
  462. package/lib/es/components/tag/tag.js.map +1 -0
  463. package/lib/es/components/text/highlight.js +28 -0
  464. package/lib/es/components/text/highlight.js.map +1 -0
  465. package/lib/es/components/text/index.js +11 -0
  466. package/lib/es/components/text/index.js.map +1 -0
  467. package/lib/es/components/text/number.js +27 -0
  468. package/lib/es/components/text/number.js.map +1 -0
  469. package/lib/es/components/text/text.js +28 -0
  470. package/lib/es/components/text/text.js.map +1 -0
  471. package/lib/es/components/text/time.js +20 -0
  472. package/lib/es/components/text/time.js.map +1 -0
  473. package/lib/es/components/tree/index.js +6 -0
  474. package/lib/es/components/tree/index.js.map +1 -0
  475. package/lib/es/components/tree/item.js +73 -0
  476. package/lib/es/components/tree/item.js.map +1 -0
  477. package/lib/es/components/tree/tree.js +132 -0
  478. package/lib/es/components/tree/tree.js.map +1 -0
  479. package/lib/es/components/upload/index.js +6 -0
  480. package/lib/es/components/upload/index.js.map +1 -0
  481. package/lib/es/components/upload/renderFile.js +61 -0
  482. package/lib/es/components/upload/renderFile.js.map +1 -0
  483. package/lib/es/components/upload/upload.js +123 -0
  484. package/lib/es/components/upload/upload.js.map +1 -0
  485. package/lib/es/components/utils/empty/index.js +11 -0
  486. package/lib/es/components/utils/empty/index.js.map +1 -0
  487. package/lib/es/components/utils/helpericon/helpericon.js +24 -0
  488. package/lib/es/components/utils/helpericon/helpericon.js.map +1 -0
  489. package/lib/es/components/utils/helpericon/index.js +6 -0
  490. package/lib/es/components/utils/helpericon/index.js.map +1 -0
  491. package/lib/es/components/video/index.js +6 -0
  492. package/lib/es/components/video/index.js.map +1 -0
  493. package/lib/es/components/video/video.js +171 -0
  494. package/lib/es/components/video/video.js.map +1 -0
  495. package/lib/es/index.js +45 -0
  496. package/lib/es/index.js.map +1 -0
  497. package/lib/es/js/hooks.js +109 -0
  498. package/lib/es/js/hooks.js.map +1 -0
  499. package/lib/es/js/usePreview/content.js +144 -0
  500. package/lib/es/js/usePreview/content.js.map +1 -0
  501. package/lib/es/js/usePreview/index.js +23 -0
  502. package/lib/es/js/usePreview/index.js.map +1 -0
  503. package/lib/es/js/usePreview/renderFile.js +20 -0
  504. package/lib/es/js/usePreview/renderFile.js.map +1 -0
  505. package/lib/es/js/usePreview/type.js +13 -0
  506. package/lib/es/js/usePreview/type.js.map +1 -0
  507. package/lib/es/js/useRipple/index.js +43 -0
  508. package/lib/es/js/useRipple/index.js.map +1 -0
  509. package/lib/es/js/utils.js +265 -0
  510. package/lib/es/js/utils.js.map +1 -0
  511. package/lib/index.js +4317 -2
  512. package/lib/types/components/picker/type.d.ts +2 -2
  513. package/lib/types/js/usePreview/type.d.ts +2 -11
  514. package/package.json +20 -11
  515. package/lib/components/affix/affix.js +0 -2
  516. package/lib/components/affix/affix.js.map +0 -1
  517. package/lib/components/affix/index.js +0 -2
  518. package/lib/components/affix/totop.js +0 -2
  519. package/lib/components/affix/totop.js.map +0 -1
  520. package/lib/components/badge/badge.js +0 -2
  521. package/lib/components/badge/badge.js.map +0 -1
  522. package/lib/components/badge/index.js +0 -2
  523. package/lib/components/button/button.js +0 -2
  524. package/lib/components/button/button.js.map +0 -1
  525. package/lib/components/button/group.js +0 -2
  526. package/lib/components/button/group.js.map +0 -1
  527. package/lib/components/button/index.js +0 -2
  528. package/lib/components/button/index.js.map +0 -1
  529. package/lib/components/button/toggle.js +0 -2
  530. package/lib/components/button/toggle.js.map +0 -1
  531. package/lib/components/card/card.js +0 -2
  532. package/lib/components/card/card.js.map +0 -1
  533. package/lib/components/card/index.js +0 -2
  534. package/lib/components/checkbox/checkbox.js +0 -2
  535. package/lib/components/checkbox/checkbox.js.map +0 -1
  536. package/lib/components/checkbox/index.js +0 -2
  537. package/lib/components/checkbox/item.js +0 -2
  538. package/lib/components/checkbox/item.js.map +0 -1
  539. package/lib/components/collapse/collapse.js +0 -2
  540. package/lib/components/collapse/collapse.js.map +0 -1
  541. package/lib/components/collapse/index.js +0 -2
  542. package/lib/components/collapse/index.js.map +0 -1
  543. package/lib/components/collapse/item.js +0 -2
  544. package/lib/components/collapse/item.js.map +0 -1
  545. package/lib/components/datagrid/cell.js +0 -2
  546. package/lib/components/datagrid/cell.js.map +0 -1
  547. package/lib/components/datagrid/datagrid.js +0 -2
  548. package/lib/components/datagrid/datagrid.js.map +0 -1
  549. package/lib/components/datagrid/index.js +0 -2
  550. package/lib/components/datagrid/index.js.map +0 -1
  551. package/lib/components/datagrid/resize.js +0 -2
  552. package/lib/components/datagrid/resize.js.map +0 -1
  553. package/lib/components/datagrid/row.js +0 -2
  554. package/lib/components/datagrid/row.js.map +0 -1
  555. package/lib/components/datagrid/sorter.js +0 -2
  556. package/lib/components/datagrid/sorter.js.map +0 -1
  557. package/lib/components/description/description.js +0 -2
  558. package/lib/components/description/description.js.map +0 -1
  559. package/lib/components/description/index.js +0 -2
  560. package/lib/components/description/index.js.map +0 -1
  561. package/lib/components/drawer/drawer.js +0 -2
  562. package/lib/components/drawer/drawer.js.map +0 -1
  563. package/lib/components/drawer/index.js +0 -2
  564. package/lib/components/drawer/index.js.map +0 -1
  565. package/lib/components/dropdown/dropdown.js +0 -2
  566. package/lib/components/dropdown/dropdown.js.map +0 -1
  567. package/lib/components/dropdown/index.js +0 -2
  568. package/lib/components/dropdown/index.js.map +0 -1
  569. package/lib/components/dropdown/item.js +0 -2
  570. package/lib/components/dropdown/item.js.map +0 -1
  571. package/lib/components/editor/controls.js +0 -2
  572. package/lib/components/editor/controls.js.map +0 -1
  573. package/lib/components/editor/editor.js +0 -2
  574. package/lib/components/editor/editor.js.map +0 -1
  575. package/lib/components/editor/index.js +0 -2
  576. package/lib/components/editor/index.js.map +0 -1
  577. package/lib/components/flex/flex.js +0 -2
  578. package/lib/components/flex/flex.js.map +0 -1
  579. package/lib/components/flex/index.js +0 -2
  580. package/lib/components/flex/index.js.map +0 -1
  581. package/lib/components/form/context.js +0 -2
  582. package/lib/components/form/context.js.map +0 -1
  583. package/lib/components/form/field.js +0 -2
  584. package/lib/components/form/field.js.map +0 -1
  585. package/lib/components/form/form.js +0 -2
  586. package/lib/components/form/form.js.map +0 -1
  587. package/lib/components/form/index.js +0 -2
  588. package/lib/components/form/index.js.map +0 -1
  589. package/lib/components/form/useForm.js +0 -2
  590. package/lib/components/form/useForm.js.map +0 -1
  591. package/lib/components/icon/icon.js +0 -2
  592. package/lib/components/icon/icon.js.map +0 -1
  593. package/lib/components/icon/index.js +0 -2
  594. package/lib/components/icon/index.js.map +0 -1
  595. package/lib/components/image/image.js +0 -2
  596. package/lib/components/image/image.js.map +0 -1
  597. package/lib/components/image/index.js +0 -2
  598. package/lib/components/image/index.js.map +0 -1
  599. package/lib/components/image/list.js +0 -2
  600. package/lib/components/image/list.js.map +0 -1
  601. package/lib/components/input/container.js +0 -2
  602. package/lib/components/input/container.js.map +0 -1
  603. package/lib/components/input/index.js +0 -2
  604. package/lib/components/input/index.js.map +0 -1
  605. package/lib/components/input/input.js +0 -2
  606. package/lib/components/input/input.js.map +0 -1
  607. package/lib/components/input/number.js +0 -2
  608. package/lib/components/input/number.js.map +0 -1
  609. package/lib/components/input/range.js +0 -2
  610. package/lib/components/input/range.js.map +0 -1
  611. package/lib/components/input/textarea.js +0 -2
  612. package/lib/components/input/textarea.js.map +0 -1
  613. package/lib/components/list/index.js +0 -2
  614. package/lib/components/list/index.js.map +0 -1
  615. package/lib/components/list/item.js +0 -2
  616. package/lib/components/list/item.js.map +0 -1
  617. package/lib/components/list/list.js +0 -2
  618. package/lib/components/list/list.js.map +0 -1
  619. package/lib/components/loading/index.js +0 -2
  620. package/lib/components/loading/index.js.map +0 -1
  621. package/lib/components/loading/loading.js +0 -2
  622. package/lib/components/loading/loading.js.map +0 -1
  623. package/lib/components/message/index.js +0 -2
  624. package/lib/components/message/index.js.map +0 -1
  625. package/lib/components/message/message.js +0 -2
  626. package/lib/components/message/message.js.map +0 -1
  627. package/lib/components/modal/hookModal.js +0 -2
  628. package/lib/components/modal/hookModal.js.map +0 -1
  629. package/lib/components/modal/index.js +0 -2
  630. package/lib/components/modal/index.js.map +0 -1
  631. package/lib/components/modal/modal.js +0 -2
  632. package/lib/components/modal/modal.js.map +0 -1
  633. package/lib/components/modal/useModal.js +0 -2
  634. package/lib/components/modal/useModal.js.map +0 -1
  635. package/lib/components/pagination/index.js +0 -2
  636. package/lib/components/pagination/index.js.map +0 -1
  637. package/lib/components/pagination/page.js +0 -2
  638. package/lib/components/pagination/page.js.map +0 -1
  639. package/lib/components/pagination/pagination.js +0 -2
  640. package/lib/components/pagination/pagination.js.map +0 -1
  641. package/lib/components/picker/colors/footer.js +0 -2
  642. package/lib/components/picker/colors/footer.js.map +0 -1
  643. package/lib/components/picker/colors/handle.js +0 -2
  644. package/lib/components/picker/colors/handle.js.map +0 -1
  645. package/lib/components/picker/colors/index.js +0 -2
  646. package/lib/components/picker/colors/index.js.map +0 -1
  647. package/lib/components/picker/dates/dates.js +0 -2
  648. package/lib/components/picker/dates/dates.js.map +0 -1
  649. package/lib/components/picker/dates/index.js +0 -2
  650. package/lib/components/picker/dates/index.js.map +0 -1
  651. package/lib/components/picker/dates/panel.js +0 -2
  652. package/lib/components/picker/dates/panel.js.map +0 -1
  653. package/lib/components/picker/time/index.js +0 -2
  654. package/lib/components/picker/time/index.js.map +0 -1
  655. package/lib/components/picker/time/item.js +0 -2
  656. package/lib/components/picker/time/item.js.map +0 -1
  657. package/lib/components/picker/time/panel.js +0 -2
  658. package/lib/components/picker/time/panel.js.map +0 -1
  659. package/lib/components/popconfirm/index.js +0 -2
  660. package/lib/components/popconfirm/index.js.map +0 -1
  661. package/lib/components/popconfirm/popconfirm.js +0 -2
  662. package/lib/components/popconfirm/popconfirm.js.map +0 -1
  663. package/lib/components/popup/content.js +0 -2
  664. package/lib/components/popup/content.js.map +0 -1
  665. package/lib/components/popup/index.js +0 -2
  666. package/lib/components/popup/index.js.map +0 -1
  667. package/lib/components/popup/popup.js +0 -2
  668. package/lib/components/popup/popup.js.map +0 -1
  669. package/lib/components/progress/circle.js +0 -2
  670. package/lib/components/progress/circle.js.map +0 -1
  671. package/lib/components/progress/index.js +0 -2
  672. package/lib/components/progress/index.js.map +0 -1
  673. package/lib/components/progress/line.js +0 -2
  674. package/lib/components/progress/line.js.map +0 -1
  675. package/lib/components/progress/progress.js +0 -2
  676. package/lib/components/progress/progress.js.map +0 -1
  677. package/lib/components/radio/index.js +0 -2
  678. package/lib/components/radio/index.js.map +0 -1
  679. package/lib/components/radio/item.js +0 -2
  680. package/lib/components/radio/item.js.map +0 -1
  681. package/lib/components/radio/radio.js +0 -2
  682. package/lib/components/radio/radio.js.map +0 -1
  683. package/lib/components/resizable/index.js +0 -2
  684. package/lib/components/resizable/index.js.map +0 -1
  685. package/lib/components/resizable/resizable.js +0 -2
  686. package/lib/components/resizable/resizable.js.map +0 -1
  687. package/lib/components/select/index.js +0 -2
  688. package/lib/components/select/index.js.map +0 -1
  689. package/lib/components/select/options.js +0 -2
  690. package/lib/components/select/options.js.map +0 -1
  691. package/lib/components/select/select.js +0 -2
  692. package/lib/components/select/select.js.map +0 -1
  693. package/lib/components/step/divider.js +0 -2
  694. package/lib/components/step/divider.js.map +0 -1
  695. package/lib/components/step/index.js +0 -2
  696. package/lib/components/step/index.js.map +0 -1
  697. package/lib/components/step/item.js +0 -2
  698. package/lib/components/step/item.js.map +0 -1
  699. package/lib/components/step/step.js +0 -2
  700. package/lib/components/step/step.js.map +0 -1
  701. package/lib/components/swiper/index.js +0 -2
  702. package/lib/components/swiper/index.js.map +0 -1
  703. package/lib/components/swiper/item.js +0 -2
  704. package/lib/components/swiper/item.js.map +0 -1
  705. package/lib/components/swiper/swiper.js +0 -2
  706. package/lib/components/swiper/swiper.js.map +0 -1
  707. package/lib/components/tabs/index.js +0 -2
  708. package/lib/components/tabs/index.js.map +0 -1
  709. package/lib/components/tabs/item.js +0 -2
  710. package/lib/components/tabs/item.js.map +0 -1
  711. package/lib/components/tabs/tabs.js +0 -2
  712. package/lib/components/tabs/tabs.js.map +0 -1
  713. package/lib/components/tag/index.js +0 -2
  714. package/lib/components/tag/index.js.map +0 -1
  715. package/lib/components/tag/tag.js +0 -2
  716. package/lib/components/tag/tag.js.map +0 -1
  717. package/lib/components/text/highlight.js +0 -2
  718. package/lib/components/text/highlight.js.map +0 -1
  719. package/lib/components/text/index.js +0 -2
  720. package/lib/components/text/index.js.map +0 -1
  721. package/lib/components/text/number.js +0 -2
  722. package/lib/components/text/number.js.map +0 -1
  723. package/lib/components/text/text.js +0 -2
  724. package/lib/components/text/text.js.map +0 -1
  725. package/lib/components/text/time.js +0 -2
  726. package/lib/components/text/time.js.map +0 -1
  727. package/lib/components/tree/index.js +0 -2
  728. package/lib/components/tree/index.js.map +0 -1
  729. package/lib/components/tree/item.js +0 -2
  730. package/lib/components/tree/item.js.map +0 -1
  731. package/lib/components/tree/tree.js +0 -2
  732. package/lib/components/tree/tree.js.map +0 -1
  733. package/lib/components/upload/index.js +0 -2
  734. package/lib/components/upload/index.js.map +0 -1
  735. package/lib/components/upload/renderFile.js +0 -2
  736. package/lib/components/upload/renderFile.js.map +0 -1
  737. package/lib/components/upload/upload.js +0 -2
  738. package/lib/components/upload/upload.js.map +0 -1
  739. package/lib/components/utils/empty/index.js +0 -2
  740. package/lib/components/utils/empty/index.js.map +0 -1
  741. package/lib/components/utils/helpericon/helpericon.js +0 -2
  742. package/lib/components/utils/helpericon/helpericon.js.map +0 -1
  743. package/lib/components/utils/helpericon/index.js +0 -2
  744. package/lib/components/utils/helpericon/index.js.map +0 -1
  745. package/lib/components/video/index.js +0 -2
  746. package/lib/components/video/index.js.map +0 -1
  747. package/lib/components/video/video.js +0 -2
  748. package/lib/components/video/video.js.map +0 -1
  749. package/lib/index.js.map +0 -1
  750. package/lib/js/hooks.js +0 -2
  751. package/lib/js/hooks.js.map +0 -1
  752. package/lib/js/usePreview/content.js +0 -2
  753. package/lib/js/usePreview/content.js.map +0 -1
  754. package/lib/js/usePreview/index.js +0 -2
  755. package/lib/js/usePreview/index.js.map +0 -1
  756. package/lib/js/usePreview/renderFile.js +0 -2
  757. package/lib/js/usePreview/renderFile.js.map +0 -1
  758. package/lib/js/usePreview/type.js +0 -2
  759. package/lib/js/usePreview/type.js.map +0 -1
  760. package/lib/js/useRipple/index.js +0 -2
  761. package/lib/js/useRipple/index.js.map +0 -1
  762. package/lib/js/utils.js +0 -2
  763. package/lib/js/utils.js.map +0 -1
@@ -0,0 +1,148 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ require('../../components/button/index.js');
7
+ var icon = require('../../components/icon/icon.js');
8
+ var material = require('@ricons/material');
9
+ var ahooks = require('ahooks');
10
+ var classNames = require('classnames');
11
+ var radash = require('radash');
12
+ var react = require('react');
13
+ var hooks = require('../hooks.js');
14
+ var utils = require('../utils.js');
15
+ var renderFile = require('./renderFile.js');
16
+ var type = require('./type.js');
17
+ var button = require('../../components/button/button.js');
18
+
19
+ function Content(props) {
20
+ const { items = [], initial = 0, renderFile: renderFile$1 = renderFile.default, onRotate, onChange, onClose, onZoom, } = props;
21
+ const state = ahooks.useReactive({
22
+ current: initial,
23
+ rotate: 0,
24
+ scale: 1,
25
+ translate: [0, 0],
26
+ start: [0, 0],
27
+ dragging: false,
28
+ controlHidden: true,
29
+ });
30
+ const box = react.useRef(null);
31
+ const translate = react.useRef([0, 0]);
32
+ const hiddenTO = react.useRef(null);
33
+ const files = react.useMemo(() => {
34
+ return items.map((item) => {
35
+ const o = {
36
+ src: "",
37
+ };
38
+ if (typeof item === "string") {
39
+ o.src = item;
40
+ }
41
+ else {
42
+ Object.assign(o, item);
43
+ }
44
+ o.suffix = utils.getSuffixByUrl(o.src) || "";
45
+ o.type = utils.getFileType(o.suffix, item["type"]);
46
+ return o;
47
+ });
48
+ }, [items]);
49
+ const { file, content } = react.useMemo(() => {
50
+ const file = files[state.current];
51
+ const content = renderFile$1(file);
52
+ return {
53
+ file,
54
+ content,
55
+ };
56
+ }, [state.current, items]);
57
+ const isImage = file.type === type.TFileType.IMAGE;
58
+ const handleSwitch = (next) => {
59
+ const l = files.length;
60
+ const { current: before } = state;
61
+ if (next >= l) {
62
+ state.current = 0;
63
+ }
64
+ else if (next < 0) {
65
+ state.current = l - 1;
66
+ }
67
+ else {
68
+ state.current = next;
69
+ }
70
+ onChange?.(state.current, before);
71
+ state.rotate = files[state.current].rotate || 0;
72
+ if (state.scale !== 1) {
73
+ state.scale = 1;
74
+ onZoom?.(1);
75
+ }
76
+ onRotate?.(state.rotate);
77
+ state.translate = translate.current = [0, 0];
78
+ };
79
+ const handleRotate = (deg) => {
80
+ state.rotate += deg;
81
+ onRotate?.(state.rotate);
82
+ };
83
+ const handleMouseWheel = radash.throttle({ interval: 60 }, (e) => {
84
+ if (!isImage)
85
+ return;
86
+ let after = state.scale + (e.deltaY < 0 ? 0.05 : -0.05);
87
+ if (after > 2)
88
+ after = 2;
89
+ if (after < 0.25)
90
+ after = 0.25;
91
+ onZoom?.(after);
92
+ state.scale = after;
93
+ });
94
+ const handleMouseDown = (e) => {
95
+ if (!isImage)
96
+ return;
97
+ e.preventDefault();
98
+ state.dragging = true;
99
+ state.start = [e.pageX, e.pageY];
100
+ };
101
+ const clearHiddenTO = () => {
102
+ if (!hiddenTO.current || state.controlHidden)
103
+ return;
104
+ clearTimeout(hiddenTO.current);
105
+ hiddenTO.current = null;
106
+ };
107
+ const setHiddenFalse = () => {
108
+ if (!state.controlHidden)
109
+ return;
110
+ state.controlHidden = false;
111
+ clearHiddenTO();
112
+ hiddenTO.current = setTimeout(() => {
113
+ state.controlHidden = true;
114
+ }, 1000);
115
+ };
116
+ const throttleMouseMove = radash.throttle({ interval: 300 }, setHiddenFalse);
117
+ const handleMouseMove = (e) => {
118
+ throttleMouseMove();
119
+ if (!state.dragging)
120
+ return;
121
+ e.preventDefault();
122
+ const [x, y] = translate.current;
123
+ const [ox, oy] = state.start;
124
+ const offsetX = e.pageX - ox;
125
+ const offsetY = e.pageY - oy;
126
+ state.translate = [x + offsetX, y + offsetY];
127
+ };
128
+ const handleMouseUp = () => {
129
+ if (!state.dragging)
130
+ return;
131
+ state.dragging = false;
132
+ translate.current = state.translate;
133
+ };
134
+ hooks.useMouseMove(handleMouseMove);
135
+ hooks.useMouseUp(handleMouseUp);
136
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: box, className: classNames("i-preview-content", {
137
+ "no-transition": state.dragging,
138
+ }), style: {
139
+ transform: `translate(${state.translate
140
+ .map((n) => `${n}px`)
141
+ .join(",")}) rotate(${state.rotate}deg) scale(${state.scale})`,
142
+ }, onWheel: handleMouseWheel, onMouseDown: handleMouseDown, onClick: (e) => e.stopPropagation(), children: content }), jsxRuntime.jsxs("div", { className: classNames("i-preview-controls", {
143
+ "i-preview-controls-hidden": state.controlHidden,
144
+ }), children: [jsxRuntime.jsx(button.default, { square: true, flat: true, onClick: onClose, children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.CloseRound, {}) }) }), files.length > 1 && (jsxRuntime.jsxs("span", { className: 'px-8', children: [state.current + 1, " / ", files.length] })), state.scale !== 1 && (jsxRuntime.jsxs(button.default, { flat: true, onClick: () => (state.scale = 1), children: [jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.AspectRatioRound, {}) }), jsxRuntime.jsxs("span", { className: 'mt-2', children: [(state.scale * 100).toFixed(0), "%"] })] })), jsxRuntime.jsx(button.default, { square: true, flat: true, href: file.src, target: '_blank', children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.OpenInNewRound, {}) }) }), jsxRuntime.jsx(button.default, { square: true, flat: true, href: file.src, download: true, target: '_blank', children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.FileDownloadOutlined, {}) }) }), jsxRuntime.jsx(button.default, { square: true, flat: true, onClick: () => handleRotate(90), children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.RotateRightRound, {}) }) }), jsxRuntime.jsx(button.default, { square: true, flat: true, onClick: () => handleRotate(-90), children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.RotateLeftRound, {}) }) }), files.length > 1 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(button.default, { square: true, flat: true, onClick: () => handleSwitch(state.current - 1), children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.KeyboardArrowLeftRound, {}) }) }), jsxRuntime.jsx(button.default, { square: true, flat: true, onClick: () => handleSwitch(state.current + 1), children: jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.KeyboardArrowRightRound, {}) }) })] }))] })] }));
145
+ }
146
+
147
+ exports.default = Content;
148
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","sources":["../../../../packages/js/usePreview/content.tsx"],"sourcesContent":["import Button from \"@p/components/button\";\nimport Icon from \"@p/components/icon\";\nimport {\n\tAspectRatioRound,\n\tCloseRound,\n\tFileDownloadOutlined,\n\tKeyboardArrowLeftRound,\n\tKeyboardArrowRightRound,\n\tOpenInNewRound,\n\tRotateLeftRound,\n\tRotateRightRound,\n} from \"@ricons/material\";\nimport { useReactive } from \"ahooks\";\nimport classNames from \"classnames\";\nimport { throttle } from \"radash\";\nimport { useMemo, useRef } from \"react\";\nimport { useMouseMove, useMouseUp } from \"../hooks\";\nimport { getFileType, getSuffixByUrl } from \"../utils\";\nimport DefaultRenderFile from \"./renderFile\";\nimport { IPreview, TFileType, TPreviewItem } from \"./type\";\n\nexport default function Content(props: IPreview) {\n\tconst {\n\t\titems = [],\n\t\tinitial = 0,\n\t\trenderFile = DefaultRenderFile,\n\t\tonRotate,\n\t\tonChange,\n\t\tonClose,\n\t\tonZoom,\n\t} = props;\n\tconst state = useReactive({\n\t\tcurrent: initial,\n\t\trotate: 0,\n\t\tscale: 1,\n\t\ttranslate: [0, 0],\n\t\tstart: [0, 0],\n\t\tdragging: false,\n\t\tcontrolHidden: true,\n\t});\n\tconst box = useRef<HTMLDivElement>(null);\n\tconst translate = useRef<number[]>([0, 0]);\n\tconst hiddenTO = useRef<any>(null);\n\n\tconst files = useMemo(() => {\n\t\treturn items.map((item) => {\n\t\t\tconst o: TPreviewItem = {\n\t\t\t\tsrc: \"\",\n\t\t\t};\n\t\t\tif (typeof item === \"string\") {\n\t\t\t\to.src = item;\n\t\t\t} else {\n\t\t\t\tObject.assign(o, item);\n\t\t\t}\n\n\t\t\to.suffix = getSuffixByUrl(o.src) || \"\";\n\t\t\to.type = getFileType(o.suffix, item[\"type\"]);\n\n\t\t\treturn o;\n\t\t});\n\t}, [items]);\n\n\tconst { file, content } = useMemo(() => {\n\t\tconst file = files[state.current];\n\t\tconst content = renderFile(file);\n\n\t\treturn {\n\t\t\tfile,\n\t\t\tcontent,\n\t\t};\n\t}, [state.current, items]);\n\n\tconst isImage = file.type === TFileType.IMAGE;\n\n\tconst handleSwitch = (next: number) => {\n\t\tconst l = files.length;\n\t\tconst { current: before } = state;\n\t\tif (next >= l) {\n\t\t\tstate.current = 0;\n\t\t} else if (next < 0) {\n\t\t\tstate.current = l - 1;\n\t\t} else {\n\t\t\tstate.current = next;\n\t\t}\n\t\tonChange?.(state.current, before);\n\n\t\tstate.rotate = files[state.current].rotate || 0;\n\n\t\tif (state.scale !== 1) {\n\t\t\tstate.scale = 1;\n\t\t\tonZoom?.(1);\n\t\t}\n\t\tonRotate?.(state.rotate);\n\t\tstate.translate = translate.current = [0, 0];\n\t};\n\n\tconst handleRotate = (deg: number) => {\n\t\tstate.rotate += deg;\n\n\t\tonRotate?.(state.rotate);\n\t};\n\n\tconst handleMouseWheel = throttle({ interval: 60 }, (e) => {\n\t\tif (!isImage) return;\n\t\tlet after = state.scale + (e.deltaY < 0 ? 0.05 : -0.05);\n\t\tif (after > 2) after = 2;\n\t\tif (after < 0.25) after = 0.25;\n\n\t\tonZoom?.(after);\n\t\tstate.scale = after;\n\t});\n\n\tconst handleMouseDown = (e) => {\n\t\tif (!isImage) return;\n\t\te.preventDefault();\n\t\tstate.dragging = true;\n\t\tstate.start = [e.pageX, e.pageY];\n\t};\n\n\tconst clearHiddenTO = () => {\n\t\tif (!hiddenTO.current || state.controlHidden) return;\n\t\tclearTimeout(hiddenTO.current);\n\t\thiddenTO.current = null;\n\t};\n\n\tconst setHiddenFalse = () => {\n\t\tif (!state.controlHidden) return;\n\t\tstate.controlHidden = false;\n\n\t\tclearHiddenTO();\n\t\thiddenTO.current = setTimeout(() => {\n\t\t\tstate.controlHidden = true;\n\t\t}, 1000);\n\t};\n\n\tconst throttleMouseMove = throttle({ interval: 300 }, setHiddenFalse);\n\n\tconst handleMouseMove = (e) => {\n\t\tthrottleMouseMove();\n\t\tif (!state.dragging) return;\n\t\te.preventDefault();\n\n\t\tconst [x, y] = translate.current;\n\t\tconst [ox, oy] = state.start;\n\t\tconst offsetX = e.pageX - ox;\n\t\tconst offsetY = e.pageY - oy;\n\n\t\tstate.translate = [x + offsetX, y + offsetY];\n\t};\n\n\tconst handleMouseUp = () => {\n\t\tif (!state.dragging) return;\n\t\tstate.dragging = false;\n\t\ttranslate.current = state.translate;\n\t};\n\n\tuseMouseMove(handleMouseMove);\n\tuseMouseUp(handleMouseUp);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tref={box}\n\t\t\t\tclassName={classNames(\"i-preview-content\", {\n\t\t\t\t\t\"no-transition\": state.dragging,\n\t\t\t\t})}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: `translate(${state.translate\n\t\t\t\t\t\t.map((n) => `${n}px`)\n\t\t\t\t\t\t.join(\",\")}) rotate(${state.rotate}deg) scale(${\n\t\t\t\t\t\tstate.scale\n\t\t\t\t\t})`,\n\t\t\t\t}}\n\t\t\t\tonWheel={handleMouseWheel}\n\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\tonClick={(e) => e.stopPropagation()}\n\t\t\t>\n\t\t\t\t{content}\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tclassName={classNames(\"i-preview-controls\", {\n\t\t\t\t\t\"i-preview-controls-hidden\": state.controlHidden,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<Button square flat onClick={onClose}>\n\t\t\t\t\t<Icon icon={<CloseRound />} />\n\t\t\t\t</Button>\n\t\t\t\t{files.length > 1 && (\n\t\t\t\t\t<span className='px-8'>\n\t\t\t\t\t\t{state.current + 1} / {files.length}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{state.scale !== 1 && (\n\t\t\t\t\t<Button flat onClick={() => (state.scale = 1)}>\n\t\t\t\t\t\t<Icon icon={<AspectRatioRound />} />\n\t\t\t\t\t\t<span className='mt-2'>\n\t\t\t\t\t\t\t{(state.scale * 100).toFixed(0)}%\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t<Button square flat href={file.src} target='_blank'>\n\t\t\t\t\t<Icon icon={<OpenInNewRound />} />\n\t\t\t\t</Button>\n\t\t\t\t<Button square flat href={file.src} download target='_blank'>\n\t\t\t\t\t<Icon icon={<FileDownloadOutlined />} />\n\t\t\t\t</Button>\n\t\t\t\t<Button square flat onClick={() => handleRotate(90)}>\n\t\t\t\t\t<Icon icon={<RotateRightRound />} />\n\t\t\t\t</Button>\n\t\t\t\t<Button square flat onClick={() => handleRotate(-90)}>\n\t\t\t\t\t<Icon icon={<RotateLeftRound />} />\n\t\t\t\t</Button>\n\n\t\t\t\t{files.length > 1 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsquare\n\t\t\t\t\t\t\tflat\n\t\t\t\t\t\t\tonClick={() => handleSwitch(state.current - 1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon icon={<KeyboardArrowLeftRound />} />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsquare\n\t\t\t\t\t\t\tflat\n\t\t\t\t\t\t\tonClick={() => handleSwitch(state.current + 1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon icon={<KeyboardArrowRightRound />} />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"names":["renderFile","DefaultRenderFile","useReactive","useRef","useMemo","getSuffixByUrl","getFileType","TFileType","throttle","useMouseMove","useMouseUp","_jsxs","_Fragment","_jsx","Button","Icon","CloseRound","AspectRatioRound","OpenInNewRound","FileDownloadOutlined","RotateRightRound","RotateLeftRound","KeyboardArrowLeftRound","KeyboardArrowRightRound"],"mappings":";;;;;;;;;;;;;;;;;;AAqBwB,SAAA,OAAO,CAAC,KAAe,EAAA;IAC9C,MAAM,EACL,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,CAAC,cACXA,YAAU,GAAGC,kBAAiB,EAC9B,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,GACN,GAAG,KAAK;IACT,MAAM,KAAK,GAAGC,kBAAW,CAAC;AACzB,QAAA,OAAO,EAAE,OAAO;AAChB,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,QAAA,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACb,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,aAAa,EAAE,IAAI;AACnB,KAAA,CAAC;AACF,IAAA,MAAM,GAAG,GAAGC,YAAM,CAAiB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,YAAI,EAAC,EAAA,IAAI,EAAEF,cAAC,CAAAU,gCAAuB,EAAG,EAAA,CAAA,EAAA,CAAI,GACnC,CACP,EAAA,CAAA,CACH,CACI,EAAA,CAAA,CAAA,EAAA,CACJ;AAEL;;;;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
7
+ var hookModal = require('../../components/modal/hookModal.js');
8
+ var utils = require('../utils.js');
9
+ var content = require('./content.js');
10
+
11
+ function usePreview() {
12
+ const ref = react.useRef(null);
13
+ const preview = (config) => {
14
+ const { items, modalProps, onClose, ...restProps } = config;
15
+ const handleClose = () => {
16
+ onClose?.();
17
+ unMount?.();
18
+ };
19
+ const unMount = utils.renderNode(jsxRuntime.jsx(hookModal.default, { ref: ref, visible: true, className: 'i-preview', customized: true, hideShadow: true, ...modalProps, children: jsxRuntime.jsx(content.default, { ...restProps, items: items, onClose: () => {
20
+ ref.current?.update({ visible: false });
21
+ } }), fixed: true, onClose: handleClose }));
22
+ };
23
+ return preview;
24
+ }
25
+
26
+ exports.default = usePreview;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/js/usePreview/index.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport HookModal from \"../../components/modal/hookModal\";\nimport type { RefHookModal } from \"../../components/modal/type\";\nimport { renderNode } from \"../utils\";\nimport Content from \"./content\";\nimport \"./index.css\";\nimport type { IPreview } from \"./type\";\n\nexport default function usePreview() {\n\tconst ref = useRef<RefHookModal>(null);\n\n\tconst preview = (config: IPreview) => {\n\t\tconst { items, modalProps, onClose, ...restProps } = config;\n\n\t\tconst handleClose = () => {\n\t\t\tonClose?.();\n\t\t\tunMount?.();\n\t\t};\n\n\t\tconst unMount = renderNode(\n\t\t\t<HookModal\n\t\t\t\tref={ref}\n\t\t\t\tvisible\n\t\t\t\tclassName='i-preview'\n\t\t\t\tcustomized\n\t\t\t\thideShadow\n\t\t\t\t{...modalProps}\n\t\t\t\tchildren={\n\t\t\t\t\t<Content\n\t\t\t\t\t\t{...restProps}\n\t\t\t\t\t\titems={items}\n\t\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\t\tref.current?.update({ visible: false });\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tfixed\n\t\t\t\tonClose={handleClose}\n\t\t\t/>\n\t\t);\n\t};\n\n\treturn preview;\n}\n"],"names":["useRef","renderNode","_jsx","HookModal","Content"],"mappings":";;;;;;;;;;AAQc,SAAU,UAAU,GAAA;AACjC,IAAA,MAAM,GAAG,GAAGA,YAAM,CAAe,IAAI,CAAC;AAEtC,IAAA,MAAM,OAAO,GAAG,CAAC,MAAgB,KAAI;AACpC,QAAA,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM;QAE3D,MAAM,WAAW,GAAG,MAAK;YACxB,OAAO,IAAI;YACX,OAAO,IAAI;AACZ,SAAC;AAED,QAAA,MAAM,OAAO,GAAGC,gBAAU,CACzBC,cAAA,CAACC,iBAAS,EACT,EAAA,GAAG,EAAE,GAAG,EACR,OAAO,EAAA,IAAA,EACP,SAAS,EAAC,WAAW,EACrB,UAAU,EACV,IAAA,EAAA,UAAU,WACN,UAAU,EACd,QAAQ,EACPD,eAACE,eAAO,EAAA,EAAA,GACH,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAK;oBACb,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;iBACvC,EAAA,CACA,EAEH,KAAK,EAAA,IAAA,EACL,OAAO,EAAE,WAAW,EACnB,CAAA,CACF;AACF,KAAC;AAED,IAAA,OAAO,OAAO;AACf;;;;"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var icon = require('../../components/icon/icon.js');
7
+ var video = require('../../components/video/video.js');
8
+ var material = require('@ricons/material');
9
+ var type = require('./type.js');
10
+
11
+ function renderFile(props) {
12
+ const { name, suffix, type: type$1 } = props;
13
+ switch (type$1) {
14
+ case type.TFileType.IMAGE:
15
+ return jsxRuntime.jsx("img", { src: props.src });
16
+ case type.TFileType.VIDEO:
17
+ return jsxRuntime.jsx(video.default, { ...props });
18
+ default:
19
+ return (jsxRuntime.jsxs("div", { className: 'i-preview-unknown', children: [jsxRuntime.jsx(icon.default, { icon: jsxRuntime.jsx(material.FeedOutlined, {}), size: '3em' }), jsxRuntime.jsx("h5", { className: 'mt-4', children: name || suffix || "?" })] }));
20
+ }
21
+ }
22
+
23
+ exports.default = renderFile;
24
+ //# sourceMappingURL=renderFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderFile.js","sources":["../../../../packages/js/usePreview/renderFile.tsx"],"sourcesContent":["import Icon from \"@p/components/icon\";\nimport Video from \"@p/components/video\";\nimport { FeedOutlined } from \"@ricons/material\";\nimport { TFileType, TPreviewItem } from \"./type\";\n\nexport default function renderFile(props: TPreviewItem) {\n\tconst { name, suffix, type } = props;\n\n\tswitch (type) {\n\t\tcase TFileType.IMAGE:\n\t\t\treturn <img src={props.src} />;\n\t\tcase TFileType.VIDEO:\n\t\t\treturn <Video {...props} />;\n\t\tdefault:\n\t\t\treturn (\n\t\t\t\t<div className='i-preview-unknown'>\n\t\t\t\t\t<Icon icon={<FeedOutlined />} size='3em' />\n\t\t\t\t\t<h5 className='mt-4'>{name || suffix || \"?\"}</h5>\n\t\t\t\t</div>\n\t\t\t);\n\t}\n}\n"],"names":["type","TFileType","_jsx","Video","_jsxs","Icon","FeedOutlined"],"mappings":";;;;;;;;;;AAKwB,SAAA,UAAU,CAAC,KAAmB,EAAA;IACrD,MAAM,EAAE,IAAI,EAAE,MAAM,QAAEA,MAAI,EAAE,GAAG,KAAK;IAEpC,QAAQA,MAAI;QACX,KAAKC,cAAS,CAAC,KAAK;AACnB,YAAA,OAAOC,wBAAK,GAAG,EAAE,KAAK,CAAC,GAAG,GAAI;QAC/B,KAAKD,cAAS,CAAC,KAAK;AACnB,YAAA,OAAOC,cAAC,CAAAC,aAAK,EAAK,EAAA,GAAA,KAAK,GAAI;AAC5B,QAAA;AACC,YAAA,QACCC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,mBAAmB,EACjC,QAAA,EAAA,CAAAF,cAAA,CAACG,YAAI,EAAA,EAAC,IAAI,EAAEH,cAAC,CAAAI,qBAAY,KAAG,EAAE,IAAI,EAAC,KAAK,EAAG,CAAA,EAC3CJ,cAAI,CAAA,IAAA,EAAA,EAAA,SAAS,EAAC,MAAM,EAAA,QAAA,EAAE,IAAI,IAAI,MAAM,IAAI,GAAG,EAAM,CAAA,CAAA,EAAA,CAC5C;;AAGV;;;;"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ exports.TFileType = void 0;
4
+ (function (TFileType) {
5
+ TFileType["IMAGE"] = "IMAGE";
6
+ TFileType["VIDEO"] = "VIDEO";
7
+ TFileType["AUDIO"] = "AUDIO";
8
+ TFileType["PDF"] = "PDF";
9
+ TFileType["EXCEL"] = "EXCEL";
10
+ TFileType["TXT"] = "TXT";
11
+ TFileType["UNKNOWN"] = "UNKNOWN";
12
+ })(exports.TFileType || (exports.TFileType = {}));
13
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sources":["../../../../packages/js/usePreview/type.ts"],"sourcesContent":["import { CSSProperties, ReactNode } from \"react\";\nimport type { IModal } from \"../../components/modal/type\";\n\nexport type TPreviewItem = {\n\tsrc: string;\n\tname?: ReactNode;\n\tthumb?: string;\n\trotate?: number;\n\tzoom?: number;\n\tstyle?: CSSProperties;\n\ttype?: string;\n\tsuffix?: string;\n};\n\nexport enum TFileType {\n\tIMAGE = \"IMAGE\",\n\tVIDEO = \"VIDEO\",\n\tAUDIO = \"AUDIO\",\n\tPDF = \"PDF\",\n\tEXCEL = \"EXCEL\",\n\tTXT = \"TXT\",\n\tUNKNOWN = \"UNKNOWN\",\n}\n\nexport interface IPreview {\n\titems: (TPreviewItem | string)[];\n\tinitial?: number;\n\tcontrols?: boolean;\n\tloop?: boolean;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tmodalProps?: IModal;\n\trenderImage?: (file: TPreviewItem) => ReactNode;\n\trenderFile?: (file: TPreviewItem) => ReactNode;\n\tonClose?: () => void;\n\tonChange?: (after: number, before?: number) => void;\n\tonZoom?: (scale: number) => void;\n\tonRotate?: (deg: number) => void;\n}\n"],"names":["TFileType"],"mappings":";;AAcYA;AAAZ,CAAA,UAAY,SAAS,EAAA;AACpB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACpB,CAAC,EARWA,iBAAS,KAATA,iBAAS,GAQpB,EAAA,CAAA,CAAA;;"}
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const TIMEOUT = 500;
6
+ const useRipple = () => {
7
+ if (document.documentElement.dataset["useripple"])
8
+ return;
9
+ document.documentElement.dataset["useripple"] = "enable";
10
+ document.addEventListener("mousedown", listener);
11
+ };
12
+ function listener(e) {
13
+ const target = e.target;
14
+ const parent = target.closest("[data-ripple]");
15
+ if (!target || !parent)
16
+ return;
17
+ triggerRipple(parent, e);
18
+ }
19
+ function triggerRipple(target, e) {
20
+ const [$box, $ripple] = createRipple();
21
+ const rect = target.getBoundingClientRect();
22
+ const size = Math.max(rect.width, rect.height) * 2;
23
+ $ripple.style.cssText = `
24
+ left: ${e.pageX - rect.left}px;
25
+ top: ${e.pageY - rect.top}px;
26
+ width: ${size}px;
27
+ height: ${size}px;
28
+ transition: all ${TIMEOUT / 1000}s;
29
+ `;
30
+ target.insertAdjacentElement("afterbegin", $box);
31
+ target.offsetHeight;
32
+ $ripple.classList.add("i-ripple-active");
33
+ setTimeout(() => {
34
+ $box.remove();
35
+ }, TIMEOUT);
36
+ }
37
+ function createRipple() {
38
+ const $box = document.createElement("SPAN");
39
+ const $ripple = document.createElement("SPAN");
40
+ $box.className = "i-ripple-container";
41
+ $ripple.className = "i-ripple";
42
+ $box.append($ripple);
43
+ return [$box, $ripple];
44
+ }
45
+
46
+ exports.default = useRipple;
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/js/useRipple/index.ts"],"sourcesContent":["import \"./ripple.css\";\n\nconst TIMEOUT = 500;\n\nconst useRipple = () => {\n\tif (document.documentElement.dataset[\"useripple\"]) return;\n\tdocument.documentElement.dataset[\"useripple\"] = \"enable\";\n\n\tdocument.addEventListener(\"mousedown\", listener);\n};\n\nfunction listener(e: MouseEvent) {\n\tconst target = e.target as HTMLElement;\n\tconst parent = target.closest(\"[data-ripple]\") as HTMLElement;\n\n\tif (!target || !parent) return;\n\n\ttriggerRipple(parent, e);\n}\n\nfunction triggerRipple(target: HTMLElement, e: MouseEvent) {\n\tconst [$box, $ripple] = createRipple();\n\tconst rect = target.getBoundingClientRect();\n\tconst size = Math.max(rect.width, rect.height) * 2;\n\n\t$ripple.style.cssText = `\n left: ${e.pageX - rect.left}px;\n top: ${e.pageY - rect.top}px;\n width: ${size}px;\n height: ${size}px;\n transition: all ${TIMEOUT / 1000}s;\n `;\n\ttarget.insertAdjacentElement(\"afterbegin\", $box);\n\ttarget.offsetHeight;\n\t$ripple.classList.add(\"i-ripple-active\");\n\n\tsetTimeout(() => {\n\t\t$box.remove();\n\t}, TIMEOUT);\n}\n\nfunction createRipple() {\n\tconst $box = document.createElement(\"SPAN\");\n\tconst $ripple = document.createElement(\"SPAN\");\n\n\t$box.className = \"i-ripple-container\";\n\t$ripple.className = \"i-ripple\";\n\n\t$box.append($ripple);\n\n\treturn [$box, $ripple];\n}\n\nexport default useRipple;\n"],"names":[],"mappings":";;;;AAEA,MAAM,OAAO,GAAG,GAAG;AAEb,MAAA,SAAS,GAAG,MAAK;AACtB,IAAA,IAAI,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE;IACnD,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ;AAExD,IAAA,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC;AACjD;AAEA,SAAS,QAAQ,CAAC,CAAa,EAAA;AAC9B,IAAA,MAAM,MAAM,GAAG,CAAC,CAAC,MAAqB;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAgB;AAE7D,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;QAAE;AAExB,IAAA,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;AACzB;AAEA,SAAS,aAAa,CAAC,MAAmB,EAAE,CAAa,EAAA;IACxD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE;AACtC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC3C,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AAElD,IAAA,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG;AACT,cAAA,EAAA,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAA;AACpB,aAAA,EAAA,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAA;iBAChB,IAAI,CAAA;kBACH,IAAI,CAAA;AACI,wBAAA,EAAA,OAAO,GAAG,IAAI,CAAA;KACnC;AACJ,IAAA,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,IAAI,CAAC;IAChD,MAAM,CAAC,YAAY;AACnB,IAAA,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAExC,UAAU,CAAC,MAAK;QACf,IAAI,CAAC,MAAM,EAAE;KACb,EAAE,OAAO,CAAC;AACZ;AAEA,SAAS,YAAY,GAAA;IACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;IAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AAE9C,IAAA,IAAI,CAAC,SAAS,GAAG,oBAAoB;AACrC,IAAA,OAAO,CAAC,SAAS,GAAG,UAAU;AAE9B,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;AAEpB,IAAA,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AACvB;;;;"}
@@ -0,0 +1,281 @@
1
+ 'use strict';
2
+
3
+ var client = require('react-dom/client');
4
+
5
+ function getPosition($source, $popup, options = {}) {
6
+ const { refWindow, gap = 0, offset = 0, position = "top", align } = options;
7
+ if (!$source || !$popup)
8
+ return [
9
+ 0,
10
+ 0,
11
+ {
12
+ arrowX: 0,
13
+ arrowY: 0,
14
+ arrowPos: "bottom",
15
+ },
16
+ ];
17
+ const rectT = $source.getBoundingClientRect();
18
+ const rectC = $popup.getBoundingClientRect();
19
+ let w = window.innerWidth;
20
+ let h = window.innerHeight;
21
+ let { left: tl, top: tt, right: tr, bottom: tb, width: tw, height: th, } = rectT;
22
+ const { height: ch, width: cw } = rectC;
23
+ if (!refWindow) {
24
+ const rectPa = $source.offsetParent?.getBoundingClientRect();
25
+ w = rectPa?.width || w;
26
+ h = rectPa?.height || h;
27
+ tl = $source.offsetLeft;
28
+ tt = $source.offsetTop;
29
+ tr = tl + rectT.width;
30
+ tb = tt + rectT.height;
31
+ }
32
+ let y = 0;
33
+ let x = 0;
34
+ let arrowX = 0;
35
+ let arrowY = 0;
36
+ let arrowPos = "bottom";
37
+ switch (position) {
38
+ case "left":
39
+ case "right":
40
+ y =
41
+ th !== ch
42
+ ? computePosition({
43
+ containerSize: h,
44
+ targetSize: th,
45
+ targetOffset: tt,
46
+ contentSize: ch,
47
+ gap,
48
+ align,
49
+ })
50
+ : tt;
51
+ arrowY = y < tt ? tt - y + th / 2 : th / 2;
52
+ const xl = tl - offset - cw;
53
+ const xr = tr + offset + cw;
54
+ if (position === "left") {
55
+ const R = xl < 0 && xr <= w;
56
+ x = R ? tr + offset : xl;
57
+ arrowX = R ? 0 : cw;
58
+ arrowPos = R ? "left" : "right";
59
+ }
60
+ else {
61
+ const R = w > xr || xl < 0;
62
+ x = R ? tr + offset : xl;
63
+ arrowX = R ? 0 : cw;
64
+ arrowPos = R ? "left" : "right";
65
+ }
66
+ break;
67
+ case "top":
68
+ case "bottom":
69
+ x =
70
+ tw !== cw
71
+ ? computePosition({
72
+ containerSize: w,
73
+ targetOffset: tl,
74
+ targetSize: tw,
75
+ contentSize: cw,
76
+ gap,
77
+ align,
78
+ })
79
+ : tl;
80
+ arrowX = x > tl ? cw / 2 : tl - x + tw / 2;
81
+ const yt = tt - offset - ch;
82
+ const yb = tb + offset + ch;
83
+ if (position === "top") {
84
+ const T = yt < 0 && yb <= h;
85
+ y = T ? tb + offset : yt;
86
+ arrowY = T ? 0 : ch;
87
+ arrowPos = T ? "top" : "bottom";
88
+ }
89
+ else {
90
+ const B = h > yb || yt < 0;
91
+ y = B ? tb + offset : yt;
92
+ arrowY = B ? 0 : ch;
93
+ arrowPos = B ? "top" : "bottom";
94
+ }
95
+ break;
96
+ }
97
+ return [
98
+ x,
99
+ y,
100
+ {
101
+ arrowX,
102
+ arrowY,
103
+ arrowPos,
104
+ },
105
+ ];
106
+ }
107
+ function getPointPosition(e, content) {
108
+ const { width: w, height: h } = content.getBoundingClientRect();
109
+ const parent = content.offsetParent;
110
+ let pw, ph, pl = 0, pt = 0;
111
+ if (parent) {
112
+ const { width: ow, height: oh, left: ol, top: ot, } = parent.getBoundingClientRect();
113
+ const st = parent.scrollTop ?? 0;
114
+ pw = ow;
115
+ ph = oh;
116
+ pt = ot - st;
117
+ pl = ol;
118
+ }
119
+ else {
120
+ pw = window.innerWidth;
121
+ ph = window.innerHeight;
122
+ }
123
+ const x = e.pageX - pl;
124
+ const y = e.pageY - pt;
125
+ const left = x + w >= pw ? (x - w > 0 ? x - w : x) : x;
126
+ const top = y + h >= ph ? (y - h > 0 ? y - h : y) : y;
127
+ return [left, top];
128
+ }
129
+ function computePosition({ containerSize, targetSize, targetOffset, contentSize, gap, align = "center", }) {
130
+ const centerPoint = targetOffset + targetSize / 2;
131
+ switch (align) {
132
+ case "start":
133
+ return targetOffset + contentSize > containerSize
134
+ ? containerSize - contentSize - gap
135
+ : targetOffset;
136
+ case "center":
137
+ if (targetSize >= contentSize) {
138
+ return centerPoint - contentSize / 2;
139
+ }
140
+ if (centerPoint + contentSize / 2 + gap > containerSize) {
141
+ return targetOffset + targetSize - contentSize;
142
+ }
143
+ if (centerPoint - contentSize / 2 - gap < 0) {
144
+ return gap;
145
+ }
146
+ return centerPoint - contentSize / 2;
147
+ case "end":
148
+ const result = targetOffset + targetSize - contentSize;
149
+ return result > 0 ? result : gap;
150
+ default:
151
+ return centerPoint - contentSize / 2;
152
+ }
153
+ }
154
+ function formatOption(options) {
155
+ return options.map((option) => ["string", "number"].includes(typeof option)
156
+ ? { label: option, value: option }
157
+ : option);
158
+ }
159
+ function animate(from, to, duration = 1000, callback, easing = (t) => 1 - Math.pow(1 - t, 4)) {
160
+ const start = performance.now();
161
+ const diff = to - from;
162
+ let raf = requestAnimationFrame(loop);
163
+ function loop() {
164
+ raf = requestAnimationFrame(loop);
165
+ const past = performance.now() - start;
166
+ let percent = past / duration;
167
+ if (percent >= 1) {
168
+ percent = 1;
169
+ cancelAnimationFrame(raf);
170
+ }
171
+ const pass = diff * easing(percent);
172
+ callback?.(pass);
173
+ }
174
+ }
175
+ function formatNumber(value, options = {}) {
176
+ const { precision, thousand } = options;
177
+ const result = value.toFixed(precision);
178
+ if (!thousand)
179
+ return result;
180
+ const points = result.split(".");
181
+ const integer = points[0].replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, `$&${thousand}`);
182
+ if (points.length === 1)
183
+ return integer;
184
+ return `${integer}.${points[1]}`;
185
+ }
186
+ function renderNode(node, container = document.body) {
187
+ const div = document.createElement("div");
188
+ container.append(div);
189
+ const root = client.createRoot(div);
190
+ const sto = setTimeout(() => {
191
+ root?.render(node);
192
+ }, 0);
193
+ return () => {
194
+ div?.remove();
195
+ root?.unmount();
196
+ sto && clearTimeout(sto);
197
+ };
198
+ }
199
+ function getSuffixByUrl(url) {
200
+ return url.match(/\.([^\./\?]+)($|\?)/)?.[1];
201
+ }
202
+ function getFileType(suffix, type) {
203
+ switch (true) {
204
+ case ["jpg", "jpeg", "png", "webp", "svg"].includes(suffix) ||
205
+ type?.startsWith("image/"):
206
+ return "IMAGE";
207
+ case ["mp4", "avi"].includes(suffix) || type?.startsWith("video/"):
208
+ return "VIDEO";
209
+ default:
210
+ return "UNKNOWN";
211
+ }
212
+ }
213
+ function fullScreen(el) {
214
+ el.requestFullscreen?.();
215
+ }
216
+ function exitFullScreen() {
217
+ document.exitFullscreen?.();
218
+ }
219
+ function formatTime(time, options) {
220
+ const result = [];
221
+ const { zero = true, units = ["", ":", ":"] } = options;
222
+ const l = units.length;
223
+ let i = 0;
224
+ while (i < l) {
225
+ if (time <= 0 && i > 1)
226
+ break;
227
+ const n = Math.round(time % 60);
228
+ time = Math.floor(time / 60);
229
+ result.unshift((zero && n < 10 ? `0${n}` : n) + units[i++]);
230
+ }
231
+ return result.join("");
232
+ }
233
+ function getNextSorter(prevSortBy, prevSortType, sortBy) {
234
+ const types = ["desc", "asc"];
235
+ if (prevSortBy === sortBy) {
236
+ const i = types.findIndex((t) => t === prevSortType) + 1;
237
+ const type = types[i] || "";
238
+ const by = type === "" ? "" : sortBy;
239
+ return [by, type];
240
+ }
241
+ return [sortBy, "desc"];
242
+ }
243
+ function formatBytes(bytes, decimals = 2) {
244
+ if (!+bytes)
245
+ return "0 Bytes";
246
+ const k = 1024;
247
+ const dm = decimals < 0 ? 0 : decimals;
248
+ const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
249
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
250
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
251
+ }
252
+ function clamp(value, min, max) {
253
+ return value < min ? min : value > max ? max : value;
254
+ }
255
+ const arrayMove = (array, fromIndex, toIndex) => {
256
+ if (toIndex >= array.length) {
257
+ let k = toIndex - array.length + 1;
258
+ while (k--) {
259
+ array.push(undefined);
260
+ }
261
+ }
262
+ array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);
263
+ return array;
264
+ };
265
+
266
+ exports.animate = animate;
267
+ exports.arrayMove = arrayMove;
268
+ exports.clamp = clamp;
269
+ exports.exitFullScreen = exitFullScreen;
270
+ exports.formatBytes = formatBytes;
271
+ exports.formatNumber = formatNumber;
272
+ exports.formatOption = formatOption;
273
+ exports.formatTime = formatTime;
274
+ exports.fullScreen = fullScreen;
275
+ exports.getFileType = getFileType;
276
+ exports.getNextSorter = getNextSorter;
277
+ exports.getPointPosition = getPointPosition;
278
+ exports.getPosition = getPosition;
279
+ exports.getSuffixByUrl = getSuffixByUrl;
280
+ exports.renderNode = renderNode;
281
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../packages/js/utils.ts"],"sourcesContent":["import type { MouseEvent } from \"react\";\nimport { ReactNode } from \"react\";\nimport { Root, createRoot } from \"react-dom/client\";\nimport type { TOption, TOptions, TRelativeOptions } from \"../type\";\n\ntype TComputePosition = {\n\tcontainerSize: number;\n\ttargetSize: number;\n\ttargetOffset: number;\n\tcontentSize: number;\n\tgap: number;\n\talign?: \"start\" | \"center\" | \"end\";\n};\n\nexport function getPosition(\n\t$source?: HTMLElement | null,\n\t$popup?: HTMLElement | null,\n\toptions: TRelativeOptions = {}\n): [\n\tx: number,\n\ty: number,\n\tz: {\n\t\tarrowX: number;\n\t\tarrowY: number;\n\t\tarrowPos: string;\n\t}\n] {\n\tconst { refWindow, gap = 0, offset = 0, position = \"top\", align } = options;\n\n\tif (!$source || !$popup)\n\t\treturn [\n\t\t\t0,\n\t\t\t0,\n\t\t\t{\n\t\t\t\tarrowX: 0,\n\t\t\t\tarrowY: 0,\n\t\t\t\tarrowPos: \"bottom\",\n\t\t\t},\n\t\t];\n\n\tconst rectT = $source.getBoundingClientRect();\n\tconst rectC = $popup.getBoundingClientRect();\n\n\tlet w = window.innerWidth;\n\tlet h = window.innerHeight;\n\tlet {\n\t\tleft: tl,\n\t\ttop: tt,\n\t\tright: tr,\n\t\tbottom: tb,\n\t\twidth: tw,\n\t\theight: th,\n\t} = rectT;\n\tconst { height: ch, width: cw } = rectC;\n\n\tif (!refWindow) {\n\t\tconst rectPa = $source.offsetParent?.getBoundingClientRect();\n\n\t\tw = rectPa?.width || w;\n\t\th = rectPa?.height || h;\n\t\ttl = $source.offsetLeft;\n\t\ttt = $source.offsetTop;\n\t\ttr = tl + rectT.width;\n\t\ttb = tt + rectT.height;\n\t}\n\n\tlet y = 0;\n\tlet x = 0;\n\tlet arrowX = 0;\n\tlet arrowY = 0;\n\tlet arrowPos = \"bottom\";\n\n\tswitch (position) {\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\ty =\n\t\t\t\tth !== ch\n\t\t\t\t\t? computePosition({\n\t\t\t\t\t\t\tcontainerSize: h,\n\t\t\t\t\t\t\ttargetSize: th,\n\t\t\t\t\t\t\ttargetOffset: tt,\n\t\t\t\t\t\t\tcontentSize: ch,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t })\n\t\t\t\t\t: tt;\n\t\t\tarrowY = y < tt ? tt - y + th / 2 : th / 2;\n\n\t\t\tconst xl = tl - offset - cw;\n\t\t\tconst xr = tr + offset + cw;\n\n\t\t\tif (position === \"left\") {\n\t\t\t\tconst R = xl < 0 && xr <= w;\n\t\t\t\tx = R ? tr + offset : xl;\n\t\t\t\tarrowX = R ? 0 : cw;\n\t\t\t\tarrowPos = R ? \"left\" : \"right\";\n\t\t\t} else {\n\t\t\t\tconst R = w > xr || xl < 0;\n\t\t\t\tx = R ? tr + offset : xl;\n\t\t\t\tarrowX = R ? 0 : cw;\n\t\t\t\tarrowPos = R ? \"left\" : \"right\";\n\t\t\t}\n\n\t\t\tbreak;\n\t\tcase \"top\":\n\t\tcase \"bottom\":\n\t\t\tx =\n\t\t\t\ttw !== cw\n\t\t\t\t\t? computePosition({\n\t\t\t\t\t\t\tcontainerSize: w,\n\t\t\t\t\t\t\ttargetOffset: tl,\n\t\t\t\t\t\t\ttargetSize: tw,\n\t\t\t\t\t\t\tcontentSize: cw,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t })\n\t\t\t\t\t: tl;\n\t\t\tarrowX = x > tl ? cw / 2 : tl - x + tw / 2;\n\n\t\t\tconst yt = tt - offset - ch;\n\t\t\tconst yb = tb + offset + ch;\n\t\t\tif (position === \"top\") {\n\t\t\t\tconst T = yt < 0 && yb <= h;\n\t\t\t\ty = T ? tb + offset : yt;\n\t\t\t\tarrowY = T ? 0 : ch;\n\t\t\t\tarrowPos = T ? \"top\" : \"bottom\";\n\t\t\t} else {\n\t\t\t\tconst B = h > yb || yt < 0;\n\t\t\t\ty = B ? tb + offset : yt;\n\t\t\t\tarrowY = B ? 0 : ch;\n\t\t\t\tarrowPos = B ? \"top\" : \"bottom\";\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn [\n\t\tx,\n\t\ty,\n\t\t{\n\t\t\tarrowX,\n\t\t\tarrowY,\n\t\t\tarrowPos,\n\t\t},\n\t];\n}\n\nexport function getPointPosition(e: MouseEvent, content: HTMLElement) {\n\tconst { width: w, height: h } = content.getBoundingClientRect();\n\tconst parent = content.offsetParent;\n\tlet pw,\n\t\tph,\n\t\tpl = 0,\n\t\tpt = 0;\n\n\tif (parent) {\n\t\tconst {\n\t\t\twidth: ow,\n\t\t\theight: oh,\n\t\t\tleft: ol,\n\t\t\ttop: ot,\n\t\t} = parent.getBoundingClientRect();\n\t\tconst st = parent.scrollTop ?? 0;\n\n\t\tpw = ow;\n\t\tph = oh;\n\t\tpt = ot - st;\n\t\tpl = ol;\n\t} else {\n\t\tpw = window.innerWidth;\n\t\tph = window.innerHeight;\n\t}\n\tconst x = e.pageX - pl;\n\tconst y = e.pageY - pt;\n\n\tconst left = x + w >= pw ? (x - w > 0 ? x - w : x) : x;\n\tconst top = y + h >= ph ? (y - h > 0 ? y - h : y) : y;\n\n\treturn [left, top];\n}\n\nfunction computePosition({\n\tcontainerSize,\n\ttargetSize,\n\ttargetOffset,\n\tcontentSize,\n\tgap,\n\talign = \"center\",\n}: TComputePosition) {\n\tconst centerPoint = targetOffset + targetSize / 2;\n\n\tswitch (align) {\n\t\tcase \"start\":\n\t\t\treturn targetOffset + contentSize > containerSize\n\t\t\t\t? containerSize - contentSize - gap\n\t\t\t\t: targetOffset;\n\t\tcase \"center\":\n\t\t\tif (targetSize >= contentSize) {\n\t\t\t\treturn centerPoint - contentSize / 2;\n\t\t\t}\n\n\t\t\tif (centerPoint + contentSize / 2 + gap > containerSize) {\n\t\t\t\treturn targetOffset + targetSize - contentSize;\n\t\t\t}\n\n\t\t\tif (centerPoint - contentSize / 2 - gap < 0) {\n\t\t\t\treturn gap;\n\t\t\t}\n\n\t\t\treturn centerPoint - contentSize / 2;\n\t\tcase \"end\":\n\t\t\tconst result = targetOffset + targetSize - contentSize;\n\t\t\treturn result > 0 ? result : gap;\n\t\tdefault:\n\t\t\treturn centerPoint - contentSize / 2;\n\t}\n}\n\nexport function formatOption(options: TOptions): TOption[] {\n\treturn options.map((option) =>\n\t\t[\"string\", \"number\"].includes(typeof option)\n\t\t\t? { label: option, value: option }\n\t\t\t: option\n\t) as TOption[];\n}\n\nexport function animate(\n\tfrom: number,\n\tto: number,\n\tduration: number = 1000,\n\tcallback?: (v: number) => void,\n\teasing: (t: number) => number = (t) => 1 - Math.pow(1 - t, 4)\n) {\n\tconst start = performance.now();\n\tconst diff = to - from;\n\tlet raf = requestAnimationFrame(loop);\n\n\tfunction loop() {\n\t\traf = requestAnimationFrame(loop);\n\n\t\tconst past = performance.now() - start;\n\t\tlet percent = past / duration;\n\n\t\tif (percent >= 1) {\n\t\t\tpercent = 1;\n\t\t\tcancelAnimationFrame(raf);\n\t\t}\n\n\t\tconst pass = diff * easing(percent);\n\t\tcallback?.(pass);\n\t}\n}\n\nexport function formatNumber(\n\tvalue: number,\n\toptions: {\n\t\tprecision?: number;\n\t\tthousand?: string;\n\t} = {}\n) {\n\tconst { precision, thousand } = options;\n\n\tconst result = value.toFixed(precision);\n\n\tif (!thousand) return result;\n\n\tconst points = result.split(\".\");\n\tconst integer = points[0].replace(\n\t\t/\\d{1,3}(?=(\\d{3})+(\\.\\d*)?$)/g,\n\t\t`$&${thousand}`\n\t);\n\n\tif (points.length === 1) return integer;\n\n\treturn `${integer}.${points[1]}`;\n}\n\nexport function renderNode(node: ReactNode, container = document.body) {\n\tconst div: HTMLDivElement | null = document.createElement(\"div\");\n\tcontainer.append(div);\n\n\tconst root: Root | null = createRoot(div);\n\tconst sto = setTimeout(() => {\n\t\troot?.render(node);\n\t}, 0);\n\n\treturn () => {\n\t\tdiv?.remove();\n\t\troot?.unmount();\n\t\tsto && clearTimeout(sto);\n\t};\n}\n\nexport function getSuffixByUrl(url: string) {\n\treturn url.match(/\\.([^\\./\\?]+)($|\\?)/)?.[1];\n}\n\nexport function getFileType(suffix: string, type?: string) {\n\tswitch (true) {\n\t\tcase [\"jpg\", \"jpeg\", \"png\", \"webp\", \"svg\"].includes(suffix) ||\n\t\t\ttype?.startsWith(\"image/\"):\n\t\t\treturn \"IMAGE\";\n\t\tcase [\"mp4\", \"avi\"].includes(suffix) || type?.startsWith(\"video/\"):\n\t\t\treturn \"VIDEO\";\n\t\tdefault:\n\t\t\treturn \"UNKNOWN\";\n\t}\n}\n\nexport function fullScreen(el: HTMLElement) {\n\tel.requestFullscreen?.();\n}\n\nexport function exitFullScreen() {\n\tdocument.exitFullscreen?.();\n}\n\nexport function formatTime(\n\ttime: number,\n\toptions?: {\n\t\tzero?: boolean;\n\t\tunits?: string[];\n\t}\n) {\n\tconst result: string[] = [];\n\tconst { zero = true, units = [\"\", \":\", \":\"] } = options || {};\n\n\tconst l = units.length;\n\tlet i = 0;\n\n\twhile (i < l) {\n\t\tif (time <= 0 && i > 1) break;\n\n\t\tconst n = Math.round(time % 60);\n\n\t\ttime = Math.floor(time / 60);\n\n\t\tresult.unshift((zero && n < 10 ? `0${n}` : n) + units[i++]);\n\t}\n\n\treturn result.join(\"\");\n}\n\nexport function getNextSorter(\n\tprevSortBy: string,\n\tprevSortType: string,\n\tsortBy: string\n): [sortBy: string, sortType: string] {\n\tconst types = [\"desc\", \"asc\"];\n\n\tif (prevSortBy === sortBy) {\n\t\tconst i = types.findIndex((t) => t === prevSortType) + 1;\n\t\tconst type = types[i] || \"\";\n\t\tconst by = type === \"\" ? \"\" : sortBy;\n\n\t\treturn [by, type];\n\t}\n\n\treturn [sortBy, \"desc\"];\n}\n\nexport function formatBytes(bytes: number, decimals = 2) {\n\tif (!+bytes) return \"0 Bytes\";\n\n\tconst k = 1024;\n\tconst dm = decimals < 0 ? 0 : decimals;\n\tconst sizes = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\n\n\tconst i = Math.floor(Math.log(bytes) / Math.log(k));\n\n\treturn `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;\n}\n\nexport function clamp(value: number, min: number, max: number) {\n\treturn value < min ? min : value > max ? max : value;\n}\n\nexport const arrayMove = (array, fromIndex: number, toIndex: number) => {\n\tif (toIndex >= array.length) {\n\t\tlet k = toIndex - array.length + 1;\n\t\twhile (k--) {\n\t\t\tarray.push(undefined);\n\t\t}\n\t}\n\tarray.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);\n\treturn array;\n};\n"],"names":["createRoot"],"mappings":";;;;AAcM,SAAU,WAAW,CAC1B,OAA4B,EAC5B,MAA2B,EAC3B,UAA4B,EAAE,EAAA;AAU9B,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO;AAE3E,IAAA,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;QACtB,OAAO;YACN,CAAC;YACD,CAAC;AACD,YAAA;AACC,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,QAAQ,EAAE,QAAQ;AAClB,aAAA;SACD;AAEF,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE;AAC7C,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAE5C,IAAA,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU;AACzB,IAAA,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW;IAC1B,IAAI,EACH,IAAI,EAAE,EAAE,EACR,GAAG,EAAE,EAAE,EACP,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,GACV,GAAG,KAAK;IACT,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK;IAEvC,IAAI,CAAC,SAAS,E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