Skip to content

Commit

Permalink
Merge pull request #26 from Coaktion/fix/multicomplete-optional-prop
Browse files Browse the repository at this point in the history
Fix/multicomplete optional prop
  • Loading branch information
MatheusDev20 authored Apr 11, 2024
2 parents f314a79 + 1ca241a commit 58a65f7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/auto-complete-multiple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface AktAutoCompleteMultipleProps {
limitTags?: number;
iconColor?: string;
onChange: (data: any) => void;
allSelectOption: string;
allSelectOption?: string;
}

interface OptionProps {
Expand Down Expand Up @@ -55,10 +55,8 @@ const AktAutoCompleteMultiple: React.FC<AktAutoCompleteMultipleProps> = ({
const [isOpen, setIsOpen] = useState(false);

const handleChange = (value: any) => {
if (value.includes(allSelectOption)) {
// value = value.length === rows.length ? [] : rows.filter((item) => item !== allSelectOption)
if (allSelectOption && value.includes(allSelectOption)) {
value = rows.filter((item) => item !== allSelectOption);
setIsOpen(false);
}

onChange(value);
Expand Down

0 comments on commit 58a65f7

Please sign in to comment.