import { Directive, inject, input, TemplateRef } from '@angular/core'; /** * Implicit context passed to templates registered with {@link CellDefDirective}. * * @typeParam T - Row record type mirrored from {@link TableComponent}. */ export interface CellDefContext { /** Current row — available as `let-row` on the projected template. */ $implicit: T; } /** * Registers a projected cell template against a column key for * {@link TableComponent}. * * WHY a structural-style directive: mirrors Angular CDK Table's split between * column *definition* (`columns` input) and cell *content* (projected * templates) so a cell can host badges, buttons, nested components — not just * text — without TableComponent knowing about those UIs. * * @example * ```html * * {{ row.status }} * * ``` */ @Directive({ selector: '[africaniesCellDef]', standalone: true, }) /** * Registers a projected cell template against a column key for {@link TableComponent}. */ export class CellDefDirective { /** Template projected into matching column body cells. */ readonly template = inject(TemplateRef); /** * Column key this template binds to — must match a {@link TableColumn.key}. */ readonly africaniesCellDef = input.required(); }