@lminii/material-react-table 4.0.0 → 4.0.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.
@@ -1,161 +1,161 @@
1
- ---
2
- name: migrate-v3-to-v4
3
- description: >
4
- Migrate an application from material-react-table V3 to @lminii/material-react-table V4: switch the package and imports, upgrade Material UI and X Date Pickers to V9, move text field props to slotProps, and apply every TanStack Table V9 rename and behaviour change (column pinning start/end, columnResizing, sortFn, getPaginatedRowModel, rowSelection true values, removed getCoreRowModel options and onStateChange). Load for migration plans, implementation, or audits of a V3 codebase.
5
- metadata:
6
- type: lifecycle
7
- library: '@lminii/material-react-table'
8
- library_version: '4.0.0'
9
- framework: react
10
- requires:
11
- - getting-started
12
- sources:
13
- - 'lminii/material-react-table:MIGRATION.md'
14
- - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/migrating-to-v4.mdx'
15
- - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
16
- - 'lminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
- ---
18
-
19
- This skill builds on `getting-started`. V4 keeps the V3 API: `useMaterialReactTable`, the `table` prop, every `mui*Props`, `render*`, and `enable*` option. Breaking changes come from three sources only: the package rename, Material UI V9, and TanStack Table V9. Do them in that order.
20
-
21
- ## Setup
22
-
23
- ```bash
24
- npx @mui/codemod@latest v9.0.0/system-props src
25
- npx @mui/codemod@latest deprecations/all src
26
- npm uninstall material-react-table
27
- npm install @lminii/material-react-table @mui/material@^9 @mui/icons-material@^9 @mui/x-date-pickers@^9
28
- ```
29
-
30
- Then rewrite imports:
31
-
32
- ```diff
33
- -import { MaterialReactTable } from 'material-react-table';
34
- -import { MRT_Localization_DE } from 'material-react-table/locales/de';
35
- +import { MaterialReactTable } from '@lminii/material-react-table';
36
- +import { MRT_Localization_DE } from '@lminii/material-react-table/locales/de';
37
- ```
38
-
39
- Peer floors are `@mui/material`, `@mui/icons-material`, and `@mui/x-date-pickers` at 9.0 or newer; React 18 and Emotion 11.13 are unchanged. Node 22.12 or newer is required for the CommonJS build.
40
-
41
- ## Core Patterns
42
-
43
- ### Renames from TanStack Table V9
44
-
45
- Each of these is a find and replace across the codebase:
46
-
47
- | V3 | V4 |
48
- | --- | --- |
49
- | `columnPinning: { left, right }` | `columnPinning: { start, end }` |
50
- | `column.pin('left')`, `getIsPinned() === 'left'` | `column.pin('start')`, `getIsPinned() === 'start'` |
51
- | `table.getLeftLeafColumns()`, `getRight*`, `row.getLeftVisibleCells()` | `getStartLeafColumns()`, `getEnd*`, `row.getStartVisibleCells()` |
52
- | `columnSizingInfo`, `onColumnSizingInfoChange`, `setColumnSizingInfo` | `columnResizing`, `onColumnResizingChange`, `setColumnResizing` |
53
- | `sortingFn`, `sortingFns`, `column.getSortingFn()` | `sortFn`, `sortFns`, `column.getSortFn()` |
54
- | `table.getPrePaginationRowModel()`, `getPaginationRowModel()` | `getPrePaginatedRowModel()`, `getPaginatedRowModel()` |
55
- | `column.getAggregationFn()` | `column.getAggregationFns()` |
56
- | `MRT_SortingFn`, `MRT_ColumnSizingInfoState` | `MRT_SortFn`, `MRT_ColumnResizingState` (old names remain as deprecated aliases) |
57
-
58
- ### Behaviour changes to audit
59
-
60
- - `rowSelection` values are `true`, never `false`. Deselect by deleting the key.
61
- - `rowPinning` needs both `top` and `bottom`; `columnPinning` needs both `start` and `end` when passed through `initialState` or `state`.
62
- - `table.getIsSomeRowsSelected()` is `true` when all rows are selected. Indeterminate is `getIsSomeRowsSelected() && !getIsAllRowsSelected()`.
63
- - A custom `aggregationFn` is `{ aggregate: (context) => value }`, not a callable. Built-in names still work.
64
- - `getCoreRowModel`, `getFilteredRowModel`, `getSortedRowModel`, `getPaginationRowModel`, `getExpandedRowModel`, `getGroupedRowModel`, and `getFaceted*` options are gone; the models are always registered. Use `manual*` to take over a stage.
65
- - Rows with `renderDetailPanel` report `row.getCanExpand()` as `true`. Pass `getRowCanExpand` to restrict it.
66
- - `onStateChange` and `table.setState()` are gone. Control slices individually.
67
- - `table.getState()` still returns the full state; `table.state` is reactive in render code.
68
- - Pinned cells use `insetInlineStart` and `insetInlineEnd`, so RTL pins to the logical start and end.
69
-
70
- ### Material UI V9 changes inside MRT options
71
-
72
- ```diff
73
- muiFilterTextFieldProps: {
74
- - InputProps: { sx: { minWidth: 120 } },
75
- + slotProps: { input: { sx: { minWidth: 120 } } },
76
- },
77
- -const pickerProps: DatePickerProps<Dayjs> = { ... };
78
- +const pickerProps: DatePickerProps = { ... };
79
- ```
80
-
81
- `muiFilterDatePickerProps`, `muiFilterDateTimePickerProps`, and `muiFilterTimePickerProps` are no longer generic, and the filter pickers render `PickersTextField`, so a custom `slots.textField` must accept `PickersTextFieldProps`. Everything else in `mui*Props` passes straight to Material UI, so Material UI's own V7 and V9 notes apply.
82
-
83
- ### Package entry points
84
-
85
- The package ships an `exports` map with `.mjs` and `.js` builds. Only `@lminii/material-react-table`, `@lminii/material-react-table/locales/<code>`, and `@lminii/material-react-table/package.json` resolve; deep imports into `dist/` or `src/` fail at build time and must be replaced with root exports.
86
-
87
- ## Common Mistakes
88
-
89
- ### HIGH Keeping v8 pinning literals
90
-
91
- Wrong:
92
-
93
- ```tsx
94
- initialState: { columnPinning: { left: ['mrt-row-select'], right: ['mrt-row-actions'] } }
95
- ```
96
-
97
- Correct:
98
-
99
- ```tsx
100
- initialState: { columnPinning: { start: ['mrt-row-select'], end: ['mrt-row-actions'] } }
101
- ```
102
-
103
- `left` and `right` are no longer valid keys, so the pinning state is silently empty.
104
-
105
- Source: `MIGRATION.md`
106
-
107
- ### HIGH Passing row model factories
108
-
109
- Wrong:
110
-
111
- ```tsx
112
- useMaterialReactTable({ columns, data, getSortedRowModel: getSortedRowModel() })
113
- ```
114
-
115
- Correct:
116
-
117
- ```tsx
118
- useMaterialReactTable({ columns, data })
119
- ```
120
-
121
- The options no longer exist in `MRT_TableOptions`; MRT registers every row model itself.
122
-
123
- Source: `packages/material-react-table/src/features/mrtFeatures.ts`
124
-
125
- ### MEDIUM Treating the migration as a TanStack useTable rewrite
126
-
127
- Wrong:
128
-
129
- ```tsx
130
- const table = useTable({ features: tableFeatures({ rowSortingFeature }), columns, data })
131
- ```
132
-
133
- Correct:
134
-
135
- ```tsx
136
- const table = useMaterialReactTable({ columns, data })
137
- ```
138
-
139
- The `@tanstack/react-table#migrate-v8-to-v9` skill describes migrating a headless table. MRT applications stay on `useMaterialReactTable`; only the renamed instance methods and state shapes from that skill apply.
140
-
141
- Source: `MIGRATION.md`
142
-
143
- ### LOW Deep-importing a locale file
144
-
145
- Wrong:
146
-
147
- ```tsx
148
- import { MRT_Localization_FR } from '@lminii/material-react-table/dist/locales/fr'
149
- ```
150
-
151
- Correct:
152
-
153
- ```tsx
154
- import { MRT_Localization_FR } from '@lminii/material-react-table/locales/fr'
155
- ```
156
-
157
- Source: `packages/material-react-table/package.json` exports map
158
-
159
- ## API Discovery
160
-
161
- Compare `node_modules/@lminii/material-react-table/dist/index.d.ts` against the V3 declarations for renamed members; the deprecated `MRT_SortingFn` and `MRT_ColumnSizingInfoState` aliases carry JSDoc pointing to the new names. The full guide with tables is at `/docs/getting-started/migrating-to-v4`.
1
+ ---
2
+ name: migrate-v3-to-v4
3
+ description: >
4
+ Migrate an application from material-react-table V3 to @lminii/material-react-table V4: switch the package and imports, upgrade Material UI and X Date Pickers to V9, move text field props to slotProps, and apply every TanStack Table V9 rename and behaviour change (column pinning start/end, columnResizing, sortFn, getPaginatedRowModel, rowSelection true values, removed getCoreRowModel options and onStateChange). Load for migration plans, implementation, or audits of a V3 codebase.
5
+ metadata:
6
+ type: lifecycle
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ sources:
13
+ - 'lminii/material-react-table:MIGRATION.md'
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/migrating-to-v4.mdx'
15
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
16
+ - 'lminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
+ ---
18
+
19
+ This skill builds on `getting-started`. V4 keeps the V3 API: `useMaterialReactTable`, the `table` prop, every `mui*Props`, `render*`, and `enable*` option. Breaking changes come from three sources only: the package rename, Material UI V9, and TanStack Table V9. Do them in that order.
20
+
21
+ ## Setup
22
+
23
+ ```bash
24
+ npx @mui/codemod@latest v9.0.0/system-props src
25
+ npx @mui/codemod@latest deprecations/all src
26
+ npm uninstall material-react-table
27
+ npm install @lminii/material-react-table @mui/material@^9 @mui/icons-material@^9 @mui/x-date-pickers@^9
28
+ ```
29
+
30
+ Then rewrite imports:
31
+
32
+ ```diff
33
+ -import { MaterialReactTable } from 'material-react-table';
34
+ -import { MRT_Localization_DE } from 'material-react-table/locales/de';
35
+ +import { MaterialReactTable } from '@lminii/material-react-table';
36
+ +import { MRT_Localization_DE } from '@lminii/material-react-table/locales/de';
37
+ ```
38
+
39
+ Peer floors are `@mui/material`, `@mui/icons-material`, and `@mui/x-date-pickers` at 9.0 or newer; React 18 and Emotion 11.13 are unchanged. Node 22.12 or newer is required for the CommonJS build.
40
+
41
+ ## Core Patterns
42
+
43
+ ### Renames from TanStack Table V9
44
+
45
+ Each of these is a find and replace across the codebase:
46
+
47
+ | V3 | V4 |
48
+ | --- | --- |
49
+ | `columnPinning: { left, right }` | `columnPinning: { start, end }` |
50
+ | `column.pin('left')`, `getIsPinned() === 'left'` | `column.pin('start')`, `getIsPinned() === 'start'` |
51
+ | `table.getLeftLeafColumns()`, `getRight*`, `row.getLeftVisibleCells()` | `getStartLeafColumns()`, `getEnd*`, `row.getStartVisibleCells()` |
52
+ | `columnSizingInfo`, `onColumnSizingInfoChange`, `setColumnSizingInfo` | `columnResizing`, `onColumnResizingChange`, `setColumnResizing` |
53
+ | `sortingFn`, `sortingFns`, `column.getSortingFn()` | `sortFn`, `sortFns`, `column.getSortFn()` |
54
+ | `table.getPrePaginationRowModel()`, `getPaginationRowModel()` | `getPrePaginatedRowModel()`, `getPaginatedRowModel()` |
55
+ | `column.getAggregationFn()` | `column.getAggregationFns()` |
56
+ | `MRT_SortingFn`, `MRT_ColumnSizingInfoState` | `MRT_SortFn`, `MRT_ColumnResizingState` (old names remain as deprecated aliases) |
57
+
58
+ ### Behaviour changes to audit
59
+
60
+ - `rowSelection` values are `true`, never `false`. Deselect by deleting the key.
61
+ - `rowPinning` needs both `top` and `bottom`; `columnPinning` needs both `start` and `end` when passed through `initialState` or `state`.
62
+ - `table.getIsSomeRowsSelected()` is `true` when all rows are selected. Indeterminate is `getIsSomeRowsSelected() && !getIsAllRowsSelected()`.
63
+ - A custom `aggregationFn` is `{ aggregate: (context) => value }`, not a callable. Built-in names still work.
64
+ - `getCoreRowModel`, `getFilteredRowModel`, `getSortedRowModel`, `getPaginationRowModel`, `getExpandedRowModel`, `getGroupedRowModel`, and `getFaceted*` options are gone; the models are always registered. Use `manual*` to take over a stage.
65
+ - Rows with `renderDetailPanel` report `row.getCanExpand()` as `true`. Pass `getRowCanExpand` to restrict it.
66
+ - `onStateChange` and `table.setState()` are gone. Control slices individually.
67
+ - `table.getState()` still returns the full state; `table.state` is reactive in render code.
68
+ - Pinned cells use `insetInlineStart` and `insetInlineEnd`, so RTL pins to the logical start and end.
69
+
70
+ ### Material UI V9 changes inside MRT options
71
+
72
+ ```diff
73
+ muiFilterTextFieldProps: {
74
+ - InputProps: { sx: { minWidth: 120 } },
75
+ + slotProps: { input: { sx: { minWidth: 120 } } },
76
+ },
77
+ -const pickerProps: DatePickerProps<Dayjs> = { ... };
78
+ +const pickerProps: DatePickerProps = { ... };
79
+ ```
80
+
81
+ `muiFilterDatePickerProps`, `muiFilterDateTimePickerProps`, and `muiFilterTimePickerProps` are no longer generic, and the filter pickers render `PickersTextField`, so a custom `slots.textField` must accept `PickersTextFieldProps`. Everything else in `mui*Props` passes straight to Material UI, so Material UI's own V7 and V9 notes apply.
82
+
83
+ ### Package entry points
84
+
85
+ The package ships an `exports` map with `.mjs` and `.js` builds. Only `@lminii/material-react-table`, `@lminii/material-react-table/locales/<code>`, and `@lminii/material-react-table/package.json` resolve; deep imports into `dist/` or `src/` fail at build time and must be replaced with root exports.
86
+
87
+ ## Common Mistakes
88
+
89
+ ### HIGH Keeping v8 pinning literals
90
+
91
+ Wrong:
92
+
93
+ ```tsx
94
+ initialState: { columnPinning: { left: ['mrt-row-select'], right: ['mrt-row-actions'] } }
95
+ ```
96
+
97
+ Correct:
98
+
99
+ ```tsx
100
+ initialState: { columnPinning: { start: ['mrt-row-select'], end: ['mrt-row-actions'] } }
101
+ ```
102
+
103
+ `left` and `right` are no longer valid keys, so the pinning state is silently empty.
104
+
105
+ Source: `MIGRATION.md`
106
+
107
+ ### HIGH Passing row model factories
108
+
109
+ Wrong:
110
+
111
+ ```tsx
112
+ useMaterialReactTable({ columns, data, getSortedRowModel: getSortedRowModel() })
113
+ ```
114
+
115
+ Correct:
116
+
117
+ ```tsx
118
+ useMaterialReactTable({ columns, data })
119
+ ```
120
+
121
+ The options no longer exist in `MRT_TableOptions`; MRT registers every row model itself.
122
+
123
+ Source: `packages/material-react-table/src/features/mrtFeatures.ts`
124
+
125
+ ### MEDIUM Treating the migration as a TanStack useTable rewrite
126
+
127
+ Wrong:
128
+
129
+ ```tsx
130
+ const table = useTable({ features: tableFeatures({ rowSortingFeature }), columns, data })
131
+ ```
132
+
133
+ Correct:
134
+
135
+ ```tsx
136
+ const table = useMaterialReactTable({ columns, data })
137
+ ```
138
+
139
+ The `@tanstack/react-table#migrate-v8-to-v9` skill describes migrating a headless table. MRT applications stay on `useMaterialReactTable`; only the renamed instance methods and state shapes from that skill apply.
140
+
141
+ Source: `MIGRATION.md`
142
+
143
+ ### LOW Deep-importing a locale file
144
+
145
+ Wrong:
146
+
147
+ ```tsx
148
+ import { MRT_Localization_FR } from '@lminii/material-react-table/dist/locales/fr'
149
+ ```
150
+
151
+ Correct:
152
+
153
+ ```tsx
154
+ import { MRT_Localization_FR } from '@lminii/material-react-table/locales/fr'
155
+ ```
156
+
157
+ Source: `packages/material-react-table/package.json` exports map
158
+
159
+ ## API Discovery
160
+
161
+ Compare `node_modules/@lminii/material-react-table/dist/index.d.ts` against the V3 declarations for renamed members; the deprecated `MRT_SortingFn` and `MRT_ColumnSizingInfoState` aliases carry JSDoc pointing to the new names. The full guide with tables is at `/docs/getting-started/migrating-to-v4`.