mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13:15:24 +02:00
feat: bulk ASIN selection via space-separated paste in filters
Allow pasting multiple ASINs separated by spaces in any MultiSelectDropdown search field and pressing Enter to auto-select all matching options. Also switch ads CSV/Excel parsing to header-based column mapping for robustness across different file formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
69eafe8335
commit
487b8e105e
@@ -181,7 +181,20 @@ const MultiSelectDropdown: React.FC<MultiSelectDropdownProps> = ({ label, select
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
if (filteredOptions.length > 0) {
|
||||
// Check if input contains multiple space-separated terms (bulk paste)
|
||||
const terms = searchTerm.trim().split(/\s+/).filter(Boolean);
|
||||
if (terms.length > 1) {
|
||||
// Bulk select: match each term against options (case-insensitive)
|
||||
const termsLower = terms.map(t => t.toLowerCase());
|
||||
const matched = options.filter(opt =>
|
||||
termsLower.some(t => opt.toLowerCase() === t || opt.toLowerCase().includes(t))
|
||||
);
|
||||
if (matched.length > 0) {
|
||||
onChange(Array.from(new Set([...selected, ...matched])));
|
||||
}
|
||||
setIsOpen(false);
|
||||
setSearchTerm('');
|
||||
} else if (filteredOptions.length > 0) {
|
||||
const allSelected = filteredOptions.every(opt => selected.includes(opt));
|
||||
if (allSelected) {
|
||||
// Deselect all filtered
|
||||
|
||||
Reference in New Issue
Block a user