-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add filterTooltipValueFn option to transform the value of the filter tooltip #360
feat: add filterTooltipValueFn option to transform the value of the filter tooltip #360
Conversation
@yamadayutaka is attempting to deploy a commit to the Kevin Vandy OSS Team on Vercel. A member of the Team first needs to authorize it. |
Hi @yamadayutaka thanks for your contribution, please see the comments I left. |
Hi @alessandrojcm thanks for your reply! |
@@ -69,10 +71,12 @@ export const MRT_TableHeadCellFilterLabel = <TData extends MRT_RowData>({ | |||
'{filterValue}', | |||
`"${ | |||
Array.isArray(column.getFilterValue()) | |||
? (column.getFilterValue() as [string, string]).join( | |||
? (column.getFilterValue() as []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure here about the type, if the previous type was casted as [string, string]
then it should remain so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since filterTooltipValueFn
does the conversion to string, I think the input to filterTooltipValueFn
should remain the original data type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok yeah agree, do you think you could type the prop accordingly then? Basically, I´d like to avoid using any
when possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a type definition. What do you think of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yamadayutaka could please add it to the prop? So it'd be filterToolValueFn?: (value: string) => string
@@ -500,6 +500,7 @@ export type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit< | |||
enableEditing?: ((row: MRT_Row<TData>) => boolean) | boolean; | |||
enableFilterMatchHighlighting?: boolean; | |||
filterFn?: MRT_FilterFn<TData>; | |||
filterTooltipValueFn?: (value: any) => string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Yes apologies, please check now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry missed that you already typed the props (GH's UI can be very confusing sometimes...) Wil merge now thanks!
Thanks for merging! |
This PR is an implementation of the feature suggestion #359.
Specify the Column Option as follows.
Then, the tooltip is displayed as follows.