mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 15:35:23 +02:00
debug: add console logs to trace filter state + stopPropagation on popover
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
d3675bba0b
commit
e24e3e5067
@@ -34,10 +34,13 @@ export function ColumnFilterPopover({
|
||||
const isAllSelected = selectedValues.length === uniqueValues.length && uniqueValues.length > 0;
|
||||
|
||||
return (
|
||||
<div className={cn(
|
||||
"absolute top-full left-0 mt-1 w-64 bg-slate-800 border border-slate-700 rounded-lg shadow-2xl z-50 p-3 flex flex-col gap-3 animate-in fade-in zoom-in-95 duration-100",
|
||||
className
|
||||
)}>
|
||||
<div
|
||||
className={cn(
|
||||
"absolute top-full left-0 mt-1 w-64 bg-slate-800 border border-slate-700 rounded-lg shadow-2xl z-50 p-3 flex flex-col gap-3 animate-in fade-in zoom-in-95 duration-100",
|
||||
className
|
||||
)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{title && <div className="text-[10px] font-bold text-slate-500 uppercase tracking-wider px-1">{title}</div>}
|
||||
|
||||
<div className="relative">
|
||||
|
||||
@@ -64,6 +64,7 @@ export function ProductDescriptions({ data, onEdit, rowStatuses }: ProductDescri
|
||||
if (licenseFilter) result = result.filter(r => r.row[COLUMNS.LICENSE] === licenseFilter);
|
||||
|
||||
// Column-specific filters (Excel-like)
|
||||
console.log('[Filter] applying columnFilters:', columnFilters, 'result count before:', result.length);
|
||||
Object.entries(columnFilters).forEach(([colIdx, selectedValues]) => {
|
||||
const col = Number(colIdx);
|
||||
const vals = selectedValues as string[];
|
||||
@@ -77,7 +78,12 @@ export function ProductDescriptions({ data, onEdit, rowStatuses }: ProductDescri
|
||||
});
|
||||
} else {
|
||||
// For other columns, use regular value matching
|
||||
result = result.filter(r => vals.includes(String(r.row[col] || '')));
|
||||
const before = result.length;
|
||||
result = result.filter(r => {
|
||||
const cellVal = String(r.row[col] ?? '').trim();
|
||||
return vals.some(v => v.trim() === cellVal);
|
||||
});
|
||||
console.log('[Filter] col', col, 'vals', vals, 'before:', before, 'after:', result.length);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -121,12 +127,15 @@ export function ProductDescriptions({ data, onEdit, rowStatuses }: ProductDescri
|
||||
};
|
||||
|
||||
const toggleColumnFilter = (col: number, value: string) => {
|
||||
console.log('[Filter] toggleColumnFilter called, col:', col, 'value:', JSON.stringify(value));
|
||||
setColumnFilters(prev => {
|
||||
const current = prev[col] || [];
|
||||
const next = current.includes(value)
|
||||
? current.filter(v => v !== value)
|
||||
: [...current, value];
|
||||
return { ...prev, [col]: next };
|
||||
const updated = { ...prev, [col]: next };
|
||||
console.log('[Filter] new columnFilters:', updated);
|
||||
return updated;
|
||||
});
|
||||
setPage(1);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user