@jielga/tmdatagrid 2.2.0 → 2.4.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 (50) hide show
  1. package/dist/index.d.ts +302 -11
  2. package/dist/index.js +2338 -2097
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/docs/columns.md +9 -1
  6. package/docs/components.md +1 -0
  7. package/docs/filtering.md +5 -1
  8. package/docs/grouping.md +1 -1
  9. package/docs/localization.md +3 -3
  10. package/docs/persistence.md +189 -2
  11. package/docs/row-details.md +5 -0
  12. package/docs/row-interaction.md +1 -1
  13. package/docs/row-styling.md +17 -0
  14. package/docs/typed-deep-links.md +169 -0
  15. package/docs/use-tm-data-grid.md +6 -2
  16. package/package.json +1 -1
  17. package/skills/appearance/SKILL.md +1 -1
  18. package/skills/appearance/references/labels.md +3 -3
  19. package/skills/cell-selection/SKILL.md +1 -1
  20. package/skills/columns/SKILL.md +6 -3
  21. package/skills/columns/references/columns-api.md +1 -0
  22. package/skills/data/SKILL.md +1 -1
  23. package/skills/editing/SKILL.md +1 -1
  24. package/skills/filtering/SKILL.md +26 -13
  25. package/skills/getting-started/SKILL.md +2 -2
  26. package/skills/grouping/SKILL.md +2 -2
  27. package/skills/migrating-to-2/SKILL.md +1 -1
  28. package/skills/options/SKILL.md +105 -10
  29. package/skills/options/references/typed-links.md +134 -0
  30. package/skills/rows/SKILL.md +18 -9
  31. package/skills/server-side/SKILL.md +1 -1
  32. package/skills/testing/SKILL.md +1 -1
  33. package/skills/testing-components/SKILL.md +1 -1
  34. package/skills/testing-editing/SKILL.md +1 -1
  35. package/src/components/TMDataGridFilterPills.module.css +9 -7
  36. package/src/components/TMDataGridFilterPills.tsx +15 -1
  37. package/src/components/TMDataGridGroupColumn.tsx +19 -4
  38. package/src/components/TMDataGridHeaderFilterRow.tsx +7 -1
  39. package/src/components/TMDataGridTable.module.css +15 -6
  40. package/src/components/TMDataGridTable.tsx +23 -11
  41. package/src/components/sticky.module.css +27 -7
  42. package/src/core/filterControls.ts +8 -0
  43. package/src/core/filterOperators.ts +54 -18
  44. package/src/core/grouping.ts +11 -3
  45. package/src/core/labels.ts +4 -3
  46. package/src/core/persistence.ts +330 -26
  47. package/src/core/urlState.ts +439 -0
  48. package/src/core/valueText.ts +46 -0
  49. package/src/index.ts +14 -0
  50. package/src/useTMDataGrid.tsx +145 -21
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";
@@ -815,7 +815,7 @@ type TMDataGridLabels = {
815
815
  filterTo: string;
816
816
  /** `DgTriStateFilter`'s no-filter segment. */
817
817
  filterAll: string;
818
- /** What a boolean column's `true` reads as - its filter choice and cell text. */
818
+ /** What a boolean `true` reads as - its filter choice, filter pill and group row. */
819
819
  booleanTrue: string;
820
820
  booleanFalse: string;
821
821
  addFilter: string;
@@ -1037,6 +1037,14 @@ type TMDataGridColumnFilterOptions = {
1037
1037
  * See {@link TMDataGridFilterControlComponent}.
1038
1038
  */
1039
1039
  control?: TMDataGridFilterControlComponent;
1040
+ /**
1041
+ * Whether this column's filter goes into the `persist.urlKey` search param.
1042
+ * Defaults to `true`. `false` keeps it out of the param, on read and on
1043
+ * write. Only has an effect when `urlKey` carries `columnFilters`, and since such
1044
+ * a slice is not stored under `dataKey` either, the filter is then not
1045
+ * persisted anywhere.
1046
+ */
1047
+ url?: boolean;
1040
1048
  };
1041
1049
  //#endregion
1042
1050
  //#region .types-tmp/core/filterSurface.d.ts
@@ -1173,11 +1181,31 @@ type TMDataGridSettingsSlice = (typeof SETTINGS_STATE_SLICES)[number];
1173
1181
  type TMDataGridPersistKey<TSlice extends string> = string | readonly [key: string, slices: readonly TSlice[]];
1174
1182
  /** Same values as Mantine's `StorageType`, which the package does not re-export. */
1175
1183
  type TMDataGridStorageMode = "localStorage" | "sessionStorage";
1184
+ /**
1185
+ * Reads and writes the one URL search param that `urlKey` names. Replaces the
1186
+ * default, which reads `window.location.search` and writes with
1187
+ * `history.replaceState`, for a router that owns the URL.
1188
+ */
1189
+ type TMDataGridUrlStorage = {
1190
+ /** The param's current value, or `null` when the URL has none. */
1191
+ get(name: string): string | null;
1192
+ /** Sets the param to `value`, or removes it when `value` is `null`. */
1193
+ set(name: string, value: string | null): void;
1194
+ };
1176
1195
  type TMDataGridPersistence = {
1177
1196
  /** Key for filters, global filter, sorting and pagination. */
1178
1197
  dataKey?: TMDataGridPersistKey<TMDataGridDataSlice>;
1179
1198
  /** Key for column visibility, sizing, order and pinning. */
1180
1199
  settingsKey?: TMDataGridPersistKey<TMDataGridSettingsSlice>;
1200
+ /**
1201
+ * Search param for data slices kept in the URL, so a link opens the grid on
1202
+ * the same state. Takes the slices it lists away from `dataKey`. The param
1203
+ * holds only the slices that differ from the initial state, and carries no
1204
+ * version stamp.
1205
+ */
1206
+ urlKey?: TMDataGridPersistKey<TMDataGridDataSlice>;
1207
+ /** Where `urlKey` reads and writes. Defaults to the browser's URL. */
1208
+ urlStorage?: TMDataGridUrlStorage;
1181
1209
  /** Which storage area to use. Defaults to `"localStorage"`. */
1182
1210
  storageMode?: TMDataGridStorageMode;
1183
1211
  /** Serializes a payload before it is stored. Defaults to `JSON.stringify`. */
@@ -1437,6 +1465,209 @@ type ResolveRangeBoundsArgs = {
1437
1465
  */
1438
1466
  declare function resolveRangeBounds({ range, rowIndexOf, columnIndexOf }: ResolveRangeBoundsArgs): TMDataGridRangeBounds | null;
1439
1467
  //#endregion
1468
+ //#region .types-tmp/core/urlState.d.ts
1469
+ /**
1470
+ * Typed deep links.
1471
+ *
1472
+ * `createTMDataGridColumnHelper` returns columns that carry, in their type
1473
+ * only, what a link needs to know about them: the id, the `meta.type`, the
1474
+ * value type, the offered operators, and whether the column can be filtered,
1475
+ * sorted and put in the URL. `createTMDataGridUrlState` reads that from the
1476
+ * grid's own columns, so a link can name only what the grid can show: a
1477
+ * filter on a column the grid lacks, an operator its type does not offer or a
1478
+ * value of the wrong type is a compile error, not a link that silently opens
1479
+ * unfiltered.
1480
+ *
1481
+ * Nothing here is visible at runtime except the definition object. The
1482
+ * column brand is a type, never a property.
1483
+ */
1484
+ /**
1485
+ * What a column built with `createTMDataGridColumnHelper` tells a typed link
1486
+ * about itself. Read from literal values in the column definition: a value
1487
+ * that is not a literal (`enableSorting: isAdmin`) reads as "not allowed".
1488
+ */
1489
+ type TMDataGridColumnInfo = {
1490
+ /** The column id, by TanStack's rule: `id`, else the accessor key with `.` replaced by `_`. */
1491
+ id: string;
1492
+ /** `meta.type`, `"string"` when unset. */
1493
+ type: TMDataGridColumnType;
1494
+ /** The value type the accessor returns. */
1495
+ value: unknown;
1496
+ /** `meta.filter.operators`, every operator when unset. */
1497
+ operators: TMDataGridFilterOperator;
1498
+ /** `enableColumnFilter` is not `false`. */
1499
+ filterable: boolean;
1500
+ /** `enableSorting` is not `false`. */
1501
+ sortable: boolean;
1502
+ /** `meta.filter.url` is not `false`. */
1503
+ url: boolean;
1504
+ };
1505
+ declare const columnInfo: unique symbol;
1506
+ /**
1507
+ * The type-only brand a column helper column carries. Never present at
1508
+ * runtime, so spreading, cloning or serializing a column is unaffected.
1509
+ */
1510
+ type TMDataGridTypedColumn<TInfo extends TMDataGridColumnInfo> = {
1511
+ readonly [columnInfo]: TInfo;
1512
+ };
1513
+ /** The info of every leaf column in `TColumn`, a group's children included. */
1514
+ type TMDataGridColumnInfoOf<TColumn> = TColumn extends TMDataGridTypedColumn<infer TInfo> ? TInfo : never;
1515
+ /** `"address.city"` becomes `"address_city"`, as TanStack derives the id. */
1516
+ type DotsToUnderscores<S extends string> = S extends `${infer Head}.${infer Tail}` ? `${Head}_${DotsToUnderscores<Tail>}` : S;
1517
+ /**
1518
+ * The column id the helper's `accessor` call produces: the explicit `id`,
1519
+ * else the accessor key. An accessor function without an `id` gets `never`,
1520
+ * which no link can name.
1521
+ */
1522
+ type TMDataGridAccessorColumnId<TAccessor, TId extends string> = [TId] extends [never] ? TAccessor extends string ? DotsToUnderscores<TAccessor> : never : TId;
1523
+ /**
1524
+ * The column options whose literal values a typed link reads. Intersected into
1525
+ * the column helper's parameter so each one is inferred as a literal.
1526
+ *
1527
+ * @internal
1528
+ */
1529
+ type TMDataGridColumnInfoHints<TId extends string, TType extends TMDataGridColumnType, TOperator extends TMDataGridFilterOperator, TFilterable extends boolean, TSortable extends boolean, TUrl extends boolean> = {
1530
+ id?: TId;
1531
+ enableColumnFilter?: TFilterable;
1532
+ enableSorting?: TSortable;
1533
+ meta?: {
1534
+ type?: TType;
1535
+ filter?: {
1536
+ operators?: ReadonlyArray<TOperator>;
1537
+ url?: TUrl;
1538
+ };
1539
+ };
1540
+ };
1541
+ /** A `Date`, or an ISO `YYYY-MM-DD` string. */
1542
+ type TMDataGridDateInput = Date | string;
1543
+ /** One choice of a select column: the value, or an element of an array value. */
1544
+ type OptionOf<TValue> = NonNullable<TValue> extends ReadonlyArray<infer TElement> ? TElement : NonNullable<TValue>;
1545
+ type ScalarInput = {
1546
+ string: string;
1547
+ number: number;
1548
+ date: TMDataGridDateInput;
1549
+ boolean: boolean;
1550
+ select: string;
1551
+ multiSelect: string;
1552
+ };
1553
+ type RangeEnd<TType extends TMDataGridColumnType> = TType extends "date" ? TMDataGridDateInput : TType extends "number" ? number : string;
1554
+ /** One filter on one column: an operator, and the value that operator takes. */
1555
+ type FilterInputFor<TType extends TMDataGridColumnType, TValue, TOperator extends TMDataGridFilterOperator> = TOperator extends "isEmpty" | "isNotEmpty" ? {
1556
+ operator: TOperator;
1557
+ } : TOperator extends "isAnyOf" | "isNoneOf" ? {
1558
+ operator: TOperator;
1559
+ value: ReadonlyArray<OptionOf<TValue>>;
1560
+ } : TOperator extends "between" ? {
1561
+ operator: TOperator;
1562
+ /** `null` leaves that end open. */
1563
+ value: readonly [from: RangeEnd<TType> | null, to: RangeEnd<TType> | null];
1564
+ } : {
1565
+ operator: TOperator;
1566
+ value: ScalarInput[TType];
1567
+ };
1568
+ /** Columns a link may filter: filterable, and not kept out of the URL. */
1569
+ type LinkFilterable<TInfo extends TMDataGridColumnInfo> = Extract<TInfo, {
1570
+ filterable: true;
1571
+ url: true;
1572
+ }>;
1573
+ /**
1574
+ * The `filters` a link accepts: one optional entry per filterable column.
1575
+ * With no filterable column it accepts no entry at all - an empty object type
1576
+ * would let any key through, since TypeScript skips the unknown-key check
1577
+ * against `{}`.
1578
+ */
1579
+ 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"]>>; };
1580
+ /** The ids a link may sort by. */
1581
+ type TMDataGridUrlSortableId<TInfo extends TMDataGridColumnInfo> = Extract<TInfo, {
1582
+ sortable: true;
1583
+ }>["id"];
1584
+ type Carries<TSlices extends ReadonlyArray<TMDataGridDataSlice>, TSlice extends TMDataGridDataSlice> = TSlice extends TSlices[number] ? true : false;
1585
+ /** What a link may set: only the slices the definition carries, only the grid's columns. */
1586
+ type TMDataGridUrlInput<TInfo extends TMDataGridColumnInfo, TSlices extends ReadonlyArray<TMDataGridDataSlice>> = (Carries<TSlices, "columnFilters"> extends true ? {
1587
+ filters?: TMDataGridUrlFiltersInput<TInfo>;
1588
+ } : unknown) & (Carries<TSlices, "globalFilter"> extends true ? {
1589
+ globalFilter?: string;
1590
+ } : unknown) & (Carries<TSlices, "sorting"> extends true ? {
1591
+ sorting?: ReadonlyArray<{
1592
+ id: TMDataGridUrlSortableId<TInfo>;
1593
+ /** Defaults to `false`. */
1594
+ desc?: boolean;
1595
+ }>;
1596
+ } : unknown) & (Carries<TSlices, "pagination"> extends true ? {
1597
+ pagination?: {
1598
+ pageIndex: number;
1599
+ pageSize: number;
1600
+ };
1601
+ } : unknown);
1602
+ /** What the grid keeps in its URL param: the data slices, in the grid's own state shape. */
1603
+ type TMDataGridUrlPayload = {
1604
+ columnFilters?: Array<TMDataGridColumnFilter>;
1605
+ /** `null` is a search the user cleared, as opposed to one the link does not set. */
1606
+ globalFilter?: string | null;
1607
+ sorting?: Array<{
1608
+ id: string;
1609
+ desc: boolean;
1610
+ }>;
1611
+ pagination?: {
1612
+ pageIndex: number;
1613
+ pageSize: number;
1614
+ };
1615
+ expanded?: true | Record<string, boolean>;
1616
+ };
1617
+ /**
1618
+ * A router's search, read and written as values rather than strings, for
1619
+ * routers that keep objects in their search params and encode them
1620
+ * themselves, such as TanStack Router.
1621
+ */
1622
+ type TMDataGridUrlSearchStorage = {
1623
+ /** The param's current value in the router's search, or `undefined`. */
1624
+ get(name: string): unknown;
1625
+ /** Sets the param to `value`, or removes it on `undefined`. */
1626
+ set(name: string, value: TMDataGridUrlPayload | undefined): void;
1627
+ };
1628
+ type TMDataGridUrlState<TKey extends string, TSlices extends ReadonlyArray<TMDataGridDataSlice>, TInfo extends TMDataGridColumnInfo> = {
1629
+ /** The URL search param. */
1630
+ readonly key: TKey;
1631
+ /** The data slices the param carries. */
1632
+ readonly slices: TSlices;
1633
+ /** For `persist.urlKey`. */
1634
+ readonly urlKey: TMDataGridPersistKey<TMDataGridDataSlice>;
1635
+ /** The param's value for a link, or `undefined` when the input sets nothing. */
1636
+ payload(input: TMDataGridUrlInput<TInfo, TSlices>): TMDataGridUrlPayload | undefined;
1637
+ /** The search object for a router link, `{ [key]: payload }`. */
1638
+ search(input: TMDataGridUrlInput<TInfo, TSlices>): { [K in TKey]: TMDataGridUrlPayload | undefined; };
1639
+ /**
1640
+ * The search params for a plain link, encoded the way the grid's default
1641
+ * `serialize` encodes them. Pass the `serialize` you gave `persist`, if any.
1642
+ */
1643
+ searchParams(input: TMDataGridUrlInput<TInfo, TSlices>, options?: {
1644
+ serialize?: (payload: TMDataGridUrlPayload) => string;
1645
+ }): URLSearchParams;
1646
+ /**
1647
+ * A route search validator: keeps the param when it is an object and drops
1648
+ * anything else. The grid checks every slice itself when it reads the param.
1649
+ */
1650
+ validateSearch(search: Record<string, unknown>): { [K in TKey]?: TMDataGridUrlPayload; };
1651
+ /**
1652
+ * `urlKey`, plus a `urlStorage` over `storage` when one is given. Without
1653
+ * one, the grid reads and writes the browser's URL itself.
1654
+ */
1655
+ persist(storage?: TMDataGridUrlSearchStorage): Pick<TMDataGridPersistence, "urlKey" | "urlStorage">;
1656
+ };
1657
+ /**
1658
+ * Defines a grid's deep links from its columns. `columns` is the array the
1659
+ * grid renders, built with `createTMDataGridColumnHelper`; it decides which
1660
+ * filters, operators, values and sorts a link may name.
1661
+ */
1662
+ declare function createTMDataGridUrlState<const TKey extends string, TColumns extends ReadonlyArray<unknown>, const TSlices extends ReadonlyArray<TMDataGridDataSlice> = typeof DATA_STATE_SLICES>(options: {
1663
+ /** The URL search param. */
1664
+ key: TKey;
1665
+ /** The grid's columns. */
1666
+ columns: TColumns;
1667
+ /** The data slices the param carries. Defaults to every data slice. */
1668
+ slices?: TSlices;
1669
+ }): TMDataGridUrlState<TKey, TSlices, TMDataGridColumnInfoOf<TColumns[number]>>;
1670
+ //#endregion
1440
1671
  //#region .types-tmp/core/export.d.ts
1441
1672
  type ErasedRow = Row<TMDataGridFeatures, TMDataGridRowData>;
1442
1673
  type ErasedColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
@@ -1927,12 +2158,30 @@ type WithRowTypedMeta<TDef, TData extends RowData> = TDef extends unknown ? Omit
1927
2158
  * TanStack's column helper with `meta` typed against `TData`, so the
1928
2159
  * `meta.options` and `meta.edit.enabled` callbacks receive
1929
2160
  * `Row<TMDataGridFeatures, TData>`.
2161
+ *
2162
+ * Every column it returns also carries `TMDataGridColumnInfo` in its type,
2163
+ * read from the literal values of `id`, `meta.type`,
2164
+ * `meta.filter.operators`, `meta.filter.url`, `enableColumnFilter` and
2165
+ * `enableSorting`. `createTMDataGridUrlState` reads it to type the links into
2166
+ * the grid. TanStack's own return type keeps none of this: it types
2167
+ * `accessorKey` as a plain string.
1930
2168
  */
1931
2169
  type TMDataGridColumnHelper<TData extends RowData> = {
1932
- 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>;
2170
+ 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<{
2171
+ id: TMDataGridAccessorColumnId<TAccessor, TId>;
2172
+ type: TType;
2173
+ value: TValue;
2174
+ operators: TOperator;
2175
+ filterable: TFilterable;
2176
+ sortable: TSortable;
2177
+ url: TUrl;
2178
+ }>;
1933
2179
  columns: ColumnHelper<TMDataGridFeatures, TData>["columns"];
1934
2180
  display: (column: WithRowTypedMeta<DisplayColumnDef<TMDataGridFeatures, TData>, TData>) => DisplayColumnDef<TMDataGridFeatures, TData, unknown>;
1935
- group: (column: WithRowTypedMeta<GroupColumnDef<TMDataGridFeatures, TData, unknown>, TData>) => GroupColumnDef<TMDataGridFeatures, TData, unknown>;
2181
+ /** A header group. Carries the column info of every column under it. */
2182
+ group: <const TChildren extends ReadonlyArray<ColumnDef<TMDataGridFeatures, TData, any>>>(column: WithRowTypedMeta<Omit<GroupColumnDef<TMDataGridFeatures, TData, unknown>, "columns">, TData> & {
2183
+ columns: TChildren;
2184
+ }) => GroupColumnDef<TMDataGridFeatures, TData, unknown> & TMDataGridTypedColumn<TMDataGridColumnInfoOf<TChildren[number]>>;
1936
2185
  };
1937
2186
  declare function createTMDataGridColumnHelper<TData extends RowData>(): TMDataGridColumnHelper<TData>;
1938
2187
  /** What the `renderDetails` render prop is handed for an expanded row. */
@@ -2310,8 +2559,9 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
2310
2559
  getRowId: NonNullable<TableOptions<TMDataGridFeatures, TData>["getRowId"]>;
2311
2560
  }) & {
2312
2561
  /**
2313
- * Restore and persist table state across mounts. Two keys, because the two
2314
- * kinds of state have different lifetimes - see {@link TMDataGridPersistence}.
2562
+ * Restore and persist table state across mounts. Two storage keys, because
2563
+ * the two kinds of state have different lifetimes, and a URL search param
2564
+ * for the data slices a link should carry - see {@link TMDataGridPersistence}.
2315
2565
  *
2316
2566
  * Keep the object referentially stable (module scope or `useMemo`); it is a
2317
2567
  * dependency of the subscription that writes back.
@@ -2642,6 +2892,22 @@ type TMDataGridFilterValue = {
2642
2892
  type TMDataGridColumnType = "string" | "number" | "boolean" | "date" | "select" | "multiSelect";
2643
2893
  type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "between" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
2644
2894
  declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
2895
+ declare const OPERATORS_BY_TYPE: {
2896
+ readonly string: readonly ["contains", "equals", "notEquals", "startsWith", "endsWith", "isEmpty", "isNotEmpty"];
2897
+ readonly number: readonly ["equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "between", "isEmpty", "isNotEmpty"];
2898
+ readonly boolean: readonly ["equals", "notEquals", "isEmpty", "isNotEmpty"];
2899
+ readonly date: readonly ["equals", "notEquals", "before", "after", "onOrBefore", "onOrAfter", "between", "isEmpty", "isNotEmpty"];
2900
+ readonly select: readonly ["isAnyOf", "isNoneOf", "isEmpty", "isNotEmpty"];
2901
+ readonly multiSelect: readonly ["isAnyOf", "isNoneOf", "isEmpty", "isNotEmpty"];
2902
+ };
2903
+ /**
2904
+ * The operators each column type offers, as a type: the same lists the filter
2905
+ * panel offers, so a typed link can never name an operator the panel lacks.
2906
+ *
2907
+ * @internal Feeds the typed links in urlState.ts; not exported from the
2908
+ * package.
2909
+ */
2910
+ type OperatorsByColumnType = { [TType in TMDataGridColumnType]: (typeof OPERATORS_BY_TYPE)[TType][number]; };
2645
2911
  declare function getOperatorsForType(type: TMDataGridColumnType): readonly TMDataGridFilterOperator[];
2646
2912
  declare function operatorNeedsValue(operator: TMDataGridFilterOperator): boolean;
2647
2913
  /** Whether the operator's value is a string array - `isAnyOf` / `isNoneOf`. */
@@ -2697,14 +2963,19 @@ declare function activeColumnFilters<TData extends RowData>(source: TMDataGridTa
2697
2963
  *
2698
2964
  * The type's default operator is left implicit - "First name: Sofia" reads the
2699
2965
  * way a person would say it - while any other operator is spelled out, since
2700
- * that is the part a reader cannot guess.
2966
+ * that is the part a reader cannot guess. A value with an option reads as the
2967
+ * option's label, and a boolean as `labels.booleanTrue` / `booleanFalse`.
2701
2968
  */
2702
- declare function formatFilterLabel({ label, type, filter, operatorLabels }: {
2969
+ declare function formatFilterLabel({ label, type, filter, operatorLabels, options, labels }: {
2703
2970
  label: string;
2704
2971
  type: TMDataGridColumnType;
2705
2972
  filter: TMDataGridFilterValue;
2706
2973
  /** Localized operator names - `labels.operators`. Defaults to English. */
2707
2974
  operatorLabels?: Record<TMDataGridFilterOperator, string>;
2975
+ /** The column's options, so a value reads as its option's label. */
2976
+ options?: ReadonlyArray<TMDataGridOption>;
2977
+ /** What a boolean value reads as. Defaults to English. */
2978
+ labels?: Pick<TMDataGridLabels, "booleanTrue" | "booleanFalse">;
2708
2979
  }): string;
2709
2980
  declare function matchesFilter(cellValue: unknown, { operator, value }: TMDataGridFilterValue): boolean;
2710
2981
  /**
@@ -3321,6 +3592,14 @@ type TMDataGridTableProps<TData extends RowData> = {
3321
3592
  * stay put while the virtualizer mounts and unmounts rows.
3322
3593
  */
3323
3594
  striped?: boolean;
3595
+ /**
3596
+ * Whether a body row takes the hover tint under the pointer. Unset, a row
3597
+ * takes it when the row itself answers a gesture: `selectionMode: "row"`,
3598
+ * a highlight mode, `onRowClick` or `renderRowContextMenu`. Group rows sit
3599
+ * out those gestures and so sit out the tint too. `true` tints every row,
3600
+ * `false` none. The row carries `data-highlight-on-hover` while it applies.
3601
+ */
3602
+ highlightOnHover?: boolean;
3324
3603
  /**
3325
3604
  * Called when the scroll *arrives* at an edge - once per arrival, not per
3326
3605
  * scroll event, and not on mount (the grid starts at the top-left edge).
@@ -3432,7 +3711,7 @@ type TMDataGridTableProps<TData extends RowData> = {
3432
3711
  * no-pagination mode work at any row count. Pagination is opt in through
3433
3712
  * `enablePagination`, or implied by `manualPagination`.
3434
3713
  */
3435
- declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, onCellClick, onCellDoubleClick, onCellContextMenu, rowClassName, rowStyle, striped, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, renderEmptyState, renderRowContextMenu, renderColumnMenuItems, rowContextMenuProps, onReachEnd, reachEndThreshold, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: TMDataGridTableProps<TData>): import("react").JSX.Element;
3714
+ declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, onCellClick, onCellDoubleClick, onCellContextMenu, rowClassName, rowStyle, striped, highlightOnHover, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, renderEmptyState, renderRowContextMenu, renderColumnMenuItems, rowContextMenuProps, onReachEnd, reachEndThreshold, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: TMDataGridTableProps<TData>): import("react").JSX.Element;
3436
3715
  //#endregion
3437
3716
  //#region .types-tmp/components/TMDataGridToolbar.d.ts
3438
3717
  type TMDataGridToolbarProps = BoxProps & {
@@ -3589,6 +3868,16 @@ declare const ROW_NUMBER_COLUMN_ID = "__rowNumber__";
3589
3868
  //#region .types-tmp/components/TMDataGridGroupColumn.d.ts
3590
3869
  declare const GROUP_COLUMN_ID = "__group__";
3591
3870
  //#endregion
3871
+ //#region .types-tmp/core/valueText.d.ts
3872
+ type TMDataGridValueTextOptions = {
3873
+ /** The column's `meta.type`. A `boolean` column's `"true"` / `"false"` filter strings read as booleans. */
3874
+ type?: TMDataGridColumnType;
3875
+ /** The column's resolved options: a value with an option reads as its label. */
3876
+ options?: ReadonlyArray<TMDataGridOption>;
3877
+ /** What `true` and `false` read as. Defaults to English. */
3878
+ labels?: Pick<TMDataGridLabels, "booleanTrue" | "booleanFalse">;
3879
+ };
3880
+ //#endregion
3592
3881
  //#region .types-tmp/core/grouping.d.ts
3593
3882
  /**
3594
3883
  * The data rows under a group row, at any depth.
@@ -3609,8 +3898,10 @@ declare function getGroupDataRows<TData extends RowData>(row: Row<TMDataGridFeat
3609
3898
  * Deliberately not the grouped column's own `cell` renderer: that renderer is
3610
3899
  * written for a data row and is free to reach into `row.original`, which on a
3611
3900
  * group row is the first leaf's record rather than anything about the group.
3901
+ * `options` carries what the chrome knows of the column instead - its type,
3902
+ * its option labels and the boolean labels.
3612
3903
  */
3613
- declare function formatGroupValue(value: unknown, blankLabel?: string): string;
3904
+ declare function formatGroupValue(value: unknown, blankLabel?: string, options?: TMDataGridValueTextOptions): string;
3614
3905
  //#endregion
3615
3906
  //#region .types-tmp/useTMDataGridExport.d.ts
3616
3907
  /** What {@link useTMDataGridExport} returns. */
@@ -4003,4 +4294,4 @@ declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridF
4003
4294
  */
4004
4295
  declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
4005
4296
  //#endregion
4006
- 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 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 };
4297
+ 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 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 };