@gooddata/sdk-ui-filters 11.14.0 → 11.15.0-alpha.1
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/esm/DateFilter/DateFilterBody/CalendarTypeTabs.d.ts +12 -0
- package/esm/DateFilter/DateFilterBody/CalendarTypeTabs.d.ts.map +1 -0
- package/esm/DateFilter/DateFilterBody/CalendarTypeTabs.js +22 -0
- package/esm/DateFilter/DateFilterBody/CalendarTypeTabs.js.map +1 -0
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContent.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContent.js +16 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContent.js.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContentFiltered.d.ts +7 -2
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContentFiltered.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContentFiltered.js +4 -3
- package/esm/DateFilter/DateFilterBody/DateFilterBodyContentFiltered.js.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyMobileContent.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyMobileContent.js +10 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyMobileContent.js.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyRedesigned.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/DateFilterBodyRedesigned.js +30 -6
- package/esm/DateFilter/DateFilterBody/DateFilterBodyRedesigned.js.map +1 -1
- package/esm/DateFilter/DateFilterBody/RelativePresetFilterItems.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterBody/RelativePresetFilterItems.js +3 -0
- package/esm/DateFilter/DateFilterBody/RelativePresetFilterItems.js.map +1 -1
- package/esm/DateFilter/DateFilterButtonLocalized/DateFilterButtonLocalized.js +2 -2
- package/esm/DateFilter/DateFilterButtonLocalized/DateFilterButtonLocalized.js.map +1 -1
- package/esm/DateFilter/DateFilterTextLocalized/DateFilterTextLocalized.d.ts +10 -2
- package/esm/DateFilter/DateFilterTextLocalized/DateFilterTextLocalized.d.ts.map +1 -1
- package/esm/DateFilter/DateFilterTextLocalized/DateFilterTextLocalized.js +4 -4
- package/esm/DateFilter/DateFilterTextLocalized/DateFilterTextLocalized.js.map +1 -1
- package/esm/DateFilter/DynamicSelect/utils.d.ts +3 -0
- package/esm/DateFilter/DynamicSelect/utils.d.ts.map +1 -1
- package/esm/DateFilter/DynamicSelect/utils.js +6 -0
- package/esm/DateFilter/DynamicSelect/utils.js.map +1 -1
- package/esm/DateFilter/RelativeDateFilterForm/GranularityTabs.d.ts.map +1 -1
- package/esm/DateFilter/RelativeDateFilterForm/GranularityTabs.js +12 -9
- package/esm/DateFilter/RelativeDateFilterForm/GranularityTabs.js.map +1 -1
- package/esm/DateFilter/constants/i18n.d.ts +26 -0
- package/esm/DateFilter/constants/i18n.d.ts.map +1 -1
- package/esm/DateFilter/constants/i18n.js +25 -0
- package/esm/DateFilter/constants/i18n.js.map +1 -1
- package/esm/DateFilter/index.d.ts +9 -4
- package/esm/DateFilter/index.d.ts.map +1 -1
- package/esm/DateFilter/index.js +1 -0
- package/esm/DateFilter/index.js.map +1 -1
- package/esm/DateFilter/utils/Translations/DateFilterTitle.d.ts +5 -4
- package/esm/DateFilter/utils/Translations/DateFilterTitle.d.ts.map +1 -1
- package/esm/DateFilter/utils/Translations/DateFilterTitle.js +17 -15
- package/esm/DateFilter/utils/Translations/DateFilterTitle.js.map +1 -1
- package/esm/DateFilter/utils/presetFilterUtils.d.ts +116 -0
- package/esm/DateFilter/utils/presetFilterUtils.d.ts.map +1 -0
- package/esm/DateFilter/utils/presetFilterUtils.js +197 -0
- package/esm/DateFilter/utils/presetFilterUtils.js.map +1 -0
- package/esm/MeasureValueFilter/AttributePicker.d.ts +12 -2
- package/esm/MeasureValueFilter/AttributePicker.d.ts.map +1 -1
- package/esm/MeasureValueFilter/AttributePicker.js +94 -68
- package/esm/MeasureValueFilter/AttributePicker.js.map +1 -1
- package/esm/MeasureValueFilter/DateDatasetPickerItem.d.ts +31 -0
- package/esm/MeasureValueFilter/DateDatasetPickerItem.d.ts.map +1 -0
- package/esm/MeasureValueFilter/DateDatasetPickerItem.js +26 -0
- package/esm/MeasureValueFilter/DateDatasetPickerItem.js.map +1 -0
- package/esm/MeasureValueFilter/DimensionalitySection.d.ts +8 -0
- package/esm/MeasureValueFilter/DimensionalitySection.d.ts.map +1 -1
- package/esm/MeasureValueFilter/DimensionalitySection.js +38 -28
- package/esm/MeasureValueFilter/DimensionalitySection.js.map +1 -1
- package/esm/MeasureValueFilter/Dropdown.d.ts +3 -0
- package/esm/MeasureValueFilter/Dropdown.d.ts.map +1 -1
- package/esm/MeasureValueFilter/Dropdown.js +2 -2
- package/esm/MeasureValueFilter/Dropdown.js.map +1 -1
- package/esm/MeasureValueFilter/DropdownBody.d.ts +3 -0
- package/esm/MeasureValueFilter/DropdownBody.d.ts.map +1 -1
- package/esm/MeasureValueFilter/DropdownBody.js +4 -3
- package/esm/MeasureValueFilter/DropdownBody.js.map +1 -1
- package/esm/MeasureValueFilter/MeasureValueFilterDropdown.d.ts.map +1 -1
- package/esm/MeasureValueFilter/MeasureValueFilterDropdown.js +11 -21
- package/esm/MeasureValueFilter/MeasureValueFilterDropdown.js.map +1 -1
- package/esm/MeasureValueFilter/OperatorDropdown.d.ts.map +1 -1
- package/esm/MeasureValueFilter/OperatorDropdown.js +2 -2
- package/esm/MeasureValueFilter/OperatorDropdown.js.map +1 -1
- package/esm/MeasureValueFilter/typings.d.ts +46 -1
- package/esm/MeasureValueFilter/typings.d.ts.map +1 -1
- package/esm/MeasureValueFilter/typings.js.map +1 -1
- package/esm/MeasureValueFilter/useAttributePickerItemsData.d.ts +25 -0
- package/esm/MeasureValueFilter/useAttributePickerItemsData.d.ts.map +1 -0
- package/esm/MeasureValueFilter/useAttributePickerItemsData.js +86 -0
- package/esm/MeasureValueFilter/useAttributePickerItemsData.js.map +1 -0
- package/esm/MeasureValueFilter/useAttributePickerListboxItems.d.ts +36 -0
- package/esm/MeasureValueFilter/useAttributePickerListboxItems.d.ts.map +1 -0
- package/esm/MeasureValueFilter/useAttributePickerListboxItems.js +120 -0
- package/esm/MeasureValueFilter/useAttributePickerListboxItems.js.map +1 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/internal.d.ts +1 -0
- package/esm/internal.d.ts.map +1 -1
- package/esm/internal.js +2 -1
- package/esm/internal.js.map +1 -1
- package/esm/locales.d.ts.map +1 -1
- package/esm/locales.js +40 -0
- package/esm/locales.js.map +1 -1
- package/esm/sdk-ui-filters.d.ts +162 -3
- package/package.json +10 -10
- package/styles/css/main.css +89 -6
- package/styles/css/main.css.map +1 -1
- package/styles/css/measureValueFilter.css +89 -6
- package/styles/css/measureValueFilter.css.map +1 -1
- package/styles/scss/measureValueFilter.scss +108 -6
|
@@ -3,22 +3,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { sortBy } from "lodash-es";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import { messages } from "../../locales.js";
|
|
6
|
-
import {
|
|
6
|
+
import { granularityIntlCodesFull } from "../constants/i18n.js";
|
|
7
7
|
import { Tab, TabsWrapper } from "../Tabs/Tabs.js";
|
|
8
8
|
const granularityOrders = {
|
|
9
|
-
"GDC.time.
|
|
10
|
-
"GDC.time.
|
|
11
|
-
"GDC.time.
|
|
12
|
-
"GDC.time.
|
|
13
|
-
"GDC.time.
|
|
14
|
-
"GDC.time.
|
|
15
|
-
"GDC.time.
|
|
9
|
+
"GDC.time.fiscal_year": 0,
|
|
10
|
+
"GDC.time.fiscal_quarter": 1,
|
|
11
|
+
"GDC.time.fiscal_month": 2,
|
|
12
|
+
"GDC.time.year": 3,
|
|
13
|
+
"GDC.time.quarter": 4,
|
|
14
|
+
"GDC.time.month": 5,
|
|
15
|
+
"GDC.time.week_us": 6,
|
|
16
|
+
"GDC.time.date": 7,
|
|
17
|
+
"GDC.time.hour": 8,
|
|
18
|
+
"GDC.time.minute": 9,
|
|
16
19
|
};
|
|
17
20
|
const sortGranularities = (granularities) => sortBy(granularities, (granularity) => granularityOrders[granularity]);
|
|
18
21
|
export function GranularityTabs({ availableGranularities, selectedGranularity, accessibilityConfig, onSelectedGranularityChange, }) {
|
|
19
22
|
return (_jsx(TabsWrapper, { className: "gd-relative-filter-form-granularity-tabs s-relative-filter-form-granularity-tabs", children: sortGranularities(availableGranularities)
|
|
20
23
|
.map((granularity) => {
|
|
21
|
-
const intlGranularity =
|
|
24
|
+
const intlGranularity = granularityIntlCodesFull[granularity];
|
|
22
25
|
if (intlGranularity === undefined) {
|
|
23
26
|
return null;
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GranularityTabs.js","sourceRoot":"","sources":["../../../src/DateFilter/RelativeDateFilterForm/GranularityTabs.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"GranularityTabs.js","sourceRoot":"","sources":["../../../src/DateFilter/RelativeDateFilterForm/GranularityTabs.tsx"],"names":[],"mappings":";AAAA,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MA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1,9 +1,35 @@
|
|
|
1
1
|
import { type DateFilterGranularity } from "@gooddata/sdk-model";
|
|
2
2
|
/**
|
|
3
|
+
* Label mode for date filter display.
|
|
4
|
+
* - "short": Abbreviated labels suitable for list context (group heading provides granularity info)
|
|
5
|
+
* - "full": Complete labels suitable for standalone display (button, selected value)
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export type DateFilterLabelMode = "short" | "full";
|
|
9
|
+
/**
|
|
10
|
+
* Short-form intl keys for granularities.
|
|
3
11
|
* @beta
|
|
4
12
|
*/
|
|
5
13
|
export type GranularityIntlKey = "day" | "minute" | "hour" | "week" | "month" | "quarter" | "year";
|
|
14
|
+
/**
|
|
15
|
+
* Full-form intl keys for granularities (includes fiscal variants).
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export type GranularityIntlKeyFull = GranularityIntlKey | "fiscalmonth" | "fiscalquarter" | "fiscalyear";
|
|
19
|
+
/**
|
|
20
|
+
* Maps granularity to short-form intl key. Fiscal granularities map to their non-fiscal equivalents
|
|
21
|
+
* for abbreviated display (e.g., in lists where group heading already indicates "Fiscal").
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
6
24
|
export declare const granularityIntlCodes: {
|
|
7
25
|
[key in DateFilterGranularity]: GranularityIntlKey;
|
|
8
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Maps granularity to full-form intl key. Each granularity maps to its specific intl key
|
|
29
|
+
* for complete display (e.g., in buttons or selected values where context is needed).
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export declare const granularityIntlCodesFull: {
|
|
33
|
+
[key in DateFilterGranularity]: GranularityIntlKeyFull;
|
|
34
|
+
};
|
|
9
35
|
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/constants/i18n.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/constants/i18n.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnG;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,aAAa,GAAG,eAAe,GAAG,YAAY,CAAC;AAEzG;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE;KAC9B,GAAG,IAAI,qBAAqB,GAAG,kBAAkB;CAYrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE;KAClC,GAAG,IAAI,qBAAqB,GAAG,sBAAsB;CAYzD,CAAC"}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps granularity to short-form intl key. Fiscal granularities map to their non-fiscal equivalents
|
|
3
|
+
* for abbreviated display (e.g., in lists where group heading already indicates "Fiscal").
|
|
4
|
+
* @beta
|
|
5
|
+
*/
|
|
1
6
|
export const granularityIntlCodes = {
|
|
2
7
|
"GDC.time.minute": "minute",
|
|
3
8
|
"GDC.time.hour": "hour",
|
|
4
9
|
"GDC.time.date": "day",
|
|
5
10
|
"GDC.time.week_us": "week",
|
|
6
11
|
"GDC.time.month": "month",
|
|
12
|
+
"GDC.time.fiscal_month": "month",
|
|
7
13
|
"GDC.time.quarter": "quarter",
|
|
14
|
+
"GDC.time.fiscal_quarter": "quarter",
|
|
8
15
|
"GDC.time.year": "year",
|
|
16
|
+
"GDC.time.fiscal_year": "year",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Maps granularity to full-form intl key. Each granularity maps to its specific intl key
|
|
20
|
+
* for complete display (e.g., in buttons or selected values where context is needed).
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export const granularityIntlCodesFull = {
|
|
24
|
+
"GDC.time.minute": "minute",
|
|
25
|
+
"GDC.time.hour": "hour",
|
|
26
|
+
"GDC.time.date": "day",
|
|
27
|
+
"GDC.time.week_us": "week",
|
|
28
|
+
"GDC.time.month": "month",
|
|
29
|
+
"GDC.time.fiscal_month": "fiscalmonth",
|
|
30
|
+
"GDC.time.quarter": "quarter",
|
|
31
|
+
"GDC.time.fiscal_quarter": "fiscalquarter",
|
|
32
|
+
"GDC.time.year": "year",
|
|
33
|
+
"GDC.time.fiscal_year": "fiscalyear",
|
|
9
34
|
};
|
|
10
35
|
//# sourceMappingURL=i18n.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/DateFilter/constants/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/DateFilter/constants/i18n.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAE7B;IACA,iBAAiB,EAAE,QAAQ;IAC3B,eAAe,EAAE,MAAM;IACvB,eAAe,EAAE,KAAK;IACtB,kBAAkB,EAAE,MAAM;IAC1B,gBAAgB,EAAE,OAAO;IACzB,uBAAuB,EAAE,OAAO;IAChC,kBAAkB,EAAE,SAAS;IAC7B,yBAAyB,EAAE,SAAS;IACpC,eAAe,EAAE,MAAM;IACvB,sBAAsB,EAAE,MAAM;CACjC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC;IACA,iBAAiB,EAAE,QAAQ;IAC3B,eAAe,EAAE,MAAM;IACvB,eAAe,EAAE,KAAK;IACtB,kBAAkB,EAAE,MAAM;IAC1B,gBAAgB,EAAE,OAAO;IACzB,uBAAuB,EAAE,aAAa;IACtC,kBAAkB,EAAE,SAAS;IAC7B,yBAAyB,EAAE,eAAe;IAC1C,eAAe,EAAE,MAAM;IACvB,sBAAsB,EAAE,YAAY;CACvC,CAAC"}
|
|
@@ -6,13 +6,16 @@ export type { IDateAndMessageTranslator, IDateTranslator, IMessageTranslator, }
|
|
|
6
6
|
*/
|
|
7
7
|
declare const DateFilterHelpers: {
|
|
8
8
|
validateFilterOption: (filterOption: import("./interfaces/index.js").DateFilterOption) => import("./interfaces/index.js").IExtendedDateFilterErrors;
|
|
9
|
-
getDateFilterTitleUsingTranslator: (filter: import("./interfaces/index.js").DateFilterOption, translator: import("./utils/Translations/Translators.js").IDateAndMessageTranslator, dateFormat?: string) => string;
|
|
10
|
-
getDateFilterRepresentation: (filter: import("./interfaces/index.js").DateFilterOption, locale: import("@gooddata/sdk-ui").ILocale, messages: import("@gooddata/sdk-ui").ITranslations, dateFormat?: string) => string;
|
|
9
|
+
getDateFilterTitleUsingTranslator: (filter: import("./interfaces/index.js").DateFilterOption, translator: import("./utils/Translations/Translators.js").IDateAndMessageTranslator, dateFormat?: string, labelMode?: import("./constants/i18n.js").DateFilterLabelMode) => string;
|
|
10
|
+
getDateFilterRepresentation: (filter: import("./interfaces/index.js").DateFilterOption, locale: import("@gooddata/sdk-ui").ILocale, messages: import("@gooddata/sdk-ui").ITranslations, dateFormat?: string, labelMode?: import("./constants/i18n.js").DateFilterLabelMode) => string;
|
|
11
11
|
granularityIntlCodes: {
|
|
12
12
|
"GDC.time.year": import("./constants/i18n.js").GranularityIntlKey;
|
|
13
|
+
"GDC.time.fiscal_year": import("./constants/i18n.js").GranularityIntlKey;
|
|
13
14
|
"GDC.time.week_us": import("./constants/i18n.js").GranularityIntlKey;
|
|
14
15
|
"GDC.time.quarter": import("./constants/i18n.js").GranularityIntlKey;
|
|
16
|
+
"GDC.time.fiscal_quarter": import("./constants/i18n.js").GranularityIntlKey;
|
|
15
17
|
"GDC.time.month": import("./constants/i18n.js").GranularityIntlKey;
|
|
18
|
+
"GDC.time.fiscal_month": import("./constants/i18n.js").GranularityIntlKey;
|
|
16
19
|
"GDC.time.date": import("./constants/i18n.js").GranularityIntlKey;
|
|
17
20
|
"GDC.time.hour": import("./constants/i18n.js").GranularityIntlKey;
|
|
18
21
|
"GDC.time.minute": import("./constants/i18n.js").GranularityIntlKey;
|
|
@@ -22,7 +25,7 @@ declare const DateFilterHelpers: {
|
|
|
22
25
|
canExcludeCurrentPeriod: (dateFilterOption: import("./interfaces/index.js").DateFilterOption) => boolean;
|
|
23
26
|
mapOptionToAfm: (value: import("./interfaces/index.js").DateFilterOption, dateDataSet: import("@gooddata/sdk-model").ObjRef, excludeCurrentPeriod: boolean) => import("@gooddata/sdk-model").IDateFilter | null;
|
|
24
27
|
formatAbsoluteDateRange: (from: Date | string, to: Date | string, dateFormat: string, splitter?: string) => string;
|
|
25
|
-
formatRelativeDateRange: (from: number, to: number, granularity: import("@gooddata/sdk-model").DateFilterGranularity, translator: import("./utils/Translations/Translators.js").IDateAndMessageTranslator, boundedFilter?: import("@gooddata/sdk-model").IUpperBoundedFilter | import("@gooddata/sdk-model").ILowerBoundedFilter) => string;
|
|
28
|
+
formatRelativeDateRange: (from: number, to: number, granularity: import("@gooddata/sdk-model").DateFilterGranularity, translator: import("./utils/Translations/Translators.js").IDateAndMessageTranslator, boundedFilter?: import("@gooddata/sdk-model").IUpperBoundedFilter | import("@gooddata/sdk-model").ILowerBoundedFilter, labelMode?: import("./constants/i18n.js").DateFilterLabelMode) => string;
|
|
26
29
|
filterVisibleDateFilterOptions: typeof filterVisibleDateFilterOptions;
|
|
27
30
|
};
|
|
28
31
|
export type { IDateFilterCallbackProps, IDateFilterOwnProps, IDateFilterProps, IDateFilterState, IDateFilterStatePropsIntersection, };
|
|
@@ -31,7 +34,9 @@ export type { AbsoluteDateFilterOption, DateFilterOption, DateFilterRelativeOpti
|
|
|
31
34
|
export { isAbsoluteDateFilterOption, isRelativeDateFilterOption, isRelativeDateFilterWithBoundOption, isUiRelativeDateFilterForm, } from "./interfaces/index.js";
|
|
32
35
|
export type { IFilterConfigurationProps } from "./DateFilterBody/types.js";
|
|
33
36
|
export { defaultDateFilterOptions } from "./constants/config.js";
|
|
34
|
-
export type { GranularityIntlKey } from "./constants/i18n.js";
|
|
37
|
+
export type { GranularityIntlKey, DateFilterLabelMode } from "./constants/i18n.js";
|
|
35
38
|
export { getLocalizedIcuDateFormatPattern } from "./utils/FormattingUtils.js";
|
|
36
39
|
export type { IDateFilterButtonProps } from "./DateFilterButton/DateFilterButton.js";
|
|
40
|
+
export type { CalendarTabType, IFiscalTabsConfig, IUiRelativeDateFilterFormLike, } from "./utils/presetFilterUtils.js";
|
|
41
|
+
export { getFiscalTabsConfig, hasFiscalPresets, hasStandardPresets, filterStandardPresets, filterFiscalPresets, filterStandardGranularities, filterFiscalGranularities, getTabForPreset, isFiscalGranularity, ensureCompatibleGranularity, } from "./utils/presetFilterUtils.js";
|
|
37
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateFilter/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iCAAiC,EACzC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AASxE,YAAY,EACR,yBAAyB,EACzB,eAAe,EACf,kBAAkB,GACrB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,QAAA,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateFilter/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,mB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yB,EACzB,eAAe,EACf,mBAAmB,EACnB,2BAA2B,GAC9B,MAAM,8BAA8B,CAAC"}
|
package/esm/DateFilter/index.js
CHANGED
|
@@ -27,4 +27,5 @@ export { DateFilter, DateFilterHelpers, filterVisibleDateFilterOptions };
|
|
|
27
27
|
export { isAbsoluteDateFilterOption, isRelativeDateFilterOption, isRelativeDateFilterWithBoundOption, isUiRelativeDateFilterForm, } from "./interfaces/index.js";
|
|
28
28
|
export { defaultDateFilterOptions } from "./constants/config.js";
|
|
29
29
|
export { getLocalizedIcuDateFormatPattern } from "./utils/FormattingUtils.js";
|
|
30
|
+
export { getFiscalTabsConfig, hasFiscalPresets, hasStandardPresets, filterStandardPresets, filterFiscalPresets, filterStandardGranularities, filterFiscalGranularities, getTabForPreset, isFiscalGranularity, ensureCompatibleGranularity, } from "./utils/presetFilterUtils.js";
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DateFilter/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACH,UAAU,GAMb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,iCAAiC,GACpC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAOxE;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACtB,oBAAoB;IACpB,iCAAiC;IACjC,2BAA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,EAAE,CAAC;AAezE,OAAO,EACH,0BAA0B,EAC1B,0BAA0B,EAC1B,mCAAmC,EACnC,0BAA0B,GAC7B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAQ9E,OAAO,EACH,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,2BAA2B,GAC9B,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type DateFilterGranularity, type ILowerBoundedFilter, type IUpperBoundedFilter } from "@gooddata/sdk-model";
|
|
2
2
|
import { type ILocale, type ITranslations } from "@gooddata/sdk-ui";
|
|
3
3
|
import { type IDateAndMessageTranslator } from "./Translators.js";
|
|
4
|
+
import { type DateFilterLabelMode } from "../../constants/i18n.js";
|
|
4
5
|
import { type DateFilterOption } from "../../interfaces/index.js";
|
|
5
6
|
export declare const getTimeRange: (dateFrom: Date, dateTo: Date, splitter?: string) => string;
|
|
6
7
|
export declare const formatAbsoluteDateRange: (from: Date | string, to: Date | string, dateFormat: string, splitter?: string) => string;
|
|
7
|
-
export declare const formatRelativeDateRange: (from: number, to: number, granularity: DateFilterGranularity, translator: IDateAndMessageTranslator, boundedFilter?: IUpperBoundedFilter | ILowerBoundedFilter) => string;
|
|
8
|
-
export declare const getDateFilterRepresentationByFilterType: (filter: DateFilterOption, translator: IDateAndMessageTranslator, dateFormat: string) => string;
|
|
8
|
+
export declare const formatRelativeDateRange: (from: number, to: number, granularity: DateFilterGranularity, translator: IDateAndMessageTranslator, boundedFilter?: IUpperBoundedFilter | ILowerBoundedFilter, labelMode?: DateFilterLabelMode) => string;
|
|
9
|
+
export declare const getDateFilterRepresentationByFilterType: (filter: DateFilterOption, translator: IDateAndMessageTranslator, dateFormat: string, labelMode?: DateFilterLabelMode) => string;
|
|
9
10
|
/**
|
|
10
11
|
* Gets the filter title using provided intl object.
|
|
11
12
|
* @returns Representation of the filter (e.g. "My preset", "From 2 weeks ago to 1 week ahead")
|
|
12
13
|
*/
|
|
13
|
-
export declare const getDateFilterTitleUsingTranslator: (filter: DateFilterOption, translator: IDateAndMessageTranslator, dateFormat?: string) => string;
|
|
14
|
-
export declare const getDateFilterRepresentation: (filter: DateFilterOption, locale: ILocale, messages: ITranslations, dateFormat?: string) => string;
|
|
14
|
+
export declare const getDateFilterTitleUsingTranslator: (filter: DateFilterOption, translator: IDateAndMessageTranslator, dateFormat?: string, labelMode?: DateFilterLabelMode) => string;
|
|
15
|
+
export declare const getDateFilterRepresentation: (filter: DateFilterOption, locale: ILocale, messages: ITranslations, dateFormat?: string, labelMode?: DateFilterLabelMode) => string;
|
|
15
16
|
//# sourceMappingURL=DateFilterTitle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilterTitle.d.ts","sourceRoot":"","sources":["../../../../src/DateFilter/utils/Translations/DateFilterTitle.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EAO3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,KAAK,yBAAyB,EAA2B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DateFilterTitle.d.ts","sourceRoot":"","sources":["../../../../src/DateFilter/utils/Translations/DateFilterTitle.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EAO3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,KAAK,yBAAyB,EAA2B,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EACH,KAAK,mBAAmB,EAG3B,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EACH,KAAK,gBAAgB,EAGxB,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,YAAY,GAAI,UAAU,IAAI,EAAE,QAAQ,IAAI,EAAE,iBAAmB,KAAG,MAKhF,CAAC;AAoBF,eAAO,MAAM,uBAAuB,GAChC,MAAM,IAAI,GAAG,MAAM,EACnB,IAAI,IAAI,GAAG,MAAM,EACjB,YAAY,MAAM,EAClB,iBAAmB,KACpB,MA2BF,CAAC;AA+FF,eAAO,MAAM,uBAAuB,GAChC,MAAM,MAAM,EACZ,IAAI,MAAM,EACV,aAAa,qBAAqB,EAClC,YAAY,yBAAyB,EACrC,gBAAgB,mBAAmB,GAAG,mBAAmB,EACzD,YAAW,mBAA6B,KACzC,MAWF,CAAC;AA6CF,eAAO,MAAM,uCAAuC,GAChD,QAAQ,gBAAgB,EACxB,YAAY,yBAAyB,EACrC,YAAY,MAAM,EAClB,YAAW,mBAA6B,WAgB3C,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAC1C,QAAQ,gBAAgB,EACxB,YAAY,yBAAyB,EACrC,aAAY,MAA4B,EACxC,YAAW,mBAA6B,KACzC,MAA4F,CAAC;AA2BhG,eAAO,MAAM,2BAA2B,GACpC,QAAQ,gBAAgB,EACxB,QAAQ,OAAO,EACf,UAAU,aAAa,EACvB,aAAY,MAA4B,EACxC,YAAW,mBAA6B,KACzC,MAIF,CAAC"}
|
|
@@ -5,7 +5,7 @@ import moment from "moment";
|
|
|
5
5
|
import { isAbsoluteDateFilterForm, isAbsoluteDateFilterPreset, isAllTimeDateFilterOption, isRelativeDateFilterForm, isRelativeDateFilterPreset, isUpperBound, } from "@gooddata/sdk-model";
|
|
6
6
|
import { getIntl } from "@gooddata/sdk-ui";
|
|
7
7
|
import { messages } from "../../../locales.js";
|
|
8
|
-
import { granularityIntlCodes } from "../../constants/i18n.js";
|
|
8
|
+
import { granularityIntlCodes, granularityIntlCodesFull, } from "../../constants/i18n.js";
|
|
9
9
|
import { DAY_END_TIME, DAY_START_TIME, DEFAULT_DATE_FORMAT, TIME_FORMAT, TIME_FORMAT_WITH_SEPARATOR, } from "../../constants/Platform.js";
|
|
10
10
|
import { convertPlatformDateStringToDate } from "../DateConversions.js";
|
|
11
11
|
export const getTimeRange = (dateFrom, dateTo, splitter = "\u2013") => {
|
|
@@ -123,8 +123,9 @@ const relativeDateRangeFormatters = [
|
|
|
123
123
|
}),
|
|
124
124
|
},
|
|
125
125
|
];
|
|
126
|
-
export const formatRelativeDateRange = (from, to, granularity, translator, boundedFilter) => {
|
|
127
|
-
const
|
|
126
|
+
export const formatRelativeDateRange = (from, to, granularity, translator, boundedFilter, labelMode = "short") => {
|
|
127
|
+
const intlCodes = labelMode === "full" ? granularityIntlCodesFull : granularityIntlCodes;
|
|
128
|
+
const intlGranularity = intlCodes[granularity];
|
|
128
129
|
if (intlGranularity === undefined) {
|
|
129
130
|
return granularity; // in the case when invalid granularity was found in metadata
|
|
130
131
|
}
|
|
@@ -137,18 +138,19 @@ export const formatRelativeDateRange = (from, to, granularity, translator, bound
|
|
|
137
138
|
const getAllTimeFilterRepresentation = (translator) => translator.formatMessage({ id: "filters.allTime.title" });
|
|
138
139
|
const getAbsoluteFormFilterRepresentation = (filter, dateFormat) => (filter.from && filter.to ? formatAbsoluteDateRange(filter.from, filter.to, dateFormat) : "");
|
|
139
140
|
const getAbsolutePresetFilterRepresentation = (filter, dateFormat) => formatAbsoluteDateRange(filter.from, filter.to, dateFormat);
|
|
140
|
-
const getRelativeFormFilterRepresentation = (filter, translator) => typeof filter.from === "number" && typeof filter.to === "number" && filter.granularity
|
|
141
|
-
? formatRelativeDateRange(filter.from, filter.to, filter.granularity, translator, filter.boundedFilter)
|
|
141
|
+
const getRelativeFormFilterRepresentation = (filter, translator, labelMode = "short") => typeof filter.from === "number" && typeof filter.to === "number" && filter.granularity
|
|
142
|
+
? formatRelativeDateRange(filter.from, filter.to, filter.granularity, translator, filter.boundedFilter, labelMode)
|
|
142
143
|
: "";
|
|
143
|
-
const getRelativePresetFilterRepresentation = (filter, translator) => formatRelativeDateRange(filter.from, filter.to, filter.granularity, translator, filter.boundedFilter);
|
|
144
|
-
export const getDateFilterRepresentationByFilterType = (filter, translator, dateFormat) => {
|
|
144
|
+
const getRelativePresetFilterRepresentation = (filter, translator, labelMode = "short") => formatRelativeDateRange(filter.from, filter.to, filter.granularity, translator, filter.boundedFilter, labelMode);
|
|
145
|
+
export const getDateFilterRepresentationByFilterType = (filter, translator, dateFormat, labelMode = "short") => {
|
|
145
146
|
if (isAbsoluteDateFilterForm(filter) || isRelativeDateFilterForm(filter)) {
|
|
146
|
-
return getDateFilterRepresentationUsingTranslator(filter, translator, dateFormat);
|
|
147
|
+
return getDateFilterRepresentationUsingTranslator(filter, translator, dateFormat, labelMode);
|
|
147
148
|
}
|
|
148
149
|
else if (isAllTimeDateFilterOption(filter) ||
|
|
149
150
|
isAbsoluteDateFilterPreset(filter) ||
|
|
150
151
|
isRelativeDateFilterPreset(filter)) {
|
|
151
|
-
return filter.name ||
|
|
152
|
+
return (filter.name ||
|
|
153
|
+
getDateFilterRepresentationUsingTranslator(filter, translator, dateFormat, labelMode));
|
|
152
154
|
}
|
|
153
155
|
else {
|
|
154
156
|
throw new Error("Unknown DateFilterOption type");
|
|
@@ -166,12 +168,12 @@ export const getDateFilterRepresentationByFilterType = (filter, translator, date
|
|
|
166
168
|
* Gets the filter title using provided intl object.
|
|
167
169
|
* @returns Representation of the filter (e.g. "My preset", "From 2 weeks ago to 1 week ahead")
|
|
168
170
|
*/
|
|
169
|
-
export const getDateFilterTitleUsingTranslator = (filter, translator, dateFormat = DEFAULT_DATE_FORMAT) => getDateFilterRepresentationByFilterType(filter, translator, dateFormat);
|
|
171
|
+
export const getDateFilterTitleUsingTranslator = (filter, translator, dateFormat = DEFAULT_DATE_FORMAT, labelMode = "short") => getDateFilterRepresentationByFilterType(filter, translator, dateFormat, labelMode);
|
|
170
172
|
/**
|
|
171
173
|
* Gets the filter representation regardless of custom name.
|
|
172
174
|
* @returns Representation of the filter (e.g. "From 2 weeks ago to 1 week ahead")
|
|
173
175
|
*/
|
|
174
|
-
const getDateFilterRepresentationUsingTranslator = (filter, translator, dateFormat) => {
|
|
176
|
+
const getDateFilterRepresentationUsingTranslator = (filter, translator, dateFormat, labelMode = "short") => {
|
|
175
177
|
if (isAbsoluteDateFilterForm(filter)) {
|
|
176
178
|
return getAbsoluteFormFilterRepresentation(filter, dateFormat);
|
|
177
179
|
}
|
|
@@ -182,17 +184,17 @@ const getDateFilterRepresentationUsingTranslator = (filter, translator, dateForm
|
|
|
182
184
|
return getAllTimeFilterRepresentation(translator);
|
|
183
185
|
}
|
|
184
186
|
else if (isRelativeDateFilterForm(filter)) {
|
|
185
|
-
return getRelativeFormFilterRepresentation(filter, translator);
|
|
187
|
+
return getRelativeFormFilterRepresentation(filter, translator, labelMode);
|
|
186
188
|
}
|
|
187
189
|
else if (isRelativeDateFilterPreset(filter)) {
|
|
188
|
-
return getRelativePresetFilterRepresentation(filter, translator);
|
|
190
|
+
return getRelativePresetFilterRepresentation(filter, translator, labelMode);
|
|
189
191
|
}
|
|
190
192
|
else {
|
|
191
193
|
throw new Error("Unknown DateFilterOption type");
|
|
192
194
|
}
|
|
193
195
|
};
|
|
194
|
-
export const getDateFilterRepresentation = (filter, locale, messages, dateFormat = DEFAULT_DATE_FORMAT) => {
|
|
196
|
+
export const getDateFilterRepresentation = (filter, locale, messages, dateFormat = DEFAULT_DATE_FORMAT, labelMode = "short") => {
|
|
195
197
|
const translator = getIntl(locale, messages);
|
|
196
|
-
return getDateFilterRepresentationUsingTranslator(filter, translator, dateFormat);
|
|
198
|
+
return getDateFilterRepresentationUsingTranslator(filter, translator, dateFormat, labelMode);
|
|
197
199
|
};
|
|
198
200
|
//# sourceMappingURL=DateFilterTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilterTitle.js","sourceRoot":"","sources":["../../../../src/DateFilter/utils/Translations/DateFilterTitle.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAMH,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG7E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"DateFilterTitle.js","sourceRoot":"","sources":["../../../../src/DateFilter/utils/Translations/DateFilterTitle.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAMH,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG7E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAEH,oBAAoB,EACpB,wBAAwB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,0BAA0B,GAC7B,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,+BA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E,SAAS,CAAC,CAAC;IAChF,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACrD,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACvC,MAAwB,EACxB,MAAe,EACf,QAAuB,EACvB,aAAqB,mBAAmB,EACxC,YAAiC,OAAO,EAClC,EAAE;IACR,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE7C,OAAO,0CAA0C,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACjG,CAAC,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type DateFilterGranularity } from "@gooddata/sdk-model";
|
|
2
|
+
import { type DateFilterOption, type DateFilterRelativeOptionGroup } from "../interfaces/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Type representing the calendar tab selection.
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export type CalendarTabType = "standard" | "fiscal";
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for fiscal calendar tabs.
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface IFiscalTabsConfig {
|
|
13
|
+
hasFiscal: boolean;
|
|
14
|
+
hasStandard: boolean;
|
|
15
|
+
showTabs: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get fiscal tabs configuration based on available presets.
|
|
19
|
+
* @param presets - The relative presets option group to check, or undefined
|
|
20
|
+
* @returns Configuration object with hasFiscal, hasStandard, and showTabs flags
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFiscalTabsConfig(presets: DateFilterRelativeOptionGroup | undefined): IFiscalTabsConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Check if the presets contain any fiscal granularities.
|
|
26
|
+
* @param presets - The relative presets option group to check
|
|
27
|
+
* @returns true if any fiscal granularities are present
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasFiscalPresets(presets: DateFilterRelativeOptionGroup): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the presets contain any standard granularities.
|
|
33
|
+
* @param presets - The relative presets option group to check
|
|
34
|
+
* @returns true if any standard granularities are present
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasStandardPresets(presets: DateFilterRelativeOptionGroup): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Filter presets for the Standard tab.
|
|
40
|
+
* @param presets - The relative presets option group to filter
|
|
41
|
+
* @returns Filtered presets containing only standard granularities
|
|
42
|
+
* @alpha
|
|
43
|
+
*/
|
|
44
|
+
export declare function filterStandardPresets(presets: DateFilterRelativeOptionGroup): DateFilterRelativeOptionGroup;
|
|
45
|
+
/**
|
|
46
|
+
* Filter presets for the Fiscal tab.
|
|
47
|
+
* @param presets - The relative presets option group to filter
|
|
48
|
+
* @returns Filtered presets containing fiscal granularities and shared granularities (week, day, hour, minute)
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
export declare function filterFiscalPresets(presets: DateFilterRelativeOptionGroup): DateFilterRelativeOptionGroup;
|
|
52
|
+
/**
|
|
53
|
+
* Determine which tab should be selected based on the selected preset's granularity.
|
|
54
|
+
* @param preset - The currently selected date filter option
|
|
55
|
+
* @returns "fiscal" if the preset uses a fiscal granularity, otherwise "standard"
|
|
56
|
+
* @alpha
|
|
57
|
+
*/
|
|
58
|
+
export declare function getTabForPreset(preset: DateFilterOption): CalendarTabType;
|
|
59
|
+
/**
|
|
60
|
+
* Check if a granularity is a fiscal granularity.
|
|
61
|
+
* @param granularity - The granularity to check
|
|
62
|
+
* @returns true if the granularity is fiscal (fiscal_year, fiscal_quarter, or fiscal_month)
|
|
63
|
+
* @alpha
|
|
64
|
+
*/
|
|
65
|
+
export declare function isFiscalGranularity(granularity: DateFilterGranularity): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Standard granularities that have fiscal equivalents.
|
|
68
|
+
* Used for filtering granularities when switching between standard/fiscal tabs.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare const STANDARD_GRANULARITIES_WITH_FISCAL_EQUIVALENT: DateFilterGranularity[];
|
|
72
|
+
/**
|
|
73
|
+
* Mapping from standard granularities to their fiscal equivalents.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export declare const STANDARD_TO_FISCAL_GRANULARITY: Partial<Record<DateFilterGranularity, DateFilterGranularity>>;
|
|
77
|
+
/**
|
|
78
|
+
* Mapping from fiscal granularities to their standard equivalents.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare const FISCAL_TO_STANDARD_GRANULARITY: Partial<Record<DateFilterGranularity, DateFilterGranularity>>;
|
|
82
|
+
/**
|
|
83
|
+
* Filter granularities for the standard tab view.
|
|
84
|
+
* Excludes all fiscal granularities.
|
|
85
|
+
* @param granularities - Available granularities to filter
|
|
86
|
+
* @returns Granularities suitable for standard tab
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
export declare function filterStandardGranularities(granularities: DateFilterGranularity[]): DateFilterGranularity[];
|
|
90
|
+
/**
|
|
91
|
+
* Filter granularities for the fiscal tab view.
|
|
92
|
+
* Includes fiscal granularities and shared granularities (week, day, hour, minute).
|
|
93
|
+
* @param granularities - Available granularities to filter
|
|
94
|
+
* @returns Granularities suitable for fiscal tab
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export declare function filterFiscalGranularities(granularities: DateFilterGranularity[]): DateFilterGranularity[];
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export interface IUiRelativeDateFilterFormLike {
|
|
102
|
+
granularity?: DateFilterGranularity;
|
|
103
|
+
from?: number;
|
|
104
|
+
to?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Ensures the granularity in a relative filter option is compatible with the available granularities.
|
|
108
|
+
* If the current granularity is not available, maps it to an equivalent or picks the first available.
|
|
109
|
+
* @param filterOption - The filter option to check/correct
|
|
110
|
+
* @param availableGranularities - List of available granularities
|
|
111
|
+
* @param fiscalFirst - Whether to prefer fiscal granularities when mapping
|
|
112
|
+
* @returns The filter option with a compatible granularity
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
export declare function ensureCompatibleGranularity<T extends IUiRelativeDateFilterFormLike>(filterOption: T, availableGranularities: DateFilterGranularity[], fiscalFirst: boolean): T;
|
|
116
|
+
//# sourceMappingURL=presetFilterUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presetFilterUtils.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/presetFilterUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAqCnG;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,6BAA6B,GAAG,SAAS,GAAG,iBAAiB,CAKzG;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAElF;AAaD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,6BAA6B,GAAG,6BAA6B,CAE3G;AAED;;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