@nextgis/ngw-map 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-map; version: 3.0.0-alpha.17; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.18; author: NextGIS */
2
2
  import { getIcon } from '@nextgis/icons';
3
3
  import NgwConnector from '@nextgis/ngw-connector';
4
4
  import { NgwKit, fetchNgwLayerItem, fetchNgwLayerItems, fetchNgwLayerFeature, fetchNgwLayerFeatureCollection, fetchIdentifyItem, fetchIdentifyGeoJson, createNgwLayerAdapter, fetchNgwExtent, sendIdentifyRequest, getCompanyLogo, getIdentifyItems, createIdentifyItem } from '@nextgis/ngw-kit';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.17; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 3.0.0-alpha.18; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1068,7 +1068,7 @@ var NgwMap = (function (exports) {
1068
1068
 
1069
1069
  var pkg = {
1070
1070
  name: "@nextgis/ngw-connector",
1071
- version: "3.0.0-alpha.17",
1071
+ version: "3.0.0-alpha.18",
1072
1072
  _priority: 12,
1073
1073
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1074
1074
  main: "index.js",
@@ -4288,6 +4288,10 @@ var NgwMap = (function (exports) {
4288
4288
  }
4289
4289
  }
4290
4290
 
4291
+ function createLayerSymbolParam(resourceId, intervals) {
4292
+ return { [`symbols[${resourceId}]`]: intervals.join(",") || void 0 };
4293
+ }
4294
+
4291
4295
  var __defProp$r = Object.defineProperty;
4292
4296
  var __defProps$c = Object.defineProperties;
4293
4297
  var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
@@ -4356,7 +4360,9 @@ var NgwMap = (function (exports) {
4356
4360
  this.connector = connector;
4357
4361
  this.layer = layer;
4358
4362
  this.layerId = layerId;
4359
- this.legend = this.createLegend(legend);
4363
+ if (legend) {
4364
+ this.legend = this.createLegend(legend);
4365
+ }
4360
4366
  this.resourceId = resourceId;
4361
4367
  this.webMap = webMap;
4362
4368
  this.onSymbolRenderChange = onSymbolRenderChange;
@@ -4365,12 +4371,13 @@ var NgwMap = (function (exports) {
4365
4371
  this.layerId = String(layer.id);
4366
4372
  this.layer = layer;
4367
4373
  }
4368
- create(options) {
4369
- return __async$k(this, null, function* () {
4374
+ create() {
4375
+ return __async$k(this, arguments, function* (options = {}) {
4370
4376
  if (this.connector) {
4371
4377
  const ngwLegend = yield this.connector.route("render.legend_symbols", {
4372
4378
  id: this.resourceId
4373
4379
  }).get(__spreadValues$j({}, options));
4380
+ this.legend = ngwLegend;
4374
4381
  return this.createLegend(ngwLegend);
4375
4382
  }
4376
4383
  });
@@ -4384,15 +4391,17 @@ var NgwMap = (function (exports) {
4384
4391
  }));
4385
4392
  }
4386
4393
  setSymbolRender(symbolIndex, status) {
4387
- const legendItem = this.legend.find((l) => l.index === symbolIndex);
4388
- if (legendItem) {
4389
- const render = legendItem.render;
4390
- if (render !== status) {
4391
- legendItem.render = status;
4392
- const newSymbols = this.legend.filter((l) => l.render).map((l) => l.index);
4393
- this.setLegendSymbol(newSymbols);
4394
- if (this.onSymbolRenderChange) {
4395
- this.onSymbolRenderChange(newSymbols);
4394
+ if (this.legend) {
4395
+ const legendItem = this.legend.find((l) => l.index === symbolIndex);
4396
+ if (legendItem) {
4397
+ const render = legendItem.render;
4398
+ if (render !== status) {
4399
+ legendItem.render = status;
4400
+ const newSymbols = this.legend.filter((l) => l.render).map((l) => l.index);
4401
+ this.setLegendSymbol(newSymbols);
4402
+ if (this.onSymbolRenderChange) {
4403
+ this.onSymbolRenderChange(newSymbols);
4404
+ }
4396
4405
  }
4397
4406
  }
4398
4407
  }
@@ -4404,9 +4413,7 @@ var NgwMap = (function (exports) {
4404
4413
  }
4405
4414
  if (this.layer.updateLayer) {
4406
4415
  this.layer.updateLayer({
4407
- params: {
4408
- [`symbols[${this.resourceId}]`]: intervals.join(",") || void 0
4409
- }
4416
+ params: __spreadValues$j({}, createLayerSymbolParam(this.resourceId, intervals))
4410
4417
  });
4411
4418
  }
4412
4419
  if (intervals.length) {
@@ -4559,13 +4566,10 @@ var NgwMap = (function (exports) {
4559
4566
  if (connector && "resourceId" in this.item) {
4560
4567
  const resourceId = Number(this.item.resourceId);
4561
4568
  if (this.item.item_type === "layer") {
4562
- const ngwLegend = yield connector.route("render.legend_symbols", {
4563
- id: resourceId
4564
- }).get(__spreadValues$i({}, options));
4565
- if (this.layer && ngwLegend) {
4569
+ if (this.layer) {
4566
4570
  const legend = new Legend({
4571
+ connector: this.connector,
4567
4572
  layerId: id,
4568
- legend: ngwLegend,
4569
4573
  layer: this.layer,
4570
4574
  resourceId,
4571
4575
  webMap: this.webMap,
@@ -4578,6 +4582,7 @@ var NgwMap = (function (exports) {
4578
4582
  });
4579
4583
  }
4580
4584
  });
4585
+ yield legend.create(options);
4581
4586
  return [legend];
4582
4587
  }
4583
4588
  }