@gooddata/sdk-ui-filters 11.50.0-alpha.2 → 11.50.0-alpha.3
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/utils/DateFilterConfigConversions.d.ts +15 -0
- package/esm/DateFilter/utils/DateFilterConfigConversions.d.ts.map +1 -0
- package/esm/DateFilter/utils/DateFilterConfigConversions.js +86 -0
- package/esm/DateFilter/utils/DateFilterOptionMapping.d.ts +46 -0
- package/esm/DateFilter/utils/DateFilterOptionMapping.d.ts.map +1 -0
- package/esm/DateFilter/utils/DateFilterOptionMapping.js +279 -0
- package/esm/DateFilter/utils/DefaultDateFilterConfig.d.ts +22 -0
- package/esm/DateFilter/utils/DefaultDateFilterConfig.d.ts.map +1 -0
- package/esm/DateFilter/utils/DefaultDateFilterConfig.js +447 -0
- package/esm/DateFilter/utils/OptionUtils.d.ts +1 -0
- package/esm/DateFilter/utils/OptionUtils.d.ts.map +1 -1
- package/esm/DateFilter/utils/OptionUtils.js +1 -1
- package/esm/DateFilter/utils/PeriodExclusion.d.ts +28 -0
- package/esm/DateFilter/utils/PeriodExclusion.d.ts.map +1 -1
- package/esm/DateFilter/utils/PeriodExclusion.js +22 -3
- package/esm/index.d.ts +4 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -0
- package/esm/sdk-ui-filters.d.ts +115 -0
- package/package.json +12 -12
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type IDateFilterConfig } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IDateFilterOptionsByType } from "../interfaces/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a workspace date filter config — as stored on the backend — into the date filter options
|
|
5
|
+
* the {@link DateFilter} component consumes (its `filterOptions` prop).
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Extracted from sdk-ui-dashboard so non-dashboard hosts (e.g. conditional formatting's date
|
|
9
|
+
* condition picker) consume the same workspace preset catalog; dashboards re-export it.
|
|
10
|
+
*
|
|
11
|
+
* @param config - date filter config from backend
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare function convertDateFilterConfigToDateFilterOptions(config: IDateFilterConfig): IDateFilterOptionsByType;
|
|
15
|
+
//# sourceMappingURL=DateFilterConfigConversions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateFilterConfigConversions.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/DateFilterConfigConversions.ts"],"names":[],"mappings":"AAKA,OAAO,EAIH,KAAK,iBAAiB,EAIzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGH,KAAK,wBAAwB,EAIhC,MAAM,wBAAwB,CAAC;AAOhC;;;;;;;;;;GAUG;AACH,wBAAgB,0CAA0C,CACtD,MAAM,EAAE,iBAAiB,GAC1B,wBAAwB,CAgB1B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// (C) 2019-2026 GoodData Corporation
|
|
2
|
+
import { endOfDay, format, startOfDay, subMonths } from "date-fns";
|
|
3
|
+
import { groupBy, max, min } from "lodash-es";
|
|
4
|
+
import { removeEmptyKeysFromDateFilterOptions } from "./OptionUtils.js";
|
|
5
|
+
// date-fns tokens of the platform date-time format (Platform.ts holds the moment spelling).
|
|
6
|
+
const PLATFORM_DATE_FORMAT = "yyyy-MM-dd HH:mm";
|
|
7
|
+
/**
|
|
8
|
+
* Converts a workspace date filter config — as stored on the backend — into the date filter options
|
|
9
|
+
* the {@link DateFilter} component consumes (its `filterOptions` prop).
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Extracted from sdk-ui-dashboard so non-dashboard hosts (e.g. conditional formatting's date
|
|
13
|
+
* condition picker) consume the same workspace preset catalog; dashboards re-export it.
|
|
14
|
+
*
|
|
15
|
+
* @param config - date filter config from backend
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function convertDateFilterConfigToDateFilterOptions(config) {
|
|
19
|
+
const allTime = convertAllTime(config.allTime);
|
|
20
|
+
const emptyValues = convertEmptyValues(config.emptyValues);
|
|
21
|
+
const absoluteForm = convertAbsoluteForm(config.absoluteForm);
|
|
22
|
+
const relativeForm = convertRelativeForm(config.relativeForm);
|
|
23
|
+
const absolutePreset = convertAbsolutePresets(config.absolutePresets);
|
|
24
|
+
const relativePreset = convertRelativePresets(config.relativePresets);
|
|
25
|
+
return removeEmptyKeysFromDateFilterOptions({
|
|
26
|
+
allTime,
|
|
27
|
+
emptyValues,
|
|
28
|
+
absoluteForm,
|
|
29
|
+
absolutePreset,
|
|
30
|
+
relativeForm,
|
|
31
|
+
relativePreset,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function convertAllTime(filter) {
|
|
35
|
+
return (filter && {
|
|
36
|
+
...filter,
|
|
37
|
+
type: "allTime",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function convertEmptyValues(filter) {
|
|
41
|
+
return (filter && {
|
|
42
|
+
...filter,
|
|
43
|
+
type: "emptyValues",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function convertAbsoluteForm(filter) {
|
|
47
|
+
const now = new Date();
|
|
48
|
+
return (filter && {
|
|
49
|
+
...filter,
|
|
50
|
+
from: format(startOfDay(subMonths(now, 1)), PLATFORM_DATE_FORMAT),
|
|
51
|
+
to: format(endOfDay(now), PLATFORM_DATE_FORMAT),
|
|
52
|
+
type: "absoluteForm",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function convertRelativeForm(filter) {
|
|
56
|
+
return (filter && {
|
|
57
|
+
from: undefined,
|
|
58
|
+
// we order the granularities anyway, this lets the user to config the default
|
|
59
|
+
granularity: filter.availableGranularities[0],
|
|
60
|
+
localIdentifier: filter.localIdentifier,
|
|
61
|
+
name: filter.name,
|
|
62
|
+
to: undefined,
|
|
63
|
+
type: "relativeForm",
|
|
64
|
+
visible: filter.visible,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function convertAbsolutePresets(filters) {
|
|
68
|
+
return filters?.map((preset) => sanitizeDateFilterOption({
|
|
69
|
+
...preset,
|
|
70
|
+
type: "absolutePreset",
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function convertRelativePresets(filters) {
|
|
74
|
+
return (filters &&
|
|
75
|
+
groupBy(filters.map((preset) => sanitizeDateFilterOption({
|
|
76
|
+
...preset,
|
|
77
|
+
type: "relativePreset",
|
|
78
|
+
})), (preset) => preset.granularity));
|
|
79
|
+
}
|
|
80
|
+
function sanitizeDateFilterOption(option) {
|
|
81
|
+
return {
|
|
82
|
+
...option,
|
|
83
|
+
from: min([option.from, option.to]),
|
|
84
|
+
to: max([option.from, option.to]),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type IDashboardDateFilter } from "@gooddata/sdk-model";
|
|
2
|
+
import { type DateFilterOption, type IDateFilterOptionsByType } from "../interfaces/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* A matched date filter option together with the reconstructed exclude-current-period state.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface IDateFilterOptionInfo {
|
|
9
|
+
dateFilterOption: DateFilterOption;
|
|
10
|
+
excludeCurrentPeriod: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tries to match a preset or a form with the provided value. Prioritizes the provided option if possible.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This is to handle cases when user picked a form and filled values that match an existing preset.
|
|
17
|
+
* In those cases we want to show the form as picked even though a preset would otherwise be preferred.
|
|
18
|
+
*
|
|
19
|
+
* @param dateFilter - value to match against
|
|
20
|
+
* @param availableOptions - date options available
|
|
21
|
+
* @param preferredOptionId - id of the option that should be matched first if possible
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare function matchDateFilterToDateFilterOptionWithPreference(dateFilter: IDashboardDateFilter | undefined, availableOptions: IDateFilterOptionsByType, preferredOptionId: string | undefined): IDateFilterOptionInfo;
|
|
25
|
+
/**
|
|
26
|
+
* Tries to match a preset or a form with the provided value. Prioritizes presets over forms.
|
|
27
|
+
* @param dateFilterValue - value to match against
|
|
28
|
+
* @param availableOptions - date options available
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export declare function matchDateFilterToDateFilterOption(dateFilter: IDashboardDateFilter | undefined, availableOptions: IDateFilterOptionsByType): IDateFilterOptionInfo;
|
|
32
|
+
/**
|
|
33
|
+
* Flattens the provided date filter options. The flattening maintains a stable, predefined order in which
|
|
34
|
+
* the options should be rendered by the date filter component.
|
|
35
|
+
*
|
|
36
|
+
* @param dateFilterOptions - available options to flatten
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export declare function flattenDateFilterOptions(dateFilterOptions: IDateFilterOptionsByType): DateFilterOption[];
|
|
40
|
+
/**
|
|
41
|
+
* Finds the date filter option whose stored value equals the provided filter's value.
|
|
42
|
+
*
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export declare function findDateFilterOptionByValue(dateFilter: IDashboardDateFilter, dateFilterOptions: IDateFilterOptionsByType): DateFilterOption | undefined;
|
|
46
|
+
//# sourceMappingURL=DateFilterOptionMapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateFilterOptionMapping.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/DateFilterOptionMapping.ts"],"names":[],"mappings":"AAIA,OAAO,EAIH,KAAK,oBAAoB,EAK5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAKhC,MAAM,wBAAwB,CAAC;AAYhC;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAaD;;;;;;;;;;;GAWG;AACH,wBAAgB,+CAA+C,CAC3D,UAAU,EAAE,oBAAoB,GAAG,SAAS,EAC5C,gBAAgB,EAAE,wBAAwB,EAC1C,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACtC,qBAAqB,CAmBvB;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC7C,UAAU,EAAE,oBAAoB,GAAG,SAAS,EAC5C,gBAAgB,EAAE,wBAAwB,GAC3C,qBAAqB,CA6EvB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,wBAAwB,GAAG,gBAAgB,EAAE,CAcxG;AAsDD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,oBAAoB,EAChC,iBAAiB,EAAE,wBAAwB,gCAG9C"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// (C) 2021-2026 GoodData Corporation
|
|
2
|
+
import { compact } from "lodash-es";
|
|
3
|
+
import { isAllTimeDashboardDateFilter, isLowerBound, isUpperBound, } from "@gooddata/sdk-model";
|
|
4
|
+
import { isAbsoluteDateFilterOption, isRelativeDateFilterOption, } from "../interfaces/index.js";
|
|
5
|
+
import { revertExcludedCurrentPeriodRange } from "./PeriodExclusion.js";
|
|
6
|
+
const VIRTUAL_PRESET_IDENTIFIER = "GDC__VIRTUAL_PRESET";
|
|
7
|
+
const virtualPresetBase = {
|
|
8
|
+
localIdentifier: VIRTUAL_PRESET_IDENTIFIER,
|
|
9
|
+
name: "",
|
|
10
|
+
visible: false,
|
|
11
|
+
};
|
|
12
|
+
const isAllTimeDateFilter = (dateFilter) => dateFilter && isAllTimeDashboardDateFilter(dateFilter);
|
|
13
|
+
function applyEmptyValueHandling(dateFilterOption, dateFilter) {
|
|
14
|
+
const emptyValueHandling = dateFilter?.dateFilter.emptyValueHandling;
|
|
15
|
+
return emptyValueHandling ? { ...dateFilterOption, emptyValueHandling } : dateFilterOption;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tries to match a preset or a form with the provided value. Prioritizes the provided option if possible.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This is to handle cases when user picked a form and filled values that match an existing preset.
|
|
22
|
+
* In those cases we want to show the form as picked even though a preset would otherwise be preferred.
|
|
23
|
+
*
|
|
24
|
+
* @param dateFilter - value to match against
|
|
25
|
+
* @param availableOptions - date options available
|
|
26
|
+
* @param preferredOptionId - id of the option that should be matched first if possible
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export function matchDateFilterToDateFilterOptionWithPreference(dateFilter, availableOptions, preferredOptionId) {
|
|
30
|
+
const preferredOption = preferredOptionId
|
|
31
|
+
? findDateFilterOptionById(preferredOptionId, availableOptions)
|
|
32
|
+
: undefined;
|
|
33
|
+
const isAllTime = isAllTimeDateFilter(dateFilter);
|
|
34
|
+
// we only really need to handle the cases when the selected option is a form
|
|
35
|
+
// other cases are correctly handled by the unbiased matching function
|
|
36
|
+
if (dateFilter &&
|
|
37
|
+
!isAllTime &&
|
|
38
|
+
(preferredOption?.type === "absoluteForm" || preferredOption?.type === "relativeForm") &&
|
|
39
|
+
canReconstructFormForStoredFilter(availableOptions, dateFilter)) {
|
|
40
|
+
return reconstructFormForStoredFilter(availableOptions, dateFilter);
|
|
41
|
+
}
|
|
42
|
+
return matchDateFilterToDateFilterOption(dateFilter, availableOptions);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Tries to match a preset or a form with the provided value. Prioritizes presets over forms.
|
|
46
|
+
* @param dateFilterValue - value to match against
|
|
47
|
+
* @param availableOptions - date options available
|
|
48
|
+
* @alpha
|
|
49
|
+
*/
|
|
50
|
+
export function matchDateFilterToDateFilterOption(dateFilter, availableOptions) {
|
|
51
|
+
// no value means common All Time, try matching against All time (if it is available) or create virtual preset for it
|
|
52
|
+
const isAllTime = isAllTimeDateFilter(dateFilter);
|
|
53
|
+
if (!dateFilter || isAllTime) {
|
|
54
|
+
const emptyValueHandling = dateFilter?.dateFilter.emptyValueHandling;
|
|
55
|
+
if (emptyValueHandling === "only") {
|
|
56
|
+
const { emptyValues: emptyValuesOption } = availableOptions;
|
|
57
|
+
if (emptyValuesOption?.visible) {
|
|
58
|
+
return {
|
|
59
|
+
dateFilterOption: { ...emptyValuesOption, emptyValueHandling: "only" },
|
|
60
|
+
excludeCurrentPeriod: false,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const { allTime } = availableOptions;
|
|
65
|
+
if (allTime) {
|
|
66
|
+
return {
|
|
67
|
+
dateFilterOption: applyEmptyValueHandling(allTime, dateFilter),
|
|
68
|
+
excludeCurrentPeriod: false,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const virtual = createVirtualPresetForStoredFilter(undefined);
|
|
72
|
+
return {
|
|
73
|
+
...virtual,
|
|
74
|
+
dateFilterOption: applyEmptyValueHandling(virtual.dateFilterOption, dateFilter),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// try matching the filter as is
|
|
78
|
+
const matchingFilter = findDateFilterOptionByValue(dateFilter, availableOptions);
|
|
79
|
+
if (matchingFilter) {
|
|
80
|
+
return {
|
|
81
|
+
dateFilterOption: applyEmptyValueHandling(matchingFilter, dateFilter),
|
|
82
|
+
excludeCurrentPeriod: false,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// try matching the filter with excludeCurrentPeriod === true, but only for relativeFormPresets.
|
|
86
|
+
// Entry is gated on `revertExcludedCurrentPeriodRange` being the EXACT inverse of the filter bar's
|
|
87
|
+
// forward exclusion — so a genuine exclusion output (to === -1, from < -1) reconstructs its preset,
|
|
88
|
+
// but a plain "previous period" range (e.g. from === to === -1) is no longer force-matched as
|
|
89
|
+
// current+exclude the way the earlier `to === -1`-only check did.
|
|
90
|
+
if (dateFilter.dateFilter.type === "relative") {
|
|
91
|
+
const storedFrom = Number.parseInt(dateFilter.dateFilter.from?.toString() ?? "", 10);
|
|
92
|
+
const storedTo = Number.parseInt(dateFilter.dateFilter.to?.toString() ?? "", 10);
|
|
93
|
+
const unshifted = Number.isNaN(storedFrom) || Number.isNaN(storedTo)
|
|
94
|
+
? undefined
|
|
95
|
+
: revertExcludedCurrentPeriodRange({ from: storedFrom, to: storedTo });
|
|
96
|
+
if (unshifted) {
|
|
97
|
+
const filterToMatch = {
|
|
98
|
+
dateFilter: { ...dateFilter.dateFilter, ...unshifted },
|
|
99
|
+
};
|
|
100
|
+
const matchingFilter = findDateFilterOptionByValueAndType(filterToMatch, availableOptions, "relativePreset");
|
|
101
|
+
if (matchingFilter) {
|
|
102
|
+
return {
|
|
103
|
+
dateFilterOption: applyEmptyValueHandling(matchingFilter, dateFilter),
|
|
104
|
+
excludeCurrentPeriod: true,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// the stored filter must be a form with custom values
|
|
110
|
+
if (canReconstructFormForStoredFilter(availableOptions, dateFilter)) {
|
|
111
|
+
return reconstructFormForStoredFilter(availableOptions, dateFilter);
|
|
112
|
+
}
|
|
113
|
+
// we cannot use the form because it is disabled or otherwise incompatible
|
|
114
|
+
// -> we must create a virtual hidden preset
|
|
115
|
+
const virtual = createVirtualPresetForStoredFilter(dateFilter);
|
|
116
|
+
return { ...virtual, dateFilterOption: applyEmptyValueHandling(virtual.dateFilterOption, dateFilter) };
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Flattens the provided date filter options. The flattening maintains a stable, predefined order in which
|
|
120
|
+
* the options should be rendered by the date filter component.
|
|
121
|
+
*
|
|
122
|
+
* @param dateFilterOptions - available options to flatten
|
|
123
|
+
* @alpha
|
|
124
|
+
*/
|
|
125
|
+
export function flattenDateFilterOptions(dateFilterOptions) {
|
|
126
|
+
// relativePreset is optional — guard it, or option sets without it (e.g. a static-only picker)
|
|
127
|
+
// crash the whole matching path on Object.values(undefined).
|
|
128
|
+
const relativePresets = compact(Object.values(dateFilterOptions.relativePreset ?? {})).flat();
|
|
129
|
+
// the order is significant here
|
|
130
|
+
// the first visible filter is selected for new dashboards if none is specified in config
|
|
131
|
+
return compact([
|
|
132
|
+
dateFilterOptions.allTime,
|
|
133
|
+
dateFilterOptions.emptyValues,
|
|
134
|
+
...(dateFilterOptions.absolutePreset || []),
|
|
135
|
+
...relativePresets,
|
|
136
|
+
dateFilterOptions.absoluteForm,
|
|
137
|
+
dateFilterOptions.relativeForm,
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
function canReconstructFormForStoredFilter(options, dateFilter) {
|
|
141
|
+
switch (dateFilter.dateFilter.type) {
|
|
142
|
+
case "absolute":
|
|
143
|
+
return isDateFilterOptionVisible(options.absoluteForm);
|
|
144
|
+
case "relative":
|
|
145
|
+
return isDateFilterOptionVisible(options.relativeForm);
|
|
146
|
+
default:
|
|
147
|
+
throw new Error("Unknown dateFilterValue type");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function reconstructFormForStoredFilter(options, dateFilter) {
|
|
151
|
+
if (dateFilter.dateFilter.type === "absolute") {
|
|
152
|
+
const dateFilterOption = {
|
|
153
|
+
...options.absoluteForm,
|
|
154
|
+
from: dateFilter.dateFilter.from.toString(),
|
|
155
|
+
to: dateFilter.dateFilter.to.toString(),
|
|
156
|
+
type: "absoluteForm",
|
|
157
|
+
...(dateFilter.dateFilter.emptyValueHandling
|
|
158
|
+
? { emptyValueHandling: dateFilter.dateFilter.emptyValueHandling }
|
|
159
|
+
: {}),
|
|
160
|
+
};
|
|
161
|
+
return { dateFilterOption, excludeCurrentPeriod: false };
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const dateFilterOption = {
|
|
165
|
+
...options.relativeForm,
|
|
166
|
+
from: Number.parseInt(dateFilter.dateFilter.from.toString(), 10),
|
|
167
|
+
to: Number.parseInt(dateFilter.dateFilter.to.toString(), 10),
|
|
168
|
+
granularity: dateFilter.dateFilter.granularity,
|
|
169
|
+
type: "relativeForm",
|
|
170
|
+
...(dateFilter.dateFilter.emptyValueHandling
|
|
171
|
+
? { emptyValueHandling: dateFilter.dateFilter.emptyValueHandling }
|
|
172
|
+
: {}),
|
|
173
|
+
};
|
|
174
|
+
return { dateFilterOption, excludeCurrentPeriod: false };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function isDateFilterOptionVisible(option) {
|
|
178
|
+
return !!option?.visible;
|
|
179
|
+
}
|
|
180
|
+
function findDateFilterOptionById(id, dateFilterOptions) {
|
|
181
|
+
return flattenDateFilterOptions(dateFilterOptions).find((option) => option.localIdentifier === id);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Finds the date filter option whose stored value equals the provided filter's value.
|
|
185
|
+
*
|
|
186
|
+
* @alpha
|
|
187
|
+
*/
|
|
188
|
+
export function findDateFilterOptionByValue(dateFilter, dateFilterOptions) {
|
|
189
|
+
return flattenDateFilterOptions(dateFilterOptions).find(filterMatchesData(dateFilter));
|
|
190
|
+
}
|
|
191
|
+
function findDateFilterOptionByValueAndType(dateFilter, dateFilterOptions, type) {
|
|
192
|
+
return flattenDateFilterOptions(dateFilterOptions)
|
|
193
|
+
.filter((option) => option.type === type)
|
|
194
|
+
.find(filterMatchesData(dateFilter));
|
|
195
|
+
}
|
|
196
|
+
const filterMatchesData = (dateFilter) => (filter) => {
|
|
197
|
+
if (!filter) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
const data = dateFilter.dateFilter;
|
|
201
|
+
if (isAbsoluteDateFilterOption(filter)) {
|
|
202
|
+
return data.type === "absolute" && filter.from === data.from && filter.to === data.to;
|
|
203
|
+
}
|
|
204
|
+
if (isRelativeDateFilterOption(filter)) {
|
|
205
|
+
// Check if boundedFilter properties match exactly
|
|
206
|
+
const boundedFiltersMatch = (() => {
|
|
207
|
+
// If both don't have boundedFilter, they match
|
|
208
|
+
if (!filter.boundedFilter && !data.boundedFilter) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
// If only one has boundedFilter, they don't match
|
|
212
|
+
if (!filter.boundedFilter || !data.boundedFilter) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
// Both have boundedFilter - check granularity first
|
|
216
|
+
if (filter.boundedFilter.granularity !== data.boundedFilter.granularity) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
// Both must be the same type (both lower or both upper)
|
|
220
|
+
if (isLowerBound(filter.boundedFilter) && isLowerBound(data.boundedFilter)) {
|
|
221
|
+
return filter.boundedFilter.from === data.boundedFilter.from;
|
|
222
|
+
}
|
|
223
|
+
else if (isUpperBound(filter.boundedFilter) && isUpperBound(data.boundedFilter)) {
|
|
224
|
+
return filter.boundedFilter.to === data.boundedFilter.to;
|
|
225
|
+
}
|
|
226
|
+
// Different bound types don't match
|
|
227
|
+
return false;
|
|
228
|
+
})();
|
|
229
|
+
return (data.type === "relative" &&
|
|
230
|
+
filter.from?.toString() === data.from?.toString() &&
|
|
231
|
+
filter.to?.toString() === data.to?.toString() &&
|
|
232
|
+
filter.granularity === data.granularity &&
|
|
233
|
+
boundedFiltersMatch);
|
|
234
|
+
}
|
|
235
|
+
return false;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Creates a virtual preset with values corresponding to a provided server-side value.
|
|
239
|
+
* This is used in situations when a dashboard was saved with setting
|
|
240
|
+
* that can no longer be reproduced by the available options (e.g. relativeForm was used and later, was disabled)
|
|
241
|
+
*/
|
|
242
|
+
function createVirtualPresetForStoredFilter(dateFilter) {
|
|
243
|
+
if (!dateFilter) {
|
|
244
|
+
const dateFilterOption = {
|
|
245
|
+
...virtualPresetBase,
|
|
246
|
+
type: "allTime",
|
|
247
|
+
};
|
|
248
|
+
return { dateFilterOption, excludeCurrentPeriod: false };
|
|
249
|
+
}
|
|
250
|
+
const { type, from, to, granularity } = dateFilter.dateFilter;
|
|
251
|
+
if (type === "absolute") {
|
|
252
|
+
const dateFilterOption = {
|
|
253
|
+
...virtualPresetBase,
|
|
254
|
+
from: from.toString(),
|
|
255
|
+
to: to.toString(),
|
|
256
|
+
type: "absolutePreset",
|
|
257
|
+
...(dateFilter.dateFilter.emptyValueHandling
|
|
258
|
+
? { emptyValueHandling: dateFilter.dateFilter.emptyValueHandling }
|
|
259
|
+
: {}),
|
|
260
|
+
};
|
|
261
|
+
return { dateFilterOption, excludeCurrentPeriod: false };
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
const dateFilterOption = {
|
|
265
|
+
...virtualPresetBase,
|
|
266
|
+
from: Number.parseInt(from.toString(), 10),
|
|
267
|
+
to: Number.parseInt(to.toString(), 10),
|
|
268
|
+
granularity,
|
|
269
|
+
type: "relativePreset",
|
|
270
|
+
...(dateFilter.dateFilter.boundedFilter
|
|
271
|
+
? { boundedFilter: dateFilter.dateFilter.boundedFilter }
|
|
272
|
+
: {}),
|
|
273
|
+
...(dateFilter.dateFilter.emptyValueHandling
|
|
274
|
+
? { emptyValueHandling: dateFilter.dateFilter.emptyValueHandling }
|
|
275
|
+
: {}),
|
|
276
|
+
};
|
|
277
|
+
return { dateFilterOption, excludeCurrentPeriod: false };
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type IDateFilterConfig } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* Default date filter preset for standard calendar.
|
|
4
|
+
*
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_DATE_FILTER_PRESET = "THIS_MONTH";
|
|
8
|
+
/**
|
|
9
|
+
* Default date filter preset for fiscal calendar.
|
|
10
|
+
* Used when fiscal calendar is set as the default calendar type.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_FISCAL_DATE_FILTER_PRESET = "THIS_FISCAL_MONTH";
|
|
15
|
+
/**
|
|
16
|
+
* The date filter configuration used when a workspace defines no (valid) custom one — the same
|
|
17
|
+
* catalog the dashboard date filter falls back to.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare const defaultDateFilterConfig: IDateFilterConfig;
|
|
22
|
+
//# sourceMappingURL=DefaultDateFilterConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultDateFilterConfig.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/DefaultDateFilterConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAS,MAAM,qBAAqB,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,sBAAsB,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,iBAyarC,CAAC"}
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
// (C) 2021-2026 GoodData Corporation
|
|
2
|
+
import { idRef } from "@gooddata/sdk-model";
|
|
3
|
+
/**
|
|
4
|
+
* Default date filter preset for standard calendar.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_DATE_FILTER_PRESET = "THIS_MONTH";
|
|
9
|
+
/**
|
|
10
|
+
* Default date filter preset for fiscal calendar.
|
|
11
|
+
* Used when fiscal calendar is set as the default calendar type.
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_FISCAL_DATE_FILTER_PRESET = "THIS_FISCAL_MONTH";
|
|
16
|
+
/**
|
|
17
|
+
* The date filter configuration used when a workspace defines no (valid) custom one — the same
|
|
18
|
+
* catalog the dashboard date filter falls back to.
|
|
19
|
+
*
|
|
20
|
+
* @alpha
|
|
21
|
+
*/
|
|
22
|
+
export const defaultDateFilterConfig = {
|
|
23
|
+
ref: idRef("defaultDateFilterProjectConfig"),
|
|
24
|
+
selectedOption: DEFAULT_DATE_FILTER_PRESET,
|
|
25
|
+
allTime: {
|
|
26
|
+
localIdentifier: "ALL_TIME",
|
|
27
|
+
type: "allTime",
|
|
28
|
+
name: "",
|
|
29
|
+
visible: true,
|
|
30
|
+
},
|
|
31
|
+
emptyValues: {
|
|
32
|
+
localIdentifier: "EMPTY_VALUES",
|
|
33
|
+
type: "emptyValues",
|
|
34
|
+
name: "",
|
|
35
|
+
visible: true,
|
|
36
|
+
},
|
|
37
|
+
absoluteForm: {
|
|
38
|
+
localIdentifier: "ABSOLUTE_FORM",
|
|
39
|
+
type: "absoluteForm",
|
|
40
|
+
name: "",
|
|
41
|
+
visible: true,
|
|
42
|
+
},
|
|
43
|
+
relativeForm: {
|
|
44
|
+
type: "relativeForm",
|
|
45
|
+
// month has to be the first as it should be the default selected option
|
|
46
|
+
availableGranularities: [
|
|
47
|
+
"GDC.time.month",
|
|
48
|
+
"GDC.time.fiscal_month",
|
|
49
|
+
"GDC.time.minute",
|
|
50
|
+
"GDC.time.hour",
|
|
51
|
+
"GDC.time.date",
|
|
52
|
+
"GDC.time.week_us",
|
|
53
|
+
"GDC.time.quarter",
|
|
54
|
+
"GDC.time.fiscal_quarter",
|
|
55
|
+
"GDC.time.year",
|
|
56
|
+
"GDC.time.fiscal_year",
|
|
57
|
+
],
|
|
58
|
+
localIdentifier: "RELATIVE_FORM",
|
|
59
|
+
name: "",
|
|
60
|
+
visible: true,
|
|
61
|
+
},
|
|
62
|
+
relativePresets: [
|
|
63
|
+
{
|
|
64
|
+
from: -14,
|
|
65
|
+
to: 0,
|
|
66
|
+
granularity: "GDC.time.minute",
|
|
67
|
+
localIdentifier: "LAST_15_MINUTES",
|
|
68
|
+
type: "relativePreset",
|
|
69
|
+
visible: true,
|
|
70
|
+
name: "",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
from: -29,
|
|
74
|
+
to: 0,
|
|
75
|
+
granularity: "GDC.time.minute",
|
|
76
|
+
localIdentifier: "LAST_30_MINUTES",
|
|
77
|
+
type: "relativePreset",
|
|
78
|
+
visible: true,
|
|
79
|
+
name: "",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
from: -44,
|
|
83
|
+
to: 0,
|
|
84
|
+
granularity: "GDC.time.minute",
|
|
85
|
+
localIdentifier: "LAST_45_MINUTES",
|
|
86
|
+
type: "relativePreset",
|
|
87
|
+
visible: true,
|
|
88
|
+
name: "",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
from: -59,
|
|
92
|
+
to: 0,
|
|
93
|
+
granularity: "GDC.time.minute",
|
|
94
|
+
localIdentifier: "LAST_60_MINUTES",
|
|
95
|
+
type: "relativePreset",
|
|
96
|
+
visible: true,
|
|
97
|
+
name: "",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
from: -1,
|
|
101
|
+
to: -1,
|
|
102
|
+
granularity: "GDC.time.hour",
|
|
103
|
+
localIdentifier: "LAST_HOUR",
|
|
104
|
+
type: "relativePreset",
|
|
105
|
+
visible: true,
|
|
106
|
+
name: "",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
from: -7,
|
|
110
|
+
to: 0,
|
|
111
|
+
granularity: "GDC.time.hour",
|
|
112
|
+
localIdentifier: "LAST_8_HOURS",
|
|
113
|
+
type: "relativePreset",
|
|
114
|
+
visible: true,
|
|
115
|
+
name: "",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
from: -11,
|
|
119
|
+
to: 0,
|
|
120
|
+
granularity: "GDC.time.hour",
|
|
121
|
+
localIdentifier: "LAST_12_HOURS",
|
|
122
|
+
type: "relativePreset",
|
|
123
|
+
visible: true,
|
|
124
|
+
name: "",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
from: -23,
|
|
128
|
+
to: 0,
|
|
129
|
+
granularity: "GDC.time.hour",
|
|
130
|
+
localIdentifier: "LAST_24_HOURS",
|
|
131
|
+
type: "relativePreset",
|
|
132
|
+
visible: true,
|
|
133
|
+
name: "",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
from: 0,
|
|
137
|
+
to: 0,
|
|
138
|
+
granularity: "GDC.time.week_us",
|
|
139
|
+
localIdentifier: "THIS_WEEK",
|
|
140
|
+
type: "relativePreset",
|
|
141
|
+
visible: true,
|
|
142
|
+
name: "",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
from: 0,
|
|
146
|
+
to: 0,
|
|
147
|
+
granularity: "GDC.time.week_us",
|
|
148
|
+
localIdentifier: "THIS_WEEK_TO_DATE",
|
|
149
|
+
type: "relativePreset",
|
|
150
|
+
visible: true,
|
|
151
|
+
name: "",
|
|
152
|
+
boundedFilter: {
|
|
153
|
+
granularity: "GDC.time.date",
|
|
154
|
+
to: 0,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
from: -1,
|
|
159
|
+
to: -1,
|
|
160
|
+
granularity: "GDC.time.week_us",
|
|
161
|
+
localIdentifier: "LAST_WEEK",
|
|
162
|
+
type: "relativePreset",
|
|
163
|
+
visible: true,
|
|
164
|
+
name: "",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
from: -1,
|
|
168
|
+
to: 0,
|
|
169
|
+
granularity: "GDC.time.week_us",
|
|
170
|
+
localIdentifier: "LAST_2_WEEKS",
|
|
171
|
+
type: "relativePreset",
|
|
172
|
+
visible: true,
|
|
173
|
+
name: "",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
from: 0,
|
|
177
|
+
to: 0,
|
|
178
|
+
granularity: "GDC.time.date",
|
|
179
|
+
localIdentifier: "TODAY",
|
|
180
|
+
type: "relativePreset",
|
|
181
|
+
visible: true,
|
|
182
|
+
name: "",
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
from: -1,
|
|
186
|
+
to: -1,
|
|
187
|
+
granularity: "GDC.time.date",
|
|
188
|
+
localIdentifier: "YESTERDAY",
|
|
189
|
+
type: "relativePreset",
|
|
190
|
+
visible: true,
|
|
191
|
+
name: "",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
from: -6,
|
|
195
|
+
to: 0,
|
|
196
|
+
granularity: "GDC.time.date",
|
|
197
|
+
localIdentifier: "LAST_7_DAYS",
|
|
198
|
+
type: "relativePreset",
|
|
199
|
+
visible: true,
|
|
200
|
+
name: "",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
from: -29,
|
|
204
|
+
to: 0,
|
|
205
|
+
granularity: "GDC.time.date",
|
|
206
|
+
localIdentifier: "LAST_30_DAYS",
|
|
207
|
+
type: "relativePreset",
|
|
208
|
+
visible: true,
|
|
209
|
+
name: "",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
from: -89,
|
|
213
|
+
to: 0,
|
|
214
|
+
granularity: "GDC.time.date",
|
|
215
|
+
localIdentifier: "LAST_90_DAYS",
|
|
216
|
+
type: "relativePreset",
|
|
217
|
+
visible: true,
|
|
218
|
+
name: "",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
from: 0,
|
|
222
|
+
to: 0,
|
|
223
|
+
granularity: "GDC.time.month",
|
|
224
|
+
localIdentifier: "THIS_MONTH_TO_DATE",
|
|
225
|
+
type: "relativePreset",
|
|
226
|
+
visible: true,
|
|
227
|
+
name: "",
|
|
228
|
+
boundedFilter: {
|
|
229
|
+
granularity: "GDC.time.date",
|
|
230
|
+
to: 0,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
from: 0,
|
|
235
|
+
to: 0,
|
|
236
|
+
granularity: "GDC.time.month",
|
|
237
|
+
localIdentifier: "THIS_MONTH",
|
|
238
|
+
type: "relativePreset",
|
|
239
|
+
visible: true,
|
|
240
|
+
name: "",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
from: -1,
|
|
244
|
+
to: -1,
|
|
245
|
+
granularity: "GDC.time.month",
|
|
246
|
+
localIdentifier: "LAST_MONTH",
|
|
247
|
+
type: "relativePreset",
|
|
248
|
+
visible: true,
|
|
249
|
+
name: "",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
from: -11,
|
|
253
|
+
to: 0,
|
|
254
|
+
granularity: "GDC.time.month",
|
|
255
|
+
localIdentifier: "LAST_12_MONTHS",
|
|
256
|
+
type: "relativePreset",
|
|
257
|
+
visible: true,
|
|
258
|
+
name: "",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
from: 0,
|
|
262
|
+
to: 0,
|
|
263
|
+
granularity: "GDC.time.quarter",
|
|
264
|
+
localIdentifier: "THIS_QUARTER_TO_DATE",
|
|
265
|
+
type: "relativePreset",
|
|
266
|
+
visible: true,
|
|
267
|
+
name: "",
|
|
268
|
+
boundedFilter: {
|
|
269
|
+
granularity: "GDC.time.date",
|
|
270
|
+
to: 0,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
from: 0,
|
|
275
|
+
to: 0,
|
|
276
|
+
granularity: "GDC.time.quarter",
|
|
277
|
+
localIdentifier: "THIS_QUARTER",
|
|
278
|
+
type: "relativePreset",
|
|
279
|
+
visible: true,
|
|
280
|
+
name: "",
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
from: -1,
|
|
284
|
+
to: -1,
|
|
285
|
+
granularity: "GDC.time.quarter",
|
|
286
|
+
localIdentifier: "LAST_QUARTER",
|
|
287
|
+
type: "relativePreset",
|
|
288
|
+
visible: true,
|
|
289
|
+
name: "",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
from: -3,
|
|
293
|
+
to: 0,
|
|
294
|
+
granularity: "GDC.time.quarter",
|
|
295
|
+
localIdentifier: "LAST_4_QUARTERS",
|
|
296
|
+
type: "relativePreset",
|
|
297
|
+
visible: true,
|
|
298
|
+
name: "",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
from: 0,
|
|
302
|
+
to: 0,
|
|
303
|
+
granularity: "GDC.time.year",
|
|
304
|
+
localIdentifier: "THIS_YEAR_TO_DATE",
|
|
305
|
+
type: "relativePreset",
|
|
306
|
+
visible: true,
|
|
307
|
+
name: "",
|
|
308
|
+
boundedFilter: {
|
|
309
|
+
granularity: "GDC.time.date",
|
|
310
|
+
to: 0,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
from: 0,
|
|
315
|
+
to: 0,
|
|
316
|
+
granularity: "GDC.time.year",
|
|
317
|
+
localIdentifier: "THIS_YEAR",
|
|
318
|
+
type: "relativePreset",
|
|
319
|
+
visible: true,
|
|
320
|
+
name: "",
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
from: -1,
|
|
324
|
+
to: -1,
|
|
325
|
+
granularity: "GDC.time.year",
|
|
326
|
+
localIdentifier: "LAST_YEAR",
|
|
327
|
+
type: "relativePreset",
|
|
328
|
+
visible: true,
|
|
329
|
+
name: "",
|
|
330
|
+
},
|
|
331
|
+
// Fiscal Year presets
|
|
332
|
+
{
|
|
333
|
+
from: 0,
|
|
334
|
+
to: 0,
|
|
335
|
+
granularity: "GDC.time.fiscal_year",
|
|
336
|
+
localIdentifier: "THIS_FISCAL_YEAR_TO_DATE",
|
|
337
|
+
type: "relativePreset",
|
|
338
|
+
visible: true,
|
|
339
|
+
name: "",
|
|
340
|
+
boundedFilter: {
|
|
341
|
+
granularity: "GDC.time.date",
|
|
342
|
+
to: 0,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
from: 0,
|
|
347
|
+
to: 0,
|
|
348
|
+
granularity: "GDC.time.fiscal_year",
|
|
349
|
+
localIdentifier: "THIS_FISCAL_YEAR",
|
|
350
|
+
type: "relativePreset",
|
|
351
|
+
visible: true,
|
|
352
|
+
name: "",
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
from: -1,
|
|
356
|
+
to: -1,
|
|
357
|
+
granularity: "GDC.time.fiscal_year",
|
|
358
|
+
localIdentifier: "LAST_FISCAL_YEAR",
|
|
359
|
+
type: "relativePreset",
|
|
360
|
+
visible: true,
|
|
361
|
+
name: "",
|
|
362
|
+
},
|
|
363
|
+
// Fiscal Quarter presets
|
|
364
|
+
{
|
|
365
|
+
from: 0,
|
|
366
|
+
to: 0,
|
|
367
|
+
granularity: "GDC.time.fiscal_quarter",
|
|
368
|
+
localIdentifier: "THIS_FISCAL_QUARTER_TO_DATE",
|
|
369
|
+
type: "relativePreset",
|
|
370
|
+
visible: true,
|
|
371
|
+
name: "",
|
|
372
|
+
boundedFilter: {
|
|
373
|
+
granularity: "GDC.time.date",
|
|
374
|
+
to: 0,
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
from: 0,
|
|
379
|
+
to: 0,
|
|
380
|
+
granularity: "GDC.time.fiscal_quarter",
|
|
381
|
+
localIdentifier: "THIS_FISCAL_QUARTER",
|
|
382
|
+
type: "relativePreset",
|
|
383
|
+
visible: true,
|
|
384
|
+
name: "",
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
from: -1,
|
|
388
|
+
to: -1,
|
|
389
|
+
granularity: "GDC.time.fiscal_quarter",
|
|
390
|
+
localIdentifier: "LAST_FISCAL_QUARTER",
|
|
391
|
+
type: "relativePreset",
|
|
392
|
+
visible: true,
|
|
393
|
+
name: "",
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
from: -3,
|
|
397
|
+
to: 0,
|
|
398
|
+
granularity: "GDC.time.fiscal_quarter",
|
|
399
|
+
localIdentifier: "LAST_4_FISCAL_QUARTERS",
|
|
400
|
+
type: "relativePreset",
|
|
401
|
+
visible: true,
|
|
402
|
+
name: "",
|
|
403
|
+
},
|
|
404
|
+
// Fiscal Month (Period) presets
|
|
405
|
+
{
|
|
406
|
+
from: 0,
|
|
407
|
+
to: 0,
|
|
408
|
+
granularity: "GDC.time.fiscal_month",
|
|
409
|
+
localIdentifier: "THIS_FISCAL_MONTH_TO_DATE",
|
|
410
|
+
type: "relativePreset",
|
|
411
|
+
visible: true,
|
|
412
|
+
name: "",
|
|
413
|
+
boundedFilter: {
|
|
414
|
+
granularity: "GDC.time.date",
|
|
415
|
+
to: 0,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
from: 0,
|
|
420
|
+
to: 0,
|
|
421
|
+
granularity: "GDC.time.fiscal_month",
|
|
422
|
+
localIdentifier: "THIS_FISCAL_MONTH",
|
|
423
|
+
type: "relativePreset",
|
|
424
|
+
visible: true,
|
|
425
|
+
name: "",
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
from: -1,
|
|
429
|
+
to: -1,
|
|
430
|
+
granularity: "GDC.time.fiscal_month",
|
|
431
|
+
localIdentifier: "LAST_FISCAL_MONTH",
|
|
432
|
+
type: "relativePreset",
|
|
433
|
+
visible: true,
|
|
434
|
+
name: "",
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
from: -11,
|
|
438
|
+
to: 0,
|
|
439
|
+
granularity: "GDC.time.fiscal_month",
|
|
440
|
+
localIdentifier: "LAST_12_FISCAL_MONTHS",
|
|
441
|
+
type: "relativePreset",
|
|
442
|
+
visible: true,
|
|
443
|
+
name: "",
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
absolutePresets: [],
|
|
447
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DateFilterGranularity } from "@gooddata/sdk-model";
|
|
2
2
|
import { type DateFilterOption, type IDateFilterOptionsByType } from "../interfaces/index.js";
|
|
3
3
|
export declare function getDateFilterOptionGranularity(dateFilterOption: DateFilterOption): DateFilterGranularity | undefined;
|
|
4
|
+
export declare function removeEmptyKeysFromDateFilterOptions({ absoluteForm, absolutePreset, allTime, emptyValues, relativeForm, relativePreset }: IDateFilterOptionsByType): IDateFilterOptionsByType;
|
|
4
5
|
/**
|
|
5
6
|
* Returns dateFilterOptions with only items that have visible set to true.
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionUtils.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/OptionUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,qBAAqB,EAK7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,gBAAgB,EAErB,KAAK,wBAAwB,EAEhC,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,8BAA8B,CAC1C,gBAAgB,EAAE,gBAAgB,GACnC,qBAAqB,GAAG,SAAS,CAInC;
|
|
1
|
+
{"version":3,"file":"OptionUtils.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/OptionUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,qBAAqB,EAK7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,gBAAgB,EAErB,KAAK,wBAAwB,EAEhC,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,8BAA8B,CAC1C,gBAAgB,EAAE,gBAAgB,GACnC,qBAAqB,GAAG,SAAS,CAInC;AA+BD,wBAAgB,oCAAoC,CAAC,EACjD,YAAY,EACZ,cAAc,EACd,OAAO,EACP,WAAW,EACX,YAAY,EACZ,cAAc,EACjB,EAAE,wBAAwB,GAAG,wBAAwB,CASrD;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC1C,iBAAiB,EAAE,wBAAwB,GAC5C,wBAAwB,CAsB1B;AA+BD;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,iBAAiB,EAAE,wBAAwB,GAC5C,wBAAwB,CAW1B"}
|
|
@@ -23,7 +23,7 @@ function filterVisibleRelativePresets(relativePreset) {
|
|
|
23
23
|
return filtered;
|
|
24
24
|
}, {});
|
|
25
25
|
}
|
|
26
|
-
function removeEmptyKeysFromDateFilterOptions({ absoluteForm, absolutePreset, allTime, emptyValues, relativeForm, relativePreset, }) {
|
|
26
|
+
export function removeEmptyKeysFromDateFilterOptions({ absoluteForm, absolutePreset, allTime, emptyValues, relativeForm, relativePreset, }) {
|
|
27
27
|
return {
|
|
28
28
|
...(allTime && { allTime }),
|
|
29
29
|
...(emptyValues && { emptyValues }),
|
|
@@ -4,4 +4,32 @@ import { type DateFilterOption } from "../interfaces/index.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const applyExcludeCurrentPeriod: (dateFilterOption: DateFilterOption | undefined, excludeCurrentPeriod: boolean) => DateFilterOption | undefined;
|
|
6
6
|
export declare const canExcludeCurrentPeriod: (dateFilterOption: DateFilterOption) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The numeric core of exclude-current-period: a current-period-ending range shifts back by one
|
|
9
|
+
* period; anything else is returned unchanged (exclusion does not apply). This is what the filter
|
|
10
|
+
* bar persists — no flag, just the shifted offsets.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare const excludeCurrentPeriodFromRange: (range: {
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
}, excludeCurrentPeriod: boolean) => {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Inverse of {@link excludeCurrentPeriodFromRange}: the current-period-ending range that would have
|
|
23
|
+
* produced the stored offsets via exclusion, or undefined when the stored range cannot be an
|
|
24
|
+
* exclusion result. Lets stored offsets be matched back to "preset + checked toggle".
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare const revertExcludedCurrentPeriodRange: (range: {
|
|
29
|
+
from: number;
|
|
30
|
+
to: number;
|
|
31
|
+
}) => {
|
|
32
|
+
from: number;
|
|
33
|
+
to: number;
|
|
34
|
+
} | undefined;
|
|
7
35
|
//# sourceMappingURL=PeriodExclusion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodExclusion.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/PeriodExclusion.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"PeriodExclusion.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/utils/PeriodExclusion.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,yBAAyB,iHAgCrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,iDAQnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B;;;;;;CAM3B,CAAC;AAEhB;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC;;;;;;aAI6C,CAAC"}
|
|
@@ -16,14 +16,15 @@ export const applyExcludeCurrentPeriod = (dateFilterOption, excludeCurrentPeriod
|
|
|
16
16
|
}
|
|
17
17
|
else if (isRelativeDateFilterPreset(dateFilterOption)) {
|
|
18
18
|
const { from, to } = dateFilterOption;
|
|
19
|
-
const
|
|
19
|
+
const excluded = excludeCurrentPeriodFromRange({ from, to }, true);
|
|
20
|
+
const shouldExcludeCurrent = excluded.from !== from || excluded.to !== to;
|
|
20
21
|
return {
|
|
21
22
|
...dateFilterOption,
|
|
22
23
|
// When exclusion is applied, the selection no longer matches the original preset interval,
|
|
23
24
|
// so the title should be computed from the adjusted interval instead of reusing preset's name.
|
|
24
25
|
name: shouldExcludeCurrent ? "" : dateFilterOption.name,
|
|
25
|
-
from:
|
|
26
|
-
to:
|
|
26
|
+
from: excluded.from,
|
|
27
|
+
to: excluded.to,
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
@@ -39,3 +40,21 @@ export const canExcludeCurrentPeriod = (dateFilterOption) => {
|
|
|
39
40
|
}
|
|
40
41
|
return false;
|
|
41
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* The numeric core of exclude-current-period: a current-period-ending range shifts back by one
|
|
45
|
+
* period; anything else is returned unchanged (exclusion does not apply). This is what the filter
|
|
46
|
+
* bar persists — no flag, just the shifted offsets.
|
|
47
|
+
*
|
|
48
|
+
* @alpha
|
|
49
|
+
*/
|
|
50
|
+
export const excludeCurrentPeriodFromRange = (range, excludeCurrentPeriod) => excludeCurrentPeriod && range.to === 0 && range.from < range.to
|
|
51
|
+
? { from: range.from - 1, to: -1 }
|
|
52
|
+
: range;
|
|
53
|
+
/**
|
|
54
|
+
* Inverse of {@link excludeCurrentPeriodFromRange}: the current-period-ending range that would have
|
|
55
|
+
* produced the stored offsets via exclusion, or undefined when the stored range cannot be an
|
|
56
|
+
* exclusion result. Lets stored offsets be matched back to "preset + checked toggle".
|
|
57
|
+
*
|
|
58
|
+
* @alpha
|
|
59
|
+
*/
|
|
60
|
+
export const revertExcludedCurrentPeriodRange = (range) => range.to === -1 && range.from < range.to ? { from: range.from + 1, to: 0 } : undefined;
|
package/esm/index.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export { type GranularityIntlKey, type DateFilterLabelMode } from "./DateFilter/
|
|
|
15
15
|
export type { IDateAndMessageTranslator, IDateTranslator, IMessageTranslator, } from "./DateFilter/utils/Translations/Translators.js";
|
|
16
16
|
export { filterVisibleDateFilterOptions } from "./DateFilter/utils/OptionUtils.js";
|
|
17
17
|
export { getLocalizedIcuDateFormatPattern } from "./DateFilter/utils/FormattingUtils.js";
|
|
18
|
+
export { convertDateFilterConfigToDateFilterOptions } from "./DateFilter/utils/DateFilterConfigConversions.js";
|
|
19
|
+
export { DEFAULT_DATE_FILTER_PRESET, DEFAULT_FISCAL_DATE_FILTER_PRESET, defaultDateFilterConfig, } from "./DateFilter/utils/DefaultDateFilterConfig.js";
|
|
20
|
+
export { excludeCurrentPeriodFromRange, revertExcludedCurrentPeriodRange, } from "./DateFilter/utils/PeriodExclusion.js";
|
|
21
|
+
export { type IDateFilterOptionInfo, findDateFilterOptionByValue, flattenDateFilterOptions, matchDateFilterToDateFilterOption, matchDateFilterToDateFilterOptionWithPreference, } from "./DateFilter/utils/DateFilterOptionMapping.js";
|
|
18
22
|
export { type CalendarTabType, type IFiscalTabsConfig, type IUiRelativeDateFilterFormLike, getFiscalTabsConfig, getDefaultCalendarTab, getFilteredPresets, getFilteredGranularities, hasFiscalPresets, hasStandardPresets, filterStandardPresets, filterFiscalPresets, filterStandardGranularities, filterFiscalGranularities, getTabForPreset, ensureCompatibleGranularity, STANDARD_GRANULARITIES_WITH_FISCAL_EQUIVALENT, } from "./DateFilter/utils/presetFilterUtils.js";
|
|
19
23
|
export { isFiscalGranularity } from "@gooddata/sdk-model";
|
|
20
24
|
export type { IFilterConfigurationProps } from "./DateFilter/DateFilterBody/types.js";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAGH,OAAO,EACH,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iCAAiC,GACzC,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qCAAqC,EAC1C,0BAA0B,EAC1B,0BAA0B,EAC1B,mCAAmC,EACnC,0BAA0B,GAC7B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGnG,YAAY,EACR,yBAAyB,EACzB,eA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AE,MAAM,8BAA8B,CAAC;AAE7G,YAAY,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EACH,sBAAsB,EACtB,KAAK,4BAA4B,GACpC,MAAM,wDAAwD,CAAC;AAEhE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -19,6 +19,10 @@ export { isAbsoluteDateFilterOption, isRelativeDateFilterOption, isRelativeDateF
|
|
|
19
19
|
export { defaultDateFilterOptions } from "./DateFilter/constants/config.js";
|
|
20
20
|
export { filterVisibleDateFilterOptions } from "./DateFilter/utils/OptionUtils.js";
|
|
21
21
|
export { getLocalizedIcuDateFormatPattern } from "./DateFilter/utils/FormattingUtils.js";
|
|
22
|
+
export { convertDateFilterConfigToDateFilterOptions } from "./DateFilter/utils/DateFilterConfigConversions.js";
|
|
23
|
+
export { DEFAULT_DATE_FILTER_PRESET, DEFAULT_FISCAL_DATE_FILTER_PRESET, defaultDateFilterConfig, } from "./DateFilter/utils/DefaultDateFilterConfig.js";
|
|
24
|
+
export { excludeCurrentPeriodFromRange, revertExcludedCurrentPeriodRange, } from "./DateFilter/utils/PeriodExclusion.js";
|
|
25
|
+
export { findDateFilterOptionByValue, flattenDateFilterOptions, matchDateFilterToDateFilterOption, matchDateFilterToDateFilterOptionWithPreference, } from "./DateFilter/utils/DateFilterOptionMapping.js";
|
|
22
26
|
export { getFiscalTabsConfig, getDefaultCalendarTab, getFilteredPresets, getFilteredGranularities, hasFiscalPresets, hasStandardPresets, filterStandardPresets, filterFiscalPresets, filterStandardGranularities, filterFiscalGranularities, getTabForPreset, ensureCompatibleGranularity, STANDARD_GRANULARITIES_WITH_FISCAL_EQUIVALENT, } from "./DateFilter/utils/presetFilterUtils.js";
|
|
23
27
|
// Canonical fiscal-granularity check lives in sdk-model; re-exported to preserve this package's public API.
|
|
24
28
|
export { isFiscalGranularity } from "@gooddata/sdk-model";
|
package/esm/sdk-ui-filters.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { IAttributeMetadataObject } from '@gooddata/sdk-model';
|
|
|
32
32
|
import { IDashboardDateFilter } from '@gooddata/sdk-model';
|
|
33
33
|
import { IDataSetMetadataObject } from '@gooddata/sdk-model';
|
|
34
34
|
import { IDateFilter } from '@gooddata/sdk-model';
|
|
35
|
+
import { IDateFilterConfig } from '@gooddata/sdk-model';
|
|
35
36
|
import { IDropdownButtonRenderProps } from '@gooddata/sdk-ui-kit';
|
|
36
37
|
import { IElementsQueryAttributeFilter } from '@gooddata/sdk-backend-spi';
|
|
37
38
|
import { IEmptyValuesDateFilterOption } from '@gooddata/sdk-model';
|
|
@@ -464,6 +465,19 @@ export declare type CommonFilterControllerData = {
|
|
|
464
465
|
isWorkingSelectionChanged?: boolean;
|
|
465
466
|
};
|
|
466
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Converts a workspace date filter config — as stored on the backend — into the date filter options
|
|
470
|
+
* the {@link DateFilter} component consumes (its `filterOptions` prop).
|
|
471
|
+
*
|
|
472
|
+
* @remarks
|
|
473
|
+
* Extracted from sdk-ui-dashboard so non-dashboard hosts (e.g. conditional formatting's date
|
|
474
|
+
* condition picker) consume the same workspace preset catalog; dashboards re-export it.
|
|
475
|
+
*
|
|
476
|
+
* @param config - date filter config from backend
|
|
477
|
+
* @alpha
|
|
478
|
+
*/
|
|
479
|
+
export declare function convertDateFilterConfigToDateFilterOptions(config: IDateFilterConfig): IDateFilterOptionsByType;
|
|
480
|
+
|
|
467
481
|
/**
|
|
468
482
|
* @public
|
|
469
483
|
*/
|
|
@@ -577,6 +591,29 @@ export declare type DateFilterRelativeOptionGroup = {
|
|
|
577
591
|
*/
|
|
578
592
|
export declare type DateRangePosition = "from" | "to";
|
|
579
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Default date filter preset for standard calendar.
|
|
596
|
+
*
|
|
597
|
+
* @alpha
|
|
598
|
+
*/
|
|
599
|
+
export declare const DEFAULT_DATE_FILTER_PRESET = "THIS_MONTH";
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Default date filter preset for fiscal calendar.
|
|
603
|
+
* Used when fiscal calendar is set as the default calendar type.
|
|
604
|
+
*
|
|
605
|
+
* @alpha
|
|
606
|
+
*/
|
|
607
|
+
export declare const DEFAULT_FISCAL_DATE_FILTER_PRESET = "THIS_FISCAL_MONTH";
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* The date filter configuration used when a workspace defines no (valid) custom one — the same
|
|
611
|
+
* catalog the dashboard date filter falls back to.
|
|
612
|
+
*
|
|
613
|
+
* @alpha
|
|
614
|
+
*/
|
|
615
|
+
export declare const defaultDateFilterConfig: IDateFilterConfig;
|
|
616
|
+
|
|
580
617
|
/**
|
|
581
618
|
* The default set of date filter options.
|
|
582
619
|
*
|
|
@@ -739,6 +776,21 @@ export declare function EmptyElementsSearchBar(_props: IAttributeFilterElementsS
|
|
|
739
776
|
*/
|
|
740
777
|
export declare function ensureCompatibleGranularity<T extends IUiRelativeDateFilterFormLike>(filterOption: T, availableGranularities: DateFilterGranularity[], fiscalFirst: boolean): T;
|
|
741
778
|
|
|
779
|
+
/**
|
|
780
|
+
* The numeric core of exclude-current-period: a current-period-ending range shifts back by one
|
|
781
|
+
* period; anything else is returned unchanged (exclusion does not apply). This is what the filter
|
|
782
|
+
* bar persists — no flag, just the shifted offsets.
|
|
783
|
+
*
|
|
784
|
+
* @alpha
|
|
785
|
+
*/
|
|
786
|
+
export declare const excludeCurrentPeriodFromRange: (range: {
|
|
787
|
+
from: number;
|
|
788
|
+
to: number;
|
|
789
|
+
}, excludeCurrentPeriod: boolean) => {
|
|
790
|
+
from: number;
|
|
791
|
+
to: number;
|
|
792
|
+
};
|
|
793
|
+
|
|
742
794
|
/**
|
|
743
795
|
* Renders a small icon (with hover bubble) inside a filter button — used to surface
|
|
744
796
|
* filter mode hints such as HIDDEN or LOCKED. Shared between filter implementations.
|
|
@@ -817,6 +869,22 @@ export declare function filterStandardPresets(presets: DateFilterRelativeOptionG
|
|
|
817
869
|
*/
|
|
818
870
|
export declare function filterVisibleDateFilterOptions(dateFilterOptions: IDateFilterOptionsByType): IDateFilterOptionsByType;
|
|
819
871
|
|
|
872
|
+
/**
|
|
873
|
+
* Finds the date filter option whose stored value equals the provided filter's value.
|
|
874
|
+
*
|
|
875
|
+
* @alpha
|
|
876
|
+
*/
|
|
877
|
+
export declare function findDateFilterOptionByValue(dateFilter: IDashboardDateFilter, dateFilterOptions: IDateFilterOptionsByType): DateFilterOption | undefined;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Flattens the provided date filter options. The flattening maintains a stable, predefined order in which
|
|
881
|
+
* the options should be rendered by the date filter component.
|
|
882
|
+
*
|
|
883
|
+
* @param dateFilterOptions - available options to flatten
|
|
884
|
+
* @alpha
|
|
885
|
+
*/
|
|
886
|
+
export declare function flattenDateFilterOptions(dateFilterOptions: IDateFilterOptionsByType): DateFilterOption[];
|
|
887
|
+
|
|
820
888
|
/**
|
|
821
889
|
* @internal
|
|
822
890
|
*/
|
|
@@ -3135,6 +3203,16 @@ export declare interface IDateFilterCallbackProps {
|
|
|
3135
3203
|
onClose?: () => void;
|
|
3136
3204
|
}
|
|
3137
3205
|
|
|
3206
|
+
/**
|
|
3207
|
+
* A matched date filter option together with the reconstructed exclude-current-period state.
|
|
3208
|
+
*
|
|
3209
|
+
* @alpha
|
|
3210
|
+
*/
|
|
3211
|
+
export declare interface IDateFilterOptionInfo {
|
|
3212
|
+
dateFilterOption: DateFilterOption;
|
|
3213
|
+
excludeCurrentPeriod: boolean;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3138
3216
|
/**
|
|
3139
3217
|
* All date filter options grouped by their type
|
|
3140
3218
|
* @public
|
|
@@ -4592,6 +4670,28 @@ export declare type IWarningMessage = {
|
|
|
4592
4670
|
*/
|
|
4593
4671
|
export declare function mapAvailableSelectionTypesToInternal(selectionTypes: AttributeFilterAvailableSelectionType[] | undefined): AttributeFilterSelectionType[];
|
|
4594
4672
|
|
|
4673
|
+
/**
|
|
4674
|
+
* Tries to match a preset or a form with the provided value. Prioritizes presets over forms.
|
|
4675
|
+
* @param dateFilterValue - value to match against
|
|
4676
|
+
* @param availableOptions - date options available
|
|
4677
|
+
* @alpha
|
|
4678
|
+
*/
|
|
4679
|
+
export declare function matchDateFilterToDateFilterOption(dateFilter: IDashboardDateFilter | undefined, availableOptions: IDateFilterOptionsByType): IDateFilterOptionInfo;
|
|
4680
|
+
|
|
4681
|
+
/**
|
|
4682
|
+
* Tries to match a preset or a form with the provided value. Prioritizes the provided option if possible.
|
|
4683
|
+
*
|
|
4684
|
+
* @remarks
|
|
4685
|
+
* This is to handle cases when user picked a form and filled values that match an existing preset.
|
|
4686
|
+
* In those cases we want to show the form as picked even though a preset would otherwise be preferred.
|
|
4687
|
+
*
|
|
4688
|
+
* @param dateFilter - value to match against
|
|
4689
|
+
* @param availableOptions - date options available
|
|
4690
|
+
* @param preferredOptionId - id of the option that should be matched first if possible
|
|
4691
|
+
* @alpha
|
|
4692
|
+
*/
|
|
4693
|
+
export declare function matchDateFilterToDateFilterOptionWithPreference(dateFilter: IDashboardDateFilter | undefined, availableOptions: IDateFilterOptionsByType, preferredOptionId: string | undefined): IDateFilterOptionInfo;
|
|
4694
|
+
|
|
4595
4695
|
/**
|
|
4596
4696
|
* @beta
|
|
4597
4697
|
*/
|
|
@@ -4916,6 +5016,21 @@ export declare type RelativeDateFilterOption = IUiRelativeDateFilterForm | IRela
|
|
|
4916
5016
|
*/
|
|
4917
5017
|
export declare type RenderMeasureDropdownBody = (props: IRankingMeasureDropdownBodyRenderProps) => ReactNode;
|
|
4918
5018
|
|
|
5019
|
+
/**
|
|
5020
|
+
* Inverse of {@link excludeCurrentPeriodFromRange}: the current-period-ending range that would have
|
|
5021
|
+
* produced the stored offsets via exclusion, or undefined when the stored range cannot be an
|
|
5022
|
+
* exclusion result. Lets stored offsets be matched back to "preset + checked toggle".
|
|
5023
|
+
*
|
|
5024
|
+
* @alpha
|
|
5025
|
+
*/
|
|
5026
|
+
export declare const revertExcludedCurrentPeriodRange: (range: {
|
|
5027
|
+
from: number;
|
|
5028
|
+
to: number;
|
|
5029
|
+
}) => {
|
|
5030
|
+
from: number;
|
|
5031
|
+
to: number;
|
|
5032
|
+
} | undefined;
|
|
5033
|
+
|
|
4919
5034
|
/**
|
|
4920
5035
|
* Selection type callbacks (elements vs text selection type switching).
|
|
4921
5036
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-filters",
|
|
3
|
-
"version": "11.50.0-alpha.
|
|
3
|
+
"version": "11.50.0-alpha.3",
|
|
4
4
|
"description": "GoodData.UI SDK - Filter Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"ts-invariant": "0.10.3",
|
|
47
47
|
"tslib": "2.8.1",
|
|
48
48
|
"uuid": "11.1.1",
|
|
49
|
-
"@gooddata/sdk-backend-spi": "11.50.0-alpha.
|
|
50
|
-
"@gooddata/sdk-ui
|
|
51
|
-
"@gooddata/sdk-ui": "11.50.0-alpha.
|
|
52
|
-
"@gooddata/util": "11.50.0-alpha.
|
|
53
|
-
"@gooddata/sdk-model": "11.50.0-alpha.
|
|
49
|
+
"@gooddata/sdk-backend-spi": "11.50.0-alpha.3",
|
|
50
|
+
"@gooddata/sdk-ui": "11.50.0-alpha.3",
|
|
51
|
+
"@gooddata/sdk-ui-kit": "11.50.0-alpha.3",
|
|
52
|
+
"@gooddata/util": "11.50.0-alpha.3",
|
|
53
|
+
"@gooddata/sdk-model": "11.50.0-alpha.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@microsoft/api-documenter": "^7.17.0",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"typescript": "5.9.3",
|
|
93
93
|
"vitest": "4.1.8",
|
|
94
94
|
"vitest-dom": "0.1.1",
|
|
95
|
-
"@gooddata/eslint-config": "11.50.0-alpha.
|
|
96
|
-
"@gooddata/
|
|
97
|
-
"@gooddata/
|
|
98
|
-
"@gooddata/sdk-
|
|
99
|
-
"@gooddata/
|
|
100
|
-
"@gooddata/stylelint-config": "11.50.0-alpha.
|
|
95
|
+
"@gooddata/eslint-config": "11.50.0-alpha.3",
|
|
96
|
+
"@gooddata/reference-workspace": "11.50.0-alpha.3",
|
|
97
|
+
"@gooddata/sdk-backend-mockingbird": "11.50.0-alpha.3",
|
|
98
|
+
"@gooddata/sdk-ui-theme-provider": "11.50.0-alpha.3",
|
|
99
|
+
"@gooddata/oxlint-config": "11.50.0-alpha.3",
|
|
100
|
+
"@gooddata/stylelint-config": "11.50.0-alpha.3"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"react": "^18.0.0 || ^19.0.0",
|