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

View file

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

View file

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

View file

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

View file

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