import { type Readable } from 'svelte/store'; import { BodyCell } from './bodyCells.js'; import type { FlatColumn } from './columns.js'; import { TableComponent } from './tableComponent.js'; import type { AnyPlugins } from './types/TablePlugin.js'; export type BodyRowInit = { id: string; cells: BodyCell[]; cellForId: Record>; depth?: number; parentRow?: BodyRow; }; export type BodyRowAttributes = { role: 'row'; }; export declare abstract class BodyRow extends TableComponent { cells: BodyCell[]; /** * Get the cell with a given column id. * * **This includes hidden cells.** */ cellForId: Record>; depth: number; parentRow?: BodyRow; subRows?: BodyRow[]; constructor({ id, cells, cellForId, depth, parentRow }: BodyRowInit); attrs(): Readable>; abstract clone(props?: BodyRowCloneProps): BodyRow; isData(): this is DataBodyRow; isDisplay(): this is DisplayBodyRow; } type BodyRowCloneProps = { includeCells?: boolean; includeSubRows?: boolean; }; export type DataBodyRowInit = BodyRowInit & { dataId: string; original: Item; }; export declare class DataBodyRow extends BodyRow { __data: boolean; dataId: string; original: Item; constructor({ id, dataId, original, cells, cellForId, depth, parentRow, }: DataBodyRowInit); clone({ includeCells, includeSubRows }?: BodyRowCloneProps): DataBodyRow; } export type DisplayBodyRowInit = BodyRowInit; export declare class DisplayBodyRow extends BodyRow { __display: boolean; constructor({ id, cells, cellForId, depth, parentRow }: DisplayBodyRowInit); clone({ includeCells, includeSubRows }?: BodyRowCloneProps): DisplayBodyRow; } export interface BodyRowsOptions { rowDataId?: (item: Item, index: number) => string; } /** * Converts an array of items into an array of table `BodyRow`s based on the column structure. * @param data The data to display. * @param flatColumns The column structure. * @returns An array of `BodyRow`s representing the table structure. */ export declare const getBodyRows: (data: Item[], flatColumns: FlatColumn[], { rowDataId }?: BodyRowsOptions) => BodyRow[]; /** * Arranges and hides columns in an array of `BodyRow`s based on * `columnIdOrder` by transforming the `cells` property of each row. * * `cellForId` should remain unaffected. * * @param rows The rows to transform. * @param columnIdOrder The column order to transform to. * @returns A new array of `BodyRow`s with corrected row references. */ export declare const getColumnedBodyRows: (rows: BodyRow[], columnIdOrder: string[]) => BodyRow[]; /** * Converts an array of items into an array of table `BodyRow`s based on a parent row. * @param subItems The sub data to display. * @param parentRow The parent row. * @returns An array of `BodyRow`s representing the child rows of `parentRow`. */ export declare const getSubRows: (subItems: Item[], parentRow: BodyRow, { rowDataId }?: BodyRowsOptions) => BodyRow[]; export {};