1 | import { ReactWidget } from './vdom';
|
2 | import React from 'react';
|
3 | /**
|
4 | * The class name added to the filebrowser crumbs node.
|
5 | */
|
6 | export interface IFilterBoxProps {
|
7 | /**
|
8 | * Whether to use case-sensitive search
|
9 | */
|
10 | caseSensitive?: boolean;
|
11 | /**
|
12 | * Whether the search box is disabled or not.
|
13 | */
|
14 | disabled?: boolean;
|
15 | /**
|
16 | * Whether to force a refresh.
|
17 | */
|
18 | forceRefresh?: boolean;
|
19 | /**
|
20 | * An optional initial search value.
|
21 | */
|
22 | initialQuery?: string;
|
23 | /**
|
24 | * Pass a ref to the input element
|
25 | */
|
26 | inputRef?: React.RefObject<HTMLInputElement>;
|
27 | /**
|
28 | * Optional placeholder for the search box.
|
29 | */
|
30 | placeholder?: string;
|
31 | /**
|
32 | * Whether to show a search icon in the box.
|
33 | */
|
34 | showIcon?: boolean;
|
35 | /**
|
36 | * A function to callback when filter is updated.
|
37 | */
|
38 | updateFilter: (filterFn: (item: string) => Partial<IScore> | null, query?: string) => void;
|
39 | /**
|
40 | * Whether to use the fuzzy filter.
|
41 | */
|
42 | useFuzzyFilter: boolean;
|
43 | }
|
44 | /**
|
45 | * A text match score with associated content item.
|
46 | */
|
47 | export interface IScore {
|
48 | /**
|
49 | * The numerical score for the text match.
|
50 | */
|
51 | score: number;
|
52 | /**
|
53 | * The indices of the text matches.
|
54 | */
|
55 | indices: number[] | null;
|
56 | }
|
57 | /**
|
58 | * Perform a fuzzy search on a single item.
|
59 | */
|
60 | export declare function fuzzySearch(source: string, query: string): IScore | null;
|
61 | export declare const updateFilterFunction: (value: string, useFuzzyFilter: boolean, caseSensitive?: boolean) => (item: string) => Partial<IScore> | null;
|
62 | export declare const FilterBox: (props: IFilterBoxProps) => JSX.Element;
|
63 | /**
|
64 | * A widget which hosts a input textbox to filter on file names.
|
65 | */
|
66 | export declare const FilenameSearcher: (props: IFilterBoxProps) => ReactWidget;
|