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