@nextgis/ngw-leaflet 1.16.4 → 1.16.6

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.16.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.16.6; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.16.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.16.6; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -14937,8 +14937,9 @@ var NgwLeaflet = (function () {
14937
14937
  if (er instanceof _this.CancelError) {
14938
14938
  for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
14939
14939
  var v = values_1[_i];
14940
- if ('cancel' in v) {
14941
- v.cancel();
14940
+ var v_ = v;
14941
+ if ('cancel' in v_) {
14942
+ v_.cancel();
14942
14943
  }
14943
14944
  }
14944
14945
  }
@@ -17060,7 +17061,7 @@ var NgwLeaflet = (function () {
17060
17061
  }
17061
17062
  });
17062
17063
  }); };
17063
- if (layer && layer.options.visibility !== toStatus) {
17064
+ if (layer) {
17064
17065
  return this.onMapLoad().then(function () { return action(layer); });
17065
17066
  }
17066
17067
  return Promise.resolve();
@@ -17186,20 +17187,21 @@ var NgwLeaflet = (function () {
17186
17187
  };
17187
17188
  WebMapLayers.prototype.propertiesFilter = function (layerDef, filters, options) {
17188
17189
  var layer = this.getLayer(layerDef);
17189
- if (!layer)
17190
- return;
17191
- var adapter = layer;
17192
- if (adapter.propertiesFilter) {
17193
- adapter.propertiesFilter(filters, options);
17194
- }
17195
- else if (adapter.filter) {
17196
- this.filterLayer(adapter, function (e) {
17197
- if (e.feature && e.feature.properties) {
17198
- return propertiesFilter(e.feature.properties, filters);
17199
- }
17200
- return true;
17201
- });
17190
+ if (layer) {
17191
+ var adapter = layer;
17192
+ if (adapter.propertiesFilter) {
17193
+ return adapter.propertiesFilter(filters, options);
17194
+ }
17195
+ else if (adapter.filter) {
17196
+ this.filterLayer(adapter, function (e) {
17197
+ if (e.feature && e.feature.properties) {
17198
+ return propertiesFilter(e.feature.properties, filters);
17199
+ }
17200
+ return true;
17201
+ });
17202
+ }
17202
17203
  }
17204
+ return Promise.resolve();
17203
17205
  };
17204
17206
  WebMapLayers.prototype.removeLayerFilter = function (layerDef) {
17205
17207
  var layer = this.getLayer(layerDef);
@@ -21863,7 +21865,7 @@ var NgwLeaflet = (function () {
21863
21865
  extent: bbox,
21864
21866
  size: width + ',' + height,
21865
21867
  timestamp: Date.now(),
21866
- nd: nd,
21868
+ nd: nd !== null && nd !== void 0 ? nd : 200,
21867
21869
  };
21868
21870
  }
21869
21871
  var vectorLayerGeomToPaintTypeAlias = {
@@ -22301,28 +22303,32 @@ var NgwLeaflet = (function () {
22301
22303
  asterisk: '<path d="m7.59 12v-3.27l2.83 1.64 1.58-2.74-2.85-1.64 2.83-1.64-1.56-2.74-2.83 1.64v-3.24h-3.17v3.24l-2.85-1.64-1.57 2.74 2.84 1.64-2.84 1.64 1.57 2.74 2.85-1.64v3.27z"/>',
22302
22304
  };
22303
22305
  var STROKE = 0.8;
22304
- function insertSvg(width, height, stroke, content) {
22306
+ function generateSvg(width, height, stroke, content) {
22305
22307
  if (stroke === void 0) { stroke = 0; }
22306
22308
  var s = stroke / 2;
22307
22309
  var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(width + stroke, " ").concat(height + stroke, "\"\n >").concat(content, "</svg>");
22310
+ return svg;
22311
+ }
22312
+ function insertSvg(svg) {
22308
22313
  var oParser = new DOMParser();
22309
22314
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
22310
22315
  return oDOM.documentElement;
22311
22316
  }
22312
22317
  function getIcon(opt) {
22318
+ var _a, _b, _c, _d;
22313
22319
  if (opt === void 0) { opt = {}; }
22314
22320
  // default values
22315
- var shape = opt.shape || 'circle';
22316
- var color = opt.color || 'blue';
22317
- var strokeColor = opt.strokeColor || 'white';
22318
- var size = opt.size || 12;
22321
+ var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
22322
+ var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
22323
+ var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
22324
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
22319
22325
  var anchor = size / 2;
22320
22326
  var defSize = 12;
22321
22327
  var stroke = typeof opt.stroke === 'number' ? opt.stroke : STROKE;
22322
22328
  var scale = size / defSize;
22323
- var pathAlias = svgPath[shape] || 'circle';
22329
+ var pathAlias = opt.p || svgPath[shape] || 'circle';
22324
22330
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
22325
- var svg = insertSvg(size, size, stroke * scale, path);
22331
+ var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
22326
22332
  var fistChild = svg.firstChild;
22327
22333
  var transform = "scale(".concat(scale, ")");
22328
22334
  fistChild.setAttribute('fill', color);
@@ -22706,7 +22712,10 @@ var NgwLeaflet = (function () {
22706
22712
  _a.label = 5;
22707
22713
  case 5:
22708
22714
  if (item) {
22709
- fetchNgwResourceExtent(item, this.connector).then(function (extent) {
22715
+ fetchNgwExtent({
22716
+ resourceId: item.resource.id,
22717
+ connector: this.connector,
22718
+ }).then(function (extent) {
22710
22719
  if (extent) {
22711
22720
  _this.fitBounds(extent, options);
22712
22721
  }
@@ -22715,7 +22724,7 @@ var NgwLeaflet = (function () {
22715
22724
  _a.label = 6;
22716
22725
  case 6: return [3 /*break*/, 8];
22717
22726
  case 7:
22718
- _super.prototype.fitLayer.call(this, layerDef, options);
22727
+ _super.prototype.fitLayer.call(this, typeof layerDef === 'number' ? String(layerDef) : layerDef, options);
22719
22728
  _a.label = 8;
22720
22729
  case 8: return [2 /*return*/];
22721
22730
  }
@@ -24524,7 +24533,8 @@ var NgwLeaflet = (function () {
24524
24533
  }
24525
24534
  };
24526
24535
  LeafletMapAdapter.prototype.getZoom = function () {
24527
- return (this.map && this.map.getZoom()) || undefined;
24536
+ var _a;
24537
+ return (_a = (this.map && this.map.getZoom())) !== null && _a !== void 0 ? _a : undefined;
24528
24538
  };
24529
24539
  LeafletMapAdapter.prototype.getBounds = function () {
24530
24540
  if (!this.map)