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

20 lines (19 loc) 790 B
import { type Writable } from 'svelte/store'; import type { BodyRow } from '../bodyRows.js'; import type { NewTablePropSet, TablePlugin } from '../types/TablePlugin.js'; export interface FlattenConfig { initialDepth?: number; } export interface FlattenState { depth: Writable<number>; } export interface FlattenColumnOptions<Item> extends Record<string, never> { } export type FlattenPropSet = NewTablePropSet<{ 'tbody.tr.td': { flatten: (depth: number) => void; unflatten: () => void; }; }>; export declare const getFlattenedRows: <Item, Row extends BodyRow<Item>>(rows: Row[], depth: number) => Row[]; export declare const addFlatten: <Item>({ initialDepth }?: FlattenConfig) => TablePlugin<Item, FlattenState, FlattenColumnOptions<Item>, FlattenPropSet>;