Skip to content

Commit a52fd15

Browse files
committed
[IMP] Data filter: Trim whitespace
[Data filter] Trim whitespace and don't bother of caps vs low case when filtering Task:5375214
1 parent 04b8575 commit a52fd15

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/filters/filter_menu_value_list/filter_menu_value_list.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,15 @@ 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 normalize = (value: string) => {
80+
return toLowerCase(value).trim();
81+
};
82+
const normalizedFilteredValues = new Set(filterValues.map(normalize));
8083

8184
const set = new Set<string>();
8285
const values: (Value & { normalizedValue: string })[] = [];
8386
const addValue = (value: string) => {
84-
const normalizedValue = toLowerCase(value);
87+
const normalizedValue = normalize(value);
8588
if (!set.has(normalizedValue)) {
8689
values.push({
8790
string: value || "",

0 commit comments

Comments
 (0)