Skip to content

Commit 3f369c1

Browse files
Merge pull request #457 from KevinVandy/427-clear-columnfilters-search-input-is-not-cleared-when-columnfilter-is-set-to-empty-array-using-custom-reset-button
427 clear columnfilters search input is not cleared when columnfilter is set to empty array using custom reset button
2 parents 0446cd0 + 6b05a38 commit 3f369c1

File tree

140 files changed

+6819
-7934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+6819
-7934
lines changed

apps/mantine-react-table-docs/components/mdx/SourceCodeSnippet.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,12 @@ export const SourceCodeSnippet = ({
183183
setColorScheme(
184184
value?.startsWith('dark') ? 'dark' : 'light',
185185
);
186-
value === 'darkDark'
187-
? setDarkDark(true)
188-
: setDarkDark(false);
186+
187+
if (value === 'darkDark') {
188+
setDarkDark(true);
189+
} else {
190+
setDarkDark(false);
191+
}
189192
plausible(`toggle-theme-${value}-mode`);
190193
}}
191194
className={classes.colorSchemeSelect}

apps/mantine-react-table-docs/components/prop-tables/CellInstanceAPIsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./CellInstanceAPIsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/ColumnInstanceAPIsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./ColumnInstanceAPIsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/ColumnOptionsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./ColumnOptionsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/RowInstanceAPIsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./RowInstanceAPIsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/StateOptionsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./StateOptionsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/TableInstanceAPIsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./TableInstanceAPIsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/components/prop-tables/TableOptionsSource.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text } from '@mantine/core';
22
import { SourceCodeSnippet } from '../mdx/SourceCodeSnippet';
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34
const TS = require('!!raw-loader!./TableOptionsTable.tsx').default;
45

56
const ExampleTable = () => {

apps/mantine-react-table-docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@types/react-dom": "^18.3.1",
4747
"@typescript-eslint/eslint-plugin": "^8.8.1",
4848
"@typescript-eslint/parser": "^8.8.1",
49-
"eslint": "9.12.0",
49+
"eslint": "^8.57.0",
5050
"eslint-config-next": "14.2.15",
5151
"next-plausible": "^3.12.2",
5252
"postcss": "^8.4.47",

packages/mantine-react-table/.eslintrc

+11-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": [
33
"eslint:recommended",
44
"plugin:@typescript-eslint/recommended",
5-
"plugin:perfectionist/recommended-natural"
5+
"plugin:perfectionist/recommended-natural-legacy",
66
],
77
"parser": "@typescript-eslint/parser",
88
"plugins": ["@typescript-eslint", "perfectionist"],
@@ -17,8 +17,8 @@
1717
{
1818
"prefer": "type-imports",
1919
"disallowTypeAnnotations": true,
20-
"fixStyle": "inline-type-imports"
21-
}
20+
"fixStyle": "inline-type-imports",
21+
},
2222
],
2323
"perfectionist/sort-imports": [
2424
"warn",
@@ -32,12 +32,9 @@
3232
"tanstack",
3333
"mantine",
3434
"mrt",
35-
"siblings",
36-
"sibling-type",
37-
"parent",
38-
"parent-type"
35+
["sibling", "sibling-type", "parent", "parent-type"]
3936
],
40-
"custom-groups": {
37+
"customGroups": {
4138
"value": {
4239
"clsx": "clsx",
4340
"style": ["./**.module.css"],
@@ -46,16 +43,15 @@
4643
"tanstack": "@tanstack/**",
4744
"mantine": "@mantine/**",
4845
"mrt": ["./MRT_**", "../**MRT_**", "../../src"],
49-
"faker": "@faker/**"
46+
"faker": "@faker/**",
5047
},
5148
"type": {
52-
"react": "react"
53-
}
49+
"react": "react",
50+
},
5451
},
55-
"newlines-between": "never"
56-
}
57-
]
52+
},
53+
],
5854
},
5955
"root": true,
60-
"ignorePatterns": ["dist/", "locales/", "node_modules/"]
56+
"ignorePatterns": ["dist/", "locales/", "node_modules/"],
6157
}

packages/mantine-react-table/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"@vitejs/plugin-react": "^4.3.2",
109109
"clsx": "^2.1.1",
110110
"dayjs": "^1.11.13",
111-
"eslint": "^9.12.0",
111+
"eslint": "^8.57.0",
112112
"eslint-plugin-perfectionist": "^3.8.0",
113113
"mantine-contextmenu": "^7.12.2",
114114
"postcss": "^8.4.47",

packages/mantine-react-table/src/components/body/MRT_TableBody.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_TableBody.module.css';
4+
35
import { memo, useMemo } from 'react';
6+
47
import {
58
type TableProps,
69
TableTbody,
710
type TableTbodyProps,
811
} from '@mantine/core';
9-
import { MRT_TableBodyRow, Memo_MRT_TableBodyRow } from './MRT_TableBodyRow';
10-
import { useMRT_RowVirtualizer } from '../../hooks/useMRT_RowVirtualizer';
12+
13+
import { MRT_TableBodyEmptyRow } from './MRT_TableBodyEmptyRow';
14+
import { Memo_MRT_TableBodyRow, MRT_TableBodyRow } from './MRT_TableBodyRow';
15+
1116
import { useMRT_Rows } from '../../hooks/useMRT_Rows';
17+
import { useMRT_RowVirtualizer } from '../../hooks/useMRT_RowVirtualizer';
1218
import {
1319
type MRT_ColumnVirtualizer,
1420
type MRT_Row,
@@ -17,7 +23,6 @@ import {
1723
type MRT_VirtualItem,
1824
} from '../../types';
1925
import { parseFromValuesOrFunc } from '../../utils/utils';
20-
import { MRT_TableBodyEmptyRow } from './MRT_TableBodyEmptyRow';
2126

2227
export interface MRT_TableBodyProps<TData extends MRT_RowData>
2328
extends TableTbodyProps {

packages/mantine-react-table/src/components/body/MRT_TableBodyCell.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_TableBodyCell.module.css';
4+
35
import {
46
type CSSProperties,
57
type DragEvent,
8+
memo,
69
type MouseEvent,
710
type RefObject,
8-
memo,
911
useEffect,
1012
useState,
1113
} from 'react';
14+
1215
import {
1316
Skeleton,
1417
TableTd,
1518
type TableTdProps,
1619
useDirection,
1720
} from '@mantine/core';
21+
1822
import { MRT_TableBodyCellValue } from './MRT_TableBodyCellValue';
23+
1924
import {
2025
type MRT_Cell,
2126
type MRT_CellValue,

packages/mantine-react-table/src/components/body/MRT_TableBodyCellValue.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Highlight, type HighlightProps } from '@mantine/core';
2+
23
import {
34
type MRT_Cell,
45
type MRT_CellValue,

packages/mantine-react-table/src/components/body/MRT_TableBodyEmptyRow.tsx

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_TableBody.module.css';
4+
35
import { useMemo } from 'react';
4-
import { type TableProps, Text, TableTd, TableTrProps } from '@mantine/core';
6+
7+
import { createRow } from '@tanstack/react-table';
8+
9+
import {
10+
type TableProps,
11+
TableTd,
12+
type TableTrProps,
13+
Text,
14+
} from '@mantine/core';
15+
516
import { MRT_TableBodyRow } from './MRT_TableBodyRow';
17+
618
import {
719
type MRT_Row,
820
type MRT_RowData,
921
type MRT_TableInstance,
1022
} from '../../types';
11-
import { createRow } from '@tanstack/react-table';
1223
import { MRT_ExpandButton } from '../buttons/MRT_ExpandButton';
1324

1425
interface Props<TData extends MRT_RowData> extends TableTrProps {
@@ -54,12 +65,12 @@ export const MRT_TableBodyEmptyRow = <TData extends MRT_RowData>({
5465

5566
return (
5667
<MRT_TableBodyRow
57-
table={table}
58-
tableProps={tableProps}
5968
className={clsx(
6069
'mrt-table-body-row',
6170
layoutMode?.startsWith('grid') && classes['empty-row-tr-grid'],
6271
)}
72+
table={table}
73+
tableProps={tableProps}
6374
{...emptyRowProps}
6475
>
6576
{renderDetailPanel && (

packages/mantine-react-table/src/components/body/MRT_TableBodyRow.tsx

+39-32
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_TableBodyRow.module.css';
4+
35
import { type DragEvent, memo, useMemo, useRef } from 'react';
6+
47
import {
58
Box,
69
type TableProps,
710
TableTr,
811
type TableTrProps,
912
} from '@mantine/core';
10-
import { MRT_TableBodyCell, Memo_MRT_TableBodyCell } from './MRT_TableBodyCell';
13+
14+
import { Memo_MRT_TableBodyCell, MRT_TableBodyCell } from './MRT_TableBodyCell';
1115
import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
16+
1217
import {
1318
type MRT_Cell,
1419
type MRT_ColumnVirtualizer,
@@ -190,37 +195,39 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
190195
{virtualPaddingLeft ? (
191196
<Box component="td" display="flex" w={virtualPaddingLeft} />
192197
) : null}
193-
{children ? children : (virtualColumns ?? row.getVisibleCells()).map(
194-
(cellOrVirtualCell, renderedColumnIndex) => {
195-
let cell = cellOrVirtualCell as MRT_Cell<TData>;
196-
if (columnVirtualizer) {
197-
renderedColumnIndex = (cellOrVirtualCell as MRT_VirtualItem)
198-
.index;
199-
cell = visibleCells[renderedColumnIndex];
200-
}
201-
const cellProps = {
202-
cell,
203-
numRows,
204-
renderedColumnIndex,
205-
renderedRowIndex,
206-
rowRef,
207-
table,
208-
virtualCell: columnVirtualizer
209-
? (cellOrVirtualCell as MRT_VirtualItem)
210-
: undefined,
211-
};
212-
return memoMode === 'cells' &&
213-
cell.column.columnDef.columnDefType === 'data' &&
214-
!draggingColumn &&
215-
!draggingRow &&
216-
editingCell?.id !== cell.id &&
217-
editingRow?.id !== row.id ? (
218-
<Memo_MRT_TableBodyCell key={cell.id} {...cellProps} />
219-
) : (
220-
<MRT_TableBodyCell key={cell.id} {...cellProps} />
221-
);
222-
},
223-
)}
198+
{children
199+
? children
200+
: (virtualColumns ?? row.getVisibleCells()).map(
201+
(cellOrVirtualCell, renderedColumnIndex) => {
202+
let cell = cellOrVirtualCell as MRT_Cell<TData>;
203+
if (columnVirtualizer) {
204+
renderedColumnIndex = (cellOrVirtualCell as MRT_VirtualItem)
205+
.index;
206+
cell = visibleCells[renderedColumnIndex];
207+
}
208+
const cellProps = {
209+
cell,
210+
numRows,
211+
renderedColumnIndex,
212+
renderedRowIndex,
213+
rowRef,
214+
table,
215+
virtualCell: columnVirtualizer
216+
? (cellOrVirtualCell as MRT_VirtualItem)
217+
: undefined,
218+
};
219+
return memoMode === 'cells' &&
220+
cell.column.columnDef.columnDefType === 'data' &&
221+
!draggingColumn &&
222+
!draggingRow &&
223+
editingCell?.id !== cell.id &&
224+
editingRow?.id !== row.id ? (
225+
<Memo_MRT_TableBodyCell key={cell.id} {...cellProps} />
226+
) : (
227+
<MRT_TableBodyCell key={cell.id} {...cellProps} />
228+
);
229+
},
230+
)}
224231
{virtualPaddingRight ? (
225232
<Box component="td" display="flex" w={virtualPaddingRight} />
226233
) : null}

packages/mantine-react-table/src/components/body/MRT_TableBodyRowGrabHandle.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { type DragEvent, type RefObject } from 'react';
2+
23
import { type ActionIconProps } from '@mantine/core';
4+
35
import {
46
type MRT_Row,
57
type MRT_RowData,

packages/mantine-react-table/src/components/body/MRT_TableBodyRowPinButton.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { type ActionIconProps, Box } from '@mantine/core';
2+
23
import {
34
type MRT_Row,
45
type MRT_RowData,

packages/mantine-react-table/src/components/body/MRT_TableDetailPanel.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_TableDetailPanel.module.css';
4+
35
import { type RefObject } from 'react';
6+
47
import { Collapse, TableTd, type TableTdProps, TableTr } from '@mantine/core';
8+
59
import {
610
type MRT_Row,
711
type MRT_RowData,
@@ -66,7 +70,9 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
6670
));
6771

6872
const DetailPanel =
69-
!isLoading && row.getIsExpanded() && renderDetailPanel?.({ row, table, internalEditComponents });
73+
!isLoading &&
74+
row.getIsExpanded() &&
75+
renderDetailPanel?.({ internalEditComponents, row, table });
7076

7177
return (
7278
<TableTr

packages/mantine-react-table/src/components/buttons/MRT_ColumnPinningButtons.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import clsx from 'clsx';
2+
23
import classes from './MRT_ColumnPinningButtons.module.css';
4+
35
import { ActionIcon, Flex, Tooltip } from '@mantine/core';
6+
47
import {
58
type MRT_Column,
69
type MRT_RowData,

0 commit comments

Comments
 (0)