@gooddata/sdk-ui-dashboard 11.52.0 → 11.53.0-alpha.1
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 +59 -9
- package/esm/__version.d.ts +1 -1
- package/esm/__version.d.ts.map +1 -1
- package/esm/__version.js +1 -1
- package/esm/index.d.ts +3 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -4
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/resolveDashboardConfig.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/resolveDashboardConfig.js +2 -0
- package/esm/model/store/config/configSelectors.d.ts +12 -0
- package/esm/model/store/config/configSelectors.d.ts.map +1 -1
- package/esm/model/store/config/configSelectors.js +16 -0
- package/esm/model/store/drill/drillReducers.d.ts.map +1 -1
- package/esm/model/store/drill/drillReducers.js +2 -1
- package/esm/model/types/commonTypes.d.ts +21 -0
- package/esm/model/types/commonTypes.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js +4 -3
- package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.d.ts +1 -5
- package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/state/AlertingDialogStateProvider.js +1 -5
- package/esm/presentation/automations/alerting/state/useAlertFormState.js +2 -2
- package/esm/presentation/automations/alerting/types.d.ts +1 -15
- package/esm/presentation/automations/alerting/types.d.ts.map +1 -1
- package/esm/presentation/automations/contexts/AlertingDialogContext.d.ts +0 -26
- package/esm/presentation/automations/contexts/AlertingDialogContext.d.ts.map +1 -1
- package/esm/presentation/automations/contexts/AlertingDialogContext.js +0 -26
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.d.ts +0 -9
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.d.ts.map +1 -1
- package/esm/presentation/automations/contexts/ScheduledEmailDialogContext.js +0 -9
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +4 -3
- package/esm/presentation/automations/scheduledEmail/types.d.ts +1 -15
- package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
- package/esm/presentation/automations/shared/filters/conversions.d.ts +6 -6
- package/esm/presentation/automations/shared/filters/conversions.d.ts.map +1 -1
- package/esm/presentation/automations/shared/filters/conversions.js +48 -30
- package/esm/presentation/automations/shared/filters/index.d.ts +1 -1
- package/esm/presentation/automations/shared/filters/index.d.ts.map +1 -1
- package/esm/presentation/automations/shared/filters/index.js +1 -1
- package/esm/presentation/dashboard/DashboardHeader/DashboardHeader.d.ts +1 -1
- package/esm/presentation/dashboard/DashboardHeader/DashboardHeader.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardHeader/DashboardHeader.js +10 -0
- package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.js +5 -2
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightList.d.ts +2 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightList.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightList.js +2 -2
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListCore.d.ts +1 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListCore.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListCore.js +3 -3
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListItemWrapper.d.ts +2 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListItemWrapper.d.ts.map +1 -1
- package/esm/presentation/dashboard/DashboardSidebar/DraggableInsightList/DraggableInsightListItemWrapper.js +3 -2
- package/esm/presentation/dashboard/components/DashboardInner.d.ts.map +1 -1
- package/esm/presentation/dashboard/components/DashboardInner.js +9 -5
- package/esm/presentation/dashboard/components/DashboardSkeleton.d.ts +5 -0
- package/esm/presentation/dashboard/components/DashboardSkeleton.d.ts.map +1 -0
- package/esm/presentation/dashboard/components/DashboardSkeleton.js +30 -0
- package/esm/presentation/dragAndDrop/WrapInsightListItemWithDrag.d.ts +1 -1
- package/esm/presentation/dragAndDrop/WrapInsightListItemWithDrag.d.ts.map +1 -1
- package/esm/presentation/dragAndDrop/WrapInsightListItemWithDrag.js +3 -3
- package/esm/presentation/dragAndDrop/draggableWidget/DraggableInsightListItem.d.ts +1 -0
- package/esm/presentation/dragAndDrop/draggableWidget/DraggableInsightListItem.d.ts.map +1 -1
- package/esm/presentation/dragAndDrop/draggableWidget/DraggableInsightListItem.js +2 -2
- package/esm/presentation/dragAndDrop/types.d.ts +2 -0
- package/esm/presentation/dragAndDrop/types.d.ts.map +1 -1
- package/esm/presentation/filterBar/filterBar/DefaultFilterBarContainer.d.ts.map +1 -1
- package/esm/presentation/filterBar/filterBar/DefaultFilterBarContainer.js +7 -1
- package/esm/presentation/insightList/types.d.ts +1 -0
- package/esm/presentation/insightList/types.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/cancelButton/DefaultCancelButton.d.ts +1 -1
- package/esm/presentation/topBar/buttonBar/button/cancelButton/DefaultCancelButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/cancelButton/DefaultCancelButton.js +3 -2
- package/esm/presentation/topBar/buttonBar/button/cancelButton/types.d.ts +1 -0
- package/esm/presentation/topBar/buttonBar/button/cancelButton/types.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/cancelButton/types.js +1 -1
- package/esm/presentation/topBar/buttonBar/button/editButton/DefaultEditButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/editButton/DefaultEditButton.js +3 -2
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/DefaultSaveAsNewButton.d.ts +1 -1
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/DefaultSaveAsNewButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/DefaultSaveAsNewButton.js +5 -2
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/types.d.ts +1 -0
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/types.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/saveAsButton/types.js +1 -1
- package/esm/presentation/topBar/buttonBar/button/saveButton/DefaultSaveButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/saveButton/DefaultSaveButton.js +3 -1
- package/esm/presentation/topBar/buttonBar/button/settingButton/DefaultSettingButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/settingButton/DefaultSettingButton.js +3 -1
- package/esm/presentation/topBar/buttonBar/button/shareButton/DefaultShareButton.d.ts +1 -1
- package/esm/presentation/topBar/buttonBar/button/shareButton/DefaultShareButton.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/shareButton/DefaultShareButton.js +5 -2
- package/esm/presentation/topBar/buttonBar/button/shareButton/types.d.ts +1 -0
- package/esm/presentation/topBar/buttonBar/button/shareButton/types.d.ts.map +1 -1
- package/esm/presentation/topBar/buttonBar/button/shareButton/types.js +1 -0
- package/esm/presentation/topBar/menuButton/DefaultMenuButton.d.ts +1 -1
- package/esm/presentation/topBar/menuButton/DefaultMenuButton.d.ts.map +1 -1
- package/esm/presentation/topBar/menuButton/DefaultMenuButton.js +7 -2
- package/esm/presentation/topBar/menuButton/types.d.ts +4 -0
- package/esm/presentation/topBar/menuButton/types.d.ts.map +1 -1
- package/esm/presentation/widget/common/configuration/DateDatasetDropdown.d.ts.map +1 -1
- package/esm/presentation/widget/common/configuration/DateDatasetDropdown.js +93 -27
- package/esm/presentation/widget/common/configuration/utils.d.ts +3 -0
- package/esm/presentation/widget/common/configuration/utils.d.ts.map +1 -1
- package/esm/presentation/widget/common/configuration/utils.js +14 -2
- package/esm/sdk-ui-dashboard.d.ts +49 -96
- package/package.json +21 -21
- package/styles/css/dashboard.css +118 -0
- package/styles/css/dashboard.css.map +1 -1
- package/styles/css/main.css +118 -44
- package/styles/css/main.css.map +1 -1
- package/styles/scss/dashboard.scss +96 -0
|
@@ -7,6 +7,7 @@ import { messages } from "../../../../../locales.js";
|
|
|
7
7
|
import { saveDashboard } from "../../../../../model/commands/dashboard.js";
|
|
8
8
|
import { useDashboardDispatch, useDashboardSelector, } from "../../../../../model/react/DashboardStoreProvider.js";
|
|
9
9
|
import { dispatchAndWaitFor } from "../../../../../model/store/_infra/dispatchAndWaitFor.js";
|
|
10
|
+
import { selectIsAiGenerating } from "../../../../../model/store/config/configSelectors.js";
|
|
10
11
|
import { selectIsDashboardDirty } from "../../../../../model/store/meta/metaSelectors.js";
|
|
11
12
|
import { selectIsInEditMode } from "../../../../../model/store/renderMode/renderModeSelectors.js";
|
|
12
13
|
import { selectIsDashboardSaving } from "../../../../../model/store/saving/savingSelectors.js";
|
|
@@ -34,6 +35,7 @@ export function useSaveButtonProps() {
|
|
|
34
35
|
});
|
|
35
36
|
}, [dispatch]);
|
|
36
37
|
const isEditing = useDashboardSelector(selectIsInEditMode);
|
|
38
|
+
const isAiGenerating = useDashboardSelector(selectIsAiGenerating);
|
|
37
39
|
const isSavingDashboard = useDashboardSelector(selectIsDashboardSaving);
|
|
38
40
|
const isPrivateDashboard = useDashboardSelector(selectIsPrivateDashboard);
|
|
39
41
|
const isEmptyDashboard = !useDashboardSelector(selectLayoutHasAnalyticalWidgets); // we need at least one non-custom widget there
|
|
@@ -41,7 +43,7 @@ export function useSaveButtonProps() {
|
|
|
41
43
|
const isDashboardDirty = useDashboardSelector(selectIsDashboardDirty);
|
|
42
44
|
const isSaving = isSavingDashboard || optimisticIsSaving;
|
|
43
45
|
const isVisible = isEditing;
|
|
44
|
-
const isEnabled = isDashboardDirty && !isEmptyDashboard && canSaveDashboard;
|
|
46
|
+
const isEnabled = isDashboardDirty && !isEmptyDashboard && canSaveDashboard && !isAiGenerating;
|
|
45
47
|
let buttonTitle = messages.controlButtonsSaveAndPublishTitle;
|
|
46
48
|
if (isPrivateDashboard) {
|
|
47
49
|
buttonTitle = messages.controlButtonsSaveAsPrivateTitle;
|
package/esm/presentation/topBar/buttonBar/button/settingButton/DefaultSettingButton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSettingButton.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/settingButton/DefaultSettingButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultSettingButton.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/settingButton/DefaultSettingButton.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,mBAAmB,CAuB3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACX,cAAc,EACjB,EAAE,mBAAmB,kDAuBrB"}
|
|
@@ -5,6 +5,7 @@ import { FormattedMessage, useIntl } from "react-intl";
|
|
|
5
5
|
import { UiIconButton, UiTooltip, useMediaQuery } from "@gooddata/sdk-ui-kit";
|
|
6
6
|
import { messages } from "../../../../../locales.js";
|
|
7
7
|
import { useDashboardDispatch, useDashboardSelector, } from "../../../../../model/react/DashboardStoreProvider.js";
|
|
8
|
+
import { selectIsAiGenerating } from "../../../../../model/store/config/configSelectors.js";
|
|
8
9
|
import { selectIsInEditMode } from "../../../../../model/store/renderMode/renderModeSelectors.js";
|
|
9
10
|
import { selectIsDashboardSaving } from "../../../../../model/store/saving/savingSelectors.js";
|
|
10
11
|
import { uiActions } from "../../../../../model/store/ui/index.js";
|
|
@@ -17,8 +18,9 @@ export function useSettingButtonProps() {
|
|
|
17
18
|
const onSettingClick = useCallback(() => dispatch(uiActions.openSettingsDialog()), [dispatch]);
|
|
18
19
|
const isEditing = useDashboardSelector(selectIsInEditMode);
|
|
19
20
|
const isSaving = useDashboardSelector(selectIsDashboardSaving);
|
|
21
|
+
const isAiGenerating = useDashboardSelector(selectIsAiGenerating);
|
|
20
22
|
const isVisible = isEditing && !isSmall;
|
|
21
|
-
const isEnabled =
|
|
23
|
+
const isEnabled = !isAiGenerating;
|
|
22
24
|
const buttonValue = messages.controlButtonsSettingValue;
|
|
23
25
|
const buttonTitle = messages.controlButtonsSettingTitle;
|
|
24
26
|
return {
|
|
@@ -7,5 +7,5 @@ export declare function useShareButtonProps(): IShareButtonProps;
|
|
|
7
7
|
/**
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
|
-
export declare function DefaultShareButton({ isVisible, onShareButtonClick }: IShareButtonProps): ReactElement | null;
|
|
10
|
+
export declare function DefaultShareButton({ isVisible, isEnabled, onShareButtonClick }: IShareButtonProps): ReactElement | null;
|
|
11
11
|
//# sourceMappingURL=DefaultShareButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultShareButton.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/shareButton/DefaultShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultShareButton.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/shareButton/DefaultShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,OAAO,CAAC;AAiBvD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,iBAAiB,CAWvD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAC/B,SAAS,EACT,SAAS,EACT,kBAAkB,EACrB,EAAE,iBAAiB,GAAG,YAAY,GAAG,IAAI,CAkCzC"}
|
|
@@ -5,6 +5,7 @@ import cx from "classnames";
|
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { Button, UiTooltip } from "@gooddata/sdk-ui-kit";
|
|
7
7
|
import { useDashboardDispatch, useDashboardSelector, } from "../../../../../model/react/DashboardStoreProvider.js";
|
|
8
|
+
import { selectIsAiGenerating } from "../../../../../model/store/config/configSelectors.js";
|
|
8
9
|
import { selectIsShareButtonVisible } from "../../../../../model/store/topBar/topBarSelectors.js";
|
|
9
10
|
import { uiActions } from "../../../../../model/store/ui/index.js";
|
|
10
11
|
import { selectDashboardDensity } from "../../../../../model/store/ui/uiSelectors.js";
|
|
@@ -16,22 +17,24 @@ export function useShareButtonProps() {
|
|
|
16
17
|
const dispatch = useDashboardDispatch();
|
|
17
18
|
const onShareButtonClick = useCallback(() => dispatch(uiActions.openShareDialog()), [dispatch]);
|
|
18
19
|
const isVisible = useDashboardSelector(selectIsShareButtonVisible);
|
|
20
|
+
const isAiGenerating = useDashboardSelector(selectIsAiGenerating);
|
|
19
21
|
return {
|
|
20
22
|
isVisible,
|
|
23
|
+
isEnabled: !isAiGenerating,
|
|
21
24
|
onShareButtonClick,
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* @alpha
|
|
26
29
|
*/
|
|
27
|
-
export function DefaultShareButton({ isVisible, onShareButtonClick, }) {
|
|
30
|
+
export function DefaultShareButton({ isVisible, isEnabled, onShareButtonClick, }) {
|
|
28
31
|
const density = useDashboardSelector(selectDashboardDensity);
|
|
29
32
|
const intl = useIntl();
|
|
30
33
|
const tooltipText = intl.formatMessage({ id: "share.button.tooltip" });
|
|
31
34
|
if (!isVisible) {
|
|
32
35
|
return _jsx(HiddenShareButton, {});
|
|
33
36
|
}
|
|
34
|
-
return (_jsx(UiTooltip, { arrowPlacement: "top-end", content: tooltipText, anchor: _jsx(Button, { onClick: () => onShareButtonClick(), value: intl.formatMessage({ id: "share.button.text" }), className: cx("gd-button-secondary dash-header-share-button s-header-share-button gd-button gd-icon-users", {
|
|
37
|
+
return (_jsx(UiTooltip, { arrowPlacement: "top-end", content: tooltipText, anchor: _jsx(Button, { onClick: () => onShareButtonClick(), value: intl.formatMessage({ id: "share.button.text" }), disabled: !isEnabled, className: cx("gd-button-secondary dash-header-share-button s-header-share-button gd-button gd-icon-users", {
|
|
35
38
|
"gd-button-small": density === "compact",
|
|
36
39
|
}), accessibilityConfig: {
|
|
37
40
|
ariaLabel: tooltipText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/shareButton/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/topBar/buttonBar/button/shareButton/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -3,5 +3,5 @@ import { type IMenuButtonProps } from "./types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* @alpha
|
|
5
5
|
*/
|
|
6
|
-
export declare function DefaultMenuButton({ menuItems }: IMenuButtonProps): ReactElement | null;
|
|
6
|
+
export declare function DefaultMenuButton({ menuItems, isEnabled }: IMenuButtonProps): ReactElement | null;
|
|
7
7
|
//# sourceMappingURL=DefaultMenuButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultMenuButton.d.ts","sourceRoot":"","sources":["../../../../src/presentation/topBar/menuButton/DefaultMenuButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,YAAY,EAOpB,MAAM,OAAO,CAAC;AA4Bf,OAAO,EAIH,KAAK,gBAAgB,EACxB,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"DefaultMenuButton.d.ts","sourceRoot":"","sources":["../../../../src/presentation/topBar/menuButton/DefaultMenuButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,YAAY,EAOpB,MAAM,OAAO,CAAC;AA4Bf,OAAO,EAIH,KAAK,gBAAgB,EACxB,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,SAAgB,EAAE,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,CAsOxG"}
|
|
@@ -12,7 +12,7 @@ const overlayAlignPoints = [{ align: "br tr" }];
|
|
|
12
12
|
/**
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
15
|
-
export function DefaultMenuButton({ menuItems }) {
|
|
15
|
+
export function DefaultMenuButton({ menuItems, isEnabled = true }) {
|
|
16
16
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
17
|
const [autofocusSubmenu, setAutofocusSubmenu] = useState(false);
|
|
18
18
|
const intl = useIntl();
|
|
@@ -127,6 +127,11 @@ export function DefaultMenuButton({ menuItems }) {
|
|
|
127
127
|
setParentItemId(null);
|
|
128
128
|
}
|
|
129
129
|
}, [selectedMenuItem, parentItemId, menuItemRefs, autofocusSubmenu]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (!isEnabled && isOpen) {
|
|
132
|
+
onClose();
|
|
133
|
+
}
|
|
134
|
+
}, [isEnabled, isOpen, onClose]);
|
|
130
135
|
if (!visibleMenuItems.length) {
|
|
131
136
|
return null;
|
|
132
137
|
}
|
|
@@ -140,7 +145,7 @@ export function DefaultMenuButton({ menuItems }) {
|
|
|
140
145
|
] }) }) }) }, "topBarMenuButton"));
|
|
141
146
|
};
|
|
142
147
|
return (_jsxs(_Fragment, { children: [
|
|
143
|
-
_jsx("div", { className: cx("dash-header-options-button", dropdownAnchorClassName), children: _jsx(UiTooltip, { arrowPlacement: "top-end", content: tooltipText, anchor: _jsx(UiIconButton, { ref: triggerButtonRef, onClick: onMenuButtonClick, icon: "ellipsis", id: DEFAULT_MENU_BUTTON_ID, dataTestId: "s-header-options-button", variant: smallScreen ? "tertiary" : "secondary", size: smallScreen ? "xlarge" : density === "compact" ? "small" : "medium", accessibilityConfig: {
|
|
148
|
+
_jsx("div", { className: cx("dash-header-options-button", dropdownAnchorClassName), children: _jsx(UiTooltip, { arrowPlacement: "top-end", content: tooltipText, anchor: _jsx(UiIconButton, { ref: triggerButtonRef, onClick: onMenuButtonClick, icon: "ellipsis", id: DEFAULT_MENU_BUTTON_ID, dataTestId: "s-header-options-button", variant: smallScreen ? "tertiary" : "secondary", size: smallScreen ? "xlarge" : density === "compact" ? "small" : "medium", isDisabled: !isEnabled, accessibilityConfig: {
|
|
144
149
|
role: "button",
|
|
145
150
|
ariaLabel: tooltipText,
|
|
146
151
|
ariaExpanded: isOpen,
|
|
@@ -70,6 +70,10 @@ export interface IMenuButtonProps {
|
|
|
70
70
|
* Items that will be in the menu.
|
|
71
71
|
*/
|
|
72
72
|
menuItems: ReadonlyArray<IMenuButtonItem>;
|
|
73
|
+
/**
|
|
74
|
+
* Indicates if the menu button is enabled.
|
|
75
|
+
*/
|
|
76
|
+
isEnabled?: boolean;
|
|
73
77
|
DefaultMenuButton: CustomMenuButtonComponent;
|
|
74
78
|
}
|
|
75
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/presentation/topBar/menuButton/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE;QACH,qBAAqB,GAAG,wBAAwB,GAAG,qBAAqB;QACxE,GAAG,CAAC,qBAAqB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC,EAAE;KAClF,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IAClE,IAAI,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,mBAAmB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1C,iBAAiB,EAAE,yBAAyB,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CAClE"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/presentation/topBar/menuButton/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE;QACH,qBAAqB,GAAG,wBAAwB,GAAG,qBAAqB;QACxE,GAAG,CAAC,qBAAqB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC,EAAE;KAClF,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IAClE,IAAI,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,mBAAmB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iBAAiB,EAAE,yBAAyB,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CAClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateDatasetDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/common/configuration/DateDatasetDropdown.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateDatasetDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/common/configuration/DateDatasetDropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,MAAM,EAAkB,MAAM,qBAAqB,CAAC;AAsF5F,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC,oBAAoB,CAAC,EAAE,mBAAmB,CAAC;IAC3C,qBAAqB,CAAC,EAAE,mBAAmB,CAAC;IAC5C,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,qBAAqB,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,CAAC;CACrE;AAOD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,2CAqOnE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO;;;EAiB9C"}
|
|
@@ -1,38 +1,67 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
|
+
import { debounce } from "lodash-es";
|
|
5
6
|
import { FormattedMessage, defineMessage, defineMessages, useIntl } from "react-intl";
|
|
6
7
|
import { objRefToString } from "@gooddata/sdk-model";
|
|
7
|
-
import { Button, Dropdown, DropdownButton, DropdownList, ScrollableItem,
|
|
8
|
-
import {
|
|
9
|
-
import { getDateConfigurationDropdownHeight, getSortedDateDatasetsItems, removeDateFromTitle, } from "./utils.js";
|
|
8
|
+
import { Button, DATE_DATASET_LIST_ITEM_CLASSNAME, DateDatasetsListItem, Dropdown, DropdownButton, DropdownList, ScrollableItem, isDateDatasetHeader, } from "@gooddata/sdk-ui-kit";
|
|
9
|
+
import { getDateConfigurationDropdownHeight, getDateDatasetDropdownWidth, getSortedDateDatasetsItems, removeDateFromTitle, } from "./utils.js";
|
|
10
10
|
const DEFAULT_HYPHEN_CHAR = "-";
|
|
11
|
-
const alignPoints = [
|
|
12
|
-
|
|
13
|
-
{ align: "
|
|
14
|
-
{ align: "
|
|
11
|
+
const alignPoints = [
|
|
12
|
+
{ align: "bl tl" },
|
|
13
|
+
{ align: "tl bl" },
|
|
14
|
+
{ align: "br tr" },
|
|
15
|
+
{ align: "tr br" },
|
|
15
16
|
];
|
|
16
17
|
const DROPDOWN_MIN_HEIGHT = 170;
|
|
17
18
|
const DEFAULT_DROPDOWN_ITEM_HEIGHT = 28;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const EVENT_DEBOUNCE_MILLISECONDS = 60;
|
|
20
|
+
function measureScrollbarWidth() {
|
|
21
|
+
const probe = document.createElement("div");
|
|
22
|
+
probe.className = "s-date-dataset-scrollbar-probe";
|
|
23
|
+
probe.style.position = "absolute";
|
|
24
|
+
probe.style.top = "-9999px";
|
|
25
|
+
probe.style.left = "-9999px";
|
|
26
|
+
probe.style.width = "100px";
|
|
27
|
+
probe.style.height = "100px";
|
|
28
|
+
probe.style.overflow = "scroll";
|
|
29
|
+
document.body.appendChild(probe);
|
|
30
|
+
const scrollbarWidth = probe.offsetWidth - probe.clientWidth;
|
|
31
|
+
document.body.removeChild(probe);
|
|
32
|
+
return scrollbarWidth;
|
|
33
|
+
}
|
|
34
|
+
function measureLongestItemWidth(titles) {
|
|
35
|
+
if (titles.length === 0) {
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
const probe = document.createElement("div");
|
|
39
|
+
probe.className = `${DATE_DATASET_LIST_ITEM_CLASSNAME} is-selected s-date-dataset-width-probe`;
|
|
40
|
+
probe.style.position = "absolute";
|
|
41
|
+
probe.style.visibility = "hidden";
|
|
42
|
+
probe.style.whiteSpace = "nowrap";
|
|
43
|
+
probe.style.top = "-9999px";
|
|
44
|
+
probe.style.left = "-9999px";
|
|
45
|
+
const text = document.createElement("span");
|
|
46
|
+
text.className = "shortened is-whole";
|
|
47
|
+
probe.appendChild(text);
|
|
48
|
+
document.body.appendChild(probe);
|
|
49
|
+
let maxWidth = 0;
|
|
50
|
+
for (const title of titles) {
|
|
51
|
+
text.textContent = title;
|
|
52
|
+
maxWidth = Math.max(maxWidth, probe.getBoundingClientRect().width);
|
|
53
|
+
}
|
|
54
|
+
document.body.removeChild(probe);
|
|
55
|
+
return Math.ceil(maxWidth);
|
|
56
|
+
}
|
|
57
|
+
// pre-translate header titles before handing them to the kit's DateDatasetsListItem,
|
|
58
|
+
// which renders whatever title it's given as-is (see DateDatasetsDropdown.tsx in AD for the same pattern)
|
|
20
59
|
const dateDatasetHeaderMessages = defineMessages({
|
|
21
60
|
"gs.date.date-dataset.recommended": { id: "gs.date.date-dataset.recommended" },
|
|
22
61
|
"gs.date.date-dataset.other": { id: "gs.date.date-dataset.other" },
|
|
23
62
|
"gs.date.date-dataset.related": { id: "gs.date.date-dataset.related" },
|
|
24
63
|
"gs.date.date-dataset.unrelated": { id: "gs.date.date-dataset.unrelated" },
|
|
25
64
|
});
|
|
26
|
-
function DateDatasetsListItem({ id, title = "", isHeader, isSelected, isUnrelated, onClick, }) {
|
|
27
|
-
if (isHeader) {
|
|
28
|
-
return _jsx("div", { className: "gd-list-item gd-list-item-header", children: title });
|
|
29
|
-
}
|
|
30
|
-
const classNames = cx("gd-list-item", "gd-list-item-shortened", `s-${id}`, `s-${simplifyText(title)}`, {
|
|
31
|
-
"is-selected": isSelected,
|
|
32
|
-
"is-unrelated": isUnrelated,
|
|
33
|
-
});
|
|
34
|
-
return (_jsx("div", { className: classNames, onClick: onClick, children: _jsx(ShortenedText, { tooltipAlignPoints: tooltipAlignPoints, ellipsisPosition: "end", children: title }) }));
|
|
35
|
-
}
|
|
36
65
|
export function DateDatasetDropdown(props) {
|
|
37
66
|
const { className = "s-date-dataset-switch", isLoading = false, autoOpen = false, onDateDatasetChange, activeDateDataset, unrelatedDateDataset, dateFromVisualization, relatedDateDatasets, widgetRef, enableUnrelatedItemsVisibility, unrelatedDateDatasets, } = props;
|
|
38
67
|
const intl = useIntl();
|
|
@@ -51,7 +80,14 @@ export function DateDatasetDropdown(props) {
|
|
|
51
80
|
if (dateFromVisualization) {
|
|
52
81
|
recommendedDateDataSet = relatedDateDatasets.find((d) => d.dataSet.uri === dateFromVisualization.dataSet.uri);
|
|
53
82
|
}
|
|
54
|
-
const sortedItems = getSortedDateDatasetsItems(relatedDateDatasets, recommendedDateDataSet, unrelatedDateDataset, unrelatedDateDatasets, enableUnrelatedItemsVisibility && showUnavailableItems)
|
|
83
|
+
const sortedItems = useMemo(() => getSortedDateDatasetsItems(relatedDateDatasets, recommendedDateDataSet, unrelatedDateDataset, unrelatedDateDatasets, enableUnrelatedItemsVisibility && showUnavailableItems), [
|
|
84
|
+
relatedDateDatasets,
|
|
85
|
+
recommendedDateDataSet,
|
|
86
|
+
unrelatedDateDataset,
|
|
87
|
+
unrelatedDateDatasets,
|
|
88
|
+
enableUnrelatedItemsVisibility,
|
|
89
|
+
showUnavailableItems,
|
|
90
|
+
]);
|
|
55
91
|
const unrelatedDateDatasetCount = (unrelatedDateDatasets?.length ?? 0) - (unrelatedDateDataset ? 1 : 0);
|
|
56
92
|
const buttonRef = useRef(null);
|
|
57
93
|
const [{ height, width }, setDropdownDimensions] = useState({
|
|
@@ -59,12 +95,42 @@ export function DateDatasetDropdown(props) {
|
|
|
59
95
|
height: DROPDOWN_MIN_HEIGHT,
|
|
60
96
|
});
|
|
61
97
|
const dropdownBodyHeight = (sortedItems?.length || 0) * DEFAULT_DROPDOWN_ITEM_HEIGHT;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
98
|
+
const measuredContentWidthRef = useRef(0);
|
|
99
|
+
const scrollbarWidthRef = useRef(null);
|
|
100
|
+
// Cheap: only reads the button's current position/size plus the content width already
|
|
101
|
+
// measured below, so it's safe to run on every debounced resize/scroll. The scrollbar
|
|
102
|
+
// width is measured lazily, on first actual need, and cached — never during render, so
|
|
103
|
+
// this stays safe for SSR/non-DOM environments.
|
|
104
|
+
const recalculateDimensions = useCallback(() => {
|
|
105
|
+
const buttonRect = buttonRef.current?.getBoundingClientRect();
|
|
65
106
|
const calculatedHeight = getDateConfigurationDropdownHeight(buttonRect?.top ?? 0, buttonRect?.height ?? 0, dropdownBodyHeight, !unrelatedDateDatasets?.length);
|
|
107
|
+
let contentWidth = measuredContentWidthRef.current;
|
|
108
|
+
if (dropdownBodyHeight > calculatedHeight) {
|
|
109
|
+
scrollbarWidthRef.current ??= measureScrollbarWidth();
|
|
110
|
+
contentWidth += scrollbarWidthRef.current;
|
|
111
|
+
}
|
|
112
|
+
const calculatedWidth = getDateDatasetDropdownWidth(buttonRect?.width ?? 0, contentWidth, buttonRect?.left ?? 0, buttonRect?.right ?? 0);
|
|
66
113
|
setDropdownDimensions({ width: calculatedWidth, height: calculatedHeight });
|
|
67
|
-
}, [dropdownBodyHeight, unrelatedDateDatasets
|
|
114
|
+
}, [dropdownBodyHeight, unrelatedDateDatasets]);
|
|
115
|
+
// Expensive: builds a DOM probe and measures every title, so it only re-runs when the
|
|
116
|
+
// actual item list changes, not on every resize/scroll.
|
|
117
|
+
useLayoutEffect(() => {
|
|
118
|
+
const titles = sortedItems.map((item) => isDateDatasetHeader(item)
|
|
119
|
+
? intl.formatMessage(dateDatasetHeaderMessages[item.title])
|
|
120
|
+
: removeDateFromTitle(item.title));
|
|
121
|
+
measuredContentWidthRef.current = measureLongestItemWidth(titles);
|
|
122
|
+
recalculateDimensions();
|
|
123
|
+
}, [sortedItems, intl, recalculateDimensions]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const debouncedRecalculate = debounce(recalculateDimensions, EVENT_DEBOUNCE_MILLISECONDS);
|
|
126
|
+
window.addEventListener("resize", debouncedRecalculate);
|
|
127
|
+
window.addEventListener("scroll", debouncedRecalculate, true);
|
|
128
|
+
return () => {
|
|
129
|
+
debouncedRecalculate.cancel();
|
|
130
|
+
window.removeEventListener("resize", debouncedRecalculate);
|
|
131
|
+
window.removeEventListener("scroll", debouncedRecalculate, true);
|
|
132
|
+
};
|
|
133
|
+
}, [recalculateDimensions]);
|
|
68
134
|
const onShowHideUnrelatedItemsClick = () => {
|
|
69
135
|
setShowUnavailableItems(!showUnavailableItems);
|
|
70
136
|
};
|
|
@@ -72,13 +138,13 @@ export function DateDatasetDropdown(props) {
|
|
|
72
138
|
if (isLoading) {
|
|
73
139
|
return null;
|
|
74
140
|
}
|
|
75
|
-
return (_jsxs("div", { style: { width }, children: [_jsx(DropdownList, { className: "configuration-dropdown dataSets-list", height: height, width: width, items: sortedItems, itemsCount: sortedItems.length, renderItem: ({ item }) => {
|
|
141
|
+
return (_jsxs("div", { style: { width }, children: [_jsx(DropdownList, { className: "configuration-dropdown dataSets-list", height: height, width: width, items: sortedItems, itemsCount: sortedItems.length, renderItem: ({ item, width: itemWidth }) => {
|
|
76
142
|
const isHeader = isDateDatasetHeader(item);
|
|
77
143
|
const isSelected = !isDateDatasetHeader(item) && activeDateDataSetId === item.id;
|
|
78
144
|
const isUnrelated = !isDateDatasetHeader(item) && unrelatedDateDataSetId === item.id;
|
|
79
145
|
return (_jsx(DateDatasetsListItem, { title: isHeader
|
|
80
146
|
? intl.formatMessage(dateDatasetHeaderMessages[item.title])
|
|
81
|
-
: removeDateFromTitle(item.title), isHeader: isHeader, isSelected: isSelected, isUnrelated: isUnrelated, onClick: (e) => {
|
|
147
|
+
: removeDateFromTitle(item.title), isHeader: isHeader, isSelected: isSelected, isUnrelated: isUnrelated, width: itemWidth, onClick: (e) => {
|
|
82
148
|
e.preventDefault();
|
|
83
149
|
if (isDateDatasetHeader(item)) {
|
|
84
150
|
return;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type IAttributeMetadataObject, type ICatalogDateDataset, type IInsightDefinition, type ObjRef } from "@gooddata/sdk-model";
|
|
2
2
|
import { type IDateDataset, type IDateDatasetHeader } from "@gooddata/sdk-ui-kit";
|
|
3
|
+
export declare const PADDING = 10;
|
|
4
|
+
export declare const MAX_DATE_DATASET_DROPDOWN_WIDTH = 350;
|
|
3
5
|
export declare function getUnrelatedDateDataset(relatedDateDataSets: readonly ICatalogDateDataset[], selectedDateDataSet: ICatalogDateDataset | undefined, selectedDateDataSetHidden: boolean | undefined): ICatalogDateDataset | undefined;
|
|
4
6
|
export declare function getDateOptionsDisabledForInsight(insight: IInsightDefinition): boolean;
|
|
5
7
|
export declare function removeDateFromTitle(title: string): string;
|
|
6
8
|
export declare function getAttributeByDisplayForm(attributes: IAttributeMetadataObject[], displayForm: ObjRef): IAttributeMetadataObject | undefined;
|
|
7
9
|
export declare function getUnrelatedDateDatasets(allDateDataSets: readonly ICatalogDateDataset[], relatedDateDataSets?: readonly ICatalogDateDataset[]): readonly ICatalogDateDataset[];
|
|
8
10
|
export declare function getDateConfigurationDropdownHeight(dropdownButtonTop: number, dropdownButtonHeight: number, dropdownBodyHeight: number, hasFooter?: boolean): number;
|
|
11
|
+
export declare function getDateDatasetDropdownWidth(minWidth: number, contentWidth: number, buttonLeft: number, buttonRight: number, windowObj?: Pick<Window, "innerWidth">): number;
|
|
9
12
|
export declare function getSortedDateDatasetsItems(relatedDateDatasets: readonly ICatalogDateDataset[], recommendedDateDataSet: ICatalogDateDataset | undefined, unrelatedDateDataset: ICatalogDateDataset | undefined, unrelatedDateDatasets: readonly ICatalogDateDataset[] | undefined, shouldDisplayUnrelatedDatasets?: boolean): (IDateDataset | IDateDatasetHeader)[];
|
|
10
13
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/common/configuration/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAEvB,KAAK,MAAM,EAMd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAG1B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/widget/common/configuration/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAEvB,KAAK,MAAM,EAMd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAG1B,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,OAAO,KAAK,CAAC;AAG1B,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,wBAAgB,uBAAuB,CACnC,mBAAmB,EAAE,SAAS,mBAAmB,EAAE,EACnD,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,EACpD,yBAAyB,EAAE,OAAO,GAAG,SAAS,GAC/C,mBAAmB,GAAG,SAAS,CAQjC;AAUD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAGrF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,wBAAwB,EAAE,EAAE,WAAW,EAAE,MAAM,wCAEpG;AAED,wBAAgB,wBAAwB,CACpC,eAAe,EAAE,SAAS,mBAAmB,EAAE,EAC/C,mBAAmB,CAAC,EAAE,SAAS,mBAAmB,EAAE,GACrD,SAAS,mBAAmB,EAAE,CAUhC;AAED,wBAAgB,kCAAkC,CAC9C,iBAAiB,EAAE,MAAM,EACzB,oBAAoB,EAAE,MAAM,EAC5B,kBAAkB,EAAE,MAAM,EAC1B,SAAS,UAAQ,UASpB;AAED,wBAAgB,2BAA2B,CACvC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAU,GAC/C,MAAM,CAWR;AAUD,wBAAgB,0BAA0B,CACtC,mBAAmB,EAAE,SAAS,mBAAmB,EAAE,EACnD,sBAAsB,EAAE,mBAAmB,GAAG,SAAS,EACvD,oBAAoB,EAAE,mBAAmB,GAAG,SAAS,EACrD,qBAAqB,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACjE,8BAA8B,UAAQ,GACvC,CAAC,YAAY,GAAG,kBAAkB,CAAC,EAAE,CAqBvC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
// (C) 2022-
|
|
1
|
+
// (C) 2022-2026 GoodData Corporation
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
3
|
import { areObjRefsEqual, insightMeasures, isDateFilter, isSimpleMeasure, measureFilters, } from "@gooddata/sdk-model";
|
|
4
4
|
import { sortDateDatasets, unrelatedHeader, } from "@gooddata/sdk-ui-kit";
|
|
5
5
|
const DATE_DROPDOWN_BODY_MARGIN = 6;
|
|
6
6
|
const UNRELATED_HEIGHT = 37;
|
|
7
|
-
const PADDING = 10;
|
|
7
|
+
export const PADDING = 10;
|
|
8
8
|
const DROPDOWN_MAX_HEIGHT = 400;
|
|
9
|
+
export const MAX_DATE_DATASET_DROPDOWN_WIDTH = 350;
|
|
9
10
|
export function getUnrelatedDateDataset(relatedDateDataSets, selectedDateDataSet, selectedDateDataSetHidden) {
|
|
10
11
|
if (!selectedDateDataSet || selectedDateDataSetHidden) {
|
|
11
12
|
return undefined;
|
|
@@ -44,6 +45,17 @@ export function getDateConfigurationDropdownHeight(dropdownButtonTop, dropdownBu
|
|
|
44
45
|
const maxHeight = Math.max(nodeAboveHeight, nodeBelowHeight);
|
|
45
46
|
return Math.min(dropdownBodyHeight, maxHeight, DROPDOWN_MAX_HEIGHT);
|
|
46
47
|
}
|
|
48
|
+
export function getDateDatasetDropdownWidth(minWidth, contentWidth, buttonLeft, buttonRight, windowObj = window) {
|
|
49
|
+
const isButtonLeftOnScreen = buttonLeft >= 0 && buttonLeft <= windowObj.innerWidth;
|
|
50
|
+
const isButtonRightOnScreen = buttonRight >= 0 && buttonRight <= windowObj.innerWidth;
|
|
51
|
+
const availableToTheRight = isButtonLeftOnScreen
|
|
52
|
+
? Math.max(0, windowObj.innerWidth - buttonLeft - PADDING)
|
|
53
|
+
: 0;
|
|
54
|
+
const availableToTheLeft = isButtonRightOnScreen ? Math.max(0, buttonRight - PADDING) : 0;
|
|
55
|
+
const viewportLimit = Math.max(availableToTheRight, availableToTheLeft);
|
|
56
|
+
const maxWidth = Math.max(minWidth, Math.min(MAX_DATE_DATASET_DROPDOWN_WIDTH, viewportLimit));
|
|
57
|
+
return Math.min(Math.max(minWidth, contentWidth), maxWidth);
|
|
58
|
+
}
|
|
47
59
|
function catalogDateDatasetToDateDataset(ds) {
|
|
48
60
|
return {
|
|
49
61
|
id: ds.dataSet.id,
|