Skip to content

Commit

Permalink
release v1.8.3 - re-add support for edit and filter texfield children
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Feb 27, 2023
1 parent a75b6a6 commit 911e787
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 63 deletions.
4 changes: 4 additions & 0 deletions apps/material-react-table-docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import Head from 'next/head';

### Version 1 (Latest)

#### v1.8.3 (2023-02-27)

- Add back support for custom edit and filter textfield children

#### v1.8.2 (2023-02-26)

- Added `tableFeatures` prop for advanced tableInstance customization
Expand Down
2 changes: 1 addition & 1 deletion packages/material-react-table/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.2",
"version": "1.8.3",
"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
55 changes: 28 additions & 27 deletions packages/material-react-table/src/inputs/MRT_EditCellTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,34 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
onChange={handleChange}
onKeyDown={handleEnterKeyDown}
>
{columnDef?.editSelectOptions?.map(
(option: string | { text: string; value: string }) => {
let value: string;
let text: string;
if (typeof option !== 'object') {
value = option;
text = option;
} else {
value = option.value;
text = option.text;
}
return (
<MenuItem
key={value}
sx={{
display: 'flex',
m: 0,
alignItems: 'center',
gap: '0.5rem',
}}
value={value}
>
{text}
</MenuItem>
);
},
)}
{textFieldProps.children ??
columnDef?.editSelectOptions?.map(
(option: string | { text: string; value: string }) => {
let value: string;
let text: string;
if (typeof option !== 'object') {
value = option;
text = option;
} else {
value = option.value;
text = option.text;
}
return (
<MenuItem
key={value}
sx={{
display: 'flex',
m: 0,
alignItems: 'center',
gap: '0.5rem',
}}
value={value}
>
{text}
</MenuItem>
);
},
)}
</TextField>
);
};
71 changes: 36 additions & 35 deletions packages/material-react-table/src/inputs/MRT_FilterTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,41 +349,42 @@ export const MRT_FilterTextField = ({
<Box sx={{ opacity: 0.5 }}>{filterPlaceholder}</Box>
</MenuItem>
)}
{columnDef?.filterSelectOptions?.map(
(option: string | { text: string; value: string }) => {
let value: string;
let text: string;
if (typeof option !== 'object') {
value = option;
text = option;
} else {
value = option.value;
text = option.text;
}
return (
<MenuItem
key={value}
sx={{
display: 'flex',
m: 0,
alignItems: 'center',
gap: '0.5rem',
}}
value={value}
>
{isMultiSelectFilter && (
<Checkbox
checked={(
(column.getFilterValue() ?? []) as string[]
).includes(value)}
sx={{ mr: '0.5rem' }}
/>
)}
{text}
</MenuItem>
);
},
)}
{textFieldProps.children ??
columnDef?.filterSelectOptions?.map(
(option: string | { text: string; value: string }) => {
let value: string;
let text: string;
if (typeof option !== 'object') {
value = option;
text = option;
} else {
value = option.value;
text = option.text;
}
return (
<MenuItem
key={value}
sx={{
display: 'flex',
m: 0,
alignItems: 'center',
gap: '0.5rem',
}}
value={value}
>
{isMultiSelectFilter && (
<Checkbox
checked={(
(column.getFilterValue() ?? []) as string[]
).includes(value)}
sx={{ mr: '0.5rem' }}
/>
)}
{text}
</MenuItem>
);
},
)}
</TextField>
<MRT_FilterOptionMenu
anchorEl={anchorEl}
Expand Down

2 comments on commit 911e787

@vercel
Copy link

@vercel vercel bot commented on 911e787 Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 911e787 Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.