44 lines
2.2 KiB
TypeScript
44 lines
2.2 KiB
TypeScript
import React from 'react';
|
|
import { TablerIconsProps } from '@tabler/icons-react';
|
|
export interface ActionMenuItem {
|
|
key: string;
|
|
label: string;
|
|
icon?: React.ComponentType<TablerIconsProps>;
|
|
color?: string;
|
|
disabled?: boolean;
|
|
hidden?: boolean;
|
|
onClick: (item?: any) => void | Promise<void>;
|
|
confirm?: {
|
|
title: string;
|
|
message: string;
|
|
confirmLabel?: string;
|
|
cancelLabel?: string;
|
|
};
|
|
show?: (item: any) => boolean;
|
|
}
|
|
export interface ActionMenuProps {
|
|
item?: any;
|
|
actions: ActionMenuItem[];
|
|
trigger?: 'dots' | 'button' | 'custom';
|
|
triggerLabel?: string;
|
|
triggerIcon?: React.ComponentType<TablerIconsProps>;
|
|
triggerProps?: any;
|
|
customTrigger?: React.ReactNode;
|
|
position?: 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start';
|
|
withArrow?: boolean;
|
|
withinPortal?: boolean;
|
|
'aria-label'?: string;
|
|
}
|
|
declare const ActionMenu: React.FC<ActionMenuProps>;
|
|
export default ActionMenu;
|
|
export declare const createViewAction: (onView: (item: any) => void) => ActionMenuItem;
|
|
export declare const createEditAction: (onEdit: (item: any) => void) => ActionMenuItem;
|
|
export declare const createCopyAction: (onCopy: (item: any) => void) => ActionMenuItem;
|
|
export declare const createDeleteAction: (onDelete: (item: any) => void | Promise<void>, itemName?: string) => ActionMenuItem;
|
|
export declare const createArchiveAction: (onArchive: (item: any) => void) => ActionMenuItem;
|
|
export declare const createRestoreAction: (onRestore: (item: any) => void) => ActionMenuItem;
|
|
export declare const getUserActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onViewDetails?: (item: any) => void) => ActionMenuItem[];
|
|
export declare const getApplicationActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onConfigure?: (item: any) => void) => ActionMenuItem[];
|
|
export declare const getFunctionActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onExecute?: (item: any) => void, onViewLogs?: (item: any) => void) => ActionMenuItem[];
|
|
export declare const getTokenActions: (onRevoke: (item: any) => void, onCopy?: (item: any) => void, onRefresh?: (item: any) => void) => ActionMenuItem[];
|