@antscorp/antsomi-ui 1.3.3-beta.26 → 1.3.3-beta.28

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