@jielga/tmdatagrid 0.1.0 → 0.2.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 +442 -337
- package/dist/index.js +811 -694
- 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 +39 -16
- 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 +63 -0
- package/src/tmdatagrid/{TMDataGrid.tsx → components/TMDataGrid.tsx} +9 -4
- package/src/tmdatagrid/components/TMDataGridColumnsPanel.module.css +25 -0
- package/src/tmdatagrid/{TMDataGridColumnsPanel.tsx → components/TMDataGridColumnsPanel.tsx} +3 -3
- package/src/tmdatagrid/components/TMDataGridFilterPanel.module.css +20 -0
- package/src/tmdatagrid/{TMDataGridFilterPanel.tsx → components/TMDataGridFilterPanel.tsx} +4 -4
- package/src/tmdatagrid/components/TMDataGridFooter.module.css +10 -0
- package/src/tmdatagrid/components/TMDataGridFooter.tsx +143 -0
- package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +153 -0
- package/src/tmdatagrid/{TMDataGridHeaderCell.tsx → components/TMDataGridHeaderCell.tsx} +22 -13
- package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +100 -0
- package/src/tmdatagrid/components/TMDataGridTable.module.css +103 -0
- package/src/tmdatagrid/{TMDataGridTable.tsx → components/TMDataGridTable.tsx} +79 -20
- package/src/tmdatagrid/components/TMDataGridToolbar.module.css +12 -0
- package/src/tmdatagrid/{TMDataGridToolbar.tsx → components/TMDataGridToolbar.tsx} +5 -5
- package/src/tmdatagrid/components/sticky.module.css +45 -0
- package/src/tmdatagrid/{capabilities.ts → core/capabilities.ts} +30 -2
- package/src/tmdatagrid/{columnOrdering.ts → core/columnOrdering.ts} +2 -2
- package/src/tmdatagrid/{columnUtils.ts → core/columnUtils.ts} +1 -1
- package/src/tmdatagrid/{persistence.ts → core/persistence.ts} +80 -2
- package/src/tmdatagrid/index.ts +15 -9
- package/src/tmdatagrid/useTMDataGrid.tsx +102 -55
- package/src/tmdatagrid/TMDataGrid.module.css +0 -410
- package/src/tmdatagrid/TMDataGridFooter.tsx +0 -74
- /package/src/tmdatagrid/{icons.ts → components/icons.ts} +0 -0
- /package/src/tmdatagrid/{filterOperators.ts → core/filterOperators.ts} +0 -0
- /package/src/tmdatagrid/{sizes.ts → core/sizes.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MantineSize } from
|
|
5
|
-
|
|
6
|
-
import { Store } from '@tanstack/store';
|
|
7
|
-
|
|
1
|
+
import { Column, ColumnPinningState, Row, RowData, Table, TableFeatures, TableOptions, TableState } from "@tanstack/react-table";
|
|
2
|
+
import { CSSProperties, ReactNode } from "react";
|
|
3
|
+
import { Store } from "@tanstack/store";
|
|
4
|
+
import { MantineSize } from "@mantine/core";
|
|
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
|
-
|
|
34
|
-
type TMDataGridSize = MantineSize;
|
|
35
|
-
declare const DEFAULT_TMDATAGRID_SIZE: TMDataGridSize;
|
|
36
|
-
/**
|
|
37
|
-
* Row height per size, in px.
|
|
38
|
-
*
|
|
39
|
-
* The virtualizer needs this as a number — it cannot read the CSS variable —
|
|
40
|
-
* so the scale lives here and `TMDataGrid.module.css` mirrors it. `meta.rowHeight`
|
|
41
|
-
* overrides it when a grid needs a height the scale doesn't offer.
|
|
42
|
-
*/
|
|
43
|
-
declare const SIZE_ROW_HEIGHT: Record<TMDataGridSize, number>;
|
|
44
|
-
/** Size of the Mantine controls rendered inside the grid chrome. */
|
|
45
|
-
declare const SIZE_CONTROL_SIZE: Record<TMDataGridSize, MantineSize>;
|
|
46
|
-
|
|
20
|
+
declare function TMDataGridFilterPanel(): import("react").JSX.Element | null;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region .types-tmp/core/filterOperators.d.ts
|
|
47
23
|
/**
|
|
48
24
|
* The value shape stored in `columnFilters` for every TMDataGrid column.
|
|
49
25
|
*
|
|
@@ -53,8 +29,8 @@ declare const SIZE_CONTROL_SIZE: Record<TMDataGridSize, MantineSize>;
|
|
|
53
29
|
* `manualFiltering` table (just forward `columnFilters` to the API).
|
|
54
30
|
*/
|
|
55
31
|
type TMDataGridFilterValue = {
|
|
56
|
-
|
|
57
|
-
|
|
32
|
+
operator: TMDataGridFilterOperator;
|
|
33
|
+
value: string;
|
|
58
34
|
};
|
|
59
35
|
type TMDataGridColumnType = "string" | "number";
|
|
60
36
|
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "isEmpty" | "isNotEmpty";
|
|
@@ -71,7 +47,8 @@ declare function isFilterActive(value: unknown): boolean;
|
|
|
71
47
|
* "contains" / "does not equal" / "is empty" without redefining the column.
|
|
72
48
|
*/
|
|
73
49
|
declare function tmDataGridFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown): boolean;
|
|
74
|
-
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region .types-tmp/core/persistence.d.ts
|
|
75
52
|
type GridState = TableState<TMDataGridFeatures>;
|
|
76
53
|
/**
|
|
77
54
|
* Persistence deliberately does not use Mantine's `useLocalStorage`.
|
|
@@ -110,18 +87,49 @@ type TMDataGridPersistKey<TSlice extends string> = string | readonly [key: strin
|
|
|
110
87
|
/** Same values as Mantine's `StorageType`, which the package does not re-export. */
|
|
111
88
|
type TMDataGridStorageMode = "localStorage" | "sessionStorage";
|
|
112
89
|
type TMDataGridPersistence = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
90
|
+
/** Key for filters, global filter, sorting and pagination. */
|
|
91
|
+
dataKey?: TMDataGridPersistKey<TMDataGridDataSlice>;
|
|
92
|
+
/** Key for column visibility, sizing, order and pinning. */
|
|
93
|
+
settingsKey?: TMDataGridPersistKey<TMDataGridSettingsSlice>;
|
|
94
|
+
/** Which storage area to use. Defaults to `"localStorage"`. */
|
|
95
|
+
storageMode?: TMDataGridStorageMode;
|
|
96
|
+
/** Serializes a payload before it is stored. Defaults to `JSON.stringify`. */
|
|
97
|
+
serialize?: (value: Partial<GridState>) => string;
|
|
98
|
+
/** Parses a stored payload. Defaults to `JSON.parse`. */
|
|
99
|
+
deserialize?: (value: string) => unknown;
|
|
123
100
|
};
|
|
124
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region .types-tmp/core/sizes.d.ts
|
|
103
|
+
type TMDataGridSize = MantineSize;
|
|
104
|
+
declare const DEFAULT_TMDATAGRID_SIZE: TMDataGridSize;
|
|
105
|
+
/**
|
|
106
|
+
* Row height per size, in px.
|
|
107
|
+
*
|
|
108
|
+
* The virtualizer needs this as a number — it cannot read the CSS variable —
|
|
109
|
+
* so the scale lives here and `TMDataGrid.module.css` mirrors it. `meta.rowHeight`
|
|
110
|
+
* overrides it when a grid needs a height the scale doesn't offer.
|
|
111
|
+
*/
|
|
112
|
+
declare const SIZE_ROW_HEIGHT: Record<TMDataGridSize, number>;
|
|
113
|
+
/** Size of the Mantine controls rendered inside the grid chrome. */
|
|
114
|
+
declare const SIZE_CONTROL_SIZE: Record<TMDataGridSize, MantineSize>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region .types-tmp/TMDataGridContext.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Row shape the chrome components work against. They only ever touch columns,
|
|
119
|
+
* rows and cells generically, so the concrete row type is erased at the context
|
|
120
|
+
* boundary — the same trick Mantine uses for its compound components.
|
|
121
|
+
*/
|
|
122
|
+
type TMDataGridRowData = Record<string, unknown>;
|
|
123
|
+
type TMDataGridContextValue = TMDataGridApi<TMDataGridRowData> & {
|
|
124
|
+
size: TMDataGridSize;
|
|
125
|
+
/** Row height in px, already resolved from `size` and `meta.rowHeight`. */
|
|
126
|
+
rowHeight: number;
|
|
127
|
+
/** Mantine control size that pairs with `size`. */
|
|
128
|
+
controlSize: TMDataGridSize;
|
|
129
|
+
};
|
|
130
|
+
declare function useTMDataGridContext(): TMDataGridContextValue;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region .types-tmp/core/capabilities.d.ts
|
|
125
133
|
/**
|
|
126
134
|
* Table-level feature switches, read straight off the options object.
|
|
127
135
|
*
|
|
@@ -134,16 +142,30 @@ type TMDataGridPersistence = {
|
|
|
134
142
|
* TanStack still decides: these flags are combined with `getCanX()`, which is
|
|
135
143
|
* what applies the per-column overrides.
|
|
136
144
|
*/
|
|
145
|
+
/**
|
|
146
|
+
* How rows are selected — see `rowSelectionMode` on {@link UseTMDataGridOptions}.
|
|
147
|
+
*/
|
|
148
|
+
type TMDataGridRowSelectionMode = "checkbox" | "row";
|
|
137
149
|
type TMDataGridFeatureFlags = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
sorting: boolean;
|
|
151
|
+
filtering: boolean;
|
|
152
|
+
hiding: boolean;
|
|
153
|
+
pinning: boolean;
|
|
154
|
+
resizing: boolean;
|
|
155
|
+
ordering: boolean;
|
|
156
|
+
rowSelection: boolean;
|
|
157
|
+
/** Only meaningful while `rowSelection` is on. Defaults to `"checkbox"`. */
|
|
158
|
+
rowSelectionMode: TMDataGridRowSelectionMode;
|
|
159
|
+
/** Whether a selected row takes the highlight colour. Follows the mode. */
|
|
160
|
+
highlightSelectedRows: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* The one default-off flag: pagination must be asked for, either with the
|
|
163
|
+
* grid's `enablePagination` or implicitly by declaring `manualPagination`.
|
|
164
|
+
* Off, the grid renders every filtered row and relies on virtualization.
|
|
165
|
+
*/
|
|
166
|
+
pagination: boolean;
|
|
145
167
|
};
|
|
146
|
-
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection">): TMDataGridFeatureFlags;
|
|
168
|
+
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection" | "rowSelectionMode" | "highlightSelectedRows" | "enablePagination" | "manualPagination">): TMDataGridFeatureFlags;
|
|
147
169
|
/**
|
|
148
170
|
* What one column's header may offer.
|
|
149
171
|
*
|
|
@@ -157,193 +179,194 @@ declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMData
|
|
|
157
179
|
* | Header dragging, Move left / right | `enableColumnOrdering` / `meta.enableOrdering` |
|
|
158
180
|
*/
|
|
159
181
|
type TMDataGridColumnCapabilities = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
182
|
+
canSort: boolean;
|
|
183
|
+
canFilter: boolean;
|
|
184
|
+
canHide: boolean;
|
|
185
|
+
canPin: boolean;
|
|
186
|
+
canResize: boolean;
|
|
187
|
+
canReorder: boolean;
|
|
166
188
|
};
|
|
167
189
|
declare function getColumnCapabilities(column: Column<TMDataGridFeatures, TMDataGridRowData, unknown>, features: TMDataGridFeatureFlags): TMDataGridColumnCapabilities;
|
|
168
190
|
/** The same questions, asked of the whole grid — used to hide toolbar buttons. */
|
|
169
191
|
type TMDataGridCapabilities = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
192
|
+
canSortAny: boolean;
|
|
193
|
+
canFilterAny: boolean;
|
|
194
|
+
canHideAny: boolean;
|
|
195
|
+
canPinAny: boolean;
|
|
196
|
+
canReorderAny: boolean;
|
|
197
|
+
canSelectRows: boolean;
|
|
198
|
+
canPaginate: boolean;
|
|
176
199
|
};
|
|
177
|
-
declare function getGridCapabilities(table: TMDataGridTable
|
|
178
|
-
|
|
179
|
-
|
|
200
|
+
declare function getGridCapabilities(table: TMDataGridTable<TMDataGridRowData>, features: TMDataGridFeatureFlags): TMDataGridCapabilities;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region .types-tmp/useTMDataGrid.d.ts
|
|
180
203
|
/** Per-column configuration the TMDataGrid chrome reads. */
|
|
181
204
|
type TMDataGridColumnMeta = {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
/** Name shown in menus and the column manager. Falls back to a string header. */
|
|
206
|
+
label?: string;
|
|
207
|
+
/** Drives which filter operators are offered. Defaults to `"string"`. */
|
|
208
|
+
type?: TMDataGridColumnType;
|
|
209
|
+
/** Share of the leftover width this column claims. Defaults to `1`. */
|
|
210
|
+
flex?: number;
|
|
211
|
+
align?: "left" | "right" | "center";
|
|
212
|
+
/**
|
|
213
|
+
* `false` keeps the column where it is: no header dragging, no move items.
|
|
214
|
+
* Column ordering is the one feature TanStack defines no column option for,
|
|
215
|
+
* so its switch lives here rather than on the column definition.
|
|
216
|
+
*/
|
|
217
|
+
enableOrdering?: boolean;
|
|
195
218
|
};
|
|
196
219
|
/** Grid-wide configuration passed through `options.meta`. */
|
|
197
220
|
type TMDataGridTableMeta = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
loading?: boolean;
|
|
222
|
+
noResultsLabel?: string;
|
|
223
|
+
/** Row height used by the virtualizer. Defaults to `52`. */
|
|
224
|
+
rowHeight?: number;
|
|
225
|
+
/**
|
|
226
|
+
* Unfiltered row total. Only needed for server-driven grids, where the client
|
|
227
|
+
* never holds the full data set — `TMDataGrid.SummaryCount` uses it as denominator.
|
|
228
|
+
*/
|
|
229
|
+
totalRowCount?: number;
|
|
207
230
|
};
|
|
208
231
|
/**
|
|
209
232
|
* Every feature the TMDataGrid chrome can drive. Defined at module scope so the
|
|
210
233
|
* reference stays stable across renders (see the TanStack table-state skill).
|
|
211
234
|
*/
|
|
212
235
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
};
|
|
236
|
+
columnFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
237
|
+
globalFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
238
|
+
rowSortingFeature: import("@tanstack/table-core").TableFeature;
|
|
239
|
+
rowPaginationFeature: import("@tanstack/table-core").TableFeature;
|
|
240
|
+
rowSelectionFeature: import("@tanstack/table-core").TableFeature;
|
|
241
|
+
columnPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
242
|
+
columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
|
|
243
|
+
columnOrderingFeature: import("@tanstack/table-core").TableFeature;
|
|
244
|
+
columnSizingFeature: import("@tanstack/table-core").TableFeature;
|
|
245
|
+
columnResizingFeature: import("@tanstack/table-core").TableFeature;
|
|
246
|
+
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
247
|
+
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
248
|
+
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
249
|
+
paginatedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
250
|
+
facetedRowModel: (table: Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
251
|
+
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
252
|
+
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
253
|
+
filterFns: {
|
|
254
|
+
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) & {
|
|
255
|
+
autoRemove: (val: any) => boolean;
|
|
256
|
+
};
|
|
257
|
+
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) & {
|
|
258
|
+
autoRemove: (val: any) => boolean;
|
|
259
|
+
};
|
|
260
|
+
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;
|
|
261
|
+
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) & {
|
|
262
|
+
autoRemove: (val: any) => boolean;
|
|
263
|
+
};
|
|
264
|
+
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) & {
|
|
265
|
+
autoRemove: (val: any) => boolean;
|
|
266
|
+
};
|
|
267
|
+
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) & {
|
|
268
|
+
autoRemove: (val: any) => boolean;
|
|
269
|
+
};
|
|
270
|
+
equals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
271
|
+
autoRemove: (val: any) => boolean;
|
|
272
|
+
};
|
|
273
|
+
equalsString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
274
|
+
autoRemove: (val: any) => boolean;
|
|
267
275
|
};
|
|
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;
|
|
276
|
+
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) & {
|
|
277
|
+
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
278
|
+
autoRemove: (val: any) => boolean;
|
|
275
279
|
};
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
includesString: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
281
|
+
autoRemove: (val: any) => boolean;
|
|
282
|
+
};
|
|
283
|
+
includesStringSensitive: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
284
|
+
autoRemove: (val: any) => boolean;
|
|
285
|
+
};
|
|
286
|
+
weakEquals: (<TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(row: import("@tanstack/table-core").Row<TFeatures, TData>, columnId: string, filterValue: unknown) => boolean) & {
|
|
287
|
+
autoRemove: (val: any) => boolean;
|
|
288
|
+
};
|
|
289
|
+
tmDataGrid: typeof tmDataGridFilterFn;
|
|
290
|
+
};
|
|
291
|
+
sortFns: {
|
|
292
|
+
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;
|
|
293
|
+
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;
|
|
294
|
+
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;
|
|
295
|
+
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;
|
|
296
|
+
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;
|
|
297
|
+
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;
|
|
298
|
+
};
|
|
299
|
+
tableMeta: TMDataGridTableMeta;
|
|
300
|
+
columnMeta: TMDataGridColumnMeta;
|
|
278
301
|
};
|
|
279
302
|
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
|
-
|
|
324
|
-
|
|
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
|
-
};
|
|
303
|
+
type TMDataGridTable<TData extends RowData> = Table<TMDataGridFeatures, TData>;
|
|
304
|
+
declare function createTMDataGridColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<{
|
|
305
|
+
columnFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
306
|
+
globalFilteringFeature: import("@tanstack/table-core").TableFeature;
|
|
307
|
+
rowSortingFeature: import("@tanstack/table-core").TableFeature;
|
|
308
|
+
rowPaginationFeature: import("@tanstack/table-core").TableFeature;
|
|
309
|
+
rowSelectionFeature: import("@tanstack/table-core").TableFeature;
|
|
310
|
+
columnPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
311
|
+
columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
|
|
312
|
+
columnOrderingFeature: import("@tanstack/table-core").TableFeature;
|
|
313
|
+
columnSizingFeature: import("@tanstack/table-core").TableFeature;
|
|
314
|
+
columnResizingFeature: import("@tanstack/table-core").TableFeature;
|
|
315
|
+
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
316
|
+
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
317
|
+
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
318
|
+
paginatedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
319
|
+
facetedRowModel: (table: Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
320
|
+
facetedMinMaxValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => undefined | [number, number];
|
|
321
|
+
facetedUniqueValues: (table: Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
|
|
322
|
+
filterFns: {
|
|
323
|
+
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) & {
|
|
324
|
+
autoRemove: (val: any) => boolean;
|
|
325
|
+
};
|
|
326
|
+
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) & {
|
|
327
|
+
autoRemove: (val: any) => boolean;
|
|
328
|
+
};
|
|
329
|
+
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;
|
|
330
|
+
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) & {
|
|
331
|
+
autoRemove: (val: any) => boolean;
|
|
332
|
+
};
|
|
333
|
+
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) & {
|
|
334
|
+
autoRemove: (val: any) => boolean;
|
|
335
|
+
};
|
|
336
|
+
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) & {
|
|
337
|
+
autoRemove: (val: any) => boolean;
|
|
338
|
+
};
|
|
339
|
+
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) & {
|
|
340
|
+
autoRemove: (val: any) => boolean;
|
|
341
|
+
};
|
|
342
|
+
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) & {
|
|
343
|
+
autoRemove: (val: any) => boolean;
|
|
344
|
+
};
|
|
345
|
+
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) & {
|
|
346
|
+
resolveFilterValue: (val: [any, any]) => readonly [number, number];
|
|
347
|
+
autoRemove: (val: any) => boolean;
|
|
336
348
|
};
|
|
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;
|
|
349
|
+
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) & {
|
|
350
|
+
autoRemove: (val: any) => boolean;
|
|
344
351
|
};
|
|
345
|
-
|
|
346
|
-
|
|
352
|
+
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) & {
|
|
353
|
+
autoRemove: (val: any) => boolean;
|
|
354
|
+
};
|
|
355
|
+
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) & {
|
|
356
|
+
autoRemove: (val: any) => boolean;
|
|
357
|
+
};
|
|
358
|
+
tmDataGrid: typeof tmDataGridFilterFn;
|
|
359
|
+
};
|
|
360
|
+
sortFns: {
|
|
361
|
+
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;
|
|
362
|
+
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;
|
|
363
|
+
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;
|
|
364
|
+
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;
|
|
365
|
+
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;
|
|
366
|
+
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;
|
|
367
|
+
};
|
|
368
|
+
tableMeta: TMDataGridTableMeta;
|
|
369
|
+
columnMeta: TMDataGridColumnMeta;
|
|
347
370
|
}, TData>;
|
|
348
371
|
/**
|
|
349
372
|
* Chrome state that is *not* table state: which panels are open, and which
|
|
@@ -351,50 +374,88 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): _tanstac
|
|
|
351
374
|
* subscribe to it the same way they subscribe to `table.store`.
|
|
352
375
|
*/
|
|
353
376
|
type TMDataGridUiState = {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
377
|
+
filterPanelOpen: boolean;
|
|
378
|
+
columnsPanelOpen: boolean;
|
|
379
|
+
/** Column whose filter row should be focused when the panel opens. */
|
|
380
|
+
filterPanelColumnId: string | null;
|
|
381
|
+
/**
|
|
382
|
+
* Column being dragged by its header, if any. Held here rather than read from
|
|
383
|
+
* `dataTransfer`, which browsers keep unreadable until the drop.
|
|
384
|
+
*/
|
|
385
|
+
draggedColumnId: string | null;
|
|
363
386
|
};
|
|
364
387
|
type TMDataGridUiActions = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
388
|
+
openFilterPanel: (columnId?: string | null) => void;
|
|
389
|
+
closeFilterPanel: () => void;
|
|
390
|
+
setColumnsPanelOpen: (open: boolean) => void;
|
|
391
|
+
toggleColumnsPanel: () => void;
|
|
392
|
+
startColumnDrag: (columnId: string) => void;
|
|
393
|
+
endColumnDrag: () => void;
|
|
371
394
|
};
|
|
372
395
|
type TMDataGridUiStore = Store<TMDataGridUiState, TMDataGridUiActions>;
|
|
373
396
|
/** What `useTMDataGrid` returns — spread straight onto `<TMDataGrid />`. */
|
|
374
397
|
type TMDataGridApi<TData extends RowData> = {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
398
|
+
table: TMDataGridTable<TData>;
|
|
399
|
+
ui: TMDataGridUiStore;
|
|
400
|
+
/** Table-level feature switches, re-read from options on every render. */
|
|
401
|
+
features: TMDataGridFeatureFlags;
|
|
379
402
|
};
|
|
380
403
|
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
|
-
|
|
404
|
+
/**
|
|
405
|
+
* Restore and persist table state across mounts. Two keys, because the two
|
|
406
|
+
* kinds of state have different lifetimes — see {@link TMDataGridPersistence}.
|
|
407
|
+
*
|
|
408
|
+
* Keep the object referentially stable (module scope or `useMemo`); it is a
|
|
409
|
+
* dependency of the subscription that writes back.
|
|
410
|
+
*/
|
|
411
|
+
persist?: TMDataGridPersistence;
|
|
412
|
+
/**
|
|
413
|
+
* Header drag-and-drop and the move items in the column menu. Defaults to
|
|
414
|
+
* `true`.
|
|
415
|
+
*
|
|
416
|
+
* The one feature switch the grid defines itself: TanStack's
|
|
417
|
+
* `columnOrderingFeature` ships state and APIs but no `enable` option, since
|
|
418
|
+
* reordering is entirely a matter of interface.
|
|
419
|
+
*/
|
|
420
|
+
enableColumnOrdering?: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Client-side pagination and the built-in `TMDataGrid.Footer` pager.
|
|
423
|
+
* Defaults to `false`: the grid renders every filtered row and relies on
|
|
424
|
+
* virtualization.
|
|
425
|
+
*
|
|
426
|
+
* The second grid-defined switch (TanStack defines no `enablePagination`
|
|
427
|
+
* option). `manualPagination: true` implies it — a server-paged grid needs
|
|
428
|
+
* no extra flag.
|
|
429
|
+
*/
|
|
430
|
+
enablePagination?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* How rows are selected. Defaults to `"checkbox"`.
|
|
433
|
+
*
|
|
434
|
+
* - `"checkbox"` — the generated checkbox column selects; clicking a row
|
|
435
|
+
* elsewhere does not.
|
|
436
|
+
* - `"row"` — no checkbox column; clicking a row toggles it. Other rows keep
|
|
437
|
+
* their state, so a click never clears the rest of the selection.
|
|
438
|
+
*
|
|
439
|
+
* Ignored when `enableRowSelection` is `false`. Both modes write to the same
|
|
440
|
+
* `rowSelection` state.
|
|
441
|
+
*/
|
|
442
|
+
rowSelectionMode?: TMDataGridRowSelectionMode;
|
|
443
|
+
/**
|
|
444
|
+
* Give selected rows the highlight background. Defaults to `true` under
|
|
445
|
+
* `rowSelectionMode: "row"`, where the highlight is the only feedback a click
|
|
446
|
+
* gives, and `false` under `"checkbox"`, where the box already shows it.
|
|
447
|
+
*
|
|
448
|
+
* The colour is the `--dg-row-selected-bg` CSS variable, so it can be changed
|
|
449
|
+
* without turning the flag on or off:
|
|
450
|
+
*
|
|
451
|
+
* ```tsx
|
|
452
|
+
* <TMDataGrid
|
|
453
|
+
* {...grid}
|
|
454
|
+
* style={{ "--dg-row-selected-bg": "var(--mantine-color-blue-0)" }}
|
|
455
|
+
* />
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
highlightSelectedRows?: boolean;
|
|
398
459
|
};
|
|
399
460
|
/**
|
|
400
461
|
* Builds a TMDataGrid table plus its chrome store.
|
|
@@ -403,81 +464,121 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
403
464
|
* only needs `manualPagination` / `manualFiltering` / `manualSorting`,
|
|
404
465
|
* `rowCount` and the matching `onXChange` callbacks — the chrome reads
|
|
405
466
|
* `getRowCount()` / `getPageCount()` / `getPaginatedRowModel()`, all of which
|
|
406
|
-
* already respect manual mode.
|
|
467
|
+
* already respect manual mode. `manualPagination` also switches the pagination
|
|
468
|
+
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
469
|
+
* options.
|
|
407
470
|
*/
|
|
408
|
-
declare function useTMDataGrid<TData extends RowData>({ persist, enableColumnOrdering, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
471
|
+
declare function useTMDataGrid<TData extends RowData>({ persist, enableColumnOrdering, enablePagination, rowSelectionMode, highlightSelectedRows, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
409
472
|
/**
|
|
410
473
|
* Opens the filter panel for a column, seeding an empty filter row when the
|
|
411
474
|
* column has none yet — mirrors "Filter" in the column header menu.
|
|
412
475
|
*/
|
|
413
476
|
declare function openColumnFilter<TData extends RowData>(api: TMDataGridApi<TData>, columnId: string): void;
|
|
414
|
-
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region .types-tmp/components/TMDataGridFooter.d.ts
|
|
479
|
+
/** Distilled pagination state and actions for building a custom pager. */
|
|
480
|
+
type TMDataGridPaginationApi = {
|
|
481
|
+
pageIndex: number;
|
|
482
|
+
pageSize: number;
|
|
483
|
+
/** `-1` when a manual grid declares `pageCount: -1` (unknown total). */
|
|
484
|
+
pageCount: number;
|
|
485
|
+
rowCount: number;
|
|
486
|
+
canPreviousPage: boolean;
|
|
487
|
+
canNextPage: boolean;
|
|
488
|
+
setPageIndex: (pageIndex: number) => void;
|
|
489
|
+
setPageSize: (pageSize: number) => void;
|
|
490
|
+
previousPage: () => void;
|
|
491
|
+
nextPage: () => void;
|
|
492
|
+
firstPage: () => void;
|
|
493
|
+
lastPage: () => void;
|
|
494
|
+
};
|
|
415
495
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
496
|
+
* Reads {@link TMDataGridPaginationApi} off a table. The Footer feeds it to the
|
|
497
|
+
* `pagination` render prop; a pager living outside the Footer can call it with
|
|
498
|
+
* the table from `useTMDataGrid` directly.
|
|
419
499
|
*/
|
|
420
|
-
|
|
421
|
-
type
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
/** Mantine control size that pairs with `size`. */
|
|
426
|
-
controlSize: TMDataGridSize;
|
|
500
|
+
declare function getTMDataGridPaginationApi<TData extends RowData>(table: TMDataGridTable<TData>): TMDataGridPaginationApi;
|
|
501
|
+
type TMDataGridFooterProps = {
|
|
502
|
+
pageSizeOptions?: ReadonlyArray<number>;
|
|
503
|
+
/** Replaces the built-in pager. Receives the distilled pagination API. */
|
|
504
|
+
pagination?: (api: TMDataGridPaginationApi) => ReactNode;
|
|
427
505
|
};
|
|
428
|
-
|
|
429
|
-
|
|
506
|
+
/**
|
|
507
|
+
* MUI-style pager: "Rows per page · from–to of total · ‹ ›".
|
|
508
|
+
*
|
|
509
|
+
* Renders nothing unless pagination is enabled (`enablePagination` or
|
|
510
|
+
* `manualPagination`) — the footer is a pager; extra footer content belongs in
|
|
511
|
+
* your own layout.
|
|
512
|
+
*
|
|
513
|
+
* Row totals come from `table.getRowCount()`, which prefers `options.rowCount`
|
|
514
|
+
* — so a server-paged grid shows the server's total without changes here.
|
|
515
|
+
*/
|
|
516
|
+
declare function TMDataGridFooter({ pageSizeOptions, pagination }: TMDataGridFooterProps): import("react").JSX.Element | null;
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region .types-tmp/components/TMDataGridTable.d.ts
|
|
430
519
|
/** Where a column sits relative to the pinned regions, resolved once per render. */
|
|
431
520
|
type TMDataGridColumnLayout = {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
521
|
+
pinnedAt: "left" | "right" | false;
|
|
522
|
+
/** Distance in px from the grid's left or right edge. */
|
|
523
|
+
offset: number;
|
|
524
|
+
/** Last left-pinned / first right-pinned column — the one that casts the edge. */
|
|
525
|
+
isBoundary: boolean;
|
|
437
526
|
};
|
|
438
527
|
type TMDataGridTableProps<TData extends RowData> = {
|
|
439
|
-
|
|
440
|
-
|
|
528
|
+
/**
|
|
529
|
+
* Called when a body row is clicked. Runs in addition to row selection under
|
|
530
|
+
* `rowSelectionMode: "row"`, not instead of it.
|
|
531
|
+
*/
|
|
532
|
+
onRowClick?: (row: Row<TMDataGridFeatures, TData>) => void;
|
|
441
533
|
};
|
|
442
534
|
/**
|
|
443
535
|
* The scrollable grid surface. Always virtualized: only the rows inside the
|
|
444
|
-
* viewport (plus overscan) are mounted
|
|
536
|
+
* viewport (plus overscan) are mounted — which is what makes the default
|
|
537
|
+
* no-pagination mode viable at any row count. Pagination is opt-in via
|
|
538
|
+
* `enablePagination` (or implied by `manualPagination`).
|
|
445
539
|
*/
|
|
446
|
-
declare function TMDataGridTable<TData extends RowData = TMDataGridRowData>({ onRowClick
|
|
447
|
-
|
|
540
|
+
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick }: TMDataGridTableProps<TData>): import("react").JSX.Element;
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region .types-tmp/components/TMDataGridToolbar.d.ts
|
|
448
543
|
/** Row above the grid. Compose it from the pieces below, or anything else. */
|
|
449
544
|
declare function TMDataGridToolbar({ children }: {
|
|
450
|
-
|
|
451
|
-
}): react.JSX.Element;
|
|
545
|
+
children?: ReactNode;
|
|
546
|
+
}): import("react").JSX.Element;
|
|
452
547
|
/** Pushes the following toolbar items to the right. */
|
|
453
|
-
declare function TMDataGridToolbarSpacer(): react.JSX.Element;
|
|
548
|
+
declare function TMDataGridToolbarSpacer(): import("react").JSX.Element;
|
|
454
549
|
/**
|
|
455
550
|
* Visible rows over total rows. On a server-driven grid, set
|
|
456
551
|
* `meta.totalRowCount` for the denominator — the client never sees every row.
|
|
457
552
|
*/
|
|
458
553
|
declare function TMDataGridSummaryCount({ children }: {
|
|
459
|
-
|
|
460
|
-
}): react.JSX.Element;
|
|
554
|
+
children?: ReactNode;
|
|
555
|
+
}): import("react").JSX.Element;
|
|
461
556
|
/**
|
|
462
557
|
* Burger menu in the grid's top-right corner — opens "Manage columns".
|
|
463
558
|
* Renders nothing when no column can be hidden (`enableHiding: false`).
|
|
464
559
|
*/
|
|
465
|
-
declare function TMDataGridColumnsButton(): react.JSX.Element | null;
|
|
560
|
+
declare function TMDataGridColumnsButton(): import("react").JSX.Element | null;
|
|
466
561
|
/**
|
|
467
562
|
* Toggles the filter panel, seeding a filter row on the first filterable column.
|
|
468
563
|
* Renders nothing when no column can be filtered (`enableColumnFilters: false`).
|
|
469
564
|
*/
|
|
470
|
-
declare function TMDataGridFilterButton(): react.JSX.Element | null;
|
|
471
|
-
|
|
565
|
+
declare function TMDataGridFilterButton(): import("react").JSX.Element | null;
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region .types-tmp/components/TMDataGrid.d.ts
|
|
472
568
|
type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
569
|
+
children: ReactNode;
|
|
570
|
+
/**
|
|
571
|
+
* Mantine size scale. Drives row height, font size, cell padding and the
|
|
572
|
+
* size of the controls in the chrome. `meta.rowHeight` still wins if set.
|
|
573
|
+
*/
|
|
574
|
+
size?: TMDataGridSize;
|
|
575
|
+
className?: string;
|
|
576
|
+
/**
|
|
577
|
+
* Inline styles. Widened to accept CSS variables, which is how the grid's
|
|
578
|
+
* colours are themed — `--dg-row-selected-bg` for the selected row
|
|
579
|
+
* background. Plain `CSSProperties` rejects `--*` keys.
|
|
580
|
+
*/
|
|
581
|
+
style?: CSSProperties & Record<`--${string}`, string | number>;
|
|
481
582
|
};
|
|
482
583
|
/**
|
|
483
584
|
* Root of the grid. Takes the object returned by `useTMDataGrid` — spread it —
|
|
@@ -497,34 +598,38 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
497
598
|
* </TMDataGrid>
|
|
498
599
|
* ```
|
|
499
600
|
*/
|
|
500
|
-
declare function TMDataGridRoot<TData extends RowData>({ table, ui, features, size, children, className, style
|
|
601
|
+
declare function TMDataGridRoot<TData extends RowData>({ table, ui, features, size, children, className, style }: TMDataGridProps<TData>): import("react").JSX.Element;
|
|
501
602
|
declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
603
|
+
Toolbar: typeof TMDataGridToolbar;
|
|
604
|
+
Spacer: typeof TMDataGridToolbarSpacer;
|
|
605
|
+
SummaryCount: typeof TMDataGridSummaryCount;
|
|
606
|
+
ColumnsButton: typeof TMDataGridColumnsButton;
|
|
607
|
+
FilterButton: typeof TMDataGridFilterButton;
|
|
608
|
+
Table: typeof TMDataGridTable$1;
|
|
609
|
+
Footer: typeof TMDataGridFooter;
|
|
610
|
+
/** Rendered by `TMDataGrid.Table`; exported for custom layouts. */
|
|
611
|
+
FilterPanel: typeof TMDataGridFilterPanel;
|
|
612
|
+
/** Rendered by `TMDataGrid.ColumnsButton`; exported for custom layouts. */
|
|
613
|
+
ColumnsPanel: typeof TMDataGridColumnsPanel;
|
|
513
614
|
};
|
|
514
|
-
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region .types-tmp/components/TMDataGridSelectColumn.d.ts
|
|
617
|
+
declare const SELECT_COLUMN_ID = "__select__";
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region .types-tmp/core/columnUtils.d.ts
|
|
515
620
|
/**
|
|
516
621
|
* Structural shape of the column bits the chrome reads. Kept minimal so these
|
|
517
622
|
* helpers work with any `Column`/`Header` instance without dragging generics
|
|
518
623
|
* through every call site.
|
|
519
624
|
*/
|
|
520
625
|
type ColumnLike = {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
626
|
+
id: string;
|
|
627
|
+
columnDef: {
|
|
628
|
+
header?: unknown;
|
|
629
|
+
meta?: TMDataGridColumnMeta;
|
|
630
|
+
};
|
|
631
|
+
/** Set on a leaf that sits inside a header group. */
|
|
632
|
+
parent?: unknown;
|
|
528
633
|
};
|
|
529
634
|
/** Menu- and panel-facing column name. */
|
|
530
635
|
declare function getColumnLabel(column: ColumnLike): string;
|
|
@@ -538,9 +643,10 @@ declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
|
538
643
|
* columns that no longer belong to it.
|
|
539
644
|
*/
|
|
540
645
|
declare function isColumnReorderable(column: ColumnLike): boolean;
|
|
541
|
-
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region .types-tmp/core/columnOrdering.d.ts
|
|
542
648
|
type GridColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
543
|
-
type GridTable = TMDataGridTable
|
|
649
|
+
type GridTable = TMDataGridTable<TMDataGridRowData>;
|
|
544
650
|
/**
|
|
545
651
|
* The lane a column renders in.
|
|
546
652
|
*
|
|
@@ -554,12 +660,12 @@ type TMDataGridColumnRegion = "left" | "center" | "right";
|
|
|
554
660
|
type TMDataGridDropSide = "before" | "after";
|
|
555
661
|
declare function getColumnRegion(columnPinning: ColumnPinningState, columnId: string): TMDataGridColumnRegion;
|
|
556
662
|
type MoveColumnArgs = {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
663
|
+
table: GridTable;
|
|
664
|
+
/** Column being moved. */
|
|
665
|
+
columnId: string;
|
|
666
|
+
/** Column it was dropped on. */
|
|
667
|
+
targetId: string;
|
|
668
|
+
side: TMDataGridDropSide;
|
|
563
669
|
};
|
|
564
670
|
/**
|
|
565
671
|
* Moves a column next to another one. A no-op when the two are in different
|
|
@@ -570,12 +676,12 @@ type MoveColumnArgs = {
|
|
|
570
676
|
* unpinned. Pinned lanes are read from `columnPinning`, so a move inside one
|
|
571
677
|
* updates that array as well.
|
|
572
678
|
*/
|
|
573
|
-
declare function moveColumn({ table, columnId, targetId, side
|
|
679
|
+
declare function moveColumn({ table, columnId, targetId, side }: MoveColumnArgs): void;
|
|
574
680
|
type ColumnStepArgs = {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
681
|
+
table: GridTable;
|
|
682
|
+
columnId: string;
|
|
683
|
+
/** `-1` moves towards the start of the lane, `1` towards its end. */
|
|
684
|
+
direction: -1 | 1;
|
|
579
685
|
};
|
|
580
686
|
/**
|
|
581
687
|
* The column a single step would swap with, or `null` when there is none.
|
|
@@ -584,9 +690,8 @@ type ColumnStepArgs = {
|
|
|
584
690
|
* — that is what keeps the checkbox column anchored at the start of the left
|
|
585
691
|
* lane. Use it to enable or disable a "move" control.
|
|
586
692
|
*/
|
|
587
|
-
declare function getStepTargetColumn({ table, columnId, direction
|
|
693
|
+
declare function getStepTargetColumn({ table, columnId, direction }: ColumnStepArgs): GridColumn | null;
|
|
588
694
|
/** Moves a column one position within its lane. Hidden columns are stepped over. */
|
|
589
|
-
declare function moveColumnByStep({ table, columnId, direction
|
|
590
|
-
|
|
591
|
-
export { DATA_STATE_SLICES, DEFAULT_TMDATAGRID_SIZE, FILTER_OPERATOR_LABELS, SELECT_COLUMN_ID, SETTINGS_STATE_SLICES, SIZE_CONTROL_SIZE, SIZE_ROW_HEIGHT, TMDataGrid, createTMDataGridColumnHelper, getColumnCapabilities, getColumnLabel, getColumnRegion, getColumnType, getGridCapabilities, getStepTargetColumn, isColumnReorderable, isFilterActive, moveColumn, moveColumnByStep, openColumnFilter, readFeatureFlags, tmDataGridFeatures, useTMDataGrid, useTMDataGridContext };
|
|
592
|
-
export type { ColumnStepArgs, MoveColumnArgs, TMDataGridApi, TMDataGridCapabilities, TMDataGridColumnCapabilities, TMDataGridColumnLayout, TMDataGridColumnMeta, TMDataGridColumnRegion, TMDataGridColumnType, TMDataGridContextValue, TMDataGridDataSlice, TMDataGridDropSide, TMDataGridFeatureFlags, TMDataGridFeatures, TMDataGridFilterOperator, TMDataGridFilterValue, TMDataGridPersistKey, TMDataGridPersistence, TMDataGridProps, TMDataGridRowData, TMDataGridSettingsSlice, TMDataGridSize, TMDataGridStorageMode, TMDataGridTable$1 as TMDataGridTable, TMDataGridTableMeta, TMDataGridUiActions, TMDataGridUiState, TMDataGridUiStore, UseTMDataGridOptions };
|
|
695
|
+
declare function moveColumnByStep({ table, columnId, direction }: ColumnStepArgs): void;
|
|
696
|
+
//#endregion
|
|
697
|
+
export { type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_TMDATAGRID_SIZE, FILTER_OPERATOR_LABELS, type MoveColumnArgs, 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, type TMDataGridFilterValue, type TMDataGridFooterProps, type TMDataGridPaginationApi, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridRowData, type TMDataGridRowSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type UseTMDataGridOptions, createTMDataGridColumnHelper, getColumnCapabilities, getColumnLabel, getColumnRegion, getColumnType, getGridCapabilities, getStepTargetColumn, getTMDataGridPaginationApi, isColumnReorderable, isFilterActive, moveColumn, moveColumnByStep, openColumnFilter, readFeatureFlags, tmDataGridFeatures, useTMDataGrid, useTMDataGridContext };
|