mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
adding leaflet-groupedlayercontrol types (#39044)
* adding leaflet-groupedlayercontrol types * Adding typescript version information to index.d.ts file. * Updating formatting in types * Adding dom to libs in tsconfig * Updating formatting issues in index.d.ts file
This commit is contained in:
parent
7c2c4a1a3f
commit
dc02437227
29
types/leaflet-groupedlayercontrol/index.d.ts
vendored
Normal file
29
types/leaflet-groupedlayercontrol/index.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for leaflet-groupedlayercontrol 0.6
|
||||
// Project: https://github.com/ismyrnow/leaflet-groupedlayercontrol
|
||||
// Definitions by: Ryan Conklin <https://github.com/ryanc16>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare module 'leaflet' {
|
||||
namespace Control {
|
||||
class GroupedLayers extends Control {
|
||||
constructor(baseLayers: { [index: string]: Layer }, groupedOverlays: { [index: string]: { [index: string]: LayerGroup } }, options: GroupedLayersOptions);
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
function groupedLayers(baseLayers: { [index: string]: Layer }, groupedOverlays: { [index: string]: { [index: string]: LayerGroup } }, options: GroupedLayersOptions): Control;
|
||||
}
|
||||
|
||||
interface GroupedLayersOptions extends ControlOptions {
|
||||
/** Default: true */
|
||||
collapsed?: boolean;
|
||||
/** Default: true */
|
||||
autoZIndex?: boolean;
|
||||
exclusiveGroups?: string[];
|
||||
/** Default: false */
|
||||
groupCheckboxes?: boolean;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-groupedlayercontrol';
|
||||
|
||||
const map: L.Map = L.map('#map');
|
||||
|
||||
const baseLayers = {
|
||||
street: L.tileLayer('...')
|
||||
};
|
||||
|
||||
const groupedOverlays = {
|
||||
overlayGroup1: {
|
||||
overlay1: L.layerGroup(),
|
||||
overlay2: L.layerGroup()
|
||||
},
|
||||
overlayGroup2: {
|
||||
overlay3: L.layerGroup()
|
||||
}
|
||||
};
|
||||
|
||||
const groupedLayersOptions: L.GroupedLayersOptions = {
|
||||
position: 'topleft',
|
||||
exclusiveGroups: ['overlayGroup1', 'overlayGroup2'],
|
||||
groupCheckboxes: false
|
||||
};
|
||||
|
||||
L.control.groupedLayers(baseLayers, groupedOverlays, groupedLayersOptions).addTo(map);
|
||||
24
types/leaflet-groupedlayercontrol/tsconfig.json
Normal file
24
types/leaflet-groupedlayercontrol/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leaflet-groupedlayercontrol-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/leaflet-groupedlayercontrol/tslint.json
Normal file
1
types/leaflet-groupedlayercontrol/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user