Skip to content

Commit

Permalink
Support enableHiddenItems in getActionPanelItems
Browse files Browse the repository at this point in the history
  • Loading branch information
mournfulCoroner committed Dec 26, 2024
1 parent eb490a1 commit 2079aeb
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/ui/utils/getActionPanelItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand All @@ -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: <Icon data={CopyPlus} />,
Expand Down

0 comments on commit 2079aeb

Please sign in to comment.