@jielga/tmdatagrid 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -2
- package/dist/index.d.ts +792 -327
- package/dist/index.js +1581 -892
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -7
- package/skills/columns/SKILL.md +8 -7
- package/skills/features/SKILL.md +104 -16
- package/skills/getting-started/SKILL.md +78 -20
- package/skills/options/SKILL.md +12 -7
- package/skills/server-side/SKILL.md +5 -2
- package/src/tmdatagrid/TMDataGridContext.ts +1 -1
- package/src/tmdatagrid/components/TMDataGrid.module.css +73 -0
- package/src/tmdatagrid/{TMDataGrid.tsx → components/TMDataGrid.tsx} +15 -4
- package/src/tmdatagrid/components/TMDataGridColumnsPanel.module.css +25 -0
- package/src/tmdatagrid/{TMDataGridColumnsPanel.tsx → components/TMDataGridColumnsPanel.tsx} +10 -4
- package/src/tmdatagrid/components/TMDataGridFilterPanel.module.css +35 -0
- package/src/tmdatagrid/{TMDataGridFilterPanel.tsx → components/TMDataGridFilterPanel.tsx} +91 -14
- package/src/tmdatagrid/components/TMDataGridFilterPills.module.css +35 -0
- package/src/tmdatagrid/components/TMDataGridFilterPills.tsx +135 -0
- package/src/tmdatagrid/components/TMDataGridFooter.module.css +18 -0
- package/src/tmdatagrid/components/TMDataGridFooter.tsx +171 -0
- package/src/tmdatagrid/components/TMDataGridGroupColumn.module.css +48 -0
- package/src/tmdatagrid/components/TMDataGridGroupColumn.tsx +147 -0
- package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +159 -0
- package/src/tmdatagrid/{TMDataGridHeaderCell.tsx → components/TMDataGridHeaderCell.tsx} +99 -14
- package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +177 -0
- package/src/tmdatagrid/components/TMDataGridTable.module.css +137 -0
- package/src/tmdatagrid/components/TMDataGridTable.tsx +720 -0
- package/src/tmdatagrid/components/TMDataGridToolbar.module.css +12 -0
- package/src/tmdatagrid/{TMDataGridToolbar.tsx → components/TMDataGridToolbar.tsx} +8 -5
- package/src/tmdatagrid/{icons.ts → components/icons.ts} +5 -0
- package/src/tmdatagrid/components/sticky.module.css +45 -0
- package/src/tmdatagrid/core/capabilities.ts +215 -0
- package/src/tmdatagrid/{columnOrdering.ts → core/columnOrdering.ts} +2 -2
- package/src/tmdatagrid/{columnUtils.ts → core/columnUtils.ts} +1 -1
- package/src/tmdatagrid/{filterOperators.ts → core/filterOperators.ts} +25 -0
- package/src/tmdatagrid/core/grouping.ts +21 -0
- package/src/tmdatagrid/{persistence.ts → core/persistence.ts} +92 -2
- package/src/tmdatagrid/core/rowSelection.ts +202 -0
- package/src/tmdatagrid/index.ts +39 -9
- package/src/tmdatagrid/useTMDataGrid.tsx +318 -66
- package/src/tmdatagrid/TMDataGrid.module.css +0 -410
- package/src/tmdatagrid/TMDataGridFooter.tsx +0 -74
- package/src/tmdatagrid/TMDataGridTable.tsx +0 -297
- package/src/tmdatagrid/capabilities.ts +0 -117
- /package/src/tmdatagrid/{sizes.ts → core/sizes.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { Store } from '@tanstack/store';
|
|
7
|
-
|
|
1
|
+
import { Cell, Column, ColumnPinningState, Row, RowData, RowSelectionState, Table, TableFeatures, TableOptions, TableState } from "@tanstack/react-table";
|
|
2
|
+
import { CSSProperties, ReactNode } from "react";
|
|
3
|
+
import { MantineSize, MenuProps } from "@mantine/core";
|
|
4
|
+
import { Store } from "@tanstack/store";
|
|
5
|
+
//#region .types-tmp/components/TMDataGridColumnsPanel.d.ts
|
|
8
6
|
/**
|
|
9
7
|
* The "Manage columns" surface. Reachable from every column header menu and
|
|
10
8
|
* from the grid's burger menu, so it lives on its own and is rendered by
|
|
11
9
|
* `TMDataGrid.ColumnsButton`.
|
|
12
10
|
*/
|
|
13
|
-
declare function TMDataGridColumnsPanel(): react.JSX.Element;
|
|
14
|
-
|
|
11
|
+
declare function TMDataGridColumnsPanel(): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region .types-tmp/components/TMDataGridFilterPanel.d.ts
|
|
15
14
|
/**
|
|
16
15
|
* The MUI-style filter surface: one row per active column filter, each row a
|
|
17
16
|
* column / operator / value triple. It only ever reads and writes the table's
|
|
18
17
|
* `columnFilters` state, so a `manualFiltering` grid gets the same panel for
|
|
19
18
|
* free — the state is forwarded to the server instead of a row model.
|
|
20
19
|
*/
|
|
21
|
-
declare function TMDataGridFilterPanel(): react.JSX.Element | null;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
pageSizeOptions?: ReadonlyArray<number>;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* MUI-style pager: "Rows per page · from–to of total · ‹ ›".
|
|
28
|
-
*
|
|
29
|
-
* Row totals come from `table.getRowCount()`, which prefers `options.rowCount`
|
|
30
|
-
* — so a server-paged grid shows the server's total without changes here.
|
|
31
|
-
*/
|
|
32
|
-
declare function TMDataGridFooter({ pageSizeOptions, }: TMDataGridFooterProps): react.JSX.Element;
|
|
33
|
-
|
|
20
|
+
declare function TMDataGridFilterPanel(): import("react").JSX.Element | null;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region .types-tmp/core/sizes.d.ts
|
|
34
23
|
type TMDataGridSize = MantineSize;
|
|
35
24
|
declare const DEFAULT_TMDATAGRID_SIZE: TMDataGridSize;
|
|
36
25
|
/**
|
|
@@ -43,7 +32,8 @@ declare const DEFAULT_TMDATAGRID_SIZE: TMDataGridSize;
|
|
|
43
32
|
declare const SIZE_ROW_HEIGHT: Record<TMDataGridSize, number>;
|
|
44
33
|
/** Size of the Mantine controls rendered inside the grid chrome. */
|
|
45
34
|
declare const SIZE_CONTROL_SIZE: Record<TMDataGridSize, MantineSize>;
|
|
46
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region .types-tmp/core/filterOperators.d.ts
|
|
47
37
|
/**
|
|
48
38
|
* The value shape stored in `columnFilters` for every TMDataGrid column.
|
|
49
39
|
*
|
|
@@ -53,8 +43,8 @@ declare const SIZE_CONTROL_SIZE: Record<TMDataGridSize, MantineSize>;
|
|
|
53
43
|
* `manualFiltering` table (just forward `columnFilters` to the API).
|
|
54
44
|
*/
|
|
55
45
|
type TMDataGridFilterValue = {
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
operator: TMDataGridFilterOperator;
|
|
47
|
+
value: string;
|
|
58
48
|
};
|
|
59
49
|
type TMDataGridColumnType = "string" | "number";
|
|
60
50
|
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "isEmpty" | "isNotEmpty";
|
|
@@ -65,13 +55,26 @@ declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
|
|
|
65
55
|
* are treated as inactive for the funnel indicator and for row matching.
|
|
66
56
|
*/
|
|
67
57
|
declare function isFilterActive(value: unknown): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* One-line description of a single filter, as shown on a filter pill.
|
|
60
|
+
*
|
|
61
|
+
* The type's default operator is left implicit — "First name: Sofia" reads the
|
|
62
|
+
* way a person would say it — while any other operator is spelled out, since
|
|
63
|
+
* that is the part a reader cannot guess.
|
|
64
|
+
*/
|
|
65
|
+
declare function formatFilterLabel({ label, type, filter }: {
|
|
66
|
+
label: string;
|
|
67
|
+
type: TMDataGridColumnType;
|
|
68
|
+
filter: TMDataGridFilterValue;
|
|
69
|
+
}): string;
|
|
68
70
|
/**
|
|
69
71
|
* The single filter function every TMDataGrid column uses. It dispatches on the
|
|
70
72
|
* operator carried by the filter value, which is what lets one column offer
|
|
71
73
|
* "contains" / "does not equal" / "is empty" without redefining the column.
|
|
72
74
|
*/
|
|
73
75
|
declare function tmDataGridFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown): boolean;
|
|
74
|
-
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region .types-tmp/core/persistence.d.ts
|
|
75
78
|
type GridState = TableState<TMDataGridFeatures>;
|
|
76
79
|
/**
|
|
77
80
|
* Persistence deliberately does not use Mantine's `useLocalStorage`.
|
|
@@ -92,12 +95,12 @@ type GridState = TableState<TMDataGridFeatures>;
|
|
|
92
95
|
* State slices describing what the user is looking at. Derived from the data,
|
|
93
96
|
* so they can go stale as it changes.
|
|
94
97
|
*/
|
|
95
|
-
declare const DATA_STATE_SLICES: readonly ["columnFilters", "globalFilter", "sorting", "pagination"];
|
|
98
|
+
declare const DATA_STATE_SLICES: readonly ["columnFilters", "globalFilter", "sorting", "pagination", "expanded"];
|
|
96
99
|
/**
|
|
97
100
|
* State slices describing how the user configured the grid. Independent of the
|
|
98
101
|
* data, and the ones users notice losing.
|
|
99
102
|
*/
|
|
100
|
-
declare const SETTINGS_STATE_SLICES: readonly ["columnVisibility", "columnSizing", "columnOrder", "columnPinning"];
|
|
103
|
+
declare const SETTINGS_STATE_SLICES: readonly ["columnVisibility", "columnSizing", "columnOrder", "columnPinning", "grouping"];
|
|
101
104
|
type TMDataGridDataSlice = (typeof DATA_STATE_SLICES)[number];
|
|
102
105
|
type TMDataGridSettingsSlice = (typeof SETTINGS_STATE_SLICES)[number];
|
|
103
106
|
/**
|
|
@@ -110,18 +113,35 @@ type TMDataGridPersistKey<TSlice extends string> = string | readonly [key: strin
|
|
|
110
113
|
/** Same values as Mantine's `StorageType`, which the package does not re-export. */
|
|
111
114
|
type TMDataGridStorageMode = "localStorage" | "sessionStorage";
|
|
112
115
|
type TMDataGridPersistence = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
/** Key for filters, global filter, sorting and pagination. */
|
|
117
|
+
dataKey?: TMDataGridPersistKey<TMDataGridDataSlice>;
|
|
118
|
+
/** Key for column visibility, sizing, order and pinning. */
|
|
119
|
+
settingsKey?: TMDataGridPersistKey<TMDataGridSettingsSlice>;
|
|
120
|
+
/** Which storage area to use. Defaults to `"localStorage"`. */
|
|
121
|
+
storageMode?: TMDataGridStorageMode;
|
|
122
|
+
/** Serializes a payload before it is stored. Defaults to `JSON.stringify`. */
|
|
123
|
+
serialize?: (value: Partial<GridState>) => string;
|
|
124
|
+
/** Parses a stored payload. Defaults to `JSON.parse`. */
|
|
125
|
+
deserialize?: (value: string) => unknown;
|
|
123
126
|
};
|
|
124
|
-
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region .types-tmp/TMDataGridContext.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Row shape the chrome components work against. They only ever touch columns,
|
|
131
|
+
* rows and cells generically, so the concrete row type is erased at the context
|
|
132
|
+
* boundary — the same trick Mantine uses for its compound components.
|
|
133
|
+
*/
|
|
134
|
+
type TMDataGridRowData = Record<string, unknown>;
|
|
135
|
+
type TMDataGridContextValue = TMDataGridApi<TMDataGridRowData> & {
|
|
136
|
+
size: TMDataGridSize;
|
|
137
|
+
/** Row height in px, already resolved from `size` and `meta.rowHeight`. */
|
|
138
|
+
rowHeight: number;
|
|
139
|
+
/** Mantine control size that pairs with `size`. */
|
|
140
|
+
controlSize: TMDataGridSize;
|
|
141
|
+
};
|
|
142
|
+
declare function useTMDataGridContext(): TMDataGridContextValue;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region .types-tmp/core/capabilities.d.ts
|
|
125
145
|
/**
|
|
126
146
|
* Table-level feature switches, read straight off the options object.
|
|
127
147
|
*
|
|
@@ -134,16 +154,76 @@ type TMDataGridPersistence = {
|
|
|
134
154
|
* TanStack still decides: these flags are combined with `getCanX()`, which is
|
|
135
155
|
* what applies the per-column overrides.
|
|
136
156
|
*/
|
|
157
|
+
/**
|
|
158
|
+
* How rows are selected — see `selectionMode` on {@link UseTMDataGridOptions}.
|
|
159
|
+
*
|
|
160
|
+
* One axis, because the two things a config could set independently — which
|
|
161
|
+
* chrome selects, and what a bare row click does — cannot both be free: a click
|
|
162
|
+
* can either toggle a multi-selection or move the highlight, never both. Folding
|
|
163
|
+
* them into one value makes that conflict unrepresentable rather than something
|
|
164
|
+
* to warn about.
|
|
165
|
+
*/
|
|
166
|
+
type TMDataGridSelectionMode =
|
|
167
|
+
/** Checkbox column, multi-select. Clicking a row elsewhere does nothing. */
|
|
168
|
+
"checkbox" |
|
|
169
|
+
/** No checkbox column; row click multi-selects, with Ctrl/Shift modifiers. */
|
|
170
|
+
"row" |
|
|
171
|
+
/** Checkbox column multi-selects, and a row click highlights one row. */
|
|
172
|
+
"checkboxAndHighlight" |
|
|
173
|
+
/** No selection at all — a row click only highlights. Master-detail. */
|
|
174
|
+
"highlight";
|
|
137
175
|
type TMDataGridFeatureFlags = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
176
|
+
sorting: boolean;
|
|
177
|
+
filtering: boolean;
|
|
178
|
+
hiding: boolean;
|
|
179
|
+
pinning: boolean;
|
|
180
|
+
resizing: boolean;
|
|
181
|
+
ordering: boolean;
|
|
182
|
+
/** Whether any row selection is possible. Off outright under `"highlight"`. */
|
|
183
|
+
rowSelection: boolean;
|
|
184
|
+
/** Defaults to `"checkbox"`. */
|
|
185
|
+
selectionMode: TMDataGridSelectionMode;
|
|
186
|
+
/** Whether the generated checkbox column is prepended. */
|
|
187
|
+
selectColumn: boolean;
|
|
188
|
+
/** Whether a bare row click toggles the selection. Only under `"row"`. */
|
|
189
|
+
rowClickSelects: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Whether more than one row can be selected at once — TanStack's
|
|
192
|
+
* `enableMultiRowSelection`. Off, the grid drops the select-all header
|
|
193
|
+
* checkbox: TanStack's `toggleAllRowsSelected` only consults `getCanSelect`,
|
|
194
|
+
* so that control would select every row and walk straight past the limit.
|
|
195
|
+
*
|
|
196
|
+
* A per-row predicate counts as on, since some rows may still multi-select.
|
|
197
|
+
*/
|
|
198
|
+
multiRowSelection: boolean;
|
|
199
|
+
/** Whether a selected row takes the highlight colour. Follows the mode. */
|
|
200
|
+
showSelectedBackground: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The single highlighted row — clicking a row highlights it, for a detail
|
|
203
|
+
* panel to follow. State of its own, not a slice of `rowSelection`, which is
|
|
204
|
+
* what lets it coexist with a checkbox multi-selection.
|
|
205
|
+
*/
|
|
206
|
+
highlightRow: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The one default-off flag: pagination must be asked for, either with the
|
|
209
|
+
* grid's `enablePagination` or implicitly by declaring `manualPagination`.
|
|
210
|
+
* Off, the grid renders every filtered row and relies on virtualization.
|
|
211
|
+
*/
|
|
212
|
+
pagination: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Row grouping: the "Group by" items in the header menu and the generated
|
|
215
|
+
* tree column. On unless `enableGrouping: false`, since an ungrouped grid
|
|
216
|
+
* looks and behaves exactly as it did before — `grouping` starts empty, and
|
|
217
|
+
* an empty grouping state passes straight through the row model.
|
|
218
|
+
*
|
|
219
|
+
* The exception is `manualPagination`, where the client holds one page rather
|
|
220
|
+
* than the whole set: grouping that page would build groups out of an
|
|
221
|
+
* arbitrary slice and quietly show wrong counts. A server-side grid that does
|
|
222
|
+
* its own grouping can still say `enableGrouping: true` to override.
|
|
223
|
+
*/
|
|
224
|
+
grouping: boolean;
|
|
145
225
|
};
|
|
146
|
-
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection">): TMDataGridFeatureFlags;
|
|
226
|
+
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection" | "enableMultiRowSelection" | "selectionMode" | "showSelectedBackground" | "enablePagination" | "manualPagination" | "enableGrouping">): TMDataGridFeatureFlags;
|
|
147
227
|
/**
|
|
148
228
|
* What one column's header may offer.
|
|
149
229
|
*
|
|
@@ -155,195 +235,229 @@ declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMData
|
|
|
155
235
|
* | Pin to left / right | `enableColumnPinning` / `enablePinning` |
|
|
156
236
|
* | Resize dragging | `enableColumnResizing` / `enableResizing` |
|
|
157
237
|
* | Header dragging, Move left / right | `enableColumnOrdering` / `meta.enableOrdering` |
|
|
238
|
+
* | Group by / Ungroup | `enableGrouping` (table or column) |
|
|
158
239
|
*/
|
|
159
240
|
type TMDataGridColumnCapabilities = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
241
|
+
canSort: boolean;
|
|
242
|
+
canFilter: boolean;
|
|
243
|
+
canHide: boolean;
|
|
244
|
+
canPin: boolean;
|
|
245
|
+
canResize: boolean;
|
|
246
|
+
canReorder: boolean;
|
|
247
|
+
canGroup: boolean;
|
|
166
248
|
};
|
|
167
249
|
declare function getColumnCapabilities(column: Column<TMDataGridFeatures, TMDataGridRowData, unknown>, features: TMDataGridFeatureFlags): TMDataGridColumnCapabilities;
|
|
168
250
|
/** The same questions, asked of the whole grid — used to hide toolbar buttons. */
|
|
169
251
|
type TMDataGridCapabilities = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
252
|
+
canSortAny: boolean;
|
|
253
|
+
canFilterAny: boolean;
|
|
254
|
+
canHideAny: boolean;
|
|
255
|
+
canPinAny: boolean;
|
|
256
|
+
canReorderAny: boolean;
|
|
257
|
+
canGroupAny: boolean;
|
|
258
|
+
canSelectRows: boolean;
|
|
259
|
+
canPaginate: boolean;
|
|
176
260
|
};
|
|
177
|
-
declare function getGridCapabilities(table: TMDataGridTable
|
|
178
|
-
|
|
179
|
-
|
|
261
|
+
declare function getGridCapabilities(table: TMDataGridTable<TMDataGridRowData>, features: TMDataGridFeatureFlags): TMDataGridCapabilities;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region .types-tmp/useTMDataGrid.d.ts
|
|
180
264
|
/** Per-column configuration the TMDataGrid chrome reads. */
|
|
181
265
|
type TMDataGridColumnMeta = {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
266
|
+
/** Name shown in menus and the column manager. Falls back to a string header. */
|
|
267
|
+
label?: string;
|
|
268
|
+
/** Drives which filter operators are offered. Defaults to `"string"`. */
|
|
269
|
+
type?: TMDataGridColumnType;
|
|
270
|
+
/** Share of the leftover width this column claims. Defaults to `1`. */
|
|
271
|
+
flex?: number;
|
|
272
|
+
align?: "left" | "right" | "center";
|
|
273
|
+
/**
|
|
274
|
+
* `false` keeps the column where it is: no header dragging, no move items.
|
|
275
|
+
* Column ordering is the one feature TanStack defines no column option for,
|
|
276
|
+
* so its switch lives here rather than on the column definition.
|
|
277
|
+
*/
|
|
278
|
+
enableOrdering?: boolean;
|
|
195
279
|
};
|
|
196
280
|
/** Grid-wide configuration passed through `options.meta`. */
|
|
197
281
|
type TMDataGridTableMeta = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
282
|
+
loading?: boolean;
|
|
283
|
+
noResultsLabel?: string;
|
|
284
|
+
/** Row height used by the virtualizer. Defaults to `52`. */
|
|
285
|
+
rowHeight?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Unfiltered row total. Only needed for server-driven grids, where the client
|
|
288
|
+
* never holds the full data set — `TMDataGrid.SummaryCount` uses it as denominator.
|
|
289
|
+
*/
|
|
290
|
+
totalRowCount?: number;
|
|
207
291
|
};
|
|
208
292
|
/**
|
|
209
293
|
* Every feature the TMDataGrid chrome can drive. Defined at module scope so the
|
|
210
294
|
* reference stays stable across renders (see the TanStack table-state skill).
|
|
211
295
|
*/
|
|
212
296
|
declare const tmDataGridFeatures: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
autoRemove: (val: any) => boolean;
|
|
241
|
-
};
|
|
242
|
-
between: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
243
|
-
autoRemove: (val: any) => boolean;
|
|
244
|
-
};
|
|
245
|
-
betweenInclusive: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
246
|
-
autoRemove: (val: any) => boolean;
|
|
247
|
-
};
|
|
248
|
-
equals: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
249
|
-
autoRemove: (val: any) => boolean;
|
|
250
|
-
};
|
|
251
|
-
equalsString: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
252
|
-
autoRemove: (val: any) => boolean;
|
|
253
|
-
};
|
|
254
|
-
inNumberRange: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
255
|
-
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
256
|
-
autoRemove: (val: any) => boolean;
|
|
257
|
-
};
|
|
258
|
-
includesString: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
259
|
-
autoRemove: (val: any) => boolean;
|
|
260
|
-
};
|
|
261
|
-
includesStringSensitive: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
262
|
-
autoRemove: (val: any) => boolean;
|
|
263
|
-
};
|
|
264
|
-
weakEquals: (<TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
265
|
-
autoRemove: (val: any) => boolean;
|
|
266
|
-
};
|
|
297
|
+
columnFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
298
|
+
globalFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
299
|
+
rowSortingFeature: import("@tanstack/table-core").TableFeature;
|
|
300
|
+
rowPaginationFeature: import("@tanstack/table-core").TableFeature;
|
|
301
|
+
rowSelectionFeature: import("@tanstack/table-core").TableFeature;
|
|
302
|
+
columnPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
303
|
+
columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
|
|
304
|
+
columnOrderingFeature: import("@tanstack/table-core").TableFeature;
|
|
305
|
+
columnSizingFeature: import("@tanstack/table-core").TableFeature;
|
|
306
|
+
columnResizingFeature: import("@tanstack/table-core").TableFeature;
|
|
307
|
+
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
308
|
+
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
309
|
+
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
310
|
+
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
311
|
+
groupedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
312
|
+
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
313
|
+
expandedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
314
|
+
paginatedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
315
|
+
facetedRowModel: (table: Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
316
|
+
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
317
|
+
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
318
|
+
filterFns: {
|
|
319
|
+
arrIncludes: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
320
|
+
autoRemove: (val: any) => boolean;
|
|
321
|
+
};
|
|
322
|
+
arrIncludesAll: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
323
|
+
autoRemove: (val: any) => boolean;
|
|
267
324
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
basic: <TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData>, rowB: _tanstack_table_core.Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
272
|
-
datetime: <TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData>, rowB: _tanstack_table_core.Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
273
|
-
text: <TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData>, rowB: _tanstack_table_core.Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
274
|
-
textCaseSensitive: <TFeatures extends _tanstack_table_core.TableFeatures, TData extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData>, rowB: _tanstack_table_core.Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
325
|
+
arrHas: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean;
|
|
326
|
+
arrIncludesSome: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
327
|
+
autoRemove: (val: any) => boolean;
|
|
275
328
|
};
|
|
276
|
-
|
|
277
|
-
|
|
329
|
+
between: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
330
|
+
autoRemove: (val: any) => boolean;
|
|
331
|
+
};
|
|
332
|
+
betweenInclusive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
333
|
+
autoRemove: (val: any) => boolean;
|
|
334
|
+
};
|
|
335
|
+
equals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
336
|
+
autoRemove: (val: any) => boolean;
|
|
337
|
+
};
|
|
338
|
+
equalsString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
339
|
+
autoRemove: (val: any) => boolean;
|
|
340
|
+
};
|
|
341
|
+
inNumberRange: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
342
|
+
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
343
|
+
autoRemove: (val: any) => boolean;
|
|
344
|
+
};
|
|
345
|
+
includesString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
346
|
+
autoRemove: (val: any) => boolean;
|
|
347
|
+
};
|
|
348
|
+
includesStringSensitive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
349
|
+
autoRemove: (val: any) => boolean;
|
|
350
|
+
};
|
|
351
|
+
weakEquals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
352
|
+
autoRemove: (val: any) => boolean;
|
|
353
|
+
};
|
|
354
|
+
tmDataGrid: typeof tmDataGridFilterFn;
|
|
355
|
+
};
|
|
356
|
+
sortFns: {
|
|
357
|
+
alphanumeric: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => number;
|
|
358
|
+
alphanumericCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => number;
|
|
359
|
+
basic: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
360
|
+
datetime: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
361
|
+
text: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
362
|
+
textCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData>, rowB: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string) => 0 | 1 | -1;
|
|
363
|
+
};
|
|
364
|
+
aggregationFns: {
|
|
365
|
+
sum: typeof import("@tanstack/table-core").aggregationFn_sum;
|
|
366
|
+
min: typeof import("@tanstack/table-core").aggregationFn_min;
|
|
367
|
+
max: typeof import("@tanstack/table-core").aggregationFn_max;
|
|
368
|
+
extent: typeof import("@tanstack/table-core").aggregationFn_extent;
|
|
369
|
+
mean: typeof import("@tanstack/table-core").aggregationFn_mean;
|
|
370
|
+
median: typeof import("@tanstack/table-core").aggregationFn_median;
|
|
371
|
+
unique: typeof import("@tanstack/table-core").aggregationFn_unique;
|
|
372
|
+
uniqueCount: typeof import("@tanstack/table-core").aggregationFn_uniqueCount;
|
|
373
|
+
count: typeof import("@tanstack/table-core").aggregationFn_count;
|
|
374
|
+
};
|
|
375
|
+
tableMeta: TMDataGridTableMeta;
|
|
376
|
+
columnMeta: TMDataGridColumnMeta;
|
|
278
377
|
};
|
|
279
378
|
type TMDataGridFeatures = typeof tmDataGridFeatures;
|
|
280
|
-
type TMDataGridTable
|
|
281
|
-
declare function createTMDataGridColumnHelper<TData extends RowData>():
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
323
|
-
inNumberRange: (<TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
324
|
-
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
325
|
-
autoRemove: (val: any) => boolean;
|
|
326
|
-
};
|
|
327
|
-
includesString: (<TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
328
|
-
autoRemove: (val: any) => boolean;
|
|
329
|
-
};
|
|
330
|
-
includesStringSensitive: (<TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
331
|
-
autoRemove: (val: any) => boolean;
|
|
332
|
-
};
|
|
333
|
-
weakEquals: (<TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(row: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
334
|
-
autoRemove: (val: any) => boolean;
|
|
335
|
-
};
|
|
379
|
+
type TMDataGridTable<TData extends RowData> = Table<TMDataGridFeatures, TData>;
|
|
380
|
+
declare function createTMDataGridColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<{
|
|
381
|
+
columnFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
382
|
+
globalFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
383
|
+
rowSortingFeature: import("@tanstack/table-core").TableFeature;
|
|
384
|
+
rowPaginationFeature: import("@tanstack/table-core").TableFeature;
|
|
385
|
+
rowSelectionFeature: import("@tanstack/table-core").TableFeature;
|
|
386
|
+
columnPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
387
|
+
columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
|
|
388
|
+
columnOrderingFeature: import("@tanstack/table-core").TableFeature;
|
|
389
|
+
columnSizingFeature: import("@tanstack/table-core").TableFeature;
|
|
390
|
+
columnResizingFeature: import("@tanstack/table-core").TableFeature;
|
|
391
|
+
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
392
|
+
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
393
|
+
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
394
|
+
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
395
|
+
groupedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
396
|
+
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
397
|
+
expandedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
398
|
+
paginatedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
399
|
+
facetedRowModel: (table: Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
400
|
+
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
401
|
+
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
402
|
+
filterFns: {
|
|
403
|
+
arrIncludes: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
404
|
+
autoRemove: (val: any) => boolean;
|
|
405
|
+
};
|
|
406
|
+
arrIncludesAll: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
407
|
+
autoRemove: (val: any) => boolean;
|
|
408
|
+
};
|
|
409
|
+
arrHas: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: Array<unknown>) => boolean;
|
|
410
|
+
arrIncludesSome: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: Array<unknown>) => boolean) & {
|
|
411
|
+
autoRemove: (val: any) => boolean;
|
|
412
|
+
};
|
|
413
|
+
between: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
414
|
+
autoRemove: (val: any) => boolean;
|
|
415
|
+
};
|
|
416
|
+
betweenInclusive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValues: [unknown, unknown]) => boolean) & {
|
|
417
|
+
autoRemove: (val: any) => boolean;
|
|
418
|
+
};
|
|
419
|
+
equals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
420
|
+
autoRemove: (val: any) => boolean;
|
|
336
421
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
alphanumericCaseSensitive: <TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData_1>, rowB: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string) => number;
|
|
340
|
-
basic: <TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData_1>, rowB: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
341
|
-
datetime: <TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData_1>, rowB: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
342
|
-
text: <TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData_1>, rowB: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
343
|
-
textCaseSensitive: <TFeatures extends _tanstack_table_core.TableFeatures, TData_1 extends RowData>(rowA: _tanstack_table_core.Row<TFeatures, TData_1>, rowB: _tanstack_table_core.Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
422
|
+
equalsString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
423
|
+
autoRemove: (val: any) => boolean;
|
|
344
424
|
};
|
|
345
|
-
|
|
346
|
-
|
|
425
|
+
inNumberRange: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: [number, number]) => boolean) & {
|
|
426
|
+
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
427
|
+
autoRemove: (val: any) => boolean;
|
|
428
|
+
};
|
|
429
|
+
includesString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
430
|
+
autoRemove: (val: any) => boolean;
|
|
431
|
+
};
|
|
432
|
+
includesStringSensitive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
433
|
+
autoRemove: (val: any) => boolean;
|
|
434
|
+
};
|
|
435
|
+
weakEquals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string, filterValue: unknown) => boolean) & {
|
|
436
|
+
autoRemove: (val: any) => boolean;
|
|
437
|
+
};
|
|
438
|
+
tmDataGrid: typeof tmDataGridFilterFn;
|
|
439
|
+
};
|
|
440
|
+
sortFns: {
|
|
441
|
+
alphanumeric: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => number;
|
|
442
|
+
alphanumericCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => number;
|
|
443
|
+
basic: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
444
|
+
datetime: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
445
|
+
text: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
446
|
+
textCaseSensitive: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: import("@tanstack/table-core").Row<TFeatures, TData_1>, rowB: import("@tanstack/table-core").Row<TFeatures, TData_1>, columnId: string) => 0 | 1 | -1;
|
|
447
|
+
};
|
|
448
|
+
aggregationFns: {
|
|
449
|
+
sum: typeof import("@tanstack/table-core").aggregationFn_sum;
|
|
450
|
+
min: typeof import("@tanstack/table-core").aggregationFn_min;
|
|
451
|
+
max: typeof import("@tanstack/table-core").aggregationFn_max;
|
|
452
|
+
extent: typeof import("@tanstack/table-core").aggregationFn_extent;
|
|
453
|
+
mean: typeof import("@tanstack/table-core").aggregationFn_mean;
|
|
454
|
+
median: typeof import("@tanstack/table-core").aggregationFn_median;
|
|
455
|
+
unique: typeof import("@tanstack/table-core").aggregationFn_unique;
|
|
456
|
+
uniqueCount: typeof import("@tanstack/table-core").aggregationFn_uniqueCount;
|
|
457
|
+
count: typeof import("@tanstack/table-core").aggregationFn_count;
|
|
458
|
+
};
|
|
459
|
+
tableMeta: TMDataGridTableMeta;
|
|
460
|
+
columnMeta: TMDataGridColumnMeta;
|
|
347
461
|
}, TData>;
|
|
348
462
|
/**
|
|
349
463
|
* Chrome state that is *not* table state: which panels are open, and which
|
|
@@ -351,50 +465,143 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): _tanstac
|
|
|
351
465
|
* subscribe to it the same way they subscribe to `table.store`.
|
|
352
466
|
*/
|
|
353
467
|
type TMDataGridUiState = {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
468
|
+
filterPanelOpen: boolean;
|
|
469
|
+
columnsPanelOpen: boolean;
|
|
470
|
+
/** Column whose filter row should be focused when the panel opens. */
|
|
471
|
+
filterPanelColumnId: string | null;
|
|
472
|
+
/**
|
|
473
|
+
* Column being dragged by its header, if any. Held here rather than read from
|
|
474
|
+
* `dataTransfer`, which browsers keep unreadable until the drop.
|
|
475
|
+
*/
|
|
476
|
+
draggedColumnId: string | null;
|
|
477
|
+
/**
|
|
478
|
+
* The single highlighted row — the one a detail panel would be showing. Its
|
|
479
|
+
* own concept, not a slice of `rowSelection`: under
|
|
480
|
+
* `selectionMode: "checkboxAndHighlight"` the two coexist, and TanStack's one
|
|
481
|
+
* selection map cannot hold both.
|
|
482
|
+
*
|
|
483
|
+
* Not pruned when the row is filtered out, paged away or dropped from `data`,
|
|
484
|
+
* matching how TanStack treats `rowSelection` — nothing there resets it
|
|
485
|
+
* either. The row simply renders unhighlighted, and highlights again if it
|
|
486
|
+
* comes back.
|
|
487
|
+
*/
|
|
488
|
+
highlightedRowId: string | null;
|
|
489
|
+
/** The pivot a shift-click extends from. See resolveRowSelectionClick. */
|
|
490
|
+
selectionAnchorRowId: string | null;
|
|
363
491
|
};
|
|
364
492
|
type TMDataGridUiActions = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
493
|
+
openFilterPanel: (columnId?: string | null) => void;
|
|
494
|
+
closeFilterPanel: () => void;
|
|
495
|
+
setColumnsPanelOpen: (open: boolean) => void;
|
|
496
|
+
toggleColumnsPanel: () => void;
|
|
497
|
+
startColumnDrag: (columnId: string) => void;
|
|
498
|
+
endColumnDrag: () => void;
|
|
499
|
+
/**
|
|
500
|
+
* Moves the active row, or clears it with `null` — which is how a consumer
|
|
501
|
+
* closing its detail panel puts the grid back in step.
|
|
502
|
+
*/
|
|
503
|
+
setHighlightedRow: (rowId: string | null) => void;
|
|
504
|
+
setSelectionAnchor: (rowId: string | null) => void;
|
|
371
505
|
};
|
|
372
506
|
type TMDataGridUiStore = Store<TMDataGridUiState, TMDataGridUiActions>;
|
|
373
507
|
/** What `useTMDataGrid` returns — spread straight onto `<TMDataGrid />`. */
|
|
374
508
|
type TMDataGridApi<TData extends RowData> = {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
509
|
+
table: TMDataGridTable<TData>;
|
|
510
|
+
ui: TMDataGridUiStore;
|
|
511
|
+
/** Table-level feature switches, re-read from options on every render. */
|
|
512
|
+
features: TMDataGridFeatureFlags;
|
|
379
513
|
};
|
|
380
514
|
type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridFeatures, TData>, "features"> & {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Restore and persist table state across mounts. Two keys, because the two
|
|
517
|
+
* kinds of state have different lifetimes — see {@link TMDataGridPersistence}.
|
|
518
|
+
*
|
|
519
|
+
* Keep the object referentially stable (module scope or `useMemo`); it is a
|
|
520
|
+
* dependency of the subscription that writes back.
|
|
521
|
+
*/
|
|
522
|
+
persist?: TMDataGridPersistence;
|
|
523
|
+
/**
|
|
524
|
+
* Header drag-and-drop and the move items in the column menu. Defaults to
|
|
525
|
+
* `true`.
|
|
526
|
+
*
|
|
527
|
+
* The one feature switch the grid defines itself: TanStack's
|
|
528
|
+
* `columnOrderingFeature` ships state and APIs but no `enable` option, since
|
|
529
|
+
* reordering is entirely a matter of interface.
|
|
530
|
+
*/
|
|
531
|
+
enableColumnOrdering?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Client-side pagination and the built-in `TMDataGrid.Footer` pager.
|
|
534
|
+
* Defaults to `false`: the grid renders every filtered row and relies on
|
|
535
|
+
* virtualization.
|
|
536
|
+
*
|
|
537
|
+
* The second grid-defined switch (TanStack defines no `enablePagination`
|
|
538
|
+
* option). `manualPagination: true` implies it — a server-paged grid needs
|
|
539
|
+
* no extra flag.
|
|
540
|
+
*/
|
|
541
|
+
enablePagination?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* How rows are selected. Defaults to `"checkbox"`.
|
|
544
|
+
*
|
|
545
|
+
* | Mode | Checkbox column | Row click |
|
|
546
|
+
* | ---- | --------------- | --------- |
|
|
547
|
+
* | `"checkbox"` | yes, multi-select | nothing |
|
|
548
|
+
* | `"row"` | no | multi-selects, Ctrl/Shift modifiers |
|
|
549
|
+
* | `"checkboxAndHighlight"` | yes, multi-select | highlights one row |
|
|
550
|
+
* | `"highlight"` | no | highlights one row, no selection at all |
|
|
551
|
+
*
|
|
552
|
+
* One option rather than two, so the combination that cannot work — a click
|
|
553
|
+
* that both toggles a multi-selection and moves the highlight — is not
|
|
554
|
+
* expressible.
|
|
555
|
+
*
|
|
556
|
+
* The first two write to TanStack's `rowSelection`. The highlight is separate
|
|
557
|
+
* state, which is what lets `"checkboxAndHighlight"` run both at once: tick
|
|
558
|
+
* rows for a bulk action, click one to open its detail panel. See
|
|
559
|
+
* `defaultHighlightedRowId` / `onHighlightedRowChange`.
|
|
560
|
+
*
|
|
561
|
+
* `enableRowSelection` still gates the selection half, predicate form
|
|
562
|
+
* included; under `"highlight"` there is nothing for it to gate.
|
|
563
|
+
*/
|
|
564
|
+
selectionMode?: TMDataGridSelectionMode;
|
|
565
|
+
/**
|
|
566
|
+
* Give selected rows the highlight background. Defaults to `true` under
|
|
567
|
+
* `selectionMode: "row"`, where the highlight is the only feedback a click
|
|
568
|
+
* gives, and `false` under `"checkbox"`, where the box already shows it.
|
|
569
|
+
*
|
|
570
|
+
* The colour is the `--dg-row-selected-bg` CSS variable, so it can be changed
|
|
571
|
+
* without turning the flag on or off:
|
|
572
|
+
*
|
|
573
|
+
* ```tsx
|
|
574
|
+
* <TMDataGrid
|
|
575
|
+
* {...grid}
|
|
576
|
+
* style={{ "--dg-row-selected-bg": "var(--mantine-color-blue-0)" }}
|
|
577
|
+
* />
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
showSelectedBackground?: boolean;
|
|
581
|
+
/**
|
|
582
|
+
* The row that starts out highlighted, under a `selectionMode` that has a
|
|
583
|
+
* highlight. Read once on mount, like `initialState`.
|
|
584
|
+
*
|
|
585
|
+
* The grid never persists the highlighted row. Pair this with
|
|
586
|
+
* {@link onHighlightedRowChange} and keep it wherever it belongs — for a
|
|
587
|
+
* detail panel that is usually the route, which gets you a shareable link and
|
|
588
|
+
* a working back button as well as surviving a reload:
|
|
589
|
+
*
|
|
590
|
+
* ```tsx
|
|
591
|
+
* const { rowId } = useParams();
|
|
592
|
+
* useTMDataGrid({
|
|
593
|
+
* selectionMode: "highlight",
|
|
594
|
+
* defaultHighlightedRowId: rowId,
|
|
595
|
+
* onHighlightedRowChange: (id) => navigate(id ? `/employees/${id}` : "/employees"),
|
|
596
|
+
* });
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
defaultHighlightedRowId?: string | null;
|
|
600
|
+
/**
|
|
601
|
+
* Called with the newly highlighted row id, or `null` when it is cleared.
|
|
602
|
+
* Fires for `ui.actions.setHighlightedRow` too, not only for clicks.
|
|
603
|
+
*/
|
|
604
|
+
onHighlightedRowChange?: (rowId: string | null) => void;
|
|
398
605
|
};
|
|
399
606
|
/**
|
|
400
607
|
* Builds a TMDataGrid table plus its chrome store.
|
|
@@ -403,81 +610,209 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
403
610
|
* only needs `manualPagination` / `manualFiltering` / `manualSorting`,
|
|
404
611
|
* `rowCount` and the matching `onXChange` callbacks — the chrome reads
|
|
405
612
|
* `getRowCount()` / `getPageCount()` / `getPaginatedRowModel()`, all of which
|
|
406
|
-
* already respect manual mode.
|
|
613
|
+
* already respect manual mode. `manualPagination` also switches the pagination
|
|
614
|
+
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
615
|
+
* options.
|
|
407
616
|
*/
|
|
408
|
-
declare function useTMDataGrid<TData extends RowData>({ persist, enableColumnOrdering, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
617
|
+
declare function useTMDataGrid<TData extends RowData>({ persist, enableColumnOrdering, enablePagination, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
409
618
|
/**
|
|
410
619
|
* Opens the filter panel for a column, seeding an empty filter row when the
|
|
411
620
|
* column has none yet — mirrors "Filter" in the column header menu.
|
|
412
621
|
*/
|
|
413
622
|
declare function openColumnFilter<TData extends RowData>(api: TMDataGridApi<TData>, columnId: string): void;
|
|
414
|
-
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region .types-tmp/components/TMDataGridFilterPills.d.ts
|
|
625
|
+
type TMDataGridFilterPillsProps<TData extends RowData> = {
|
|
626
|
+
/** The object returned by `useTMDataGrid`. */
|
|
627
|
+
api: TMDataGridApi<TData>;
|
|
628
|
+
/** Mantine size of the pills. Defaults to `"sm"`. */
|
|
629
|
+
size?: TMDataGridSize;
|
|
630
|
+
/** "Clear all" button, shown once two filters are active. Defaults to `true`. */
|
|
631
|
+
showClearAll?: boolean;
|
|
632
|
+
/**
|
|
633
|
+
* Replaces what a click on a pill's label does. The default opens the grid's
|
|
634
|
+
* filter panel on that column.
|
|
635
|
+
*/
|
|
636
|
+
onPillClick?: (columnId: string) => void;
|
|
637
|
+
className?: string;
|
|
638
|
+
};
|
|
415
639
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
640
|
+
* One pill per active filter — `First name: Sofia ✕` — with the ✕ clearing that
|
|
641
|
+
* filter and a click on the label opening the filter panel on its column.
|
|
642
|
+
*
|
|
643
|
+
* The one grid component that takes the api as a prop instead of reading
|
|
644
|
+
* context, so it can live anywhere: a page header, a card title, a breadcrumb
|
|
645
|
+
* row. Renders nothing while no filter is active.
|
|
646
|
+
*
|
|
647
|
+
* ```tsx
|
|
648
|
+
* const grid = useTMDataGrid({ data, columns });
|
|
649
|
+
*
|
|
650
|
+
* <Group>
|
|
651
|
+
* <Title order={3}>Employees</Title>
|
|
652
|
+
* <TMDataGridFilterPills api={grid} />
|
|
653
|
+
* </Group>
|
|
654
|
+
* ```
|
|
655
|
+
*
|
|
656
|
+
* Half-typed filters are left out: a filter that is not narrowing the rows yet
|
|
657
|
+
* has nothing to report, which is the same rule the funnel indicator uses.
|
|
419
658
|
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
659
|
+
declare function TMDataGridFilterPills<TData extends RowData>({ api, size, showClearAll, onPillClick, className }: TMDataGridFilterPillsProps<TData>): import("react").JSX.Element | null;
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region .types-tmp/components/TMDataGridFooter.d.ts
|
|
662
|
+
/** Distilled pagination state and actions for building a custom pager. */
|
|
663
|
+
type TMDataGridPaginationApi = {
|
|
664
|
+
pageIndex: number;
|
|
665
|
+
pageSize: number;
|
|
666
|
+
/** `-1` when a manual grid declares `pageCount: -1` (unknown total). */
|
|
667
|
+
pageCount: number;
|
|
668
|
+
rowCount: number;
|
|
669
|
+
canPreviousPage: boolean;
|
|
670
|
+
canNextPage: boolean;
|
|
671
|
+
setPageIndex: (pageIndex: number) => void;
|
|
672
|
+
setPageSize: (pageSize: number) => void;
|
|
673
|
+
previousPage: () => void;
|
|
674
|
+
nextPage: () => void;
|
|
675
|
+
firstPage: () => void;
|
|
676
|
+
lastPage: () => void;
|
|
427
677
|
};
|
|
428
|
-
|
|
429
|
-
|
|
678
|
+
/**
|
|
679
|
+
* Reads {@link TMDataGridPaginationApi} off a table. The Footer feeds it to the
|
|
680
|
+
* `pagination` render prop; a pager living outside the Footer can call it with
|
|
681
|
+
* the table from `useTMDataGrid` directly.
|
|
682
|
+
*/
|
|
683
|
+
declare function getTMDataGridPaginationApi<TData extends RowData>(table: TMDataGridTable<TData>): TMDataGridPaginationApi;
|
|
684
|
+
type TMDataGridFooterProps = {
|
|
685
|
+
pageSizeOptions?: ReadonlyArray<number>;
|
|
686
|
+
/** Replaces the built-in pager. Receives the distilled pagination API. */
|
|
687
|
+
pagination?: (api: TMDataGridPaginationApi) => ReactNode;
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* MUI-style pager: "Rows per page · from–to of total · ‹ ›".
|
|
691
|
+
*
|
|
692
|
+
* Renders nothing unless pagination is enabled (`enablePagination` or
|
|
693
|
+
* `manualPagination`) — the footer is a pager; extra footer content belongs in
|
|
694
|
+
* your own layout.
|
|
695
|
+
*
|
|
696
|
+
* Row totals come from `table.getRowCount()`, which prefers `options.rowCount`
|
|
697
|
+
* — so a server-paged grid shows the server's total without changes here.
|
|
698
|
+
*/
|
|
699
|
+
declare function TMDataGridFooter({ pageSizeOptions, pagination }: TMDataGridFooterProps): import("react").JSX.Element | null;
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region .types-tmp/components/TMDataGridTable.d.ts
|
|
430
702
|
/** Where a column sits relative to the pinned regions, resolved once per render. */
|
|
431
703
|
type TMDataGridColumnLayout = {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
704
|
+
pinnedAt: "left" | "right" | false;
|
|
705
|
+
/** Distance in px from the grid's left or right edge. */
|
|
706
|
+
offset: number;
|
|
707
|
+
/** Last left-pinned / first right-pinned column — the one that casts the edge. */
|
|
708
|
+
isBoundary: boolean;
|
|
709
|
+
};
|
|
710
|
+
/** What a `rowContextMenu` render prop is handed for the right-clicked row. */
|
|
711
|
+
type TMDataGridRowContextMenuArgs<TData extends RowData> = {
|
|
712
|
+
table: Table<TMDataGridFeatures, TData>;
|
|
713
|
+
row: Row<TMDataGridFeatures, TData>;
|
|
714
|
+
/**
|
|
715
|
+
* The cell under the pointer. `null` only when the right-click landed on the
|
|
716
|
+
* row but on no cell — which a custom cell renderer that stops propagation
|
|
717
|
+
* can cause.
|
|
718
|
+
*/
|
|
719
|
+
cell: Cell<TMDataGridFeatures, TData, unknown> | null;
|
|
720
|
+
/**
|
|
721
|
+
* Closes the menu. `Menu.Item` already closes on click (Mantine's
|
|
722
|
+
* `closeOnItemClick`), so this is for content that isn't a menu item.
|
|
723
|
+
*/
|
|
724
|
+
close: () => void;
|
|
437
725
|
};
|
|
726
|
+
/**
|
|
727
|
+
* Builds the contents of a row's context menu — `Menu.Item`, `Menu.Label`,
|
|
728
|
+
* `Menu.Divider`, `Menu.Sub`, or any other node. The grid owns the `Menu` and
|
|
729
|
+
* its `Menu.Dropdown`; this fills the dropdown.
|
|
730
|
+
*/
|
|
731
|
+
type TMDataGridRowContextMenu<TData extends RowData> = (args: TMDataGridRowContextMenuArgs<TData>) => ReactNode;
|
|
438
732
|
type TMDataGridTableProps<TData extends RowData> = {
|
|
439
|
-
|
|
440
|
-
|
|
733
|
+
/**
|
|
734
|
+
* Called when a body row is clicked. Runs in addition to row selection under
|
|
735
|
+
* `selectionMode: "row"`, not instead of it.
|
|
736
|
+
*/
|
|
737
|
+
onRowClick?: (row: Row<TMDataGridFeatures, TData>) => void;
|
|
738
|
+
/**
|
|
739
|
+
* Contents of the menu a right-click on a row opens, at the pointer. Return
|
|
740
|
+
* `null` to leave a row without one — the browser's own menu stays suppressed
|
|
741
|
+
* either way.
|
|
742
|
+
*
|
|
743
|
+
* ```tsx
|
|
744
|
+
* <TMDataGrid.Table<Employee>
|
|
745
|
+
* rowContextMenu={({ row, close }) => (
|
|
746
|
+
* <>
|
|
747
|
+
* <Menu.Label>{row.original.firstName}</Menu.Label>
|
|
748
|
+
* <Menu.Item onClick={() => open(row.original.id)}>Open</Menu.Item>
|
|
749
|
+
* <Menu.Divider />
|
|
750
|
+
* <Menu.Item color="red" onClick={() => remove(row.original.id)}>
|
|
751
|
+
* Delete
|
|
752
|
+
* </Menu.Item>
|
|
753
|
+
* </>
|
|
754
|
+
* )}
|
|
755
|
+
* />
|
|
756
|
+
* ```
|
|
757
|
+
*
|
|
758
|
+
* Called during render, and only for the row whose menu is open — so it stays
|
|
759
|
+
* a pure function of the row, and cost per row does not matter.
|
|
760
|
+
*/
|
|
761
|
+
rowContextMenu?: TMDataGridRowContextMenu<TData>;
|
|
762
|
+
/**
|
|
763
|
+
* Passed to the Mantine `Menu` the grid wraps the row in — `width`, `shadow`,
|
|
764
|
+
* `position`, `transitionProps` and the rest. Its open state is the grid's.
|
|
765
|
+
*/
|
|
766
|
+
rowContextMenuProps?: Omit<MenuProps, "opened" | "onChange" | "children">;
|
|
441
767
|
};
|
|
442
768
|
/**
|
|
443
769
|
* The scrollable grid surface. Always virtualized: only the rows inside the
|
|
444
|
-
* viewport (plus overscan) are mounted
|
|
770
|
+
* viewport (plus overscan) are mounted — which is what makes the default
|
|
771
|
+
* no-pagination mode viable at any row count. Pagination is opt-in via
|
|
772
|
+
* `enablePagination` (or implied by `manualPagination`).
|
|
445
773
|
*/
|
|
446
|
-
declare function TMDataGridTable<TData extends RowData = TMDataGridRowData>({ onRowClick, }: TMDataGridTableProps<TData>): react.JSX.Element;
|
|
447
|
-
|
|
774
|
+
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, rowContextMenu, rowContextMenuProps }: TMDataGridTableProps<TData>): import("react").JSX.Element;
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region .types-tmp/components/TMDataGridToolbar.d.ts
|
|
448
777
|
/** Row above the grid. Compose it from the pieces below, or anything else. */
|
|
449
778
|
declare function TMDataGridToolbar({ children }: {
|
|
450
|
-
|
|
451
|
-
}): react.JSX.Element;
|
|
779
|
+
children?: ReactNode;
|
|
780
|
+
}): import("react").JSX.Element;
|
|
452
781
|
/** Pushes the following toolbar items to the right. */
|
|
453
|
-
declare function TMDataGridToolbarSpacer(): react.JSX.Element;
|
|
782
|
+
declare function TMDataGridToolbarSpacer(): import("react").JSX.Element;
|
|
454
783
|
/**
|
|
455
784
|
* Visible rows over total rows. On a server-driven grid, set
|
|
456
785
|
* `meta.totalRowCount` for the denominator — the client never sees every row.
|
|
457
786
|
*/
|
|
458
787
|
declare function TMDataGridSummaryCount({ children }: {
|
|
459
|
-
|
|
460
|
-
}): react.JSX.Element;
|
|
788
|
+
children?: ReactNode;
|
|
789
|
+
}): import("react").JSX.Element;
|
|
461
790
|
/**
|
|
462
791
|
* Burger menu in the grid's top-right corner — opens "Manage columns".
|
|
463
792
|
* Renders nothing when no column can be hidden (`enableHiding: false`).
|
|
464
793
|
*/
|
|
465
|
-
declare function TMDataGridColumnsButton(): react.JSX.Element | null;
|
|
794
|
+
declare function TMDataGridColumnsButton(): import("react").JSX.Element | null;
|
|
466
795
|
/**
|
|
467
796
|
* Toggles the filter panel, seeding a filter row on the first filterable column.
|
|
468
797
|
* Renders nothing when no column can be filtered (`enableColumnFilters: false`).
|
|
469
798
|
*/
|
|
470
|
-
declare function TMDataGridFilterButton(): react.JSX.Element | null;
|
|
471
|
-
|
|
799
|
+
declare function TMDataGridFilterButton(): import("react").JSX.Element | null;
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region .types-tmp/components/TMDataGrid.d.ts
|
|
472
802
|
type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
803
|
+
children: ReactNode;
|
|
804
|
+
/**
|
|
805
|
+
* Mantine size scale. Drives row height, font size, cell padding and the
|
|
806
|
+
* size of the controls in the chrome. `meta.rowHeight` still wins if set.
|
|
807
|
+
*/
|
|
808
|
+
size?: TMDataGridSize;
|
|
809
|
+
className?: string;
|
|
810
|
+
/**
|
|
811
|
+
* Inline styles. Widened to accept CSS variables, which is how the grid's
|
|
812
|
+
* colours are themed — `--dg-row-selected-bg` for the selected row
|
|
813
|
+
* background. Plain `CSSProperties` rejects `--*` keys.
|
|
814
|
+
*/
|
|
815
|
+
style?: CSSProperties & Record<`--${string}`, string | number>;
|
|
481
816
|
};
|
|
482
817
|
/**
|
|
483
818
|
* Root of the grid. Takes the object returned by `useTMDataGrid` — spread it —
|
|
@@ -497,34 +832,54 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
497
832
|
* </TMDataGrid>
|
|
498
833
|
* ```
|
|
499
834
|
*/
|
|
500
|
-
declare function TMDataGridRoot<TData extends RowData>({ table, ui, features, size, children, className, style
|
|
835
|
+
declare function TMDataGridRoot<TData extends RowData>({ table, ui, features, size, children, className, style }: TMDataGridProps<TData>): import("react").JSX.Element;
|
|
501
836
|
declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
837
|
+
Toolbar: typeof TMDataGridToolbar;
|
|
838
|
+
Spacer: typeof TMDataGridToolbarSpacer;
|
|
839
|
+
SummaryCount: typeof TMDataGridSummaryCount;
|
|
840
|
+
ColumnsButton: typeof TMDataGridColumnsButton;
|
|
841
|
+
FilterButton: typeof TMDataGridFilterButton;
|
|
842
|
+
Table: typeof TMDataGridTable$1;
|
|
843
|
+
Footer: typeof TMDataGridFooter;
|
|
844
|
+
/** Rendered by `TMDataGrid.Table`; exported for custom layouts. */
|
|
845
|
+
FilterPanel: typeof TMDataGridFilterPanel;
|
|
846
|
+
/**
|
|
847
|
+
* Takes the grid as an `api` prop rather than from context, so it can be
|
|
848
|
+
* rendered outside `<TMDataGrid>` — a page header, for instance.
|
|
849
|
+
*/
|
|
850
|
+
FilterPills: typeof TMDataGridFilterPills;
|
|
851
|
+
/** Rendered by `TMDataGrid.ColumnsButton`; exported for custom layouts. */
|
|
852
|
+
ColumnsPanel: typeof TMDataGridColumnsPanel;
|
|
513
853
|
};
|
|
514
|
-
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region .types-tmp/components/TMDataGridSelectColumn.d.ts
|
|
856
|
+
declare const SELECT_COLUMN_ID = "__select__";
|
|
857
|
+
//#endregion
|
|
858
|
+
//#region .types-tmp/components/TMDataGridGroupColumn.d.ts
|
|
859
|
+
declare const GROUP_COLUMN_ID = "__group__";
|
|
860
|
+
/**
|
|
861
|
+
* How a grouping value is written into the tree cell.
|
|
862
|
+
*
|
|
863
|
+
* Deliberately not the grouped column's own `cell` renderer: that renderer is
|
|
864
|
+
* written for a data row and is free to reach into `row.original`, which on a
|
|
865
|
+
* group row is the first leaf's record rather than anything about the group.
|
|
866
|
+
*/
|
|
867
|
+
declare function formatGroupValue(value: unknown): string;
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region .types-tmp/core/columnUtils.d.ts
|
|
515
870
|
/**
|
|
516
871
|
* Structural shape of the column bits the chrome reads. Kept minimal so these
|
|
517
872
|
* helpers work with any `Column`/`Header` instance without dragging generics
|
|
518
873
|
* through every call site.
|
|
519
874
|
*/
|
|
520
875
|
type ColumnLike = {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
876
|
+
id: string;
|
|
877
|
+
columnDef: {
|
|
878
|
+
header?: unknown;
|
|
879
|
+
meta?: TMDataGridColumnMeta;
|
|
880
|
+
};
|
|
881
|
+
/** Set on a leaf that sits inside a header group. */
|
|
882
|
+
parent?: unknown;
|
|
528
883
|
};
|
|
529
884
|
/** Menu- and panel-facing column name. */
|
|
530
885
|
declare function getColumnLabel(column: ColumnLike): string;
|
|
@@ -538,9 +893,25 @@ declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
|
538
893
|
* columns that no longer belong to it.
|
|
539
894
|
*/
|
|
540
895
|
declare function isColumnReorderable(column: ColumnLike): boolean;
|
|
541
|
-
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region .types-tmp/core/grouping.d.ts
|
|
898
|
+
/**
|
|
899
|
+
* The data rows under a group row, at any depth.
|
|
900
|
+
*
|
|
901
|
+
* Not `row.getLeafRows()`, despite the name: that flattens the whole subtree
|
|
902
|
+
* and keeps the branches, so a group nested two deep reports its sub-groups
|
|
903
|
+
* alongside the records. Grouping `city` then `name` would have Stockholm
|
|
904
|
+
* counting four rows and three names as seven, and one tick on it selecting
|
|
905
|
+
* ids that hold no record.
|
|
906
|
+
*
|
|
907
|
+
* A row with no subRows is a data row, which also makes this the identity on an
|
|
908
|
+
* ungrouped grid.
|
|
909
|
+
*/
|
|
910
|
+
declare function getGroupDataRows<TData extends RowData>(row: Row<TMDataGridFeatures, TData>): Array<Row<TMDataGridFeatures, TData>>;
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region .types-tmp/core/columnOrdering.d.ts
|
|
542
913
|
type GridColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
543
|
-
type GridTable = TMDataGridTable
|
|
914
|
+
type GridTable = TMDataGridTable<TMDataGridRowData>;
|
|
544
915
|
/**
|
|
545
916
|
* The lane a column renders in.
|
|
546
917
|
*
|
|
@@ -554,12 +925,12 @@ type TMDataGridColumnRegion = "left" | "center" | "right";
|
|
|
554
925
|
type TMDataGridDropSide = "before" | "after";
|
|
555
926
|
declare function getColumnRegion(columnPinning: ColumnPinningState, columnId: string): TMDataGridColumnRegion;
|
|
556
927
|
type MoveColumnArgs = {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
928
|
+
table: GridTable;
|
|
929
|
+
/** Column being moved. */
|
|
930
|
+
columnId: string;
|
|
931
|
+
/** Column it was dropped on. */
|
|
932
|
+
targetId: string;
|
|
933
|
+
side: TMDataGridDropSide;
|
|
563
934
|
};
|
|
564
935
|
/**
|
|
565
936
|
* Moves a column next to another one. A no-op when the two are in different
|
|
@@ -570,12 +941,12 @@ type MoveColumnArgs = {
|
|
|
570
941
|
* unpinned. Pinned lanes are read from `columnPinning`, so a move inside one
|
|
571
942
|
* updates that array as well.
|
|
572
943
|
*/
|
|
573
|
-
declare function moveColumn({ table, columnId, targetId, side
|
|
944
|
+
declare function moveColumn({ table, columnId, targetId, side }: MoveColumnArgs): void;
|
|
574
945
|
type ColumnStepArgs = {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
946
|
+
table: GridTable;
|
|
947
|
+
columnId: string;
|
|
948
|
+
/** `-1` moves towards the start of the lane, `1` towards its end. */
|
|
949
|
+
direction: -1 | 1;
|
|
579
950
|
};
|
|
580
951
|
/**
|
|
581
952
|
* The column a single step would swap with, or `null` when there is none.
|
|
@@ -584,9 +955,103 @@ type ColumnStepArgs = {
|
|
|
584
955
|
* — that is what keeps the checkbox column anchored at the start of the left
|
|
585
956
|
* lane. Use it to enable or disable a "move" control.
|
|
586
957
|
*/
|
|
587
|
-
declare function getStepTargetColumn({ table, columnId, direction
|
|
958
|
+
declare function getStepTargetColumn({ table, columnId, direction }: ColumnStepArgs): GridColumn | null;
|
|
588
959
|
/** Moves a column one position within its lane. Hidden columns are stepped over. */
|
|
589
|
-
declare function moveColumnByStep({ table, columnId, direction
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
960
|
+
declare function moveColumnByStep({ table, columnId, direction }: ColumnStepArgs): void;
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region .types-tmp/core/rowSelection.d.ts
|
|
963
|
+
/**
|
|
964
|
+
* Rows in the order they are displayed, which is the order a shift-click range
|
|
965
|
+
* is measured over — so a range follows the active sort and skips filtered-out
|
|
966
|
+
* rows. Under pagination it is the current page, so a range cannot cross a page
|
|
967
|
+
* boundary.
|
|
968
|
+
*
|
|
969
|
+
* Once a column is grouped this includes the group rows, and only the leaves of
|
|
970
|
+
* groups that are open — and paging is suspended, so it is the whole tree. That
|
|
971
|
+
* is the right list for a range: it is what the user can see, and a range that
|
|
972
|
+
* swept collapsed rows would select things off screen. What a group row in the
|
|
973
|
+
* range contributes is decided by {@link getSelectableRowIds}.
|
|
974
|
+
*/
|
|
975
|
+
declare function getDisplayedRows<TData extends RowData>(table: TMDataGridTable<TData>, features: TMDataGridFeatureFlags): Array<Row<TMDataGridFeatures, TData>>;
|
|
976
|
+
/**
|
|
977
|
+
* Whether the built-in pager is actually slicing anything.
|
|
978
|
+
*
|
|
979
|
+
* Grouping suspends it. A page can only count one kind of thing, and once the
|
|
980
|
+
* rows are a tree neither answer works: counting every row splits a group
|
|
981
|
+
* across a page boundary and strands the rest of the tree on pages the user has
|
|
982
|
+
* to go looking for, and counting only the top-level rows quietly redefines
|
|
983
|
+
* "rows per page" as groups per page, so a page of 25 can hold thousands of
|
|
984
|
+
* rows. Rather than pick, the grid renders the whole tree and leans on the
|
|
985
|
+
* virtualizer — which is its default mode anyway, pagination being opt-in.
|
|
986
|
+
*
|
|
987
|
+
* `TMDataGrid.Footer` reads this too, and greys the pager out rather than
|
|
988
|
+
* hiding it, so the pager going quiet is visible instead of mysterious.
|
|
989
|
+
*/
|
|
990
|
+
declare function isPagingActive<TData extends RowData>(table: TMDataGridTable<TData>, features: TMDataGridFeatureFlags): boolean;
|
|
991
|
+
/**
|
|
992
|
+
* Which modifiers were held. Named for what they mean rather than for the keys,
|
|
993
|
+
* because the keys differ per platform — `toggle` is Ctrl on Windows/Linux and
|
|
994
|
+
* Cmd on macOS.
|
|
995
|
+
*/
|
|
996
|
+
type TMDataGridRowClickModifiers = {
|
|
997
|
+
toggle: boolean;
|
|
998
|
+
extend: boolean;
|
|
999
|
+
};
|
|
1000
|
+
type ResolveRowSelectionClickArgs<TData extends RowData> = {
|
|
1001
|
+
/** Displayed order — see {@link getDisplayedRows}. */
|
|
1002
|
+
rows: ReadonlyArray<Row<TMDataGridFeatures, TData>>;
|
|
1003
|
+
rowId: string;
|
|
1004
|
+
/** The pivot a shift-click extends from. */
|
|
1005
|
+
anchorRowId: string | null;
|
|
1006
|
+
modifiers: TMDataGridRowClickModifiers;
|
|
1007
|
+
selection: RowSelectionState;
|
|
1008
|
+
/**
|
|
1009
|
+
* Whether this gesture is allowed to clear rows it did not touch.
|
|
1010
|
+
*
|
|
1011
|
+
* `true` for a bare row click, where replacing is the whole point. `false` for
|
|
1012
|
+
* a checkbox, which is only ever additive — ticking one box has never cleared
|
|
1013
|
+
* the others, and shift-clicking one adds the range rather than becoming it.
|
|
1014
|
+
*/
|
|
1015
|
+
canReplaceSelection: boolean;
|
|
1016
|
+
};
|
|
1017
|
+
type ResolvedRowSelection = {
|
|
1018
|
+
selection: RowSelectionState;
|
|
1019
|
+
anchorRowId: string | null;
|
|
1020
|
+
};
|
|
1021
|
+
/**
|
|
1022
|
+
* The row ids one gesture on this row selects.
|
|
1023
|
+
*
|
|
1024
|
+
* A group row is never selected itself: it holds no record, and TanStack
|
|
1025
|
+
* derives its checked state from its descendants. So ticking a group means
|
|
1026
|
+
* ticking every selectable leaf under it, which is also what makes the group's
|
|
1027
|
+
* own box light up.
|
|
1028
|
+
*
|
|
1029
|
+
* Leaves rather than direct children, so one click on a top-level group takes
|
|
1030
|
+
* the whole subtree however deeply it nests.
|
|
1031
|
+
*/
|
|
1032
|
+
declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridFeatures, TData>): Array<string>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Turns one click into the next selection, following the convention every
|
|
1035
|
+
* desktop list uses:
|
|
1036
|
+
*
|
|
1037
|
+
* | Gesture | Effect |
|
|
1038
|
+
* | ------- | ------ |
|
|
1039
|
+
* | Click | selection becomes only this row |
|
|
1040
|
+
* | Ctrl/Cmd + click | toggle this row, leave the rest |
|
|
1041
|
+
* | Shift + click | selection becomes the range anchor → this row |
|
|
1042
|
+
* | Ctrl/Cmd + Shift + click | add that range to the selection |
|
|
1043
|
+
*
|
|
1044
|
+
* The anchor is a *pivot*, not "the last row touched": only a plain or
|
|
1045
|
+
* Ctrl-click moves it, which is what lets a run of shift-clicks grow and shrink
|
|
1046
|
+
* the same range from a fixed point.
|
|
1047
|
+
*
|
|
1048
|
+
* Selection state is rebuilt here and handed to `setRowSelection` wholesale
|
|
1049
|
+
* rather than going through `row.toggleSelected()` per row, which would publish
|
|
1050
|
+
* one state update each. That skips TanStack's sub-row cascade, so the cascade
|
|
1051
|
+
* is done here instead: every row in the gesture is expanded through
|
|
1052
|
+
* {@link getSelectableRowIds} before it reaches the map. Under grouping that is
|
|
1053
|
+
* what makes one tick on a group select all of it.
|
|
1054
|
+
*/
|
|
1055
|
+
declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
|
|
1056
|
+
//#endregion
|
|
1057
|
+
export { type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_TMDATAGRID_SIZE, FILTER_OPERATOR_LABELS, GROUP_COLUMN_ID, type MoveColumnArgs, type ResolveRowSelectionClickArgs, type ResolvedRowSelection, SELECT_COLUMN_ID, SETTINGS_STATE_SLICES, SIZE_CONTROL_SIZE, SIZE_ROW_HEIGHT, TMDataGrid, type TMDataGridApi, type TMDataGridCapabilities, type TMDataGridColumnCapabilities, type TMDataGridColumnLayout, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnType, type TMDataGridContextValue, type TMDataGridDataSlice, type TMDataGridDropSide, type TMDataGridFeatureFlags, type TMDataGridFeatures, type TMDataGridFilterOperator, TMDataGridFilterPills, type TMDataGridFilterPillsProps, type TMDataGridFilterValue, type TMDataGridFooterProps, type TMDataGridPaginationApi, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridRowClickModifiers, type TMDataGridRowContextMenu, type TMDataGridRowContextMenuArgs, type TMDataGridRowData, type TMDataGridSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridTableProps, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type UseTMDataGridOptions, createTMDataGridColumnHelper, formatFilterLabel, formatGroupValue, getColumnCapabilities, getColumnLabel, getColumnRegion, getColumnType, getDisplayedRows, getGridCapabilities, getGroupDataRows, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, isColumnReorderable, isFilterActive, isPagingActive, moveColumn, moveColumnByStep, openColumnFilter, readFeatureFlags, resolveRowSelectionClick, tmDataGridFeatures, useTMDataGrid, useTMDataGridContext };
|