@jielga/tmdatagrid 0.5.0 → 1.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 +25 -2
- package/dist/index.d.ts +856 -14
- package/dist/index.js +3370 -1546
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.layer.css +1 -0
- package/package.json +12 -2
- package/skills/columns/SKILL.md +1 -1
- package/skills/features/SKILL.md +1 -1
- package/skills/getting-started/SKILL.md +1 -1
- package/skills/options/SKILL.md +1 -1
- package/skills/server-side/SKILL.md +1 -1
- package/skills/testing/SKILL.md +198 -0
- package/src/tmdatagrid/components/TMDataGrid.module.css +11 -0
- package/src/tmdatagrid/components/TMDataGrid.tsx +34 -0
- package/src/tmdatagrid/components/TMDataGridCellEditor.tsx +256 -0
- package/src/tmdatagrid/components/TMDataGridColumnsPanel.tsx +35 -12
- package/src/tmdatagrid/components/TMDataGridDetailsColumn.tsx +3 -0
- package/src/tmdatagrid/components/TMDataGridEditActions.tsx +62 -0
- package/src/tmdatagrid/components/TMDataGridEditColumn.tsx +237 -0
- package/src/tmdatagrid/components/TMDataGridEntryRows.tsx +164 -0
- package/src/tmdatagrid/components/TMDataGridFilterPanel.tsx +77 -62
- package/src/tmdatagrid/components/TMDataGridFilterPills.tsx +6 -0
- package/src/tmdatagrid/components/TMDataGridFooter.tsx +10 -3
- package/src/tmdatagrid/components/TMDataGridGroupColumn.tsx +2 -0
- package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +15 -2
- package/src/tmdatagrid/components/TMDataGridHeaderCell.tsx +21 -4
- package/src/tmdatagrid/components/TMDataGridRowNumberColumn.tsx +44 -0
- package/src/tmdatagrid/components/TMDataGridSearch.tsx +2 -0
- package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +3 -0
- package/src/tmdatagrid/components/TMDataGridTable.module.css +206 -0
- package/src/tmdatagrid/components/TMDataGridTable.tsx +841 -57
- package/src/tmdatagrid/components/TMDataGridToolbar.tsx +12 -7
- package/src/tmdatagrid/components/editors/TMDataGridBooleanEditor.tsx +29 -0
- package/src/tmdatagrid/components/editors/TMDataGridDateEditor.tsx +57 -0
- package/src/tmdatagrid/components/editors/TMDataGridMultiSelectEditor.tsx +45 -0
- package/src/tmdatagrid/components/editors/TMDataGridNumberEditor.tsx +38 -0
- package/src/tmdatagrid/components/editors/TMDataGridSelectEditor.tsx +53 -0
- package/src/tmdatagrid/components/editors/TMDataGridStringEditor.tsx +31 -0
- package/src/tmdatagrid/components/editors/editorShared.ts +48 -0
- package/src/tmdatagrid/components/filters/DgAutocompleteFilter.tsx +46 -0
- package/src/tmdatagrid/components/filters/DgDateRangeFilter.tsx +43 -0
- package/src/tmdatagrid/components/filters/DgRangeSliderFilter.tsx +52 -0
- package/src/tmdatagrid/components/filters/DgTriStateFilter.tsx +38 -0
- package/src/tmdatagrid/components/filters/TMDataGridFilterValueInput.tsx +122 -0
- package/src/tmdatagrid/components/icons.ts +4 -0
- package/src/tmdatagrid/core/autosize.ts +1 -1
- package/src/tmdatagrid/core/capabilities.ts +37 -1
- package/src/tmdatagrid/core/cellNavigation.ts +41 -0
- package/src/tmdatagrid/core/columnUtils.ts +31 -6
- package/src/tmdatagrid/core/editEngine.ts +857 -0
- package/src/tmdatagrid/core/filterControls.ts +45 -0
- package/src/tmdatagrid/core/filterOperators.ts +72 -4
- package/src/tmdatagrid/core/labels.ts +68 -1
- package/src/tmdatagrid/core/labelsSv.ts +24 -1
- package/src/tmdatagrid/core/matchHighlight.ts +96 -0
- package/src/tmdatagrid/core/persistence.ts +97 -3
- package/src/tmdatagrid/core/quickSearch.ts +144 -0
- package/src/tmdatagrid/core/rowPinning.ts +37 -0
- package/src/tmdatagrid/core/rowSelection.ts +10 -1
- package/src/tmdatagrid/index.ts +51 -0
- package/src/tmdatagrid/useTMDataGrid.tsx +456 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Cell, Column, ColumnPinningState, ExpandedState, Row, RowData, RowSelectionState, Table, TableFeatures, TableOptions, TableState, aggregationFns } from "@tanstack/react-table";
|
|
2
|
-
import { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { CSSProperties, ComponentType, MouseEvent, MutableRefObject, ReactNode } from "react";
|
|
3
3
|
import { MantineSize, MenuProps } from "@mantine/core";
|
|
4
4
|
import { Store } from "@tanstack/store";
|
|
5
|
+
import { AnyFieldApi, AnyFormApi, StandardSchemaV1 } from "@tanstack/react-form";
|
|
6
|
+
import { RankingInfo } from "@tanstack/match-sorter-utils";
|
|
5
7
|
//#region .types-tmp/components/TMDataGridColumnsPanel.d.ts
|
|
6
8
|
/**
|
|
7
9
|
* The "Manage columns" surface. Reachable from every column header menu and
|
|
@@ -10,6 +12,24 @@ import { Store } from "@tanstack/store";
|
|
|
10
12
|
*/
|
|
11
13
|
declare function TMDataGridColumnsPanel(): import("react").JSX.Element;
|
|
12
14
|
//#endregion
|
|
15
|
+
//#region .types-tmp/components/TMDataGridEditActions.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Batch mode's toolbar chrome: Save with the dirty-row count, and Discard.
|
|
18
|
+
* Both read the edit store, so they grey out while nothing is dirty and the
|
|
19
|
+
* Save spins while a submit is in flight. Works under any `editMode` — a
|
|
20
|
+
* cellConfirm grid accumulating drafts can offer the same pair — and renders
|
|
21
|
+
* nothing while editing is off.
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <TMDataGrid.Toolbar>
|
|
25
|
+
* <TMDataGrid.SummaryCount />
|
|
26
|
+
* <TMDataGrid.Spacer />
|
|
27
|
+
* <TMDataGrid.EditActions />
|
|
28
|
+
* </TMDataGrid.Toolbar>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare function TMDataGridEditActions(): import("react").JSX.Element | null;
|
|
32
|
+
//#endregion
|
|
13
33
|
//#region .types-tmp/components/TMDataGridFilterPanel.d.ts
|
|
14
34
|
/**
|
|
15
35
|
* The MUI-style filter surface: one row per active column filter, each row a
|
|
@@ -144,21 +164,27 @@ declare function optionsToComboboxData(options: ReadonlyArray<TMDataGridOption>)
|
|
|
144
164
|
* `manualFiltering` table (just forward `columnFilters` to the API).
|
|
145
165
|
*
|
|
146
166
|
* `value` is a string array under `isAnyOf` / `isNoneOf` (the set the cell is
|
|
147
|
-
* tested against)
|
|
148
|
-
*
|
|
167
|
+
* tested against), a `[min, max]` pair under `between` (an empty string means
|
|
168
|
+
* that end is open), and a single string everywhere else — dates travel as
|
|
169
|
+
* ISO `YYYY-MM-DD` strings, booleans as `"true"` / `"false"`. Still plain
|
|
170
|
+
* JSON.
|
|
149
171
|
*/
|
|
150
172
|
type TMDataGridFilterValue = {
|
|
151
173
|
operator: TMDataGridFilterOperator;
|
|
152
174
|
value: string | ReadonlyArray<string>;
|
|
153
175
|
};
|
|
154
176
|
type TMDataGridColumnType = "string" | "number" | "boolean" | "date" | "select" | "multiSelect";
|
|
155
|
-
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
|
|
177
|
+
type TMDataGridFilterOperator = "contains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "between" | "before" | "after" | "onOrBefore" | "onOrAfter" | "isAnyOf" | "isNoneOf" | "isEmpty" | "isNotEmpty";
|
|
156
178
|
declare const FILTER_OPERATOR_LABELS: Record<TMDataGridFilterOperator, string>;
|
|
157
179
|
declare function getOperatorsForType(type: TMDataGridColumnType): readonly TMDataGridFilterOperator[];
|
|
158
180
|
declare function getDefaultOperator(type: TMDataGridColumnType): TMDataGridFilterOperator;
|
|
159
181
|
declare function operatorNeedsValue(operator: TMDataGridFilterOperator): boolean;
|
|
160
182
|
/** Whether the operator's value is a string array — `isAnyOf` / `isNoneOf`. */
|
|
161
183
|
declare function operatorTakesArrayValue(operator: TMDataGridFilterOperator): boolean;
|
|
184
|
+
/** Whether the operator's value is a `[min, max]` pair — `between`. */
|
|
185
|
+
declare function operatorTakesRangeValue(operator: TMDataGridFilterOperator): boolean;
|
|
186
|
+
/** The untouched value a fresh filter starts with — the operator's shape, empty. */
|
|
187
|
+
declare function emptyValueForOperator(operator: TMDataGridFilterOperator): string | ReadonlyArray<string>;
|
|
162
188
|
/**
|
|
163
189
|
* A filter only narrows the row set once it has something to compare against.
|
|
164
190
|
* Half-typed filters stay in state (so the panel keeps rendering their row) but
|
|
@@ -186,6 +212,267 @@ declare function formatFilterLabel({ label, type, filter, operatorLabels }: {
|
|
|
186
212
|
*/
|
|
187
213
|
declare function tmDataGridFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown): boolean;
|
|
188
214
|
//#endregion
|
|
215
|
+
//#region .types-tmp/core/editEngine.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* How commits happen — one axis, each mode a thin policy over the same
|
|
218
|
+
* engine. See `editMode` on `UseTMDataGridOptions`.
|
|
219
|
+
*/
|
|
220
|
+
type TMDataGridEditMode = "cell" | "cellConfirm" | "row" | "batch";
|
|
221
|
+
/**
|
|
222
|
+
* One editing row's live form. TanStack Form's `FormApi`, not a wrapper: the
|
|
223
|
+
* engine is a form library, and everything mid-edit — values, dirty state,
|
|
224
|
+
* errors, async validation, submit lifecycle — is form state, read off
|
|
225
|
+
* `form.store` with the same selector idiom as the rest of the grid.
|
|
226
|
+
*
|
|
227
|
+
* The alias erases Form's validator generics the way `TMDataGridRowData`
|
|
228
|
+
* erases the row type: the concrete types lived at the `useTMDataGrid` call.
|
|
229
|
+
*/
|
|
230
|
+
type TMDataGridRowEditForm = AnyFormApi;
|
|
231
|
+
/** The live field a cell editor binds to — TanStack Form's own `FieldApi`. */
|
|
232
|
+
type TMDataGridEditField = AnyFieldApi;
|
|
233
|
+
/**
|
|
234
|
+
* A validator as TanStack Form takes it: a Standard Schema (Zod, Valibot,
|
|
235
|
+
* ArkType…) or a plain function returning an error or nothing. Forwarded
|
|
236
|
+
* untouched — the vocabulary is Form's, not a grid re-implementation.
|
|
237
|
+
*/
|
|
238
|
+
type TMDataGridValidator = StandardSchemaV1<unknown, unknown> | ((args: {
|
|
239
|
+
value: never;
|
|
240
|
+
fieldApi: never;
|
|
241
|
+
}) => unknown);
|
|
242
|
+
/**
|
|
243
|
+
* `meta.validate` — per-column field validators. A bare schema or function is
|
|
244
|
+
* shorthand for `{ onChange: it }`; the object form takes every trigger
|
|
245
|
+
* TanStack Form defines, `Async` variants and debounce included.
|
|
246
|
+
*/
|
|
247
|
+
type TMDataGridFieldValidate = TMDataGridValidator | {
|
|
248
|
+
onMount?: TMDataGridValidator;
|
|
249
|
+
onChange?: TMDataGridValidator;
|
|
250
|
+
onChangeAsync?: TMDataGridValidator;
|
|
251
|
+
onChangeAsyncDebounceMs?: number;
|
|
252
|
+
onBlur?: TMDataGridValidator;
|
|
253
|
+
onBlurAsync?: TMDataGridValidator;
|
|
254
|
+
onSubmit?: TMDataGridValidator;
|
|
255
|
+
onSubmitAsync?: TMDataGridValidator;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* `rowValidators` — form-level validators for the whole row, where
|
|
259
|
+
* cross-field rules live. Passed into each row form's `validators` untouched;
|
|
260
|
+
* pathed issues land on the matching fields, pathless ones on the row.
|
|
261
|
+
*/
|
|
262
|
+
type TMDataGridRowValidators = {
|
|
263
|
+
onMount?: TMDataGridValidator;
|
|
264
|
+
onChange?: TMDataGridValidator;
|
|
265
|
+
onChangeAsync?: TMDataGridValidator;
|
|
266
|
+
onChangeAsyncDebounceMs?: number;
|
|
267
|
+
onBlur?: TMDataGridValidator;
|
|
268
|
+
onBlurAsync?: TMDataGridValidator;
|
|
269
|
+
onSubmit?: TMDataGridValidator;
|
|
270
|
+
onSubmitAsync?: TMDataGridValidator;
|
|
271
|
+
onSubmitAsyncDebounceMs?: number;
|
|
272
|
+
};
|
|
273
|
+
/** One field's before/after across a commit. */
|
|
274
|
+
type TMDataGridEditChange = {
|
|
275
|
+
/** Column the field maps back to, for consumers thinking in columns. */
|
|
276
|
+
columnId: string;
|
|
277
|
+
/** The data path — `getEditFieldName` of the column. */
|
|
278
|
+
field: string;
|
|
279
|
+
previous: unknown;
|
|
280
|
+
next: unknown;
|
|
281
|
+
};
|
|
282
|
+
type TMDataGridEditCommitArgs<TData extends RowData> = {
|
|
283
|
+
rowId: string;
|
|
284
|
+
/** The whole row as edited — for the consumer who saves records. */
|
|
285
|
+
value: TData;
|
|
286
|
+
/** The row as it was when editing began. */
|
|
287
|
+
original: TData;
|
|
288
|
+
/** Per-field diff — for the consumer who PATCHes. One entry in cell mode. */
|
|
289
|
+
changes: Array<TMDataGridEditChange>;
|
|
290
|
+
/** Which policy committed. */
|
|
291
|
+
source: TMDataGridEditMode;
|
|
292
|
+
};
|
|
293
|
+
/** What one open row's form looks like from outside — the cell markers. */
|
|
294
|
+
type TMDataGridEditRowProjection = {
|
|
295
|
+
/** Field names whose value differs from the original. */
|
|
296
|
+
dirtyFields: ReadonlyArray<string>;
|
|
297
|
+
/** Field names carrying a validation error. */
|
|
298
|
+
errorFields: ReadonlyArray<string>;
|
|
299
|
+
/** A row-level error — a pathless `.refine()`, or a rejected commit. */
|
|
300
|
+
hasRowError: boolean;
|
|
301
|
+
isSubmitting: boolean;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* The grid-facing index of everything mid-edit. A projection synced from the
|
|
305
|
+
* open forms' stores, so body cells subscribe to this one store for their
|
|
306
|
+
* dirty/error markers instead of one store per form. Only the editor host
|
|
307
|
+
* reads a form's store directly — it is mounted for one cell at a time.
|
|
308
|
+
*/
|
|
309
|
+
type TMDataGridEditState = {
|
|
310
|
+
/** The cell whose editor is open; `columnId: null` is a whole row (row mode). */
|
|
311
|
+
active: {
|
|
312
|
+
rowId: string;
|
|
313
|
+
columnId: string | null;
|
|
314
|
+
} | null;
|
|
315
|
+
/** Rows with a live form. In cell mode at most one; in batch, many. */
|
|
316
|
+
openRowIds: ReadonlyArray<string>;
|
|
317
|
+
rows: Record<string, TMDataGridEditRowProjection>;
|
|
318
|
+
/** Phase 4 — rows being created, not yet in `data`. */
|
|
319
|
+
newRows: ReadonlyArray<{
|
|
320
|
+
tempId: string;
|
|
321
|
+
}>;
|
|
322
|
+
/** Phase 4 — rows marked deleted under batch mode. */
|
|
323
|
+
deletedRowIds: ReadonlyArray<string>;
|
|
324
|
+
};
|
|
325
|
+
type ErasedRow = Row<TMDataGridFeatures, TMDataGridRowData>;
|
|
326
|
+
type ErasedColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
327
|
+
/**
|
|
328
|
+
* What a cell editor is handed — deliberately both vocabularies at once. The
|
|
329
|
+
* form side is TanStack Form's real `field` API (`field.state.value`,
|
|
330
|
+
* `field.state.meta.errors`, `field.handleChange`, `field.handleBlur`), so a
|
|
331
|
+
* custom calendar, slider or async combobox binds to it exactly as it would
|
|
332
|
+
* inside any TanStack Form. The table side is where the editor is standing.
|
|
333
|
+
*
|
|
334
|
+
* The built-ins are implemented against this same contract, so
|
|
335
|
+
* `meta.editor` is not a special case — it is the slot the defaults
|
|
336
|
+
* fill, and the exported built-ins can be wrapped instead of replaced.
|
|
337
|
+
*/
|
|
338
|
+
type TMDataGridEditorArgs = {
|
|
339
|
+
/** The live TanStack Form field for this cell. */
|
|
340
|
+
field: TMDataGridEditField;
|
|
341
|
+
/** The whole row form, for the rare editor that reads sibling fields. */
|
|
342
|
+
form: TMDataGridRowEditForm;
|
|
343
|
+
cell: Cell<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
344
|
+
row: ErasedRow;
|
|
345
|
+
column: ErasedColumn;
|
|
346
|
+
table: TMDataGridTable<TMDataGridRowData>;
|
|
347
|
+
/** What Enter would do — commit the edit. For the editor's own UI. */
|
|
348
|
+
commit: () => Promise<boolean>;
|
|
349
|
+
/** What Escape would do — drop the draft. */
|
|
350
|
+
cancel: () => void;
|
|
351
|
+
size: TMDataGridSize;
|
|
352
|
+
/**
|
|
353
|
+
* Whether this editor should take the focus on mount. True for a single
|
|
354
|
+
* opened cell; in row mode only the row's first editable cell gets it.
|
|
355
|
+
*/
|
|
356
|
+
autoFocus: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Set when typing opened the editor (the Sheets gesture) — the built-ins
|
|
359
|
+
* replace the value with it and keep typing. A custom editor may ignore it.
|
|
360
|
+
*/
|
|
361
|
+
seedText?: string;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* `meta.editor` — replaces the built-in editor for this column. Rendered as
|
|
365
|
+
* JSX, never invoked as a bare function, so hooks are legal inside. Define it
|
|
366
|
+
* at module scope: a new identity per render remounts the editor mid-edit.
|
|
367
|
+
*/
|
|
368
|
+
type TMDataGridEditorComponent = ComponentType<TMDataGridEditorArgs>;
|
|
369
|
+
/** A new row being committed — `onRowAdd`, and `submitAll`'s `added`. */
|
|
370
|
+
type TMDataGridRowAddArgs<TData extends RowData> = {
|
|
371
|
+
/** The engine's placeholder id; the real id is the consumer's to mint. */
|
|
372
|
+
tempId: string;
|
|
373
|
+
value: TData;
|
|
374
|
+
};
|
|
375
|
+
/** A deletion — `onRowDelete`. */
|
|
376
|
+
type TMDataGridRowDeleteArgs<TData extends RowData> = {
|
|
377
|
+
rowId: string;
|
|
378
|
+
row: Row<TMDataGridFeatures, TData>;
|
|
379
|
+
};
|
|
380
|
+
/** What `submitAll` hands `onEditCommitBatch` — everything pending at once. */
|
|
381
|
+
type TMDataGridEditCommitBatchArgs<TData extends RowData> = {
|
|
382
|
+
/** Every valid dirty existing row. */
|
|
383
|
+
rows: Array<TMDataGridEditCommitArgs<TData>>;
|
|
384
|
+
/** Every valid new row from the entry block. */
|
|
385
|
+
added: Array<TMDataGridRowAddArgs<TData>>;
|
|
386
|
+
/** Ids marked deleted while the batch accumulated. */
|
|
387
|
+
deleted: Array<string>;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* The data path a column edits, or `null` for a column that has none.
|
|
391
|
+
*
|
|
392
|
+
* `accessorKey` is the true path and Form addresses fields by dot-path, so
|
|
393
|
+
* nested rows work for free: `accessorKey: "address.city"` edits
|
|
394
|
+
* `values.address.city`. A column built on `accessorFn` has no path and is
|
|
395
|
+
* not editable unless `meta.editField` names one. TanStack's default column
|
|
396
|
+
* id turns dots into underscores — which is why this starts from
|
|
397
|
+
* `accessorKey`, never from `id`.
|
|
398
|
+
*/
|
|
399
|
+
declare function getEditFieldName(column: {
|
|
400
|
+
columnDef: {
|
|
401
|
+
meta?: {
|
|
402
|
+
editField?: string;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
}): string | null;
|
|
406
|
+
/** What Delete writes into a cell — the type's honest empty value. */
|
|
407
|
+
declare function clearedValueForType(type: TMDataGridColumnType): unknown;
|
|
408
|
+
/**
|
|
409
|
+
* The engine plus its store — `api.edit`.
|
|
410
|
+
*
|
|
411
|
+
* "One row, one form": `getForm` hands out the same `FormApi` the inline
|
|
412
|
+
* editors write through, so a consumer can render it in a drawer or a detail
|
|
413
|
+
* panel and share values, dirty state and errors with the cells.
|
|
414
|
+
*/
|
|
415
|
+
type TMDataGridEditApi = {
|
|
416
|
+
/** The projection store — subscribe with `useSelector(edit.store, …)`. */
|
|
417
|
+
store: Store<TMDataGridEditState>;
|
|
418
|
+
/** Current snapshot, for reads outside React. */
|
|
419
|
+
readonly state: TMDataGridEditState;
|
|
420
|
+
/** rowId → live form. The source of truth for everything mid-edit. */
|
|
421
|
+
getForm: (rowId: string) => TMDataGridRowEditForm | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* Whether this cell may open an editor: the column maps to a field, nothing
|
|
424
|
+
* switched it off, and the row takes edits at all.
|
|
425
|
+
*/
|
|
426
|
+
canEditCell: (row: ErasedRow, column: ErasedColumn) => boolean;
|
|
427
|
+
/** Whether the row takes edits at all — the edit lane's pencil gate. */
|
|
428
|
+
canEditRow: (row: ErasedRow) => boolean;
|
|
429
|
+
/** Opens an editor. `columnId: null` opens the whole row (row mode). */
|
|
430
|
+
begin: (target: {
|
|
431
|
+
rowId: string;
|
|
432
|
+
columnId: string | null;
|
|
433
|
+
}) => void;
|
|
434
|
+
/**
|
|
435
|
+
* Commits one row — `form.handleSubmit` under the hood. Resolves `true`
|
|
436
|
+
* when the form is gone: validation passed and `onEditCommit` resolved, or
|
|
437
|
+
* there was nothing to save. `false` keeps the form open with its errors.
|
|
438
|
+
*/
|
|
439
|
+
commit: (rowId: string) => Promise<boolean>;
|
|
440
|
+
/** Drops one row's draft. */
|
|
441
|
+
cancel: (rowId: string) => void;
|
|
442
|
+
/**
|
|
443
|
+
* Closes the editor without touching the draft — what blur does under
|
|
444
|
+
* `"cellConfirm"`, where the dirty cell keeps waiting for its ✓.
|
|
445
|
+
*/
|
|
446
|
+
deactivate: () => void;
|
|
447
|
+
/** Drops every draft. */
|
|
448
|
+
cancelAll: () => void;
|
|
449
|
+
/** Commits every open row — batch mode's save. `true` when all landed. */
|
|
450
|
+
submitAll: () => Promise<boolean>;
|
|
451
|
+
/** Writes the type's empty value into a cell and commits it — Delete. */
|
|
452
|
+
clearCell: (rowId: string, columnId: string) => Promise<boolean>;
|
|
453
|
+
/**
|
|
454
|
+
* Opens a new entry row (the sticky block under the header) seeded from
|
|
455
|
+
* `newRowDefaults`. Returns its temporary id — a form with no backing row
|
|
456
|
+
* yet. Committing it calls `onRowAdd` (immediate modes) or joins
|
|
457
|
+
* `submitAll`'s `added` (batch).
|
|
458
|
+
*/
|
|
459
|
+
addRow: () => string;
|
|
460
|
+
/**
|
|
461
|
+
* Deletes a row: `onRowDelete` straight away under the immediate modes;
|
|
462
|
+
* under batch it toggles the id in `deletedRowIds` — the row renders
|
|
463
|
+
* struck through until `submitAll` reports it. On an uncommitted entry
|
|
464
|
+
* row it just discards the entry.
|
|
465
|
+
*/
|
|
466
|
+
deleteRow: (rowId: string) => void;
|
|
467
|
+
/** Whether delete chrome makes sense — the lane's trash gate. */
|
|
468
|
+
canDeleteRows: () => boolean;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* `meta.validate` normalised to the object TanStack Form's `validators`
|
|
472
|
+
* option takes — a bare schema or function is shorthand for `{ onChange }`.
|
|
473
|
+
*/
|
|
474
|
+
declare function normalizeFieldValidate(validate: TMDataGridFieldValidate | undefined): Record<string, unknown> | undefined;
|
|
475
|
+
//#endregion
|
|
189
476
|
//#region .types-tmp/core/labels.d.ts
|
|
190
477
|
/**
|
|
191
478
|
* Every user-facing string in the grid — menu items, panels, tooltips, the
|
|
@@ -210,10 +497,25 @@ type TMDataGridLabels = {
|
|
|
210
497
|
columnsNoMatch: (search: string) => string;
|
|
211
498
|
columnsShowHideAll: string;
|
|
212
499
|
columnsReset: string;
|
|
500
|
+
/** Tooltip on the reset button, stating everything the reset covers. */
|
|
501
|
+
columnsResetHint: string;
|
|
502
|
+
/** Menu/panel name of the generated row-number gutter. */
|
|
503
|
+
rowNumberColumnLabel: string;
|
|
504
|
+
/**
|
|
505
|
+
* The truly-empty message — no data and no filters. Filtered-empty says
|
|
506
|
+
* {@link noResults} instead; only one of the two is the user's own doing.
|
|
507
|
+
*/
|
|
508
|
+
noRows: string;
|
|
213
509
|
filterColumn: string;
|
|
214
510
|
filterOperator: string;
|
|
215
511
|
filterValue: string;
|
|
216
512
|
filterValuePlaceholder: string;
|
|
513
|
+
/** The lower bound of a `between` filter. */
|
|
514
|
+
filterFrom: string;
|
|
515
|
+
/** The upper bound of a `between` filter. */
|
|
516
|
+
filterTo: string;
|
|
517
|
+
/** `DgTriStateFilter`'s no-filter segment. */
|
|
518
|
+
filterAll: string;
|
|
217
519
|
/** What a boolean column's `true` reads as — its filter choice and cell text. */
|
|
218
520
|
booleanTrue: string;
|
|
219
521
|
booleanFalse: string;
|
|
@@ -252,6 +554,34 @@ type TMDataGridLabels = {
|
|
|
252
554
|
nextPage: string;
|
|
253
555
|
noResults: string;
|
|
254
556
|
loading: string;
|
|
557
|
+
/** `aria-label` of an open cell editor's input. */
|
|
558
|
+
editCell: (column: string) => string;
|
|
559
|
+
/** cellConfirm's ✓ beside the input. */
|
|
560
|
+
confirmEdit: string;
|
|
561
|
+
/** cellConfirm's ✕ beside the input. */
|
|
562
|
+
cancelEdit: string;
|
|
563
|
+
/** The generated edit lane's name in the column manager. */
|
|
564
|
+
editColumnLabel: string;
|
|
565
|
+
/** The lane's pencil. */
|
|
566
|
+
editRow: string;
|
|
567
|
+
/** The lane's ✓ while a row edit is open. */
|
|
568
|
+
saveRow: string;
|
|
569
|
+
/** The lane's ✕ while a row edit is open. */
|
|
570
|
+
cancelRowEdit: string;
|
|
571
|
+
/** Save tooltip when field errors block the row, with no row message. */
|
|
572
|
+
editRowErrors: string;
|
|
573
|
+
/** `EditActions`' Save, with the dirty-row count. */
|
|
574
|
+
saveAllEdits: (rows: number) => string;
|
|
575
|
+
/** `EditActions`' Discard. */
|
|
576
|
+
discardAllEdits: string;
|
|
577
|
+
/** The entry row's ✓ — commit the add. */
|
|
578
|
+
confirmNewRow: string;
|
|
579
|
+
/** The entry row's ✕ — drop the entry. */
|
|
580
|
+
discardNewRow: string;
|
|
581
|
+
/** The lane's trash can. */
|
|
582
|
+
deleteRow: string;
|
|
583
|
+
/** The lane's undo on a row marked deleted (batch). */
|
|
584
|
+
restoreRow: string;
|
|
255
585
|
cellCount: (count: number) => string;
|
|
256
586
|
copy: string;
|
|
257
587
|
exportCsv: string;
|
|
@@ -282,6 +612,61 @@ declare const TMDATAGRID_LABELS_EN: TMDataGridLabels;
|
|
|
282
612
|
/** A partial override folded over the English defaults. */
|
|
283
613
|
declare function mergeLabels(override?: TMDataGridLabelsOverride): TMDataGridLabels;
|
|
284
614
|
//#endregion
|
|
615
|
+
//#region .types-tmp/core/filterControls.d.ts
|
|
616
|
+
/**
|
|
617
|
+
* What a filter control is handed — the value slot of one filter-panel row.
|
|
618
|
+
*
|
|
619
|
+
* The contract is value-only: the control reads `operator` to shape itself
|
|
620
|
+
* (a `between` pair renders two ends, an `equals` a single input) and calls
|
|
621
|
+
* `onChange` with the bare value; the grid composes the operator-aware
|
|
622
|
+
* `TMDataGridFilterValue` around it. A control never builds that wrapper and
|
|
623
|
+
* never writes the operator — `table` is the escape hatch for the rare
|
|
624
|
+
* control that must.
|
|
625
|
+
*/
|
|
626
|
+
type TMDataGridFilterControlArgs = {
|
|
627
|
+
column: Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
628
|
+
table: TMDataGridTable<TMDataGridRowData>;
|
|
629
|
+
/** The row's currently selected operator. Read-only for the control. */
|
|
630
|
+
operator: TMDataGridFilterOperator;
|
|
631
|
+
/** The bare filter value — never the `{ operator, value }` wrapper. */
|
|
632
|
+
value: string | ReadonlyArray<string>;
|
|
633
|
+
/** Writes the bare value; the grid pairs it with the current operator. */
|
|
634
|
+
onChange: (next: string | ReadonlyArray<string>) => void;
|
|
635
|
+
/**
|
|
636
|
+
* The column's options through `resolveColumnOptions`, pre-resolved for a
|
|
637
|
+
* column that declares `meta.options` or is select-shaped. Empty otherwise —
|
|
638
|
+
* a control wanting faceted values on other columns resolves them itself.
|
|
639
|
+
*/
|
|
640
|
+
options: ReadonlyArray<TMDataGridOption>;
|
|
641
|
+
size: TMDataGridSize;
|
|
642
|
+
labels: TMDataGridLabels;
|
|
643
|
+
};
|
|
644
|
+
/**
|
|
645
|
+
* `meta.filterControl` — replaces the built-in value control for this column.
|
|
646
|
+
* Rendered as JSX, never invoked as a bare function, so hooks are legal
|
|
647
|
+
* inside. Define it at module scope so its identity is stable across renders.
|
|
648
|
+
*/
|
|
649
|
+
type TMDataGridFilterControlComponent = ComponentType<TMDataGridFilterControlArgs>;
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region .types-tmp/core/quickSearch.d.ts
|
|
652
|
+
/** How the quick search matches — see `quickSearchMode` on the hook options. */
|
|
653
|
+
type TMDataGridQuickSearchMode = "fuzzy" | "contains";
|
|
654
|
+
/** What {@link fuzzyGlobalFilterFn} records per column via `addMeta`. */
|
|
655
|
+
type FuzzyFilterMeta = {
|
|
656
|
+
fuzzyRank: RankingInfo;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Match-sorter ranking as the global filter: a row passes when a globally
|
|
660
|
+
* filterable column ranks above match-sorter's threshold — typos and skipped
|
|
661
|
+
* characters forgiven — and the rank is recorded for the ordering to read.
|
|
662
|
+
*
|
|
663
|
+
* TanStack stops probing a row's columns at the first passing one, so the
|
|
664
|
+
* recorded ranks cover the columns up to and including it; the best of those
|
|
665
|
+
* stands for the row. Good enough for a quick search: the first passing
|
|
666
|
+
* column is almost always the one the user is looking at.
|
|
667
|
+
*/
|
|
668
|
+
declare function fuzzyGlobalFilterFn<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, columnId: string, filterValue: unknown, addMeta?: (meta: FuzzyFilterMeta) => void): boolean;
|
|
669
|
+
//#endregion
|
|
285
670
|
//#region .types-tmp/core/persistence.d.ts
|
|
286
671
|
type GridState = TableState<TMDataGridFeatures>;
|
|
287
672
|
/**
|
|
@@ -332,6 +717,15 @@ type TMDataGridPersistence = {
|
|
|
332
717
|
/** Parses a stored payload. Defaults to `JSON.parse`. */
|
|
333
718
|
deserialize?: (value: string) => unknown;
|
|
334
719
|
};
|
|
720
|
+
/**
|
|
721
|
+
* Version stamped into every stored payload, under a key no state slice can
|
|
722
|
+
* collide with. A payload whose version does not match is dropped whole: a
|
|
723
|
+
* migration would be guessing at a shape this code no longer knows, and the
|
|
724
|
+
* cost of dropping is one lost layout. Payloads written before versioning
|
|
725
|
+
* existed (≤0.4.0) have no stamp and are dropped the same way — the 1.0
|
|
726
|
+
* wave's one-time break, named in its changeset.
|
|
727
|
+
*/
|
|
728
|
+
declare const PERSIST_PAYLOAD_VERSION = 1;
|
|
335
729
|
//#endregion
|
|
336
730
|
//#region .types-tmp/core/capabilities.d.ts
|
|
337
731
|
/**
|
|
@@ -442,8 +836,27 @@ type TMDataGridFeatureFlags = {
|
|
|
442
836
|
* its own grouping can still say `enableGrouping: true` to override.
|
|
443
837
|
*/
|
|
444
838
|
grouping: boolean;
|
|
839
|
+
/** Whether cells can be edited at all — `editMode` was set. */
|
|
840
|
+
editing: boolean;
|
|
841
|
+
/** The commit policy, or `null` while editing is off. */
|
|
842
|
+
editMode: TMDataGridEditMode | null;
|
|
843
|
+
/** The generated row-number gutter — `enableRowNumbers`. Off by default. */
|
|
844
|
+
rowNumbers: boolean;
|
|
845
|
+
/**
|
|
846
|
+
* Whether rows can be pinned to the top or bottom edge — `enableRowPinning`,
|
|
847
|
+
* boolean or per-row predicate. Off by default: pinning has no built-in
|
|
848
|
+
* gesture, so a grid that never calls `row.pin()` has nothing to gain from
|
|
849
|
+
* the body watching the state.
|
|
850
|
+
*/
|
|
851
|
+
rowPinning: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Whether cells highlight the matched text while a contains-family filter
|
|
854
|
+
* or the quick search is active — `enableMatchHighlighting`. Off by
|
|
855
|
+
* default, so a grid that has not asked pays nothing per cell.
|
|
856
|
+
*/
|
|
857
|
+
matchHighlighting: boolean;
|
|
445
858
|
};
|
|
446
|
-
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableGlobalFilter" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection" | "enableMultiRowSelection" | "selectionMode" | "showSelectedBackground" | "cellSelection" | "enablePagination" | "manualPagination" | "enableGrouping">): TMDataGridFeatureFlags;
|
|
859
|
+
declare function readFeatureFlags<TData extends RowData>(options: Pick<UseTMDataGridOptions<TData>, "enableSorting" | "enableColumnFilters" | "enableGlobalFilter" | "enableHiding" | "enableColumnPinning" | "enableColumnResizing" | "enableColumnOrdering" | "enableRowSelection" | "enableMultiRowSelection" | "selectionMode" | "showSelectedBackground" | "cellSelection" | "enablePagination" | "manualPagination" | "enableGrouping" | "editMode" | "enableRowNumbers" | "enableRowPinning" | "enableMatchHighlighting">): TMDataGridFeatureFlags;
|
|
447
860
|
/**
|
|
448
861
|
* What one column's header may offer.
|
|
449
862
|
*
|
|
@@ -628,6 +1041,51 @@ type TMDataGridColumnMeta = {
|
|
|
628
1041
|
* so its switch lives here rather than on the column definition.
|
|
629
1042
|
*/
|
|
630
1043
|
enableOrdering?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* The operator a fresh filter on this column starts with, instead of the
|
|
1046
|
+
* type's default — a salary column can open on `"between"`. Must be one of
|
|
1047
|
+
* the type's own operators.
|
|
1048
|
+
*/
|
|
1049
|
+
defaultFilterOperator?: TMDataGridFilterOperator;
|
|
1050
|
+
/**
|
|
1051
|
+
* Replaces the built-in value control in this column's filter-panel row. A
|
|
1052
|
+
* component rendered as JSX — hooks are legal inside — receiving the
|
|
1053
|
+
* value-only contract: it reads the current operator, writes the bare
|
|
1054
|
+
* value, and the grid composes the stored filter around it. Define it at
|
|
1055
|
+
* module scope. See {@link TMDataGridFilterControlArgs}.
|
|
1056
|
+
*/
|
|
1057
|
+
filterControl?: TMDataGridFilterControlComponent;
|
|
1058
|
+
/**
|
|
1059
|
+
* Whether this column's cells take edits, once `editMode` is on. `false`
|
|
1060
|
+
* switches the column off outright; a predicate decides per row. Defaults
|
|
1061
|
+
* to editable for any column that maps to a field — see {@link editField}.
|
|
1062
|
+
*/
|
|
1063
|
+
editable?: boolean | ((row: Row<TMDataGridFeatures, TMDataGridRowData>) => boolean);
|
|
1064
|
+
/**
|
|
1065
|
+
* The data path this column edits, when it is not the `accessorKey` — the
|
|
1066
|
+
* only way a column built on `accessorFn` becomes editable. Dot paths reach
|
|
1067
|
+
* into nested records: `"address.city"`.
|
|
1068
|
+
*/
|
|
1069
|
+
editField?: string;
|
|
1070
|
+
/**
|
|
1071
|
+
* Field-level validators, in TanStack Form's own vocabulary. A bare Zod
|
|
1072
|
+
* schema (or any Standard Schema, or a plain function) means
|
|
1073
|
+
* `{ onChange: it }`; the object form takes every trigger Form defines.
|
|
1074
|
+
*
|
|
1075
|
+
* ```tsx
|
|
1076
|
+
* meta: { validate: z.string().min(2, "Too short") }
|
|
1077
|
+
* meta: { validate: { onBlur: z.string().email() } }
|
|
1078
|
+
* ```
|
|
1079
|
+
*/
|
|
1080
|
+
validate?: TMDataGridFieldValidate;
|
|
1081
|
+
/**
|
|
1082
|
+
* Replaces the built-in editor for this column. A component rendered as
|
|
1083
|
+
* JSX — hooks are legal inside — receiving the live TanStack Form `field`
|
|
1084
|
+
* API plus the table context, the same contract the built-ins fill. Define
|
|
1085
|
+
* it at module scope so its identity is stable across renders. See
|
|
1086
|
+
* {@link TMDataGridEditorArgs}.
|
|
1087
|
+
*/
|
|
1088
|
+
editor?: TMDataGridEditorComponent;
|
|
631
1089
|
};
|
|
632
1090
|
/** Grid-wide configuration passed through `options.meta`. */
|
|
633
1091
|
type TMDataGridTableMeta = {
|
|
@@ -659,6 +1117,7 @@ declare const tmDataGridFeatures: {
|
|
|
659
1117
|
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
660
1118
|
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
661
1119
|
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
1120
|
+
rowPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
662
1121
|
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
663
1122
|
groupedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
664
1123
|
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
@@ -704,6 +1163,7 @@ declare const tmDataGridFeatures: {
|
|
|
704
1163
|
autoRemove: (val: any) => boolean;
|
|
705
1164
|
};
|
|
706
1165
|
tmDataGrid: typeof tmDataGridFilterFn;
|
|
1166
|
+
tmDataGridFuzzy: typeof fuzzyGlobalFilterFn;
|
|
707
1167
|
};
|
|
708
1168
|
sortFns: {
|
|
709
1169
|
alphanumeric: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData extends RowData>(rowA: Row<TFeatures, TData>, rowB: Row<TFeatures, TData>, columnId: string) => number;
|
|
@@ -743,6 +1203,7 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): import("
|
|
|
743
1203
|
columnFacetingFeature: import("@tanstack/table-core").TableFeature;
|
|
744
1204
|
columnGroupingFeature: import("@tanstack/table-core").TableFeature;
|
|
745
1205
|
rowExpandingFeature: import("@tanstack/table-core").TableFeature;
|
|
1206
|
+
rowPinningFeature: import("@tanstack/table-core").TableFeature;
|
|
746
1207
|
filteredRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
747
1208
|
groupedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
748
1209
|
sortedRowModel: (table: Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
|
|
@@ -788,6 +1249,7 @@ declare function createTMDataGridColumnHelper<TData extends RowData>(): import("
|
|
|
788
1249
|
autoRemove: (val: any) => boolean;
|
|
789
1250
|
};
|
|
790
1251
|
tmDataGrid: typeof tmDataGridFilterFn;
|
|
1252
|
+
tmDataGridFuzzy: typeof fuzzyGlobalFilterFn;
|
|
791
1253
|
};
|
|
792
1254
|
sortFns: {
|
|
793
1255
|
alphanumeric: <TFeatures extends import("@tanstack/table-core").TableFeatures, TData_1 extends RowData>(rowA: Row<TFeatures, TData_1>, rowB: Row<TFeatures, TData_1>, columnId: string) => number;
|
|
@@ -895,10 +1357,27 @@ type TMDataGridUiActions = {
|
|
|
895
1357
|
setCellRange: (range: TMDataGridCellRange | null) => void;
|
|
896
1358
|
};
|
|
897
1359
|
type TMDataGridUiStore = Store<TMDataGridUiState, TMDataGridUiActions>;
|
|
1360
|
+
/** Where a scrolled-to row lands in the viewport. TanStack's own alignments. */
|
|
1361
|
+
type TMDataGridScrollAlign = "auto" | "start" | "center" | "end";
|
|
1362
|
+
type TMDataGridScrollToRowArgs = {
|
|
1363
|
+
/** The row's id, as `getRowId` produced it. */
|
|
1364
|
+
rowId: string;
|
|
1365
|
+
/** Defaults to `"auto"` — the nearest edge, leaving a visible row alone. */
|
|
1366
|
+
align?: TMDataGridScrollAlign;
|
|
1367
|
+
};
|
|
1368
|
+
/** @internal The body's scroll implementation. See `scrollToRow`. */
|
|
1369
|
+
type TMDataGridScroller = (args: TMDataGridScrollToRowArgs) => boolean;
|
|
898
1370
|
/** What `useTMDataGrid` returns — spread straight onto `<TMDataGrid />`. */
|
|
899
1371
|
type TMDataGridApi<TData extends RowData> = {
|
|
900
1372
|
table: TMDataGridTable<TData>;
|
|
901
1373
|
ui: TMDataGridUiStore;
|
|
1374
|
+
/**
|
|
1375
|
+
* The edit engine — open forms, dirty/error projections, and the verbs
|
|
1376
|
+
* (`begin`, `commit`, `cancel`, `submitAll`). `edit.getForm(rowId)` hands
|
|
1377
|
+
* out the same TanStack Form the inline editors write through, so a drawer
|
|
1378
|
+
* or detail panel can share a row's draft. Inert until `editMode` is set.
|
|
1379
|
+
*/
|
|
1380
|
+
edit: TMDataGridEditApi;
|
|
902
1381
|
/** Table-level feature switches, re-read from options on every render. */
|
|
903
1382
|
features: TMDataGridFeatureFlags;
|
|
904
1383
|
/** Every string the chrome renders, `labels` merged over the English defaults. */
|
|
@@ -909,8 +1388,144 @@ type TMDataGridApi<TData extends RowData> = {
|
|
|
909
1388
|
renderDetailsEstHeight: number;
|
|
910
1389
|
/** Virtualizer overscan: the option, or {@link DEFAULT_OVERSCAN}. */
|
|
911
1390
|
overscan: number;
|
|
1391
|
+
/**
|
|
1392
|
+
* Puts the settings state — visibility, order, widths, pinning, grouping —
|
|
1393
|
+
* back to what a first visit with clean storage would have shown: the
|
|
1394
|
+
* consumer's `initialState` plus the structural lanes. With persistence
|
|
1395
|
+
* configured the reset writes through to storage like any other change.
|
|
1396
|
+
*
|
|
1397
|
+
* This, not TanStack's `resetColumnX()` family, is the reset for a
|
|
1398
|
+
* persisted grid: those reset to `initialState`, and the grid bakes the
|
|
1399
|
+
* restored payload into `initialState` at mount — they would "reset" to
|
|
1400
|
+
* the very layout being discarded.
|
|
1401
|
+
*/
|
|
1402
|
+
resetSettings: () => void;
|
|
1403
|
+
/**
|
|
1404
|
+
* Scrolls a row into view. The grid is always virtualized, so a row far down
|
|
1405
|
+
* the list has no element to scroll to — this moves the virtualizer instead,
|
|
1406
|
+
* which is the only thing that can put one there.
|
|
1407
|
+
*
|
|
1408
|
+
* ```ts
|
|
1409
|
+
* grid.scrollToRow({ rowId: "42", align: "center" });
|
|
1410
|
+
* ```
|
|
1411
|
+
*
|
|
1412
|
+
* Answers whether the row could be reached. `false` means it is not in the
|
|
1413
|
+
* current view at all — filtered out, on another page, or an id that matches
|
|
1414
|
+
* no row — and nothing scrolled. A pinned row answers `true` without
|
|
1415
|
+
* scrolling: it is already parked at an edge.
|
|
1416
|
+
*
|
|
1417
|
+
* Identity is stable, so it is safe in a dependency array.
|
|
1418
|
+
*/
|
|
1419
|
+
scrollToRow: (args: TMDataGridScrollToRowArgs) => boolean;
|
|
1420
|
+
/**
|
|
1421
|
+
* @internal Wiring for `TMDataGrid.Table`, which owns the virtualizer and
|
|
1422
|
+
* fills this in. Not part of the supported surface.
|
|
1423
|
+
*/
|
|
1424
|
+
scrollerRef: MutableRefObject<TMDataGridScroller>;
|
|
912
1425
|
};
|
|
913
|
-
|
|
1426
|
+
/** The editing callbacks every mode shares. See {@link TMDataGridEditingOptions}. */
|
|
1427
|
+
type TMDataGridEditingCallbacks<TData extends RowData> = {
|
|
1428
|
+
/**
|
|
1429
|
+
* `getRowId` stops being optional once editing is on: the forms are keyed
|
|
1430
|
+
* by row id and live outside the DOM, and the index fallback points at a
|
|
1431
|
+
* different record after any sort.
|
|
1432
|
+
*/
|
|
1433
|
+
getRowId: NonNullable<TableOptions<TMDataGridFeatures, TData>["getRowId"]>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Form-level validators for the whole editing row — where cross-field
|
|
1436
|
+
* rules live. TanStack Form's own vocabulary, Standard Schema included:
|
|
1437
|
+
*
|
|
1438
|
+
* ```tsx
|
|
1439
|
+
* rowValidators: {
|
|
1440
|
+
* onSubmit: z.object({ salary: z.number().positive() })
|
|
1441
|
+
* .refine((r) => r.status !== "Terminated" || r.salary === 0, {
|
|
1442
|
+
* message: "A terminated employee has no salary",
|
|
1443
|
+
* }),
|
|
1444
|
+
* }
|
|
1445
|
+
* ```
|
|
1446
|
+
*
|
|
1447
|
+
* Pathed issues land on the matching columns; pathless ones on the row.
|
|
1448
|
+
*/
|
|
1449
|
+
rowValidators?: TMDataGridRowValidators;
|
|
1450
|
+
/** Rows the pencil skips — `false` keeps a row read-only in every mode. */
|
|
1451
|
+
isRowEditable?: (row: Row<TMDataGridFeatures, TData>) => boolean;
|
|
1452
|
+
/**
|
|
1453
|
+
* Called when an edit commits. The grid never mutates `data`: apply the
|
|
1454
|
+
* change and let the new data arrive back through `data` as always. The
|
|
1455
|
+
* engine drops the draft only when this resolves — a slow save keeps the
|
|
1456
|
+
* draft visible with a busy marker — and a rejection keeps the form open
|
|
1457
|
+
* with the error on the row.
|
|
1458
|
+
*
|
|
1459
|
+
* `changes` is the per-field diff (one entry in cell mode) for consumers
|
|
1460
|
+
* who PATCH; `value` is the whole edited row for those who save records.
|
|
1461
|
+
*/
|
|
1462
|
+
onEditCommit?: (args: TMDataGridEditCommitArgs<TData>) => void | Promise<void>;
|
|
1463
|
+
/**
|
|
1464
|
+
* Seed values for `edit.addRow()` — the entry row's starting point. A
|
|
1465
|
+
* function is called per added row (fresh timestamps, empty arrays).
|
|
1466
|
+
*/
|
|
1467
|
+
newRowDefaults?: TData | (() => TData);
|
|
1468
|
+
/**
|
|
1469
|
+
* Called when an entry row commits: `Enter` or the lane's ✓ under the
|
|
1470
|
+
* immediate modes, `submitAll` under batch. Create the record and let it
|
|
1471
|
+
* arrive back through `data`; the engine's `tempId` never leaves the grid.
|
|
1472
|
+
*/
|
|
1473
|
+
onRowAdd?: (args: TMDataGridRowAddArgs<TData>) => void | Promise<void>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Called by `edit.deleteRow` under the immediate modes — confirmation, if
|
|
1476
|
+
* any, belongs in here. Under batch, deletions accumulate in
|
|
1477
|
+
* `edit.state.deletedRowIds` instead and are reported by `submitAll`.
|
|
1478
|
+
* Setting this also puts the trash can in the edit lane.
|
|
1479
|
+
*/
|
|
1480
|
+
onRowDelete?: (args: TMDataGridRowDeleteArgs<TData>) => void | Promise<void>;
|
|
1481
|
+
};
|
|
1482
|
+
/**
|
|
1483
|
+
* The editing options travel together, and the type states it: without
|
|
1484
|
+
* `editMode` none of them has anything to act on, so passing one is a
|
|
1485
|
+
* compile error rather than a dead option; with it, `getRowId` becomes
|
|
1486
|
+
* required; and `onEditCommitBatch` exists only under `"batch"` — the one
|
|
1487
|
+
* mode whose `submitAll` calls it.
|
|
1488
|
+
*
|
|
1489
|
+
* `editMode` itself turns cell editing on and picks how commits happen. Off
|
|
1490
|
+
* by default.
|
|
1491
|
+
*
|
|
1492
|
+
* | Mode | Commit | Cancel |
|
|
1493
|
+
* | ---- | ------ | ------ |
|
|
1494
|
+
* | `"cell"` | Enter, Tab, blur — Sheets | Escape |
|
|
1495
|
+
* | `"cellConfirm"` | ✓ or Enter only; blur keeps the draft | ✕ or Escape |
|
|
1496
|
+
* | `"row"` | Save in the edit lane, or Ctrl+Enter | Cancel, or Escape |
|
|
1497
|
+
* | `"batch"` | `edit.submitAll()` | `edit.cancelAll()` |
|
|
1498
|
+
*
|
|
1499
|
+
* One TanStack Form per editing row; drafts survive scrolling because the
|
|
1500
|
+
* forms live outside the DOM, keyed by row id. Which columns edit, and with
|
|
1501
|
+
* what, is declared per column: `meta.type` picks the built-in editor,
|
|
1502
|
+
* `meta.validate` its validators, `meta.editable` / `meta.editor` the
|
|
1503
|
+
* overrides.
|
|
1504
|
+
*/
|
|
1505
|
+
type TMDataGridEditingOptions<TData extends RowData> = (TMDataGridEditingCallbacks<TData> & {
|
|
1506
|
+
editMode: "batch";
|
|
1507
|
+
/**
|
|
1508
|
+
* Batch mode's save, called once by `edit.submitAll()` with every
|
|
1509
|
+
* valid dirty row. Without it, `submitAll` falls back to the per-row
|
|
1510
|
+
* {@link TMDataGridEditingCallbacks.onEditCommit} loop. Rows failing
|
|
1511
|
+
* validation stay open either way; a rejection keeps every draft.
|
|
1512
|
+
*/
|
|
1513
|
+
onEditCommitBatch?: (args: TMDataGridEditCommitBatchArgs<TData>) => void | Promise<void>;
|
|
1514
|
+
}) | (TMDataGridEditingCallbacks<TData> & {
|
|
1515
|
+
editMode: Exclude<TMDataGridEditMode, "batch">;
|
|
1516
|
+
/** Only `"batch"`'s `submitAll` ever calls it — see the other branch. */
|
|
1517
|
+
onEditCommitBatch?: never;
|
|
1518
|
+
}) | {
|
|
1519
|
+
editMode?: never;
|
|
1520
|
+
rowValidators?: never;
|
|
1521
|
+
isRowEditable?: never;
|
|
1522
|
+
onEditCommit?: never;
|
|
1523
|
+
onEditCommitBatch?: never;
|
|
1524
|
+
newRowDefaults?: never;
|
|
1525
|
+
onRowAdd?: never;
|
|
1526
|
+
onRowDelete?: never;
|
|
1527
|
+
};
|
|
1528
|
+
type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridFeatures, TData>, "features"> & TMDataGridEditingOptions<TData> & {
|
|
914
1529
|
/**
|
|
915
1530
|
* Restore and persist table state across mounts. Two keys, because the two
|
|
916
1531
|
* kinds of state have different lifetimes — see {@link TMDataGridPersistence}.
|
|
@@ -952,6 +1567,28 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
952
1567
|
* no extra flag.
|
|
953
1568
|
*/
|
|
954
1569
|
enablePagination?: boolean;
|
|
1570
|
+
/**
|
|
1571
|
+
* The row-number gutter: a generated lane, outermost left, numbering the
|
|
1572
|
+
* rows of the current view — sorted, filtered, continuing across pages,
|
|
1573
|
+
* with group rows unnumbered. Off by default.
|
|
1574
|
+
*/
|
|
1575
|
+
enableRowNumbers?: boolean;
|
|
1576
|
+
/**
|
|
1577
|
+
* How the quick search (`TMDataGrid.Search`) matches. `"fuzzy"` — the
|
|
1578
|
+
* default — forgives typos and skipped characters, and while it is the
|
|
1579
|
+
* only thing narrowing the grid (no sort, no grouping) the rows order by
|
|
1580
|
+
* match quality, best first. `"contains"` is plain substring matching.
|
|
1581
|
+
* An explicit `globalFilterFn` overrides both.
|
|
1582
|
+
*/
|
|
1583
|
+
quickSearchMode?: TMDataGridQuickSearchMode;
|
|
1584
|
+
/**
|
|
1585
|
+
* Highlights the matched text in cells while a contains-family column
|
|
1586
|
+
* filter or the quick search is active. Default-rendered cells only — a
|
|
1587
|
+
* column with its own `cell` renderer opts out by existing; a fuzzy
|
|
1588
|
+
* typo-match with no contiguous occurrence shows no highlight. Off by
|
|
1589
|
+
* default.
|
|
1590
|
+
*/
|
|
1591
|
+
enableMatchHighlighting?: boolean;
|
|
955
1592
|
/**
|
|
956
1593
|
* How rows are selected. Defaults to `"checkbox"`.
|
|
957
1594
|
*
|
|
@@ -1134,7 +1771,7 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
1134
1771
|
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
1135
1772
|
* options.
|
|
1136
1773
|
*/
|
|
1137
|
-
declare function useTMDataGrid<TData extends RowData>({ persist, labels: labelsOverride, enableColumnOrdering, enablePagination, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, cellSelection, onFocusedCellChange, renderDetails, renderDetailsEstHeight, overscan, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
1774
|
+
declare function useTMDataGrid<TData extends RowData>({ persist, labels: labelsOverride, enableColumnOrdering, enablePagination, enableRowNumbers, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, cellSelection, onFocusedCellChange, editMode, rowValidators, isRowEditable, onEditCommit, onEditCommitBatch, newRowDefaults, onRowAdd, onRowDelete, renderDetails, renderDetailsEstHeight, overscan, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
1138
1775
|
/**
|
|
1139
1776
|
* Opens the filter panel for a column, seeding an empty filter row when the
|
|
1140
1777
|
* column has none yet — mirrors "Filter" in the column header menu.
|
|
@@ -1443,12 +2080,93 @@ type TMDataGridRowContextMenuArgs<TData extends RowData> = {
|
|
|
1443
2080
|
* its `Menu.Dropdown`; this fills the dropdown.
|
|
1444
2081
|
*/
|
|
1445
2082
|
type TMDataGridRowContextMenu<TData extends RowData> = (args: TMDataGridRowContextMenuArgs<TData>) => ReactNode;
|
|
2083
|
+
/**
|
|
2084
|
+
* What the `onCellClick` family receives — the cell with its row and column,
|
|
2085
|
+
* in the consumer's own row type, plus the pointer event.
|
|
2086
|
+
*/
|
|
2087
|
+
type TMDataGridCellEventArgs<TData extends RowData> = {
|
|
2088
|
+
cell: Cell<TMDataGridFeatures, TData, unknown>;
|
|
2089
|
+
row: Row<TMDataGridFeatures, TData>;
|
|
2090
|
+
column: Column<TMDataGridFeatures, TData, unknown>;
|
|
2091
|
+
event: MouseEvent<HTMLElement>;
|
|
2092
|
+
};
|
|
2093
|
+
/**
|
|
2094
|
+
* Inline styles for a row. Widened to accept CSS variables, because setting
|
|
2095
|
+
* `--row-bg` is the supported way to colour a row — see {@link
|
|
2096
|
+
* TMDataGridTableProps.rowStyle}.
|
|
2097
|
+
*/
|
|
2098
|
+
type TMDataGridRowStyle = CSSProperties | (CSSProperties & Record<`--${string}`, string | number>);
|
|
1446
2099
|
type TMDataGridTableProps<TData extends RowData> = {
|
|
1447
2100
|
/**
|
|
1448
2101
|
* Called when a body row is clicked. Runs in addition to row selection under
|
|
1449
2102
|
* `selectionMode: "row"`, not instead of it.
|
|
1450
2103
|
*/
|
|
1451
2104
|
onRowClick?: (row: Row<TMDataGridFeatures, TData>) => void;
|
|
2105
|
+
/**
|
|
2106
|
+
* Called when a body cell is clicked. Composes, never suppresses: whatever
|
|
2107
|
+
* the click already does — selecting, highlighting, moving the cell cursor
|
|
2108
|
+
* — still happens. Group rows sit out the cell handlers the way they sit
|
|
2109
|
+
* out `onRowClick`, and for the same reason.
|
|
2110
|
+
*/
|
|
2111
|
+
onCellClick?: (args: TMDataGridCellEventArgs<TData>) => void;
|
|
2112
|
+
/** As {@link onCellClick}; a double-click that opens an editor still does. */
|
|
2113
|
+
onCellDoubleClick?: (args: TMDataGridCellEventArgs<TData>) => void;
|
|
2114
|
+
/**
|
|
2115
|
+
* As {@link onCellClick}; `rowContextMenu` and the cell-selection menu still
|
|
2116
|
+
* open. To suppress the browser's own menu on a grid with neither, call
|
|
2117
|
+
* `event.preventDefault()` here.
|
|
2118
|
+
*/
|
|
2119
|
+
onCellContextMenu?: (args: TMDataGridCellEventArgs<TData>) => void;
|
|
2120
|
+
/**
|
|
2121
|
+
* Class for a body row — a string, or a function of the row (group rows
|
|
2122
|
+
* included; test `row.getIsGrouped()` to skip them). Added after the grid's
|
|
2123
|
+
* own row class.
|
|
2124
|
+
*/
|
|
2125
|
+
rowClassName?: string | ((row: Row<TMDataGridFeatures, TData>) => string | undefined);
|
|
2126
|
+
/**
|
|
2127
|
+
* Inline style for a body row. To colour a row, set `--row-bg` rather than
|
|
2128
|
+
* `background`: the row's own background, its sticky pinned cells and the
|
|
2129
|
+
* cell-range tint all read that variable, and hover/selection/highlight
|
|
2130
|
+
* keep working on top of it — a raw `background` bypasses all of them.
|
|
2131
|
+
*
|
|
2132
|
+
* ```tsx
|
|
2133
|
+
* rowStyle={(row) =>
|
|
2134
|
+
* row.original.overdue ? { "--row-bg": "var(--mantine-color-red-0)" } : undefined
|
|
2135
|
+
* }
|
|
2136
|
+
* ```
|
|
2137
|
+
*/
|
|
2138
|
+
rowStyle?: TMDataGridRowStyle | ((row: Row<TMDataGridFeatures, TData>) => TMDataGridRowStyle | undefined);
|
|
2139
|
+
/**
|
|
2140
|
+
* Every second row takes `--dg-row-striped-bg`. Computed from the row's
|
|
2141
|
+
* position in the view — sorting and filtering restripe, and the stripes
|
|
2142
|
+
* stay put while the virtualizer mounts and unmounts rows.
|
|
2143
|
+
*/
|
|
2144
|
+
striped?: boolean;
|
|
2145
|
+
/**
|
|
2146
|
+
* Called when the scroll *arrives* at an edge — once per arrival, not per
|
|
2147
|
+
* scroll event, and not on mount (the grid starts at the top-left edge).
|
|
2148
|
+
* For loading more rows as the end approaches, `onReachEnd` is the better
|
|
2149
|
+
* hook: it fires rows-early and latches per row count.
|
|
2150
|
+
*/
|
|
2151
|
+
onScrollToTop?: () => void;
|
|
2152
|
+
/** As {@link onScrollToTop}, for the bottom edge. */
|
|
2153
|
+
onScrollToBottom?: () => void;
|
|
2154
|
+
/** As {@link onScrollToTop}, for the left edge. */
|
|
2155
|
+
onScrollToLeft?: () => void;
|
|
2156
|
+
/** As {@link onScrollToTop}, for the right edge. */
|
|
2157
|
+
onScrollToRight?: () => void;
|
|
2158
|
+
/**
|
|
2159
|
+
* Rendered centred in the body when the view is empty — the branded blank
|
|
2160
|
+
* slate. It takes over states 3 and 4 of the empty matrix (see the docs):
|
|
2161
|
+
* loading still shows the loader, and open entry rows still show only
|
|
2162
|
+
* themselves. `hasActiveFilters` says which emptiness this is — a filter
|
|
2163
|
+
* that matched nothing wants a "clear filters" invitation, a grid with no
|
|
2164
|
+
* data wants a "create the first one".
|
|
2165
|
+
*/
|
|
2166
|
+
renderEmptyState?: (args: {
|
|
2167
|
+
hasActiveFilters: boolean;
|
|
2168
|
+
table: Table<TMDataGridFeatures, TData>;
|
|
2169
|
+
}) => ReactNode;
|
|
1452
2170
|
/**
|
|
1453
2171
|
* Contents of the menu a right-click on a row opens, at the pointer. Return
|
|
1454
2172
|
* `null` to leave a row without one — the browser's own menu stays suppressed
|
|
@@ -1503,6 +2221,14 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
1503
2221
|
* How many rows before the end {@link onReachEnd} fires at. Defaults to 10.
|
|
1504
2222
|
*/
|
|
1505
2223
|
reachEndThreshold?: number;
|
|
2224
|
+
/**
|
|
2225
|
+
* Accessible name for the grid — what a screen reader announces on entry,
|
|
2226
|
+
* and what `getByRole("grid", { name })` matches. Worth setting on any page
|
|
2227
|
+
* holding more than one grid; without it they are all just "grid".
|
|
2228
|
+
*/
|
|
2229
|
+
"aria-label"?: string;
|
|
2230
|
+
/** As {@link "aria-label"}, pointing at an element that already names it. */
|
|
2231
|
+
"aria-labelledby"?: string;
|
|
1506
2232
|
};
|
|
1507
2233
|
/**
|
|
1508
2234
|
* The scrollable grid surface. Always virtualized: only the rows inside the
|
|
@@ -1510,7 +2236,7 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
1510
2236
|
* no-pagination mode viable at any row count. Pagination is opt-in via
|
|
1511
2237
|
* `enablePagination` (or implied by `manualPagination`).
|
|
1512
2238
|
*/
|
|
1513
|
-
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, rowContextMenu, rowContextMenuProps, cellExport, onReachEnd, reachEndThreshold }: TMDataGridTableProps<TData>): import("react").JSX.Element;
|
|
2239
|
+
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, onCellClick, onCellDoubleClick, onCellContextMenu, rowClassName, rowStyle, striped, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, renderEmptyState, rowContextMenu, rowContextMenuProps, cellExport, onReachEnd, reachEndThreshold, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: TMDataGridTableProps<TData>): import("react").JSX.Element;
|
|
1514
2240
|
//#endregion
|
|
1515
2241
|
//#region .types-tmp/components/TMDataGridToolbar.d.ts
|
|
1516
2242
|
/** Row above the grid. Compose it from the pieces below, or anything else. */
|
|
@@ -1570,6 +2296,20 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
1570
2296
|
* background. Plain `CSSProperties` rejects `--*` keys.
|
|
1571
2297
|
*/
|
|
1572
2298
|
style?: CSSProperties & Record<`--${string}`, string | number>;
|
|
2299
|
+
/** Set on the root element. */
|
|
2300
|
+
id?: string;
|
|
2301
|
+
/**
|
|
2302
|
+
* Names this grid for tests. The grid names its own pieces with
|
|
2303
|
+
* `data-dg-part` rather than minting test ids, and those repeat across
|
|
2304
|
+
* grids — scope through this one and they stop colliding:
|
|
2305
|
+
*
|
|
2306
|
+
* ```ts
|
|
2307
|
+
* page.getByTestId("orders").locator('[data-dg-part="row"][data-row-id="42"]')
|
|
2308
|
+
* ```
|
|
2309
|
+
*
|
|
2310
|
+
* See the Testing docs page for the full attribute contract.
|
|
2311
|
+
*/
|
|
2312
|
+
"data-testid"?: string;
|
|
1573
2313
|
};
|
|
1574
2314
|
/**
|
|
1575
2315
|
* Root of the grid. Takes the object returned by `useTMDataGrid` — spread it —
|
|
@@ -1589,13 +2329,14 @@ type TMDataGridProps<TData extends RowData> = TMDataGridApi<TData> & {
|
|
|
1589
2329
|
* </TMDataGrid>
|
|
1590
2330
|
* ```
|
|
1591
2331
|
*/
|
|
1592
|
-
declare function TMDataGridRoot<TData extends RowData>({ table, ui, features, labels, renderDetails, renderDetailsEstHeight, overscan, size, children, className, style }: TMDataGridProps<TData>): import("react").JSX.Element;
|
|
2332
|
+
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;
|
|
1593
2333
|
declare const TMDataGrid: typeof TMDataGridRoot & {
|
|
1594
2334
|
Toolbar: typeof TMDataGridToolbar;
|
|
1595
2335
|
Spacer: typeof TMDataGridToolbarSpacer;
|
|
1596
2336
|
SummaryCount: typeof TMDataGridSummaryCount;
|
|
1597
2337
|
LoadingIndicator: typeof TMDataGridLoadingIndicator;
|
|
1598
2338
|
Search: typeof TMDataGridSearch;
|
|
2339
|
+
EditActions: typeof TMDataGridEditActions;
|
|
1599
2340
|
ColumnsButton: typeof TMDataGridColumnsButton;
|
|
1600
2341
|
FilterButton: typeof TMDataGridFilterButton;
|
|
1601
2342
|
Table: typeof TMDataGridTable$1;
|
|
@@ -1617,6 +2358,12 @@ declare const SELECT_COLUMN_ID = "__select__";
|
|
|
1617
2358
|
//#region .types-tmp/components/TMDataGridDetailsColumn.d.ts
|
|
1618
2359
|
declare const DETAILS_COLUMN_ID = "__details__";
|
|
1619
2360
|
//#endregion
|
|
2361
|
+
//#region .types-tmp/components/TMDataGridEditColumn.d.ts
|
|
2362
|
+
declare const EDIT_COLUMN_ID = "__edit__";
|
|
2363
|
+
//#endregion
|
|
2364
|
+
//#region .types-tmp/components/TMDataGridRowNumberColumn.d.ts
|
|
2365
|
+
declare const ROW_NUMBER_COLUMN_ID = "__rowNumber__";
|
|
2366
|
+
//#endregion
|
|
1620
2367
|
//#region .types-tmp/components/TMDataGridGroupColumn.d.ts
|
|
1621
2368
|
declare const GROUP_COLUMN_ID = "__group__";
|
|
1622
2369
|
/**
|
|
@@ -1628,6 +2375,91 @@ declare const GROUP_COLUMN_ID = "__group__";
|
|
|
1628
2375
|
*/
|
|
1629
2376
|
declare function formatGroupValue(value: unknown, blankLabel?: string): string;
|
|
1630
2377
|
//#endregion
|
|
2378
|
+
//#region .types-tmp/components/filters/TMDataGridFilterValueInput.d.ts
|
|
2379
|
+
/**
|
|
2380
|
+
* The built-in value control of a filter-panel row — what renders when a
|
|
2381
|
+
* column declares no `meta.filterControl`. Shaped by the operator: a
|
|
2382
|
+
* multi-select for the set operators, a From/To pair for `between`, a Yes/No
|
|
2383
|
+
* dropdown for booleans, a typed input otherwise.
|
|
2384
|
+
*
|
|
2385
|
+
* Exported so a custom control can fall back to it for the operators it does
|
|
2386
|
+
* not care about, instead of rebuilding them.
|
|
2387
|
+
*/
|
|
2388
|
+
declare function TMDataGridFilterValueInput({ column, operator, value, onChange, options, size, labels }: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2389
|
+
//#endregion
|
|
2390
|
+
//#region .types-tmp/components/filters/DgRangeSliderFilter.d.ts
|
|
2391
|
+
/**
|
|
2392
|
+
* A built-in `meta.filterControl` for `number` columns: a range slider whose
|
|
2393
|
+
* bounds are seeded from the values present in the data, writing the
|
|
2394
|
+
* `between` pair. Pair it with `meta.defaultFilterOperator: "between"` so
|
|
2395
|
+
* the filter opens on it; any non-range operator falls back to the standard
|
|
2396
|
+
* input.
|
|
2397
|
+
*/
|
|
2398
|
+
declare function DgRangeSliderFilter(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2399
|
+
//#endregion
|
|
2400
|
+
//#region .types-tmp/components/filters/DgDateRangeFilter.d.ts
|
|
2401
|
+
/**
|
|
2402
|
+
* A built-in `meta.filterControl` for `date` columns: a From/To pair of
|
|
2403
|
+
* native date inputs writing the `between` pair — no `@mantine/dates`
|
|
2404
|
+
* involved, like the built-in date editor. Pair it with
|
|
2405
|
+
* `meta.defaultFilterOperator: "between"`; any non-range operator falls back
|
|
2406
|
+
* to the standard input.
|
|
2407
|
+
*/
|
|
2408
|
+
declare function DgDateRangeFilter(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2409
|
+
//#endregion
|
|
2410
|
+
//#region .types-tmp/components/filters/DgAutocompleteFilter.d.ts
|
|
2411
|
+
/**
|
|
2412
|
+
* A built-in `meta.filterControl` for text-shaped columns: a free-text input
|
|
2413
|
+
* that also offers the values present in the data (or the column's declared
|
|
2414
|
+
* `meta.options`) as suggestions. Set or range operators fall back to the
|
|
2415
|
+
* standard input.
|
|
2416
|
+
*/
|
|
2417
|
+
declare function DgAutocompleteFilter(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2418
|
+
//#endregion
|
|
2419
|
+
//#region .types-tmp/components/filters/DgTriStateFilter.d.ts
|
|
2420
|
+
/**
|
|
2421
|
+
* A built-in `meta.filterControl` for `boolean` columns: an All / Yes / No
|
|
2422
|
+
* segmented control — All clears the value, which deactivates the filter.
|
|
2423
|
+
* Set or range operators fall back to the standard input.
|
|
2424
|
+
*/
|
|
2425
|
+
declare function DgTriStateFilter(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2426
|
+
//#endregion
|
|
2427
|
+
//#region .types-tmp/components/editors/TMDataGridStringEditor.d.ts
|
|
2428
|
+
/** The built-in editor for `meta.type: "string"` (and the default). */
|
|
2429
|
+
declare function TMDataGridStringEditor({ field, autoFocus, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2430
|
+
//#endregion
|
|
2431
|
+
//#region .types-tmp/components/editors/TMDataGridNumberEditor.d.ts
|
|
2432
|
+
/** The built-in editor for `meta.type: "number"`. */
|
|
2433
|
+
declare function TMDataGridNumberEditor({ field, autoFocus, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region .types-tmp/components/editors/TMDataGridBooleanEditor.d.ts
|
|
2436
|
+
/** The built-in editor for `meta.type: "boolean"` — a focused checkbox. */
|
|
2437
|
+
declare function TMDataGridBooleanEditor({ field, autoFocus, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2438
|
+
//#endregion
|
|
2439
|
+
//#region .types-tmp/components/editors/TMDataGridDateEditor.d.ts
|
|
2440
|
+
/**
|
|
2441
|
+
* The built-in editor for `meta.type: "date"` — the native
|
|
2442
|
+
* `<input type="date">` styled by Mantine, no `@mantine/dates` involved. A
|
|
2443
|
+
* consumer wanting a real picker plugs one in through `meta.editor`.
|
|
2444
|
+
*/
|
|
2445
|
+
declare function TMDataGridDateEditor({ field, autoFocus, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2446
|
+
//#endregion
|
|
2447
|
+
//#region .types-tmp/components/editors/TMDataGridSelectEditor.d.ts
|
|
2448
|
+
/**
|
|
2449
|
+
* The built-in editor for `meta.type: "select"`. Options come from the same
|
|
2450
|
+
* `meta.options` the filter panel reads — with the row in hand, so a
|
|
2451
|
+
* function source can depend on the record being edited.
|
|
2452
|
+
*/
|
|
2453
|
+
declare function TMDataGridSelectEditor({ field, autoFocus, column, row, table, size, commit }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2454
|
+
//#endregion
|
|
2455
|
+
//#region .types-tmp/components/editors/TMDataGridMultiSelectEditor.d.ts
|
|
2456
|
+
/**
|
|
2457
|
+
* The built-in editor for `meta.type: "multiSelect"` — cells holding string
|
|
2458
|
+
* arrays. Never commits on pick: building a set takes several, so the commit
|
|
2459
|
+
* stays on Enter/blur like a text edit.
|
|
2460
|
+
*/
|
|
2461
|
+
declare function TMDataGridMultiSelectEditor({ field, autoFocus, column, row, table, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2462
|
+
//#endregion
|
|
1631
2463
|
//#region .types-tmp/core/labelsSv.d.ts
|
|
1632
2464
|
/**
|
|
1633
2465
|
* The complete Swedish dictionary. Typed as {@link TMDataGridLabels} rather
|
|
@@ -1660,13 +2492,19 @@ type ColumnLike = {
|
|
|
1660
2492
|
declare function getColumnLabel(column: ColumnLike): string;
|
|
1661
2493
|
declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
1662
2494
|
/**
|
|
1663
|
-
*
|
|
1664
|
-
*
|
|
2495
|
+
* The operator a fresh filter on this column starts with —
|
|
2496
|
+
* `meta.defaultFilterOperator`, else the type's default.
|
|
2497
|
+
*/
|
|
2498
|
+
declare function getColumnDefaultOperator(column: ColumnLike): TMDataGridFilterOperator;
|
|
2499
|
+
/**
|
|
2500
|
+
* A generated lane holding one fixed-width thing — the checkbox, the details
|
|
2501
|
+
* chevron, the row number.
|
|
1665
2502
|
*
|
|
1666
2503
|
* They are laid out differently from every other column: cell padding is sized
|
|
1667
2504
|
* for text and grows with the scale, which at `xl` squeezed a 16px checkbox out
|
|
1668
|
-
* of its track, so these lanes centre their
|
|
1669
|
-
* Their headers
|
|
2505
|
+
* of its track, so these lanes centre their content in an unpadded cell.
|
|
2506
|
+
* Their headers carry no column menu, and none of them is ever exported —
|
|
2507
|
+
* they hold chrome, not values.
|
|
1670
2508
|
*
|
|
1671
2509
|
* The tree column is deliberately not one of them: it holds a label as well as a
|
|
1672
2510
|
* chevron, and wants the padding.
|
|
@@ -1854,6 +2692,10 @@ declare function moveColumnByStep({ table, columnId, direction }: ColumnStepArgs
|
|
|
1854
2692
|
* is the right list for a range: it is what the user can see, and a range that
|
|
1855
2693
|
* swept collapsed rows would select things off screen. What a group row in the
|
|
1856
2694
|
* range contributes is decided by {@link getSelectableRowIds}.
|
|
2695
|
+
*
|
|
2696
|
+
* Rows pinned to an edge leave this list — they render in their own sticky
|
|
2697
|
+
* blocks, outside the scrolling order a shift-click range or the virtualizer
|
|
2698
|
+
* walks. See `readPinnedRows`.
|
|
1857
2699
|
*/
|
|
1858
2700
|
declare function getDisplayedRows<TData extends RowData>(table: TMDataGridTable<TData>, features: TMDataGridFeatureFlags): Array<Row<TMDataGridFeatures, TData>>;
|
|
1859
2701
|
/**
|
|
@@ -1937,4 +2779,4 @@ declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridF
|
|
|
1937
2779
|
*/
|
|
1938
2780
|
declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
|
|
1939
2781
|
//#endregion
|
|
1940
|
-
export { type BuildCellMatrixArgs, type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_CELL_EXPORT_OPTIONS, DEFAULT_TMDATAGRID_SIZE, DETAILS_COLUMN_ID, FILTER_OPERATOR_LABELS, GROUP_COLUMN_ID, type MoveColumnArgs, type ResolveCellMoveArgs, 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 TMDataGridAggregationName, type TMDataGridApi, type TMDataGridCapabilities, type TMDataGridCellCoords, type TMDataGridCellExportOptions, type TMDataGridCellMatrix, type TMDataGridCellNav, type TMDataGridCellPosition, type TMDataGridCellRange, type TMDataGridCellSelectionMode, type TMDataGridColumnCapabilities, type TMDataGridColumnLayout, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnType, type TMDataGridContextValue, type TMDataGridDataSlice, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, type TMDataGridDropSide, type TMDataGridExpandAllArgs, type TMDataGridExpandTarget, type TMDataGridFeatureFlags, type TMDataGridFeatures, type TMDataGridFilterOperator, TMDataGridFilterPills, type TMDataGridFilterPillsProps, type TMDataGridFilterValue, type TMDataGridFooterProps, type TMDataGridLabels, type TMDataGridLabelsOverride, type TMDataGridOption, type TMDataGridOptionsArgs, type TMDataGridOptionsSource, type TMDataGridPaginationApi, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridRangeBounds, type TMDataGridRowClickModifiers, type TMDataGridRowContextMenu, type TMDataGridRowContextMenuArgs, type TMDataGridRowData, TMDataGridSearch, type TMDataGridSearchProps, type TMDataGridSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridTableProps, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type UseTMDataGridOptions, aggregateColumn, areAllRowsExpanded, autosizeColumn, boundsCellCount, boundsEdges, buildCellMatrix, buildGridCellMatrix, createTMDataGridColumnHelper, downloadTextFile, exportGridToCsv, formatExportValue, formatFilterLabel, formatGroupValue, getColumnCapabilities, getColumnLabel, getColumnRegion, getColumnType, getDefaultOperator, getDisplayedRows, getGridCapabilities, getGroupDataRows, getOperatorsForType, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, isColumnReorderable, isControlColumn, isFilterActive, isPagingActive, isSameCell, isWithinBounds, measureColumnContentWidth, mergeLabels, moveColumn, moveColumnByStep, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, optionsToComboboxData, readFeatureFlags, resolveCellMove, resolveColumnOptions, resolveExpandAll, resolveRangeBounds, resolveRowSelectionClick, tmDataGridFeatures, toClipboardText, toExcelCsv, useCellControlTabIndex, useTMDataGrid, useTMDataGridContext, writeClipboardText };
|
|
2782
|
+
export { type BuildCellMatrixArgs, type ColumnStepArgs, DATA_STATE_SLICES, DEFAULT_CELL_EXPORT_OPTIONS, DEFAULT_TMDATAGRID_SIZE, DETAILS_COLUMN_ID, DgAutocompleteFilter, DgDateRangeFilter, DgRangeSliderFilter, DgTriStateFilter, EDIT_COLUMN_ID, FILTER_OPERATOR_LABELS, GROUP_COLUMN_ID, type MoveColumnArgs, PERSIST_PAYLOAD_VERSION, ROW_NUMBER_COLUMN_ID, type ResolveCellMoveArgs, 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 TMDataGridAggregationName, type TMDataGridApi, TMDataGridBooleanEditor, type TMDataGridCapabilities, type TMDataGridCellCoords, type TMDataGridCellEventArgs, type TMDataGridCellExportOptions, type TMDataGridCellMatrix, type TMDataGridCellNav, type TMDataGridCellPosition, type TMDataGridCellRange, type TMDataGridCellSelectionMode, type TMDataGridColumnCapabilities, type TMDataGridColumnLayout, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnType, type TMDataGridContextValue, type TMDataGridDataSlice, TMDataGridDateEditor, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, type TMDataGridDropSide, TMDataGridEditActions, type TMDataGridEditApi, type TMDataGridEditChange, type TMDataGridEditCommitArgs, type TMDataGridEditCommitBatchArgs, type TMDataGridEditField, type TMDataGridEditMode, type TMDataGridEditRowProjection, type TMDataGridEditState, type TMDataGridEditingOptions, type TMDataGridEditorArgs, type TMDataGridEditorComponent, type TMDataGridExpandAllArgs, type TMDataGridExpandTarget, type TMDataGridFeatureFlags, type TMDataGridFeatures, type TMDataGridFieldValidate, type TMDataGridFilterControlArgs, type TMDataGridFilterControlComponent, type TMDataGridFilterOperator, TMDataGridFilterPills, type TMDataGridFilterPillsProps, type TMDataGridFilterValue, TMDataGridFilterValueInput, type TMDataGridFooterProps, type TMDataGridLabels, type TMDataGridLabelsOverride, TMDataGridMultiSelectEditor, TMDataGridNumberEditor, type TMDataGridOption, type TMDataGridOptionsArgs, type TMDataGridOptionsSource, type TMDataGridPaginationApi, type TMDataGridPersistKey, type TMDataGridPersistence, type TMDataGridProps, type TMDataGridQuickSearchMode, type TMDataGridRangeBounds, type TMDataGridRowAddArgs, type TMDataGridRowClickModifiers, type TMDataGridRowContextMenu, type TMDataGridRowContextMenuArgs, type TMDataGridRowData, type TMDataGridRowDeleteArgs, type TMDataGridRowEditForm, type TMDataGridRowStyle, type TMDataGridRowValidators, type TMDataGridScrollAlign, type TMDataGridScrollToRowArgs, TMDataGridSearch, type TMDataGridSearchProps, TMDataGridSelectEditor, type TMDataGridSelectionMode, type TMDataGridSettingsSlice, type TMDataGridSize, type TMDataGridStorageMode, TMDataGridStringEditor, type TMDataGridTable, type TMDataGridTableMeta, type TMDataGridTableProps, type TMDataGridUiActions, type TMDataGridUiState, type TMDataGridUiStore, type UseTMDataGridOptions, aggregateColumn, areAllRowsExpanded, autosizeColumn, boundsCellCount, boundsEdges, buildCellMatrix, buildGridCellMatrix, clearedValueForType, createTMDataGridColumnHelper, downloadTextFile, emptyValueForOperator, exportGridToCsv, formatExportValue, formatFilterLabel, formatGroupValue, fuzzyGlobalFilterFn, getColumnCapabilities, getColumnDefaultOperator, getColumnLabel, getColumnRegion, getColumnType, getDefaultOperator, getDisplayedRows, getEditFieldName, getGridCapabilities, getGroupDataRows, getOperatorsForType, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, isColumnReorderable, isControlColumn, isFilterActive, isPagingActive, isSameCell, isWithinBounds, measureColumnContentWidth, mergeLabels, moveColumn, moveColumnByStep, normalizeFieldValidate, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, operatorTakesRangeValue, optionsToComboboxData, readFeatureFlags, resolveCellMove, resolveColumnOptions, resolveExpandAll, resolveRangeBounds, resolveRowSelectionClick, tmDataGridFeatures, toClipboardText, toExcelCsv, useCellControlTabIndex, useTMDataGrid, useTMDataGridContext, writeClipboardText };
|