@nextgis/ngw-map 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 +2 -2
- package/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +25 -10
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.global.js +25 -10
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NgwMap
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
Framework-independent NextGIS Web map class used by `ngw-leaflet`, `ngw-ol`,
|
|
6
6
|
and `ngw-maplibre-gl`.
|
|
@@ -21,7 +21,7 @@ npm install @nextgis/ngw-map @nextgis/leaflet-map-adapter leaflet
|
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
|
-
```
|
|
24
|
+
```javascript
|
|
25
25
|
import { NgwMap } from '@nextgis/ngw-map';
|
|
26
26
|
import MapAdapter from '@nextgis/leaflet-map-adapter';
|
|
27
27
|
import 'leaflet/dist/leaflet.css';
|
package/lib/ngw-map.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 4.0.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 4.0.2; author: NextGIS */
|
|
2
2
|
const svgPath = {
|
|
3
3
|
brill: '<path d="m6 0-5 6 5 6 5-6z"/>',
|
|
4
4
|
circle: '<circle cx="6" cy="6" r="6"/>',
|
|
@@ -349,8 +349,14 @@ function fixUrlStr(url) {
|
|
|
349
349
|
return url.replace(/([^:]\/)\/+/g, "$1");
|
|
350
350
|
}
|
|
351
351
|
function updateUrlParams(urlStr, params) {
|
|
352
|
-
const
|
|
353
|
-
const
|
|
352
|
+
const hashIndex = urlStr.indexOf("#");
|
|
353
|
+
const hash = hashIndex === -1 ? "" : urlStr.slice(hashIndex);
|
|
354
|
+
const url = hashIndex === -1 ? urlStr : urlStr.slice(0, hashIndex);
|
|
355
|
+
const queryIndex = url.indexOf("?");
|
|
356
|
+
const baseUrl = queryIndex === -1 ? url : url.slice(0, queryIndex);
|
|
357
|
+
const searchParams = new URLSearchParams(
|
|
358
|
+
queryIndex === -1 ? "" : url.slice(queryIndex + 1)
|
|
359
|
+
);
|
|
354
360
|
Object.entries(params).forEach(([key, value]) => {
|
|
355
361
|
if (value === void 0) {
|
|
356
362
|
searchParams.delete(key);
|
|
@@ -360,7 +366,7 @@ function updateUrlParams(urlStr, params) {
|
|
|
360
366
|
});
|
|
361
367
|
searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
|
|
362
368
|
const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
|
|
363
|
-
return `${
|
|
369
|
+
return `${baseUrl}?${newSearch}${hash}`;
|
|
364
370
|
}
|
|
365
371
|
|
|
366
372
|
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
@@ -1077,7 +1083,7 @@ function unwrapListeners(arr) {
|
|
|
1077
1083
|
}
|
|
1078
1084
|
|
|
1079
1085
|
var pkg = {
|
|
1080
|
-
version: "4.0.
|
|
1086
|
+
version: "4.0.2"};
|
|
1081
1087
|
|
|
1082
1088
|
class AbortError extends Error {
|
|
1083
1089
|
constructor(message = "AbortError") {
|
|
@@ -4879,7 +4885,7 @@ class NgwWebmapLayerAdapter {
|
|
|
4879
4885
|
return webmap.bookmark_resource.id;
|
|
4880
4886
|
}
|
|
4881
4887
|
}
|
|
4882
|
-
fetchBookmarks(options) {
|
|
4888
|
+
fetchBookmarks(options = {}) {
|
|
4883
4889
|
const bookmarkResId = this.getBookmarksResourceId();
|
|
4884
4890
|
const connector = this.options.connector;
|
|
4885
4891
|
if (bookmarkResId) {
|
|
@@ -5540,9 +5546,9 @@ function createBasemapLayerAdapter(_0) {
|
|
|
5540
5546
|
item
|
|
5541
5547
|
}) {
|
|
5542
5548
|
if (item.basemap_layer) {
|
|
5543
|
-
const
|
|
5544
|
-
const url =
|
|
5545
|
-
if (qms) {
|
|
5549
|
+
const basemap = item.basemap_layer;
|
|
5550
|
+
const { qms, url } = basemap;
|
|
5551
|
+
if (qms && typeof qms === "string") {
|
|
5546
5552
|
const qms_ = JSON.parse(qms);
|
|
5547
5553
|
const adapter = Promise.resolve(
|
|
5548
5554
|
createQmsAdapter(webMap, {
|
|
@@ -5555,10 +5561,19 @@ function createBasemapLayerAdapter(_0) {
|
|
|
5555
5561
|
const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
|
|
5556
5562
|
if (TileAdapter) {
|
|
5557
5563
|
class BasemapTileAdapter extends TileAdapter {
|
|
5564
|
+
constructor(map, options) {
|
|
5565
|
+
super(map, __spreadProps$a(__spreadValues$f({}, options), { baselayer: true, order: 0 }));
|
|
5566
|
+
}
|
|
5558
5567
|
addLayer(opt) {
|
|
5559
5568
|
return __async$g(this, null, function* () {
|
|
5569
|
+
var _a, _b, _c;
|
|
5560
5570
|
if (url) {
|
|
5561
|
-
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$a(__spreadValues$f({}, opt), {
|
|
5571
|
+
return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$a(__spreadValues$f({}, opt), {
|
|
5572
|
+
url,
|
|
5573
|
+
minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
|
|
5574
|
+
maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
|
|
5575
|
+
attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
|
|
5576
|
+
}));
|
|
5562
5577
|
}
|
|
5563
5578
|
});
|
|
5564
5579
|
}
|