import { type Writable } from 'svelte/store'; import type { NewTablePropSet, TablePlugin } from '../types/TablePlugin.js'; /** * Configuration options for the addColumnOrder plugin. */ export interface ColumnOrderConfig { /** Initial order of column IDs. Columns are ordered in this sequence. */ initialColumnIdOrder?: string[]; /** If true, columns not in the order list are hidden. Defaults to false. */ hideUnspecifiedColumns?: boolean; } /** * State exposed by the addColumnOrder plugin. */ export interface ColumnOrderState { /** Writable store containing the ordered list of column IDs. */ columnIdOrder: Writable; } /** * Creates a column order plugin that enables reordering table columns. * Columns are displayed in the order specified by columnIdOrder. * * @template Item - The type of data items in the table. * @param config - Configuration options. * @returns A TablePlugin that provides column ordering functionality. * @example * ```typescript * const table = createTable(data, { * order: addColumnOrder({ * initialColumnIdOrder: ['name', 'age', 'email'], * hideUnspecifiedColumns: false * }) * }) * * // Reorder columns dynamically * const { columnIdOrder } = table.pluginStates.order * columnIdOrder.set(['email', 'name', 'age']) * ``` */ export declare const addColumnOrder: ({ initialColumnIdOrder, hideUnspecifiedColumns }?: ColumnOrderConfig) => TablePlugin, NewTablePropSet>;