@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.
- package/es/assets/images/background/skeleton-background.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 +3 -1
- package/es/components/atoms/Spin/Spin.js +2 -2
- package/es/components/common/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/es/components/common/ConfigProvider/ConfigProvider.js +9 -4
- package/es/components/common/ConfigProvider/GlobalStyle.js +85 -16
- 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/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 +24 -16
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +5 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +31 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +3 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +5 -4
- 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 +3 -2
- 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/LayoutContent/LayoutContent.js +2 -2
- 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 +71 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +172 -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 +18 -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 +5 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +197 -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 +52 -0
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +107 -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.d.ts +3 -0
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +72 -0
- package/es/components/molecules/ThumbnailCard/constants.d.ts +3 -0
- package/es/components/molecules/ThumbnailCard/constants.js +3 -0
- package/es/components/molecules/ThumbnailCard/index.d.ts +2 -0
- package/es/components/molecules/ThumbnailCard/index.js +2 -0
- package/es/components/molecules/ThumbnailCard/styled.d.ts +1 -0
- package/es/components/{template/TemplateListing/components/TemplateItem → molecules/ThumbnailCard}/styled.js +14 -7
- package/es/components/molecules/ThumbnailCard/types.d.ts +23 -0
- package/es/components/molecules/ThumbnailCard/types.js +1 -0
- package/es/components/molecules/UploadImage/index.js +1 -1
- package/es/components/molecules/index.d.ts +5 -0
- package/es/components/molecules/index.js +3 -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 +3 -0
- package/es/components/organism/Menu/index.d.ts +1 -0
- package/es/components/organism/Menu/index.js +3 -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 +29 -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 +11 -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/styled.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/styled.js +26 -0
- package/es/components/organism/PreviewTemplateModal/types.d.ts +39 -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 +9 -7
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +2 -0
- 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 +44 -7
- package/es/components/template/TemplateListing/components/CategoryListing/types.d.ts +2 -1
- 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 -1
- package/es/components/template/TemplateListing/components/index.js +1 -1
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +8 -4
- package/es/components/template/TemplateListing/constants/defaultProps.js +9 -6
- 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 +226 -0
- package/es/components/template/TemplateListing/index.js +75 -13
- package/es/components/template/TemplateListing/styled/index.d.ts +2 -0
- package/es/components/template/TemplateListing/styled/index.js +29 -5
- package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +3 -2
- 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 +20 -9
- package/es/components/template/TemplateListing/types/index.d.ts +0 -1
- package/es/components/template/TemplateListing/types/index.js +0 -1
- 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 +3 -0
- package/es/constants/queries.js +4 -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 +11 -3
- 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/TemplateListing/index.d.ts +47 -0
- package/es/queries/TemplateListing/index.js +98 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/TemplateListing/index.d.ts +65 -0
- package/es/services/TemplateListing/index.js +149 -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 +17 -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 +34 -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
- package/es/components/template/TemplateListing/components/TemplateItem/index.d.ts +0 -3
- package/es/components/template/TemplateListing/components/TemplateItem/index.js +0 -53
- package/es/components/template/TemplateListing/components/TemplateItem/styled.d.ts +0 -1
- package/es/components/template/TemplateListing/types/TemplateItem.d.ts +0 -14
- /package/es/components/{template/TemplateListing/types/TemplateItem.js → molecules/CalendarSelection/components/CustomPicker/types.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import React, { useEffect, useState } from 'react';
|
|
13
|
+
import { ModalV2 } from '../ModalV2';
|
|
14
|
+
import { TemplateSaveAs } from './TemplateSaveAs';
|
|
15
|
+
// NOTE: helper link (read more about controlled and uncontrolled component)
|
|
16
|
+
// Inspiration form input component https://react.dev/reference/react-dom/components/input
|
|
17
|
+
export const TemplateSaveAsModal = props => {
|
|
18
|
+
const { open, onCancel, okText, onOk, title, templateProps, defaultValue } = props, restProps = __rest(props, ["open", "onCancel", "okText", "onOk", "title", "templateProps", "defaultValue"]);
|
|
19
|
+
const { onChange: templateOnChange, value: templateValue } = templateProps, restTemplateProps = __rest(templateProps, ["onChange", "value"]);
|
|
20
|
+
const [internalValue, setInternalValue] = useState(defaultValue || templateValue);
|
|
21
|
+
const [errors, setErrors] = useState();
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (defaultValue)
|
|
24
|
+
setInternalValue(defaultValue);
|
|
25
|
+
}, [defaultValue]);
|
|
26
|
+
const handleOnChange = (value, errors) => {
|
|
27
|
+
setErrors(errors);
|
|
28
|
+
if (templateOnChange) {
|
|
29
|
+
templateOnChange(value);
|
|
30
|
+
}
|
|
31
|
+
// NOTE: If there are no templateValue and templateOnChange => uncontrolled component => return templateValue
|
|
32
|
+
if (defaultValue && !templateValue && !templateOnChange) {
|
|
33
|
+
setInternalValue(value);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const handleOk = (event) => {
|
|
37
|
+
if (onOk && (!errors || errors.length === 0)) {
|
|
38
|
+
// NOTE: If there are templateValue and templateOnChange => controlled component => return templateValue
|
|
39
|
+
onOk(event, templateValue && templateOnChange ? templateValue : internalValue);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const handleCancel = (event) => {
|
|
43
|
+
if (onCancel) {
|
|
44
|
+
setInternalValue(defaultValue);
|
|
45
|
+
onCancel(event);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return (React.createElement(ModalV2, Object.assign({ open: open, onCancel: handleCancel, onOk: handleOk, okText: okText || 'Save', width: 1177, title: title || 'Save as my template' }, restProps),
|
|
49
|
+
React.createElement(TemplateSaveAs, Object.assign({ onChange: (newValue, errors) => handleOnChange(newValue, errors), value: templateValue || internalValue }, restTemplateProps))));
|
|
50
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ImageSliderProps {
|
|
3
|
+
thumbnails: (string | undefined)[];
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
skeleton?: boolean;
|
|
7
|
+
previewNavigation?: boolean;
|
|
8
|
+
slidesPerView?: number;
|
|
9
|
+
hideThumbnailsList?: boolean;
|
|
10
|
+
hideDefaultButton?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Default thumbnail - order of default thumbnail in thumbnails array
|
|
13
|
+
*/
|
|
14
|
+
defaultThumbnail?: number;
|
|
15
|
+
onSelectDefault?: (imgIndex: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ImageSlider: React.FC<ImageSliderProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import React, { useState, useRef } from 'react';
|
|
3
|
+
import { Image } from 'antd';
|
|
4
|
+
import Icon from '@antscorp/icons';
|
|
5
|
+
// Components
|
|
6
|
+
import { Button, Flex, Spin } from '@antscorp/antsomi-ui/es/components';
|
|
7
|
+
// Styles
|
|
8
|
+
import { ImageSliderStyled } from './styled';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
export const ImageSlider = props => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const { thumbnails, isLoading, className, skeleton, previewNavigation, slidesPerView = 3, hideThumbnailsList, hideDefaultButton, defaultThumbnail, onSelectDefault, } = props;
|
|
13
|
+
const sliderContainerRef = useRef(null);
|
|
14
|
+
const thumbnailSelectedRef = useRef(null);
|
|
15
|
+
const [selectedThumbnail, setSelectedThumbnail] = useState(0);
|
|
16
|
+
const [defaultThumbnailInternal, setDefaultThumbnailInternal] = useState(defaultThumbnail || 0);
|
|
17
|
+
(_a = thumbnailSelectedRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
18
|
+
left: selectedThumbnail * 330,
|
|
19
|
+
behavior: 'smooth',
|
|
20
|
+
});
|
|
21
|
+
(_b = sliderContainerRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
|
|
22
|
+
left: selectedThumbnail * (330 / slidesPerView),
|
|
23
|
+
behavior: 'smooth',
|
|
24
|
+
});
|
|
25
|
+
const handleNextThumbnail = () => {
|
|
26
|
+
setSelectedThumbnail(prev => (prev === thumbnails.length - 1 ? 0 : prev + 1));
|
|
27
|
+
};
|
|
28
|
+
const handlePrevThumbnail = () => {
|
|
29
|
+
setSelectedThumbnail(prev => (prev === 0 ? thumbnails.length - 1 : prev - 1));
|
|
30
|
+
};
|
|
31
|
+
return (React.createElement(ImageSliderStyled, { className: className || '', "$skeleton": skeleton, "$slidesPerView": slidesPerView, vertical: true, gap: 10 },
|
|
32
|
+
React.createElement(Flex, { className: "thumbnail-preview-container", ref: thumbnailSelectedRef }, isLoading ? (React.createElement(Spin, { spinning: true })) : (thumbnails.map((url, index) => (React.createElement("div", { key: `image-big_${url}_${index * 2}`, className: clsx('image-container--big', {
|
|
33
|
+
'image-container--default': defaultThumbnailInternal === index,
|
|
34
|
+
}) },
|
|
35
|
+
url ? (React.createElement(Image, { preview: false, width: "80%", height: "96%", src: thumbnails[index] })) : null,
|
|
36
|
+
hideDefaultButton ? null : (React.createElement(Button, { className: "set-default-button", onClick: () => {
|
|
37
|
+
setDefaultThumbnailInternal(selectedThumbnail);
|
|
38
|
+
if (onSelectDefault) {
|
|
39
|
+
onSelectDefault(selectedThumbnail);
|
|
40
|
+
}
|
|
41
|
+
} },
|
|
42
|
+
defaultThumbnailInternal === index ? (React.createElement(Icon, { type: "icon-ants-check", style: { fontSize: '12px' } })) : null,
|
|
43
|
+
defaultThumbnailInternal === index ? 'Default thumbnail' : 'Set as default'))))))),
|
|
44
|
+
hideThumbnailsList ? null : (React.createElement(Flex, { gap: 10, className: "thumbnail-slider-container", ref: sliderContainerRef }, isLoading ? (React.createElement(Spin, { spinning: true })) : (thumbnails.map((url, index) => (React.createElement("div", { key: `${url}_${index * 2}`, className: clsx('image-container--small', {
|
|
45
|
+
'image-container--selected': index === selectedThumbnail,
|
|
46
|
+
}), onClick: () => setSelectedThumbnail(index) }, url ? (React.createElement(Image, { key: url, preview: false, width: "80%", height: "96%", src: url })) : null)))))),
|
|
47
|
+
previewNavigation && !isLoading ? (React.createElement(React.Fragment, null,
|
|
48
|
+
React.createElement("div", { className: "change-preview-button change-preview-button--left", onClick: handlePrevThumbnail },
|
|
49
|
+
React.createElement(Icon, { type: "icon-ants-angle-left" })),
|
|
50
|
+
React.createElement("div", { className: "change-preview-button change-preview-button--right", onClick: handleNextThumbnail },
|
|
51
|
+
React.createElement(Icon, { type: "icon-ants-angle-right" })))) : null,
|
|
52
|
+
hideThumbnailsList || isLoading ? null : (React.createElement(React.Fragment, null,
|
|
53
|
+
React.createElement("div", { className: "slider-button slider-button--left", onClick: handlePrevThumbnail },
|
|
54
|
+
React.createElement(Icon, { type: "icon-ants-angle-left" })),
|
|
55
|
+
React.createElement("div", { className: "slider-button slider-button--right", onClick: handleNextThumbnail },
|
|
56
|
+
React.createElement(Icon, { type: "icon-ants-angle-right" }))))));
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImageSlider } from './ImageSlider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImageSlider } from './ImageSlider';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ImageSliderStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
|
|
3
|
+
$skeleton?: boolean | undefined;
|
|
4
|
+
$slidesPerView?: number | undefined;
|
|
5
|
+
}, never>;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components';
|
|
4
|
+
// Assets
|
|
5
|
+
import SkeletonBg from '@antscorp/antsomi-ui/es/assets/images/skeleton_bg.png';
|
|
6
|
+
const backgroundImage = css `
|
|
7
|
+
${props => props.$skeleton
|
|
8
|
+
? css `
|
|
9
|
+
background: url(${SkeletonBg}) no-repeat center center, #e5e5e5;
|
|
10
|
+
background-size: contain;
|
|
11
|
+
`
|
|
12
|
+
: css `
|
|
13
|
+
background: #e5e5e5;
|
|
14
|
+
`}
|
|
15
|
+
`;
|
|
16
|
+
const setWidthHeight = ({ w, h }) => `
|
|
17
|
+
width: ${w};
|
|
18
|
+
height: ${h};
|
|
19
|
+
`;
|
|
20
|
+
const centerBlock = css `
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
`;
|
|
25
|
+
export const ImageSliderStyled = styled(Flex) `
|
|
26
|
+
/* NOTE: Style for prev and next button in thumbnail slider */
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
.change-preview-button {
|
|
30
|
+
${centerBlock}
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 115px;
|
|
33
|
+
transform: translateY(-50%);
|
|
34
|
+
font-size: 24px;
|
|
35
|
+
color: #fafafa;
|
|
36
|
+
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
|
|
40
|
+
&--left {
|
|
41
|
+
left: 6px;
|
|
42
|
+
}
|
|
43
|
+
&--right {
|
|
44
|
+
right: 6px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.slider-button {
|
|
49
|
+
${centerBlock}
|
|
50
|
+
position: absolute;
|
|
51
|
+
bottom: 36px;
|
|
52
|
+
transform: translateY(50%);
|
|
53
|
+
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
|
|
56
|
+
${setWidthHeight({ w: '24px', h: '24px' })}
|
|
57
|
+
border-radius: 999px;
|
|
58
|
+
background-color: #fff;
|
|
59
|
+
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
z-index: 1;
|
|
62
|
+
|
|
63
|
+
&--left {
|
|
64
|
+
left: 2px;
|
|
65
|
+
}
|
|
66
|
+
&--right {
|
|
67
|
+
right: 2px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.thumbnail-preview-container:has(.antsomi-spin),
|
|
72
|
+
.thumbnail-slider-container:has(.antsomi-spin) {
|
|
73
|
+
box-shadow: rgba(159, 180, 180, 0.2) 0px 2px 8px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.thumbnail-preview-container .antsomi-spin,
|
|
77
|
+
.thumbnail-slider-container .antsomi-spin {
|
|
78
|
+
width: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
background-color: #fcfcfc;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.thumbnail-preview-container {
|
|
86
|
+
width: 330px;
|
|
87
|
+
overflow-x: scroll;
|
|
88
|
+
scrollbar-width: none;
|
|
89
|
+
|
|
90
|
+
/* NOTE: set border-radius for parent of thumbnail list make better UI when scroll horizontal */
|
|
91
|
+
border-radius: 5px;
|
|
92
|
+
|
|
93
|
+
& > div {
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.antsomi-spin {
|
|
98
|
+
height: 230px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.thumbnail-slider-container {
|
|
103
|
+
position: relative;
|
|
104
|
+
width: 330px;
|
|
105
|
+
overflow-x: scroll;
|
|
106
|
+
scrollbar-width: none;
|
|
107
|
+
|
|
108
|
+
.antsomi-spin {
|
|
109
|
+
height: 72px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.image-container {
|
|
114
|
+
&--big,
|
|
115
|
+
&--small {
|
|
116
|
+
${centerBlock}
|
|
117
|
+
${backgroundImage}
|
|
118
|
+
img {
|
|
119
|
+
object-fit: contain;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
div:has(> img) {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&--big {
|
|
129
|
+
${setWidthHeight({ w: '100%', h: '230px' })}
|
|
130
|
+
/* ${setWidthHeight({ w: '330px', h: '230px' })} */
|
|
131
|
+
flex-shrink: 0;
|
|
132
|
+
|
|
133
|
+
position: relative;
|
|
134
|
+
/* border-radius: 5px; */
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
|
|
137
|
+
&::before {
|
|
138
|
+
content: '';
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 0;
|
|
141
|
+
left: 0;
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 100%;
|
|
144
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
145
|
+
z-index: 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&--small {
|
|
150
|
+
width: ${props => `calc(100% / ${props.$slidesPerView || 3} - 10px)`};
|
|
151
|
+
height: 72px;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
|
|
154
|
+
border: 2px solid #e5e5e5;
|
|
155
|
+
border-radius: 2px;
|
|
156
|
+
user-select: none;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
&--selected {
|
|
160
|
+
border: 2px solid var(--primary-color);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.set-default-button {
|
|
165
|
+
position: absolute;
|
|
166
|
+
top: 50%;
|
|
167
|
+
left: 50%;
|
|
168
|
+
transform: translate(-50%, -50%);
|
|
169
|
+
z-index: 2;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* .swiper-button-prev,
|
|
173
|
+
.swiper-button-next {
|
|
174
|
+
background: #fff;
|
|
175
|
+
width: 24px;
|
|
176
|
+
height: 24px;
|
|
177
|
+
border-radius: 999px;
|
|
178
|
+
&:after {
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
font-weight: bold;
|
|
181
|
+
color: #000;
|
|
182
|
+
}
|
|
183
|
+
&.swiper-button-disabled {
|
|
184
|
+
opacity: 1;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
}
|
|
187
|
+
} */
|
|
188
|
+
|
|
189
|
+
/* .swiper-button-prev.swiper-button-disabled {
|
|
190
|
+
opacity: 1;
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
} */
|
|
193
|
+
|
|
194
|
+
/* .swiper-button-lock {
|
|
195
|
+
display: flex;
|
|
196
|
+
} */
|
|
197
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImageSlider } from './ImageSlider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImageSlider } from './ImageSlider';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
|
|
2
|
+
import { TCategoryItem } from '../../../template';
|
|
3
|
+
import { TGetTemplateCategoryList, TGetObjectTEmplateList } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
|
|
4
|
+
import { TTemplateListingConfig } from '@antscorp/antsomi-ui/es/types/templateListing';
|
|
5
|
+
import { TemplateCategory } from '@antscorp/antsomi-ui/es/models/TemplateCategory';
|
|
6
|
+
import { TemplateValueOptions } from '../TemplateSaveAs';
|
|
7
|
+
interface TemplateListingOptions {
|
|
8
|
+
service: PayloadInfo;
|
|
9
|
+
config: TTemplateListingConfig & {
|
|
10
|
+
filter?: any;
|
|
11
|
+
};
|
|
12
|
+
queriesOptions?: {
|
|
13
|
+
categoryList?: TGetTemplateCategoryList['options'];
|
|
14
|
+
templateList?: TGetObjectTEmplateList['options'];
|
|
15
|
+
};
|
|
16
|
+
defaultValue?: Partial<TemplateValueOptions>;
|
|
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
|
+
* @property {TCategoryItem[]} categoryItems - An array of category items for rendering the template listing's category structure.
|
|
26
|
+
* @property {Array<{ id: string | number; label: string; thumbnail?: string }>} templateItems - An array of template items representing the templates available for the specified configuration.
|
|
27
|
+
* @property {boolean} isLoading - A boolean indicating whether data is currently being loaded.
|
|
28
|
+
*
|
|
29
|
+
* @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
|
|
30
|
+
*/
|
|
31
|
+
export declare const useTemplateSave: (options: TemplateListingOptions) => {
|
|
32
|
+
categoryItems: TCategoryItem[];
|
|
33
|
+
templateItems: {
|
|
34
|
+
id: string | number;
|
|
35
|
+
label: string;
|
|
36
|
+
thumbnail?: string | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
value: Partial<TemplateValueOptions>;
|
|
39
|
+
formattedCategoriesValue: {
|
|
40
|
+
camelCase: Record<string, any>;
|
|
41
|
+
snakeCase: {};
|
|
42
|
+
};
|
|
43
|
+
isLoadingCategoryList: boolean;
|
|
44
|
+
isLoadingTemplateList: boolean;
|
|
45
|
+
form: import("antd").FormInstance<any>;
|
|
46
|
+
errors: any[] | undefined;
|
|
47
|
+
refetchCategoryList: <TPageData>(options?: (import("@tanstack/query-core").RefetchOptions & import("@tanstack/query-core").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/query-core").QueryObserverResult<TemplateCategory[], any>>;
|
|
48
|
+
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>>;
|
|
49
|
+
onLoadMore: () => void;
|
|
50
|
+
onChange: (newValue: Partial<TemplateValueOptions>) => void;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { useGetTemplateCategoryList, useGetObjectTemplateList, } from '@antscorp/antsomi-ui/es/queries/TemplateListing';
|
|
4
|
+
// Hooks
|
|
5
|
+
import { useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
6
|
+
import { Form } from 'antd';
|
|
7
|
+
import { snakeCaseToCamelCase } from '@antscorp/antsomi-ui/es/utils';
|
|
8
|
+
/**
|
|
9
|
+
* Custom React Hook for managing state and data fetching logic related to a template listing.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} options - The options object for configuring the hook.
|
|
12
|
+
* @param {PayloadInfo} options.service - Payload information for making API requests.
|
|
13
|
+
* @param {TTemplateListingConfig} options.config - Configuration options for the template listing.
|
|
14
|
+
*
|
|
15
|
+
* @property {TCategoryItem[]} categoryItems - An array of category items for rendering the template listing's category structure.
|
|
16
|
+
* @property {Array<{ id: string | number; label: string; thumbnail?: string }>} templateItems - An array of template items representing the templates available for the specified configuration.
|
|
17
|
+
* @property {boolean} isLoading - A boolean indicating whether data is currently being loaded.
|
|
18
|
+
*
|
|
19
|
+
* @property {Function} onLoadMore - A function to load more template data when scrolling in the template listing.
|
|
20
|
+
*/
|
|
21
|
+
export const useTemplateSave = (options) => {
|
|
22
|
+
const { service, config, queriesOptions, defaultValue: valueArg } = options;
|
|
23
|
+
const { objectType, categoryCodes, publicLevel, limitListPerPage = 10, getListType, filter, } = config;
|
|
24
|
+
const { categoryList: categoryListOptions, templateList: templateListOptions } = queriesOptions || {};
|
|
25
|
+
const [value, setValue] = useState(valueArg || {});
|
|
26
|
+
const [errors, setErrors] = useState();
|
|
27
|
+
const formattedCategoriesValue = useMemo(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
const snakeCase = {};
|
|
30
|
+
(_a = value.categories) === null || _a === void 0 ? void 0 : _a.forEach(category => {
|
|
31
|
+
snakeCase[category.key] = category.children;
|
|
32
|
+
});
|
|
33
|
+
const camelCase = snakeCaseToCamelCase(snakeCase);
|
|
34
|
+
return { camelCase, snakeCase };
|
|
35
|
+
}, [value]);
|
|
36
|
+
const [form] = Form.useForm();
|
|
37
|
+
const { data: categoryList, isLoading: isLoadingCategoryList, refetch: refetchCategoryList, } = useGetTemplateCategoryList({
|
|
38
|
+
args: {
|
|
39
|
+
auth: service,
|
|
40
|
+
params: {
|
|
41
|
+
objectTypes: [objectType],
|
|
42
|
+
categoryCodes,
|
|
43
|
+
publicLevel,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
options: categoryListOptions,
|
|
47
|
+
});
|
|
48
|
+
// Queries
|
|
49
|
+
const { data: infiniteObjectTemplate, isFetchingNextPage, isFetching, hasNextPage, fetchNextPage, refetch: refetchTemplateList, } = useGetObjectTemplateList({
|
|
50
|
+
args: {
|
|
51
|
+
auth: service,
|
|
52
|
+
params: Object.assign({ get_list_type: getListType, object_type: objectType, public_level: publicLevel, limit: limitListPerPage }, (filter ? { filter } : {})),
|
|
53
|
+
},
|
|
54
|
+
options: templateListOptions,
|
|
55
|
+
});
|
|
56
|
+
// Variables
|
|
57
|
+
const isLoadingTemplateList = isFetching || isFetchingNextPage;
|
|
58
|
+
// Memo
|
|
59
|
+
const categoryItems = useDeepCompareMemo(() => {
|
|
60
|
+
const recursiveCategory = (categories = []) => categories.map(category => {
|
|
61
|
+
const { categoryCode, categoryId, categoryName, children } = category;
|
|
62
|
+
const key = Array.isArray(children) && children.length ? categoryCode : categoryId;
|
|
63
|
+
return Object.assign({ key, label: categoryName }, ((children === null || children === void 0 ? void 0 : children.length) > 0 ? { children: recursiveCategory(children) } : {}));
|
|
64
|
+
});
|
|
65
|
+
return recursiveCategory(categoryList || []);
|
|
66
|
+
}, [categoryList]);
|
|
67
|
+
const templateItems = useMemo(() => {
|
|
68
|
+
if (infiniteObjectTemplate) {
|
|
69
|
+
const { pages } = infiniteObjectTemplate;
|
|
70
|
+
return pages.flatMap(({ entities }) => entities.flatMap(({ id, name, thumbnail }) => ({
|
|
71
|
+
id,
|
|
72
|
+
label: name,
|
|
73
|
+
thumbnail,
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
return [];
|
|
77
|
+
}, [infiniteObjectTemplate]);
|
|
78
|
+
const onLoadMore = useCallback(() => {
|
|
79
|
+
if (!isFetchingNextPage && hasNextPage) {
|
|
80
|
+
fetchNextPage();
|
|
81
|
+
}
|
|
82
|
+
}, [fetchNextPage, hasNextPage, isFetchingNextPage]);
|
|
83
|
+
const onChange = (newValue) => {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
setErrors((_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);
|
|
86
|
+
setValue(newValue);
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
// MapKeys
|
|
90
|
+
categoryItems,
|
|
91
|
+
templateItems,
|
|
92
|
+
value,
|
|
93
|
+
// formattedValue
|
|
94
|
+
formattedCategoriesValue,
|
|
95
|
+
// Values
|
|
96
|
+
isLoadingCategoryList,
|
|
97
|
+
isLoadingTemplateList,
|
|
98
|
+
// Form handler
|
|
99
|
+
form,
|
|
100
|
+
errors,
|
|
101
|
+
// Functions
|
|
102
|
+
refetchCategoryList,
|
|
103
|
+
refetchTemplateList,
|
|
104
|
+
onLoadMore,
|
|
105
|
+
onChange,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const TemplateSaveAsStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
|
|
3
|
+
$skeleton?: boolean | undefined;
|
|
4
|
+
}, never>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
// Libraries
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
// Components
|
|
5
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components';
|
|
6
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
7
|
+
export const TemplateSaveAsStyled = styled(Flex) `
|
|
8
|
+
padding: 10px;
|
|
9
|
+
/* max-width: 1177px; */
|
|
10
|
+
|
|
11
|
+
.save-options-container {
|
|
12
|
+
padding: 15px 0;
|
|
13
|
+
margin-bottom: 20px;
|
|
14
|
+
border-bottom: 1px dashed #e5e5e5;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.template-container {
|
|
18
|
+
width: 698px;
|
|
19
|
+
/* max-height: 567px; */
|
|
20
|
+
max-height: 50vh;
|
|
21
|
+
padding-right: 28px;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
}
|
|
24
|
+
.share-access-container {
|
|
25
|
+
flex: 1;
|
|
26
|
+
padding: 0 28px;
|
|
27
|
+
border-left: 1px solid #e5e5e5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.field-container {
|
|
31
|
+
gap: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.field-title {
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
width: 150px;
|
|
37
|
+
/* background-color: violet; */
|
|
38
|
+
span {
|
|
39
|
+
color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.red6};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--middle {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
div:has(> .field-input) {
|
|
49
|
+
width: 330px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.category-container {
|
|
53
|
+
flex: 1;
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(2, 1fr);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.selected-category {
|
|
59
|
+
/* width: 240px; */
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
height: 30px;
|
|
62
|
+
border: 1px solid #b8cfe6;
|
|
63
|
+
padding: 0 5px;
|
|
64
|
+
border-radius: 3px;
|
|
65
|
+
|
|
66
|
+
& > span.remove-btn {
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
font-weight: bold;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
user-select: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|