Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Jul 17, 2024
1 parent 516d7b7 commit 28f0125
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,12 @@ export const columnOptions: ColumnOption[] = [
{
columnOption: 'filterTooltipValueFn',
defaultValue: '',
description:
'Specify to transform tooltip values to a readable format.',
description: 'Specify to transform tooltip values to a readable format.',
link: '',
linkText: '',
source: 'MRT',
required: false,
type: "MRT_FilterTooltipValueFn",
type: 'MRT_FilterTooltipValueFn',
},
{
columnOption: 'filterVariant',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const MRT_TableHeadCellFilterLabel = <TData extends MRT_RowData>({
const currentFilterOption = columnDef._filterFn;
const filterValueFn =
columnDef.filterTooltipValueFn || ((value) => value as string);
type FilterValueType = Parameters<typeof filterValueFn>[0]
type FilterValueType = Parameters<typeof filterValueFn>[0];
const filterTooltip =
columnFilterDisplayMode === 'popover' && !isFilterActive
? localization.filterByColumn?.replace(
Expand All @@ -73,12 +73,17 @@ export const MRT_TableHeadCellFilterLabel = <TData extends MRT_RowData>({
'{filterValue}',
`"${
Array.isArray(column.getFilterValue())
? (column.getFilterValue() as [FilterValueType, FilterValueType])
.map((v) => filterValueFn(v))
.join(
`" ${isRangeFilter ? localization.and : localization.or} "`,
? (
column.getFilterValue() as [
FilterValueType,
FilterValueType,
]
)
: filterValueFn(column.getFilterValue())
.map((v) => filterValueFn(v))
.join(
`" ${isRangeFilter ? localization.and : localization.or} "`,
)
: filterValueFn(column.getFilterValue())
}"`,
)
.replace('" "', '');
Expand Down
2 changes: 1 addition & 1 deletion packages/mantine-react-table/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,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?: MRT_FilterTooltipValueFn,
filterTooltipValueFn?: MRT_FilterTooltipValueFn;
filterVariant?:
| 'autocomplete'
| 'checkbox'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,12 @@ export const CustomTooltipValueFn = () => {
const [columnFilters, setColumnFilters] = useState<MRT_ColumnFiltersState>(
[],
);
const [isActiveValueFn, setIsActiveValueFn] = useState<MRT_FilterTooltipValueFn<string>|undefined>(undefined);
const [dateValueFn, setDateValueFn] = useState<MRT_FilterTooltipValueFn<Date>|undefined>(undefined);
const [isActiveValueFn, setIsActiveValueFn] = useState<
MRT_FilterTooltipValueFn<string> | undefined
>(undefined);
const [dateValueFn, setDateValueFn] = useState<
MRT_FilterTooltipValueFn<Date> | undefined
>(undefined);
const [enableValueFns, setEnableValueFns] = useState(true);

const formatDate = (date: any, format: string) => {
Expand Down

0 comments on commit 28f0125

Please sign in to comment.