import type { ReactNode } from 'react'; import { type DataTableViewRange } from './data-table-range-model.js'; import { type DataTableViewSelection, type DataTableViewSelectionResult } from './data-table-selection-model.js'; export type { DataTableViewRange } from './data-table-range-model.js'; export type { DataTableViewSelection, DataTableViewSelectionResult } from './data-table-selection-model.js'; export interface DataTableViewColumn { key: string; label: string; value?: (row: T) => string | number | null; canHide?: boolean; sortable?: boolean; filterOptions?: readonly { value: string; label: string; }[]; rangeFilter?: 'number' | 'date'; } /** Serializable view state; record objects remain outside this state. */ export interface DataTableViewState { search: string; filters: { id: string; value: string; }[]; ranges?: DataTableViewRange[]; visibility: Record; pagination: { pageIndex: number; pageSize: number; }; sorting: { id: string; desc: boolean; }[]; density: 'comfortable' | 'compact'; } export interface DataTableViewResult { rows: readonly T[]; isColumnVisible: (key: string) => boolean; visibleColumnCount: number; filteredCount: number; state: DataTableViewState; toggleSort: (key: string, multiple?: boolean) => void; selection: DataTableViewSelectionResult | undefined; } export interface DataTableViewLabels { search: string; columns: string; all: string; density: string; comfortable: string; compact: string; pageSize: string; previous: string; next: string; empty: string; rangeFrom: (column: string) => string; rangeTo: (column: string) => string; selectPage: string; clearSelection: string; selected: (count: number) => string; /** Receives one-based page and at least one page, including empty results. */ page: (page: number, pages: number, matchingRows: number) => string; } export interface DataTableViewProps { rows: readonly T[]; columns: readonly DataTableViewColumn[]; getRowId: (row: T) => string; children: (view: DataTableViewResult) => ReactNode; labels?: Partial; label: string; state?: DataTableViewState; defaultState?: Partial; onStateChange?: (state: DataTableViewState) => void; /** Server mode never filters, sorts or slices the supplied page. */ mode?: 'client' | 'server'; rowCount?: number; /** Keep existing application/server ordering while filtering and paging locally. */ manualSorting?: boolean; disabled?: boolean; toolbar?: ReactNode; searchable?: boolean; selection?: DataTableViewSelection; } export declare const DataTableView: (props: DataTableViewProps) => import("react").JSX.Element; //# sourceMappingURL=data-table-view.d.ts.map