@dooherceg/material-react-table 4.1.1 → 4.1.3
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 +359 -182
- package/dist/index.d.ts +9 -1
- package/dist/index.esm.js +28 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,215 +1,392 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
View [Documentation](https://www.material-react-table.com/)
|
|
4
|
-
|
|
5
|
-
<a href="https://npmjs.com/package/material-react-table" target="_blank">
|
|
6
|
-
<img alt="" src="https://badgen.net/npm/v/material-react-table?color=blue" />
|
|
7
|
-
</a>
|
|
8
|
-
<a href="https://npmtrends.com/material-react-table" target="_blank">
|
|
9
|
-
<img alt="" src="https://badgen.net/npm/dt/material-react-table?label=installs&icon=npm&color=blue" />
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://bundlephobia.com/result?p=material-react-table" target="_blank">
|
|
12
|
-
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table@latest?color=blue" />
|
|
13
|
-
</a>
|
|
14
|
-
<a href="https://star-history.com/#kevinvandy/material-react-table&Date" target="_blank">
|
|
15
|
-
<img alt="" src="https://badgen.net/github/stars/KevinVandy/material-react-table?color=blue" />
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://github.com/KevinVandy/material-react-table/blob/v3/LICENSE" target="_blank">
|
|
18
|
-
<img alt="" src="https://badgen.net/github/license/KevinVandy/material-react-table?color=blue" />
|
|
19
|
-
</a>
|
|
20
|
-
<a
|
|
21
|
-
href="https://github.com/sponsors/kevinvandy"
|
|
22
|
-
target="_blank"
|
|
23
|
-
rel="noopener"
|
|
24
|
-
>
|
|
25
|
-
<img alt="" src="https://img.shields.io/badge/sponsor-violet" />
|
|
26
|
-
</a>
|
|
27
|
-
<a
|
|
28
|
-
href="https://discord.gg/5wqyRx6fnm"
|
|
29
|
-
target="_blank"
|
|
30
|
-
rel="noopener"
|
|
31
|
-
>
|
|
32
|
-
<img alt="" src="https://dcbadge.vercel.app/api/server/5wqyRx6fnm?style=flat">
|
|
33
|
-
</a>
|
|
34
|
-
|
|
35
|
-
## About
|
|
36
|
-
|
|
37
|
-
### _Quickly Create React Data Tables with Material Design_
|
|
38
|
-
|
|
39
|
-
### **Built with [Material UI <sup>V6</sup>](https://mui.com) and [TanStack Table <sup>V8</sup>](https://tanstack.com/table/v8)**
|
|
40
|
-
|
|
41
|
-
<img src="https://material-react-table.com/banner.png" alt="MRT" height="50" />
|
|
42
|
-
|
|
43
|
-
> Want to use Mantine instead of Material UI? Check out [Mantine React Table](https://www.mantine-react-table.com)
|
|
44
|
-
|
|
45
|
-
## Learn More
|
|
46
|
-
|
|
47
|
-
- Join the [Discord](https://discord.gg/5wqyRx6fnm) server to join in on the development discussion or ask questions
|
|
48
|
-
- View the [Docs Website](https://www.material-react-table.com/)
|
|
49
|
-
- See all [Props, Options, APIs, Components, and Hooks](https://www.material-react-table.com/docs/api)
|
|
50
|
-
|
|
51
|
-
### Quick Examples
|
|
52
|
-
|
|
53
|
-
- [Basic Table](https://www.material-react-table.com/docs/examples/basic/) (See Default Features)
|
|
54
|
-
- [Minimal Table](https://www.material-react-table.com/docs/examples/minimal/) (Turn off Features like Pagination, Sorting, Filtering, and Toolbars)
|
|
55
|
-
- [Advanced Table](https://www.material-react-table.com/docs/examples/advanced/) (See some of the Advanced Features)
|
|
56
|
-
- [Custom Headless Table](https://www.material-react-table.com/docs/examples/custom-headless/) (Build your own table markup)
|
|
57
|
-
- [Dragging / Ordering Examples](https://www.material-react-table.com/docs/examples/column-ordering/) (Drag and Drop)
|
|
58
|
-
- [Editing (CRUD) Examples](https://www.material-react-table.com/docs/examples/editing-crud/) (Create, Edit, and Delete Rows)
|
|
59
|
-
- [Expanding / Grouping Examples](https://www.material-react-table.com/docs/examples/aggregation-and-grouping/) (Sum, Average, Count, etc.)
|
|
60
|
-
- [Filtering Examples](https://www.material-react-table.com/docs/examples/filter-variants/) (Faceted Values, Switching Filters, etc.)
|
|
61
|
-
- [Sticky Pinning Examples](https://www.material-react-table.com/docs/examples/sticky-header/) (Sticky Headers, Sticky Columns, Sticky Rows, etc.)
|
|
62
|
-
- [Remote Data Fetching Examples](https://www.material-react-table.com/docs/examples/react-query/) (Server-side Pagination, Sorting, and Filtering)
|
|
63
|
-
- [Virtualized Examples](https://www.material-react-table.com/docs/examples/virtualized/) (10,000 rows at once!)
|
|
64
|
-
- [Infinite Scrolling](https://www.material-react-table.com/docs/examples/infinite-scrolling/) (Fetch data as you scroll)
|
|
65
|
-
- [Localization (i18n)](https://www.material-react-table.com/docs/guides/localization#built-in-locale-examples) (Over a dozen languages built-in)
|
|
66
|
-
|
|
67
|
-
View additional [storybook examples](https://www.material-react-table.dev/)
|
|
68
|
-
|
|
69
|
-
## Features
|
|
70
|
-
|
|
71
|
-
_All features can easily be enabled/disabled_
|
|
72
|
-
|
|
73
|
-
_**Fully Fleshed out [Docs](https://www.material-react-table.com/docs/guides#guides) are available for all features**_
|
|
74
|
-
|
|
75
|
-
- [x] 30-56kb gzipped - [Bundlephobia](https://bundlephobia.com/package/material-react-table)
|
|
76
|
-
- [x] Advanced TypeScript Generics Support (TypeScript Optional)
|
|
77
|
-
- [x] Aggregation and Grouping (Sum, Average, Count, etc.)
|
|
78
|
-
- [x] Cell Actions (Right-click Context Menu)
|
|
79
|
-
- [x] Click To Copy Cell Values
|
|
80
|
-
- [x] Column Action Dropdown Menu
|
|
81
|
-
- [x] Column Hiding
|
|
82
|
-
- [x] Column Ordering via Drag'n'Drop
|
|
83
|
-
- [x] Column Pinning (Freeze Columns)
|
|
84
|
-
- [x] Column Resizing
|
|
85
|
-
- [x] Customize Icons
|
|
86
|
-
- [x] Customize Styling of internal Mui Components
|
|
87
|
-
- [x] Data Editing and Creating (5 different editing modes)
|
|
88
|
-
- [x] Density Toggle
|
|
89
|
-
- [x] Detail Panels (Expansion)
|
|
90
|
-
- [x] Faceted Value Generation for Filter Options
|
|
91
|
-
- [x] Filtering (supports client-side and server-side)
|
|
92
|
-
- [x] Filter Match Highlighting
|
|
93
|
-
- [x] Full Screen Mode
|
|
94
|
-
- [x] Global Filtering (Search across all columns, rank by best match)
|
|
95
|
-
- [x] Header Groups & Footers
|
|
96
|
-
- [x] Localization (i18n) support
|
|
97
|
-
- [x] Manage your own state or let the table manage it internally for you
|
|
98
|
-
- [x] Pagination (supports client-side and server-side)
|
|
99
|
-
- [x] Row Actions (Your Custom Action Buttons)
|
|
100
|
-
- [x] Row Numbers
|
|
101
|
-
- [x] Row Ordering via Drag'n'Drop
|
|
102
|
-
- [x] Row Pinning
|
|
103
|
-
- [x] Row Selection (Checkboxes)
|
|
104
|
-
- [x] SSR compatible
|
|
105
|
-
- [x] Sorting (supports client-side and server-side)
|
|
106
|
-
- [x] Theming (Respects your Material UI Theme)
|
|
107
|
-
- [x] Toolbars (Add your own action buttons)
|
|
108
|
-
- [x] Tree Data / Expanding Sub-rows
|
|
109
|
-
- [x] Virtualization (@tanstack/react-virtual)
|
|
110
|
-
|
|
111
|
-
## Getting Started
|
|
112
|
-
|
|
113
|
-
### Installation
|
|
114
|
-
|
|
115
|
-
View the full [Installation Docs](https://www.material-react-table.com/docs/getting-started/install)
|
|
116
|
-
|
|
117
|
-
1. Ensure that you have React 18 or later installed
|
|
118
|
-
|
|
119
|
-
2. Install Peer Dependencies (Material UI V6)
|
|
1
|
+
# @dooherceg/material-react-table
|
|
120
2
|
|
|
121
|
-
|
|
122
|
-
npm install @mui/material @mui/x-date-pickers @mui/icons-material @emotion/react @emotion/styled
|
|
123
|
-
```
|
|
3
|
+
A Material UI data table for React, built on **TanStack Table v9**. This package started as a fork of the open-source [`material-react-table`](https://github.com/KevinVandy/material-react-table) (v3, TanStack Table v8) and has since diverged substantially: it has been migrated onto TanStack Table v9, had its internal state architecture rewritten for performance, lost several upstream features (free-text filtering, click-to-copy, most editing modes), and gained a typed, backend-driven data model, an advanced filter rule builder, a modal-based create/edit form system, and a server-table data-fetching layer that do not exist upstream.
|
|
124
4
|
|
|
125
|
-
|
|
5
|
+
This README documents the library **as it exists in this repository**, not the upstream project. If you are looking for the original open-source library, see [KevinVandy/material-react-table](https://github.com/KevinVandy/material-react-table).
|
|
126
6
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
7
|
+
## Origin
|
|
8
|
+
|
|
9
|
+
This is a private fork, maintained by **HercegDoo**, that lives inside a pnpm/Turborepo monorepo:
|
|
10
|
+
|
|
11
|
+
- `packages/material-react-table` — the library itself. All of the content below describes this package.
|
|
12
|
+
- `apps/material-react-table-docs` — the original Next.js docs site inherited from upstream. It is **not** kept in sync with this fork's actual API and should not be treated as accurate documentation for this package (see [Known Limitations](#known-limitations)).
|
|
13
|
+
|
|
14
|
+
The repository is in an active, multi-phase migration from TanStack Table v8 (the upstream base) to v9, combined with a ground-up state-ownership rewrite. Three long-form design documents at the repo root (written in Bosnian/Croatian) are the authoritative internal record of *why* the code looks the way it does and exactly which features were kept, removed, or deliberately left unoptimized:
|
|
15
|
+
|
|
16
|
+
- `TANSTACK_TABLE_V9_MIGRATION_PLAN.md` — phase-by-phase migration plan and API renames.
|
|
17
|
+
- `TABLE_FEATURES_INVENTORY.md` — the definitive per-feature keep/remove/freeze decision log.
|
|
18
|
+
- `PERFORMANCE_OPTIMIZATION_PLAN.mdx` — the re-render analysis that motivated the atom-based state split.
|
|
19
|
+
|
|
20
|
+
## Key Features
|
|
21
|
+
|
|
22
|
+
- Sorting (single and multi-column), pagination, column grouping and aggregation (sum/average/count/etc.), column pinning, ordering, resizing, hiding, and virtualization (`@tanstack/react-virtual`)
|
|
23
|
+
- Row selection (single/multi/select-all, with cross-page selection via `getAllSelectableRowIds`), row pinning, row numbers, expandable detail panels, and tree data with reorder-via-selection (not drag-and-drop)
|
|
24
|
+
- Row-level actions menu, cell-level context-menu actions, and a fully custom `actions` system for toolbar/row action buttons (e.g. delete, edit, export)
|
|
25
|
+
- A typed column system (`type: 'string' | 'number' | 'date' | 'dateTime' | 'enum' | 'icon' | 'dimension' | 'boolean' | 'actions' | 'object'`) that drives cell rendering, filter editors, and auto-generated create/edit form fields from one declaration
|
|
26
|
+
- An advanced filter rule builder (AND/OR groups, per-type operators), pinned "quick filter" chips, and saved filter presets
|
|
27
|
+
- A modal-based create/edit form (`MRT_NewEntryModal`) built on React Hook Form, with per-column form field config, custom sections, and custom additional fields
|
|
28
|
+
- CSV/PDF/custom export (table-wide and per-row), plus per-row print
|
|
29
|
+
- A `MaterialReactServerTable` / `useServerTableState` layer for building fully server-driven tables (manual filtering/sorting/pagination/grouping) with minimal boilerplate
|
|
30
|
+
- Skeleton and lightweight "ghost row" loading placeholders, plus header/toolbar progress bars for background refetches
|
|
31
|
+
- Density toggle, sticky header/footer, grid or semantic CSS layout modes, full localization (5 built-in locales), and MUI theme–aware styling
|
|
32
|
+
- CRUD helpers on the table instance (`addRow`, `updateRow`, `upsertRow`, `removeRow`, `setRows`)
|
|
33
|
+
|
|
34
|
+
## Custom Enhancements
|
|
35
|
+
|
|
36
|
+
These are fork-specific additions with no upstream equivalent:
|
|
37
|
+
|
|
38
|
+
- **Typed columns.** Every column definition requires a `type` field (`MRT_ColumnDef`'s `type: ColumnType`). A `ColumnTypeResolver` per type (`src/column-types/*`) supplies the cell renderer, available filter operators, and (optionally) the create/edit form input for that type — one declaration drives rendering, filtering, and forms instead of three separate render props.
|
|
39
|
+
- **Advanced filters, not free-text filtering.** There is no per-column filter input and no global search box. Filtering goes exclusively through `state.filters` (an AND/OR rule tree, `MRT_AdvancedFilters.tsx`), pinned "quick filter" chips, and named saved-filter presets (`initialSavedFilters`, `onSaveFilters`, `onDeleteSavedFilter`).
|
|
40
|
+
- **Modal create/edit forms.** `enableNewEntryButton` + `MRT_NewEntryModal` render a React Hook Form–backed modal for creating or editing a row, configured table-wide via `formConfig` (sections, field order, custom renderers, validation rules) and per-column via `formField`. This is the only editing UI; there is no inline cell/row/table editing.
|
|
41
|
+
- **Custom actions system.** `actions: Action<TData>[]` lets you register arbitrary toolbar/row actions. `createDeleteAction`, `createEditAction`, and `createExportAction` are built-in factories that wrap the default delete/edit/export behavior while letting you intercept it (`defaultOnDelete`, `defaultOnEdit`, `defaultOnExport` are passed back to your handler).
|
|
42
|
+
- **Server-driven tables.** `useServerTableState` owns all table state and exposes a `fetchTrigger` object containing only the values that should retrigger a data fetch (filters, pagination, sorting, a column-visibility "just became visible" counter, and a manual `refetchIndex`), so you can put exactly that in a `useEffect` dependency array without guessing. `MaterialReactServerTable` wraps this with an async `loadConfig()` (columns/initial state/exports arrive from the backend) plus its own loading and error states.
|
|
43
|
+
- **Granular loading UX.** `skeletonMode: 'cells' | 'placeholder'` controls whether the initial loading state renders a full MUI `Skeleton` per cell or lightweight pulsing ghost rows; `positionProgressBars: 'both' | 'bottom' | 'header' | 'none' | 'top'` controls where a background-refetch progress indicator appears (including a header-only thin bar).
|
|
44
|
+
- **Row reordering via selection, not drag-and-drop.** `enableRowReordering` + `onTreeRowReorder` let users select rows and move them with an explicit "move to top level" / "insert here" action, rather than HTML5 drag events.
|
|
45
|
+
- **Iconify-backed icon columns.** `type: 'icon'` columns resolve glyphs from a table-level `iconsList` map (icon code → Iconify component name + default color) via `@iconify/react`, independent of the `@mui/icons-material` set used for the rest of the UI (`icons`/`MRT_Icons`).
|
|
46
|
+
- **`dimension` column type.** A column type for dimension/tolerance-style values (`MRT_DimensionsDef`), with its own cell renderer and form input — not present upstream at all.
|
|
47
|
+
- **`extendColumns` override on the server table.** `MaterialReactServerTable`/`MaterialReactServerTableInstance` accept an `extendColumns` option that lets a consumer override individual column properties (e.g. `Cell`, `header`, `size`) by `accessorKey`, layered on top of the column config the backend supplies via `loadConfig`, without having to own the whole column array.
|
|
48
|
+
- **Performance work predates the v9 atom rewrite.** Before the TanStack v9 migration, this fork had already moved off naive re-rendering: stable row/cell React keys (avoids full DOM remounts on sort/paginate), direct DOM writes during column-resize drag (a single React commit only on pointer release), CSS-variable-driven density/sizing, and hover/drag state lifted out of the root component into slice stores. The v9-era atom/selector work described in `CLAUDE.md` builds on top of this earlier rewrite, rather than being the starting point.
|
|
49
|
+
|
|
50
|
+
## Differences from Upstream
|
|
51
|
+
|
|
52
|
+
| Area | Upstream `material-react-table` v3 | This fork |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| TanStack Table version | v8 | v9 (`@tanstack/react-table` 9.x) — migration in progress |
|
|
55
|
+
| Column/row filtering | Per-column filter inputs + filter-mode menu, global fuzzy search | Removed entirely; replaced by the advanced filter rule builder + saved/pinned filters |
|
|
56
|
+
| Faceted filter values | `enableFacetedValues` auto-populates filter options | Removed — filter options are supplied manually (`filterSelectOptions`-style config) |
|
|
57
|
+
| Click-to-copy cell value | `enableClickToCopy` | Removed |
|
|
58
|
+
| Keyboard navigation shortcuts | `enableKeyboardShortcuts` | Removed |
|
|
59
|
+
| Full screen toggle | Full-screen mode button | Removed — only a stale `toggleFullScreen` locale string remains; no option or component implements it |
|
|
60
|
+
| Row reordering | HTML5 drag-and-drop via a grab-handle column | Removed; replaced by selection + explicit move actions (`enableRowReordering`, `onTreeRowReorder`) |
|
|
61
|
+
| Editing display modes | `cell`, `row`, `table`, `modal`, `custom` (`editDisplayMode`) | Only modal editing exists (`MRT_NewEntryModal`); the other four modes and their components were deleted |
|
|
62
|
+
| Create display modes | `row`, `modal`, `custom` (`createDisplayMode`) | Only modal creation exists |
|
|
63
|
+
| Column `type` | Not part of the public column API | Required discriminant field driving cell rendering, filter operators, and form inputs |
|
|
64
|
+
| Pinning sides | `left` / `right` | `start` / `end` (TanStack v9 logical pinning, no compat shim) |
|
|
65
|
+
| `@tanstack/match-sorter-utils` | Dependency (fuzzy filter/sort) | Removed along with fuzzy filtering/sorting |
|
|
66
|
+
| `fuzzy` filter/sort function | Available, and the default fallback filter for text columns | Removed; `contains` is the fallback |
|
|
67
|
+
| Server-state helpers | None — consumers wire `onXChange` manually | `useServerTableState` + `MaterialReactServerTable` built-in |
|
|
68
|
+
| Form/CRUD system | None built in | `formConfig`, `MRT_NewEntryModal`, `actions`, `createDeleteAction`/`createEditAction`/`createExportAction` |
|
|
69
|
+
| UI-only state (density, hovered/dragging column, action cell) | Ad hoc `useState` | Modeled as a real TanStack v9 feature/atom (`fns/mrtUiFeature.ts`) |
|
|
70
|
+
| Peer dependencies | MUI v6, React 18 | MUI v7, React 19, plus fork-only peers `@dooherceg/mui-date-range-picker` and `print-js` |
|
|
71
|
+
|
|
72
|
+
See `TABLE_FEATURES_INVENTORY.md` for the complete, feature-by-feature keep/remove decision log this table is derived from, and `TANSTACK_TABLE_V9_MIGRATION_PLAN.md` for the v8→v9 API renames not summarized here.
|
|
73
|
+
|
|
74
|
+
## Technology Stack
|
|
75
|
+
|
|
76
|
+
- **React 19**, **TypeScript 5.7**
|
|
77
|
+
- **TanStack Table v9** (`@tanstack/react-table`, `@tanstack/table-core`) and **TanStack Store** (`@tanstack/store`, `@tanstack/react-store`) for atom-based state
|
|
78
|
+
- **TanStack Virtual** (`@tanstack/react-virtual`) for row/column virtualization
|
|
79
|
+
- **Material UI v7** (`@mui/material`, `@mui/icons-material`, `@mui/x-date-pickers`) + Emotion
|
|
80
|
+
- **React Hook Form** for the create/edit modal
|
|
81
|
+
- **`@iconify/react`** for icon-column glyphs, **`dayjs`** for date handling, **`notistack`** for snackbars, **`print-js`** for row printing, **`lodash`**, **`use-debounce`**
|
|
82
|
+
- Build: **Rollup** (+ `rollup-plugin-dts`, `babel-plugin-react-compiler`) and **tsc**, bundle-size enforced by **size-limit**. The React Compiler's Babel transform runs against the real build output, so the shipped bundles are auto-memoized in production — this is separate from (and stronger than) the audit-only ESLint rule described under [Build and Testing](#build-and-testing)
|
|
83
|
+
- Tooling: **pnpm** workspaces + **Turborepo**, **Vitest** + **React Testing Library** for tests, **Storybook** for component development, **ESLint** (flat config) + **Prettier**, **Husky** + **lint-staged** pre-commit hooks
|
|
84
|
+
|
|
85
|
+
## Requirements
|
|
86
|
+
|
|
87
|
+
- Node.js ≥ 16 (monorepo root) — the library package itself requires Node ≥ 16; CI/local dev is on modern LTS
|
|
88
|
+
- pnpm 9.3.0 (pinned via `packageManager`)
|
|
89
|
+
- React ≥ 19 and React DOM ≥ 19
|
|
90
|
+
- Peer dependencies you must install alongside this package: `@mui/material` ≥ 7, `@mui/icons-material` ≥ 7, `@mui/x-date-pickers` ≥ 8, `@emotion/react`/`@emotion/styled` ≥ 11.13, `@iconify/react` ≥ 6, `react-hook-form` ≥ 7, `print-js` ≥ 1.6, and the fork-specific `@dooherceg/mui-date-range-picker` ≥ 0.2.8
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
130
93
|
|
|
131
|
-
|
|
94
|
+
This package is published as **`@dooherceg/material-react-table`** (currently at version `4.1.1`), but it is **not available on the public npm registry** — the repository (`HercegDoo/material-react-table` / `zmirnes/material-react-table`) is private, and there is no `publish` script or `publishConfig` wired up in this monorepo. There is no verified public install command to give here.
|
|
132
95
|
|
|
133
|
-
|
|
96
|
+
If you are consuming this package from another project in the same organization, confirm with the team how it is actually distributed (private registry, Git dependency, or pnpm workspace reference) before adding it to a project — do not assume an `npm install @dooherceg/material-react-table` will resolve.
|
|
134
97
|
|
|
135
|
-
|
|
98
|
+
To work on the library itself, clone this monorepo and install with pnpm (see [Local Development](#local-development)).
|
|
136
99
|
|
|
137
|
-
|
|
138
|
-
|
|
100
|
+
## Quick Start
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import { useMemo } from 'react';
|
|
139
104
|
import {
|
|
140
105
|
MaterialReactTable,
|
|
141
106
|
useMaterialReactTable,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
107
|
+
type MRT_ColumnDef,
|
|
108
|
+
} from '@dooherceg/material-react-table';
|
|
109
|
+
|
|
110
|
+
type Person = {
|
|
111
|
+
id: string;
|
|
112
|
+
firstName: string;
|
|
113
|
+
lastName: string;
|
|
114
|
+
age: number;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const data: Person[] = [
|
|
118
|
+
{ id: '1', firstName: 'John', lastName: 'Doe', age: 30 },
|
|
119
|
+
{ id: '2', firstName: 'Sara', lastName: 'Connor', age: 25 },
|
|
154
120
|
];
|
|
155
121
|
|
|
156
122
|
export default function App() {
|
|
157
|
-
const columns = useMemo(
|
|
123
|
+
const columns = useMemo<MRT_ColumnDef<Person>[]>(
|
|
158
124
|
() => [
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
muiTableHeadCellProps: { sx: { color: 'green' } }, //optional custom props
|
|
163
|
-
Cell: ({ cell }) => <span>{cell.getValue()}</span>, //optional custom cell render
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
accessorFn: (row) => row.age, //alternate way
|
|
167
|
-
id: 'age', //id required if you use accessorFn instead of accessorKey
|
|
168
|
-
header: 'Age',
|
|
169
|
-
Header: () => <i>Age</i>, //optional custom header render
|
|
170
|
-
},
|
|
125
|
+
{ accessorKey: 'firstName', header: 'First Name', type: 'string' },
|
|
126
|
+
{ accessorKey: 'lastName', header: 'Last Name', type: 'string' },
|
|
127
|
+
{ accessorKey: 'age', header: 'Age', type: 'number' },
|
|
171
128
|
],
|
|
172
129
|
[],
|
|
173
130
|
);
|
|
174
131
|
|
|
175
|
-
//optionally, you can manage any/all of the table state yourself
|
|
176
|
-
const [rowSelection, setRowSelection] = useState({});
|
|
177
|
-
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
//do something when the row selection changes
|
|
180
|
-
}, [rowSelection]);
|
|
181
|
-
|
|
182
132
|
const table = useMaterialReactTable({
|
|
183
133
|
columns,
|
|
184
134
|
data,
|
|
185
|
-
|
|
135
|
+
getRowId: (row) => row.id,
|
|
186
136
|
enableRowSelection: true,
|
|
187
|
-
enablePagination:
|
|
188
|
-
onRowSelectionChange: setRowSelection, //hoist internal state to your own state (optional)
|
|
189
|
-
state: { rowSelection }, //manage your own state, pass it back to the table (optional)
|
|
137
|
+
enablePagination: true,
|
|
190
138
|
});
|
|
191
139
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
140
|
+
return <MaterialReactTable table={table} />;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
196
143
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
144
|
+
Every column requires a `type` — it drives the default cell renderer, the filter operators available for that column in the advanced filters panel, and (if `enableNewEntryButton` is on) the default form input in the create/edit modal.
|
|
145
|
+
|
|
146
|
+
## API Reference
|
|
147
|
+
|
|
148
|
+
The full public surface is re-exported from `src/index.ts`. The most important parts:
|
|
149
|
+
|
|
150
|
+
### Hooks
|
|
151
|
+
- `useMaterialReactTable(tableOptions)` — builds the table instance; just `useMRT_TableInstance(useMRT_TableOptions(tableOptions))`.
|
|
152
|
+
- `useMRT_TableInstance` / `useMRT_TableOptions` — the two halves of the above, exported separately for advanced use.
|
|
153
|
+
- `useServerTableState({ initialState, saveState, saveDebounceMs })` — owns all server-relevant table state; returns `{ tableState, handlers, fetchTrigger, refetch }` to spread into `state`, the `onXChange` props, and your data-fetching `useEffect`.
|
|
154
|
+
- `useMRT_RowVirtualizer` / `useMRT_ColumnVirtualizer` — underlying virtualization hooks.
|
|
155
|
+
- `useMRT_Rows` — row-model accessor hook.
|
|
156
|
+
|
|
157
|
+
### Components
|
|
158
|
+
- `<MaterialReactTable table={table} />` — the main table, given an instance from `useMaterialReactTable`.
|
|
159
|
+
- `<MaterialReactServerTable loadConfig={...} ... />` — a self-contained server-driven table: calls an async `loadConfig()` for columns/initial state/exports, then renders `MaterialReactServerTableSkeleton` while loading or `MaterialReactServerTableError` on failure.
|
|
160
|
+
- `<MRT_AdvancedFilters />`, `<MRT_NewEntryModal />` and its sub-parts (`MRT_NewEntryForm*`) — can be used standalone if you build a custom table shell.
|
|
161
|
+
- Individual sub-components (`MRT_Table`, `MRT_TopToolbar`, `MRT_BottomToolbar`, `MRT_TableBody`, `MRT_TableHead`, button/menu components, etc.) are all exported for building a custom layout — see `src/index.ts` for the complete list.
|
|
162
|
+
|
|
163
|
+
### Key table options (`MRT_TableOptions<TData>`, see `src/types.ts`)
|
|
164
|
+
- **Data/columns:** `columns`, `data`, `defaultColumn`, `defaultDisplayColumn`, `getRowId`, `iconsList`
|
|
165
|
+
- **Filtering:** `enableAdvancedFilters`, `manualFiltering`, `initialSavedFilters`, `onSaveFilters`, `onDeleteSavedFilter`, `onFiltersChange`
|
|
166
|
+
- **Selection/expansion/pinning:** `enableRowSelection`, `enableBatchRowSelection`, `enableSelectAll`, `selectAllMode`, `getAllSelectableRowIds`, `enableExpandAll`, `maxDepth`, `enableRowReordering`, `onTreeRowReorder`, `rowPinningDisplayMode`
|
|
167
|
+
- **Editing/CRUD:** `enableEditing`, `enableNewEntryButton`, `formConfig`, `actions`, `deleteRowsFn`, `editRowFn`, `onNewEntryModalChange`
|
|
168
|
+
- **Export:** `availableExports`, `loadExport`, `onActiveExportsChange`, `getTotalRows`
|
|
169
|
+
- **Loading UX:** `skeletonMode`, `positionProgressBars`, state flags `isLoading` / `showSkeletons` / `showProgressBars` / `isSaving`
|
|
170
|
+
- **Layout/virtualization:** `layoutMode`, `enableRowVirtualization`, `enableColumnVirtualization`, `rowVirtualizerOptions`, `columnVirtualizerOptions`
|
|
171
|
+
- **Theming/i18n:** `mrtTheme`, `icons`, `localization`, `memoMode`
|
|
172
|
+
- **State:** `state` / `initialState` (`MRT_TableState<TData>`), `enableResetState`, `resetState`
|
|
173
|
+
- Every `mui*Props` option (e.g. `muiTableBodyRowProps`, `muiPaginationProps`, `muiNewEntryModalProps`) accepts either a static props object or a function of `{ table }` (and sometimes `{ row }`/`{ column }`/`{ cell }`) returning one — this passthrough pattern is unchanged from upstream.
|
|
174
|
+
|
|
175
|
+
### Column type system
|
|
176
|
+
`type: 'string' | 'number' | 'date' | 'dateTime' | 'enum' | 'icon' | 'dimension' | 'boolean' | 'actions' | 'object'` is required on every `MRT_ColumnDef`. Each type (except `object`/`actions`) has a `ColumnTypeResolver` in `src/column-types/registy.ts` supplying `createColumnDef`, `getFilterOperators`, `activeFilterRenderer`, and optionally `getFormFieldRenderer`.
|
|
177
|
+
|
|
178
|
+
### Row CRUD helpers
|
|
179
|
+
`table.addRow`, `table.updateRow`, `table.upsertRow`, `table.removeRow`, `table.setRows` are always available on the table instance (`fns/tableCrudFns.ts`), independent of any editing UI. **`updateRow` and `upsertRow` merge the given partial row (matched by `id`) into the existing row rather than replacing it wholesale** — pass only the fields that changed, not a full replacement object.
|
|
180
|
+
|
|
181
|
+
## Usage Examples
|
|
182
|
+
|
|
183
|
+
### Advanced filters + saved presets
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
const table = useMaterialReactTable({
|
|
187
|
+
columns,
|
|
188
|
+
data,
|
|
189
|
+
enableAdvancedFilters: true,
|
|
190
|
+
initialState: {
|
|
191
|
+
filters: { logicOperator: 'and', rules: [], pinnedFilters: [] },
|
|
192
|
+
},
|
|
193
|
+
onSaveFilters: async (savedFilter) => {
|
|
194
|
+
await api.saveFilterPreset(savedFilter);
|
|
195
|
+
},
|
|
196
|
+
onDeleteSavedFilter: async (name) => {
|
|
197
|
+
await api.deleteFilterPreset(name);
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Create/edit modal with a custom action
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { createEditAction, createDeleteAction } from '@dooherceg/material-react-table';
|
|
206
|
+
|
|
207
|
+
const table = useMaterialReactTable({
|
|
208
|
+
columns,
|
|
209
|
+
data,
|
|
210
|
+
enableNewEntryButton: true,
|
|
211
|
+
formConfig: {
|
|
212
|
+
sections: [{ id: 'main', title: 'Details' }],
|
|
213
|
+
},
|
|
214
|
+
actions: [
|
|
215
|
+
createEditAction(),
|
|
216
|
+
createDeleteAction({
|
|
217
|
+
deleteConfirmation: { title: 'Delete row?' },
|
|
218
|
+
onDelete: async ({ rowsToDelete, defaultOnDelete }) => {
|
|
219
|
+
await api.delete(rowsToDelete.map((r) => r.original.id));
|
|
220
|
+
defaultOnDelete();
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
],
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Server-driven table
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import { useEffect } from 'react';
|
|
231
|
+
import { useMaterialReactTable, MaterialReactTable, useServerTableState } from '@dooherceg/material-react-table';
|
|
232
|
+
|
|
233
|
+
function ServerTable() {
|
|
234
|
+
const { tableState, handlers, fetchTrigger, refetch } = useServerTableState<Person>({
|
|
235
|
+
initialState: { pagination: { pageIndex: 0, pageSize: 25 } },
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
fetchPeople(fetchTrigger).then((res) => {
|
|
240
|
+
/* set rows + rowCount into your own data state */
|
|
241
|
+
});
|
|
242
|
+
}, [fetchTrigger]);
|
|
243
|
+
|
|
244
|
+
const table = useMaterialReactTable({
|
|
245
|
+
columns,
|
|
246
|
+
data: rows,
|
|
247
|
+
manualFiltering: true,
|
|
248
|
+
manualPagination: true,
|
|
249
|
+
manualSorting: true,
|
|
250
|
+
state: tableState,
|
|
251
|
+
...handlers,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
return <MaterialReactTable table={table} />;
|
|
200
255
|
}
|
|
201
256
|
```
|
|
202
257
|
|
|
203
|
-
|
|
258
|
+
Or let `MaterialReactServerTable` own the fetch-on-mount config loading entirely:
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
<MaterialReactServerTable<Person>
|
|
262
|
+
loadConfig={async () => ({
|
|
263
|
+
columns,
|
|
264
|
+
initialState: { pagination: { pageIndex: 0, pageSize: 25 } },
|
|
265
|
+
})}
|
|
266
|
+
saveState={(state) => api.saveTableState(state)}
|
|
267
|
+
/>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Styling and Theming
|
|
271
|
+
|
|
272
|
+
- `mrtTheme` accepts either a static `Partial<MRT_Theme>` or a function of the ambient MUI `Theme`, for MRT-specific colors (e.g. pinned/selected row backgrounds).
|
|
273
|
+
- Every internal MUI subcomponent is overridable via its corresponding `mui*Props` table or column option (static object or `({ table, ... }) => props` function) — this is the same passthrough pattern as upstream MRT.
|
|
274
|
+
- `layoutMode: 'grid' | 'grid-no-grow' | 'semantic'` switches between CSS grid/flexbox sizing and default semantic HTML table layout; per-column `grow` controls flex-grow in grid modes.
|
|
275
|
+
- `theme/overrides/components/*` supplies MUI component-level overrides (Table, Switch, Select, etc.); `theme/options` merges user theme options.
|
|
276
|
+
- Column widths use a CSS-variable-based sizing scheme (`utils/style.utils.ts`) rather than inline widths per cell.
|
|
277
|
+
|
|
278
|
+
## Localization
|
|
279
|
+
|
|
280
|
+
Pass a locale object imported from `material-react-table/locales/*` (or a custom `Partial<MRT_Localization>`) via the `localization` table option. Built-in locales: **English (`en`)**, **German (`de`)**, **French (`fr`)**, **Croatian (`hr`)**, **Dutch (`nl`)**. Locale files are built separately from the main bundle via `build-locales.mjs` (`pnpm lib:build-locales`). Note that `MaterialReactServerTable` falls back to the Croatian locale (`MRT_Localization_HR`) by default when no `localization` prop is supplied, not English.
|
|
281
|
+
|
|
282
|
+
## Project Structure
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
packages/material-react-table/
|
|
286
|
+
├── src/
|
|
287
|
+
│ ├── types.ts # All MRT_* public types (column defs, table options, state, instance)
|
|
288
|
+
│ ├── tableFeatures.ts # TanStack v9 feature registration (MRT_tableFeatures)
|
|
289
|
+
│ ├── tanstack-table.ts # TanStack module augmentation (ColumnMeta, etc.)
|
|
290
|
+
│ ├── icons.ts # Default icon set (@mui/icons-material)
|
|
291
|
+
│ ├── hooks/ # useMaterialReactTable, useMRT_TableInstance/Options,
|
|
292
|
+
│ │ # useServerTableState, virtualizer hooks, display-column factories
|
|
293
|
+
│ ├── fns/ # Pure TanStack-shaped fns: mrtUiFeature, aggregationFns,
|
|
294
|
+
│ │ # sortingFns, tableCrudFns, treeRowReorderingFns
|
|
295
|
+
│ ├── components/ # table/, body/, head/, footer/, toolbar/, buttons/, menus/,
|
|
296
|
+
│ │ # modals/ (new-entry form), rhf-form/, advanced-filters/,
|
|
297
|
+
│ │ # inputs/, actions/, effects/, iconify/
|
|
298
|
+
│ ├── column-types/ # Per-type column behavior + registry; activeFiltersRenderers/
|
|
299
|
+
│ │ # filterEditors used by advanced filters
|
|
300
|
+
│ ├── types/actions/ # Action<TData> system types
|
|
301
|
+
│ ├── utils/ # column/displayColumn/row/style utils, utils/actions
|
|
302
|
+
│ │ # (createDeleteAction/createEditAction/createExportAction)
|
|
303
|
+
│ ├── theme/ # MUI theme option/override merging
|
|
304
|
+
│ ├── locales/ # en, de, fr, hr, nl
|
|
305
|
+
│ └── tests/ # Vitest suites mirroring the source tree, plus integration_tests
|
|
306
|
+
├── stories/ # Storybook examples (features/, styling/, fixed-bugs/)
|
|
307
|
+
├── dist/ # Build output (index.js, index.esm.js, index.d.ts) — not committed
|
|
308
|
+
└── locales/ # Built locale output (separate from src/locales)
|
|
309
|
+
|
|
310
|
+
apps/material-react-table-docs/ # Inherited Next.js docs site — not kept in sync with this fork
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Local Development
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
pnpm i # install, from the repo root
|
|
317
|
+
pnpm storybook # Storybook on :6006 — primary way to develop/test UI changes
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Husky + lint-staged run on commit: `eslint --fix` + prettier on staged `src/**/*.{ts,tsx}`, `vitest run` on staged test files, prettier on staged `*.md`. Don't bypass with `--no-verify`.
|
|
321
|
+
|
|
322
|
+
## Available Scripts
|
|
323
|
+
|
|
324
|
+
From the monorepo root (`package.json`):
|
|
325
|
+
|
|
326
|
+
| Script | Description |
|
|
327
|
+
|---|---|
|
|
328
|
+
| `pnpm build` | `turbo run build --parallel` across all workspaces |
|
|
329
|
+
| `pnpm dev` | `turbo run dev --parallel` |
|
|
330
|
+
| `pnpm lib:build` | Copies the root `README.md` into the package, then runs the library build |
|
|
331
|
+
| `pnpm lib:build-locales` / `pnpm lib:build-lib` | Locale build / library build in isolation |
|
|
332
|
+
| `pnpm typecheck` | `tsc --noEmit` for the `material-react-table` package |
|
|
333
|
+
| `pnpm lint` | `turbo run lint` |
|
|
334
|
+
| `pnpm format` | `prettier --write` across js/ts/tsx/md |
|
|
335
|
+
| `pnpm storybook` | Storybook dev server |
|
|
336
|
+
| `pnpm docs:dev` / `pnpm docs:build` / `pnpm docs:start` | Inherited docs site tasks |
|
|
337
|
+
|
|
338
|
+
From `packages/material-react-table/package.json` (also runnable via `pnpm --filter=material-react-table <script>` from the root):
|
|
339
|
+
|
|
340
|
+
| Script | Description |
|
|
341
|
+
|---|---|
|
|
342
|
+
| `pnpm test` / `pnpm test:run` / `pnpm test:watch` / `pnpm test:ui` | Vitest, in various modes |
|
|
343
|
+
| `pnpm test:coverage` | Vitest with coverage |
|
|
344
|
+
| `pnpm lint` | `eslint . --config eslint.config.mjs` |
|
|
345
|
+
| `pnpm typecheck` | `tsc --noEmit -p tsconfig.json` |
|
|
346
|
+
| `pnpm size` | `size-limit` bundle-size check |
|
|
347
|
+
| `pnpm storybook` / `pnpm storybook:build` | Storybook dev / static build |
|
|
348
|
+
|
|
349
|
+
## Build and Testing
|
|
350
|
+
|
|
351
|
+
- **Build:** `tsc` emits types (`tsconfig.build.json`) and Rollup (`rollup.config.mjs`) produces `dist/index.js` (CJS) and `dist/index.esm.js` (ESM), each checked against a `size-limit` budget (190 kB / 150 kB minzipped respectively). Rollup's Babel step also applies `babel-plugin-react-compiler` to that output, so the shipped bundles are already Compiler-memoized — don't confuse this with the lint rule below, which only audits source and never touches the build.
|
|
352
|
+
- **Tests:** Vitest + jsdom + React Testing Library (`vite.config.ts`, setup in `src/tests/setup.ts`). Row virtualization is on by default and needs real layout measurements; the test setup stubs `ResizeObserver` and `getBoundingClientRect` so virtualized rows render under jsdom — if a new test can't find row content, check whether it needs the same sizing stub rather than disabling virtualization.
|
|
353
|
+
- **Linting:** flat ESLint config enforces no `any`, inline type-only imports, a fixed import-group order, MUI submodule imports (warning), and treats the React Compiler plugin as audit-only (`warn`, not yet build-blocking).
|
|
354
|
+
|
|
355
|
+
## Publishing
|
|
356
|
+
|
|
357
|
+
No publish automation exists in this repository: there is no `publish` script, no `publishConfig`, and no CI workflow found that pushes this package to any registry. `pnpm lib:build` produces a publishable `dist/` and copies this README in, but shipping it anywhere is a manual, undocumented step today.
|
|
358
|
+
|
|
359
|
+
## Migration from Original Material React Table
|
|
360
|
+
|
|
361
|
+
If you have existing code written against upstream `material-react-table` v3, expect to touch at least:
|
|
362
|
+
|
|
363
|
+
1. **Filtering** — `columnFilters`, `enableColumnFilters`, `enableGlobalFilter`, `filterFn`/`filterVariant` (column-level), and all `MRT_FilterOptionMenu`-driven features are gone. Rebuild filtering on `state.filters` / `enableAdvancedFilters`.
|
|
364
|
+
2. **Editing** — `editDisplayMode` other than `'modal'`, and `createDisplayMode` other than `'modal'`, no longer exist. Rebuild CRUD UI around `enableNewEntryButton`, `formConfig`, and the `actions` system.
|
|
365
|
+
3. **Column defs** — add a `type` field to every column; it is required, not optional.
|
|
366
|
+
4. **Pinning** — rename any `left`/`right` pinning references to `start`/`end`.
|
|
367
|
+
5. **Row reordering** — replace drag-and-drop row reordering with `enableRowReordering` + `onTreeRowReorder` (selection-based).
|
|
368
|
+
6. **Removed options with no replacement** — `enableClickToCopy`, `enableKeyboardShortcuts`, `enableFacetedValues`, `enableFilterMatchHighlighting`, the full-screen toggle, any `fuzzy` filter/sort usage.
|
|
369
|
+
7. **Peer dependencies** — bump to MUI v7 and React 19, and add `@dooherceg/mui-date-range-picker` and `print-js`.
|
|
370
|
+
8. **CRUD helper semantics** — `updateRow`/`upsertRow` used to behave like a replace; they now merge the given partial row into the existing one by `id`. Code that passed a full object expecting old fields to be dropped will instead see them preserved.
|
|
371
|
+
|
|
372
|
+
There is no automated codemod for this migration; consult `TABLE_FEATURES_INVENTORY.md` and `TANSTACK_TABLE_V9_MIGRATION_PLAN.md` for the exhaustive feature-by-feature and API-rename details.
|
|
373
|
+
|
|
374
|
+
## Known Limitations
|
|
204
375
|
|
|
205
|
-
|
|
376
|
+
- The migration to TanStack Table v9 is **in progress**, not complete — treat anything not explicitly covered above as unverified.
|
|
377
|
+
- `apps/material-react-table-docs` (the Next.js docs site) still documents removed options (e.g. column filtering) in its `.mdx` guides and prop tables. It is not type-checked against `src/` and does not block the package build, but it should not be used as a source of truth for this fork.
|
|
378
|
+
- There is no verified, working `npm install` command for consumers outside this monorepo (see [Installation](#installation)).
|
|
379
|
+
- No publish pipeline exists; getting a build of this package into another project is currently a manual process.
|
|
206
380
|
|
|
207
|
-
|
|
208
|
-
<img src="https://contrib.rocks/image?repo=kevinvandy/material-react-table" />
|
|
209
|
-
</a>
|
|
381
|
+
## Contributing
|
|
210
382
|
|
|
211
|
-
|
|
383
|
+
- Keep PRs small (max ~10 changed files; 12 in justified cases) and scoped to one task.
|
|
384
|
+
- No magic strings/numbers/URLs inline — extract to named constants.
|
|
385
|
+
- Don't add `useMemo`/`useCallback` without a concrete, stated reason.
|
|
386
|
+
- Extract data fetching into hooks/services, never inline `fetch`/`axios` calls in components.
|
|
387
|
+
- Before touching table-options wiring, feature registration, or anything resembling a removed v8 feature, check `TABLE_FEATURES_INVENTORY.md` first.
|
|
388
|
+
- Run `pnpm storybook` for local UI development; see [Local Development](#local-development) above for the full workflow inherited from upstream (`pnpm docs:dev` for the docs site, etc.).
|
|
212
389
|
|
|
213
|
-
|
|
390
|
+
## License
|
|
214
391
|
|
|
215
|
-
|
|
392
|
+
MIT, © 2022 Kevin Vandy — see [`LICENSE`](./LICENSE). The original upstream copyright notice has been preserved unmodified; this fork has not added a separate copyright line.
|
package/dist/index.d.ts
CHANGED
|
@@ -1323,6 +1323,7 @@ interface MRT_TableConfig<TData extends MRT_RowData> {
|
|
|
1323
1323
|
columns: MRT_ColumnDef<TData, unknown>[];
|
|
1324
1324
|
initialState?: Partial<MRT_TableState<TData>>;
|
|
1325
1325
|
availableExports?: Record<string, MRT_ExportDefinition>;
|
|
1326
|
+
rowsPerPageOptions?: number[] | undefined;
|
|
1326
1327
|
formConfig?: MRT_FormConfig<TData>;
|
|
1327
1328
|
}
|
|
1328
1329
|
interface MRT_TableData<TData extends MRT_RowData> {
|
|
@@ -1578,6 +1579,13 @@ declare const getDefaultColumnPinningState: <TData extends MRT_RowData>(tableOpt
|
|
|
1578
1579
|
start: string[];
|
|
1579
1580
|
end: string[];
|
|
1580
1581
|
};
|
|
1582
|
+
/**
|
|
1583
|
+
* Forces mrt-row-expand to a fixed slot in columnOrder: right after the
|
|
1584
|
+
* checkbox column when row selection is enabled, otherwise the very first
|
|
1585
|
+
* column. Not configurable — mirrors how getDefaultColumnPinningState
|
|
1586
|
+
* forces the checkbox column itself to the front of columnPinning.start.
|
|
1587
|
+
*/
|
|
1588
|
+
declare const normalizeRowExpandColumnOrder: <TData extends MRT_RowData>(tableOptions: MRT_StatefulTableOptions<TData>, columnOrder: string[]) => string[];
|
|
1581
1589
|
declare const getDefaultColumnOrderIds: <TData extends MRT_RowData>(tableOptions: MRT_StatefulTableOptions<TData>, reset?: boolean) => string[];
|
|
1582
1590
|
|
|
1583
1591
|
declare const getMRT_Rows: <TData extends MRT_RowData>(table: MRT_TableInstance<TData>, all?: boolean) => MRT_Row<TData>[];
|
|
@@ -2089,4 +2097,4 @@ interface MRT_TopToolbarProps<TData extends MRT_RowData> {
|
|
|
2089
2097
|
}
|
|
2090
2098
|
declare const MRT_TopToolbar: <TData extends MRT_RowData>({ table, }: MRT_TopToolbarProps<TData>) => react.JSX.Element;
|
|
2091
2099
|
|
|
2092
|
-
export { type Action, type ActionRowRenderContext, type ActionToolbarRenderContext, CHECKBOX_DISPLAY_COLUMN_ID, type ColumnType, type ColumnTypeResolver, type CreateDeleteActionOptions, type CreateEditActionOptions, type CreateExportActionOptions, type CustomOnDeleteActionContext, type CustomOnEditActionContext, type CustomOnExportActionContext, type DeleteActionRowRenderContext, type DeleteActionToolbarRenderContext, type DeleteConfirmationConfig, type DistributiveOmit, type DropdownOption, type ExportActionRowRenderContext, type ExportActionToolbarRenderContext, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_ActiveExportsState, MRT_AdvancedFilters, type MRT_AdvancedFiltersProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnResizingState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, type MRT_ExportDefinition, type MRT_ExportFileResponse, type MRT_ExportParams, MRT_ExportsToolbar, type MRT_ExportsToolbarProps, type MRT_FilterOperator, type MRT_FilterOperatorDefinition, type MRT_FilterOperatorEditComponentProps, type MRT_FilterOperatorValueShape, type MRT_FilterRule, type MRT_FiltersLogicOperator, type MRT_FiltersState, type MRT_FormActionButtonRenderProps, type MRT_FormAdditionalField, type MRT_FormAdditionalFieldRenderProps, type MRT_FormCallbackProps, type MRT_FormConfig, type MRT_FormCustomAction, type MRT_FormFieldConfig, type MRT_FormFieldEntry, type MRT_FormFieldRenderProps, type MRT_FormRenderEntry, type MRT_FormSectionConfig, type MRT_GetRowId, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_IconColumnDef, type MRT_Icons, type MRT_IconsListEntry, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_ModalPosition, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, type MRT_NewEntryFormActionsContextValue, type MRT_NewEntryFormActionsProps, type MRT_NewEntryFormProps, MRT_NewEntryFormProvider, type MRT_NewEntryFormProviderProps, MRT_NewEntryModal, type MRT_NewEntryModalOverrides, type MRT_NewEntryModalProps, type MRT_NewEntryModalState, type MRT_NonIconColumnDef, MRT_PaginationBoundsEffect, type MRT_PaginationBoundsEffectProps, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowManipulationInput, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowReorderingSelectionState, type MRT_RowSelectionState, type MRT_RowVirtualizer, type MRT_SavedFilter, type MRT_SavedFilters, MRT_SelectAllMenu, type MRT_SelectAllMenuProps, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_SelectionCountBadge, type MRT_SelectionCountBadgeProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, type MRT_TableConfig, MRT_TableContainer, type MRT_TableContainerProps, type MRT_TableData, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_TreeRowReorderEvent, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactServerTable, type MaterialReactServerTableProps, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type OnDeleteActionContext, type OnEditActionContext, type OnExportActionContext, type Prettify, RHF_FormProvider, type RHF_FormProviderProps, type UseServerTableStateOptions, type UseServerTableStateReturn, type Xor, buildDefaultValues, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getColumnId, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, prepareColumns, reorderColumn, resolveFormFields, showRowActionsColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, toAdditionalRenderEntries, toColumnRenderEntries, useMRT_ColumnVirtualizer, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
|
2100
|
+
export { type Action, type ActionRowRenderContext, type ActionToolbarRenderContext, CHECKBOX_DISPLAY_COLUMN_ID, type ColumnType, type ColumnTypeResolver, type CreateDeleteActionOptions, type CreateEditActionOptions, type CreateExportActionOptions, type CustomOnDeleteActionContext, type CustomOnEditActionContext, type CustomOnExportActionContext, type DeleteActionRowRenderContext, type DeleteActionToolbarRenderContext, type DeleteConfirmationConfig, type DistributiveOmit, type DropdownOption, type ExportActionRowRenderContext, type ExportActionToolbarRenderContext, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_ActiveExportsState, MRT_AdvancedFilters, type MRT_AdvancedFiltersProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnResizingState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, type MRT_ExportDefinition, type MRT_ExportFileResponse, type MRT_ExportParams, MRT_ExportsToolbar, type MRT_ExportsToolbarProps, type MRT_FilterOperator, type MRT_FilterOperatorDefinition, type MRT_FilterOperatorEditComponentProps, type MRT_FilterOperatorValueShape, type MRT_FilterRule, type MRT_FiltersLogicOperator, type MRT_FiltersState, type MRT_FormActionButtonRenderProps, type MRT_FormAdditionalField, type MRT_FormAdditionalFieldRenderProps, type MRT_FormCallbackProps, type MRT_FormConfig, type MRT_FormCustomAction, type MRT_FormFieldConfig, type MRT_FormFieldEntry, type MRT_FormFieldRenderProps, type MRT_FormRenderEntry, type MRT_FormSectionConfig, type MRT_GetRowId, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_IconColumnDef, type MRT_Icons, type MRT_IconsListEntry, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_ModalPosition, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, type MRT_NewEntryFormActionsContextValue, type MRT_NewEntryFormActionsProps, type MRT_NewEntryFormProps, MRT_NewEntryFormProvider, type MRT_NewEntryFormProviderProps, MRT_NewEntryModal, type MRT_NewEntryModalOverrides, type MRT_NewEntryModalProps, type MRT_NewEntryModalState, type MRT_NonIconColumnDef, MRT_PaginationBoundsEffect, type MRT_PaginationBoundsEffectProps, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowManipulationInput, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowReorderingSelectionState, type MRT_RowSelectionState, type MRT_RowVirtualizer, type MRT_SavedFilter, type MRT_SavedFilters, MRT_SelectAllMenu, type MRT_SelectAllMenuProps, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_SelectionCountBadge, type MRT_SelectionCountBadgeProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, type MRT_TableConfig, MRT_TableContainer, type MRT_TableContainerProps, type MRT_TableData, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_TreeRowReorderEvent, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactServerTable, type MaterialReactServerTableProps, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type OnDeleteActionContext, type OnEditActionContext, type OnExportActionContext, type Prettify, RHF_FormProvider, type RHF_FormProviderProps, type UseServerTableStateOptions, type UseServerTableStateReturn, type Xor, buildDefaultValues, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getColumnId, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, normalizeRowExpandColumnOrder, prepareColumns, reorderColumn, resolveFormFields, showRowActionsColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, toAdditionalRenderEntries, toColumnRenderEntries, useMRT_ColumnVirtualizer, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|