1 | import * as L from 'leaflet';
|
2 | import { ControlPosition, FeatureGroup, MarkerOptions, Map } from 'leaflet';
|
3 | import SearchElement from './SearchElement';
|
4 | import ResultList from './resultList';
|
5 | import { SearchResult } from './providers/provider';
|
6 | import { Provider } from './providers';
|
7 | interface SearchControlProps {
|
8 |
|
9 | provider: Provider;
|
10 |
|
11 | position: ControlPosition;
|
12 | |
13 |
|
14 |
|
15 |
|
16 | style: 'button' | 'bar';
|
17 | marker: MarkerOptions;
|
18 | maxMarkers: number;
|
19 | showMarker: boolean;
|
20 | showPopup: boolean;
|
21 | popupFormat<T = any>(args: {
|
22 | query: Selection;
|
23 | result: SearchResult<T>;
|
24 | }): string;
|
25 | resultFormat<T = any>(args: {
|
26 | result: SearchResult<T>;
|
27 | }): string;
|
28 | searchLabel: string;
|
29 | clearSearchLabel: string;
|
30 | notFoundMessage: string;
|
31 | messageHideDelay: number;
|
32 | animateZoom: boolean;
|
33 | zoomLevel: number;
|
34 | retainZoomLevel: boolean;
|
35 | classNames: {
|
36 | container: string;
|
37 | button: string;
|
38 | resetButton: string;
|
39 | msgbox: string;
|
40 | form: string;
|
41 | input: string;
|
42 | resultlist: string;
|
43 | item: string;
|
44 | notfound: string;
|
45 | };
|
46 | autoComplete: boolean;
|
47 | autoCompleteDelay: number;
|
48 | maxSuggestions: number;
|
49 | autoClose: boolean;
|
50 | keepResult: boolean;
|
51 | updateMap: boolean;
|
52 | }
|
53 | export declare type SearchControlOptions = Partial<SearchControlProps> & {
|
54 | provider: Provider;
|
55 | };
|
56 | interface Selection {
|
57 | query: string;
|
58 | data?: SearchResult;
|
59 | }
|
60 | interface SearchControl {
|
61 | options: Omit<SearchControlProps, 'provider'> & {
|
62 | provider?: SearchControlProps['provider'];
|
63 | };
|
64 | markers: FeatureGroup;
|
65 | searchElement: SearchElement;
|
66 | resultList: ResultList;
|
67 | classNames: SearchControlProps['classNames'];
|
68 | container: HTMLDivElement;
|
69 | input: HTMLInputElement;
|
70 | button: HTMLAnchorElement;
|
71 | resetButton: HTMLAnchorElement;
|
72 | map: Map;
|
73 | initialize(options: SearchControlProps): void;
|
74 | onSubmit(result: Selection): void;
|
75 | open(): void;
|
76 | close(): void;
|
77 | onClick(event: Event): void;
|
78 | clearResults(event?: KeyboardEvent | null, force?: boolean): void;
|
79 | autoSearch(event: KeyboardEvent): void;
|
80 | selectResult(event: KeyboardEvent): void;
|
81 | showResult(result: SearchResult, query: Selection): void;
|
82 | addMarker(result: SearchResult, selection: Selection): void;
|
83 | centerMap(result: SearchResult): void;
|
84 | closeResults(): void;
|
85 | getZoom(): number;
|
86 | onAdd(map: Map): HTMLDivElement;
|
87 | onRemove(): SearchControl;
|
88 | }
|
89 | export default function SearchControl(...options: any[]): SearchControl & L.Control;
|
90 | export {};
|