From 333dc9cb893cdb49ca87e39d4f98f0af2beb82f3 Mon Sep 17 00:00:00 2001 From: EYHN Date: Thu, 22 May 2025 11:12:37 +0000 Subject: [PATCH] feat(core): draft filter skip method step if there is only one method (#12457) ## Summary by CodeRabbit - **New Features** - Filter options can now start from a specified step, improving flexibility when multiple filtering methods are available. --- .../core/src/components/filter/conditions/condition.tsx | 1 + packages/frontend/core/src/components/filter/options.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/components/filter/conditions/condition.tsx b/packages/frontend/core/src/components/filter/conditions/condition.tsx index 43d92a47fa..a9dab73a4d 100644 --- a/packages/frontend/core/src/components/filter/conditions/condition.tsx +++ b/packages/frontend/core/src/components/filter/conditions/condition.tsx @@ -39,6 +39,7 @@ export const Condition = ({ 1 ? 0 : 1} items={[ methods && (({ onDraftCompleted, menuRef }) => { diff --git a/packages/frontend/core/src/components/filter/options.tsx b/packages/frontend/core/src/components/filter/options.tsx index 98e1447176..4a09561685 100644 --- a/packages/frontend/core/src/components/filter/options.tsx +++ b/packages/frontend/core/src/components/filter/options.tsx @@ -13,10 +13,12 @@ export const FilterOptionsGroup = ({ isDraft, onDraftCompleted, items, + initialStep = 0, }: { isDraft?: boolean; onDraftCompleted?: () => void; items?: FilterOptionsGroupChildren[]; + initialStep?: number; }) => { const stepCount = items?.filter(v => { @@ -27,7 +29,7 @@ export const FilterOptionsGroup = ({ }).length ?? 0; const childRefs = useRef<(MenuRef | null)[]>([]); - const [currentStep, setCurrentStep] = useState(0); + const [currentStep, setCurrentStep] = useState(initialStep); const handleNextStep = useCallback(() => { // Add a small delay between steps to prevent the next menu from automatically closing due to the previous menu's close event