import { type PropsWithChildren, type ReactElement, type ReactNode, type MouseEvent as ReactMouseEvent } from 'react'; import { type Column, type RowData, type TableFeature, type TableOptions } from '../../hooks/useTable/types.js'; import { type DataTableV2ColumnDef, type DataTableV2RowData } from '../../public.api.js'; /** * Props for slotting selector component `DataTableV2ColumnActions`. * @public */ export interface DataTableV2ColumnActionsProps { children: ReactNode | ((column: DataTableV2ColumnDef) => ReactElement); /** * Column id that the given columnactions apply to. If left empty, the given cell actions * apply to all columns that allow cell actions. */ column?: string; } /** * Slotting selector component for the `DataTableV2ColumnActions`. * @public */ export declare function DataTableV2ColumnActions(props: DataTableV2ColumnActionsProps): null; /** * Props for slotting selector component `DataTableV2CellActions`. * @public */ export interface DataTableV2CellActionsProps { children: ReactNode | ((props: { columnDef: DataTableV2ColumnDef; cellValue: unknown; row: TData; rowId: string; }) => ReactElement); /** * Column id that the given cellactions apply to. If left empty, the given cell actions * apply to all columns that allow cell actions. */ column?: string; } /** * Slotting selector component for the `DataTableV2CellActions`. * @public */ export declare function DataTableV2CellActions(props: DataTableV2CellActionsProps): null; /** * Props for slotting selector component `DataTableV2RowActions`. * @public */ export interface DataTableV2RowActionsProps { children: (row: TData, { rowDensity, rowIndex, rowId, }: { rowDensity: 'default' | 'condensed' | 'comfortable'; rowIndex: number; rowId: string; }) => ReactElement; } /** * Slotting selector component for the `DataTableV2RowActions`. * @public */ export declare function DataTableV2RowActions(props: DataTableV2RowActionsProps): null; /** * Extension interface to extend the TableState of the tanstack table. * @internal */ export interface DataTableV2UserActionsState { floatingMenuInfo?: { type: 'headerAction' | 'cellAction' | null; columnId: string | null; rowId: string | null; x: number; y: number; }; } /** * Extension interface to extend the useTable hook options with the UserActions options. * @internal */ export interface DataTableV2UserActionsOptions { /** * Enables columnActions as a feature on the table. */ enableColumnActions?: boolean; /** Holds a collection of all cell actions to render when necessary. */ cellActions?: { [key in symbol | string]: Array; cellValue: unknown; row: TData; rowId: string; }) => ReactElement)>; }; /** * Enables cellActions as a feature on the table. */ enableCellActions?: boolean; builtinColumnActions?: Record) => ReactElement | null>; /** Holds a collection of all column actions to render when necessary. */ columnActions?: { [key in symbol | string]: Array) => ReactElement)>; }; /** * Enables rowActions as a feature on the table. */ enableRowActions?: boolean; /** Holds a collection of all row actions to render when necessary. */ rowActions?: (row: TData, { rowDensity, rowIndex, rowId, }: { rowDensity: 'default' | 'condensed' | 'comfortable'; rowIndex: number; rowId: string; }) => ReactNode; /** * Reference map to get to the original (non-exteded version) of the column * definition passed by the consumer in order to get emit it with a column or cell action. */ consumerColumnDefMap?: Map>; } /** @internal */ export interface DataTableV2CellOrColumnActions { builtinActions?: ReactNode[] | null; customActions?: ReactNode[] | null; } /** Extension interface to extend the types for the `Table` from the tanstack table */ export interface DataTableV2UserActionsInstance { /** * @internal * Allows to set the state of the floating menu and the context of the floating menu */ _setFloatingMenuInfo: (columnId: string, rowId: string | null, x: number, y: number) => void; /** * Allows global access to the column actions by columnId. */ getUserActionsForColumn: (columnId: string) => DataTableV2CellOrColumnActions; /** * Allows global access to the cell actions by columnId and rowId identifier. */ getUserActionsForCell: (columnId: string, rowId: string) => DataTableV2CellOrColumnActions; /** * Access to the floating context menu handler */ getUserActionFloatingMenuContextMenuHandler: () => (event: ReactMouseEvent) => void; } /** * Extension interface to extend the types of the `Column` from the tanstack table. * @internal */ export interface DataTableV2UserActionsColumn { /** * Defines if the header does have user actions defined */ getCanUserActions: () => boolean; /** * Returns the defined user actions that can be passed to the menu content. */ getUserActions: () => DataTableV2CellOrColumnActions; } /** * Extension interface to extend the types of the `Cell` from the tanstack table. * @internal */ export interface DataTableV2UserActionsCell { /** * Defines if the header does have user actions defined */ getCanUserActions: () => boolean; /** * Returns the defined user actions that can be passed to the menu content. */ getUserActions: () => DataTableV2CellOrColumnActions; } /** * Extension interface to extend the types of the `ColumnDef` from the tanstack table. * @internal */ export interface DataTableV2UserActionColumnDef { /** * Allows disabling user actions on a specific column definition. */ enableUserActions?: boolean; } /** * Helper function that will let you register built in Actions * @internal */ export declare function registerColumnAction(options: TableOptions, identifier: string | symbol, columnAction: (column: Column) => ReactElement | null): void; /** Configuration hook for the DataTableV2 UserActions feature */ export declare function useUserActions(props: PropsWithChildren, options: TableOptions, consumerColumnDefMap: Map>): void; /** * Defines the user action table feature */ export declare const UserActions: TableFeature;