Skip to content

Commit

Permalink
fix: filterOption for transfer shouldn't depend on filterValue #39906
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Tkachev committed Dec 29, 2022
1 parent 5f40fe8 commit 2e3286e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/transfer/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class TransferList<
getFilteredItems(
dataSource: RecordType[],
filterValue: string,
filterOption: (filterText: string, item: RecordType) => boolean,
): { filteredItems: RecordType[]; filteredRenderItems: RenderedItem<RecordType>[] } {
const filteredItems: RecordType[] = [];
const filteredRenderItems: RenderedItem<RecordType>[] = [];
Expand All @@ -124,7 +125,7 @@ export default class TransferList<
const { renderedText } = renderedItem;

// Filter skip
if (filterValue && !this.matchFilter(renderedText, item)) {
if ((filterValue || filterOption) && !this.matchFilter(renderedText, item)) {
return null;
}

Expand Down Expand Up @@ -322,6 +323,7 @@ export default class TransferList<
showRemove,
pagination,
direction,
filterOption,
} = this.props;

// Custom Layout
Expand All @@ -335,7 +337,7 @@ export default class TransferList<

// ====================== Get filtered, checked item list ======================

const { filteredItems, filteredRenderItems } = this.getFilteredItems(dataSource, filterValue);
const { filteredItems, filteredRenderItems } = this.getFilteredItems(dataSource, filterValue, filterOption);

// ================================= List Body =================================

Expand Down

0 comments on commit 2e3286e

Please sign in to comment.