Skip to content

Commit

Permalink
fix rangeFilterIndex undefined and fix column visibility stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Feb 28, 2024
1 parent 922e45e commit 5130880
Show file tree
Hide file tree
Showing 6 changed files with 770 additions and 608 deletions.
4 changes: 2 additions & 2 deletions apps/material-react-table-docs/package.json
Expand Up @@ -28,7 +28,7 @@
"@mui/x-date-pickers": "^6.19.5",
"@next/mdx": "^14.1.0",
"@tanstack/react-query": "^5.24.1",
"@tanstack/react-table-devtools": "^8.13.0",
"@tanstack/react-table-devtools": "^8.13.2",
"@types/mdx": "^2.0.11",
"dayjs": "^1.11.10",
"export-to-csv": "^1.2.3",
Expand All @@ -44,7 +44,7 @@
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.20.1",
"@types/node": "^20.11.20",
"@types/node": "^20.11.22",
"@types/react": "^18.2.60",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/material-react-table/package.json
@@ -1,5 +1,5 @@
{
"version": "2.12.0",
"version": "2.12.1",
"license": "MIT",
"name": "material-react-table",
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
Expand Down Expand Up @@ -61,7 +61,7 @@
"storybook:dev": "storybook dev -p 6006"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/core": "^7.24.0",
"@babel/preset-react": "^7.23.3",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
Expand All @@ -80,7 +80,7 @@
"@storybook/react": "^7.6.17",
"@storybook/react-vite": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@types/node": "^20.11.20",
"@types/node": "^20.11.22",
"@types/react": "^18.2.60",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.0",
Expand Down Expand Up @@ -116,7 +116,7 @@
},
"dependencies": {
"@tanstack/match-sorter-utils": "8.11.8",
"@tanstack/react-table": "8.13.0",
"@tanstack/react-table": "8.13.2",
"@tanstack/react-virtual": "3.1.3",
"highlight-words": "1.2.2"
}
Expand Down
Expand Up @@ -73,45 +73,32 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
const { columnDef } = column;
const { filterVariant } = columnDef;

const args = { column, rangeFilterIndex, table };

const textFieldProps: TextFieldProps = {
...parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table }),
...parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
column,
table,
}),
...parseFromValuesOrFunc(muiFilterTextFieldProps, args),
...parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, args),
...rest,
};

const autocompleteProps = {
...parseFromValuesOrFunc(muiFilterAutocompleteProps, { column, table }),
...parseFromValuesOrFunc(columnDef.muiFilterAutocompleteProps, {
column,
table,
}),
...parseFromValuesOrFunc(muiFilterAutocompleteProps, args),
...parseFromValuesOrFunc(columnDef.muiFilterAutocompleteProps, args),
};

const datePickerProps: DatePickerProps<any> = {
...parseFromValuesOrFunc(muiFilterDatePickerProps, { column, table }),
...parseFromValuesOrFunc(columnDef.muiFilterDatePickerProps, {
column,
table,
}),
...parseFromValuesOrFunc(muiFilterDatePickerProps, args),
...parseFromValuesOrFunc(columnDef.muiFilterDatePickerProps, args),
};

const dateTimePickerProps: DateTimePickerProps<any> = {
...parseFromValuesOrFunc(muiFilterDateTimePickerProps, { column, table }),
...parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, {
column,
table,
}),
...parseFromValuesOrFunc(muiFilterDateTimePickerProps, args),
...parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, args),
};

const timePickerProps: TimePickerProps<any> = {
...parseFromValuesOrFunc(muiFilterTimePickerProps, { column, table }),
...parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, {
column,
table,
}),
...parseFromValuesOrFunc(muiFilterTimePickerProps, args),
...parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, args),
};

const {
Expand Down
Expand Up @@ -47,9 +47,7 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({

const handleToggleAllColumns = (value?: boolean) => {
getAllLeafColumns()
.filter(
(col) => col.columnDef.enableHiding !== false && !col.getIsPinned(),
)
.filter((col) => col.columnDef.enableHiding !== false)
.forEach((col) => col.toggleVisibility(value));
};

Expand Down
Expand Up @@ -56,10 +56,7 @@ export const MRT_ShowHideColumnsMenuItems = <TData extends MRT_RowData>({
const { columnDef } = column;
const { columnDefType } = columnDef;

const switchChecked =
(columnDefType !== 'group' && column.getIsVisible()) ||
(columnDefType === 'group' &&
column.getLeafColumns().some((col) => col.getIsVisible()));
const switchChecked = column.getIsVisible();

const handleToggleColumnHidden = (column: MRT_Column<TData>) => {
if (columnDefType === 'group') {
Expand Down

0 comments on commit 5130880

Please sign in to comment.