@@ -229,23 +229,12 @@ export class MatTableDataSource<T, P extends MatPaginator = MatPaginator> extend
229229 * @returns Whether the filter matches against the data
230230 */
231231 filterPredicate : ( data : T , filter : string ) => boolean = ( data : T , filter : string ) : boolean => {
232- // Transform the data into a lowercase string of all property values.
233- const dataStr = Object . keys ( data as unknown as Record < string , any > )
234- . reduce ( ( currentTerm : string , key : string ) => {
235- // Use an obscure Unicode character to delimit the words in the concatenated string.
236- // This avoids matches where the values of two columns combined will match the user's query
237- // (e.g. `Flute` and `Stop` will match `Test`). The character is intended to be something
238- // that has a very low chance of being typed in by somebody in a text field. This one in
239- // particular is "White up-pointing triangle with dot" from
240- // https://en.wikipedia.org/wiki/List_of_Unicode_characters
241- return currentTerm + ( data as unknown as Record < string , any > ) [ key ] + '◬' ;
242- } , '' )
243- . toLowerCase ( ) ;
244-
245232 // Transform the filter by converting it to lowercase and removing whitespace.
246233 const transformedFilter = filter . trim ( ) . toLowerCase ( ) ;
247-
248- return dataStr . indexOf ( transformedFilter ) != - 1 ;
234+ // Loops over the values in the array and returns true if any of them match the filter string
235+ return Object . values ( data as { [ key : string ] : any } ) . some ( value =>
236+ `${ value } ` . toLowerCase ( ) . includes ( transformedFilter ) ,
237+ ) ;
249238 } ;
250239
251240 constructor ( initialData : T [ ] = [ ] ) {
0 commit comments