File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
packages/o-spreadsheet-engine/src/helpers Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,11 @@ export function toLowerCase(str: string | undefined): string {
297297 return str ? str . toLowerCase ( ) : "" ;
298298}
299299
300+ /** Removes whitespace from both ends of the string. If the string is undefined, return an empty string */
301+ export function trim ( str : string | undefined ) : string {
302+ return str ? str . trim ( ) : "" ;
303+ }
304+
300305/**
301306 * Extract the fontSize from a context font string
302307 * @param font The (context) font string to parse
Original file line number Diff line number Diff line change 11import { SpreadsheetChildEnv } from "@odoo/o-spreadsheet-engine/types/spreadsheet_env" ;
22import { Component , onWillUpdateProps , useRef , useState } from "@odoo/owl" ;
3- import { deepEquals , positions , toLowerCase } from "../../../helpers" ;
3+ import { deepEquals , positions , toLowerCase , trim } from "../../../helpers" ;
44import { fuzzyLookup } from "../../../helpers/search" ;
55import { Position } from "../../../types" ;
66import { FilterMenuValueItem } from "../filter_menu_item/filter_menu_value_item" ;
@@ -76,12 +76,12 @@ export class FilterMenuValueList extends Component<Props, SpreadsheetChildEnv> {
7676
7777 const cellValues = cells . map ( ( val ) => val . cellValue ) ;
7878 const filterValues = filterValue ?. filterType === "values" ? filterValue . hiddenValues : [ ] ;
79- const normalizedFilteredValues = new Set ( filterValues . map ( toLowerCase ) ) ;
79+ const normalizedFilteredValues = new Set ( filterValues . map ( toLowerCase ) . map ( trim ) ) ;
8080
8181 const set = new Set < string > ( ) ;
8282 const values : ( Value & { normalizedValue : string } ) [ ] = [ ] ;
8383 const addValue = ( value : string ) => {
84- const normalizedValue = toLowerCase ( value ) ;
84+ const normalizedValue = trim ( toLowerCase ( value ) ) ;
8585 if ( ! set . has ( normalizedValue ) ) {
8686 values . push ( {
8787 string : value || "" ,
You can’t perform that action at this time.
0 commit comments