import "../createRegistry/index.mjs"; import { ColumnNode } from "../createDataTable/columns.mjs"; import { Ref } from "vue"; //#region src/composables/createDataGrid/layout.d.ts type PinPosition = 'left' | 'right' | false; interface GridColumnDef extends ColumnNode { /** Width as a percentage (0–100). Unset columns share remaining space equally. */ readonly size?: number; /** Minimum width as a percentage. @default 2 */ readonly minSize?: number; /** Maximum width as a percentage. @default 100 */ readonly maxSize?: number; /** Pin position. @default false */ readonly pinned?: PinPosition; /** Allow resizing. @default true */ readonly resizable?: boolean; /** Allow reordering. @default true */ readonly reorderable?: boolean; readonly children?: readonly GridColumnDef[]; } interface ResolvedColumn { id: string; index: number; /** Current size as a percentage */ size: number; /** Distance from the column's pinning edge — left edge for left/scrollable, right edge for right. Apply directly as the CSS `left` / `right` value for sticky positioning. */ offset: number; pinned: PinPosition; resizable: boolean; reorderable: boolean; minSize: number; maxSize: number; /** Whether the column is part of the render set. Always `true` for render-set entries; meaningful on `all`, where hidden columns surface as `false`. */ visible: boolean; } interface PinnedRegion { left: ResolvedColumn[]; scrollable: ResolvedColumn[]; right: ResolvedColumn[]; } interface ColumnLayout { /** Resolved columns for each pin region (hidden columns excluded) */ pinned: Readonly>; /** All visible resolved columns in display order (hidden columns excluded) */ columns: Readonly>; /** Every column in display order, including hidden ones, each carrying a `visible` flag — for a column chooser. */ all: Readonly>; /** Pin a column to a region (or unpin with false) */ pin: (id: string, position: PinPosition) => void; /** * Resize a column by delta percentage within its pin region. * The neighbor to the right absorbs the inverse delta. * No-op for the last column in its region or non-resizable columns. */ resize: (id: string, delta: number) => void; /** * Move a column from one display-order index to another. Indices address * the visible display set (matching `columns`), so hidden columns are not * counted. No-op if the resolved top-level group has `reorderable: false`. */ reorder: (from: number, to: number) => void; /** * Replace visible-column sizes in registry (mount) order, not pin display order. * Hidden columns keep their sizes. Length must match the visible leaf count. */ distribute: (sizes: number[]) => void; /** Show a previously hidden column */ show: (id: string) => void; /** Hide a column — excludes it from the render set without redistributing */ hide: (id: string) => void; /** Toggle a column's visibility */ toggle: (id: string) => void; /** Restore initial sizes, order, and pins */ reset: () => void; } //#endregion export { ColumnLayout, GridColumnDef, PinPosition, PinnedRegion, ResolvedColumn };