import { Component } from 'vue'; import { CoarIconSize } from '@cocoar/vue-ui'; import { ICellRendererParams } from 'ag-grid-community'; /** Accessor that can be either a static value or a per-row function. */ export type WrapperSlotAccessor = TValue | ((row: TData) => TValue); /** Icon-shorthand slot: renders a CoarIcon with optional click handler / tooltip. */ export interface WrapperIconSlotConfig { /** Icon name. Return `null`/empty string to hide for this row. */ icon: WrapperSlotAccessor; /** Icon registry source (e.g. `'coar-builtin'`). */ source?: string; /** Icon size (default: `'s'`). */ size?: CoarIconSize; /** CSS color value (static or per-row). */ color?: WrapperSlotAccessor; /** Tooltip text (static or per-row). */ tooltip?: WrapperSlotAccessor; /** Click handler. When set, the slot becomes clickable and stops propagation. */ onClick?: (row: TData, event: MouseEvent) => void; /** Optional visibility gate. Return `false` to hide the slot entirely (v-if). */ show?: (row: TData) => boolean; } /** Component slot: mounts any Vue component with per-row props. */ export interface WrapperComponentSlotConfig { /** Vue component to mount. */ component: Component; /** Build the component's props from the row (optional). */ params?: (row: TData) => Record; /** When set, the slot becomes clickable and stops propagation. */ onClick?: (row: TData, event: MouseEvent) => void; /** Optional visibility gate. */ show?: (row: TData) => boolean; } /** Text slot: renders plain text (static or per-row). */ export interface WrapperTextSlotConfig { /** Text content. */ text: WrapperSlotAccessor; /** Tooltip text. */ tooltip?: WrapperSlotAccessor; /** When set, the slot becomes clickable and stops propagation. */ onClick?: (row: TData, event: MouseEvent) => void; /** Optional visibility gate. */ show?: (row: TData) => boolean; } /** Union of all supported slot shapes. Discriminated by the presence of `icon` / `component` / `text`. */ export type WrapperSlotItem = WrapperIconSlotConfig | WrapperComponentSlotConfig | WrapperTextSlotConfig; /** * Slot config: a single item or an ordered list of items. * Use an array to stack multiple icons/badges/components next to each other * (e.g. `[{ icon: ..., show: (r) => r.isCritical }, { icon: ..., show: (r) => r.awaitingFeedback }]`). */ export type WrapperSlotConfig = WrapperSlotItem | WrapperSlotItem[]; /** Runtime config consumed by `WrapperCellRenderer` (attached via `cellRendererParams.config`). */ export interface WrapperCellRendererConfig { left?: WrapperSlotConfig; right?: WrapperSlotConfig; /** Inner cell renderer to embed between the slots. Falls back to `valueFormatted` / `value` text. */ innerRenderer?: Component | null; /** Params forwarded to the inner renderer (merged with AG Grid's `ICellRendererParams`). */ innerRendererParams?: Record; } /** Type guard: icon-shorthand slot. */ export declare function isIconSlot(slot: WrapperSlotItem): slot is WrapperIconSlotConfig; /** Type guard: component slot. */ export declare function isComponentSlot(slot: WrapperSlotItem): slot is WrapperComponentSlotConfig; /** Type guard: text slot. */ export declare function isTextSlot(slot: WrapperSlotItem): slot is WrapperTextSlotConfig; /** Normalize a slot config to an array of items. */ export declare function toSlotItems(slot: WrapperSlotConfig | undefined): WrapperSlotItem[]; /** @internal — resolve an accessor against a row. */ export declare function resolveAccessor(accessor: WrapperSlotAccessor | undefined, row: TData): TValue | undefined; /** Re-exported for convenience in tests / consumers. */ export type { ICellRendererParams }; //# sourceMappingURL=wrapper-cell-renderer.models.d.ts.map