@gooddata/sdk-ui-analytical-designer 11.71.0-alpha.3 → 11.71.0-alpha.5
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 +45 -45
- package/esm/components/buckets/MeasureBucketItemHeader.d.ts +5 -2
- package/esm/components/buckets/MeasureBucketItemHeader.d.ts.map +1 -1
- package/esm/components/buckets/MeasureBucketItemHeader.js +3 -3
- package/esm/components/buckets/MeasureDateFilter.d.ts +6 -2
- package/esm/components/buckets/MeasureDateFilter.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilter.js +14 -6
- package/esm/components/buckets/MeasureDateFilterPicker.d.ts +9 -2
- package/esm/components/buckets/MeasureDateFilterPicker.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilterPicker.js +5 -3
- package/esm/components/buckets/MeasureDateFilterTitle.d.ts +3 -0
- package/esm/components/buckets/MeasureDateFilterTitle.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilterTitle.js +2 -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 +5 -1
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.d.ts +9 -0
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/Buttons/applyButtonHook.js +44 -19
- package/esm/components/filterBar/dateFilter/DateFilter.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/DateFilter.js +23 -12
- package/esm/components/filterBar/dateFilter/DateFilterItem.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/DateFilterItem.js +5 -4
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButton.d.ts +3 -1
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButton.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButton.js +2 -2
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.d.ts +3 -1
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/FilterButton/FilterButtonLabel.js +5 -3
- package/esm/components/filterBar/dateFilter/FilterButton/SelectedPresetName.d.ts +3 -0
- package/esm/components/filterBar/dateFilter/FilterButton/SelectedPresetName.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/FilterButton/SelectedPresetName.js +2 -2
- package/esm/components/filterBar/dateFilter/FilterDropdown/FilterDropdown.d.ts +3 -0
- package/esm/components/filterBar/dateFilter/FilterDropdown/FilterDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.d.ts +8 -4
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdown.js +13 -6
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.d.ts +4 -3
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/DatePresetsDropdownButton.js +5 -4
- package/esm/components/filterBar/dateFilter/PresetSection/PresetsSection.d.ts +13 -2
- package/esm/components/filterBar/dateFilter/PresetSection/PresetsSection.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/PresetsSection.js +24 -7
- package/esm/components/filterBar/dateFilter/PresetSection/StaticDateRange.d.ts +14 -4
- package/esm/components/filterBar/dateFilter/PresetSection/StaticDateRange.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/StaticDateRange.js +3 -2
- package/esm/components/filterBar/dateFilter/PresetSection/absoluteGranularities.d.ts +12 -0
- package/esm/components/filterBar/dateFilter/PresetSection/absoluteGranularities.d.ts.map +1 -0
- package/esm/components/filterBar/dateFilter/PresetSection/absoluteGranularities.js +19 -0
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.d.ts +3 -2
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/PresetSection/supportedPresetsHook.js +10 -4
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.d.ts +4 -2
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.js +2 -2
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.d.ts +4 -2
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.js +2 -2
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.d.ts +4 -2
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.js +11 -11
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.d.ts +23 -4
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/dateFilterOptionFactory.js +58 -1
- package/esm/components/filterBar/dateFilter/selectors.d.ts +163 -12
- package/esm/components/filterBar/dateFilter/selectors.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/selectors.js +3 -0
- package/esm/components/filterBar/dateFilter/types.d.ts +3 -1
- package/esm/components/filterBar/dateFilter/types.d.ts.map +1 -1
- package/esm/components/sort/ChartSort.d.ts +23 -3
- package/esm/components/sort/ChartSort.d.ts.map +1 -1
- package/esm/components/sort/chart_sort_bucket_items.d.ts +46 -6
- 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 +24 -1
- package/esm/convertors/toBackend/FilterConverter.d.ts.map +1 -1
- package/esm/convertors/toBackend/FilterConverter.js +18 -1
- package/esm/convertors/toBackend/afm/FilterConverter.d.ts +2 -1
- package/esm/convertors/toBackend/afm/FilterConverter.d.ts.map +1 -1
- package/esm/convertors/toBackend/afm/FilterConverter.js +14 -1
- package/esm/models/date_filter.d.ts +3 -3
- package/esm/models/date_filter.d.ts.map +1 -1
- package/esm/models/date_filter.js +17 -4
- package/esm/models/decorated_bucket.d.ts +3 -3
- package/esm/models/decorated_bucket.d.ts.map +1 -1
- package/esm/models/decorated_bucket.js +4 -4
- package/esm/models/decorated_bucket_item.d.ts +2 -2
- package/esm/models/decorated_bucket_item.d.ts.map +1 -1
- package/esm/models/decorated_bucket_item.js +5 -5
- package/esm/models/metadata.d.ts.map +1 -1
- package/esm/models/metadata.js +94 -17
- package/esm/models/period.d.ts +6 -0
- package/esm/models/period.d.ts.map +1 -1
- package/esm/models/period.js +14 -0
- package/esm/models/preset_item.d.ts +6 -2
- package/esm/models/preset_item.d.ts.map +1 -1
- package/esm/models/preset_item.js +5 -0
- package/esm/postMessageApi/outgoing/control_filtering_events.d.ts +0 -1
- package/esm/postMessageApi/outgoing/control_filtering_events.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/control_filtering_events.js +0 -5
- package/esm/postMessageApi/sagas/control_filtering_saga.d.ts +11 -3
- package/esm/postMessageApi/sagas/control_filtering_saga.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/control_filtering_saga.js +79 -14
- package/esm/postMessageApi/sagas/post_message_saga_helper.d.ts +3 -3
- package/esm/postMessageApi/sagas/post_message_saga_helper.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/post_message_saga_helper.js +14 -2
- package/esm/postMessageApi/state/selectors/post_message_context_selector.d.ts +46 -6
- package/esm/postMessageApi/state/selectors/post_message_context_selector.d.ts.map +1 -1
- package/esm/sagas/date_datasets/date_datasets_sagas.d.ts.map +1 -1
- package/esm/sagas/date_datasets/date_datasets_sagas.js +2 -2
- package/esm/selectors/buckets_selector.d.ts +136 -16
- package/esm/selectors/buckets_selector.d.ts.map +1 -1
- package/esm/selectors/buckets_selector.js +4 -4
- package/esm/selectors/date_datasets_selector.d.ts +88 -8
- package/esm/selectors/date_datasets_selector.d.ts.map +1 -1
- package/esm/selectors/export_button_selector.d.ts +92 -12
- package/esm/selectors/export_button_selector.d.ts.map +1 -1
- package/esm/selectors/export_selector.d.ts +23 -3
- package/esm/selectors/export_selector.d.ts.map +1 -1
- package/esm/selectors/feature_flag_selector.d.ts +21 -0
- package/esm/selectors/feature_flag_selector.d.ts.map +1 -1
- package/esm/selectors/feature_flag_selector.js +2 -0
- package/esm/selectors/insight_selectors.d.ts +176 -16
- package/esm/selectors/insight_selectors.d.ts.map +1 -1
- package/esm/selectors/measure_bucket_item_header_selector.d.ts +30 -2
- package/esm/selectors/measure_bucket_item_header_selector.d.ts.map +1 -1
- package/esm/selectors/measure_bucket_item_header_selector.js +4 -1
- package/esm/selectors/options_menu_selector.d.ts +138 -18
- package/esm/selectors/options_menu_selector.d.ts.map +1 -1
- package/esm/selectors/report_selector.d.ts +44 -4
- package/esm/selectors/report_selector.d.ts.map +1 -1
- package/esm/selectors/report_selector.js +11 -3
- package/esm/selectors/report_visualization_selector.d.ts +22 -10
- package/esm/selectors/report_visualization_selector.d.ts.map +1 -1
- package/esm/services/reference_point_service.js +3 -3
- package/esm/store/bucket_filters/bucket_filters_actions.d.ts +4 -4
- package/esm/store/bucket_filters/bucket_filters_actions.d.ts.map +1 -1
- package/esm/store/bucket_filters/bucket_filters_operations.d.ts.map +1 -1
- package/esm/store/bucket_filters/bucket_filters_operations.js +9 -8
- package/esm/store/bucket_filters/bucket_filters_sagas.d.ts +2 -2
- package/esm/store/bucket_filters/bucket_filters_sagas.d.ts.map +1 -1
- package/esm/store/bucket_filters/bucket_filters_sagas.js +22 -4
- 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 +4 -4
- package/esm/store/filter_bar/filter_bar_selector.js +2 -2
- package/esm/store/filter_bar/filter_bar_types.d.ts +33 -2
- package/esm/store/filter_bar/filter_bar_types.d.ts.map +1 -1
- package/esm/store/filter_bar/filter_bar_types.js +26 -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/handle_missing_date_filters.d.ts.map +1 -1
- package/esm/store/report/handle_missing_date_filters.js +20 -7
- package/esm/translations/de-DE.json +3 -0
- package/esm/translations/en-AU.json +3 -0
- package/esm/translations/en-GB.json +3 -0
- package/esm/translations/en-US.json +12 -0
- package/esm/translations/es-419.json +3 -0
- package/esm/translations/es-ES.json +3 -0
- package/esm/translations/fi-FI.json +4 -1
- package/esm/translations/fr-CA.json +3 -0
- package/esm/translations/fr-FR.json +3 -0
- package/esm/translations/id-ID.json +3 -0
- package/esm/translations/it-IT.json +3 -0
- package/esm/translations/ja-JP.json +4 -1
- package/esm/translations/ko-KR.json +3 -0
- package/esm/translations/nl-NL.json +3 -0
- package/esm/translations/pl-PL.json +3 -0
- package/esm/translations/pt-BR.json +4 -1
- package/esm/translations/pt-PT.json +4 -1
- package/esm/translations/ru-RU.json +3 -0
- package/esm/translations/sl-SI.json +3 -0
- package/esm/translations/th-TH.json +4 -1
- package/esm/translations/tr-TR.json +3 -0
- package/esm/translations/uk-UA.json +3 -0
- package/esm/translations/vi-VN.json +3 -0
- package/esm/translations/zh-HK.json +3 -0
- package/esm/translations/zh-Hans.json +3 -0
- package/esm/translations/zh-Hant.json +3 -0
- package/esm/typings/bear/bearTypes.d.ts +35 -3
- package/esm/typings/bear/bearTypes.d.ts.map +1 -1
- package/esm/typings/bear/bearTypes.js +5 -0
- package/esm/utils/drilling/types.d.ts +18 -2
- package/esm/utils/drilling/types.d.ts.map +1 -1
- package/esm/utils/drilling/types.js +9 -1
- package/esm/utils/id_prefix_sanitize.d.ts.map +1 -1
- package/esm/utils/id_prefix_sanitize.js +6 -1
- package/esm/utils/sdkModelToADRep/FilterConverter.d.ts.map +1 -1
- package/esm/utils/sdkModelToADRep/FilterConverter.js +12 -2
- package/package.json +21 -21
- package/esm/components/dialog_utils.d.ts +0 -19
- package/esm/components/dialog_utils.d.ts.map +0 -1
- package/esm/components/dialog_utils.js +0 -25
- package/esm/components/filterBar/dateFilter/AdditionalFiltersSection/fragments/AdditionalDateAttributes.d.ts +0 -22
- package/esm/components/filterBar/dateFilter/AdditionalFiltersSection/fragments/AdditionalDateAttributes.d.ts.map +0 -1
- package/esm/components/filterBar/dateFilter/AdditionalFiltersSection/fragments/AdditionalDateAttributes.js +0 -85
- package/esm/components/sort/fragments/ChartSortFragment.d.ts +0 -24
- package/esm/components/sort/fragments/ChartSortFragment.d.ts.map +0 -1
- package/esm/components/sort/fragments/ChartSortFragment.js +0 -49
package/esm/models/metadata.js
CHANGED
|
@@ -8,8 +8,8 @@ import { _cloneDeep, _isEmpty, _omit } from "@gooddata/util";
|
|
|
8
8
|
import { ATTRIBUTE, COMPUTED_ATTRIBUTE, DATE, GEO_ATTRIBUTE, METRIC } from "../constants/bucket.js";
|
|
9
9
|
import { ALL_TIME } from "../constants/presets.js";
|
|
10
10
|
import { isElementUrisSupported } from "../selectors/backend_capabilities_selector.js";
|
|
11
|
-
import { FilterBar, isParameterizedDateFilterConfig, isTextFilterAll, } from "../store/filter_bar/filter_bar_types.js";
|
|
12
|
-
import { isVisualizationObjectAbsoluteDateFilter, isVisualizationObjectArbitraryAttributeFilter, isVisualizationObjectArithmeticMeasureDefinition, isVisualizationObjectAttribute, isVisualizationObjectAttributeFilter, isVisualizationObjectDateFilter, isLocalIdentifierQualifier as isVisualizationObjectLocalIdentifierQualifier, isVisualizationObjectMatchAttributeFilter, isVisualizationObjectMeasure, isVisualizationObjectMeasureValueFilter, isVisualizationObjectNegativeAttributeFilter, isVisualizationObjectParameterizedDateFilter, isVisualizationObjectPoPMeasureDefinition as isVisualizationObjectPopMeasureDefinition, isVisualizationObjectPositiveAttributeFilter, isVisualizationObjectPreviousPeriodMeasureDefinition, isVisualizationObjectRankingFilter, isVisualizationObjectRelativeDateFilter, } from "../typings/bear/bearTypes.js";
|
|
11
|
+
import { FilterBar, getDateFilterConfigGranularity, isAbsoluteGranularityDateFilterConfig, isDateFilterConfigWithoutInterval, isParameterizedDateFilterConfig, isTextFilterAll, } from "../store/filter_bar/filter_bar_types.js";
|
|
12
|
+
import { isVisualizationObjectAbsoluteDateFilter, isVisualizationObjectAbsoluteGranularityDateFilter, isVisualizationObjectArbitraryAttributeFilter, isVisualizationObjectArithmeticMeasureDefinition, isVisualizationObjectAttribute, isVisualizationObjectAttributeFilter, isVisualizationObjectDateFilter, isLocalIdentifierQualifier as isVisualizationObjectLocalIdentifierQualifier, isVisualizationObjectMatchAttributeFilter, isVisualizationObjectMeasure, isVisualizationObjectMeasureValueFilter, isVisualizationObjectNegativeAttributeFilter, isVisualizationObjectParameterizedDateFilter, isVisualizationObjectPoPMeasureDefinition as isVisualizationObjectPopMeasureDefinition, isVisualizationObjectPositiveAttributeFilter, isVisualizationObjectPreviousPeriodMeasureDefinition, isVisualizationObjectRankingFilter, isVisualizationObjectRelativeDateFilter, } from "../typings/bear/bearTypes.js";
|
|
13
13
|
import { isDecoratedDateFilter, } from "../typings/measure_filters.js";
|
|
14
14
|
import { extractVisualizationObjectAttributeFilterElements, isSingleEmptyStringElement, } from "../utils/date_filter.js";
|
|
15
15
|
import { fromSdkModelDimensionality, toSdkModelDimensionality } from "../utils/dimensionality.js";
|
|
@@ -18,8 +18,8 @@ import { bucketItemBase, getDefaultArithmeticMeasureFormat, getLocalIdentifier,
|
|
|
18
18
|
import { generateBucketItemIdentifier, generateDerivedMeasureLocalIdentifier, } from "./bucket_item_identifier.js";
|
|
19
19
|
import { DATE_DATASET_ATTRIBUTE } from "./date_item.js";
|
|
20
20
|
import { isSupportedDisplayFormType } from "./display_form.js";
|
|
21
|
-
import { GRANULARITY, isFiscalGranularity
|
|
22
|
-
import {
|
|
21
|
+
import { GRANULARITY, isFiscalGranularity } from "./granularity.js";
|
|
22
|
+
import { toPeriodDateFilterConfig } from "./period.js";
|
|
23
23
|
import { PRESETS } from "./preset_item.js";
|
|
24
24
|
const isDefined = negate((v) => v === undefined);
|
|
25
25
|
const isValid = (value) => !(value === undefined) && !(value === null);
|
|
@@ -69,6 +69,9 @@ function measureFilterToMd(filter) {
|
|
|
69
69
|
if (isParameterizedDateFilterConfig(period)) {
|
|
70
70
|
return parameterizedDateFilterToMd(period, dataSet, filter.original?.emptyDateValuesFilter);
|
|
71
71
|
}
|
|
72
|
+
if (isAbsoluteGranularityDateFilterConfig(period)) {
|
|
73
|
+
return absoluteGranularityDateFilterToMd(period, dataSet, filter.original?.emptyDateValuesFilter);
|
|
74
|
+
}
|
|
72
75
|
const from = filter.interval?.interval?.[0];
|
|
73
76
|
const to = filter.interval?.interval?.[1];
|
|
74
77
|
const emptyDateValuesFilter = filter.original?.emptyDateValuesFilter;
|
|
@@ -187,10 +190,29 @@ function parameterizedDateFilterToMd({ parameterRef, localIdentifier }, dataSet,
|
|
|
187
190
|
},
|
|
188
191
|
};
|
|
189
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* A filter on whole periods of a granularity is new, so it has no legacy shape either: it always carries its
|
|
195
|
+
* empty date values mode itself. It is never All time, so include is stored too.
|
|
196
|
+
*/
|
|
197
|
+
function absoluteGranularityDateFilterToMd({ granularity, from, to, localIdentifier }, dataSet, emptyDateValuesFilter) {
|
|
198
|
+
return {
|
|
199
|
+
absoluteGranularityDateFilter: {
|
|
200
|
+
...(localIdentifier ? { localIdentifier } : {}),
|
|
201
|
+
dataSet,
|
|
202
|
+
granularity,
|
|
203
|
+
...(from === undefined ? {} : { from }),
|
|
204
|
+
...(to === undefined ? {} : { to }),
|
|
205
|
+
...emptyValueHandlingToMd(emptyDateValuesFilter, false),
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
190
209
|
function dateFilterToMd({ filterConfig, dateDatasetRef, emptyDateValuesFilter }, useEmptyValueHandling) {
|
|
191
210
|
if (isParameterizedDateFilterConfig(filterConfig)) {
|
|
192
211
|
return parameterizedDateFilterToMd(filterConfig, dateDatasetRef, emptyDateValuesFilter);
|
|
193
212
|
}
|
|
213
|
+
if (isAbsoluteGranularityDateFilterConfig(filterConfig)) {
|
|
214
|
+
return absoluteGranularityDateFilterToMd(filterConfig, dateDatasetRef, emptyDateValuesFilter);
|
|
215
|
+
}
|
|
194
216
|
const [from, to] = filterConfig?.interval || [undefined, undefined];
|
|
195
217
|
const isAbsolute = filterConfig?.type === "absolute";
|
|
196
218
|
const isAllTime = !isAbsolute && (from === undefined || to === undefined);
|
|
@@ -577,7 +599,7 @@ function createEmptyDateValuesAttributeFilter(dateFilter, dateDatasets) {
|
|
|
577
599
|
return undefined;
|
|
578
600
|
}
|
|
579
601
|
// Use the date filter's granularity, defaulting to year if not specified
|
|
580
|
-
const granularity = filterConfig
|
|
602
|
+
const granularity = getDateFilterConfigGranularity(filterConfig) || GRANULARITY.YEAR;
|
|
581
603
|
const dfRef = findDateAttributeDfRef(dateDatasetRef, dateDatasets, granularity);
|
|
582
604
|
if (!dfRef) {
|
|
583
605
|
return undefined;
|
|
@@ -615,7 +637,7 @@ export function filtersToMetadata(filters, attributeFilterConfigs = {}, dateData
|
|
|
615
637
|
result.push(filterToMd(filter, attributeFilterConfigs, useEmptyValueHandling));
|
|
616
638
|
if (!useEmptyValueHandling &&
|
|
617
639
|
FilterBar.isDateFilter(filter) &&
|
|
618
|
-
!
|
|
640
|
+
!isDateFilterConfigWithoutInterval(filter.filterConfig)) {
|
|
619
641
|
const emptyValuesFilter = createEmptyDateValuesAttributeFilter(filter, dateDatasets);
|
|
620
642
|
if (emptyValuesFilter) {
|
|
621
643
|
result.push(emptyValuesFilter);
|
|
@@ -855,13 +877,7 @@ function processVisualizationDateFilter(filterItem, data, overTimeComparisonType
|
|
|
855
877
|
function toParameterizedDateFilterConfig({ parameter, localIdentifier }, dateRangeParameters) {
|
|
856
878
|
// the convertor from SDK returns a ref without type
|
|
857
879
|
const parameterRef = isUriRef(parameter) ? parameter : idRef(parameter.identifier, "parameter");
|
|
858
|
-
|
|
859
|
-
return {
|
|
860
|
-
type: "parameterized",
|
|
861
|
-
parameterRef,
|
|
862
|
-
...(granularity ? { granularity: periodGranularityToGranularity(granularity) } : {}),
|
|
863
|
-
...(localIdentifier ? { localIdentifier } : {}),
|
|
864
|
-
};
|
|
880
|
+
return toPeriodDateFilterConfig(parameterRef, dateRangeParameters, localIdentifier);
|
|
865
881
|
}
|
|
866
882
|
function processVisualizationParameterizedDateFilter({ parameterizedDateFilter }, data, overTimeComparisonType) {
|
|
867
883
|
const { dataSet, emptyValueHandling } = parameterizedDateFilter;
|
|
@@ -877,6 +893,30 @@ function processVisualizationParameterizedDateFilter({ parameterizedDateFilter }
|
|
|
877
893
|
...(emptyValueHandling ? { emptyDateValuesFilter: emptyValueHandling } : {}),
|
|
878
894
|
};
|
|
879
895
|
}
|
|
896
|
+
/** The range of whole periods a stored filter has, with the local identifier the filter is stored with. */
|
|
897
|
+
function toAbsoluteGranularityDateFilterConfig({ granularity, from, to, localIdentifier, }) {
|
|
898
|
+
return {
|
|
899
|
+
type: "absoluteGranularity",
|
|
900
|
+
granularity,
|
|
901
|
+
...(from === undefined ? {} : { from }),
|
|
902
|
+
...(to === undefined ? {} : { to }),
|
|
903
|
+
...(localIdentifier ? { localIdentifier } : {}),
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
function processVisualizationAbsoluteGranularityDateFilter({ absoluteGranularityDateFilter }, data, overTimeComparisonType) {
|
|
907
|
+
const { dataSet, emptyValueHandling } = absoluteGranularityDateFilter;
|
|
908
|
+
return {
|
|
909
|
+
attribute: DATE_DATASET_ATTRIBUTE,
|
|
910
|
+
allElements: [],
|
|
911
|
+
selectedElements: [],
|
|
912
|
+
isInverted: true,
|
|
913
|
+
totalElementsCount: 0,
|
|
914
|
+
dimension: findDimensionIdentifier(dataSet, data?.dateDatasets),
|
|
915
|
+
interval: toAbsoluteGranularityDateFilterConfig(absoluteGranularityDateFilter),
|
|
916
|
+
overTimeComparisonType,
|
|
917
|
+
...(emptyValueHandling ? { emptyDateValuesFilter: emptyValueHandling } : {}),
|
|
918
|
+
};
|
|
919
|
+
}
|
|
880
920
|
function transformVisualizationFilter(filter, data, overTimeComparisonType) {
|
|
881
921
|
if (isVisualizationObjectDateFilter(filter)) {
|
|
882
922
|
return processVisualizationDateFilter(filter, data, overTimeComparisonType);
|
|
@@ -884,6 +924,9 @@ function transformVisualizationFilter(filter, data, overTimeComparisonType) {
|
|
|
884
924
|
if (isVisualizationObjectParameterizedDateFilter(filter)) {
|
|
885
925
|
return processVisualizationParameterizedDateFilter(filter, data, overTimeComparisonType);
|
|
886
926
|
}
|
|
927
|
+
if (isVisualizationObjectAbsoluteGranularityDateFilter(filter)) {
|
|
928
|
+
return processVisualizationAbsoluteGranularityDateFilter(filter, data, overTimeComparisonType);
|
|
929
|
+
}
|
|
887
930
|
return processVisualizationAttributeFilter(filter, data);
|
|
888
931
|
}
|
|
889
932
|
function transformToDateFilterConfig(visualizationFilter) {
|
|
@@ -952,6 +995,21 @@ function transformVisualizationParameterizedDateFilter({ parameterizedDateFilter
|
|
|
952
995
|
...(emptyValueHandling ? { emptyDateValuesFilter: emptyValueHandling } : {}),
|
|
953
996
|
};
|
|
954
997
|
}
|
|
998
|
+
function transformVisualizationAbsoluteGranularityDateFilter({ absoluteGranularityDateFilter }, overTimeComparisonType, ignoreOverTimeComparisonType) {
|
|
999
|
+
const { dataSet, emptyValueHandling } = absoluteGranularityDateFilter;
|
|
1000
|
+
return {
|
|
1001
|
+
type: "date",
|
|
1002
|
+
localIdentifier: generateBucketItemIdentifier(),
|
|
1003
|
+
cacheItemIdentifier: DATE_DATASET_ATTRIBUTE,
|
|
1004
|
+
...(ignoreOverTimeComparisonType
|
|
1005
|
+
? { overTimeComparisonType: "nothing" }
|
|
1006
|
+
: { overTimeComparisonType }),
|
|
1007
|
+
filterConfig: toAbsoluteGranularityDateFilterConfig(absoluteGranularityDateFilter),
|
|
1008
|
+
// the convertor from SDK returns a ref without type
|
|
1009
|
+
dateDatasetRef: { ...dataSet, type: "dataSet" },
|
|
1010
|
+
...(emptyValueHandling ? { emptyDateValuesFilter: emptyValueHandling } : {}),
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
955
1013
|
/** The date dataset a stored date filter filters on. */
|
|
956
1014
|
function getDateFilterDataSet(visualizationFilter) {
|
|
957
1015
|
return isVisualizationObjectRelativeDateFilter(visualizationFilter)
|
|
@@ -1208,6 +1266,17 @@ export function normalizeEmptyDateValuesFilters(visualizationFilters, dateDatase
|
|
|
1208
1266
|
},
|
|
1209
1267
|
};
|
|
1210
1268
|
}
|
|
1269
|
+
if (isVisualizationObjectAbsoluteGranularityDateFilter(filter)) {
|
|
1270
|
+
// its writer keeps include too; a legacy "" attribute filter sets the mode as when loaded
|
|
1271
|
+
const { dataSet, emptyValueHandling } = filter.absoluteGranularityDateFilter;
|
|
1272
|
+
const mode = emptyValueHandling ?? emptyDateValuesFilters[objRefToString(dataSet)]?.mode;
|
|
1273
|
+
return {
|
|
1274
|
+
absoluteGranularityDateFilter: {
|
|
1275
|
+
..._omit(filter.absoluteGranularityDateFilter, "emptyValueHandling"),
|
|
1276
|
+
...emptyValueHandlingToMd(mode, false),
|
|
1277
|
+
},
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1211
1280
|
if (!isVisualizationObjectDateFilter(filter)) {
|
|
1212
1281
|
return filter;
|
|
1213
1282
|
}
|
|
@@ -1262,10 +1331,18 @@ function transformVisualizationFilters(metadataObject, overTimeComparisonType, a
|
|
|
1262
1331
|
result.push(transformVisualizationAttributeFilter(visualizationFilter, itemCache, filterItems));
|
|
1263
1332
|
}
|
|
1264
1333
|
else if (isVisualizationObjectDateFilter(visualizationFilter) ||
|
|
1265
|
-
isVisualizationObjectParameterizedDateFilter(visualizationFilter)
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1334
|
+
isVisualizationObjectParameterizedDateFilter(visualizationFilter) ||
|
|
1335
|
+
isVisualizationObjectAbsoluteGranularityDateFilter(visualizationFilter)) {
|
|
1336
|
+
let df;
|
|
1337
|
+
if (isVisualizationObjectParameterizedDateFilter(visualizationFilter)) {
|
|
1338
|
+
df = transformVisualizationParameterizedDateFilter(visualizationFilter, additionalData?.dateRangeParameters, overTimeComparisonType, firstDateFilterTransformed);
|
|
1339
|
+
}
|
|
1340
|
+
else if (isVisualizationObjectAbsoluteGranularityDateFilter(visualizationFilter)) {
|
|
1341
|
+
df = transformVisualizationAbsoluteGranularityDateFilter(visualizationFilter, overTimeComparisonType, firstDateFilterTransformed);
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1344
|
+
df = transformVisualizationDateFilter(visualizationFilter, overTimeComparisonType, firstDateFilterTransformed);
|
|
1345
|
+
}
|
|
1269
1346
|
// the legacy "" attribute filter sets the mode unless the date filter carries it itself; either
|
|
1270
1347
|
// way the attribute filter is dropped, so re-saving migrates the insight to the field
|
|
1271
1348
|
const dateDatasetRef = df.dateDatasetRef;
|
package/esm/models/period.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type IDateRangeParameterMetadataObject, type ObjRef } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IParameterizedDateFilterConfig } from "../store/filter_bar/filter_bar_types.js";
|
|
2
3
|
/**
|
|
3
4
|
* The catalog's period (a DATE_RANGE parameter) that a date filter references. The catalog does not have it
|
|
4
5
|
* when the `enableDateRangeParameters` setting is off or the period was deleted.
|
|
@@ -6,4 +7,9 @@ import { type IDateRangeParameterMetadataObject, type ObjRef } from "@gooddata/s
|
|
|
6
7
|
export declare function findPeriod(ref: ObjRef, dateRangeParameters: ReadonlyArray<IDateRangeParameterMetadataObject> | undefined): IDateRangeParameterMetadataObject | undefined;
|
|
7
8
|
/** The title of the period a date filter references, or its id when the catalog does not have the period. */
|
|
8
9
|
export declare function getPeriodTitle(ref: ObjRef, dateRangeParameters: ReadonlyArray<IDateRangeParameterMetadataObject> | undefined): string;
|
|
10
|
+
/**
|
|
11
|
+
* The config of a date filter with the period, with the granularity the catalog knows for the period and the
|
|
12
|
+
* local identifier the filter is stored with.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toPeriodDateFilterConfig(parameterRef: ObjRef, dateRangeParameters: ReadonlyArray<IDateRangeParameterMetadataObject> | undefined, localIdentifier?: string): IParameterizedDateFilterConfig;
|
|
9
15
|
//# sourceMappingURL=period.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"period.d.ts","sourceRoot":"","sources":["../../src/models/period.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,iCAAiC,EACtC,KAAK,MAAM,EAGd,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,aAAa,CAAC,iCAAiC,CAAC,GAAG,SAAS,GAClF,iCAAiC,GAAG,SAAS,CAE/C;AAED,6GAA6G;AAC7G,wBAAgB,cAAc,CAC1B,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,aAAa,CAAC,iCAAiC,CAAC,GAAG,SAAS,GAClF,MAAM,CAER"}
|
|
1
|
+
{"version":3,"file":"period.d.ts","sourceRoot":"","sources":["../../src/models/period.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,iCAAiC,EACtC,KAAK,MAAM,EAGd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAI9F;;;GAGG;AACH,wBAAgB,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,aAAa,CAAC,iCAAiC,CAAC,GAAG,SAAS,GAClF,iCAAiC,GAAG,SAAS,CAE/C;AAED,6GAA6G;AAC7G,wBAAgB,cAAc,CAC1B,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,aAAa,CAAC,iCAAiC,CAAC,GAAG,SAAS,GAClF,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACpC,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,aAAa,CAAC,iCAAiC,CAAC,GAAG,SAAS,EACjF,eAAe,CAAC,EAAE,MAAM,GACzB,8BAA8B,CAShC"}
|
package/esm/models/period.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { areObjRefsEqual, getParameterTitle, } from "@gooddata/sdk-model";
|
|
3
|
+
import { periodGranularityToGranularity } from "./granularity.js";
|
|
3
4
|
/**
|
|
4
5
|
* The catalog's period (a DATE_RANGE parameter) that a date filter references. The catalog does not have it
|
|
5
6
|
* when the `enableDateRangeParameters` setting is off or the period was deleted.
|
|
@@ -11,3 +12,16 @@ export function findPeriod(ref, dateRangeParameters) {
|
|
|
11
12
|
export function getPeriodTitle(ref, dateRangeParameters) {
|
|
12
13
|
return getParameterTitle(ref, findPeriod(ref, dateRangeParameters));
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The config of a date filter with the period, with the granularity the catalog knows for the period and the
|
|
17
|
+
* local identifier the filter is stored with.
|
|
18
|
+
*/
|
|
19
|
+
export function toPeriodDateFilterConfig(parameterRef, dateRangeParameters, localIdentifier) {
|
|
20
|
+
const granularity = findPeriod(parameterRef, dateRangeParameters)?.definition.defaultValue.granularity;
|
|
21
|
+
return {
|
|
22
|
+
type: "parameterized",
|
|
23
|
+
parameterRef,
|
|
24
|
+
...(granularity ? { granularity: periodGranularityToGranularity(granularity) } : {}),
|
|
25
|
+
...(localIdentifier ? { localIdentifier } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
2
|
import { type IntlShape } from "react-intl";
|
|
3
3
|
import { type ILowerBoundedFilter, type IUpperBoundedFilter } from "@gooddata/sdk-model";
|
|
4
|
-
import { type IDateFilterConfig } from "../store/filter_bar/filter_bar_types.js";
|
|
4
|
+
import { type IAbsoluteGranularityDateFilterConfig, type IDateFilterConfig } from "../store/filter_bar/filter_bar_types.js";
|
|
5
5
|
import { type Granularity } from "./granularity.js";
|
|
6
6
|
export interface IPresetItem {
|
|
7
7
|
name?: string;
|
|
@@ -20,7 +20,11 @@ export interface IPresetPeriod<T = Date> {
|
|
|
20
20
|
end: T;
|
|
21
21
|
}
|
|
22
22
|
export interface IDecoratedPresetItem extends IPresetItem {
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The stored interval. A range of whole weeks, months, quarters or years is kept here only: it is no
|
|
25
|
+
* preset, so the item has none of the preset fields.
|
|
26
|
+
*/
|
|
27
|
+
original?: IPresetItem | IAbsoluteGranularityDateFilterConfig;
|
|
24
28
|
isFloating?: boolean;
|
|
25
29
|
isStatic?: boolean;
|
|
26
30
|
isSingle?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset_item.d.ts","sourceRoot":"","sources":["../../src/models/preset_item.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,YAAY,CAAC;AAE3D,OAAO,EAEH,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAC3B,MAAM,qBAAqB,CAAC;AA6E7B,OAAO,
|
|
1
|
+
{"version":3,"file":"preset_item.d.ts","sourceRoot":"","sources":["../../src/models/preset_item.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,YAAY,CAAC;AAE3D,OAAO,EAEH,KAAK,mBAAmB,EACxB,K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AA6B,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAO7E;AA4BD,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,oBAAoB,WASpG"}
|
|
@@ -7,6 +7,7 @@ import { formatRelativeDateRange } from "@gooddata/sdk-ui-filters";
|
|
|
7
7
|
import { DEFAULT_LOCALE } from "@gooddata/sdk-ui-filters/internal";
|
|
8
8
|
import { _isEqual } from "@gooddata/util";
|
|
9
9
|
import { ALL_TIME, DAY, EIGHT_MONTHS_AGO, ELEVEN_MONTHS_AGO, FISCAL_MONTH, FISCAL_QUARTER, FISCAL_YEAR, FIVE_MONTHS_AGO, FIVE_QUARTERS_AGO, FIVE_WEEKS_AGO, FIVE_YEARS_AGO, FOUR_MONTHS_AGO, FOUR_QUARTERS_AGO, FOUR_WEEKS_AGO, FOUR_YEARS_AGO, LAST_12_FISCAL_MONTHS, LAST_12_MONTHS, LAST_2_WEEKS_US, LAST_30_DAYS, LAST_4_FISCAL_QUARTERS, LAST_4_QUARTERS, LAST_7_DAYS, LAST_90_DAYS, LAST_FISCAL_MONTH, LAST_FISCAL_QUARTER, LAST_FISCAL_YEAR, LAST_MONTH, LAST_QUARTER, LAST_WEEK, LAST_WEEK_US, LAST_YEAR, MONTH, NINE_MONTHS_AGO, OTHER, QUARTER, SEVEN_MONTHS_AGO, SEVEN_QUARTERS_AGO, SEVEN_WEEKS_AGO, SIX_MONTHS_AGO, SIX_QUARTERS_AGO, SIX_WEEKS_AGO, STATIC_PERIOD, TEN_MONTHS_AGO, THIRTEEN_MONTHS_AGO, THIS_FISCAL_MONTH, THIS_FISCAL_MONTH_TO_DATE, THIS_FISCAL_QUARTER, THIS_FISCAL_QUARTER_TO_DATE, THIS_FISCAL_YEAR, THIS_FISCAL_YEAR_TO_DATE, THIS_MONTH, THIS_MONTH_TO_DATE, THIS_QUARTER, THIS_QUARTER_TO_DATE, THIS_WEEK, THIS_WEEK_TO_DATE, THIS_WEEK_US, THIS_YEAR, THIS_YEAR_TO_DATE, THREE_MONTHS_AGO, THREE_QUARTERS_AGO, THREE_WEEKS_AGO, THREE_YEARS_AGO, TWELVE_MONTHS_AGO, TWO_MONTHS_AGO, TWO_QUARTERS_AGO, TWO_WEEKS_AGO, TWO_YEARS_AGO, WEEK, YEAR, } from "../constants/presets.js";
|
|
10
|
+
import { isAbsoluteGranularityDateFilterConfig, } from "../store/filter_bar/filter_bar_types.js";
|
|
10
11
|
import { GRANULARITY, GRANULARITY_OPTIONS } from "./granularity.js";
|
|
11
12
|
export const asDateFilterConfig = (preset) => {
|
|
12
13
|
if (preset === undefined || preset.header !== undefined) {
|
|
@@ -451,6 +452,10 @@ export const DecoratedPresetItem = {
|
|
|
451
452
|
getPickerInterval,
|
|
452
453
|
};
|
|
453
454
|
export function createDecoratedPresetItem(preset) {
|
|
455
|
+
// whole periods of a granularity have no interval, template or unit of a preset to derive
|
|
456
|
+
if (isAbsoluteGranularityDateFilterConfig(preset)) {
|
|
457
|
+
return { original: preset, isFloating: false, isStatic: false, isSingle: false, isRange: false };
|
|
458
|
+
}
|
|
454
459
|
const plain = preset;
|
|
455
460
|
const withFlags = { ...plain, original: plain, ...getInterval(plain) };
|
|
456
461
|
// template/unitCount read the interval flags, so they are computed on the flagged item
|
|
@@ -18,7 +18,6 @@ export declare const CONTROL_FILTERING_ERRORS: {
|
|
|
18
18
|
invalidDateFilterGranularity: ICommandFailedBody;
|
|
19
19
|
invalidDateFilterFromToValue: ICommandFailedBody;
|
|
20
20
|
invalidFilterDataFormat: ICommandFailedBody;
|
|
21
|
-
unsupportedAbsoluteGranularityDateFilter: ICommandFailedBody;
|
|
22
21
|
invalidFilterItemsCount: ICommandFailedBody;
|
|
23
22
|
invalidRemoveFilterItemsCount: ICommandFailedBody;
|
|
24
23
|
notExistedDateDataset: ICommandFailedBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control_filtering_events.d.ts","sourceRoot":"","sources":["../../../src/postMessageApi/outgoing/control_filtering_events.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,UAAU,EACf,KAAK,gBAAgB,EAIrB,KAAK,kBAAkB,EAC1B,MAAM,yBAAyB,CAAC;AAIjC,wBAAgB,6BAA6B,CACzC,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,IAAI,CAGN;AAED,wBAAgB,gCAAgC,CAC5C,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,IAAI,CAON;AAGD,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAMxG;
|
|
1
|
+
{"version":3,"file":"control_filtering_events.d.ts","sourceRoot":"","sources":["../../../src/postMessageApi/outgoing/control_filtering_events.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,UAAU,EACf,KAAK,gBAAgB,EAIrB,KAAK,kBAAkB,EAC1B,MAAM,yBAAyB,CAAC;AAIjC,wBAAgB,6BAA6B,CACzC,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,IAAI,CAGN;AAED,wBAAgB,gCAAgC,CAC5C,iBAAiB,EAAE,gBAAgB,EAAE,EACrC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,IAAI,CAON;AAGD,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAMxG;AA+ID,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BpC,CAAC"}
|
|
@@ -73,10 +73,6 @@ const invalidFilterDataFormat = {
|
|
|
73
73
|
errorCode: GdcErrorType.InvalidArgument,
|
|
74
74
|
errorMessage: "The command has invalid filter format",
|
|
75
75
|
};
|
|
76
|
-
const unsupportedAbsoluteGranularityDateFilter = {
|
|
77
|
-
errorCode: GdcErrorType.InvalidArgument,
|
|
78
|
-
errorMessage: "The command has absolute date filter with granularity which is not supported yet",
|
|
79
|
-
};
|
|
80
76
|
const invalidFilterItemsCount = {
|
|
81
77
|
errorCode: GdcErrorType.InvalidArgument,
|
|
82
78
|
errorMessage: "The app cannot be applied more than 20 items on filter bar",
|
|
@@ -149,7 +145,6 @@ export const CONTROL_FILTERING_ERRORS = {
|
|
|
149
145
|
invalidDateFilterGranularity,
|
|
150
146
|
invalidDateFilterFromToValue,
|
|
151
147
|
invalidFilterDataFormat,
|
|
152
|
-
unsupportedAbsoluteGranularityDateFilter,
|
|
153
148
|
invalidFilterItemsCount,
|
|
154
149
|
invalidRemoveFilterItemsCount,
|
|
155
150
|
notExistedDateDataset,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type SagaIterator } from "redux-saga";
|
|
2
2
|
import { type ICommandFailedBody, type IRemoveAttributeFilterItem, type IRemoveDateFilterItem, type IRemoveRankingFilterItem } from "@gooddata/sdk-embedding";
|
|
3
|
-
import { type ITransformedArbitraryAttributeFilter, type ITransformedDateFilterItem, type ITransformedMatchAttributeFilter, type ITransformedRankingFilter } from "@gooddata/sdk-embedding/internal";
|
|
3
|
+
import { type ITransformedAbsoluteGranularityDateFilterItem, type ITransformedArbitraryAttributeFilter, type ITransformedDateFilterItem, type ITransformedMatchAttributeFilter, type ITransformedParameterizedDateFilterItem, type ITransformedRankingFilter } from "@gooddata/sdk-embedding/internal";
|
|
4
4
|
import { type IAttributeDisplayFormMetadataObject, type IAttributeMetadataObject, type IComputedAttributeMetadataObject, type ObjRef } from "@gooddata/sdk-model";
|
|
5
5
|
import { type ICommandUpdateFilterItemsActionPayload, type IUpdateArbitraryFilterActionPayload, type IUpdateAttributeFilterActionPayload, type IUpdateDateFilterActionPayload, type IUpdateMatchFilterActionPayload, type IUpdateRankingFilterActionPayload } from "../../store/bucket_filters/bucket_filters_actions.js";
|
|
6
6
|
import { filterItemsCommandFailed } from "../../store/bucket_filters/bucket_filters_operation_events.js";
|
|
7
|
-
import { type IFilter } from "../../store/filter_bar/filter_bar_types.js";
|
|
7
|
+
import { type IDateFilter, type IFilter } from "../../store/filter_bar/filter_bar_types.js";
|
|
8
8
|
import { type IAppState } from "../../store/types.js";
|
|
9
9
|
import { type IRawBucketItems } from "../../typings/buckets.js";
|
|
10
10
|
import { type ICacheItem, type ICatalogEntries } from "../../typings/state_objects.js";
|
|
11
11
|
import { PostEventActionTypeKeys } from "../actions/action_types.js";
|
|
12
12
|
import { type IRemoveFilterContextRequestedAction, type ISetFilterContextRequestedAction, type ITransformedAttributeFilterItem } from "../actions/control_filtering_actions.js";
|
|
13
|
+
import { buildDateFilterConfig } from "./post_message_saga_helper.js";
|
|
14
|
+
type ExternalDateFilterItem = ITransformedDateFilterItem | ITransformedParameterizedDateFilterItem | ITransformedAbsoluteGranularityDateFilterItem;
|
|
13
15
|
interface IMappingFilterItems {
|
|
14
16
|
externalObjRefs: ObjRef[];
|
|
15
17
|
externalFiltersFromCached: ITransformedAttributeFilterItem[];
|
|
@@ -19,7 +21,7 @@ export declare function validateExternalAttributeFilters(attributeFilters: ITran
|
|
|
19
21
|
export declare function validateExternalArbitraryFilters(filters: ITransformedArbitraryAttributeFilter[]): SagaIterator<IUpdateArbitraryFilterActionPayload[]>;
|
|
20
22
|
export declare function validateExternalMatchFilters(filters: ITransformedMatchAttributeFilter[]): SagaIterator<IUpdateMatchFilterActionPayload[]>;
|
|
21
23
|
export declare function validateExternalAttributeFilterValues({ attributeElements, dfUri, dfIdentifier, dfType, localIdentifier, negativeSelection, cacheItemIdentifier, }: ITransformedAttributeFilterItem): SagaIterator<IUpdateAttributeFilterActionPayload>;
|
|
22
|
-
export declare function validateExternalDateFilters(dateFilters:
|
|
24
|
+
export declare function validateExternalDateFilters(dateFilters: ExternalDateFilterItem[], isTimeSupported: boolean, isSecondsSupported: boolean, useMultipleDateFilters?: boolean): Generator<import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<IUpdateDateFilterActionPayload>> | import("redux-saga/effects").CallEffect<void>, IUpdateDateFilterActionPayload[], IUpdateDateFilterActionPayload[]>;
|
|
23
25
|
export declare function handleSetFilterContextRequested({ payload: { filters, postMessageContext }, }: ISetFilterContextRequestedAction): Generator<import("redux-saga/effects").AllEffect<never> | import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").CallEffect<IUpdateArbitraryFilterActionPayload[]> | import("redux-saga/effects").CallEffect<IUpdateAttributeFilterActionPayload[]> | import("redux-saga/effects").CallEffect<IUpdateDateFilterActionPayload[]> | import("redux-saga/effects").CallEffect<IUpdateMatchFilterActionPayload[]> | import("redux-saga/effects").CallEffect<IUpdateRankingFilterActionPayload> | import("redux-saga/effects").CallEffect<boolean> | import("redux-saga/effects").PutEffect<{
|
|
24
26
|
payload: ICommandUpdateFilterItemsActionPayload;
|
|
25
27
|
type: import("../../constants/actions.js").ActionTypeKeys.STORE_ADD_OR_UPDATE_FILTER_ITEMS;
|
|
@@ -44,6 +46,12 @@ export declare function getValidExternalAttributeFilters(externalFilters: ITrans
|
|
|
44
46
|
};
|
|
45
47
|
type: import("../../constants/actions.js").ActionTypeKeys.STORE_UPDATE_ITEM_CACHE;
|
|
46
48
|
}> | import("redux-saga/effects").SelectEffect, ITransformedAttributeFilterItem[], never>;
|
|
49
|
+
/**
|
|
50
|
+
* Whole periods set on a filter that already has whole periods are still that stored filter: they keep its
|
|
51
|
+
* local identifier, or none when it has none. The command's local identifier names the filter in the filter
|
|
52
|
+
* bar, so it becomes the stored one only for a filter that has no whole periods yet.
|
|
53
|
+
*/
|
|
54
|
+
export declare function withStoredWholePeriodsLocalIdentifier(filterConfig: ReturnType<typeof buildDateFilterConfig>, storedFilterConfig: IDateFilter["filterConfig"]): ReturnType<typeof buildDateFilterConfig>;
|
|
47
55
|
export declare function isOverLimitFilterBarItems(appState: IAppState, attributeBucketItems: IRawBucketItems, validFilterItems: ICommandUpdateFilterItemsActionPayload, supportsElementUris: boolean): boolean;
|
|
48
56
|
export declare function mappingDfsFromItemCached(state: IAppState, externalFilters: ITransformedAttributeFilterItem[], itemsCached: ICatalogEntries): IMappingFilterItems;
|
|
49
57
|
export declare function handleRemoveFilterContextRequested({ payload: { filters, postMessageContext }, }: IRemoveFilterContextRequestedAction): Generator<import("redux-saga/effects").CallEffect<string[]> | import("redux-saga/effects").CallEffect<string | null> | import("redux-saga/effects").PutEffect<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control_filtering_saga.d.ts","sourceRoot":"","sources":["../../../src/postMessageApi/sagas/control_filtering_saga.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"control_filtering_saga.d.ts","sourceRoot":"","sources":["../../../src/postMessageApi/sagas/control_filtering_saga.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAKhC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEH,KAAK,6CAA6C,EAClD,KAAK,oCAAoC,EACzC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,yBAAyB,EAIjC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEH,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,MAAM,EAMd,MAAM,qBAAqB,CAAC;AAoC7B,OAAO,EACH,KAAK,sCAAsC,EAC3C,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EAEnC,KAAK,+BAA+B,EACpC,KAAK,i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AsF/F;AAED,wBAAiB,qBAAqB,6EAcrC"}
|
|
@@ -2,30 +2,34 @@
|
|
|
2
2
|
import moment from "moment";
|
|
3
3
|
import { all, call, put, race, select, take, takeEvery } from "redux-saga/effects";
|
|
4
4
|
import { isUnexpectedResponseError } from "@gooddata/sdk-backend-spi";
|
|
5
|
-
import {
|
|
6
|
-
import { filterConverters, toDisplayFormRefType, } from "@gooddata/sdk-embedding/internal";
|
|
5
|
+
import { isPositiveAttributeFilter, isRemoveAttributeFilter, isRemoveDateFilter, isRemoveRankingFilter, } from "@gooddata/sdk-embedding";
|
|
6
|
+
import { filterConverters, isTransformedAbsoluteGranularityDateFilterItem, toDisplayFormRefType, } from "@gooddata/sdk-embedding/internal";
|
|
7
7
|
import { areObjRefsEqual, idRef, isComputedAttributeRef, isUriRef, uriRef, } from "@gooddata/sdk-model";
|
|
8
8
|
import { _partition, _uniq, _uniqBy } from "@gooddata/util";
|
|
9
9
|
import { updateItemCache } from "../../actions/data_actions.js";
|
|
10
10
|
import { MAX_ATTRIBUTE_FILTERS_COUNT } from "../../constants/catalog_filters.js";
|
|
11
11
|
import { generateBucketItemIdentifier } from "../../models/bucket_item_identifier.js";
|
|
12
|
+
import { periodGranularityToGranularity } from "../../models/granularity.js";
|
|
12
13
|
import { computedAttributeCacheKey } from "../../models/item_cache_lookup.js";
|
|
14
|
+
import { toPeriodDateFilterConfig } from "../../models/period.js";
|
|
13
15
|
import { sanitizeFilters } from "../../sagas/filter_bar/filter_bar_saga.js";
|
|
14
16
|
import { isElementUrisSupported, selectSupportsMultipleDateFilters, supportsTimeGranularities, } from "../../selectors/backend_capabilities_selector.js";
|
|
15
17
|
import { getProjectId } from "../../selectors/bootstrap_selector.js";
|
|
16
18
|
import { getAllMeasureBucketItems, getAllSlicingAttributeBucketItems, getAttributeBucketItems, getDateBucketItem, } from "../../selectors/buckets_selector.js";
|
|
19
|
+
import { getDateDatasetRefsWithGranularities } from "../../selectors/date_dataset_with_granularities_selector.js";
|
|
17
20
|
import { selectedOverTimeComparisonMeasures } from "../../selectors/date_filter_selector.js";
|
|
18
21
|
import { isReportOpening, isReportSaving } from "../../selectors/export_selector.js";
|
|
19
|
-
import { enableComputedAttributes, enableSecondGranularities, } from "../../selectors/feature_flag_selector.js";
|
|
22
|
+
import { enableAbsoluteDateFilterGranularity, enableComputedAttributes, enableSecondGranularities, } from "../../selectors/feature_flag_selector.js";
|
|
20
23
|
import { getItemCache } from "../../selectors/item_cache_selector.js";
|
|
21
24
|
import { getPrimaryDateDataset } from "../../services/buckets_service.js";
|
|
22
25
|
import { DateDatasetsMetaService } from "../../services/date_datasets_meta_service.js";
|
|
23
26
|
import { DateDatasetsService } from "../../services/date_datasets_service.js";
|
|
24
27
|
import { commandAddOrUpdateFilterItems, storeUpdateAttributeFilterDisplayForm, } from "../../store/bucket_filters/bucket_filters_actions.js";
|
|
25
28
|
import { filterItemsCommandFailed, filterItemsUpdatedFromCommand, } from "../../store/bucket_filters/bucket_filters_operation_events.js";
|
|
29
|
+
import { getCatalogDateRangeParameters } from "../../store/catalog/catalog_selector.js";
|
|
26
30
|
import { filtersWereChanged, removeFiltersFromState } from "../../store/filter_bar/filter_bar_actions.js";
|
|
27
31
|
import { getAttributeFilter, getAttributeFilterById, getDateFilter, getDateFilterIndex, getDateFilters, getFilterItems, getFilterItemsWithoutAdditionalDateAttributes, getFirstDateFilter, getRankingFilter, } from "../../store/filter_bar/filter_bar_selector.js";
|
|
28
|
-
import { FilterBar } from "../../store/filter_bar/filter_bar_types.js";
|
|
32
|
+
import { FilterBar, isAbsoluteGranularityDateFilterConfig, isParameterizedDateFilterConfig, } from "../../store/filter_bar/filter_bar_types.js";
|
|
29
33
|
import { getAttributeDisplayForms, getAttributes, getComputedAttributes, loadValidElementsData, } from "../../utils/api.js";
|
|
30
34
|
import { PostEventActionTypeKeys } from "../actions/action_types.js";
|
|
31
35
|
import { removeFilterContextFailedAction, removeFilterContextFinishedAction, removeFilterItemsFromState, setFilterContextFailedAction, setFilterContextFinishedAction, } from "../actions/control_filtering_actions.js";
|
|
@@ -47,7 +51,6 @@ const ERROR_DUPLICATED_ATTRIBUTE_FILTER_IDENTIFIERS = "ERROR_DUPLICATED_ATTRIBUT
|
|
|
47
51
|
const ERROR_INVALID_DATE_DATASET_URI = "ERROR_INVALID_DATE_DATASET_URI";
|
|
48
52
|
const ERROR_HAS_NON_DEFAULT_ATTRIBUTE_DISPLAY_FORM = "ERROR_HAS_NON_DEFAULT_ATTRIBUTE_DISPLAY_FORM";
|
|
49
53
|
const ERROR_INVALID_FILTER_DATA_FORMAT = "ERROR_INVALID_FILTER_DATA_FORMAT";
|
|
50
|
-
const ERROR_UNSUPPORTED_ABSOLUTE_GRANULARITY_DATE_FILTER = "ERROR_UNSUPPORTED_ABSOLUTE_GRANULARITY_DATE_FILTER";
|
|
51
54
|
const ERROR_INVALID_ATTRIBUTE_FILTER_ID = "ERROR_INVALID_ATTRIBUTE_FILTER_ID";
|
|
52
55
|
const ERROR_INVALID_ATTRIBUTE_FILTER_VALUE = "ERROR_INVALID_ATTRIBUTE_FILTER_VALUE";
|
|
53
56
|
const ERROR_BAD_ATTRIBUTE_FILTER_DISPLAY_FORM = "ERROR_BAD_ATTRIBUTE_FILTER_DISPLAY_FORM";
|
|
@@ -80,8 +83,6 @@ function getAttributeFilterErrorMessage(error) {
|
|
|
80
83
|
return CONTROL_FILTERING_ERRORS.invalidDateDatasetUri;
|
|
81
84
|
case ERROR_INVALID_FILTER_DATA_FORMAT:
|
|
82
85
|
return CONTROL_FILTERING_ERRORS.invalidFilterDataFormat;
|
|
83
|
-
case ERROR_UNSUPPORTED_ABSOLUTE_GRANULARITY_DATE_FILTER:
|
|
84
|
-
return CONTROL_FILTERING_ERRORS.unsupportedAbsoluteGranularityDateFilter;
|
|
85
86
|
case ERROR_INVALID_FILTER_ITEMS_COUNT:
|
|
86
87
|
return CONTROL_FILTERING_ERRORS.invalidFilterItemsCount;
|
|
87
88
|
case ERROR_INVALID_REMOVE_FILTER_CONTEXT_COUNT:
|
|
@@ -322,6 +323,36 @@ function validateDateFilterValues(dateFilter, isTimeSupported, isSecondsSupporte
|
|
|
322
323
|
throw new Error(ERROR_INVALID_DATE_FILTER_FROM_TO_VALUE);
|
|
323
324
|
}
|
|
324
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* A filter on whole weeks, months, quarters or years needs the date dataset to have that granularity. A date
|
|
328
|
+
* dataset whose granularities are not known is not checked.
|
|
329
|
+
*/
|
|
330
|
+
function validatePeriodGranularityOfDateDataset(appState, dateFilter, dateDatasetRef) {
|
|
331
|
+
if (!isTransformedAbsoluteGranularityDateFilterItem(dateFilter)) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const datasetGranularities = getDateDatasetRefsWithGranularities(appState).find(({ ref }) => areObjRefsEqual(ref, dateDatasetRef))
|
|
335
|
+
?.attributes ?? [];
|
|
336
|
+
const granularity = periodGranularityToGranularity(dateFilter.granularity);
|
|
337
|
+
if (datasetGranularities.length &&
|
|
338
|
+
!datasetGranularities.some(({ dateType }) => dateType === granularity)) {
|
|
339
|
+
throw new Error(ERROR_INVALID_DATE_FILTER_GRANULARITY);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* A command can set a filter on whole weeks, months, quarters or years even when the feature is off. Such
|
|
344
|
+
* a command is rejected as one with a granularity that is not supported. The setting is read only when the
|
|
345
|
+
* command has such a filter.
|
|
346
|
+
*/
|
|
347
|
+
function* rejectAbsoluteGranularityDateFiltersWhenDisabled(dateFilters) {
|
|
348
|
+
if (!dateFilters.some(isTransformedAbsoluteGranularityDateFilterItem)) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const absoluteGranularityEnabled = yield select(enableAbsoluteDateFilterGranularity);
|
|
352
|
+
if (!absoluteGranularityEnabled) {
|
|
353
|
+
throw new Error(ERROR_INVALID_DATE_FILTER_GRANULARITY);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
325
356
|
/**
|
|
326
357
|
* A computed attribute is referenced directly, so a command can name one even when the feature is off.
|
|
327
358
|
* Such a command is rejected up front instead of ending in a filter the backend refuses. The setting is
|
|
@@ -398,6 +429,7 @@ function* validateExternalDateFilter(dateFilter, useMultipleDateFilters, numberO
|
|
|
398
429
|
if (!validDatasetByIdentifier) {
|
|
399
430
|
throw new Error(ERROR_INVALID_DATE_DATASET_ID);
|
|
400
431
|
}
|
|
432
|
+
validatePeriodGranularityOfDateDataset(appState, dateFilter, validDatasetByIdentifier.ref);
|
|
401
433
|
return yield call(buildDateDatasetFilterItem, dateFilter, validDatasetByIdentifier.ref, existingDateFilter?.localIdentifier || dateFilter.localIdentifier, useMultipleDateFilters);
|
|
402
434
|
}
|
|
403
435
|
// validate external date filter uri
|
|
@@ -405,14 +437,20 @@ function* validateExternalDateFilter(dateFilter, useMultipleDateFilters, numberO
|
|
|
405
437
|
if (!validDatasetByUri) {
|
|
406
438
|
throw new Error(ERROR_INVALID_DATE_DATASET_URI);
|
|
407
439
|
}
|
|
440
|
+
validatePeriodGranularityOfDateDataset(appState, dateFilter, validDatasetByUri.ref);
|
|
408
441
|
return yield call(buildDateDatasetFilterItem, dateFilter, validDatasetByUri.ref, existingDateFilter?.localIdentifier || dateFilter.localIdentifier, useMultipleDateFilters);
|
|
409
442
|
}
|
|
410
443
|
export function* validateExternalDateFilters(dateFilters, isTimeSupported, isSecondsSupported, useMultipleDateFilters = false) {
|
|
411
444
|
if (dateFilters.length > 1 && !useMultipleDateFilters) {
|
|
412
445
|
throw new Error(ERROR_INVALID_DATE_FILTER_COUNT);
|
|
413
446
|
}
|
|
447
|
+
yield call(rejectAbsoluteGranularityDateFiltersWhenDisabled, dateFilters);
|
|
414
448
|
dateFilters.forEach((dateFilter) => {
|
|
415
|
-
|
|
449
|
+
// the format check of the command already validated the periods of a filter on whole periods
|
|
450
|
+
if (!filterConverters.isTransformedParameterizedDateFilterItem(dateFilter) &&
|
|
451
|
+
!isTransformedAbsoluteGranularityDateFilterItem(dateFilter)) {
|
|
452
|
+
validateDateFilterValues(dateFilter, isTimeSupported, isSecondsSupported);
|
|
453
|
+
}
|
|
416
454
|
});
|
|
417
455
|
const filtersToUse = useMultipleDateFilters ? dateFilters : [dateFilters[0]];
|
|
418
456
|
const results = yield all(filtersToUse.map((dateFilter) => call(validateExternalDateFilter, dateFilter, useMultipleDateFilters, dateFilters.length)));
|
|
@@ -437,9 +475,6 @@ export function* handleSetFilterContextRequested({ payload: { filters, postMessa
|
|
|
437
475
|
if (hasInvalidFilters || hasSingleSelectionFilters) {
|
|
438
476
|
throw new Error(ERROR_INVALID_FILTER_DATA_FORMAT);
|
|
439
477
|
}
|
|
440
|
-
if (filters.some(isAbsoluteGranularityDateFilter)) {
|
|
441
|
-
throw new Error(ERROR_UNSUPPORTED_ABSOLUTE_GRANULARITY_DATE_FILTER);
|
|
442
|
-
}
|
|
443
478
|
const { attributeFilters, dateFilters, rankingFilter, arbitraryAttributeFilters, matchAttributeFilters, measureValueFilters, } = filterConverters.transformFilterContext(filters);
|
|
444
479
|
yield call(rejectComputedAttributesWhenDisabled, [
|
|
445
480
|
...attributeFilters,
|
|
@@ -656,6 +691,21 @@ const convertComputedAttributesToItemCache = (computedAttributes) => {
|
|
|
656
691
|
return cacheItems;
|
|
657
692
|
}, {});
|
|
658
693
|
};
|
|
694
|
+
/**
|
|
695
|
+
* Whole periods set on a filter that already has whole periods are still that stored filter: they keep its
|
|
696
|
+
* local identifier, or none when it has none. The command's local identifier names the filter in the filter
|
|
697
|
+
* bar, so it becomes the stored one only for a filter that has no whole periods yet.
|
|
698
|
+
*/
|
|
699
|
+
export function withStoredWholePeriodsLocalIdentifier(filterConfig, storedFilterConfig) {
|
|
700
|
+
if (!isAbsoluteGranularityDateFilterConfig(filterConfig) ||
|
|
701
|
+
!isAbsoluteGranularityDateFilterConfig(storedFilterConfig)) {
|
|
702
|
+
return filterConfig;
|
|
703
|
+
}
|
|
704
|
+
const { localIdentifier: _commandLocalIdentifier, ...config } = filterConfig;
|
|
705
|
+
return storedFilterConfig.localIdentifier === undefined
|
|
706
|
+
? config
|
|
707
|
+
: { ...config, localIdentifier: storedFilterConfig.localIdentifier };
|
|
708
|
+
}
|
|
659
709
|
function* buildDateDatasetFilterItem(dateFilter, dateDatasetRef, localIdentifier, useMultipleDateFilters) {
|
|
660
710
|
const appState = yield select();
|
|
661
711
|
const index = getDateFilterIndex(appState, localIdentifier);
|
|
@@ -664,12 +714,16 @@ function* buildDateDatasetFilterItem(dateFilter, dateDatasetRef, localIdentifier
|
|
|
664
714
|
const dateDataFilter = useMultipleDateFilters
|
|
665
715
|
? getDateFilter(appState, localIdentifier)
|
|
666
716
|
: getFirstDateFilter(appState);
|
|
667
|
-
const
|
|
717
|
+
const isPeriod = filterConverters.isTransformedParameterizedDateFilterItem(dateFilter);
|
|
668
718
|
const overTimeComparisonMeasures = yield select(selectedOverTimeComparisonMeasures);
|
|
669
719
|
let overTimeComparisonType = "nothing";
|
|
670
|
-
if (dateDataFilter?.overTimeComparisonType &&
|
|
720
|
+
if (dateDataFilter?.overTimeComparisonType &&
|
|
721
|
+
(isPeriod || dateFilter.granularity !== filterConverters.ALL_TIME_GRANULARITY)) {
|
|
671
722
|
overTimeComparisonType = dateDataFilter.overTimeComparisonType;
|
|
672
723
|
}
|
|
724
|
+
const dateRangeParameters = isPeriod
|
|
725
|
+
? yield select(getCatalogDateRangeParameters)
|
|
726
|
+
: [];
|
|
673
727
|
return {
|
|
674
728
|
...(dateDataFilter
|
|
675
729
|
? { localIdentifier: dateDataFilter.localIdentifier }
|
|
@@ -680,8 +734,19 @@ function* buildDateDatasetFilterItem(dateFilter, dateDatasetRef, localIdentifier
|
|
|
680
734
|
}),
|
|
681
735
|
dateDatasetRef,
|
|
682
736
|
overTimeComparisonType: includeOverTimeComparison ? overTimeComparisonType : "nothing",
|
|
683
|
-
filterConfig:
|
|
737
|
+
filterConfig: isPeriod
|
|
738
|
+
? toPeriodDateFilterConfig(dateFilter.parameterRef, dateRangeParameters,
|
|
739
|
+
// a stored period keeps its id, so saving neither drops it nor counts as a change
|
|
740
|
+
isParameterizedDateFilterConfig(dateDataFilter?.filterConfig)
|
|
741
|
+
? dateDataFilter.filterConfig.localIdentifier
|
|
742
|
+
: undefined)
|
|
743
|
+
: withStoredWholePeriodsLocalIdentifier(buildDateFilterConfig(dateFilter), dateDataFilter?.filterConfig),
|
|
684
744
|
overTimeComparisonMeasures: includeOverTimeComparison ? overTimeComparisonMeasures : [],
|
|
745
|
+
// a period and a filter on whole periods of a granularity say how they treat empty date values
|
|
746
|
+
...((isPeriod || isTransformedAbsoluteGranularityDateFilterItem(dateFilter)) &&
|
|
747
|
+
dateFilter.emptyValueHandling
|
|
748
|
+
? { emptyDateValuesFilter: dateFilter.emptyValueHandling }
|
|
749
|
+
: {}),
|
|
685
750
|
};
|
|
686
751
|
}
|
|
687
752
|
function* handleSetFilterContextFinished({ payload: { postMessageContext }, }) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
2
|
import { type AdCommandData } from "@gooddata/sdk-embedding";
|
|
3
|
-
import { type DisplayFormRefType, type ITransformedDateFilterItem } from "@gooddata/sdk-embedding/internal";
|
|
4
|
-
import { type IDateFilterConfig } from "../../store/filter_bar/filter_bar_types.js";
|
|
3
|
+
import { type DisplayFormRefType, type ITransformedAbsoluteGranularityDateFilterItem, type ITransformedDateFilterItem } from "@gooddata/sdk-embedding/internal";
|
|
4
|
+
import { type IAbsoluteGranularityDateFilterConfig, type IDateFilterConfig } from "../../store/filter_bar/filter_bar_types.js";
|
|
5
5
|
import { type ICatalogEntries, type ICatalogEntry } from "../../typings/state_objects.js";
|
|
6
6
|
import { type IPostMessageContextContent } from "../actions/post_message_action_helper.js";
|
|
7
7
|
export declare const getSupportedGranularities: (isTimeSupported: boolean, isSecondsSupported?: boolean) => Record<string, string>;
|
|
8
8
|
export declare function getPostMessageContextId(postMessageContextContent?: IPostMessageContextContent): string;
|
|
9
9
|
export declare function getPostMessageContextIdFromCommandData(commandData: AdCommandData): string;
|
|
10
10
|
export declare function isWriteCommand(commandType: string): boolean;
|
|
11
|
-
export declare function buildDateFilterConfig(
|
|
11
|
+
export declare function buildDateFilterConfig(dateFilter: ITransformedDateFilterItem | ITransformedAbsoluteGranularityDateFilterItem): IDateFilterConfig | IAbsoluteGranularityDateFilterConfig;
|
|
12
12
|
export declare function convertRelativeToStaticDate(dateFilter: ITransformedDateFilterItem, projectTimezoneOffset: number, isTimeSupported: boolean, currentDate?: moment.Moment): {
|
|
13
13
|
periodFrom: string;
|
|
14
14
|
periodTo: string;
|