@antscorp/antsomi-ui 1.3.3-beta.52 → 1.3.3-beta.53

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 (806) hide show
  1. package/README.md +78 -78
  2. package/dist/0dfb9214dfd945cd7290.png +1 -0
  3. package/dist/3570ecd176167c157ca4.ttf +0 -0
  4. package/dist/574b7bee0563a9fe9a29.png +1 -0
  5. package/dist/6b586356e837581204dc.svg +1 -0
  6. package/dist/8fe5f001e9f235bedfe9.svg +1 -0
  7. package/dist/9df500764bebdef838b4.eot +0 -0
  8. package/dist/bc6bf11c6f5e6743aa4c.png +1 -0
  9. package/dist/e32f09119052a55cce3c.png +1 -0
  10. package/dist/e3851b9384a984c6fdb5.png +1 -0
  11. package/dist/f422f99dc05cb0013092.png +1 -0
  12. package/dist/fc2ea7e45a1b0489b742.woff +0 -0
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.LICENSE.txt +69 -0
  15. package/dist/main.css +168 -0
  16. package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
  17. package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
  18. package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
  19. package/dist/public/icons/97210ba7dc321670f4a144c1b40e88d8.png +0 -0
  20. package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +87 -0
  21. package/dist/public/icons/c856330eba3f0521e9e3a22b88124b81.svg +364 -0
  22. package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
  23. package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
  24. package/dist/public/icons/iphone-top-bar.png +0 -0
  25. package/dist/public/icons/iphone.png +0 -0
  26. package/dist/public/icons/placeholder-image.png +0 -0
  27. package/dist/public/icons/stars_slider.png +0 -0
  28. package/dist/public/icons/transparent.svg +1 -0
  29. package/es/assets/css/main.scss +4 -4
  30. package/es/assets/images/feedback.svg +3 -3
  31. package/es/components/atoms/Alert/Alert.d.ts +4 -4
  32. package/es/components/atoms/Alert/Alert.js +19 -19
  33. package/es/components/atoms/Alert/index.d.ts +1 -1
  34. package/es/components/atoms/Alert/index.js +1 -1
  35. package/es/components/atoms/Button/Button.d.ts +1 -1
  36. package/es/components/atoms/Button/Button.js +1 -1
  37. package/es/components/atoms/Button/index.d.ts +4 -4
  38. package/es/components/atoms/Button/index.js +2 -2
  39. package/es/components/atoms/Button/test.d.ts +3 -3
  40. package/es/components/atoms/Button/test.js +99 -99
  41. package/es/components/atoms/Checkbox/Checkbox.d.ts +1 -1
  42. package/es/components/atoms/Checkbox/Checkbox.js +1 -1
  43. package/es/components/atoms/Checkbox/index.d.ts +1 -1
  44. package/es/components/atoms/Checkbox/index.js +1 -1
  45. package/es/components/atoms/Divider/Divider.d.ts +1 -1
  46. package/es/components/atoms/Divider/Divider.js +1 -1
  47. package/es/components/atoms/Divider/index.d.ts +1 -1
  48. package/es/components/atoms/Divider/index.js +1 -1
  49. package/es/components/atoms/DividerPure/DividerPure.d.ts +10 -10
  50. package/es/components/atoms/DividerPure/DividerPure.js +27 -27
  51. package/es/components/atoms/DividerPure/index.d.ts +1 -1
  52. package/es/components/atoms/DividerPure/index.js +1 -1
  53. package/es/components/atoms/DividerPure/styled.d.ts +1 -1
  54. package/es/components/atoms/DividerPure/styled.js +41 -41
  55. package/es/components/atoms/Empty/Empty.d.ts +6 -6
  56. package/es/components/atoms/Empty/Empty.js +8 -8
  57. package/es/components/atoms/Empty/index.d.ts +1 -1
  58. package/es/components/atoms/Empty/index.js +1 -1
  59. package/es/components/atoms/Flex/Flex.d.ts +2 -2
  60. package/es/components/atoms/Flex/Flex.js +1 -1
  61. package/es/components/atoms/Flex/index.d.ts +1 -1
  62. package/es/components/atoms/Flex/index.js +1 -1
  63. package/es/components/atoms/FloatButton/FloatButton.d.ts +1 -1
  64. package/es/components/atoms/FloatButton/FloatButton.js +1 -1
  65. package/es/components/atoms/FloatButton/index.d.ts +1 -1
  66. package/es/components/atoms/FloatButton/index.js +2 -2
  67. package/es/components/atoms/Grid/Grid.d.ts +3 -3
  68. package/es/components/atoms/Grid/Grid.js +3 -3
  69. package/es/components/atoms/Grid/index.d.ts +1 -1
  70. package/es/components/atoms/Grid/index.js +1 -1
  71. package/es/components/atoms/Icon/index.d.ts +10 -10
  72. package/es/components/atoms/Icon/index.js +36 -36
  73. package/es/components/atoms/Input/Input.d.ts +31 -31
  74. package/es/components/atoms/Input/Input.js +96 -96
  75. package/es/components/atoms/Input/index.d.ts +2 -2
  76. package/es/components/atoms/Input/index.js +1 -1
  77. package/es/components/atoms/Input/styled.d.ts +11 -11
  78. package/es/components/atoms/Input/styled.js +109 -109
  79. package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -2
  80. package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -89
  81. package/es/components/atoms/InputDynamic/InputDynamic.d.ts +30 -30
  82. package/es/components/atoms/InputDynamic/InputDynamic.js +320 -320
  83. package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -16
  84. package/es/components/atoms/InputDynamic/PopupShortLink.js +85 -85
  85. package/es/components/atoms/InputDynamic/index.d.ts +2 -2
  86. package/es/components/atoms/InputDynamic/index.js +1 -1
  87. package/es/components/atoms/InputDynamic/styled.d.ts +12 -12
  88. package/es/components/atoms/InputDynamic/styled.js +281 -281
  89. package/es/components/atoms/InputDynamic/utils.d.ts +22 -22
  90. package/es/components/atoms/InputDynamic/utils.js +751 -751
  91. package/es/components/atoms/InputNumber/InputNumber.d.ts +6 -6
  92. package/es/components/atoms/InputNumber/InputNumber.js +27 -27
  93. package/es/components/atoms/InputNumber/index.d.ts +1 -1
  94. package/es/components/atoms/InputNumber/index.js +1 -1
  95. package/es/components/atoms/Message/Message.d.ts +1 -1
  96. package/es/components/atoms/Message/Message.js +1 -1
  97. package/es/components/atoms/Message/index.d.ts +1 -1
  98. package/es/components/atoms/Message/index.js +1 -1
  99. package/es/components/atoms/MobileFrame/MobileFrame.d.ts +4 -4
  100. package/es/components/atoms/MobileFrame/MobileFrame.js +22 -22
  101. package/es/components/atoms/MobileFrame/constants.d.ts +4 -4
  102. package/es/components/atoms/MobileFrame/constants.js +4 -4
  103. package/es/components/atoms/MobileFrame/index.d.ts +2 -2
  104. package/es/components/atoms/MobileFrame/index.js +1 -1
  105. package/es/components/atoms/MobileFrame/styled.d.ts +3 -3
  106. package/es/components/atoms/MobileFrame/styled.js +33 -33
  107. package/es/components/atoms/Notification/Notification.d.ts +1 -1
  108. package/es/components/atoms/Notification/Notification.js +1 -1
  109. package/es/components/atoms/Notification/index.d.ts +1 -1
  110. package/es/components/atoms/Notification/index.js +1 -1
  111. package/es/components/atoms/Pagination/Pagination.d.ts +2 -2
  112. package/es/components/atoms/Pagination/Pagination.js +2 -2
  113. package/es/components/atoms/Pagination/index.d.ts +2 -2
  114. package/es/components/atoms/Pagination/index.js +1 -1
  115. package/es/components/atoms/Popover/Popover.d.ts +4 -4
  116. package/es/components/atoms/Popover/Popover.js +2 -2
  117. package/es/components/atoms/Popover/index.d.ts +1 -1
  118. package/es/components/atoms/Popover/index.js +1 -1
  119. package/es/components/atoms/Popover/styled.d.ts +4 -4
  120. package/es/components/atoms/Popover/styled.js +5 -5
  121. package/es/components/atoms/PreviewTabs/PreviewTabs.d.ts +7 -7
  122. package/es/components/atoms/PreviewTabs/PreviewTabs.js +67 -67
  123. package/es/components/atoms/PreviewTabs/index.d.ts +2 -2
  124. package/es/components/atoms/PreviewTabs/index.js +1 -1
  125. package/es/components/atoms/PreviewTabs/styled.d.ts +6 -6
  126. package/es/components/atoms/PreviewTabs/styled.js +79 -79
  127. package/es/components/atoms/Progress/Progress.d.ts +2 -2
  128. package/es/components/atoms/Progress/Progress.js +2 -2
  129. package/es/components/atoms/Progress/index.d.ts +1 -1
  130. package/es/components/atoms/Progress/index.js +1 -1
  131. package/es/components/atoms/Radio/Radio.d.ts +1 -1
  132. package/es/components/atoms/Radio/Radio.js +1 -1
  133. package/es/components/atoms/Radio/index.d.ts +7 -7
  134. package/es/components/atoms/Radio/index.js +25 -25
  135. package/es/components/atoms/Rate/Rate.d.ts +2 -2
  136. package/es/components/atoms/Rate/Rate.js +2 -2
  137. package/es/components/atoms/Rate/index.d.ts +1 -1
  138. package/es/components/atoms/Rate/index.js +1 -1
  139. package/es/components/atoms/RateV2/RateV2.d.ts +18 -18
  140. package/es/components/atoms/RateV2/RateV2.js +73 -73
  141. package/es/components/atoms/RateV2/index.d.ts +1 -1
  142. package/es/components/atoms/RateV2/index.js +1 -1
  143. package/es/components/atoms/RequiredLabel/index.d.ts +8 -8
  144. package/es/components/atoms/RequiredLabel/index.js +25 -25
  145. package/es/components/atoms/RequiredLabel/styled.d.ts +2 -2
  146. package/es/components/atoms/RequiredLabel/styled.js +10 -10
  147. package/es/components/atoms/ScrollBox/index.d.ts +9 -9
  148. package/es/components/atoms/ScrollBox/index.js +51 -51
  149. package/es/components/atoms/Segmented/Segmented.d.ts +2 -2
  150. package/es/components/atoms/Segmented/Segmented.js +2 -2
  151. package/es/components/atoms/Segmented/index.d.ts +1 -1
  152. package/es/components/atoms/Segmented/index.js +1 -1
  153. package/es/components/atoms/Skeleton/Skeleton.d.ts +8 -8
  154. package/es/components/atoms/Skeleton/Skeleton.js +2 -2
  155. package/es/components/atoms/Skeleton/index.d.ts +1 -1
  156. package/es/components/atoms/Skeleton/index.js +1 -1
  157. package/es/components/atoms/Slider/index.d.ts +6 -6
  158. package/es/components/atoms/Slider/index.js +25 -25
  159. package/es/components/atoms/Slider/styled.d.ts +7 -7
  160. package/es/components/atoms/Slider/styled.js +44 -44
  161. package/es/components/atoms/SliderV2/index.d.ts +6 -6
  162. package/es/components/atoms/SliderV2/index.js +21 -21
  163. package/es/components/atoms/Space/Space.d.ts +6 -6
  164. package/es/components/atoms/Space/Space.js +9 -9
  165. package/es/components/atoms/Space/index.d.ts +1 -1
  166. package/es/components/atoms/Space/index.js +1 -1
  167. package/es/components/atoms/Spin/Spin.d.ts +10 -10
  168. package/es/components/atoms/Spin/Spin.js +28 -28
  169. package/es/components/atoms/Spin/index.d.ts +1 -1
  170. package/es/components/atoms/Spin/index.js +1 -1
  171. package/es/components/atoms/Spin/styled.d.ts +1 -1
  172. package/es/components/atoms/Spin/styled.js +7 -7
  173. package/es/components/atoms/Statistic/Statistic.d.ts +1 -1
  174. package/es/components/atoms/Statistic/Statistic.js +2 -2
  175. package/es/components/atoms/Statistic/index.d.ts +1 -1
  176. package/es/components/atoms/Statistic/index.js +1 -1
  177. package/es/components/atoms/Steps/Steps.d.ts +4 -4
  178. package/es/components/atoms/Steps/Steps.js +2 -2
  179. package/es/components/atoms/Steps/index.d.ts +1 -1
  180. package/es/components/atoms/Steps/index.js +1 -1
  181. package/es/components/atoms/Switch/Switch.d.ts +2 -2
  182. package/es/components/atoms/Switch/Switch.js +2 -2
  183. package/es/components/atoms/Switch/index.d.ts +1 -1
  184. package/es/components/atoms/Switch/index.js +1 -1
  185. package/es/components/atoms/Tag/Tag.d.ts +1 -1
  186. package/es/components/atoms/Tag/Tag.js +1 -1
  187. package/es/components/atoms/Tag/index.d.ts +1 -1
  188. package/es/components/atoms/Tag/index.js +1 -1
  189. package/es/components/atoms/Text/index.d.ts +10 -10
  190. package/es/components/atoms/Text/index.js +27 -27
  191. package/es/components/atoms/Text/styled.d.ts +7 -7
  192. package/es/components/atoms/Text/styled.js +52 -52
  193. package/es/components/atoms/Timeline/Timeline.d.ts +4 -4
  194. package/es/components/atoms/Timeline/Timeline.js +2 -2
  195. package/es/components/atoms/Timeline/index.d.ts +1 -1
  196. package/es/components/atoms/Timeline/index.js +1 -1
  197. package/es/components/atoms/Tooltip/Tooltip.d.ts +1 -1
  198. package/es/components/atoms/Tooltip/Tooltip.js +1 -1
  199. package/es/components/atoms/Tooltip/index.d.ts +1 -1
  200. package/es/components/atoms/Tooltip/index.js +1 -1
  201. package/es/components/atoms/Typography/Text.d.ts +1 -1
  202. package/es/components/atoms/Typography/Text.js +1 -1
  203. package/es/components/atoms/Typography/index.d.ts +1 -1
  204. package/es/components/atoms/Typography/index.js +1 -1
  205. package/es/components/atoms/Watermark/Watermark.d.ts +2 -2
  206. package/es/components/atoms/Watermark/Watermark.js +2 -2
  207. package/es/components/atoms/Watermark/index.d.ts +1 -1
  208. package/es/components/atoms/Watermark/index.js +1 -1
  209. package/es/components/atoms/index.d.ts +41 -41
  210. package/es/components/atoms/index.js +38 -38
  211. package/es/components/common/ConfigProvider/ConfigProvider.d.ts +10 -10
  212. package/es/components/common/ConfigProvider/ConfigProvider.js +42 -42
  213. package/es/components/common/ConfigProvider/GlobalStyle.d.ts +5 -5
  214. package/es/components/common/ConfigProvider/GlobalStyle.js +734 -734
  215. package/es/components/common/ConfigProvider/index.d.ts +1 -1
  216. package/es/components/common/ConfigProvider/index.js +1 -1
  217. package/es/components/common/index.d.ts +1 -1
  218. package/es/components/common/index.js +1 -1
  219. package/es/components/icons/AccountCircle.d.ts +3 -3
  220. package/es/components/icons/AccountCircle.js +3 -3
  221. package/es/components/icons/AddShoppingCart.d.ts +3 -3
  222. package/es/components/icons/AddShoppingCart.js +3 -3
  223. package/es/components/icons/ArrowGrowIcon.d.ts +2 -2
  224. package/es/components/icons/ArrowGrowIcon.js +4 -4
  225. package/es/components/icons/AssignmentInd.d.ts +3 -3
  226. package/es/components/icons/AssignmentInd.js +3 -3
  227. package/es/components/icons/AudioRecordIcon.d.ts +2 -2
  228. package/es/components/icons/AudioRecordIcon.js +4 -4
  229. package/es/components/icons/BugIcon.d.ts +2 -2
  230. package/es/components/icons/BugIcon.js +4 -4
  231. package/es/components/icons/Call.d.ts +3 -3
  232. package/es/components/icons/Call.js +3 -3
  233. package/es/components/icons/CameraIcon.d.ts +2 -2
  234. package/es/components/icons/CameraIcon.js +4 -4
  235. package/es/components/icons/CaptureIcon.d.ts +2 -2
  236. package/es/components/icons/CaptureIcon.js +4 -4
  237. package/es/components/icons/Category.d.ts +3 -3
  238. package/es/components/icons/Category.js +5 -5
  239. package/es/components/icons/ChatBubbleOutline.d.ts +3 -3
  240. package/es/components/icons/ChatBubbleOutline.js +3 -3
  241. package/es/components/icons/CheckSlimIcon.d.ts +2 -2
  242. package/es/components/icons/CheckSlimIcon.js +4 -4
  243. package/es/components/icons/CircleNotifications.d.ts +3 -3
  244. package/es/components/icons/CircleNotifications.js +3 -3
  245. package/es/components/icons/CloseIcon.d.ts +4 -4
  246. package/es/components/icons/CloseIcon.js +22 -22
  247. package/es/components/icons/CommentIcon.d.ts +2 -2
  248. package/es/components/icons/CommentIcon.js +4 -4
  249. package/es/components/icons/ConfirmationNumber.d.ts +3 -3
  250. package/es/components/icons/ConfirmationNumber.js +3 -3
  251. package/es/components/icons/DesktopWindows.d.ts +3 -3
  252. package/es/components/icons/DesktopWindows.js +3 -3
  253. package/es/components/icons/EventIcon.d.ts +4 -4
  254. package/es/components/icons/EventIcon.js +18 -18
  255. package/es/components/icons/FactCheck.d.ts +3 -3
  256. package/es/components/icons/FactCheck.js +3 -3
  257. package/es/components/icons/FreeDrawIcon.d.ts +2 -2
  258. package/es/components/icons/FreeDrawIcon.js +4 -4
  259. package/es/components/icons/GPTIcon.d.ts +2 -2
  260. package/es/components/icons/GPTIcon.js +18 -18
  261. package/es/components/icons/GPTIconV2.d.ts +2 -2
  262. package/es/components/icons/GPTIconV2.js +18 -18
  263. package/es/components/icons/GPTIconV3.d.ts +2 -2
  264. package/es/components/icons/GPTIconV3.js +5 -5
  265. package/es/components/icons/HighlightIcon.d.ts +2 -2
  266. package/es/components/icons/HighlightIcon.js +4 -4
  267. package/es/components/icons/HightlightAlt.d.ts +3 -3
  268. package/es/components/icons/HightlightAlt.js +3 -3
  269. package/es/components/icons/HowToReg.d.ts +3 -3
  270. package/es/components/icons/HowToReg.js +3 -3
  271. package/es/components/icons/IdeaIcon.d.ts +2 -2
  272. package/es/components/icons/IdeaIcon.js +4 -4
  273. package/es/components/icons/Interactive.d.ts +3 -3
  274. package/es/components/icons/Interactive.js +3 -3
  275. package/es/components/icons/InvisibleIcon.d.ts +2 -2
  276. package/es/components/icons/InvisibleIcon.js +5 -5
  277. package/es/components/icons/List.d.ts +3 -3
  278. package/es/components/icons/List.js +3 -3
  279. package/es/components/icons/LocalMallIcon.d.ts +3 -3
  280. package/es/components/icons/LocalMallIcon.js +3 -3
  281. package/es/components/icons/MobileFriendly.d.ts +3 -3
  282. package/es/components/icons/MobileFriendly.js +3 -3
  283. package/es/components/icons/MuteIcon.d.ts +2 -2
  284. package/es/components/icons/MuteIcon.js +4 -4
  285. package/es/components/icons/NotificationsActive.d.ts +3 -3
  286. package/es/components/icons/NotificationsActive.js +3 -3
  287. package/es/components/icons/OpenUrlIcon.d.ts +2 -2
  288. package/es/components/icons/OpenUrlIcon.js +4 -4
  289. package/es/components/icons/PauseIcon.d.ts +2 -2
  290. package/es/components/icons/PauseIcon.js +4 -4
  291. package/es/components/icons/Payment.d.ts +3 -3
  292. package/es/components/icons/Payment.js +3 -3
  293. package/es/components/icons/PersonAddDisabled.d.ts +3 -3
  294. package/es/components/icons/PersonAddDisabled.js +4 -4
  295. package/es/components/icons/PhoneCallback.d.ts +3 -3
  296. package/es/components/icons/PhoneCallback.js +3 -3
  297. package/es/components/icons/PlaneIcon.d.ts +2 -2
  298. package/es/components/icons/PlaneIcon.js +8 -8
  299. package/es/components/icons/Preview.d.ts +3 -3
  300. package/es/components/icons/Preview.js +3 -3
  301. package/es/components/icons/Redeem.d.ts +3 -3
  302. package/es/components/icons/Redeem.js +3 -3
  303. package/es/components/icons/RemoveRedEye.d.ts +3 -3
  304. package/es/components/icons/RemoveRedEye.js +3 -3
  305. package/es/components/icons/RemoveShoppingCart.d.ts +3 -3
  306. package/es/components/icons/RemoveShoppingCart.js +3 -3
  307. package/es/components/icons/RequestIcon.d.ts +2 -2
  308. package/es/components/icons/RequestIcon.js +4 -4
  309. package/es/components/icons/Search.d.ts +3 -3
  310. package/es/components/icons/Search.js +3 -3
  311. package/es/components/icons/ShoppingBag.d.ts +3 -3
  312. package/es/components/icons/ShoppingBag.js +3 -3
  313. package/es/components/icons/ShoppingCart.d.ts +3 -3
  314. package/es/components/icons/ShoppingCart.js +3 -3
  315. package/es/components/icons/StopRecordIcon.d.ts +2 -2
  316. package/es/components/icons/StopRecordIcon.js +4 -4
  317. package/es/components/icons/Store.d.ts +3 -3
  318. package/es/components/icons/Store.js +3 -3
  319. package/es/components/icons/UserIcon.d.ts +2 -2
  320. package/es/components/icons/UserIcon.js +8 -8
  321. package/es/components/icons/VerticalDotsIcon.d.ts +2 -2
  322. package/es/components/icons/VerticalDotsIcon.js +4 -4
  323. package/es/components/icons/WarningIcon.d.ts +2 -2
  324. package/es/components/icons/WarningIcon.js +4 -4
  325. package/es/components/icons/Web.d.ts +3 -3
  326. package/es/components/icons/Web.js +3 -3
  327. package/es/components/icons/WebAsset.d.ts +3 -3
  328. package/es/components/icons/WebAsset.js +3 -3
  329. package/es/components/icons/index.d.ts +54 -54
  330. package/es/components/icons/index.js +54 -54
  331. package/es/components/icons/type.d.ts +3 -3
  332. package/es/components/icons/type.js +1 -1
  333. package/es/components/index.d.ts +4 -4
  334. package/es/components/index.js +4 -4
  335. package/es/components/molecules/AlignSetting/index.d.ts +19 -19
  336. package/es/components/molecules/AlignSetting/index.js +52 -52
  337. package/es/components/molecules/AlignSetting/styled.d.ts +1 -1
  338. package/es/components/molecules/AlignSetting/styled.js +7 -7
  339. package/es/components/molecules/AlignSetting/utils.d.ts +3 -3
  340. package/es/components/molecules/AlignSetting/utils.js +19 -19
  341. package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +16 -16
  342. package/es/components/molecules/CaptureScreen/CaptureScreen.js +834 -834
  343. package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +17 -17
  344. package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.js +80 -80
  345. package/es/components/molecules/CaptureScreen/components/CommentBox/index.d.ts +1 -1
  346. package/es/components/molecules/CaptureScreen/components/CommentBox/index.js +1 -1
  347. package/es/components/molecules/CaptureScreen/components/CommentBox/styled.d.ts +12 -12
  348. package/es/components/molecules/CaptureScreen/components/CommentBox/styled.js +136 -136
  349. package/es/components/molecules/CaptureScreen/components/CommentBox/types.d.ts +15 -15
  350. package/es/components/molecules/CaptureScreen/components/CommentBox/types.js +1 -1
  351. package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +4 -4
  352. package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.js +17 -17
  353. package/es/components/molecules/CaptureScreen/components/Cursor/index.d.ts +1 -1
  354. package/es/components/molecules/CaptureScreen/components/Cursor/index.js +1 -1
  355. package/es/components/molecules/CaptureScreen/components/Cursor/styled.d.ts +7 -7
  356. package/es/components/molecules/CaptureScreen/components/Cursor/styled.js +79 -79
  357. package/es/components/molecules/CaptureScreen/components/Cursor/types.d.ts +10 -10
  358. package/es/components/molecules/CaptureScreen/components/Cursor/types.js +1 -1
  359. package/es/components/molecules/CaptureScreen/constants.d.ts +41 -41
  360. package/es/components/molecules/CaptureScreen/constants.js +118 -118
  361. package/es/components/molecules/CaptureScreen/hooks/useImageEditor.d.ts +5 -5
  362. package/es/components/molecules/CaptureScreen/hooks/useImageEditor.js +103 -103
  363. package/es/components/molecules/CaptureScreen/index.d.ts +1 -1
  364. package/es/components/molecules/CaptureScreen/index.js +1 -1
  365. package/es/components/molecules/CaptureScreen/styled.d.ts +26 -26
  366. package/es/components/molecules/CaptureScreen/styled.js +255 -255
  367. package/es/components/molecules/CaptureScreen/themes/black.d.ts +54 -54
  368. package/es/components/molecules/CaptureScreen/themes/black.js +64 -64
  369. package/es/components/molecules/CaptureScreen/themes/white.d.ts +54 -54
  370. package/es/components/molecules/CaptureScreen/themes/white.js +64 -64
  371. package/es/components/molecules/CaptureScreen/types.d.ts +108 -108
  372. package/es/components/molecules/CaptureScreen/types.js +1 -1
  373. package/es/components/molecules/CaptureScreen/utils.d.ts +13 -13
  374. package/es/components/molecules/CaptureScreen/utils.js +62 -62
  375. package/es/components/molecules/Card/Card.d.ts +1 -1
  376. package/es/components/molecules/Card/Card.js +2 -2
  377. package/es/components/molecules/Card/index.d.ts +1 -1
  378. package/es/components/molecules/Card/index.js +1 -1
  379. package/es/components/molecules/Cascader/Cascader.d.ts +1 -1
  380. package/es/components/molecules/Cascader/Cascader.js +1 -1
  381. package/es/components/molecules/Cascader/index.d.ts +1 -1
  382. package/es/components/molecules/Cascader/index.js +1 -1
  383. package/es/components/molecules/ChatBox/ChatBox.d.ts +3 -3
  384. package/es/components/molecules/ChatBox/ChatBox.js +188 -188
  385. package/es/components/molecules/ChatBox/MessageItem.d.ts +5 -5
  386. package/es/components/molecules/ChatBox/MessageItem.js +66 -66
  387. package/es/components/molecules/ChatBox/constants.d.ts +6 -6
  388. package/es/components/molecules/ChatBox/constants.js +51 -51
  389. package/es/components/molecules/ChatBox/index.d.ts +1 -1
  390. package/es/components/molecules/ChatBox/index.js +1 -1
  391. package/es/components/molecules/ChatBox/styled.d.ts +10 -10
  392. package/es/components/molecules/ChatBox/styled.js +280 -280
  393. package/es/components/molecules/ChatBox/types.d.ts +32 -32
  394. package/es/components/molecules/ChatBox/types.js +1 -1
  395. package/es/components/molecules/Collapse/Collapse.d.ts +4 -4
  396. package/es/components/molecules/Collapse/Collapse.js +11 -11
  397. package/es/components/molecules/Collapse/index.d.ts +1 -1
  398. package/es/components/molecules/Collapse/index.js +1 -1
  399. package/es/components/molecules/ColorPicker/ChromePicker/index.d.ts +1 -1
  400. package/es/components/molecules/ColorPicker/ChromePicker/index.js +3 -3
  401. package/es/components/molecules/ColorPicker/ChromePicker/styled.d.ts +1 -1
  402. package/es/components/molecules/ColorPicker/ChromePicker/styled.js +15 -15
  403. package/es/components/molecules/ColorPicker/CustomPicker/index.d.ts +2 -2
  404. package/es/components/molecules/ColorPicker/CustomPicker/index.js +117 -117
  405. package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +9 -9
  406. package/es/components/molecules/ColorPicker/CustomPicker/styled.js +104 -104
  407. package/es/components/molecules/ColorPicker/SketchPicker/index.d.ts +10 -10
  408. package/es/components/molecules/ColorPicker/SketchPicker/index.js +5 -5
  409. package/es/components/molecules/ColorPicker/SketchPicker/styled.d.ts +1 -1
  410. package/es/components/molecules/ColorPicker/SketchPicker/styled.js +10 -10
  411. package/es/components/molecules/ColorPicker/index.d.ts +13 -13
  412. package/es/components/molecules/ColorPicker/index.js +95 -95
  413. package/es/components/molecules/ColorPicker/styled.d.ts +1 -1
  414. package/es/components/molecules/ColorPicker/styled.js +10 -10
  415. package/es/components/molecules/ColorSetting/index.d.ts +14 -14
  416. package/es/components/molecules/ColorSetting/index.js +97 -97
  417. package/es/components/molecules/ColorSetting/styled.d.ts +7 -7
  418. package/es/components/molecules/ColorSetting/styled.js +42 -42
  419. package/es/components/molecules/DatePicker/DatePicker.d.ts +8 -8
  420. package/es/components/molecules/DatePicker/DatePicker.js +8 -8
  421. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +28 -28
  422. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +575 -575
  423. package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +94 -94
  424. package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.js +183 -183
  425. package/es/components/molecules/DatePicker/components/AdvancedPicker/index.d.ts +3 -3
  426. package/es/components/molecules/DatePicker/components/AdvancedPicker/index.js +1 -1
  427. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +7 -7
  428. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +93 -93
  429. package/es/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +36 -36
  430. package/es/components/molecules/DatePicker/components/AdvancedPicker/types.js +1 -1
  431. package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +35 -35
  432. package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +173 -173
  433. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +15 -15
  434. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +70 -70
  435. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +4 -4
  436. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.js +4 -4
  437. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/index.d.ts +2 -2
  438. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/index.js +1 -1
  439. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +17 -17
  440. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/types.js +1 -1
  441. package/es/components/molecules/DatePicker/index.d.ts +3 -3
  442. package/es/components/molecules/DatePicker/index.js +1 -1
  443. package/es/components/molecules/Drawer/Drawer.d.ts +5 -5
  444. package/es/components/molecules/Drawer/Drawer.js +4 -4
  445. package/es/components/molecules/Drawer/index.d.ts +2 -2
  446. package/es/components/molecules/Drawer/index.js +1 -1
  447. package/es/components/molecules/Dropdown/Dropdown.d.ts +1 -1
  448. package/es/components/molecules/Dropdown/Dropdown.js +1 -1
  449. package/es/components/molecules/Dropdown/index.d.ts +1 -1
  450. package/es/components/molecules/Dropdown/index.js +1 -1
  451. package/es/components/molecules/EdgeSetting/index.d.ts +39 -39
  452. package/es/components/molecules/EdgeSetting/index.js +192 -192
  453. package/es/components/molecules/EdgeSetting/styled.d.ts +3 -3
  454. package/es/components/molecules/EdgeSetting/styled.js +18 -18
  455. package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -307
  456. package/es/components/molecules/FontFamilySelect/constants.js +257 -257
  457. package/es/components/molecules/FontFamilySelect/index.d.ts +17 -17
  458. package/es/components/molecules/FontFamilySelect/index.js +53 -53
  459. package/es/components/molecules/FontSetting/constants.d.ts +3 -3
  460. package/es/components/molecules/FontSetting/constants.js +22 -22
  461. package/es/components/molecules/FontSetting/index.d.ts +24 -24
  462. package/es/components/molecules/FontSetting/index.js +54 -54
  463. package/es/components/molecules/FontSetting/types.d.ts +22 -22
  464. package/es/components/molecules/FontSetting/types.js +1 -1
  465. package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -28
  466. package/es/components/molecules/FontWeightSelect/constants.js +11 -11
  467. package/es/components/molecules/FontWeightSelect/index.d.ts +9 -9
  468. package/es/components/molecules/FontWeightSelect/index.js +39 -39
  469. package/es/components/molecules/Form/Form.d.ts +1 -1
  470. package/es/components/molecules/Form/Form.js +1 -1
  471. package/es/components/molecules/Form/index.d.ts +1 -1
  472. package/es/components/molecules/Form/index.js +1 -1
  473. package/es/components/molecules/GradientSetting/index.d.ts +36 -36
  474. package/es/components/molecules/GradientSetting/index.js +99 -99
  475. package/es/components/molecules/GradientSetting/styled.d.ts +1 -1
  476. package/es/components/molecules/GradientSetting/styled.js +59 -59
  477. package/es/components/molecules/IconSelection/components/Icon/index.d.ts +10 -10
  478. package/es/components/molecules/IconSelection/components/Icon/index.js +28 -28
  479. package/es/components/molecules/IconSelection/constants.d.ts +56 -56
  480. package/es/components/molecules/IconSelection/constants.js +89 -89
  481. package/es/components/molecules/IconSelection/index.d.ts +3 -3
  482. package/es/components/molecules/IconSelection/index.js +143 -143
  483. package/es/components/molecules/IconSelection/styled.d.ts +8 -8
  484. package/es/components/molecules/IconSelection/styled.js +80 -80
  485. package/es/components/molecules/IconSelection/types.d.ts +26 -26
  486. package/es/components/molecules/IconSelection/types.js +2 -2
  487. package/es/components/molecules/IconSelection/utils.d.ts +4 -4
  488. package/es/components/molecules/IconSelection/utils.js +13 -13
  489. package/es/components/molecules/InputNumber/index.d.ts +9 -9
  490. package/es/components/molecules/InputNumber/index.js +81 -81
  491. package/es/components/molecules/InputNumberWithUnit/index.d.ts +31 -31
  492. package/es/components/molecules/InputNumberWithUnit/index.js +37 -37
  493. package/es/components/molecules/InputNumberWithUnit/styled.d.ts +1 -1
  494. package/es/components/molecules/InputNumberWithUnit/styled.js +20 -20
  495. package/es/components/molecules/InputSearch/index.d.ts +7 -7
  496. package/es/components/molecules/InputSearch/index.js +23 -23
  497. package/es/components/molecules/InputSearch/styled.d.ts +1 -1
  498. package/es/components/molecules/InputSearch/styled.js +48 -48
  499. package/es/components/molecules/Modal/Modal.d.ts +23 -23
  500. package/es/components/molecules/Modal/Modal.js +26 -26
  501. package/es/components/molecules/Modal/index.d.ts +2 -2
  502. package/es/components/molecules/Modal/index.js +1 -1
  503. package/es/components/molecules/Modal/styled.d.ts +15 -15
  504. package/es/components/molecules/Modal/styled.js +78 -78
  505. package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -5
  506. package/es/components/molecules/ModalV2/ModalV2.js +26 -26
  507. package/es/components/molecules/ModalV2/index.d.ts +2 -2
  508. package/es/components/molecules/ModalV2/index.js +1 -1
  509. package/es/components/molecules/ModalV2/styled.d.ts +7 -7
  510. package/es/components/molecules/ModalV2/styled.js +22 -22
  511. package/es/components/molecules/Popconfirm/Popconfirm.d.ts +4 -4
  512. package/es/components/molecules/Popconfirm/Popconfirm.js +2 -2
  513. package/es/components/molecules/Popconfirm/index.d.ts +1 -1
  514. package/es/components/molecules/Popconfirm/index.js +1 -1
  515. package/es/components/molecules/PopupDraggable/PopupDraggable.d.ts +6 -6
  516. package/es/components/molecules/PopupDraggable/PopupDraggable.js +52 -52
  517. package/es/components/molecules/PopupDraggable/index.d.ts +1 -1
  518. package/es/components/molecules/PopupDraggable/index.js +1 -1
  519. package/es/components/molecules/PopupDraggable/styled.d.ts +5 -5
  520. package/es/components/molecules/PopupDraggable/styled.js +52 -52
  521. package/es/components/molecules/PopupDraggable/types.d.ts +15 -15
  522. package/es/components/molecules/PopupDraggable/types.js +1 -1
  523. package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -7
  524. package/es/components/molecules/PreviewModal/PreviewModal.js +30 -30
  525. package/es/components/molecules/PreviewModal/index.d.ts +2 -2
  526. package/es/components/molecules/PreviewModal/index.js +1 -1
  527. package/es/components/molecules/PreviewModal/styled.d.ts +4 -4
  528. package/es/components/molecules/PreviewModal/styled.js +39 -39
  529. package/es/components/molecules/RadioGroup/index.d.ts +7 -7
  530. package/es/components/molecules/RadioGroup/index.js +23 -23
  531. package/es/components/molecules/RadioGroup/styled.d.ts +3 -3
  532. package/es/components/molecules/RadioGroup/styled.js +14 -14
  533. package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -3
  534. package/es/components/molecules/ResizeGrid/ResizeGrid.js +755 -727
  535. package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -3
  536. package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +87 -87
  537. package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -1
  538. package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -1
  539. package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -3
  540. package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -80
  541. package/es/components/molecules/ResizeGrid/constant.d.ts +35 -35
  542. package/es/components/molecules/ResizeGrid/constant.js +111 -111
  543. package/es/components/molecules/ResizeGrid/index.d.ts +2 -2
  544. package/es/components/molecules/ResizeGrid/index.js +1 -1
  545. package/es/components/molecules/ResizeGrid/styled.d.ts +10 -10
  546. package/es/components/molecules/ResizeGrid/styled.js +56 -56
  547. package/es/components/molecules/ResizeGrid/types.d.ts +147 -147
  548. package/es/components/molecules/ResizeGrid/types.js +1 -1
  549. package/es/components/molecules/Result/Result.d.ts +1 -1
  550. package/es/components/molecules/Result/Result.js +2 -2
  551. package/es/components/molecules/Result/index.d.ts +1 -1
  552. package/es/components/molecules/Result/index.js +1 -1
  553. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +9 -9
  554. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +53 -53
  555. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.d.ts +11 -11
  556. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.js +47 -47
  557. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.d.ts +9 -9
  558. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +52 -52
  559. package/es/components/molecules/RichMenu/RichMenuBlock/constants.d.ts +2 -2
  560. package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +765 -765
  561. package/es/components/molecules/RichMenu/RichMenuBlock/index.d.ts +3 -3
  562. package/es/components/molecules/RichMenu/RichMenuBlock/index.js +2 -2
  563. package/es/components/molecules/RichMenu/RichMenuBlock/styled.d.ts +9 -9
  564. package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +17 -17
  565. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +10 -10
  566. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +32 -32
  567. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.d.ts +6 -6
  568. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.js +15 -15
  569. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.d.ts +4 -4
  570. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +47 -47
  571. package/es/components/molecules/RichMenu/RichMenuChatBar/index.d.ts +2 -2
  572. package/es/components/molecules/RichMenu/RichMenuChatBar/index.js +1 -1
  573. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +9 -9
  574. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +37 -37
  575. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +10 -10
  576. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +37 -37
  577. package/es/components/molecules/RichMenu/RichMenuMobileView/index.d.ts +1 -1
  578. package/es/components/molecules/RichMenu/RichMenuMobileView/index.js +1 -1
  579. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +6 -6
  580. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +20 -20
  581. package/es/components/molecules/RichMenu/index.d.ts +3 -3
  582. package/es/components/molecules/RichMenu/index.js +3 -3
  583. package/es/components/molecules/Select/Select.d.ts +19 -19
  584. package/es/components/molecules/Select/Select.js +50 -50
  585. package/es/components/molecules/Select/Test.d.ts +3 -3
  586. package/es/components/molecules/Select/Test.js +22 -22
  587. package/es/components/molecules/Select/index.d.ts +2 -2
  588. package/es/components/molecules/Select/index.js +1 -1
  589. package/es/components/molecules/Select/styled.d.ts +4 -4
  590. package/es/components/molecules/Select/styled.js +41 -41
  591. package/es/components/molecules/SettingWrapper/index.d.ts +12 -12
  592. package/es/components/molecules/SettingWrapper/index.js +20 -20
  593. package/es/components/molecules/SettingWrapper/styled.d.ts +5 -5
  594. package/es/components/molecules/SettingWrapper/styled.js +17 -17
  595. package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -16
  596. package/es/components/molecules/SettingWrapperPopover/index.js +17 -17
  597. package/es/components/molecules/ShareAccess/ShareAccess.d.ts +3 -3
  598. package/es/components/molecules/ShareAccess/ShareAccess.js +23 -23
  599. package/es/components/molecules/ShareAccess/actions.d.ts +16 -16
  600. package/es/components/molecules/ShareAccess/actions.js +12 -12
  601. package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.d.ts +2 -2
  602. package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.js +70 -70
  603. package/es/components/molecules/ShareAccess/components/GeneralAccess/index.d.ts +1 -1
  604. package/es/components/molecules/ShareAccess/components/GeneralAccess/index.js +1 -1
  605. package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.d.ts +1 -1
  606. package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +57 -57
  607. package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.d.ts +3 -3
  608. package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +14 -14
  609. package/es/components/molecules/ShareAccess/components/LayoutContent/index.d.ts +1 -1
  610. package/es/components/molecules/ShareAccess/components/LayoutContent/index.js +1 -1
  611. package/es/components/molecules/ShareAccess/components/LayoutContent/styled.d.ts +1 -1
  612. package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +7 -7
  613. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.d.ts +2 -2
  614. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.js +43 -43
  615. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/index.js +1 -1
  616. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.d.ts +7 -7
  617. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.js +18 -18
  618. package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.d.ts +5 -5
  619. package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +92 -92
  620. package/es/components/molecules/ShareAccess/components/PeopleAccess/index.d.ts +1 -1
  621. package/es/components/molecules/ShareAccess/components/PeopleAccess/index.js +1 -1
  622. package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.d.ts +1 -1
  623. package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +46 -46
  624. package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.d.ts +5 -5
  625. package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.js +73 -73
  626. package/es/components/molecules/ShareAccess/components/SearchUser/index.d.ts +1 -1
  627. package/es/components/molecules/ShareAccess/components/SearchUser/index.js +1 -1
  628. package/es/components/molecules/ShareAccess/components/SearchUser/styled.d.ts +2 -2
  629. package/es/components/molecules/ShareAccess/components/SearchUser/styled.js +29 -29
  630. package/es/components/molecules/ShareAccess/components/index.d.ts +1 -1
  631. package/es/components/molecules/ShareAccess/components/index.js +1 -1
  632. package/es/components/molecules/ShareAccess/constants.d.ts +61 -61
  633. package/es/components/molecules/ShareAccess/constants.js +79 -79
  634. package/es/components/molecules/ShareAccess/context.d.ts +4 -4
  635. package/es/components/molecules/ShareAccess/context.js +3 -3
  636. package/es/components/molecules/ShareAccess/hooks/index.d.ts +1 -1
  637. package/es/components/molecules/ShareAccess/hooks/index.js +1 -1
  638. package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +15 -15
  639. package/es/components/molecules/ShareAccess/hooks/useShareAccess.js +15 -15
  640. package/es/components/molecules/ShareAccess/index.d.ts +1 -1
  641. package/es/components/molecules/ShareAccess/index.js +1 -1
  642. package/es/components/molecules/ShareAccess/reducer.d.ts +2 -2
  643. package/es/components/molecules/ShareAccess/reducer.js +19 -19
  644. package/es/components/molecules/ShareAccess/types.d.ts +46 -46
  645. package/es/components/molecules/ShareAccess/types.js +1 -1
  646. package/es/components/molecules/ShareAccess/utils.d.ts +14 -14
  647. package/es/components/molecules/ShareAccess/utils.js +22 -22
  648. package/es/components/molecules/SliderWithInputNumber/index.d.ts +11 -11
  649. package/es/components/molecules/SliderWithInputNumber/index.js +62 -62
  650. package/es/components/molecules/SliderWithInputNumber/styled.d.ts +1 -1
  651. package/es/components/molecules/SliderWithInputNumber/styled.js +8 -8
  652. package/es/components/molecules/Tabs/Tabs.d.ts +1 -1
  653. package/es/components/molecules/Tabs/Tabs.js +1 -1
  654. package/es/components/molecules/Tabs/index.d.ts +1 -1
  655. package/es/components/molecules/Tabs/index.js +1 -1
  656. package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -19
  657. package/es/components/molecules/TextDecorationSelect/constants.js +26 -26
  658. package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -15
  659. package/es/components/molecules/TextDecorationSelect/index.js +45 -45
  660. package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -13
  661. package/es/components/molecules/TextTransformSelect/constants.js +19 -19
  662. package/es/components/molecules/TextTransformSelect/index.d.ts +9 -9
  663. package/es/components/molecules/TextTransformSelect/index.js +39 -39
  664. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +13 -13
  665. package/es/components/molecules/TreeSelect/TreeSelect.js +2 -2
  666. package/es/components/molecules/TreeSelect/index.d.ts +1 -1
  667. package/es/components/molecules/TreeSelect/index.js +1 -1
  668. package/es/components/molecules/UploadImage/MediaIcon.d.ts +3 -3
  669. package/es/components/molecules/UploadImage/MediaIcon.js +8 -8
  670. package/es/components/molecules/UploadImage/index.d.ts +33 -33
  671. package/es/components/molecules/UploadImage/index.js +366 -366
  672. package/es/components/molecules/UploadImage/styled.d.ts +13 -13
  673. package/es/components/molecules/UploadImage/styled.js +134 -134
  674. package/es/components/molecules/index.d.ts +45 -45
  675. package/es/components/molecules/index.js +39 -39
  676. package/es/components/organism/Help/Help.d.ts +5 -5
  677. package/es/components/organism/Help/Help.js +1005 -1005
  678. package/es/components/organism/Help/constants.d.ts +140 -140
  679. package/es/components/organism/Help/constants.js +1653 -1653
  680. package/es/components/organism/Help/index.d.ts +1 -1
  681. package/es/components/organism/Help/index.js +1 -1
  682. package/es/components/organism/Help/styled.d.ts +75 -75
  683. package/es/components/organism/Help/styled.js +264 -264
  684. package/es/components/organism/Help/types.d.ts +67 -67
  685. package/es/components/organism/Help/types.js +1 -1
  686. package/es/components/organism/Help/utils.d.ts +15 -15
  687. package/es/components/organism/Help/utils.js +82 -82
  688. package/es/components/organism/PositionSetting/config.d.ts +10 -10
  689. package/es/components/organism/PositionSetting/config.js +10 -10
  690. package/es/components/organism/PositionSetting/index.d.ts +15 -15
  691. package/es/components/organism/PositionSetting/index.js +62 -62
  692. package/es/components/organism/PositionSetting/styled.d.ts +1 -1
  693. package/es/components/organism/PositionSetting/styled.js +3 -3
  694. package/es/components/organism/PositionSetting/types.d.ts +10 -10
  695. package/es/components/organism/PositionSetting/types.js +1 -1
  696. package/es/components/organism/Table/CrossTabTable/CrossTabTable.d.ts +18 -18
  697. package/es/components/organism/Table/CrossTabTable/CrossTabTable.js +305 -305
  698. package/es/components/organism/Table/CrossTabTable/components/CustomCell/CustomCell.d.ts +11 -11
  699. package/es/components/organism/Table/CrossTabTable/components/CustomCell/CustomCell.js +22 -22
  700. package/es/components/organism/Table/CrossTabTable/components/CustomCell/index.d.ts +1 -1
  701. package/es/components/organism/Table/CrossTabTable/components/CustomCell/index.js +1 -1
  702. package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.d.ts +1 -1
  703. package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.js +13 -13
  704. package/es/components/organism/Table/CrossTabTable/constants.d.ts +75 -75
  705. package/es/components/organism/Table/CrossTabTable/constants.js +1525 -1525
  706. package/es/components/organism/Table/CrossTabTable/index.d.ts +1 -1
  707. package/es/components/organism/Table/CrossTabTable/index.js +1 -1
  708. package/es/components/organism/Table/CrossTabTable/styled.d.ts +1 -1
  709. package/es/components/organism/Table/CrossTabTable/styled.js +13 -13
  710. package/es/components/organism/Table/CrossTabTable/types.d.ts +1 -1
  711. package/es/components/organism/Table/CrossTabTable/types.js +1 -1
  712. package/es/components/organism/Table/CrossTabTable/utils.d.ts +1 -1
  713. package/es/components/organism/Table/CrossTabTable/utils.js +1 -1
  714. package/es/components/organism/Table/ExplorePivotTable/ExplorePivotTable.d.ts +11 -11
  715. package/es/components/organism/Table/ExplorePivotTable/ExplorePivotTable.js +51 -51
  716. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/CustomCell.d.ts +12 -12
  717. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/CustomCell.js +41 -41
  718. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/index.d.ts +1 -1
  719. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/index.js +1 -1
  720. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.d.ts +3 -3
  721. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.js +21 -21
  722. package/es/components/organism/Table/ExplorePivotTable/constants.d.ts +4 -4
  723. package/es/components/organism/Table/ExplorePivotTable/constants.js +84 -84
  724. package/es/components/organism/Table/ExplorePivotTable/index.d.ts +2 -2
  725. package/es/components/organism/Table/ExplorePivotTable/index.js +2 -2
  726. package/es/components/organism/Table/ExplorePivotTable/styled.d.ts +12 -12
  727. package/es/components/organism/Table/ExplorePivotTable/styled.js +15 -15
  728. package/es/components/organism/Table/ExplorePivotTable/types.d.ts +17 -17
  729. package/es/components/organism/Table/ExplorePivotTable/types.js +1 -1
  730. package/es/components/organism/Table/ExplorePivotTable/utils.d.ts +4 -4
  731. package/es/components/organism/Table/ExplorePivotTable/utils.js +154 -154
  732. package/es/components/organism/Table/Table.d.ts +1 -1
  733. package/es/components/organism/Table/Table.js +1 -1
  734. package/es/components/organism/Table/index.d.ts +2 -2
  735. package/es/components/organism/Table/index.js +2 -2
  736. package/es/components/organism/index.d.ts +3 -3
  737. package/es/components/organism/index.js +3 -3
  738. package/es/constants/gradientSetting.d.ts +83 -83
  739. package/es/constants/gradientSetting.js +86 -86
  740. package/es/constants/index.d.ts +4 -4
  741. package/es/constants/index.js +4 -4
  742. package/es/constants/keyCode.d.ts +387 -387
  743. package/es/constants/keyCode.js +394 -394
  744. package/es/constants/richMenu.d.ts +19 -19
  745. package/es/constants/richMenu.js +19 -19
  746. package/es/constants/storybook.d.ts +17 -17
  747. package/es/constants/storybook.js +36 -36
  748. package/es/constants/theme.d.ts +12 -12
  749. package/es/constants/theme.js +173 -173
  750. package/es/hooks/index.d.ts +2 -2
  751. package/es/hooks/index.js +21 -21
  752. package/es/hooks/useDebounce.d.ts +3 -3
  753. package/es/hooks/useDebounce.js +15 -15
  754. package/es/hooks/useDebounceCallback.d.ts +1 -1
  755. package/es/hooks/useDebounceCallback.js +5 -5
  756. package/es/hooks/useDebounceV2.d.ts +1 -1
  757. package/es/hooks/useDebounceV2.js +11 -11
  758. package/es/hooks/useDeepCompareEffect.d.ts +1 -1
  759. package/es/hooks/useDeepCompareEffect.js +21 -21
  760. package/es/hooks/usePrevious.d.ts +2 -2
  761. package/es/hooks/usePrevious.js +9 -9
  762. package/es/index.d.ts +1 -1
  763. package/es/index.js +1 -1
  764. package/es/locales/en/translation.json +68 -68
  765. package/es/locales/i18n.d.ts +143 -143
  766. package/es/locales/i18n.js +38 -38
  767. package/es/locales/translations.d.ts +72 -72
  768. package/es/locales/translations.js +35 -35
  769. package/es/locales/types.d.ts +15 -15
  770. package/es/locales/types.js +1 -1
  771. package/es/locales/vi/translation.json +67 -67
  772. package/es/models/SavedImage.d.ts +32 -32
  773. package/es/models/SavedImage.js +26 -26
  774. package/es/models/Upload.d.ts +32 -32
  775. package/es/models/Upload.js +21 -21
  776. package/es/models/model.d.ts +8 -8
  777. package/es/models/model.js +5 -5
  778. package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +6 -6
  779. package/es/services/MediaTemplateDesign/UploadFile/index.js +75 -75
  780. package/es/services/Ticket.d.ts +67 -67
  781. package/es/services/Ticket.js +73 -73
  782. package/es/services/constants.d.ts +20 -20
  783. package/es/services/constants.js +21 -21
  784. package/es/services/index.d.ts +9 -9
  785. package/es/services/index.js +64 -64
  786. package/es/test.d.ts +0 -14
  787. package/es/test.js +1 -253
  788. package/es/types/index.d.ts +18 -18
  789. package/es/types/index.js +2 -2
  790. package/es/types/richMenu.d.ts +191 -191
  791. package/es/types/richMenu.js +1 -1
  792. package/es/types/variables.d.ts +2 -2
  793. package/es/types/variables.js +1 -1
  794. package/es/utils/color.d.ts +10 -10
  795. package/es/utils/color.js +61 -61
  796. package/es/utils/common.d.ts +56 -56
  797. package/es/utils/common.js +375 -375
  798. package/es/utils/handleError.d.ts +32 -32
  799. package/es/utils/handleError.js +44 -44
  800. package/es/utils/index.d.ts +3 -3
  801. package/es/utils/index.js +3 -3
  802. package/es/utils/loadable.d.ts +7 -7
  803. package/es/utils/loadable.js +10 -10
  804. package/es/utils/web.d.ts +10 -10
  805. package/es/utils/web.js +26 -26
  806. package/package.json +186 -186
@@ -1,727 +1,755 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
20
- };
21
- import React, { useState, useRef, useEffect } from 'react';
22
- import { Cell } from './components/Cell';
23
- import { GRID_TEMPLATE, MIN_SIZE, THREADHOLD, buildGrid } from './constant';
24
- import { StyledGrid, StyledMiddleLayer, StyledBGLayer, StyledLine } from './styled';
25
- import { useDeepCompareEffect } from '../../../hooks/useDeepCompareEffect';
26
- const defaultProps = {
27
- containerStyle: {},
28
- cellBorder: '1px dotted',
29
- cellStyle: {},
30
- cellActiveStyle: { background: '#2f79bf80' },
31
- isPreview: false,
32
- isCompact: false,
33
- delayUpdate: 100,
34
- selectColor: '#2f79bf80',
35
- };
36
- export const ResizeGrid = props => {
37
- const { containerStyle, cellBorder, cellStyle, cellActiveStyle, isPreview, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, onChange, delayUpdate, selectColor, } = props;
38
- const [grid, setGrid] = useState(buildGrid(initGrid || GRID_TEMPLATE.GRID_2_3));
39
- const startRef = useRef(null);
40
- const startCellRef = useRef(null);
41
- const selectRef = useRef(null);
42
- const selectEndRef = useRef(null);
43
- const gridRef = useRef();
44
- const containerRef = useRef(null);
45
- const verticalLineRef = useRef(null);
46
- const horizontalLineRef = useRef(null);
47
- const layersRef = useRef(null);
48
- const cellsRef = useRef({});
49
- const cordinatesRef = useRef({});
50
- const onChangeTimoutRef = useRef();
51
- const onChangeDelayRef = useRef();
52
- const acceptUpdateRef = useRef(false);
53
- const firstChangeRef = useRef(true);
54
- const ctrlKeyRef = useRef(false);
55
- const initRef = useRef(0);
56
- const initDoneRef = useRef(false);
57
- // console.log('grid', grid)
58
- function lineVertical(isShow = true, left = 0) {
59
- if (verticalLineRef.current && layersRef.current) {
60
- verticalLineRef.current.style.display = isShow ? 'block' : 'none';
61
- layersRef.current.style.opacity = isShow ? '.5' : '1';
62
- verticalLineRef.current.style.left = `${left}px`;
63
- }
64
- }
65
- function lineHorizontal(isShow = true, top = 0) {
66
- if (horizontalLineRef.current && layersRef.current) {
67
- horizontalLineRef.current.style.display = isShow ? 'block' : 'none';
68
- layersRef.current.style.opacity = isShow ? '.5' : '1';
69
- horizontalLineRef.current.style.top = `${top}px`;
70
- }
71
- }
72
- const handleChangeGrid = () => {
73
- clearTimeout(onChangeTimoutRef.current);
74
- onChangeTimoutRef.current = setTimeout(() => {
75
- if (containerRef.current && cellsRef.current && cellsRef.current[0]) {
76
- const container = containerRef.current.getBoundingClientRect();
77
- // Object.values(cordinatesRef.current);
78
- const childs = Object.values(cellsRef.current).map(cell => {
79
- if (!cell || !cell.current)
80
- return;
81
- const childBox = cell.current.getBoundingClientRect();
82
- return {
83
- width: childBox.width,
84
- height: childBox.height,
85
- x: childBox.x - container.x,
86
- y: childBox.y - container.y,
87
- };
88
- });
89
- if (typeof onChange === 'function') {
90
- onChange(grid, childs, firstChangeRef.current ? 'system' : 'user');
91
- acceptUpdateRef.current = false;
92
- firstChangeRef.current = false;
93
- clearTimeout(onChangeDelayRef.current);
94
- onChangeDelayRef.current = setTimeout(() => {
95
- acceptUpdateRef.current = true;
96
- }, delayUpdate);
97
- }
98
- }
99
- }, 300);
100
- };
101
- const isFollow = (cell, line, isCol = true) => isCol
102
- ? (cell.colEnd !== line || !cell.sizeX) && (cell.colStart !== line || !cell.sizeX)
103
- : (cell.rowEnd !== line || !cell.sizeY) && (cell.rowStart !== line || !cell.sizeY);
104
- const notFollow = (cell, line, isCol = true) => !isFollow(cell, line, isCol);
105
- const floorSize = size => Math.floor(size);
106
- useEffect(() => {
107
- handleChangeGrid();
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
- }, [grid]);
110
- useDeepCompareEffect(() => {
111
- // console.log('changed grid', initGrid, acceptUpdateRef.current, initGrid?.rows, initGrid?.cols)
112
- if ((initRef.current < 2 || !initDoneRef.current || acceptUpdateRef.current) &&
113
- (initGrid === null || initGrid === void 0 ? void 0 : initGrid.rows) &&
114
- (initGrid === null || initGrid === void 0 ? void 0 : initGrid.cols)) {
115
- // console.log('apply change...', buildGrid(initGrid))
116
- initRef.current += 1;
117
- firstChangeRef.current = true;
118
- setGrid(buildGrid(initGrid));
119
- resetBackgroundCellRef();
120
- }
121
- // eslint-disable-next-line react-hooks/exhaustive-deps
122
- }, [initGrid]);
123
- useEffect(() => {
124
- setTimeout(() => {
125
- initDoneRef.current = true;
126
- }, 3000);
127
- const handleMove = e => {
128
- // Resize Grid
129
- if (startRef.current && gridRef.current && containerRef.current) {
130
- const { type, line } = startRef.current;
131
- const idx = line - 1;
132
- const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
133
- if (idx <= 0 || (type === 'row' && idx >= rows) || (type === 'column' && idx >= cols))
134
- return;
135
- const { clientX, clientY } = e;
136
- if (type === 'row') {
137
- const gridHeight = containerRef.current.offsetHeight;
138
- const yDistant = clientY - startRef.current.clientY;
139
- const yPercentDistant = (100 * yDistant) / gridHeight;
140
- const minPercent = (100 * MIN_SIZE) / gridHeight;
141
- // console.log('move Y', clientY, yDistant, yPercentDistant);
142
- const newArr = [...gridTemplateRows];
143
- newArr[idx - 1] += yPercentDistant;
144
- newArr[idx] -= yPercentDistant;
145
- if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
146
- const newChilds = JSON.parse(JSON.stringify(childs));
147
- let isValidChildSize = true;
148
- newChilds.forEach((child, idx) => {
149
- var _a, _b;
150
- if (isValidChildSize && notFollow(child, (_a = startRef.current) === null || _a === void 0 ? void 0 : _a.line, false)) {
151
- if (child.rowStart === ((_b = startRef.current) === null || _b === void 0 ? void 0 : _b.line)) {
152
- if (child.transformY) {
153
- child.transformY = +child.transformY - yDistant;
154
- }
155
- else {
156
- child.sizeY = +child.sizeY - yDistant;
157
- }
158
- }
159
- else {
160
- child.transformY &&
161
- !child.movedBottom &&
162
- (child.sizeY = +child.sizeY + yDistant);
163
- }
164
- // console.log('check...', startRef.current.line, child.transformY, yDistant, +child.transformY - yDistant)
165
- if (child.sizeY < MIN_SIZE) {
166
- isValidChildSize = false;
167
- }
168
- }
169
- });
170
- isValidChildSize &&
171
- setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateRows: newArr, childs: newChilds }));
172
- }
173
- }
174
- else {
175
- const xDistant = clientX - startRef.current.clientX;
176
- const gridWidth = containerRef.current.offsetWidth;
177
- const xPercentDistant = (100 * xDistant) / gridWidth;
178
- const minPercent = (100 * MIN_SIZE) / gridWidth;
179
- // console.log('move X', clientX, xDistant, xPercentDistant);
180
- const newArr = [...gridTemplateColumns];
181
- newArr[idx - 1] += xPercentDistant;
182
- newArr[idx] -= xPercentDistant;
183
- if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
184
- const newChilds = JSON.parse(JSON.stringify(childs));
185
- let isValidChildSize = true;
186
- newChilds.forEach(child => {
187
- if (isValidChildSize && notFollow(child, line)) {
188
- if (child.colStart === line) {
189
- if (child.transformX) {
190
- child.transformX = +child.transformX - xDistant;
191
- }
192
- else {
193
- child.sizeX = +child.sizeX - xDistant;
194
- }
195
- }
196
- else {
197
- child.transformX && !child.movedRight && (child.sizeX = +child.sizeX + xDistant);
198
- }
199
- // console.log('check...', startRef.current.line, child.transformX, xDistant, +child.transformX - xDistant)
200
- if (child.sizeX < MIN_SIZE) {
201
- isValidChildSize = false;
202
- }
203
- }
204
- });
205
- isValidChildSize &&
206
- setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateColumns: newArr, childs: newChilds }));
207
- }
208
- }
209
- }
210
- //-------------------------------------------
211
- // Resize Cell
212
- if (startCellRef.current && gridRef.current) {
213
- const { clientX: startClientX, clientY: startClientY, direction, isRevert, leftCells, rightCells, } = startCellRef.current;
214
- // const { rowStart, rowEnd, colStart, colEnd, transformX, transformY } = cell;
215
- // const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
216
- // if (
217
- // idx < 0 ||
218
- // (direction === 'top' && rowStart === 1) ||
219
- // (direction === 'right' && colEnd === cols + 1) ||
220
- // (direction === 'bottom' && rowEnd === rows + 1) ||
221
- // (direction === 'left' && colStart === 1)
222
- // )
223
- // return;
224
- const { clientX, clientY } = e;
225
- if (['top', 'bottom'].includes(direction)) {
226
- // const cellHeight = cellRef.current.offsetHeight;
227
- let yDistant = clientY - startClientY;
228
- // console.log('move Y', clientY, yDistant);
229
- if (Math.abs(yDistant) > THREADHOLD) {
230
- startCellRef.current.fallback = true;
231
- }
232
- let isValid = true;
233
- const mapNewSizeTop = {};
234
- const mapNewSizeBottom = {};
235
- const leftKeys = Object.keys(leftCells);
236
- leftKeys.forEach(cellIdx => {
237
- const cell = leftCells[cellIdx];
238
- let newHeight = (cell.sizeY || 0) + yDistant;
239
- if (newHeight < MIN_SIZE) {
240
- isValid = false;
241
- }
242
- else {
243
- const cellCordinate = cordinatesRef.current[cellIdx];
244
- // const cell = gridRef.current.childs[cellIdx];
245
- const newYEnd = cellCordinate.y + newHeight;
246
- const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
247
- gridRef.current.childs[cor[0]] &&
248
- !leftKeys.includes(cor[0]) &&
249
- gridRef.current.childs[cor[0]].colStart !== cell.colStart &&
250
- Math.abs(cor[1].yEnd - newYEnd) <= THREADHOLD);
251
- // console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
252
- if (nearestCells.length && startCellRef.current) {
253
- const nearestY = Math.abs(nearestCells[0][1].y - newYEnd) <= THREADHOLD
254
- ? nearestCells[0][1].y
255
- : nearestCells[0][1].yEnd;
256
- const delta = nearestY - newYEnd;
257
- if (startCellRef.current.fallback ||
258
- floorSize(cellCordinate.height) !== floorSize(newHeight + delta)) {
259
- newHeight += delta;
260
- yDistant += delta;
261
- lineHorizontal(true, nearestY - 1);
262
- }
263
- }
264
- else {
265
- lineHorizontal(false);
266
- }
267
- mapNewSizeTop[cellIdx] = newHeight;
268
- }
269
- });
270
- Object.keys(rightCells).forEach(cellIdx => {
271
- const nextCell = rightCells[cellIdx];
272
- const newHeightNextCell = (nextCell.sizeY || 0) - yDistant;
273
- if (newHeightNextCell < MIN_SIZE) {
274
- isValid = false;
275
- }
276
- mapNewSizeBottom[cellIdx] = [newHeightNextCell, nextCell];
277
- });
278
- if (isValid) {
279
- const newChilds = [...gridRef.current.childs];
280
- Object.keys(mapNewSizeTop).forEach(cellIdx => {
281
- newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeTop[cellIdx], movedBottom: true });
282
- });
283
- Object.keys(mapNewSizeBottom).forEach(cellIdx => {
284
- newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeBottom[cellIdx][0], transformY: (mapNewSizeBottom[cellIdx][1].transformY || 0) + yDistant, movedTop: true });
285
- });
286
- setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
287
- }
288
- }
289
- else {
290
- // const cellWidth = cellRef.current.offsetWidth;
291
- let xDistant = clientX - startClientX;
292
- // console.log('move X', clientX, xDistant);
293
- if (Math.abs(xDistant) > THREADHOLD) {
294
- startCellRef.current.fallback = true;
295
- }
296
- let isValid = true;
297
- const mapNewSizeLeft = {};
298
- const mapNewSizeRight = {};
299
- const mapReset = {};
300
- const leftKeys = Object.keys(leftCells);
301
- leftKeys.forEach(cellIdx => {
302
- const cell = leftCells[cellIdx];
303
- let newWidth = (cell.sizeX || 0) + xDistant;
304
- if (newWidth < MIN_SIZE) {
305
- isValid = false;
306
- }
307
- else if (gridRef.current) {
308
- const cellCordinate = cordinatesRef.current[cellIdx];
309
- // const cell = gridRef.current.childs[cellIdx];
310
- const newXEnd = cellCordinate.x + newWidth;
311
- const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
312
- gridRef.current.childs[cor[0]] &&
313
- !leftKeys.includes(cor[0]) &&
314
- gridRef.current.childs[cor[0]].rowStart !== cell.rowStart &&
315
- Math.abs(cor[1].xEnd - newXEnd) <= THREADHOLD);
316
- // console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
317
- if (nearestCells.length && startCellRef.current) {
318
- const nearestX = Math.abs(nearestCells[0][1].x - newXEnd) <= THREADHOLD
319
- ? nearestCells[0][1].x
320
- : nearestCells[0][1].xEnd;
321
- const delta = nearestX - newXEnd;
322
- if (startCellRef.current.fallback ||
323
- floorSize(cellCordinate.width) !== floorSize(newWidth + delta)) {
324
- newWidth += delta;
325
- xDistant += delta;
326
- lineVertical(true, nearestX - 1);
327
- }
328
- }
329
- else {
330
- lineVertical(false);
331
- }
332
- mapNewSizeLeft[cellIdx] = newWidth;
333
- }
334
- });
335
- Object.keys(rightCells).forEach(cellIdx => {
336
- const nextCell = rightCells[cellIdx];
337
- const newWidthNextCell = (nextCell.sizeX || 0) - xDistant;
338
- if (newWidthNextCell < MIN_SIZE) {
339
- isValid = false;
340
- }
341
- mapNewSizeRight[cellIdx] = [newWidthNextCell, nextCell];
342
- });
343
- if (isValid) {
344
- const newChilds = [...gridRef.current.childs];
345
- Object.keys(mapNewSizeLeft).forEach(cellIdx => {
346
- newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeLeft[cellIdx], movedRight: true });
347
- });
348
- Object.keys(mapNewSizeRight).forEach(cellIdx => {
349
- newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeRight[cellIdx][0], transformX: (mapNewSizeRight[cellIdx][1].transformX || 0) + xDistant, movedLeft: true });
350
- });
351
- setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
352
- }
353
- }
354
- }
355
- //------------------------------------------
356
- // if (selectRef.current) {}
357
- };
358
- const handleUp = () => {
359
- startRef.current = null;
360
- startCellRef.current = null;
361
- lineVertical(false);
362
- lineHorizontal(false);
363
- };
364
- const isMac = () => navigator.platform.indexOf('Mac') >= 0;
365
- window.addEventListener('mousemove', handleMove);
366
- window.addEventListener('mouseup', handleUp);
367
- const handleKeyDown = e => {
368
- if (!ctrlKeyRef.current && ((isMac() && e.metaKey) || (!isMac() && e.key === 'Control'))) {
369
- ctrlKeyRef.current = true;
370
- // console.log('ctrlKeyRef', ctrlKeyRef.current);
371
- }
372
- };
373
- const handleKeyUp = () => {
374
- ctrlKeyRef.current = false;
375
- // console.log('ctrlKeyRef', ctrlKeyRef.current);
376
- };
377
- window.addEventListener('keydown', handleKeyDown);
378
- window.addEventListener('keyup', handleKeyUp);
379
- return () => {
380
- window.removeEventListener('mousemove', handleMove);
381
- window.removeEventListener('mouseup', handleUp);
382
- window.removeEventListener('keydown', handleKeyDown);
383
- window.removeEventListener('keyup', handleKeyUp);
384
- };
385
- }, []);
386
- // const rebaseCordinate = (x, y, ...rest) => {
387
- // if (containerRef.current) {
388
- // const container = containerRef.current.getBoundingClientRect();
389
- // console.log('rebased', x - container.x, y - container.y, ...rest);
390
- // }
391
- // };
392
- const activeCell = ({ idx }) => {
393
- setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: prev.childs.map((c, i) => (Object.assign(Object.assign({}, c), { active: i === idx }))) })));
394
- };
395
- const findResizeCells = ({ type, line, direction, idx,
396
- // cell,
397
- isRevert, leftCols = [], rightCols = [], dones = [], level = 0, }) => {
398
- // left is current cell and right is the opposite
399
- if (dones.includes(idx)) {
400
- return null;
401
- }
402
- const { childs } = grid;
403
- const cellBox = cordinatesRef.current[idx];
404
- dones.push(idx);
405
- if (level === 0 && !leftCols.length) {
406
- leftCols.push(idx);
407
- }
408
- let isEnd = true;
409
- if (type === 'column') {
410
- childs.forEach((cell, i) => {
411
- if (((direction === 'left' &&
412
- cell.colEnd === line &&
413
- Math.abs(cellBox.x - cordinatesRef.current[i].xEnd) < 1) ||
414
- (direction === 'right' &&
415
- cell.colStart === line &&
416
- Math.abs(cellBox.xEnd - cordinatesRef.current[i].x) < 1)) &&
417
- !(floorSize(cordinatesRef.current[i].y) >= floorSize(cellBox.yEnd) ||
418
- floorSize(cordinatesRef.current[i].yEnd) <= floorSize(cellBox.y))) {
419
- if (!rightCols.includes(i)) {
420
- rightCols.push(i);
421
- // const cellIRef = cellsRef.current[i];
422
- // if (cellIRef.current) {
423
- // cellIRef.current.style.background = 'green';
424
- // }
425
- isEnd = false;
426
- }
427
- // else if (direction === 'right' && !leftCols.includes(i)) {
428
- // leftCols.push(i);
429
- // const cellIRef = cellsRef.current[i];
430
- // if (cellIRef.current) {
431
- // cellIRef.current.style.background = 'blue';
432
- // }
433
- // isEnd = false;
434
- // }
435
- }
436
- });
437
- }
438
- else {
439
- childs.forEach((cell, i) => {
440
- if (((direction === 'top' &&
441
- cell.rowEnd === line &&
442
- Math.abs(cellBox.y - cordinatesRef.current[i].yEnd) < 1) ||
443
- (direction === 'bottom' &&
444
- cell.rowStart === line &&
445
- Math.abs(cellBox.yEnd - cordinatesRef.current[i].y) < 1)) &&
446
- !(floorSize(cordinatesRef.current[i].x) >= floorSize(cellBox.xEnd) ||
447
- floorSize(cordinatesRef.current[i].xEnd) <= floorSize(cellBox.x))) {
448
- if (!rightCols.includes(i)) {
449
- rightCols.push(i);
450
- // const cellIRef = cellsRef.current[i];
451
- // if (cellIRef.current) {
452
- // cellIRef.current.style.background = 'green';
453
- // }
454
- isEnd = false;
455
- }
456
- // else if (direction === 'bottom' && !leftCols.includes(i)) {
457
- // leftCols.push(i);
458
- // const cellIRef = cellsRef.current[i];
459
- // if (cellIRef.current) {
460
- // cellIRef.current.style.background = 'blue';
461
- // }
462
- // isEnd = false;
463
- // }
464
- }
465
- });
466
- }
467
- // console.log(' find', direction, idx, leftCols, rightCols, dones, cordinatesRef.current);
468
- if (!isEnd) {
469
- // console.log('continue find', leftCols, rightCols);
470
- rightCols
471
- .filter(i => !dones.includes(i))
472
- .forEach(i => {
473
- findResizeCells({
474
- type,
475
- line,
476
- direction: { left: 'right', right: 'left', top: 'bottom', bottom: 'top' }[direction] || '',
477
- idx: i,
478
- isRevert,
479
- leftCols: rightCols,
480
- rightCols: leftCols,
481
- dones,
482
- level: level + 1,
483
- });
484
- });
485
- }
486
- return { leftCols, rightCols };
487
- };
488
- const handleDownCell = (e, type, line, idx, direction, cell, cellRef) => {
489
- const { clientX, clientY } = e;
490
- // rebaseCordinate(clientX, clientY, type, line);
491
- const isRevert = ['top', 'left'].includes(direction);
492
- // let newIdx = isRevert ? idx - 1 : idx;
493
- // let nextCellIdx = isRevert ? idx - 1 : idx + 1;
494
- const leftCols = [idx];
495
- const rightCols = [];
496
- findResizeCells({ type, line, direction, idx, isRevert, leftCols, rightCols });
497
- // console.log('change cell', leftCols, rightCols);
498
- // if (['top', 'bottom'].includes(direction)) {
499
- // nextCellIdx = grid.childs.findIndex(
500
- // b =>
501
- // b.colStart === cell.colStart &&
502
- // ((isRevert && b.rowEnd === cell.rowStart) || (!isRevert && b.rowStart === cell.rowEnd)),
503
- // );
504
- // newIdx = isRevert ? nextCellIdx : idx;
505
- // }
506
- // if (nextCellIdx < 0) return;
507
- if (!leftCols.length || !rightCols.length)
508
- return;
509
- const leftCells = {};
510
- const rightCells = {};
511
- leftCols.forEach(i => {
512
- var _a, _b;
513
- const cell = grid.childs[i];
514
- const cellRef = cellsRef.current[i];
515
- leftCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
516
- });
517
- rightCols.forEach(i => {
518
- var _a, _b;
519
- const cell = grid.childs[i];
520
- const cellRef = cellsRef.current[i];
521
- rightCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
522
- });
523
- const newDirection = isRevert
524
- ? {
525
- left: 'right',
526
- right: 'left',
527
- top: 'bottom',
528
- bottom: 'top',
529
- }[direction]
530
- : direction;
531
- startCellRef.current = {
532
- clientX,
533
- clientY,
534
- // idx: newIdx,
535
- direction: newDirection,
536
- isRevert,
537
- leftCells: isRevert ? rightCells : leftCells,
538
- rightCells: !isRevert ? rightCells : leftCells,
539
- };
540
- // console.log('down cell', clientX, clientY, idx, direction, cell, cellRef);
541
- gridRef.current = grid;
542
- };
543
- const handleDown = (e, type, line, idx, direction, cell, cellRef) => {
544
- const { clientX, clientY } = e;
545
- // rebaseCordinate(clientX, clientY, type, line);
546
- startRef.current = { clientX, clientY, type, line };
547
- // const isRevert = ['top', 'left'].includes(direction);
548
- // const { leftCols, rightCols } = findResizeCells({ type, line, direction, idx, isRevert });
549
- // console.log('change cell', leftCols, rightCols);
550
- // console.log('down', type, line, clientX, clientY);
551
- gridRef.current = JSON.parse(JSON.stringify(grid));
552
- };
553
- const handleUp = (e, direction, idx) => {
554
- // console.log('up', direction, idx, e);
555
- startRef.current = null;
556
- startCellRef.current = null;
557
- lineVertical(false);
558
- lineHorizontal(false);
559
- };
560
- const downSelect = (idx, cell) => {
561
- // console.log('dow select', idx, cell);
562
- !cell.active && activeCell({ idx });
563
- selectRef.current = { idx, cell };
564
- gridRef.current = grid;
565
- };
566
- const unMerge = (cell, idx) => {
567
- const { colStart, colEnd, rowStart, rowEnd } = cell;
568
- if (colStart + 1 === colEnd && rowStart + 1 === rowEnd) {
569
- return;
570
- }
571
- const newChilds = [...grid.childs];
572
- for (let i = rowStart; i < rowEnd; i++) {
573
- for (let j = colStart; j < colEnd; j++) {
574
- const rStart = i;
575
- const cStart = j;
576
- const rEnd = rStart + 1;
577
- const cEnd = cStart + 1;
578
- // console.log('merge', i, j, rStart, cStart, rEnd, cEnd)
579
- const newChild = {
580
- colStart: cStart,
581
- colEnd: cEnd,
582
- rowStart: rStart,
583
- rowEnd: rEnd,
584
- };
585
- if (i === rowStart && j === colStart) {
586
- newChilds[idx] = newChild;
587
- }
588
- else if (rStart !== rowStart ||
589
- rEnd !== rowEnd ||
590
- cStart !== colStart ||
591
- cEnd !== colEnd) {
592
- newChilds.splice(idx, 0, newChild);
593
- }
594
- }
595
- }
596
- setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: newChilds })));
597
- };
598
- function resetBackgroundCellRef() {
599
- Object.values(cellsRef.current).forEach(r => {
600
- if (r.current) {
601
- r.current.style.background = 'unset';
602
- }
603
- });
604
- }
605
- const upSelect = (idx, cell) => {
606
- // console.log('up select', idx, cell);
607
- if (selectRef.current &&
608
- selectEndRef.current &&
609
- gridRef.current &&
610
- selectRef.current.idx !== selectEndRef.current.idx &&
611
- (selectEndRef.current.cell.rowEnd > selectRef.current.cell.rowEnd ||
612
- selectEndRef.current.cell.colEnd > selectRef.current.cell.colEnd)) {
613
- resetBackgroundCellRef();
614
- // console.log('merge', selectRef.current, selectEndRef.current)
615
- const { cell: cellStart, idx: idxStart } = selectRef.current;
616
- const { cell: cellEnd, idx: idxEnd, hCells } = selectEndRef.current;
617
- const newChilds = JSON.parse(JSON.stringify(gridRef.current.childs));
618
- newChilds[idxStart].rowEnd = cellEnd.rowEnd;
619
- newChilds[idxStart].colEnd = cellEnd.colEnd;
620
- delete newChilds[idxStart].sizeX;
621
- delete newChilds[idxStart].sizeY;
622
- hCells.reverse().forEach(i => {
623
- if (i !== idxStart) {
624
- newChilds.splice(i, 1);
625
- delete cellsRef.current[i];
626
- delete cordinatesRef.current[i];
627
- // console.log('del corr', i, cordinatesRef.current)
628
- }
629
- });
630
- setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
631
- }
632
- selectRef.current = null;
633
- selectEndRef.current = null;
634
- };
635
- const hoverSelect = (idx, cell) => {
636
- if (selectRef.current && gridRef.current) {
637
- // console.log('hover select', idx, cell);
638
- const { cell: cellStart, idx: idxStart } = selectRef.current;
639
- const hCells = [];
640
- gridRef.current.childs.forEach((child, i) => {
641
- if (child.rowStart >= cellStart.rowStart &&
642
- child.rowEnd <= cell.rowEnd &&
643
- child.colStart >= cellStart.colStart &&
644
- child.colEnd <= cell.colEnd) {
645
- hCells.push(i);
646
- }
647
- });
648
- // console.log('hCells', hCells)
649
- resetBackgroundCellRef();
650
- hCells.forEach(i => {
651
- const cellRef = cellsRef.current[i];
652
- if (cellRef && cellRef.current) {
653
- cellRef.current.style.background = selectColor || 'unset';
654
- }
655
- });
656
- selectEndRef.current = { cell, idx, hCells };
657
- gridRef.current = grid;
658
- }
659
- };
660
- const setRef = (idx, ref) => {
661
- cellsRef.current[idx] = ref;
662
- // console.log('cellsRef.current', cellsRef.current)
663
- };
664
- const setCordinate = (idx) => __awaiter(void 0, void 0, void 0, function* () {
665
- // while(!cellsRef[idx]) {
666
- // await new Promise(r => {setTimeout(r, 100)});
667
- // console.log('wait', idx, cellsRef[idx])
668
- // }
669
- var _b;
670
- if (containerRef.current) {
671
- const container = containerRef.current.getBoundingClientRect();
672
- const childRef = cellsRef.current[idx];
673
- const childBox = (_b = childRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
674
- if (childBox) {
675
- const cordinate = {
676
- width: childBox.width,
677
- height: childBox.height,
678
- x: childBox.x - container.x,
679
- y: childBox.y - container.y,
680
- xEnd: childBox.x - container.x + childBox.width,
681
- yEnd: childBox.y - container.y + childBox.height,
682
- };
683
- cordinatesRef.current[idx] = cordinate;
684
- // console.log('set cor', idx, cordinate);
685
- }
686
- }
687
- // console.log('set corr', idx, cordinatesRef.current)
688
- });
689
- const renderGrid = (style) => {
690
- const { gridTemplateColumns, gridTemplateRows, childs } = grid;
691
- // console.log('grid', { gridTemplateColumns, gridTemplateRows, childs });
692
- return (React.createElement("div", { className: "grid-container", ref: containerRef, style: Object.assign({ gridTemplateColumns: gridTemplateColumns.map(fr => `${fr}%`).join(' '), gridTemplateRows: gridTemplateRows.map(fr => `${fr}%`).join(' ') }, style) }, childs.map((cell, idx) => (React.createElement(Cell, { key: `${cell.rowStart}-${cell.colStart}-${cell.rowEnd}-${cell.colEnd}`, idx: idx, cell: cell, down: handleDown, downCell: handleDownCell, up: handleUp, setRef: setRef, setCordinate: setCordinate, downSelect: downSelect, upSelect: upSelect, hoverSelect: hoverSelect, unMerge: unMerge, renderCell: renderCell, borderStyle: cellBorder, style: cellStyle, activeStyle: cellActiveStyle, isPreview: isPreview, rowPercentage: grid.gridTemplateRows[cell.rowStart - 1], colPercentage: grid.gridTemplateColumns[cell.colStart - 1], ctrlKeyRef: ctrlKeyRef })))));
693
- };
694
- const handleUpLine = () => {
695
- lineVertical(false);
696
- lineHorizontal(false);
697
- };
698
- const _a = containerStyle || {}, { borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderStyle, borderColor } = _a, rest = __rest(_a, ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderStyle", "borderColor"]);
699
- const renderLines = () => (React.createElement(React.Fragment, null,
700
- React.createElement(StyledLine, { ref: verticalLineRef, className: "vertical", onMouseUp: handleUpLine }),
701
- React.createElement(StyledLine, { ref: horizontalLineRef, className: "horizontal", onMouseUp: handleUpLine })));
702
- return (React.createElement(StyledGrid, { className: "grid-wrapper", isCompact: !!isCompact },
703
- React.createElement("div", { className: "layers", ref: layersRef },
704
- React.createElement(StyledBGLayer, { style: {
705
- backgroundImage: image ? `url(${image})` : 'unset',
706
- backgroundSize: imageSize === 'fill' ? '100% 100%' : imageSize,
707
- backgroundPosition: imagePosition,
708
- } }),
709
- React.createElement(StyledMiddleLayer, { style: {
710
- borderTopLeftRadius,
711
- borderTopRightRadius,
712
- borderBottomRightRadius,
713
- borderBottomLeftRadius,
714
- borderTopWidth,
715
- borderRightWidth,
716
- borderBottomWidth,
717
- borderLeftWidth,
718
- borderStyle,
719
- borderColor,
720
- } }),
721
- renderGrid(Object.assign(Object.assign({}, rest), { borderTopLeftRadius,
722
- borderTopRightRadius,
723
- borderBottomRightRadius,
724
- borderBottomLeftRadius }))),
725
- renderLines()));
726
- };
727
- ResizeGrid.defaultProps = defaultProps;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import React, { useState, useRef, useEffect } from 'react';
22
+ import domtoimage from 'dom-to-image';
23
+ import { Cell } from './components/Cell';
24
+ import { GRID_TEMPLATE, MIN_SIZE, THREADHOLD, buildGrid } from './constant';
25
+ import { StyledGrid, StyledMiddleLayer, StyledBGLayer, StyledLine } from './styled';
26
+ import { useDeepCompareEffect } from '../../../hooks/useDeepCompareEffect';
27
+ const defaultProps = {
28
+ containerStyle: {},
29
+ cellBorder: '1px dotted',
30
+ cellStyle: {},
31
+ cellActiveStyle: { background: '#2f79bf80' },
32
+ isPreview: false,
33
+ isCompact: false,
34
+ delayUpdate: 300,
35
+ selectColor: '#2f79bf80',
36
+ };
37
+ export const ResizeGrid = props => {
38
+ const { containerStyle, cellBorder, cellStyle, cellActiveStyle, isPreview, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, onChange, delayUpdate, selectColor, } = props;
39
+ const [grid, setGrid] = useState(buildGrid(initGrid || GRID_TEMPLATE.GRID_2_3));
40
+ const startRef = useRef(null);
41
+ const startCellRef = useRef(null);
42
+ const selectRef = useRef(null);
43
+ const selectEndRef = useRef(null);
44
+ const gridRef = useRef();
45
+ const containerRef = useRef(null);
46
+ const verticalLineRef = useRef(null);
47
+ const horizontalLineRef = useRef(null);
48
+ const layersRef = useRef(null);
49
+ const cellsRef = useRef({});
50
+ const cordinatesRef = useRef({});
51
+ const onChangeTimoutRef = useRef();
52
+ const onChangeDelayRef = useRef();
53
+ const acceptUpdateRef = useRef(false);
54
+ const firstChangeRef = useRef(true);
55
+ const ctrlKeyRef = useRef(false);
56
+ const initRef = useRef(0);
57
+ const initDoneRef = useRef(false);
58
+ // console.log('grid', grid)
59
+ function lineVertical(isShow = true, left = 0) {
60
+ if (verticalLineRef.current && layersRef.current) {
61
+ verticalLineRef.current.style.display = isShow ? 'block' : 'none';
62
+ layersRef.current.style.opacity = isShow ? '.5' : '1';
63
+ verticalLineRef.current.style.left = `${left}px`;
64
+ }
65
+ }
66
+ function lineHorizontal(isShow = true, top = 0) {
67
+ if (horizontalLineRef.current && layersRef.current) {
68
+ horizontalLineRef.current.style.display = isShow ? 'block' : 'none';
69
+ layersRef.current.style.opacity = isShow ? '.5' : '1';
70
+ horizontalLineRef.current.style.top = `${top}px`;
71
+ }
72
+ }
73
+ const handleChangeGrid = () => {
74
+ clearTimeout(onChangeTimoutRef.current);
75
+ onChangeTimoutRef.current = setTimeout(() => {
76
+ if (containerRef.current && cellsRef.current && cellsRef.current[0]) {
77
+ const container = containerRef.current.getBoundingClientRect();
78
+ // Object.values(cordinatesRef.current);
79
+ const childs = Object.values(cellsRef.current).map(cell => {
80
+ if (!cell || !cell.current)
81
+ return;
82
+ const childBox = cell.current.getBoundingClientRect();
83
+ return {
84
+ width: childBox.width,
85
+ height: childBox.height,
86
+ x: childBox.x - container.x,
87
+ y: childBox.y - container.y,
88
+ };
89
+ });
90
+ // capture
91
+ // html2canvas(containerRef.current).then(canvas => {
92
+ // const img = canvas.toDataURL("image/png");
93
+ // console.log('img', img)
94
+ // window.open(img);
95
+ // });
96
+ console.time();
97
+ domtoimage.toJpeg(containerRef.current, { quality: 1 })
98
+ .then(dataUrl => {
99
+ console.timeEnd();
100
+ const link = document.createElement('a');
101
+ link.download = 'my-image-name.jpeg';
102
+ link.href = dataUrl;
103
+ link.click();
104
+ });
105
+ // toPng(containerRef.current, { cacheBust: true, })
106
+ // .then((dataUrl) => {
107
+ // console.timeEnd()
108
+ // const link = document.createElement('a')
109
+ // link.download = 'my-image-name.png'
110
+ // link.href = dataUrl
111
+ // link.click()
112
+ // })
113
+ // .catch((err) => {
114
+ // console.log(err)
115
+ // })
116
+ if (typeof onChange === 'function') {
117
+ onChange(grid, childs, firstChangeRef.current ? 'system' : 'user');
118
+ acceptUpdateRef.current = false;
119
+ firstChangeRef.current = false;
120
+ clearTimeout(onChangeDelayRef.current);
121
+ onChangeDelayRef.current = setTimeout(() => {
122
+ acceptUpdateRef.current = true;
123
+ }, delayUpdate);
124
+ }
125
+ }
126
+ }, 300);
127
+ };
128
+ const isFollow = (cell, line, isCol = true) => isCol
129
+ ? (cell.colEnd !== line || !cell.sizeX) && (cell.colStart !== line || !cell.sizeX)
130
+ : (cell.rowEnd !== line || !cell.sizeY) && (cell.rowStart !== line || !cell.sizeY);
131
+ const notFollow = (cell, line, isCol = true) => !isFollow(cell, line, isCol);
132
+ const floorSize = size => Math.floor(size);
133
+ useEffect(() => {
134
+ handleChangeGrid();
135
+ // eslint-disable-next-line react-hooks/exhaustive-deps
136
+ }, [grid]);
137
+ useDeepCompareEffect(() => {
138
+ // console.log('changed grid', initGrid, acceptUpdateRef.current, initGrid?.rows, initGrid?.cols)
139
+ console.log(initRef.current < 2, !initDoneRef.current, acceptUpdateRef.current);
140
+ if ((initRef.current < 2 || !initDoneRef.current || acceptUpdateRef.current) &&
141
+ (initGrid === null || initGrid === void 0 ? void 0 : initGrid.rows) &&
142
+ (initGrid === null || initGrid === void 0 ? void 0 : initGrid.cols)) {
143
+ // console.log('apply change...', buildGrid(initGrid))
144
+ initRef.current += 1;
145
+ firstChangeRef.current = true;
146
+ setGrid(buildGrid(initGrid));
147
+ resetBackgroundCellRef();
148
+ }
149
+ // eslint-disable-next-line react-hooks/exhaustive-deps
150
+ }, [initGrid]);
151
+ useEffect(() => {
152
+ setTimeout(() => {
153
+ initDoneRef.current = true;
154
+ }, 3000);
155
+ const handleMove = e => {
156
+ // Resize Grid
157
+ if (startRef.current && gridRef.current && containerRef.current) {
158
+ const { type, line } = startRef.current;
159
+ const idx = line - 1;
160
+ const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
161
+ if (idx <= 0 || (type === 'row' && idx >= rows) || (type === 'column' && idx >= cols))
162
+ return;
163
+ const { clientX, clientY } = e;
164
+ if (type === 'row') {
165
+ const gridHeight = containerRef.current.offsetHeight;
166
+ const yDistant = clientY - startRef.current.clientY;
167
+ const yPercentDistant = (100 * yDistant) / gridHeight;
168
+ const minPercent = (100 * MIN_SIZE) / gridHeight;
169
+ // console.log('move Y', clientY, yDistant, yPercentDistant);
170
+ const newArr = [...gridTemplateRows];
171
+ newArr[idx - 1] += yPercentDistant;
172
+ newArr[idx] -= yPercentDistant;
173
+ if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
174
+ const newChilds = JSON.parse(JSON.stringify(childs));
175
+ let isValidChildSize = true;
176
+ newChilds.forEach((child, idx) => {
177
+ var _a, _b;
178
+ if (isValidChildSize && notFollow(child, (_a = startRef.current) === null || _a === void 0 ? void 0 : _a.line, false)) {
179
+ if (child.rowStart === ((_b = startRef.current) === null || _b === void 0 ? void 0 : _b.line)) {
180
+ if (child.transformY) {
181
+ child.transformY = +child.transformY - yDistant;
182
+ }
183
+ else {
184
+ child.sizeY = +child.sizeY - yDistant;
185
+ }
186
+ }
187
+ else {
188
+ child.transformY &&
189
+ !child.movedBottom &&
190
+ (child.sizeY = +child.sizeY + yDistant);
191
+ }
192
+ // console.log('check...', startRef.current.line, child.transformY, yDistant, +child.transformY - yDistant)
193
+ if (child.sizeY < MIN_SIZE) {
194
+ isValidChildSize = false;
195
+ }
196
+ }
197
+ });
198
+ isValidChildSize &&
199
+ setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateRows: newArr, childs: newChilds }));
200
+ }
201
+ }
202
+ else {
203
+ const xDistant = clientX - startRef.current.clientX;
204
+ const gridWidth = containerRef.current.offsetWidth;
205
+ const xPercentDistant = (100 * xDistant) / gridWidth;
206
+ const minPercent = (100 * MIN_SIZE) / gridWidth;
207
+ // console.log('move X', clientX, xDistant, xPercentDistant);
208
+ const newArr = [...gridTemplateColumns];
209
+ newArr[idx - 1] += xPercentDistant;
210
+ newArr[idx] -= xPercentDistant;
211
+ if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
212
+ const newChilds = JSON.parse(JSON.stringify(childs));
213
+ let isValidChildSize = true;
214
+ newChilds.forEach(child => {
215
+ if (isValidChildSize && notFollow(child, line)) {
216
+ if (child.colStart === line) {
217
+ if (child.transformX) {
218
+ child.transformX = +child.transformX - xDistant;
219
+ }
220
+ else {
221
+ child.sizeX = +child.sizeX - xDistant;
222
+ }
223
+ }
224
+ else {
225
+ child.transformX && !child.movedRight && (child.sizeX = +child.sizeX + xDistant);
226
+ }
227
+ // console.log('check...', startRef.current.line, child.transformX, xDistant, +child.transformX - xDistant)
228
+ if (child.sizeX < MIN_SIZE) {
229
+ isValidChildSize = false;
230
+ }
231
+ }
232
+ });
233
+ isValidChildSize &&
234
+ setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateColumns: newArr, childs: newChilds }));
235
+ }
236
+ }
237
+ }
238
+ //-------------------------------------------
239
+ // Resize Cell
240
+ if (startCellRef.current && gridRef.current) {
241
+ const { clientX: startClientX, clientY: startClientY, direction, isRevert, leftCells, rightCells, } = startCellRef.current;
242
+ // const { rowStart, rowEnd, colStart, colEnd, transformX, transformY } = cell;
243
+ // const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
244
+ // if (
245
+ // idx < 0 ||
246
+ // (direction === 'top' && rowStart === 1) ||
247
+ // (direction === 'right' && colEnd === cols + 1) ||
248
+ // (direction === 'bottom' && rowEnd === rows + 1) ||
249
+ // (direction === 'left' && colStart === 1)
250
+ // )
251
+ // return;
252
+ const { clientX, clientY } = e;
253
+ if (['top', 'bottom'].includes(direction)) {
254
+ // const cellHeight = cellRef.current.offsetHeight;
255
+ let yDistant = clientY - startClientY;
256
+ // console.log('move Y', clientY, yDistant);
257
+ if (Math.abs(yDistant) > THREADHOLD) {
258
+ startCellRef.current.fallback = true;
259
+ }
260
+ let isValid = true;
261
+ const mapNewSizeTop = {};
262
+ const mapNewSizeBottom = {};
263
+ const leftKeys = Object.keys(leftCells);
264
+ leftKeys.forEach(cellIdx => {
265
+ const cell = leftCells[cellIdx];
266
+ let newHeight = (cell.sizeY || 0) + yDistant;
267
+ if (newHeight < MIN_SIZE) {
268
+ isValid = false;
269
+ }
270
+ else {
271
+ const cellCordinate = cordinatesRef.current[cellIdx];
272
+ // const cell = gridRef.current.childs[cellIdx];
273
+ const newYEnd = cellCordinate.y + newHeight;
274
+ const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
275
+ gridRef.current.childs[cor[0]] &&
276
+ !leftKeys.includes(cor[0]) &&
277
+ gridRef.current.childs[cor[0]].colStart !== cell.colStart &&
278
+ Math.abs(cor[1].yEnd - newYEnd) <= THREADHOLD);
279
+ // console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
280
+ if (nearestCells.length && startCellRef.current) {
281
+ const nearestY = Math.abs(nearestCells[0][1].y - newYEnd) <= THREADHOLD
282
+ ? nearestCells[0][1].y
283
+ : nearestCells[0][1].yEnd;
284
+ const delta = nearestY - newYEnd;
285
+ if (startCellRef.current.fallback ||
286
+ floorSize(cellCordinate.height) !== floorSize(newHeight + delta)) {
287
+ newHeight += delta;
288
+ yDistant += delta;
289
+ lineHorizontal(true, nearestY - 1);
290
+ }
291
+ }
292
+ else {
293
+ lineHorizontal(false);
294
+ }
295
+ mapNewSizeTop[cellIdx] = newHeight;
296
+ }
297
+ });
298
+ Object.keys(rightCells).forEach(cellIdx => {
299
+ const nextCell = rightCells[cellIdx];
300
+ const newHeightNextCell = (nextCell.sizeY || 0) - yDistant;
301
+ if (newHeightNextCell < MIN_SIZE) {
302
+ isValid = false;
303
+ }
304
+ mapNewSizeBottom[cellIdx] = [newHeightNextCell, nextCell];
305
+ });
306
+ if (isValid) {
307
+ const newChilds = [...gridRef.current.childs];
308
+ Object.keys(mapNewSizeTop).forEach(cellIdx => {
309
+ newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeTop[cellIdx], movedBottom: true });
310
+ });
311
+ Object.keys(mapNewSizeBottom).forEach(cellIdx => {
312
+ newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeBottom[cellIdx][0], transformY: (mapNewSizeBottom[cellIdx][1].transformY || 0) + yDistant, movedTop: true });
313
+ });
314
+ setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
315
+ }
316
+ }
317
+ else {
318
+ // const cellWidth = cellRef.current.offsetWidth;
319
+ let xDistant = clientX - startClientX;
320
+ // console.log('move X', clientX, xDistant);
321
+ if (Math.abs(xDistant) > THREADHOLD) {
322
+ startCellRef.current.fallback = true;
323
+ }
324
+ let isValid = true;
325
+ const mapNewSizeLeft = {};
326
+ const mapNewSizeRight = {};
327
+ const mapReset = {};
328
+ const leftKeys = Object.keys(leftCells);
329
+ leftKeys.forEach(cellIdx => {
330
+ const cell = leftCells[cellIdx];
331
+ let newWidth = (cell.sizeX || 0) + xDistant;
332
+ if (newWidth < MIN_SIZE) {
333
+ isValid = false;
334
+ }
335
+ else if (gridRef.current) {
336
+ const cellCordinate = cordinatesRef.current[cellIdx];
337
+ // const cell = gridRef.current.childs[cellIdx];
338
+ const newXEnd = cellCordinate.x + newWidth;
339
+ const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
340
+ gridRef.current.childs[cor[0]] &&
341
+ !leftKeys.includes(cor[0]) &&
342
+ gridRef.current.childs[cor[0]].rowStart !== cell.rowStart &&
343
+ Math.abs(cor[1].xEnd - newXEnd) <= THREADHOLD);
344
+ // console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
345
+ if (nearestCells.length && startCellRef.current) {
346
+ const nearestX = Math.abs(nearestCells[0][1].x - newXEnd) <= THREADHOLD
347
+ ? nearestCells[0][1].x
348
+ : nearestCells[0][1].xEnd;
349
+ const delta = nearestX - newXEnd;
350
+ if (startCellRef.current.fallback ||
351
+ floorSize(cellCordinate.width) !== floorSize(newWidth + delta)) {
352
+ newWidth += delta;
353
+ xDistant += delta;
354
+ lineVertical(true, nearestX - 1);
355
+ }
356
+ }
357
+ else {
358
+ lineVertical(false);
359
+ }
360
+ mapNewSizeLeft[cellIdx] = newWidth;
361
+ }
362
+ });
363
+ Object.keys(rightCells).forEach(cellIdx => {
364
+ const nextCell = rightCells[cellIdx];
365
+ const newWidthNextCell = (nextCell.sizeX || 0) - xDistant;
366
+ if (newWidthNextCell < MIN_SIZE) {
367
+ isValid = false;
368
+ }
369
+ mapNewSizeRight[cellIdx] = [newWidthNextCell, nextCell];
370
+ });
371
+ if (isValid) {
372
+ const newChilds = [...gridRef.current.childs];
373
+ Object.keys(mapNewSizeLeft).forEach(cellIdx => {
374
+ newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeLeft[cellIdx], movedRight: true });
375
+ });
376
+ Object.keys(mapNewSizeRight).forEach(cellIdx => {
377
+ newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeRight[cellIdx][0], transformX: (mapNewSizeRight[cellIdx][1].transformX || 0) + xDistant, movedLeft: true });
378
+ });
379
+ setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
380
+ }
381
+ }
382
+ }
383
+ //------------------------------------------
384
+ // if (selectRef.current) {}
385
+ };
386
+ const handleUp = () => {
387
+ startRef.current = null;
388
+ startCellRef.current = null;
389
+ lineVertical(false);
390
+ lineHorizontal(false);
391
+ };
392
+ const isMac = () => navigator.platform.indexOf('Mac') >= 0;
393
+ window.addEventListener('mousemove', handleMove);
394
+ window.addEventListener('mouseup', handleUp);
395
+ const handleKeyDown = e => {
396
+ if (!ctrlKeyRef.current && ((isMac() && e.metaKey) || (!isMac() && e.key === 'Control'))) {
397
+ ctrlKeyRef.current = true;
398
+ // console.log('ctrlKeyRef', ctrlKeyRef.current);
399
+ }
400
+ };
401
+ const handleKeyUp = () => {
402
+ ctrlKeyRef.current = false;
403
+ // console.log('ctrlKeyRef', ctrlKeyRef.current);
404
+ };
405
+ window.addEventListener('keydown', handleKeyDown);
406
+ window.addEventListener('keyup', handleKeyUp);
407
+ return () => {
408
+ window.removeEventListener('mousemove', handleMove);
409
+ window.removeEventListener('mouseup', handleUp);
410
+ window.removeEventListener('keydown', handleKeyDown);
411
+ window.removeEventListener('keyup', handleKeyUp);
412
+ };
413
+ }, []);
414
+ // const rebaseCordinate = (x, y, ...rest) => {
415
+ // if (containerRef.current) {
416
+ // const container = containerRef.current.getBoundingClientRect();
417
+ // console.log('rebased', x - container.x, y - container.y, ...rest);
418
+ // }
419
+ // };
420
+ const activeCell = ({ idx }) => {
421
+ setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: prev.childs.map((c, i) => (Object.assign(Object.assign({}, c), { active: i === idx }))) })));
422
+ };
423
+ const findResizeCells = ({ type, line, direction, idx,
424
+ // cell,
425
+ isRevert, leftCols = [], rightCols = [], dones = [], level = 0, }) => {
426
+ // left is current cell and right is the opposite
427
+ if (dones.includes(idx)) {
428
+ return null;
429
+ }
430
+ const { childs } = grid;
431
+ const cellBox = cordinatesRef.current[idx];
432
+ dones.push(idx);
433
+ if (level === 0 && !leftCols.length) {
434
+ leftCols.push(idx);
435
+ }
436
+ let isEnd = true;
437
+ if (type === 'column') {
438
+ childs.forEach((cell, i) => {
439
+ if (((direction === 'left' &&
440
+ cell.colEnd === line &&
441
+ Math.abs(cellBox.x - cordinatesRef.current[i].xEnd) < 1) ||
442
+ (direction === 'right' &&
443
+ cell.colStart === line &&
444
+ Math.abs(cellBox.xEnd - cordinatesRef.current[i].x) < 1)) &&
445
+ !(floorSize(cordinatesRef.current[i].y) >= floorSize(cellBox.yEnd) ||
446
+ floorSize(cordinatesRef.current[i].yEnd) <= floorSize(cellBox.y))) {
447
+ if (!rightCols.includes(i)) {
448
+ rightCols.push(i);
449
+ // const cellIRef = cellsRef.current[i];
450
+ // if (cellIRef.current) {
451
+ // cellIRef.current.style.background = 'green';
452
+ // }
453
+ isEnd = false;
454
+ }
455
+ // else if (direction === 'right' && !leftCols.includes(i)) {
456
+ // leftCols.push(i);
457
+ // const cellIRef = cellsRef.current[i];
458
+ // if (cellIRef.current) {
459
+ // cellIRef.current.style.background = 'blue';
460
+ // }
461
+ // isEnd = false;
462
+ // }
463
+ }
464
+ });
465
+ }
466
+ else {
467
+ childs.forEach((cell, i) => {
468
+ if (((direction === 'top' &&
469
+ cell.rowEnd === line &&
470
+ Math.abs(cellBox.y - cordinatesRef.current[i].yEnd) < 1) ||
471
+ (direction === 'bottom' &&
472
+ cell.rowStart === line &&
473
+ Math.abs(cellBox.yEnd - cordinatesRef.current[i].y) < 1)) &&
474
+ !(floorSize(cordinatesRef.current[i].x) >= floorSize(cellBox.xEnd) ||
475
+ floorSize(cordinatesRef.current[i].xEnd) <= floorSize(cellBox.x))) {
476
+ if (!rightCols.includes(i)) {
477
+ rightCols.push(i);
478
+ // const cellIRef = cellsRef.current[i];
479
+ // if (cellIRef.current) {
480
+ // cellIRef.current.style.background = 'green';
481
+ // }
482
+ isEnd = false;
483
+ }
484
+ // else if (direction === 'bottom' && !leftCols.includes(i)) {
485
+ // leftCols.push(i);
486
+ // const cellIRef = cellsRef.current[i];
487
+ // if (cellIRef.current) {
488
+ // cellIRef.current.style.background = 'blue';
489
+ // }
490
+ // isEnd = false;
491
+ // }
492
+ }
493
+ });
494
+ }
495
+ // console.log(' find', direction, idx, leftCols, rightCols, dones, cordinatesRef.current);
496
+ if (!isEnd) {
497
+ // console.log('continue find', leftCols, rightCols);
498
+ rightCols
499
+ .filter(i => !dones.includes(i))
500
+ .forEach(i => {
501
+ findResizeCells({
502
+ type,
503
+ line,
504
+ direction: { left: 'right', right: 'left', top: 'bottom', bottom: 'top' }[direction] || '',
505
+ idx: i,
506
+ isRevert,
507
+ leftCols: rightCols,
508
+ rightCols: leftCols,
509
+ dones,
510
+ level: level + 1,
511
+ });
512
+ });
513
+ }
514
+ return { leftCols, rightCols };
515
+ };
516
+ const handleDownCell = (e, type, line, idx, direction, cell, cellRef) => {
517
+ const { clientX, clientY } = e;
518
+ // rebaseCordinate(clientX, clientY, type, line);
519
+ const isRevert = ['top', 'left'].includes(direction);
520
+ // let newIdx = isRevert ? idx - 1 : idx;
521
+ // let nextCellIdx = isRevert ? idx - 1 : idx + 1;
522
+ const leftCols = [idx];
523
+ const rightCols = [];
524
+ findResizeCells({ type, line, direction, idx, isRevert, leftCols, rightCols });
525
+ // console.log('change cell', leftCols, rightCols);
526
+ // if (['top', 'bottom'].includes(direction)) {
527
+ // nextCellIdx = grid.childs.findIndex(
528
+ // b =>
529
+ // b.colStart === cell.colStart &&
530
+ // ((isRevert && b.rowEnd === cell.rowStart) || (!isRevert && b.rowStart === cell.rowEnd)),
531
+ // );
532
+ // newIdx = isRevert ? nextCellIdx : idx;
533
+ // }
534
+ // if (nextCellIdx < 0) return;
535
+ if (!leftCols.length || !rightCols.length)
536
+ return;
537
+ const leftCells = {};
538
+ const rightCells = {};
539
+ leftCols.forEach(i => {
540
+ var _a, _b;
541
+ const cell = grid.childs[i];
542
+ const cellRef = cellsRef.current[i];
543
+ leftCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
544
+ });
545
+ rightCols.forEach(i => {
546
+ var _a, _b;
547
+ const cell = grid.childs[i];
548
+ const cellRef = cellsRef.current[i];
549
+ rightCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
550
+ });
551
+ const newDirection = isRevert
552
+ ? {
553
+ left: 'right',
554
+ right: 'left',
555
+ top: 'bottom',
556
+ bottom: 'top',
557
+ }[direction]
558
+ : direction;
559
+ startCellRef.current = {
560
+ clientX,
561
+ clientY,
562
+ // idx: newIdx,
563
+ direction: newDirection,
564
+ isRevert,
565
+ leftCells: isRevert ? rightCells : leftCells,
566
+ rightCells: !isRevert ? rightCells : leftCells,
567
+ };
568
+ // console.log('down cell', clientX, clientY, idx, direction, cell, cellRef);
569
+ gridRef.current = grid;
570
+ };
571
+ const handleDown = (e, type, line, idx, direction, cell, cellRef) => {
572
+ const { clientX, clientY } = e;
573
+ // rebaseCordinate(clientX, clientY, type, line);
574
+ startRef.current = { clientX, clientY, type, line };
575
+ // const isRevert = ['top', 'left'].includes(direction);
576
+ // const { leftCols, rightCols } = findResizeCells({ type, line, direction, idx, isRevert });
577
+ // console.log('change cell', leftCols, rightCols);
578
+ // console.log('down', type, line, clientX, clientY);
579
+ gridRef.current = JSON.parse(JSON.stringify(grid));
580
+ };
581
+ const handleUp = (e, direction, idx) => {
582
+ // console.log('up', direction, idx, e);
583
+ startRef.current = null;
584
+ startCellRef.current = null;
585
+ lineVertical(false);
586
+ lineHorizontal(false);
587
+ };
588
+ const downSelect = (idx, cell) => {
589
+ // console.log('dow select', idx, cell);
590
+ !cell.active && activeCell({ idx });
591
+ selectRef.current = { idx, cell };
592
+ gridRef.current = grid;
593
+ };
594
+ const unMerge = (cell, idx) => {
595
+ const { colStart, colEnd, rowStart, rowEnd } = cell;
596
+ if (colStart + 1 === colEnd && rowStart + 1 === rowEnd) {
597
+ return;
598
+ }
599
+ const newChilds = [...grid.childs];
600
+ for (let i = rowStart; i < rowEnd; i++) {
601
+ for (let j = colStart; j < colEnd; j++) {
602
+ const rStart = i;
603
+ const cStart = j;
604
+ const rEnd = rStart + 1;
605
+ const cEnd = cStart + 1;
606
+ // console.log('merge', i, j, rStart, cStart, rEnd, cEnd)
607
+ const newChild = {
608
+ colStart: cStart,
609
+ colEnd: cEnd,
610
+ rowStart: rStart,
611
+ rowEnd: rEnd,
612
+ };
613
+ if (i === rowStart && j === colStart) {
614
+ newChilds[idx] = newChild;
615
+ }
616
+ else if (rStart !== rowStart ||
617
+ rEnd !== rowEnd ||
618
+ cStart !== colStart ||
619
+ cEnd !== colEnd) {
620
+ newChilds.splice(idx, 0, newChild);
621
+ }
622
+ }
623
+ }
624
+ setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: newChilds })));
625
+ };
626
+ function resetBackgroundCellRef() {
627
+ Object.values(cellsRef.current).forEach(r => {
628
+ if (r.current) {
629
+ r.current.style.background = 'unset';
630
+ }
631
+ });
632
+ }
633
+ const upSelect = (idx, cell) => {
634
+ // console.log('up select', idx, cell);
635
+ if (selectRef.current &&
636
+ selectEndRef.current &&
637
+ gridRef.current &&
638
+ selectRef.current.idx !== selectEndRef.current.idx &&
639
+ (selectEndRef.current.cell.rowEnd > selectRef.current.cell.rowEnd ||
640
+ selectEndRef.current.cell.colEnd > selectRef.current.cell.colEnd)) {
641
+ resetBackgroundCellRef();
642
+ // console.log('merge', selectRef.current, selectEndRef.current)
643
+ const { cell: cellStart, idx: idxStart } = selectRef.current;
644
+ const { cell: cellEnd, idx: idxEnd, hCells } = selectEndRef.current;
645
+ const newChilds = JSON.parse(JSON.stringify(gridRef.current.childs));
646
+ newChilds[idxStart].rowEnd = cellEnd.rowEnd;
647
+ newChilds[idxStart].colEnd = cellEnd.colEnd;
648
+ delete newChilds[idxStart].sizeX;
649
+ delete newChilds[idxStart].sizeY;
650
+ hCells.reverse().forEach(i => {
651
+ if (i !== idxStart) {
652
+ newChilds.splice(i, 1);
653
+ delete cellsRef.current[i];
654
+ delete cordinatesRef.current[i];
655
+ // console.log('del corr', i, cordinatesRef.current)
656
+ }
657
+ });
658
+ setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
659
+ }
660
+ selectRef.current = null;
661
+ selectEndRef.current = null;
662
+ };
663
+ const hoverSelect = (idx, cell) => {
664
+ if (selectRef.current && gridRef.current) {
665
+ // console.log('hover select', idx, cell);
666
+ const { cell: cellStart, idx: idxStart } = selectRef.current;
667
+ const hCells = [];
668
+ gridRef.current.childs.forEach((child, i) => {
669
+ if (child.rowStart >= cellStart.rowStart &&
670
+ child.rowEnd <= cell.rowEnd &&
671
+ child.colStart >= cellStart.colStart &&
672
+ child.colEnd <= cell.colEnd) {
673
+ hCells.push(i);
674
+ }
675
+ });
676
+ // console.log('hCells', hCells)
677
+ resetBackgroundCellRef();
678
+ hCells.forEach(i => {
679
+ const cellRef = cellsRef.current[i];
680
+ if (cellRef && cellRef.current) {
681
+ cellRef.current.style.background = selectColor || 'unset';
682
+ }
683
+ });
684
+ selectEndRef.current = { cell, idx, hCells };
685
+ gridRef.current = grid;
686
+ }
687
+ };
688
+ const setRef = (idx, ref) => {
689
+ cellsRef.current[idx] = ref;
690
+ // console.log('cellsRef.current', cellsRef.current)
691
+ };
692
+ const setCordinate = (idx) => __awaiter(void 0, void 0, void 0, function* () {
693
+ // while(!cellsRef[idx]) {
694
+ // await new Promise(r => {setTimeout(r, 100)});
695
+ // console.log('wait', idx, cellsRef[idx])
696
+ // }
697
+ var _b;
698
+ if (containerRef.current) {
699
+ const container = containerRef.current.getBoundingClientRect();
700
+ const childRef = cellsRef.current[idx];
701
+ const childBox = (_b = childRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
702
+ if (childBox) {
703
+ const cordinate = {
704
+ width: childBox.width,
705
+ height: childBox.height,
706
+ x: childBox.x - container.x,
707
+ y: childBox.y - container.y,
708
+ xEnd: childBox.x - container.x + childBox.width,
709
+ yEnd: childBox.y - container.y + childBox.height,
710
+ };
711
+ cordinatesRef.current[idx] = cordinate;
712
+ // console.log('set cor', idx, cordinate);
713
+ }
714
+ }
715
+ // console.log('set corr', idx, cordinatesRef.current)
716
+ });
717
+ const renderGrid = (style) => {
718
+ const { gridTemplateColumns, gridTemplateRows, childs } = grid;
719
+ // console.log('grid', { gridTemplateColumns, gridTemplateRows, childs });
720
+ return (React.createElement("div", { className: "grid-container", ref: containerRef, style: Object.assign({ gridTemplateColumns: gridTemplateColumns.map(fr => `${fr}%`).join(' '), gridTemplateRows: gridTemplateRows.map(fr => `${fr}%`).join(' ') }, style) }, childs.map((cell, idx) => (React.createElement(Cell, { key: `${cell.rowStart}-${cell.colStart}-${cell.rowEnd}-${cell.colEnd}`, idx: idx, cell: cell, down: handleDown, downCell: handleDownCell, up: handleUp, setRef: setRef, setCordinate: setCordinate, downSelect: downSelect, upSelect: upSelect, hoverSelect: hoverSelect, unMerge: unMerge, renderCell: renderCell, borderStyle: cellBorder, style: cellStyle, activeStyle: cellActiveStyle, isPreview: isPreview, rowPercentage: grid.gridTemplateRows[cell.rowStart - 1], colPercentage: grid.gridTemplateColumns[cell.colStart - 1], ctrlKeyRef: ctrlKeyRef })))));
721
+ };
722
+ const handleUpLine = () => {
723
+ lineVertical(false);
724
+ lineHorizontal(false);
725
+ };
726
+ const _a = containerStyle || {}, { borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderStyle, borderColor } = _a, rest = __rest(_a, ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderStyle", "borderColor"]);
727
+ const renderLines = () => (React.createElement(React.Fragment, null,
728
+ React.createElement(StyledLine, { ref: verticalLineRef, className: "vertical", onMouseUp: handleUpLine }),
729
+ React.createElement(StyledLine, { ref: horizontalLineRef, className: "horizontal", onMouseUp: handleUpLine })));
730
+ return (React.createElement(StyledGrid, { className: "grid-wrapper", isCompact: !!isCompact },
731
+ React.createElement("div", { className: "layers", ref: layersRef },
732
+ React.createElement(StyledBGLayer, { style: {
733
+ backgroundImage: image ? `url(${image})` : 'unset',
734
+ backgroundSize: imageSize === 'fill' ? '100% 100%' : imageSize,
735
+ backgroundPosition: imagePosition,
736
+ } }),
737
+ React.createElement(StyledMiddleLayer, { style: {
738
+ borderTopLeftRadius,
739
+ borderTopRightRadius,
740
+ borderBottomRightRadius,
741
+ borderBottomLeftRadius,
742
+ borderTopWidth,
743
+ borderRightWidth,
744
+ borderBottomWidth,
745
+ borderLeftWidth,
746
+ borderStyle,
747
+ borderColor,
748
+ } }),
749
+ renderGrid(Object.assign(Object.assign({}, rest), { borderTopLeftRadius,
750
+ borderTopRightRadius,
751
+ borderBottomRightRadius,
752
+ borderBottomLeftRadius }))),
753
+ renderLines()));
754
+ };
755
+ ResizeGrid.defaultProps = defaultProps;