mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 15:30:27 +03:00
Member drawer filter (#1457)
* save member drawer sort filter in local storage * render member drawer with key * improve member search
This commit is contained in:
parent
b4e1ced3ed
commit
50429a3513
8 changed files with 71 additions and 44 deletions
|
|
@ -17,7 +17,8 @@ export type UseAsyncSearchOptions = AsyncSearchOption & {
|
|||
};
|
||||
|
||||
export type SearchItemStrGetter<TSearchItem extends object | string | number> = (
|
||||
searchItem: TSearchItem
|
||||
searchItem: TSearchItem,
|
||||
query: string
|
||||
) => string | string[];
|
||||
|
||||
export type UseAsyncSearchResult<TSearchItem extends object | string | number> = {
|
||||
|
|
@ -38,7 +39,7 @@ export const useAsyncSearch = <TSearchItem extends object | string | number>(
|
|||
setResult(undefined);
|
||||
|
||||
const handleMatch: MatchHandler<TSearchItem> = (item, query) => {
|
||||
const itemStr = getItemStr(item);
|
||||
const itemStr = getItemStr(item, query);
|
||||
if (Array.isArray(itemStr))
|
||||
return !!itemStr.find((i) =>
|
||||
matchQuery(normalize(i, options?.normalizeOptions), query, options?.matchOptions)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue