import { CSSProperties } from 'react'; import { CellVerticalAlign, ColumnDef, ColumnKey } from './types'; /** * **Column width and `DataListTable` layout** * * Helpers used by `DataListTable` to turn `ColumnDef` min/max/`widthPercent` and viewport options * into pixel widths and frame metrics. Consumers who pass custom layout-related props should read * this summary so behavior matches expectations. * * **Width resolution** * - `resolveColumnWidth` / `resolveColumnWidthForRender` — combine `minWidth`, `maxWidth`, and * optional per-column caps (`maxWidthByColumnKey`). When responsive allocation supplies a map of * pixel widths, fixed widths override min for layout. * - `normalizeColumnWidthPercents` — turns `widthPercent` into fractions summing to 100; if all * missing/zero, columns split evenly. * * **Responsive path (`isResponsiveTable === true`)** * - `computeResponsiveColumnWidths` allocates integer pixel widths to data columns inside * `dataAreaWidthPx`. It subtracts **total** inter-column gap `(n − 1) × interColumnGapPx` first * (must match CSS `gap` between cells). Default `interColumnGapPx` is **0** (backward compatible). * - If usable width ≥ sum of mins: distribute **extra** space by normalized `widthPercent` weights, * respecting `maxWidth` caps where applicable; last column absorbs rounding remainder. * - If usable width **≤** sum of mins (narrow viewport): columns **shrink proportionally** by * `minWidth` ratios so the row does not rely on min-sum horizontal overflow (remainder goes to * the last column when needed). Zero usable width yields zero widths. * * **Non-responsive path (`isResponsiveTable === false`)** * - No per-column pixel map; table uses intrinsic min widths + rail. `effectiveW` is * `min(viewport, singleTableMinWidth)` unless `expandFrameWidthToViewport === true` **and** * `viewportWidth >= singleTableMinWidth`, in which case the frame grows to full viewport width. * Default `expandFrameWidthToViewport` is **false**. * * **`computeDataListTableLayout`** * - Single entry for viewport width + options: returns `effectiveW`, `centered`, * `columnWidthPxByKey` (only when responsive and not in the “narrow + horizontal scroll” early * exit), and `singleTableMinWidth`. When viewport is below `responsiveTableMinWidth` and horizontal * scroll is allowed, it returns without computing responsive column widths (legacy scroll * behavior). * * **Cell alignment helpers** * - `alignToJustify`, `cellVerticalAlignToFlexAlign`, `textAlignForCell` map column alignment enums * to CSS for flex and text. */ export declare function resolveColumnWidth(def: ColumnDef, maxWidthByColumnKey?: Partial>): { maxWidth: number | undefined; minWidth: number; }; /** Normalizes `widthPercent` values to sum to 100; equal split when all zero or missing. */ export declare function normalizeColumnWidthPercents(orderedColumns: ColumnDef[]): number[]; /** * Allocates integer pixel widths for data columns: mins are respected, remaining space is split * by normalized percent weights. Used when `isResponsiveTable` is true. * * @param interColumnGapPx — Total horizontal gap is `(n - 1) * interColumnGapPx` subtracted from * `dataAreaWidthPx` before allocation (e.g. flex `gap` between cells). */ export declare function computeResponsiveColumnWidths(orderedColumns: ColumnDef[], dataAreaWidthPx: number, maxWidthByColumnKey?: Partial>, interColumnGapPx?: number): Map; /** * Resolves layout width for a column: fixed px from `columnWidthPxByKey` when present (responsive), * otherwise legacy `minWidth` / caps. */ export declare function resolveColumnWidthForRender(def: ColumnDef, maxWidthByColumnKey: Partial> | undefined, columnWidthPxByKey: Map | undefined): { maxWidth: number | undefined; minWidth: number; }; export declare function sumOrderedMinWidths(ordered: ColumnDef[], maxWidthByColumnKey?: Partial>): number; export declare function computeDataListTableLayout(viewportWidth: number, opts: { centerWhenNarrow: boolean; isResponsiveTable: boolean; orderedColumns: ColumnDef[]; railW: number; columnGapPx?: number; expandFrameWidthToViewport?: boolean; isHorizontalScroll?: boolean; maxWidthByColumnKey?: Partial>; responsiveTableMaxWidth?: number; responsiveTableMinWidth?: number; }): { centered: boolean; columnWidthPxByKey: Map | undefined; effectiveW: number; singleTableMinWidth: number; }; export declare function alignToJustify(align: ColumnDef["align"]): CSSProperties["justifyContent"]; export declare function cellVerticalAlignToFlexAlign(align: CellVerticalAlign | undefined): NonNullable; export declare function textAlignForCell(align: ColumnDef["align"]): CSSProperties["textAlign"];