@nextgis/ngw-leaflet 4.0.0-rc.2 → 4.0.1

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: 4.0.0-rc.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 4.0.1; author: NextGIS */
2
2
  import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
3
3
  import { NgwMap } from '@nextgis/ngw-map';
4
4
  import { Icon } from 'leaflet';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 4.0.0-rc.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 4.0.1; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15781,13 +15781,22 @@ var NgwLeaflet = (function () {
15781
15781
  __publicField$K(this, "options", options);
15782
15782
  __publicField$K(this, "layer");
15783
15783
  __publicField$K(this, "pane", "order-0");
15784
+ var _a, _b;
15784
15785
  if (options.order !== void 0) {
15785
- const pane = "order-" + options.order;
15786
+ const order = options.order;
15787
+ const pane = "order-" + order;
15786
15788
  let exist = map.getPane(pane);
15787
15789
  if (!exist) {
15788
15790
  exist = map.createPane(pane);
15791
+ const nextPane = (_a = Object.entries(map.getPanes()).filter(([name]) => name.startsWith("order-")).map(([name, element]) => ({
15792
+ element,
15793
+ order: Number(name.slice("order-".length))
15794
+ })).filter((candidate) => candidate.order > order).sort((a, b) => a.order - b.order)[0]) == null ? void 0 : _a.element;
15795
+ if (nextPane) {
15796
+ (_b = exist.parentElement) == null ? void 0 : _b.insertBefore(exist, nextPane);
15797
+ }
15789
15798
  }
15790
- exist.style.zIndex = String(Math.round(options.order * 100));
15799
+ exist.style.zIndex = String(Math.round(order * 100));
15791
15800
  this.pane = pane;
15792
15801
  }
15793
15802
  }
@@ -21266,7 +21275,7 @@ var NgwLeaflet = (function () {
21266
21275
  let Cache = _Cache;
21267
21276
 
21268
21277
  var pkg = {
21269
- version: "4.0.0-rc.2"};
21278
+ version: "4.0.1"};
21270
21279
 
21271
21280
  class AbortError extends Error {
21272
21281
  constructor(message = "AbortError") {
@@ -24974,7 +24983,7 @@ var NgwLeaflet = (function () {
24974
24983
  return webmap.bookmark_resource.id;
24975
24984
  }
24976
24985
  }
24977
- fetchBookmarks(options) {
24986
+ fetchBookmarks(options = {}) {
24978
24987
  const bookmarkResId = this.getBookmarksResourceId();
24979
24988
  const connector = this.options.connector;
24980
24989
  if (bookmarkResId) {
@@ -25638,9 +25647,9 @@ var NgwLeaflet = (function () {
25638
25647
  item
25639
25648
  }) {
25640
25649
  if (item.basemap_layer) {
25641
- const qms = item.basemap_layer.qms;
25642
- const url = item.basemap_layer.url;
25643
- if (qms) {
25650
+ const basemap = item.basemap_layer;
25651
+ const { qms, url } = basemap;
25652
+ if (qms && typeof qms === "string") {
25644
25653
  const qms_ = JSON.parse(qms);
25645
25654
  const adapter = Promise.resolve(
25646
25655
  createQmsAdapter(webMap, {
@@ -25653,10 +25662,19 @@ var NgwLeaflet = (function () {
25653
25662
  const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
25654
25663
  if (TileAdapter) {
25655
25664
  class BasemapTileAdapter extends TileAdapter {
25665
+ constructor(map, options) {
25666
+ super(map, __spreadProps$8(__spreadValues$a({}, options), { baselayer: true, order: 0 }));
25667
+ }
25656
25668
  addLayer(opt) {
25657
25669
  return __async$b(this, null, function* () {
25670
+ var _a, _b, _c;
25658
25671
  if (url) {
25659
- return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), { url }));
25672
+ return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), {
25673
+ url,
25674
+ minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
25675
+ maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
25676
+ attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
25677
+ }));
25660
25678
  }
25661
25679
  });
25662
25680
  }