mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 13:15:24 +02:00
fix: skip column filter when all values selected in Cosmetic Items tab
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
co-authored by
claude-flow
parent
19b02812bd
commit
d69acd5872
@@ -53,7 +53,11 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
|
|||||||
}, [data, COLUMNS]);
|
}, [data, COLUMNS]);
|
||||||
|
|
||||||
const getUniqueValues = (col: number): string[] =>
|
const getUniqueValues = (col: number): string[] =>
|
||||||
Array.from(columnUniqueValues[col] as Set<string> ?? []).sort();
|
Array.from(columnUniqueValues[col] as Set<string> ?? []).sort((a, b) => {
|
||||||
|
const na = parseFloat(a), nb = parseFloat(b);
|
||||||
|
if (!isNaN(na) && !isNaN(nb)) return na - nb;
|
||||||
|
return a.localeCompare(b);
|
||||||
|
});
|
||||||
|
|
||||||
const filteredData = useMemo(() => {
|
const filteredData = useMemo(() => {
|
||||||
let result = data.map((row, index) => ({ row, index }));
|
let result = data.map((row, index) => ({ row, index }));
|
||||||
@@ -78,6 +82,8 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
|
|||||||
(Object.entries(columnFilters) as [string, string[]][]).forEach(([colIdx, filterValues]) => {
|
(Object.entries(columnFilters) as [string, string[]][]).forEach(([colIdx, filterValues]) => {
|
||||||
if (!filterValues || filterValues.length === 0) return;
|
if (!filterValues || filterValues.length === 0) return;
|
||||||
const colNum = parseInt(colIdx);
|
const colNum = parseInt(colIdx);
|
||||||
|
const allVals = getUniqueValues(colNum);
|
||||||
|
if (filterValues.length >= allVals.length) return;
|
||||||
result = result.filter(({ row }) => {
|
result = result.filter(({ row }) => {
|
||||||
const val = String(row[colNum] ?? '');
|
const val = String(row[colNum] ?? '');
|
||||||
return filterValues.includes(val);
|
return filterValues.includes(val);
|
||||||
|
|||||||
Reference in New Issue
Block a user