From 2079aeb0192273d7d4e7756184d8711238898aba Mon Sep 17 00:00:00 2001 From: Taya Leutina Date: Thu, 26 Dec 2024 13:27:35 +0300 Subject: [PATCH] Support enableHiddenItems in getActionPanelItems --- src/ui/utils/getActionPanelItems.tsx | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/ui/utils/getActionPanelItems.tsx b/src/ui/utils/getActionPanelItems.tsx index 25e2e18b48..c9b62e9615 100644 --- a/src/ui/utils/getActionPanelItems.tsx +++ b/src/ui/utils/getActionPanelItems.tsx @@ -24,14 +24,7 @@ export const TYPES_TO_DIALOGS_MAP = { export const ITEM_PASTE_ITEM_ID = 'paste'; -export const getActionPanelItems = ({ - copiedData, - onPasteItem, - openDialog, - filterItem, - userSettings, - scope, -}: { +export type ActionPanelItemParams = { copiedData: CopiedConfigData | null; onPasteItem: (item: CopiedConfigData) => void; openDialog: ( @@ -41,11 +34,25 @@ export const getActionPanelItems = ({ filterItem?: (item: DashkitActionPanelItem) => boolean; userSettings?: DLUserSettings; scope?: string; -}) => { + enableHiddenItems?: boolean; +}; + +export const getActionPanelItems = ({ + copiedData, + onPasteItem, + openDialog, + filterItem, + userSettings, + scope, + enableHiddenItems = true, +}: ActionPanelItemParams) => { const {getBasicActionPanelItems} = registry.common.functions.getAll(); const items = getBasicActionPanelItems({userSettings, scope}); - if (copiedData) { + const enablePaste = + copiedData && (enableHiddenItems || copiedData.type !== DashTabItemType.Image); + + if (enablePaste) { items.push({ id: ITEM_PASTE_ITEM_ID, icon: ,