forked from Turbo87/sidebar-v2
-
Notifications
You must be signed in to change notification settings - Fork 70
/
index.d.ts
64 lines (47 loc) · 1.8 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// <reference types="leaflet" />
import * as L from 'leaflet';
declare module 'leaflet' {
type SidebarOptions = L.Control.SidebarOptions;
type PanelOptions = L.Control.PanelOptions;
type SidebarEvents = L.Control.SidebarEvents;
type SidebarEventHandlerFnMap = L.Control.SidebarEventHandlerFnMap;
namespace Control {
interface SidebarOptions extends Omit<L.ControlOptions, 'position'>{
container?: HTMLElement | string,
position?: 'left' | 'right',
autopan?: boolean,
closeButton?: boolean,
}
interface PanelOptions {
id: string,
tab: HTMLElement | string,
pane?: HTMLElement | string,
button?: EventListener | string,
disabled?: boolean,
position?: 'top' | 'bottom',
title?: string,
}
type SidebarEvents = 'opening' | 'closing' | 'content'
type SidebarEventHandlerFnMap = {
'opening'?: L.LeafletEventHandlerFn,
'closing'?: L.LeafletEventHandlerFn,
'content'?: L.LeafletEventHandlerFn,
}
export class Sidebar extends L.Control {
constructor(options?: SidebarOptions);
addTo(map: L.Map): this;
removeFrom(map: L.Map): this;
open(id: string): this;
close(): this;
addPanel(data: PanelOptions): this;
removePanel(id: string): this;
enablePanel(id: string): this;
disablePanel(id: string): this;
on(type: SidebarEvents, fn: L.LeafletEventHandlerFn, context?: any): this;
on(eventMap: SidebarEventHandlerFnMap): this;
}
}
namespace control {
export function sidebar(options?: Control.SidebarOptions): Control.Sidebar;
}
}