thingsboard/ui-ngx/src/typings/leaflet-extend-tb.d.ts

119 lines
3.4 KiB
TypeScript
Raw Normal View History

///
2024-01-09 10:46:16 +02:00
/// Copyright © 2016-2024 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
import { FormattedData } from '@shared/models/widget.models';
2025-01-03 19:37:04 +02:00
import L from 'leaflet';
2025-01-21 19:42:21 +02:00
import { TbMapDatasource } from '@home/components/widget/lib/maps/models/map.models';
// redeclare module, maintains compatibility with @types/leaflet
declare module 'leaflet' {
interface MarkerOptions {
2025-01-21 19:42:21 +02:00
tbMarkerData?: FormattedData<TbMapDatasource>;
}
2025-01-03 19:37:04 +02:00
interface TileLayer {
_url: string;
_getSubdomain(tilePoint: L.Coords): string;
_globalTileRange: L.Bounds;
}
2024-12-27 15:26:19 +02:00
namespace TB {
2024-12-30 19:29:15 +02:00
interface SidebarControlOptions extends ControlOptions {
container: JQuery<HTMLElement>;
paneWidth?: number;
}
class SidebarControl extends Control<SidebarControlOptions> {
constructor(options: SidebarControlOptions);
2025-01-10 18:03:40 +02:00
addPane(pane: JQuery<HTMLElement>, button: JQuery<HTMLElement>): this;
2024-12-30 19:29:15 +02:00
togglePane(pane: JQuery<HTMLElement>, button: JQuery<HTMLElement>): void;
}
interface SidebarPaneControlOptions extends ControlOptions {
sidebar: SidebarControl;
uiClass: string;
buttonTitle?: string;
paneTitle: string;
}
class SidebarPaneControl<O extends SidebarPaneControlOptions> extends Control<O> {
constructor(options: O);
onAddPane(map: Map, button: JQuery<HTMLElement>, $ui: JQuery<HTMLElement>, toggle: (e: JQuery.MouseEventBase) => void);
}
interface LayerData {
title: string;
2025-01-03 19:37:04 +02:00
attributionPrefix?: string;
2024-12-30 19:29:15 +02:00
layer: Layer;
mini: Layer;
}
interface LayersControlOptions extends SidebarPaneControlOptions {
layers: LayerData[];
}
class LayersControl extends SidebarPaneControl<LayersControlOptions> {
constructor(options: LayersControlOptions);
}
2025-01-10 18:03:40 +02:00
interface DataLayer {
toggleGroup(group: string): boolean;
}
interface GroupData {
title: string;
group: string;
enabled: boolean;
dataLayers: DataLayer[];
}
interface GroupsControlOptions extends SidebarPaneControlOptions {
groups: GroupData[];
}
class GroupsControl extends SidebarPaneControl<GroupsControlOptions> {
constructor(options: GroupsControlOptions);
}
2024-12-30 19:29:15 +02:00
function sidebar(options: SidebarControlOptions): SidebarControl;
function sidebarPane<O extends SidebarPaneControlOptions>(options: O): SidebarPaneControl<O>;
function layers(options: LayersControlOptions): LayersControl;
2025-01-03 19:37:04 +02:00
2025-01-10 18:03:40 +02:00
function groups(options: GroupsControlOptions): GroupsControl;
2025-01-03 19:37:04 +02:00
namespace TileLayer {
interface ChinaProvidersData {
[provider: string]: {
[type: string]: string;
Subdomains: string;
};
}
class ChinaProvider extends L.TileLayer {
constructor(type: string, options?: TileLayerOptions);
}
}
namespace tileLayer {
function chinaProvider(type: string, options?: TileLayerOptions): TileLayer.ChinaProvider;
}
2024-12-27 15:26:19 +02:00
}
}