@asymmetrik/ngx-leaflet
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -84,2 +84,9 @@ 'use strict'; | ||
// Add source maps for dependencies | ||
{ | ||
test: /node_modules\/*\.js$/, | ||
loader: 'source-map-loader', | ||
enforce: 'pre' | ||
}, | ||
// CSS loader | ||
@@ -86,0 +93,0 @@ { test: /\.css$/, loaders: [ 'style-loader', 'css-loader' ] }, |
@@ -1,12 +0,12 @@ | ||
/*! @asymmetrik/ngx-leaflet - 2.3.1 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved. + */ | ||
/*! @asymmetrik/ngx-leaflet - 2.4.0 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved. + */ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('leaflet')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'leaflet'], factory) : | ||
(factory((global.ngxLeaflet = global.ngxLeaflet || {}),global.ng.core,global.L)); | ||
}(this, (function (exports,_angular_core,L$1) { 'use strict'; | ||
(factory((global.ngxLeaflet = {}),global.ng.core,global.L)); | ||
}(this, (function (exports,core,L) { 'use strict'; | ||
var LeafletDirective = (function () { | ||
var LeafletDirective = /** @class */ (function () { | ||
function LeafletDirective(el) { | ||
this.DEFAULT_ZOOM = 1; | ||
this.DEFAULT_CENTER = L$1.latLng([38.907192, -77.036871]); | ||
this.DEFAULT_CENTER = L.latLng([38.907192, -77.036871]); | ||
this.DEFAULT_FPZ_OPTIONS = {}; | ||
@@ -20,3 +20,3 @@ this.fitBoundsOptions = this.DEFAULT_FPZ_OPTIONS; | ||
// Configure callback function for the map | ||
this.mapReady = new _angular_core.EventEmitter(); | ||
this.mapReady = new core.EventEmitter(); | ||
this.element = el; | ||
@@ -26,3 +26,3 @@ } | ||
// Create the map with some reasonable defaults | ||
this.map = L$1.map(this.element.nativeElement, this.options); | ||
this.map = L.map(this.element.nativeElement, this.options); | ||
// Only setView if there is a center/zoom | ||
@@ -123,27 +123,27 @@ if (null != this.center && null != this.zoom) { | ||
}; | ||
LeafletDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[leaflet]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletDirective.ctorParameters = function () { return [ | ||
{ type: core.ElementRef, }, | ||
]; }; | ||
LeafletDirective.propDecorators = { | ||
'fitBoundsOptions': [{ type: core.Input, args: ['leafletFitBoundsOptions',] },], | ||
'panOptions': [{ type: core.Input, args: ['leafletPanOptions',] },], | ||
'zoomOptions': [{ type: core.Input, args: ['leafletZoomOptions',] },], | ||
'zoomPanOptions': [{ type: core.Input, args: ['leafletZoomPanOptions',] },], | ||
'options': [{ type: core.Input, args: ['leafletOptions',] },], | ||
'mapReady': [{ type: core.Output, args: ['leafletMapReady',] },], | ||
'zoom': [{ type: core.Input, args: ['leafletZoom',] },], | ||
'center': [{ type: core.Input, args: ['leafletCenter',] },], | ||
'fitBounds': [{ type: core.Input, args: ['leafletFitBounds',] },], | ||
'onResize': [{ type: core.HostListener, args: ['window:resize', [],] },], | ||
}; | ||
return LeafletDirective; | ||
}()); | ||
LeafletDirective.decorators = [ | ||
{ type: _angular_core.Directive, args: [{ | ||
selector: '[leaflet]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletDirective.ctorParameters = function () { return [ | ||
{ type: _angular_core.ElementRef, }, | ||
]; }; | ||
LeafletDirective.propDecorators = { | ||
'fitBoundsOptions': [{ type: _angular_core.Input, args: ['leafletFitBoundsOptions',] },], | ||
'panOptions': [{ type: _angular_core.Input, args: ['leafletPanOptions',] },], | ||
'zoomOptions': [{ type: _angular_core.Input, args: ['leafletZoomOptions',] },], | ||
'zoomPanOptions': [{ type: _angular_core.Input, args: ['leafletZoomPanOptions',] },], | ||
'options': [{ type: _angular_core.Input, args: ['leafletOptions',] },], | ||
'mapReady': [{ type: _angular_core.Output, args: ['leafletMapReady',] },], | ||
'zoom': [{ type: _angular_core.Input, args: ['leafletZoom',] },], | ||
'center': [{ type: _angular_core.Input, args: ['leafletCenter',] },], | ||
'fitBounds': [{ type: _angular_core.Input, args: ['leafletFitBounds',] },], | ||
'onResize': [{ type: _angular_core.HostListener, args: ['window:resize', [],] },], | ||
}; | ||
var LeafletDirectiveWrapper = (function () { | ||
var LeafletDirectiveWrapper = /** @class */ (function () { | ||
function LeafletDirectiveWrapper(leafletDirective) { | ||
@@ -176,3 +176,3 @@ this.leafletDirective = leafletDirective; | ||
*/ | ||
var LeafletLayersDirective = (function () { | ||
var LeafletLayersDirective = /** @class */ (function () { | ||
function LeafletLayersDirective(leafletDirective, differs) { | ||
@@ -225,19 +225,19 @@ this.differs = differs; | ||
}; | ||
LeafletLayersDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[leafletLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: core.IterableDiffers, }, | ||
]; }; | ||
LeafletLayersDirective.propDecorators = { | ||
'layers': [{ type: core.Input, args: ['leafletLayers',] },], | ||
}; | ||
return LeafletLayersDirective; | ||
}()); | ||
LeafletLayersDirective.decorators = [ | ||
{ type: _angular_core.Directive, args: [{ | ||
selector: '[leafletLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: _angular_core.IterableDiffers, }, | ||
]; }; | ||
LeafletLayersDirective.propDecorators = { | ||
'layers': [{ type: _angular_core.Input, args: ['leafletLayers',] },], | ||
}; | ||
var LeafletControlLayersChanges = (function () { | ||
var LeafletControlLayersChanges = /** @class */ (function () { | ||
function LeafletControlLayersChanges() { | ||
@@ -254,3 +254,3 @@ this.layersRemoved = 0; | ||
var LeafletControlLayersWrapper = (function () { | ||
var LeafletControlLayersWrapper = /** @class */ (function () { | ||
function LeafletControlLayersWrapper() { | ||
@@ -264,3 +264,3 @@ } | ||
var overlays = controlConfig.overlays || {}; | ||
this.layersControl = L$1.control.layers(baseLayers, overlays, controlOptions); | ||
this.layersControl = L.control.layers(baseLayers, overlays, controlOptions); | ||
return this.layersControl; | ||
@@ -305,3 +305,3 @@ }; | ||
var LeafletControlLayersConfig = (function () { | ||
var LeafletControlLayersConfig = /** @class */ (function () { | ||
function LeafletControlLayersConfig() { | ||
@@ -324,3 +324,3 @@ this.baseLayers = {}; | ||
*/ | ||
var LeafletLayersControlDirective = (function () { | ||
var LeafletLayersControlDirective = /** @class */ (function () { | ||
function LeafletLayersControlDirective(leafletDirective, differs) { | ||
@@ -385,20 +385,20 @@ this.differs = differs; | ||
}; | ||
LeafletLayersControlDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[leafletLayersControl]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersControlDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: core.KeyValueDiffers, }, | ||
]; }; | ||
LeafletLayersControlDirective.propDecorators = { | ||
'layersControlConfig': [{ type: core.Input, args: ['leafletLayersControl',] },], | ||
'layersControlOptions': [{ type: core.Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
return LeafletLayersControlDirective; | ||
}()); | ||
LeafletLayersControlDirective.decorators = [ | ||
{ type: _angular_core.Directive, args: [{ | ||
selector: '[leafletLayersControl]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersControlDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: _angular_core.KeyValueDiffers, }, | ||
]; }; | ||
LeafletLayersControlDirective.propDecorators = { | ||
'layersControlConfig': [{ type: _angular_core.Input, args: ['leafletLayersControl',] },], | ||
'layersControlOptions': [{ type: _angular_core.Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
var LeafletUtil = (function () { | ||
var LeafletUtil = /** @class */ (function () { | ||
function LeafletUtil() { | ||
@@ -429,3 +429,3 @@ } | ||
*/ | ||
var LeafletBaseLayersDirective = (function () { | ||
var LeafletBaseLayersDirective = /** @class */ (function () { | ||
function LeafletBaseLayersDirective(leafletDirective, differs) { | ||
@@ -481,3 +481,3 @@ this.differs = differs; | ||
map$$1.eachLayer(function (l) { | ||
foundLayer = layers.find(function (bl) { return l === bl; }); | ||
foundLayer = layers.find(function (bl) { return (l === bl); }); | ||
}); | ||
@@ -497,20 +497,20 @@ // Did we find the layer? | ||
}; | ||
LeafletBaseLayersDirective.decorators = [ | ||
{ type: core.Directive, args: [{ | ||
selector: '[leafletBaseLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletBaseLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: core.KeyValueDiffers, }, | ||
]; }; | ||
LeafletBaseLayersDirective.propDecorators = { | ||
'baseLayers': [{ type: core.Input, args: ['leafletBaseLayers',] },], | ||
'layersControlOptions': [{ type: core.Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
return LeafletBaseLayersDirective; | ||
}()); | ||
LeafletBaseLayersDirective.decorators = [ | ||
{ type: _angular_core.Directive, args: [{ | ||
selector: '[leafletBaseLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletBaseLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: _angular_core.KeyValueDiffers, }, | ||
]; }; | ||
LeafletBaseLayersDirective.propDecorators = { | ||
'baseLayers': [{ type: _angular_core.Input, args: ['leafletBaseLayers',] },], | ||
'layersControlOptions': [{ type: _angular_core.Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
var LeafletModule = (function () { | ||
var LeafletModule = /** @class */ (function () { | ||
function LeafletModule() { | ||
@@ -521,24 +521,24 @@ } | ||
}; | ||
LeafletModule.decorators = [ | ||
{ type: core.NgModule, args: [{ | ||
exports: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
], | ||
declarations: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletModule.ctorParameters = function () { return []; }; | ||
return LeafletModule; | ||
}()); | ||
LeafletModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{ | ||
exports: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
], | ||
declarations: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletModule.ctorParameters = function () { return []; }; | ||
var LeafletTileLayerDefinition = (function () { | ||
var LeafletTileLayerDefinition = /** @class */ (function () { | ||
function LeafletTileLayerDefinition(type, url, options) { | ||
@@ -545,0 +545,0 @@ this.type = type; |
@@ -1,2 +0,121 @@ | ||
/*! @asymmetrik/ngx-leaflet - 2.3.1 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved. + */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("leaflet")):"function"==typeof define&&define.amd?define(["exports","@angular/core","leaflet"],t):t(e.ngxLeaflet=e.ngxLeaflet||{},e.ng.core,e.L)}(this,function(e,t,r){"use strict";var n=function(){function e(e){this.DEFAULT_ZOOM=1,this.DEFAULT_CENTER=r.latLng([38.907192,-77.036871]),this.DEFAULT_FPZ_OPTIONS={},this.fitBoundsOptions=this.DEFAULT_FPZ_OPTIONS,this.panOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomPanOptions=this.DEFAULT_FPZ_OPTIONS,this.options={},this.mapReady=new t.EventEmitter,this.element=e}return e.prototype.ngOnInit=function(){this.map=r.map(this.element.nativeElement,this.options),null!=this.center&&null!=this.zoom&&this.setView(this.center,this.zoom),null!=this.fitBounds&&this.setFitBounds(this.fitBounds),this.doResize(),this.mapReady.emit(this.map)},e.prototype.ngOnChanges=function(e){e.zoom&&e.center&&null!=this.zoom&&null!=this.center?this.setView(e.center.currentValue,e.zoom.currentValue):e.zoom?this.setZoom(e.zoom.currentValue):e.center&&this.setCenter(e.center.currentValue),e.fitBounds&&this.setFitBounds(e.fitBounds.currentValue)},e.prototype.getMap=function(){return this.map},e.prototype.onResize=function(){this.delayResize()},e.prototype.doResize=function(){this.map.invalidateSize({})},e.prototype.delayResize=function(){null!=this.resizeTimer&&clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.doResize.bind(this),200)},e.prototype.setView=function(e,t){this.map&&null!=e&&null!=t&&this.map.setView(e,t,this.zoomPanOptions)},e.prototype.setZoom=function(e){this.map&&null!=e&&this.map.setZoom(e,this.zoomOptions)},e.prototype.setCenter=function(e){this.map&&null!=e&&this.map.panTo(e,this.panOptions)},e.prototype.setFitBounds=function(e){this.map&&null!=e&&this.map.fitBounds(e,this.fitBoundsOptions)},e}();n.decorators=[{type:t.Directive,args:[{selector:"[leaflet]"}]}],n.ctorParameters=function(){return[{type:t.ElementRef}]},n.propDecorators={fitBoundsOptions:[{type:t.Input,args:["leafletFitBoundsOptions"]}],panOptions:[{type:t.Input,args:["leafletPanOptions"]}],zoomOptions:[{type:t.Input,args:["leafletZoomOptions"]}],zoomPanOptions:[{type:t.Input,args:["leafletZoomPanOptions"]}],options:[{type:t.Input,args:["leafletOptions"]}],mapReady:[{type:t.Output,args:["leafletMapReady"]}],zoom:[{type:t.Input,args:["leafletZoom"]}],center:[{type:t.Input,args:["leafletCenter"]}],fitBounds:[{type:t.Input,args:["leafletFitBounds"]}],onResize:[{type:t.HostListener,args:["window:resize",[]]}]};var i=function(){function e(e){this.leafletDirective=e}return e.prototype.init=function(){},e.prototype.getMap=function(){return this.leafletDirective.getMap()},e}(),s=function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.layersDiffer=this.differs.find([]).create()}return Object.defineProperty(e.prototype,"layers",{get:function(){return this.layersValue},set:function(e){this.layersValue=e,this.updateLayers()},enumerable:!0,configurable:!0}),e.prototype.ngDoCheck=function(){this.updateLayers()},e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.updateLayers()},e.prototype.updateLayers=function(){var e=this.leafletDirective.getMap();if(null!=e&&null!=this.layersDiffer){var t=this.layersDiffer.diff(this.layersValue);null!=t&&(t.forEachRemovedItem(function(t){e.removeLayer(t.item)}),t.forEachAddedItem(function(t){e.addLayer(t.item)}))}},e}();s.decorators=[{type:t.Directive,args:[{selector:"[leafletLayers]"}]}],s.ctorParameters=function(){return[{type:n},{type:t.IterableDiffers}]},s.propDecorators={layers:[{type:t.Input,args:["leafletLayers"]}]};var o=function(){function e(){this.layersRemoved=0,this.layersChanged=0,this.layersAdded=0}return e.prototype.changed=function(){return!(0===this.layersRemoved&&0===this.layersChanged&&0===this.layersAdded)},e}(),a=function(){function e(){}return e.prototype.getLayersControl=function(){return this.layersControl},e.prototype.init=function(e,t){var n=e.baseLayers||{},i=e.overlays||{};return this.layersControl=r.control.layers(n,i,t),this.layersControl},e.prototype.applyBaseLayerChanges=function(e){var t=new o;return null!=this.layersControl&&(t=this.applyChanges(e,this.layersControl.addBaseLayer)),t},e.prototype.applyOverlayChanges=function(e){var t=new o;return null!=this.layersControl&&(t=this.applyChanges(e,this.layersControl.addOverlay)),t},e.prototype.applyChanges=function(e,t){var r=this,n=new o;return null!=e&&(e.forEachChangedItem(function(e){r.layersControl.removeLayer(e.previousValue),t.call(r.layersControl,e.currentValue,e.key),n.layersChanged++}),e.forEachRemovedItem(function(e){r.layersControl.removeLayer(e.currentValue),n.layersRemoved++}),e.forEachAddedItem(function(e){t.call(r.layersControl,e.currentValue,e.key),n.layersAdded++})),n},e}(),l=function(){function e(){this.baseLayers={},this.overlays={}}return e}(),u=function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.controlLayers=new a,this.baseLayersDiffer=this.differs.find({}).create(),this.overlaysDiffer=this.differs.find({}).create()}return Object.defineProperty(e.prototype,"layersControlConfig",{get:function(){return this.layersControlConfigValue},set:function(e){null==e&&(e=new l),null==e.baseLayers&&(e.baseLayers={}),null==e.overlays&&(e.overlays={}),this.layersControlConfigValue=e,this.updateLayers()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.controlLayers.init({},this.layersControlOptions).addTo(this.leafletDirective.getMap()),this.updateLayers()},e.prototype.ngDoCheck=function(){this.updateLayers()},e.prototype.updateLayers=function(){var e=this.leafletDirective.getMap(),t=this.controlLayers.getLayersControl();if(null!=e&&null!=t){if(null!=this.baseLayersDiffer&&null!=this.layersControlConfigValue.baseLayers){var r=this.baseLayersDiffer.diff(this.layersControlConfigValue.baseLayers);this.controlLayers.applyBaseLayerChanges(r)}if(null!=this.overlaysDiffer&&null!=this.layersControlConfigValue.overlays){var r=this.overlaysDiffer.diff(this.layersControlConfigValue.overlays);this.controlLayers.applyOverlayChanges(r)}}},e}();u.decorators=[{type:t.Directive,args:[{selector:"[leafletLayersControl]"}]}],u.ctorParameters=function(){return[{type:n},{type:t.KeyValueDiffers}]},u.propDecorators={layersControlConfig:[{type:t.Input,args:["leafletLayersControl"]}],layersControlOptions:[{type:t.Input,args:["leafletLayersControlOptions"]}]};var p=function(){function e(){}return e.mapToArray=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t},e}(),f=function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.controlLayers=new a,this.baseLayersDiffer=this.differs.find({}).create()}return Object.defineProperty(e.prototype,"baseLayers",{get:function(){return this.baseLayersValue},set:function(e){this.baseLayersValue=e,this.updateBaseLayers()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.controlLayers.init({},this.layersControlOptions).addTo(this.leafletDirective.getMap()),this.updateBaseLayers()},e.prototype.ngDoCheck=function(){this.updateBaseLayers()},e.prototype.updateBaseLayers=function(){var e=this.leafletDirective.getMap(),t=this.controlLayers.getLayersControl();if(null!=e&&null!=t&&null!=this.baseLayersDiffer){var r=this.baseLayersDiffer.diff(this.baseLayersValue);this.controlLayers.applyBaseLayerChanges(r).changed()&&this.syncBaseLayer()}},e.prototype.syncBaseLayer=function(){var e,t=this.leafletDirective.getMap(),r=p.mapToArray(this.baseLayers);t.eachLayer(function(t){e=r.find(function(e){return t===e})}),null!=e?this.baseLayer=e:r.length>0&&(this.baseLayer=r[0],this.baseLayer.addTo(t))},e}();f.decorators=[{type:t.Directive,args:[{selector:"[leafletBaseLayers]"}]}],f.ctorParameters=function(){return[{type:n},{type:t.KeyValueDiffers}]},f.propDecorators={baseLayers:[{type:t.Input,args:["leafletBaseLayers"]}],layersControlOptions:[{type:t.Input,args:["leafletLayersControlOptions"]}]};var y=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e}();y.decorators=[{type:t.NgModule,args:[{exports:[n,s,u,f],declarations:[n,s,u,f]}]}],y.ctorParameters=function(){return[]};var c=function(){function e(e,t,r){this.type=e,this.url=t,this.options=r}return e.createTileLayer=function(e){var t;switch(e.type){case"xyz":t=L.tileLayer(e.url,e.options);break;case"wms":default:t=L.tileLayer.wms(e.url,e.options)}return t},e.createTileLayers=function(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e.createTileLayer(t[n]));return r},e.prototype.createTileLayer=function(){return e.createTileLayer(this)},e}();e.LeafletModule=y,e.LeafletDirective=n,e.LeafletDirectiveWrapper=i,e.LeafletTileLayerDefinition=c,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
/*! @asymmetrik/ngx-leaflet - 2.4.0 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved. + */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("leaflet")):"function"==typeof define&&define.amd?define(["exports","@angular/core","leaflet"],t):t(e.ngxLeaflet={},e.ng.core,e.L)}(this,function(e,t,r){"use strict";var n=/** @class */function(){function e(e){this.DEFAULT_ZOOM=1,this.DEFAULT_CENTER=r.latLng([38.907192,-77.036871]),this.DEFAULT_FPZ_OPTIONS={},this.fitBoundsOptions=this.DEFAULT_FPZ_OPTIONS,this.panOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomPanOptions=this.DEFAULT_FPZ_OPTIONS, | ||
// Default configuration | ||
this.options={}, | ||
// Configure callback function for the map | ||
this.mapReady=new t.EventEmitter,this.element=e}/** | ||
* Resize the map to fit it's parent container | ||
*/ | ||
/** | ||
* Manage a delayed resize of the component | ||
*/ | ||
/** | ||
* Set the view (center/zoom) all at once | ||
* @param center The new center | ||
* @param zoom The new zoom level | ||
*/ | ||
/** | ||
* Set the map zoom level | ||
* @param zoom the new zoom level for the map | ||
*/ | ||
/** | ||
* Set the center of the map | ||
* @param center the center point | ||
*/ | ||
/** | ||
* Fit the map to the bounds | ||
* @param center the center point | ||
*/ | ||
/** @nocollapse */ | ||
return e.prototype.ngOnInit=function(){ | ||
// Create the map with some reasonable defaults | ||
this.map=r.map(this.element.nativeElement,this.options), | ||
// Only setView if there is a center/zoom | ||
null!=this.center&&null!=this.zoom&&this.setView(this.center,this.zoom), | ||
// Set up all the initial settings | ||
null!=this.fitBounds&&this.setFitBounds(this.fitBounds),this.doResize(), | ||
// Fire map ready event | ||
this.mapReady.emit(this.map)},e.prototype.ngOnChanges=function(e){/* | ||
* The following code is to address an issue with our (basic) implementation of | ||
* zooming and panning. From our testing, it seems that a pan operation followed | ||
* by a zoom operation in the same thread will interfere with eachother. The zoom | ||
* operation interrupts/cancels the pan, resulting in a final center point that is | ||
* inaccurate. The solution seems to be to either separate them with a timeout or | ||
* to collapse them into a setView call. | ||
*/ | ||
// Zooming and Panning | ||
e.zoom&&e.center&&null!=this.zoom&&null!=this.center?this.setView(e.center.currentValue,e.zoom.currentValue):e.zoom?this.setZoom(e.zoom.currentValue):e.center&&this.setCenter(e.center.currentValue), | ||
// Fit bounds | ||
e.fitBounds&&this.setFitBounds(e.fitBounds.currentValue)},e.prototype.getMap=function(){return this.map},e.prototype.onResize=function(){this.delayResize()},e.prototype.doResize=function(){ | ||
// Invalidate the map size to trigger it to update itself | ||
this.map.invalidateSize({})},e.prototype.delayResize=function(){null!=this.resizeTimer&&clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.doResize.bind(this),200)},e.prototype.setView=function(e,t){this.map&&null!=e&&null!=t&&this.map.setView(e,t,this.zoomPanOptions)},e.prototype.setZoom=function(e){this.map&&null!=e&&this.map.setZoom(e,this.zoomOptions)},e.prototype.setCenter=function(e){this.map&&null!=e&&this.map.panTo(e,this.panOptions)},e.prototype.setFitBounds=function(e){this.map&&null!=e&&this.map.fitBounds(e,this.fitBoundsOptions)},e.decorators=[{type:t.Directive,args:[{selector:"[leaflet]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef}]},e.propDecorators={fitBoundsOptions:[{type:t.Input,args:["leafletFitBoundsOptions"]}],panOptions:[{type:t.Input,args:["leafletPanOptions"]}],zoomOptions:[{type:t.Input,args:["leafletZoomOptions"]}],zoomPanOptions:[{type:t.Input,args:["leafletZoomPanOptions"]}],options:[{type:t.Input,args:["leafletOptions"]}],mapReady:[{type:t.Output,args:["leafletMapReady"]}],zoom:[{type:t.Input,args:["leafletZoom"]}],center:[{type:t.Input,args:["leafletCenter"]}],fitBounds:[{type:t.Input,args:["leafletFitBounds"]}],onResize:[{type:t.HostListener,args:["window:resize",[]]}]},e}(),i=/** @class */function(){function e(e){this.leafletDirective=e}return e.prototype.init=function(){},e.prototype.getMap=function(){return this.leafletDirective.getMap()},e}(),s=/** @class */function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.layersDiffer=this.differs.find([]).create()}/** | ||
* Update the state of the layers. | ||
* We use an iterable differ to synchronize the map layers with the state of the bound layers array. | ||
* This is important because it allows us to react to changes to the contents of the array as well | ||
* as changes to the actual array instance. | ||
*/ | ||
/** @nocollapse */ | ||
return Object.defineProperty(e.prototype,"layers",{get:function(){return this.layersValue}, | ||
// Set/get the layers | ||
set:function(e){this.layersValue=e, | ||
// Now that we have a differ, do an immediate layer update | ||
this.updateLayers()},enumerable:!0,configurable:!0}),e.prototype.ngDoCheck=function(){this.updateLayers()},e.prototype.ngOnInit=function(){ | ||
// Init the map | ||
this.leafletDirective.init(), | ||
// Update layers once the map is ready | ||
this.updateLayers()},e.prototype.updateLayers=function(){var e=this.leafletDirective.getMap();if(null!=e&&null!=this.layersDiffer){var t=this.layersDiffer.diff(this.layersValue);null!=t&&(t.forEachRemovedItem(function(t){e.removeLayer(t.item)}),t.forEachAddedItem(function(t){e.addLayer(t.item)}))}},e.decorators=[{type:t.Directive,args:[{selector:"[leafletLayers]"}]}],e.ctorParameters=function(){return[{type:n},{type:t.IterableDiffers}]},e.propDecorators={layers:[{type:t.Input,args:["leafletLayers"]}]},e}(),o=/** @class */function(){function e(){this.layersRemoved=0,this.layersChanged=0,this.layersAdded=0}return e.prototype.changed=function(){return!(0===this.layersRemoved&&0===this.layersChanged&&0===this.layersAdded)},e}(),a=/** @class */function(){function e(){}return e.prototype.getLayersControl=function(){return this.layersControl},e.prototype.init=function(e,t){var n=e.baseLayers||{},i=e.overlays||{};return this.layersControl=r.control.layers(n,i,t),this.layersControl},e.prototype.applyBaseLayerChanges=function(e){var t=new o;return null!=this.layersControl&&(t=this.applyChanges(e,this.layersControl.addBaseLayer)),t},e.prototype.applyOverlayChanges=function(e){var t=new o;return null!=this.layersControl&&(t=this.applyChanges(e,this.layersControl.addOverlay)),t},e.prototype.applyChanges=function(e,t){var r=this,n=new o;return null!=e&&(e.forEachChangedItem(function(e){r.layersControl.removeLayer(e.previousValue),t.call(r.layersControl,e.currentValue,e.key),n.layersChanged++}),e.forEachRemovedItem(function(e){r.layersControl.removeLayer(e.currentValue),n.layersRemoved++}),e.forEachAddedItem(function(e){t.call(r.layersControl,e.currentValue,e.key),n.layersAdded++})),n},e}(),l=/** @class */function(){return function(){this.baseLayers={},this.overlays={}}}(),u=/** @class */function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.controlLayers=new a, | ||
// Generate differs | ||
this.baseLayersDiffer=this.differs.find({}).create(),this.overlaysDiffer=this.differs.find({}).create()}/** @nocollapse */ | ||
return Object.defineProperty(e.prototype,"layersControlConfig",{get:function(){return this.layersControlConfigValue},set:function(e){ | ||
// Validation/init stuff | ||
null==e&&(e=new l),null==e.baseLayers&&(e.baseLayers={}),null==e.overlays&&(e.overlays={}), | ||
// Store the value | ||
this.layersControlConfigValue=e, | ||
// Update the map | ||
this.updateLayers()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){ | ||
// Init the map | ||
this.leafletDirective.init(), | ||
// Set up all the initial settings | ||
this.controlLayers.init({},this.layersControlOptions).addTo(this.leafletDirective.getMap()),this.updateLayers()},e.prototype.ngDoCheck=function(){this.updateLayers()},e.prototype.updateLayers=function(){var e=this.leafletDirective.getMap(),t=this.controlLayers.getLayersControl();if(null!=e&&null!=t){ | ||
// Run the baselayers differ | ||
if(null!=this.baseLayersDiffer&&null!=this.layersControlConfigValue.baseLayers){r=this.baseLayersDiffer.diff(this.layersControlConfigValue.baseLayers);this.controlLayers.applyBaseLayerChanges(r)} | ||
// Run the overlays differ | ||
if(null!=this.overlaysDiffer&&null!=this.layersControlConfigValue.overlays){var r=this.overlaysDiffer.diff(this.layersControlConfigValue.overlays);this.controlLayers.applyOverlayChanges(r)}}},e.decorators=[{type:t.Directive,args:[{selector:"[leafletLayersControl]"}]}],e.ctorParameters=function(){return[{type:n},{type:t.KeyValueDiffers}]},e.propDecorators={layersControlConfig:[{type:t.Input,args:["leafletLayersControl"]}],layersControlOptions:[{type:t.Input,args:["leafletLayersControlOptions"]}]},e}(),p=/** @class */function(){function e(){}return e.mapToArray=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t},e}(),f=/** @class */function(){function e(e,t){this.differs=t,this.leafletDirective=new i(e),this.controlLayers=new a,this.baseLayersDiffer=this.differs.find({}).create()}/** | ||
* Check the current base layer and change it to the new one if necessary | ||
*/ | ||
/** @nocollapse */ | ||
return Object.defineProperty(e.prototype,"baseLayers",{get:function(){return this.baseLayersValue}, | ||
// Set/get baseLayers | ||
set:function(e){this.baseLayersValue=e,this.updateBaseLayers()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){ | ||
// Init the map | ||
this.leafletDirective.init(), | ||
// Initially configure the controlLayers | ||
this.controlLayers.init({},this.layersControlOptions).addTo(this.leafletDirective.getMap()),this.updateBaseLayers()},e.prototype.ngDoCheck=function(){this.updateBaseLayers()},e.prototype.updateBaseLayers=function(){var e=this.leafletDirective.getMap(),t=this.controlLayers.getLayersControl();if(null!=e&&null!=t&&null!=this.baseLayersDiffer){var r=this.baseLayersDiffer.diff(this.baseLayersValue);this.controlLayers.applyBaseLayerChanges(r).changed()&&this.syncBaseLayer()}},e.prototype.syncBaseLayer=function(){var e,t=this.leafletDirective.getMap(),r=p.mapToArray(this.baseLayers); | ||
// Search all the layers in the map to see if we can find them in the baselayer array | ||
t.eachLayer(function(t){e=r.find(function(e){return t===e})}), | ||
// Did we find the layer? | ||
null!=e? | ||
// Yes - set the baselayer to the one we found | ||
this.baseLayer=e: | ||
// No - set the baselayer to the first in the array and add it to the map | ||
r.length>0&&(this.baseLayer=r[0],this.baseLayer.addTo(t))},e.decorators=[{type:t.Directive,args:[{selector:"[leafletBaseLayers]"}]}],e.ctorParameters=function(){return[{type:n},{type:t.KeyValueDiffers}]},e.propDecorators={baseLayers:[{type:t.Input,args:["leafletBaseLayers"]}],layersControlOptions:[{type:t.Input,args:["leafletLayersControlOptions"]}]},e}(),y=/** @class */function(){function e(){}/** @nocollapse */ | ||
return e.forRoot=function(){return{ngModule:e,providers:[]}},e.decorators=[{type:t.NgModule,args:[{exports:[n,s,u,f],declarations:[n,s,u,f]}]}],e.ctorParameters=function(){return[]},e}(),c=/** @class */function(){function e(e,t,r){this.type=e,this.url=t,this.options=r}/** | ||
* Creates a TileLayer from the provided definition. This is a convenience function | ||
* to help with generating layers from objects. | ||
* | ||
* @param layerDef The layer to create | ||
* @returns {L.TileLayer} The TileLayer that has been created | ||
*/ | ||
/** | ||
* Creates a TileLayer for each key in the incoming map. This is a convenience function | ||
* for generating an associative array of layers from an associative array of objects | ||
* | ||
* @param layerDefs A map of key to tile layer definition | ||
* @returns {{[p: string]: L.TileLayer}} A new map of key to TileLayer | ||
*/ | ||
/** | ||
* Create a Tile Layer from the current state of this object | ||
* | ||
* @returns {L.TileLayer} A new TileLayer | ||
*/ | ||
return e.createTileLayer=function(e){var t;switch(e.type){case"xyz":t=r.tileLayer(e.url,e.options);break;case"wms":default:t=r.tileLayer.wms(e.url,e.options)}return t},e.createTileLayers=function(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e.createTileLayer(t[n]));return r},e.prototype.createTileLayer=function(){return e.createTileLayer(this)},e}();e.LeafletModule=y,e.LeafletDirective=n,e.LeafletDirectiveWrapper=i,e.LeafletTileLayerDefinition=c,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { ElementRef, EventEmitter, OnChanges, OnInit, SimpleChange } from '@angular/core'; | ||
@@ -3,0 +2,0 @@ import * as L from 'leaflet'; |
import { Directive, ElementRef, EventEmitter, HostListener, Input, Output } from '@angular/core'; | ||
import * as L from 'leaflet'; | ||
var LeafletDirective = (function () { | ||
var LeafletDirective = /** @class */ (function () { | ||
function LeafletDirective(el) { | ||
@@ -116,26 +116,26 @@ this.DEFAULT_ZOOM = 1; | ||
}; | ||
LeafletDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leaflet]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletDirective.ctorParameters = function () { return [ | ||
{ type: ElementRef, }, | ||
]; }; | ||
LeafletDirective.propDecorators = { | ||
'fitBoundsOptions': [{ type: Input, args: ['leafletFitBoundsOptions',] },], | ||
'panOptions': [{ type: Input, args: ['leafletPanOptions',] },], | ||
'zoomOptions': [{ type: Input, args: ['leafletZoomOptions',] },], | ||
'zoomPanOptions': [{ type: Input, args: ['leafletZoomPanOptions',] },], | ||
'options': [{ type: Input, args: ['leafletOptions',] },], | ||
'mapReady': [{ type: Output, args: ['leafletMapReady',] },], | ||
'zoom': [{ type: Input, args: ['leafletZoom',] },], | ||
'center': [{ type: Input, args: ['leafletCenter',] },], | ||
'fitBounds': [{ type: Input, args: ['leafletFitBounds',] },], | ||
'onResize': [{ type: HostListener, args: ['window:resize', [],] },], | ||
}; | ||
return LeafletDirective; | ||
}()); | ||
export { LeafletDirective }; | ||
LeafletDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leaflet]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletDirective.ctorParameters = function () { return [ | ||
{ type: ElementRef, }, | ||
]; }; | ||
LeafletDirective.propDecorators = { | ||
'fitBoundsOptions': [{ type: Input, args: ['leafletFitBoundsOptions',] },], | ||
'panOptions': [{ type: Input, args: ['leafletPanOptions',] },], | ||
'zoomOptions': [{ type: Input, args: ['leafletZoomOptions',] },], | ||
'zoomPanOptions': [{ type: Input, args: ['leafletZoomPanOptions',] },], | ||
'options': [{ type: Input, args: ['leafletOptions',] },], | ||
'mapReady': [{ type: Output, args: ['leafletMapReady',] },], | ||
'zoom': [{ type: Input, args: ['leafletZoom',] },], | ||
'center': [{ type: Input, args: ['leafletCenter',] },], | ||
'fitBounds': [{ type: Input, args: ['leafletFitBounds',] },], | ||
'onResize': [{ type: HostListener, args: ['window:resize', [],] },], | ||
}; | ||
//# sourceMappingURL=leaflet.directive.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { LeafletDirective } from './leaflet.directive'; | ||
@@ -3,0 +2,0 @@ export declare class LeafletDirectiveWrapper { |
@@ -1,2 +0,2 @@ | ||
var LeafletDirectiveWrapper = (function () { | ||
var LeafletDirectiveWrapper = /** @class */ (function () { | ||
function LeafletDirectiveWrapper(leafletDirective) { | ||
@@ -3,0 +3,0 @@ this.leafletDirective = leafletDirective; |
@@ -1,2 +0,2 @@ | ||
var LeafletUtil = (function () { | ||
var LeafletUtil = /** @class */ (function () { | ||
function LeafletUtil() { | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { DoCheck, KeyValueDiffer, KeyValueDiffers, OnInit } from '@angular/core'; | ||
@@ -3,0 +2,0 @@ import * as L from 'leaflet'; |
@@ -17,3 +17,3 @@ import { Directive, Input, KeyValueDiffers } from '@angular/core'; | ||
*/ | ||
var LeafletBaseLayersDirective = (function () { | ||
var LeafletBaseLayersDirective = /** @class */ (function () { | ||
function LeafletBaseLayersDirective(leafletDirective, differs) { | ||
@@ -69,3 +69,3 @@ this.differs = differs; | ||
map.eachLayer(function (l) { | ||
foundLayer = layers.find(function (bl) { return l === bl; }); | ||
foundLayer = layers.find(function (bl) { return (l === bl); }); | ||
}); | ||
@@ -85,19 +85,19 @@ // Did we find the layer? | ||
}; | ||
LeafletBaseLayersDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletBaseLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletBaseLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: KeyValueDiffers, }, | ||
]; }; | ||
LeafletBaseLayersDirective.propDecorators = { | ||
'baseLayers': [{ type: Input, args: ['leafletBaseLayers',] },], | ||
'layersControlOptions': [{ type: Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
return LeafletBaseLayersDirective; | ||
}()); | ||
export { LeafletBaseLayersDirective }; | ||
LeafletBaseLayersDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletBaseLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletBaseLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: KeyValueDiffers, }, | ||
]; }; | ||
LeafletBaseLayersDirective.propDecorators = { | ||
'baseLayers': [{ type: Input, args: ['leafletBaseLayers',] },], | ||
'layersControlOptions': [{ type: Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
//# sourceMappingURL=leaflet-baselayers.directive.js.map |
@@ -1,2 +0,2 @@ | ||
var LeafletControlLayersChanges = (function () { | ||
var LeafletControlLayersChanges = /** @class */ (function () { | ||
function LeafletControlLayersChanges() { | ||
@@ -3,0 +3,0 @@ this.layersRemoved = 0; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import * as L from 'leaflet'; | ||
@@ -3,0 +2,0 @@ export declare class LeafletControlLayersConfig { |
@@ -1,2 +0,2 @@ | ||
var LeafletControlLayersConfig = (function () { | ||
var LeafletControlLayersConfig = /** @class */ (function () { | ||
function LeafletControlLayersConfig() { | ||
@@ -3,0 +3,0 @@ this.baseLayers = {}; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { DoCheck, KeyValueDiffer, KeyValueDiffers, OnInit } from '@angular/core'; | ||
@@ -3,0 +2,0 @@ import { LeafletDirective } from '../../core/leaflet.directive'; |
@@ -16,3 +16,3 @@ import { Directive, Input, KeyValueDiffers } from '@angular/core'; | ||
*/ | ||
var LeafletLayersControlDirective = (function () { | ||
var LeafletLayersControlDirective = /** @class */ (function () { | ||
function LeafletLayersControlDirective(leafletDirective, differs) { | ||
@@ -77,19 +77,19 @@ this.differs = differs; | ||
}; | ||
LeafletLayersControlDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletLayersControl]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersControlDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: KeyValueDiffers, }, | ||
]; }; | ||
LeafletLayersControlDirective.propDecorators = { | ||
'layersControlConfig': [{ type: Input, args: ['leafletLayersControl',] },], | ||
'layersControlOptions': [{ type: Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
return LeafletLayersControlDirective; | ||
}()); | ||
export { LeafletLayersControlDirective }; | ||
LeafletLayersControlDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletLayersControl]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersControlDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: KeyValueDiffers, }, | ||
]; }; | ||
LeafletLayersControlDirective.propDecorators = { | ||
'layersControlConfig': [{ type: Input, args: ['leafletLayersControl',] },], | ||
'layersControlOptions': [{ type: Input, args: ['leafletLayersControlOptions',] },], | ||
}; | ||
//# sourceMappingURL=leaflet-control-layers.directive.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { KeyValueChanges } from '@angular/core'; | ||
@@ -3,0 +2,0 @@ import * as L from 'leaflet'; |
import * as L from 'leaflet'; | ||
import { LeafletControlLayersChanges } from './leaflet-control-layers-changes.model'; | ||
var LeafletControlLayersWrapper = (function () { | ||
var LeafletControlLayersWrapper = /** @class */ (function () { | ||
function LeafletControlLayersWrapper() { | ||
@@ -5,0 +5,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/// <reference types="leaflet" /> | ||
import { DoCheck, IterableDiffer, IterableDiffers, OnInit } from '@angular/core'; | ||
@@ -3,0 +2,0 @@ import * as L from 'leaflet'; |
@@ -19,3 +19,3 @@ import { Directive, Input, IterableDiffers } from '@angular/core'; | ||
*/ | ||
var LeafletLayersDirective = (function () { | ||
var LeafletLayersDirective = /** @class */ (function () { | ||
function LeafletLayersDirective(leafletDirective, differs) { | ||
@@ -68,18 +68,18 @@ this.differs = differs; | ||
}; | ||
LeafletLayersDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: IterableDiffers, }, | ||
]; }; | ||
LeafletLayersDirective.propDecorators = { | ||
'layers': [{ type: Input, args: ['leafletLayers',] },], | ||
}; | ||
return LeafletLayersDirective; | ||
}()); | ||
export { LeafletLayersDirective }; | ||
LeafletLayersDirective.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: '[leafletLayers]' | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletLayersDirective.ctorParameters = function () { return [ | ||
{ type: LeafletDirective, }, | ||
{ type: IterableDiffers, }, | ||
]; }; | ||
LeafletLayersDirective.propDecorators = { | ||
'layers': [{ type: Input, args: ['leafletLayers',] },], | ||
}; | ||
//# sourceMappingURL=leaflet-layers.directive.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference types="leaflet" /> | ||
import * as L from 'leaflet'; | ||
export declare class LeafletTileLayerDefinition { | ||
@@ -3,0 +3,0 @@ type: string; |
@@ -1,2 +0,3 @@ | ||
var LeafletTileLayerDefinition = (function () { | ||
import * as L from 'leaflet'; | ||
var LeafletTileLayerDefinition = /** @class */ (function () { | ||
function LeafletTileLayerDefinition(type, url, options) { | ||
@@ -3,0 +4,0 @@ this.type = type; |
@@ -6,3 +6,3 @@ import { NgModule } from '@angular/core'; | ||
import { LeafletBaseLayersDirective } from './layers/base/leaflet-baselayers.directive'; | ||
var LeafletModule = (function () { | ||
var LeafletModule = /** @class */ (function () { | ||
function LeafletModule() { | ||
@@ -13,23 +13,23 @@ } | ||
}; | ||
LeafletModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
exports: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
], | ||
declarations: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletModule.ctorParameters = function () { return []; }; | ||
return LeafletModule; | ||
}()); | ||
export { LeafletModule }; | ||
LeafletModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
exports: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
], | ||
declarations: [ | ||
LeafletDirective, | ||
LeafletLayersDirective, | ||
LeafletLayersControlDirective, | ||
LeafletBaseLayersDirective | ||
] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
LeafletModule.ctorParameters = function () { return []; }; | ||
//# sourceMappingURL=leaflet.module.js.map |
@@ -82,3 +82,4 @@ 'use strict'; | ||
return gulp.src(path.posix.join(assets.dist.bundleDir, `${pkg.artifactName}.js`)) | ||
.pipe(plugins.uglify({ preserveComments: 'license' })) | ||
.pipe(plugins.uglify({ output: { comments: 'license' } })) | ||
.on('error', (err) => { plugins.util.log(plugins.util.colors.red('[Uglify]'), err.toString()); }) | ||
.pipe(plugins.rename(pkg.artifactName + '.min.js')) | ||
@@ -93,3 +94,3 @@ .pipe(gulp.dest(assets.dist.bundleDir)); | ||
return rollup.rollup({ | ||
entry: path.posix.join(assets.dist.dir, '/index.js'), | ||
input: path.posix.join(assets.dist.dir, '/index.js'), | ||
external: [ | ||
@@ -108,6 +109,6 @@ '@angular/core', | ||
return bundle.write({ | ||
dest: path.posix.join(assets.dist.bundleDir, `${pkg.artifactName}.js`), | ||
file: path.posix.join(assets.dist.bundleDir, `${pkg.artifactName}.js`), | ||
format: 'umd', | ||
moduleName: pkg.moduleName, | ||
sourceMap: true, | ||
name: pkg.moduleName, | ||
sourcemap: true, | ||
banner: bannerString, | ||
@@ -131,17 +132,18 @@ globals: { | ||
let compiler = webpack(webpackConfig); | ||
let port = 9000; | ||
new webpackDevServer(compiler, { | ||
stats: { | ||
colors: true, | ||
chunks: false | ||
modules: false, | ||
colors: true | ||
}, | ||
watchOptions: { | ||
aggregateTimeout: 300, | ||
aggregateTimeout: 500, | ||
poll: 1000 | ||
}, | ||
}).listen(9000, 'localhost', (err) => { | ||
}).listen(port, 'localhost', (err) => { | ||
if(err) throw new plugins.util.PluginError('webpack', err); | ||
// Server listening | ||
plugins.util.log('[webpack]', 'http://localhost:9000/webpack-dev-server/index.html'); | ||
plugins.util.log('[webpack]', `http://localhost:${port}/webpack-dev-server/index.html`); | ||
}); | ||
@@ -148,0 +150,0 @@ }); |
@@ -6,4 +6,3 @@ { | ||
"description": "Angular 2+ components for Leaflet", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"author": "Asymmetrik, Ltd.", | ||
@@ -40,29 +39,30 @@ "copyright": "Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.", | ||
"leaflet": "1.0", | ||
"@types/leaflet": "1.0", | ||
"leaflet": "1", | ||
"@types/leaflet": "1", | ||
"core-js": "2.4", | ||
"core-js": "2.5", | ||
"rxjs": "5.2", | ||
"rxjs": "5.4", | ||
"zone.js": "0.8", | ||
"@types/node": "6", | ||
"merge2": "1.0", | ||
"rollup": "0.41", | ||
"merge2": "1.1", | ||
"rollup": "0.49", | ||
"typescript": "2.2", | ||
"tslint": "4.5", | ||
"typescript": "2.5", | ||
"tslint": "5.7", | ||
"tslint-stylish": "2.1", | ||
"webpack": "2.3", | ||
"webpack-dev-server": "2.4", | ||
"webpack": "3.5", | ||
"webpack-dev-server": "2.7", | ||
"angular2-template-loader": "0.6", | ||
"css-loader": "0.27", | ||
"file-loader": "0.10", | ||
"html-loader": "0.4", | ||
"resolve-url-loader": "2.0", | ||
"css-loader": "0.28", | ||
"file-loader": "0.11", | ||
"html-loader": "0.5", | ||
"resolve-url-loader": "2.1", | ||
"sass-loader": "6.0", | ||
"style-loader": "0.16", | ||
"awesome-typescript-loader": "3.1", | ||
"style-loader": "0.18", | ||
"awesome-typescript-loader": "3.2", | ||
"url-loader": "0.5", | ||
"source-map-loader": "0.2", | ||
@@ -74,8 +74,8 @@ "gulp": "3.9", | ||
"gulp-rename": "1.2", | ||
"gulp-sourcemaps": "2.4", | ||
"gulp-typescript": "3.1", | ||
"gulp-tslint": "7.1", | ||
"gulp-uglify": "2.1", | ||
"gulp-sourcemaps": "2.6", | ||
"gulp-typescript": "3.2", | ||
"gulp-tslint": "8.1", | ||
"gulp-uglify": "3.0", | ||
"gulp-util": "3.0", | ||
"run-sequence": "1.2", | ||
"run-sequence": "2.1", | ||
"through2": "2.0", | ||
@@ -82,0 +82,0 @@ "node-sass": "4.5" |
@@ -11,3 +11,3 @@ # @asymmetrik/ngx-leaflet | ||
> Leaflet packages for Angular 2+. | ||
> Provides flexible and extensible components for integrating Leaflet v0.7.x and v1.0.x into Angular 2+ projects. | ||
> Provides flexible and extensible components for integrating Leaflet v0.7.x and v1.x into Angular 2+ projects. | ||
> Now supports Angular v4, Ahead-of-Time compilation (AOT), and use in Angular-CLI based projects. | ||
@@ -14,0 +14,0 @@ |
@@ -78,3 +78,3 @@ import { Component } from '@angular/core'; | ||
}) as any, | ||
{ style: () => { return { color: '#ff7800' }; } }) | ||
{ style: () => ({ color: '#ff7800' })}) | ||
}; | ||
@@ -117,8 +117,8 @@ | ||
// Get the active base layer | ||
let baseLayer = this.model.baseLayers.find((l) => { return l.id === this.model.baseLayer; }); | ||
const baseLayer = this.model.baseLayers.find((l: any) => (l.id === this.model.baseLayer)); | ||
// Get all the active overlay layers | ||
let newLayers = this.model.overlayLayers | ||
.filter((l) => { return l.enabled; }) | ||
.map((l) => { return l.layer; }); | ||
const newLayers = this.model.overlayLayers | ||
.filter((l: any) => l.enabled) | ||
.map((l: any) => l.layer); | ||
newLayers.unshift(baseLayer.layer); | ||
@@ -125,0 +125,0 @@ |
@@ -24,3 +24,3 @@ import { Component } from '@angular/core'; | ||
addMarker() { | ||
let marker = L.marker( | ||
const marker = L.marker( | ||
[ 46.879966 + 0.1 * (Math.random() - 0.5), -121.726909 + 0.1 * (Math.random() - 0.5) ], | ||
@@ -27,0 +27,0 @@ { |
@@ -15,3 +15,3 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
mutableAdd() { | ||
let marker = L.marker( | ||
const marker = L.marker( | ||
[ 46.879966 + 0.1 * (Math.random() - 0.5), -121.726909 + 0.1 * (Math.random() - 0.5) ], | ||
@@ -18,0 +18,0 @@ { |
export class LeafletUtil { | ||
static mapToArray<T>(map: { [ key: string ]: T }): T[] { | ||
let toReturn: T[] = []; | ||
const toReturn: T[] = []; | ||
for (let k in map) { | ||
for (const k in map) { | ||
if (map.hasOwnProperty(k)) { | ||
@@ -8,0 +8,0 @@ toReturn.push(map[k]); |
@@ -80,4 +80,4 @@ import { Directive, DoCheck, Input, KeyValueDiffer, KeyValueDiffers, OnInit } from '@angular/core'; | ||
let map = this.leafletDirective.getMap(); | ||
let layersControl = this.controlLayers.getLayersControl(); | ||
const map = this.leafletDirective.getMap(); | ||
const layersControl = this.controlLayers.getLayersControl(); | ||
@@ -100,4 +100,4 @@ if (null != map && null != layersControl && null != this.baseLayersDiffer) { | ||
let map = this.leafletDirective.getMap(); | ||
let layers = LeafletUtil.mapToArray(this.baseLayers); | ||
const map = this.leafletDirective.getMap(); | ||
const layers = LeafletUtil.mapToArray(this.baseLayers); | ||
let foundLayer: L.Layer; | ||
@@ -107,3 +107,3 @@ | ||
map.eachLayer((l: L.Layer) => { | ||
foundLayer = layers.find((bl) => { return l === bl; }); | ||
foundLayer = layers.find((bl) => (l === bl)); | ||
}); | ||
@@ -110,0 +110,0 @@ |
@@ -84,4 +84,4 @@ import { Directive, DoCheck, Input, KeyValueDiffer, KeyValueDiffers, OnInit } from '@angular/core'; | ||
let map = this.leafletDirective.getMap(); | ||
let layersControl = this.controlLayers.getLayersControl(); | ||
const map = this.leafletDirective.getMap(); | ||
const layersControl = this.controlLayers.getLayersControl(); | ||
@@ -88,0 +88,0 @@ if (null != map && null != layersControl) { |
@@ -18,4 +18,4 @@ import { KeyValueChanges } from '@angular/core'; | ||
let baseLayers = controlConfig.baseLayers || {}; | ||
let overlays = controlConfig.overlays || {}; | ||
const baseLayers = controlConfig.baseLayers || {}; | ||
const overlays = controlConfig.overlays || {}; | ||
@@ -48,3 +48,3 @@ this.layersControl = L.control.layers(baseLayers, overlays, controlOptions); | ||
private applyChanges(changes: KeyValueChanges<string, L.Layer>, addFn: (layer: L.Layer, name: string) => void): LeafletControlLayersChanges { | ||
let results: LeafletControlLayersChanges = new LeafletControlLayersChanges(); | ||
const results: LeafletControlLayersChanges = new LeafletControlLayersChanges(); | ||
@@ -51,0 +51,0 @@ if (null != changes) { |
@@ -78,3 +78,3 @@ import { Directive, DoCheck, Input, IterableDiffer, IterableDiffers, OnInit } from '@angular/core'; | ||
let map = this.leafletDirective.getMap(); | ||
const map = this.leafletDirective.getMap(); | ||
@@ -81,0 +81,0 @@ if (null != map && null != this.layersDiffer) { |
@@ -0,1 +1,3 @@ | ||
import * as L from 'leaflet'; | ||
export class LeafletTileLayerDefinition { | ||
@@ -40,5 +42,5 @@ | ||
static createTileLayers(layerDefs: { [ key: string ]: LeafletTileLayerDefinition }): { [ key: string ]: L.TileLayer } { | ||
let layers: { [ key: string ]: L.TileLayer } = {}; | ||
const layers: { [ key: string ]: L.TileLayer } = {}; | ||
for (let k in layerDefs) { | ||
for (const k in layerDefs) { | ||
if (layerDefs.hasOwnProperty(k)) { | ||
@@ -45,0 +47,0 @@ layers[k] = (LeafletTileLayerDefinition.createTileLayer(layerDefs[k])); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
219577
2865
44