@jielga/tmdatagrid 1.1.1 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -34
- package/dist/index.d.ts +273 -155
- package/dist/index.js +1784 -1687
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/appearance/SKILL.md +37 -34
- package/skills/cell-selection/SKILL.md +19 -19
- package/skills/columns/SKILL.md +46 -21
- package/skills/data/SKILL.md +53 -53
- package/skills/editing/SKILL.md +165 -169
- package/skills/editing/references/editing-api.md +26 -24
- package/skills/editing/references/editors-and-validation.md +71 -25
- package/skills/filtering/SKILL.md +62 -62
- package/skills/getting-started/SKILL.md +10 -10
- package/skills/grouping/SKILL.md +41 -43
- package/skills/options/SKILL.md +4 -4
- package/skills/rows/SKILL.md +59 -59
- package/skills/rows/references/rows-api.md +6 -6
- package/skills/server-side/SKILL.md +1 -1
- package/skills/testing/SKILL.md +10 -10
- package/src/tmdatagrid/components/TMDataGrid.module.css +6 -1
- package/src/tmdatagrid/components/TMDataGridCellEditor.tsx +49 -16
- package/src/tmdatagrid/components/TMDataGridColumnsPanel.tsx +29 -18
- package/src/tmdatagrid/components/TMDataGridDetailsColumn.tsx +5 -8
- package/src/tmdatagrid/components/TMDataGridEditActions.tsx +1 -1
- package/src/tmdatagrid/components/TMDataGridEditColumn.tsx +5 -1
- package/src/tmdatagrid/components/TMDataGridEntryRows.tsx +42 -11
- package/src/tmdatagrid/components/TMDataGridFilterPanel.tsx +5 -3
- package/src/tmdatagrid/components/TMDataGridHeaderCell.tsx +11 -6
- package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +9 -5
- package/src/tmdatagrid/components/TMDataGridTable.tsx +60 -62
- package/src/tmdatagrid/components/editors/TMDataGridBooleanEditor.tsx +0 -2
- package/src/tmdatagrid/components/editors/TMDataGridDateEditor.tsx +1 -3
- package/src/tmdatagrid/components/editors/TMDataGridMultiSelectEditor.tsx +0 -2
- package/src/tmdatagrid/components/editors/TMDataGridNumberEditor.tsx +14 -12
- package/src/tmdatagrid/components/editors/TMDataGridSelectEditor.tsx +0 -2
- package/src/tmdatagrid/components/editors/TMDataGridStringEditor.tsx +13 -9
- package/src/tmdatagrid/components/editors/editorShared.ts +47 -0
- package/src/tmdatagrid/components/filters/DgAutocompleteFilter.tsx +1 -1
- package/src/tmdatagrid/components/filters/DgDateRangeFilter.tsx +2 -2
- package/src/tmdatagrid/components/filters/DgRangeSliderFilter.tsx +2 -2
- package/src/tmdatagrid/components/filters/DgTriStateFilter.tsx +1 -1
- package/src/tmdatagrid/components/filters/TMDataGridFilterValueInput.tsx +1 -1
- package/src/tmdatagrid/core/autosize.ts +30 -6
- package/src/tmdatagrid/core/capabilities.ts +5 -5
- package/src/tmdatagrid/core/cellExport.ts +6 -7
- package/src/tmdatagrid/core/cellNavigation.ts +2 -2
- package/src/tmdatagrid/core/cellRange.ts +6 -6
- package/src/tmdatagrid/core/columnOrdering.ts +30 -1
- package/src/tmdatagrid/core/columnUtils.ts +58 -3
- package/src/tmdatagrid/core/editEngine.ts +95 -28
- package/src/tmdatagrid/core/editorFocus.ts +29 -0
- package/src/tmdatagrid/core/filterControls.ts +28 -1
- package/src/tmdatagrid/core/filterOperators.ts +6 -6
- package/src/tmdatagrid/core/matchHighlight.ts +3 -3
- package/src/tmdatagrid/core/persistence.ts +3 -3
- package/src/tmdatagrid/core/rowSelection.ts +3 -3
- package/src/tmdatagrid/index.ts +8 -0
- package/src/tmdatagrid/useTMDataGrid.tsx +145 -133
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ type TMDataGridEditActionsProps = {
|
|
|
61
61
|
/**
|
|
62
62
|
* Batch mode's toolbar chrome: Save with the dirty-row count, and Discard.
|
|
63
63
|
* Both read the edit store, so they grey out while nothing is dirty and the
|
|
64
|
-
* Save spins while a submit is in flight. Works under any `
|
|
64
|
+
* Save spins while a submit is in flight. Works under any `editing.mode` - a
|
|
65
65
|
* cellConfirm grid accumulating drafts can offer the same pair - and renders
|
|
66
66
|
* nothing while editing is off.
|
|
67
67
|
*
|
|
@@ -204,9 +204,9 @@ declare function optionsToComboboxData(options: ReadonlyArray<TMDataGridOption>)
|
|
|
204
204
|
* The value shape stored in `columnFilters` for every TMDataGrid column.
|
|
205
205
|
*
|
|
206
206
|
* TanStack resolves `filterFn` statically per column, so the operator travels
|
|
207
|
-
* inside the filter *value* instead. That keeps the
|
|
208
|
-
* serialisable JSON
|
|
209
|
-
* `
|
|
207
|
+
* inside the filter *value* instead. That keeps the filter model plain,
|
|
208
|
+
* serialisable JSON, so a server-side `manualFiltering` table can forward
|
|
209
|
+
* `columnFilters` to the API unchanged.
|
|
210
210
|
*
|
|
211
211
|
* `value` is a string array under `isAnyOf` / `isNoneOf` (the set the cell is
|
|
212
212
|
* tested against), a `[min, max]` pair under `between` (an empty string means
|
|
@@ -285,7 +285,7 @@ type TMDataGridValidator = StandardSchemaV1<unknown, unknown> | ((args: {
|
|
|
285
285
|
fieldApi: never;
|
|
286
286
|
}) => unknown);
|
|
287
287
|
/**
|
|
288
|
-
* `meta.validate` - per-column field validators. A bare schema or function is
|
|
288
|
+
* `meta.edit.validate` - per-column field validators. A bare schema or function is
|
|
289
289
|
* shorthand for `{ onChange: it }`; the object form takes every trigger
|
|
290
290
|
* TanStack Form defines, `Async` variants and debounce included.
|
|
291
291
|
*/
|
|
@@ -384,7 +384,7 @@ type ErasedColumn = Column<TMDataGridFeatures, TMDataGridRowData, unknown>;
|
|
|
384
384
|
* inside any TanStack Form. The table side is where the editor is standing.
|
|
385
385
|
*
|
|
386
386
|
* The built-ins are implemented against this same contract, so
|
|
387
|
-
* `meta.editor` is not a special case - it is the slot the defaults
|
|
387
|
+
* `meta.edit.editor` is not a special case - it is the slot the defaults
|
|
388
388
|
* fill, and the exported built-ins can be wrapped instead of replaced.
|
|
389
389
|
*/
|
|
390
390
|
type TMDataGridEditorArgs = {
|
|
@@ -401,16 +401,6 @@ type TMDataGridEditorArgs = {
|
|
|
401
401
|
/** What Escape would do - drop the draft. */
|
|
402
402
|
cancel: () => void;
|
|
403
403
|
size: TMDataGridSize;
|
|
404
|
-
/**
|
|
405
|
-
* @deprecated The grid places the caret itself, once per open gesture, so
|
|
406
|
-
* honouring this is optional and it will go in the next major. It focuses
|
|
407
|
-
* `data-dg-part="editor-input"` when the editor publishes it and the first
|
|
408
|
-
* focusable element inside the editor otherwise, which is why a custom
|
|
409
|
-
* editor that ignores this prop still gets the caret. False under
|
|
410
|
-
* `editMode: "row"`, where a whole row of editors is mounted at once and
|
|
411
|
-
* only the named cell may take it.
|
|
412
|
-
*/
|
|
413
|
-
autoFocus: boolean;
|
|
414
404
|
/**
|
|
415
405
|
* Set when typing opened the editor (the Sheets gesture) - the built-ins
|
|
416
406
|
* replace the value with it and keep typing. A custom editor may ignore it.
|
|
@@ -418,11 +408,79 @@ type TMDataGridEditorArgs = {
|
|
|
418
408
|
seedText?: string;
|
|
419
409
|
};
|
|
420
410
|
/**
|
|
421
|
-
* `meta.editor` - replaces the built-in editor for this column. Rendered
|
|
422
|
-
* JSX, never invoked as a bare function, so hooks are legal inside. Define
|
|
423
|
-
* at module scope: a new identity per render remounts the editor mid-edit.
|
|
411
|
+
* `meta.edit.editor` - replaces the built-in editor for this column. Rendered
|
|
412
|
+
* as JSX, never invoked as a bare function, so hooks are legal inside. Define
|
|
413
|
+
* it at module scope: a new identity per render remounts the editor mid-edit.
|
|
424
414
|
*/
|
|
425
415
|
type TMDataGridEditorComponent = ComponentType<TMDataGridEditorArgs>;
|
|
416
|
+
/** What `meta.edit.mapValue` is handed for one write. */
|
|
417
|
+
type TMDataGridEditValueMapArgs = {
|
|
418
|
+
/** The value the editor just wrote. */
|
|
419
|
+
value: unknown;
|
|
420
|
+
/** What the field held before this write - for length-aware masks. */
|
|
421
|
+
previous: unknown;
|
|
422
|
+
row: ErasedRow;
|
|
423
|
+
column: ErasedColumn;
|
|
424
|
+
table: TMDataGridTable<TMDataGridRowData>;
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* `meta.edit.mapValue` - the value on its way into the draft, mapped.
|
|
428
|
+
*
|
|
429
|
+
* Runs on every write an editor makes, which for a text input is every
|
|
430
|
+
* keystroke and for a select is every pick, so the mapped value is what the
|
|
431
|
+
* user sees, what validators judge and what commits.
|
|
432
|
+
*/
|
|
433
|
+
type TMDataGridEditValueMap = (args: TMDataGridEditValueMapArgs) => unknown;
|
|
434
|
+
/**
|
|
435
|
+
* `meta.edit` - everything about how this column is edited, in one place,
|
|
436
|
+
* mirroring the `edit.*` engine the grid exposes at runtime.
|
|
437
|
+
*
|
|
438
|
+
* ```tsx
|
|
439
|
+
* meta: {
|
|
440
|
+
* type: "string",
|
|
441
|
+
* edit: {
|
|
442
|
+
* enabled: (row) => row.original.status !== "Locked",
|
|
443
|
+
* validate: z.string().min(2, "Too short"),
|
|
444
|
+
* mapValue: ({ value }) =>
|
|
445
|
+
* typeof value === "string" ? value.toUpperCase() : value,
|
|
446
|
+
* },
|
|
447
|
+
* }
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* `meta.type` and `meta.options` stay outside this namespace on purpose: one
|
|
451
|
+
* declaration of each feeds the cell editor and the filter panel alike.
|
|
452
|
+
*/
|
|
453
|
+
type TMDataGridColumnEditOptions = {
|
|
454
|
+
/**
|
|
455
|
+
* Whether this column's cells take edits, once `editMode` is on. `false`
|
|
456
|
+
* switches the column off outright; a predicate decides per row. Defaults
|
|
457
|
+
* to editable for any column that maps to a field - see {@link field}.
|
|
458
|
+
*/
|
|
459
|
+
enabled?: boolean | ((row: Row<TMDataGridFeatures, TMDataGridRowData>) => boolean);
|
|
460
|
+
/**
|
|
461
|
+
* The data path this column edits, when it is not the `accessorKey` - the
|
|
462
|
+
* only way a column built on `accessorFn` becomes editable. Dot paths reach
|
|
463
|
+
* into nested records: `"address.city"`.
|
|
464
|
+
*/
|
|
465
|
+
field?: string;
|
|
466
|
+
/**
|
|
467
|
+
* Replaces the built-in editor for this column. See
|
|
468
|
+
* {@link TMDataGridEditorComponent}.
|
|
469
|
+
*/
|
|
470
|
+
editor?: TMDataGridEditorComponent;
|
|
471
|
+
/**
|
|
472
|
+
* Field-level validators, in TanStack Form's own vocabulary. A bare Zod
|
|
473
|
+
* schema (or any Standard Schema, or a plain function) means
|
|
474
|
+
* `{ onChange: it }`; the object form takes every trigger Form defines.
|
|
475
|
+
*/
|
|
476
|
+
validate?: TMDataGridFieldValidate;
|
|
477
|
+
/**
|
|
478
|
+
* Maps every value an editor writes before it reaches the draft - uppercase
|
|
479
|
+
* a code, strip spaces from an IBAN, clamp a number into range. See
|
|
480
|
+
* {@link TMDataGridEditValueMap}.
|
|
481
|
+
*/
|
|
482
|
+
mapValue?: TMDataGridEditValueMap;
|
|
483
|
+
};
|
|
426
484
|
/** A new row being committed - `onRowAdd`, and `submitAll`'s `added`. */
|
|
427
485
|
type TMDataGridRowAddArgs<TData extends RowData> = {
|
|
428
486
|
/** The engine's placeholder id; the real id is the consumer's to mint. */
|
|
@@ -447,16 +505,18 @@ type TMDataGridEditCommitBatchArgs<TData extends RowData> = {
|
|
|
447
505
|
* The data path a column edits, or `null` for a column that has none.
|
|
448
506
|
*
|
|
449
507
|
* `accessorKey` is the true path and Form addresses fields by dot-path, so
|
|
450
|
-
* nested rows
|
|
451
|
-
* `values.address.city`. A column built on `accessorFn` has no path and is
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
508
|
+
* nested rows need no extra handling: `accessorKey: "address.city"` edits
|
|
509
|
+
* `values.address.city`. A column built on `accessorFn` has no path and is not
|
|
510
|
+
* editable unless `meta.edit.field` names one. TanStack's default column id
|
|
511
|
+
* turns dots into underscores, which is why this starts from `accessorKey` and
|
|
512
|
+
* never from `id`.
|
|
455
513
|
*/
|
|
456
514
|
declare function getEditFieldName(column: {
|
|
457
515
|
columnDef: {
|
|
458
516
|
meta?: {
|
|
459
|
-
|
|
517
|
+
edit?: {
|
|
518
|
+
field?: string;
|
|
519
|
+
};
|
|
460
520
|
};
|
|
461
521
|
};
|
|
462
522
|
}): string | null;
|
|
@@ -529,7 +589,7 @@ type TMDataGridEditApi = {
|
|
|
529
589
|
canDeleteRows: () => boolean;
|
|
530
590
|
};
|
|
531
591
|
/**
|
|
532
|
-
* `meta.validate` normalised to the object TanStack Form's `validators`
|
|
592
|
+
* `meta.edit.validate` normalised to the object TanStack Form's `validators`
|
|
533
593
|
* option takes - a bare schema or function is shorthand for `{ onChange }`.
|
|
534
594
|
*/
|
|
535
595
|
declare function normalizeFieldValidate(validate: TMDataGridFieldValidate | undefined): Record<string, unknown> | undefined;
|
|
@@ -703,11 +763,37 @@ type TMDataGridFilterControlArgs = {
|
|
|
703
763
|
labels: TMDataGridLabels;
|
|
704
764
|
};
|
|
705
765
|
/**
|
|
706
|
-
* `meta.
|
|
766
|
+
* `meta.filter.control` - replaces the built-in value control for this column.
|
|
707
767
|
* Rendered as JSX, never invoked as a bare function, so hooks are legal
|
|
708
768
|
* inside. Define it at module scope so its identity is stable across renders.
|
|
709
769
|
*/
|
|
710
770
|
type TMDataGridFilterControlComponent = ComponentType<TMDataGridFilterControlArgs>;
|
|
771
|
+
/**
|
|
772
|
+
* `meta.filter` - everything about how this column filters, in one place.
|
|
773
|
+
*
|
|
774
|
+
* ```tsx
|
|
775
|
+
* meta: {
|
|
776
|
+
* type: "number",
|
|
777
|
+
* filter: { defaultOperator: "between", control: DgRangeSliderFilter },
|
|
778
|
+
* }
|
|
779
|
+
* ```
|
|
780
|
+
*
|
|
781
|
+
* `meta.type` and `meta.options` stay outside this namespace on purpose: one
|
|
782
|
+
* declaration of each feeds the filter panel and the cell editor alike.
|
|
783
|
+
*/
|
|
784
|
+
type TMDataGridColumnFilterOptions = {
|
|
785
|
+
/**
|
|
786
|
+
* The operator a fresh filter on this column starts with, instead of the
|
|
787
|
+
* type's default - a salary column can open on `"between"`. Must be one of
|
|
788
|
+
* the type's own operators.
|
|
789
|
+
*/
|
|
790
|
+
defaultOperator?: TMDataGridFilterOperator;
|
|
791
|
+
/**
|
|
792
|
+
* Replaces the built-in value control in this column's filter-panel row.
|
|
793
|
+
* See {@link TMDataGridFilterControlComponent}.
|
|
794
|
+
*/
|
|
795
|
+
control?: TMDataGridFilterControlComponent;
|
|
796
|
+
};
|
|
711
797
|
//#endregion
|
|
712
798
|
//#region .types-tmp/core/quickSearch.d.ts
|
|
713
799
|
/** How the quick search matches - see `quickSearchMode` on the hook options. */
|
|
@@ -733,11 +819,11 @@ type GridState = TableState<TMDataGridFeatures>;
|
|
|
733
819
|
/**
|
|
734
820
|
* Persistence deliberately does not use Mantine's `useLocalStorage`.
|
|
735
821
|
*
|
|
736
|
-
* That hook
|
|
737
|
-
* table already
|
|
822
|
+
* That hook holds a piece of state and returns `[value, setValue]`. Here the
|
|
823
|
+
* table already holds the state and storage only mirrors it, so routing writes
|
|
738
824
|
* through the hook would keep a second copy and trigger a React state update on
|
|
739
825
|
* every change, including every pointer move during a column resize. Its
|
|
740
|
-
* defaults also
|
|
826
|
+
* defaults also conflict with this use: `getInitialValueInEffect: true` delivers
|
|
741
827
|
* the stored value after mount, while `initialState` is only read on the first
|
|
742
828
|
* render, and `sync: true` would let two open tabs overwrite each other's
|
|
743
829
|
* column layout.
|
|
@@ -897,7 +983,7 @@ type TMDataGridFeatureFlags = {
|
|
|
897
983
|
* its own grouping can still say `enableGrouping: true` to override.
|
|
898
984
|
*/
|
|
899
985
|
grouping: boolean;
|
|
900
|
-
/** Whether cells can be edited at all - `
|
|
986
|
+
/** Whether cells can be edited at all - the `editing` option was set. */
|
|
901
987
|
editing: boolean;
|
|
902
988
|
/** The commit policy, or `null` while editing is off. */
|
|
903
989
|
editMode: TMDataGridEditMode | null;
|
|
@@ -917,7 +1003,7 @@ type TMDataGridFeatureFlags = {
|
|
|
917
1003
|
*/
|
|
918
1004
|
matchHighlighting: boolean;
|
|
919
1005
|
};
|
|
920
|
-
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" | "
|
|
1006
|
+
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" | "editing" | "enableRowNumbers" | "enableRowPinning" | "enableMatchHighlighting">): TMDataGridFeatureFlags;
|
|
921
1007
|
/**
|
|
922
1008
|
* What one column's header may offer.
|
|
923
1009
|
*
|
|
@@ -963,8 +1049,8 @@ declare function getGridCapabilities(table: TMDataGridTable<TMDataGridRowData>,
|
|
|
963
1049
|
* Ids, because every other thing the grid does moves cells around: sorting
|
|
964
1050
|
* reorders rows, filtering removes them, dragging a header reorders columns. A
|
|
965
1051
|
* coordinate pair would silently come to mean a different cell after any of
|
|
966
|
-
* them, while a pair of ids either still resolves or does not resolve at all
|
|
967
|
-
* and "does not resolve"
|
|
1052
|
+
* them, while a pair of ids either still resolves or does not resolve at all,
|
|
1053
|
+
* and the grid handles "does not resolve" explicitly.
|
|
968
1054
|
*
|
|
969
1055
|
* Indices are what navigation is actually computed in, so they are resolved
|
|
970
1056
|
* from the ids on each keystroke and turned straight back. See resolveCellMove.
|
|
@@ -1043,11 +1129,11 @@ type ResolveRangeBoundsArgs = {
|
|
|
1043
1129
|
* Turns a range into the rectangle to paint and copy, or `null` when either
|
|
1044
1130
|
* corner no longer exists.
|
|
1045
1131
|
*
|
|
1046
|
-
* A corner goes missing whenever a filter drops its row or a column is hidden
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1132
|
+
* A corner goes missing whenever a filter drops its row or a column is hidden.
|
|
1133
|
+
* There is then no rectangle, rather than a guessed replacement corner that
|
|
1134
|
+
* would copy cells the user never selected. The range itself is left alone:
|
|
1135
|
+
* clearing it here would discard a selection that returns as soon as the filter
|
|
1136
|
+
* is cleared.
|
|
1051
1137
|
*/
|
|
1052
1138
|
declare function resolveRangeBounds({ range, rowIndexOf, columnIndexOf }: ResolveRangeBoundsArgs): TMDataGridRangeBounds | null;
|
|
1053
1139
|
/** Whether a cell is inside the rectangle. */
|
|
@@ -1055,7 +1141,7 @@ declare function isWithinBounds(bounds: TMDataGridRangeBounds | null, rowIndex:
|
|
|
1055
1141
|
/** How many cells the rectangle covers. `0` for no range at all. */
|
|
1056
1142
|
declare function boundsCellCount(bounds: TMDataGridRangeBounds | null): number;
|
|
1057
1143
|
/**
|
|
1058
|
-
* Which edges of the rectangle a cell
|
|
1144
|
+
* Which edges of the rectangle a cell lies on, for the outline.
|
|
1059
1145
|
*
|
|
1060
1146
|
* The border is drawn per cell rather than as one box over the top, because the
|
|
1061
1147
|
* body is a scrolling CSS grid with sticky columns in it: an overlay would have
|
|
@@ -1070,7 +1156,16 @@ declare function boundsEdges(bounds: TMDataGridRangeBounds | null, rowIndex: num
|
|
|
1070
1156
|
} | null;
|
|
1071
1157
|
//#endregion
|
|
1072
1158
|
//#region .types-tmp/useTMDataGrid.d.ts
|
|
1073
|
-
/**
|
|
1159
|
+
/**
|
|
1160
|
+
* Per-column configuration the grid's own components read.
|
|
1161
|
+
*
|
|
1162
|
+
* The filter and edit stages each get a namespace, `filter` and `edit`,
|
|
1163
|
+
* mirroring the feature's runtime API. What the column *is* stays flat:
|
|
1164
|
+
* `label`, `type`, `options`, `align`, `flex`, `autoSize`, `enableOrdering`.
|
|
1165
|
+
* `type` and `options` are read by both stages, so one declaration of each
|
|
1166
|
+
* feeds the filter panel and the cell editor, which is why they sit outside
|
|
1167
|
+
* both namespaces.
|
|
1168
|
+
*/
|
|
1074
1169
|
type TMDataGridColumnMeta = {
|
|
1075
1170
|
/** Name shown in menus and the column manager. Falls back to a string header. */
|
|
1076
1171
|
label?: string;
|
|
@@ -1103,50 +1198,34 @@ type TMDataGridColumnMeta = {
|
|
|
1103
1198
|
*/
|
|
1104
1199
|
enableOrdering?: boolean;
|
|
1105
1200
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* the type's own operators.
|
|
1109
|
-
*/
|
|
1110
|
-
defaultFilterOperator?: TMDataGridFilterOperator;
|
|
1111
|
-
/**
|
|
1112
|
-
* Replaces the built-in value control in this column's filter-panel row. A
|
|
1113
|
-
* component rendered as JSX (hooks are legal inside), receiving the
|
|
1114
|
-
* value-only contract: it reads the current operator, writes the bare
|
|
1115
|
-
* value, and the grid composes the stored filter around it. Define it at
|
|
1116
|
-
* module scope. See {@link TMDataGridFilterControlArgs}.
|
|
1117
|
-
*/
|
|
1118
|
-
filterControl?: TMDataGridFilterControlComponent;
|
|
1119
|
-
/**
|
|
1120
|
-
* Whether this column's cells take edits, once `editMode` is on. `false`
|
|
1121
|
-
* switches the column off outright; a predicate decides per row. Defaults
|
|
1122
|
-
* to editable for any column that maps to a field - see {@link editField}.
|
|
1123
|
-
*/
|
|
1124
|
-
editable?: boolean | ((row: Row<TMDataGridFeatures, TMDataGridRowData>) => boolean);
|
|
1125
|
-
/**
|
|
1126
|
-
* The data path this column edits, when it is not the `accessorKey` - the
|
|
1127
|
-
* only way a column built on `accessorFn` becomes editable. Dot paths reach
|
|
1128
|
-
* into nested records: `"address.city"`.
|
|
1129
|
-
*/
|
|
1130
|
-
editField?: string;
|
|
1131
|
-
/**
|
|
1132
|
-
* Field-level validators, in TanStack Form's own vocabulary. A bare Zod
|
|
1133
|
-
* schema (or any Standard Schema, or a plain function) means
|
|
1134
|
-
* `{ onChange: it }`; the object form takes every trigger Form defines.
|
|
1201
|
+
* How this column filters: the operator a fresh filter starts with, and the
|
|
1202
|
+
* value control the filter panel renders for it.
|
|
1135
1203
|
*
|
|
1136
1204
|
* ```tsx
|
|
1137
|
-
* meta: {
|
|
1138
|
-
*
|
|
1205
|
+
* meta: {
|
|
1206
|
+
* type: "number",
|
|
1207
|
+
* filter: { defaultOperator: "between", control: DgRangeSliderFilter },
|
|
1208
|
+
* }
|
|
1139
1209
|
* ```
|
|
1210
|
+
*
|
|
1211
|
+
* See {@link TMDataGridColumnFilterOptions}.
|
|
1140
1212
|
*/
|
|
1141
|
-
|
|
1213
|
+
filter?: TMDataGridColumnFilterOptions;
|
|
1142
1214
|
/**
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1215
|
+
* How this column is edited: whether it takes edits, which field they write
|
|
1216
|
+
* to, which editor opens, what validates the field and what maps the value
|
|
1217
|
+
* on its way in.
|
|
1218
|
+
*
|
|
1219
|
+
* ```tsx
|
|
1220
|
+
* meta: {
|
|
1221
|
+
* type: "string",
|
|
1222
|
+
* edit: { validate: z.string().min(2, "Too short") },
|
|
1223
|
+
* }
|
|
1224
|
+
* ```
|
|
1225
|
+
*
|
|
1226
|
+
* See {@link TMDataGridColumnEditOptions}.
|
|
1148
1227
|
*/
|
|
1149
|
-
|
|
1228
|
+
edit?: TMDataGridColumnEditOptions;
|
|
1150
1229
|
};
|
|
1151
1230
|
/** Grid-wide configuration passed through `options.meta`. */
|
|
1152
1231
|
type TMDataGridTableMeta = {
|
|
@@ -1436,7 +1515,7 @@ type TMDataGridApi<TData extends RowData> = {
|
|
|
1436
1515
|
* The edit engine - open forms, dirty/error projections, and the verbs
|
|
1437
1516
|
* (`begin`, `commit`, `cancel`, `submitAll`). `edit.getForm(rowId)` hands
|
|
1438
1517
|
* out the same TanStack Form the inline editors write through, so a drawer
|
|
1439
|
-
* or detail panel can share a row's draft. Inert until `
|
|
1518
|
+
* or detail panel can share a row's draft. Inert until `editing` is set.
|
|
1440
1519
|
*/
|
|
1441
1520
|
edit: TMDataGridEditApi;
|
|
1442
1521
|
/** Table-level feature switches, re-read from options on every render. */
|
|
@@ -1479,19 +1558,13 @@ type TMDataGridApi<TData extends RowData> = {
|
|
|
1479
1558
|
*/
|
|
1480
1559
|
scrollToRow: (args: TMDataGridScrollToRowArgs) => boolean;
|
|
1481
1560
|
/**
|
|
1482
|
-
* @internal Wiring for `TMDataGrid.Table`, which
|
|
1483
|
-
* fills this in. Not part of the
|
|
1561
|
+
* @internal Wiring for `TMDataGrid.Table`, which holds the virtualizer and
|
|
1562
|
+
* fills this in. Not part of the public API.
|
|
1484
1563
|
*/
|
|
1485
1564
|
scrollerRef: MutableRefObject<TMDataGridScroller>;
|
|
1486
1565
|
};
|
|
1487
|
-
/** The editing
|
|
1566
|
+
/** The editing members every mode shares. See {@link TMDataGridEditingOptions}. */
|
|
1488
1567
|
type TMDataGridEditingCallbacks<TData extends RowData> = {
|
|
1489
|
-
/**
|
|
1490
|
-
* `getRowId` stops being optional once editing is on: the forms are keyed
|
|
1491
|
-
* by row id and live outside the DOM, and the index fallback points at a
|
|
1492
|
-
* different record after any sort.
|
|
1493
|
-
*/
|
|
1494
|
-
getRowId: NonNullable<TableOptions<TMDataGridFeatures, TData>["getRowId"]>;
|
|
1495
1568
|
/**
|
|
1496
1569
|
* Form-level validators for the whole editing row - where cross-field
|
|
1497
1570
|
* rules live. TanStack Form's own vocabulary, Standard Schema included:
|
|
@@ -1517,10 +1590,10 @@ type TMDataGridEditingCallbacks<TData extends RowData> = {
|
|
|
1517
1590
|
* draft visible with a busy marker - and a rejection keeps the form open
|
|
1518
1591
|
* with the error on the row.
|
|
1519
1592
|
*
|
|
1520
|
-
* `changes` is the per-field diff (one entry in cell mode) for
|
|
1521
|
-
*
|
|
1593
|
+
* `changes` is the per-field diff (one entry in cell mode), for a PATCH.
|
|
1594
|
+
* `value` is the entire edited row, for saving a record.
|
|
1522
1595
|
*/
|
|
1523
|
-
|
|
1596
|
+
onCommit?: (args: TMDataGridEditCommitArgs<TData>) => void | Promise<void>;
|
|
1524
1597
|
/**
|
|
1525
1598
|
* Seed values for `edit.addRow()` - the entry row's starting point. A
|
|
1526
1599
|
* function is called per added row (fresh timestamps, empty arrays).
|
|
@@ -1541,14 +1614,9 @@ type TMDataGridEditingCallbacks<TData extends RowData> = {
|
|
|
1541
1614
|
onRowDelete?: (args: TMDataGridRowDeleteArgs<TData>) => void | Promise<void>;
|
|
1542
1615
|
};
|
|
1543
1616
|
/**
|
|
1544
|
-
* The editing
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
* required; and `onEditCommitBatch` exists only under `"batch"` - the one
|
|
1548
|
-
* mode whose `submitAll` calls it.
|
|
1549
|
-
*
|
|
1550
|
-
* `editMode` itself turns cell editing on and picks how commits happen. Off
|
|
1551
|
-
* by default.
|
|
1617
|
+
* The `editing` option: one object that turns editing on and holds
|
|
1618
|
+
* everything about it. `mode` picks what counts as a commit and which
|
|
1619
|
+
* controls trigger it; the other members act within that mode.
|
|
1552
1620
|
*
|
|
1553
1621
|
* | Mode | Commit | Cancel |
|
|
1554
1622
|
* | ---- | ------ | ------ |
|
|
@@ -1557,36 +1625,46 @@ type TMDataGridEditingCallbacks<TData extends RowData> = {
|
|
|
1557
1625
|
* | `"row"` | Save in the edit lane, or Ctrl+Enter | Cancel, or Escape |
|
|
1558
1626
|
* | `"batch"` | `edit.submitAll()` | `edit.cancelAll()` |
|
|
1559
1627
|
*
|
|
1628
|
+
* Setting `editing` makes `getRowId` required - drafts are keyed by row id,
|
|
1629
|
+
* and the index fallback would name a different record after any sort - and
|
|
1630
|
+
* `onCommitBatch` exists only under `mode: "batch"`, the one mode whose
|
|
1631
|
+
* `submitAll` calls it.
|
|
1632
|
+
*
|
|
1633
|
+
* The object may be written inline: the callbacks are read through a ref
|
|
1634
|
+
* every render, so its identity does not matter.
|
|
1635
|
+
*
|
|
1560
1636
|
* One TanStack Form per editing row; drafts survive scrolling because the
|
|
1561
1637
|
* forms live outside the DOM, keyed by row id. Which columns edit, and with
|
|
1562
|
-
* what, is declared per column
|
|
1563
|
-
* `
|
|
1564
|
-
*
|
|
1638
|
+
* what, is declared per column under `meta.edit`: `meta.type` picks the
|
|
1639
|
+
* built-in editor, and `enabled`, `field`, `editor`, `validate` and `mapValue`
|
|
1640
|
+
* override the rest.
|
|
1565
1641
|
*/
|
|
1566
|
-
type TMDataGridEditingOptions<TData extends RowData> =
|
|
1567
|
-
|
|
1642
|
+
type TMDataGridEditingOptions<TData extends RowData> = TMDataGridEditingCallbacks<TData> & ({
|
|
1643
|
+
mode: "batch";
|
|
1568
1644
|
/**
|
|
1569
1645
|
* Batch mode's save, called once by `edit.submitAll()` with every
|
|
1570
1646
|
* valid dirty row. Without it, `submitAll` falls back to the per-row
|
|
1571
|
-
* {@link TMDataGridEditingCallbacks.
|
|
1647
|
+
* {@link TMDataGridEditingCallbacks.onCommit} loop. Rows failing
|
|
1572
1648
|
* validation stay open either way; a rejection keeps every draft.
|
|
1573
1649
|
*/
|
|
1574
|
-
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1650
|
+
onCommitBatch?: (args: TMDataGridEditCommitBatchArgs<TData>) => void | Promise<void>;
|
|
1651
|
+
} | {
|
|
1652
|
+
mode: Exclude<TMDataGridEditMode, "batch">;
|
|
1577
1653
|
/** Only `"batch"`'s `submitAll` ever calls it - see the other branch. */
|
|
1578
|
-
|
|
1579
|
-
})
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1654
|
+
onCommitBatch?: never;
|
|
1655
|
+
});
|
|
1656
|
+
type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridFeatures, TData>, "features"> & ({
|
|
1657
|
+
editing?: undefined;
|
|
1658
|
+
} | {
|
|
1659
|
+
/** Turns editing on. See {@link TMDataGridEditingOptions}. */
|
|
1660
|
+
editing: TMDataGridEditingOptions<TData>;
|
|
1661
|
+
/**
|
|
1662
|
+
* Required once `editing` is set: the forms are keyed by row id and
|
|
1663
|
+
* live outside the DOM, and the index fallback points at a different
|
|
1664
|
+
* record after any sort.
|
|
1665
|
+
*/
|
|
1666
|
+
getRowId: NonNullable<TableOptions<TMDataGridFeatures, TData>["getRowId"]>;
|
|
1667
|
+
}) & {
|
|
1590
1668
|
/**
|
|
1591
1669
|
* Restore and persist table state across mounts. Two keys, because the two
|
|
1592
1670
|
* kinds of state have different lifetimes - see {@link TMDataGridPersistence}.
|
|
@@ -1806,9 +1884,9 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
1806
1884
|
* Defaults to 160.
|
|
1807
1885
|
*
|
|
1808
1886
|
* An estimate, not a height: every mounted row is measured, so the real one
|
|
1809
|
-
* takes over as soon as the panel is on screen. It keeps the scrollbar
|
|
1810
|
-
* for panels that open off screen
|
|
1811
|
-
*
|
|
1887
|
+
* takes over as soon as the panel is on screen. It keeps the scrollbar
|
|
1888
|
+
* accurate for panels that open off screen, such as restored `expanded`
|
|
1889
|
+
* state. An approximate value is enough.
|
|
1812
1890
|
*/
|
|
1813
1891
|
renderDetailsEstHeight?: number;
|
|
1814
1892
|
/**
|
|
@@ -1832,7 +1910,7 @@ type UseTMDataGridOptions<TData extends RowData> = Omit<TableOptions<TMDataGridF
|
|
|
1832
1910
|
* flag on, so `<TMDataGrid.Footer />` renders its pager without further
|
|
1833
1911
|
* options.
|
|
1834
1912
|
*/
|
|
1835
|
-
declare function useTMDataGrid<TData extends RowData>({ persist, labels: labelsOverride, enableColumnOrdering, enablePagination, enableRowNumbers, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, cellSelection, onFocusedCellChange,
|
|
1913
|
+
declare function useTMDataGrid<TData extends RowData>({ persist, labels: labelsOverride, enableColumnOrdering, enablePagination, enableRowNumbers, selectionMode, showSelectedBackground, defaultHighlightedRowId, onHighlightedRowChange, cellSelection, onFocusedCellChange, editing, renderDetails, renderDetailsEstHeight, overscan, ...options }: UseTMDataGridOptions<TData>): TMDataGridApi<TData>;
|
|
1836
1914
|
/**
|
|
1837
1915
|
* Opens the filter panel for a column, seeding an empty filter row when the
|
|
1838
1916
|
* column has none yet - mirrors "Filter" in the column header menu.
|
|
@@ -2134,9 +2212,9 @@ declare function toClipboardText(matrix: TMDataGridCellMatrix): string;
|
|
|
2134
2212
|
* | UTF-8 BOM | without it Excel reads the file as ANSI, and å ä ö arrive broken |
|
|
2135
2213
|
* | CRLF line endings | what Excel writes, and what its importer is happiest with |
|
|
2136
2214
|
*
|
|
2137
|
-
* The `sep=` line is Excel's alone; other readers show it as a first row.
|
|
2138
|
-
*
|
|
2139
|
-
*
|
|
2215
|
+
* The `sep=` line is Excel's alone; other readers show it as a first row. This
|
|
2216
|
+
* export targets Excel, so opening correctly there takes priority over strict
|
|
2217
|
+
* CSV.
|
|
2140
2218
|
*/
|
|
2141
2219
|
declare function toExcelCsv(matrix: TMDataGridCellMatrix, { separator }: {
|
|
2142
2220
|
separator: string;
|
|
@@ -2147,7 +2225,7 @@ declare function toExcelCsv(matrix: TMDataGridCellMatrix, { separator }: {
|
|
|
2147
2225
|
* The async clipboard API only resolves for a document that has the focus and a
|
|
2148
2226
|
* user gesture behind it - both true when this runs off Ctrl+C or a menu item.
|
|
2149
2227
|
* It is still allowed to reject (a permissions policy, a page that lost focus
|
|
2150
|
-
* mid-copy), so the result is a boolean
|
|
2228
|
+
* mid-copy), so the result is a boolean the caller can act on.
|
|
2151
2229
|
*/
|
|
2152
2230
|
declare function writeClipboardText(text: string): Promise<boolean>;
|
|
2153
2231
|
/**
|
|
@@ -2394,9 +2472,9 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
2394
2472
|
*/
|
|
2395
2473
|
reachEndThreshold?: number;
|
|
2396
2474
|
/**
|
|
2397
|
-
* Accessible name for the grid
|
|
2398
|
-
*
|
|
2399
|
-
*
|
|
2475
|
+
* Accessible name for the grid: what a screen reader announces on entry, and
|
|
2476
|
+
* what `getByRole("grid", { name })` matches. Set it on any page holding more
|
|
2477
|
+
* than one grid; without it they are all announced as "grid".
|
|
2400
2478
|
*/
|
|
2401
2479
|
"aria-label"?: string;
|
|
2402
2480
|
/** As {@link "aria-label"}, pointing at an element that already names it. */
|
|
@@ -2404,9 +2482,9 @@ type TMDataGridTableProps<TData extends RowData> = {
|
|
|
2404
2482
|
};
|
|
2405
2483
|
/**
|
|
2406
2484
|
* The scrollable grid surface. Always virtualized: only the rows inside the
|
|
2407
|
-
* viewport (plus overscan) are mounted
|
|
2408
|
-
* no-pagination mode
|
|
2409
|
-
* `enablePagination
|
|
2485
|
+
* viewport (plus overscan) are mounted, which is what makes the default
|
|
2486
|
+
* no-pagination mode work at any row count. Pagination is opt in through
|
|
2487
|
+
* `enablePagination`, or implied by `manualPagination`.
|
|
2410
2488
|
*/
|
|
2411
2489
|
declare function TMDataGridTable$1<TData extends RowData = TMDataGridRowData>({ onRowClick, onCellClick, onCellDoubleClick, onCellContextMenu, rowClassName, rowStyle, striped, onScrollToTop, onScrollToBottom, onScrollToLeft, onScrollToRight, renderEmptyState, renderRowContextMenu, renderColumnMenuItems, rowContextMenuProps, cellExport, onReachEnd, reachEndThreshold, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: TMDataGridTableProps<TData>): import("react").JSX.Element;
|
|
2412
2490
|
//#endregion
|
|
@@ -2550,7 +2628,7 @@ declare function formatGroupValue(value: unknown, blankLabel?: string): string;
|
|
|
2550
2628
|
//#region .types-tmp/components/filters/TMDataGridFilterValueInput.d.ts
|
|
2551
2629
|
/**
|
|
2552
2630
|
* The built-in value control of a filter-panel row - what renders when a
|
|
2553
|
-
* column declares no `meta.
|
|
2631
|
+
* column declares no `meta.filter.control`. Shaped by the operator: a
|
|
2554
2632
|
* multi-select for the set operators, a From/To pair for `between`, a Yes/No
|
|
2555
2633
|
* dropdown for booleans, a typed input otherwise.
|
|
2556
2634
|
*
|
|
@@ -2561,9 +2639,9 @@ declare function TMDataGridFilterValueInput({ column, operator, value, onChange,
|
|
|
2561
2639
|
//#endregion
|
|
2562
2640
|
//#region .types-tmp/components/filters/DgRangeSliderFilter.d.ts
|
|
2563
2641
|
/**
|
|
2564
|
-
* A built-in `meta.
|
|
2642
|
+
* A built-in `meta.filter.control` for `number` columns: a range slider whose
|
|
2565
2643
|
* bounds are seeded from the values present in the data, writing the
|
|
2566
|
-
* `between` pair. Pair it with `meta.
|
|
2644
|
+
* `between` pair. Pair it with `meta.filter.defaultOperator: "between"` so
|
|
2567
2645
|
* the filter opens on it; any non-range operator falls back to the standard
|
|
2568
2646
|
* input.
|
|
2569
2647
|
*/
|
|
@@ -2571,17 +2649,17 @@ declare function DgRangeSliderFilter(args: TMDataGridFilterControlArgs): import(
|
|
|
2571
2649
|
//#endregion
|
|
2572
2650
|
//#region .types-tmp/components/filters/DgDateRangeFilter.d.ts
|
|
2573
2651
|
/**
|
|
2574
|
-
* A built-in `meta.
|
|
2652
|
+
* A built-in `meta.filter.control` for `date` columns: a From/To pair of
|
|
2575
2653
|
* native date inputs writing the `between` pair - no `@mantine/dates`
|
|
2576
2654
|
* involved, like the built-in date editor. Pair it with
|
|
2577
|
-
* `meta.
|
|
2655
|
+
* `meta.filter.defaultOperator: "between"`; any non-range operator falls back
|
|
2578
2656
|
* to the standard input.
|
|
2579
2657
|
*/
|
|
2580
2658
|
declare function DgDateRangeFilter(args: TMDataGridFilterControlArgs): import("react").JSX.Element;
|
|
2581
2659
|
//#endregion
|
|
2582
2660
|
//#region .types-tmp/components/filters/DgAutocompleteFilter.d.ts
|
|
2583
2661
|
/**
|
|
2584
|
-
* A built-in `meta.
|
|
2662
|
+
* A built-in `meta.filter.control` for text-shaped columns: a free-text input
|
|
2585
2663
|
* that also offers the values present in the data (or the column's declared
|
|
2586
2664
|
* `meta.options`) as suggestions. Set or range operators fall back to the
|
|
2587
2665
|
* standard input.
|
|
@@ -2590,7 +2668,7 @@ declare function DgAutocompleteFilter(args: TMDataGridFilterControlArgs): import
|
|
|
2590
2668
|
//#endregion
|
|
2591
2669
|
//#region .types-tmp/components/filters/DgTriStateFilter.d.ts
|
|
2592
2670
|
/**
|
|
2593
|
-
* A built-in `meta.
|
|
2671
|
+
* A built-in `meta.filter.control` for `boolean` columns: an All / Yes / No
|
|
2594
2672
|
* segmented control - All clears the value, which deactivates the filter.
|
|
2595
2673
|
* Set or range operators fall back to the standard input.
|
|
2596
2674
|
*/
|
|
@@ -2598,23 +2676,23 @@ declare function DgTriStateFilter(args: TMDataGridFilterControlArgs): import("re
|
|
|
2598
2676
|
//#endregion
|
|
2599
2677
|
//#region .types-tmp/components/editors/TMDataGridStringEditor.d.ts
|
|
2600
2678
|
/** The built-in editor for `meta.type: "string"` (and the default). */
|
|
2601
|
-
declare function TMDataGridStringEditor({ field,
|
|
2679
|
+
declare function TMDataGridStringEditor({ field, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2602
2680
|
//#endregion
|
|
2603
2681
|
//#region .types-tmp/components/editors/TMDataGridNumberEditor.d.ts
|
|
2604
2682
|
/** The built-in editor for `meta.type: "number"`. */
|
|
2605
|
-
declare function TMDataGridNumberEditor({ field,
|
|
2683
|
+
declare function TMDataGridNumberEditor({ field, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2606
2684
|
//#endregion
|
|
2607
2685
|
//#region .types-tmp/components/editors/TMDataGridBooleanEditor.d.ts
|
|
2608
2686
|
/** The built-in editor for `meta.type: "boolean"` - a focused checkbox. */
|
|
2609
|
-
declare function TMDataGridBooleanEditor({ field,
|
|
2687
|
+
declare function TMDataGridBooleanEditor({ field, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2610
2688
|
//#endregion
|
|
2611
2689
|
//#region .types-tmp/components/editors/TMDataGridDateEditor.d.ts
|
|
2612
2690
|
/**
|
|
2613
2691
|
* The built-in editor for `meta.type: "date"` - the native
|
|
2614
2692
|
* `<input type="date">` styled by Mantine, no `@mantine/dates` involved. A
|
|
2615
|
-
* consumer wanting a real picker plugs one in through `meta.editor`.
|
|
2693
|
+
* consumer wanting a real picker plugs one in through `meta.edit.editor`.
|
|
2616
2694
|
*/
|
|
2617
|
-
declare function TMDataGridDateEditor({ field,
|
|
2695
|
+
declare function TMDataGridDateEditor({ field, column, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2618
2696
|
//#endregion
|
|
2619
2697
|
//#region .types-tmp/components/editors/TMDataGridSelectEditor.d.ts
|
|
2620
2698
|
/**
|
|
@@ -2622,7 +2700,7 @@ declare function TMDataGridDateEditor({ field, autoFocus, column, size }: TMData
|
|
|
2622
2700
|
* `meta.options` the filter panel reads - with the row in hand, so a
|
|
2623
2701
|
* function source can depend on the record being edited.
|
|
2624
2702
|
*/
|
|
2625
|
-
declare function TMDataGridSelectEditor({ field,
|
|
2703
|
+
declare function TMDataGridSelectEditor({ field, column, row, table, size, commit }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2626
2704
|
//#endregion
|
|
2627
2705
|
//#region .types-tmp/components/editors/TMDataGridMultiSelectEditor.d.ts
|
|
2628
2706
|
/**
|
|
@@ -2630,7 +2708,7 @@ declare function TMDataGridSelectEditor({ field, autoFocus, column, row, table,
|
|
|
2630
2708
|
* arrays. Never commits on pick: building a set takes several, so the commit
|
|
2631
2709
|
* stays on Enter/blur like a text edit.
|
|
2632
2710
|
*/
|
|
2633
|
-
declare function TMDataGridMultiSelectEditor({ field,
|
|
2711
|
+
declare function TMDataGridMultiSelectEditor({ field, column, row, table, size }: TMDataGridEditorArgs): import("react").JSX.Element;
|
|
2634
2712
|
//#endregion
|
|
2635
2713
|
//#region .types-tmp/core/labelsSv.d.ts
|
|
2636
2714
|
/**
|
|
@@ -2665,9 +2743,23 @@ declare function getColumnLabel(column: ColumnLike): string;
|
|
|
2665
2743
|
declare function getColumnType(column: ColumnLike): TMDataGridColumnType;
|
|
2666
2744
|
/**
|
|
2667
2745
|
* The operator a fresh filter on this column starts with -
|
|
2668
|
-
* `meta.
|
|
2746
|
+
* `meta.filter.defaultOperator`, else the type's default.
|
|
2669
2747
|
*/
|
|
2670
2748
|
declare function getColumnDefaultOperator(column: ColumnLike): TMDataGridFilterOperator;
|
|
2749
|
+
/**
|
|
2750
|
+
* This column's filter-panel value control - `meta.filter.control`, or
|
|
2751
|
+
* `undefined` for the built-in shape-by-operator input.
|
|
2752
|
+
*/
|
|
2753
|
+
declare function getColumnFilterControl(column: ColumnLike): TMDataGridFilterControlComponent | undefined;
|
|
2754
|
+
/**
|
|
2755
|
+
* Whether `meta.edit.enabled` lets this column's cell on this row be edited -
|
|
2756
|
+
* the switch, then the predicate.
|
|
2757
|
+
*
|
|
2758
|
+
* This is only the column's half of the rule. A cell also needs the column to
|
|
2759
|
+
* map to a field (`getEditFieldName`) and the row to take edits at all
|
|
2760
|
+
* (`isRowEditable`); `edit.canEditCell` is the whole question.
|
|
2761
|
+
*/
|
|
2762
|
+
declare function isColumnEditableForRow(column: ColumnLike, row: Row<TMDataGridFeatures, TMDataGridRowData>): boolean;
|
|
2671
2763
|
/**
|
|
2672
2764
|
* A generated lane holding one fixed-width thing - the checkbox, the details
|
|
2673
2765
|
* chevron, the row number.
|
|
@@ -2682,6 +2774,16 @@ declare function getColumnDefaultOperator(column: ColumnLike): TMDataGridFilterO
|
|
|
2682
2774
|
* chevron, and wants the padding.
|
|
2683
2775
|
*/
|
|
2684
2776
|
declare function isControlColumn(columnId: string): boolean;
|
|
2777
|
+
/**
|
|
2778
|
+
* Whether the grid generated this column rather than the consumer declaring it
|
|
2779
|
+
* - the four control lanes plus the tree column.
|
|
2780
|
+
*
|
|
2781
|
+
* These hold the grid's own chrome, and they keep the edges of the row: the
|
|
2782
|
+
* generated left lanes before every consumer column, the edit lane after all of
|
|
2783
|
+
* them. `isControlColumn` answers a narrower question about layout, and leaves
|
|
2784
|
+
* the tree column out because it is padded like a data column.
|
|
2785
|
+
*/
|
|
2786
|
+
declare function isGeneratedColumn(columnId: string): boolean;
|
|
2685
2787
|
/**
|
|
2686
2788
|
* Whether a column may be moved. Ordering is the one column feature TanStack
|
|
2687
2789
|
* has no column option for, so the switch lives in `meta.enableOrdering`.
|
|
@@ -2736,7 +2838,9 @@ declare function aggregateColumn<TData extends RowData>({ table, columnId, fn }:
|
|
|
2736
2838
|
*
|
|
2737
2839
|
* Mounted cells only: under virtualization the unmounted rows do not exist to
|
|
2738
2840
|
* be measured, so this reads the visible window plus overscan - the same
|
|
2739
|
-
* trade AG Grid's autosize makes by default.
|
|
2841
|
+
* trade AG Grid's autosize makes by default. With no rows mounted at all the
|
|
2842
|
+
* header is the only thing left to measure, which is a width that fits the
|
|
2843
|
+
* title and nothing else - see `hasMountedCells`.
|
|
2740
2844
|
*/
|
|
2741
2845
|
declare function measureColumnContentWidth({ container, columnId }: {
|
|
2742
2846
|
/** The grid's scroll container - anything enclosing the column's cells. */
|
|
@@ -2835,6 +2939,20 @@ type MoveColumnArgs = {
|
|
|
2835
2939
|
* updates that array as well.
|
|
2836
2940
|
*/
|
|
2837
2941
|
declare function moveColumn({ table, columnId, targetId, side }: MoveColumnArgs): void;
|
|
2942
|
+
/**
|
|
2943
|
+
* Puts the generated lanes back on the outside of both pinned lanes: the ones
|
|
2944
|
+
* on the left before every consumer column, the edit lane after all of them.
|
|
2945
|
+
*
|
|
2946
|
+
* `column.pin("right")` appends, so pinning a column right would otherwise drop
|
|
2947
|
+
* it outside the edit lane, so the row's Save and Delete would no longer be
|
|
2948
|
+
* last in the row. Pinning left appends too, which is already correct there,
|
|
2949
|
+
* but the same pass keeps both lanes in place whatever a consumer writes into
|
|
2950
|
+
* `columnPinning` directly.
|
|
2951
|
+
*
|
|
2952
|
+
* Relative order is preserved inside each part, so a user's own arrangement of
|
|
2953
|
+
* the pinned columns survives.
|
|
2954
|
+
*/
|
|
2955
|
+
declare function keepGeneratedColumnsOutermost(pinning: ColumnPinningState): ColumnPinningState;
|
|
2838
2956
|
type ColumnStepArgs = {
|
|
2839
2957
|
table: GridTable;
|
|
2840
2958
|
columnId: string;
|
|
@@ -2905,9 +3023,9 @@ type ResolveRowSelectionClickArgs<TData extends RowData> = {
|
|
|
2905
3023
|
/**
|
|
2906
3024
|
* Whether this gesture is allowed to clear rows it did not touch.
|
|
2907
3025
|
*
|
|
2908
|
-
* `true` for a bare row click,
|
|
2909
|
-
*
|
|
2910
|
-
*
|
|
3026
|
+
* `true` for a bare row click, which replaces the selection. `false` for a
|
|
3027
|
+
* checkbox, which is only ever additive: ticking one box does not clear the
|
|
3028
|
+
* others, and shift-clicking one adds the range rather than replacing it.
|
|
2911
3029
|
*/
|
|
2912
3030
|
canReplaceSelection: boolean;
|
|
2913
3031
|
};
|
|
@@ -2951,4 +3069,4 @@ declare function getSelectableRowIds<TData extends RowData>(row: Row<TMDataGridF
|
|
|
2951
3069
|
*/
|
|
2952
3070
|
declare function resolveRowSelectionClick<TData extends RowData>({ rows, rowId, anchorRowId, modifiers, selection, canReplaceSelection }: ResolveRowSelectionClickArgs<TData>): ResolvedRowSelection;
|
|
2953
3071
|
//#endregion
|
|
2954
|
-
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 TMDataGridColumnMenuItemsArgs, type TMDataGridColumnMenuItemsRenderer, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnType, type TMDataGridContextValue, type TMDataGridDataSlice, TMDataGridDateEditor, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, type TMDataGridDropSide, TMDataGridEditActions, type TMDataGridEditActionsActions, type TMDataGridEditActionsControls, type TMDataGridEditActionsProps, type TMDataGridEditActionsSlotArgs, type TMDataGridEditActionsState, 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 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 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 };
|
|
3072
|
+
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 TMDataGridColumnEditOptions, type TMDataGridColumnFilterOptions, type TMDataGridColumnLayout, type TMDataGridColumnMenuItemsArgs, type TMDataGridColumnMenuItemsRenderer, type TMDataGridColumnMeta, type TMDataGridColumnRegion, type TMDataGridColumnType, type TMDataGridContextValue, type TMDataGridDataSlice, TMDataGridDateEditor, type TMDataGridDetailsArgs, type TMDataGridDetailsRenderer, type TMDataGridDropSide, TMDataGridEditActions, type TMDataGridEditActionsActions, type TMDataGridEditActionsControls, type TMDataGridEditActionsProps, type TMDataGridEditActionsSlotArgs, type TMDataGridEditActionsState, type TMDataGridEditApi, type TMDataGridEditChange, type TMDataGridEditCommitArgs, type TMDataGridEditCommitBatchArgs, type TMDataGridEditField, type TMDataGridEditMode, type TMDataGridEditRowProjection, type TMDataGridEditState, type TMDataGridEditValueMap, type TMDataGridEditValueMapArgs, 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 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 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, getColumnFilterControl, getColumnLabel, getColumnRegion, getColumnType, getDefaultOperator, getDisplayedRows, getEditFieldName, getGridCapabilities, getGroupDataRows, getOperatorsForType, getSelectableRowIds, getStepTargetColumn, getTMDataGridPaginationApi, isColumnEditableForRow, isColumnReorderable, isControlColumn, isFilterActive, isGeneratedColumn, isPagingActive, isSameCell, isWithinBounds, keepGeneratedColumnsOutermost, measureColumnContentWidth, mergeLabels, moveColumn, moveColumnByStep, normalizeFieldValidate, openColumnFilter, operatorNeedsValue, operatorTakesArrayValue, operatorTakesRangeValue, optionsToComboboxData, readFeatureFlags, resolveCellMove, resolveColumnOptions, resolveExpandAll, resolveRangeBounds, resolveRowSelectionClick, tmDataGridFeatures, toClipboardText, toExcelCsv, useCellControlTabIndex, useTMDataGrid, useTMDataGridContext, writeClipboardText };
|