import type { ActionIconConfig, ActionVariant, ActionsRendererOptions, CellActionController, CellActionParams, CellActionValue, GridAction } from '../../../types/cell-action.types'; import type { ColumnDef } from '../../../types/column.types'; import type { RowNode } from '../../../types/row.types'; /** Everything needed to build params for one cell, independent of the action. */ export interface ActionParamsSource { readonly row: Record; readonly node: RowNode | null; readonly rowIndex: number; readonly value: unknown; readonly colDef: ColumnDef; readonly api: unknown; readonly event?: MouseEvent | null; readonly controller?: CellActionController; } /** * One action, resolved against one row. * * The shape both the button and the menu item are built from, so the two * layouts cannot drift in what they show. */ export interface ResolvedAction { readonly action: GridAction; readonly id: string; /** Visible text. `''` for an icon-only control. */ readonly label: string; /** Accessible name — never empty, so no control is unlabelled. */ readonly ariaLabel: string; readonly icon: ActionIconConfig | null; readonly variant: ActionVariant; readonly disabled: boolean; /** Native tooltip text. `''` when there is none to show. */ readonly tooltip: string; } /** Reads the host's shared application state, or `{}` when it set none. */ export declare function readGridContext(api: unknown): Record; /** * Builds the params object handed to one action's callbacks. * * One per action rather than one per cell because `action` and `id` are on it — * a predicate that logs which action it is deciding about should not have to be * told separately. */ export declare function createActionParams(source: ActionParamsSource, action: GridAction): CellActionParams; /** Resolves a literal-or-function option against the row. */ export declare function resolveValue(value: CellActionValue | undefined, params: CellActionParams): T | undefined; /** * Resolves one action against one row. * * ### Why a throwing predicate does not propagate * These callbacks are the host's, they run once per action per rendered cell, * and `render` must not throw — a renderer error blanks the row and, on a * scrolling grid, every row after it. So an action whose own resolution fails * is dropped and the rest of the column still paints. Dropped rather than * offered-but-broken, deliberately: a `visible` predicate that could not decide * has not granted permission, and a Delete button drawn on that basis is the * expensive kind of wrong. The failure is reported to the console once per * action, so the bug stays visible without flooding the log per row. * * @returns The resolved action, or `null` when it is not offered for this row — * invisible, disabled in a column that hides disabled actions, or failed to * resolve. A `null` here is what makes an action uninvokable, not just * undrawn: the click handler resolves through this same function. */ export declare function resolveAction(action: GridAction, source: ActionParamsSource, options: ActionsRendererOptions): ResolvedAction | null; /** Clears the reported-failure log. Test seam; not part of the public API. */ export declare function resetActionFailureReports(): void; /** * Resolves every action a row offers, in declaration order. * * Allocates one array per rendered cell. That is the honest cost of a column * whose contents depend on the row; it is bounded by the number of actions * declared, not by the dataset. */ export declare function resolveActions(source: ActionParamsSource, options: ActionsRendererOptions): ResolvedAction[]; /** How the resolved actions divide between buttons and the overflow menu. */ export interface ActionSplit { /** Drawn as buttons in the cell. */ readonly inline: readonly ResolvedAction[]; /** Reached through the overflow trigger. Never rendered until it is opened. */ readonly overflow: readonly ResolvedAction[]; } /** * Divides resolved actions between the cell and its overflow menu. * * Pure, and shared by the renderer and the click handler, so the menu opened by * a trigger contains exactly the actions the cell decided not to draw — without * either side storing that decision in the DOM. */ export declare function splitActions(resolved: readonly ResolvedAction[], options: ActionsRendererOptions): ActionSplit; /** Finds a declared action by id, or `null`. Used when a click arrives. */ export declare function findAction(options: ActionsRendererOptions, id: string): GridAction | null; //# sourceMappingURL=action-resolver.d.ts.map