import { BuiltInSortingFn, SortingFn, Table } from '@tanstack/react-table'; /** * The comparison every `StyledTable` column uses unless the column, or the app's `defaultColumn`, names its own `sortingFn` * (ASMA-8597, P2f, DEC-SORTFN). It is registered as `sortingFns.styledDefault`. * * - Empty cells (`undefined`, `null`, `''`, whitespace only, `NaN`, an invalid `Date`) go last in both directions. Two empty * cells tie. * - Numbers, `Date`s and booleans compare by value; two ISO 8601 date strings compare by time. * - Any other two strings, and two values of different types, compare as text in the table locale: case and accents are * ignored and digit runs compare as numbers (`svc-9` before `svc-10`). * - Ties return 0, so TanStack keeps the data order. */ /** * The name the comparison is registered under in the table's `sortingFns`. It is typed as a built-in name because TanStack's * `SortingFns` interface, which would let `'styledDefault'` type-check, turns `sortingFns` into a required prop of every * `StyledTable` once it is augmented; the table registers the function itself, so no app needs to. */ export declare const STYLED_DEFAULT_SORTING_FN: BuiltInSortingFn; /** One collator per locale: building one is the expensive part of a text comparison. */ export declare const getSortCollator: (locale?: string) => Intl.Collator; /** Whether a cell has no value to sort on: such cells always go last. */ export declare const isEmptySortValue: (value: unknown) => boolean; /** Compares two cells that are not empty, ascending. A tie is exactly 0. */ export declare const compareSortValues: (a: unknown, b: unknown, collator: Intl.Collator) => number; /** * Builds the comparison. TanStack hands a sorting function only `(rowA, rowB, columnId)` and flips its result afterwards * for a descending sort and for `invertSorting`, so an empty cell would swap ends with the direction. To keep it last the * comparison reads the column's direction and `invertSorting` live from the table (`getTable` returns the table of the * render that sorts) and returns the sign that comes out "after" once TanStack has applied both flips. */ export declare const createStyledDefaultSortingFn: (getTable: () => Table | undefined) => SortingFn; /** The parts of a column definition that decide whether the default comparison applies to it. */ interface SortUndefinedColumnDef { sortingFn?: unknown; sortUndefined?: unknown; columns?: readonly SortUndefinedColumnDef[]; } /** * Gives `sortUndefined: false` to the leaf columns that sort with `styledDefault`, and to no other (DeepSeek's audit of * #340, round 1). The setting lets `undefined` reach the comparison so that it can put it last. A column with its own * `sortingFn` would then receive `undefined` in its own comparator, which was written for TanStack's handling and may not * expect it, so it keeps TanStack's default. * * A leaf gets it only when it sorts with `styledDefault` (neither it nor the app's `defaultColumn` names another * `sortingFn`) and neither it nor the app's `defaultColumn` sets `sortUndefined`. Group columns are walked into. */ export declare const resolveSortUndefinedDefaults: (columns: readonly TColumn[], defaultColumn?: SortUndefinedColumnDef) => TColumn[]; export {};