From 911e7875d80f7da248a71018a49cb37b5d98d0eb Mon Sep 17 00:00:00 2001 From: Kevin Vandy Date: Mon, 27 Feb 2023 17:35:34 -0600 Subject: [PATCH] release v1.8.3 - re-add support for edit and filter texfield children --- .../pages/changelog.mdx | 4 ++ packages/material-react-table/package.json | 2 +- .../src/inputs/MRT_EditCellTextField.tsx | 55 +++++++------- .../src/inputs/MRT_FilterTextField.tsx | 71 ++++++++++--------- 4 files changed, 69 insertions(+), 63 deletions(-) diff --git a/apps/material-react-table-docs/pages/changelog.mdx b/apps/material-react-table-docs/pages/changelog.mdx index 69433c7f3..6c6a17c71 100644 --- a/apps/material-react-table-docs/pages/changelog.mdx +++ b/apps/material-react-table-docs/pages/changelog.mdx @@ -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 diff --git a/packages/material-react-table/package.json b/packages/material-react-table/package.json index 86fa73452..27d86f21a 100644 --- a/packages/material-react-table/package.json +++ b/packages/material-react-table/package.json @@ -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.", diff --git a/packages/material-react-table/src/inputs/MRT_EditCellTextField.tsx b/packages/material-react-table/src/inputs/MRT_EditCellTextField.tsx index e929fc2ca..cb21ab109 100644 --- a/packages/material-react-table/src/inputs/MRT_EditCellTextField.tsx +++ b/packages/material-react-table/src/inputs/MRT_EditCellTextField.tsx @@ -116,33 +116,34 @@ export const MRT_EditCellTextField = = {}>({ 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 ( - - {text} - - ); - }, - )} + {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 ( + + {text} + + ); + }, + )} ); }; diff --git a/packages/material-react-table/src/inputs/MRT_FilterTextField.tsx b/packages/material-react-table/src/inputs/MRT_FilterTextField.tsx index db69ef82f..2f43af503 100644 --- a/packages/material-react-table/src/inputs/MRT_FilterTextField.tsx +++ b/packages/material-react-table/src/inputs/MRT_FilterTextField.tsx @@ -349,41 +349,42 @@ export const MRT_FilterTextField = ({ {filterPlaceholder} )} - {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 ( - - {isMultiSelectFilter && ( - - )} - {text} - - ); - }, - )} + {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 ( + + {isMultiSelectFilter && ( + + )} + {text} + + ); + }, + )}