@antscorp/antsomi-ui 1.3.5-beta.4 → 1.3.5-beta.41

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 (284) hide show
  1. package/es/assets/images/background/skeleton-background.png +0 -0
  2. package/es/assets/images/profile.png +0 -0
  3. package/es/assets/images/skeleton_bg.png +0 -0
  4. package/es/assets/images/tail.png +0 -0
  5. package/es/assets/svg/mobile-frame.svg +3 -0
  6. package/es/components/atoms/MobileFrame/MobileFrame.d.ts +2 -0
  7. package/es/components/atoms/MobileFrame/MobileFrame.js +1 -1
  8. package/es/components/atoms/MobileFrame/styled.d.ts +2 -1
  9. package/es/components/atoms/MobileFrame/styled.js +11 -6
  10. package/es/components/atoms/SlideBar/SlideBar.js +3 -1
  11. package/es/components/atoms/Spin/Spin.js +2 -2
  12. package/es/components/common/ConfigProvider/ConfigProvider.d.ts +1 -1
  13. package/es/components/common/ConfigProvider/ConfigProvider.js +9 -4
  14. package/es/components/common/ConfigProvider/GlobalStyle.js +85 -16
  15. package/es/components/molecules/CalendarSelection/CalendarSelection.d.ts +3 -0
  16. package/es/components/molecules/CalendarSelection/CalendarSelection.js +45 -0
  17. package/es/components/molecules/CalendarSelection/actions.d.ts +55 -0
  18. package/es/components/molecules/CalendarSelection/actions.js +39 -0
  19. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.d.ts +7 -0
  20. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.js +24 -0
  21. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.d.ts +1 -0
  22. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.js +1 -0
  23. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.d.ts +1 -0
  24. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +10 -0
  25. package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.d.ts +3 -0
  26. package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.js +108 -0
  27. package/es/components/molecules/CalendarSelection/components/CustomPicker/index.d.ts +1 -0
  28. package/es/components/molecules/CalendarSelection/components/CustomPicker/index.js +1 -0
  29. package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.d.ts +6 -0
  30. package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +152 -0
  31. package/es/components/molecules/CalendarSelection/components/CustomPicker/types.d.ts +1 -0
  32. package/es/components/molecules/CalendarSelection/components/Footer/Footer.d.ts +2 -0
  33. package/es/components/molecules/CalendarSelection/components/Footer/Footer.js +11 -0
  34. package/es/components/molecules/CalendarSelection/components/Footer/index.d.ts +1 -0
  35. package/es/components/molecules/CalendarSelection/components/Footer/index.js +1 -0
  36. package/es/components/molecules/CalendarSelection/components/Footer/styled.d.ts +1 -0
  37. package/es/components/molecules/CalendarSelection/components/Footer/styled.js +6 -0
  38. package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.d.ts +5 -0
  39. package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.js +4 -0
  40. package/es/components/molecules/CalendarSelection/components/RangePicker/index.d.ts +1 -0
  41. package/es/components/molecules/CalendarSelection/components/RangePicker/index.js +1 -0
  42. package/es/components/molecules/CalendarSelection/components/RangePicker/styled.d.ts +5 -0
  43. package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +13 -0
  44. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.d.ts +3 -0
  45. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.js +23 -0
  46. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.d.ts +2 -0
  47. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.js +41 -0
  48. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.d.ts +1 -0
  49. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.js +1 -0
  50. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.d.ts +11 -0
  51. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +40 -0
  52. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.d.ts +1 -0
  53. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.js +1 -0
  54. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.d.ts +1 -0
  55. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.js +29 -0
  56. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.d.ts +2 -0
  57. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.js +2 -0
  58. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.d.ts +1 -0
  59. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.js +1 -0
  60. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.d.ts +3 -0
  61. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +34 -0
  62. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.d.ts +1 -0
  63. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.js +1 -0
  64. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.d.ts +8 -0
  65. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js +49 -0
  66. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.d.ts +2 -0
  67. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.js +2 -0
  68. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.d.ts +1 -0
  69. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +70 -0
  70. package/es/components/molecules/CalendarSelection/components/index.d.ts +5 -0
  71. package/es/components/molecules/CalendarSelection/components/index.js +5 -0
  72. package/es/components/molecules/CalendarSelection/constants.d.ts +97 -0
  73. package/es/components/molecules/CalendarSelection/constants.js +183 -0
  74. package/es/components/molecules/CalendarSelection/context.d.ts +4 -0
  75. package/es/components/molecules/CalendarSelection/context.js +6 -0
  76. package/es/components/molecules/CalendarSelection/hooks/index.d.ts +2 -0
  77. package/es/components/molecules/CalendarSelection/hooks/index.js +2 -0
  78. package/es/components/molecules/CalendarSelection/hooks/useStateContext.d.ts +4 -0
  79. package/es/components/molecules/CalendarSelection/hooks/useStateContext.js +13 -0
  80. package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.d.ts +9 -0
  81. package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.js +19 -0
  82. package/es/components/molecules/CalendarSelection/index.d.ts +25 -0
  83. package/es/components/molecules/CalendarSelection/index.js +6 -0
  84. package/es/components/molecules/CalendarSelection/reducer.d.ts +3 -0
  85. package/es/components/molecules/CalendarSelection/reducer.js +121 -0
  86. package/es/components/molecules/CalendarSelection/styled.d.ts +6 -0
  87. package/es/components/molecules/CalendarSelection/styled.js +13 -0
  88. package/es/components/molecules/CalendarSelection/types.d.ts +98 -0
  89. package/es/components/molecules/CalendarSelection/types.js +1 -0
  90. package/es/components/molecules/CalendarSelection/utils.d.ts +52 -0
  91. package/es/components/molecules/CalendarSelection/utils.js +304 -0
  92. package/es/components/molecules/ColorPicker/CustomPicker/index.js +3 -3
  93. package/es/components/molecules/ColorPicker/index.d.ts +1 -0
  94. package/es/components/molecules/ColorPicker/index.js +3 -2
  95. package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +24 -16
  96. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +5 -0
  97. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +31 -1
  98. package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +1 -1
  99. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +3 -1
  100. package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +5 -4
  101. package/es/components/molecules/ModalV2/styled.js +4 -0
  102. package/es/components/molecules/ResizeGrid/ResizeGrid.js +10 -2
  103. package/es/components/molecules/ResizeGrid/types.d.ts +1 -0
  104. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +1 -0
  105. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +2 -2
  106. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +1 -0
  107. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +3 -2
  108. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +1 -0
  109. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +1 -1
  110. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +7 -0
  111. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +25 -6
  112. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +5 -0
  113. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +31 -0
  114. package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +2 -2
  115. package/es/components/molecules/ShareAccess/index.d.ts +2 -3
  116. package/es/components/molecules/ShareAccess/index.js +2 -3
  117. package/es/components/molecules/ShareAccess/types.d.ts +2 -0
  118. package/es/components/molecules/ShareAccess/utils.d.ts +2 -1
  119. package/es/components/molecules/ShareAccess/utils.js +9 -0
  120. package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +71 -0
  121. package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +172 -0
  122. package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.d.ts +10 -0
  123. package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.js +50 -0
  124. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +18 -0
  125. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +57 -0
  126. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.d.ts +1 -0
  127. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.js +1 -0
  128. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.d.ts +5 -0
  129. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +197 -0
  130. package/es/components/molecules/TemplateSaveAs/components/index.d.ts +1 -0
  131. package/es/components/molecules/TemplateSaveAs/components/index.js +1 -0
  132. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +52 -0
  133. package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +107 -0
  134. package/es/components/molecules/TemplateSaveAs/index.d.ts +4 -0
  135. package/es/components/molecules/TemplateSaveAs/index.js +3 -0
  136. package/es/components/molecules/TemplateSaveAs/styled.d.ts +4 -0
  137. package/es/components/molecules/TemplateSaveAs/styled.js +73 -0
  138. package/es/components/molecules/ThumbnailCard/ThumbnailCard.d.ts +3 -0
  139. package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +72 -0
  140. package/es/components/molecules/ThumbnailCard/constants.d.ts +3 -0
  141. package/es/components/molecules/ThumbnailCard/constants.js +3 -0
  142. package/es/components/molecules/ThumbnailCard/index.d.ts +2 -0
  143. package/es/components/molecules/ThumbnailCard/index.js +2 -0
  144. package/es/components/molecules/ThumbnailCard/styled.d.ts +1 -0
  145. package/es/components/{template/TemplateListing/components/TemplateItem → molecules/ThumbnailCard}/styled.js +14 -7
  146. package/es/components/molecules/ThumbnailCard/types.d.ts +23 -0
  147. package/es/components/molecules/ThumbnailCard/types.js +1 -0
  148. package/es/components/molecules/UploadImage/index.js +1 -1
  149. package/es/components/molecules/index.d.ts +5 -0
  150. package/es/components/molecules/index.js +3 -0
  151. package/es/components/organism/Help/Help.js +30 -1
  152. package/es/components/organism/Menu/Menu.d.ts +2 -0
  153. package/es/components/organism/Menu/Menu.js +3 -0
  154. package/es/components/organism/Menu/index.d.ts +1 -0
  155. package/es/components/organism/Menu/index.js +3 -0
  156. package/es/components/organism/PreviewTemplateModal/components/Banner/index.d.ts +3 -0
  157. package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +13 -0
  158. package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +4 -0
  159. package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +98 -0
  160. package/es/components/organism/PreviewTemplateModal/components/Information/index.d.ts +3 -0
  161. package/es/components/organism/PreviewTemplateModal/components/Information/index.js +29 -0
  162. package/es/components/organism/PreviewTemplateModal/components/Information/styled.d.ts +2 -0
  163. package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +41 -0
  164. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.d.ts +3 -0
  165. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +29 -0
  166. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.d.ts +2 -0
  167. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +12 -0
  168. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.d.ts +6 -0
  169. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.js +77 -0
  170. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.d.ts +3 -0
  171. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +62 -0
  172. package/es/components/organism/PreviewTemplateModal/components/index.d.ts +4 -0
  173. package/es/components/organism/PreviewTemplateModal/components/index.js +4 -0
  174. package/es/components/organism/PreviewTemplateModal/constants/dataSample.d.ts +2 -0
  175. package/es/components/organism/PreviewTemplateModal/constants/dataSample.js +9 -0
  176. package/es/components/organism/PreviewTemplateModal/constants/defaultProps.d.ts +8 -0
  177. package/es/components/organism/PreviewTemplateModal/constants/defaultProps.js +11 -0
  178. package/es/components/organism/PreviewTemplateModal/constants/html.d.ts +1 -0
  179. package/es/components/organism/PreviewTemplateModal/constants/html.js +1 -0
  180. package/es/components/organism/PreviewTemplateModal/constants/index.d.ts +4 -0
  181. package/es/components/organism/PreviewTemplateModal/constants/index.js +4 -0
  182. package/es/components/organism/PreviewTemplateModal/constants/variables.d.ts +12 -0
  183. package/es/components/organism/PreviewTemplateModal/constants/variables.js +12 -0
  184. package/es/components/organism/PreviewTemplateModal/index.d.ts +3 -0
  185. package/es/components/organism/PreviewTemplateModal/index.js +34 -0
  186. package/es/components/organism/PreviewTemplateModal/styled.d.ts +4 -0
  187. package/es/components/organism/PreviewTemplateModal/styled.js +26 -0
  188. package/es/components/organism/PreviewTemplateModal/types.d.ts +39 -0
  189. package/es/components/organism/PreviewTemplateModal/types.js +1 -0
  190. package/es/components/organism/index.d.ts +1 -0
  191. package/es/components/organism/index.js +1 -0
  192. package/es/components/template/TemplateListing/Loadable.d.ts +6 -0
  193. package/es/components/template/TemplateListing/Loadable.js +7 -0
  194. package/es/components/template/TemplateListing/components/BlankTemplate/index.js +9 -7
  195. package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +2 -0
  196. package/es/components/template/TemplateListing/components/CategoryListing/index.js +19 -10
  197. package/es/components/template/TemplateListing/components/CategoryListing/styled.d.ts +2 -0
  198. package/es/components/template/TemplateListing/components/CategoryListing/styled.js +44 -7
  199. package/es/components/template/TemplateListing/components/CategoryListing/types.d.ts +2 -1
  200. package/es/components/template/TemplateListing/components/Empty/index.d.ts +3 -0
  201. package/es/components/template/TemplateListing/components/Empty/index.js +18 -0
  202. package/es/components/template/TemplateListing/components/Empty/styled.d.ts +3 -0
  203. package/es/components/template/TemplateListing/components/Empty/styled.js +35 -0
  204. package/es/components/template/TemplateListing/components/index.d.ts +1 -1
  205. package/es/components/template/TemplateListing/components/index.js +1 -1
  206. package/es/components/template/TemplateListing/constants/defaultProps.d.ts +8 -4
  207. package/es/components/template/TemplateListing/constants/defaultProps.js +9 -6
  208. package/es/components/template/TemplateListing/hooks/index.d.ts +1 -0
  209. package/es/components/template/TemplateListing/hooks/index.js +1 -0
  210. package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +62 -0
  211. package/es/components/template/TemplateListing/hooks/useTemplateListing.js +226 -0
  212. package/es/components/template/TemplateListing/index.js +75 -13
  213. package/es/components/template/TemplateListing/styled/index.d.ts +2 -0
  214. package/es/components/template/TemplateListing/styled/index.js +29 -5
  215. package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +3 -2
  216. package/es/components/template/TemplateListing/types/CategoryListing.d.ts +5 -2
  217. package/es/components/template/TemplateListing/types/Empty.d.ts +5 -0
  218. package/es/components/template/TemplateListing/types/Empty.js +1 -0
  219. package/es/components/template/TemplateListing/types/TemplateListing.d.ts +20 -9
  220. package/es/components/template/TemplateListing/types/index.d.ts +0 -1
  221. package/es/components/template/TemplateListing/types/index.js +0 -1
  222. package/es/components/template/index.d.ts +2 -1
  223. package/es/components/template/index.js +5 -1
  224. package/es/constants/datetime.d.ts +8 -0
  225. package/es/constants/datetime.js +1594 -0
  226. package/es/constants/index.d.ts +5 -1
  227. package/es/constants/index.js +5 -1
  228. package/es/constants/queries.d.ts +3 -0
  229. package/es/constants/queries.js +4 -0
  230. package/es/constants/templateListing.d.ts +50 -0
  231. package/es/constants/templateListing.js +52 -0
  232. package/es/constants/theme.js +1 -1
  233. package/es/constants/variables.d.ts +19 -0
  234. package/es/constants/variables.js +19 -0
  235. package/es/hooks/index.d.ts +4 -0
  236. package/es/hooks/index.js +4 -0
  237. package/es/hooks/useEffectOnlyOnce.d.ts +2 -0
  238. package/es/hooks/useEffectOnlyOnce.js +12 -0
  239. package/es/hooks/useForceUpdate.d.ts +1 -0
  240. package/es/hooks/useForceUpdate.js +5 -0
  241. package/es/hooks/useIntersectionObserver.d.ts +57 -0
  242. package/es/hooks/useIntersectionObserver.js +97 -0
  243. package/es/hooks/useListingItemResize.d.ts +12 -0
  244. package/es/hooks/useListingItemResize.js +58 -0
  245. package/es/hooks/useScrollToEnd.d.ts +1 -0
  246. package/es/hooks/useScrollToEnd.js +30 -0
  247. package/es/index.d.ts +3 -0
  248. package/es/index.js +3 -0
  249. package/es/locales/en/translation.json +11 -3
  250. package/es/locales/i18n.d.ts +16 -0
  251. package/es/locales/translations.d.ts +8 -0
  252. package/es/locales/vi/translation.json +9 -1
  253. package/es/models/ObjectTemplate.d.ts +56 -0
  254. package/es/models/ObjectTemplate.js +82 -0
  255. package/es/models/TemplateCategory.d.ts +13 -0
  256. package/es/models/TemplateCategory.js +28 -0
  257. package/es/queries/TemplateListing/index.d.ts +47 -0
  258. package/es/queries/TemplateListing/index.js +98 -0
  259. package/es/queries/index.d.ts +1 -0
  260. package/es/queries/index.js +1 -0
  261. package/es/services/TemplateListing/index.d.ts +65 -0
  262. package/es/services/TemplateListing/index.js +149 -0
  263. package/es/test.js +65 -11
  264. package/es/types/index.d.ts +5 -0
  265. package/es/types/index.js +3 -0
  266. package/es/types/service.d.ts +22 -0
  267. package/es/types/service.js +1 -0
  268. package/es/types/share-access.d.ts +17 -0
  269. package/es/types/share-access.js +1 -0
  270. package/es/types/templateListing.d.ts +13 -0
  271. package/es/types/templateListing.js +1 -0
  272. package/es/types/variables.d.ts +3 -0
  273. package/es/utils/common.d.ts +4 -0
  274. package/es/utils/common.js +34 -0
  275. package/es/utils/index.d.ts +1 -0
  276. package/es/utils/index.js +1 -0
  277. package/es/utils/templateListing.d.ts +2 -0
  278. package/es/utils/templateListing.js +12 -0
  279. package/package.json +6 -1
  280. package/es/components/template/TemplateListing/components/TemplateItem/index.d.ts +0 -3
  281. package/es/components/template/TemplateListing/components/TemplateItem/index.js +0 -53
  282. package/es/components/template/TemplateListing/components/TemplateItem/styled.d.ts +0 -1
  283. package/es/components/template/TemplateListing/types/TemplateItem.d.ts +0 -14
  284. /package/es/components/{template/TemplateListing/types/TemplateItem.js → molecules/CalendarSelection/components/CustomPicker/types.js} +0 -0
@@ -34,7 +34,7 @@ const defaultProps = {
34
34
  selectColor: '#2f79bf80',
35
35
  };
36
36
  export const ResizeGrid = props => {
37
- const { containerStyle, cellBorder, cellStyle, cellActiveStyle, isPreview, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, onChange, delayUpdate, selectColor, } = props;
37
+ const { containerStyle, cellBorder, cellStyle, cellActiveStyle, isPreview, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, onChange, delayUpdate, selectColor, reCalculateFlag, } = props;
38
38
  const [grid, setGrid] = useState(buildGrid(initGrid || GRID_TEMPLATE.GRID_2_3));
39
39
  const startRef = useRef(null);
40
40
  const startCellRef = useRef(null);
@@ -106,7 +106,7 @@ export const ResizeGrid = props => {
106
106
  useEffect(() => {
107
107
  handleChangeGrid();
108
108
  // eslint-disable-next-line react-hooks/exhaustive-deps
109
- }, [grid]);
109
+ }, [grid, reCalculateFlag]);
110
110
  useDeepCompareEffect(() => {
111
111
  // console.log('changed grid', initGrid, acceptUpdateRef.current, initGrid?.rows, initGrid?.cols)
112
112
  // console.log(initRef.current < 2,!initDoneRef.current, acceptUpdateRef.current)
@@ -560,11 +560,15 @@ export const ResizeGrid = props => {
560
560
  };
561
561
  const downSelect = (idx, cell) => {
562
562
  // console.log('dow select', idx, cell);
563
+ if (isPreview)
564
+ return;
563
565
  !cell.active && activeCell({ idx });
564
566
  selectRef.current = { idx, cell };
565
567
  gridRef.current = grid;
566
568
  };
567
569
  const unMerge = (cell, idx) => {
570
+ if (isPreview)
571
+ return;
568
572
  const { colStart, colEnd, rowStart, rowEnd } = cell;
569
573
  if (colStart + 1 === colEnd && rowStart + 1 === rowEnd) {
570
574
  return;
@@ -604,6 +608,8 @@ export const ResizeGrid = props => {
604
608
  });
605
609
  }
606
610
  const upSelect = (idx, cell) => {
611
+ if (isPreview)
612
+ return;
607
613
  // console.log('up select', idx, cell);
608
614
  if (selectRef.current &&
609
615
  selectEndRef.current &&
@@ -634,6 +640,8 @@ export const ResizeGrid = props => {
634
640
  selectEndRef.current = null;
635
641
  };
636
642
  const hoverSelect = (idx, cell) => {
643
+ if (isPreview)
644
+ return;
637
645
  if (selectRef.current && gridRef.current) {
638
646
  // console.log('hover select', idx, cell);
639
647
  const { cell: cellStart, idx: idxStart } = selectRef.current;
@@ -136,6 +136,7 @@ export interface IResizeGridProps {
136
136
  containerStyle?: React.CSSProperties;
137
137
  isCompact?: boolean;
138
138
  delayUpdate?: number;
139
+ reCalculateFlag?: number | boolean;
139
140
  }
140
141
  export type TCordinate = {
141
142
  x: number;
@@ -9,5 +9,6 @@ export interface RichMenuBlockProps {
9
9
  cellActiveIdx?: number;
10
10
  onClickCell?: (cellIdx: number) => void;
11
11
  onChange?: (richMenu: RichMenu, source?: 'user' | 'system') => void;
12
+ reCalculateFlag?: boolean | number;
12
13
  }
13
14
  export declare const RichMenuBlock: React.FC<RichMenuBlockProps>;
@@ -8,7 +8,7 @@ import { RichMenuCell } from './RichMenuCell';
8
8
  import { tryCatchWrapper } from '@antscorp/antsomi-ui/es/utils';
9
9
  const PATH = 'src/app/modules/Dashboard/containers/RichMenu/containers/Design/components/Workspace/components/RichMenuBlock/index.tsx';
10
10
  export const RichMenuBlock = props => {
11
- const { richMenu, layerActive, cellActiveIdx, isPreview, isActionLink = false, onClickCell, onChange, } = props;
11
+ const { richMenu, layerActive, cellActiveIdx, isPreview, isActionLink = false, onClickCell, onChange, reCalculateFlag, } = props;
12
12
  const { gridTemplateCols = [], gridTemplateRows = [], cells = [], uploadMode, image, layoutType, rows, cols, } = richMenu || {};
13
13
  const { imageUrl, imageStyles } = image || {};
14
14
  const grid = {
@@ -45,7 +45,7 @@ export const RichMenuBlock = props => {
45
45
  }
46
46
  }, PATH);
47
47
  const renderCell = (cellInfo, ctx) => (React.createElement(RichMenuCell, { context: ctx, isActionLink: isActionLink, isPreview: isPreview, layerActive: layerActive, cellActiveIdx: cellActiveIdx, cell: cellInfo, isSingleMode: isSingleUploadMode, onClick: handleClickCell }));
48
- return (React.createElement(ResizeGrid, Object.assign({ grid: grid, isPreview: isPreview, containerStyle: imageStyles, isCompact: layoutType === 'compact', renderCell: renderCell, cellActiveStyle: { background: 'rgba(0, 95, 184, 0.5)' }, cellBorder: isSingleUploadMode ? '1px solid rgba(0, 95, 184, 1)' : '1px dotted #000000', onChange: handleGridChange }, Object.assign({}, (isSingleUploadMode && {
48
+ return (React.createElement(ResizeGrid, Object.assign({ grid: grid, isPreview: isPreview, containerStyle: imageStyles, isCompact: layoutType === 'compact', renderCell: renderCell, cellActiveStyle: { background: 'rgba(0, 95, 184, 0.5)' }, cellBorder: isSingleUploadMode ? '1px solid rgba(0, 95, 184, 1)' : '1px dotted #000000', onChange: handleGridChange, reCalculateFlag: reCalculateFlag }, Object.assign({}, (isSingleUploadMode && {
49
49
  image: imageUrl,
50
50
  imagePosition: imageStyles === null || imageStyles === void 0 ? void 0 : imageStyles.objectPosition,
51
51
  imageSize: imageStyles === null || imageStyles === void 0 ? void 0 : imageStyles.objectFit,
@@ -4,6 +4,7 @@ export interface RichMenuChatBarProps extends React.HtmlHTMLAttributes<HTMLDivEl
4
4
  showRichMenu?: boolean;
5
5
  showTypingChat?: boolean;
6
6
  disabled?: boolean;
7
+ size?: 'large' | 'medium';
7
8
  onToggleRichMenu?: (toggle: boolean) => void;
8
9
  onToggleTypingChat?: (toggle: boolean) => void;
9
10
  }
@@ -19,11 +19,12 @@ import { TypingChat } from './TypingChat';
19
19
  const defaultProps = {
20
20
  label: 'Menu',
21
21
  showRichMenu: true,
22
+ size: 'large',
22
23
  showTypingChat: false,
23
24
  };
24
25
  export const RichMenuChatBar = props => {
25
- const { disabled, label, showRichMenu, showTypingChat, className, onToggleRichMenu, onToggleTypingChat = () => { } } = props, restOfProps = __rest(props, ["disabled", "label", "showRichMenu", "showTypingChat", "className", "onToggleRichMenu", "onToggleTypingChat"]);
26
- return (React.createElement(ChatBarWrapper, Object.assign({ "$showRichMenu": showRichMenu, "$showTypingChat": showTypingChat, "$disabled": disabled, className: `antsomi-chat-bar ${className}` }, restOfProps), showTypingChat ? (React.createElement(TypingChat, { onClickMenu: () => onToggleTypingChat(!showTypingChat) })) : (React.createElement(React.Fragment, null,
26
+ const { disabled, label, showRichMenu, showTypingChat, className, size, onToggleRichMenu, onToggleTypingChat = () => { } } = props, restOfProps = __rest(props, ["disabled", "label", "showRichMenu", "showTypingChat", "className", "size", "onToggleRichMenu", "onToggleTypingChat"]);
27
+ return (React.createElement(ChatBarWrapper, Object.assign({ "$showRichMenu": showRichMenu, "$showTypingChat": showTypingChat, "$disabled": disabled, "$size": size, className: `antsomi-chat-bar ${className}` }, restOfProps), showTypingChat ? (React.createElement(TypingChat, { onClickMenu: () => onToggleTypingChat(!showTypingChat) })) : (React.createElement(React.Fragment, null,
27
28
  React.createElement(Icon, { type: "icon-ants-keyboard", className: "icon-keyboard", onClick: () => onToggleTypingChat(!showTypingChat) }),
28
29
  React.createElement(ChatBarMenuBox, { onClick: () => onToggleRichMenu && onToggleRichMenu(!showRichMenu) },
29
30
  React.createElement(Typography.Text, { className: "ants-text-sm" }, label),
@@ -3,6 +3,7 @@ interface ChatBarWrapperProps {
3
3
  $showRichMenu?: boolean;
4
4
  $showTypingChat?: boolean;
5
5
  $disabled?: boolean;
6
+ $size?: 'large' | 'medium';
6
7
  }
7
8
  export declare const ChatBarWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, ChatBarWrapperProps, never>;
8
9
  export declare const ChatBarMenuBox: 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>;
@@ -4,7 +4,7 @@ import styled, { css } from 'styled-components';
4
4
  import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
5
5
  export const ChatBarWrapper = styled(Flex) `
6
6
  position: relative;
7
- height: 84px;
7
+ height: ${props => (props.$size === 'medium' ? 65 : 84)}px;
8
8
  padding: 10px 20px;
9
9
  background-color: #fff;
10
10
  z-index: 10;
@@ -3,8 +3,15 @@ import { RichMenu } from '@antscorp/antsomi-ui/es/types';
3
3
  interface RichMenuMobileViewProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  richMenu: RichMenu;
5
5
  isPreview?: boolean;
6
+ messagePreview?: {
7
+ show?: boolean;
8
+ text?: string;
9
+ };
6
10
  onChangeRichMenu?: (richMenu: RichMenu, source?: 'user' | 'system') => void;
7
11
  onClickCell?: (cellIndex: number) => void;
12
+ size?: 'large' | 'medium';
13
+ backgroundColor?: string;
14
+ reCalculateFlag?: boolean | number;
8
15
  }
9
16
  export declare const RichMenuMobileView: React.FC<RichMenuMobileViewProps>;
10
17
  export {};
@@ -13,14 +13,16 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import React, { useState } from 'react';
14
14
  // Assets
15
15
  import IphoneTopBar from '@antscorp/antsomi-ui/es/assets/images/iphone-top-bar.png';
16
+ import TailMessage from '@antscorp/antsomi-ui/es/assets/images/tail.png';
17
+ import ProfileMessage from '@antscorp/antsomi-ui/es/assets/images/profile.png';
16
18
  // Components
17
19
  import { MobileFrame } from '@antscorp/antsomi-ui/es/components/atoms';
18
20
  import { RichMenuChatBar } from '../RichMenuChatBar';
19
21
  import { RichMenuBlock } from '../RichMenuBlock';
20
22
  // Styles
21
- import { MobileContent, RichMenuWrapper, TopBar } from './styled';
23
+ import { Image, Message, MessageBox, MessageWrapper, Profile, MobileContent, RichMenuWrapper, TopBar, } from './styled';
22
24
  export const RichMenuMobileView = props => {
23
- const { richMenu, className, isPreview, onChangeRichMenu, onClickCell } = props, restOfProps = __rest(props, ["richMenu", "className", "isPreview", "onChangeRichMenu", "onClickCell"]);
25
+ const { richMenu, className, isPreview, onChangeRichMenu, onClickCell, reCalculateFlag, messagePreview, backgroundColor, size } = props, restOfProps = __rest(props, ["richMenu", "className", "isPreview", "onChangeRichMenu", "onClickCell", "reCalculateFlag", "messagePreview", "backgroundColor", "size"]);
24
26
  // State
25
27
  const [state, setState] = useState({
26
28
  showRichMenu: true,
@@ -29,9 +31,26 @@ export const RichMenuMobileView = props => {
29
31
  });
30
32
  // Variables
31
33
  const { showRichMenu, showTypingChat } = state;
32
- return (React.createElement(MobileFrame, Object.assign({ className: `ants-mx-auto ${className}` }, restOfProps),
33
- isPreview && React.createElement(TopBar, { src: IphoneTopBar, width: "100%", height: "auto" }),
34
+ return (React.createElement(MobileFrame, Object.assign({ size: size, backgroundColor: backgroundColor, className: `ants-mx-auto ${className}` }, restOfProps),
35
+ isPreview && (React.createElement(React.Fragment, null,
36
+ React.createElement(TopBar, { src: IphoneTopBar, width: "100%", height: "auto" }),
37
+ (messagePreview === null || messagePreview === void 0 ? void 0 : messagePreview.show) && (React.createElement(MessageBox, null,
38
+ React.createElement(Profile, null,
39
+ React.createElement(Image, { src: ProfileMessage, alt: "profile user" })),
40
+ React.createElement(MessageWrapper, null,
41
+ React.createElement("div", { style: {
42
+ position: 'absolute',
43
+ top: '-5px',
44
+ left: '-10px',
45
+ width: 20,
46
+ height: 20,
47
+ } },
48
+ React.createElement(Image, { src: TailMessage, alt: "tail decorator", style: { objectFit: 'contain' } })),
49
+ React.createElement(Message, null, (messagePreview === null || messagePreview === void 0 ? void 0 : messagePreview.text) ||
50
+ `Antsomi CDP 365 helps businesses decode their customer data, understand the
51
+ nuances of their customer lifecycles, and act on them – 24 hours a day, 365 days a
52
+ year.`)))))),
34
53
  React.createElement(MobileContent, null,
35
- React.createElement(RichMenuWrapper, { "$showRichMenu": showRichMenu && !showTypingChat, "$isPreview": !!isPreview }, richMenu && (React.createElement(RichMenuBlock, { richMenu: richMenu, isPreview: isPreview, onChange: onChangeRichMenu, onClickCell: onClickCell }))),
36
- React.createElement(RichMenuChatBar, { disabled: !isPreview, label: richMenu === null || richMenu === void 0 ? void 0 : richMenu.chatBar.label, showRichMenu: showRichMenu, showTypingChat: showTypingChat, onToggleRichMenu: showRichMenu => setState(prevState => (Object.assign(Object.assign({}, prevState), { showRichMenu: !!showRichMenu }))), onToggleTypingChat: showTypingChat => setState(prevState => (Object.assign(Object.assign({}, prevState), { showTypingChat: !!showTypingChat }))) }))));
54
+ React.createElement(RichMenuWrapper, { "$showRichMenu": showRichMenu && !showTypingChat, "$isPreview": !!isPreview }, richMenu && (React.createElement(RichMenuBlock, { richMenu: richMenu, isPreview: isPreview, onChange: onChangeRichMenu, onClickCell: onClickCell, reCalculateFlag: reCalculateFlag }))),
55
+ React.createElement(RichMenuChatBar, { disabled: !isPreview, label: richMenu === null || richMenu === void 0 ? void 0 : richMenu.chatBar.label, size: size, showRichMenu: showRichMenu, showTypingChat: showTypingChat, onToggleRichMenu: showRichMenu => setState(prevState => (Object.assign(Object.assign({}, prevState), { showRichMenu: !!showRichMenu }))), onToggleTypingChat: showTypingChat => setState(prevState => (Object.assign(Object.assign({}, prevState), { showTypingChat: !!showTypingChat }))) }))));
37
56
  };
@@ -4,3 +4,8 @@ export declare const RichMenuWrapper: import("styled-components").StyledComponen
4
4
  $isPreview: boolean;
5
5
  }, never>;
6
6
  export declare const TopBar: import("styled-components").StyledComponent<"img", any, {}, never>;
7
+ export declare const MessageBox: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const Profile: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const Image: import("styled-components").StyledComponent<"img", any, {}, never>;
10
+ export declare const Message: import("styled-components").StyledComponent<"div", any, {}, never>;
11
+ export declare const MessageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,8 @@
1
+ var _a;
1
2
  // Libraries
2
3
  import styled, { css } from 'styled-components';
4
+ // Constants
5
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
6
  export const MobileContent = styled.div `
4
7
  position: absolute;
5
8
  bottom: 0;
@@ -18,3 +21,31 @@ export const RichMenuWrapper = styled.div `
18
21
  `}
19
22
  `;
20
23
  export const TopBar = styled.img ``;
24
+ export const MessageBox = styled.div `
25
+ display: flex;
26
+ gap: 10px;
27
+ margin: 15px 9px 0px 8px;
28
+ `;
29
+ export const Profile = styled.div `
30
+ width: 24px;
31
+ height: 24px;
32
+ `;
33
+ export const Image = styled.img `
34
+ width: 100%;
35
+ height: 100%;
36
+ object-fit: cover;
37
+ `;
38
+ export const Message = styled.div `
39
+ color: rgba(37, 37, 37, 1);
40
+ font-size: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.fontSize}px;
41
+ line-height: 16px;
42
+ `;
43
+ export const MessageWrapper = styled.div `
44
+ position: relative;
45
+ flex: 1;
46
+ padding: 10px;
47
+ background-color: rgba(229, 229, 234, 1);
48
+ border-radius: 15px;
49
+ color: rgba(229, 229, 234, 1);
50
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
51
+ `;
@@ -6,13 +6,13 @@ import { PeopleAccess } from '../PeopleAccess';
6
6
  import { SearchUser } from '../SearchUser';
7
7
  import { StyledLayoutContentRoot } from './styled';
8
8
  export const LayoutContent = (props) => {
9
- const { getUserInfo, allowChangeOnwership = true } = props;
9
+ const { getUserInfo, allowChangeOnwership = true, allowAddUser = true } = props;
10
10
  const { state } = useShareAccess();
11
11
  const { allowEdit, allowView } = state;
12
12
  if (!allowEdit && !allowView)
13
13
  return null;
14
14
  return (React.createElement(StyledLayoutContentRoot, null,
15
- React.createElement(SearchUser, { getUserInfo: getUserInfo }),
15
+ allowAddUser && React.createElement(SearchUser, { getUserInfo: getUserInfo }),
16
16
  React.createElement(PeopleAccess, { allowChangeOnwership: allowChangeOnwership }),
17
17
  React.createElement(GeneralAccess, null),
18
18
  React.createElement(ModalTransferOwnership, null)));
@@ -1,4 +1,3 @@
1
- import * as Constants from './constants';
2
- import * as Utils from './utils';
3
1
  export { ShareAccess } from './ShareAccess';
4
- export { Constants, Utils };
2
+ export * as Constants from './constants';
3
+ export * as Utils from './utils';
@@ -1,4 +1,3 @@
1
- import * as Constants from './constants';
2
- import * as Utils from './utils';
3
1
  export { ShareAccess } from './ShareAccess';
4
- export { Constants, Utils };
2
+ export * as Constants from './constants';
3
+ export * as Utils from './utils';
@@ -8,6 +8,7 @@ export type UserInfo = {
8
8
  user_type: number;
9
9
  ctime: Date;
10
10
  utime: Date;
11
+ [key: string]: any;
11
12
  };
12
13
  export type UserAccessInfo = {
13
14
  userId: number;
@@ -33,6 +34,7 @@ export type ShareAccessProps = {
33
34
  view: number;
34
35
  };
35
36
  accessInfo?: ObjectAccessInfo;
37
+ allowAddUser?: boolean;
36
38
  allowChangeOnwership?: boolean;
37
39
  getUserInfo?(search: string, signal: AbortSignal): Promise<UserInfo[]> | UserInfo[];
38
40
  onChange?: (accessInfo: ObjectAccessInfo) => void;
@@ -1,4 +1,4 @@
1
- import { ObjectAccessInfo } from './types';
1
+ import { ObjectAccessInfo, UserInfo } from './types';
2
2
  export declare const mergePermission: (objectPermissionAllow: boolean, menuPermissionValue: number) => boolean;
3
3
  export declare const composeObjectMenuPermissions: (params: {
4
4
  isPublic: boolean;
@@ -36,3 +36,4 @@ export declare const getActionsByUser: (args: {
36
36
  readonly label: "Remove Access";
37
37
  readonly key: "remove_acess";
38
38
  })[];
39
+ export declare const initAccessInfoDefault: (userInfo: UserInfo) => ObjectAccessInfo;
@@ -1,5 +1,6 @@
1
1
  import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, ROLE_MAPPING, } from './constants';
2
2
  import { remove } from 'lodash';
3
+ import { snakeCaseToCamelCase } from '@antscorp/antsomi-ui/es/utils';
3
4
  export const mergePermission = (objectPermissionAllow, menuPermissionValue) => {
4
5
  const valueMapping = {
5
6
  [`${MENU_PERMISSION.NONE}_false`]: false,
@@ -55,3 +56,11 @@ export const getActionsByUser = (args) => {
55
56
  }
56
57
  return actions.map(actKey => PEOPLE_ACTIONS[actKey]);
57
58
  };
59
+ export const initAccessInfoDefault = (userInfo) => ({
60
+ ownerId: userInfo.user_id,
61
+ listAccess: [
62
+ Object.assign(Object.assign({}, snakeCaseToCamelCase(userInfo)), { role: ROLE_MAPPING.OWNER, allowView: 1, allowEdit: 1, allowComment: 1 }),
63
+ ],
64
+ publicRole: PUBLIC_ROLE.ONLY_VIEWER,
65
+ isPublic: 0,
66
+ });
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import type { FormInstance, SelectProps } from 'antd';
3
+ import { ShareAccessProps } from '../ShareAccess/types';
4
+ export type categoriesProps = Array<{
5
+ label: string | React.ReactNode;
6
+ key: string | number;
7
+ children: Array<{
8
+ label: string | React.ReactNode;
9
+ key: string | number;
10
+ }>;
11
+ }>;
12
+ export interface TemplateValueOptions {
13
+ saveOption?: string;
14
+ templateName?: {
15
+ id?: string | number;
16
+ label?: string;
17
+ };
18
+ description?: string;
19
+ defaultThumbnail?: number;
20
+ categories?: categoriesProps;
21
+ accessInfo?: ShareAccessProps['accessInfo'];
22
+ }
23
+ export interface ImagePreviewOptions {
24
+ thumbnails: (string | undefined)[];
25
+ isLoading?: boolean;
26
+ skeleton?: boolean;
27
+ previewNavigation?: boolean;
28
+ slidesPerView?: number;
29
+ hideThumbnailsList?: boolean;
30
+ hideDefaultButton?: boolean;
31
+ label?: string;
32
+ }
33
+ export interface TemplateSaveAsProps {
34
+ className?: string;
35
+ shareAccess: Omit<{
36
+ show: boolean;
37
+ } & ShareAccessProps, 'accessInfo' | 'onChange'>;
38
+ imageReview: ImagePreviewOptions;
39
+ saveOptions?: {
40
+ saveNewText?: string;
41
+ saveExistText?: string;
42
+ saveNewValue?: string;
43
+ saveExistValue?: string;
44
+ };
45
+ categories?: categoriesProps;
46
+ /**
47
+ * Hide categories with following key
48
+ */
49
+ omitCategories?: string[];
50
+ templateNames: Array<{
51
+ label: string;
52
+ id: string | number;
53
+ }>;
54
+ templateNamesOptions?: {
55
+ label?: string;
56
+ isLoading?: boolean;
57
+ searchValue?: string;
58
+ defaultNewTemplateName?: string;
59
+ onSearch?: SelectProps['onSearch'];
60
+ onNamePopupScroll?: SelectProps['onPopupScroll'];
61
+ };
62
+ descriptionOptions?: {
63
+ label?: string;
64
+ placeholder?: string;
65
+ };
66
+ form?: FormInstance<any>;
67
+ value?: TemplateValueOptions;
68
+ onChange?: (value: Partial<TemplateValueOptions>, errors?: any[]) => void;
69
+ onEvent?: (value: Partial<TemplateValueOptions>) => void;
70
+ }
71
+ export declare const TemplateSaveAs: React.FC<TemplateSaveAsProps>;
@@ -0,0 +1,172 @@
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
+ // Libraries
13
+ import React, { useState } from 'react';
14
+ import { Dropdown, Form } from 'antd';
15
+ import dayjs from 'dayjs';
16
+ // Components
17
+ import { Tooltip, Button, Flex, Input, Typography, Select, ShareAccess, RadioGroup, Radio, Space, Spin, } from '@antscorp/antsomi-ui/es/components';
18
+ // Styles
19
+ import { TemplateSaveAsStyled } from './styled';
20
+ import { ImageSlider } from './components';
21
+ const { Text } = Typography;
22
+ export const TemplateSaveAs = props => {
23
+ const { className, shareAccess, saveOptions, imageReview, categories, omitCategories, templateNames, templateNamesOptions, descriptionOptions, form, value, onChange, onEvent,
24
+ // onNamePopupScroll,
25
+ } = props;
26
+ const { show: isShowShareAccess } = shareAccess, shareAccessProps = __rest(shareAccess, ["show"]);
27
+ const { thumbnails, isLoading: isLoadingThumbnail, skeleton, previewNavigation, slidesPerView, hideThumbnailsList, hideDefaultButton, label: imageReviewLabel, } = imageReview;
28
+ const { isLoading, searchValue, label: templateLabel, defaultNewTemplateName, onSearch, onNamePopupScroll, } = templateNamesOptions || {};
29
+ const { label: descriptionLabel, placeholder: descriptionPlaceholder } = descriptionOptions || {};
30
+ const { saveNewText = 'Save as a new media Template', saveExistText = 'Save as an existing media Template', saveNewValue = 'save-new', saveExistValue = 'save-exist', } = saveOptions || {};
31
+ const { saveOption = saveNewValue, templateName: defaultTemplateName, description: defaultTemplateDesc, defaultThumbnail = 0, categories: categoriesValue = [], accessInfo, } = value || {};
32
+ const [templateName, setTemplateName] = useState(defaultNewTemplateName || `Untitled Media Template#${dayjs().format('YYYY-MM-DD HH:mm:ss')}`);
33
+ const [templateNameExist, setTemplateNameExist] = useState((defaultTemplateName === null || defaultTemplateName === void 0 ? void 0 : defaultTemplateName.id) ? defaultTemplateName : templateNames === null || templateNames === void 0 ? void 0 : templateNames[0]);
34
+ const handleChangeValue = (newValue) => {
35
+ var _a, _b;
36
+ if (onEvent) {
37
+ onEvent(newValue);
38
+ }
39
+ if (onChange) {
40
+ onChange(Object.assign(Object.assign(Object.assign({}, value), newValue), {
41
+ // TODO: return saveOption and templateName generate default value if not pass as value props
42
+ defaultThumbnail: newValue.defaultThumbnail || defaultThumbnail, saveOption: !(value === null || value === void 0 ? void 0 : value.saveOption) && !newValue.saveOption
43
+ ? saveOption
44
+ : newValue.saveOption || (value === null || value === void 0 ? void 0 : value.saveOption), templateName: !defaultTemplateName && !newValue.templateName
45
+ ? saveOption === saveNewValue
46
+ ? { id: undefined, label: templateName }
47
+ : templateNameExist
48
+ : newValue.templateName || defaultTemplateName }), (_b = (_a = form === null || form === void 0 ? void 0 : form.getFieldsError()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.errors);
49
+ }
50
+ };
51
+ const handleAddCategory = ({ parent, parentKey, item, }) => {
52
+ const currCategory = categoriesValue.find(category => category.label === parent);
53
+ if (currCategory) {
54
+ currCategory.children.push(item);
55
+ const newCategoryList = categoriesValue.filter(item => item.label !== currCategory.label);
56
+ const newCategory = [...newCategoryList, currCategory];
57
+ handleChangeValue({ categories: newCategory });
58
+ }
59
+ else {
60
+ const newCategory = [...categoriesValue, { label: parent, key: parentKey, children: [item] }];
61
+ handleChangeValue({ categories: newCategory });
62
+ }
63
+ };
64
+ const handleRemoveCategory = ({ parent, item, }) => {
65
+ const currCategory = categoriesValue.find(category => category.label === parent);
66
+ if (!currCategory)
67
+ return;
68
+ const newChildren = currCategory.children.filter(child => child.label !== item.label);
69
+ const newCategoryList = categoriesValue.filter(child => child.label !== currCategory.label);
70
+ handleChangeValue({
71
+ categories: [...newCategoryList, Object.assign(Object.assign({}, currCategory), { children: newChildren })],
72
+ });
73
+ };
74
+ return (React.createElement(Form, { form: form, initialValues: {
75
+ 'template-name': defaultNewTemplateName ||
76
+ `Untitled Media Template#${dayjs().format('YYYY-MM-DD HH:mm:ss')}`,
77
+ } },
78
+ React.createElement(TemplateSaveAsStyled, { className: className || '', vertical: true },
79
+ React.createElement(Flex, { className: "save-options-container" },
80
+ React.createElement(RadioGroup, { value: saveOption, onChange: e => handleChangeValue({
81
+ saveOption: e.target.value,
82
+ templateName: e.target.value === saveNewValue
83
+ ? { id: undefined, label: templateName }
84
+ : templateNameExist,
85
+ }) },
86
+ React.createElement(Radio, { value: saveNewValue }, saveNewText),
87
+ React.createElement(Radio, { value: saveExistValue }, saveExistText))),
88
+ React.createElement(Flex, null,
89
+ React.createElement(Flex, { vertical: true, gap: 20, className: "template-container" },
90
+ React.createElement(Flex, { className: "field-container" },
91
+ React.createElement(Text, { className: "field-title field-title--middle" },
92
+ templateLabel || 'Template name',
93
+ " ",
94
+ React.createElement("span", null, " *")),
95
+ saveOption === saveNewValue ? (React.createElement(Form.Item, { name: "template-name", validateTrigger: "onChange", noStyle: true, rules: [{ required: true }] },
96
+ React.createElement(Input, { debounce: 1000, className: "field-input", value: templateName, onAfterChange: value => {
97
+ handleChangeValue({ templateName: { id: undefined, label: value } });
98
+ setTemplateName(value);
99
+ }, required: true }))) : (React.createElement(Select, { className: "field-input", showSearch: true, searchValue: searchValue, onSearch: onSearch, onPopupScroll: onNamePopupScroll, filterOption: false, dropdownRender: menu => (React.createElement(React.Fragment, null,
100
+ isLoading && templateNames.length === 0 ? null : menu,
101
+ isLoading ? (React.createElement(Space, { style: {
102
+ padding: '4px 0',
103
+ width: '100%',
104
+ justifyContent: 'center',
105
+ alignItems: 'center',
106
+ } },
107
+ React.createElement(Spin, { size: "small" }))) : null)), value: templateNameExist === null || templateNameExist === void 0 ? void 0 : templateNameExist.id, options: (templateNames === null || templateNames === void 0 ? void 0 : templateNames.length) > 0
108
+ ? templateNames.map(item => ({ value: item.id, label: item.label }))
109
+ : [], onChange: value => {
110
+ var _a, _b;
111
+ handleChangeValue({
112
+ templateName: {
113
+ id: value,
114
+ label: ((_a = templateNames.find(item => item.id === value)) === null || _a === void 0 ? void 0 : _a.label) || '',
115
+ },
116
+ });
117
+ setTemplateNameExist({
118
+ id: value,
119
+ label: ((_b = templateNames.find(item => item.id === value)) === null || _b === void 0 ? void 0 : _b.label) || '',
120
+ });
121
+ } }))),
122
+ React.createElement(Flex, { className: "field-container" },
123
+ React.createElement(Text, { className: "field-title field-title--middle" }, descriptionLabel || 'Description'),
124
+ React.createElement(Input, { placeholder: descriptionPlaceholder || 'Describe your media template', className: "field-input", value: defaultTemplateDesc, debounce: 1000, onAfterChange: value => handleChangeValue({ description: value }) })),
125
+ React.createElement(Flex, { className: "field-container" },
126
+ React.createElement(Text, { className: "field-title" },
127
+ imageReviewLabel || 'Thumbnail template',
128
+ " ",
129
+ React.createElement("span", null, "*")),
130
+ React.createElement(ImageSlider, { thumbnails: thumbnails, isLoading: isLoadingThumbnail, skeleton: skeleton, previewNavigation: previewNavigation, slidesPerView: slidesPerView, defaultThumbnail: defaultThumbnail, onSelectDefault: value => handleChangeValue({ defaultThumbnail: value }), hideThumbnailsList: hideThumbnailsList, hideDefaultButton: hideDefaultButton })), categories === null || categories === void 0 ? void 0 :
131
+ categories.map(parentCategory => {
132
+ var _a, _b, _c;
133
+ const selectedChildren = (_a = categoriesValue
134
+ .find(item => item.label === parentCategory.label)) === null || _a === void 0 ? void 0 : _a.children.map(item => item.label);
135
+ const remainChildren = parentCategory.children.filter(item => !(selectedChildren === null || selectedChildren === void 0 ? void 0 : selectedChildren.includes(item.label)));
136
+ const formatData = remainChildren.map((item, idx) => ({
137
+ label: item.label,
138
+ key: idx,
139
+ }));
140
+ // NOTE: filter to remove device and template categories
141
+ if ((omitCategories === null || omitCategories === void 0 ? void 0 : omitCategories.length) && omitCategories.includes(parentCategory.key.toString()))
142
+ return null;
143
+ return (React.createElement(Flex, { key: parentCategory.key, className: "field-container" },
144
+ React.createElement(Text, { className: "field-title" }, parentCategory.label),
145
+ React.createElement(Flex, { wrap: "wrap", gap: 10, className: "category-container" },
146
+ /* selectedCategory */
147
+ (_b = categoriesValue
148
+ .find(item => item.label === parentCategory.label)) === null || _b === void 0 ? void 0 :
149
+ _b.children.map(selectedItem => (React.createElement(Flex, { key: selectedItem.key, className: "selected-category", justify: "space-between", align: "center" },
150
+ React.createElement(Tooltip, { title: selectedItem.label },
151
+ React.createElement(Text, { ellipsis: true, style: { textOverflow: 'ellipsis' } }, selectedItem.label)),
152
+ ' ',
153
+ React.createElement("span", { className: "remove-btn", onClick: () => handleRemoveCategory({
154
+ parent: parentCategory.label,
155
+ item: selectedItem,
156
+ }) }, "\u00D7")))),
157
+ React.createElement(Dropdown, { menu: {
158
+ items: formatData,
159
+ onClick: ({ key }) => {
160
+ handleAddCategory({
161
+ parent: parentCategory.label,
162
+ parentKey: parentCategory.key,
163
+ item: remainChildren[key],
164
+ });
165
+ },
166
+ }, getPopupContainer: triggerNode => triggerNode.parentElement, trigger: ['click'] }, typeof parentCategory.label === 'string' ? (React.createElement(Button, null,
167
+ "+ Add ", (_c = parentCategory.label) === null || _c === void 0 ? void 0 :
168
+ _c.toLowerCase())) : (parentCategory.label)))));
169
+ })),
170
+ isShowShareAccess ? (React.createElement("div", { className: "share-access-container" },
171
+ React.createElement(ShareAccess, Object.assign({ accessInfo: accessInfo, onChange: value => handleChangeValue({ accessInfo: value }) }, shareAccessProps)))) : null))));
172
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ModalV2Props } from '../ModalV2';
3
+ import { TemplateSaveAsProps, TemplateValueOptions } from './TemplateSaveAs';
4
+ interface TemplateSaveAsModalProps extends ModalV2Props {
5
+ templateProps: TemplateSaveAsProps;
6
+ defaultValue?: TemplateValueOptions;
7
+ onOk?: (e: React.MouseEvent<HTMLButtonElement>, value?: TemplateValueOptions) => void;
8
+ }
9
+ export declare const TemplateSaveAsModal: React.FC<TemplateSaveAsModalProps>;
10
+ export {};