@@ -30,18 +30,15 @@ export const textMatchesConfigSearch = (text: string, queryLower: string): boole
3030/** 行是否命中设置面板搜索(工厂行看 `title` / `desc`;`custom` 看 `keywords`;`stack` 由各行左列与右侧控件文案推导;`select` 另含选项文案) */
3131export const configRowMatchesSearchQuery = ( row : SettingRow , queryLower : string ) : boolean => {
3232 switch ( row . type ) {
33- case "custom " :
34- return row . keywords . some ( ( k ) => textMatchesConfigSearch ( k , queryLower ) ) ;
35- case "stack " :
36- return stackExtraSearchStrings ( row ) . some ( ( s ) => textMatchesConfigSearch ( s , queryLower ) ) ;
37- case "select " :
38- if (
33+ case "switch " :
34+ case "text" :
35+ case "textBlock " :
36+ case "range" :
37+ case "notebookSavePath " :
38+ return (
3939 textMatchesConfigSearch ( row . title , queryLower ) ||
4040 textMatchesConfigSearch ( row . desc , queryLower )
41- ) {
42- return true ;
43- }
44- return row . options . some ( ( o ) => textMatchesConfigSearch ( o . label , queryLower ) ) ;
41+ ) ;
4542 case "number" :
4643 if (
4744 textMatchesConfigSearch ( row . title , queryLower ) ||
@@ -53,41 +50,49 @@ export const configRowMatchesSearchQuery = (row: SettingRow, queryLower: string)
5350 return true ;
5451 }
5552 return false ;
56- case "button" :
57- return (
58- textMatchesConfigSearch ( row . title , queryLower ) ||
59- textMatchesConfigSearch ( row . desc , queryLower ) ||
60- textMatchesConfigSearch ( row . label , queryLower )
61- ) ;
62- default :
53+ case "select" :
6354 if (
6455 textMatchesConfigSearch ( row . title , queryLower ) ||
6556 textMatchesConfigSearch ( row . desc , queryLower )
6657 ) {
6758 return true ;
6859 }
69- return false ;
60+ return row . options . some ( ( o ) => textMatchesConfigSearch ( o . label , queryLower ) ) ;
61+ case "button" :
62+ return (
63+ textMatchesConfigSearch ( row . title , queryLower ) ||
64+ textMatchesConfigSearch ( row . desc , queryLower ) ||
65+ textMatchesConfigSearch ( row . label , queryLower )
66+ ) ;
67+ case "custom" :
68+ return row . keywords . some ( ( k ) => textMatchesConfigSearch ( k , queryLower ) ) ;
69+ case "stack" :
70+ return stackExtraSearchStrings ( row ) . some ( ( s ) => textMatchesConfigSearch ( s , queryLower ) ) ;
7071 }
7172} ;
7273
7374/** 从一行注册数据取出参与侧栏与内容区检索索引的字符串(`custom` 仅用 `keywords`;`stack` 由各行推导;其余含 `title` / `desc` 的行用二者) */
7475export const collectRowStringsForSearchIndex = ( row : SettingRow ) : string [ ] => {
7576 switch ( row . type ) {
76- case "custom " :
77- return [ ... row . keywords ] ;
78- case "stack " :
79- return stackExtraSearchStrings ( row ) ;
80- case "select " :
81- return [ row . title , row . desc , ... row . options . map ( ( o ) => o . label ) ] ;
77+ case "switch " :
78+ case "text" :
79+ case "textBlock " :
80+ case "range" :
81+ case "notebookSavePath " :
82+ return [ row . title , row . desc ] ;
8283 case "number" :
8384 if ( row . unit ) {
8485 return [ row . title , row . desc , row . unit ] ;
8586 }
8687 return [ row . title , row . desc ] ;
88+ case "select" :
89+ return [ row . title , row . desc , ...row . options . map ( ( o ) => o . label ) ] ;
8790 case "button" :
8891 return [ row . title , row . desc , row . label ] ;
89- default :
90- return [ row . title , row . desc ] ;
92+ case "custom" :
93+ return [ ...row . keywords ] ;
94+ case "stack" :
95+ return stackExtraSearchStrings ( row ) ;
9196 }
9297} ;
9398
0 commit comments