From 4d2e9c79a60a1981bdf232a4f2d1b3e4c7918d08 Mon Sep 17 00:00:00 2001
From: Innders <49156310+Innders@users.noreply.github.com>
Date: Wed, 4 Sep 2024 15:47:38 +0100
Subject: [PATCH] fix(Dropdown): mixed override show remove icon
---
src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx | 5 ++++-
src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx | 3 ++-
src/Dropdowns/Dropdown/Dropdown.tsx | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx b/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
index fba658d..9da679d 100644
--- a/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
+++ b/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
@@ -39,6 +39,7 @@ export interface AssigneeDropdownProps {
fullName?: string
avatarUrl?: string
isSelected?: boolean
+ isSelectedMixed?: boolean
multiSelect: boolean
onClick?: () => void
size?: number
@@ -52,6 +53,7 @@ export const AssigneeDropdownTemplate = ({
avatarUrl,
fullName,
isSelected,
+ isSelectedMixed,
multiSelect,
onClick,
size = 21,
@@ -77,7 +79,8 @@ export const AssigneeDropdownTemplate = ({
{fullName || name}
{!!error && ' (missing)'}
- {multiSelect && isSelected && }
+ {}
+ {multiSelect && (isSelected || isSelectedMixed) && }
)
}
diff --git a/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx b/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
index 131361d..42fce17 100644
--- a/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
+++ b/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
@@ -101,10 +101,11 @@ export const AssigneeSelect = forwardRef(
options={sortedOptions}
dataKey={'name'}
disabled={disabled}
- itemTemplate={(ops, isActive, isSelected) => (
+ itemTemplate={(ops, _isActive, isSelected, _index, selectedMixed) => (
(
{option.icon && }
{option[labelKey] || option[dataKey]}
{multiSelect &&
- selected?.includes(option[dataKey]) &&
+ [...selected, ...mixedSelected]?.includes(option[dataKey]) &&
selected.length > minSelected && (
)}