Fix reset button, maximum rows, filtering by booleans in filters (#4100)

* Support boolean static values

* Max rows, reset button

* Max rows, reset button
This commit is contained in:
Patryk Andrzejewski 2023-08-22 09:43:49 +02:00 committed by GitHub
parent 1cec02e1b4
commit 65106203f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 8 deletions

View file

@ -1762,10 +1762,6 @@
"AyQkmp": { "AyQkmp": {
"string": "Sorting by this column is not available" "string": "Sorting by this column is not available"
}, },
"AyW1j6": {
"context": "Clear filters button text",
"string": "Clear all fields"
},
"AzMSmb": { "AzMSmb": {
"context": "caption", "context": "caption",
"string": "If enabled this attribute can be used as a column in product table." "string": "If enabled this attribute can be used as a column in product table."
@ -7182,6 +7178,10 @@
"nLML8Y": { "nLML8Y": {
"string": "Default Shipping Address" "string": "Default Shipping Address"
}, },
"nMojhT": {
"context": "Clear filters button text",
"string": "Reset"
},
"nNeWAx": { "nNeWAx": {
"context": "dialog header", "context": "dialog header",
"string": "Delete Shipping Method" "string": "Delete Shipping Method"

View file

@ -19,6 +19,8 @@ interface FiltersAreaProps {
onCancel?: () => void; onCancel?: () => void;
} }
const MAX_VALUE_ITEMS = 12;
export const FiltersArea: FC<FiltersAreaProps> = ({ export const FiltersArea: FC<FiltersAreaProps> = ({
onConfirm, onConfirm,
onCancel, onCancel,
@ -84,7 +86,10 @@ export const FiltersArea: FC<FiltersAreaProps> = ({
locale={translations.locale} locale={translations.locale}
> >
<_ExperimentalFilters.Footer> <_ExperimentalFilters.Footer>
<_ExperimentalFilters.AddRowButton variant="tertiary"> <_ExperimentalFilters.AddRowButton
variant="tertiary"
disabled={value.length > MAX_VALUE_ITEMS}
>
{translations.addFilter} {translations.addFilter}
</_ExperimentalFilters.AddRowButton> </_ExperimentalFilters.AddRowButton>
<Box display="flex" gap={3}> <Box display="flex" gap={3}>

View file

@ -76,7 +76,7 @@ export const STATIC_OPTIONS: LeftOperand[] = [
}, },
{ {
value: "giftCard", value: "giftCard",
label: "Has giftcard", label: "Is giftcard",
type: "giftCard", type: "giftCard",
slug: "giftCard", slug: "giftCard",
}, },

View file

@ -17,8 +17,8 @@ export const conditionalFilterMessages = defineMessages({
description: "Add filter button text", description: "Add filter button text",
}, },
clearFilters: { clearFilters: {
defaultMessage: "Clear all fields", defaultMessage: "Reset",
id: "AyW1j6", id: "nMojhT",
description: "Clear filters button text", description: "Clear filters button text",
}, },
saveFilters: { saveFilters: {

View file

@ -39,6 +39,10 @@ const createStaticQueryPart = (
return { range: { lte, gte } }; return { range: { lte, gte } };
} }
if (isItemOption(value) && ["true", "false"].includes(value.value)) {
return value.value === "true";
}
if (isItemOption(value)) { if (isItemOption(value)) {
return { eq: value.value }; return { eq: value.value };
} }