@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/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,
|
|
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,EAEH,KAAK,gBAAgB,EAExB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAkB,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGvF,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAiC7E,MAAM,WAAW,+BAAgC,SAAQ,0BAA0B;IAC/E,cAAc,EAAE,gBAAgB,CAAC;IACjC,mFAAmF;IACnF,cAAc,CAAC,EAAE,uBAAuB,CAAC;IACzC,gBAAgB,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,yBAAyB,CAAC,EACtC,MAAM,EACN,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,GACb,EAAE,+BAA+B,2CAqBjC"}
|
|
@@ -3,7 +3,7 @@ import classNames from "classnames";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { isAbsoluteDateFilterForm, isRelativeDateFilterForm } from "@gooddata/sdk-model";
|
|
5
5
|
import { IntlWrapper } from "@gooddata/sdk-ui";
|
|
6
|
-
import { DateFilterHelpers } from "@gooddata/sdk-ui-filters";
|
|
6
|
+
import { DateFilterHelpers, isUiAbsoluteGranularityDateFilterForm, } from "@gooddata/sdk-ui-filters";
|
|
7
7
|
import { DropdownButton } from "@gooddata/sdk-ui-kit";
|
|
8
8
|
import { DropdownButtonWrapper } from "../../../DropdownButtonWrapper.js";
|
|
9
9
|
function LocalizedPresetTitle({ preset, dateFormat }) {
|
|
@@ -16,7 +16,8 @@ function PresetTitle(props) {
|
|
|
16
16
|
}
|
|
17
17
|
function ButtonTitle({ preset, dateFormat }) {
|
|
18
18
|
const intl = useIntl();
|
|
19
|
-
|
|
19
|
+
// whole weeks, months, quarters or years are a static period too
|
|
20
|
+
if (isAbsoluteDateFilterForm(preset) || isUiAbsoluteGranularityDateFilterForm(preset)) {
|
|
20
21
|
return _jsx(_Fragment, { children: intl.formatMessage({ id: "static_period" }) });
|
|
21
22
|
}
|
|
22
23
|
if (isRelativeDateFilterForm(preset)) {
|
|
@@ -24,10 +25,10 @@ function ButtonTitle({ preset, dateFormat }) {
|
|
|
24
25
|
}
|
|
25
26
|
return _jsx(PresetTitle, { preset: preset, dateFormat: dateFormat });
|
|
26
27
|
}
|
|
27
|
-
export function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset,
|
|
28
|
+
export function DatePresetsDropdownButton({ isOpen, toggleDropdown, selectedPreset, selectedPeriod, buttonWrapperRef, dateFormat, }) {
|
|
28
29
|
const buttonClassName = classNames("s-date-preset-button", {
|
|
29
30
|
"s-expanded": isOpen,
|
|
30
31
|
"s-collapsed": !isOpen,
|
|
31
32
|
});
|
|
32
|
-
return (_jsx(DropdownButtonWrapper, { setRef: buttonWrapperRef, children: _jsx(DropdownButton, { id: "preset-dropdown", className: buttonClassName, value:
|
|
33
|
+
return (_jsx(DropdownButtonWrapper, { setRef: buttonWrapperRef, children: _jsx(DropdownButton, { id: "preset-dropdown", className: buttonClassName, value: selectedPeriod ? (selectedPeriod.title) : (_jsx(ButtonTitle, { preset: selectedPreset, dateFormat: dateFormat })), onClick: toggleDropdown }) }));
|
|
33
34
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type IActiveCalendars, type WeekStart } from "@gooddata/sdk-model";
|
|
2
|
-
import { type DateFilterRelativeOptionGroup } from "@gooddata/sdk-ui-filters";
|
|
2
|
+
import { type DateFilterRelativeOptionGroup, type IUiPeriodPreset } from "@gooddata/sdk-ui-filters";
|
|
3
3
|
import { type IDecoratedDateDataset } from "../../../../models/decorated_date_dataset.js";
|
|
4
4
|
import { type IDateDatasetRefWithGranularities } from "../../../../typings/datasets.js";
|
|
5
5
|
import { type IDateFilterOption } from "../dateFilterOptionFactory.js";
|
|
6
6
|
export interface IPresetsSectionProps {
|
|
7
7
|
filter: IDateFilterOption;
|
|
8
|
+
/** the local identifier saved with the stored filter's period, which as-code keys the filter by */
|
|
9
|
+
storedPeriodLocalIdentifier?: string;
|
|
8
10
|
onChange: (filter: IDateFilterOption) => void;
|
|
9
11
|
/**
|
|
10
12
|
* Called after `onChange` for a change the user made, not for the automatic reset of a period the
|
|
@@ -12,6 +14,8 @@ export interface IPresetsSectionProps {
|
|
|
12
14
|
*/
|
|
13
15
|
onEdit?: () => void;
|
|
14
16
|
relativeDateFilterPresets: DateFilterRelativeOptionGroup;
|
|
17
|
+
/** the periods (DATE_RANGE parameters) to offer; the list narrows them like the presets */
|
|
18
|
+
periodPresets: readonly IUiPeriodPreset[];
|
|
15
19
|
dateDataset: IDecoratedDateDataset;
|
|
16
20
|
dateDatasetRefsWithGranularities: IDateDatasetRefWithGranularities[];
|
|
17
21
|
dateFormat: string;
|
|
@@ -22,6 +26,13 @@ export interface IPresetsSectionProps {
|
|
|
22
26
|
submitForm: () => void;
|
|
23
27
|
isDisabled?: boolean;
|
|
24
28
|
activeCalendars?: IActiveCalendars;
|
|
29
|
+
/**
|
|
30
|
+
* Offers whole weeks, months, quarters and years in the static period (the
|
|
31
|
+
* `enableAbsoluteDateFilterGranularity` setting). A filter that already has them keeps them without it.
|
|
32
|
+
*/
|
|
33
|
+
isAbsoluteGranularityEnabled?: boolean;
|
|
34
|
+
/** reports whether the fields of the static period's period picker form a range that can be applied */
|
|
35
|
+
onPeriodRangeValidityChange?: (isValid: boolean) => void;
|
|
25
36
|
}
|
|
26
|
-
export declare function PresetsSection({ filter, relativeDateFilterPresets, onChange, onEdit, dateDataset, dateDatasetRefsWithGranularities, dateFormat, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled, weekStart, submitForm, isDisabled, activeCalendars, }: IPresetsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function PresetsSection({ filter, storedPeriodLocalIdentifier, relativeDateFilterPresets, periodPresets, onChange, onEdit, dateDataset, dateDatasetRefsWithGranularities, dateFormat, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled, weekStart, submitForm, isDisabled, activeCalendars, isAbsoluteGranularityEnabled, onPeriodRangeValidityChange, }: IPresetsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
27
38
|
//# sourceMappingURL=PresetsSection.d.ts.map
|
|
@@ -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,
|
|
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,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIH,KAAK,6BAA6B,EAElC,KAAK,eAAe,EAUvB,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,EAAyC,MAAM,+BAA+B,CAAC;AA+B9G,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mGAAmG;IACnG,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,EAAE,6BAA6B,CAAC;IACzD,2FAA2F;IAC3F,aAAa,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,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;IACnC;;;OAGG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,uGAAuG;IACvG,2BAA2B,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,aAAa,EACb,QAAQ,EACR,MAAM,EACN,WAAW,EACX,gCAAgC,EAChC,UAAU,EACV,6BAA6B,EAC7B,gCAAgC,EAChC,2BAAmC,EACnC,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,4BAAoC,EACpC,2BAA2B,GAC9B,EAAE,oBAAoB,2CA+JtB"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
|
-
import { isAbsoluteDateFilterForm, isRelativeDateFilterForm, } from "@gooddata/sdk-model";
|
|
6
|
-
import { DateFilterHelpers, ensureCompatibleGranularity, filterFiscalPresets, filterStandardPresets, getDefaultCalendarTab, getFilteredGranularities, getFiscalTabsConfig, } from "@gooddata/sdk-ui-filters";
|
|
5
|
+
import { areObjRefsEqual, isAbsoluteDateFilterForm, isRelativeDateFilterForm, } from "@gooddata/sdk-model";
|
|
6
|
+
import { DateFilterHelpers, ensureCompatibleGranularity, filterFiscalPresets, filterStandardPresets, getDefaultCalendarTab, getFilteredGranularities, getFiscalTabsConfig, isUiAbsoluteGranularityDateFilterForm, isUiPeriodPreset, } from "@gooddata/sdk-ui-filters";
|
|
7
7
|
import { DisableableFilterWrapper } from "../AdditionalFiltersSection/DisableableFilterWrapper.js";
|
|
8
|
+
import { buildPeriodDateFilterOptionFromPreset } from "../dateFilterOptionFactory.js";
|
|
9
|
+
import { getAbsoluteGranularities } from "./absoluteGranularities.js";
|
|
8
10
|
import { DatePresetsDropdown } from "./DatePresetsDropdown.js";
|
|
9
11
|
import { ExcludeCurrentPeriod } from "./ExcludeCurrentPeriod.js";
|
|
10
12
|
import { RelativeDateRange } from "./RelativeDateRange.js";
|
|
@@ -23,7 +25,7 @@ function getFilteredCalendarPresets(presets, config) {
|
|
|
23
25
|
}
|
|
24
26
|
return presets;
|
|
25
27
|
}
|
|
26
|
-
export function PresetsSection({ filter, relativeDateFilterPresets, onChange, onEdit, dateDataset, dateDatasetRefsWithGranularities, dateFormat, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled = false, weekStart, submitForm, isDisabled, activeCalendars, }) {
|
|
28
|
+
export function PresetsSection({ filter, storedPeriodLocalIdentifier, relativeDateFilterPresets, periodPresets, onChange, onEdit, dateDataset, dateDatasetRefsWithGranularities, dateFormat, isTimeForAbsoluteRangeEnabled, isSecondsForAbsoluteRangeEnabled, isSecondsGranularityEnabled = false, weekStart, submitForm, isDisabled, activeCalendars, isAbsoluteGranularityEnabled = false, onPeriodRangeValidityChange, }) {
|
|
27
29
|
const { filterOption: currentFilterOption } = filter;
|
|
28
30
|
const { supportedDateFilterPresets, supportedChronologicalGranularities } = useSupportedDateFilterPresets(relativeDateFilterPresets, dateDataset, dateDatasetRefsWithGranularities, isSecondsGranularityEnabled);
|
|
29
31
|
const fiscalTabsConfig = getFiscalTabsConfig(supportedDateFilterPresets, activeCalendars);
|
|
@@ -32,7 +34,9 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
32
34
|
onChange(option);
|
|
33
35
|
onEdit?.();
|
|
34
36
|
};
|
|
35
|
-
|
|
37
|
+
// a period is a standard-calendar range, as getDefaultCalendarTab treats a period preset; the All time
|
|
38
|
+
// option underneath it would open the default calendar's tab instead
|
|
39
|
+
const [selectedTab, setSelectedTab] = useState(() => filter.period ? "standard" : getDefaultCalendarTab(activeCalendars, currentFilterOption));
|
|
36
40
|
const handleTabChange = (newTab) => {
|
|
37
41
|
setSelectedTab(newTab);
|
|
38
42
|
// If relative form is currently displayed, correct its granularity for the new tab
|
|
@@ -49,13 +53,26 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
49
53
|
useResetPresetWhenUnsupportedOneIsSelected(currentFilterOption, enabledCalendarPresets, onChange);
|
|
50
54
|
useResetPeriodWhenUnsupportedByDateDataset(filter, dateDataset, dateDatasetRefsWithGranularities, onChange);
|
|
51
55
|
useResetRelativeRangeWhenUnsupportedOneIsSelected(currentFilterOption, filteredGranularities, onChange);
|
|
52
|
-
const
|
|
56
|
+
const absoluteGranularities = useMemo(() => getAbsoluteGranularities(isAbsoluteGranularityEnabled, supportedChronologicalGranularities), [isAbsoluteGranularityEnabled, supportedChronologicalGranularities]);
|
|
57
|
+
// the static period is days, or whole weeks, months, quarters or years
|
|
58
|
+
const staticPeriodOption = isAbsoluteDateFilterForm(currentFilterOption) ||
|
|
59
|
+
isUiAbsoluteGranularityDateFilterForm(currentFilterOption)
|
|
60
|
+
? currentFilterOption
|
|
61
|
+
: undefined;
|
|
53
62
|
const displayFloatingRange = isRelativeDateFilterForm(currentFilterOption);
|
|
54
63
|
const displayExcludePeriod = DateFilterHelpers.canExcludeCurrentPeriod(currentFilterOption);
|
|
55
64
|
const onPresetValueChange = (updatedFilter, excludeCurrentPeriod = false) => {
|
|
56
65
|
onUserChange({ filterOption: updatedFilter, excludeCurrentPeriod });
|
|
57
66
|
};
|
|
58
67
|
const onPresetSelectionChange = (newlySelectedPreset) => {
|
|
68
|
+
if (isUiPeriodPreset(newlySelectedPreset)) {
|
|
69
|
+
// any period picked keeps the stored local identifier, also after All time, which has none;
|
|
70
|
+
// picking the saved period back is then no change
|
|
71
|
+
if (!areObjRefsEqual(newlySelectedPreset.parameter, filter.period?.config.parameterRef)) {
|
|
72
|
+
onUserChange(buildPeriodDateFilterOptionFromPreset(newlySelectedPreset, storedPeriodLocalIdentifier));
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
59
76
|
// with a period, its All time base is not a choice the user made, so All time replaces the period too
|
|
60
77
|
if (filter.period || newlySelectedPreset.localIdentifier !== currentFilterOption.localIdentifier) {
|
|
61
78
|
// If switching to relative form, ensure granularity is compatible
|
|
@@ -72,5 +89,5 @@ export function PresetsSection({ filter, relativeDateFilterPresets, onChange, on
|
|
|
72
89
|
const onExcludePeriodChange = (excludeCurrentPeriod) => {
|
|
73
90
|
onPresetValueChange(currentFilterOption, excludeCurrentPeriod);
|
|
74
91
|
};
|
|
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,
|
|
92
|
+
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, selectedPeriod: filter.period, periodPresets: periodPresets, weekStart: weekStart, onChange: onPresetSelectionChange, dateFormat: dateFormat, selectedTab: selectedTab, onTabChange: handleTabChange, activeCalendars: activeCalendars }), staticPeriodOption ? (_jsx(StaticDateRange, { selectedFilter: staticPeriodOption, onChange: onPresetValueChange, dateFormat: dateFormat, isTimeEnabled: isTimeForAbsoluteRangeEnabled, isSecondsEnabled: isSecondsForAbsoluteRangeEnabled, weekStart: weekStart, submitForm: submitForm, isGranularityEnabled: isAbsoluteGranularityEnabled, availableGranularities: absoluteGranularities, onPeriodRangeValidityChange: onPeriodRangeValidityChange })) : null, displayFloatingRange ? (_jsx(RelativeDateRange, { granularities: filteredGranularities, selectedFilter: currentFilterOption, onChange: onPresetValueChange })) : null, displayExcludePeriod ? (_jsx(ExcludeCurrentPeriod, { selectedFilter: filter, onChange: onExcludePeriodChange })) : null] }));
|
|
76
93
|
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import { type WeekStart } from "@gooddata/sdk-model";
|
|
2
|
-
import { type DateFilterOption } from "@gooddata/sdk-ui-filters";
|
|
1
|
+
import { type DateFilterGranularity, type WeekStart } from "@gooddata/sdk-model";
|
|
2
|
+
import { type DateFilterOption, type IUiAbsoluteDateFilterForm, type IUiAbsoluteGranularityDateFilterForm } from "@gooddata/sdk-ui-filters";
|
|
3
3
|
export interface IStaticDateRangeProps {
|
|
4
|
-
|
|
4
|
+
/** days, or whole weeks, months, quarters or years */
|
|
5
|
+
selectedFilter: IUiAbsoluteDateFilterForm | IUiAbsoluteGranularityDateFilterForm;
|
|
5
6
|
onChange: (filter: DateFilterOption) => void;
|
|
6
7
|
dateFormat: string;
|
|
7
8
|
isTimeEnabled: boolean;
|
|
8
9
|
isSecondsEnabled?: boolean;
|
|
9
10
|
weekStart?: WeekStart;
|
|
10
11
|
submitForm: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Offers the picker of whole weeks, months, quarters and years next to the days. Without it a selection
|
|
14
|
+
* of whole periods is not shown and the day picker stays empty, until the user picks days.
|
|
15
|
+
*/
|
|
16
|
+
isGranularityEnabled?: boolean;
|
|
17
|
+
/** the granularities the picker offers a tab for, the day included */
|
|
18
|
+
availableGranularities?: DateFilterGranularity[];
|
|
19
|
+
/** reports whether the fields of the period picker form a range that can be applied */
|
|
20
|
+
onPeriodRangeValidityChange?: (isValid: boolean) => void;
|
|
11
21
|
}
|
|
12
|
-
export declare function StaticDateRange({ dateFormat, selectedFilter, onChange, isTimeEnabled, isSecondsEnabled, weekStart, submitForm, }: IStaticDateRangeProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function StaticDateRange({ dateFormat, selectedFilter, onChange, isTimeEnabled, isSecondsEnabled, weekStart, submitForm, isGranularityEnabled, availableGranularities, onPeriodRangeValidityChange, }: IStaticDateRangeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
23
|
//# sourceMappingURL=StaticDateRange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticDateRange.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/StaticDateRange.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"StaticDateRange.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/StaticDateRange.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAC5C,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,qBAAqB;IAClC,sDAAsD;IACtD,cAAc,EAAE,yBAAyB,GAAG,oCAAoC,CAAC;IACjF,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACjD,uFAAuF;IACvF,2BAA2B,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,eAAe,CAAC,EAC5B,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,oBAA4B,EAC5B,sBAAyC,EACzC,2BAA2B,GAC9B,EAAE,qBAAqB,2CAwBvB"}
|
|
@@ -3,7 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { IntlWrapper } from "@gooddata/sdk-ui";
|
|
5
5
|
import { AbsoluteDateFilterForm } from "@gooddata/sdk-ui-filters/internal";
|
|
6
|
-
|
|
6
|
+
const NO_GRANULARITIES = [];
|
|
7
|
+
export function StaticDateRange({ dateFormat, selectedFilter, onChange, isTimeEnabled, isSecondsEnabled, weekStart, submitForm, isGranularityEnabled = false, availableGranularities = NO_GRANULARITIES, onPeriodRangeValidityChange, }) {
|
|
7
8
|
const intl = useIntl();
|
|
8
|
-
return (_jsx("div", { className: "subsection-wrap", children: _jsx("div", { className: "subsection", children: _jsx(IntlWrapper, { locale: intl.locale, children: _jsx(AbsoluteDateFilterForm, { selectedFilterOption: selectedFilter, onSelectedFilterOptionChange: onChange, dateFormat: dateFormat, isMobile: false, isTimeEnabled: isTimeEnabled, isSecondsEnabled: isSecondsEnabled, weekStart: weekStart, shouldOverlayDatePicker: true, submitForm: submitForm, availableGranularities:
|
|
9
|
+
return (_jsx("div", { className: "subsection-wrap", children: _jsx("div", { className: "subsection", children: _jsx(IntlWrapper, { locale: intl.locale, children: _jsx(AbsoluteDateFilterForm, { selectedFilterOption: selectedFilter, onSelectedFilterOptionChange: onChange, dateFormat: dateFormat, isMobile: false, isTimeEnabled: isTimeEnabled, isSecondsEnabled: isSecondsEnabled, weekStart: weekStart, shouldOverlayDatePicker: true, submitForm: submitForm, isGranularityEnabled: isGranularityEnabled, availableGranularities: availableGranularities, onPeriodRangeValidityChange: onPeriodRangeValidityChange }) }) }) }));
|
|
9
10
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DateFilterGranularity } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* The granularity tabs of the static period: the day, and the whole weeks, months, quarters and years the
|
|
4
|
+
* date dataset has a granularity for.
|
|
5
|
+
*
|
|
6
|
+
* @param isAbsoluteGranularityEnabled - whether whole periods are offered (the
|
|
7
|
+
* `enableAbsoluteDateFilterGranularity` setting)
|
|
8
|
+
* @param datasetGranularities - the granularities of the selected date dataset
|
|
9
|
+
* @returns the tabs, none without the setting or when the day would be the only one
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAbsoluteGranularities(isAbsoluteGranularityEnabled: boolean, datasetGranularities: DateFilterGranularity[]): DateFilterGranularity[];
|
|
12
|
+
//# sourceMappingURL=absoluteGranularities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absoluteGranularities.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/PresetSection/absoluteGranularities.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8C,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI7G;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACpC,4BAA4B,EAAE,OAAO,EACrC,oBAAoB,EAAE,qBAAqB,EAAE,GAC9C,qBAAqB,EAAE,CAQzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { DEFAULT_ABSOLUTE_DATE_FILTER_GRANULARITIES } from "@gooddata/sdk-model";
|
|
3
|
+
const NO_GRANULARITIES = [];
|
|
4
|
+
/**
|
|
5
|
+
* The granularity tabs of the static period: the day, and the whole weeks, months, quarters and years the
|
|
6
|
+
* date dataset has a granularity for.
|
|
7
|
+
*
|
|
8
|
+
* @param isAbsoluteGranularityEnabled - whether whole periods are offered (the
|
|
9
|
+
* `enableAbsoluteDateFilterGranularity` setting)
|
|
10
|
+
* @param datasetGranularities - the granularities of the selected date dataset
|
|
11
|
+
* @returns the tabs, none without the setting or when the day would be the only one
|
|
12
|
+
*/
|
|
13
|
+
export function getAbsoluteGranularities(isAbsoluteGranularityEnabled, datasetGranularities) {
|
|
14
|
+
if (!isAbsoluteGranularityEnabled) {
|
|
15
|
+
return NO_GRANULARITIES;
|
|
16
|
+
}
|
|
17
|
+
const granularities = DEFAULT_ABSOLUTE_DATE_FILTER_GRANULARITIES.filter((granularity) => granularity === "GDC.time.date" || datasetGranularities.includes(granularity));
|
|
18
|
+
return granularities.length > 1 ? granularities : NO_GRANULARITIES;
|
|
19
|
+
}
|
|
@@ -37,8 +37,9 @@ export declare const useResetPresetWhenUnsupportedOneIsSelected: (selectedFilter
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const useResetRelativeRangeWhenUnsupportedOneIsSelected: (selectedFilter: DateFilterOption, supportedChronologicalGranularities: DateFilterGranularity[], resetCallback: (filter: IDateFilterOption) => void) => void;
|
|
39
39
|
/**
|
|
40
|
-
* Hook calls `resetCallback` with All time when `filter` keeps a period
|
|
41
|
-
*
|
|
40
|
+
* Hook calls `resetCallback` with All time when `filter` keeps a period, or a range of whole weeks, months,
|
|
41
|
+
* quarters or years, whose granularity the selected date dataset does not have, as moving the date item in
|
|
42
|
+
* the buckets to such a dataset does. A period without a known
|
|
42
43
|
* granularity (the catalog does not have it) follows the dataset, and so does any period while the dataset's
|
|
43
44
|
* granularities are not known.
|
|
44
45
|
*
|
|
@@ -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,
|
|
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,EAGrC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAE1F,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;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0CAA0C,WAC3C,iBAAiB,uBACJ,qBAAqB,oCACR,gCAAgC,EAAE,iBACrD,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,SAoBrD,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// (C) 2022-2026 GoodData Corporation
|
|
2
2
|
import { useEffect, useMemo } from "react";
|
|
3
3
|
import { areObjRefsEqual, isDateFilterGranularity, } from "@gooddata/sdk-model";
|
|
4
|
-
import { isUiRelativeDateFilterForm, } from "@gooddata/sdk-ui-filters";
|
|
4
|
+
import { isUiAbsoluteGranularityDateFilterForm, isUiRelativeDateFilterForm, } from "@gooddata/sdk-ui-filters";
|
|
5
5
|
import { _omit } from "@gooddata/util";
|
|
6
|
+
import { periodGranularityToGranularity } from "../../../../models/granularity.js";
|
|
6
7
|
import { ALL_TIME_FILTER_OPTION, RELATIVE_PERIOD_FILTER_OPTION } from "../defaultFilterOptions.js";
|
|
7
8
|
/**
|
|
8
9
|
* Hook returns memoized DateFilterRelativeOptionGroup created by filtering out unsupported granularities from the provided `allRelativeDateFilterPresets`.
|
|
@@ -86,8 +87,9 @@ export const useResetRelativeRangeWhenUnsupportedOneIsSelected = (selectedFilter
|
|
|
86
87
|
}, [selectedFilter, supportedChronologicalGranularities, resetCallback]);
|
|
87
88
|
};
|
|
88
89
|
/**
|
|
89
|
-
* Hook calls `resetCallback` with All time when `filter` keeps a period
|
|
90
|
-
*
|
|
90
|
+
* Hook calls `resetCallback` with All time when `filter` keeps a period, or a range of whole weeks, months,
|
|
91
|
+
* quarters or years, whose granularity the selected date dataset does not have, as moving the date item in
|
|
92
|
+
* the buckets to such a dataset does. A period without a known
|
|
91
93
|
* granularity (the catalog does not have it) follows the dataset, and so does any period while the dataset's
|
|
92
94
|
* granularities are not known.
|
|
93
95
|
*
|
|
@@ -97,7 +99,11 @@ export const useResetRelativeRangeWhenUnsupportedOneIsSelected = (selectedFilter
|
|
|
97
99
|
* @param resetCallback -
|
|
98
100
|
*/
|
|
99
101
|
export const useResetPeriodWhenUnsupportedByDateDataset = (filter, selectedDateDataset, dateDatasetRefsWithGranularities, resetCallback) => {
|
|
100
|
-
const
|
|
102
|
+
const { filterOption } = filter;
|
|
103
|
+
const granularity = filter.period?.config.granularity ??
|
|
104
|
+
(isUiAbsoluteGranularityDateFilterForm(filterOption)
|
|
105
|
+
? periodGranularityToGranularity(filterOption.granularity)
|
|
106
|
+
: undefined);
|
|
101
107
|
useEffect(() => {
|
|
102
108
|
const datasetGranularities = dateDatasetRefsWithGranularities.find(({ ref }) => areObjRefsEqual(ref, selectedDateDataset?.ref))?.attributes;
|
|
103
109
|
if (granularity &&
|
package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OverTimeComparisonType } from "@gooddata/sdk-ui";
|
|
2
|
+
import { type UncomparableDateFilter } from "../dateFilterOptionFactory.js";
|
|
2
3
|
import { type IComparisonCompatibleMeasure } from "../types.js";
|
|
3
4
|
interface IComparedMeasuresSection {
|
|
4
5
|
selectedType: OverTimeComparisonType;
|
|
@@ -10,10 +11,11 @@ export interface ITimeComparisonSectionProps extends IComparedMeasuresSection {
|
|
|
10
11
|
supportedTypes: OverTimeComparisonType[];
|
|
11
12
|
onTypeSelected: (selectedType: OverTimeComparisonType) => void;
|
|
12
13
|
isPoPAvailable: boolean;
|
|
13
|
-
|
|
14
|
+
/** the selected date filter, when the comparison does not work with it */
|
|
15
|
+
uncomparableDateFilter?: UncomparableDateFilter;
|
|
14
16
|
isSectionHidden: boolean;
|
|
15
17
|
isDisabled?: boolean;
|
|
16
18
|
}
|
|
17
|
-
export declare function TimeComparisonSection({ selectedType, supportedTypes, selectedMeasureIds, compatibleMeasures, onTypeSelected, onMeasuresSelected,
|
|
19
|
+
export declare function TimeComparisonSection({ selectedType, supportedTypes, selectedMeasureIds, compatibleMeasures, onTypeSelected, onMeasuresSelected, uncomparableDateFilter, isPoPAvailable, isSectionHidden, isDisabled, }: ITimeComparisonSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export {};
|
|
19
21
|
//# sourceMappingURL=TimeComparisonSection.d.ts.map
|
package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeComparisonSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;AAKxF,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAUhE,UAAU,wBAAwB;IAC9B,YAAY,EAAE,sBAAsB,CAAC;IACrC,kBAAkB,EAAE,4BAA4B,EAAE,CAAC;IACnD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,EAAE,CAAC,+BAA+B,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,MAAM,WAAW,2BAA4B,SAAQ,wBAAwB;IACzE,cAAc,EAAE,sBAAsB,EAAE,CAAC;IACzC,cAAc,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC/D,cAAc,EAAE,OAAO,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"TimeComparisonSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;AAKxF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAUhE,UAAU,wBAAwB;IAC9B,YAAY,EAAE,sBAAsB,CAAC;IACrC,kBAAkB,EAAE,4BAA4B,EAAE,CAAC;IACnD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,EAAE,CAAC,+BAA+B,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,MAAM,WAAW,2BAA4B,SAAQ,wBAAwB;IACzE,cAAc,EAAE,sBAAsB,EAAE,CAAC;IACzC,cAAc,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC/D,cAAc,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAgCD,wBAAgB,qBAAqB,CAAC,EAClC,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,UAAU,GACb,EAAE,2BAA2B,2CA4C7B"}
|
|
@@ -14,7 +14,7 @@ function ComparedMeasuresSection({ compatibleMeasures, selectedType, selectedMea
|
|
|
14
14
|
}
|
|
15
15
|
return (_jsx("div", { className: "subsection-wrap", children: _jsxs("div", { className: "subsection", children: [_jsx("label", { className: "adi-compare-apply-label", htmlFor: "time-comparison-measures-dropdown", children: _jsx(FormattedMessage, { id: "filter.compare.apply_on" }) }), _jsx(ComparedMeasuresDropdown, { listItemHeight: DROPDOWN_ITEM_HEIGHT, selectedMeasures: selectedMeasureIds, compatibleMeasures: compatibleMeasures, selectedAllCompatible: areAllCompatibleMeasuresSelected(compatibleMeasures, selectedMeasureIds), onSelectionApplied: onMeasuresSelected })] }) }));
|
|
16
16
|
}
|
|
17
|
-
export function TimeComparisonSection({ selectedType, supportedTypes, selectedMeasureIds, compatibleMeasures, onTypeSelected, onMeasuresSelected,
|
|
17
|
+
export function TimeComparisonSection({ selectedType, supportedTypes, selectedMeasureIds, compatibleMeasures, onTypeSelected, onMeasuresSelected, uncomparableDateFilter, isPoPAvailable, isSectionHidden, isDisabled, }) {
|
|
18
18
|
const intl = useIntl();
|
|
19
19
|
if (isSectionHidden) {
|
|
20
20
|
return (_jsx(Message, { type: "progress", className: "s-date-filter-error-message date-filter-error-message", children: intl.formatMessage({ id: "filter.date.comparing_only_on_first_warning" }) }));
|
|
@@ -22,5 +22,5 @@ export function TimeComparisonSection({ selectedType, supportedTypes, selectedMe
|
|
|
22
22
|
if (supportedTypes.length === 0) {
|
|
23
23
|
return (_jsx(Message, { type: "progress", className: "s-date-filter-error-message date-filter-error-message", children: intl.formatMessage({ id: "filter.date.comparing_not_supported_by_visualization" }) }));
|
|
24
24
|
}
|
|
25
|
-
return (_jsxs(DisableableFilterWrapper, { isDisabled: isDisabled, className: "section adi-date-dropdown adi-compare-apply-select", children: [_jsx("label", { htmlFor: "time-comparison-dropdown", children: _jsx(FormattedMessage, { id: "filter.date.compare_period_with" }) }), _jsx(TimeComparisonTypesDropdown, { className: "s-filter-date-compare-switch adi-date-preset-select-dropdown", supportedTypes: supportedTypes,
|
|
25
|
+
return (_jsxs(DisableableFilterWrapper, { isDisabled: isDisabled, className: "section adi-date-dropdown adi-compare-apply-select", children: [_jsx("label", { htmlFor: "time-comparison-dropdown", children: _jsx(FormattedMessage, { id: "filter.date.compare_period_with" }) }), _jsx(TimeComparisonTypesDropdown, { className: "s-filter-date-compare-switch adi-date-preset-select-dropdown", supportedTypes: supportedTypes, uncomparableDateFilter: uncomparableDateFilter, selectedType: selectedType, onSelect: onTypeSelected, itemHeight: DROPDOWN_ITEM_HEIGHT, isPoPAvailable: isPoPAvailable }), _jsx(ComparedMeasuresSection, { selectedType: selectedType, compatibleMeasures: compatibleMeasures, selectedMeasureIds: selectedMeasureIds, onMeasuresSelected: onMeasuresSelected })] }));
|
|
26
26
|
}
|
package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OverTimeComparisonType } from "@gooddata/sdk-ui";
|
|
2
|
+
import { type UncomparableDateFilter } from "../dateFilterOptionFactory.js";
|
|
2
3
|
export interface ITimeComparisonTypesDropdownProps {
|
|
3
4
|
supportedTypes: OverTimeComparisonType[];
|
|
4
5
|
selectedType: OverTimeComparisonType;
|
|
@@ -6,8 +7,9 @@ export interface ITimeComparisonTypesDropdownProps {
|
|
|
6
7
|
itemHeight: number;
|
|
7
8
|
className?: string;
|
|
8
9
|
defaultDialogHeight?: number;
|
|
9
|
-
|
|
10
|
+
/** the selected date filter, when the comparison does not work with it */
|
|
11
|
+
uncomparableDateFilter?: UncomparableDateFilter;
|
|
10
12
|
isPoPAvailable: boolean;
|
|
11
13
|
}
|
|
12
|
-
export declare function TimeComparisonTypesDropdown({ onSelect, selectedType, itemHeight, className, defaultDialogHeight,
|
|
14
|
+
export declare function TimeComparisonTypesDropdown({ onSelect, selectedType, itemHeight, className, defaultDialogHeight, uncomparableDateFilter, isPoPAvailable, supportedTypes, }: ITimeComparisonTypesDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
//# sourceMappingURL=TimeComparisonTypesDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeComparisonTypesDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TimeComparisonTypesDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;AAWxF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAI5E,MAAM,WAAW,iCAAiC;IAC9C,cAAc,EAAE,sBAAsB,EAAE,CAAC;IACzC,YAAY,EAAE,sBAAsB,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,cAAc,EAAE,OAAO,CAAC;CAC3B;AAeD,wBAAgB,2BAA2B,CAAC,EACxC,QAAmB,EACnB,YAAY,EACZ,UAAU,EACV,SAAsC,EACtC,mBAAyC,EACzC,sBAAsB,EACtB,cAAc,EACd,cAAc,GACjB,EAAE,iCAAiC,2CA4HnC"}
|
package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.js
CHANGED
|
@@ -20,7 +20,7 @@ function getComparisonTypeDropdownMessageId(type) {
|
|
|
20
20
|
return `filter.compare.type.dropdown.${type}`;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export function TimeComparisonTypesDropdown({ onSelect = () => { }, selectedType, itemHeight, className = "s-compare-types-dropdown", defaultDialogHeight = DROPDOWN_MIN_HEIGHT,
|
|
23
|
+
export function TimeComparisonTypesDropdown({ onSelect = () => { }, selectedType, itemHeight, className = "s-compare-types-dropdown", defaultDialogHeight = DROPDOWN_MIN_HEIGHT, uncomparableDateFilter, isPoPAvailable, supportedTypes, }) {
|
|
24
24
|
const intl = useIntl();
|
|
25
25
|
const [state, setState] = useState({
|
|
26
26
|
opened: false,
|
|
@@ -90,5 +90,5 @@ export function TimeComparisonTypesDropdown({ onSelect = () => { }, selectedType
|
|
|
90
90
|
return (_jsx(Dropdown, { className: className, renderButton: ({ toggleDropdown }) => renderDropdownButton(toggleDropdown), onOpenStateChanged: onOpenStateChanged, alignPoints: DROPDOWN_ALIGN_POINTS, closeOnParentScroll: true, closeOnMouseDrag: true, renderBody: ({ closeDropdown }) => (_jsx(DropdownList, { className: "adi-compare-types-list s-compare-types-list", itemHeight: itemHeight, height: height, width: width, items: itemsRef.current, renderItem: ({ item }) => (_jsx(TimeComparisonTypesDropdownItem, { item: item, selected: selectedType, onClick: () => {
|
|
91
91
|
onSelect(item);
|
|
92
92
|
closeDropdown();
|
|
93
|
-
},
|
|
93
|
+
}, uncomparableDateFilter: uncomparableDateFilter, isPoPAvailable: isPoPAvailable })) })) }));
|
|
94
94
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type OverTimeComparisonType } from "@gooddata/sdk-ui";
|
|
2
|
+
import { type UncomparableDateFilter } from "../dateFilterOptionFactory.js";
|
|
2
3
|
export interface ITypesDropdownItemProps {
|
|
3
4
|
selected: OverTimeComparisonType;
|
|
4
5
|
item?: OverTimeComparisonType;
|
|
5
6
|
onClick?: (selectedType: OverTimeComparisonType) => void;
|
|
6
|
-
|
|
7
|
+
/** the selected date filter, when the comparison does not work with it */
|
|
8
|
+
uncomparableDateFilter?: UncomparableDateFilter;
|
|
7
9
|
isPoPAvailable: boolean;
|
|
8
10
|
}
|
|
9
|
-
export declare function TimeComparisonTypesDropdownItem({ item, onClick, selected,
|
|
11
|
+
export declare function TimeComparisonTypesDropdownItem({ item, onClick, selected, uncomparableDateFilter, isPoPAvailable, }: ITypesDropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
//# sourceMappingURL=TimeComparisonTypesDropdownItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeComparisonTypesDropdownItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TimeComparisonTypesDropdownItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAoB5E,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,+BAA+B,CAAC,EAC5C,IAAW,EACX,OAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,cAAc,GACjB,EAAE,uBAAuB,2CAgEzB"}
|
package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdownItem.js
CHANGED
|
@@ -5,6 +5,10 @@ import classNames from "classnames";
|
|
|
5
5
|
import { defineMessage, useIntl } from "react-intl";
|
|
6
6
|
import { OverTimeComparisonTypes } from "@gooddata/sdk-ui";
|
|
7
7
|
import { Bubble, BubbleHoverTrigger } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
const UNCOMPARABLE_DATE_FILTER_TOOLTIPS = {
|
|
9
|
+
allTime: defineMessage({ id: "filter.compare.type.dropdown.disabled_for_all_time_period_tooltip" }),
|
|
10
|
+
period: defineMessage({ id: "filter.compare.type.dropdown.disabled_for_named_period_tooltip" }),
|
|
11
|
+
};
|
|
8
12
|
function getComparisonTypeDropdownMessageId(type) {
|
|
9
13
|
switch (type) {
|
|
10
14
|
case OverTimeComparisonTypes.NOTHING:
|
|
@@ -17,14 +21,14 @@ function getComparisonTypeDropdownMessageId(type) {
|
|
|
17
21
|
return `filter.compare.type.dropdown.${type}`;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
|
-
export function TimeComparisonTypesDropdownItem({ item = null, onClick = () => { }, selected,
|
|
24
|
+
export function TimeComparisonTypesDropdownItem({ item = null, onClick = () => { }, selected, uncomparableDateFilter, isPoPAvailable, }) {
|
|
21
25
|
const intl = useIntl();
|
|
22
26
|
const isIncompatible = useCallback(() => {
|
|
23
|
-
const
|
|
27
|
+
const disabledForDateFilter = uncomparableDateFilter !== undefined &&
|
|
24
28
|
(item === OverTimeComparisonTypes.PREVIOUS_PERIOD ||
|
|
25
29
|
item === OverTimeComparisonTypes.SAME_PERIOD_PREVIOUS_YEAR);
|
|
26
|
-
return
|
|
27
|
-
}, [item,
|
|
30
|
+
return disabledForDateFilter || !isPoPAvailable;
|
|
31
|
+
}, [item, uncomparableDateFilter, isPoPAvailable]);
|
|
28
32
|
const isSelected = useCallback(() => {
|
|
29
33
|
return item === selected;
|
|
30
34
|
}, [item, selected]);
|
|
@@ -32,16 +36,12 @@ export function TimeComparisonTypesDropdownItem({ item = null, onClick = () => {
|
|
|
32
36
|
return isIncompatible() && item !== OverTimeComparisonTypes.NOTHING;
|
|
33
37
|
}, [item, isIncompatible]);
|
|
34
38
|
const getBubbleText = useCallback(() => {
|
|
35
|
-
return isPoPAvailable
|
|
36
|
-
? intl.formatMessage(
|
|
37
|
-
id: defineMessage({
|
|
38
|
-
id: "filter.compare.type.dropdown.disabled_for_all_time_period_tooltip",
|
|
39
|
-
}).id,
|
|
40
|
-
})
|
|
39
|
+
return isPoPAvailable && uncomparableDateFilter
|
|
40
|
+
? intl.formatMessage(UNCOMPARABLE_DATE_FILTER_TOOLTIPS[uncomparableDateFilter])
|
|
41
41
|
: intl.formatMessage({
|
|
42
42
|
id: defineMessage({ id: "filter.compare.type.dropdown.disabled_for_pop" }).id,
|
|
43
43
|
});
|
|
44
|
-
}, [intl, isPoPAvailable]);
|
|
44
|
+
}, [intl, isPoPAvailable, uncomparableDateFilter]);
|
|
45
45
|
const handleClick = useCallback((e) => {
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
const isResettable = item === OverTimeComparisonTypes.NOTHING;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type DateFilterOption } from "@gooddata/sdk-ui-filters";
|
|
2
|
-
import { type IDateFilterConfig, type IParameterizedDateFilterConfig } from "../../../store/filter_bar/filter_bar_types.js";
|
|
1
|
+
import { type DateFilterOption, type IUiPeriodPreset } from "@gooddata/sdk-ui-filters";
|
|
2
|
+
import { type IAbsoluteGranularityDateFilterConfig, 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;
|
|
@@ -17,12 +17,31 @@ export interface IDateFilterOptionPeriod {
|
|
|
17
17
|
}
|
|
18
18
|
/** The option is All time, not a period, which is All time underneath. */
|
|
19
19
|
export declare const isAllTimeOption: ({ filterOption, period }: IDateFilterOption) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The option's filter always stores its empty date values mode itself: a filter with a period and a filter
|
|
22
|
+
* on whole periods of a granularity are new and have no legacy shape of the mode. Such a filter keeps
|
|
23
|
+
* "include" with the `enableImprovedMetricDateFilter` setting on or off.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isOptionStoringEmptyValuesMode: ({ filterOption, period }: IDateFilterOption) => boolean;
|
|
20
26
|
/** The option of a filter with a period. */
|
|
21
27
|
export declare const buildPeriodDateFilterOption: (config: IParameterizedDateFilterConfig, title: string) => IDateFilterOption;
|
|
28
|
+
/** The option of a period picked from the list of periods, in the filter with the given local identifier. */
|
|
29
|
+
export declare const buildPeriodDateFilterOptionFromPreset: ({ parameter, period, name }: IUiPeriodPreset, localIdentifier?: string) => IDateFilterOption;
|
|
30
|
+
/** A date filter the comparison over time does not work with: it has no previous period to compare to. */
|
|
31
|
+
export type UncomparableDateFilter = "allTime" | "period";
|
|
32
|
+
export declare const getUncomparableDateFilter: (option: IDateFilterOption) => UncomparableDateFilter | undefined;
|
|
22
33
|
/**
|
|
23
34
|
* Tries to match a preset or a form with the provided value. Prioritizes preset over form.
|
|
24
35
|
* @param dateFilterValue - Value to match against.
|
|
25
36
|
*/
|
|
26
|
-
export declare const matchDateFilterValueToDateFilterOption: (dateFilterValue: IDateFilterConfig) => IDateFilterOption | undefined;
|
|
27
|
-
|
|
37
|
+
export declare const matchDateFilterValueToDateFilterOption: (dateFilterValue: IDateFilterConfig | IAbsoluteGranularityDateFilterConfig) => IDateFilterOption | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Whole periods picked for a filter that is stored with whole periods are still that stored filter, so they
|
|
40
|
+
* keep its local identifier. The picker's option has no place for it.
|
|
41
|
+
*
|
|
42
|
+
* @param picked - the config or metric interval built from the picked option
|
|
43
|
+
* @param stored - the config or metric interval the filter had before
|
|
44
|
+
*/
|
|
45
|
+
export declare const withStoredLocalIdentifier: <T>(picked: T, stored: unknown) => T;
|
|
46
|
+
export declare const buildDateFilterValueFromDateFilterOption: (option: DateFilterOption) => IDateFilterConfig | IAbsoluteGranularityDateFilterConfig | undefined;
|
|
28
47
|
//# sourceMappingURL=dateFilterOptionFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFilterOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/dateFilterOptionFactory.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"dateFilterOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/dateFilter/dateFilterOptionFactory.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,gBAAgB,EAGrB,KAAK,eAAe,EAIvB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACH,KAAK,oCAAoC,EACzC,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EAEtC,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;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,6BAA8B,iBAAiB,KAAG,OAC1B,CAAC;AAEpE,4CAA4C;AAC5C,eAAO,MAAM,2BAA2B,WAC5B,8BAA8B,SAC/B,MAAM,KACd,iBAID,CAAC;AAEH,6GAA6G;AAC7G,eAAO,MAAM,qCAAqC,gCACjB,eAAe,oBAC1B,MAAM,KACzB,iBASE,CAAC;AAEN,0GAA0G;AAC1G,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,eAAO,MAAM,yBAAyB,WAAY,iBAAiB,KAAG,sBAAsB,GAAG,SAK9F,CAAC;AAmEF;;;GAGG;AACH,eAAO,MAAM,sCAAsC,oBAC9B,iBAAiB,GAAG,oCAAoC,KAC1E,iBAAiB,GAAG,SA4BtB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,UAAU,CAAC,UAAU,OAAO,KAAG,CAK1D,CAAC;AAEjB,eAAO,MAAM,wCAAwC,WACzC,gBAAgB,KACzB,iBAAiB,GAAG,oCAAoC,GAAG,SAmC7D,CAAC"}
|