@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
42 lines (41 loc) • 1.35 kB
TypeScript
import { type Writable } from 'svelte/store';
import type { NewTableAttributeSet, NewTablePropSet, TablePlugin } from '../types/TablePlugin.js';
export interface AddResizedColumnsConfig {
onResizeEnd?: (ev: Event) => void;
}
export type ResizedColumnsState = {
columnWidths: Writable<Record<string, number>>;
};
export type ResizedColumnsColumnOptions = {
initialWidth?: number;
minWidth?: number;
maxWidth?: number;
disable?: boolean;
};
export type ResizedColumnsPropSet = NewTablePropSet<{
'thead.tr.th': {
(node: Element): void;
drag: (node: Element) => void;
reset: (node: Element) => void;
disabled: boolean;
};
}>;
export type ResizedColumnsAttributeSet = NewTableAttributeSet<{
'thead.tr.th': {
style?: {
width: string;
'min-width': string;
'max-width': string;
'box-sizing': 'border-box';
};
};
'tbody.tr.td': {
style?: {
width: string;
'min-width': string;
'max-width': string;
'box-sizing': 'border-box';
};
};
}>;
export declare const addResizedColumns: <Item>({ onResizeEnd }?: AddResizedColumnsConfig) => TablePlugin<Item, ResizedColumnsState, ResizedColumnsColumnOptions, ResizedColumnsPropSet, ResizedColumnsAttributeSet>;