@jielga/tmdatagrid 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.d.ts +289 -9
  2. package/dist/index.js +1418 -1280
  3. package/dist/index.js.map +1 -1
  4. package/docs/columns.md +8 -0
  5. package/docs/editors.md +31 -0
  6. package/docs/filtering.md +2 -1
  7. package/docs/grouping.md +1 -1
  8. package/docs/localization.md +3 -3
  9. package/docs/persistence.md +88 -0
  10. package/docs/typed-deep-links.md +169 -0
  11. package/package.json +1 -1
  12. package/skills/appearance/SKILL.md +1 -1
  13. package/skills/appearance/references/labels.md +3 -3
  14. package/skills/cell-selection/SKILL.md +1 -1
  15. package/skills/columns/SKILL.md +5 -2
  16. package/skills/columns/references/columns-api.md +1 -0
  17. package/skills/data/SKILL.md +1 -1
  18. package/skills/editing/SKILL.md +15 -2
  19. package/skills/editing/references/editing-api.md +2 -1
  20. package/skills/editing/references/editors-and-validation.md +24 -0
  21. package/skills/filtering/SKILL.md +3 -2
  22. package/skills/getting-started/SKILL.md +2 -2
  23. package/skills/grouping/SKILL.md +2 -2
  24. package/skills/migrating-to-2/SKILL.md +1 -1
  25. package/skills/options/SKILL.md +30 -6
  26. package/skills/options/references/typed-links.md +134 -0
  27. package/skills/rows/SKILL.md +1 -1
  28. package/skills/server-side/SKILL.md +1 -1
  29. package/skills/testing/SKILL.md +1 -1
  30. package/skills/testing-components/SKILL.md +1 -1
  31. package/skills/testing-editing/SKILL.md +1 -1
  32. package/src/components/TMDataGridFilterPills.tsx +15 -1
  33. package/src/components/TMDataGridGroupColumn.tsx +19 -4
  34. package/src/components/TMDataGridHeaderFilterRow.tsx +7 -1
  35. package/src/core/editEngine.ts +101 -5
  36. package/src/core/filterOperators.ts +41 -18
  37. package/src/core/grouping.ts +11 -3
  38. package/src/core/labels.ts +4 -3
  39. package/src/core/persistence.ts +9 -1
  40. package/src/core/urlState.ts +439 -0
  41. package/src/core/valueText.ts +46 -0
  42. package/src/index.ts +15 -0
  43. package/src/useTMDataGrid.tsx +51 -8
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BoxProps, MantineSize, MenuProps } from "@mantine/core";
2
2
  import { CSSProperties, ComponentType, MouseEvent, MutableRefObject, ReactNode } from "react";
3
- import { AccessorFn, AccessorFnColumnDef, AccessorKeyColumnDef, Cell, Column, ColumnFiltersState, ColumnHelper, ColumnPinningState, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, FilterMeta, GroupColumnDef, Header, IdentifiedColumnDef, Row, RowData, RowSelectionState, Table, TableFeatures, TableOptions, TableState, aggregationFns } from "@tanstack/react-table";
3
+ import { AccessorFn, AccessorFnColumnDef, AccessorKeyColumnDef, Cell, Column, ColumnDef, ColumnFiltersState, ColumnHelper, ColumnPinningState, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, FilterMeta, GroupColumnDef, Header, IdentifiedColumnDef, Row, RowData, RowSelectionState, Table, TableFeatures, TableOptions, TableState, aggregationFns } from "@tanstack/react-table";
4
4
  import { Store } from "@tanstack/store";
5
5
  import { AnyFieldApi, AnyFormApi, StandardSchemaV1 } from "@tanstack/react-form";
6
6
  import { RankingInfo } from "@tanstack/match-sorter-utils";
@@ -390,6 +390,24 @@ type TMDataGridEditValueMapArgs = {
390
390
  * user sees, what validators judge and what commits.
391
391
  */
392
392
  type TMDataGridEditValueMap = (args: TMDataGridEditValueMapArgs) => unknown;
393
+ /** What `meta.edit.mapCommitValue` is handed for one field of a row being committed. */
394
+ type TMDataGridEditCommitMapArgs = {
395
+ /** The value the field holds as the row is committed. */
396
+ value: unknown;
397
+ /** What the field held when editing began. */
398
+ previous: unknown;
399
+ /** The row being committed. `undefined` for a row that is being added. */
400
+ row: ErasedRow$1 | undefined;
401
+ column: ErasedColumn$1;
402
+ table: TMDataGridTable<TMDataGridRowData>;
403
+ };
404
+ /**
405
+ * `meta.edit.mapCommitValue` - the value as the row commits, mapped.
406
+ *
407
+ * Runs once per field, not per keystroke, so the user can type what the
408
+ * mapped value would not allow, like a trailing space.
409
+ */
410
+ type TMDataGridEditCommitMap = (args: TMDataGridEditCommitMapArgs) => unknown;
393
411
  /**
394
412
  * `meta.edit` - everything about how this column is edited, in one place,
395
413
  * mirroring the `edit.*` engine the grid exposes at runtime.
@@ -440,6 +458,14 @@ type TMDataGridColumnEditOptions<TData extends RowData = TMDataGridRowData> = {
440
458
  * {@link TMDataGridEditValueMap}.
441
459
  */
442
460
  mapValue?: TMDataGridEditValueMap;
461
+ /**
462
+ * Maps the value of each field the user changed, once, as its row commits -
463
+ * trim a string the user was free to type spaces into. It runs before the
464
+ * validators of the submit, and its result is written back into the form,
465
+ * so the draft, `changes` and `onCommit` hold the mapped value. See
466
+ * {@link TMDataGridEditCommitMap}.
467
+ */
468
+ mapCommitValue?: TMDataGridEditCommitMap;
443
469
  };
444
470
  /** A new row being committed - `onRowAdd`, and `saveDrafts`'s `created`. */
445
471
  type TMDataGridRowAddArgs<TData extends RowData> = {
@@ -815,7 +841,7 @@ type TMDataGridLabels = {
815
841
  filterTo: string;
816
842
  /** `DgTriStateFilter`'s no-filter segment. */
817
843
  filterAll: string;
818
- /** What a boolean column's `true` reads as - its filter choice and cell text. */
844
+ /** What a boolean `true` reads as - its filter choice, filter pill and group row. */
819
845
  booleanTrue: string;
820
846
  booleanFalse: string;
821
847
  addFilter: string;
@@ -1465,6 +1491,209 @@ type ResolveRangeBoundsArgs = {
1465
1491
  */
1466
1492
  declare function resolveRangeBounds({ range, rowIndexOf, columnIndexOf }: ResolveRangeBoundsArgs): TMDataGridRangeBounds | null;
1467
1493
  //#endregion
1494
+ //#region .types-tmp/core/urlState.d.ts
1495
+ /**
1496
+ * Typed deep links.
1497
+ *
1498
+ * `createTMDataGridColumnHelper` returns columns that carry, in their type
1499
+ * only, what a link needs to know about them: the id, the `meta.type`, the
1500
+ * value type, the offered operators, and whether the column can be filtered,
1501
+ * sorted and put in the URL. `createTMDataGridUrlState` reads that from the
1502
+ * grid's own columns, so a link can name only what the grid can show: a
1503
+ * filter on a column the grid lacks, an operator its type does not offer or a
1504
+ * value of the wrong type is a compile error, not a link that silently opens
1505
+ * unfiltered.
1506
+ *
1507
+ * Nothing here is visible at runtime except the definition object. The
1508
+ * column brand is a type, never a property.
1509
+ */
1510
+ /**
1511
+ * What a column built with `createTMDataGridColumnHelper` tells a typed link
1512
+ * about itself. Read from literal values in the column definition: a value
1513
+ * that is not a literal (`enableSorting: isAdmin`) reads as "not allowed".
1514
+ */
1515
+ type TMDataGridColumnInfo = {
1516
+ /** The column id, by TanStack's rule: `id`, else the accessor key with `.` replaced by `_`. */
1517
+ id: string;
1518
+ /** `meta.type`, `"string"` when unset. */
1519
+ type: TMDataGridColumnType;
1520
+ /** The value type the accessor returns. */
1521
+ value: unknown;
1522
+ /** `meta.filter.operators`, every operator when unset. */
1523
+ operators: TMDataGridFilterOperator;
1524
+ /** `enableColumnFilter` is not `false`. */
1525
+ filterable: boolean;
1526
+ /** `enableSorting` is not `false`. */
1527
+ sortable: boolean;
1528
+ /** `meta.filter.url` is not `false`. */
1529
+ url: boolean;
1530
+ };
1531
+ declare const columnInfo: unique symbol;
1532
+ /**
1533
+ * The type-only brand a column helper column carries. Never present at
1534
+ * runtime, so spreading, cloning or serializing a column is unaffected.
1535
+ */
1536
+ type TMDataGridTypedColumn<TInfo extends TMDataGridColumnInfo> = {
1537
+ readonly [columnInfo]: TInfo;
1538
+ };
1539
+ /** The info of every leaf column in `TColumn`, a group's children included. */
1540
+ type TMDataGridColumnInfoOf<TColumn> = TColumn extends TMDataGridTypedColumn<infer TInfo> ? TInfo : never;
1541
+ /** `"address.city"` becomes `"address_city"`, as TanStack derives the id. */
1542
+ type DotsToUnderscores<S extends string> = S extends `${infer Head}.${infer Tail}` ? `${Head}_${DotsToUnderscores<Tail>}` : S;
1543
+ /**
1544
+ * The column id the helper's `accessor` call produces: the explicit `id`,
1545
+ * else the accessor key. An accessor function without an `id` gets `never`,
1546
+ * which no link can name.
1547
+ */
1548
+ type TMDataGridAccessorColumnId<TAccessor, TId extends string> = [TId] extends [never] ? TAccessor extends string ? DotsToUnderscores<TAccessor> : never : TId;
1549
+ /**
1550
+ * The column options whose literal values a typed link reads. Intersected into
1551
+ * the column helper's parameter so each one is inferred as a literal.
1552
+ *
1553
+ * @internal
1554
+ */
1555
+ type TMDataGridColumnInfoHints<TId extends string, TType extends TMDataGridColumnType, TOperator extends TMDataGridFilterOperator, TFilterable extends boolean, TSortable extends boolean, TUrl extends boolean> = {
1556
+ id?: TId;
1557
+ enableColumnFilter?: TFilterable;
1558
+ enableSorting?: TSortable;
1559
+ meta?: {
1560
+ type?: TType;
1561
+ filter?: {
1562
+ operators?: ReadonlyArray<TOperator>;
1563
+ url?: TUrl;
1564
+ };
1565
+ };
1566
+ };
1567
+ /** A `Date`, or an ISO `YYYY-MM-DD` string. */
1568
+ type TMDataGridDateInput = Date | string;
1569
+ /** One choice of a select column: the value, or an element of an array value. */
1570
+ type OptionOf<TValue> = NonNullable<TValue> extends ReadonlyArray<infer TElement> ? TElement : NonNullable<TValue>;
1571
+ type ScalarInput = {
1572
+ string: string;
1573
+ number: number;
1574
+ date: TMDataGridDateInput;
1575
+ boolean: boolean;
1576
+ select: string;
1577
+ multiSelect: string;
1578
+ };
1579
+ type RangeEnd<TType extends TMDataGridColumnType> = TType extends "date" ? TMDataGridDateInput : TType extends "number" ? number : string;
1580
+ /** One filter on one column: an operator, and the value that operator takes. */
1581
+ type FilterInputFor<TType extends TMDataGridColumnType, TValue, TOperator extends TMDataGridFilterOperator> = TOperator extends "isEmpty" | "isNotEmpty" ? {
1582
+ operator: TOperator;
1583
+ } : TOperator extends "isAnyOf" | "isNoneOf" ? {
1584
+ operator: TOperator;
1585
+ value: ReadonlyArray<OptionOf<TValue>>;
1586
+ } : TOperator extends "between" ? {
1587
+ operator: TOperator;
1588
+ /** `null` leaves that end open. */
1589
+ value: readonly [from: RangeEnd<TType> | null, to: RangeEnd<TType> | null];
1590
+ } : {
1591
+ operator: TOperator;
1592
+ value: ScalarInput[TType];
1593
+ };
1594
+ /** Columns a link may filter: filterable, and not kept out of the URL. */
1595
+ type LinkFilterable<TInfo extends TMDataGridColumnInfo> = Extract<TInfo, {
1596
+ filterable: true;
1597
+ url: true;
1598
+ }>;
1599
+ /**
1600
+ * The `filters` a link accepts: one optional entry per filterable column.
1601
+ * With no filterable column it accepts no entry at all - an empty object type
1602
+ * would let any key through, since TypeScript skips the unknown-key check
1603
+ * against `{}`.
1604
+ */
1605
+ type TMDataGridUrlFiltersInput<TInfo extends TMDataGridColumnInfo> = [LinkFilterable<TInfo>] extends [never] ? Record<string, never> : { [TColumn in LinkFilterable<TInfo> as TColumn["id"]]?: FilterInputFor<TColumn["type"], TColumn["value"], Extract<OperatorsByColumnType[TColumn["type"]], TColumn["operators"]>>; };
1606
+ /** The ids a link may sort by. */
1607
+ type TMDataGridUrlSortableId<TInfo extends TMDataGridColumnInfo> = Extract<TInfo, {
1608
+ sortable: true;
1609
+ }>["id"];
1610
+ type Carries<TSlices extends ReadonlyArray<TMDataGridDataSlice>, TSlice extends TMDataGridDataSlice> = TSlice extends TSlices[number] ? true : false;
1611
+ /** What a link may set: only the slices the definition carries, only the grid's columns. */
1612
+ type TMDataGridUrlInput<TInfo extends TMDataGridColumnInfo, TSlices extends ReadonlyArray<TMDataGridDataSlice>> = (Carries<TSlices, "columnFilters"> extends true ? {
1613
+ filters?: TMDataGridUrlFiltersInput<TInfo>;
1614
+ } : unknown) & (Carries<TSlices, "globalFilter"> extends true ? {
1615
+ globalFilter?: string;
1616
+ } : unknown) & (Carries<TSlices, "sorting"> extends true ? {
1617
+ sorting?: ReadonlyArray<{
1618
+ id: TMDataGridUrlSortableId<TInfo>;
1619
+ /** Defaults to `false`. */
1620
+ desc?: boolean;
1621
+ }>;
1622
+ } : unknown) & (Carries<TSlices, "pagination"> extends true ? {
1623
+ pagination?: {
1624
+ pageIndex: number;
1625
+ pageSize: number;
1626
+ };
1627
+ } : unknown);
1628
+ /** What the grid keeps in its URL param: the data slices, in the grid's own state shape. */
1629
+ type TMDataGridUrlPayload = {
1630
+ columnFilters?: Array<TMDataGridColumnFilter>;
1631
+ /** `null` is a search the user cleared, as opposed to one the link does not set. */
1632
+ globalFilter?: string | null;
1633
+ sorting?: Array<{
1634
+ id: string;
1635
+ desc: boolean;
1636
+ }>;
1637
+ pagination?: {
1638
+ pageIndex: number;
1639
+ pageSize: number;
1640
+ };
1641
+ expanded?: true | Record<string, boolean>;
1642
+ };
1643
+ /**
1644
+ * A router's search, read and written as values rather than strings, for
1645
+ * routers that keep objects in their search params and encode them
1646
+ * themselves, such as TanStack Router.
1647
+ */
1648
+ type TMDataGridUrlSearchStorage = {
1649
+ /** The param's current value in the router's search, or `undefined`. */
1650
+ get(name: string): unknown;
1651
+ /** Sets the param to `value`, or removes it on `undefined`. */
1652
+ set(name: string, value: TMDataGridUrlPayload | undefined): void;
1653
+ };
1654
+ type TMDataGridUrlState<TKey extends string, TSlices extends ReadonlyArray<TMDataGridDataSlice>, TInfo extends TMDataGridColumnInfo> = {
1655
+ /** The URL search param. */
1656
+ readonly key: TKey;
1657
+ /** The data slices the param carries. */
1658
+ readonly slices: TSlices;
1659
+ /** For `persist.urlKey`. */
1660
+ readonly urlKey: TMDataGridPersistKey<TMDataGridDataSlice>;
1661
+ /** The param's value for a link, or `undefined` when the input sets nothing. */
1662
+ payload(input: TMDataGridUrlInput<TInfo, TSlices>): TMDataGridUrlPayload | undefined;
1663
+ /** The search object for a router link, `{ [key]: payload }`. */
1664
+ search(input: TMDataGridUrlInput<TInfo, TSlices>): { [K in TKey]: TMDataGridUrlPayload | undefined; };
1665
+ /**
1666
+ * The search params for a plain link, encoded the way the grid's default
1667
+ * `serialize` encodes them. Pass the `serialize` you gave `persist`, if any.
1668
+ */
1669
+ searchParams(input: TMDataGridUrlInput<TInfo, TSlices>, options?: {
1670
+ serialize?: (payload: TMDataGridUrlPayload) => string;
1671
+ }): URLSearchParams;
1672
+ /**
1673
+ * A route search validator: keeps the param when it is an object and drops
1674
+ * anything else. The grid checks every slice itself when it reads the param.
1675
+ */
1676
+ validateSearch(search: Record<string, unknown>): { [K in TKey]?: TMDataGridUrlPayload; };
1677
+ /**
1678
+ * `urlKey`, plus a `urlStorage` over `storage` when one is given. Without
1679
+ * one, the grid reads and writes the browser's URL itself.
1680
+ */
1681
+ persist(storage?: TMDataGridUrlSearchStorage): Pick<TMDataGridPersistence, "urlKey" | "urlStorage">;
1682
+ };
1683
+ /**
1684
+ * Defines a grid's deep links from its columns. `columns` is the array the
1685
+ * grid renders, built with `createTMDataGridColumnHelper`; it decides which
1686
+ * filters, operators, values and sorts a link may name.
1687
+ */
1688
+ declare function createTMDataGridUrlState<const TKey extends string, TColumns extends ReadonlyArray<unknown>, const TSlices extends ReadonlyArray<TMDataGridDataSlice> = typeof DATA_STATE_SLICES>(options: {
1689
+ /** The URL search param. */
1690
+ key: TKey;
1691
+ /** The grid's columns. */
1692
+ columns: TColumns;
1693
+ /** The data slices the param carries. Defaults to every data slice. */
1694
+ slices?: TSlices;
1695
+ }): TMDataGridUrlState<TKey, TSlices, TMDataGridColumnInfoOf<TColumns[number]>>;
1696
+ //#endregion
1468
1697
  //#region .types-tmp/core/export.d.ts
1469
1698
  type ErasedRow = Row<TMDataGridFeatures, TMDataGridRowData>;
1470
1699
  type ErasedColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
@@ -1955,12 +2184,30 @@ type WithRowTypedMeta<TDef, TData extends RowData> = TDef extends unknown ? Omit
1955
2184
  * TanStack's column helper with `meta` typed against `TData`, so the
1956
2185
  * `meta.options` and `meta.edit.enabled` callbacks receive
1957
2186
  * `Row<TMDataGridFeatures, TData>`.
2187
+ *
2188
+ * Every column it returns also carries `TMDataGridColumnInfo` in its type,
2189
+ * read from the literal values of `id`, `meta.type`,
2190
+ * `meta.filter.operators`, `meta.filter.url`, `enableColumnFilter` and
2191
+ * `enableSorting`. `createTMDataGridUrlState` reads it to type the links into
2192
+ * the grid. TanStack's own return type keeps none of this: it types
2193
+ * `accessorKey` as a plain string.
1958
2194
  */
1959
2195
  type TMDataGridColumnHelper<TData extends RowData> = {
1960
- accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never>(accessor: TAccessor, column: WithRowTypedMeta<TAccessor extends AccessorFn<TData> ? DisplayColumnDef<TMDataGridFeatures, TData, TValue> : IdentifiedColumnDef<TMDataGridFeatures, TData, TValue>, TData>) => TAccessor extends AccessorFn<TData> ? AccessorFnColumnDef<TMDataGridFeatures, TData, TValue> : AccessorKeyColumnDef<TMDataGridFeatures, TData, TValue>;
2196
+ accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never, const TId extends string = never, TType extends TMDataGridColumnType = "string", TOperator extends TMDataGridFilterOperator = TMDataGridFilterOperator, TFilterable extends boolean = true, TSortable extends boolean = true, TUrl extends boolean = true>(accessor: TAccessor, column: WithRowTypedMeta<TAccessor extends AccessorFn<TData> ? DisplayColumnDef<TMDataGridFeatures, TData, TValue> : IdentifiedColumnDef<TMDataGridFeatures, TData, TValue>, TData> & TMDataGridColumnInfoHints<TId, TType, TOperator, TFilterable, TSortable, TUrl>) => (TAccessor extends AccessorFn<TData> ? AccessorFnColumnDef<TMDataGridFeatures, TData, TValue> : AccessorKeyColumnDef<TMDataGridFeatures, TData, TValue>) & TMDataGridTypedColumn<{
2197
+ id: TMDataGridAccessorColumnId<TAccessor, TId>;
2198
+ type: TType;
2199
+ value: TValue;
2200
+ operators: TOperator;
2201
+ filterable: TFilterable;
2202
+ sortable: TSortable;
2203
+ url: TUrl;
2204
+ }>;
1961
2205
  columns: ColumnHelper<TMDataGridFeatures, TData>["columns"];
1962
2206
  display: (column: WithRowTypedMeta<DisplayColumnDef<TMDataGridFeatures, TData>, TData>) => DisplayColumnDef<TMDataGridFeatures, TData, unknown>;
1963
- group: (column: WithRowTypedMeta<GroupColumnDef<TMDataGridFeatures, TData, unknown>, TData>) => GroupColumnDef<TMDataGridFeatures, TData, unknown>;
2207
+ /** A header group. Carries the column info of every column under it. */
2208
+ group: <const TChildren extends ReadonlyArray<ColumnDef<TMDataGridFeatures, TData, any>>>(column: WithRowTypedMeta<Omit<GroupColumnDef<TMDataGridFeatures, TData, unknown>, "columns">, TData> & {
2209
+ columns: TChildren;
2210
+ }) => GroupColumnDef<TMDataGridFeatures, TData, unknown> & TMDataGridTypedColumn<TMDataGridColumnInfoOf<TChildren[number]>>;
1964
2211
  };
1965
2212
  declare function createTMDataGridColumnHelper<TData extends RowData>(): TMDataGridColumnHelper<TData>;
1966
2213
  /** What the `renderDetails` render prop is handed for an expanded row. */
@@ -2267,7 +2514,7 @@ type TMDataGridEditingCallbacks<TData extends RowData> = {
2267
2514
  * One TanStack Form per editing row; drafts survive scrolling because the
2268
2515
  * forms live outside the DOM, keyed by row id. Which columns edit, and with
2269
2516
  * what, is declared per column under `meta.edit`: `meta.type` picks the
2270
- * built-in editor, and `enabled`, `field`, `editor`, `validate` and `mapValue`
2517
+ * built-in editor, and `enabled`, `field`, `editor`, `validate`, `mapValue` and `mapCommitValue`
2271
2518
  * override the rest.
2272
2519
  */
2273
2520
  type TMDataGridEditingOptions<TData extends RowData> = TMDataGridEditingCallbacks<TData> & {
@@ -2671,6 +2918,22 @@ type TMDataGridFilterValue = {
2671
2918
  type TMDataGridColumnType = "string" | "number" | "boolean" | "date" | "select" | "multiSelect";
2672
2919
  type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "between" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
2673
2920
  declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
2921
+ declare const OPERATORS_BY_TYPE: {
2922
+ readonly string: readonly ["contains", "equals", "notEquals", "startsWith", "endsWith", "isEmpty", "isNotEmpty"];
2923
+ readonly number: readonly ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "isEmpty", "isNotEmpty"];
2924
+ readonly boolean: readonly ["equals", "notEquals", "isEmpty", "isNotEmpty"];
2925
+ readonly date: readonly ["equals", "notEquals", "before", "after", "onOrBefore", "onOrAfter", "between", "isEmpty", "isNotEmpty"];
2926
+ readonly select: readonly ["isAnyOf", "isNoneOf", "isEmpty", "isNotEmpty"];
2927
+ readonly multiSelect: readonly ["isAnyOf", "isNoneOf", "isEmpty", "isNotEmpty"];
2928
+ };
2929
+ /**
2930
+ * The operators each column type offers, as a type: the same lists the filter
2931
+ * panel offers, so a typed link can never name an operator the panel lacks.
2932
+ *
2933
+ * @internal Feeds the typed links in urlState.ts; not exported from the
2934
+ * package.
2935
+ */
2936
+ type OperatorsByColumnType = { [TType in TMDataGridColumnType]: (typeof OPERATORS_BY_TYPE)[TType][number]; };
2674
2937
  declare function getOperatorsForType(type: TMDataGridColumnType): readonly TMDataGridFilterOperator[];
2675
2938
  declare function operatorNeedsValue(operator: TMDataGridFilterOperator): boolean;
2676
2939
  /** Whether the operator's value is a string array - `isAnyOf` / `isNoneOf`. */
@@ -2726,14 +2989,19 @@ declare function activeColumnFilters<TData extends RowData>(source: TMDataGridTa
2726
2989
  *
2727
2990
  * The type's default operator is left implicit - "First name: Sofia" reads the
2728
2991
  * way a person would say it - while any other operator is spelled out, since
2729
- * that is the part a reader cannot guess.
2992
+ * that is the part a reader cannot guess. A value with an option reads as the
2993
+ * option's label, and a boolean as `labels.booleanTrue` / `booleanFalse`.
2730
2994
  */
2731
- declare function formatFilterLabel({ label, type, filter, operatorLabels }: {
2995
+ declare function formatFilterLabel({ label, type, filter, operatorLabels, options, labels }: {
2732
2996
  label: string;
2733
2997
  type: TMDataGridColumnType;
2734
2998
  filter: TMDataGridFilterValue;
2735
2999
  /** Localized operator names - `labels.operators`. Defaults to English. */
2736
3000
  operatorLabels?: Record<TMDataGridFilterOperator, string>;
3001
+ /** The column's options, so a value reads as its option's label. */
3002
+ options?: ReadonlyArray<TMDataGridOption>;
3003
+ /** What a boolean value reads as. Defaults to English. */
3004
+ labels?: Pick<TMDataGridLabels, "booleanTrue" | "booleanFalse">;
2737
3005
  }): string;
2738
3006
  declare function matchesFilter(cellValue: unknown, { operator, value }: TMDataGridFilterValue): boolean;
2739
3007
  /**
@@ -3626,6 +3894,16 @@ declare const ROW_NUMBER_COLUMN_ID = "__rowNumber__";
3626
3894
  //#region .types-tmp/components/TMDataGridGroupColumn.d.ts
3627
3895
  declare const GROUP_COLUMN_ID = "__group__";
3628
3896
  //#endregion
3897
+ //#region .types-tmp/core/valueText.d.ts
3898
+ type TMDataGridValueTextOptions = {
3899
+ /** The column's `meta.type`. A `boolean` column's `"true"` / `"false"` filter strings read as booleans. */
3900
+ type?: TMDataGridColumnType;
3901
+ /** The column's resolved options: a value with an option reads as its label. */
3902
+ options?: ReadonlyArray<TMDataGridOption>;
3903
+ /** What `true` and `false` read as. Defaults to English. */
3904
+ labels?: Pick<TMDataGridLabels, "booleanTrue" | "booleanFalse">;
3905
+ };
3906
+ //#endregion
3629
3907
  //#region .types-tmp/core/grouping.d.ts
3630
3908
  /**
3631
3909
  * The data rows under a group row, at any depth.
@@ -3646,8 +3924,10 @@ declare function getGroupDataRows<TData extends RowData>(row: Row<TMDataGridFeat
3646
3924
  * Deliberately not the grouped column's own `cell` renderer: that renderer is
3647
3925
  * written for a data row and is free to reach into `row.original`, which on a
3648
3926
  * group row is the first leaf's record rather than anything about the group.
3927
+ * `options` carries what the chrome knows of the column instead - its type,
3928
+ * its option labels and the boolean labels.
3649
3929
  */
3650
- declare function formatGroupValue(value: unknown, blankLabel?: string): string;
3930
+ declare function formatGroupValue(value: unknown, blankLabel?: string, options?: TMDataGridValueTextOptions): string;
3651
3931
  //#endregion
3652
3932
  //#region .types-tmp/useTMDataGridExport.d.ts
3653
3933
  /** What {@link useTMDataGridExport} returns. */
@@ -4040,4 +4320,4 @@ declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridF
4040
4320
  */
4041
4321
  declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
4042
4322
  //#endregion
4043
- export { type BuildExportDataArgs, type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_EXPORT_OPTIONS, DEFAULT_TMDATAGRID_SIZE, DETAILS_COLUMN_ID, DgAutocompleteFilter, DgDateRangeFilter, DgRangeSliderFilter, DgTriStateFilter, EDIT_COLUMN_ID, type ExportGridArgs, FILTER_OPERATOR_LABELS, GROUP_COLUMN_ID, type MoveColumnArgs, PERSIST_PAYLOAD_VERSION, ROW_NUMBER_COLUMN_ID, type ResolveRangeBoundsArgs, type ResolveRowSelectionClickArgs, type ResolvedRowSelection, SELECT_COLUMN_ID, SETTINGS_STATE_SLICES, SIZE_CONTROL_SIZE, SIZE_ROW_HEIGHT, TMDATAGRID_LABELS_EN, TMDATAGRID_LABELS_SV, TMDataGrid, type TMDataGridAddRowsOptions, type TMDataGridAddRowsResult, type TMDataGridAggregationName, type TMDataGridApi, TMDataGridBooleanEditor, type TMDataGridCapabilities, type TMDataGridCellEventArgs, type TMDataGridCellPosition, type TMDataGridCellRange, type TMDataGridCellSelectionMode, type TMDataGridClipboardTextOptions, type TMDataGridColSpanArgs, type TMDataGridColumnCapabilities, type TMDataGridColumnEditOptions, type TMDataGridColumnFilter, type TMDataGridColumnFilterOptions, type TMDataGridColumnHelper, type TMDataGridColumnMenuItemsArgs, type TMDataGridColumnMenuItemsRenderer, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnSearchable, type TMDataGridColumnType, type TMDataGridColumnsPanelProps, type TMDataGridCommitAllResult, type TMDataGridContextValue, type TMDataGridCsvFormatOptions, type TMDataGridDataSlice, TMDataGridDateEditor, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, TMDataGridDraftActions, type TMDataGridDraftActionsActions, type TMDataGridDraftActionsControls, type TMDataGridDraftActionsProps, type TMDataGridDraftActionsSlotArgs, type TMDataGridDraftActionsState, type TMDataGridDropSide, type TMDataGridEditApi, type TMDataGridEditChange, type TMDataGridEditCommitArgs, type TMDataGridEditField, type TMDataGridEditMode, type TMDataGridEditRowProjection, type TMDataGridEditRowSnapshot, type TMDataGridEditState, type TMDataGridEditValueMap, type TMDataGridEditValueMapArgs, type TMDataGridEditingOptions, type TMDataGridEditorArgs, type TMDataGridEditorComponent, type TMDataGridExpandAllArgs, type TMDataGridExpandTarget, type TMDataGridExportApi, type TMDataGridExportColumns, type TMDataGridExportData, type TMDataGridExportFormat, type TMDataGridExportOptions, type TMDataGridExportPickerRequest, type TMDataGridExportRows, type TMDataGridExportSettings, type TMDataGridExportValueGetter, type TMDataGridExportWriteOptions, type TMDataGridFeatureFlags, type TMDataGridFeatures, type TMDataGridFieldValidate, type TMDataGridFilterControlArgs, type TMDataGridFilterControlComponent, type TMDataGridFilterControlLayout, type TMDataGridFilterFn, type TMDataGridFilterOperator, type TMDataGridFilterPanelLayout, type TMDataGridFilterPanelProps, TMDataGridFilterPills, type TMDataGridFilterPillsProps, type TMDataGridFilterSidebarSide, type TMDataGridFilterSurface, type TMDataGridFilterValue, TMDataGridFilterValueInput, type TMDataGridFilterValueShape, type TMDataGridFiltersOptions, type TMDataGridFiltersSettings, type TMDataGridFooterProps, type TMDataGridJsonFormatOptions, type TMDataGridLabels, type TMDataGridLabelsOverride, type TMDataGridMenuColumnsProps, type TMDataGridMenuExportProps, type TMDataGridMenuProps, TMDataGridMultiSelectEditor, TMDataGridNumberEditor, type TMDataGridOption, type TMDataGridOptionsArgs, type TMDataGridOptionsSource, type TMDataGridPaginationActions, type TMDataGridPaginationApi, type TMDataGridPaginationControls, type TMDataGridPaginationSlotArgs, type TMDataGridPaginationState, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridQuickSearchMode, type TMDataGridRangeBounds, type TMDataGridRowAddArgs, type TMDataGridRowClickModifiers, type TMDataGridRowContextMenuArgs, type TMDataGridRowContextMenuRenderer, type TMDataGridRowData, type TMDataGridRowDeleteArgs, type TMDataGridRowEditForm, type TMDataGridRowStyle, type TMDataGridRowValidators, type TMDataGridSaveDraftsArgs, type TMDataGridSaveDraftsResponse, type TMDataGridSaveDraftsResult, type TMDataGridSaveOutcomes, type TMDataGridScrollAlign, type TMDataGridScrollToRowArgs, TMDataGridSearch, type TMDataGridSearchProps, TMDataGridSelectEditor, type TMDataGridSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, TMDataGridStringEditor, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridTableProps, type TMDataGridTableValidateArgs, type TMDataGridTableValidators, type TMDataGridToolbarProps, type TMDataGridTsvFormatOptions, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type TMDataGridUrlStorage, type UseTMDataGridOptions, activeColumnFilters, aggregateColumn, areAllRowsExpanded, autosizeColumn, buildExportData, clearedValueForType, countSelectedExportRows, createTMDataGridColumnHelper, csvExcelFormat, csvFormat, downloadFile, emptyValueForOperator, exportGrid, filterValueShape, formatExportValue, formatFilterLabel, formatGroupValue, fuzzyGlobalFilterFn, getColumnCapabilities, getColumnDefaultOperator, getColumnLabel, getColumnOperators, getColumnRegion, getColumnType, getDisplayedRows, getEditFieldName, getExportableColumns, getGridCapabilities, getGroupDataRows, getOperatorsForType, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, guardFormula, hasPendingEdits, isControlColumn, isFilterActive, isGeneratedColumn, isPagingActive, jsonFormat, keepGeneratedColumnsOutermost, matchesFilter, mergeLabels, moveColumn, moveColumnByStep, normalizeFieldValidate, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, operatorTakesRangeValue, optionsToComboboxData, readFeatureFlags, resolveColumnOptions, resolveExpandAll, resolveExportOptions, resolveRangeBounds, resolveRowSelectionClick, tmDataGridFilterFn, toClipboardText, tsvFormat, useTMDataGrid, useTMDataGridContext, useTMDataGridExport, writeClipboardText, writeExportFile };
4323
+ export { type BuildExportDataArgs, type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_EXPORT_OPTIONS, DEFAULT_TMDATAGRID_SIZE, DETAILS_COLUMN_ID, DgAutocompleteFilter, DgDateRangeFilter, DgRangeSliderFilter, DgTriStateFilter, EDIT_COLUMN_ID, type ExportGridArgs, FILTER_OPERATOR_LABELS, GROUP_COLUMN_ID, type MoveColumnArgs, PERSIST_PAYLOAD_VERSION, ROW_NUMBER_COLUMN_ID, type ResolveRangeBoundsArgs, type ResolveRowSelectionClickArgs, type ResolvedRowSelection, SELECT_COLUMN_ID, SETTINGS_STATE_SLICES, SIZE_CONTROL_SIZE, SIZE_ROW_HEIGHT, TMDATAGRID_LABELS_EN, TMDATAGRID_LABELS_SV, TMDataGrid, type TMDataGridAddRowsOptions, type TMDataGridAddRowsResult, type TMDataGridAggregationName, type TMDataGridApi, TMDataGridBooleanEditor, type TMDataGridCapabilities, type TMDataGridCellEventArgs, type TMDataGridCellPosition, type TMDataGridCellRange, type TMDataGridCellSelectionMode, type TMDataGridClipboardTextOptions, type TMDataGridColSpanArgs, type TMDataGridColumnCapabilities, type TMDataGridColumnEditOptions, type TMDataGridColumnFilter, type TMDataGridColumnFilterOptions, type TMDataGridColumnHelper, type TMDataGridColumnInfo, type TMDataGridColumnInfoOf, type TMDataGridColumnMenuItemsArgs, type TMDataGridColumnMenuItemsRenderer, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnSearchable, type TMDataGridColumnType, type TMDataGridColumnsPanelProps, type TMDataGridCommitAllResult, type TMDataGridContextValue, type TMDataGridCsvFormatOptions, type TMDataGridDataSlice, TMDataGridDateEditor, type TMDataGridDateInput, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, TMDataGridDraftActions, type TMDataGridDraftActionsActions, type TMDataGridDraftActionsControls, type TMDataGridDraftActionsProps, type TMDataGridDraftActionsSlotArgs, type TMDataGridDraftActionsState, type TMDataGridDropSide, type TMDataGridEditApi, type TMDataGridEditChange, type TMDataGridEditCommitArgs, type TMDataGridEditCommitMap, type TMDataGridEditCommitMapArgs, type TMDataGridEditField, type TMDataGridEditMode, type TMDataGridEditRowProjection, type TMDataGridEditRowSnapshot, type TMDataGridEditState, type TMDataGridEditValueMap, type TMDataGridEditValueMapArgs, type TMDataGridEditingOptions, type TMDataGridEditorArgs, type TMDataGridEditorComponent, type TMDataGridExpandAllArgs, type TMDataGridExpandTarget, type TMDataGridExportApi, type TMDataGridExportColumns, type TMDataGridExportData, type TMDataGridExportFormat, type TMDataGridExportOptions, type TMDataGridExportPickerRequest, type TMDataGridExportRows, type TMDataGridExportSettings, type TMDataGridExportValueGetter, type TMDataGridExportWriteOptions, type TMDataGridFeatureFlags, type TMDataGridFeatures, type TMDataGridFieldValidate, type TMDataGridFilterControlArgs, type TMDataGridFilterControlComponent, type TMDataGridFilterControlLayout, type TMDataGridFilterFn, type TMDataGridFilterOperator, type TMDataGridFilterPanelLayout, type TMDataGridFilterPanelProps, TMDataGridFilterPills, type TMDataGridFilterPillsProps, type TMDataGridFilterSidebarSide, type TMDataGridFilterSurface, type TMDataGridFilterValue, TMDataGridFilterValueInput, type TMDataGridFilterValueShape, type TMDataGridFiltersOptions, type TMDataGridFiltersSettings, type TMDataGridFooterProps, type TMDataGridJsonFormatOptions, type TMDataGridLabels, type TMDataGridLabelsOverride, type TMDataGridMenuColumnsProps, type TMDataGridMenuExportProps, type TMDataGridMenuProps, TMDataGridMultiSelectEditor, TMDataGridNumberEditor, type TMDataGridOption, type TMDataGridOptionsArgs, type TMDataGridOptionsSource, type TMDataGridPaginationActions, type TMDataGridPaginationApi, type TMDataGridPaginationControls, type TMDataGridPaginationSlotArgs, type TMDataGridPaginationState, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridQuickSearchMode, type TMDataGridRangeBounds, type TMDataGridRowAddArgs, type TMDataGridRowClickModifiers, type TMDataGridRowContextMenuArgs, type TMDataGridRowContextMenuRenderer, type TMDataGridRowData, type TMDataGridRowDeleteArgs, type TMDataGridRowEditForm, type TMDataGridRowStyle, type TMDataGridRowValidators, type TMDataGridSaveDraftsArgs, type TMDataGridSaveDraftsResponse, type TMDataGridSaveDraftsResult, type TMDataGridSaveOutcomes, type TMDataGridScrollAlign, type TMDataGridScrollToRowArgs, TMDataGridSearch, type TMDataGridSearchProps, TMDataGridSelectEditor, type TMDataGridSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, TMDataGridStringEditor, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridTableProps, type TMDataGridTableValidateArgs, type TMDataGridTableValidators, type TMDataGridToolbarProps, type TMDataGridTsvFormatOptions, type TMDataGridTypedColumn, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type TMDataGridUrlFiltersInput, type TMDataGridUrlInput, type TMDataGridUrlPayload, type TMDataGridUrlSearchStorage, type TMDataGridUrlSortableId, type TMDataGridUrlState, type TMDataGridUrlStorage, type UseTMDataGridOptions, activeColumnFilters, aggregateColumn, areAllRowsExpanded, autosizeColumn, buildExportData, clearedValueForType, countSelectedExportRows, createTMDataGridColumnHelper, createTMDataGridUrlState, csvExcelFormat, csvFormat, downloadFile, emptyValueForOperator, exportGrid, filterValueShape, formatExportValue, formatFilterLabel, formatGroupValue, fuzzyGlobalFilterFn, getColumnCapabilities, getColumnDefaultOperator, getColumnLabel, getColumnOperators, getColumnRegion, getColumnType, getDisplayedRows, getEditFieldName, getExportableColumns, getGridCapabilities, getGroupDataRows, getOperatorsForType, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, guardFormula, hasPendingEdits, isControlColumn, isFilterActive, isGeneratedColumn, isPagingActive, jsonFormat, keepGeneratedColumnsOutermost, matchesFilter, mergeLabels, moveColumn, moveColumnByStep, normalizeFieldValidate, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, operatorTakesRangeValue, optionsToComboboxData, readFeatureFlags, resolveColumnOptions, resolveExpandAll, resolveExportOptions, resolveRangeBounds, resolveRowSelectionClick, tmDataGridFilterFn, toClipboardText, tsvFormat, useTMDataGrid, useTMDataGridContext, useTMDataGridExport, writeClipboardText, writeExportFile };