fix: 가나다 필터 검색어 입력 시 전체 범위 검색으로 수정

검색어 입력 시 activeFilterTab(초성/알파벳) 필터가 동시 적용되어
검색 결과가 현재 탭 내로 제한되던 문제를 수정한다.
searchText가 있으면 필터 탭을 무시하고 전체 데이터에서 검색한다.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
SeongHyun Kim 2026-03-24 18:33:47 +09:00
parent cbe3242f3a
commit 7e54940963
1 changed files with 5 additions and 5 deletions

View File

@ -799,8 +799,8 @@ function ModalDialog({ open, onOpenChange, modalConfig, title, onSelect }: Modal
);
}
// 필터 탭 (초성/알파벳) 적용
if (activeFilterTab && displayField) {
// 필터 탭 (초성/알파벳) 적용 — 검색어 입력 시에는 전체 범위에서 검색
if (activeFilterTab && displayField && !searchText.trim()) {
items = items.filter((row) => {
const val = row[displayField];
if (val == null) return false;
@ -812,9 +812,9 @@ function ModalDialog({ open, onOpenChange, modalConfig, title, onSelect }: Modal
return items;
}, [allRows, searchText, searchColumns, colsToShow, searchMode, activeFilterTab, displayField]);
// 그룹화 (필터 탭 활성화 시)
// 그룹화 (필터 탭 활성화 시, 검색어 없을 때만)
const groupedRows = useMemo(() => {
if (!activeFilterTab || !displayField) return null;
if (!activeFilterTab || !displayField || searchText.trim()) return null;
const groups = new Map<string, Record<string, unknown>[]>();
for (const row of filteredRows) {
@ -828,7 +828,7 @@ function ModalDialog({ open, onOpenChange, modalConfig, title, onSelect }: Modal
// 정렬
const sorted = [...groups.entries()].sort(([a], [b]) => a.localeCompare(b, "ko"));
return sorted;
}, [filteredRows, activeFilterTab, displayField]);
}, [filteredRows, activeFilterTab, displayField, searchText]);
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const v = e.target.value;