mirror of
https://github.com/rowyio/rowy.git
synced 2026-02-24 04:01:17 +01:00
add filtering for numbers
This commit is contained in:
@@ -66,6 +66,7 @@ const OPERATORS = [
|
||||
},
|
||||
{ value: "<", label: "<", compatibleTypes: [FieldType.number] },
|
||||
{ value: "<=", label: "<=", compatibleTypes: [FieldType.number] },
|
||||
{ value: "==", label: "==", compatibleTypes: [FieldType.number] },
|
||||
{ value: ">=", label: ">=", compatibleTypes: [FieldType.number] },
|
||||
{ value: ">", label: ">", compatibleTypes: [FieldType.number] },
|
||||
{
|
||||
@@ -243,6 +244,24 @@ const Filters = () => {
|
||||
placeholder="Text value"
|
||||
/>
|
||||
);
|
||||
case FieldType.number:
|
||||
return (
|
||||
<TextField
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
if (query.value || value)
|
||||
setQuery((query) => ({
|
||||
...query,
|
||||
value: value !== "" ? parseFloat(value) : "",
|
||||
}));
|
||||
}}
|
||||
value={typeof query.value === "number" ? query.value : ""}
|
||||
variant="filled"
|
||||
hiddenLabel
|
||||
type="number"
|
||||
placeholder="number value"
|
||||
/>
|
||||
);
|
||||
|
||||
case FieldType.singleSelect:
|
||||
if (operator === "in")
|
||||
@@ -486,7 +505,8 @@ const Filters = () => {
|
||||
disabled={
|
||||
query.value !== true &&
|
||||
query.value !== false &&
|
||||
_isEmpty(query.value)
|
||||
_isEmpty(query.value) &&
|
||||
typeof query.value !== "number"
|
||||
}
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user