@nextgis/ngw-leaflet 3.0.0-alpha.18 → 3.0.0-alpha.19

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: 3.0.0-alpha.17; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.18; author: NextGIS */
2
2
  var domain;
3
3
 
4
4
  // This constructor is used to store event handlers. Instantiating this is
@@ -17038,7 +17038,6 @@ var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key,
17038
17038
  var __publicField$D = (obj, key, value) => __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
17039
17039
  class ImageLayer extends leafletSrcExports.Layer {
17040
17040
  constructor(url, options) {
17041
- var _a;
17042
17041
  super(options);
17043
17042
  __publicField$D(this, "defaultWmsParams", {
17044
17043
  service: "WMS",
@@ -17073,18 +17072,21 @@ class ImageLayer extends leafletSrcExports.Layer {
17073
17072
  const opts = {};
17074
17073
  let opt;
17075
17074
  for (opt in options) {
17075
+ const val = options[opt];
17076
17076
  if (opt in this.options) {
17077
- opts[opt] = options[opt];
17078
- } else if (!isObject$1(options[opt])) {
17079
- params[opt] = options[opt];
17077
+ opts[opt] = val;
17078
+ }
17079
+ }
17080
+ if (options.params) {
17081
+ for (const param in options.params) {
17082
+ const val = options.params[param];
17083
+ if (!isObject$1(val) && !Array.isArray(val) && typeof val !== "function") {
17084
+ params[param] = val;
17085
+ }
17080
17086
  }
17081
17087
  }
17082
17088
  leafletSrcExports.Util.setOptions(this, opts);
17083
- this.wmsParams = leafletSrcExports.Util.extend(
17084
- {},
17085
- this.defaultWmsParams,
17086
- (_a = params == null ? void 0 : params.params) != null ? _a : {}
17087
- );
17089
+ this.wmsParams = leafletSrcExports.Util.extend({}, this.defaultWmsParams, params);
17088
17090
  }
17089
17091
  setParams(params) {
17090
17092
  leafletSrcExports.Util.extend(this.wmsParams, params);
@@ -18188,7 +18190,7 @@ let Cache = _Cache;
18188
18190
 
18189
18191
  var pkg = {
18190
18192
  name: "@nextgis/ngw-connector",
18191
- version: "3.0.0-alpha.17",
18193
+ version: "3.0.0-alpha.18",
18192
18194
  _priority: 12,
18193
18195
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18194
18196
  main: "index.js",
@@ -21314,6 +21316,10 @@ class WebmapLayerOpacityPropertyHandler extends BaseProperty {
21314
21316
  }
21315
21317
  }
21316
21318
 
21319
+ function createLayerSymbolParam(resourceId, intervals) {
21320
+ return { [`symbols[${resourceId}]`]: intervals.join(",") || void 0 };
21321
+ }
21322
+
21317
21323
  var __defProp$p = Object.defineProperty;
21318
21324
  var __defProps$d = Object.defineProperties;
21319
21325
  var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
@@ -21382,7 +21388,9 @@ class Legend {
21382
21388
  this.connector = connector;
21383
21389
  this.layer = layer;
21384
21390
  this.layerId = layerId;
21385
- this.legend = this.createLegend(legend);
21391
+ if (legend) {
21392
+ this.legend = this.createLegend(legend);
21393
+ }
21386
21394
  this.resourceId = resourceId;
21387
21395
  this.webMap = webMap;
21388
21396
  this.onSymbolRenderChange = onSymbolRenderChange;
@@ -21391,12 +21399,13 @@ class Legend {
21391
21399
  this.layerId = String(layer.id);
21392
21400
  this.layer = layer;
21393
21401
  }
21394
- create(options) {
21395
- return __async$j(this, null, function* () {
21402
+ create() {
21403
+ return __async$j(this, arguments, function* (options = {}) {
21396
21404
  if (this.connector) {
21397
21405
  const ngwLegend = yield this.connector.route("render.legend_symbols", {
21398
21406
  id: this.resourceId
21399
21407
  }).get(__spreadValues$h({}, options));
21408
+ this.legend = ngwLegend;
21400
21409
  return this.createLegend(ngwLegend);
21401
21410
  }
21402
21411
  });
@@ -21410,15 +21419,17 @@ class Legend {
21410
21419
  }));
21411
21420
  }
21412
21421
  setSymbolRender(symbolIndex, status) {
21413
- const legendItem = this.legend.find((l) => l.index === symbolIndex);
21414
- if (legendItem) {
21415
- const render = legendItem.render;
21416
- if (render !== status) {
21417
- legendItem.render = status;
21418
- const newSymbols = this.legend.filter((l) => l.render).map((l) => l.index);
21419
- this.setLegendSymbol(newSymbols);
21420
- if (this.onSymbolRenderChange) {
21421
- this.onSymbolRenderChange(newSymbols);
21422
+ if (this.legend) {
21423
+ const legendItem = this.legend.find((l) => l.index === symbolIndex);
21424
+ if (legendItem) {
21425
+ const render = legendItem.render;
21426
+ if (render !== status) {
21427
+ legendItem.render = status;
21428
+ const newSymbols = this.legend.filter((l) => l.render).map((l) => l.index);
21429
+ this.setLegendSymbol(newSymbols);
21430
+ if (this.onSymbolRenderChange) {
21431
+ this.onSymbolRenderChange(newSymbols);
21432
+ }
21422
21433
  }
21423
21434
  }
21424
21435
  }
@@ -21430,9 +21441,7 @@ class Legend {
21430
21441
  }
21431
21442
  if (this.layer.updateLayer) {
21432
21443
  this.layer.updateLayer({
21433
- params: {
21434
- [`symbols[${this.resourceId}]`]: intervals.join(",") || void 0
21435
- }
21444
+ params: __spreadValues$h({}, createLayerSymbolParam(this.resourceId, intervals))
21436
21445
  });
21437
21446
  }
21438
21447
  if (intervals.length) {
@@ -21585,13 +21594,10 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
21585
21594
  if (connector && "resourceId" in this.item) {
21586
21595
  const resourceId = Number(this.item.resourceId);
21587
21596
  if (this.item.item_type === "layer") {
21588
- const ngwLegend = yield connector.route("render.legend_symbols", {
21589
- id: resourceId
21590
- }).get(__spreadValues$g({}, options));
21591
- if (this.layer && ngwLegend) {
21597
+ if (this.layer) {
21592
21598
  const legend = new Legend({
21599
+ connector: this.connector,
21593
21600
  layerId: id,
21594
- legend: ngwLegend,
21595
21601
  layer: this.layer,
21596
21602
  resourceId,
21597
21603
  webMap: this.webMap,
@@ -21604,6 +21610,7 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
21604
21610
  });
21605
21611
  }
21606
21612
  });
21613
+ yield legend.create(options);
21607
21614
  return [legend];
21608
21615
  }
21609
21616
  }