import type { BodyRow } from './bodyRows.js'; import type { DataColumn, DisplayColumn, FlatColumn } from './columns.js'; import { TableComponent } from './tableComponent.js'; import type { DataLabel, DisplayLabel } from './types/Label.js'; import type { AnyPlugins } from './types/TablePlugin.js'; import type { RenderConfig } from '@humanspeak/svelte-render'; import { type Readable } from 'svelte/store'; /** * Initialization options for creating a BodyCell. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export type BodyCellInit = { id: string; row: BodyRow; }; /** * HTML attributes for a body cell element. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export type BodyCellAttributes = { role: 'cell'; }; /** * Abstract base class representing a cell in the table body. * Extended by DataBodyCell for data cells and DisplayBodyCell for display-only cells. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export declare abstract class BodyCell extends TableComponent { abstract column: FlatColumn; row: BodyRow; constructor({ id, row }: BodyCellInit); abstract render(): RenderConfig; attrs(): Readable>; abstract clone(): BodyCell; /** * Gets a unique identifier combining the row ID and column ID. * * @returns A string in the format "rowId:columnId". */ rowColId(): string; /** * Gets a unique identifier combining the data row ID and column ID. * Only available for cells in data rows. * * @returns A string in the format "dataId:columnId", or undefined if not a data row. */ dataRowColId(): string | undefined; /** * Type guard to check if this cell is a data cell. * * @returns True if this is a DataBodyCell. */ isData(): this is DataBodyCell; /** * Type guard to check if this cell is a display cell. * * @returns True if this is a DisplayBodyCell. */ isDisplay(): this is DisplayBodyCell; } /** * Initialization options for creating a DataBodyCell. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. * @template Value - The type of the cell value. */ export type DataBodyCellInit = Omit, 'id'> & { /** The data column this cell belongs to. */ column: DataColumn; /** Optional custom label renderer for the cell. */ label?: DataLabel; /** The cell's value. */ value: Value; }; /** * HTML attributes for a data body cell element. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export type DataBodyCellAttributes = BodyCellAttributes; /** * A body cell that contains actual data from the data source. * Provides access to the cell value and custom rendering. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. * @template Value - The type of the cell value. */ export declare class DataBodyCell extends BodyCell { __data: boolean; /** The data column this cell belongs to. */ column: DataColumn; /** Optional custom label renderer for the cell. */ label?: DataLabel; /** The cell's value. */ value: Value; /** * Creates a new DataBodyCell. * * @param init - Initialization options. */ constructor({ row, column, label, value }: DataBodyCellInit); /** * Renders the cell content using the label function or the raw value. * * @returns The render configuration for displaying this cell. * @throws Error if state reference is missing when using a custom label. */ render(): RenderConfig; /** * Creates a copy of this cell. * * @returns A cloned DataBodyCell. */ clone(): DataBodyCell; } /** * Initialization options for creating a DisplayBodyCell. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export type DisplayBodyCellInit = Omit, 'id'> & { /** The display column this cell belongs to. */ column: DisplayColumn; /** The label renderer for the cell. */ label: DisplayLabel; }; /** * A body cell used for display purposes only (e.g., action buttons, checkboxes). * Does not contain direct data from the data source. * * @template Item - The type of data items in the table. * @template Plugins - The plugins used by the table. */ export declare class DisplayBodyCell extends BodyCell { __display: boolean; /** The display column this cell belongs to. */ column: DisplayColumn; /** The label renderer for the cell. */ label: DisplayLabel; /** * Creates a new DisplayBodyCell. * * @param init - Initialization options. */ constructor({ row, column, label }: DisplayBodyCellInit); /** * Renders the cell content using the label function. * * @returns The render configuration for displaying this cell. * @throws Error if state reference is missing. */ render(): RenderConfig; /** * Creates a copy of this cell. * * @returns A cloned DisplayBodyCell. */ clone(): DisplayBodyCell; }