@nextgis/ngw-leaflet 4.0.0 → 4.0.2
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 +1 -1
- package/lib/ngw-leaflet.esm-browser.js +25 -10
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +8 -3
- package/lib/ngw-leaflet.esm-bundler.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.prod.js +1 -1
- package/lib/ngw-leaflet.esm-bundler.prod.js.map +1 -1
- package/lib/ngw-leaflet.global.js +25 -10
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NgwLeaflet
|
|
2
2
|
|
|
3
|
-

|
|
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.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 4.0.2; author: NextGIS */
|
|
2
2
|
function getElement(el) {
|
|
3
3
|
if (typeof el === "string") {
|
|
4
4
|
let el_ = document.getElementById(el);
|
|
@@ -15652,8 +15652,14 @@ function fixUrlStr(url) {
|
|
|
15652
15652
|
return url.replace(/([^:]\/)\/+/g, "$1");
|
|
15653
15653
|
}
|
|
15654
15654
|
function updateUrlParams(urlStr, params) {
|
|
15655
|
-
const
|
|
15656
|
-
const
|
|
15655
|
+
const hashIndex = urlStr.indexOf("#");
|
|
15656
|
+
const hash = hashIndex === -1 ? "" : urlStr.slice(hashIndex);
|
|
15657
|
+
const url = hashIndex === -1 ? urlStr : urlStr.slice(0, hashIndex);
|
|
15658
|
+
const queryIndex = url.indexOf("?");
|
|
15659
|
+
const baseUrl = queryIndex === -1 ? url : url.slice(0, queryIndex);
|
|
15660
|
+
const searchParams = new URLSearchParams(
|
|
15661
|
+
queryIndex === -1 ? "" : url.slice(queryIndex + 1)
|
|
15662
|
+
);
|
|
15657
15663
|
Object.entries(params).forEach(([key, value]) => {
|
|
15658
15664
|
if (value === void 0) {
|
|
15659
15665
|
searchParams.delete(key);
|
|
@@ -15663,7 +15669,7 @@ function updateUrlParams(urlStr, params) {
|
|
|
15663
15669
|
});
|
|
15664
15670
|
searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
|
|
15665
15671
|
const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
|
|
15666
|
-
return `${
|
|
15672
|
+
return `${baseUrl}?${newSearch}${hash}`;
|
|
15667
15673
|
}
|
|
15668
15674
|
|
|
15669
15675
|
function boundsToArray(bounds) {
|
|
@@ -21272,7 +21278,7 @@ __publicField$s(_Cache, "instance", {});
|
|
|
21272
21278
|
let Cache = _Cache;
|
|
21273
21279
|
|
|
21274
21280
|
var pkg = {
|
|
21275
|
-
version: "4.0.
|
|
21281
|
+
version: "4.0.2"};
|
|
21276
21282
|
|
|
21277
21283
|
class AbortError extends Error {
|
|
21278
21284
|
constructor(message = "AbortError") {
|
|
@@ -24980,7 +24986,7 @@ class NgwWebmapLayerAdapter {
|
|
|
24980
24986
|
return webmap.bookmark_resource.id;
|
|
24981
24987
|
}
|
|
24982
24988
|
}
|
|
24983
|
-
fetchBookmarks(options) {
|
|
24989
|
+
fetchBookmarks(options = {}) {
|
|
24984
24990
|
const bookmarkResId = this.getBookmarksResourceId();
|
|
24985
24991
|
const connector = this.options.connector;
|
|
24986
24992
|
if (bookmarkResId) {
|
|
@@ -25644,9 +25650,9 @@ function createBasemapLayerAdapter(_0) {
|
|
|
25644
25650
|
item
|
|
25645
25651
|
}) {
|
|
25646
25652
|
if (item.basemap_layer) {
|
|
25647
|
-
const
|
|
25648
|
-
const url =
|
|
25649
|
-
if (qms) {
|
|
25653
|
+
const basemap = item.basemap_layer;
|
|
25654
|
+
const { qms, url } = basemap;
|
|
25655
|
+
if (qms && typeof qms === "string") {
|
|
25650
25656
|
const qms_ = JSON.parse(qms);
|
|
25651
25657
|
const adapter = Promise.resolve(
|
|
25652
25658
|
createQmsAdapter(webMap, {
|
|
@@ -25659,10 +25665,19 @@ function createBasemapLayerAdapter(_0) {
|
|
|
25659
25665
|
const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
|
|
25660
25666
|
if (TileAdapter) {
|
|
25661
25667
|
class BasemapTileAdapter extends TileAdapter {
|
|
25668
|
+
constructor(map, options) {
|
|
25669
|
+
super(map, __spreadProps$8(__spreadValues$a({}, options), { baselayer: true, order: 0 }));
|
|
25670
|
+
}
|
|
25662
25671
|
addLayer(opt) {
|
|
25663
25672
|
return __async$b(this, null, function* () {
|
|
25673
|
+
var _a, _b, _c;
|
|
25664
25674
|
if (url) {
|
|
25665
|
-
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), {
|
|
25675
|
+
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$8(__spreadValues$a({}, opt), {
|
|
25676
|
+
url,
|
|
25677
|
+
minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
|
|
25678
|
+
maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
|
|
25679
|
+
attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
|
|
25680
|
+
}));
|
|
25666
25681
|
}
|
|
25667
25682
|
});
|
|
25668
25683
|
}
|