File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
packages/plugin-react/src/isMatch Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1- import { IS_ENUM_ITEM } from 'enum-plus' ;
2-
31export interface IsMatchOptions {
42 /**
53 * - **EN:** The field used for searching in the `isMatch` function, default is `label`.
@@ -23,15 +21,11 @@ export function isMatchCore(options: {
2321 text = toString ( item ) ;
2422 } else if ( typeof item === 'object' && item !== null ) {
2523 let content : unknown ;
26- if ( item [ IS_ENUM_ITEM ] ) {
27- if ( item . raw ?. [ searchField ] !== undefined ) {
28- content = translate ( item . raw [ searchField ] ) ;
29- } else if ( searchField === 'label' ) {
30- // label is not present in raw, auto fallback to key instead
31- content = item . key ;
32- } else {
33- content = item [ searchField ] ;
34- }
24+ if ( item . raw ?. [ searchField ] !== undefined ) {
25+ content = translate ( item . raw [ searchField ] ) ;
26+ } else if ( searchField === 'label' && item . key ) {
27+ // label is not present in raw, auto fallback to key instead
28+ content = item . key ;
3529 } else {
3630 content = item [ searchField ] ;
3731 }
You can’t perform that action at this time.
0 commit comments