@gooddata/sdk-ui-analytical-designer 11.70.0-alpha.3 → 11.70.0-alpha.4
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/NOTICE +47 -47
- package/esm/actions/open_actions.d.ts +1 -1
- package/esm/actions/open_actions.d.ts.map +1 -1
- package/esm/components/Report.d.ts +4 -1
- package/esm/components/Report.d.ts.map +1 -1
- package/esm/components/Report.js +5 -3
- package/esm/components/buckets/MeasureDateFilterPicker.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilterPicker.js +4 -3
- package/esm/components/buckets/MeasureDateFilterTitle.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilterTitle.js +5 -2
- package/esm/components/buckets/measureDateFilterOption.d.ts +3 -2
- package/esm/components/buckets/measureDateFilterOption.d.ts.map +1 -1
- package/esm/components/buckets/measureDateFilterOption.js +10 -3
- package/esm/components/filterBar/AttributeFilterItem.d.ts +6 -0
- package/esm/components/filterBar/AttributeFilterItem.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.d.ts +1 -2
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.js +10 -9
- package/esm/components/filterBar/dateFilter/DateFilter.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/DateFilter.js +16 -8
- package/esm/components/filterBar/dateFilter/DateFilterItem.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/DateFilterItem.js +2 -2
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.js +2 -2
- package/esm/components/filterBar/dateFilter/FilterButton/SelectedPresetName.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/FilterButton/SelectedPresetName.js +8 -5
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.d.ts +2 -0
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.js +6 -3
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.d.ts +3 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.js +2 -2
- package/esm/components/filterBar/dateFilter/PresetSection/PresetsSection.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/PresetsSection.js +5 -3
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.d.ts +12 -0
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.js +22 -0
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.d.ts +15 -1
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.js +8 -0
- package/esm/components/filterBar/dateFilter/selectors.d.ts +130 -9
- package/esm/components/filterBar/dateFilter/selectors.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/selectors.js +11 -3
- package/esm/components/filterBar/dateFilter/types.d.ts +3 -1
- package/esm/components/filterBar/dateFilter/types.d.ts.map +1 -1
- package/esm/components/filterBar/rankingFilter/RankingFilterItem.d.ts +22 -2
- package/esm/components/filterBar/rankingFilter/RankingFilterItem.d.ts.map +1 -1
- package/esm/components/report/ReportLoadFailed.d.ts +8 -0
- package/esm/components/report/ReportLoadFailed.d.ts.map +1 -0
- package/esm/components/report/ReportLoadFailed.js +14 -0
- package/esm/components/sort/ChartSort.d.ts +22 -2
- package/esm/components/sort/ChartSort.d.ts.map +1 -1
- package/esm/components/sort/chart_sort_bucket_items.d.ts +44 -4
- package/esm/components/sort/chart_sort_bucket_items.d.ts.map +1 -1
- package/esm/convertors/fromBackend/VisualizationConverter.d.ts.map +1 -1
- package/esm/convertors/fromBackend/VisualizationConverter.js +18 -1
- package/esm/convertors/toBackend/FilterConverter.d.ts.map +1 -1
- package/esm/convertors/toBackend/FilterConverter.js +15 -1
- package/esm/models/date_dataset.d.ts +3 -1
- package/esm/models/date_dataset.d.ts.map +1 -1
- package/esm/models/date_filter.d.ts +4 -1
- package/esm/models/date_filter.d.ts.map +1 -1
- package/esm/models/date_filter.js +10 -2
- package/esm/models/decorated_bucket_item.d.ts.map +1 -1
- package/esm/models/decorated_bucket_item.js +1 -1
- package/esm/models/granularity.d.ts +6 -1
- package/esm/models/granularity.d.ts.map +1 -1
- package/esm/models/granularity.js +5 -0
- package/esm/models/metadata.d.ts +3 -1
- package/esm/models/metadata.d.ts.map +1 -1
- package/esm/models/metadata.js +99 -17
- package/esm/models/period.d.ts +9 -0
- package/esm/models/period.d.ts.map +1 -0
- package/esm/models/period.js +13 -0
- package/esm/postMessageApi/state/selectors/post_message_context_selector.d.ts +44 -4
- package/esm/postMessageApi/state/selectors/post_message_context_selector.d.ts.map +1 -1
- package/esm/sagas/catalog/catalog_saga.d.ts +5 -0
- package/esm/sagas/catalog/catalog_saga.d.ts.map +1 -1
- package/esm/sagas/catalog/catalog_saga.js +3 -1
- package/esm/sagas/date_datasets/date_datasets_sagas.d.ts.map +1 -1
- package/esm/sagas/date_datasets/date_datasets_sagas.js +8 -1
- package/esm/sagas/open_report_sagas.d.ts +36 -11
- package/esm/sagas/open_report_sagas.d.ts.map +1 -1
- package/esm/sagas/open_report_sagas.js +110 -18
- package/esm/selectors/buckets_selector.d.ts +132 -12
- package/esm/selectors/buckets_selector.d.ts.map +1 -1
- package/esm/selectors/date_datasets_selector.d.ts +88 -8
- package/esm/selectors/date_datasets_selector.d.ts.map +1 -1
- package/esm/selectors/date_filter_selector.d.ts +6 -0
- package/esm/selectors/date_filter_selector.d.ts.map +1 -1
- package/esm/selectors/export_button_selector.d.ts +88 -8
- package/esm/selectors/export_button_selector.d.ts.map +1 -1
- package/esm/selectors/export_selector.d.ts +22 -2
- package/esm/selectors/export_selector.d.ts.map +1 -1
- package/esm/selectors/insight_selectors.d.ts +176 -16
- package/esm/selectors/insight_selectors.d.ts.map +1 -1
- package/esm/selectors/options_menu_selector.d.ts +132 -12
- package/esm/selectors/options_menu_selector.d.ts.map +1 -1
- package/esm/selectors/recommendations_selector.d.ts +17 -17
- package/esm/selectors/recommendations_selector.d.ts.map +1 -1
- package/esm/selectors/recommendations_selector.js +15 -6
- package/esm/selectors/report_selector.d.ts +105 -13
- package/esm/selectors/report_selector.d.ts.map +1 -1
- package/esm/selectors/report_selector.js +4 -0
- package/esm/selectors/report_visualization_selector.d.ts +34 -10
- package/esm/selectors/report_visualization_selector.d.ts.map +1 -1
- package/esm/selectors/selected_date_datasets_selector.d.ts +22 -2
- package/esm/selectors/selected_date_datasets_selector.d.ts.map +1 -1
- package/esm/selectors/selected_date_datasets_selector.js +3 -1
- package/esm/services/reference_point_service.d.ts.map +1 -1
- package/esm/services/reference_point_service.js +8 -5
- package/esm/store/bucket_filters/bucket_filters_actions.d.ts +2 -2
- package/esm/store/bucket_filters/bucket_filters_actions.d.ts.map +1 -1
- package/esm/store/bucket_filters/bucket_filters_sagas.d.ts +5 -1
- package/esm/store/bucket_filters/bucket_filters_sagas.d.ts.map +1 -1
- package/esm/store/bucket_filters/bucket_filters_sagas.js +13 -2
- package/esm/store/catalog/catalog_reducer.d.ts.map +1 -1
- package/esm/store/catalog/catalog_reducer.js +7 -0
- package/esm/store/catalog/catalog_selector.d.ts +119 -103
- package/esm/store/catalog/catalog_selector.d.ts.map +1 -1
- package/esm/store/catalog/catalog_selector.js +2 -4
- package/esm/store/catalog/catalog_store_actions.d.ts +6 -1
- package/esm/store/catalog/catalog_store_actions.d.ts.map +1 -1
- package/esm/store/catalog/catalog_store_actions.js +2 -0
- package/esm/store/catalog/catalog_types.d.ts +2 -0
- package/esm/store/catalog/catalog_types.d.ts.map +1 -1
- package/esm/store/filter_bar/filter_bar_helpers.d.ts +2 -2
- package/esm/store/filter_bar/filter_bar_helpers.d.ts.map +1 -1
- package/esm/store/filter_bar/filter_bar_helpers.js +19 -10
- package/esm/store/filter_bar/filter_bar_selector.d.ts.map +1 -1
- package/esm/store/filter_bar/filter_bar_selector.js +3 -2
- package/esm/store/filter_bar/filter_bar_types.d.ts +20 -1
- package/esm/store/filter_bar/filter_bar_types.d.ts.map +1 -1
- package/esm/store/filter_bar/filter_bar_types.js +6 -0
- package/esm/store/reference_point/reference_point_state.d.ts +2 -2
- package/esm/store/reference_point/reference_point_state.d.ts.map +1 -1
- package/esm/store/report/open_report_operation.d.ts +3 -1
- package/esm/store/report/open_report_operation.d.ts.map +1 -1
- package/esm/store/report/open_report_operation.js +1 -0
- package/esm/store/report/report_state.d.ts +15 -1
- package/esm/store/report/report_state.d.ts.map +1 -1
- package/esm/store/report/report_state.js +10 -0
- package/esm/translations/en-US.json +4 -0
- package/esm/typings/bear/bearTypes.d.ts +16 -1
- package/esm/typings/bear/bearTypes.d.ts.map +1 -1
- package/esm/typings/bear/bearTypes.js +4 -0
- package/esm/utils/api.d.ts +13 -0
- package/esm/utils/api.d.ts.map +1 -1
- package/esm/utils/api.js +14 -3
- package/esm/utils/sdkModelToADRep/FilterConverter.d.ts.map +1 -1
- package/esm/utils/sdkModelToADRep/FilterConverter.js +12 -1
- package/package.json +21 -21
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// (C) 2022-2026 GoodData Corporation
|
|
2
2
|
import moment from "moment";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { areObjRefsEqual
|
|
4
|
+
import { areObjRefsEqual } from "@gooddata/sdk-model";
|
|
5
5
|
import { OverTimeComparisonTypes } from "@gooddata/sdk-ui";
|
|
6
6
|
import { isAbsoluteDateFilterOption, isRelativeDateFilterOption, } from "@gooddata/sdk-ui-filters";
|
|
7
7
|
import { _isEqual } from "@gooddata/util";
|
|
8
|
-
|
|
8
|
+
import { isAllTimeOption } from "../dateFilterOptionFactory.js";
|
|
9
|
+
const isAllTimeSelectedAndTimeComparisonApplied = (selectedFilter, selectedTimeComparisonType) => isAllTimeOption(selectedFilter) &&
|
|
9
10
|
(OverTimeComparisonTypes.PREVIOUS_PERIOD === selectedTimeComparisonType ||
|
|
10
11
|
OverTimeComparisonTypes.SAME_PERIOD_PREVIOUS_YEAR === selectedTimeComparisonType);
|
|
11
12
|
const areSameMeasuresSelected = (selectedComparisonMeasures, originalComparisonMeasures) => _isEqual(selectedComparisonMeasures.slice().sort(), originalComparisonMeasures.slice().sort());
|
|
@@ -13,7 +14,7 @@ const areSameMeasuresSelected = (selectedComparisonMeasures, originalComparisonM
|
|
|
13
14
|
* Include with a period works only as the date filter's own empty values handling; the legacy
|
|
14
15
|
* representation supports it with All time alone.
|
|
15
16
|
*/
|
|
16
|
-
const isEmptyValuesIncludeInvalid = (
|
|
17
|
+
const isEmptyValuesIncludeInvalid = (option, mode, isIncludeWithPeriodAllowed) => mode === "include" && !isIncludeWithPeriodAllowed && !isAllTimeOption(option);
|
|
17
18
|
const isEndTimeAfterOrAtStartTime = (start, end) => moment(start) <= moment(end);
|
|
18
19
|
const isValidAbsoluteDateRange = (selectedFilter) => !isAbsoluteDateFilterOption(selectedFilter) ||
|
|
19
20
|
(selectedFilter.from !== undefined &&
|
|
@@ -25,7 +26,7 @@ const isValidFloatingDateRange = (selectedFilter) => !isRelativeDateFilterOption
|
|
|
25
26
|
* The mode as it is saved: include on All time is the default and is not stored, so it equals no mode.
|
|
26
27
|
* Any other mode is stored as chosen, so choosing it is a change even when it matches the backend default.
|
|
27
28
|
*/
|
|
28
|
-
const getStoredEmptyDateValuesFilterMode = (mode,
|
|
29
|
+
const getStoredEmptyDateValuesFilterMode = (mode, option) => mode === "include" && isAllTimeOption(option) ? undefined : mode;
|
|
29
30
|
const isDialogStateChanged = (selectedFilter, originalFilter, selectedDateDataset, originalDateDataset, selectedTimeComparisonType, originalTimeComparisonType, selectedComparisonMeasures, originalComparisonMeasures, additionalDateFilters, originalAdditionalDateFilters, selectedEmptyDateValuesFilterMode, originalEmptyDateValuesFilterMode) => {
|
|
30
31
|
const isFilterSame = _isEqual(selectedFilter, originalFilter);
|
|
31
32
|
const isComparisonTypeSame = selectedTimeComparisonType === originalTimeComparisonType;
|
|
@@ -33,8 +34,8 @@ const isDialogStateChanged = (selectedFilter, originalFilter, selectedDateDatase
|
|
|
33
34
|
const isSameDateDataset = areObjRefsEqual(selectedDateDataset.ref, originalDateDataset?.ref);
|
|
34
35
|
const areComparisonMeasuresSame = areSameMeasuresSelected(selectedComparisonMeasures, originalComparisonMeasures);
|
|
35
36
|
const areAdditionalFiltersSame = _isEqual(additionalDateFilters, originalAdditionalDateFilters);
|
|
36
|
-
const isEmptyDateValuesFilterModeSame = getStoredEmptyDateValuesFilterMode(selectedEmptyDateValuesFilterMode, selectedFilter
|
|
37
|
-
getStoredEmptyDateValuesFilterMode(originalEmptyDateValuesFilterMode, originalFilter
|
|
37
|
+
const isEmptyDateValuesFilterModeSame = getStoredEmptyDateValuesFilterMode(selectedEmptyDateValuesFilterMode, selectedFilter) ===
|
|
38
|
+
getStoredEmptyDateValuesFilterMode(originalEmptyDateValuesFilterMode, originalFilter);
|
|
38
39
|
return (!isFilterSame ||
|
|
39
40
|
!isComparisonTypeSame ||
|
|
40
41
|
!isSameDateDataset ||
|
|
@@ -46,8 +47,8 @@ export const useApplyButtonEnabled = (selectedFilter, originalFilter, selectedDa
|
|
|
46
47
|
const { filterOption } = selectedFilter;
|
|
47
48
|
const isSelectionDifferent = isDialogStateChanged(selectedFilter, originalFilter, selectedDateDataset, originalDateDataset, selectedTimeComparisonType, originalTimeComparisonType, selectedComparisonMeasures, originalComparisonMeasures, additionalDateFilters, originalAdditionalDateFilters, selectedEmptyDateValuesFilterMode, originalEmptyDateValuesFilterMode);
|
|
48
49
|
const ignoreTimeComparison = selectedTimeComparisonType === OverTimeComparisonTypes.NOTHING;
|
|
49
|
-
const isValidTimeComparison = isAllTimeSelectedAndTimeComparisonApplied(
|
|
50
|
-
const isInvalidEmptyValuesInclude = isEmptyValuesIncludeInvalid(
|
|
50
|
+
const isValidTimeComparison = isAllTimeSelectedAndTimeComparisonApplied(selectedFilter, selectedTimeComparisonType);
|
|
51
|
+
const isInvalidEmptyValuesInclude = isEmptyValuesIncludeInvalid(selectedFilter, selectedEmptyDateValuesFilterMode, isIncludeWithPeriodAllowed);
|
|
51
52
|
return (isSelectionDifferent &&
|
|
52
53
|
isValidAbsoluteDateRange(filterOption) &&
|
|
53
54
|
isValidFloatingDateRange(filterOption) &&
|
|
@@ -58,7 +59,7 @@ export const useApplyButtonEnabled = (selectedFilter, originalFilter, selectedDa
|
|
|
58
59
|
export const useDisabledApplyButtonTooltip = (selectedFilter, selectedTimeComparisonType, isValidDateDataset, selectedEmptyDateValuesFilterMode, isIncludeWithPeriodAllowed = false) => {
|
|
59
60
|
const intl = useIntl();
|
|
60
61
|
const ignoreTimeComparison = selectedTimeComparisonType === OverTimeComparisonTypes.NOTHING;
|
|
61
|
-
const isAllTime =
|
|
62
|
+
const isAllTime = isAllTimeOption(selectedFilter);
|
|
62
63
|
if (isEmptyValuesIncludeInvalid(selectedFilter, selectedEmptyDateValuesFilterMode, isIncludeWithPeriodAllowed)) {
|
|
63
64
|
return intl.formatMessage({ id: "filter.date.empty_values.include.disabled_apply_tooltip" });
|
|
64
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/DateFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/DateFilter.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAcnD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,2CAgUpD"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useRef, useState } from "react";
|
|
4
4
|
import { shallowEqual, useDispatch, useSelector } from "react-redux";
|
|
5
|
-
import { areObjRefsEqual
|
|
5
|
+
import { areObjRefsEqual } from "@gooddata/sdk-model";
|
|
6
6
|
import { OverTimeComparisonTypes } from "@gooddata/sdk-ui";
|
|
7
7
|
import { DateFilterHelpers } from "@gooddata/sdk-ui-filters";
|
|
8
8
|
import { normalizeSelectedFilterOption } from "@gooddata/sdk-ui-filters/internal";
|
|
@@ -18,6 +18,7 @@ import { CancelButton } from "./Buttons/CancelButton.js";
|
|
|
18
18
|
import { STATIC_DATE_RANGE_BUTTON_LABEL_FORMAT } from "./constants.js";
|
|
19
19
|
import { datasetRefWithGranularitiesHasSeconds } from "./dateDatasetGranularities.js";
|
|
20
20
|
import { DateDatasetSection } from "./DateDatasetSection/DateDatasetSection.js";
|
|
21
|
+
import { isAllTimeOption } from "./dateFilterOptionFactory.js";
|
|
21
22
|
import { ALL_TIME_FILTER_OPTION } from "./defaultFilterOptions.js";
|
|
22
23
|
import { FilterDropdown } from "./FilterDropdown/FilterDropdown.js";
|
|
23
24
|
import { PresetsSection } from "./PresetSection/PresetsSection.js";
|
|
@@ -33,7 +34,7 @@ export function DateFilter(ownProps) {
|
|
|
33
34
|
const { filter, relativeDateFilterPresets, dateDataset, dateDatasets, dateDatasetRefsWithGranularities, dateFormat, timeComparisonMeasures, supportedTimeComparisonTypes, timeComparisonType, timeComparisonCompatibleMeasures, isUsedByInsight, dateBucketItemDateDatasetRefs, isDateDatasetsDropdownLoaded, areGenericDateAttributeElementsSupported, additionalDateAttributeFilters, additionalDateFilterLabels, migratedAdditionalFilters, isTimeForAbsoluteRangeEnabled, isSecondsGranularityEnabled, formatLocale, weekStart, enableUnavailableItemsVisibility, storedEmptyDateValuesFilter, isFirstDateFilter, activeCalendars, } = useSelector((state) => selectDateFilterProps(state, ownProps), shallowEqual);
|
|
34
35
|
// the flag writes the empty values mode as the date filter's own handling, which supports include
|
|
35
36
|
// with any period
|
|
36
|
-
const
|
|
37
|
+
const isImprovedMetricDateFilterEnabled = useSelector(enableImprovedMetricDateFilter);
|
|
37
38
|
const dispatch = useDispatch();
|
|
38
39
|
const loadDateDatasets = useCallback((ignoreDateDataset) => dispatch(loadDateDatasetsToDateDropdown(ignoreDateDataset)), [dispatch]);
|
|
39
40
|
// A filter the user just added mounts with its picker open (the add and the auto-open hand-over land
|
|
@@ -66,9 +67,13 @@ export function DateFilter(ownProps) {
|
|
|
66
67
|
// rather than a dataset the user may have selected in the open dropdown but not yet applied.
|
|
67
68
|
const isSecondsForAppliedFilterButton = isSecondsGranularityEnabled &&
|
|
68
69
|
datasetRefWithGranularitiesHasSeconds(dateDatasetRefsWithGranularities, dateDataset?.ref);
|
|
69
|
-
const isAllTime =
|
|
70
|
+
const isAllTime = isAllTimeOption(selectedFilter);
|
|
71
|
+
// AD does not offer the comparison over time with a period
|
|
72
|
+
const isPeriodSelected = !!selectedFilter.period;
|
|
73
|
+
// a filter with a period always carries its empty values mode itself, so it keeps include without the flag
|
|
74
|
+
const isIncludeWithPeriodAllowed = isImprovedMetricDateFilterEnabled || isPeriodSelected;
|
|
70
75
|
const isValidDateDataset = isValidDateDatasetSelected(selectedDateDataset, dateBucketItemDateDatasetRefs);
|
|
71
|
-
const applyButtonTooltip = useDisabledApplyButtonTooltip(selectedFilter
|
|
76
|
+
const applyButtonTooltip = useDisabledApplyButtonTooltip(selectedFilter, selectedTimeComparison, isValidDateDataset, selectedEmptyDateValuesFilterMode, isIncludeWithPeriodAllowed);
|
|
72
77
|
const isApplyEnabled = useApplyButtonEnabled(selectedFilter, filter, selectedDateDataset, dateDataset, selectedTimeComparison, timeComparisonType, selectedTimeComparisonMeasures, timeComparisonMeasures, selectedAdditionalDateFilters, additionalDateAttributeFilters, isValidDateDataset, selectedEmptyDateValuesFilterMode, storedEmptyDateValuesFilter, isIncludeWithPeriodAllowed);
|
|
73
78
|
const handleOnOpen = () => {
|
|
74
79
|
setDropdownOpen(true);
|
|
@@ -85,7 +90,7 @@ export function DateFilter(ownProps) {
|
|
|
85
90
|
onClose();
|
|
86
91
|
};
|
|
87
92
|
const handleOnApply = () => {
|
|
88
|
-
const { filterOption, excludeCurrentPeriod } = selectedFilter;
|
|
93
|
+
const { filterOption, excludeCurrentPeriod, period } = selectedFilter;
|
|
89
94
|
// When "Only" empty values is selected, force All time, remove additional filters, and reset comparison
|
|
90
95
|
const isOnlyEmptyValues = selectedEmptyDateValuesFilterMode === "only";
|
|
91
96
|
const effectiveFilterOption = isOnlyEmptyValues ? ALL_TIME_FILTER_OPTION : filterOption;
|
|
@@ -106,6 +111,8 @@ export function DateFilter(ownProps) {
|
|
|
106
111
|
filter: DateFilterHelpers.applyExcludeCurrentPeriod(normalizedFilterOption, effectiveExcludeCurrentPeriod),
|
|
107
112
|
isCurrentPeriodExcluded: effectiveExcludeCurrentPeriod,
|
|
108
113
|
emptyDateValuesFilter: selectedEmptyDateValuesFilterMode,
|
|
114
|
+
// "Only" empty values replaces the period with All time like any other period
|
|
115
|
+
...(period && !isOnlyEmptyValues ? { period: period.config } : {}),
|
|
109
116
|
});
|
|
110
117
|
handleOnClose();
|
|
111
118
|
};
|
|
@@ -144,8 +151,9 @@ export function DateFilter(ownProps) {
|
|
|
144
151
|
onMigratedFiltersDismiss();
|
|
145
152
|
}
|
|
146
153
|
};
|
|
147
|
-
// Without the flag the legacy representation drops include, so the button must not word it
|
|
148
|
-
|
|
154
|
+
// Without the flag the legacy representation drops include, so the button must not word it; a filter with
|
|
155
|
+
// a period keeps it
|
|
156
|
+
const buttonEmptyDateValuesFilterMode = storedEmptyDateValuesFilter === "include" && !isImprovedMetricDateFilterEnabled && !filter.period
|
|
149
157
|
? undefined
|
|
150
158
|
: storedEmptyDateValuesFilter;
|
|
151
159
|
const filterDropdownDateFormat = formatLocale ? dateFormat : STATIC_DATE_RANGE_BUTTON_LABEL_FORMAT;
|
|
@@ -155,5 +163,5 @@ export function DateFilter(ownProps) {
|
|
|
155
163
|
compatibleMeasuresCount: timeComparisonCompatibleMeasures.length,
|
|
156
164
|
selectedMeasuresCount: timeComparisonMeasures.length,
|
|
157
165
|
}
|
|
158
|
-
: null, additionalDateFilterLabels: additionalDateFilterLabels, emptyDateValuesFilterMode: buttonEmptyDateValuesFilterMode, isDragged: isDragged, datasetTitle: dateDataset?.title, isUsedByInsight: isUsedByInsight, migratedAdditionalFilters: migratedAdditionalFilters, dateFormat: filterDropdownDateFormat, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAppliedFilterButton, children: [_jsx(DateDatasetSection, { selectedDateDataset: selectedDateDataset, dateDatasets: dateDatasets, onChange: handleOnDateDataset, loadDateDatasets: loadDateDatasets, isDateDatasetsDropdownLoaded: isDateDatasetsDropdownLoaded, enableUnavailableItemsVisibility: enableUnavailableItemsVisibility }), _jsxs("div", { className: "adi-date-filter-body s-adi-date-filter-body", children: [_jsx(PresetsSection, { filter: selectedFilter, onChange: setSelectedFilter, onEdit: onMigratedFiltersDismiss, relativeDateFilterPresets: relativeDateFilterPresets, dateDataset: selectedDateDataset, dateDatasetRefsWithGranularities: dateDatasetRefsWithGranularities, dateFormat: dateFormat, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled: isSecondsGranularityEnabled, weekStart: weekStart, submitForm: handleOnApply, isDisabled: isOtherFiltersDisabled, activeCalendars: activeCalendars }), areGenericDateAttributeElementsSupported ? (_jsx(AdditionalDateFilters, { dateDataset: selectedDateDataset, dateDatasetRefsWithGranularities: dateDatasetRefsWithGranularities, additionalDateAttributeFilters: isFirstDateFilter ? selectedAdditionalDateFilters : [], migratedAdditionalFilters: currentMigratedFilters, emptyDateValuesFilterMode: selectedEmptyDateValuesFilterMode, onFiltersUpdate: setSelectedAdditionalDateFilters, onMigratedFiltersDismiss: onMigratedFiltersDismiss, onEmptyDateValuesFilterModeChange: handleEmptyDateValuesFilterModeChange, isDisabled: isOtherFiltersDisabled, isAllTime: isAllTime, isIncludeWithPeriodAllowed: isIncludeWithPeriodAllowed, showDateGranularities: isFirstDateFilter })) : null, _jsx(TimeComparisonSection, { selectedType: selectedTimeComparison, selectedMeasureIds: selectedTimeComparisonMeasures, onTypeSelected: handleTimeComparisonTypeSelected, onMeasuresSelected: handleTimeComparisonMeasuresSelected, compatibleMeasures: timeComparisonCompatibleMeasures, supportedTypes: supportedTimeComparisonTypes, isAllTimeDateFilter: isAllTime, isPoPAvailable: isValidDateDataset, isSectionHidden: !isFirstDateFilter, isDisabled: isOtherFiltersDisabled })] }), _jsxs("div", { className: "filter-picker-buttons", children: [_jsx(CancelButton, { onClick: handleOnClose }), _jsx(ApplyButton, { onClick: handleOnApply, isEnabled: isApplyEnabled, tooltip: applyButtonTooltip })] })] }));
|
|
166
|
+
: null, additionalDateFilterLabels: additionalDateFilterLabels, emptyDateValuesFilterMode: buttonEmptyDateValuesFilterMode, isDragged: isDragged, datasetTitle: dateDataset?.title, isUsedByInsight: isUsedByInsight, migratedAdditionalFilters: migratedAdditionalFilters, dateFormat: filterDropdownDateFormat, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAppliedFilterButton, children: [_jsx(DateDatasetSection, { selectedDateDataset: selectedDateDataset, dateDatasets: dateDatasets, onChange: handleOnDateDataset, loadDateDatasets: loadDateDatasets, isDateDatasetsDropdownLoaded: isDateDatasetsDropdownLoaded, enableUnavailableItemsVisibility: enableUnavailableItemsVisibility }), _jsxs("div", { className: "adi-date-filter-body s-adi-date-filter-body", children: [_jsx(PresetsSection, { filter: selectedFilter, onChange: setSelectedFilter, onEdit: onMigratedFiltersDismiss, relativeDateFilterPresets: relativeDateFilterPresets, dateDataset: selectedDateDataset, dateDatasetRefsWithGranularities: dateDatasetRefsWithGranularities, dateFormat: dateFormat, isTimeForAbsoluteRangeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled: isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled: isSecondsGranularityEnabled, weekStart: weekStart, submitForm: handleOnApply, isDisabled: isOtherFiltersDisabled, activeCalendars: activeCalendars }), areGenericDateAttributeElementsSupported ? (_jsx(AdditionalDateFilters, { dateDataset: selectedDateDataset, dateDatasetRefsWithGranularities: dateDatasetRefsWithGranularities, additionalDateAttributeFilters: isFirstDateFilter ? selectedAdditionalDateFilters : [], migratedAdditionalFilters: currentMigratedFilters, emptyDateValuesFilterMode: selectedEmptyDateValuesFilterMode, onFiltersUpdate: setSelectedAdditionalDateFilters, onMigratedFiltersDismiss: onMigratedFiltersDismiss, onEmptyDateValuesFilterModeChange: handleEmptyDateValuesFilterModeChange, isDisabled: isOtherFiltersDisabled, isAllTime: isAllTime, isIncludeWithPeriodAllowed: isIncludeWithPeriodAllowed, showDateGranularities: isFirstDateFilter })) : null, isPeriodSelected ? null : (_jsx(TimeComparisonSection, { selectedType: selectedTimeComparison, selectedMeasureIds: selectedTimeComparisonMeasures, onTypeSelected: handleTimeComparisonTypeSelected, onMeasuresSelected: handleTimeComparisonMeasuresSelected, compatibleMeasures: timeComparisonCompatibleMeasures, supportedTypes: supportedTimeComparisonTypes, isAllTimeDateFilter: isAllTime, isPoPAvailable: isValidDateDataset, isSectionHidden: !isFirstDateFilter, isDisabled: isOtherFiltersDisabled }))] }), _jsxs("div", { className: "filter-picker-buttons", children: [_jsx(CancelButton, { onClick: handleOnClose }), _jsx(ApplyButton, { onClick: handleOnApply, isEnabled: isApplyEnabled, tooltip: applyButtonTooltip })] })] }));
|
|
159
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilterItem.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/DateFilterItem.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAQjF,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,OAAO,EAAE,WAAW,GACvB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"DateFilterItem.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/DateFilterItem.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAQjF,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,OAAO,EAAE,WAAW,GACvB,EAAE,uBAAuB,2CAqDzB"}
|
|
@@ -15,12 +15,12 @@ export function DateFilterItem({ filter, className, isHighlighted, isDraggedItem
|
|
|
15
15
|
highlight: isHighlighted,
|
|
16
16
|
});
|
|
17
17
|
const { localIdentifier } = filter;
|
|
18
|
-
const onApply = useMemo(() => ({ overTimeComparisonType, overTimeComparisonMeasures, filter, dateDatasetRef, additionalDateAttributeFilters, isCurrentPeriodExcluded, emptyDateValuesFilter, }) => {
|
|
18
|
+
const onApply = useMemo(() => ({ overTimeComparisonType, overTimeComparisonMeasures, filter, period, dateDatasetRef, additionalDateAttributeFilters, isCurrentPeriodExcluded, emptyDateValuesFilter, }) => {
|
|
19
19
|
dispatch(updateDateFilter({
|
|
20
20
|
localIdentifier: localIdentifier,
|
|
21
21
|
overTimeComparisonType,
|
|
22
22
|
overTimeComparisonMeasures,
|
|
23
|
-
filterConfig: buildDateFilterValueFromDateFilterOption(filter),
|
|
23
|
+
filterConfig: period ?? buildDateFilterValueFromDateFilterOption(filter),
|
|
24
24
|
dateDatasetRef,
|
|
25
25
|
additionalDateAttributeFilters,
|
|
26
26
|
isCurrentPeriodExcluded,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterButtonLabel.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterButtonLabel.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAC3G,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,+BAA+B,CAAC;AAOxF,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACzD,0BAA0B,EAAE,0BAA0B,EAAE,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B,EAAE,OAAO,CAAC;IACvC,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAaD,wBAAgB,iBAAiB,CAAC,EAC9B,MAAM,EACN,YAAY,EACZ,qBAAqB,EACrB,0BAA0B,EAC1B,UAAU,EACV,yBAAyB,EACzB,SAAS,EACT,6BAA6B,EAC7B,gCAAgC,GACnC,EAAE,uBAAuB,2CAwDzB"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import {
|
|
5
|
+
import { isAllTimeOption } from "../dateFilterOptionFactory.js";
|
|
6
6
|
import { AdditionalFilterDetails } from "./AdditionalFilterDetails.js";
|
|
7
7
|
import { DatasetTitle } from "./DatasetTitle.js";
|
|
8
8
|
import { SelectedPresetName } from "./SelectedPresetName.js";
|
|
@@ -19,7 +19,7 @@ export function FilterButtonLabel({ filter, datasetTitle, timeComparisonSummary,
|
|
|
19
19
|
const hasTimeComparisonConfigured = isTimeComparisonConfigured(timeComparisonSummary);
|
|
20
20
|
const hasAdditionalFiltersConfigured = additionalDateFilterLabels.length > 0;
|
|
21
21
|
const isPresetOnFirstLine = hasTimeComparisonConfigured || hasAdditionalFiltersConfigured;
|
|
22
|
-
const isAllTime =
|
|
22
|
+
const isAllTime = isAllTimeOption(filter);
|
|
23
23
|
const hasEmptyValuesFilterApplied = emptyDateValuesFilterMode === "only" || emptyDateValuesFilterMode === "exclude";
|
|
24
24
|
const isInDefaultState = isAllTime && !hasTimeComparisonConfigured && !hasEmptyValuesFilterApplied;
|
|
25
25
|
const secondLineClassNames = classNames("adi-filter-selection", "s-global-attribute-filter-selection", "s-global-filter-label-bottom", "adi-filter-button-bottom-line", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectedPresetName.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/FilterButton/SelectedPresetName.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectedPresetName.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/FilterButton/SelectedPresetName.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,+BAA+B,CAAC;AAExF,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CACzD;AAgCD,wBAAgB,kBAAkB,CAAC,EAAE,yBAAyB,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,2CAYnG"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { isAllTimeDateFilterOption } from "@gooddata/sdk-model";
|
|
5
4
|
import { IntlWrapper } from "@gooddata/sdk-ui";
|
|
6
5
|
import { DateFilterHelpers } from "@gooddata/sdk-ui-filters";
|
|
7
6
|
import { FilterLabel } from "@gooddata/sdk-ui-kit";
|
|
8
7
|
import { getPeriodTitleWithEmptyValues } from "../../../../models/empty_date_values_title.js";
|
|
9
|
-
|
|
8
|
+
import { isAllTimeOption } from "../dateFilterOptionFactory.js";
|
|
9
|
+
function PresetName({ filter, dateFormat, isInDefaultState, withEmptyValues, }) {
|
|
10
10
|
const sdkIntl = useIntl();
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
11
|
+
const { filterOption, excludeCurrentPeriod, period } = filter;
|
|
12
|
+
// a period shows its title, not its range (Figma Specs 05); its empty values mode is worded like any period's
|
|
13
|
+
const selectionTitle = period
|
|
14
|
+
? period.title
|
|
15
|
+
: DateFilterHelpers.getDateFilterTitleUsingTranslator(DateFilterHelpers.applyExcludeCurrentPeriod(filterOption, excludeCurrentPeriod), sdkIntl, "full", dateFormat);
|
|
16
|
+
const title = withEmptyValues(selectionTitle, isAllTimeOption(filter));
|
|
14
17
|
// a worded empty date values mode is never the default state
|
|
15
18
|
if (isInDefaultState && title === selectionTitle) {
|
|
16
19
|
return _jsx(_Fragment, { children: selectionTitle });
|
|
@@ -2,6 +2,8 @@ import { type IActiveCalendars } from "@gooddata/sdk-model";
|
|
|
2
2
|
import { type CalendarTabType, type DateFilterOption, type DateFilterRelativeOptionGroup } from "@gooddata/sdk-ui-filters";
|
|
3
3
|
export interface IDatePresetsDropdownProps {
|
|
4
4
|
selectedPreset: DateFilterOption;
|
|
5
|
+
/** the title of the period the filter references; no preset is selected then */
|
|
6
|
+
selectedPeriodTitle?: string;
|
|
5
7
|
relativeDateFilterPresets: DateFilterRelativeOptionGroup;
|
|
6
8
|
onChange: (filter: DateFilterOption) => void;
|
|
7
9
|
dateFormat: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePresetsDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAGrC,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,yBAAyB;IACtC,cAAc,EAAE,gBAAgB,CAAC;IACjC,yBAAyB,EAAE,6BAA6B,CAAC;IACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"DatePresetsDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAGrC,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,yBAAyB;IACtC,cAAc,EAAE,gBAAgB,CAAC;IACjC,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,6BAA6B,CAAC;IACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACtC;AA2ED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,2CA2BnE"}
|
|
@@ -11,9 +11,12 @@ import { useDropdownHeight } from "../../../shared/DropdownWrapperHook.js";
|
|
|
11
11
|
import { ALL_TIME_FILTER_OPTION, RELATIVE_PERIOD_FILTER_OPTION, STATIC_PERIOD_FILTER_OPTION, } from "../defaultFilterOptions.js";
|
|
12
12
|
import { DatePresetDropdownItem } from "./DatePresetDropdownItem.js";
|
|
13
13
|
import { DatePresetsDropdownButton } from "./DatePresetsDropdownButton.js";
|
|
14
|
-
|
|
14
|
+
// matches no item: with a period selected, no preset is
|
|
15
|
+
const NO_SELECTED_PRESET = { ...ALL_TIME_FILTER_OPTION, localIdentifier: "" };
|
|
16
|
+
function DatePresetsDropdownBody({ buttonNode, selectedPreset: selectedPresetProp, selectedPeriodTitle, relativeDateFilterPresets, onChange, closeDropdown, dateFormat, contextWindow = window, selectedTab, onTabChange, activeCalendars, }) {
|
|
15
17
|
const intl = useIntl();
|
|
16
18
|
const dialogHeight = useDropdownHeight(buttonNode, 100, 600, 0, 30, contextWindow);
|
|
19
|
+
const selectedPreset = selectedPeriodTitle === undefined ? selectedPresetProp : NO_SELECTED_PRESET;
|
|
17
20
|
const fiscalTabsConfig = getFiscalTabsConfig(relativeDateFilterPresets, activeCalendars);
|
|
18
21
|
const filteredPresets = getFilteredPresets(relativeDateFilterPresets, fiscalTabsConfig, selectedTab);
|
|
19
22
|
const handleOnChange = (option) => {
|
|
@@ -24,6 +27,6 @@ function DatePresetsDropdownBody({ buttonNode, selectedPreset, relativeDateFilte
|
|
|
24
27
|
}
|
|
25
28
|
export function DatePresetsDropdown(props) {
|
|
26
29
|
const buttonRef = useRef(null);
|
|
27
|
-
const { selectedPreset, dateFormat } = props;
|
|
28
|
-
return (_jsx(Dropdown, { className: "s-filter-date-preset-switch adi-date-preset-select-dropdown s-date-dataset-switch", renderButton: (props) => (_jsx(DatePresetsDropdownButton, { ...props, selectedPreset: selectedPreset, buttonWrapperRef: buttonRef, dateFormat: dateFormat })), alignPoints: DROPDOWN_ALIGN_POINTS, closeOnParentScroll: true, closeOnMouseDrag: true, renderBody: ({ closeDropdown }) => (_jsx(DatePresetsDropdownBody, { ...props, buttonNode: buttonRef.current, closeDropdown: closeDropdown })) }));
|
|
30
|
+
const { selectedPreset, selectedPeriodTitle, dateFormat } = props;
|
|
31
|
+
return (_jsx(Dropdown, { className: "s-filter-date-preset-switch adi-date-preset-select-dropdown s-date-dataset-switch", renderButton: (props) => (_jsx(DatePresetsDropdownButton, { ...props, selectedPreset: selectedPreset, selectedPeriodTitle: selectedPeriodTitle, buttonWrapperRef: buttonRef, dateFormat: dateFormat })), alignPoints: DROPDOWN_ALIGN_POINTS, closeOnParentScroll: true, closeOnMouseDrag: true, renderBody: ({ closeDropdown }) => (_jsx(DatePresetsDropdownBody, { ...props, buttonNode: buttonRef.current, closeDropdown: closeDropdown })) }));
|
|
29
32
|
}
|
|
@@ -3,8 +3,10 @@ import { type DateFilterOption } from "@gooddata/sdk-ui-filters";
|
|
|
3
3
|
import { type IDropdownButtonRenderProps } from "@gooddata/sdk-ui-kit";
|
|
4
4
|
export interface IDatePresetsDropdownButtonProps extends IDropdownButtonRenderProps {
|
|
5
5
|
selectedPreset: DateFilterOption;
|
|
6
|
+
/** the title of the period the filter references, shown instead of the preset */
|
|
7
|
+
selectedPeriodTitle?: string;
|
|
6
8
|
buttonWrapperRef: Ref<HTMLDivElement>;
|
|
7
9
|
dateFormat: string;
|
|
8
10
|
}
|
|
9
|
-
export declare function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset, buttonWrapperRef, dateFormat, }: IDatePresetsDropdownButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset, selectedPeriodTitle, buttonWrapperRef, dateFormat, }: IDatePresetsDropdownButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
//# sourceMappingURL=DatePresetsDropdownButton.d.ts.map
|
package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePresetsDropdownButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAkB,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAkCvF,MAAM,WAAW,+BAAgC,SAAQ,0BAA0B;IAC/E,cAAc,EAAE,gBAAgB,CAAC;IACjC,gBAAgB,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,yBAAyB,CAAC,EACtC,MAAM,EACN,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,GACb,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"DatePresetsDropdownButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAkB,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAkCvF,MAAM,WAAW,+BAAgC,SAAQ,0BAA0B;IAC/E,cAAc,EAAE,gBAAgB,CAAC;IACjC,iFAAiF;IACjF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,yBAAyB,CAAC,EACtC,MAAM,EACN,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,GACb,EAAE,+BAA+B,2CAqBjC"}
|
|
@@ -24,10 +24,10 @@ function ButtonTitle({ preset, dateFormat }) {
|
|
|
24
24
|
}
|
|
25
25
|
return _jsx(PresetTitle, { preset: preset, dateFormat: dateFormat });
|
|
26
26
|
}
|
|
27
|
-
export function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset, buttonWrapperRef, dateFormat, }) {
|
|
27
|
+
export function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset, selectedPeriodTitle, buttonWrapperRef, dateFormat, }) {
|
|
28
28
|
const buttonClassName = classNames("s-date-preset-button", {
|
|
29
29
|
"s-expanded": isOpen,
|
|
30
30
|
"s-collapsed": !isOpen,
|
|
31
31
|
});
|
|
32
|
-
return (_jsx(DropdownButtonWrapper, { setRef: buttonWrapperRef, children: _jsx(DropdownButton, { id: "preset-dropdown", className: buttonClassName, value: _jsx(ButtonTitle, { preset: selectedPreset, dateFormat: dateFormat }), onClick: toggleDropdown }) }));
|
|
32
|
+
return (_jsx(DropdownButtonWrapper, { setRef: buttonWrapperRef, children: _jsx(DropdownButton, { id: "preset-dropdown", className: buttonClassName, value: selectedPeriodTitle === undefined ? (_jsx(ButtonTitle, { preset: selectedPreset, dateFormat: dateFormat })) : (selectedPeriodTitle), onClick: toggleDropdown }) }));
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresetsSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/PresetsSection.tsx"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAGjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIH,KAAK,6BAA6B,EASrC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAExF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"PresetsSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/PresetsSection.tsx"],"names":[],"mappings":"AAMA,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAGjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIH,KAAK,6BAA6B,EASrC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAExF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AA8BvE,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,EAAE,6BAA6B,CAAC;IACzD,WAAW,EAAE,qBAAqB,CAAC;IACnC,gCAAgC,EAAE,gCAAgC,EAAE,CAAC;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B,EAAE,OAAO,CAAC;IACvC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,yBAAyB,EACzB,QAAQ,EACR,MAAM,EACN,WAAW,EACX,gCAAgC,EAChC,UAAU,EACV,6BAA6B,EAC7B,gCAAgC,EAChC,2BAAmC,EACnC,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,GAClB,EAAE,oBAAoB,2CAoItB"}
|
|
@@ -9,7 +9,7 @@ import { DatePresetsDropdown } from "./DatePresetsDropdown.js";
|
|
|
9
9
|
import { ExcludeCurrentPeriod } from "./ExcludeCurrentPeriod.js";
|
|
10
10
|
import { RelativeDateRange } from "./RelativeDateRange.js";
|
|
11
11
|
import { StaticDateRange } from "./StaticDateRange.js";
|
|
12
|
-
import { useResetPresetWhenUnsupportedOneIsSelected, useResetRelativeRangeWhenUnsupportedOneIsSelected, useSupportedDateFilterPresets, } from "./supportedPresetsHook.js";
|
|
12
|
+
import { useResetPeriodWhenUnsupportedByDateDataset, useResetPresetWhenUnsupportedOneIsSelected, useResetRelativeRangeWhenUnsupportedOneIsSelected, useSupportedDateFilterPresets, } from "./supportedPresetsHook.js";
|
|
13
13
|
/**
|
|
14
14
|
* Filter presets based on which calendars are enabled (not by selected tab).
|
|
15
15
|
* Used for the dropdown which handles tab-based filtering internally.
|
|
@@ -47,6 +47,7 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
47
47
|
};
|
|
48
48
|
const filteredGranularities = getFilteredGranularities(supportedChronologicalGranularities, fiscalTabsConfig, selectedTab);
|
|
49
49
|
useResetPresetWhenUnsupportedOneIsSelected(currentFilterOption, enabledCalendarPresets, onChange);
|
|
50
|
+
useResetPeriodWhenUnsupportedByDateDataset(filter, dateDataset, dateDatasetRefsWithGranularities, onChange);
|
|
50
51
|
useResetRelativeRangeWhenUnsupportedOneIsSelected(currentFilterOption, filteredGranularities, onChange);
|
|
51
52
|
const displayDateRange = isAbsoluteDateFilterForm(currentFilterOption);
|
|
52
53
|
const displayFloatingRange = isRelativeDateFilterForm(currentFilterOption);
|
|
@@ -55,7 +56,8 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
55
56
|
onUserChange({ filterOption: updatedFilter, excludeCurrentPeriod });
|
|
56
57
|
};
|
|
57
58
|
const onPresetSelectionChange = (newlySelectedPreset) => {
|
|
58
|
-
|
|
59
|
+
// with a period, its All time base is not a choice the user made, so All time replaces the period too
|
|
60
|
+
if (filter.period || newlySelectedPreset.localIdentifier !== currentFilterOption.localIdentifier) {
|
|
59
61
|
// If switching to relative form, ensure granularity is compatible
|
|
60
62
|
if (isRelativeDateFilterForm(newlySelectedPreset)) {
|
|
61
63
|
const isFiscal = fiscalTabsConfig.showTabs && selectedTab === "fiscal";
|
|
@@ -70,5 +72,5 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
70
72
|
const onExcludePeriodChange = (excludeCurrentPeriod) => {
|
|
71
73
|
onPresetValueChange(currentFilterOption, excludeCurrentPeriod);
|
|
72
74
|
};
|
|
73
|
-
return (_jsxs(DisableableFilterWrapper, { isDisabled: isDisabled, className: "section adi-date-dropdown adi-date-preset-select s-preset-section", children: [_jsx("label", { htmlFor: "preset-dropdown", children: _jsx(FormattedMessage, { id: "filter.date.period" }) }), _jsx(DatePresetsDropdown, { relativeDateFilterPresets: enabledCalendarPresets, selectedPreset: currentFilterOption, onChange: onPresetSelectionChange, dateFormat: dateFormat, selectedTab: selectedTab, onTabChange: handleTabChange, activeCalendars: activeCalendars }), displayDateRange ? (_jsx(StaticDateRange, { selectedFilter: currentFilterOption, onChange: onPresetValueChange, dateFormat: dateFormat, isTimeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsEnabled: isSecondsForAbsoluteRangeEnabled, weekStart: weekStart, submitForm: submitForm })) : null, displayFloatingRange ? (_jsx(RelativeDateRange, { granularities: filteredGranularities, selectedFilter: currentFilterOption, onChange: onPresetValueChange })) : null, displayExcludePeriod ? (_jsx(ExcludeCurrentPeriod, { selectedFilter: filter, onChange: onExcludePeriodChange })) : null] }));
|
|
75
|
+
return (_jsxs(DisableableFilterWrapper, { isDisabled: isDisabled, className: "section adi-date-dropdown adi-date-preset-select s-preset-section", children: [_jsx("label", { htmlFor: "preset-dropdown", children: _jsx(FormattedMessage, { id: "filter.date.period" }) }), _jsx(DatePresetsDropdown, { relativeDateFilterPresets: enabledCalendarPresets, selectedPreset: currentFilterOption, selectedPeriodTitle: filter.period?.title, onChange: onPresetSelectionChange, dateFormat: dateFormat, selectedTab: selectedTab, onTabChange: handleTabChange, activeCalendars: activeCalendars }), displayDateRange ? (_jsx(StaticDateRange, { selectedFilter: currentFilterOption, onChange: onPresetValueChange, dateFormat: dateFormat, isTimeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsEnabled: isSecondsForAbsoluteRangeEnabled, weekStart: weekStart, submitForm: submitForm })) : null, displayFloatingRange ? (_jsx(RelativeDateRange, { granularities: filteredGranularities, selectedFilter: currentFilterOption, onChange: onPresetValueChange })) : null, displayExcludePeriod ? (_jsx(ExcludeCurrentPeriod, { selectedFilter: filter, onChange: onExcludePeriodChange })) : null] }));
|
|
74
76
|
}
|
|
@@ -36,4 +36,16 @@ export declare const useResetPresetWhenUnsupportedOneIsSelected: (selectedFilter
|
|
|
36
36
|
* @param resetCallback -
|
|
37
37
|
*/
|
|
38
38
|
export declare const useResetRelativeRangeWhenUnsupportedOneIsSelected: (selectedFilter: DateFilterOption, supportedChronologicalGranularities: DateFilterGranularity[], resetCallback: (filter: IDateFilterOption) => void) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Hook calls `resetCallback` with All time when `filter` keeps a period whose granularity the selected date dataset
|
|
41
|
+
* does not have, as moving the date item in the buckets to such a dataset does. A period without a known
|
|
42
|
+
* granularity (the catalog does not have it) follows the dataset, and so does any period while the dataset's
|
|
43
|
+
* granularities are not known.
|
|
44
|
+
*
|
|
45
|
+
* @param filter -
|
|
46
|
+
* @param selectedDateDataset -
|
|
47
|
+
* @param dateDatasetRefsWithGranularities -
|
|
48
|
+
* @param resetCallback -
|
|
49
|
+
*/
|
|
50
|
+
export declare const useResetPeriodWhenUnsupportedByDateDataset: (filter: IDateFilterOption, selectedDateDataset: IDecoratedDateDataset, dateDatasetRefsWithGranularities: IDateDatasetRefWithGranularities[], resetCallback: (filter: IDateFilterOption) => void) => void;
|
|
39
51
|
//# sourceMappingURL=supportedPresetsHook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supportedPresetsHook.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,qBAAqB,EAI7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAErC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,iCACR,6BAA6B,uBACtC,qBAAqB,oCACR,gCAAgC,EAAE,+BACvC,OAAO;gCAGJ,6BAA6B;yCACpB,qBAAqB,EAAE;CAkCnE,CAAC;AAkBF;;;;;;;GAOG;AACH,eAAO,MAAM,0CAA0C,mBACnC,gBAAgB,8BACJ,6BAA6B,iBAC1C,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAOrD,CAAC;AAYF;;;;;;;GAOG;AACH,eAAO,MAAM,iDAAiD,mBAC1C,gBAAgB,uCACK,qBAAqB,EAAE,iBAC7C,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAOrD,CAAC"}
|
|
1
|
+
{"version":3,"file":"supportedPresetsHook.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,qBAAqB,EAI7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,6BAA6B,EAErC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,iCACR,6BAA6B,uBACtC,qBAAqB,oCACR,gCAAgC,EAAE,+BACvC,OAAO;gCAGJ,6BAA6B;yCACpB,qBAAqB,EAAE;CAkCnE,CAAC;AAkBF;;;;;;;GAOG;AACH,eAAO,MAAM,0CAA0C,mBACnC,gBAAgB,8BACJ,6BAA6B,iBAC1C,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAOrD,CAAC;AAYF;;;;;;;GAOG;AACH,eAAO,MAAM,iDAAiD,mBAC1C,gBAAgB,uCACK,qBAAqB,EAAE,iBAC7C,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAOrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0CAA0C,WAC3C,iBAAiB,uBACJ,qBAAqB,oCACR,gCAAgC,EAAE,iBACrD,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAerD,CAAC"}
|
|
@@ -85,3 +85,25 @@ export const useResetRelativeRangeWhenUnsupportedOneIsSelected = (selectedFilter
|
|
|
85
85
|
}
|
|
86
86
|
}, [selectedFilter, supportedChronologicalGranularities, resetCallback]);
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Hook calls `resetCallback` with All time when `filter` keeps a period whose granularity the selected date dataset
|
|
90
|
+
* does not have, as moving the date item in the buckets to such a dataset does. A period without a known
|
|
91
|
+
* granularity (the catalog does not have it) follows the dataset, and so does any period while the dataset's
|
|
92
|
+
* granularities are not known.
|
|
93
|
+
*
|
|
94
|
+
* @param filter -
|
|
95
|
+
* @param selectedDateDataset -
|
|
96
|
+
* @param dateDatasetRefsWithGranularities -
|
|
97
|
+
* @param resetCallback -
|
|
98
|
+
*/
|
|
99
|
+
export const useResetPeriodWhenUnsupportedByDateDataset = (filter, selectedDateDataset, dateDatasetRefsWithGranularities, resetCallback) => {
|
|
100
|
+
const granularity = filter.period?.config.granularity;
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const datasetGranularities = dateDatasetRefsWithGranularities.find(({ ref }) => areObjRefsEqual(ref, selectedDateDataset?.ref))?.attributes;
|
|
103
|
+
if (granularity &&
|
|
104
|
+
datasetGranularities &&
|
|
105
|
+
!datasetGranularities.some((attribute) => attribute.dateType === granularity)) {
|
|
106
|
+
resetCallback(defaultPreset);
|
|
107
|
+
}
|
|
108
|
+
}, [granularity, selectedDateDataset, dateDatasetRefsWithGranularities, resetCallback]);
|
|
109
|
+
};
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { type DateFilterOption } from "@gooddata/sdk-ui-filters";
|
|
2
|
-
import { type IDateFilterConfig } from "../../../store/filter_bar/filter_bar_types.js";
|
|
2
|
+
import { type IDateFilterConfig, type IParameterizedDateFilterConfig } from "../../../store/filter_bar/filter_bar_types.js";
|
|
3
3
|
export interface IDateFilterOption {
|
|
4
4
|
filterOption: DateFilterOption;
|
|
5
5
|
excludeCurrentPeriod: boolean;
|
|
6
6
|
isTimeForAbsoluteRangeEnabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The period (a DATE_RANGE parameter) the filter references. `filterOption` is then All time, which no
|
|
9
|
+
* other option is; picking another option drops the period.
|
|
10
|
+
*/
|
|
11
|
+
period?: IDateFilterOptionPeriod;
|
|
7
12
|
}
|
|
13
|
+
export interface IDateFilterOptionPeriod {
|
|
14
|
+
config: IParameterizedDateFilterConfig;
|
|
15
|
+
/** the period's title, or its id when the catalog does not have the period */
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
/** The option is All time, not a period, which is All time underneath. */
|
|
19
|
+
export declare const isAllTimeOption: ({ filterOption, period }: IDateFilterOption) => boolean;
|
|
20
|
+
/** The option of a filter with a period. */
|
|
21
|
+
export declare const buildPeriodDateFilterOption: (config: IParameterizedDateFilterConfig, title: string) => IDateFilterOption;
|
|
8
22
|
/**
|
|
9
23
|
* Tries to match a preset or a form with the provided value. Prioritizes preset over form.
|
|
10
24
|
* @param dateFilterValue - Value to match against.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFilterOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/dateFilterOptionFactory.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,gBAAgB,EAIxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,
|
|
1
|
+
{"version":3,"file":"dateFilterOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/dateFilterOptionFactory.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,gBAAgB,EAIxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACtC,MAAM,+CAA+C,CAAC;AAKvD,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,8BAA8B,CAAC;IACvC,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,6BAA8B,iBAAiB,KAAG,OACxB,CAAC;AAEvD,4CAA4C;AAC5C,eAAO,MAAM,2BAA2B,WAC5B,8BAA8B,SAC/B,MAAM,KACd,iBAID,CAAC;AAkDH;;;GAGG;AACH,eAAO,MAAM,sCAAsC,oBAC9B,iBAAiB,KACnC,iBAAiB,GAAG,SAyBtB,CAAC;AAEF,eAAO,MAAM,wCAAwC,WACzC,gBAAgB,KACzB,iBAAiB,GAAG,SA0BtB,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { isUiRelativeDateFilterForm, } from "@gooddata/sdk-ui-filters";
|
|
|
4
4
|
import { ALL_TIME } from "../../../constants/presets.js";
|
|
5
5
|
import { ALL_TIME_FILTER_OPTION } from "./defaultFilterOptions.js";
|
|
6
6
|
import { findRelativePresetByValue } from "./presets.js";
|
|
7
|
+
/** The option is All time, not a period, which is All time underneath. */
|
|
8
|
+
export const isAllTimeOption = ({ filterOption, period }) => !period && isAllTimeDateFilterOption(filterOption);
|
|
9
|
+
/** The option of a filter with a period. */
|
|
10
|
+
export const buildPeriodDateFilterOption = (config, title) => ({
|
|
11
|
+
filterOption: ALL_TIME_FILTER_OPTION,
|
|
12
|
+
excludeCurrentPeriod: false,
|
|
13
|
+
period: { config, title },
|
|
14
|
+
});
|
|
7
15
|
const virtualPresetBase = {
|
|
8
16
|
name: "",
|
|
9
17
|
visible: true,
|