@nextgis/ngw-leaflet 1.11.2 → 1.11.9

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.11.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.11.9; 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.11.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.11.9; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15723,9 +15723,6 @@ var NgwLeaflet = (function () {
15723
15723
  line: 'path',
15724
15724
  point: 'circle',
15725
15725
  };
15726
- /**
15727
- * @internal
15728
- */
15729
15726
  var typeAlias$1 = {
15730
15727
  Point: 'point',
15731
15728
  LineString: 'line',
@@ -19151,6 +19148,13 @@ var NgwLeaflet = (function () {
19151
19148
  }
19152
19149
  });
19153
19150
  }
19151
+ function fetchNgwExtent(options) {
19152
+ return options.connector.getResource(options.resourceId).then(function (resource) {
19153
+ if (resource) {
19154
+ return fetchNgwResourceExtent(resource, options.connector);
19155
+ }
19156
+ });
19157
+ }
19154
19158
  /** @deprecated use {@link fetchNgwExtent} instead */
19155
19159
  function fetchNgwResourceExtent(item, connector) {
19156
19160
  if (item.webmap) {
@@ -19250,7 +19254,19 @@ var NgwLeaflet = (function () {
19250
19254
  }
19251
19255
  // NGW REST API is not able to filtering by combined queries
19252
19256
  // therefore the filter is divided into several requests
19253
- function createFeatureFieldFilterQueries(opt, _queries, _parentAllParams) {
19257
+ function createFeatureFieldFilterQueries(opt) {
19258
+ var queries = getQueries(opt);
19259
+ return CancelablePromise.all(queries).then(function (itemsParts) {
19260
+ var items = itemsParts.reduce(function (a, b) { return a.concat(b); }, []);
19261
+ var offset = opt.offset !== undefined ? opt.offset : 0;
19262
+ var limit = opt.limit !== undefined ? opt.limit : items.length;
19263
+ if (opt.offset || opt.limit) {
19264
+ return items.splice(offset, limit);
19265
+ }
19266
+ return items;
19267
+ });
19268
+ }
19269
+ function getQueries(opt, _queries, _parentAllParams) {
19254
19270
  if (_queries === void 0) { _queries = []; }
19255
19271
  if (_parentAllParams === void 0) { _parentAllParams = []; }
19256
19272
  var filters = opt.filters;
@@ -19272,46 +19288,39 @@ var NgwLeaflet = (function () {
19272
19288
  return ["".concat(isFldStr).concat(field_, "__").concat(operation), v];
19273
19289
  };
19274
19290
  if (logic === 'any') {
19275
- filters_.forEach(function (f) {
19291
+ for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
19292
+ var f = filters_1[_i];
19276
19293
  if (isPropertyFilter(f)) {
19277
19294
  _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)], false) })));
19278
19295
  }
19279
19296
  else {
19280
- createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
19297
+ getQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
19281
19298
  }
19282
- });
19299
+ }
19283
19300
  }
19284
19301
  else if (logic === 'all') {
19285
- var filters_2 = [];
19302
+ var filters_3 = [];
19286
19303
  var propertiesFilterList = [];
19287
- for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
19288
- var f = filters_1[_i];
19304
+ for (var _a = 0, filters_2 = filters_; _a < filters_2.length; _a++) {
19305
+ var f = filters_2[_a];
19289
19306
  if (isPropertyFilter(f)) {
19290
- filters_2.push(createParam(f));
19307
+ filters_3.push(createParam(f));
19291
19308
  }
19292
19309
  else {
19293
19310
  propertiesFilterList.push(f);
19294
19311
  }
19295
19312
  }
19296
19313
  if (propertiesFilterList.length) {
19297
- for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
19298
- var x = propertiesFilterList_1[_a];
19299
- createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true));
19314
+ for (var _b = 0, propertiesFilterList_1 = propertiesFilterList; _b < propertiesFilterList_1.length; _b++) {
19315
+ var x = propertiesFilterList_1[_b];
19316
+ getQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_3, true));
19300
19317
  }
19301
19318
  }
19302
19319
  else {
19303
- _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true) })));
19320
+ _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_3, true) })));
19304
19321
  }
19305
19322
  }
19306
- return CancelablePromise.all(_queries).then(function (itemsParts) {
19307
- var items = itemsParts.reduce(function (a, b) { return a.concat(b); }, []);
19308
- var offset = opt.offset !== undefined ? opt.offset : 0;
19309
- var limit = opt.limit !== undefined ? opt.limit : items.length;
19310
- if (opt.offset || opt.limit) {
19311
- return items.splice(offset, limit);
19312
- }
19313
- return items;
19314
- });
19323
+ return _queries;
19315
19324
  }
19316
19325
  function createWktFromCoordArray(coord) {
19317
19326
  var polygon = coord.map(function (_a) {
@@ -19389,7 +19398,7 @@ var NgwLeaflet = (function () {
19389
19398
  if (filters) {
19390
19399
  return createFeatureFieldFilterQueries(__assign(__assign({}, options), { filters: filters })).then(function (data) {
19391
19400
  // Additional client-side filter check
19392
- data.filter(function (y) {
19401
+ data = data.filter(function (y) {
19393
19402
  var fields = prepareNgwFieldsToPropertiesFilter(__assign({}, y.fields));
19394
19403
  var result = propertiesFilter(fields, filters);
19395
19404
  return result;
@@ -19547,7 +19556,7 @@ var NgwLeaflet = (function () {
19547
19556
  hasData = this.getLayers && this.getLayers().length;
19548
19557
  strategy = this.options.strategy;
19549
19558
  if ((strategy === null || strategy === void 0 ? void 0 : strategy.startsWith('BBOX')) || hasData) {
19550
- return [2 /*return*/, fetchNgwResourceExtent(item, connector)];
19559
+ return [2 /*return*/, fetchNgwExtent({ connector: connector, resourceId: item.resource.id })];
19551
19560
  }
19552
19561
  else {
19553
19562
  if (_super.prototype.getBounds) {
@@ -22294,9 +22303,9 @@ var NgwLeaflet = (function () {
22294
22303
  *
22295
22304
  * @example
22296
22305
  * ```javascript
22297
- * // add raster layer resourceId is the style of 4004 layer
22306
+ * // Add raster layer resourceId is the style of 4004 layer
22298
22307
  * ngwMap.addNgwLayer({ resource: 4005 });
22299
- * // add vector data from layer GEOJSON source
22308
+ * // Add vector data from layer GEOJSON source
22300
22309
  * ngwMap.addNgwLayer({
22301
22310
  * resource: 4038,
22302
22311
  * adapter: 'GEOJSON',
@@ -22482,7 +22491,7 @@ var NgwLeaflet = (function () {
22482
22491
  *
22483
22492
  * @example
22484
22493
  * ```javascript
22485
- * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resourceId: 4005 });
22494
+ * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resource: 4005 });
22486
22495
  * ngwMap.fitLayer(ngwLayer);
22487
22496
  * ngwMap.fitLayer('ngw_layer_name');
22488
22497
  * ```