@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.
- package/es/assets/images/background/skeleton-background.png +0 -0
- package/es/assets/images/components/PreviewModal/Banner/skeletonBackground.png +0 -0
- package/es/assets/images/components/PreviewModal/Information/buttonText.png +0 -0
- package/es/assets/images/components/PreviewModal/Information/clickButton.png +0 -0
- package/es/assets/images/components/PreviewModal/Information/description.png +0 -0
- package/es/assets/images/components/PreviewModal/Information/deviceRadio.png +0 -0
- package/es/assets/images/components/PreviewModal/Information/itemName.png +0 -0
- package/es/assets/images/components/PreviewModal/banner.png +0 -0
- package/es/assets/images/components/PreviewModal/information.png +0 -0
- package/es/assets/images/components/PreviewModal/similarTemplate.png +0 -0
- package/es/assets/images/components/PreviewModal/thumbnails.png +0 -0
- package/es/assets/images/components/TemplateListing/blankTemplate.png +0 -0
- package/es/assets/images/components/TemplateListing/categoryListing.png +0 -0
- package/es/assets/images/components/TemplateListing/empty.png +0 -0
- package/es/assets/images/components/TemplateListing/previewModal.png +0 -0
- package/es/assets/images/components/TemplateListing/templateItem.png +0 -0
- package/es/assets/images/components/TemplateListing/templates.png +0 -0
- package/es/assets/images/profile.png +0 -0
- package/es/assets/images/skeleton_bg.png +0 -0
- package/es/assets/images/tail.png +0 -0
- package/es/assets/svg/mobile-frame.svg +3 -0
- package/es/components/atoms/MobileFrame/MobileFrame.d.ts +2 -0
- package/es/components/atoms/MobileFrame/MobileFrame.js +1 -1
- package/es/components/atoms/MobileFrame/styled.d.ts +2 -1
- package/es/components/atoms/MobileFrame/styled.js +11 -6
- package/es/components/atoms/SlideBar/SlideBar.js +1 -1
- package/es/components/atoms/Spin/Spin.js +2 -2
- package/es/components/common/ConfigProvider/ConfigProvider.js +4 -3
- package/es/components/common/ConfigProvider/GlobalStyle.js +85 -16
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +3 -2
- package/es/components/molecules/CalendarSelection/CalendarSelection.d.ts +3 -0
- package/es/components/molecules/CalendarSelection/CalendarSelection.js +45 -0
- package/es/components/molecules/CalendarSelection/actions.d.ts +55 -0
- package/es/components/molecules/CalendarSelection/actions.js +39 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.d.ts +7 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.js +24 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +10 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.d.ts +3 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.js +108 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.d.ts +6 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +152 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/types.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/CustomPicker/types.js +1 -0
- package/es/components/molecules/CalendarSelection/components/Footer/Footer.d.ts +2 -0
- package/es/components/molecules/CalendarSelection/components/Footer/Footer.js +11 -0
- package/es/components/molecules/CalendarSelection/components/Footer/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/Footer/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/Footer/styled.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/Footer/styled.js +6 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.d.ts +5 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.js +4 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.d.ts +5 -0
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +13 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.d.ts +3 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.js +23 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.d.ts +2 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.js +41 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.d.ts +11 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +40 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.js +29 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.d.ts +2 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.js +2 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.js +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.d.ts +3 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +34 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.js +1 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.d.ts +8 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js +49 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.d.ts +2 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.js +2 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.d.ts +1 -0
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +70 -0
- package/es/components/molecules/CalendarSelection/components/index.d.ts +5 -0
- package/es/components/molecules/CalendarSelection/components/index.js +5 -0
- package/es/components/molecules/CalendarSelection/constants.d.ts +97 -0
- package/es/components/molecules/CalendarSelection/constants.js +183 -0
- package/es/components/molecules/CalendarSelection/context.d.ts +4 -0
- package/es/components/molecules/CalendarSelection/context.js +6 -0
- package/es/components/molecules/CalendarSelection/hooks/index.d.ts +2 -0
- package/es/components/molecules/CalendarSelection/hooks/index.js +2 -0
- package/es/components/molecules/CalendarSelection/hooks/useStateContext.d.ts +4 -0
- package/es/components/molecules/CalendarSelection/hooks/useStateContext.js +13 -0
- package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.d.ts +9 -0
- package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.js +19 -0
- package/es/components/molecules/CalendarSelection/index.d.ts +25 -0
- package/es/components/molecules/CalendarSelection/index.js +6 -0
- package/es/components/molecules/CalendarSelection/reducer.d.ts +3 -0
- package/es/components/molecules/CalendarSelection/reducer.js +121 -0
- package/es/components/molecules/CalendarSelection/styled.d.ts +6 -0
- package/es/components/molecules/CalendarSelection/styled.js +13 -0
- package/es/components/molecules/CalendarSelection/types.d.ts +98 -0
- package/es/components/molecules/CalendarSelection/types.js +1 -0
- package/es/components/molecules/CalendarSelection/utils.d.ts +52 -0
- package/es/components/molecules/CalendarSelection/utils.js +304 -0
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +3 -3
- package/es/components/molecules/ColorPicker/index.d.ts +1 -0
- package/es/components/molecules/ColorPicker/index.js +3 -2
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +20 -16
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +3 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +23 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +2 -2
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +1 -0
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +3 -3
- package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.js +2 -2
- package/es/components/molecules/ModalV2/styled.js +4 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +10 -2
- package/es/components/molecules/ResizeGrid/types.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +2 -2
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +4 -3
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +1 -1
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +7 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +25 -6
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +5 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +31 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.js +2 -2
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +1 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +2 -2
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +1 -1
- package/es/components/molecules/ShareAccess/index.d.ts +2 -3
- package/es/components/molecules/ShareAccess/index.js +2 -3
- package/es/components/molecules/ShareAccess/types.d.ts +2 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +2 -1
- package/es/components/molecules/ShareAccess/utils.js +9 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +79 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +184 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.d.ts +10 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.js +50 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +20 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +57 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/index.js +1 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.d.ts +9 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +182 -0
- package/es/components/molecules/TemplateSaveAs/components/index.d.ts +1 -0
- package/es/components/molecules/TemplateSaveAs/components/index.js +1 -0
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +65 -0
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +121 -0
- package/es/components/molecules/TemplateSaveAs/index.d.ts +4 -0
- package/es/components/molecules/TemplateSaveAs/index.js +3 -0
- package/es/components/molecules/TemplateSaveAs/styled.d.ts +4 -0
- package/es/components/molecules/TemplateSaveAs/styled.js +73 -0
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +29 -13
- package/es/components/molecules/ThumbnailCard/constants.d.ts +2 -2
- package/es/components/molecules/ThumbnailCard/constants.js +2 -2
- package/es/components/molecules/ThumbnailCard/styled.js +2 -1
- package/es/components/molecules/ThumbnailCard/types.d.ts +12 -6
- package/es/components/molecules/UploadImage/index.js +1 -1
- package/es/components/molecules/index.d.ts +3 -0
- package/es/components/molecules/index.js +2 -0
- package/es/components/organism/Help/Help.js +30 -1
- package/es/components/organism/Menu/Menu.d.ts +2 -0
- package/es/components/organism/Menu/Menu.js +2 -0
- package/es/components/organism/Menu/index.d.ts +1 -0
- package/es/components/organism/Menu/index.js +1 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +13 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +98 -0
- package/es/components/organism/PreviewTemplateModal/components/Information/index.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/components/Information/index.js +29 -0
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +41 -0
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +32 -0
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +12 -0
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.d.ts +6 -0
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/index.js +77 -0
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +62 -0
- package/es/components/organism/PreviewTemplateModal/components/index.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/components/index.js +4 -0
- package/es/components/organism/PreviewTemplateModal/constants/dataSample.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/constants/dataSample.js +9 -0
- package/es/components/organism/PreviewTemplateModal/constants/defaultProps.d.ts +8 -0
- package/es/components/organism/PreviewTemplateModal/constants/defaultProps.js +12 -0
- package/es/components/organism/PreviewTemplateModal/constants/html.d.ts +1 -0
- package/es/components/organism/PreviewTemplateModal/constants/html.js +1 -0
- package/es/components/organism/PreviewTemplateModal/constants/index.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/constants/index.js +4 -0
- package/es/components/organism/PreviewTemplateModal/constants/variables.d.ts +12 -0
- package/es/components/organism/PreviewTemplateModal/constants/variables.js +12 -0
- package/es/components/organism/PreviewTemplateModal/index.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/index.js +34 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/BannerPropsTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/BannerPropsTable/index.js +34 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/DataTypeTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/DataTypeTable/index.js +62 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/InformationPropsTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/InformationPropsTable/index.js +76 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/SimilarTemplatePropsTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/SimilarTemplatePropsTable/index.js +40 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/TThumbnailTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/TThumbnailTable/index.js +30 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/ThumbnailPropsTable/index.d.ts +2 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/ThumbnailPropsTable/index.js +46 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/index.d.ts +6 -0
- package/es/components/organism/PreviewTemplateModal/stories/dataTypes/components/index.js +6 -0
- package/es/components/organism/PreviewTemplateModal/styled.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/styled.js +26 -0
- package/es/components/organism/PreviewTemplateModal/types.d.ts +38 -0
- package/es/components/organism/PreviewTemplateModal/types.js +1 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +6 -0
- package/es/components/template/TemplateListing/Loadable.js +7 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/index.js +3 -1
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +19 -10
- package/es/components/template/TemplateListing/components/CategoryListing/styled.d.ts +2 -0
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +50 -8
- package/es/components/template/TemplateListing/components/Empty/index.d.ts +3 -0
- package/es/components/template/TemplateListing/components/Empty/index.js +18 -0
- package/es/components/template/TemplateListing/components/Empty/styled.d.ts +3 -0
- package/es/components/template/TemplateListing/components/Empty/styled.js +35 -0
- package/es/components/template/TemplateListing/components/index.d.ts +1 -0
- package/es/components/template/TemplateListing/components/index.js +1 -0
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +5 -3
- package/es/components/template/TemplateListing/constants/defaultProps.js +8 -7
- package/es/components/template/TemplateListing/hooks/index.d.ts +1 -0
- package/es/components/template/TemplateListing/hooks/index.js +1 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +62 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.js +230 -0
- package/es/components/template/TemplateListing/index.js +75 -14
- package/es/components/template/TemplateListing/stories/dataTypes/components/BlankTemplatePropsTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/BlankTemplatePropsTable/index.js +46 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/CategoryListingPropsTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/CategoryListingPropsTable/index.js +57 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/DataTypeTables/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/DataTypeTables/index.js +78 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/EmptyPropsTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/EmptyPropsTable/index.js +30 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TCategoryItemTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TCategoryItemTable/index.js +46 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TTemplateItemTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TTemplateItemTable/index.js +38 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TemplatesPropsTable/index.d.ts +2 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/TemplatesPropsTable/index.js +50 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/index.d.ts +7 -0
- package/es/components/template/TemplateListing/stories/dataTypes/components/index.js +7 -0
- package/es/components/template/TemplateListing/stories/demo/styled.d.ts +1 -0
- package/es/components/template/TemplateListing/stories/demo/styled.js +7 -0
- package/es/components/template/TemplateListing/styled/index.d.ts +1 -0
- package/es/components/template/TemplateListing/styled/index.js +24 -5
- package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +1 -1
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +5 -2
- package/es/components/template/TemplateListing/types/Empty.d.ts +5 -0
- package/es/components/template/TemplateListing/types/Empty.js +1 -0
- package/es/components/template/TemplateListing/types/TemplateListing.d.ts +16 -6
- package/es/components/template/index.d.ts +2 -1
- package/es/components/template/index.js +5 -1
- package/es/constants/datetime.d.ts +8 -0
- package/es/constants/datetime.js +1594 -0
- package/es/constants/index.d.ts +5 -1
- package/es/constants/index.js +5 -1
- package/es/constants/queries.d.ts +4 -0
- package/es/constants/queries.js +5 -0
- package/es/constants/templateListing.d.ts +50 -0
- package/es/constants/templateListing.js +52 -0
- package/es/constants/theme.js +1 -1
- package/es/constants/variables.d.ts +19 -0
- package/es/constants/variables.js +19 -0
- package/es/hooks/index.d.ts +4 -0
- package/es/hooks/index.js +4 -0
- package/es/hooks/useEffectOnlyOnce.d.ts +2 -0
- package/es/hooks/useEffectOnlyOnce.js +12 -0
- package/es/hooks/useForceUpdate.d.ts +1 -0
- package/es/hooks/useForceUpdate.js +5 -0
- package/es/hooks/useIntersectionObserver.d.ts +57 -0
- package/es/hooks/useIntersectionObserver.js +97 -0
- package/es/hooks/useListingItemResize.d.ts +12 -0
- package/es/hooks/useListingItemResize.js +58 -0
- package/es/hooks/useScrollToEnd.d.ts +1 -0
- package/es/hooks/useScrollToEnd.js +30 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/locales/en/translation.json +9 -1
- package/es/locales/i18n.d.ts +16 -0
- package/es/locales/translations.d.ts +8 -0
- package/es/locales/vi/translation.json +9 -1
- package/es/models/ObjectTemplate.d.ts +56 -0
- package/es/models/ObjectTemplate.js +82 -0
- package/es/models/TemplateCategory.d.ts +13 -0
- package/es/models/TemplateCategory.js +28 -0
- package/es/queries/CustomFunction/useCustomFunction.js +35 -35
- package/es/queries/TemplateListing/index.d.ts +52 -0
- package/es/queries/TemplateListing/index.js +105 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/TemplateListing/index.d.ts +70 -0
- package/es/services/TemplateListing/index.js +161 -0
- package/es/test.js +65 -11
- package/es/types/index.d.ts +5 -0
- package/es/types/index.js +3 -0
- package/es/types/service.d.ts +22 -0
- package/es/types/service.js +1 -0
- package/es/types/share-access.d.ts +18 -0
- package/es/types/share-access.js +1 -0
- package/es/types/templateListing.d.ts +13 -0
- package/es/types/templateListing.js +1 -0
- package/es/types/variables.d.ts +3 -0
- package/es/utils/common.d.ts +4 -0
- package/es/utils/common.js +38 -0
- package/es/utils/commonComponent.d.ts +7 -0
- package/es/utils/commonComponent.js +28 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/templateListing.d.ts +2 -0
- package/es/utils/templateListing.js +12 -0
- 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
|
-
|
|
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
|
-
|
|
10
|
-
.
|
|
11
|
-
|
|
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:
|
|
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:
|
|
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,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,10 +1,12 @@
|
|
|
1
1
|
import { ThumbnailCardProps } from '../../../molecules';
|
|
2
|
-
import { BlankTemplateProps, CategoryListingProps, TemplateListingProps } from '../types';
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
6
|
-
import { ThumbnailCard } from '
|
|
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,
|
|
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
|
-
|
|
13
|
-
const {
|
|
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({
|
|
16
|
-
React.createElement(
|
|
17
|
-
React.createElement(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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;
|