-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(QueryBuilder): empty and is not empty operators as value renderers
- Loading branch information
1 parent
b3285f0
commit f90ca70
Showing
5 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/core/src/QueryBuilder/Rule/Value/EmptyValue/EmptyValue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useEffect } from "react"; | ||
|
||
import { useQueryBuilderContext } from "../../../Context"; | ||
|
||
export interface EmptyValueProps { | ||
id: React.Key; | ||
} | ||
|
||
export const EmptyValue = ({ id }: EmptyValueProps) => { | ||
const { dispatchAction } = useQueryBuilderContext(); | ||
|
||
// Clear value on first render | ||
useEffect(() => { | ||
dispatchAction({ | ||
type: "set-value", | ||
id, | ||
value: null, | ||
}); | ||
}, [dispatchAction, id]); | ||
|
||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./EmptyValue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters