Skip to content

Commit 321317d

Browse files
author
Kenneth
committed
#feature: add selectFilterOptionByLabel strategy
1 parent d2f2666 commit 321317d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/molecules/Select/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from './strategies';
12
export * from './Select';
23
export * from './types';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './selectFilterOptionByLabel';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { RdSelectProps } from '../types';
2+
3+
export const selectFilterOptionByLabel: RdSelectProps['filterOption'] = (input, option) => {
4+
return (
5+
option?.props?.children?.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
6+
option?.props?.label?.toLowerCase().indexOf(input.toLowerCase()) >= 0
7+
);
8+
};

0 commit comments

Comments
 (0)