@nextgis/ngw-leaflet 1.11.8 → 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.8; 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.8; 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
 
@@ -19254,7 +19254,19 @@ var NgwLeaflet = (function () {
19254
19254
  }
19255
19255
  // NGW REST API is not able to filtering by combined queries
19256
19256
  // therefore the filter is divided into several requests
19257
- 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) {
19258
19270
  if (_queries === void 0) { _queries = []; }
19259
19271
  if (_parentAllParams === void 0) { _parentAllParams = []; }
19260
19272
  var filters = opt.filters;
@@ -19276,46 +19288,39 @@ var NgwLeaflet = (function () {
19276
19288
  return ["".concat(isFldStr).concat(field_, "__").concat(operation), v];
19277
19289
  };
19278
19290
  if (logic === 'any') {
19279
- filters_.forEach(function (f) {
19291
+ for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
19292
+ var f = filters_1[_i];
19280
19293
  if (isPropertyFilter(f)) {
19281
19294
  _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)], false) })));
19282
19295
  }
19283
19296
  else {
19284
- createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
19297
+ getQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
19285
19298
  }
19286
- });
19299
+ }
19287
19300
  }
19288
19301
  else if (logic === 'all') {
19289
- var filters_2 = [];
19302
+ var filters_3 = [];
19290
19303
  var propertiesFilterList = [];
19291
- for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
19292
- var f = filters_1[_i];
19304
+ for (var _a = 0, filters_2 = filters_; _a < filters_2.length; _a++) {
19305
+ var f = filters_2[_a];
19293
19306
  if (isPropertyFilter(f)) {
19294
- filters_2.push(createParam(f));
19307
+ filters_3.push(createParam(f));
19295
19308
  }
19296
19309
  else {
19297
19310
  propertiesFilterList.push(f);
19298
19311
  }
19299
19312
  }
19300
19313
  if (propertiesFilterList.length) {
19301
- for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
19302
- var x = propertiesFilterList_1[_a];
19303
- 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));
19304
19317
  }
19305
19318
  }
19306
19319
  else {
19307
- _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) })));
19308
19321
  }
19309
19322
  }
19310
- return CancelablePromise.all(_queries).then(function (itemsParts) {
19311
- var items = itemsParts.reduce(function (a, b) { return a.concat(b); }, []);
19312
- var offset = opt.offset !== undefined ? opt.offset : 0;
19313
- var limit = opt.limit !== undefined ? opt.limit : items.length;
19314
- if (opt.offset || opt.limit) {
19315
- return items.splice(offset, limit);
19316
- }
19317
- return items;
19318
- });
19323
+ return _queries;
19319
19324
  }
19320
19325
  function createWktFromCoordArray(coord) {
19321
19326
  var polygon = coord.map(function (_a) {
@@ -19393,7 +19398,7 @@ var NgwLeaflet = (function () {
19393
19398
  if (filters) {
19394
19399
  return createFeatureFieldFilterQueries(__assign(__assign({}, options), { filters: filters })).then(function (data) {
19395
19400
  // Additional client-side filter check
19396
- data.filter(function (y) {
19401
+ data = data.filter(function (y) {
19397
19402
  var fields = prepareNgwFieldsToPropertiesFilter(__assign({}, y.fields));
19398
19403
  var result = propertiesFilter(fields, filters);
19399
19404
  return result;