@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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NgwLeaflet
2
2
 
3
- ![size](https://img.shields.io/bundlephobia/minzip/@nextgis/ngw-leaflet) ![version](https://img.shields.io/npm/v/@nextgis/ngw-leaflet)
3
+ ![version](https://img.shields.io/npm/v/@nextgis/ngw-leaflet)
4
4
 
5
5
  Ready-to-use [Leaflet](https://leafletjs.com)-based map for NextGIS Web.
6
6
 
@@ -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
  function getElement(el) {
3
3
  if (typeof el === "string") {
4
4
  let el_ = document.getElementById(el);
@@ -15778,13 +15778,22 @@ class BaseAdapter {
15778
15778
  __publicField$K(this, "options", options);
15779
15779
  __publicField$K(this, "layer");
15780
15780
  __publicField$K(this, "pane", "order-0");
15781
+ var _a, _b;
15781
15782
  if (options.order !== void 0) {
15782
- const pane = "order-" + options.order;
15783
+ const order = options.order;
15784
+ const pane = "order-" + order;
15783
15785
  let exist = map.getPane(pane);
15784
15786
  if (!exist) {
15785
15787
  exist = map.createPane(pane);
15788
+ const nextPane = (_a = Object.entries(map.getPanes()).filter(([name]) => name.startsWith("order-")).map(([name, element]) => ({
15789
+ element,
15790
+ order: Number(name.slice("order-".length))
15791
+ })).filter((candidate) => candidate.order > order).sort((a, b) => a.order - b.order)[0]) == null ? void 0 : _a.element;
15792
+ if (nextPane) {
15793
+ (_b = exist.parentElement) == null ? void 0 : _b.insertBefore(exist, nextPane);
15794
+ }
15786
15795
  }
15787
- exist.style.zIndex = String(Math.round(options.order * 100));
15796
+ exist.style.zIndex = String(Math.round(order * 100));
15788
15797
  this.pane = pane;
15789
15798
  }
15790
15799
  }
@@ -21263,7 +21272,7 @@ __publicField$s(_Cache, "instance", {});
21263
21272
  let Cache = _Cache;
21264
21273
 
21265
21274
  var pkg = {
21266
- version: "4.0.0-rc.2"};
21275
+ version: "4.0.1"};
21267
21276
 
21268
21277
  class AbortError extends Error {
21269
21278
  constructor(message = "AbortError") {
@@ -24971,7 +24980,7 @@ class NgwWebmapLayerAdapter {
24971
24980
  return webmap.bookmark_resource.id;
24972
24981
  }
24973
24982
  }
24974
- fetchBookmarks(options) {
24983
+ fetchBookmarks(options = {}) {
24975
24984
  const bookmarkResId = this.getBookmarksResourceId();
24976
24985
  const connector = this.options.connector;
24977
24986
  if (bookmarkResId) {
@@ -25635,9 +25644,9 @@ function createBasemapLayerAdapter(_0) {
25635
25644
  item
25636
25645
  }) {
25637
25646
  if (item.basemap_layer) {
25638
- const qms = item.basemap_layer.qms;
25639
- const url = item.basemap_layer.url;
25640
- if (qms) {
25647
+ const basemap = item.basemap_layer;
25648
+ const { qms, url } = basemap;
25649
+ if (qms && typeof qms === "string") {
25641
25650
  const qms_ = JSON.parse(qms);
25642
25651
  const adapter = Promise.resolve(
25643
25652
  createQmsAdapter(webMap, {
@@ -25650,10 +25659,19 @@ function createBasemapLayerAdapter(_0) {
25650
25659
  const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
25651
25660
  if (TileAdapter) {
25652
25661
  class BasemapTileAdapter extends TileAdapter {
25662
+ constructor(map, options) {
25663
+ super(map, __spreadProps$8(__spreadValues$a({}, options), { baselayer: true, order: 0 }));
25664
+ }
25653
25665
  addLayer(opt) {
25654
25666
  return __async$b(this, null, function* () {
25667
+ var _a, _b, _c;
25655
25668
  if (url) {
25656
- return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), { url }));
25669
+ return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), {
25670
+ url,
25671
+ minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
25672
+ maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
25673
+ attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
25674
+ }));
25657
25675
  }
25658
25676
  });
25659
25677
  }