@nextgis/ngw-map 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-map; version: 1.11.8; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.11.9; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { deepmerge, deprecatedWarn, defined, isObject } from '@nextgis/utils';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.11.8; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.11.9; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -5193,7 +5193,19 @@ var NgwMap = (function (exports) {
5193
5193
  }
5194
5194
  // NGW REST API is not able to filtering by combined queries
5195
5195
  // therefore the filter is divided into several requests
5196
- function createFeatureFieldFilterQueries(opt, _queries, _parentAllParams) {
5196
+ function createFeatureFieldFilterQueries(opt) {
5197
+ var queries = getQueries(opt);
5198
+ return CancelablePromise.all(queries).then(function (itemsParts) {
5199
+ var items = itemsParts.reduce(function (a, b) { return a.concat(b); }, []);
5200
+ var offset = opt.offset !== undefined ? opt.offset : 0;
5201
+ var limit = opt.limit !== undefined ? opt.limit : items.length;
5202
+ if (opt.offset || opt.limit) {
5203
+ return items.splice(offset, limit);
5204
+ }
5205
+ return items;
5206
+ });
5207
+ }
5208
+ function getQueries(opt, _queries, _parentAllParams) {
5197
5209
  if (_queries === void 0) { _queries = []; }
5198
5210
  if (_parentAllParams === void 0) { _parentAllParams = []; }
5199
5211
  var filters = opt.filters;
@@ -5215,46 +5227,39 @@ var NgwMap = (function (exports) {
5215
5227
  return ["".concat(isFldStr).concat(field_, "__").concat(operation), v];
5216
5228
  };
5217
5229
  if (logic === 'any') {
5218
- filters_.forEach(function (f) {
5230
+ for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
5231
+ var f = filters_1[_i];
5219
5232
  if (isPropertyFilter(f)) {
5220
5233
  _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)], false) })));
5221
5234
  }
5222
5235
  else {
5223
- createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
5236
+ getQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams, true));
5224
5237
  }
5225
- });
5238
+ }
5226
5239
  }
5227
5240
  else if (logic === 'all') {
5228
- var filters_2 = [];
5241
+ var filters_3 = [];
5229
5242
  var propertiesFilterList = [];
5230
- for (var _i = 0, filters_1 = filters_; _i < filters_1.length; _i++) {
5231
- var f = filters_1[_i];
5243
+ for (var _a = 0, filters_2 = filters_; _a < filters_2.length; _a++) {
5244
+ var f = filters_2[_a];
5232
5245
  if (isPropertyFilter(f)) {
5233
- filters_2.push(createParam(f));
5246
+ filters_3.push(createParam(f));
5234
5247
  }
5235
5248
  else {
5236
5249
  propertiesFilterList.push(f);
5237
5250
  }
5238
5251
  }
5239
5252
  if (propertiesFilterList.length) {
5240
- for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
5241
- var x = propertiesFilterList_1[_a];
5242
- createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true));
5253
+ for (var _b = 0, propertiesFilterList_1 = propertiesFilterList; _b < propertiesFilterList_1.length; _b++) {
5254
+ var x = propertiesFilterList_1[_b];
5255
+ getQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_3, true));
5243
5256
  }
5244
5257
  }
5245
5258
  else {
5246
- _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_2, true) })));
5259
+ _queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_3, true) })));
5247
5260
  }
5248
5261
  }
5249
- return CancelablePromise.all(_queries).then(function (itemsParts) {
5250
- var items = itemsParts.reduce(function (a, b) { return a.concat(b); }, []);
5251
- var offset = opt.offset !== undefined ? opt.offset : 0;
5252
- var limit = opt.limit !== undefined ? opt.limit : items.length;
5253
- if (opt.offset || opt.limit) {
5254
- return items.splice(offset, limit);
5255
- }
5256
- return items;
5257
- });
5262
+ return _queries;
5258
5263
  }
5259
5264
  function createWktFromCoordArray(coord) {
5260
5265
  var polygon = coord.map(function (_a) {
@@ -5332,7 +5337,7 @@ var NgwMap = (function (exports) {
5332
5337
  if (filters) {
5333
5338
  return createFeatureFieldFilterQueries(__assign(__assign({}, options), { filters: filters })).then(function (data) {
5334
5339
  // Additional client-side filter check
5335
- data.filter(function (y) {
5340
+ data = data.filter(function (y) {
5336
5341
  var fields = prepareNgwFieldsToPropertiesFilter(__assign({}, y.fields));
5337
5342
  var result = propertiesFilter(fields, filters);
5338
5343
  return result;