refactor(webapp): Accounts Select and MultiSelect components

This commit is contained in:
a.bouhuolia
2023-04-30 17:33:15 +02:00
parent 83510cfa70
commit 6f0f47f38a
13 changed files with 341 additions and 481 deletions

View File

@@ -0,0 +1,16 @@
import React from 'react';
import { MenuItem } from '@blueprintjs/core';
import { MenuItemNestedText } from '../Menu';
// Filters accounts items.
export const accountPredicate = (query, account, _index, exactMatch) => {
const normalizedTitle = account.name.toLowerCase();
const normalizedQuery = query.toLowerCase();
if (exactMatch) {
return normalizedTitle === normalizedQuery;
} else {
return `${account.code} ${normalizedTitle}`.indexOf(normalizedQuery) >= 0;
}
};