Skip to content

Commit

Permalink
fix(Select): fixed onChange callback params type when valueType is ob…
Browse files Browse the repository at this point in the history
…ject(#3186) (#3193)
  • Loading branch information
l123wx authored Nov 12, 2024
1 parent 869b237 commit e3be0b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/select/_example/label-in-value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const LabelInValueSelect = () => {
valueType="object"
keys={{ label: 'text', value: 'data' }}
options={[
{ text: 'Select All', checkAll: true },
{ text: 'Apple', data: 'apple', type: 'fruit' },
{ text: 'Orange', data: 'orange', type: 'fruit' },
{ text: 'Banana', data: 'banana', type: 'fruit' },
Expand Down
6 changes: 3 additions & 3 deletions src/select/base/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ const Select = forwardRefWithStatics(
if (!multiple) {
return;
}
const selectableOptions = currentOptions
.filter((option) => !option.checkAll && !option.disabled)
.map((option) => option.value);

const values = currentOptions.filter((option) => !option.checkAll && !option.disabled)
const selectableOptions = getSelectedOptions(values, multiple, valueType, keys, tmpPropOptions)

const checkAllValue =
!checkAll && selectableOptions.length !== (props.value as Array<SelectOption>)?.length ? selectableOptions : [];
Expand Down

0 comments on commit e3be0b3

Please sign in to comment.