@nextgis/ngw-leaflet 1.13.2 → 1.13.7

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: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.13.7; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.13.7; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -16919,6 +16919,7 @@ var NgwLeaflet = (function () {
16919
16919
  };
16920
16920
  /** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
16921
16921
  WebMapLayers.prototype.addTileLayer = function (url, options) {
16922
+ if (options === void 0) { options = {}; }
16922
16923
  return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
16923
16924
  };
16924
16925
  WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
@@ -18707,6 +18708,7 @@ var NgwLeaflet = (function () {
18707
18708
  this.id = ID$1++;
18708
18709
  this.emitter = new events.exports.EventEmitter();
18709
18710
  this.routeStr = '/api/component/pyramid/route';
18711
+ this.activeRequests = [];
18710
18712
  var exist = findConnector(options);
18711
18713
  if (exist) {
18712
18714
  return exist;
@@ -18792,6 +18794,7 @@ var NgwLeaflet = (function () {
18792
18794
  * Disconnecting a user. Aborting all current requests
18793
18795
  */
18794
18796
  NgwConnector.prototype.logout = function () {
18797
+ this.abort();
18795
18798
  removeConnector(this);
18796
18799
  this.options.auth = undefined;
18797
18800
  this.user = undefined;
@@ -18844,6 +18847,17 @@ var NgwLeaflet = (function () {
18844
18847
  }
18845
18848
  }
18846
18849
  };
18850
+ /** Stop all api requests */
18851
+ NgwConnector.prototype.abort = function () {
18852
+ for (var _i = 0, _a = this.activeRequests; _i < _a.length; _i++) {
18853
+ var req = _a[_i];
18854
+ req.cancel();
18855
+ }
18856
+ this.activeRequests = [];
18857
+ };
18858
+ NgwConnector.prototype.getActiveApiRequests = function () {
18859
+ return __spreadArray([], this.activeRequests, true);
18860
+ };
18847
18861
  /**
18848
18862
  * Send request to NGW api router.
18849
18863
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -19065,7 +19079,13 @@ var NgwLeaflet = (function () {
19065
19079
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
19066
19080
  }
19067
19081
  loadData(url, resolve, options, reject, onCancel);
19068
- }).catch(function (httpError) {
19082
+ })
19083
+ .then(function (resp) {
19084
+ _this._cleanActiveRequests(request);
19085
+ return resp;
19086
+ })
19087
+ .catch(function (httpError) {
19088
+ _this._cleanActiveRequests(request);
19069
19089
  if (httpError instanceof CancelablePromise.CancelError) ;
19070
19090
  else {
19071
19091
  // @ts-ignore
@@ -19084,8 +19104,15 @@ var NgwLeaflet = (function () {
19084
19104
  request.cancel();
19085
19105
  });
19086
19106
  }
19107
+ this.activeRequests.push(request);
19087
19108
  return request;
19088
19109
  };
19110
+ NgwConnector.prototype._cleanActiveRequests = function (request) {
19111
+ var activeRequestIndex = this.activeRequests.indexOf(request);
19112
+ if (activeRequestIndex !== -1) {
19113
+ this.activeRequests.splice(activeRequestIndex, 1);
19114
+ }
19115
+ };
19089
19116
  NgwConnector.prototype._handleHttpError = function (er) {
19090
19117
  if (er) {
19091
19118
  if (er instanceof NgwError) {
@@ -19898,6 +19925,8 @@ var NgwLeaflet = (function () {
19898
19925
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
19899
19926
  return {
19900
19927
  url: url,
19928
+ sourceLayer: 'ngw:' + resourceId,
19929
+ featureIdName: '$id',
19901
19930
  };
19902
19931
  }
19903
19932
  if (adapter === 'TERRAIN') {