@antscorp/antsomi-ui 1.3.5-beta.2 → 1.3.5-beta.21
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/css/main.scss +0 -2
- package/es/assets/images/background/skeleton-background.png +0 -0
- package/es/assets/images/skeleton_bg.png +0 -0
- package/es/assets/svg/mobile-frame.svg +3 -0
- package/es/components/atoms/Spin/Spin.js +2 -2
- package/es/components/common/ConfigProvider/ConfigProvider.js +8 -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 +96 -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 +97 -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/RichMenuMobileView/RichMenuMobileView.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +2 -2
- 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 +1 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.d.ts +52 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAs.js +144 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.d.ts +10 -0
- package/es/components/molecules/TemplateSaveAs/TemplateSaveAsModal.js +38 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.d.ts +15 -0
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/ImageSlider.js +68 -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 +175 -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/index.d.ts +3 -0
- package/es/components/molecules/TemplateSaveAs/index.js +2 -0
- package/es/components/molecules/TemplateSaveAs/styled.d.ts +4 -0
- package/es/components/molecules/TemplateSaveAs/styled.js +70 -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 +21 -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 +23 -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 +12 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +4 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +91 -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/index.d.ts +3 -0
- package/es/components/organism/PreviewTemplateModal/constants/index.js +3 -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 +206 -0
- package/es/components/template/TemplateListing/index.js +77 -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 +4 -1
- package/es/constants/index.js +4 -1
- package/es/constants/queries.d.ts +3 -0
- package/es/constants/queries.js +4 -0
- package/es/constants/templateListing.d.ts +58 -0
- package/es/constants/templateListing.js +58 -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 +2 -0
- package/es/index.js +2 -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 +53 -0
- package/es/models/ObjectTemplate.js +80 -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 +93 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/TemplateListing/index.d.ts +64 -0
- package/es/services/TemplateListing/index.js +149 -0
- package/es/test.js +62 -11
- package/es/types/index.d.ts +4 -0
- package/es/types/index.js +2 -0
- package/es/types/service.d.ts +22 -0
- package/es/types/service.js +1 -0
- package/es/types/templateListing.d.ts +11 -0
- package/es/types/templateListing.js +1 -0
- package/es/utils/common.d.ts +2 -0
- package/es/utils/common.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,97 @@
|
|
|
1
|
+
import { DaysUpToToday, DaysUpToYesterday } from './types';
|
|
2
|
+
export declare const TRIGGER_OUT_MODE: {
|
|
3
|
+
readonly auto: "auto";
|
|
4
|
+
readonly manual: "manual";
|
|
5
|
+
};
|
|
6
|
+
export declare const LOCAL_TIMEZONE = "Asia/Hong_Kong";
|
|
7
|
+
export declare const RANGE_LIMIT: number;
|
|
8
|
+
export declare const DEFAULT_NUM_UP_TO = 30;
|
|
9
|
+
export declare const AUTO_UPDATE_TO_KEY: {
|
|
10
|
+
readonly today: "today";
|
|
11
|
+
readonly yesterday: "yesterday";
|
|
12
|
+
readonly fixed: "fixed";
|
|
13
|
+
};
|
|
14
|
+
export declare const AUTO_UPDATE_TO_OPTIONS: {
|
|
15
|
+
today: {
|
|
16
|
+
key: "today";
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
yesterday: {
|
|
20
|
+
key: "yesterday";
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
fixed: {
|
|
24
|
+
key: "fixed";
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const SELECTION_KEY: {
|
|
29
|
+
readonly today: "today";
|
|
30
|
+
readonly yesterday: "yesterday";
|
|
31
|
+
readonly this_week: "this_week";
|
|
32
|
+
readonly last_7_days: "last_7_days";
|
|
33
|
+
readonly last_week: "last_week";
|
|
34
|
+
readonly last_14_days: "last_14_days";
|
|
35
|
+
readonly this_month: "this_month";
|
|
36
|
+
readonly last_30_days: "last_30_days";
|
|
37
|
+
readonly last_month: "last_month";
|
|
38
|
+
readonly this_quarter: "this_quarter";
|
|
39
|
+
readonly last_quarter: "last_quarter";
|
|
40
|
+
readonly all_time: "all_time";
|
|
41
|
+
readonly custom: "custom";
|
|
42
|
+
readonly days_up_to_today: "days_up_to_today";
|
|
43
|
+
readonly days_up_to_yesterday: "days_up_to_yesterday";
|
|
44
|
+
};
|
|
45
|
+
export declare const RANGE_TIME: readonly ["today", "yesterday", "this_week", "last_week", "last_7_days", "last_14_days", "last_30_days", "this_month", "last_month", "this_quarter", "last_quarter", "all_time"];
|
|
46
|
+
export declare const SPECIFIC_TIME: readonly ["days_up_to_today", "days_up_to_yesterday", "last_7_days", "last_14_days", "last_30_days"];
|
|
47
|
+
export declare const MAP_TITLE: {
|
|
48
|
+
today: string;
|
|
49
|
+
yesterday: string;
|
|
50
|
+
last_7_days: string;
|
|
51
|
+
last_14_days: string;
|
|
52
|
+
this_month: string;
|
|
53
|
+
last_30_days: string;
|
|
54
|
+
last_month: string;
|
|
55
|
+
all_time: string;
|
|
56
|
+
last_week: string;
|
|
57
|
+
this_week: string;
|
|
58
|
+
this_quarter: string;
|
|
59
|
+
last_quarter: string;
|
|
60
|
+
custom: string;
|
|
61
|
+
days_up_to_today: string;
|
|
62
|
+
days_up_to_yesterday: string;
|
|
63
|
+
sundayToToDay: string;
|
|
64
|
+
sundayToSat: string;
|
|
65
|
+
monToToDay: string;
|
|
66
|
+
monToSun: string;
|
|
67
|
+
};
|
|
68
|
+
export declare const MAP_TITLE_DISPLAY: {
|
|
69
|
+
days_up_to_yesterday: (rangeInfo: DaysUpToYesterday) => string;
|
|
70
|
+
days_up_to_today: (rangeInfo: DaysUpToToday) => string;
|
|
71
|
+
today: string;
|
|
72
|
+
yesterday: string;
|
|
73
|
+
last_7_days: string;
|
|
74
|
+
last_14_days: string;
|
|
75
|
+
this_month: string;
|
|
76
|
+
last_30_days: string;
|
|
77
|
+
last_month: string;
|
|
78
|
+
all_time: string;
|
|
79
|
+
last_week: string;
|
|
80
|
+
this_week: string;
|
|
81
|
+
this_quarter: string;
|
|
82
|
+
last_quarter: string;
|
|
83
|
+
custom: string;
|
|
84
|
+
sundayToToDay: string;
|
|
85
|
+
sundayToSat: string;
|
|
86
|
+
monToToDay: string;
|
|
87
|
+
monToSun: string;
|
|
88
|
+
};
|
|
89
|
+
export declare const RANGE_SELECTION_OPTIONS: Record<string, {
|
|
90
|
+
key: string;
|
|
91
|
+
label: string;
|
|
92
|
+
isFixed: boolean;
|
|
93
|
+
options?: {
|
|
94
|
+
key: string;
|
|
95
|
+
label: string;
|
|
96
|
+
}[];
|
|
97
|
+
}>;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export const TRIGGER_OUT_MODE = {
|
|
2
|
+
auto: 'auto',
|
|
3
|
+
manual: 'manual',
|
|
4
|
+
};
|
|
5
|
+
export const LOCAL_TIMEZONE = 'Asia/Hong_Kong' || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
6
|
+
export const RANGE_LIMIT = 365 * 2;
|
|
7
|
+
export const DEFAULT_NUM_UP_TO = 30;
|
|
8
|
+
export const AUTO_UPDATE_TO_KEY = {
|
|
9
|
+
today: 'today',
|
|
10
|
+
yesterday: 'yesterday',
|
|
11
|
+
fixed: 'fixed',
|
|
12
|
+
};
|
|
13
|
+
export const AUTO_UPDATE_TO_OPTIONS = {
|
|
14
|
+
[AUTO_UPDATE_TO_KEY.today]: {
|
|
15
|
+
key: AUTO_UPDATE_TO_KEY.today,
|
|
16
|
+
label: 'Today',
|
|
17
|
+
},
|
|
18
|
+
[AUTO_UPDATE_TO_KEY.yesterday]: {
|
|
19
|
+
key: AUTO_UPDATE_TO_KEY.yesterday,
|
|
20
|
+
label: 'Yesterday',
|
|
21
|
+
},
|
|
22
|
+
[AUTO_UPDATE_TO_KEY.fixed]: {
|
|
23
|
+
key: AUTO_UPDATE_TO_KEY.fixed,
|
|
24
|
+
label: 'Fixed',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const SELECTION_KEY = {
|
|
28
|
+
today: 'today',
|
|
29
|
+
yesterday: 'yesterday',
|
|
30
|
+
this_week: 'this_week',
|
|
31
|
+
last_7_days: 'last_7_days',
|
|
32
|
+
last_week: 'last_week',
|
|
33
|
+
last_14_days: 'last_14_days',
|
|
34
|
+
this_month: 'this_month',
|
|
35
|
+
last_30_days: 'last_30_days',
|
|
36
|
+
last_month: 'last_month',
|
|
37
|
+
this_quarter: 'this_quarter',
|
|
38
|
+
last_quarter: 'last_quarter',
|
|
39
|
+
all_time: 'all_time',
|
|
40
|
+
custom: 'custom',
|
|
41
|
+
days_up_to_today: 'days_up_to_today',
|
|
42
|
+
days_up_to_yesterday: 'days_up_to_yesterday',
|
|
43
|
+
};
|
|
44
|
+
export const RANGE_TIME = [
|
|
45
|
+
SELECTION_KEY.today,
|
|
46
|
+
SELECTION_KEY.yesterday,
|
|
47
|
+
SELECTION_KEY.this_week,
|
|
48
|
+
SELECTION_KEY.last_week,
|
|
49
|
+
SELECTION_KEY.last_7_days,
|
|
50
|
+
SELECTION_KEY.last_14_days,
|
|
51
|
+
SELECTION_KEY.last_30_days,
|
|
52
|
+
SELECTION_KEY.this_month,
|
|
53
|
+
SELECTION_KEY.last_month,
|
|
54
|
+
SELECTION_KEY.this_quarter,
|
|
55
|
+
SELECTION_KEY.last_quarter,
|
|
56
|
+
SELECTION_KEY.all_time,
|
|
57
|
+
];
|
|
58
|
+
export const SPECIFIC_TIME = [
|
|
59
|
+
SELECTION_KEY.days_up_to_today,
|
|
60
|
+
SELECTION_KEY.days_up_to_yesterday,
|
|
61
|
+
SELECTION_KEY.last_7_days,
|
|
62
|
+
SELECTION_KEY.last_14_days,
|
|
63
|
+
SELECTION_KEY.last_30_days,
|
|
64
|
+
];
|
|
65
|
+
export const MAP_TITLE = {
|
|
66
|
+
[SELECTION_KEY.today]: 'Today',
|
|
67
|
+
[SELECTION_KEY.yesterday]: 'Yesterday',
|
|
68
|
+
[SELECTION_KEY.last_7_days]: 'Last 7 days',
|
|
69
|
+
[SELECTION_KEY.last_14_days]: 'Last 14 days',
|
|
70
|
+
[SELECTION_KEY.this_month]: 'This month',
|
|
71
|
+
[SELECTION_KEY.last_30_days]: 'Last 30 days',
|
|
72
|
+
[SELECTION_KEY.last_month]: 'Last month',
|
|
73
|
+
[SELECTION_KEY.all_time]: 'All time',
|
|
74
|
+
[SELECTION_KEY.last_week]: 'Last week',
|
|
75
|
+
[SELECTION_KEY.this_week]: 'This week',
|
|
76
|
+
[SELECTION_KEY.this_quarter]: 'This quarter',
|
|
77
|
+
[SELECTION_KEY.last_quarter]: 'Last quarter',
|
|
78
|
+
[SELECTION_KEY.custom]: 'Custom',
|
|
79
|
+
[SELECTION_KEY.days_up_to_today]: 'day(s), up to today',
|
|
80
|
+
[SELECTION_KEY.days_up_to_yesterday]: 'day(s), up to yesterday',
|
|
81
|
+
sundayToToDay: 'Sun-Today',
|
|
82
|
+
sundayToSat: 'Sun-Sat',
|
|
83
|
+
monToToDay: 'Mon-Today',
|
|
84
|
+
monToSun: 'Mon-Sun',
|
|
85
|
+
};
|
|
86
|
+
export const MAP_TITLE_DISPLAY = Object.assign(Object.assign({}, MAP_TITLE), { [SELECTION_KEY.days_up_to_yesterday]: (rangeInfo) => `${rangeInfo.numOfDays} day(s) up to yesterday')`, [SELECTION_KEY.days_up_to_today]: (rangeInfo) => `${rangeInfo.numOfDays} day(s) up today` });
|
|
87
|
+
export const RANGE_SELECTION_OPTIONS = {
|
|
88
|
+
[SELECTION_KEY.today]: {
|
|
89
|
+
key: SELECTION_KEY.today,
|
|
90
|
+
label: MAP_TITLE[SELECTION_KEY.today],
|
|
91
|
+
isFixed: false, // if 1 unit is fixed, 7 day : true , this week : false
|
|
92
|
+
},
|
|
93
|
+
[SELECTION_KEY.yesterday]: {
|
|
94
|
+
key: SELECTION_KEY.yesterday,
|
|
95
|
+
label: MAP_TITLE[SELECTION_KEY.yesterday],
|
|
96
|
+
isFixed: false,
|
|
97
|
+
},
|
|
98
|
+
[SELECTION_KEY.this_week]: {
|
|
99
|
+
key: SELECTION_KEY.this_week,
|
|
100
|
+
label: MAP_TITLE[SELECTION_KEY.this_week],
|
|
101
|
+
isFixed: false,
|
|
102
|
+
options: [
|
|
103
|
+
{
|
|
104
|
+
key: `${SELECTION_KEY.this_week}_7`,
|
|
105
|
+
label: MAP_TITLE.sundayToToDay,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: `${SELECTION_KEY.this_week}_1`,
|
|
109
|
+
label: MAP_TITLE.monToToDay,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
[SELECTION_KEY.last_7_days]: {
|
|
114
|
+
key: SELECTION_KEY.last_7_days,
|
|
115
|
+
label: MAP_TITLE[SELECTION_KEY.last_7_days],
|
|
116
|
+
isFixed: true,
|
|
117
|
+
},
|
|
118
|
+
[SELECTION_KEY.last_week]: {
|
|
119
|
+
key: SELECTION_KEY.last_week,
|
|
120
|
+
label: MAP_TITLE[SELECTION_KEY.last_week],
|
|
121
|
+
isFixed: false,
|
|
122
|
+
options: [
|
|
123
|
+
{
|
|
124
|
+
key: `${SELECTION_KEY.last_week}_7`,
|
|
125
|
+
label: MAP_TITLE.sundayToSat,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: `${SELECTION_KEY.last_week}_1`,
|
|
129
|
+
label: MAP_TITLE.monToSun,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
[SELECTION_KEY.last_14_days]: {
|
|
134
|
+
key: SELECTION_KEY.last_14_days,
|
|
135
|
+
label: MAP_TITLE[SELECTION_KEY.last_14_days],
|
|
136
|
+
isFixed: true,
|
|
137
|
+
},
|
|
138
|
+
[SELECTION_KEY.this_month]: {
|
|
139
|
+
key: SELECTION_KEY.this_month,
|
|
140
|
+
label: MAP_TITLE[SELECTION_KEY.this_month],
|
|
141
|
+
isFixed: false,
|
|
142
|
+
},
|
|
143
|
+
[SELECTION_KEY.last_30_days]: {
|
|
144
|
+
key: SELECTION_KEY.last_30_days,
|
|
145
|
+
label: MAP_TITLE[SELECTION_KEY.last_30_days],
|
|
146
|
+
isFixed: true,
|
|
147
|
+
},
|
|
148
|
+
[SELECTION_KEY.last_month]: {
|
|
149
|
+
key: SELECTION_KEY.last_month,
|
|
150
|
+
label: MAP_TITLE[SELECTION_KEY.last_month],
|
|
151
|
+
isFixed: false,
|
|
152
|
+
},
|
|
153
|
+
[SELECTION_KEY.this_quarter]: {
|
|
154
|
+
key: SELECTION_KEY.this_quarter,
|
|
155
|
+
label: MAP_TITLE[SELECTION_KEY.this_quarter],
|
|
156
|
+
isFixed: false,
|
|
157
|
+
},
|
|
158
|
+
[SELECTION_KEY.last_quarter]: {
|
|
159
|
+
key: SELECTION_KEY.last_quarter,
|
|
160
|
+
label: MAP_TITLE[SELECTION_KEY.last_quarter],
|
|
161
|
+
isFixed: false,
|
|
162
|
+
},
|
|
163
|
+
[SELECTION_KEY.all_time]: {
|
|
164
|
+
key: SELECTION_KEY.all_time,
|
|
165
|
+
label: MAP_TITLE[SELECTION_KEY.all_time],
|
|
166
|
+
isFixed: false,
|
|
167
|
+
},
|
|
168
|
+
[SELECTION_KEY.custom]: {
|
|
169
|
+
key: SELECTION_KEY.custom,
|
|
170
|
+
label: MAP_TITLE.custom,
|
|
171
|
+
isFixed: true,
|
|
172
|
+
},
|
|
173
|
+
[SELECTION_KEY.days_up_to_today]: {
|
|
174
|
+
key: SELECTION_KEY.days_up_to_today,
|
|
175
|
+
label: MAP_TITLE[SELECTION_KEY.days_up_to_today],
|
|
176
|
+
isFixed: true,
|
|
177
|
+
},
|
|
178
|
+
[SELECTION_KEY.days_up_to_yesterday]: {
|
|
179
|
+
key: SELECTION_KEY.days_up_to_yesterday,
|
|
180
|
+
label: MAP_TITLE[SELECTION_KEY.days_up_to_yesterday],
|
|
181
|
+
isFixed: true,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ActionContext, StateContext } from '../context';
|
|
3
|
+
export const useCalendarSelectionContext = () => {
|
|
4
|
+
const state = useContext(StateContext);
|
|
5
|
+
const action = useContext(ActionContext);
|
|
6
|
+
if (state === undefined) {
|
|
7
|
+
throw new Error('useBrandedDomainContext not inside StateProvider');
|
|
8
|
+
}
|
|
9
|
+
if (action === undefined) {
|
|
10
|
+
throw new Error('useBrandedDomainContext not inside DispatchProvider');
|
|
11
|
+
}
|
|
12
|
+
return { state, action };
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { CalendarSelectionValue, ReducerState, Action, TriggerOutInfo } from '../types';
|
|
3
|
+
type Params = {
|
|
4
|
+
onChange?: (value: CalendarSelectionValue, info: TriggerOutInfo) => void;
|
|
5
|
+
state: ReducerState;
|
|
6
|
+
dispatch: Dispatch<Action>;
|
|
7
|
+
};
|
|
8
|
+
export declare const useTriggerOut: (params: Params) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { combineCurrentValue } from '../utils';
|
|
4
|
+
export const useTriggerOut = (params) => {
|
|
5
|
+
const { onChange: onTriggerOut, state } = params;
|
|
6
|
+
const onTriggerOutRef = useRef();
|
|
7
|
+
const { triggerOut } = state;
|
|
8
|
+
const triggerOutValue = useDeepCompareMemo(() => combineCurrentValue(state), [state]);
|
|
9
|
+
useDeepCompareEffect(() => {
|
|
10
|
+
if (onTriggerOut) {
|
|
11
|
+
onTriggerOutRef.current = () => onTriggerOut(triggerOutValue, triggerOut);
|
|
12
|
+
}
|
|
13
|
+
}, [onTriggerOut, triggerOutValue, triggerOut]);
|
|
14
|
+
useDeepCompareEffect(() => {
|
|
15
|
+
if (triggerOut.id !== null && onTriggerOutRef.current) {
|
|
16
|
+
onTriggerOutRef.current();
|
|
17
|
+
}
|
|
18
|
+
}, [triggerOut]);
|
|
19
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { CalendarSelection } from './CalendarSelection';
|
|
2
|
+
export declare const CalendarSelectionConstants: {
|
|
3
|
+
TRIGGER_OUT_MODE: {
|
|
4
|
+
readonly auto: "auto";
|
|
5
|
+
readonly manual: "manual";
|
|
6
|
+
};
|
|
7
|
+
SELECTION_KEY: {
|
|
8
|
+
readonly today: "today";
|
|
9
|
+
readonly yesterday: "yesterday";
|
|
10
|
+
readonly this_week: "this_week";
|
|
11
|
+
readonly last_7_days: "last_7_days";
|
|
12
|
+
readonly last_week: "last_week";
|
|
13
|
+
readonly last_14_days: "last_14_days";
|
|
14
|
+
readonly this_month: "this_month";
|
|
15
|
+
readonly last_30_days: "last_30_days";
|
|
16
|
+
readonly last_month: "last_month";
|
|
17
|
+
readonly this_quarter: "this_quarter";
|
|
18
|
+
readonly last_quarter: "last_quarter";
|
|
19
|
+
readonly all_time: "all_time";
|
|
20
|
+
readonly custom: "custom";
|
|
21
|
+
readonly days_up_to_today: "days_up_to_today";
|
|
22
|
+
readonly days_up_to_yesterday: "days_up_to_yesterday";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type { TriggerOutInfo, CalendarSelectionValue } from './types';
|
|
@@ -0,0 +1,121 @@
|
|
|
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 { produce } from 'immer';
|
|
13
|
+
import { AUTO_UPDATE_TO_KEY, LOCAL_TIMEZONE, RANGE_LIMIT, SELECTION_KEY, TRIGGER_OUT_MODE, } from './constants';
|
|
14
|
+
import { generateRangeInfo, getRangeValue, genTriggerOut } from './utils';
|
|
15
|
+
import dayjs from 'dayjs';
|
|
16
|
+
import { ACTION_TYPES } from './actions';
|
|
17
|
+
const DEFAULT_VALUE = {
|
|
18
|
+
rangeInfo: { type: SELECTION_KEY.today },
|
|
19
|
+
rangeValue: [
|
|
20
|
+
{
|
|
21
|
+
start: dayjs().toISOString(),
|
|
22
|
+
end: dayjs().toISOString(),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
export const INITIAL_STATE = {
|
|
27
|
+
value: {
|
|
28
|
+
original: DEFAULT_VALUE,
|
|
29
|
+
current: DEFAULT_VALUE,
|
|
30
|
+
},
|
|
31
|
+
rangeLimit: RANGE_LIMIT,
|
|
32
|
+
timezone: LOCAL_TIMEZONE,
|
|
33
|
+
open: false,
|
|
34
|
+
triggerOut: {
|
|
35
|
+
// in reset => id reset to null => useTriggerOut not trigger
|
|
36
|
+
id: null,
|
|
37
|
+
mode: 'auto',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const reducer = (state, action) => produce(state, draft => {
|
|
41
|
+
switch (action.type) {
|
|
42
|
+
case ACTION_TYPES.initState: {
|
|
43
|
+
const { initData, needTriggerOut } = action.payload;
|
|
44
|
+
const { rangeInfo } = initData;
|
|
45
|
+
const defaultValue = getRangeValue({
|
|
46
|
+
rangeInfo,
|
|
47
|
+
currentRangeValue: initData.rangeValue,
|
|
48
|
+
});
|
|
49
|
+
const initState = Object.assign(Object.assign({}, INITIAL_STATE), { value: {
|
|
50
|
+
original: { rangeInfo, rangeValue: defaultValue },
|
|
51
|
+
current: { rangeInfo, rangeValue: defaultValue },
|
|
52
|
+
} });
|
|
53
|
+
if (needTriggerOut) {
|
|
54
|
+
initState.triggerOut = genTriggerOut({ mode: TRIGGER_OUT_MODE.auto });
|
|
55
|
+
}
|
|
56
|
+
return initState;
|
|
57
|
+
}
|
|
58
|
+
case ACTION_TYPES.changeRangeType: {
|
|
59
|
+
const newRangeInfo = generateRangeInfo(action.payload.rangeType);
|
|
60
|
+
if (newRangeInfo) {
|
|
61
|
+
draft.value.current.rangeInfo = newRangeInfo;
|
|
62
|
+
draft.value.current.rangeValue = getRangeValue({
|
|
63
|
+
rangeInfo: newRangeInfo,
|
|
64
|
+
currentRangeValue: state.value.current.rangeValue,
|
|
65
|
+
});
|
|
66
|
+
if (action.payload.callback) {
|
|
67
|
+
action.payload.callback(newRangeInfo);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case ACTION_TYPES.updateRangeInfo: {
|
|
73
|
+
const _a = action.payload.updateValue, { type } = _a, rest = __rest(_a, ["type"]);
|
|
74
|
+
let updated;
|
|
75
|
+
if (type && type !== state.value.current.rangeInfo.type) {
|
|
76
|
+
const rangeInfoByType = generateRangeInfo(type);
|
|
77
|
+
if (!rangeInfoByType)
|
|
78
|
+
break;
|
|
79
|
+
updated = Object.assign(Object.assign({}, rangeInfoByType), rest);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
updated = Object.assign(Object.assign({}, state.value.current.rangeInfo), action.payload.updateValue);
|
|
83
|
+
}
|
|
84
|
+
const rangeValue = getRangeValue({
|
|
85
|
+
rangeInfo: updated,
|
|
86
|
+
currentRangeValue: state.value.current.rangeValue,
|
|
87
|
+
});
|
|
88
|
+
draft.value.current.rangeInfo = updated;
|
|
89
|
+
draft.value.current.rangeValue = rangeValue;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case ACTION_TYPES.updateRangeValue: {
|
|
93
|
+
const { rangeValue, options } = action.payload;
|
|
94
|
+
const rangeType = state.value.current.rangeInfo.type;
|
|
95
|
+
if ((options === null || options === void 0 ? void 0 : options.isManual) && rangeType !== SELECTION_KEY.custom) {
|
|
96
|
+
draft.value.current.rangeInfo = {
|
|
97
|
+
type: SELECTION_KEY.custom,
|
|
98
|
+
autoUpdateTo: AUTO_UPDATE_TO_KEY.fixed,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
draft.value.current.rangeValue = rangeValue;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case ACTION_TYPES.togglePopover: {
|
|
105
|
+
draft.open = !state.open;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case ACTION_TYPES.apply: {
|
|
109
|
+
draft.value.original = state.value.current;
|
|
110
|
+
draft.open = false;
|
|
111
|
+
draft.triggerOut = genTriggerOut({ mode: TRIGGER_OUT_MODE.manual });
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case ACTION_TYPES.resetValue: {
|
|
115
|
+
draft.value.current = state.value.original;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
default:
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledPopover: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
|
|
3
|
+
_InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
|
|
4
|
+
}, any, {}, never>;
|
|
5
|
+
export declare const StyledPopoverContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const StyledPopoverBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Popover } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledPopover = styled(Popover) `
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
`;
|
|
6
|
+
export const StyledPopoverContainer = styled.div ``;
|
|
7
|
+
export const StyledPopoverBody = styled.div `
|
|
8
|
+
font-size: 12px;
|
|
9
|
+
display: flex;
|
|
10
|
+
max-height: 75vh;
|
|
11
|
+
|
|
12
|
+
overflow: auto;
|
|
13
|
+
`;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { PopoverProps } from 'antd';
|
|
2
|
+
import { Dispatch } from 'react';
|
|
3
|
+
import { ValueOf } from 'type-fest';
|
|
4
|
+
import { updateRangeInfo, changeRangeType, updateRangeValue, changeAutoUpdateTo, initState, togglePopover, apply, resetValue } from './actions';
|
|
5
|
+
import { SELECTION_KEY, AUTO_UPDATE_TO_KEY } from './constants';
|
|
6
|
+
import { TimeRangeDisplayProps } from './components/TimeRangeDisplay/TimeRangeDisplay';
|
|
7
|
+
export type CalendarSelectionProps = Partial<{
|
|
8
|
+
popoverProps: PopoverProps;
|
|
9
|
+
rangeLimit: number;
|
|
10
|
+
timezone: string;
|
|
11
|
+
toDay: Date;
|
|
12
|
+
value: CalendarSelectionValue;
|
|
13
|
+
timeDisplayProps: TimeRangeDisplayProps;
|
|
14
|
+
onChange: (value: CalendarSelectionValue, info: TriggerOutInfo) => void;
|
|
15
|
+
}>;
|
|
16
|
+
export type Range = (typeof SELECTION_KEY)[keyof typeof SELECTION_KEY];
|
|
17
|
+
export type ActionType = {
|
|
18
|
+
dispatch: Dispatch<Action>;
|
|
19
|
+
};
|
|
20
|
+
export type TriggerOutInfo = {
|
|
21
|
+
id: number | null;
|
|
22
|
+
mode: 'auto' | 'manual';
|
|
23
|
+
};
|
|
24
|
+
export type ReducerState = {
|
|
25
|
+
value: {
|
|
26
|
+
original: CalendarSelectionValue;
|
|
27
|
+
current: ReducerState['value']['original'];
|
|
28
|
+
};
|
|
29
|
+
triggerOut: TriggerOutInfo;
|
|
30
|
+
rangeLimit: number;
|
|
31
|
+
timezone: string;
|
|
32
|
+
open: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type Action = ReturnType<typeof changeRangeType> | ReturnType<typeof updateRangeInfo> | ReturnType<typeof updateRangeValue> | ReturnType<typeof changeAutoUpdateTo> | ReturnType<typeof initState> | ReturnType<typeof togglePopover> | ReturnType<typeof apply> | ReturnType<typeof resetValue>;
|
|
35
|
+
type ToDay = {
|
|
36
|
+
type: typeof SELECTION_KEY.today;
|
|
37
|
+
};
|
|
38
|
+
type Yesterday = {
|
|
39
|
+
type: typeof SELECTION_KEY.yesterday;
|
|
40
|
+
};
|
|
41
|
+
type ThisWeek = {
|
|
42
|
+
type: typeof SELECTION_KEY.this_week;
|
|
43
|
+
weekStartsOn: number;
|
|
44
|
+
};
|
|
45
|
+
type LastWeek = {
|
|
46
|
+
type: typeof SELECTION_KEY.last_week;
|
|
47
|
+
weekStartsOn: number;
|
|
48
|
+
};
|
|
49
|
+
type Last7Days = {
|
|
50
|
+
type: typeof SELECTION_KEY.last_7_days;
|
|
51
|
+
};
|
|
52
|
+
type Last14Days = {
|
|
53
|
+
type: typeof SELECTION_KEY.last_14_days;
|
|
54
|
+
};
|
|
55
|
+
type Last30Days = {
|
|
56
|
+
type: typeof SELECTION_KEY.last_30_days;
|
|
57
|
+
};
|
|
58
|
+
type ThisMonth = {
|
|
59
|
+
type: typeof SELECTION_KEY.this_month;
|
|
60
|
+
};
|
|
61
|
+
type LastMonth = {
|
|
62
|
+
type: typeof SELECTION_KEY.last_month;
|
|
63
|
+
};
|
|
64
|
+
type ThisQuarter = {
|
|
65
|
+
type: typeof SELECTION_KEY.this_quarter;
|
|
66
|
+
};
|
|
67
|
+
type LastQuarter = {
|
|
68
|
+
type: typeof SELECTION_KEY.last_quarter;
|
|
69
|
+
};
|
|
70
|
+
type AllTime = {
|
|
71
|
+
type: typeof SELECTION_KEY.all_time;
|
|
72
|
+
};
|
|
73
|
+
export type AutoUpdateTo = ValueOf<typeof AUTO_UPDATE_TO_KEY>;
|
|
74
|
+
export type Custom = {
|
|
75
|
+
type: typeof SELECTION_KEY.custom;
|
|
76
|
+
autoUpdateTo: AutoUpdateTo;
|
|
77
|
+
};
|
|
78
|
+
export type DaysUpToToday = {
|
|
79
|
+
type: typeof SELECTION_KEY.days_up_to_today;
|
|
80
|
+
numOfDays: number;
|
|
81
|
+
};
|
|
82
|
+
export type DaysUpToYesterday = {
|
|
83
|
+
type: typeof SELECTION_KEY.days_up_to_yesterday;
|
|
84
|
+
numOfDays: number;
|
|
85
|
+
};
|
|
86
|
+
export type RangeInfo = Custom | ToDay | Yesterday | ThisWeek | LastWeek | Last7Days | Last14Days | Last30Days | ThisMonth | LastMonth | ThisQuarter | LastQuarter | AllTime | DaysUpToToday | DaysUpToYesterday;
|
|
87
|
+
export type RangeValue = {
|
|
88
|
+
start: string | null;
|
|
89
|
+
end: string | null;
|
|
90
|
+
label?: string;
|
|
91
|
+
color?: string;
|
|
92
|
+
};
|
|
93
|
+
export type CalendarSelectionValue = {
|
|
94
|
+
rangeInfo: RangeInfo;
|
|
95
|
+
rangeValue: RangeValue[];
|
|
96
|
+
};
|
|
97
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|