UNPKG

@humanspeak/svelte-headless-table

Version:

A powerful, headless table library for Svelte that provides complete control over table UI while handling complex data operations like sorting, filtering, pagination, grouping, and row expansion. Build custom, accessible data tables with zero styling opin

18 lines (17 loc) 833 B
import { type Readable, type Writable } from 'svelte/store'; import type { BodyRow } from '../bodyRows.js'; import type { NewTablePropSet, TablePlugin } from '../types/TablePlugin.js'; import { type RecordSetStore } from '../utils/store.js'; export interface ExpandedRowsConfig<Item> { initialExpandedIds?: Record<string, boolean>; } export interface ExpandedRowsState<Item> { expandedIds: RecordSetStore<string>; getRowState: (row: BodyRow<Item>) => ExpandedRowsRowState; } export interface ExpandedRowsRowState { isExpanded: Writable<boolean>; canExpand: Readable<boolean>; isAllSubRowsExpanded: Readable<boolean>; } export declare const addExpandedRows: <Item>({ initialExpandedIds }?: ExpandedRowsConfig<Item>) => TablePlugin<Item, ExpandedRowsState<Item>, Record<string, never>, NewTablePropSet<never>>;