Skip to content
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

fix: Cannot apply filter on slider #1546

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions src/components/TableToolbar/Filters/FilterInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface IFilterInputsProps {
handleChangeColumn: (column: string) => void;
joinOperator: "AND" | "OR";
setJoinOperator: (operator: "AND" | "OR") => void;
setIsDraggingDisabled: (isDisabled: boolean) => void;
}

export default function FilterInputs({
Expand All @@ -55,6 +56,7 @@ export default function FilterInputs({
handleDelete,
index,
noOfQueries,
setIsDraggingDisabled,
}: IFilterInputsProps) {
const columnType = selectedColumn ? getFieldType(selectedColumn) : null;

Expand Down Expand Up @@ -155,28 +157,35 @@ export default function FilterInputs({
</InputLabel>

<Suspense fallback={<FieldSkeleton />}>
{columnType &&
createElement(
query.key === "_rowy_ref.id"
? IdFilterInput
: getFieldProp("filter.customInput" as any, columnType) ||
getFieldProp("SideDrawerField", columnType),
{
column: selectedColumn,
_rowy_ref: {},
value: query.value,
onSubmit: () => {},
onChange: (value: any) => {
const newQuery = {
...query,
value,
};
setQuery(newQuery);
},
disabled,
operator: query.operator,
}
)}
<div
onMouseEnter={() => setIsDraggingDisabled(true)}
onMouseLeave={() => setIsDraggingDisabled(false)}
>
{columnType &&
createElement(
query.key === "_rowy_ref.id"
? IdFilterInput
: getFieldProp(
"filter.customInput" as any,
columnType
) || getFieldProp("SideDrawerField", columnType),
{
column: selectedColumn,
_rowy_ref: {},
value: query.value,
onSubmit: () => {},
onChange: (value: any) => {
const newQuery = {
...query,
value,
};
setQuery(newQuery);
},
disabled,
operator: query.operator,
}
)}
</div>
</Suspense>
</ErrorBoundary>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useState } from "react";
import FilterInputs from "./FilterInputs";

import { Button } from "@mui/material";
Expand Down Expand Up @@ -37,6 +38,8 @@ export default function FilterInputsCollection({
});
};

const [isDraggingDisabled, setIsDraggingDisabled] = useState<boolean>(false);

return (
<>
<DragDropContext onDragEnd={onDragEnd}>
Expand All @@ -49,6 +52,7 @@ export default function FilterInputsCollection({
key={query.id}
draggableId={query.id.toString()}
index={index}
isDragDisabled={isDraggingDisabled}
>
{(provided) => (
<div
Expand Down Expand Up @@ -83,6 +87,9 @@ export default function FilterInputsCollection({
return newQueries;
});
}}
setIsDraggingDisabled={(isDisabled: boolean) => {
setIsDraggingDisabled(isDisabled);
}}
index={index}
noOfQueries={queries.length}
/>
Expand Down