@gooddata/sdk-ui-analytical-designer 11.67.0-alpha.3 → 11.67.0
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 +16 -233
- package/README.md +13 -5
- package/esm/Root.d.ts +0 -2
- package/esm/Root.d.ts.map +1 -1
- package/esm/Root.js +0 -4
- package/esm/actions/app_context_actions.d.ts.map +1 -1
- package/esm/actions/app_context_actions.js +2 -4
- package/esm/actions/dialogs_actions.d.ts +2 -2
- package/esm/actions/dialogs_actions.js +2 -2
- package/esm/components/Editor.d.ts.map +1 -1
- package/esm/components/Editor.js +31 -2
- package/esm/components/EditorHeader.d.ts +19 -1
- package/esm/components/EditorHeader.d.ts.map +1 -1
- package/esm/components/EditorHeader.js +38 -86
- package/esm/components/ReportDescription.d.ts +8 -1
- package/esm/components/ReportDescription.d.ts.map +1 -1
- package/esm/components/ReportDescription.js +37 -7
- package/esm/components/buckets/MeasureAttributeFilterOrganized.d.ts.map +1 -1
- package/esm/components/buckets/MeasureAttributeFilterOrganized.js +1 -1
- package/esm/components/buckets/MeasureDateFilter.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilter.js +1 -1
- package/esm/components/buckets/categories/DateDatasetsDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.d.ts.map +1 -1
- package/esm/components/header/CancelButton.d.ts +13 -0
- package/esm/components/header/CancelButton.d.ts.map +1 -0
- package/esm/components/header/CancelButton.js +32 -0
- package/esm/components/header/ClearButton.d.ts +7 -0
- package/esm/components/header/ClearButton.d.ts.map +1 -0
- package/esm/components/header/ClearButton.js +24 -0
- package/esm/components/header/EditorActions.d.ts +14 -0
- package/esm/components/header/EditorActions.d.ts.map +1 -0
- package/esm/components/header/EditorActions.js +71 -0
- package/esm/components/header/Embed/EmbedButton.d.ts +6 -1
- package/esm/components/header/Embed/EmbedButton.d.ts.map +1 -1
- package/esm/components/header/Embed/EmbedButton.js +48 -48
- package/esm/components/header/Embed/EmbedInsightDialogContainer.d.ts +6 -0
- package/esm/components/header/Embed/EmbedInsightDialogContainer.d.ts.map +1 -0
- package/esm/components/header/Embed/EmbedInsightDialogContainer.js +52 -0
- package/esm/components/header/Embed/EmbedMenu.d.ts +6 -4
- package/esm/components/header/Embed/EmbedMenu.d.ts.map +1 -1
- package/esm/components/header/Embed/EmbedMenu.js +2 -6
- package/esm/components/header/InsightPickerDialog.d.ts +5 -1
- package/esm/components/header/InsightPickerDialog.d.ts.map +1 -1
- package/esm/components/header/InsightPickerDialog.js +9 -29
- package/esm/components/header/OpenControl.d.ts +7 -0
- package/esm/components/header/OpenControl.d.ts.map +1 -0
- package/esm/components/header/OpenControl.js +69 -0
- package/esm/components/header/OptionsMenu/OptionsButton.d.ts +5 -1
- package/esm/components/header/OptionsMenu/OptionsButton.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsButton.js +19 -9
- package/esm/components/header/OptionsMenu/OptionsMenu.d.ts +8 -60
- package/esm/components/header/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsMenu.js +56 -112
- package/esm/components/header/OptionsMenu/OptionsMenuItem.d.ts +3 -4
- package/esm/components/header/OptionsMenu/OptionsMenuItem.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsMenuItem.js +5 -9
- package/esm/components/header/OptionsMenu/useOptionsProps.d.ts +26 -0
- package/esm/components/header/OptionsMenu/useOptionsProps.d.ts.map +1 -0
- package/esm/components/header/OptionsMenu/useOptionsProps.js +188 -0
- package/esm/components/header/SaveAsNewReportButton.d.ts +6 -1
- package/esm/components/header/SaveAsNewReportButton.d.ts.map +1 -1
- package/esm/components/header/SaveAsNewReportButton.js +20 -10
- package/esm/components/header/SaveReportButton.d.ts +6 -1
- package/esm/components/header/SaveReportButton.d.ts.map +1 -1
- package/esm/components/header/SaveReportButton.js +41 -18
- package/esm/components/header/TimezoneDialog.d.ts +1 -1
- package/esm/components/header/TimezoneDialog.js +1 -1
- package/esm/components/header/UndoRedoButtons.d.ts +7 -0
- package/esm/components/header/UndoRedoButtons.d.ts.map +1 -0
- package/esm/components/header/UndoRedoButtons.js +31 -0
- package/esm/components/header/VisualizationInfo.d.ts +11 -0
- package/esm/components/header/VisualizationInfo.d.ts.map +1 -0
- package/esm/components/header/VisualizationInfo.js +47 -0
- package/esm/components/header/VisualizationTitle.d.ts +7 -0
- package/esm/components/header/VisualizationTitle.d.ts.map +1 -0
- package/esm/components/header/VisualizationTitle.js +36 -0
- package/esm/components/header/VisualizationsDropdown.d.ts +5 -1
- package/esm/components/header/VisualizationsDropdown.d.ts.map +1 -1
- package/esm/components/header/VisualizationsDropdown.js +7 -33
- package/esm/components/header/editorHeaderContext.d.ts +20 -0
- package/esm/components/header/editorHeaderContext.d.ts.map +1 -0
- package/esm/components/header/editorHeaderContext.js +58 -0
- package/esm/components/header/share/InsightAccess.d.ts +30 -1
- package/esm/components/header/share/InsightAccess.d.ts.map +1 -1
- package/esm/components/header/share/InsightAccess.js +81 -18
- package/esm/components/header/share/InsightAccessChip.d.ts +2 -2
- package/esm/components/header/share/InsightAccessChip.d.ts.map +1 -1
- package/esm/components/header/share/InsightAccessChip.js +3 -3
- package/esm/embedding/AnalyticalDesignerEmbedded.d.ts +1 -1
- package/esm/embedding/AnalyticalDesignerEmbedded.js +1 -1
- package/esm/embedding/editorHeaderSlotTypes.d.ts +569 -0
- package/esm/embedding/editorHeaderSlotTypes.d.ts.map +1 -0
- package/esm/embedding/editorHeaderSlotTypes.js +2 -0
- package/esm/embedding/slots.d.ts +73 -0
- package/esm/embedding/slots.d.ts.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/metrics_changed_events.d.ts +1 -1
- package/esm/postMessageApi/outgoing/metrics_changed_events.js +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.d.ts +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.js +1 -1
- package/esm/postMessageApi/sagas/control_filtering_saga.js +1 -1
- package/esm/sdk-ui-analytical-designer.d.ts +664 -0
- package/esm/selectors/editor_header_selector.d.ts +225 -0
- package/esm/selectors/editor_header_selector.d.ts.map +1 -1
- package/esm/selectors/editor_header_selector.js +8 -1
- package/esm/selectors/insight_access_selector.d.ts +185 -4
- package/esm/selectors/insight_access_selector.d.ts.map +1 -1
- package/esm/selectors/insight_access_selector.js +5 -3
- package/esm/selectors/report_title_selector.d.ts +6 -6
- package/esm/selectors/report_title_selector.d.ts.map +1 -1
- package/esm/selectors/report_title_selector.js +4 -3
- package/esm/selectors/report_visualization_selector.d.ts +4 -0
- package/esm/selectors/report_visualization_selector.d.ts.map +1 -1
- package/esm/selectors/save_report_selector.d.ts +7 -0
- package/esm/selectors/save_report_selector.d.ts.map +1 -1
- package/esm/selectors/save_report_selector.js +11 -1
- package/esm/selectors/uri_selector.js +1 -1
- package/esm/store/app_context/app_context_slices.d.ts.map +1 -1
- package/esm/store/app_context/app_context_slices.js +2 -3
- package/esm/store/app_context/session_id_reducer.d.ts +2 -3
- package/esm/store/app_context/session_id_reducer.d.ts.map +1 -1
- package/esm/store/app_context/session_id_reducer.js +2 -3
- package/esm/store/intl/intl_slice.d.ts.map +1 -1
- package/esm/store/intl/intl_slice.js +2 -3
- package/esm/translations/en-US.json +8 -0
- package/esm/utils/browser_detect.d.ts +2 -1
- package/esm/utils/browser_detect.d.ts.map +1 -1
- package/esm/utils/browser_detect.js +21 -3
- package/esm/utils/dropdown.d.ts +6 -2
- package/esm/utils/dropdown.d.ts.map +1 -1
- package/esm/utils/dropdown.js +10 -3
- package/package.json +23 -31
- package/styles/css/catalog.css +2 -2
- package/styles/css/catalog_sidebar.css +1 -1
- package/styles/css/catalog_sidebar.css.map +1 -1
- package/styles/css/editor_canvas.css +1 -1
- package/styles/css/editor_header.css +16 -1
- package/styles/css/editor_header.css.map +1 -1
- package/styles/css/main.css +20 -5
- package/styles/css/main.css.map +1 -1
- package/styles/scss/catalog.scss +2 -2
- package/styles/scss/catalog_sidebar.scss +2 -1
- package/styles/scss/editor_canvas.scss +1 -1
- package/styles/scss/editor_header.scss +20 -1
- package/esm/components/ReportTitle.d.ts +0 -2
- package/esm/components/ReportTitle.d.ts.map +0 -1
- package/esm/components/ReportTitle.js +0 -51
- package/esm/components/header/Embed/utils.d.ts +0 -4
- package/esm/components/header/Embed/utils.d.ts.map +0 -1
- package/esm/components/header/Embed/utils.js +0 -5
|
@@ -1,116 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
|
-
import { memo, useCallback, useState } from "react";
|
|
4
|
-
import { defineMessage, useIntl } from "react-intl";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import { createStructuredSelector } from "reselect";
|
|
7
3
|
import { Header, ItemsWrapper, Overlay, Separator } from "@gooddata/sdk-ui-kit";
|
|
8
|
-
import { showDialogExportCsv, showDialogExportPdf, showDialogExportReport, } from "../../../actions/export_report_actions.js";
|
|
9
|
-
import { exportReport } from "../../../actions/report_actions.js";
|
|
10
|
-
import { supportsExportToCsv, supportsExportToXlsx, } from "../../../selectors/backend_capabilities_selector.js";
|
|
11
|
-
import { AVAILABLE_HIDDEN_ACTIONS, hiddenActions } from "../../../selectors/editor_header_selector.js";
|
|
12
|
-
import { getBubbleTextProvider, getIsExportDisabled } from "../../../selectors/export_button_selector.js";
|
|
13
|
-
import { enableRawExports, isAccessibilityModeEnabled, isEnableTimezoneChange, } from "../../../selectors/feature_flag_selector.js";
|
|
14
|
-
import { getExportBubbleTextProvider, getExportRawBubbleTextProvider, getExportVisible, getIsExportCSVDisabled, getIsExportCSVRawDisabled, getIsExportPDFDisabled, getIsExportXLSXDisabled, isTableVisualization, } from "../../../selectors/options_menu_selector.js";
|
|
15
|
-
import { hasPartialDataLimitBreaks } from "../../../selectors/report_selector.js";
|
|
16
|
-
import { isEditFromKD } from "../../../selectors/route_selector.js";
|
|
17
|
-
import { openInAnalyticalDesignerAction } from "../../../store/router/router_actions.js";
|
|
18
|
-
import { TimezoneDialog } from "../TimezoneDialog.js";
|
|
19
4
|
import { OptionsMenuItem } from "./OptionsMenuItem.js";
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
5
|
+
import { OPTIONS_ITEM_IDS, normalizeOptionsItems } from "./useOptionsProps.js";
|
|
6
|
+
const MENU_ALIGN_POINTS = [{ align: "br tr" }];
|
|
7
|
+
// The class names and bubble ids of the built-in actions, which tests and styles select them by.
|
|
8
|
+
const BUILT_IN_ACTIONS = {
|
|
9
|
+
[OPTIONS_ITEM_IDS.openInAnalyticalDesigner]: {
|
|
10
|
+
className: "gd-open-in-analytical-designer s-open-in-analytical-designer",
|
|
11
|
+
bubbleId: "options.menu.open.in.analytical.designer",
|
|
12
|
+
},
|
|
13
|
+
[OPTIONS_ITEM_IDS.exportXlsx]: {
|
|
14
|
+
className: "gd-export-menu-export-xlsx s-gd-export-menu-export-xlsx gd-export-options-xlsx",
|
|
15
|
+
bubbleId: "ExportXLSXBubble",
|
|
16
|
+
},
|
|
17
|
+
[OPTIONS_ITEM_IDS.exportPdf]: {
|
|
18
|
+
className: "gd-export-menu-export-pdf s-gd-export-menu-export-pdf gd-export-options-pdf",
|
|
19
|
+
bubbleId: "ExportPDFBubble",
|
|
20
|
+
},
|
|
21
|
+
[OPTIONS_ITEM_IDS.exportCsv]: {
|
|
22
|
+
className: "gd-export-menu-export-csv s-gd-export-menu-export-csv gd-export-options-csv-formatted",
|
|
23
|
+
bubbleId: "ExportCSVBubble",
|
|
24
|
+
},
|
|
25
|
+
[OPTIONS_ITEM_IDS.exportCsvRaw]: {
|
|
26
|
+
className: "gd-export-menu-export-csv s-gd-export-menu-export-csv gd-export-options-csv-raw",
|
|
27
|
+
bubbleId: "ExportCSVRawBubble",
|
|
28
|
+
},
|
|
29
|
+
[OPTIONS_ITEM_IDS.changeTimezone]: {
|
|
30
|
+
className: "gd-options-menu-timezone s-options-menu-timezone",
|
|
31
|
+
bubbleId: "options.menu.changeTimezone",
|
|
32
|
+
},
|
|
48
33
|
};
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, [openExportCsvDialog]);
|
|
77
|
-
const onOpenInAnalyticalDesigner = useCallback(() => {
|
|
78
|
-
openInAnalyticalDesigner();
|
|
79
|
-
toggleOptionsMenu();
|
|
80
|
-
}, [openInAnalyticalDesigner, toggleOptionsMenu]);
|
|
81
|
-
const renderExportMenu = useCallback(() => {
|
|
82
|
-
const isOpenInADVisible = isEditFromKD && !hiddenActions.includes(AVAILABLE_HIDDEN_ACTIONS.OPEN_IN_ANALYTICAL_DESIGNER);
|
|
83
|
-
const formattedExportBubbleTextProvider = hasPartialDataLimitBreaks
|
|
84
|
-
? partialResultExportBubbleTextProvider
|
|
85
|
-
: exportBubbleTextProvider;
|
|
86
|
-
const isFormattedExportDisabled = (isDisabled) => isDisabled || hasPartialDataLimitBreaks;
|
|
87
|
-
return (_jsx(Overlay, { alignTo: ".s-options-button", alignPoints: [{ align: "br tr" }], className: "gd-export-menu-overlay s-gd-export-menu-overlay", closeOnMouseDrag: true, closeOnOutsideClick: true, onClose: toggleOptionsMenu, children: _jsxs(ItemsWrapper, { smallItemsSpacing: true, children: [isOpenInADVisible ? (_jsx(OptionsMenuItem, { bubbleId: "options.menu.open.in.analytical.designer", className: "gd-open-in-analytical-designer s-open-in-analytical-designer", titleId: defineMessage({ id: "options.menu.open.in.analytical.designer" }).id, isDisabled: false, onClick: onOpenInAnalyticalDesigner })) : null, isExportVisible ? (_jsxs(_Fragment, { children: [_jsx(Header, { children: intl.formatMessage({ id: "options.menu.export_data" }) }), exportToXlsxSupported ? (_jsx(OptionsMenuItem, { bubbleId: "ExportXLSXBubble", bubbleTextProvider: formattedExportBubbleTextProvider, className: "gd-export-menu-export-xlsx s-gd-export-menu-export-xlsx gd-export-options-xlsx", isDisabled: isFormattedExportDisabled(isExportXLSXDisabled), titleId: defineMessage({ id: "export.type.XLSX" }).id, onClick: showExportDialog })) : null, exportToPdfSupported && !isAccessibilityModeEnabled ? (_jsx(OptionsMenuItem, { bubbleId: "ExportPDFBubble", bubbleTextProvider: formattedExportBubbleTextProvider, className: "gd-export-menu-export-pdf s-gd-export-menu-export-pdf gd-export-options-pdf", isDisabled: isFormattedExportDisabled(isExportPDFDisabled), titleId: defineMessage({ id: "export.type.PDF" }).id, onClick: exportToPDF })) : null, exportToCsvSupported ? (enableRawExports ? (_jsxs(_Fragment, { children: [_jsx(OptionsMenuItem, { bubbleId: "ExportCSVFormattedBubble", bubbleTextProvider: formattedExportBubbleTextProvider, className: "gd-export-menu-export-csv s-gd-export-menu-export-csv gd-export-options-csv-formatted", isDisabled: isFormattedExportDisabled(isExportCSVDisabled), titleId: defineMessage({ id: "export.type.CSV.formatted" }).id, onClick: exportToCSV }), _jsx(OptionsMenuItem, { bubbleId: "ExportCSVRawBubble", bubbleTextProvider: exportRawBubbleTextProvider, className: "gd-export-menu-export-csv s-gd-export-menu-export-csv gd-export-options-csv-raw", isDisabled: isExportRawCSVDisabled, titleId: defineMessage({ id: "export.type.CSV.raw" }).id, onClick: exportToCSVRaw })] })) : (_jsx(OptionsMenuItem, { bubbleId: "ExportCSVBubble", bubbleTextProvider: formattedExportBubbleTextProvider, className: "gd-export-menu-export-csv s-gd-export-menu-export-csv gd-export-options-csv-formatted", isDisabled: isFormattedExportDisabled(isExportCSVDisabled), titleId: defineMessage({ id: "export.type.CSV" }).id, onClick: exportToCSV }))) : null] })) : null, isEnableTimezoneChange ? (_jsxs(_Fragment, { children: [isOpenInADVisible || isExportVisible ? _jsx(Separator, {}) : null, _jsx(OptionsMenuItem, { bubbleId: "options.menu.changeTimezone", className: "gd-options-menu-timezone s-options-menu-timezone", titleId: defineMessage({ id: "options.menu.changeTimezone" }).id, isDisabled: false, onClick: openTimezoneDialog })] })) : null] }) }, "OptionsMenu"));
|
|
88
|
-
}, [
|
|
89
|
-
exportBubbleTextProvider,
|
|
90
|
-
exportRawBubbleTextProvider,
|
|
91
|
-
intl,
|
|
92
|
-
isExportCSVDisabled,
|
|
93
|
-
isExportRawCSVDisabled,
|
|
94
|
-
isExportXLSXDisabled,
|
|
95
|
-
isExportPDFDisabled,
|
|
96
|
-
toggleOptionsMenu,
|
|
97
|
-
isExportVisible,
|
|
98
|
-
isEditFromKD,
|
|
99
|
-
hiddenActions,
|
|
100
|
-
exportToCsvSupported,
|
|
101
|
-
exportToXlsxSupported,
|
|
102
|
-
exportToPdfSupported,
|
|
103
|
-
enableRawExports,
|
|
104
|
-
hasPartialDataLimitBreaks,
|
|
105
|
-
onOpenInAnalyticalDesigner,
|
|
106
|
-
showExportDialog,
|
|
107
|
-
exportToCSV,
|
|
108
|
-
exportToCSVRaw,
|
|
109
|
-
exportToPDF,
|
|
110
|
-
isAccessibilityModeEnabled,
|
|
111
|
-
isEnableTimezoneChange,
|
|
112
|
-
openTimezoneDialog,
|
|
113
|
-
]);
|
|
114
|
-
return (_jsxs(_Fragment, { children: [isShowOptionsMenu ? renderExportMenu() : null, isTimezoneDialogOpen ? _jsx(TimezoneDialog, { onClose: closeTimezoneDialog }) : null] }));
|
|
115
|
-
});
|
|
116
|
-
export const OptionsMenu = connect(mapStateToProps, mapDispatchToProps)(OptionsMenuBase);
|
|
34
|
+
function getActionClasses(action) {
|
|
35
|
+
const simplifiedId = action.id.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
36
|
+
return (BUILT_IN_ACTIONS[action.id] ?? {
|
|
37
|
+
className: `s-options-menu-item-${simplifiedId}`,
|
|
38
|
+
bubbleId: `options-menu-item-${simplifiedId}`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The options menu overlay. Selecting an action closes the menu and starts the action.
|
|
43
|
+
*/
|
|
44
|
+
export function OptionsMenu({ items, onClose }) {
|
|
45
|
+
return (_jsx(Overlay, { alignTo: ".s-options-button", alignPoints: MENU_ALIGN_POINTS, className: "gd-export-menu-overlay s-gd-export-menu-overlay", closeOnMouseDrag: true, closeOnOutsideClick: true, onClose: onClose, children: _jsx(ItemsWrapper, { smallItemsSpacing: true, children: normalizeOptionsItems(items).map((item) => {
|
|
46
|
+
switch (item.type) {
|
|
47
|
+
case "section":
|
|
48
|
+
return _jsx(Header, { children: item.label }, item.id);
|
|
49
|
+
case "separator":
|
|
50
|
+
return _jsx(Separator, {}, item.id);
|
|
51
|
+
default: {
|
|
52
|
+
const { className, bubbleId } = getActionClasses(item);
|
|
53
|
+
return (_jsx(OptionsMenuItem, { bubbleId: bubbleId, className: className, label: item.label, isDisabled: item.isDisabled, disabledTooltip: item.disabledTooltip, onClick: () => {
|
|
54
|
+
onClose();
|
|
55
|
+
item.onSelect();
|
|
56
|
+
} }, item.id));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}) }) }, "OptionsMenu"));
|
|
60
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { type IntlShape } from "react-intl";
|
|
2
1
|
interface IOptionsMenuItemProps {
|
|
3
2
|
bubbleId: string;
|
|
4
|
-
|
|
3
|
+
disabledTooltip?: string;
|
|
5
4
|
className: string;
|
|
6
5
|
isDisabled: boolean;
|
|
7
|
-
|
|
6
|
+
label: string;
|
|
8
7
|
onClick: () => void;
|
|
9
8
|
}
|
|
10
|
-
export declare const OptionsMenuItem: import("react").MemoExoticComponent<({ bubbleId,
|
|
9
|
+
export declare const OptionsMenuItem: import("react").MemoExoticComponent<({ bubbleId, disabledTooltip, className, isDisabled, label, onClick, }: IOptionsMenuItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
10
|
export {};
|
|
12
11
|
//# sourceMappingURL=OptionsMenuItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/components/header/OptionsMenu/OptionsMenuItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OptionsMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/components/header/OptionsMenu/OptionsMenuItem.tsx"],"names":[],"mappings":"AAQA,UAAU,qBAAqB;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,8GAOzB,qBAAqB,6CAmCtB,CAAC"}
|
|
@@ -2,11 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
3
|
import { memo } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import { useIntl } from "react-intl";
|
|
6
5
|
import { Bubble, BubbleHoverTrigger, Item } from "@gooddata/sdk-ui-kit";
|
|
7
|
-
const
|
|
8
|
-
export const OptionsMenuItem = memo(function OptionsMenuItem({ bubbleId, bubbleTextProvider = noopString, className, isDisabled, titleId, onClick, }) {
|
|
9
|
-
const intl = useIntl();
|
|
6
|
+
export const OptionsMenuItem = memo(function OptionsMenuItem({ bubbleId, disabledTooltip, className, isDisabled, label, onClick, }) {
|
|
10
7
|
const getItemClasses = (customClassName, isDisabled) => {
|
|
11
8
|
return classNames("gd-list-item", "gd-menu-item", customClassName, { "is-disabled": isDisabled });
|
|
12
9
|
};
|
|
@@ -15,16 +12,15 @@ export const OptionsMenuItem = memo(function OptionsMenuItem({ bubbleId, bubbleT
|
|
|
15
12
|
};
|
|
16
13
|
const itemClasses = getItemClasses(className, isDisabled);
|
|
17
14
|
if (isDisabled) {
|
|
18
|
-
const button = _jsx(Item, { className: itemClasses, children:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return renderBubble(bubbleId, button, bubbleMessage);
|
|
15
|
+
const button = _jsx(Item, { className: itemClasses, children: label });
|
|
16
|
+
if (disabledTooltip) {
|
|
17
|
+
return renderBubble(bubbleId, button, disabledTooltip);
|
|
22
18
|
}
|
|
23
19
|
else {
|
|
24
20
|
return button;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
23
|
else {
|
|
28
|
-
return (_jsx(Item, { className: itemClasses, onClick: onClick, children:
|
|
24
|
+
return (_jsx(Item, { className: itemClasses, onClick: onClick, children: label }));
|
|
29
25
|
}
|
|
30
26
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type AnalyticalDesignerOptionsItem, type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerOptionsProps } from "../../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
/**
|
|
3
|
+
* Identifiers of the built-in options menu items.
|
|
4
|
+
*/
|
|
5
|
+
export declare const OPTIONS_ITEM_IDS: {
|
|
6
|
+
readonly openInAnalyticalDesigner: "openInAnalyticalDesigner";
|
|
7
|
+
readonly exportSection: "exportSection";
|
|
8
|
+
readonly exportXlsx: "exportXlsx";
|
|
9
|
+
readonly exportPdf: "exportPdf";
|
|
10
|
+
readonly exportCsv: "exportCsv";
|
|
11
|
+
readonly exportCsvRaw: "exportCsvRaw";
|
|
12
|
+
readonly timezoneSeparator: "timezoneSeparator";
|
|
13
|
+
readonly changeTimezone: "changeTimezone";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Props of the Options slot.
|
|
17
|
+
*
|
|
18
|
+
* @param onChangeTimezone - opens the time zone dialog, which the editor actions own so that it opens for a
|
|
19
|
+
* host's own Options menu too
|
|
20
|
+
*/
|
|
21
|
+
export declare function useOptionsProps(context: IAnalyticalDesignerHeaderContext, onChangeTimezone: () => void): IAnalyticalDesignerOptionsProps;
|
|
22
|
+
/**
|
|
23
|
+
* Drops the sections with no action after them and the separators that separate nothing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeOptionsItems(items: readonly AnalyticalDesignerOptionsItem[]): AnalyticalDesignerOptionsItem[];
|
|
26
|
+
//# sourceMappingURL=useOptionsProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOptionsProps.d.ts","sourceRoot":"","sources":["../../../../src/components/header/OptionsMenu/useOptionsProps.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACvC,MAAM,6CAA6C,CAAC;AA0BrD;;GAEG;AACH,eAAO,MAAM,gBAAgB;aACzB,wBAAwB,EAAE,0BAA0B;aACpD,aAAa,EAAE,eAAe;aAC9B,UAAU,EAAE,YAAY;aACxB,SAAS,EAAE,WAAW;aACtB,SAAS,EAAE,WAAW;aACtB,YAAY,EAAE,cAAc;aAC5B,iBAAiB,EAAE,mBAAmB;aACtC,cAAc,EAAE,gBAAgB;CAC1B,CAAC;AA4BX;;;;;GAKG;AACH,wBAAgB,eAAe,CAC3B,OAAO,EAAE,gCAAgC,EACzC,gBAAgB,EAAE,MAAM,IAAI,GAC7B,+BAA+B,CA4IjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,SAAS,6BAA6B,EAAE,GAChD,6BAA6B,EAAE,CAkBjC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { defineMessage, defineMessages, useIntl } from "react-intl";
|
|
4
|
+
import { useSelector } from "react-redux";
|
|
5
|
+
import { showDialogExportCsv, showDialogExportPdf, showDialogExportReport, } from "../../../actions/export_report_actions.js";
|
|
6
|
+
import { supportsExportToCsv, supportsExportToXlsx, } from "../../../selectors/backend_capabilities_selector.js";
|
|
7
|
+
import { isOpenInAnalyticalDesignerVisible } from "../../../selectors/editor_header_selector.js";
|
|
8
|
+
import { enableRawExports, isAccessibilityModeEnabled, isEnableTimezoneChange, } from "../../../selectors/feature_flag_selector.js";
|
|
9
|
+
import { getExportBubbleTextProvider, getExportRawBubbleTextProvider, getExportVisible, getIsExportCSVDisabled, getIsExportCSVRawDisabled, getIsExportPDFDisabled, getIsExportXLSXDisabled, isTableVisualization, } from "../../../selectors/options_menu_selector.js";
|
|
10
|
+
import { hasPartialDataLimitBreaks } from "../../../selectors/report_selector.js";
|
|
11
|
+
import { openInAnalyticalDesignerAction } from "../../../store/router/router_actions.js";
|
|
12
|
+
import { useGuardedCallback } from "../editorHeaderContext.js";
|
|
13
|
+
/**
|
|
14
|
+
* Identifiers of the built-in options menu items.
|
|
15
|
+
*/
|
|
16
|
+
export const OPTIONS_ITEM_IDS = {
|
|
17
|
+
openInAnalyticalDesigner: "openInAnalyticalDesigner",
|
|
18
|
+
exportSection: "exportSection",
|
|
19
|
+
exportXlsx: "exportXlsx",
|
|
20
|
+
exportPdf: "exportPdf",
|
|
21
|
+
exportCsv: "exportCsv",
|
|
22
|
+
exportCsvRaw: "exportCsvRaw",
|
|
23
|
+
timezoneSeparator: "timezoneSeparator",
|
|
24
|
+
changeTimezone: "changeTimezone",
|
|
25
|
+
};
|
|
26
|
+
const partialResultMessage = defineMessage({ id: "options.menu.export_data.partial_result_disabled" });
|
|
27
|
+
const csvMessages = defineMessages({
|
|
28
|
+
csv: { id: "export.type.CSV" },
|
|
29
|
+
csvFormatted: { id: "export.type.CSV.formatted" },
|
|
30
|
+
});
|
|
31
|
+
// Formatted exports are refused while the result is partial; raw exports are not.
|
|
32
|
+
const isXlsxAllowed = (state) => !getIsExportXLSXDisabled(state) && !hasPartialDataLimitBreaks(state);
|
|
33
|
+
const isPdfAllowed = (state) => !getIsExportPDFDisabled(state) && !hasPartialDataLimitBreaks(state);
|
|
34
|
+
const isCsvAllowed = (state) => !getIsExportCSVDisabled(state) && !hasPartialDataLimitBreaks(state);
|
|
35
|
+
const isCsvRawAllowed = (state) => !getIsExportCSVRawDisabled(state);
|
|
36
|
+
const runExportXlsx = (dispatch) => dispatch(showDialogExportReport());
|
|
37
|
+
const runExportPdf = (dispatch) => dispatch(showDialogExportPdf());
|
|
38
|
+
const runExportCsv = (dispatch) => dispatch(showDialogExportCsv("formatted"));
|
|
39
|
+
const runExportCsvRaw = (dispatch) => dispatch(showDialogExportCsv("raw"));
|
|
40
|
+
const runOpenInAnalyticalDesigner = (dispatch) => dispatch(openInAnalyticalDesignerAction());
|
|
41
|
+
const tooltip = (text) => (text ? { disabledTooltip: text } : {});
|
|
42
|
+
const noBubbleText = (_intl) => "";
|
|
43
|
+
/**
|
|
44
|
+
* Props of the Options slot.
|
|
45
|
+
*
|
|
46
|
+
* @param onChangeTimezone - opens the time zone dialog, which the editor actions own so that it opens for a
|
|
47
|
+
* host's own Options menu too
|
|
48
|
+
*/
|
|
49
|
+
export function useOptionsProps(context, onChangeTimezone) {
|
|
50
|
+
const intl = useIntl();
|
|
51
|
+
const exportBubbleTextProvider = useSelector(getExportBubbleTextProvider) ?? noBubbleText;
|
|
52
|
+
const exportRawBubbleTextProvider = useSelector(getExportRawBubbleTextProvider) ?? noBubbleText;
|
|
53
|
+
const isExportVisible = useSelector(getExportVisible);
|
|
54
|
+
const isExportCSVDisabled = useSelector(getIsExportCSVDisabled);
|
|
55
|
+
const isExportRawCSVDisabled = useSelector(getIsExportCSVRawDisabled);
|
|
56
|
+
const isExportXLSXDisabled = useSelector(getIsExportXLSXDisabled);
|
|
57
|
+
const isExportPDFDisabled = useSelector(getIsExportPDFDisabled);
|
|
58
|
+
const exportToCsvSupported = useSelector(supportsExportToCsv);
|
|
59
|
+
const exportToXlsxSupported = useSelector(supportsExportToXlsx);
|
|
60
|
+
const exportToPdfSupported = useSelector(isTableVisualization);
|
|
61
|
+
const isRawExportEnabled = useSelector(enableRawExports);
|
|
62
|
+
const isPartialResult = useSelector(hasPartialDataLimitBreaks);
|
|
63
|
+
const isAccessibilityMode = useSelector(isAccessibilityModeEnabled);
|
|
64
|
+
const isTimezoneChangeEnabled = useSelector(isEnableTimezoneChange);
|
|
65
|
+
const isOpenInAnalyticalDesignerShown = useSelector(isOpenInAnalyticalDesignerVisible);
|
|
66
|
+
const onExportXlsx = useGuardedCallback(isXlsxAllowed, runExportXlsx);
|
|
67
|
+
const onExportPdf = useGuardedCallback(isPdfAllowed, runExportPdf);
|
|
68
|
+
const onExportCsv = useGuardedCallback(isCsvAllowed, runExportCsv);
|
|
69
|
+
const onExportCsvRaw = useGuardedCallback(isCsvRawAllowed, runExportCsvRaw);
|
|
70
|
+
const onOpenInAnalyticalDesigner = useGuardedCallback(isOpenInAnalyticalDesignerVisible, runOpenInAnalyticalDesigner);
|
|
71
|
+
const items = useMemo(() => {
|
|
72
|
+
const formattedTooltip = isPartialResult
|
|
73
|
+
? intl.formatMessage(partialResultMessage)
|
|
74
|
+
: exportBubbleTextProvider(intl);
|
|
75
|
+
const result = [];
|
|
76
|
+
if (isOpenInAnalyticalDesignerShown) {
|
|
77
|
+
result.push({
|
|
78
|
+
type: "action",
|
|
79
|
+
id: OPTIONS_ITEM_IDS.openInAnalyticalDesigner,
|
|
80
|
+
label: intl.formatMessage({ id: "options.menu.open.in.analytical.designer" }),
|
|
81
|
+
isDisabled: false,
|
|
82
|
+
onSelect: onOpenInAnalyticalDesigner,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (isExportVisible) {
|
|
86
|
+
result.push({
|
|
87
|
+
type: "section",
|
|
88
|
+
id: OPTIONS_ITEM_IDS.exportSection,
|
|
89
|
+
label: intl.formatMessage({ id: "options.menu.export_data" }),
|
|
90
|
+
});
|
|
91
|
+
if (exportToXlsxSupported) {
|
|
92
|
+
result.push({
|
|
93
|
+
type: "action",
|
|
94
|
+
id: OPTIONS_ITEM_IDS.exportXlsx,
|
|
95
|
+
label: intl.formatMessage({ id: "export.type.XLSX" }),
|
|
96
|
+
isDisabled: isExportXLSXDisabled || isPartialResult,
|
|
97
|
+
...tooltip(formattedTooltip),
|
|
98
|
+
onSelect: onExportXlsx,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (exportToPdfSupported && !isAccessibilityMode) {
|
|
102
|
+
result.push({
|
|
103
|
+
type: "action",
|
|
104
|
+
id: OPTIONS_ITEM_IDS.exportPdf,
|
|
105
|
+
label: intl.formatMessage({ id: "export.type.PDF" }),
|
|
106
|
+
isDisabled: isExportPDFDisabled || isPartialResult,
|
|
107
|
+
...tooltip(formattedTooltip),
|
|
108
|
+
onSelect: onExportPdf,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (exportToCsvSupported) {
|
|
112
|
+
result.push({
|
|
113
|
+
type: "action",
|
|
114
|
+
id: OPTIONS_ITEM_IDS.exportCsv,
|
|
115
|
+
label: intl.formatMessage(isRawExportEnabled ? csvMessages.csvFormatted : csvMessages.csv),
|
|
116
|
+
isDisabled: isExportCSVDisabled || isPartialResult,
|
|
117
|
+
...tooltip(formattedTooltip),
|
|
118
|
+
onSelect: onExportCsv,
|
|
119
|
+
});
|
|
120
|
+
if (isRawExportEnabled) {
|
|
121
|
+
result.push({
|
|
122
|
+
type: "action",
|
|
123
|
+
id: OPTIONS_ITEM_IDS.exportCsvRaw,
|
|
124
|
+
label: intl.formatMessage({ id: "export.type.CSV.raw" }),
|
|
125
|
+
isDisabled: isExportRawCSVDisabled,
|
|
126
|
+
...tooltip(exportRawBubbleTextProvider(intl)),
|
|
127
|
+
onSelect: onExportCsvRaw,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (isTimezoneChangeEnabled) {
|
|
133
|
+
result.push({ type: "separator", id: OPTIONS_ITEM_IDS.timezoneSeparator }, {
|
|
134
|
+
type: "action",
|
|
135
|
+
id: OPTIONS_ITEM_IDS.changeTimezone,
|
|
136
|
+
label: intl.formatMessage({ id: "options.menu.changeTimezone" }),
|
|
137
|
+
isDisabled: false,
|
|
138
|
+
onSelect: onChangeTimezone,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return normalizeOptionsItems(result);
|
|
142
|
+
}, [
|
|
143
|
+
intl,
|
|
144
|
+
exportBubbleTextProvider,
|
|
145
|
+
exportRawBubbleTextProvider,
|
|
146
|
+
isExportVisible,
|
|
147
|
+
isExportCSVDisabled,
|
|
148
|
+
isExportRawCSVDisabled,
|
|
149
|
+
isExportXLSXDisabled,
|
|
150
|
+
isExportPDFDisabled,
|
|
151
|
+
exportToCsvSupported,
|
|
152
|
+
exportToXlsxSupported,
|
|
153
|
+
exportToPdfSupported,
|
|
154
|
+
isRawExportEnabled,
|
|
155
|
+
isPartialResult,
|
|
156
|
+
isAccessibilityMode,
|
|
157
|
+
isTimezoneChangeEnabled,
|
|
158
|
+
isOpenInAnalyticalDesignerShown,
|
|
159
|
+
onExportXlsx,
|
|
160
|
+
onExportPdf,
|
|
161
|
+
onExportCsv,
|
|
162
|
+
onExportCsvRaw,
|
|
163
|
+
onOpenInAnalyticalDesigner,
|
|
164
|
+
onChangeTimezone,
|
|
165
|
+
]);
|
|
166
|
+
const label = "⋯";
|
|
167
|
+
const accessibleName = intl.formatMessage({ id: "options.menu.ariaLabel" });
|
|
168
|
+
return useMemo(() => ({ ...context, label, accessibleName, isDisabled: false, items }), [context, accessibleName, items]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Drops the sections with no action after them and the separators that separate nothing.
|
|
172
|
+
*/
|
|
173
|
+
export function normalizeOptionsItems(items) {
|
|
174
|
+
// a section labels the actions up to the next section or separator
|
|
175
|
+
const withoutEmptySections = items.filter((item, index) => item.type !== "section" || items[index + 1]?.type === "action");
|
|
176
|
+
const result = [];
|
|
177
|
+
for (const item of withoutEmptySections) {
|
|
178
|
+
const previous = result[result.length - 1];
|
|
179
|
+
if (item.type === "separator" && (!previous || previous.type === "separator")) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
result.push(item);
|
|
183
|
+
}
|
|
184
|
+
while (result[result.length - 1]?.type === "separator") {
|
|
185
|
+
result.pop();
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerSaveAsProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
export declare function useSaveAsProps(context: IAnalyticalDesignerHeaderContext): IAnalyticalDesignerSaveAsProps;
|
|
3
|
+
/**
|
|
4
|
+
* Default of the SaveAs slot.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DefaultSaveAs({ label, isDisabled, onSaveAs }: IAnalyticalDesignerSaveAsProps): import("react/jsx-runtime").JSX.Element;
|
|
2
7
|
//# sourceMappingURL=SaveAsNewReportButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveAsNewReportButton.d.ts","sourceRoot":"","sources":["../../../src/components/header/SaveAsNewReportButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SaveAsNewReportButton.d.ts","sourceRoot":"","sources":["../../../src/components/header/SaveAsNewReportButton.tsx"],"names":[],"mappings":"AAUA,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACtC,MAAM,0CAA0C,CAAC;AAclD,wBAAgB,cAAc,CAAC,OAAO,EAAE,gCAAgC,GAAG,8BAA8B,CAWxG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,8BAA8B,2CAS5F"}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { defineMessages, useIntl } from "react-intl";
|
|
5
|
+
import { useSelector } from "react-redux";
|
|
6
6
|
import { Button } from "@gooddata/sdk-ui-kit";
|
|
7
7
|
import { saveReportCheck } from "../../actions/save_actions.js";
|
|
8
8
|
import { isSaveAsNewDisabledSelector, isSavingAsNewSelector } from "../../selectors/save_report_selector.js";
|
|
9
|
-
|
|
9
|
+
import { useGuardedCallback } from "./editorHeaderContext.js";
|
|
10
|
+
const messages = defineMessages({
|
|
11
|
+
saveAsNew: { id: "save_as_new" },
|
|
12
|
+
saving: { id: "saving" },
|
|
13
|
+
});
|
|
14
|
+
const canSaveAs = (state) => !isSaveAsNewDisabledSelector(state);
|
|
15
|
+
const runSaveAs = (dispatch) => dispatch(saveReportCheck(true));
|
|
16
|
+
export function useSaveAsProps(context) {
|
|
10
17
|
const intl = useIntl();
|
|
11
|
-
const dispatch = useDispatch();
|
|
12
18
|
const isSaving = useSelector(isSavingAsNewSelector);
|
|
13
19
|
const isDisabled = useSelector(isSaveAsNewDisabledSelector);
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const onSaveAs = useGuardedCallback(canSaveAs, runSaveAs);
|
|
21
|
+
const label = intl.formatMessage(isSaving ? messages.saving : messages.saveAsNew);
|
|
22
|
+
return useMemo(() => ({ ...context, label, isDisabled, isSaving, onSaveAs }), [context, label, isDisabled, isSaving, onSaveAs]);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Default of the SaveAs slot.
|
|
26
|
+
*/
|
|
27
|
+
export function DefaultSaveAs({ label, isDisabled, onSaveAs }) {
|
|
28
|
+
return (_jsx(Button, { className: "s-save-as-new-button save-as-new-button gd-button-secondary editor-header-item", onClick: onSaveAs, value: label, disabled: isDisabled }));
|
|
19
29
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerSaveProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
export declare function useSaveProps(context: IAnalyticalDesignerHeaderContext): IAnalyticalDesignerSaveProps;
|
|
3
|
+
/**
|
|
4
|
+
* Default of the Save slot.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DefaultSave({ label, isDisabled, disabledTooltip, onSave }: IAnalyticalDesignerSaveProps): import("react/jsx-runtime").JSX.Element;
|
|
2
7
|
//# sourceMappingURL=SaveReportButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveReportButton.d.ts","sourceRoot":"","sources":["../../../src/components/header/SaveReportButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SaveReportButton.d.ts","sourceRoot":"","sources":["../../../src/components/header/SaveReportButton.tsx"],"names":[],"mappings":"AAUA,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACpC,MAAM,0CAA0C,CAAC;AAsBlD,wBAAgB,YAAY,CAAC,OAAO,EAAE,gCAAgC,GAAG,4BAA4B,CAwBpG;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,4BAA4B,2CAsBvG"}
|
|
@@ -1,29 +1,52 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { defineMessages, useIntl } from "react-intl";
|
|
5
|
+
import { useSelector } from "react-redux";
|
|
5
6
|
import { Bubble, BubbleHoverTrigger, Button } from "@gooddata/sdk-ui-kit";
|
|
6
7
|
import { saveReportCheck, saveReportFromKD } from "../../actions/save_actions.js";
|
|
7
8
|
import { saveReportSelector } from "../../selectors/save_report_selector.js";
|
|
8
|
-
|
|
9
|
+
import { useGuardedCallback } from "./editorHeaderContext.js";
|
|
10
|
+
const BUBBLE_ALIGN_POINTS = [{ align: "bc tr", offset: { x: 0, y: 10 } }];
|
|
11
|
+
const messages = defineMessages({
|
|
12
|
+
save: { id: "save" },
|
|
13
|
+
saving: { id: "saving" },
|
|
14
|
+
});
|
|
15
|
+
const canSave = (state) => !saveReportSelector(state).isDisabled;
|
|
16
|
+
const runSave = (dispatch, state) => {
|
|
17
|
+
if (saveReportSelector(state).displaySaveInsightFromKDDialog) {
|
|
18
|
+
dispatch(saveReportFromKD());
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
dispatch(saveReportCheck(false));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export function useSaveProps(context) {
|
|
9
25
|
const intl = useIntl();
|
|
10
|
-
const dispatch = useDispatch();
|
|
11
26
|
const isSaving = useSelector((state) => saveReportSelector(state).isSaving);
|
|
12
27
|
const isDisabled = useSelector((state) => saveReportSelector(state).isDisabled);
|
|
13
|
-
const displaySaveInsightFromKDDialog = useSelector((state) => saveReportSelector(state).displaySaveInsightFromKDDialog);
|
|
14
28
|
const showDisabledTooltip = useSelector((state) => saveReportSelector(state).showDisabledTooltip);
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const onSave = useGuardedCallback(canSave, runSave);
|
|
30
|
+
const label = intl.formatMessage(isSaving ? messages.saving : messages.save);
|
|
31
|
+
const disabledTooltip = showDisabledTooltip
|
|
32
|
+
? intl.formatMessage({ id: "save.disabledTooltip.executionTimestamp" })
|
|
33
|
+
: undefined;
|
|
34
|
+
return useMemo(() => ({
|
|
35
|
+
...context,
|
|
36
|
+
label,
|
|
37
|
+
isDisabled,
|
|
38
|
+
isSaving,
|
|
39
|
+
...(disabledTooltip ? { disabledTooltip } : {}),
|
|
40
|
+
onSave,
|
|
41
|
+
}), [context, label, isDisabled, isSaving, disabledTooltip, onSave]);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Default of the Save slot.
|
|
45
|
+
*/
|
|
46
|
+
export function DefaultSave({ label, isDisabled, disabledTooltip, onSave }) {
|
|
47
|
+
const saveButton = (_jsx(Button, { className: "s-save-button save-button gd-button-action editor-header-item", onClick: onSave, value: label, disabled: isDisabled }));
|
|
48
|
+
if (!disabledTooltip) {
|
|
49
|
+
return saveButton;
|
|
27
50
|
}
|
|
28
|
-
return
|
|
51
|
+
return (_jsxs(BubbleHoverTrigger, { children: [saveButton, _jsx(Bubble, { className: "bubble-primary", alignPoints: BUBBLE_ALIGN_POINTS, children: disabledTooltip })] }));
|
|
29
52
|
}
|
|
@@ -6,7 +6,7 @@ export interface ITimezoneDialogProps {
|
|
|
6
6
|
* Dialog for the ad-hoc, session-only change of the insight timezone in Analytical Designer.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* Mirrors the KD
|
|
9
|
+
* Mirrors the KD `TimezoneDialog`: hosts the shared timezone picker with "Default" (clears
|
|
10
10
|
* the override so the workspace configuration applies again) and "From browser" special items.
|
|
11
11
|
* Applying a selection resolves the browser-detected sentinel locally so the session-only Redux
|
|
12
12
|
* state always stores a concrete IANA timezone ID. The override is never persisted with the insight.
|
|
@@ -12,7 +12,7 @@ import { getTimezoneOverride } from "../../selectors/timezone_override_selectors
|
|
|
12
12
|
* Dialog for the ad-hoc, session-only change of the insight timezone in Analytical Designer.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Mirrors the KD
|
|
15
|
+
* Mirrors the KD `TimezoneDialog`: hosts the shared timezone picker with "Default" (clears
|
|
16
16
|
* the override so the workspace configuration applies again) and "From browser" special items.
|
|
17
17
|
* Applying a selection resolves the browser-detected sentinel locally so the session-only Redux
|
|
18
18
|
* state always stores a concrete IANA timezone ID. The override is never persisted with the insight.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerUndoRedoProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
export declare function useUndoRedoProps(context: IAnalyticalDesignerHeaderContext): IAnalyticalDesignerUndoRedoProps;
|
|
3
|
+
/**
|
|
4
|
+
* Default of the UndoRedo slot: both buttons in one group, with their own tooltips and accessible names.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DefaultUndoRedo({ isUndoDisabled, isRedoDisabled, onUndo, onRedo, }: IAnalyticalDesignerUndoRedoProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=UndoRedoButtons.d.ts.map
|