1
0
Fork 0
mirror of https://github.com/noerw/leaflet-sidebar-v2 synced 2025-06-30 17:30:21 +02:00
leaflet-sidebar-v2/index.d.ts
Paul 1c24f0a730 Update index.d.ts (#46)
* Update index.d.ts (fixes #45)
* Additional types for easier import
2019-12-17 17:05:55 +00:00

64 lines
1.8 KiB
TypeScript

/// <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;
}
}