@jielga/tmdatagrid 2.0.0-beta.9 → 2.0.1
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.
- package/README.md +5 -212
- package/dist/index.d.ts +1281 -768
- package/dist/index.js +4607 -3250
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/adding-rows.md +132 -0
- package/docs/anatomy.md +119 -0
- package/docs/card-view.md +108 -0
- package/docs/cell-selection.md +194 -0
- package/docs/column-layout.md +182 -0
- package/docs/column-menu.md +66 -0
- package/docs/columns.md +269 -0
- package/docs/components.md +311 -0
- package/docs/draft-store.md +242 -0
- package/docs/editing.md +303 -0
- package/docs/editors.md +250 -0
- package/docs/export.md +319 -0
- package/docs/filtering.md +362 -0
- package/docs/getting-started.md +123 -0
- package/docs/grouping.md +165 -0
- package/docs/loading-and-empty.md +92 -0
- package/docs/localization.md +79 -0
- package/docs/menu.md +143 -0
- package/docs/migrating-to-2.md +163 -0
- package/docs/pagination.md +144 -0
- package/docs/persistence.md +114 -0
- package/docs/portfolio-rebalancer.md +94 -0
- package/docs/query-builder.md +179 -0
- package/docs/quick-search.md +84 -0
- package/docs/row-details.md +115 -0
- package/docs/row-interaction.md +149 -0
- package/docs/row-pinning.md +132 -0
- package/docs/row-selection.md +136 -0
- package/docs/row-styling.md +133 -0
- package/docs/scrolling.md +112 -0
- package/docs/server-query.md +246 -0
- package/docs/server-side.md +206 -0
- package/docs/sorting.md +101 -0
- package/docs/styling.md +126 -0
- package/docs/summary-row.md +76 -0
- package/docs/testing.md +744 -0
- package/docs/toolbar.md +161 -0
- package/docs/use-tm-data-grid.md +361 -0
- package/package.json +22 -46
- package/skills/appearance/SKILL.md +72 -19
- package/skills/cell-selection/SKILL.md +49 -48
- package/skills/columns/SKILL.md +125 -70
- package/skills/columns/references/columns-api.md +59 -0
- package/skills/data/SKILL.md +112 -18
- package/skills/editing/SKILL.md +76 -42
- package/skills/editing/references/common-mistakes.md +77 -69
- package/skills/editing/references/editing-api.md +25 -20
- package/skills/editing/references/editors-and-validation.md +80 -18
- package/skills/filtering/SKILL.md +155 -41
- package/skills/getting-started/SKILL.md +116 -16
- package/skills/grouping/SKILL.md +31 -16
- package/skills/migrating-to-2/SKILL.md +244 -0
- package/skills/options/SKILL.md +24 -12
- package/skills/rows/SKILL.md +22 -18
- package/skills/rows/references/rows-api.md +10 -6
- package/skills/server-side/SKILL.md +170 -17
- package/skills/testing/SKILL.md +150 -32
- package/skills/testing-components/SKILL.md +230 -0
- package/skills/testing-editing/SKILL.md +240 -0
- package/src/{tmdatagrid/components → components}/TMDataGrid.tsx +38 -21
- package/src/{tmdatagrid/components → components}/TMDataGridCellEditor.tsx +54 -8
- package/src/{tmdatagrid/components → components}/TMDataGridColumnsPanel.module.css +5 -1
- package/src/{tmdatagrid/components → components}/TMDataGridColumnsPanel.tsx +47 -55
- package/src/{tmdatagrid/components → components}/TMDataGridDetailsColumn.tsx +5 -51
- package/src/{tmdatagrid/components → components}/TMDataGridDraftActions.tsx +41 -24
- package/src/{tmdatagrid/components → components}/TMDataGridEditColumn.tsx +12 -59
- package/src/{tmdatagrid/components → components}/TMDataGridEntryRows.tsx +164 -92
- package/src/components/TMDataGridExportPicker.module.css +77 -0
- package/src/components/TMDataGridExportPicker.tsx +234 -0
- package/src/components/TMDataGridFilterPanel.module.css +54 -0
- package/src/components/TMDataGridFilterPanel.tsx +348 -0
- package/src/{tmdatagrid/components → components}/TMDataGridFilterPills.tsx +15 -8
- package/src/components/TMDataGridFilterSurface.module.css +54 -0
- package/src/components/TMDataGridFilterSurface.tsx +167 -0
- package/src/{tmdatagrid/components → components}/TMDataGridFooter.tsx +53 -90
- package/src/{tmdatagrid/components → components}/TMDataGridGroupColumn.tsx +5 -69
- package/src/{tmdatagrid/components → components}/TMDataGridHeaderCell.module.css +12 -2
- package/src/{tmdatagrid/components → components}/TMDataGridHeaderCell.tsx +58 -21
- package/src/components/TMDataGridHeaderFilterRow.module.css +51 -0
- package/src/components/TMDataGridHeaderFilterRow.tsx +301 -0
- package/src/components/TMDataGridMenu.tsx +357 -0
- package/src/{tmdatagrid/components → components}/TMDataGridSelectColumn.tsx +11 -48
- package/src/{tmdatagrid/components → components}/TMDataGridTable.module.css +69 -56
- package/src/{tmdatagrid/components → components}/TMDataGridTable.tsx +240 -138
- package/src/{tmdatagrid/components → components}/TMDataGridToolbar.module.css +5 -0
- package/src/components/TMDataGridToolbar.tsx +181 -0
- package/src/{tmdatagrid/components → components}/editors/TMDataGridBooleanEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/TMDataGridDateEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/TMDataGridMultiSelectEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/TMDataGridNumberEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/TMDataGridSelectEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/TMDataGridStringEditor.tsx +3 -3
- package/src/{tmdatagrid/components → components}/editors/editorShared.ts +16 -2
- package/src/{tmdatagrid/components → components}/filters/DgAutocompleteFilter.tsx +5 -4
- package/src/{tmdatagrid/components → components}/filters/DgDateRangeFilter.tsx +22 -5
- package/src/{tmdatagrid/components → components}/filters/DgRangeSliderFilter.tsx +5 -1
- package/src/{tmdatagrid/components → components}/filters/DgTriStateFilter.tsx +5 -1
- package/src/{tmdatagrid/components → components}/filters/TMDataGridFilterValueInput.tsx +44 -28
- package/src/components/filters/controlLayout.ts +32 -0
- package/src/components/filters/filterControlFor.ts +65 -0
- package/src/components/generatedColumns.tsx +187 -0
- package/src/{tmdatagrid/components → components}/icons.ts +1 -0
- package/src/{tmdatagrid/components → components}/sticky.module.css +44 -0
- package/src/components/useHideableColumns.ts +52 -0
- package/src/{tmdatagrid/core → core}/autosize.ts +5 -2
- package/src/{tmdatagrid/core → core}/columnOptions.ts +60 -8
- package/src/{tmdatagrid/core → core}/columnOrdering.ts +33 -14
- package/src/{tmdatagrid/core → core}/columnUtils.ts +44 -5
- package/src/core/controlledStateSync.ts +108 -0
- package/src/core/deletedRows.ts +34 -0
- package/src/core/dom.ts +74 -0
- package/src/{tmdatagrid/core → core}/editEngine.ts +1107 -460
- package/src/core/export.ts +704 -0
- package/src/{tmdatagrid/core → core}/filterControls.ts +38 -1
- package/src/{tmdatagrid/core → core}/filterOperators.ts +64 -1
- package/src/core/filterSurface.ts +99 -0
- package/src/{tmdatagrid/core → core}/grouping.ts +21 -0
- package/src/{tmdatagrid/core → core}/labels.ts +51 -6
- package/src/{tmdatagrid/core → core}/labelsSv.ts +27 -6
- package/src/core/pageReset.ts +120 -0
- package/src/core/pagination.ts +81 -0
- package/src/{tmdatagrid/core → core}/persistence.ts +22 -5
- package/src/{tmdatagrid/core → core}/summary.ts +20 -4
- package/src/{tmdatagrid/index.ts → index.ts} +69 -35
- package/src/{tmdatagrid/useTMDataGrid.tsx → useTMDataGrid.tsx} +428 -109
- package/src/useTMDataGridExport.ts +78 -0
- package/src/tmdatagrid/components/TMDataGridFilterPanel.module.css +0 -35
- package/src/tmdatagrid/components/TMDataGridFilterPanel.tsx +0 -354
- package/src/tmdatagrid/components/TMDataGridToolbar.tsx +0 -161
- package/src/tmdatagrid/core/cellExport.ts +0 -320
- /package/src/{tmdatagrid/TMDataGridContext.ts → TMDataGridContext.ts} +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGrid.module.css +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridDetailsColumn.module.css +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridFilterPills.module.css +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridFooter.module.css +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridGroupColumn.module.css +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridRowNumberColumn.tsx +0 -0
- /package/src/{tmdatagrid/components → components}/TMDataGridSearch.tsx +0 -0
- /package/src/{tmdatagrid/core → core}/capabilities.ts +0 -0
- /package/src/{tmdatagrid/core → core}/cellNavigation.ts +0 -0
- /package/src/{tmdatagrid/core → core}/cellRange.ts +0 -0
- /package/src/{tmdatagrid/core → core}/controlledState.ts +0 -0
- /package/src/{tmdatagrid/core → core}/draftCellContext.ts +0 -0
- /package/src/{tmdatagrid/core → core}/editorFocus.ts +0 -0
- /package/src/{tmdatagrid/core → core}/expanding.ts +0 -0
- /package/src/{tmdatagrid/core → core}/matchHighlight.ts +0 -0
- /package/src/{tmdatagrid/core → core}/quickSearch.ts +0 -0
- /package/src/{tmdatagrid/core → core}/resizePreview.ts +0 -0
- /package/src/{tmdatagrid/core → core}/rowPinning.ts +0 -0
- /package/src/{tmdatagrid/core → core}/rowSelection.ts +0 -0
- /package/src/{tmdatagrid/core → core}/sizes.ts +0 -0
- /package/src/{tmdatagrid/core → core}/useSettledTableState.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
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, GroupColumnDef, Header, IdentifiedColumnDef, Row, RowData, RowSelectionState, Table, TableFeatures, TableOptions, TableState, aggregationFns } from "@tanstack/react-table";
|
|
3
4
|
import { Store } from "@tanstack/store";
|
|
4
|
-
import { MantineSize, MenuProps } from "@mantine/core";
|
|
5
5
|
import { AnyFieldApi, AnyFormApi, StandardSchemaV1 } from "@tanstack/react-form";
|
|
6
6
|
import { RankingInfo } from "@tanstack/match-sorter-utils";
|
|
7
|
-
//#region .types-tmp/components/TMDataGridColumnsPanel.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* The "Manage columns" surface. Reachable from every column header menu and
|
|
10
|
-
* from the grid's burger menu, so it lives on its own and is rendered by
|
|
11
|
-
* `TMDataGrid.ColumnsButton`.
|
|
12
|
-
*/
|
|
13
|
-
declare function TMDataGridColumnsPanel(): import("react").JSX.Element;
|
|
14
|
-
//#endregion
|
|
15
7
|
//#region .types-tmp/core/sizes.d.ts
|
|
16
8
|
type TMDataGridSize = MantineSize;
|
|
17
9
|
declare const DEFAULT_TMDATAGRID_SIZE: TMDataGridSize;
|
|
@@ -57,17 +49,21 @@ type TMDataGridOption = {
|
|
|
57
49
|
/** Dropdown group heading. Ungrouped options render first. */
|
|
58
50
|
group?: string;
|
|
59
51
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
/**
|
|
53
|
+
* What an options function is called with. `TData` is the row type of the
|
|
54
|
+
* column helper the column was declared with.
|
|
55
|
+
*/
|
|
56
|
+
type TMDataGridOptionsArgs<TData extends RowData = TMDataGridRowData> = {
|
|
57
|
+
table: TMDataGridTable<TData>;
|
|
58
|
+
column: Column<TMDataGridFeatures, TData, unknown>;
|
|
63
59
|
/** The row an editor is standing on. Absent when the filter panel asks. */
|
|
64
|
-
row?: Row<TMDataGridFeatures,
|
|
60
|
+
row?: Row<TMDataGridFeatures, TData>;
|
|
65
61
|
/**
|
|
66
62
|
* Source to use when the column declares none. The filter panel passes
|
|
67
63
|
* `"faceted"` so a select column with no `meta.options` still offers the
|
|
68
64
|
* values that exist, rather than an empty dropdown.
|
|
69
65
|
*/
|
|
70
|
-
fallback?: TMDataGridOptionsSource
|
|
66
|
+
fallback?: TMDataGridOptionsSource<TData>;
|
|
71
67
|
};
|
|
72
68
|
/**
|
|
73
69
|
* Where a column's options come from - `meta.options`. One declaration feeds
|
|
@@ -79,7 +75,7 @@ type TMDataGridOptionsArgs = {
|
|
|
79
75
|
* | `"faceted"` | low-cardinality data columns: the distinct values present, via `getFacetedUniqueValues` |
|
|
80
76
|
* | function | large or contextual sets - `row` is set when an editor asks, so options can depend on the record (city given country) |
|
|
81
77
|
*/
|
|
82
|
-
type TMDataGridOptionsSource = ReadonlyArray<TMDataGridOption | string> | "faceted" | ((args: TMDataGridOptionsArgs) => ReadonlyArray<TMDataGridOption | string>);
|
|
78
|
+
type TMDataGridOptionsSource<TData extends RowData = TMDataGridRowData> = ReadonlyArray<TMDataGridOption | string> | "faceted" | ((args: TMDataGridOptionsArgs<TData>) => ReadonlyArray<TMDataGridOption | string>);
|
|
83
79
|
/**
|
|
84
80
|
* A column's options as a normalised list, whatever form `meta.options` took.
|
|
85
81
|
* Empty for a column that declares none.
|
|
@@ -105,64 +101,6 @@ type ComboboxData = Array<ComboboxItem | {
|
|
|
105
101
|
*/
|
|
106
102
|
declare function optionsToComboboxData(options: ReadonlyArray<TMDataGridOption>): ComboboxData;
|
|
107
103
|
//#endregion
|
|
108
|
-
//#region .types-tmp/core/filterOperators.d.ts
|
|
109
|
-
/**
|
|
110
|
-
* The value shape stored in `columnFilters` for every TMDataGrid column.
|
|
111
|
-
*
|
|
112
|
-
* TanStack resolves `filterFn` statically per column, so the operator travels
|
|
113
|
-
* inside the filter *value* instead. That keeps the filter model plain,
|
|
114
|
-
* serialisable JSON, so a server-side `manualFiltering` table can forward
|
|
115
|
-
* `columnFilters` to the API unchanged.
|
|
116
|
-
*
|
|
117
|
-
* `value` is a string array under `isAnyOf` / `isNoneOf` (the set the cell is
|
|
118
|
-
* tested against), a `[min, max]` pair under `between` (an empty string means
|
|
119
|
-
* that end is open), and a single string everywhere else - dates travel as
|
|
120
|
-
* ISO `YYYY-MM-DD` strings, booleans as `"true"` / `"false"`. Still plain
|
|
121
|
-
* JSON.
|
|
122
|
-
*/
|
|
123
|
-
type TMDataGridFilterValue = {
|
|
124
|
-
operator: TMDataGridFilterOperator;
|
|
125
|
-
value: string | ReadonlyArray<string>;
|
|
126
|
-
};
|
|
127
|
-
type TMDataGridColumnType = "string" | "number" | "boolean" | "date" | "select" | "multiSelect";
|
|
128
|
-
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "between" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
|
|
129
|
-
declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
|
|
130
|
-
declare function getOperatorsForType(type: TMDataGridColumnType): readonly TMDataGridFilterOperator[];
|
|
131
|
-
declare function getDefaultOperator(type: TMDataGridColumnType): TMDataGridFilterOperator;
|
|
132
|
-
declare function operatorNeedsValue(operator: TMDataGridFilterOperator): boolean;
|
|
133
|
-
/** Whether the operator's value is a string array - `isAnyOf` / `isNoneOf`. */
|
|
134
|
-
declare function operatorTakesArrayValue(operator: TMDataGridFilterOperator): boolean;
|
|
135
|
-
/** Whether the operator's value is a `[min, max]` pair - `between`. */
|
|
136
|
-
declare function operatorTakesRangeValue(operator: TMDataGridFilterOperator): boolean;
|
|
137
|
-
/** The untouched value a fresh filter starts with - the operator's shape, empty. */
|
|
138
|
-
declare function emptyValueForOperator(operator: TMDataGridFilterOperator): string | ReadonlyArray<string>;
|
|
139
|
-
/**
|
|
140
|
-
* A filter only narrows the row set once it has something to compare against.
|
|
141
|
-
* Half-typed filters stay in state (so the panel keeps rendering their row) but
|
|
142
|
-
* are treated as inactive for the funnel indicator and for row matching.
|
|
143
|
-
*/
|
|
144
|
-
declare function isFilterActive(value: unknown): boolean;
|
|
145
|
-
/**
|
|
146
|
-
* One-line description of a single filter, as shown on a filter pill.
|
|
147
|
-
*
|
|
148
|
-
* The type's default operator is left implicit - "First name: Sofia" reads the
|
|
149
|
-
* way a person would say it - while any other operator is spelled out, since
|
|
150
|
-
* that is the part a reader cannot guess.
|
|
151
|
-
*/
|
|
152
|
-
declare function formatFilterLabel({ label, type, filter, operatorLabels }: {
|
|
153
|
-
label: string;
|
|
154
|
-
type: TMDataGridColumnType;
|
|
155
|
-
filter: TMDataGridFilterValue;
|
|
156
|
-
/** Localized operator names - `labels.operators`. Defaults to English. */
|
|
157
|
-
operatorLabels?: Record<TMDataGridFilterOperator, string>;
|
|
158
|
-
}): string;
|
|
159
|
-
/**
|
|
160
|
-
* The single filter function every TMDataGrid column uses. It dispatches on the
|
|
161
|
-
* operator carried by the filter value, which is what lets one column offer
|
|
162
|
-
* "contains" / "does not equal" / "is empty" without redefining the column.
|
|
163
|
-
*/
|
|
164
|
-
declare function tmDataGridFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown): boolean;
|
|
165
|
-
//#endregion
|
|
166
104
|
//#region .types-tmp/core/editEngine.d.ts
|
|
167
105
|
/**
|
|
168
106
|
* What counts as a commit - one axis, each mode a thin policy over the same
|
|
@@ -254,8 +192,10 @@ type TMDataGridTableValidateArgs<TData extends RowData = TMDataGridRowData> = {
|
|
|
254
192
|
/**
|
|
255
193
|
* `editing.tableValidators` - rules that need the other rows: no duplicate
|
|
256
194
|
* keys, no overlapping ranges, allocations summing to a total. Run at every
|
|
257
|
-
* commit, after the row's own validators, and again per
|
|
258
|
-
* `saveDrafts
|
|
195
|
+
* commit, after the row's own validators, and again per committed row during
|
|
196
|
+
* `saveDrafts`, the only rules that run there - a committed row a later edit
|
|
197
|
+
* invalidated is reopened with the error, and the save reports it in
|
|
198
|
+
* `reopened`.
|
|
259
199
|
*
|
|
260
200
|
* Return nothing to pass, a message, or Form's `{ form, fields }` shape;
|
|
261
201
|
* pathed issues land on the committing row's cells, pathless ones on the row.
|
|
@@ -331,20 +271,22 @@ type TMDataGridEditState = {
|
|
|
331
271
|
columnId: string | null;
|
|
332
272
|
} | null;
|
|
333
273
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
274
|
+
* Every row the grid is holding work for: open rows, whose form is still
|
|
275
|
+
* undecided, and committed rows, whose values wait in the draft store. In
|
|
276
|
+
* the order the rows first entered; a reopen keeps a row's place. A row is
|
|
277
|
+
* *open* when it is in here and not in {@link committedRowIds}, or, for an
|
|
278
|
+
* entry row, not flagged `committed` in {@link newRows}.
|
|
337
279
|
*/
|
|
338
280
|
openRowIds: ReadonlyArray<string>;
|
|
339
281
|
rows: Record<string, TMDataGridEditRowProjection>;
|
|
340
282
|
/**
|
|
341
|
-
* The draft store's edit slice: existing rows
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
283
|
+
* The draft store's edit slice: existing rows that passed their commit and
|
|
284
|
+
* wait for `saveDrafts`. A committed row is data, not a form: its values
|
|
285
|
+
* are in {@link committedValues}, and `begin` on one of these builds a
|
|
286
|
+
* fresh form from them and takes the row back out.
|
|
345
287
|
*
|
|
346
|
-
* Only `editing.draft`
|
|
347
|
-
*
|
|
288
|
+
* Only `editing.draft` commits into the store. Without it a commit goes
|
|
289
|
+
* straight to the consumer, so this stays empty.
|
|
348
290
|
*/
|
|
349
291
|
committedRowIds: ReadonlyArray<string>;
|
|
350
292
|
/**
|
|
@@ -360,8 +302,9 @@ type TMDataGridEditState = {
|
|
|
360
302
|
/**
|
|
361
303
|
* Rows being created, not yet in `data`. `committed` is the draft store's
|
|
362
304
|
* add slice: the entry row passed its submit and renders as a value row
|
|
363
|
-
* until `begin` re-opens it. Without
|
|
364
|
-
* `onRowAdd` and the entry is
|
|
305
|
+
* from {@link committedValues} until `begin` re-opens it. Without
|
|
306
|
+
* `editing.draft` a commit adds through `onRowAdd` and the entry is
|
|
307
|
+
* dropped, so it never turns `true`.
|
|
365
308
|
*/
|
|
366
309
|
newRows: ReadonlyArray<{
|
|
367
310
|
tempId: string;
|
|
@@ -369,9 +312,29 @@ type TMDataGridEditState = {
|
|
|
369
312
|
}>;
|
|
370
313
|
/** The draft store's delete slice: rows marked deleted, awaiting the save. */
|
|
371
314
|
deletedRowIds: ReadonlyArray<string>;
|
|
315
|
+
/**
|
|
316
|
+
* `true` while `saveDrafts` is in flight - from the call until the
|
|
317
|
+
* consumer's callbacks (`onSaveDrafts`, or the per-row `onCommit` /
|
|
318
|
+
* `onRowAdd` / `onRowDelete` loop) have settled. Concurrent `saveDrafts`
|
|
319
|
+
* calls join the same run, so it flips once per run. It stays `false` for
|
|
320
|
+
* a save that finds nothing to send.
|
|
321
|
+
*/
|
|
322
|
+
isSaving: boolean;
|
|
372
323
|
};
|
|
373
|
-
|
|
374
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Whether the grid holds anything a navigation would lose: an open row with
|
|
326
|
+
* a moved value, an entry row, the draft store (edits, new rows, deletion
|
|
327
|
+
* marks), or a save still in flight.
|
|
328
|
+
*
|
|
329
|
+
* A pure selector over the edit state, so `useSelector(edit.store,
|
|
330
|
+
* hasPendingEdits)` re-renders only when the answer flips, and a navigation
|
|
331
|
+
* blocker can read `hasPendingEdits(edit.state)` at the moment it is asked.
|
|
332
|
+
* `isSaving` counts because the default per-row loop takes the deletion
|
|
333
|
+
* marks out of the store before its `onRowDelete` calls settle.
|
|
334
|
+
*/
|
|
335
|
+
declare function hasPendingEdits(state: TMDataGridEditState): boolean;
|
|
336
|
+
type ErasedRow$1 = Row<TMDataGridFeatures, TMDataGridRowData>;
|
|
337
|
+
type ErasedColumn$1 = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
375
338
|
/**
|
|
376
339
|
* What a cell editor is handed - deliberately both vocabularies at once. The
|
|
377
340
|
* form side is TanStack Form's real `field` API (`field.state.value`,
|
|
@@ -389,8 +352,8 @@ type TMDataGridEditorArgs = {
|
|
|
389
352
|
/** The whole row form, for the rare editor that reads sibling fields. */
|
|
390
353
|
form: TMDataGridRowEditForm;
|
|
391
354
|
cell: Cell<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
392
|
-
row: ErasedRow;
|
|
393
|
-
column: ErasedColumn;
|
|
355
|
+
row: ErasedRow$1;
|
|
356
|
+
column: ErasedColumn$1;
|
|
394
357
|
table: TMDataGridTable<TMDataGridRowData>;
|
|
395
358
|
/** What Enter would do - commit the edit. For the editor's own UI. */
|
|
396
359
|
commit: () => Promise<boolean>;
|
|
@@ -415,8 +378,8 @@ type TMDataGridEditValueMapArgs = {
|
|
|
415
378
|
value: unknown;
|
|
416
379
|
/** What the field held before this write - for length-aware masks. */
|
|
417
380
|
previous: unknown;
|
|
418
|
-
row: ErasedRow;
|
|
419
|
-
column: ErasedColumn;
|
|
381
|
+
row: ErasedRow$1;
|
|
382
|
+
column: ErasedColumn$1;
|
|
420
383
|
table: TMDataGridTable<TMDataGridRowData>;
|
|
421
384
|
};
|
|
422
385
|
/**
|
|
@@ -446,13 +409,14 @@ type TMDataGridEditValueMap = (args: TMDataGridEditValueMapArgs) => unknown;
|
|
|
446
409
|
* `meta.type` and `meta.options` stay outside this namespace on purpose: one
|
|
447
410
|
* declaration of each feeds the cell editor and the filter panel alike.
|
|
448
411
|
*/
|
|
449
|
-
type TMDataGridColumnEditOptions = {
|
|
412
|
+
type TMDataGridColumnEditOptions<TData extends RowData = TMDataGridRowData> = {
|
|
450
413
|
/**
|
|
451
414
|
* Whether this column's cells take edits, once `editMode` is on. `false`
|
|
452
415
|
* switches the column off outright; a predicate decides per row. Defaults
|
|
453
416
|
* to editable for any column that maps to a field - see {@link field}.
|
|
417
|
+
* `row` is typed by the column helper the column was declared with.
|
|
454
418
|
*/
|
|
455
|
-
enabled?: boolean | ((row: Row<TMDataGridFeatures,
|
|
419
|
+
enabled?: boolean | ((row: Row<TMDataGridFeatures, TData>) => boolean);
|
|
456
420
|
/**
|
|
457
421
|
* The data path this column edits, when it is not the `accessorKey` - the
|
|
458
422
|
* only way a column built on `accessorFn` becomes editable. Dot paths reach
|
|
@@ -500,10 +464,6 @@ type TMDataGridSaveDraftsArgs<TData extends RowData> = {
|
|
|
500
464
|
created: Array<TMDataGridRowAddArgs<TData>>;
|
|
501
465
|
/** Ids marked deleted while the drafts accumulated. */
|
|
502
466
|
deleted: Array<string>;
|
|
503
|
-
/** @deprecated Renamed to {@link updated}. Removed in a later beta. */
|
|
504
|
-
rows: Array<TMDataGridEditCommitArgs<TData>>;
|
|
505
|
-
/** @deprecated Renamed to {@link created}. Removed in a later beta. */
|
|
506
|
-
added: Array<TMDataGridRowAddArgs<TData>>;
|
|
507
467
|
};
|
|
508
468
|
/**
|
|
509
469
|
* Which entries of one bucket saved. `true`, or an id the map does not name,
|
|
@@ -520,7 +480,7 @@ type TMDataGridSaveOutcomes = boolean | Record<string, boolean>;
|
|
|
520
480
|
* with nothing beyond the state itself - a failed edit keeps `data-draft`,
|
|
521
481
|
* a failed deletion keeps `data-deleted` - so the display is the consumer's.
|
|
522
482
|
*/
|
|
523
|
-
type
|
|
483
|
+
type TMDataGridSaveDraftsResponse = {
|
|
524
484
|
/** Keyed by `rowId`. */
|
|
525
485
|
updated?: TMDataGridSaveOutcomes;
|
|
526
486
|
/** Keyed by `tempId`. */
|
|
@@ -528,11 +488,6 @@ type TMDataGridSaveDraftsResult = {
|
|
|
528
488
|
/** Keyed by `rowId`. */
|
|
529
489
|
deleted?: TMDataGridSaveOutcomes;
|
|
530
490
|
};
|
|
531
|
-
/**
|
|
532
|
-
* @deprecated Renamed to {@link TMDataGridSaveDraftsArgs} - the payload is
|
|
533
|
-
* the draft store being saved, not a commit. Removed in a later beta.
|
|
534
|
-
*/
|
|
535
|
-
type TMDataGridEditCommitDraftsArgs<TData extends RowData> = TMDataGridSaveDraftsArgs<TData>;
|
|
536
491
|
/**
|
|
537
492
|
* The data path a column edits, or `null` for a column that has none.
|
|
538
493
|
*
|
|
@@ -564,6 +519,8 @@ type TMDataGridAddRowsOptions = {
|
|
|
564
519
|
};
|
|
565
520
|
/** What `edit.addRows` reports back. Every added row is in exactly one list. */
|
|
566
521
|
type TMDataGridAddRowsResult = {
|
|
522
|
+
/** `true` when every added row committed - `open` is empty. */
|
|
523
|
+
ok: boolean;
|
|
567
524
|
/** Temp ids that committed - parked as drafts, or added outright. */
|
|
568
525
|
committed: Array<string>;
|
|
569
526
|
/**
|
|
@@ -572,6 +529,50 @@ type TMDataGridAddRowsResult = {
|
|
|
572
529
|
*/
|
|
573
530
|
open: Array<string>;
|
|
574
531
|
};
|
|
532
|
+
/**
|
|
533
|
+
* What `edit.commitAll` reports back. Every row that was open at the call is
|
|
534
|
+
* in exactly one list; ids are row ids, and temp ids for entry rows.
|
|
535
|
+
*/
|
|
536
|
+
type TMDataGridCommitAllResult = {
|
|
537
|
+
/** `true` when every open row committed - `open` is empty. */
|
|
538
|
+
ok: boolean;
|
|
539
|
+
/**
|
|
540
|
+
* Rows whose `commit` resolved `true` - into the draft store under
|
|
541
|
+
* `editing.draft`, out to the consumer without it, or closed with nothing
|
|
542
|
+
* to save.
|
|
543
|
+
*/
|
|
544
|
+
committed: Array<string>;
|
|
545
|
+
/**
|
|
546
|
+
* Rows still open, carrying their errors: validation failed, or without
|
|
547
|
+
* `editing.draft` the consumer's `onCommit` / `onRowAdd` threw.
|
|
548
|
+
*/
|
|
549
|
+
open: Array<string>;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* What `edit.saveDrafts` reports back. Ids are row ids, and temp ids for new
|
|
553
|
+
* rows; edits, new rows and deletions are mixed in each list. Every id the
|
|
554
|
+
* save took from the draft store is in exactly one list. Rows open at the
|
|
555
|
+
* call are not part of the save and are in none.
|
|
556
|
+
*/
|
|
557
|
+
type TMDataGridSaveDraftsResult = {
|
|
558
|
+
/** `true` when nothing was kept or reopened. */
|
|
559
|
+
ok: boolean;
|
|
560
|
+
/** Left the draft store - the consumer accepted it. */
|
|
561
|
+
saved: Array<string>;
|
|
562
|
+
/**
|
|
563
|
+
* Still in the draft store, still committed, and sent again by the next
|
|
564
|
+
* save: an id `onSaveDrafts` reported as failed, every id it was sent
|
|
565
|
+
* when it threw, or, without `onSaveDrafts`, a deletion whose
|
|
566
|
+
* `onRowDelete` threw.
|
|
567
|
+
*/
|
|
568
|
+
kept: Array<string>;
|
|
569
|
+
/**
|
|
570
|
+
* Out of the draft store and open again, carrying an error: a table rule
|
|
571
|
+
* now rejects the row, or, without `onSaveDrafts`, the row's own
|
|
572
|
+
* `onCommit` / `onRowAdd` threw.
|
|
573
|
+
*/
|
|
574
|
+
reopened: Array<string>;
|
|
575
|
+
};
|
|
575
576
|
/** One row of {@link TMDataGridEditApi.getRows}. */
|
|
576
577
|
type TMDataGridEditRowSnapshot<TData extends RowData = TMDataGridRowData> = {
|
|
577
578
|
/** The row's id - `addRow`'s temp id for an entry row. */
|
|
@@ -586,22 +587,28 @@ type TMDataGridEditRowSnapshot<TData extends RowData = TMDataGridRowData> = {
|
|
|
586
587
|
/**
|
|
587
588
|
* The engine plus its store - `api.edit`.
|
|
588
589
|
*
|
|
589
|
-
* "One row, one form": `getForm` hands out the same
|
|
590
|
-
* editors write through, so a consumer can render it in
|
|
591
|
-
* panel and share values, dirty state and errors with
|
|
590
|
+
* "One row, one form" while a row is open: `getForm` hands out the same
|
|
591
|
+
* `FormApi` the inline editors write through, so a consumer can render it in
|
|
592
|
+
* a drawer or a detail panel and share values, dirty state and errors with
|
|
593
|
+
* the cells. A committed row has no form - it is data in the draft store -
|
|
594
|
+
* so `getForm` returns `undefined` for it until `begin` reopens it.
|
|
592
595
|
*/
|
|
593
596
|
type TMDataGridEditApi<TData extends RowData = TMDataGridRowData> = {
|
|
594
597
|
/** The projection store - subscribe with `useSelector(edit.store, …)`. */
|
|
595
598
|
store: Store<TMDataGridEditState>;
|
|
596
599
|
/** Current snapshot, for reads outside React. */
|
|
597
600
|
readonly state: TMDataGridEditState;
|
|
598
|
-
/**
|
|
601
|
+
/**
|
|
602
|
+
* rowId → the open row's live form, the source of truth for everything
|
|
603
|
+
* mid-edit. `undefined` for a row that is not open, a committed row
|
|
604
|
+
* included; `begin` reopens one.
|
|
605
|
+
*/
|
|
599
606
|
getForm: (rowId: string) => TMDataGridRowEditForm | undefined;
|
|
600
607
|
/**
|
|
601
|
-
* The row as shown: its draft values where
|
|
602
|
-
*
|
|
603
|
-
* such row exists. A deletion mark does not
|
|
604
|
-
* `state.deletedRowIds` for that.
|
|
608
|
+
* The row as shown: its draft values where the grid holds any - an open
|
|
609
|
+
* form's, or the committed values in the draft store - else what `data`
|
|
610
|
+
* says. `undefined` when no such row exists. A deletion mark does not
|
|
611
|
+
* change the answer; check `state.deletedRowIds` for that.
|
|
605
612
|
*/
|
|
606
613
|
getRowValues: (rowId: string) => TData | undefined;
|
|
607
614
|
/**
|
|
@@ -615,16 +622,16 @@ type TMDataGridEditApi<TData extends RowData = TMDataGridRowData> = {
|
|
|
615
622
|
* Whether this cell may open an editor: the column maps to a field, nothing
|
|
616
623
|
* switched it off, and the row takes edits at all.
|
|
617
624
|
*/
|
|
618
|
-
canEditCell: (row: ErasedRow, column: ErasedColumn) => boolean;
|
|
625
|
+
canEditCell: (row: ErasedRow$1, column: ErasedColumn$1) => boolean;
|
|
619
626
|
/** Whether the row takes edits at all - the edit lane's pencil gate. */
|
|
620
|
-
canEditRow: (row: ErasedRow) => boolean;
|
|
627
|
+
canEditRow: (row: ErasedRow$1) => boolean;
|
|
621
628
|
/**
|
|
622
629
|
* Whether the column takes edits at all, with no row in hand: it maps to a
|
|
623
630
|
* field, `editing.columns` lists it if that option is set, and
|
|
624
631
|
* `meta.edit.enabled` is not `false`. A per-row `enabled` predicate is the
|
|
625
632
|
* row's half of the question - `canEditCell` asks both.
|
|
626
633
|
*/
|
|
627
|
-
isColumnEditable: (column: ErasedColumn) => boolean;
|
|
634
|
+
isColumnEditable: (column: ErasedColumn$1) => boolean;
|
|
628
635
|
/**
|
|
629
636
|
* Opens an editor. In row mode the whole row opens either way and `columnId`
|
|
630
637
|
* only says which cell takes the caret; `null` (the lane's pencil) leaves it
|
|
@@ -653,24 +660,33 @@ type TMDataGridEditApi<TData extends RowData = TMDataGridRowData> = {
|
|
|
653
660
|
* Submits every open row, as if each had been OK'd: a row that validates
|
|
654
661
|
* commits (into the draft store with `editing.draft` on, straight to the
|
|
655
662
|
* consumer without it), a row that fails stays open with its errors.
|
|
656
|
-
*
|
|
657
|
-
*
|
|
663
|
+
* Under `editing.draft` it sends nothing to the consumer by itself - that
|
|
664
|
+
* is `saveDrafts`.
|
|
665
|
+
*
|
|
666
|
+
* Resolves which rows went which way: `committed` and `open` hold every
|
|
667
|
+
* row that was open at the call, each in exactly one list, and `ok` is
|
|
668
|
+
* `true` when `open` is empty. See {@link TMDataGridCommitAllResult}.
|
|
658
669
|
*/
|
|
659
|
-
commitAll: () => Promise<
|
|
670
|
+
commitAll: () => Promise<TMDataGridCommitAllResult>;
|
|
660
671
|
/**
|
|
661
672
|
* Flushes the draft store: every committed edit, added row and deletion
|
|
662
673
|
* mark reaches the consumer, through `onSaveDrafts` in one call when it is
|
|
663
674
|
* set, or row by row through `onCommit` / `onRowAdd` / `onRowDelete`.
|
|
664
675
|
*
|
|
665
676
|
* Rows still open are left alone - they keep their form state and stay
|
|
666
|
-
* open
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
|
|
673
|
-
|
|
677
|
+
* open, and are in no list of the result.
|
|
678
|
+
*
|
|
679
|
+
* Resolves what happened to each id it sent: `saved` left the draft store,
|
|
680
|
+
* `kept` is still in it, committed, for the next save - an id
|
|
681
|
+
* `onSaveDrafts` reported as failed, every id when it threw, or a
|
|
682
|
+
* deletion whose per-row `onRowDelete` threw - and
|
|
683
|
+
* `reopened` is open again with an error, because a table rule now
|
|
684
|
+
* rejects it or its per-row `onCommit` / `onRowAdd` threw. `ok` is `true`
|
|
685
|
+
* when nothing was kept or reopened, and an empty store resolves `ok` with
|
|
686
|
+
* empty lists. A call while a save is in flight joins it and resolves the
|
|
687
|
+
* same result. See {@link TMDataGridSaveDraftsResult}.
|
|
688
|
+
*/
|
|
689
|
+
saveDrafts: () => Promise<TMDataGridSaveDraftsResult>;
|
|
674
690
|
/** Writes the type's empty value into a cell and commits it - Delete. */
|
|
675
691
|
clearCell: (rowId: string, columnId: string) => Promise<boolean>;
|
|
676
692
|
/**
|
|
@@ -708,24 +724,43 @@ type TMDataGridEditApi<TData extends RowData = TMDataGridRowData> = {
|
|
|
708
724
|
*/
|
|
709
725
|
addRow: (values?: Partial<TData>) => string;
|
|
710
726
|
/**
|
|
711
|
-
* Opens entry rows for a list of records at once - one
|
|
727
|
+
* Opens entry rows for a list of records at once - one publish for the
|
|
712
728
|
* batch, where a loop over `addRow` is one per row. Each row is seeded over
|
|
713
729
|
* `newRowDefaults` exactly as `addRow` does.
|
|
714
730
|
*
|
|
715
|
-
* `commit: true` submits
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
731
|
+
* `commit: true` submits the rows too, which is what an import wants: rows
|
|
732
|
+
* that validate commit, and rows that fail stay open in the entry block
|
|
733
|
+
* carrying their errors, for the user to fix. The result says which went
|
|
734
|
+
* which way - `committed` and `open` hold every added row, each in exactly
|
|
735
|
+
* one list, and `ok` is `true` when `open` is empty. Under
|
|
736
|
+
* `editing.draft` the rows validate together and land in the draft store
|
|
737
|
+
* in the same publish as the add - the grid renders once,
|
|
738
|
+
* whatever the count. Without it each valid row goes out through
|
|
739
|
+
* `onRowAdd`, one at a time and in order.
|
|
720
740
|
*/
|
|
721
741
|
addRows: (rows: ReadonlyArray<Partial<TData>>, options?: TMDataGridAddRowsOptions) => Promise<TMDataGridAddRowsResult>;
|
|
722
742
|
/**
|
|
723
743
|
* Deletes a row: `onRowDelete` straight away, or under `editing.draft` a
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
744
|
+
* mark in `deletedRowIds` - the row renders struck through until
|
|
745
|
+
* `saveDrafts` reports it. Idempotent: deleting a marked row again leaves
|
|
746
|
+
* it marked, and {@link restoreRow} is the undo. On an entry row,
|
|
747
|
+
* committed or not, it just discards the entry; an id the grid does not
|
|
748
|
+
* know is a no-op.
|
|
727
749
|
*/
|
|
728
750
|
deleteRow: (rowId: string) => void;
|
|
751
|
+
/**
|
|
752
|
+
* {@link deleteRow} for several rows in one call - one notification for
|
|
753
|
+
* the batch, for a bulk action over a selection. Because `deleteRow` is
|
|
754
|
+
* idempotent and ignores unknown ids, the list may be passed exactly as
|
|
755
|
+
* the selection stands - already-marked rows stay marked, duplicates and
|
|
756
|
+
* stale ids do nothing.
|
|
757
|
+
*/
|
|
758
|
+
deleteRows: (rowIds: ReadonlyArray<string>) => void;
|
|
759
|
+
/**
|
|
760
|
+
* Removes a row's deletion mark - the lane's Restore. A no-op on a row
|
|
761
|
+
* that is not marked, and outside `editing.draft`, where no marks exist.
|
|
762
|
+
*/
|
|
763
|
+
restoreRow: (rowId: string) => void;
|
|
729
764
|
/** Whether delete chrome makes sense - the lane's trash gate. */
|
|
730
765
|
canDeleteRows: () => boolean;
|
|
731
766
|
};
|
|
@@ -748,13 +783,15 @@ declare function normalizeFieldValidate(validate: TMDataGridFieldValidate | unde
|
|
|
748
783
|
type TMDataGridLabels = {
|
|
749
784
|
/** Filter operator names, as shown in the operator dropdown and on pills. */
|
|
750
785
|
operators: Record<TMDataGridFilterOperator, string>;
|
|
751
|
-
/** "Manage columns" - the burger button and the header menu item. */
|
|
752
|
-
manageColumns: string;
|
|
753
786
|
/** "Filters" - the funnel button and the filter panel's title. */
|
|
754
787
|
filters: string;
|
|
755
788
|
searchPlaceholder: string;
|
|
756
789
|
searchLabel: string;
|
|
757
790
|
clearSearch: string;
|
|
791
|
+
/** Tooltip and `aria-label` of `TMDataGrid.Menu`'s burger trigger. */
|
|
792
|
+
menuButton: string;
|
|
793
|
+
/** "Manage columns" - the header menu's submenu. */
|
|
794
|
+
manageColumns: string;
|
|
758
795
|
columnsSearchPlaceholder: string;
|
|
759
796
|
columnsNoMatch: (search: string) => string;
|
|
760
797
|
columnsShowHideAll: string;
|
|
@@ -785,6 +822,8 @@ type TMDataGridLabels = {
|
|
|
785
822
|
clearAllFilters: string;
|
|
786
823
|
closeFilters: string;
|
|
787
824
|
removeFilter: string;
|
|
825
|
+
/** Names the operator button in a column's header filter control. */
|
|
826
|
+
filterOperatorFor: (column: string) => string;
|
|
788
827
|
activeFilters: string;
|
|
789
828
|
clearFilter: (column: string) => string;
|
|
790
829
|
sortAsc: string;
|
|
@@ -810,6 +849,11 @@ type TMDataGridLabels = {
|
|
|
810
849
|
to: number;
|
|
811
850
|
total: number;
|
|
812
851
|
}) => string;
|
|
852
|
+
/** `pageCount` is `-1` when a manual grid declares an unknown total. */
|
|
853
|
+
pageNumber: (args: {
|
|
854
|
+
page: number;
|
|
855
|
+
pageCount: number;
|
|
856
|
+
}) => string;
|
|
813
857
|
groupedAllRows: (total: number) => string;
|
|
814
858
|
pagingSuspendedHint: string;
|
|
815
859
|
previousPage: string;
|
|
@@ -859,8 +903,22 @@ type TMDataGridLabels = {
|
|
|
859
903
|
rowStateDeleted: string;
|
|
860
904
|
cellCount: (count: number) => string;
|
|
861
905
|
copy: string;
|
|
862
|
-
|
|
906
|
+
exportCells: string;
|
|
863
907
|
includeHeaders: string;
|
|
908
|
+
exportAll: string;
|
|
909
|
+
exportSelected: (count: number) => string;
|
|
910
|
+
/** Title of the column picker `columns="custom"` opens; `format` is the file extension in upper case, "CSV". */
|
|
911
|
+
exportPickerTitle: (format: string) => string;
|
|
912
|
+
/** The line under the title; `selected` is the selected row count, or `null` for an export of all rows. */
|
|
913
|
+
exportPickerHint: (selected: number | null) => string;
|
|
914
|
+
exportPickerConfirm: string;
|
|
915
|
+
exportPickerCancel: string;
|
|
916
|
+
/** The select-all row over the picker's list. */
|
|
917
|
+
exportPickerSelectAll: string;
|
|
918
|
+
/** The "3 of 12" count beside it. */
|
|
919
|
+
exportPickerCount: (checked: number, total: number) => string;
|
|
920
|
+
/** Marks a column the grid hides at the moment. */
|
|
921
|
+
exportPickerHidden: string;
|
|
864
922
|
selectColumnLabel: string;
|
|
865
923
|
selectAllRows: string;
|
|
866
924
|
selectRow: string;
|
|
@@ -915,7 +973,30 @@ type TMDataGridFilterControlArgs = {
|
|
|
915
973
|
options: ReadonlyArray<TMDataGridOption>;
|
|
916
974
|
size: TMDataGridSize;
|
|
917
975
|
labels: TMDataGridLabels;
|
|
976
|
+
/**
|
|
977
|
+
* How much room the control has, and whether it names itself. The same
|
|
978
|
+
* vocabulary as `TMDataGrid.FilterPanel`'s own `layout` prop, plus the one
|
|
979
|
+
* value only a header cell can be in.
|
|
980
|
+
*
|
|
981
|
+
* | Layout | Where | Field |
|
|
982
|
+
* | --- | --- | --- |
|
|
983
|
+
* | `"row"` | A filter row laid out side by side | Labelled, fixed width |
|
|
984
|
+
* | `"stacked"` | A filter row in a narrow host - the sidebar | Labelled, full width |
|
|
985
|
+
* | `"header"` | One header cell, under `filters.inHeader` | `aria-label`, full width |
|
|
986
|
+
*
|
|
987
|
+
* Every built-in control honours it. A custom control that ignores it still
|
|
988
|
+
* works - it will simply look the same everywhere.
|
|
989
|
+
*/
|
|
990
|
+
layout: TMDataGridFilterControlLayout;
|
|
918
991
|
};
|
|
992
|
+
/** How much room a filter control has. See `layout`. */
|
|
993
|
+
type TMDataGridFilterControlLayout = "row" | "stacked" | "header";
|
|
994
|
+
/**
|
|
995
|
+
* The two a filter *panel* can be in - {@link TMDataGridFilterControlLayout}
|
|
996
|
+
* without the header cell, which is not a panel. `TMDataGrid.FilterPanel`'s
|
|
997
|
+
* `layout` prop.
|
|
998
|
+
*/
|
|
999
|
+
type TMDataGridFilterPanelLayout = Exclude<TMDataGridFilterControlLayout, "header">;
|
|
919
1000
|
/**
|
|
920
1001
|
* `meta.filter.control` - replaces the built-in value control for this column.
|
|
921
1002
|
* Rendered as JSX, never invoked as a bare function, so hooks are legal
|
|
@@ -936,10 +1017,19 @@ type TMDataGridFilterControlComponent = ComponentType<TMDataGridFilterControlArg
|
|
|
936
1017
|
* declaration of each feeds the filter panel and the cell editor alike.
|
|
937
1018
|
*/
|
|
938
1019
|
type TMDataGridColumnFilterOptions = {
|
|
1020
|
+
/**
|
|
1021
|
+
* The operators this column offers, a subset of the type's own. For a
|
|
1022
|
+
* column backed by an endpoint that answers only some of them - `contains`
|
|
1023
|
+
* and `equals`, say - so the panel and the header funnel never offer an
|
|
1024
|
+
* operator the query cannot express. Kept in the type's order; one the type
|
|
1025
|
+
* does not offer is ignored, and a list that leaves nothing falls back to
|
|
1026
|
+
* the type's full set.
|
|
1027
|
+
*/
|
|
1028
|
+
operators?: readonly TMDataGridFilterOperator[];
|
|
939
1029
|
/**
|
|
940
1030
|
* The operator a fresh filter on this column starts with, instead of the
|
|
941
1031
|
* type's default - a salary column can open on `"between"`. Must be one of
|
|
942
|
-
* the
|
|
1032
|
+
* the operators the column offers.
|
|
943
1033
|
*/
|
|
944
1034
|
defaultOperator?: TMDataGridFilterOperator;
|
|
945
1035
|
/**
|
|
@@ -949,6 +1039,83 @@ type TMDataGridColumnFilterOptions = {
|
|
|
949
1039
|
control?: TMDataGridFilterControlComponent;
|
|
950
1040
|
};
|
|
951
1041
|
//#endregion
|
|
1042
|
+
//#region .types-tmp/core/filterSurface.d.ts
|
|
1043
|
+
/**
|
|
1044
|
+
* Where the grid puts its filter controls.
|
|
1045
|
+
*
|
|
1046
|
+
* | Surface | Where it renders |
|
|
1047
|
+
* | --- | --- |
|
|
1048
|
+
* | `"popup"` | Floating over the first body rows, under the header |
|
|
1049
|
+
* | `"sidebar"` | Beside the table, inside the grid frame |
|
|
1050
|
+
* | `"none"` | Nowhere - the grid renders no panel of its own |
|
|
1051
|
+
*
|
|
1052
|
+
* Header filters are not one of these: they are a second row of controls in
|
|
1053
|
+
* the header, always visible, and they coexist with any of the three. See
|
|
1054
|
+
* {@link TMDataGridFiltersOptions.inHeader}.
|
|
1055
|
+
*/
|
|
1056
|
+
type TMDataGridFilterSurface = "popup" | "sidebar" | "none";
|
|
1057
|
+
/** Which side of the table the sidebar surface renders on. */
|
|
1058
|
+
type TMDataGridFilterSidebarSide = "left" | "right";
|
|
1059
|
+
/**
|
|
1060
|
+
* `filters` on `useTMDataGrid` - everything about where the filter controls
|
|
1061
|
+
* are, as opposed to what they do.
|
|
1062
|
+
*
|
|
1063
|
+
* Named for the option key, the way `editing` has `TMDataGridEditingOptions`.
|
|
1064
|
+
* Not to be confused with `TMDataGridColumnFilterOptions`, which is one
|
|
1065
|
+
* column's `meta.filter`.
|
|
1066
|
+
*
|
|
1067
|
+
* ```tsx
|
|
1068
|
+
* useTMDataGrid({ data, columns, filters: { surface: "sidebar" } });
|
|
1069
|
+
* ```
|
|
1070
|
+
*/
|
|
1071
|
+
type TMDataGridFiltersOptions = {
|
|
1072
|
+
/**
|
|
1073
|
+
* Which surface `TMDataGrid.Table` renders and `TMDataGrid.FilterButton`
|
|
1074
|
+
* toggles. Defaults to `"popup"`.
|
|
1075
|
+
*
|
|
1076
|
+
* Under `"none"` the table renders no panel and the filter button renders
|
|
1077
|
+
* nothing. That is what a grid running header filters alone wants, and it is
|
|
1078
|
+
* also what frees a hand-placed `<TMDataGrid.FilterPanel />` to be the only
|
|
1079
|
+
* panel on the page - mounted, it is always visible, so drive it off
|
|
1080
|
+
* `ui.state.filterPanelOpen` if it belongs behind a control of your own.
|
|
1081
|
+
*/
|
|
1082
|
+
surface?: TMDataGridFilterSurface;
|
|
1083
|
+
/** Which side the `"sidebar"` surface sits on. Defaults to `"right"`. */
|
|
1084
|
+
sidebarSide?: TMDataGridFilterSidebarSide;
|
|
1085
|
+
/** Width of the `"sidebar"` surface, any CSS length. Defaults to `"280px"`. */
|
|
1086
|
+
sidebarWidth?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether the popup or the sidebar starts open. Read once, at mount, like
|
|
1089
|
+
* `initialState`.
|
|
1090
|
+
*
|
|
1091
|
+
* Defaults to `true` under `"sidebar"` and `false` everywhere else: a
|
|
1092
|
+
* sidebar is a layout choice, so asking for one and getting an empty strip
|
|
1093
|
+
* until the funnel is clicked is not what it reads like, while a popup that
|
|
1094
|
+
* greets you open is in the way.
|
|
1095
|
+
*
|
|
1096
|
+
* Under `"none"` it is simply the starting value of
|
|
1097
|
+
* `ui.state.filterPanelOpen`, which a control of your own can read.
|
|
1098
|
+
*/
|
|
1099
|
+
defaultOpen?: boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* A second header row holding one value control per filterable column,
|
|
1102
|
+
* always visible. Off by default.
|
|
1103
|
+
*
|
|
1104
|
+
* Independent of `surface` - a grid may have header filters and a popup at
|
|
1105
|
+
* once. What it does change is the column chrome: the header's funnel
|
|
1106
|
+
* indicator and the column menu's "Filter" item both come off, because
|
|
1107
|
+
* their only job was to reveal a control that is now already on screen.
|
|
1108
|
+
*
|
|
1109
|
+
* A header cell has room for a value and an operator button, not for the
|
|
1110
|
+
* panel's column / operator / value triple. Everything else about a filter
|
|
1111
|
+
* is unchanged - the same operators, the same `meta.filter.control`, the
|
|
1112
|
+
* same `columnFilters` state.
|
|
1113
|
+
*/
|
|
1114
|
+
inHeader?: boolean;
|
|
1115
|
+
};
|
|
1116
|
+
/** {@link TMDataGridFiltersOptions} with every default filled in. */
|
|
1117
|
+
type TMDataGridFiltersSettings = Required<TMDataGridFiltersOptions>;
|
|
1118
|
+
//#endregion
|
|
952
1119
|
//#region .types-tmp/core/quickSearch.d.ts
|
|
953
1120
|
/** How the quick search matches - see `quickSearchMode` on the hook options. */
|
|
954
1121
|
type TMDataGridQuickSearchMode = "fuzzy" | "contains";
|
|
@@ -1227,41 +1394,6 @@ type TMDataGridCellPosition = {
|
|
|
1227
1394
|
rowId: string;
|
|
1228
1395
|
columnId: string;
|
|
1229
1396
|
};
|
|
1230
|
-
/** Where the focused cell sits in the rows and columns on screen. */
|
|
1231
|
-
type TMDataGridCellCoords = {
|
|
1232
|
-
rowIndex: number;
|
|
1233
|
-
columnIndex: number;
|
|
1234
|
-
};
|
|
1235
|
-
type ResolveCellMoveArgs = {
|
|
1236
|
-
/** `KeyboardEvent.key`. */
|
|
1237
|
-
key: string;
|
|
1238
|
-
/** Ctrl or Cmd - Home and End jump to the corner rather than the row end. */
|
|
1239
|
-
ctrlKey: boolean;
|
|
1240
|
-
from: TMDataGridCellCoords;
|
|
1241
|
-
rowCount: number;
|
|
1242
|
-
columnCount: number;
|
|
1243
|
-
/**
|
|
1244
|
-
* How far PageUp and PageDown travel: one viewport of rows. Passed in rather
|
|
1245
|
-
* than assumed, since only the body knows how tall it is.
|
|
1246
|
-
*/
|
|
1247
|
-
pageRows: number;
|
|
1248
|
-
};
|
|
1249
|
-
/**
|
|
1250
|
-
* The next cell for a navigation key, or `null` when the key is not one.
|
|
1251
|
-
*
|
|
1252
|
-
* Moves clamp at the edges instead of wrapping. Wrapping suits a menu, where
|
|
1253
|
-
* the items are a short ring; a grid is a coordinate space, and a Right at the
|
|
1254
|
-
* last column that lands on the first column of the next row loses the one
|
|
1255
|
-
* thing arrow keys are for - knowing where you will end up without looking.
|
|
1256
|
-
*
|
|
1257
|
-
* A clamped move returns the position it started from rather than `null`. The
|
|
1258
|
-
* caller still needs to know the key was handled: an arrow at the last row must
|
|
1259
|
-
* not fall through to the scroll container, which would scroll the body out
|
|
1260
|
-
* from under a focus that did not move.
|
|
1261
|
-
*/
|
|
1262
|
-
declare function resolveCellMove({ key, ctrlKey, from, rowCount, columnCount, pageRows }: ResolveCellMoveArgs): TMDataGridCellCoords | null;
|
|
1263
|
-
/** Whether two positions address the same cell. `null` equals only `null`. */
|
|
1264
|
-
declare function isSameCell(a: TMDataGridCellPosition | null, b: TMDataGridCellPosition | null): boolean;
|
|
1265
1397
|
//#endregion
|
|
1266
1398
|
//#region .types-tmp/core/cellRange.d.ts
|
|
1267
1399
|
/**
|
|
@@ -1304,200 +1436,396 @@ type ResolveRangeBoundsArgs = {
|
|
|
1304
1436
|
* is cleared.
|
|
1305
1437
|
*/
|
|
1306
1438
|
declare function resolveRangeBounds({ range, rowIndexOf, columnIndexOf }: ResolveRangeBoundsArgs): TMDataGridRangeBounds | null;
|
|
1307
|
-
/** Whether a cell is inside the rectangle. */
|
|
1308
|
-
declare function isWithinBounds(bounds: TMDataGridRangeBounds | null, rowIndex: number, columnIndex: number): boolean;
|
|
1309
|
-
/** How many cells the rectangle covers. `0` for no range at all. */
|
|
1310
|
-
declare function boundsCellCount(bounds: TMDataGridRangeBounds | null): number;
|
|
1311
|
-
/**
|
|
1312
|
-
* Which edges of the rectangle a cell lies on, for the outline.
|
|
1313
|
-
*
|
|
1314
|
-
* The border is drawn per cell rather than as one box over the top, because the
|
|
1315
|
-
* body is a scrolling CSS grid with sticky columns in it: an overlay would have
|
|
1316
|
-
* to be positioned against a moving target and would still be wrong the moment
|
|
1317
|
-
* a pinned lane slid over it. Four booleans per cell need no positioning at all.
|
|
1318
|
-
*/
|
|
1319
|
-
declare function boundsEdges(bounds: TMDataGridRangeBounds | null, rowIndex: number, columnIndex: number): {
|
|
1320
|
-
top: boolean;
|
|
1321
|
-
bottom: boolean;
|
|
1322
|
-
left: boolean;
|
|
1323
|
-
right: boolean;
|
|
1324
|
-
} | null;
|
|
1325
1439
|
//#endregion
|
|
1326
|
-
//#region .types-tmp/
|
|
1440
|
+
//#region .types-tmp/core/export.d.ts
|
|
1441
|
+
type ErasedRow = Row<TMDataGridFeatures, TMDataGridRowData>;
|
|
1442
|
+
type ErasedColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
1327
1443
|
/**
|
|
1328
|
-
*
|
|
1444
|
+
* What an export writes: the exported columns in render order, their labels,
|
|
1445
|
+
* and one array of raw values per row.
|
|
1329
1446
|
*
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1333
|
-
* `type` and `options` are read by both stages, so one declaration of each
|
|
1334
|
-
* feeds the filter panel and the cell editor, which is why they sit outside
|
|
1335
|
-
* both namespaces.
|
|
1447
|
+
* Raw values rather than text, so a format decides how a number, a date or an
|
|
1448
|
+
* array is written - JSON keeps a number a number, and a spreadsheet format
|
|
1449
|
+
* can write a typed cell.
|
|
1336
1450
|
*/
|
|
1337
|
-
type
|
|
1338
|
-
|
|
1339
|
-
label
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
* editor the cell opens. Defaults to `"string"`.
|
|
1343
|
-
*/
|
|
1344
|
-
type?: TMDataGridColumnType;
|
|
1345
|
-
/**
|
|
1346
|
-
* The choices of a `select` / `multiSelect` column - one declaration feeding
|
|
1347
|
-
* the filter panel's value control and the cell editor alike. A static
|
|
1348
|
-
* array, `"faceted"` (the distinct values present in the data), or a
|
|
1349
|
-
* function of the table, column and, for editors, the row. See
|
|
1350
|
-
* {@link TMDataGridOptionsSource}.
|
|
1351
|
-
*/
|
|
1352
|
-
options?: TMDataGridOptionsSource;
|
|
1353
|
-
/** Share of the leftover width this column claims. Defaults to `1`. */
|
|
1354
|
-
flex?: number;
|
|
1355
|
-
align?: "left" | "right" | "center";
|
|
1356
|
-
/**
|
|
1357
|
-
* Size the column to its widest mounted content once, after the first rows
|
|
1358
|
-
* render - unless a persisted or user-set width already covers it. The same
|
|
1359
|
-
* measurement as double-clicking the resize divider; see `autosizeColumn`.
|
|
1360
|
-
*/
|
|
1361
|
-
autoSize?: boolean;
|
|
1362
|
-
/**
|
|
1363
|
-
* `false` keeps the column where it is: no header dragging, no move items.
|
|
1364
|
-
* Column ordering is the one feature TanStack defines no column option for,
|
|
1365
|
-
* so its switch lives here rather than on the column definition.
|
|
1366
|
-
*/
|
|
1367
|
-
enableOrdering?: boolean;
|
|
1368
|
-
/**
|
|
1369
|
-
* How this column filters: the operator a fresh filter starts with, and the
|
|
1370
|
-
* value control the filter panel renders for it.
|
|
1371
|
-
*
|
|
1372
|
-
* ```tsx
|
|
1373
|
-
* meta: {
|
|
1374
|
-
* type: "number",
|
|
1375
|
-
* filter: { defaultOperator: "between", control: DgRangeSliderFilter },
|
|
1376
|
-
* }
|
|
1377
|
-
* ```
|
|
1378
|
-
*
|
|
1379
|
-
* See {@link TMDataGridColumnFilterOptions}.
|
|
1380
|
-
*/
|
|
1381
|
-
filter?: TMDataGridColumnFilterOptions;
|
|
1382
|
-
/**
|
|
1383
|
-
* How this column is edited: whether it takes edits, which field they write
|
|
1384
|
-
* to, which editor opens, what validates the field and what maps the value
|
|
1385
|
-
* on its way in.
|
|
1386
|
-
*
|
|
1387
|
-
* ```tsx
|
|
1388
|
-
* meta: {
|
|
1389
|
-
* type: "string",
|
|
1390
|
-
* edit: { validate: z.string().min(2, "Too short") },
|
|
1391
|
-
* }
|
|
1392
|
-
* ```
|
|
1393
|
-
*
|
|
1394
|
-
* See {@link TMDataGridColumnEditOptions}.
|
|
1395
|
-
*/
|
|
1396
|
-
edit?: TMDataGridColumnEditOptions;
|
|
1451
|
+
type TMDataGridExportData = {
|
|
1452
|
+
columnIds: Array<string>;
|
|
1453
|
+
/** `getColumnLabel` per column: `meta.label`, a string header, or the id. */
|
|
1454
|
+
headers: Array<string>;
|
|
1455
|
+
rows: Array<Array<unknown>>;
|
|
1397
1456
|
};
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1457
|
+
type TMDataGridExportWriteOptions = {
|
|
1458
|
+
/** Whether the format writes the column labels as its first row. */
|
|
1459
|
+
includeHeaders: boolean;
|
|
1460
|
+
};
|
|
1461
|
+
/**
|
|
1462
|
+
* A file format an export can be written in.
|
|
1463
|
+
*
|
|
1464
|
+
* The grid ships `csvExcelFormat`, `csvFormat`, `tsvFormat` and `jsonFormat`;
|
|
1465
|
+
* an addon package or your own code adds one by implementing this shape.
|
|
1466
|
+
* `write` may be async and may answer a `Blob`, which is what a binary format
|
|
1467
|
+
* such as xlsx needs.
|
|
1468
|
+
*/
|
|
1469
|
+
type TMDataGridExportFormat = {
|
|
1470
|
+
/** Identifies the format, for a menu or a test. */
|
|
1471
|
+
id: string;
|
|
1472
|
+
/** File extension without the dot, appended to the file name. */
|
|
1473
|
+
extension: string;
|
|
1474
|
+
/** The `Blob` type the download is served under. */
|
|
1475
|
+
mimeType: string;
|
|
1404
1476
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1477
|
+
* The decimal mark this format writes, when it writes text. Ctrl+C follows
|
|
1478
|
+
* it, so what is copied matches what is exported. Unset means the Nordic
|
|
1479
|
+
* default, a comma.
|
|
1407
1480
|
*/
|
|
1408
|
-
|
|
1481
|
+
decimalComma?: boolean;
|
|
1482
|
+
write: (data: TMDataGridExportData, options: TMDataGridExportWriteOptions) => string | Blob | Promise<string | Blob>;
|
|
1409
1483
|
};
|
|
1410
1484
|
/**
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1485
|
+
* Which columns an export takes: the visible ones, every exportable column
|
|
1486
|
+
* hidden or not, or a list of column ids. The generated lanes and columns
|
|
1487
|
+
* with `meta.enableExport: false` are never taken, whatever is asked for.
|
|
1413
1488
|
*/
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
1426
|
-
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
1427
|
-
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
1428
|
-
rowPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
1429
|
-
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1430
|
-
groupedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1431
|
-
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1432
|
-
expandedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1433
|
-
paginatedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1434
|
-
facetedRowModel: (table: Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
1435
|
-
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
1436
|
-
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
1437
|
-
filterFns: {
|
|
1438
|
-
arrIncludes: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
1439
|
-
autoRemove: (val: any) => boolean;
|
|
1440
|
-
};
|
|
1441
|
-
arrIncludesAll: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
1442
|
-
autoRemove: (val: any) => boolean;
|
|
1443
|
-
};
|
|
1444
|
-
arrHas: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean;
|
|
1445
|
-
arrIncludesSome: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
1446
|
-
autoRemove: (val: any) => boolean;
|
|
1447
|
-
};
|
|
1448
|
-
between: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
1449
|
-
autoRemove: (val: any) => boolean;
|
|
1450
|
-
};
|
|
1451
|
-
betweenInclusive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
1452
|
-
autoRemove: (val: any) => boolean;
|
|
1453
|
-
};
|
|
1454
|
-
equals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1455
|
-
autoRemove: (val: any) => boolean;
|
|
1456
|
-
};
|
|
1457
|
-
equalsString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1458
|
-
autoRemove: (val: any) => boolean;
|
|
1459
|
-
};
|
|
1460
|
-
inNumberRange: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
1461
|
-
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
1462
|
-
autoRemove: (val: any) => boolean;
|
|
1463
|
-
};
|
|
1464
|
-
includesString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1465
|
-
autoRemove: (val: any) => boolean;
|
|
1466
|
-
};
|
|
1467
|
-
includesStringSensitive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1468
|
-
autoRemove: (val: any) => boolean;
|
|
1469
|
-
};
|
|
1470
|
-
weakEquals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1471
|
-
autoRemove: (val: any) => boolean;
|
|
1472
|
-
};
|
|
1473
|
-
tmDataGrid: typeof tmDataGridFilterFn;
|
|
1474
|
-
tmDataGridFuzzy: typeof fuzzyGlobalFilterFn;
|
|
1475
|
-
};
|
|
1476
|
-
sortFns: {
|
|
1477
|
-
alphanumeric: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
|
|
1478
|
-
alphanumericCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
|
|
1479
|
-
basic: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
1480
|
-
datetime: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
1481
|
-
text: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
1482
|
-
textCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
1483
|
-
};
|
|
1484
|
-
aggregationFns: {
|
|
1485
|
-
sum: typeof import("@tanstack/table-core").aggregationFn_sum;
|
|
1486
|
-
min: typeof import("@tanstack/table-core").aggregationFn_min;
|
|
1487
|
-
max: typeof import("@tanstack/table-core").aggregationFn_max;
|
|
1488
|
-
extent: typeof import("@tanstack/table-core").aggregationFn_extent;
|
|
1489
|
-
mean: typeof import("@tanstack/table-core").aggregationFn_mean;
|
|
1490
|
-
median: typeof import("@tanstack/table-core").aggregationFn_median;
|
|
1491
|
-
unique: typeof import("@tanstack/table-core").aggregationFn_unique;
|
|
1492
|
-
uniqueCount: typeof import("@tanstack/table-core").aggregationFn_uniqueCount;
|
|
1493
|
-
count: typeof import("@tanstack/table-core").aggregationFn_count;
|
|
1494
|
-
};
|
|
1495
|
-
tableMeta: TMDataGridTableMeta;
|
|
1496
|
-
columnMeta: TMDataGridColumnMeta;
|
|
1489
|
+
type TMDataGridExportColumns = "visible" | "all" | ReadonlyArray<string>;
|
|
1490
|
+
/** How the grid exports: the format, the file name and whether headers go in. */
|
|
1491
|
+
type TMDataGridExportOptions = {
|
|
1492
|
+
/** Defaults to `csvExcelFormat()`. */
|
|
1493
|
+
format?: TMDataGridExportFormat;
|
|
1494
|
+
/** Without extension. Defaults to `"export"`. */
|
|
1495
|
+
fileName?: string;
|
|
1496
|
+
/** Column labels as the first row. Defaults to `true`. */
|
|
1497
|
+
includeHeaders?: boolean;
|
|
1498
|
+
/** Defaults to `"visible"`. See {@link TMDataGridExportColumns}. */
|
|
1499
|
+
columns?: TMDataGridExportColumns;
|
|
1497
1500
|
};
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
+
/**
|
|
1502
|
+
* What the column picker was opened for: which rows, and the options of the
|
|
1503
|
+
* item that opened it. Held in `ui.state.exportPicker` while it is open.
|
|
1504
|
+
*/
|
|
1505
|
+
type TMDataGridExportPickerRequest = {
|
|
1506
|
+
rows: "all" | "selected";
|
|
1507
|
+
options: TMDataGridExportOptions;
|
|
1508
|
+
};
|
|
1509
|
+
/** `TMDataGridExportOptions` with every default filled in. */
|
|
1510
|
+
type TMDataGridExportSettings = Required<TMDataGridExportOptions>;
|
|
1511
|
+
/**
|
|
1512
|
+
* The value written for a cell, in place of `row.getValue(column.id)`. See
|
|
1513
|
+
* `meta.exportValue`.
|
|
1514
|
+
*/
|
|
1515
|
+
type TMDataGridExportValueGetter = (args: {
|
|
1516
|
+
value: unknown;
|
|
1517
|
+
row: ErasedRow;
|
|
1518
|
+
column: ErasedColumn;
|
|
1519
|
+
}) => unknown;
|
|
1520
|
+
/**
|
|
1521
|
+
* Which rows an export takes: every filtered and sorted row across all pages,
|
|
1522
|
+
* the selected ones among those, or a list of your own.
|
|
1523
|
+
*/
|
|
1524
|
+
type TMDataGridExportRows<TData extends RowData> = "all" | "selected" | ReadonlyArray<Row<TMDataGridFeatures, TData>>;
|
|
1525
|
+
/**
|
|
1526
|
+
* One value as text.
|
|
1527
|
+
*
|
|
1528
|
+
* Deliberately not the rendered cell: what a cell renders is React, and often a
|
|
1529
|
+
* badge, a link or an icon rather than the value. The value is what a
|
|
1530
|
+
* spreadsheet wants, and it is the one thing every column is guaranteed to
|
|
1531
|
+
* have. `meta.exportValue` is where a column substitutes something else.
|
|
1532
|
+
*/
|
|
1533
|
+
declare function formatExportValue(value: unknown, { decimalComma }: {
|
|
1534
|
+
decimalComma: boolean;
|
|
1535
|
+
}): string;
|
|
1536
|
+
/**
|
|
1537
|
+
* Keeps a spreadsheet from running a cell as a formula.
|
|
1538
|
+
*
|
|
1539
|
+
* Excel and Sheets evaluate a cell that starts with `=`, `+`, `-` or `@`, so a
|
|
1540
|
+
* value one user typed into the grid would run in another user's spreadsheet
|
|
1541
|
+
* when the file is opened. The defence is the standard one: a leading
|
|
1542
|
+
* apostrophe, which every spreadsheet reads as "text follows".
|
|
1543
|
+
*
|
|
1544
|
+
* Text that parses as a number is left alone - `-5` and `+4670123456` are
|
|
1545
|
+
* numbers to the spreadsheet too, and an apostrophe would turn them into text.
|
|
1546
|
+
* A phone number written with spaces (`+46 70 123 45 67`) does not parse and
|
|
1547
|
+
* is prefixed; `escapeFormulas: false` on the format is the way out for a grid
|
|
1548
|
+
* whose data is trusted.
|
|
1549
|
+
*/
|
|
1550
|
+
declare function guardFormula(text: string): string;
|
|
1551
|
+
type TMDataGridCsvFormatOptions = {
|
|
1552
|
+
/** Between fields. `csvExcelFormat` defaults to `";"`, `csvFormat` to `","`. */
|
|
1553
|
+
separator?: string;
|
|
1554
|
+
/** Write numbers as `1,5` rather than `1.5`. `csvExcelFormat` defaults to `true`, `csvFormat` to `false`. */
|
|
1555
|
+
decimalComma?: boolean;
|
|
1556
|
+
/** Prefix text that a spreadsheet would run as a formula. Defaults to `true`. See {@link guardFormula}. */
|
|
1557
|
+
escapeFormulas?: boolean;
|
|
1558
|
+
};
|
|
1559
|
+
/**
|
|
1560
|
+
* A CSV that opens straight into columns in Excel.
|
|
1561
|
+
*
|
|
1562
|
+
* Three things make that true, and all three are needed:
|
|
1563
|
+
*
|
|
1564
|
+
* | Part | Why |
|
|
1565
|
+
* | ---- | --- |
|
|
1566
|
+
* | `sep=;` first line | Excel's own directive - it stops guessing and uses this |
|
|
1567
|
+
* | UTF-8 BOM | without it Excel reads the file as ANSI, and å ä ö arrive broken |
|
|
1568
|
+
* | CRLF line endings | what Excel writes, and what its importer is happiest with |
|
|
1569
|
+
*
|
|
1570
|
+
* The defaults are the Nordic ones, because they are the ones that need
|
|
1571
|
+
* choosing: an Excel running a Swedish, Norwegian, Danish or Finnish locale
|
|
1572
|
+
* reads `;` as its list separator and `,` as its decimal mark, and a file
|
|
1573
|
+
* written the other way opens as one column of text.
|
|
1574
|
+
*
|
|
1575
|
+
* The `sep=` line is Excel's alone; Sheets and Numbers show it as a first row.
|
|
1576
|
+
* `csvFormat` is the one for them.
|
|
1577
|
+
*/
|
|
1578
|
+
declare function csvExcelFormat({ separator, decimalComma, escapeFormulas }?: TMDataGridCsvFormatOptions): TMDataGridExportFormat;
|
|
1579
|
+
/**
|
|
1580
|
+
* Plain CSV as RFC 4180 has it: commas, a dot as the decimal mark, CRLF, and a
|
|
1581
|
+
* UTF-8 BOM so that Excel too reads it as UTF-8. No `sep=` line, so Google
|
|
1582
|
+
* Sheets, Numbers and every tool that reads CSV take it as is.
|
|
1583
|
+
*/
|
|
1584
|
+
declare function csvFormat({ separator, decimalComma, escapeFormulas }?: TMDataGridCsvFormatOptions): TMDataGridExportFormat;
|
|
1585
|
+
type TMDataGridTsvFormatOptions = Omit<TMDataGridCsvFormatOptions, "separator">;
|
|
1586
|
+
/**
|
|
1587
|
+
* Tab-separated text, the clipboard shape as a file: tabs between fields, CRLF
|
|
1588
|
+
* between rows, a UTF-8 BOM. Every spreadsheet opens it into columns without
|
|
1589
|
+
* a separator to guess.
|
|
1590
|
+
*/
|
|
1591
|
+
declare function tsvFormat({ decimalComma, escapeFormulas }?: TMDataGridTsvFormatOptions): TMDataGridExportFormat;
|
|
1592
|
+
type TMDataGridJsonFormatOptions = {
|
|
1593
|
+
/** Indentation passed to `JSON.stringify`. Defaults to `2`. */
|
|
1594
|
+
space?: number;
|
|
1595
|
+
};
|
|
1596
|
+
/**
|
|
1597
|
+
* An array with one object per row, keyed by the column labels, values as the
|
|
1598
|
+
* data holds them. Two columns with the same label collapse into one key, the
|
|
1599
|
+
* later column winning. `includeHeaders` has no meaning here and is ignored.
|
|
1600
|
+
*/
|
|
1601
|
+
declare function jsonFormat({ space }?: TMDataGridJsonFormatOptions): TMDataGridExportFormat;
|
|
1602
|
+
declare const DEFAULT_EXPORT_OPTIONS: TMDataGridExportSettings;
|
|
1603
|
+
/**
|
|
1604
|
+
* The defaults with each override folded over them in turn. Field by field,
|
|
1605
|
+
* so an override that spells a field as `undefined` leaves the earlier value
|
|
1606
|
+
* rather than blanking it.
|
|
1607
|
+
*/
|
|
1608
|
+
declare function resolveExportOptions(...overrides: Array<TMDataGridExportOptions | undefined>): TMDataGridExportSettings;
|
|
1609
|
+
/**
|
|
1610
|
+
* Every column an export could take, in render order: the data columns minus
|
|
1611
|
+
* the generated lanes and `meta.enableExport: false`, hidden ones included.
|
|
1612
|
+
* What the column picker lists; `column.getIsVisible()` says which of them a
|
|
1613
|
+
* `"visible"` export would take.
|
|
1614
|
+
*/
|
|
1615
|
+
declare function getExportableColumns<TData extends RowData>(table: TMDataGridTable<TData>): Array<Column<TMDataGridFeatures, TData, unknown>>;
|
|
1616
|
+
/**
|
|
1617
|
+
* How many rows `rows: "selected"` would export: the ticked rows of the
|
|
1618
|
+
* current view. Not the size of the selection map, which keeps rows the
|
|
1619
|
+
* filters have since hidden. Free while nothing is selected.
|
|
1620
|
+
*/
|
|
1621
|
+
declare function countSelectedExportRows<TData extends RowData>(table: TMDataGridTable<TData>): number;
|
|
1622
|
+
type BuildExportDataArgs<TData extends RowData> = {
|
|
1623
|
+
table: TMDataGridTable<TData>;
|
|
1624
|
+
/** Defaults to `"all"`. */
|
|
1625
|
+
rows?: TMDataGridExportRows<TData>;
|
|
1626
|
+
/** Defaults to `"visible"`. Ignored under `bounds`. */
|
|
1627
|
+
columns?: TMDataGridExportColumns;
|
|
1628
|
+
/**
|
|
1629
|
+
* A rectangle over `rows` and the visible columns, both by index - the
|
|
1630
|
+
* cell-range path. `rows` is then the list the indices refer to, usually
|
|
1631
|
+
* the displayed rows.
|
|
1632
|
+
*/
|
|
1633
|
+
bounds?: TMDataGridRangeBounds;
|
|
1634
|
+
};
|
|
1635
|
+
/**
|
|
1636
|
+
* What an export writes, before any format touches it.
|
|
1637
|
+
*
|
|
1638
|
+
* Columns are `"visible"` (the data columns on screen, in render order),
|
|
1639
|
+
* `"all"` (every exportable column, hidden or not) or a list of ids; the
|
|
1640
|
+
* generated lanes and any column with `meta.enableExport: false` are left out
|
|
1641
|
+
* whichever is asked for. Rows are `"all"` (every filtered and sorted row
|
|
1642
|
+
* across every page, group rows flattened to their records), `"selected"`
|
|
1643
|
+
* (those of them the user has ticked, in the same order - the selection map
|
|
1644
|
+
* is walked through the row list rather than the other way round, because
|
|
1645
|
+
* TanStack's selected row models ignore filtering and sorting), or a list of
|
|
1646
|
+
* your own.
|
|
1647
|
+
*/
|
|
1648
|
+
declare function buildExportData<TData extends RowData>({ table, rows, columns: which, bounds }: BuildExportDataArgs<TData>): TMDataGridExportData;
|
|
1649
|
+
/**
|
|
1650
|
+
* Writes `data` in the format and downloads it. Awaits the format, since a
|
|
1651
|
+
* binary format builds its file asynchronously.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function writeExportFile(data: TMDataGridExportData, { format, fileName, includeHeaders }: TMDataGridExportSettings): Promise<void>;
|
|
1654
|
+
type ExportGridArgs<TData extends RowData> = {
|
|
1655
|
+
table: TMDataGridTable<TData>;
|
|
1656
|
+
/** Defaults to `"all"`. See {@link TMDataGridExportRows}. */
|
|
1657
|
+
rows?: TMDataGridExportRows<TData>;
|
|
1658
|
+
/** Merged over `DEFAULT_EXPORT_OPTIONS`. */
|
|
1659
|
+
options?: TMDataGridExportOptions;
|
|
1660
|
+
};
|
|
1661
|
+
/**
|
|
1662
|
+
* Downloads the grid as a file: {@link buildExportData} through the format's
|
|
1663
|
+
* `write` and a download.
|
|
1664
|
+
*
|
|
1665
|
+
* Inside the grid, `useTMDataGridExport` and the `TMDataGrid.Menu.Export*`
|
|
1666
|
+
* items call this with the grid's own `exportOptions`; this is the entry point
|
|
1667
|
+
* for code that holds the table and nothing else.
|
|
1668
|
+
*
|
|
1669
|
+
* Nothing is downloaded when no column is exportable. A grid with no rows
|
|
1670
|
+
* still downloads its header row, since an empty file is the honest answer to
|
|
1671
|
+
* an empty view.
|
|
1672
|
+
*
|
|
1673
|
+
* Async because a format may be. Safari refuses a download that starts after
|
|
1674
|
+
* the click gesture has ended, which a format that takes long enough to build
|
|
1675
|
+
* can run into; the text formats resolve synchronously and never do.
|
|
1676
|
+
*/
|
|
1677
|
+
declare function exportGrid<TData extends RowData>({ table, rows, options }: ExportGridArgs<TData>): Promise<void>;
|
|
1678
|
+
type TMDataGridClipboardTextOptions = {
|
|
1679
|
+
/** Defaults to `true`, the Nordic mark. */
|
|
1680
|
+
decimalComma?: boolean;
|
|
1681
|
+
/** Defaults to `true`. See {@link guardFormula}. */
|
|
1682
|
+
escapeFormulas?: boolean;
|
|
1683
|
+
};
|
|
1684
|
+
/**
|
|
1685
|
+
* The clipboard format spreadsheets read: tab between cells, CRLF between rows,
|
|
1686
|
+
* values only.
|
|
1687
|
+
*
|
|
1688
|
+
* Tabs rather than commas because that is what Excel, Sheets and Numbers all
|
|
1689
|
+
* put on the clipboard themselves - paste it and the cells land in cells. A
|
|
1690
|
+
* comma-separated string pastes into a single column, which is the thing this
|
|
1691
|
+
* exists to avoid. No header row: Excel's own copy carries none either, and a
|
|
1692
|
+
* header pasted into the middle of a sheet is a row of text where numbers
|
|
1693
|
+
* were expected.
|
|
1694
|
+
*
|
|
1695
|
+
* Also accepts an already-formatted string matrix, written as is.
|
|
1696
|
+
*/
|
|
1697
|
+
declare function toClipboardText(data: TMDataGridExportData | Array<Array<string>>, { decimalComma, escapeFormulas }?: TMDataGridClipboardTextOptions): string;
|
|
1698
|
+
/**
|
|
1699
|
+
* Puts text on the clipboard, reporting whether it landed.
|
|
1700
|
+
*
|
|
1701
|
+
* The async clipboard API only resolves for a document that has the focus and a
|
|
1702
|
+
* user gesture behind it - both true when this runs off Ctrl+C or a menu item.
|
|
1703
|
+
* It is still allowed to reject (a permissions policy, a page that lost focus
|
|
1704
|
+
* mid-copy), so the result is a boolean the caller can act on.
|
|
1705
|
+
*/
|
|
1706
|
+
declare function writeClipboardText(text: string): Promise<boolean>;
|
|
1707
|
+
/**
|
|
1708
|
+
* Downloads a file, through the one mechanism a library can use: an anchor
|
|
1709
|
+
* with an object URL behind it, clicked. Revoked on the next frame -
|
|
1710
|
+
* immediately would race the browser's own read of it.
|
|
1711
|
+
*/
|
|
1712
|
+
declare function downloadFile({ fileName, content, mimeType }: {
|
|
1713
|
+
fileName: string;
|
|
1714
|
+
content: string | Blob;
|
|
1715
|
+
mimeType: string;
|
|
1716
|
+
}): void;
|
|
1717
|
+
//#endregion
|
|
1718
|
+
//#region .types-tmp/useTMDataGrid.d.ts
|
|
1719
|
+
/**
|
|
1720
|
+
* Per-column configuration the grid's own components read.
|
|
1721
|
+
*
|
|
1722
|
+
* The filter and edit stages each get a namespace, `filter` and `edit`,
|
|
1723
|
+
* mirroring the feature's runtime API. What the column *is* stays flat:
|
|
1724
|
+
* `label`, `type`, `options`, `align`, `flex`, `autoSize`, `enableOrdering`.
|
|
1725
|
+
* `type` and `options` are read by both stages, so one declaration of each
|
|
1726
|
+
* feeds the filter panel and the cell editor, which is why they sit outside
|
|
1727
|
+
* both namespaces.
|
|
1728
|
+
*
|
|
1729
|
+
* `TData` types the row that `options` and `edit.enabled` callbacks receive.
|
|
1730
|
+
* `createTMDataGridColumnHelper<TData>()` fills it in.
|
|
1731
|
+
*/
|
|
1732
|
+
type TMDataGridColumnMeta<TData extends RowData = TMDataGridRowData> = {
|
|
1733
|
+
/** Name shown in menus and the column manager. Falls back to a string header. */
|
|
1734
|
+
label?: string;
|
|
1735
|
+
/**
|
|
1736
|
+
* Drives which filter operators are offered and, once editing is on, which
|
|
1737
|
+
* editor the cell opens. Defaults to `"string"`.
|
|
1738
|
+
*/
|
|
1739
|
+
type?: TMDataGridColumnType;
|
|
1740
|
+
/**
|
|
1741
|
+
* The choices of a `select` / `multiSelect` column - one declaration feeding
|
|
1742
|
+
* the filter panel's value control and the cell editor alike. A static
|
|
1743
|
+
* array, `"faceted"` (the distinct values present in the data), or a
|
|
1744
|
+
* function of the table, column and, for editors, the row. See
|
|
1745
|
+
* {@link TMDataGridOptionsSource}.
|
|
1746
|
+
*/
|
|
1747
|
+
options?: TMDataGridOptionsSource<TData>;
|
|
1748
|
+
/** Share of the leftover width this column claims. Defaults to `1`. */
|
|
1749
|
+
flex?: number;
|
|
1750
|
+
align?: "left" | "right" | "center";
|
|
1751
|
+
/**
|
|
1752
|
+
* Size the column to its widest mounted content once, after the first rows
|
|
1753
|
+
* render - unless a persisted or user-set width already covers it. The same
|
|
1754
|
+
* measurement as double-clicking the resize divider; see `autosizeColumn`.
|
|
1755
|
+
*/
|
|
1756
|
+
autoSize?: boolean;
|
|
1757
|
+
/**
|
|
1758
|
+
* `false` keeps the column where it is: no header dragging, no move items.
|
|
1759
|
+
* Column ordering is the one feature TanStack defines no column option for,
|
|
1760
|
+
* so its switch lives here rather than on the column definition.
|
|
1761
|
+
*/
|
|
1762
|
+
enableOrdering?: boolean;
|
|
1763
|
+
/**
|
|
1764
|
+
* How this column filters: which operators it offers, the operator a fresh
|
|
1765
|
+
* filter starts with, and the value control the filter panel renders for it.
|
|
1766
|
+
*
|
|
1767
|
+
* ```tsx
|
|
1768
|
+
* meta: {
|
|
1769
|
+
* type: "number",
|
|
1770
|
+
* filter: { defaultOperator: "between", control: DgRangeSliderFilter },
|
|
1771
|
+
* }
|
|
1772
|
+
* ```
|
|
1773
|
+
*
|
|
1774
|
+
* See {@link TMDataGridColumnFilterOptions}.
|
|
1775
|
+
*/
|
|
1776
|
+
filter?: TMDataGridColumnFilterOptions;
|
|
1777
|
+
/**
|
|
1778
|
+
* How this column is edited: whether it takes edits, which field they write
|
|
1779
|
+
* to, which editor opens, what validates the field and what maps the value
|
|
1780
|
+
* on its way in.
|
|
1781
|
+
*
|
|
1782
|
+
* ```tsx
|
|
1783
|
+
* meta: {
|
|
1784
|
+
* type: "string",
|
|
1785
|
+
* edit: { validate: z.string().min(2, "Too short") },
|
|
1786
|
+
* }
|
|
1787
|
+
* ```
|
|
1788
|
+
*
|
|
1789
|
+
* See {@link TMDataGridColumnEditOptions}.
|
|
1790
|
+
*/
|
|
1791
|
+
edit?: TMDataGridColumnEditOptions<TData>;
|
|
1792
|
+
/**
|
|
1793
|
+
* `false` leaves the column out of every export and out of Ctrl+C - for a
|
|
1794
|
+
* column of buttons, or one whose value means nothing outside the grid.
|
|
1795
|
+
* Defaults to `true`.
|
|
1796
|
+
*/
|
|
1797
|
+
enableExport?: boolean;
|
|
1798
|
+
/**
|
|
1799
|
+
* The value an export writes for this column, in place of
|
|
1800
|
+
* `row.getValue(column.id)`. The export otherwise writes the value, never
|
|
1801
|
+
* what the cell renders, so this is where a status code becomes its label
|
|
1802
|
+
* or a nested object becomes one field.
|
|
1803
|
+
*
|
|
1804
|
+
* ```tsx
|
|
1805
|
+
* meta: {
|
|
1806
|
+
* exportValue: ({ value }) => STATUS_LABELS[value as Status],
|
|
1807
|
+
* }
|
|
1808
|
+
* ```
|
|
1809
|
+
*/
|
|
1810
|
+
exportValue?: TMDataGridExportValueGetter;
|
|
1811
|
+
};
|
|
1812
|
+
/** Grid-wide configuration passed through `options.meta`. */
|
|
1813
|
+
type TMDataGridTableMeta = {
|
|
1814
|
+
loading?: boolean;
|
|
1815
|
+
noResultsLabel?: string;
|
|
1816
|
+
/** Row height used by the virtualizer. Defaults to `52`. */
|
|
1817
|
+
rowHeight?: number;
|
|
1818
|
+
/**
|
|
1819
|
+
* Unfiltered row total. Only needed for server-driven grids, where the client
|
|
1820
|
+
* never holds the full data set - `TMDataGrid.SummaryCount` uses it as denominator.
|
|
1821
|
+
*/
|
|
1822
|
+
totalRowCount?: number;
|
|
1823
|
+
};
|
|
1824
|
+
/**
|
|
1825
|
+
* Every feature the TMDataGrid chrome can drive. Defined at module scope so the
|
|
1826
|
+
* reference stays stable across renders (see the TanStack table-state skill).
|
|
1827
|
+
*/
|
|
1828
|
+
declare const tmDataGridFeatures: {
|
|
1501
1829
|
columnFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
1502
1830
|
globalFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
1503
1831
|
rowSortingFeature: import("@tanstack/table-core").TableFeature;
|
|
@@ -1510,6 +1838,7 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): import("
|
|
|
1510
1838
|
columnResizingFeature: import("@tanstack/table-core").TableFeature;
|
|
1511
1839
|
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
1512
1840
|
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
1841
|
+
rowAggregationFeature: import("@tanstack/table-core").TableFeature;
|
|
1513
1842
|
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
1514
1843
|
rowPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
1515
1844
|
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
@@ -1521,66 +1850,69 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): import("
|
|
|
1521
1850
|
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
1522
1851
|
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
1523
1852
|
filterFns: {
|
|
1524
|
-
arrIncludes:
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
};
|
|
1543
|
-
equalsString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1544
|
-
autoRemove: (val: any) => boolean;
|
|
1545
|
-
};
|
|
1546
|
-
inNumberRange: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: Row<TFeatures, TData_1>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
1547
|
-
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
1548
|
-
autoRemove: (val: any) => boolean;
|
|
1549
|
-
};
|
|
1550
|
-
includesString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1551
|
-
autoRemove: (val: any) => boolean;
|
|
1552
|
-
};
|
|
1553
|
-
includesStringSensitive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1554
|
-
autoRemove: (val: any) => boolean;
|
|
1555
|
-
};
|
|
1556
|
-
weakEquals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
1557
|
-
autoRemove: (val: any) => boolean;
|
|
1558
|
-
};
|
|
1853
|
+
arrIncludes: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1854
|
+
arrIncludesAll: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1855
|
+
arrHas: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1856
|
+
arrIncludesSome: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1857
|
+
between: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1858
|
+
betweenInclusive: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1859
|
+
empty: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1860
|
+
endsWith: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1861
|
+
equals: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1862
|
+
equalsString: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1863
|
+
equalsStringSensitive: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1864
|
+
inDateRange: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1865
|
+
inNumberRange: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1866
|
+
includesString: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1867
|
+
includesStringSensitive: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1868
|
+
notEmpty: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1869
|
+
startsWith: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1870
|
+
weakEquals: import("@tanstack/table-core").CreatedFilterFn<any, any>;
|
|
1559
1871
|
tmDataGrid: typeof tmDataGridFilterFn;
|
|
1560
1872
|
tmDataGridFuzzy: typeof fuzzyGlobalFilterFn;
|
|
1561
1873
|
};
|
|
1562
1874
|
sortFns: {
|
|
1563
|
-
alphanumeric:
|
|
1564
|
-
alphanumericCaseSensitive:
|
|
1565
|
-
basic:
|
|
1566
|
-
datetime:
|
|
1567
|
-
text:
|
|
1568
|
-
textCaseSensitive:
|
|
1875
|
+
alphanumeric: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1876
|
+
alphanumericCaseSensitive: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1877
|
+
basic: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1878
|
+
datetime: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1879
|
+
text: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1880
|
+
textCaseSensitive: import("@tanstack/table-core").CreatedSortFn<any, any>;
|
|
1569
1881
|
};
|
|
1570
1882
|
aggregationFns: {
|
|
1571
|
-
sum:
|
|
1572
|
-
min:
|
|
1573
|
-
max:
|
|
1574
|
-
extent:
|
|
1575
|
-
mean:
|
|
1576
|
-
median:
|
|
1577
|
-
unique:
|
|
1578
|
-
uniqueCount:
|
|
1579
|
-
count:
|
|
1883
|
+
sum: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, number>;
|
|
1884
|
+
min: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, (number | Date) | undefined>;
|
|
1885
|
+
max: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, (number | Date) | undefined>;
|
|
1886
|
+
extent: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, [(number | Date) | undefined, (number | Date) | undefined]>;
|
|
1887
|
+
mean: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, number | undefined>;
|
|
1888
|
+
median: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, number | undefined>;
|
|
1889
|
+
unique: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, unknown[]>;
|
|
1890
|
+
uniqueCount: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, number>;
|
|
1891
|
+
count: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, number>;
|
|
1892
|
+
first: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, unknown>;
|
|
1893
|
+
last: import("@tanstack/table-core").AggregationFnDef<any, any, unknown, unknown>;
|
|
1580
1894
|
};
|
|
1581
1895
|
tableMeta: TMDataGridTableMeta;
|
|
1582
|
-
columnMeta: TMDataGridColumnMeta
|
|
1583
|
-
}
|
|
1896
|
+
columnMeta: TMDataGridColumnMeta<TMDataGridRowData>;
|
|
1897
|
+
};
|
|
1898
|
+
type TMDataGridFeatures = typeof tmDataGridFeatures;
|
|
1899
|
+
type TMDataGridTable<TData extends RowData> = Table<TMDataGridFeatures, TData>;
|
|
1900
|
+
/** A column definition with `meta` typed against the row type. */
|
|
1901
|
+
type WithRowTypedMeta<TDef, TData extends RowData> = TDef extends unknown ? Omit<TDef, "meta"> & {
|
|
1902
|
+
meta?: TMDataGridColumnMeta<TData>;
|
|
1903
|
+
} : never;
|
|
1904
|
+
/**
|
|
1905
|
+
* TanStack's column helper with `meta` typed against `TData`, so the
|
|
1906
|
+
* `meta.options` and `meta.edit.enabled` callbacks receive
|
|
1907
|
+
* `Row<TMDataGridFeatures, TData>`.
|
|
1908
|
+
*/
|
|
1909
|
+
type TMDataGridColumnHelper<TData extends RowData> = {
|
|
1910
|
+
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>;
|
|
1911
|
+
columns: ColumnHelper<TMDataGridFeatures, TData>["columns"];
|
|
1912
|
+
display: (column: WithRowTypedMeta<DisplayColumnDef<TMDataGridFeatures, TData>, TData>) => DisplayColumnDef<TMDataGridFeatures, TData, unknown>;
|
|
1913
|
+
group: (column: WithRowTypedMeta<GroupColumnDef<TMDataGridFeatures, TData, unknown>, TData>) => GroupColumnDef<TMDataGridFeatures, TData, unknown>;
|
|
1914
|
+
};
|
|
1915
|
+
declare function createTMDataGridColumnHelper<TData extends RowData>(): TMDataGridColumnHelper<TData>;
|
|
1584
1916
|
/** What the `renderDetails` render prop is handed for an expanded row. */
|
|
1585
1917
|
type TMDataGridDetailsArgs<TData extends RowData> = {
|
|
1586
1918
|
row: Row<TMDataGridFeatures, TData>;
|
|
@@ -1595,9 +1927,20 @@ type TMDataGridDetailsRenderer<TData extends RowData> = (args: TMDataGridDetails
|
|
|
1595
1927
|
*/
|
|
1596
1928
|
type TMDataGridUiState = {
|
|
1597
1929
|
filterPanelOpen: boolean;
|
|
1598
|
-
|
|
1599
|
-
|
|
1930
|
+
/**
|
|
1931
|
+
* Column whose *panel* row should take the focus. Cleared once the row has
|
|
1932
|
+
* taken it, so pointing at the same column twice focuses twice.
|
|
1933
|
+
*/
|
|
1600
1934
|
filterPanelColumnId: string | null;
|
|
1935
|
+
/**
|
|
1936
|
+
* Column whose *header filter* control should take the focus, under
|
|
1937
|
+
* `filters.inHeader`. Cleared once taken, like the one above.
|
|
1938
|
+
*
|
|
1939
|
+
* Its own slot rather than a second reader of `filterPanelColumnId`: a grid
|
|
1940
|
+
* can have header filters and a panel at once, and two controls racing to
|
|
1941
|
+
* answer one id means whichever mounted last wins the caret.
|
|
1942
|
+
*/
|
|
1943
|
+
headerFilterColumnId: string | null;
|
|
1601
1944
|
/**
|
|
1602
1945
|
* Column being dragged by its header, if any. Held here rather than read from
|
|
1603
1946
|
* `dataTransfer`, which browsers keep unreadable until the drop.
|
|
@@ -1636,12 +1979,32 @@ type TMDataGridUiState = {
|
|
|
1636
1979
|
* describe different places.
|
|
1637
1980
|
*/
|
|
1638
1981
|
cellRange: TMDataGridCellRange | null;
|
|
1982
|
+
/**
|
|
1983
|
+
* The export column picker, while it is open: which rows it exports and the
|
|
1984
|
+
* options of the item that opened it. `null` while closed. Held here rather
|
|
1985
|
+
* than in the menu item, which unmounts with the dropdown the moment it is
|
|
1986
|
+
* clicked.
|
|
1987
|
+
*/
|
|
1988
|
+
exportPicker: TMDataGridExportPickerRequest | null;
|
|
1639
1989
|
};
|
|
1640
1990
|
type TMDataGridUiActions = {
|
|
1641
1991
|
openFilterPanel: (columnId?: string | null) => void;
|
|
1642
1992
|
closeFilterPanel: () => void;
|
|
1643
|
-
|
|
1644
|
-
|
|
1993
|
+
/** Opens the export column picker for `request`. See `TMDataGrid.Menu.Export`'s `columns="custom"`. */
|
|
1994
|
+
openExportPicker: (request: TMDataGridExportPickerRequest) => void;
|
|
1995
|
+
closeExportPicker: () => void;
|
|
1996
|
+
/**
|
|
1997
|
+
* Points at a column's row in the filter panel without opening anything.
|
|
1998
|
+
* `openFilterPanel` does this as well as opening; this is the half a panel
|
|
1999
|
+
* that is already showing needs.
|
|
2000
|
+
*/
|
|
2001
|
+
focusPanelFilter: (columnId: string | null) => void;
|
|
2002
|
+
/**
|
|
2003
|
+
* Points at a column's header filter control - what `openColumnFilter` does
|
|
2004
|
+
* under `filters.inHeader`, where there is no panel to open. The header row
|
|
2005
|
+
* scrolls the column into view and focuses it.
|
|
2006
|
+
*/
|
|
2007
|
+
focusHeaderFilter: (columnId: string | null) => void;
|
|
1645
2008
|
startColumnDrag: (columnId: string) => void;
|
|
1646
2009
|
endColumnDrag: () => void;
|
|
1647
2010
|
/**
|
|
@@ -1681,13 +2044,28 @@ type TMDataGridApi<TData extends RowData> = {
|
|
|
1681
2044
|
ui: TMDataGridUiStore;
|
|
1682
2045
|
/**
|
|
1683
2046
|
* The edit engine - open forms, dirty/error projections, and the verbs
|
|
1684
|
-
* (`begin`, `commit`, `cancel`, `
|
|
1685
|
-
* out the same TanStack Form the inline editors write through
|
|
1686
|
-
* or detail panel can share a row's draft
|
|
2047
|
+
* (`begin`, `commit`, `cancel`, `saveDrafts`). `edit.getForm(rowId)` hands
|
|
2048
|
+
* out the same TanStack Form the inline editors write through while a row
|
|
2049
|
+
* is open, so a drawer or detail panel can share a row's draft; a
|
|
2050
|
+
* committed row has no form until `begin` reopens it. Inert until
|
|
2051
|
+
* `editing` is set.
|
|
1687
2052
|
*/
|
|
1688
2053
|
edit: TMDataGridEditApi<TData>;
|
|
1689
2054
|
/** Table-level feature switches, re-read from options on every render. */
|
|
1690
2055
|
features: TMDataGridFeatureFlags;
|
|
2056
|
+
/**
|
|
2057
|
+
* Where the filter controls live, the `filters` option with its defaults
|
|
2058
|
+
* filled in. On the api rather than in a component's props because the
|
|
2059
|
+
* pills, the column menu and `openColumnFilter` all have to agree with the
|
|
2060
|
+
* table about which surface is on.
|
|
2061
|
+
*/
|
|
2062
|
+
filters: TMDataGridFiltersSettings;
|
|
2063
|
+
/**
|
|
2064
|
+
* How the grid exports, the `exportOptions` option with its defaults filled
|
|
2065
|
+
* in. Read by `useTMDataGridExport`, the `TMDataGrid.Menu.Export*` items and
|
|
2066
|
+
* the cell-range menu, so every export of the grid agrees on the format.
|
|
2067
|
+
*/
|
|
2068
|
+
exportOptions: TMDataGridExportSettings;
|
|
1691
2069
|
/** Every string the chrome renders, `labels` merged over the English defaults. */
|
|
1692
2070
|
labels: TMDataGridLabels;
|
|
1693
2071
|
/** The detail renderer, when row details are on. See `renderDetails`. */
|
|
@@ -1872,15 +2250,9 @@ type TMDataGridEditingOptions<TData extends RowData> = TMDataGridEditingCallback
|
|
|
1872
2250
|
*
|
|
1873
2251
|
* Rows still open are not in the payload and stay open. Returning
|
|
1874
2252
|
* nothing saves the whole store and throwing saves none of it;
|
|
1875
|
-
* return a {@link
|
|
1876
|
-
*/
|
|
1877
|
-
onSaveDrafts?: (args: TMDataGridSaveDraftsArgs<TData>) => void | TMDataGridSaveDraftsResult | Promise<void | TMDataGridSaveDraftsResult>;
|
|
1878
|
-
/**
|
|
1879
|
-
* @deprecated Renamed to {@link onSaveDrafts} - it fires when the
|
|
1880
|
-
* draft store is saved, not when a row commits into it. Still
|
|
1881
|
-
* honoured; removed in a later beta.
|
|
2253
|
+
* return a {@link TMDataGridSaveDraftsResponse} to save part of it.
|
|
1882
2254
|
*/
|
|
1883
|
-
|
|
2255
|
+
onSaveDrafts?: (args: TMDataGridSaveDraftsArgs<TData>) => void | TMDataGridSaveDraftsResponse | Promise<void | TMDataGridSaveDraftsResponse>;
|
|
1884
2256
|
/**
|
|
1885
2257
|
* Keep committed entry rows pinned in the sticky entry block until
|
|
1886
2258
|
* the draft store is saved, out of the body's sort. Off by default:
|
|
@@ -1895,8 +2267,6 @@ type TMDataGridEditingOptions<TData extends RowData> = TMDataGridEditingCallback
|
|
|
1895
2267
|
draft?: false;
|
|
1896
2268
|
/** Only `draft: true` has a store to save - see the other branch. */
|
|
1897
2269
|
onSaveDrafts?: never;
|
|
1898
|
-
/** @deprecated See {@link onSaveDrafts}. */
|
|
1899
|
-
onCommitDrafts?: never;
|
|
1900
2270
|
/** Parked entry rows exist only under `draft: true` - see there. */
|
|
1901
2271
|
newRowsSticky?: never;
|
|
1902
2272
|
});
|
|
@@ -1953,12 +2323,55 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
1953
2323
|
* no extra flag.
|
|
1954
2324
|
*/
|
|
1955
2325
|
enablePagination?: boolean;
|
|
2326
|
+
/**
|
|
2327
|
+
* Sends the grid back to the first page whenever the query changes - a
|
|
2328
|
+
* column filter, the quick search, the sort or the grouping. On by
|
|
2329
|
+
* default. TanStack's own `autoResetPageIndex` is switched off by the
|
|
2330
|
+
* grid: it fires on any change to the `data` array, which under
|
|
2331
|
+
* `editing.draft` is every commit.
|
|
2332
|
+
*
|
|
2333
|
+
* Server-side, `pageIndex` is a position in a result set the grid does not
|
|
2334
|
+
* own: narrowing the query leaves it pointing past the last page, and the
|
|
2335
|
+
* next request comes back empty. The reset is applied in the same event as
|
|
2336
|
+
* the change, so one request goes out, for the first page of the new query.
|
|
2337
|
+
*/
|
|
2338
|
+
resetPageOnQueryChange?: boolean;
|
|
1956
2339
|
/**
|
|
1957
2340
|
* The row-number gutter: a generated lane, outermost left, numbering the
|
|
1958
2341
|
* rows of the current view - sorted, filtered, continuing across pages,
|
|
1959
2342
|
* with group rows unnumbered. Off by default.
|
|
1960
2343
|
*/
|
|
1961
2344
|
enableRowNumbers?: boolean;
|
|
2345
|
+
/**
|
|
2346
|
+
* Where the grid puts its filter controls - a popup over the rows, a sidebar
|
|
2347
|
+
* beside them, controls in the header row, or nowhere at all so you place
|
|
2348
|
+
* `TMDataGrid.FilterPanel` yourself.
|
|
2349
|
+
*
|
|
2350
|
+
* ```tsx
|
|
2351
|
+
* useTMDataGrid({ data, columns, filters: { surface: "sidebar", inHeader: true } });
|
|
2352
|
+
* ```
|
|
2353
|
+
*
|
|
2354
|
+
* Defaults to `{ surface: "popup" }` - the floating panel the grid has
|
|
2355
|
+
* always shown. See {@link TMDataGridFiltersOptions}.
|
|
2356
|
+
*
|
|
2357
|
+
* Read field by field, so a literal is fine here - unlike `labels` or
|
|
2358
|
+
* `persist`, this one does not have to be referentially stable.
|
|
2359
|
+
*/
|
|
2360
|
+
filters?: TMDataGridFiltersOptions;
|
|
2361
|
+
/**
|
|
2362
|
+
* How the grid exports: the file format, the file name and whether the
|
|
2363
|
+
* column labels go in as the first row. Defaults to `csvExcelFormat()`,
|
|
2364
|
+
* `"export"` and `true`. See {@link TMDataGridExportOptions}.
|
|
2365
|
+
*
|
|
2366
|
+
* ```tsx
|
|
2367
|
+
* useTMDataGrid({ data, columns, exportOptions: { format: csvFormat(), fileName: "employees" } });
|
|
2368
|
+
* ```
|
|
2369
|
+
*
|
|
2370
|
+
* Read field by field like `filters`, so a literal is fine. A `format`
|
|
2371
|
+
* built inline is rebuilt every render, which costs nothing but a small
|
|
2372
|
+
* object; keep it at module scope when that bothers you.
|
|
2373
|
+
*/
|
|
2374
|
+
exportOptions?: TMDataGridExportOptions;
|
|
1962
2375
|
/**
|
|
1963
2376
|
* How the quick search (`TMDataGrid.Search`) matches. `"fuzzy"` - the
|
|
1964
2377
|
* default - forgives typos and skipped characters, and while it is the
|
|
@@ -2147,22 +2560,273 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
2147
2560
|
overscan?: number;
|
|
2148
2561
|
};
|
|
2149
2562
|
/**
|
|
2150
|
-
* Builds a TMDataGrid table plus its chrome store.
|
|
2151
|
-
*
|
|
2152
|
-
* Every `TableOptions` field passes straight through, so a server-driven grid
|
|
2153
|
-
* only needs `manualPagination` / `manualFiltering` / `manualSorting`,
|
|
2154
|
-
* `rowCount` and the matching `onXChange` callbacks - the chrome reads
|
|
2155
|
-
* `getRowCount()` / `getPageCount()` / `getPaginatedRowModel()`, all of which
|
|
2156
|
-
* already respect manual mode. `manualPagination` also switches the pagination
|
|
2157
|
-
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
2158
|
-
* options.
|
|
2563
|
+
* Builds a TMDataGrid table plus its chrome store.
|
|
2564
|
+
*
|
|
2565
|
+
* Every `TableOptions` field passes straight through, so a server-driven grid
|
|
2566
|
+
* only needs `manualPagination` / `manualFiltering` / `manualSorting`,
|
|
2567
|
+
* `rowCount` and the matching `onXChange` callbacks - the chrome reads
|
|
2568
|
+
* `getRowCount()` / `getPageCount()` / `getPaginatedRowModel()`, all of which
|
|
2569
|
+
* already respect manual mode. `manualPagination` also switches the pagination
|
|
2570
|
+
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
2571
|
+
* options.
|
|
2572
|
+
*/
|
|
2573
|
+
declare function useTMDataGrid<TData extends RowData>({ persist, labels: labelsOverride, enableColumnOrdering, enablePagination, resetPageOnQueryChange, enableRowNumbers, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, cellSelection, onFocusedCellChange, filters: filterOptions, exportOptions: exportOptionsOverride, editing, renderDetails, renderDetailsEstHeight, overscan, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
2574
|
+
/**
|
|
2575
|
+
* Sends the user to a column's filter control, seeding an empty filter when
|
|
2576
|
+
* the column has none yet - what "Filter" in the column menu and a click on a
|
|
2577
|
+
* filter pill both do.
|
|
2578
|
+
*
|
|
2579
|
+
* Which control that is follows the grid's `filters` option. Under
|
|
2580
|
+
* `inHeader` it is the column's header control, which is already on screen, so
|
|
2581
|
+
* the call focuses it and leaves the popup or sidebar closed. Otherwise it is
|
|
2582
|
+
* the panel's row for that column, and the call opens the surface on it.
|
|
2583
|
+
*/
|
|
2584
|
+
declare function openColumnFilter<TData extends RowData>(api: TMDataGridApi<TData>, columnId: string): void;
|
|
2585
|
+
//#endregion
|
|
2586
|
+
//#region .types-tmp/core/filterOperators.d.ts
|
|
2587
|
+
/**
|
|
2588
|
+
* The value shape stored in `columnFilters` for every TMDataGrid column.
|
|
2589
|
+
*
|
|
2590
|
+
* TanStack resolves `filterFn` statically per column, so the operator travels
|
|
2591
|
+
* inside the filter *value* instead. That keeps the filter model plain,
|
|
2592
|
+
* serialisable JSON, so a server-side `manualFiltering` table can forward
|
|
2593
|
+
* `columnFilters` to the API unchanged.
|
|
2594
|
+
*
|
|
2595
|
+
* `value` is a string array under `isAnyOf` / `isNoneOf` (the set the cell is
|
|
2596
|
+
* tested against), a `[min, max]` pair under `between` (an empty string means
|
|
2597
|
+
* that end is open), and a single string everywhere else - dates travel as
|
|
2598
|
+
* ISO `YYYY-MM-DD` strings, booleans as `"true"` / `"false"`. Still plain
|
|
2599
|
+
* JSON.
|
|
2600
|
+
*/
|
|
2601
|
+
type TMDataGridFilterValue = {
|
|
2602
|
+
operator: TMDataGridFilterOperator;
|
|
2603
|
+
value: string | ReadonlyArray<string>;
|
|
2604
|
+
};
|
|
2605
|
+
type TMDataGridColumnType = "string" | "number" | "boolean" | "date" | "select" | "multiSelect";
|
|
2606
|
+
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "between" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
|
|
2607
|
+
declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
|
|
2608
|
+
declare function getOperatorsForType(type: TMDataGridColumnType): readonly TMDataGridFilterOperator[];
|
|
2609
|
+
declare function operatorNeedsValue(operator: TMDataGridFilterOperator): boolean;
|
|
2610
|
+
/** Whether the operator's value is a string array - `isAnyOf` / `isNoneOf`. */
|
|
2611
|
+
declare function operatorTakesArrayValue(operator: TMDataGridFilterOperator): boolean;
|
|
2612
|
+
/** Whether the operator's value is a `[min, max]` pair - `between`. */
|
|
2613
|
+
declare function operatorTakesRangeValue(operator: TMDataGridFilterOperator): boolean;
|
|
2614
|
+
/** The untouched value a fresh filter starts with - the operator's shape, empty. */
|
|
2615
|
+
declare function emptyValueForOperator(operator: TMDataGridFilterOperator): string | ReadonlyArray<string>;
|
|
2616
|
+
/**
|
|
2617
|
+
* The three value shapes an operator can take. A set is not a range, even
|
|
2618
|
+
* though both are arrays.
|
|
2619
|
+
*/
|
|
2620
|
+
type TMDataGridFilterValueShape = "scalar" | "set" | "range";
|
|
2621
|
+
/**
|
|
2622
|
+
* Which shape an operator's value takes. A typed value survives an operator or
|
|
2623
|
+
* column change only within its shape, which is the rule both the panel and
|
|
2624
|
+
* the header controls use when the operator changes.
|
|
2625
|
+
*/
|
|
2626
|
+
declare function filterValueShape(operator: TMDataGridFilterOperator): TMDataGridFilterValueShape;
|
|
2627
|
+
/**
|
|
2628
|
+
* A filter only narrows the row set once it has something to compare against.
|
|
2629
|
+
* Half-typed filters stay in state (so the panel keeps rendering their row) but
|
|
2630
|
+
* are treated as inactive for the funnel indicator and for row matching.
|
|
2631
|
+
*/
|
|
2632
|
+
declare function isFilterActive(value: unknown): boolean;
|
|
2633
|
+
/** One column's filter, typed - what `columnFilters` holds per entry. */
|
|
2634
|
+
type TMDataGridColumnFilter = {
|
|
2635
|
+
id: string;
|
|
2636
|
+
value: TMDataGridFilterValue;
|
|
2637
|
+
};
|
|
2638
|
+
/**
|
|
2639
|
+
* The column filters that are actually narrowing the grid, typed.
|
|
2640
|
+
*
|
|
2641
|
+
* `ColumnFiltersState` types `value` as `unknown`, so the first line of a
|
|
2642
|
+
* server-side mapping layer is otherwise a cast back to the shape the grid
|
|
2643
|
+
* itself wrote, wrapped in the same "drop the half-typed ones" filter every
|
|
2644
|
+
* consumer writes:
|
|
2645
|
+
*
|
|
2646
|
+
* ```ts
|
|
2647
|
+
* const predicates = activeColumnFilters(table).map((filter) =>
|
|
2648
|
+
* toPredicate(filter.id, filter.value),
|
|
2649
|
+
* );
|
|
2650
|
+
* ```
|
|
2651
|
+
*
|
|
2652
|
+
* Takes the table, or a `columnFilters` array where the consumer owns the
|
|
2653
|
+
* slice. Reading it from the table reads the current value and does not
|
|
2654
|
+
* subscribe; inside a component, subscribe to `columnFilters` the way the
|
|
2655
|
+
* grid's own chrome does.
|
|
2656
|
+
*/
|
|
2657
|
+
declare function activeColumnFilters<TData extends RowData>(source: TMDataGridTable<TData> | ColumnFiltersState): Array<TMDataGridColumnFilter>;
|
|
2658
|
+
/**
|
|
2659
|
+
* One-line description of a single filter, as shown on a filter pill.
|
|
2660
|
+
*
|
|
2661
|
+
* The type's default operator is left implicit - "First name: Sofia" reads the
|
|
2662
|
+
* way a person would say it - while any other operator is spelled out, since
|
|
2663
|
+
* that is the part a reader cannot guess.
|
|
2664
|
+
*/
|
|
2665
|
+
declare function formatFilterLabel({ label, type, filter, operatorLabels }: {
|
|
2666
|
+
label: string;
|
|
2667
|
+
type: TMDataGridColumnType;
|
|
2668
|
+
filter: TMDataGridFilterValue;
|
|
2669
|
+
/** Localized operator names - `labels.operators`. Defaults to English. */
|
|
2670
|
+
operatorLabels?: Record<TMDataGridFilterOperator, string>;
|
|
2671
|
+
}): string;
|
|
2672
|
+
/**
|
|
2673
|
+
* The single filter function every TMDataGrid column uses. It dispatches on the
|
|
2674
|
+
* operator carried by the filter value, which is what lets one column offer
|
|
2675
|
+
* "contains" / "does not equal" / "is empty" without redefining the column.
|
|
2676
|
+
*/
|
|
2677
|
+
declare function tmDataGridFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown): boolean;
|
|
2678
|
+
//#endregion
|
|
2679
|
+
//#region .types-tmp/core/columnUtils.d.ts
|
|
2680
|
+
/**
|
|
2681
|
+
* Structural shape of the column bits the chrome reads. Kept minimal so these
|
|
2682
|
+
* helpers work with any `Column`/`Header` instance without dragging generics
|
|
2683
|
+
* through every call site.
|
|
2684
|
+
*/
|
|
2685
|
+
type ColumnLike = {
|
|
2686
|
+
id: string;
|
|
2687
|
+
columnDef: {
|
|
2688
|
+
header?: unknown;
|
|
2689
|
+
meta?: TMDataGridColumnMeta;
|
|
2690
|
+
};
|
|
2691
|
+
/** Set on a leaf that sits inside a header group. */
|
|
2692
|
+
parent?: unknown;
|
|
2693
|
+
};
|
|
2694
|
+
/** Menu- and panel-facing column name. */
|
|
2695
|
+
declare function getColumnLabel(column: ColumnLike): string;
|
|
2696
|
+
declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
2697
|
+
/**
|
|
2698
|
+
* The operators this column offers: the type's list, narrowed to
|
|
2699
|
+
* `meta.filter.operators` when the column declares one. The type's order is
|
|
2700
|
+
* kept so the menu reads the same on every column; an operator the type does
|
|
2701
|
+
* not offer is dropped, and an allowlist that leaves nothing falls back to the
|
|
2702
|
+
* type's full list rather than an empty menu.
|
|
2703
|
+
*/
|
|
2704
|
+
declare function getColumnOperators(column: ColumnLike): readonly TMDataGridFilterOperator[];
|
|
2705
|
+
/**
|
|
2706
|
+
* The operator a fresh filter on this column starts with -
|
|
2707
|
+
* `meta.filter.defaultOperator`, else the type's default where the column
|
|
2708
|
+
* offers it, else the first operator it does offer.
|
|
2709
|
+
*/
|
|
2710
|
+
declare function getColumnDefaultOperator(column: ColumnLike): TMDataGridFilterOperator;
|
|
2711
|
+
/**
|
|
2712
|
+
* A generated lane holding one fixed-width thing - the checkbox, the details
|
|
2713
|
+
* chevron, the row number.
|
|
2714
|
+
*
|
|
2715
|
+
* They are laid out differently from every other column: cell padding is sized
|
|
2716
|
+
* for text and grows with the scale, which at `xl` squeezed a 16px checkbox out
|
|
2717
|
+
* of its track, so these lanes centre their content in an unpadded cell.
|
|
2718
|
+
* Their headers carry no column menu, and none of them is ever exported -
|
|
2719
|
+
* they hold chrome, not values.
|
|
2720
|
+
*
|
|
2721
|
+
* The tree column is deliberately not one of them: it holds a label as well as a
|
|
2722
|
+
* chevron, and wants the padding.
|
|
2723
|
+
*/
|
|
2724
|
+
declare function isControlColumn(columnId: string): boolean;
|
|
2725
|
+
/**
|
|
2726
|
+
* Whether the grid generated this column rather than the consumer declaring it
|
|
2727
|
+
* - the four control lanes plus the tree column.
|
|
2728
|
+
*
|
|
2729
|
+
* These hold the grid's own chrome, and they keep the edges of the row: the
|
|
2730
|
+
* generated left lanes before every consumer column, the edit lane after all of
|
|
2731
|
+
* them. `isControlColumn` answers a narrower question about layout, and leaves
|
|
2732
|
+
* the tree column out because it is padded like a data column.
|
|
2733
|
+
*/
|
|
2734
|
+
declare function isGeneratedColumn(columnId: string): boolean;
|
|
2735
|
+
/** `"auto"` shows the search box from `COLUMN_SEARCH_MIN` columns. */
|
|
2736
|
+
type TMDataGridColumnSearchable = boolean | "auto";
|
|
2737
|
+
//#endregion
|
|
2738
|
+
//#region .types-tmp/components/TMDataGridMenu.d.ts
|
|
2739
|
+
type TMDataGridMenuProps = Omit<MenuProps, "children"> & {
|
|
2740
|
+
/** The dropdown's content: Mantine `Menu.Item`s and the `TMDataGrid.Menu.*` items. */
|
|
2741
|
+
children: ReactNode;
|
|
2742
|
+
/** Replaces the burger icon on the trigger. */
|
|
2743
|
+
icon?: ReactNode;
|
|
2744
|
+
/** Tooltip and `aria-label` of the trigger. Default `labels.menuButton`. */
|
|
2745
|
+
label?: string;
|
|
2746
|
+
};
|
|
2747
|
+
type TMDataGridMenuColumnsProps = {
|
|
2748
|
+
/**
|
|
2749
|
+
* Renders a `Menu.Search` above the toggles: `"auto"` (the default) from
|
|
2750
|
+
* six hideable columns, `true` always, `false` never. Use `false` inside a
|
|
2751
|
+
* `Menu.Sub`.
|
|
2752
|
+
*/
|
|
2753
|
+
searchable?: TMDataGridColumnSearchable;
|
|
2754
|
+
};
|
|
2755
|
+
/**
|
|
2756
|
+
* The whole column chooser as menu items: a search box, one checkbox item per
|
|
2757
|
+
* hideable column, show/hide all, and Reset layout. Renders nothing when no
|
|
2758
|
+
* column can be hidden.
|
|
2759
|
+
*
|
|
2760
|
+
* `searchable` is only for a block at the top level of a dropdown.
|
|
2761
|
+
* `Menu.Search` registers on the root menu context (`hasSearch`), which
|
|
2762
|
+
* switches off type-ahead and the arrow-key handling of every dropdown of that
|
|
2763
|
+
* menu, so a search inside a `Menu.Sub` breaks the parent menu's keyboard
|
|
2764
|
+
* behaviour.
|
|
2765
|
+
*/
|
|
2766
|
+
declare function TMDataGridMenuColumns({ searchable }: TMDataGridMenuColumnsProps): import("react").JSX.Element | null;
|
|
2767
|
+
/**
|
|
2768
|
+
* One checkbox item per hideable column, narrowed to `search` when one is
|
|
2769
|
+
* given. Renders nothing when no column can be hidden.
|
|
2770
|
+
*/
|
|
2771
|
+
declare function TMDataGridMenuColumnToggles({ search }: {
|
|
2772
|
+
search?: string;
|
|
2773
|
+
}): import("react").JSX.Element | null;
|
|
2774
|
+
/**
|
|
2775
|
+
* Shows or hides every listed column at once. Renders nothing when no column
|
|
2776
|
+
* can be hidden.
|
|
2777
|
+
*/
|
|
2778
|
+
declare function TMDataGridMenuShowHideAll(): import("react").JSX.Element | null;
|
|
2779
|
+
/**
|
|
2780
|
+
* Resets the whole layout, not only visibility: order, widths, pinning and
|
|
2781
|
+
* grouping go back too. Not `table.resetColumnVisibility()`, which resets to
|
|
2782
|
+
* `initialState` - and under persistence the mount built that *from* the
|
|
2783
|
+
* persisted payload.
|
|
2784
|
+
*/
|
|
2785
|
+
declare function TMDataGridMenuResetLayout(): import("react").JSX.Element;
|
|
2786
|
+
/** Per-item overrides of the grid's `exportOptions`, and the item's text. */
|
|
2787
|
+
type TMDataGridMenuExportProps = Omit<TMDataGridExportOptions, "columns"> & {
|
|
2788
|
+
/**
|
|
2789
|
+
* Which columns the item writes: `"visible"`, `"all"`, a list of ids, or
|
|
2790
|
+
* `"custom"` - a picker listing every exportable column with the visible
|
|
2791
|
+
* ones ticked, and the download on its Export button. Defaults to the grid's
|
|
2792
|
+
* `exportOptions.columns`.
|
|
2793
|
+
*/
|
|
2794
|
+
columns?: TMDataGridExportColumns | "custom";
|
|
2795
|
+
/**
|
|
2796
|
+
* The item's text. Defaults to `labels.exportAll`, or for the selected-rows
|
|
2797
|
+
* item `labels.exportSelected(count)`. Two items offering two formats need
|
|
2798
|
+
* two texts, which is what this is for.
|
|
2799
|
+
*/
|
|
2800
|
+
label?: ReactNode;
|
|
2801
|
+
};
|
|
2802
|
+
/**
|
|
2803
|
+
* Downloads every filtered and sorted row, all pages, in the grid's export
|
|
2804
|
+
* format. Props override `exportOptions` for this item alone, which is how one
|
|
2805
|
+
* menu offers two formats.
|
|
2806
|
+
*/
|
|
2807
|
+
declare function TMDataGridMenuExport(props: TMDataGridMenuExportProps): import("react").JSX.Element;
|
|
2808
|
+
/**
|
|
2809
|
+
* Downloads the selected rows, in grid order. Disabled while nothing is
|
|
2810
|
+
* selected; renders nothing when row selection is off, since then there is
|
|
2811
|
+
* never anything for it to do.
|
|
2159
2812
|
*/
|
|
2160
|
-
declare function
|
|
2813
|
+
declare function TMDataGridMenuExportSelected(props: TMDataGridMenuExportProps): import("react").JSX.Element | null;
|
|
2814
|
+
//#endregion
|
|
2815
|
+
//#region .types-tmp/components/TMDataGridColumnsPanel.d.ts
|
|
2161
2816
|
/**
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2817
|
+
* The "Manage columns" surface as plain controls, for a host that is not a
|
|
2818
|
+
* menu - a Popover, a Drawer, an inline layout. `TMDataGrid.Menu.Columns` is
|
|
2819
|
+
* the same chooser as menu items.
|
|
2164
2820
|
*/
|
|
2165
|
-
|
|
2821
|
+
/** Mantine's style props (`w={320}`, `p="sm"`) are set on the panel block. */
|
|
2822
|
+
type TMDataGridColumnsPanelProps = BoxProps & {
|
|
2823
|
+
/**
|
|
2824
|
+
* The search box over the list: `"auto"` (the default) from six hideable
|
|
2825
|
+
* columns, `true` always, `false` never.
|
|
2826
|
+
*/
|
|
2827
|
+
searchable?: TMDataGridColumnSearchable;
|
|
2828
|
+
};
|
|
2829
|
+
declare function TMDataGridColumnsPanel({ className, searchable, ...others }?: TMDataGridColumnsPanelProps): import("react").JSX.Element;
|
|
2166
2830
|
//#endregion
|
|
2167
2831
|
//#region .types-tmp/components/TMDataGridDraftActions.d.ts
|
|
2168
2832
|
/** What the edit chrome is showing. */
|
|
@@ -2188,20 +2852,25 @@ type TMDataGridDraftActionsState = {
|
|
|
2188
2852
|
* in display order, so it need not be `openRowIds[0]`.
|
|
2189
2853
|
*/
|
|
2190
2854
|
openRowIds: ReadonlyArray<string>;
|
|
2191
|
-
/**
|
|
2192
|
-
* @deprecated Was "everything uncommitted", which Save no longer sends.
|
|
2193
|
-
* Reads as `draftCount + openCount`; use whichever you meant.
|
|
2194
|
-
*/
|
|
2195
|
-
pendingCount: number;
|
|
2196
|
-
/** Whether a submit is in flight. */
|
|
2855
|
+
/** Whether a submit is in flight - any open row is submitting. */
|
|
2197
2856
|
isSubmitting: boolean;
|
|
2857
|
+
/** `true` while `saveDrafts` is in flight. */
|
|
2858
|
+
isSaving: boolean;
|
|
2198
2859
|
};
|
|
2199
2860
|
/** What the edit chrome can do. */
|
|
2200
2861
|
type TMDataGridDraftActionsActions = {
|
|
2201
|
-
/**
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2862
|
+
/**
|
|
2863
|
+
* Saves the draft store - `edit.saveDrafts()`. Open rows are left alone.
|
|
2864
|
+
* Resolves which ids were saved, kept in the draft store for the next
|
|
2865
|
+
* save, or reopened with an error; see {@link TMDataGridSaveDraftsResult}.
|
|
2866
|
+
*/
|
|
2867
|
+
save: () => Promise<TMDataGridSaveDraftsResult>;
|
|
2868
|
+
/**
|
|
2869
|
+
* Submits every open row, committing the ones that validate -
|
|
2870
|
+
* `edit.commitAll()`. Resolves which rows committed and which are still
|
|
2871
|
+
* open; see {@link TMDataGridCommitAllResult}.
|
|
2872
|
+
*/
|
|
2873
|
+
commitAll: () => Promise<TMDataGridCommitAllResult>;
|
|
2205
2874
|
/** Drops everything - open form state and the draft store alike. */
|
|
2206
2875
|
discard: () => void;
|
|
2207
2876
|
/**
|
|
@@ -2280,16 +2949,40 @@ type TMDataGridDraftActionsProps = {
|
|
|
2280
2949
|
declare function TMDataGridDraftActions({ renderActions }?: TMDataGridDraftActionsProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
2281
2950
|
//#endregion
|
|
2282
2951
|
//#region .types-tmp/components/TMDataGridFilterPanel.d.ts
|
|
2952
|
+
/** Mantine's style props (`p="md"`, `w={320}`) are set on the panel block. */
|
|
2953
|
+
type TMDataGridFilterPanelProps = BoxProps & {
|
|
2954
|
+
/**
|
|
2955
|
+
* How one filter row is laid out.
|
|
2956
|
+
*
|
|
2957
|
+
* `"row"` - the default - puts column, operator and value side by side,
|
|
2958
|
+
* which wants about 550px. `"stacked"` puts them one under the other, each
|
|
2959
|
+
* filling the width, for a host too narrow for that: the sidebar surface
|
|
2960
|
+
* uses it, and so should a panel you place in a drawer or a narrow column.
|
|
2961
|
+
*
|
|
2962
|
+
* Passed through to every value control as its `layout`, so a
|
|
2963
|
+
* `meta.filter.control` can size itself to the same decision.
|
|
2964
|
+
*/
|
|
2965
|
+
layout?: TMDataGridFilterPanelLayout;
|
|
2966
|
+
};
|
|
2283
2967
|
/**
|
|
2284
2968
|
* The MUI-style filter surface: one row per active column filter, each row a
|
|
2285
|
-
* column / operator / value triple
|
|
2286
|
-
*
|
|
2287
|
-
*
|
|
2969
|
+
* column / operator / value triple, over an "Add filter" / "Clear all" footer.
|
|
2970
|
+
*
|
|
2971
|
+
* A plain block of controls, the way `TMDataGrid.ColumnsPanel` is - it renders
|
|
2972
|
+
* whenever it is mounted and knows nothing about floating. The chrome that
|
|
2973
|
+
* makes a floating surface (a title, a close button, click-away, Escape)
|
|
2974
|
+
* belongs to the popup and the sidebar, so this can equally be dropped into a
|
|
2975
|
+
* drawer, a page column or a form. See the `filters.surface` option.
|
|
2976
|
+
*
|
|
2977
|
+
* It only ever reads and writes the table's `columnFilters` state, so a
|
|
2978
|
+
* `manualFiltering` grid gets the same panel for free - the state is forwarded
|
|
2979
|
+
* to the server instead of a row model.
|
|
2288
2980
|
*/
|
|
2289
|
-
declare function TMDataGridFilterPanel(): import("react").JSX.Element
|
|
2981
|
+
declare function TMDataGridFilterPanel({ layout, className, ...others }?: TMDataGridFilterPanelProps): import("react").JSX.Element;
|
|
2290
2982
|
//#endregion
|
|
2291
2983
|
//#region .types-tmp/components/TMDataGridFilterPills.d.ts
|
|
2292
|
-
|
|
2984
|
+
/** Mantine's style props (`mb="sm"`, `hiddenFrom="sm"`) are set on the wrapper. */
|
|
2985
|
+
type TMDataGridFilterPillsProps<TData extends RowData> = BoxProps & {
|
|
2293
2986
|
/** The object returned by `useTMDataGrid`. */
|
|
2294
2987
|
api: TMDataGridApi<TData>;
|
|
2295
2988
|
/** Mantine size of the pills. Defaults to `"sm"`. */
|
|
@@ -2301,7 +2994,6 @@ type TMDataGridFilterPillsProps<TData extends RowData> = {
|
|
|
2301
2994
|
* filter panel on that column.
|
|
2302
2995
|
*/
|
|
2303
2996
|
onPillClick?: (columnId: string) => void;
|
|
2304
|
-
className?: string;
|
|
2305
2997
|
};
|
|
2306
2998
|
/**
|
|
2307
2999
|
* One pill per active filter (`First name: Sofia ✕`), with the ✕ clearing that
|
|
@@ -2323,9 +3015,9 @@ type TMDataGridFilterPillsProps<TData extends RowData> = {
|
|
|
2323
3015
|
* Half-typed filters are left out: a filter that is not narrowing the rows yet
|
|
2324
3016
|
* has nothing to report, which is the same rule the funnel indicator uses.
|
|
2325
3017
|
*/
|
|
2326
|
-
declare function TMDataGridFilterPills<TData extends RowData>({ api, size, showClearAll, onPillClick, className }: TMDataGridFilterPillsProps<TData>): import("react").JSX.Element | null;
|
|
3018
|
+
declare function TMDataGridFilterPills<TData extends RowData>({ api, size, showClearAll, onPillClick, className, ...others }: TMDataGridFilterPillsProps<TData>): import("react").JSX.Element | null;
|
|
2327
3019
|
//#endregion
|
|
2328
|
-
//#region .types-tmp/
|
|
3020
|
+
//#region .types-tmp/core/pagination.d.ts
|
|
2329
3021
|
/** What the pager is showing. The read half of {@link TMDataGridPaginationApi}. */
|
|
2330
3022
|
type TMDataGridPaginationState = {
|
|
2331
3023
|
pageIndex: number;
|
|
@@ -2365,6 +3057,17 @@ type TMDataGridPaginationApi = {
|
|
|
2365
3057
|
state: TMDataGridPaginationState;
|
|
2366
3058
|
actions: TMDataGridPaginationActions;
|
|
2367
3059
|
};
|
|
3060
|
+
/**
|
|
3061
|
+
* Reads {@link TMDataGridPaginationApi} off a table. The Footer feeds it to the
|
|
3062
|
+
* `renderPagination` slot; a pager living outside the Footer can call it with
|
|
3063
|
+
* the table from `useTMDataGrid` directly.
|
|
3064
|
+
*
|
|
3065
|
+
* `Controls` are not here: they are components bound to the grid context, and
|
|
3066
|
+
* this function takes only a table.
|
|
3067
|
+
*/
|
|
3068
|
+
declare function getTMDataGridPaginationApi<TData extends RowData>(table: TMDataGridTable<TData>, isPaging?: boolean): TMDataGridPaginationApi;
|
|
3069
|
+
//#endregion
|
|
3070
|
+
//#region .types-tmp/components/TMDataGridFooter.d.ts
|
|
2368
3071
|
/**
|
|
2369
3072
|
* The pre-bound pieces of the built-in pager.
|
|
2370
3073
|
*
|
|
@@ -2377,6 +3080,12 @@ type TMDataGridPaginationControls = {
|
|
|
2377
3080
|
PageSize: () => ReactNode;
|
|
2378
3081
|
/** The "1–25 of 300" range label. */
|
|
2379
3082
|
Range: () => ReactNode;
|
|
3083
|
+
/**
|
|
3084
|
+
* The "Page 3 of 200" label - what a server-paged grid usually shows in
|
|
3085
|
+
* place of a row range. Not in the default footer; put it in a
|
|
3086
|
+
* `renderPagination` layout.
|
|
3087
|
+
*/
|
|
3088
|
+
PageNumber: () => ReactNode;
|
|
2380
3089
|
/** The previous/next buttons. */
|
|
2381
3090
|
Pager: () => ReactNode;
|
|
2382
3091
|
};
|
|
@@ -2384,16 +3093,8 @@ type TMDataGridPaginationControls = {
|
|
|
2384
3093
|
type TMDataGridPaginationSlotArgs = TMDataGridPaginationApi & {
|
|
2385
3094
|
Controls: TMDataGridPaginationControls;
|
|
2386
3095
|
};
|
|
2387
|
-
/**
|
|
2388
|
-
|
|
2389
|
-
* `renderPagination` slot; a pager living outside the Footer can call it with
|
|
2390
|
-
* the table from `useTMDataGrid` directly.
|
|
2391
|
-
*
|
|
2392
|
-
* `Controls` are not here: they are components bound to the grid context, and
|
|
2393
|
-
* this function takes only a table.
|
|
2394
|
-
*/
|
|
2395
|
-
declare function getTMDataGridPaginationApi<TData extends RowData>(table: TMDataGridTable<TData>, isPaging?: boolean): TMDataGridPaginationApi;
|
|
2396
|
-
type TMDataGridFooterProps = {
|
|
3096
|
+
/** Mantine's style props (`mt="sm"`, `px="md"`) are set on the footer bar. */
|
|
3097
|
+
type TMDataGridFooterProps = BoxProps & {
|
|
2397
3098
|
pageSizeOptions?: ReadonlyArray<number>;
|
|
2398
3099
|
/**
|
|
2399
3100
|
* Replaces the built-in pager, and is handed the pieces of it.
|
|
@@ -2403,7 +3104,7 @@ type TMDataGridFooterProps = {
|
|
|
2403
3104
|
* renderPagination={({ state, actions, Controls }) => (
|
|
2404
3105
|
* <Group>
|
|
2405
3106
|
* <Controls.PageSize />
|
|
2406
|
-
* <
|
|
3107
|
+
* <Controls.PageNumber />
|
|
2407
3108
|
* <Controls.Pager />
|
|
2408
3109
|
* </Group>
|
|
2409
3110
|
* )}
|
|
@@ -2422,7 +3123,7 @@ type TMDataGridFooterProps = {
|
|
|
2422
3123
|
* Row totals come from `table.getRowCount()`, which prefers `options.rowCount`
|
|
2423
3124
|
* - so a server-paged grid shows the server's total without changes here.
|
|
2424
3125
|
*/
|
|
2425
|
-
declare function TMDataGridFooter({ pageSizeOptions, renderPagination }: TMDataGridFooterProps): import("react").JSX.Element | null;
|
|
3126
|
+
declare function TMDataGridFooter({ pageSizeOptions, renderPagination, className, ...others }: TMDataGridFooterProps): import("react").JSX.Element | null;
|
|
2426
3127
|
//#endregion
|
|
2427
3128
|
//#region .types-tmp/components/TMDataGridSearch.d.ts
|
|
2428
3129
|
type TMDataGridSearchProps = {
|
|
@@ -2481,173 +3182,7 @@ type TMDataGridColumnMenuItemsArgs = {
|
|
|
2481
3182
|
*/
|
|
2482
3183
|
type TMDataGridColumnMenuItemsRenderer = (args: TMDataGridColumnMenuItemsArgs) => Array<ReactNode>;
|
|
2483
3184
|
//#endregion
|
|
2484
|
-
//#region .types-tmp/core/cellExport.d.ts
|
|
2485
|
-
/** The selected block, flattened to text. One inner array per row. */
|
|
2486
|
-
type TMDataGridCellMatrix = Array<Array<string>>;
|
|
2487
|
-
/**
|
|
2488
|
-
* How values are written out.
|
|
2489
|
-
*
|
|
2490
|
-
* The defaults are the Nordic ones, because they are the ones that need
|
|
2491
|
-
* choosing: an Excel running a Swedish, Norwegian, Danish or Finnish locale
|
|
2492
|
-
* reads `;` as its list separator and `,` as its decimal mark, and a file
|
|
2493
|
-
* written the other way opens as one column of text. Both are settable for a
|
|
2494
|
-
* grid whose users run something else.
|
|
2495
|
-
*/
|
|
2496
|
-
type TMDataGridCellExportOptions = {
|
|
2497
|
-
/** CSV field separator. Defaults to `";"`. */
|
|
2498
|
-
separator?: string;
|
|
2499
|
-
/** Write numbers as `1,5` rather than `1.5`. Defaults to `true`. */
|
|
2500
|
-
decimalComma?: boolean;
|
|
2501
|
-
/** Column labels as the first row. Defaults to `true`. */
|
|
2502
|
-
includeHeaders?: boolean;
|
|
2503
|
-
/** Without extension. Defaults to `"export"`. */
|
|
2504
|
-
fileName?: string;
|
|
2505
|
-
};
|
|
2506
|
-
type ResolvedExportOptions = Required<TMDataGridCellExportOptions>;
|
|
2507
|
-
declare const DEFAULT_CELL_EXPORT_OPTIONS: ResolvedExportOptions;
|
|
2508
|
-
/**
|
|
2509
|
-
* One value as text.
|
|
2510
|
-
*
|
|
2511
|
-
* Deliberately not the rendered cell: what a cell renders is React, and often a
|
|
2512
|
-
* badge, a link or an icon rather than the value. The value is what a
|
|
2513
|
-
* spreadsheet wants, and it is the one thing every column is guaranteed to
|
|
2514
|
-
* have.
|
|
2515
|
-
*/
|
|
2516
|
-
declare function formatExportValue(value: unknown, { decimalComma }: {
|
|
2517
|
-
decimalComma: boolean;
|
|
2518
|
-
}): string;
|
|
2519
|
-
type BuildCellMatrixArgs = {
|
|
2520
|
-
rows: ReadonlyArray<Row<TMDataGridFeatures, TMDataGridRowData>>;
|
|
2521
|
-
/** Every visible column, in render order - the same list the bounds index into. */
|
|
2522
|
-
columns: ReadonlyArray<Column<TMDataGridFeatures, TMDataGridRowData, unknown>>;
|
|
2523
|
-
bounds: TMDataGridRangeBounds;
|
|
2524
|
-
includeHeaders: boolean;
|
|
2525
|
-
decimalComma: boolean;
|
|
2526
|
-
};
|
|
2527
|
-
/**
|
|
2528
|
-
* The selected rectangle as rows of text.
|
|
2529
|
-
*
|
|
2530
|
-
* The generated lanes - the checkbox, the tree chevron, the details chevron -
|
|
2531
|
-
* are dropped even when the rectangle covers them. They hold controls rather
|
|
2532
|
-
* than data, so a column of empty strings is all they could contribute, and
|
|
2533
|
-
* pasting one into a spreadsheet only shifts everything to its right.
|
|
2534
|
-
*/
|
|
2535
|
-
declare function buildCellMatrix({ rows, columns, bounds, includeHeaders, decimalComma }: BuildCellMatrixArgs): TMDataGridCellMatrix;
|
|
2536
|
-
/**
|
|
2537
|
-
* The whole grid as rows of text: every filtered and sorted data row - all
|
|
2538
|
-
* pages, not the one on screen - by every visible non-control column, in
|
|
2539
|
-
* render order.
|
|
2540
|
-
*
|
|
2541
|
-
* The values are the same ones a cell-range export writes; only the bounds
|
|
2542
|
-
* differ. Group rows are left out (their records are the rows themselves),
|
|
2543
|
-
* and hidden columns are not exported - what you see is what you get, minus
|
|
2544
|
-
* paging.
|
|
2545
|
-
*/
|
|
2546
|
-
declare function buildGridCellMatrix<TData extends RowData>({ table, includeHeaders, decimalComma }: {
|
|
2547
|
-
table: TMDataGridTable<TData>;
|
|
2548
|
-
includeHeaders?: boolean;
|
|
2549
|
-
decimalComma?: boolean;
|
|
2550
|
-
}): TMDataGridCellMatrix;
|
|
2551
|
-
/**
|
|
2552
|
-
* Downloads the whole grid as a CSV for Excel - {@link buildGridCellMatrix}
|
|
2553
|
-
* through {@link toExcelCsv}, with the same Nordic defaults and overrides as
|
|
2554
|
-
* the cell-range export.
|
|
2555
|
-
*
|
|
2556
|
-
* No built-in button: wire it to your own toolbar.
|
|
2557
|
-
*
|
|
2558
|
-
* ```tsx
|
|
2559
|
-
* <Button onClick={() => exportGridToCsv({ table: grid.table })}>Export</Button>
|
|
2560
|
-
* ```
|
|
2561
|
-
*/
|
|
2562
|
-
declare function exportGridToCsv<TData extends RowData>({ table, options }: {
|
|
2563
|
-
table: TMDataGridTable<TData>;
|
|
2564
|
-
options?: TMDataGridCellExportOptions;
|
|
2565
|
-
}): void;
|
|
2566
|
-
/**
|
|
2567
|
-
* The clipboard format spreadsheets read: tab between cells, CRLF between rows.
|
|
2568
|
-
*
|
|
2569
|
-
* Tabs rather than commas because that is what Excel, Sheets and Numbers all
|
|
2570
|
-
* put on the clipboard themselves - paste it and the cells land in cells. A
|
|
2571
|
-
* comma-separated string pastes into a single column, which is the thing this
|
|
2572
|
-
* exists to avoid.
|
|
2573
|
-
*/
|
|
2574
|
-
declare function toClipboardText(matrix: TMDataGridCellMatrix): string;
|
|
2575
|
-
/**
|
|
2576
|
-
* A CSV that opens straight into columns in Excel.
|
|
2577
|
-
*
|
|
2578
|
-
* Three things make that true, and all three are needed:
|
|
2579
|
-
*
|
|
2580
|
-
* | Part | Why |
|
|
2581
|
-
* | ---- | --- |
|
|
2582
|
-
* | `sep=;` first line | Excel's own directive - it stops guessing and uses this |
|
|
2583
|
-
* | UTF-8 BOM | without it Excel reads the file as ANSI, and å ä ö arrive broken |
|
|
2584
|
-
* | CRLF line endings | what Excel writes, and what its importer is happiest with |
|
|
2585
|
-
*
|
|
2586
|
-
* The `sep=` line is Excel's alone; other readers show it as a first row. This
|
|
2587
|
-
* export targets Excel, so opening correctly there takes priority over strict
|
|
2588
|
-
* CSV.
|
|
2589
|
-
*/
|
|
2590
|
-
declare function toExcelCsv(matrix: TMDataGridCellMatrix, { separator }: {
|
|
2591
|
-
separator: string;
|
|
2592
|
-
}): string;
|
|
2593
|
-
/**
|
|
2594
|
-
* Puts text on the clipboard, reporting whether it landed.
|
|
2595
|
-
*
|
|
2596
|
-
* The async clipboard API only resolves for a document that has the focus and a
|
|
2597
|
-
* user gesture behind it - both true when this runs off Ctrl+C or a menu item.
|
|
2598
|
-
* It is still allowed to reject (a permissions policy, a page that lost focus
|
|
2599
|
-
* mid-copy), so the result is a boolean the caller can act on.
|
|
2600
|
-
*/
|
|
2601
|
-
declare function writeClipboardText(text: string): Promise<boolean>;
|
|
2602
|
-
/**
|
|
2603
|
-
* Downloads text as a file, through the one mechanism a library can use: an
|
|
2604
|
-
* anchor with an object URL behind it, clicked. Revoked on the next frame -
|
|
2605
|
-
* immediately would race the browser's own read of it.
|
|
2606
|
-
*/
|
|
2607
|
-
declare function downloadTextFile({ fileName, text, mimeType }: {
|
|
2608
|
-
fileName: string;
|
|
2609
|
-
text: string;
|
|
2610
|
-
mimeType?: string;
|
|
2611
|
-
}): void;
|
|
2612
|
-
//#endregion
|
|
2613
3185
|
//#region .types-tmp/components/TMDataGridTable.d.ts
|
|
2614
|
-
/** Where a column sits relative to the pinned regions, resolved once per render. */
|
|
2615
|
-
type TMDataGridColumnLayout = {
|
|
2616
|
-
pinnedAt: "left" | "right" | false;
|
|
2617
|
-
/** Distance in px from the grid's left or right edge. */
|
|
2618
|
-
offset: number;
|
|
2619
|
-
/** Last left-pinned / first right-pinned column - the one that casts the edge. */
|
|
2620
|
-
isBoundary: boolean;
|
|
2621
|
-
};
|
|
2622
|
-
/**
|
|
2623
|
-
* What a cell needs to take part in cell selection, or `undefined` while the
|
|
2624
|
-
* feature is off - which is what keeps a plain grid's cells exactly as they
|
|
2625
|
-
* were: no tab stop, no `gridcell` role, no coordinates in the DOM.
|
|
2626
|
-
*
|
|
2627
|
-
* The coordinates are there for the delegated key handler, which reads them off
|
|
2628
|
-
* `event.target` rather than closing over per-cell state, and for the effect
|
|
2629
|
-
* that puts DOM focus where {@link TMDataGridUiState.focusedCell} says.
|
|
2630
|
-
*/
|
|
2631
|
-
type TMDataGridCellNav = {
|
|
2632
|
-
rowId: string;
|
|
2633
|
-
/** 1-based, for `aria-colindex`. */
|
|
2634
|
-
columnIndex: number;
|
|
2635
|
-
focused: boolean;
|
|
2636
|
-
/** The roving tab stop: `0` on exactly one mounted cell, `-1` on the rest. */
|
|
2637
|
-
tabIndex: 0 | -1;
|
|
2638
|
-
/** Inside the selected rectangle. Always `false` under `"single"`. */
|
|
2639
|
-
selected: boolean;
|
|
2640
|
-
/**
|
|
2641
|
-
* Which sides of the rectangle this cell is on, or `null` when it is not in
|
|
2642
|
-
* one. The outline is drawn per cell - see {@link boundsEdges}.
|
|
2643
|
-
*/
|
|
2644
|
-
edges: {
|
|
2645
|
-
top: boolean;
|
|
2646
|
-
bottom: boolean;
|
|
2647
|
-
left: boolean;
|
|
2648
|
-
right: boolean;
|
|
2649
|
-
} | null;
|
|
2650
|
-
};
|
|
2651
3186
|
/** What `renderRowContextMenu` is handed for the right-clicked row. */
|
|
2652
3187
|
type TMDataGridRowContextMenuArgs<TData extends RowData> = {
|
|
2653
3188
|
table: Table<TMDataGridFeatures, TData>;
|
|
@@ -2817,12 +3352,6 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
2817
3352
|
* `position`, `transitionProps` and the rest. Its open state is the grid's.
|
|
2818
3353
|
*/
|
|
2819
3354
|
rowContextMenuProps?: Omit<MenuProps, "opened" | "onChange" | "children">;
|
|
2820
|
-
/**
|
|
2821
|
-
* How Ctrl+C and the export item write values, under
|
|
2822
|
-
* `cellSelection: "range"`. Defaults to the Nordic Excel conventions - see
|
|
2823
|
-
* {@link TMDataGridCellExportOptions}.
|
|
2824
|
-
*/
|
|
2825
|
-
cellExport?: TMDataGridCellExportOptions;
|
|
2826
3355
|
/**
|
|
2827
3356
|
* Called when the scroll approaches the last row - the infinite-scroll
|
|
2828
3357
|
* hook-in. Append the next page to `data` and the virtualizer keeps its
|
|
@@ -2857,15 +3386,25 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
2857
3386
|
* no-pagination mode work at any row count. Pagination is opt in through
|
|
2858
3387
|
* `enablePagination`, or implied by `manualPagination`.
|
|
2859
3388
|
*/
|
|
2860
|
-
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, onCellClick, onCellDoubleClick, onCellContextMenu, rowClassName, rowStyle, striped, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, renderEmptyState, renderRowContextMenu, renderColumnMenuItems, rowContextMenuProps,
|
|
3389
|
+
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;
|
|
2861
3390
|
//#endregion
|
|
2862
3391
|
//#region .types-tmp/components/TMDataGridToolbar.d.ts
|
|
2863
|
-
|
|
2864
|
-
declare function TMDataGridToolbar({ children }: {
|
|
3392
|
+
type TMDataGridToolbarProps = BoxProps & {
|
|
2865
3393
|
children?: ReactNode;
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
3394
|
+
/**
|
|
3395
|
+
* Draws a 1px line under the toolbar in the theme's default border colour -
|
|
3396
|
+
* the same line the header draws under itself. Defaults to `false`.
|
|
3397
|
+
*/
|
|
3398
|
+
withBottomBorder?: boolean;
|
|
3399
|
+
};
|
|
3400
|
+
/**
|
|
3401
|
+
* Row above the grid. Compose it from the pieces below, or anything else.
|
|
3402
|
+
* Takes Mantine's style props (`mb="sm"`, `px="md"`, `hiddenFrom="sm"`) and
|
|
3403
|
+
* sets them on the row.
|
|
3404
|
+
*/
|
|
3405
|
+
declare function TMDataGridToolbar({ children, withBottomBorder, className, mod, ...others }: TMDataGridToolbarProps): import("react").JSX.Element;
|
|
3406
|
+
/** Pushes the following toolbar items to the right. Takes Mantine's style props. */
|
|
3407
|
+
declare function TMDataGridToolbarSpacer({ className, ...others }: BoxProps): import("react").JSX.Element;
|
|
2869
3408
|
/**
|
|
2870
3409
|
* A small spinner shown while `meta.loading` is true, and nothing otherwise.
|
|
2871
3410
|
*
|
|
@@ -2887,18 +3426,22 @@ declare function TMDataGridLoadingIndicator(): import("react").JSX.Element | nul
|
|
|
2887
3426
|
/**
|
|
2888
3427
|
* Visible rows over total rows. On a server-driven grid, set
|
|
2889
3428
|
* `meta.totalRowCount` for the denominator - the client never sees every row.
|
|
3429
|
+
* Without it the count is rendered alone, since the fallback denominator would
|
|
3430
|
+
* be the rows the server sent for the current page: a plausible-looking wrong
|
|
3431
|
+
* total, and on an unfiltered first page the same number twice.
|
|
2890
3432
|
*/
|
|
2891
3433
|
declare function TMDataGridSummaryCount({ children }: {
|
|
2892
3434
|
children?: ReactNode;
|
|
2893
3435
|
}): import("react").JSX.Element;
|
|
2894
3436
|
/**
|
|
2895
|
-
*
|
|
2896
|
-
*
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
*
|
|
2901
|
-
*
|
|
3437
|
+
* Toggles the grid's filter surface - the popup or the sidebar, whichever
|
|
3438
|
+
* `filters.surface` names - seeding a filter row on the first filterable
|
|
3439
|
+
* column. The count of active filters tints it.
|
|
3440
|
+
*
|
|
3441
|
+
* Renders nothing when no column can be filtered (`enableColumnFilters:
|
|
3442
|
+
* false`), and nothing under `filters.surface: "none"`, where there is no
|
|
3443
|
+
* automatic surface for it to toggle. Read `ui.state.filterPanelOpen` and
|
|
3444
|
+
* render your own control if a hand-placed panel wants one.
|
|
2902
3445
|
*/
|
|
2903
3446
|
declare function TMDataGridFilterButton(): import("react").JSX.Element | null;
|
|
2904
3447
|
//#endregion
|
|
@@ -2932,6 +3475,7 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
2932
3475
|
*/
|
|
2933
3476
|
"data-testid"?: string;
|
|
2934
3477
|
};
|
|
3478
|
+
declare function TMDataGridRoot<TData extends RowData>({ table, ui, edit, features, filters, exportOptions, labels, renderDetails, renderDetailsEstHeight, overscan, resetSettings, scrollToRow, scrollerRef, size, children, className, style, id, "data-testid": testId }: TMDataGridProps<TData>): import("react").JSX.Element;
|
|
2935
3479
|
/**
|
|
2936
3480
|
* Root of the grid. Takes the object returned by `useTMDataGrid` - spread it -
|
|
2937
3481
|
* and publishes it to the compound components below it:
|
|
@@ -2943,14 +3487,15 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
2943
3487
|
* <TMDataGrid.Toolbar>
|
|
2944
3488
|
* <TMDataGrid.SummaryCount />
|
|
2945
3489
|
* <TMDataGrid.Spacer />
|
|
2946
|
-
* <TMDataGrid.
|
|
3490
|
+
* <TMDataGrid.Menu>
|
|
3491
|
+
* <TMDataGrid.Menu.Columns />
|
|
3492
|
+
* </TMDataGrid.Menu>
|
|
2947
3493
|
* </TMDataGrid.Toolbar>
|
|
2948
3494
|
* <TMDataGrid.Table />
|
|
2949
3495
|
* <TMDataGrid.Footer />
|
|
2950
3496
|
* </TMDataGrid>
|
|
2951
3497
|
* ```
|
|
2952
3498
|
*/
|
|
2953
|
-
declare function TMDataGridRoot<TData extends RowData>({ table, ui, edit, features, labels, renderDetails, renderDetailsEstHeight, overscan, resetSettings, scrollToRow, scrollerRef, size, children, className, style, id, "data-testid": testId }: TMDataGridProps<TData>): import("react").JSX.Element;
|
|
2954
3499
|
declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
2955
3500
|
Toolbar: typeof TMDataGridToolbar;
|
|
2956
3501
|
Spacer: typeof TMDataGridToolbarSpacer;
|
|
@@ -2958,7 +3503,14 @@ declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
|
2958
3503
|
LoadingIndicator: typeof TMDataGridLoadingIndicator;
|
|
2959
3504
|
Search: typeof TMDataGridSearch;
|
|
2960
3505
|
DraftActions: typeof TMDataGridDraftActions;
|
|
2961
|
-
|
|
3506
|
+
Menu: (({ children, icon, label, ...menuProps }: TMDataGridMenuProps) => import("react").JSX.Element) & {
|
|
3507
|
+
Columns: typeof TMDataGridMenuColumns;
|
|
3508
|
+
ColumnToggles: typeof TMDataGridMenuColumnToggles;
|
|
3509
|
+
ShowHideAll: typeof TMDataGridMenuShowHideAll;
|
|
3510
|
+
ResetLayout: typeof TMDataGridMenuResetLayout;
|
|
3511
|
+
Export: typeof TMDataGridMenuExport;
|
|
3512
|
+
ExportSelected: typeof TMDataGridMenuExportSelected;
|
|
3513
|
+
};
|
|
2962
3514
|
FilterButton: typeof TMDataGridFilterButton;
|
|
2963
3515
|
Table: typeof TMDataGridTable$1;
|
|
2964
3516
|
Footer: typeof TMDataGridFooter;
|
|
@@ -2969,7 +3521,10 @@ declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
|
2969
3521
|
* rendered outside `<TMDataGrid>` - a page header, for instance.
|
|
2970
3522
|
*/
|
|
2971
3523
|
FilterPills: typeof TMDataGridFilterPills;
|
|
2972
|
-
/**
|
|
3524
|
+
/**
|
|
3525
|
+
* The column chooser as plain controls, for a Popover, a Drawer or an
|
|
3526
|
+
* inline layout; `TMDataGrid.Menu.Columns` is the same thing as menu items.
|
|
3527
|
+
*/
|
|
2973
3528
|
ColumnsPanel: typeof TMDataGridColumnsPanel;
|
|
2974
3529
|
};
|
|
2975
3530
|
//#endregion
|
|
@@ -2987,6 +3542,21 @@ declare const ROW_NUMBER_COLUMN_ID = "__rowNumber__";
|
|
|
2987
3542
|
//#endregion
|
|
2988
3543
|
//#region .types-tmp/components/TMDataGridGroupColumn.d.ts
|
|
2989
3544
|
declare const GROUP_COLUMN_ID = "__group__";
|
|
3545
|
+
//#endregion
|
|
3546
|
+
//#region .types-tmp/core/grouping.d.ts
|
|
3547
|
+
/**
|
|
3548
|
+
* The data rows under a group row, at any depth.
|
|
3549
|
+
*
|
|
3550
|
+
* Not `row.getLeafRows()`, despite the name: that flattens the whole subtree
|
|
3551
|
+
* and keeps the branches, so a group nested two deep reports its sub-groups
|
|
3552
|
+
* alongside the records. Grouping `city` then `name` would have Stockholm
|
|
3553
|
+
* counting four rows and three names as seven, and one tick on it selecting
|
|
3554
|
+
* ids that hold no record.
|
|
3555
|
+
*
|
|
3556
|
+
* A row with no subRows is a data row, which also makes this the identity on an
|
|
3557
|
+
* ungrouped grid.
|
|
3558
|
+
*/
|
|
3559
|
+
declare function getGroupDataRows<TData extends RowData>(row: Row<TMDataGridFeatures, TData>): Array<Row<TMDataGridFeatures, TData>>;
|
|
2990
3560
|
/**
|
|
2991
3561
|
* How a grouping value is written into the tree cell.
|
|
2992
3562
|
*
|
|
@@ -2996,17 +3566,60 @@ declare const GROUP_COLUMN_ID = "__group__";
|
|
|
2996
3566
|
*/
|
|
2997
3567
|
declare function formatGroupValue(value: unknown, blankLabel?: string): string;
|
|
2998
3568
|
//#endregion
|
|
3569
|
+
//#region .types-tmp/useTMDataGridExport.d.ts
|
|
3570
|
+
/** What {@link useTMDataGridExport} returns. */
|
|
3571
|
+
type TMDataGridExportApi = {
|
|
3572
|
+
/**
|
|
3573
|
+
* Downloads every filtered and sorted row, all pages. `overrides` are folded
|
|
3574
|
+
* over the hook's options for this one call - the column picker's chosen
|
|
3575
|
+
* columns, for instance.
|
|
3576
|
+
*/
|
|
3577
|
+
exportAll: (overrides?: TMDataGridExportOptions) => Promise<void>;
|
|
3578
|
+
/**
|
|
3579
|
+
* Downloads the selected rows of the current view, in grid order. Resolves
|
|
3580
|
+
* without a download when none is selected.
|
|
3581
|
+
*/
|
|
3582
|
+
exportSelected: (overrides?: TMDataGridExportOptions) => Promise<void>;
|
|
3583
|
+
/** How many rows `exportSelected` would write. Subscribes to the selection. */
|
|
3584
|
+
selectedCount: number;
|
|
3585
|
+
/**
|
|
3586
|
+
* Whether row selection is on at all - `false` under
|
|
3587
|
+
* `selectionMode: "highlight"` or `enableRowSelection: false`, where a
|
|
3588
|
+
* "selected rows" control has nothing to offer.
|
|
3589
|
+
*/
|
|
3590
|
+
canExportSelected: boolean;
|
|
3591
|
+
};
|
|
3592
|
+
/**
|
|
3593
|
+
* The export as click handlers, for a button of your own anywhere inside the
|
|
3594
|
+
* grid. The `TMDataGrid.Menu.Export*` items are this hook behind a
|
|
3595
|
+
* `Menu.Item`.
|
|
3596
|
+
*
|
|
3597
|
+
* ```tsx
|
|
3598
|
+
* function ExportButton() {
|
|
3599
|
+
* const { exportAll } = useTMDataGridExport();
|
|
3600
|
+
* return <Button onClick={() => void exportAll()}>Export</Button>;
|
|
3601
|
+
* }
|
|
3602
|
+
* ```
|
|
3603
|
+
*
|
|
3604
|
+
* `overrides` are folded over the grid's `exportOptions` for this caller:
|
|
3605
|
+
* another format, another file name, another set of columns.
|
|
3606
|
+
*/
|
|
3607
|
+
declare function useTMDataGridExport(overrides?: TMDataGridExportOptions): TMDataGridExportApi;
|
|
3608
|
+
//#endregion
|
|
2999
3609
|
//#region .types-tmp/components/filters/TMDataGridFilterValueInput.d.ts
|
|
3000
3610
|
/**
|
|
3001
|
-
* The built-in value control of a filter
|
|
3002
|
-
*
|
|
3003
|
-
*
|
|
3004
|
-
*
|
|
3611
|
+
* The built-in value control of a filter row - what renders when a column
|
|
3612
|
+
* declares no `meta.filter.control`. Shaped by the operator: a multi-select
|
|
3613
|
+
* for the set operators, a From/To pair for `between`, a Yes/No dropdown for
|
|
3614
|
+
* booleans, a typed input otherwise.
|
|
3615
|
+
*
|
|
3616
|
+
* Shaped by `layout` as well: in a header cell the fields drop their labels,
|
|
3617
|
+
* fill the column's width and name themselves through `aria-label`.
|
|
3005
3618
|
*
|
|
3006
3619
|
* Exported so a custom control can fall back to it for the operators it does
|
|
3007
3620
|
* not care about, instead of rebuilding them.
|
|
3008
3621
|
*/
|
|
3009
|
-
declare function TMDataGridFilterValueInput(
|
|
3622
|
+
declare function TMDataGridFilterValueInput(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
3010
3623
|
//#endregion
|
|
3011
3624
|
//#region .types-tmp/components/filters/DgRangeSliderFilter.d.ts
|
|
3012
3625
|
/**
|
|
@@ -3094,92 +3707,6 @@ declare function TMDataGridMultiSelectEditor({ field, column, row, table, size }
|
|
|
3094
3707
|
*/
|
|
3095
3708
|
declare const TMDATAGRID_LABELS_SV: TMDataGridLabels;
|
|
3096
3709
|
//#endregion
|
|
3097
|
-
//#region .types-tmp/core/columnUtils.d.ts
|
|
3098
|
-
/**
|
|
3099
|
-
* Structural shape of the column bits the chrome reads. Kept minimal so these
|
|
3100
|
-
* helpers work with any `Column`/`Header` instance without dragging generics
|
|
3101
|
-
* through every call site.
|
|
3102
|
-
*/
|
|
3103
|
-
type ColumnLike = {
|
|
3104
|
-
id: string;
|
|
3105
|
-
columnDef: {
|
|
3106
|
-
header?: unknown;
|
|
3107
|
-
meta?: TMDataGridColumnMeta;
|
|
3108
|
-
};
|
|
3109
|
-
/** Set on a leaf that sits inside a header group. */
|
|
3110
|
-
parent?: unknown;
|
|
3111
|
-
};
|
|
3112
|
-
/** Menu- and panel-facing column name. */
|
|
3113
|
-
declare function getColumnLabel(column: ColumnLike): string;
|
|
3114
|
-
declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
3115
|
-
/**
|
|
3116
|
-
* The operator a fresh filter on this column starts with -
|
|
3117
|
-
* `meta.filter.defaultOperator`, else the type's default.
|
|
3118
|
-
*/
|
|
3119
|
-
declare function getColumnDefaultOperator(column: ColumnLike): TMDataGridFilterOperator;
|
|
3120
|
-
/**
|
|
3121
|
-
* This column's filter-panel value control - `meta.filter.control`, or
|
|
3122
|
-
* `undefined` for the built-in shape-by-operator input.
|
|
3123
|
-
*/
|
|
3124
|
-
declare function getColumnFilterControl(column: ColumnLike): TMDataGridFilterControlComponent | undefined;
|
|
3125
|
-
/**
|
|
3126
|
-
* Whether `meta.edit.enabled` lets this column's cell on this row be edited -
|
|
3127
|
-
* the switch, then the predicate.
|
|
3128
|
-
*
|
|
3129
|
-
* This is only the column's half of the rule. A cell also needs the column to
|
|
3130
|
-
* map to a field (`getEditFieldName`) and the row to take edits at all
|
|
3131
|
-
* (`isRowEditable`); `edit.canEditCell` is the whole question.
|
|
3132
|
-
*/
|
|
3133
|
-
declare function isColumnEditableForRow(column: ColumnLike, row: Row<TMDataGridFeatures, TMDataGridRowData>): boolean;
|
|
3134
|
-
/**
|
|
3135
|
-
* A generated lane holding one fixed-width thing - the checkbox, the details
|
|
3136
|
-
* chevron, the row number.
|
|
3137
|
-
*
|
|
3138
|
-
* They are laid out differently from every other column: cell padding is sized
|
|
3139
|
-
* for text and grows with the scale, which at `xl` squeezed a 16px checkbox out
|
|
3140
|
-
* of its track, so these lanes centre their content in an unpadded cell.
|
|
3141
|
-
* Their headers carry no column menu, and none of them is ever exported -
|
|
3142
|
-
* they hold chrome, not values.
|
|
3143
|
-
*
|
|
3144
|
-
* The tree column is deliberately not one of them: it holds a label as well as a
|
|
3145
|
-
* chevron, and wants the padding.
|
|
3146
|
-
*/
|
|
3147
|
-
declare function isControlColumn(columnId: string): boolean;
|
|
3148
|
-
/**
|
|
3149
|
-
* Whether the grid generated this column rather than the consumer declaring it
|
|
3150
|
-
* - the four control lanes plus the tree column.
|
|
3151
|
-
*
|
|
3152
|
-
* These hold the grid's own chrome, and they keep the edges of the row: the
|
|
3153
|
-
* generated left lanes before every consumer column, the edit lane after all of
|
|
3154
|
-
* them. `isControlColumn` answers a narrower question about layout, and leaves
|
|
3155
|
-
* the tree column out because it is padded like a data column.
|
|
3156
|
-
*/
|
|
3157
|
-
declare function isGeneratedColumn(columnId: string): boolean;
|
|
3158
|
-
/**
|
|
3159
|
-
* Whether a column may be moved. Ordering is the one column feature TanStack
|
|
3160
|
-
* has no column option for, so the switch lives in `meta.enableOrdering`.
|
|
3161
|
-
*
|
|
3162
|
-
* A leaf inside a header group is never movable: `columnOrder` sequences leaf
|
|
3163
|
-
* columns, so moving one out of its group would leave the group header spanning
|
|
3164
|
-
* columns that no longer belong to it.
|
|
3165
|
-
*/
|
|
3166
|
-
declare function isColumnReorderable(column: ColumnLike): boolean;
|
|
3167
|
-
//#endregion
|
|
3168
|
-
//#region .types-tmp/core/grouping.d.ts
|
|
3169
|
-
/**
|
|
3170
|
-
* The data rows under a group row, at any depth.
|
|
3171
|
-
*
|
|
3172
|
-
* Not `row.getLeafRows()`, despite the name: that flattens the whole subtree
|
|
3173
|
-
* and keeps the branches, so a group nested two deep reports its sub-groups
|
|
3174
|
-
* alongside the records. Grouping `city` then `name` would have Stockholm
|
|
3175
|
-
* counting four rows and three names as seven, and one tick on it selecting
|
|
3176
|
-
* ids that hold no record.
|
|
3177
|
-
*
|
|
3178
|
-
* A row with no subRows is a data row, which also makes this the identity on an
|
|
3179
|
-
* ungrouped grid.
|
|
3180
|
-
*/
|
|
3181
|
-
declare function getGroupDataRows<TData extends RowData>(row: Row<TMDataGridFeatures, TData>): Array<Row<TMDataGridFeatures, TData>>;
|
|
3182
|
-
//#endregion
|
|
3183
3710
|
//#region .types-tmp/core/summary.d.ts
|
|
3184
3711
|
/** The registered aggregation names - the same set `aggregationFn` accepts. */
|
|
3185
3712
|
type TMDataGridAggregationName = keyof typeof aggregationFns;
|
|
@@ -3208,20 +3735,6 @@ declare function aggregateColumn<TData extends RowData>({ table, columnId, fn }:
|
|
|
3208
3735
|
}): unknown;
|
|
3209
3736
|
//#endregion
|
|
3210
3737
|
//#region .types-tmp/core/autosize.d.ts
|
|
3211
|
-
/**
|
|
3212
|
-
* Widest rendered content of one column, in px, measured from the DOM.
|
|
3213
|
-
*
|
|
3214
|
-
* Mounted cells only: under virtualization the unmounted rows do not exist to
|
|
3215
|
-
* be measured, so this reads the visible window plus overscan - the same
|
|
3216
|
-
* trade AG Grid's autosize makes by default. With no rows mounted at all the
|
|
3217
|
-
* header is the only thing left to measure, which is a width that fits the
|
|
3218
|
-
* title and nothing else - see `hasMountedCells`.
|
|
3219
|
-
*/
|
|
3220
|
-
declare function measureColumnContentWidth({ container, columnId }: {
|
|
3221
|
-
/** The grid's scroll container - anything enclosing the column's cells. */
|
|
3222
|
-
container: HTMLElement;
|
|
3223
|
-
columnId: string;
|
|
3224
|
-
}): number;
|
|
3225
3738
|
/**
|
|
3226
3739
|
* Sizes a column to its widest mounted content - what double-clicking the
|
|
3227
3740
|
* resize divider does, exported so a menu item or consumer code can trigger
|
|
@@ -3288,11 +3801,11 @@ type GridTable = TMDataGridTable<TMDataGridRowData>;
|
|
|
3288
3801
|
* The lane a column renders in.
|
|
3289
3802
|
*
|
|
3290
3803
|
* Pinning splits the grid into three, and TanStack sequences them from two
|
|
3291
|
-
* different state slices: `columnPinning.
|
|
3804
|
+
* different state slices: `columnPinning.start` / `.end` order the pinned
|
|
3292
3805
|
* lanes, `columnOrder` orders the centre. A move therefore always stays inside
|
|
3293
3806
|
* one lane - moving a column into another one would be a pin, not a reorder.
|
|
3294
3807
|
*/
|
|
3295
|
-
type TMDataGridColumnRegion = "
|
|
3808
|
+
type TMDataGridColumnRegion = "start" | "center" | "end";
|
|
3296
3809
|
/** Which edge of the column under the pointer a dragged column lands on. */
|
|
3297
3810
|
type TMDataGridDropSide = "before" | "after";
|
|
3298
3811
|
declare function getColumnRegion(columnPinning: ColumnPinningState, columnId: string): TMDataGridColumnRegion;
|
|
@@ -3318,7 +3831,7 @@ declare function moveColumn({ table, columnId, targetId, side }: MoveColumnArgs)
|
|
|
3318
3831
|
* Puts the generated lanes back on the outside of both pinned lanes: the ones
|
|
3319
3832
|
* on the left before every consumer column, the edit lane after all of them.
|
|
3320
3833
|
*
|
|
3321
|
-
* `column.pin("
|
|
3834
|
+
* `column.pin("end")` appends, so pinning a column right would otherwise drop
|
|
3322
3835
|
* it outside the edit lane, so the row's Save and Delete would no longer be
|
|
3323
3836
|
* last in the row. Pinning left appends too, which is already correct there,
|
|
3324
3837
|
* but the same pass keeps both lanes in place whatever a consumer writes into
|
|
@@ -3444,4 +3957,4 @@ declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridF
|
|
|
3444
3957
|
*/
|
|
3445
3958
|
declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
|
|
3446
3959
|
//#endregion
|
|
3447
|
-
export { type
|
|
3960
|
+
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 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 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, mergeLabels, moveColumn, moveColumnByStep, normalizeFieldValidate, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, operatorTakesRangeValue, optionsToComboboxData, readFeatureFlags, resolveColumnOptions, resolveExpandAll, resolveExportOptions, resolveRangeBounds, resolveRowSelectionClick, toClipboardText, tsvFormat, useTMDataGrid, useTMDataGridContext, useTMDataGridExport, writeClipboardText, writeExportFile };
|