@nextgis/ngw-leaflet 1.9.4 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.9.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.10.0; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -15777,7 +15777,7 @@ const OPTIONS$1 = {
15777
15777
  minZoom: 0,
15778
15778
  maxZoom: 20,
15779
15779
  paint: {
15780
- color: 'blue',
15780
+ color: '#0000ff',
15781
15781
  opacity: 0.4,
15782
15782
  strokeOpacity: 1,
15783
15783
  stroke: true,
@@ -15785,7 +15785,7 @@ const OPTIONS$1 = {
15785
15785
  weight: 1,
15786
15786
  },
15787
15787
  selectedPaint: {
15788
- color: 'darkblue',
15788
+ color: '#00008b',
15789
15789
  opacity: 0.4,
15790
15790
  strokeOpacity: 1,
15791
15791
  stroke: true,
@@ -16935,6 +16935,30 @@ class WebMapLayers extends WebMapMain {
16935
16935
  adapter.clearLayer(cb);
16936
16936
  }
16937
16937
  }
16938
+ setLayerPaint(layerDef, paint) {
16939
+ const layer = this.getLayer(layerDef);
16940
+ if (paint && layer && layer.setPaint) {
16941
+ layer.setPaint(paint);
16942
+ }
16943
+ }
16944
+ setLayerSelectedPaint(layerDef, paint) {
16945
+ const layer = this.getLayer(layerDef);
16946
+ if (paint && layer && layer.setSelectedPaint) {
16947
+ layer.setSelectedPaint(paint);
16948
+ }
16949
+ }
16950
+ updateLayerPaint(layerDef, paint) {
16951
+ const layer = this.getLayer(layerDef);
16952
+ if (paint && layer && layer.updatePaint) {
16953
+ layer.updatePaint(paint);
16954
+ }
16955
+ }
16956
+ updateLayerSelectedPaint(layerDef, paint) {
16957
+ const layer = this.getLayer(layerDef);
16958
+ if (paint && layer && layer.updateSelectedPaint) {
16959
+ layer.updateSelectedPaint(paint);
16960
+ }
16961
+ }
16938
16962
  getAttributions(options) {
16939
16963
  const attributions = [];
16940
16964
  for (const l in this._layers) {
@@ -19969,8 +19993,8 @@ class NgwWebmapItem extends Item {
19969
19993
  : undefined;
19970
19994
  const minZooms = [minZoomWebmap, minZoomLayer].filter(Boolean);
19971
19995
  const maxZooms = [maxZoomWebmap, maxZoomLayer].filter(Boolean);
19972
- const minZoom = Math.max(...minZooms);
19973
- const maxZoom = Math.min(...maxZooms);
19996
+ const minZoom = minZooms.length ? Math.max(...minZooms) : undefined;
19997
+ const maxZoom = maxZooms.length ? Math.min(...maxZooms) : undefined;
19974
19998
  return { minZoom, maxZoom };
19975
19999
  }
19976
20000
  _init(item) {
@@ -20346,7 +20370,24 @@ class NgwWebmapLayerAdapter {
20346
20370
  if (data) {
20347
20371
  this.response = data;
20348
20372
  const webmap = data[this.webmapClassName];
20349
- const webMap = this.options.webMap;
20373
+ this._setupBaselayers(data);
20374
+ if (webmap) {
20375
+ this._extent = [
20376
+ webmap.extent_left,
20377
+ webmap.extent_bottom,
20378
+ webmap.extent_right,
20379
+ webmap.extent_top,
20380
+ ];
20381
+ this._updateItemsParams(webmap.root_item, this.options.webMap, data);
20382
+ return webmap;
20383
+ }
20384
+ }
20385
+ }
20386
+ _setupBaselayers(data) {
20387
+ var _a;
20388
+ const webMap = this.options.webMap;
20389
+ const basemap = (_a = this.options.useBasemap) !== null && _a !== void 0 ? _a : true;
20390
+ if (basemap) {
20350
20391
  if (data.basemap_webmap && data.basemap_webmap.basemaps.length) {
20351
20392
  const activeBaselayer = webMap.getActiveBaseLayer();
20352
20393
  this._lastActiveBaselayer = activeBaselayer
@@ -20360,16 +20401,6 @@ class NgwWebmapLayerAdapter {
20360
20401
  name: 'OpenStreetMap',
20361
20402
  });
20362
20403
  }
20363
- if (webmap) {
20364
- this._extent = [
20365
- webmap.extent_left,
20366
- webmap.extent_bottom,
20367
- webmap.extent_right,
20368
- webmap.extent_top,
20369
- ];
20370
- this._updateItemsParams(webmap.root_item, this.options.webMap, data);
20371
- return webmap;
20372
- }
20373
20404
  }
20374
20405
  }
20375
20406
  _setBasemaps(baseWebmap) {
@@ -21289,10 +21320,10 @@ function prepareWebMapOptions(options) {
21289
21320
  options.baseUrl = options.connector.options.baseUrl;
21290
21321
  }
21291
21322
  options = deepmerge(OPTIONS, options);
21292
- // if (!options.center && !options.bounds) {
21293
- // options.bounds = [-179, -90, 180, 90];
21294
- // options.maxBounds = options.bounds;
21295
- // }
21323
+ if (!options.center && !options.bounds) {
21324
+ options.bounds = [-179, -90, 180, 90];
21325
+ // options.maxBounds = options.bounds;
21326
+ }
21296
21327
  if (options.connector) {
21297
21328
  kits.push(new NgwKit({
21298
21329
  connector: options.connector,
@@ -21879,6 +21910,9 @@ function createControl(control, options = {}, map) {
21879
21910
  if (options.bar) {
21880
21911
  element.classList.add('leaflet-bar');
21881
21912
  }
21913
+ if (options.addClass) {
21914
+ element.classList.add(options.addClass);
21915
+ }
21882
21916
  if (!options.margin && !options.bar) {
21883
21917
  element.style.marginBottom = '0px';
21884
21918
  element.style.marginTop = '0px';
@@ -22356,7 +22390,7 @@ class GeoJsonAdapter extends BaseAdapter {
22356
22390
  async _openPopup(def, options = {}, type, latLng) {
22357
22391
  var _a, _b;
22358
22392
  const { feature, layer } = def;
22359
- const { minWidth, autoPan, maxWidth, closeButton: closeButton_ } = {
22393
+ const { minWidth, autoPan, maxWidth, closeButton: closeButton_, } = {
22360
22394
  minWidth: 300,
22361
22395
  ...options,
22362
22396
  };
@@ -22552,7 +22586,7 @@ class GeoJsonAdapter extends BaseAdapter {
22552
22586
  ok = this._filterFun(def);
22553
22587
  }
22554
22588
  if (ok) {
22555
- const { popup, popupOptions, selectable, interactive, selectOnHover, } = this.options;
22589
+ const { popup, popupOptions, selectable, interactive, selectOnHover } = this.options;
22556
22590
  // @ts-ignore
22557
22591
  layer.options.interactive = defined(interactive) ? interactive : true;
22558
22592
  layer_.addLayer(layer);