UNPKG

ng-fusion-ui

Version:

Angular data table library!

68 lines (67 loc) 2.81 kB
import * as i0 from "@angular/core"; export interface FuColumnActionsTemplateContext<T extends object> { /** The current row object */ row: T; /** Row index in the rendered table */ index: number; /** Whether the row is in edit mode */ editing: boolean; /** Whether the row is in expanded state */ expanded: boolean; /** Start editing the row at the given index */ startEdit: (index: number, event?: Event) => void; /** Save edits for the current row */ saveEdit: (event?: Event) => void; /** Cancel edits and restore previous values */ cancelEdit: (event?: Event) => void; /** Deletes the row at the given index */ deleteRow: (index: number, event?: Event) => void; /** Expands additional row below the current row */ toggleExpand: (index: number, event?: Event) => void; } /** * Defines a custom action template for a `fu-column`. * * This template is intended for rendering row-level actions * such as edit, save, cancel, or expand controls. * * The template context exposes: * - `row` – the current row data * - `index` – row index * - `editing` – whether the row is currently in edit mode * - `startEdit`, `saveEdit`, `cancelEdit` – row edit helpers * - `toggleExpand` – expands or collapses the row * - `deleteRow` – triggers onRowDelete event for the current row * * ## Event handling * If your table listens to row click events, interactive elements * inside this template should pass `$event` to helpers in order to * stop event propagation: * * ```html * <button (click)="startEdit(index, $event)">Edit</button> * ``` * * ## Typing * To enable strong typing for `row`, provide the table data using `rowOf`. * This input is used only for type inference and does not affect rendering. * * ## Usage * ```html * <ng-template fuColumnActions let-index="index" let-startEdit="startEdit"> * <button (click)="startEdit(index, $event)">✏️</button> * </ng-template> * ``` * * * If `rowOf` is omitted, `row` will be typed as `any`. */ export declare class FuColumnActionsTemplateDirective<T extends object> { /** * Provides typing context for the column cell template. * Used only for type inference – not consumed at runtime. */ of: import("@angular/core").InputSignal<T[] | null>; static ngTemplateContextGuard<TContext extends object>(_dir: FuColumnActionsTemplateDirective<TContext>, ctx: unknown): ctx is FuColumnActionsTemplateContext<TContext>; static ɵfac: i0.ɵɵFactoryDeclaration<FuColumnActionsTemplateDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FuColumnActionsTemplateDirective<any>, "[fuColumnActions]", never, { "of": { "alias": "rowOf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; }