@antscorp/antsomi-ui 1.3.5-beta.7 → 1.3.5-beta.71

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 (327) hide show
  1. package/es/assets/images/background/skeleton-background.png +0 -0
  2. package/es/assets/images/components/PreviewModal/Banner/skeletonBackground.png +0 -0
  3. package/es/assets/images/components/PreviewModal/Information/buttonText.png +0 -0
  4. package/es/assets/images/components/PreviewModal/Information/clickButton.png +0 -0
  5. package/es/assets/images/components/PreviewModal/Information/description.png +0 -0
  6. package/es/assets/images/components/PreviewModal/Information/deviceRadio.png +0 -0
  7. package/es/assets/images/components/PreviewModal/Information/itemName.png +0 -0
  8. package/es/assets/images/components/PreviewModal/banner.png +0 -0
  9. package/es/assets/images/components/PreviewModal/information.png +0 -0
  10. package/es/assets/images/components/PreviewModal/similarTemplate.png +0 -0
  11. package/es/assets/images/components/PreviewModal/thumbnails.png +0 -0
  12. package/es/assets/images/components/TemplateListing/blankTemplate.png +0 -0
  13. package/es/assets/images/components/TemplateListing/categoryListing.png +0 -0
  14. package/es/assets/images/components/TemplateListing/empty.png +0 -0
  15. package/es/assets/images/components/TemplateListing/previewModal.png +0 -0
  16. package/es/assets/images/components/TemplateListing/templateItem.png +0 -0
  17. package/es/assets/images/components/TemplateListing/templates.png +0 -0
  18. package/es/assets/images/profile.png +0 -0
  19. package/es/assets/images/skeleton_bg.png +0 -0
  20. package/es/assets/images/tail.png +0 -0
  21. package/es/assets/svg/mobile-frame.svg +3 -0
  22. package/es/components/atoms/MobileFrame/MobileFrame.d.ts +2 -0
  23. package/es/components/atoms/MobileFrame/MobileFrame.js +1 -1
  24. package/es/components/atoms/MobileFrame/styled.d.ts +2 -1
  25. package/es/components/atoms/MobileFrame/styled.js +11 -6
  26. package/es/components/atoms/SlideBar/SlideBar.js +1 -1
  27. package/es/components/atoms/Spin/Spin.js +2 -2
  28. package/es/components/common/ConfigProvider/ConfigProvider.js +4 -3
  29. package/es/components/common/ConfigProvider/GlobalStyle.js +85 -16
  30. package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +3 -2
  31. package/es/components/molecules/CalendarSelection/CalendarSelection.d.ts +3 -0
  32. package/es/components/molecules/CalendarSelection/CalendarSelection.js +45 -0
  33. package/es/components/molecules/CalendarSelection/actions.d.ts +55 -0
  34. package/es/components/molecules/CalendarSelection/actions.js +39 -0
  35. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.d.ts +7 -0
  36. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.js +24 -0
  37. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.d.ts +1 -0
  38. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.js +1 -0
  39. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.d.ts +1 -0
  40. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +10 -0
  41. package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.d.ts +3 -0
  42. package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.js +108 -0
  43. package/es/components/molecules/CalendarSelection/components/CustomPicker/index.d.ts +1 -0
  44. package/es/components/molecules/CalendarSelection/components/CustomPicker/index.js +1 -0
  45. package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.d.ts +6 -0
  46. package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +152 -0
  47. package/es/components/molecules/CalendarSelection/components/CustomPicker/types.d.ts +1 -0
  48. package/es/components/molecules/CalendarSelection/components/CustomPicker/types.js +1 -0
  49. package/es/components/molecules/CalendarSelection/components/Footer/Footer.d.ts +2 -0
  50. package/es/components/molecules/CalendarSelection/components/Footer/Footer.js +11 -0
  51. package/es/components/molecules/CalendarSelection/components/Footer/index.d.ts +1 -0
  52. package/es/components/molecules/CalendarSelection/components/Footer/index.js +1 -0
  53. package/es/components/molecules/CalendarSelection/components/Footer/styled.d.ts +1 -0
  54. package/es/components/molecules/CalendarSelection/components/Footer/styled.js +6 -0
  55. package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.d.ts +5 -0
  56. package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.js +4 -0
  57. package/es/components/molecules/CalendarSelection/components/RangePicker/index.d.ts +1 -0
  58. package/es/components/molecules/CalendarSelection/components/RangePicker/index.js +1 -0
  59. package/es/components/molecules/CalendarSelection/components/RangePicker/styled.d.ts +5 -0
  60. package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +13 -0
  61. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.d.ts +3 -0
  62. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.js +23 -0
  63. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.d.ts +2 -0
  64. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.js +41 -0
  65. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.d.ts +1 -0
  66. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.js +1 -0
  67. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.d.ts +11 -0
  68. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +40 -0
  69. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.d.ts +1 -0
  70. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.js +1 -0
  71. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.d.ts +1 -0
  72. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.js +29 -0
  73. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.d.ts +2 -0
  74. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.js +2 -0
  75. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.d.ts +1 -0
  76. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.js +1 -0
  77. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.d.ts +3 -0
  78. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +34 -0
  79. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.d.ts +1 -0
  80. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.js +1 -0
  81. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.d.ts +8 -0
  82. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js +49 -0
  83. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.d.ts +2 -0
  84. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.js +2 -0
  85. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.d.ts +1 -0
  86. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +70 -0
  87. package/es/components/molecules/CalendarSelection/components/index.d.ts +5 -0
  88. package/es/components/molecules/CalendarSelection/components/index.js +5 -0
  89. package/es/components/molecules/CalendarSelection/constants.d.ts +97 -0
  90. package/es/components/molecules/CalendarSelection/constants.js +183 -0
  91. package/es/components/molecules/CalendarSelection/context.d.ts +4 -0
  92. package/es/components/molecules/CalendarSelection/context.js +6 -0
  93. package/es/components/molecules/CalendarSelection/hooks/index.d.ts +2 -0
  94. package/es/components/molecules/CalendarSelection/hooks/index.js +2 -0
  95. package/es/components/molecules/CalendarSelection/hooks/useStateContext.d.ts +4 -0
  96. package/es/components/molecules/CalendarSelection/hooks/useStateContext.js +13 -0
  97. package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.d.ts +9 -0
  98. package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.js +19 -0
  99. package/es/components/molecules/CalendarSelection/index.d.ts +25 -0
  100. package/es/components/molecules/CalendarSelection/index.js +6 -0
  101. package/es/components/molecules/CalendarSelection/reducer.d.ts +3 -0
  102. package/es/components/molecules/CalendarSelection/reducer.js +121 -0
  103. package/es/components/molecules/CalendarSelection/styled.d.ts +6 -0
  104. package/es/components/molecules/CalendarSelection/styled.js +13 -0
  105. package/es/components/molecules/CalendarSelection/types.d.ts +98 -0
  106. package/es/components/molecules/CalendarSelection/types.js +1 -0
  107. package/es/components/molecules/CalendarSelection/utils.d.ts +52 -0
  108. package/es/components/molecules/CalendarSelection/utils.js +304 -0
  109. package/es/components/molecules/ColorPicker/CustomPicker/index.js +3 -3
  110. package/es/components/molecules/ColorPicker/index.d.ts +1 -0
  111. package/es/components/molecules/ColorPicker/index.js +3 -2
  112. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +20 -16
  113. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +3 -0
  114. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +23 -0
  115. package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +1 -1
  116. package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +2 -2
  117. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +1 -0
  118. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +3 -3
  119. package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.js +2 -2
  120. package/es/components/molecules/ModalV2/styled.js +4 -0
  121. package/es/components/molecules/ResizeGrid/ResizeGrid.js +10 -2
  122. package/es/components/molecules/ResizeGrid/types.d.ts +1 -0
  123. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +1 -0
  124. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +2 -2
  125. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +1 -0
  126. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +4 -3
  127. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +1 -0
  128. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +1 -1
  129. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +7 -0
  130. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +25 -6
  131. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +5 -0
  132. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +31 -0
  133. package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.js +2 -2
  134. package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +1 -0
  135. package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +2 -2
  136. package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +1 -1
  137. package/es/components/molecules/ShareAccess/index.d.ts +2 -3
  138. package/es/components/molecules/ShareAccess/index.js +2 -3
  139. package/es/components/molecules/ShareAccess/types.d.ts +2 -0
  140. package/es/components/molecules/ShareAccess/utils.d.ts +2 -1
  141. package/es/components/molecules/ShareAccess/utils.js +9 -0
  142. package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +79 -0
  143. package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +184 -0
  144. package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.d.ts +10 -0
  145. package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.js +50 -0
  146. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +20 -0
  147. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +57 -0
  148. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.d.ts +1 -0
  149. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.js +1 -0
  150. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.d.ts +9 -0
  151. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +182 -0
  152. package/es/components/molecules/TemplateSaveAs/components/index.d.ts +1 -0
  153. package/es/components/molecules/TemplateSaveAs/components/index.js +1 -0
  154. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +65 -0
  155. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +121 -0
  156. package/es/components/molecules/TemplateSaveAs/index.d.ts +4 -0
  157. package/es/components/molecules/TemplateSaveAs/index.js +3 -0
  158. package/es/components/molecules/TemplateSaveAs/styled.d.ts +4 -0
  159. package/es/components/molecules/TemplateSaveAs/styled.js +73 -0
  160. package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +29 -13
  161. package/es/components/molecules/ThumbnailCard/constants.d.ts +2 -2
  162. package/es/components/molecules/ThumbnailCard/constants.js +2 -2
  163. package/es/components/molecules/ThumbnailCard/styled.js +2 -1
  164. package/es/components/molecules/ThumbnailCard/types.d.ts +12 -6
  165. package/es/components/molecules/UploadImage/index.js +1 -1
  166. package/es/components/molecules/index.d.ts +3 -0
  167. package/es/components/molecules/index.js +2 -0
  168. package/es/components/organism/Help/Help.js +30 -1
  169. package/es/components/organism/Menu/Menu.d.ts +2 -0
  170. package/es/components/organism/Menu/Menu.js +2 -0
  171. package/es/components/organism/Menu/index.d.ts +1 -0
  172. package/es/components/organism/Menu/index.js +1 -0
  173. package/es/components/organism/PreviewTemplateModal/components/Banner/index.d.ts +3 -0
  174. package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +13 -0
  175. package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +4 -0
  176. package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +98 -0
  177. package/es/components/organism/PreviewTemplateModal/components/Information/index.d.ts +3 -0
  178. package/es/components/organism/PreviewTemplateModal/components/Information/index.js +29 -0
  179. package/es/components/organism/PreviewTemplateModal/components/Information/styled.d.ts +2 -0
  180. package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +41 -0
  181. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.d.ts +3 -0
  182. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +32 -0
  183. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.d.ts +2 -0
  184. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +12 -0
  185. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.d.ts +6 -0
  186. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.js +77 -0
  187. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.d.ts +3 -0
  188. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +62 -0
  189. package/es/components/organism/PreviewTemplateModal/components/index.d.ts +4 -0
  190. package/es/components/organism/PreviewTemplateModal/components/index.js +4 -0
  191. package/es/components/organism/PreviewTemplateModal/constants/dataSample.d.ts +2 -0
  192. package/es/components/organism/PreviewTemplateModal/constants/dataSample.js +9 -0
  193. package/es/components/organism/PreviewTemplateModal/constants/defaultProps.d.ts +8 -0
  194. package/es/components/organism/PreviewTemplateModal/constants/defaultProps.js +12 -0
  195. package/es/components/organism/PreviewTemplateModal/constants/html.d.ts +1 -0
  196. package/es/components/organism/PreviewTemplateModal/constants/html.js +1 -0
  197. package/es/components/organism/PreviewTemplateModal/constants/index.d.ts +4 -0
  198. package/es/components/organism/PreviewTemplateModal/constants/index.js +4 -0
  199. package/es/components/organism/PreviewTemplateModal/constants/variables.d.ts +12 -0
  200. package/es/components/organism/PreviewTemplateModal/constants/variables.js +12 -0
  201. package/es/components/organism/PreviewTemplateModal/index.d.ts +3 -0
  202. package/es/components/organism/PreviewTemplateModal/index.js +34 -0
  203. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/BannerPropsTable/index.d.ts +2 -0
  204. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/BannerPropsTable/index.js +34 -0
  205. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/DataTypeTable/index.d.ts +2 -0
  206. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/DataTypeTable/index.js +62 -0
  207. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/InformationPropsTable/index.d.ts +2 -0
  208. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/InformationPropsTable/index.js +76 -0
  209. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/SimilarTemplatePropsTable/index.d.ts +2 -0
  210. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/SimilarTemplatePropsTable/index.js +40 -0
  211. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/TThumbnailTable/index.d.ts +2 -0
  212. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/TThumbnailTable/index.js +30 -0
  213. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/ThumbnailPropsTable/index.d.ts +2 -0
  214. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/ThumbnailPropsTable/index.js +46 -0
  215. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/index.d.ts +6 -0
  216. package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/index.js +6 -0
  217. package/es/components/organism/PreviewTemplateModal/styled.d.ts +4 -0
  218. package/es/components/organism/PreviewTemplateModal/styled.js +26 -0
  219. package/es/components/organism/PreviewTemplateModal/types.d.ts +38 -0
  220. package/es/components/organism/PreviewTemplateModal/types.js +1 -0
  221. package/es/components/organism/index.d.ts +1 -0
  222. package/es/components/organism/index.js +1 -0
  223. package/es/components/template/TemplateListing/Loadable.d.ts +6 -0
  224. package/es/components/template/TemplateListing/Loadable.js +7 -0
  225. package/es/components/template/TemplateListing/components/BlankTemplate/index.js +3 -1
  226. package/es/components/template/TemplateListing/components/CategoryListing/index.js +19 -10
  227. package/es/components/template/TemplateListing/components/CategoryListing/styled.d.ts +2 -0
  228. package/es/components/template/TemplateListing/components/CategoryListing/styled.js +50 -8
  229. package/es/components/template/TemplateListing/components/Empty/index.d.ts +3 -0
  230. package/es/components/template/TemplateListing/components/Empty/index.js +18 -0
  231. package/es/components/template/TemplateListing/components/Empty/styled.d.ts +3 -0
  232. package/es/components/template/TemplateListing/components/Empty/styled.js +35 -0
  233. package/es/components/template/TemplateListing/components/index.d.ts +1 -0
  234. package/es/components/template/TemplateListing/components/index.js +1 -0
  235. package/es/components/template/TemplateListing/constants/defaultProps.d.ts +5 -3
  236. package/es/components/template/TemplateListing/constants/defaultProps.js +8 -7
  237. package/es/components/template/TemplateListing/hooks/index.d.ts +1 -0
  238. package/es/components/template/TemplateListing/hooks/index.js +1 -0
  239. package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +62 -0
  240. package/es/components/template/TemplateListing/hooks/useTemplateListing.js +230 -0
  241. package/es/components/template/TemplateListing/index.js +75 -14
  242. package/es/components/template/TemplateListing/stories/dataTypes/components/BlankTemplatePropsTable/index.d.ts +2 -0
  243. package/es/components/template/TemplateListing/stories/dataTypes/components/BlankTemplatePropsTable/index.js +46 -0
  244. package/es/components/template/TemplateListing/stories/dataTypes/components/CategoryListingPropsTable/index.d.ts +2 -0
  245. package/es/components/template/TemplateListing/stories/dataTypes/components/CategoryListingPropsTable/index.js +57 -0
  246. package/es/components/template/TemplateListing/stories/dataTypes/components/DataTypeTables/index.d.ts +2 -0
  247. package/es/components/template/TemplateListing/stories/dataTypes/components/DataTypeTables/index.js +78 -0
  248. package/es/components/template/TemplateListing/stories/dataTypes/components/EmptyPropsTable/index.d.ts +2 -0
  249. package/es/components/template/TemplateListing/stories/dataTypes/components/EmptyPropsTable/index.js +30 -0
  250. package/es/components/template/TemplateListing/stories/dataTypes/components/TCategoryItemTable/index.d.ts +2 -0
  251. package/es/components/template/TemplateListing/stories/dataTypes/components/TCategoryItemTable/index.js +46 -0
  252. package/es/components/template/TemplateListing/stories/dataTypes/components/TTemplateItemTable/index.d.ts +2 -0
  253. package/es/components/template/TemplateListing/stories/dataTypes/components/TTemplateItemTable/index.js +38 -0
  254. package/es/components/template/TemplateListing/stories/dataTypes/components/TemplatesPropsTable/index.d.ts +2 -0
  255. package/es/components/template/TemplateListing/stories/dataTypes/components/TemplatesPropsTable/index.js +50 -0
  256. package/es/components/template/TemplateListing/stories/dataTypes/components/index.d.ts +7 -0
  257. package/es/components/template/TemplateListing/stories/dataTypes/components/index.js +7 -0
  258. package/es/components/template/TemplateListing/stories/demo/styled.d.ts +1 -0
  259. package/es/components/template/TemplateListing/stories/demo/styled.js +7 -0
  260. package/es/components/template/TemplateListing/styled/index.d.ts +1 -0
  261. package/es/components/template/TemplateListing/styled/index.js +24 -5
  262. package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +1 -1
  263. package/es/components/template/TemplateListing/types/CategoryListing.d.ts +5 -2
  264. package/es/components/template/TemplateListing/types/Empty.d.ts +5 -0
  265. package/es/components/template/TemplateListing/types/Empty.js +1 -0
  266. package/es/components/template/TemplateListing/types/TemplateListing.d.ts +16 -6
  267. package/es/components/template/index.d.ts +2 -1
  268. package/es/components/template/index.js +5 -1
  269. package/es/constants/datetime.d.ts +8 -0
  270. package/es/constants/datetime.js +1594 -0
  271. package/es/constants/index.d.ts +5 -1
  272. package/es/constants/index.js +5 -1
  273. package/es/constants/queries.d.ts +4 -0
  274. package/es/constants/queries.js +5 -0
  275. package/es/constants/templateListing.d.ts +50 -0
  276. package/es/constants/templateListing.js +52 -0
  277. package/es/constants/theme.js +1 -1
  278. package/es/constants/variables.d.ts +19 -0
  279. package/es/constants/variables.js +19 -0
  280. package/es/hooks/index.d.ts +4 -0
  281. package/es/hooks/index.js +4 -0
  282. package/es/hooks/useEffectOnlyOnce.d.ts +2 -0
  283. package/es/hooks/useEffectOnlyOnce.js +12 -0
  284. package/es/hooks/useForceUpdate.d.ts +1 -0
  285. package/es/hooks/useForceUpdate.js +5 -0
  286. package/es/hooks/useIntersectionObserver.d.ts +57 -0
  287. package/es/hooks/useIntersectionObserver.js +97 -0
  288. package/es/hooks/useListingItemResize.d.ts +12 -0
  289. package/es/hooks/useListingItemResize.js +58 -0
  290. package/es/hooks/useScrollToEnd.d.ts +1 -0
  291. package/es/hooks/useScrollToEnd.js +30 -0
  292. package/es/index.d.ts +3 -0
  293. package/es/index.js +3 -0
  294. package/es/locales/en/translation.json +9 -1
  295. package/es/locales/i18n.d.ts +16 -0
  296. package/es/locales/translations.d.ts +8 -0
  297. package/es/locales/vi/translation.json +9 -1
  298. package/es/models/ObjectTemplate.d.ts +56 -0
  299. package/es/models/ObjectTemplate.js +82 -0
  300. package/es/models/TemplateCategory.d.ts +13 -0
  301. package/es/models/TemplateCategory.js +28 -0
  302. package/es/queries/CustomFunction/useCustomFunction.js +35 -35
  303. package/es/queries/TemplateListing/index.d.ts +52 -0
  304. package/es/queries/TemplateListing/index.js +105 -0
  305. package/es/queries/index.d.ts +1 -0
  306. package/es/queries/index.js +1 -0
  307. package/es/services/TemplateListing/index.d.ts +70 -0
  308. package/es/services/TemplateListing/index.js +161 -0
  309. package/es/test.js +65 -11
  310. package/es/types/index.d.ts +5 -0
  311. package/es/types/index.js +3 -0
  312. package/es/types/service.d.ts +22 -0
  313. package/es/types/service.js +1 -0
  314. package/es/types/share-access.d.ts +18 -0
  315. package/es/types/share-access.js +1 -0
  316. package/es/types/templateListing.d.ts +13 -0
  317. package/es/types/templateListing.js +1 -0
  318. package/es/types/variables.d.ts +3 -0
  319. package/es/utils/common.d.ts +4 -0
  320. package/es/utils/common.js +38 -0
  321. package/es/utils/commonComponent.d.ts +7 -0
  322. package/es/utils/commonComponent.js +28 -0
  323. package/es/utils/index.d.ts +1 -0
  324. package/es/utils/index.js +1 -0
  325. package/es/utils/templateListing.d.ts +2 -0
  326. package/es/utils/templateListing.js +12 -0
  327. package/package.json +6 -1
@@ -1,22 +1,52 @@
1
+ var _a, _b;
1
2
  import styled from 'styled-components';
3
+ import { Typography } from '../../../../atoms';
4
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
5
+ const { Text } = Typography;
2
6
  export const MenuWrapper = styled.div `
7
+ flex-shrink: 0;
3
8
  width: ${({ $width }) => ($width !== undefined ? `${$width}px` : 'auto')};
4
9
  overflow: auto;
10
+ overflow-x: hidden;
11
+ border-right: 1px solid rgba(5, 5, 5, 0.06);
5
12
 
6
- .antsomi-menu {
7
- height: 100%;
13
+ .antsomi-menu,
14
+ .ant-menu {
15
+ [role='menuitem'] {
16
+ width: 100%;
17
+ border-radius: 0;
18
+ height: 30px;
19
+ padding: 0 10px !important;
20
+ margin-left: 0 !important;
21
+ margin-right: 0 !important;
8
22
 
9
- .antsomi-menu-submenu {
10
- .antsomi-menu-submenu-title,
11
- .antsomi-menu-item {
12
- padding-left: 10px;
23
+ .antsomi-menu-title-content,
24
+ .ant-menu-title-content {
25
+ height: 100%;
13
26
  }
14
27
  }
28
+
29
+ .antsomi-menu-submenu-title,
30
+ .ant-menu-submenu-title {
31
+ height: 30px !important;
32
+ }
33
+ }
34
+
35
+ .category-loading {
36
+ height: 100%;
37
+ }
38
+
39
+ .empty-wrapper {
40
+ width: 100%;
41
+ height: 100%;
42
+ box-sizing: border-box;
15
43
  }
16
44
  `;
17
45
  export const CustomLabelStyled = styled.div `
18
46
  display: flex;
19
47
  justify-content: space-between;
48
+ height: 100%;
49
+ align-items: center;
20
50
 
21
51
  .label {
22
52
  flex: 1 1 0%;
@@ -44,12 +74,24 @@ export const CustomLabelStyled = styled.div `
44
74
  flex-shrink: 0;
45
75
  font-size: 11px;
46
76
  font-weight: 400;
47
- color: #595959;
77
+ color: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.bw8};
78
+ line-height: 1 !important;
79
+ height: fit-content;
48
80
  }
49
81
  `;
50
82
  // TODO: tách class dùng chung
51
83
  export const CustomRootLabel = styled.div `
52
84
  font-size: 11px;
53
85
  font-weight: 400;
54
- color: #595959;
86
+ color: ${(_b = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _b === void 0 ? void 0 : _b.bw8};
87
+ height: 100%;
88
+ display: flex;
89
+ align-items: center;
90
+ padding-right: 20px;
91
+ `;
92
+ export const TextWrapper = styled(Text) `
93
+ max-width: 100%;
94
+ color: inherit;
95
+ height: fit-content;
96
+ font-size: inherit;
55
97
  `;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { EmptyProps } from '@antscorp/antsomi-ui/es/components/template/TemplateListing/types/Empty';
3
+ export declare const Empty: React.FC<EmptyProps>;
@@ -0,0 +1,18 @@
1
+ // Libraries
2
+ import React from 'react';
3
+ // Components
4
+ import { Icon } from '@antscorp/antsomi-ui/es/components';
5
+ import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
6
+ // Styled
7
+ import { EmptyIcon, EmptyWrapper } from './styled';
8
+ const { Text } = Typography;
9
+ export const Empty = props => {
10
+ const { icon, description } = props;
11
+ return (React.createElement(EmptyWrapper, null,
12
+ React.createElement(EmptyIcon, { className: "animate__animated animate__tada" }, icon),
13
+ React.createElement(Text, { className: "animate__animated animate__fadeInUp" }, description)));
14
+ };
15
+ Empty.defaultProps = {
16
+ icon: React.createElement(Icon, { type: "icon-ants-media" }),
17
+ description: 'No data',
18
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const EmptyWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
3
+ export declare const EmptyIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,35 @@
1
+ var _a, _b, _c;
2
+ // Libraries
3
+ import styled from 'styled-components';
4
+ // Components
5
+ import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
6
+ // Constants
7
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
8
+ export const EmptyWrapper = styled(Flex) `
9
+ width: 100%;
10
+ height: 100%;
11
+
12
+ .antsomi-typography {
13
+ color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw8};
14
+ }
15
+ `;
16
+ EmptyWrapper.defaultProps = {
17
+ vertical: true,
18
+ align: 'center',
19
+ justify: 'center',
20
+ gap: 15,
21
+ };
22
+ export const EmptyIcon = styled.div `
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ width: 60px;
27
+ height: 60px;
28
+ border-radius: 100%;
29
+ background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw2};
30
+
31
+ i {
32
+ font-size: 24px;
33
+ color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw6};
34
+ }
35
+ `;
@@ -1,2 +1,3 @@
1
1
  export { BlankTemplate } from './BlankTemplate';
2
2
  export { CategoryListing } from './CategoryListing';
3
+ export { Empty } from './Empty';
@@ -1,2 +1,3 @@
1
1
  export { BlankTemplate } from './BlankTemplate';
2
2
  export { CategoryListing } from './CategoryListing';
3
+ export { Empty } from './Empty';
@@ -1,10 +1,12 @@
1
1
  import { ThumbnailCardProps } from '../../../molecules';
2
- import { BlankTemplateProps, CategoryListingProps, TemplateListingProps } from '../types';
3
- export declare const TEMPLATE_ITEM_WIDTH = 200;
4
- export declare const TEMPLATE_ITEM_HEIGHT = 200;
2
+ import { BlankTemplateProps, CategoryListingProps, TemplateListingProps, TemplatesProps } from '../types';
3
+ import { EmptyProps } from '../types/Empty';
5
4
  export declare const CATEGORY_LISTING_WITH = 220;
6
5
  export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
6
+ export declare const LISTING_GAP_DEFAULT = 30;
7
7
  export declare const TEMPLATE_ITEM_DEFAULT: Omit<ThumbnailCardProps, 'id'>;
8
8
  export declare const BLANK_TEMPLATE_DEFAULT: BlankTemplateProps;
9
9
  export declare const CATEGORY_LISTING_DEFAULT: Omit<CategoryListingProps, 'items'>;
10
10
  export declare const TEMPLATE_LISTING_DEFAULT: TemplateListingProps;
11
+ export declare const EMPTY_DEFAULT: EmptyProps;
12
+ export declare const TEMPLATES_DEFAULT: TemplatesProps;
@@ -1,22 +1,23 @@
1
- export const TEMPLATE_ITEM_WIDTH = 200;
2
- export const TEMPLATE_ITEM_HEIGHT = 200;
1
+ /* Variables */
3
2
  export const CATEGORY_LISTING_WITH = 220;
4
3
  export const THUMBNAIL_URL = 'https://st-media-template.antsomi.com/base64-img/37563.png';
4
+ export const LISTING_GAP_DEFAULT = 30;
5
+ /* Default props */
5
6
  export const TEMPLATE_ITEM_DEFAULT = {
6
- width: TEMPLATE_ITEM_WIDTH,
7
- height: TEMPLATE_ITEM_HEIGHT,
8
7
  removable: true,
9
8
  };
10
9
  export const BLANK_TEMPLATE_DEFAULT = { show: false };
11
10
  export const CATEGORY_LISTING_DEFAULT = {
12
11
  width: CATEGORY_LISTING_WITH,
13
- visible: true,
12
+ show: true,
14
13
  checkedCategories: {},
15
14
  onMenuChange: () => { },
16
15
  };
17
16
  export const TEMPLATE_LISTING_DEFAULT = {
18
- templateItems: [],
19
- categoryItems: [],
20
17
  templateItemProps: TEMPLATE_ITEM_DEFAULT,
21
18
  blankTemplateProps: BLANK_TEMPLATE_DEFAULT,
22
19
  };
20
+ export const EMPTY_DEFAULT = {
21
+ description: 'No data',
22
+ };
23
+ export const TEMPLATES_DEFAULT = { items: [] };
@@ -0,0 +1 @@
1
+ export * from './useTemplateListing';
@@ -0,0 +1 @@
1
+ export * from './useTemplateListing';
@@ -0,0 +1,62 @@
1
+ /// <reference types="react" />
2
+ import { TServiceAuth } from '@antscorp/antsomi-ui/es/types';
3
+ import { TCategoryItem, TCheckedCategories, TSelectTemplateAction, TTemplateItem } from '../types';
4
+ import { TTemplateListingConfig } from '@antscorp/antsomi-ui/es/types/templateListing';
5
+ import { TThumbnailCardId } from '../../../molecules/ThumbnailCard';
6
+ import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
7
+ interface TemplateListingOptions {
8
+ serviceAuth: TServiceAuth;
9
+ config: TTemplateListingConfig;
10
+ checkedCategoriesDefault?: TCheckedCategories;
11
+ }
12
+ type TState<T> = {
13
+ checkedCategories: TCheckedCategories;
14
+ openCategoryKeys: string[];
15
+ selectedTemplateId?: TThumbnailCardId;
16
+ selectTemplateAction?: TSelectTemplateAction | T;
17
+ };
18
+ /**
19
+ * Custom React Hook for managing state and data fetching logic related to a template listing.
20
+ *
21
+ * @param {Object} options - The options object for configuring the hook.
22
+ * @param {PayloadInfo} options.service - Payload information for making API requests.
23
+ * @param {TTemplateListingConfig} options.config - Configuration options for the template listing.
24
+ *
25
+ * @returns {Object} - An object containing various properties and functions for template listing management.
26
+ *
27
+ * @property {TCategoryItem[]} categoryItems - An array of category items for rendering the template listing's category structure.
28
+ * @property {TTemplateItem[]} templateItems - An array of template items representing the templates available for the specified configuration.
29
+ * @property {string[]} openCategoryKeys - An array of keys representing the currently open category items in the template listing.
30
+ * @property {TCheckedCategories} checkedCategories - An object containing information about the checked categories in the template listing.
31
+ * @property {boolean} isLoading - A boolean indicating whether data is currently being loaded.
32
+ *
33
+ * @property {Function} onChangeCheckedCategories - A function to update the checked categories in the template listing.
34
+ * @param {TCheckedCategories} checkedCategories - An object containing information about the checked categories.
35
+ *
36
+ * @property {Function} onChangeOpenCategoryKeys - A function to update the open category keys in the template listing.
37
+ * @param {string[]} openKeys - An array of keys representing the currently open category items.
38
+ *
39
+ * @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
40
+ */
41
+ export declare const useTemplateListing: <T = undefined>(options: TemplateListingOptions) => {
42
+ categoryItems: TCategoryItem[];
43
+ templateItems: TTemplateItem[];
44
+ openCategoryKeys: string[];
45
+ similarTemplates: TTemplateItem[];
46
+ templateDetail: import("../../../../models/ObjectTemplate").ObjectTemplate | undefined;
47
+ checkedCategories: TCheckedCategories;
48
+ selectTemplateAction: TSelectTemplateAction | T | undefined;
49
+ previewTemplateCategories: TCategoryItem[];
50
+ isLoadingCategoryList: boolean;
51
+ isLoadingTemplateList: boolean;
52
+ isLoadingTemplateDetail: boolean;
53
+ refetchCategoryList: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<TemplateCategory[], any>>;
54
+ refetchTemplateList: <TPageData_1>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData_1>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@tanstack/query-core").InfiniteData<import("@antscorp/antsomi-ui/es/types").ResponseListing<import("../../../../models/ObjectTemplate").ObjectTemplate>>, any>>;
55
+ onChangeCheckedCategories: (checkedCategories: TCheckedCategories) => void;
56
+ onChangeOpenCategoryKeys: (openKeys: string[]) => void;
57
+ onRemoveObjectTemplate: (id: TThumbnailCardId) => void;
58
+ onLoadMore: () => void;
59
+ onSelectTemplate: (id: TThumbnailCardId, action: TSelectTemplateAction) => void;
60
+ setState: import("react").Dispatch<import("react").SetStateAction<TState<T>>>;
61
+ };
62
+ export {};
@@ -0,0 +1,230 @@
1
+ // Libraries
2
+ import { useCallback, useMemo, useState } from 'react';
3
+ import { App } from 'antd';
4
+ import { isEmpty } from 'lodash';
5
+ import { useGetTemplateCategoryList, useGetObjectTemplateList, useBulkUpdateTemplate, useGetObjectTemplateDetail, } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
6
+ // Locales
7
+ import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
8
+ // Hooks
9
+ import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
10
+ // Constants
11
+ import { CATEGORY_SPLIT_KEY, TEMPLATE_STATUS } from '@antscorp/antsomi-ui/es/constants';
12
+ import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
13
+ import { getShuffleArray } from '@antscorp/antsomi-ui/es/utils';
14
+ /**
15
+ * Custom React Hook for managing state and data fetching logic related to a template listing.
16
+ *
17
+ * @param {Object} options - The options object for configuring the hook.
18
+ * @param {PayloadInfo} options.service - Payload information for making API requests.
19
+ * @param {TTemplateListingConfig} options.config - Configuration options for the template listing.
20
+ *
21
+ * @returns {Object} - An object containing various properties and functions for template listing management.
22
+ *
23
+ * @property {TCategoryItem[]} categoryItems - An array of category items for rendering the template listing's category structure.
24
+ * @property {TTemplateItem[]} templateItems - An array of template items representing the templates available for the specified configuration.
25
+ * @property {string[]} openCategoryKeys - An array of keys representing the currently open category items in the template listing.
26
+ * @property {TCheckedCategories} checkedCategories - An object containing information about the checked categories in the template listing.
27
+ * @property {boolean} isLoading - A boolean indicating whether data is currently being loaded.
28
+ *
29
+ * @property {Function} onChangeCheckedCategories - A function to update the checked categories in the template listing.
30
+ * @param {TCheckedCategories} checkedCategories - An object containing information about the checked categories.
31
+ *
32
+ * @property {Function} onChangeOpenCategoryKeys - A function to update the open category keys in the template listing.
33
+ * @param {string[]} openKeys - An array of keys representing the currently open category items.
34
+ *
35
+ * @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
36
+ */
37
+ export const useTemplateListing = (options) => {
38
+ const { serviceAuth, config, checkedCategoriesDefault } = options;
39
+ const { objectType, categoryCodes, publicLevel, getListType, limitListPerPage = 10 } = config;
40
+ const { message } = App.useApp();
41
+ // Locales
42
+ const { t } = i18nInstance;
43
+ // State
44
+ const [state, setState] = useState({
45
+ checkedCategories: {},
46
+ openCategoryKeys: [],
47
+ });
48
+ const { checkedCategories, openCategoryKeys, selectedTemplateId, selectTemplateAction } = state;
49
+ const { data: categoryList, isLoading: isLoadingCategoryList, refetch: refetchCategoryList, } = useGetTemplateCategoryList({
50
+ args: {
51
+ auth: serviceAuth,
52
+ params: {
53
+ objectTypes: [objectType],
54
+ categoryCodes,
55
+ publicLevel,
56
+ getListType,
57
+ },
58
+ },
59
+ });
60
+ const filter = useDeepCompareMemo(() => {
61
+ const draftFilter = Object.entries(checkedCategories)
62
+ .map(([key, value]) => {
63
+ const category = categoryList === null || categoryList === void 0 ? void 0 : categoryList.find(category => category.categoryCode === key);
64
+ if (category && !isEmpty(value)) {
65
+ return {
66
+ [key.toUpperCase()]: {
67
+ [category.filterOperator || 'matches_any']: value.map(item => +(item.toString().split(CATEGORY_SPLIT_KEY) || [])[1]),
68
+ },
69
+ };
70
+ }
71
+ return {};
72
+ })
73
+ .filter(filter => !isEmpty(filter));
74
+ return draftFilter;
75
+ }, [checkedCategories]);
76
+ // Queries
77
+ const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, } = useGetObjectTemplateList({
78
+ args: {
79
+ auth: serviceAuth,
80
+ params: {
81
+ object_type: objectType,
82
+ public_level: publicLevel,
83
+ get_list_type: getListType,
84
+ limit: limitListPerPage,
85
+ filter: JSON.stringify(filter),
86
+ },
87
+ },
88
+ });
89
+ const { mutateAsync: bulkUpdateTemplate } = useBulkUpdateTemplate({
90
+ options: {
91
+ onSuccess: () => {
92
+ message.success(t(translations.templateListing.removeSuccess));
93
+ },
94
+ onError: () => {
95
+ message.error(t(translations.templateListing.removeFailed));
96
+ },
97
+ },
98
+ });
99
+ const { data: templateDetail, isLoading: isLoadingTemplateDetail = false } = useGetObjectTemplateDetail({
100
+ args: {
101
+ params: {
102
+ template_id: selectedTemplateId || '',
103
+ object_type: objectType,
104
+ public_level: publicLevel,
105
+ },
106
+ auth: serviceAuth,
107
+ },
108
+ options: {
109
+ enabled: !!selectedTemplateId,
110
+ },
111
+ });
112
+ // Variables
113
+ const isLoadingTemplateList = isFetching || isFetchingNextPage;
114
+ // Memo
115
+ const categoryItems = useDeepCompareMemo(() => {
116
+ const recursiveCategory = (categories = [], parentCategoryCode = '') => categories.map(category => {
117
+ const { categoryCode, categoryId, categoryName, children, total } = category;
118
+ const key = Array.isArray(children) && children.length
119
+ ? categoryCode
120
+ : [parentCategoryCode, categoryId].join(CATEGORY_SPLIT_KEY);
121
+ return {
122
+ key,
123
+ label: categoryName,
124
+ total,
125
+ children: recursiveCategory(children || [], categoryCode),
126
+ };
127
+ });
128
+ return recursiveCategory(categoryList || []);
129
+ }, [categoryList]);
130
+ const templateItems = useMemo(() => {
131
+ if (infiniteObjectTemplate) {
132
+ const { pages } = infiniteObjectTemplate;
133
+ return pages.flatMap(({ entities }) => entities.flatMap(({ id, name, thumbnail }) => ({
134
+ id,
135
+ name,
136
+ thumbnail,
137
+ })));
138
+ }
139
+ return [];
140
+ }, [infiniteObjectTemplate]);
141
+ const similarTemplates = useMemo(() => {
142
+ const maxSimilarTemplateLength = 4;
143
+ return (getShuffleArray(templateItems.filter(item => item.id !== selectedTemplateId)).slice(0, maxSimilarTemplateLength) || []);
144
+ }, [templateItems, selectedTemplateId]);
145
+ const previewTemplateCategories = useDeepCompareMemo(() => {
146
+ if ((categoryItems === null || categoryItems === void 0 ? void 0 : categoryItems.length) && !!templateDetail) {
147
+ /**
148
+ * Filter category items has value of object template
149
+ * and filter child items has value of object template
150
+ */
151
+ return categoryItems
152
+ .filter(item => {
153
+ const values = templateDetail.model[item.key];
154
+ return typeof values === 'object' ? !isEmpty(values) : !!values;
155
+ })
156
+ .map(item => {
157
+ var _a;
158
+ return (Object.assign(Object.assign({}, item), { children: (_a = item.children) === null || _a === void 0 ? void 0 : _a.filter(childItem => {
159
+ let values = templateDetail.model[item.key];
160
+ values = Array.isArray(values) ? values : [values];
161
+ return values.includes(+`${childItem.key}`.split(CATEGORY_SPLIT_KEY)[1]);
162
+ }) }));
163
+ });
164
+ }
165
+ return [];
166
+ }, [categoryItems, templateDetail]);
167
+ // Effects
168
+ useDeepCompareEffect(() => {
169
+ setState(prev => (Object.assign(Object.assign({}, prev), { openCategoryKeys: (categoryList === null || categoryList === void 0 ? void 0 : categoryList.map(({ categoryCode }) => categoryCode)) || [] })));
170
+ }, [categoryList]);
171
+ useDeepCompareEffect(() => {
172
+ if (!isEmpty(checkedCategoriesDefault)) {
173
+ setState(prev => (Object.assign(Object.assign({}, prev), { checkedCategories: Object.entries(checkedCategoriesDefault).reduce((acc, curr) => {
174
+ const [key, value] = curr;
175
+ acc[key] = value.map(item => [key, item].join(CATEGORY_SPLIT_KEY));
176
+ return acc;
177
+ }, {}) || {} })));
178
+ }
179
+ }, [checkedCategoriesDefault]);
180
+ // Handles
181
+ const onChangeCheckedCategories = (checkedCategories) => {
182
+ setState(prev => (Object.assign(Object.assign({}, prev), { checkedCategories })));
183
+ };
184
+ const onChangeOpenCategoryKeys = useCallback((openKeys) => {
185
+ setState(prev => (Object.assign(Object.assign({}, prev), { openCategoryKeys: openKeys })));
186
+ }, []);
187
+ const onRemoveObjectTemplate = useCallback((id) => {
188
+ bulkUpdateTemplate({
189
+ auth: serviceAuth,
190
+ params: {
191
+ template_ids: [+id],
192
+ data: {
193
+ status: TEMPLATE_STATUS.REMOVED,
194
+ },
195
+ },
196
+ });
197
+ }, [bulkUpdateTemplate, serviceAuth]);
198
+ const onLoadMore = useCallback(() => {
199
+ if (!isFetchingNextPage && hasNextPage) {
200
+ fetchNextPage();
201
+ }
202
+ }, [fetchNextPage, hasNextPage, isFetchingNextPage]);
203
+ const onSelectTemplate = useCallback((id, action) => {
204
+ setState(prev => (Object.assign(Object.assign({}, prev), { selectedTemplateId: id, selectTemplateAction: action })));
205
+ }, []);
206
+ return {
207
+ // MapKeys
208
+ categoryItems,
209
+ templateItems,
210
+ openCategoryKeys,
211
+ similarTemplates,
212
+ // Values
213
+ templateDetail,
214
+ checkedCategories,
215
+ selectTemplateAction,
216
+ previewTemplateCategories,
217
+ isLoadingCategoryList,
218
+ isLoadingTemplateList,
219
+ isLoadingTemplateDetail: isLoadingTemplateDetail && !!selectedTemplateId,
220
+ // Functions
221
+ refetchCategoryList,
222
+ refetchTemplateList,
223
+ onChangeCheckedCategories,
224
+ onChangeOpenCategoryKeys,
225
+ onRemoveObjectTemplate,
226
+ onLoadMore,
227
+ onSelectTemplate,
228
+ setState,
229
+ };
230
+ };
@@ -1,23 +1,84 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ /* eslint-disable react/function-component-definition */
1
13
  // Libraries
2
- import React, { memo } from 'react';
14
+ import React, { memo, useState } from 'react';
3
15
  // Components
4
- import { CategoryListing, BlankTemplate } from './components';
5
- import { Flex, Typography } from '../../atoms';
6
- import { ThumbnailCard } from '../../molecules';
16
+ import { CategoryListing, BlankTemplate, Empty } from './components';
17
+ import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
18
+ import { ThumbnailCard } from '@antscorp/antsomi-ui/es/components/molecules';
19
+ import { PreviewTemplateModal } from '../../organism/PreviewTemplateModal';
7
20
  // Constants
8
- import { BLANK_TEMPLATE_DEFAULT, TEMPLATE_ITEM_DEFAULT, TEMPLATE_LISTING_DEFAULT, TEMPLATE_ITEM_HEIGHT, TEMPLATE_ITEM_WIDTH, CATEGORY_LISTING_DEFAULT, } from './constants';
21
+ import { BLANK_TEMPLATE_DEFAULT, TEMPLATE_ITEM_DEFAULT, TEMPLATE_LISTING_DEFAULT, CATEGORY_LISTING_DEFAULT, EMPTY_DEFAULT, TEMPLATES_DEFAULT, LISTING_GAP_DEFAULT, } from './constants';
22
+ import { THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH, } from '../../molecules/ThumbnailCard/constants';
9
23
  // Styled
10
- import { TemplateListingWrapper } from './styled';
24
+ import { LoadMoreBlock, TemplateListingWrapper } from './styled';
25
+ // Hooks
26
+ import { useIntersectionObserver, useListingItemResize } from '@antscorp/antsomi-ui/es/hooks';
11
27
  export const TemplateListing = memo(props => {
12
- const { templateItems = [], categoryItems = [], templateItemProps = TEMPLATE_ITEM_DEFAULT, blankTemplateProps = BLANK_TEMPLATE_DEFAULT, categoryListingProps = CATEGORY_LISTING_DEFAULT, } = props;
13
- const { width = TEMPLATE_ITEM_WIDTH, height = TEMPLATE_ITEM_HEIGHT } = templateItemProps;
28
+ // Props
29
+ const { templatesProps = TEMPLATES_DEFAULT, templateItemProps = TEMPLATE_ITEM_DEFAULT, blankTemplateProps = BLANK_TEMPLATE_DEFAULT, categoryListingProps = CATEGORY_LISTING_DEFAULT, emptyProps = EMPTY_DEFAULT, previewModalProps, } = props;
30
+ // States
31
+ const [openPreviewModal, setOpenPreviewModal] = useState(false);
32
+ // Variables
33
+ const { items = [], gap = LISTING_GAP_DEFAULT, loading = false, onLoadMoreTemplates = () => { }, } = templatesProps || {};
34
+ const _a = previewModalProps || {}, { onOk, onCancel } = _a, restOfPreviewModalProps = __rest(_a, ["onOk", "onCancel"]);
35
+ const _b = templateItemProps || {}, { width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, previewBtnProps } = _b, restOfTemplateItemProps = __rest(_b, ["width", "height", "previewBtnProps"]);
36
+ const { onClick: onClickPreview } = previewBtnProps || {};
37
+ const isHasData = items.length > 0;
38
+ // Hooks
39
+ const { ref: containerRef, itemPerRow, ratio, gap: listingGap, } = useListingItemResize({
40
+ gap,
41
+ initialWidth: width || THUMBNAIL_CARD_DEFAULT_WIDTH,
42
+ });
43
+ const { ref: loadMoreRef } = useIntersectionObserver({
44
+ threshold: 0,
45
+ initialIsIntersecting: false,
46
+ onChange(isIntersecting) {
47
+ if (isIntersecting) {
48
+ onLoadMoreTemplates();
49
+ }
50
+ },
51
+ });
52
+ // Handlers
53
+ const handleClickThumbnailPreview = (id) => {
54
+ onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview(id);
55
+ setOpenPreviewModal(true);
56
+ };
57
+ const handleOkPreviewModal = (e) => {
58
+ onOk === null || onOk === void 0 ? void 0 : onOk(e);
59
+ setOpenPreviewModal(false);
60
+ };
61
+ const handleCancelPreviewModal = (e) => {
62
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
63
+ setOpenPreviewModal(false);
64
+ };
14
65
  return (React.createElement(TemplateListingWrapper, null,
15
- React.createElement(CategoryListing, Object.assign({ items: categoryItems }, categoryListingProps, { className: `category-listing ${(categoryListingProps === null || categoryListingProps === void 0 ? void 0 : categoryListingProps.className) || ''}` })),
16
- React.createElement(Flex, { gap: 30, wrap: "wrap", style: { padding: '15px' }, className: "template-listing" },
17
- React.createElement(BlankTemplate, Object.assign({ width: width, height: height }, blankTemplateProps)), templateItems === null || templateItems === void 0 ? void 0 :
18
- templateItems.map(({ key, name, thumbnail }) => (React.createElement(Flex, { key: key, vertical: true, gap: 10 },
19
- React.createElement(ThumbnailCard, Object.assign({ id: key, thumbnail: thumbnail }, templateItemProps)),
20
- React.createElement(Typography.Text, { ellipsis: { tooltip: name }, style: { maxWidth: '100%' } }, name)))))));
66
+ React.createElement(CategoryListing, Object.assign({}, categoryListingProps)),
67
+ React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading template-listing__loading--full" },
68
+ React.createElement("div", { className: "template-listing" },
69
+ React.createElement("div", { ref: containerRef, style: {
70
+ display: 'grid',
71
+ gap: listingGap,
72
+ gridTemplateColumns: `repeat(${itemPerRow}, minmax(0, 1fr))`,
73
+ } },
74
+ React.createElement(BlankTemplate, Object.assign({ width: width * ratio, height: height * ratio }, blankTemplateProps)), items === null || items === void 0 ? void 0 :
75
+ items.map(({ id, name, thumbnail }, index) => (React.createElement("div", { key: id },
76
+ React.createElement(ThumbnailCard, Object.assign({ id: id, name: name, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `animate__animated animate__fadeIn ${templateItemProps.className}`, previewBtnProps: {
77
+ onClick: handleClickThumbnailPreview,
78
+ } }, restOfTemplateItemProps)),
79
+ index === items.length - 1 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }))))),
80
+ !loading && !blankTemplateProps.show && !isHasData && React.createElement(Empty, Object.assign({}, emptyProps)))),
81
+ React.createElement(PreviewTemplateModal, Object.assign({ open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps))));
21
82
  });
22
83
  TemplateListing.displayName = 'TemplateListing';
23
84
  TemplateListing.defaultProps = TEMPLATE_LISTING_DEFAULT;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const BlankTemplatePropsTable: React.FC;