@nextgis/ngw-leaflet 1.16.4 → 1.16.5

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.5; author: NextGIS */
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -14934,8 +14934,9 @@ var CancelablePromise = /** @class */ (function () {
14934
14934
  if (er instanceof _this.CancelError) {
14935
14935
  for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
14936
14936
  var v = values_1[_i];
14937
- if ('cancel' in v) {
14938
- v.cancel();
14937
+ var v_ = v;
14938
+ if ('cancel' in v_) {
14939
+ v_.cancel();
14939
14940
  }
14940
14941
  }
14941
14942
  }
@@ -17057,7 +17058,7 @@ var WebMapLayers = /** @class */ (function (_super) {
17057
17058
  }
17058
17059
  });
17059
17060
  }); };
17060
- if (layer && layer.options.visibility !== toStatus) {
17061
+ if (layer) {
17061
17062
  return this.onMapLoad().then(function () { return action(layer); });
17062
17063
  }
17063
17064
  return Promise.resolve();
@@ -17183,20 +17184,21 @@ var WebMapLayers = /** @class */ (function (_super) {
17183
17184
  };
17184
17185
  WebMapLayers.prototype.propertiesFilter = function (layerDef, filters, options) {
17185
17186
  var layer = this.getLayer(layerDef);
17186
- if (!layer)
17187
- return;
17188
- var adapter = layer;
17189
- if (adapter.propertiesFilter) {
17190
- adapter.propertiesFilter(filters, options);
17191
- }
17192
- else if (adapter.filter) {
17193
- this.filterLayer(adapter, function (e) {
17194
- if (e.feature && e.feature.properties) {
17195
- return propertiesFilter(e.feature.properties, filters);
17196
- }
17197
- return true;
17198
- });
17187
+ if (layer) {
17188
+ var adapter = layer;
17189
+ if (adapter.propertiesFilter) {
17190
+ return adapter.propertiesFilter(filters, options);
17191
+ }
17192
+ else if (adapter.filter) {
17193
+ this.filterLayer(adapter, function (e) {
17194
+ if (e.feature && e.feature.properties) {
17195
+ return propertiesFilter(e.feature.properties, filters);
17196
+ }
17197
+ return true;
17198
+ });
17199
+ }
17199
17200
  }
17201
+ return Promise.resolve();
17200
17202
  };
17201
17203
  WebMapLayers.prototype.removeLayerFilter = function (layerDef) {
17202
17204
  var layer = this.getLayer(layerDef);
@@ -21860,7 +21862,7 @@ function updateImageParams(params, resourceId) {
21860
21862
  extent: bbox,
21861
21863
  size: width + ',' + height,
21862
21864
  timestamp: Date.now(),
21863
- nd: nd,
21865
+ nd: nd !== null && nd !== void 0 ? nd : 200,
21864
21866
  };
21865
21867
  }
21866
21868
  var vectorLayerGeomToPaintTypeAlias = {
@@ -22298,28 +22300,32 @@ var svgPath = {
22298
22300
  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"/>',
22299
22301
  };
22300
22302
  var STROKE = 0.8;
22301
- function insertSvg(width, height, stroke, content) {
22303
+ function generateSvg(width, height, stroke, content) {
22302
22304
  if (stroke === void 0) { stroke = 0; }
22303
22305
  var s = stroke / 2;
22304
22306
  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>");
22307
+ return svg;
22308
+ }
22309
+ function insertSvg(svg) {
22305
22310
  var oParser = new DOMParser();
22306
22311
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
22307
22312
  return oDOM.documentElement;
22308
22313
  }
22309
22314
  function getIcon(opt) {
22315
+ var _a, _b, _c, _d;
22310
22316
  if (opt === void 0) { opt = {}; }
22311
22317
  // default values
22312
- var shape = opt.shape || 'circle';
22313
- var color = opt.color || 'blue';
22314
- var strokeColor = opt.strokeColor || 'white';
22315
- var size = opt.size || 12;
22318
+ var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
22319
+ var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
22320
+ var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
22321
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
22316
22322
  var anchor = size / 2;
22317
22323
  var defSize = 12;
22318
22324
  var stroke = typeof opt.stroke === 'number' ? opt.stroke : STROKE;
22319
22325
  var scale = size / defSize;
22320
- var pathAlias = svgPath[shape] || 'circle';
22326
+ var pathAlias = opt.p || svgPath[shape] || 'circle';
22321
22327
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
22322
- var svg = insertSvg(size, size, stroke * scale, path);
22328
+ var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
22323
22329
  var fistChild = svg.firstChild;
22324
22330
  var transform = "scale(".concat(scale, ")");
22325
22331
  fistChild.setAttribute('fill', color);
@@ -22703,7 +22709,10 @@ var NgwMap = /** @class */ (function (_super) {
22703
22709
  _a.label = 5;
22704
22710
  case 5:
22705
22711
  if (item) {
22706
- fetchNgwResourceExtent(item, this.connector).then(function (extent) {
22712
+ fetchNgwExtent({
22713
+ resourceId: item.resource.id,
22714
+ connector: this.connector,
22715
+ }).then(function (extent) {
22707
22716
  if (extent) {
22708
22717
  _this.fitBounds(extent, options);
22709
22718
  }
@@ -22712,7 +22721,7 @@ var NgwMap = /** @class */ (function (_super) {
22712
22721
  _a.label = 6;
22713
22722
  case 6: return [3 /*break*/, 8];
22714
22723
  case 7:
22715
- _super.prototype.fitLayer.call(this, layerDef, options);
22724
+ _super.prototype.fitLayer.call(this, typeof layerDef === 'number' ? String(layerDef) : layerDef, options);
22716
22725
  _a.label = 8;
22717
22726
  case 8: return [2 /*return*/];
22718
22727
  }
@@ -24521,7 +24530,8 @@ var LeafletMapAdapter = /** @class */ (function () {
24521
24530
  }
24522
24531
  };
24523
24532
  LeafletMapAdapter.prototype.getZoom = function () {
24524
- return (this.map && this.map.getZoom()) || undefined;
24533
+ var _a;
24534
+ return (_a = (this.map && this.map.getZoom())) !== null && _a !== void 0 ? _a : undefined;
24525
24535
  };
24526
24536
  LeafletMapAdapter.prototype.getBounds = function () {
24527
24537
  if (!this.map)