@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
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -18713,7 +18713,19 @@ function updateItemRequestParam(params, options) {
18713
18713
  }
18714
18714
  // NGW REST API is not able to filtering by combined queries
18715
18715
  // therefore the filter is divided into several requests
18716
- function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams = []) {
18716
+ function createFeatureFieldFilterQueries(opt) {
18717
+ const queries = getQueries(opt);
18718
+ return CancelablePromise.all(queries).then((itemsParts) => {
18719
+ const items = itemsParts.reduce((a, b) => a.concat(b), []);
18720
+ const offset = opt.offset !== undefined ? opt.offset : 0;
18721
+ const limit = opt.limit !== undefined ? opt.limit : items.length;
18722
+ if (opt.offset || opt.limit) {
18723
+ return items.splice(offset, limit);
18724
+ }
18725
+ return items;
18726
+ });
18727
+ }
18728
+ function getQueries(opt, _queries = [], _parentAllParams = []) {
18717
18729
  const { filters } = opt;
18718
18730
  const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
18719
18731
  const filters_ = filters.filter((x) => Array.isArray(x));
@@ -18733,7 +18745,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18733
18745
  return [`${isFldStr}${field_}__${operation}`, v];
18734
18746
  };
18735
18747
  if (logic === 'any') {
18736
- filters_.forEach((f) => {
18748
+ for (const f of filters_) {
18737
18749
  if (isPropertyFilter(f)) {
18738
18750
  _queries.push(fetchNgwLayerItemsRequest({
18739
18751
  ...opt,
@@ -18741,12 +18753,12 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18741
18753
  }));
18742
18754
  }
18743
18755
  else {
18744
- createFeatureFieldFilterQueries({
18756
+ getQueries({
18745
18757
  ...opt,
18746
18758
  filters: f,
18747
18759
  }, _queries, [..._parentAllParams]);
18748
18760
  }
18749
- });
18761
+ }
18750
18762
  }
18751
18763
  else if (logic === 'all') {
18752
18764
  const filters = [];
@@ -18761,7 +18773,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18761
18773
  }
18762
18774
  if (propertiesFilterList.length) {
18763
18775
  for (const x of propertiesFilterList) {
18764
- createFeatureFieldFilterQueries({
18776
+ getQueries({
18765
18777
  ...opt,
18766
18778
  filters: x,
18767
18779
  }, _queries, [..._parentAllParams, ...filters]);
@@ -18774,15 +18786,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18774
18786
  }));
18775
18787
  }
18776
18788
  }
18777
- return CancelablePromise.all(_queries).then((itemsParts) => {
18778
- const items = itemsParts.reduce((a, b) => a.concat(b), []);
18779
- const offset = opt.offset !== undefined ? opt.offset : 0;
18780
- const limit = opt.limit !== undefined ? opt.limit : items.length;
18781
- if (opt.offset || opt.limit) {
18782
- return items.splice(offset, limit);
18783
- }
18784
- return items;
18785
- });
18789
+ return _queries;
18786
18790
  }
18787
18791
  function createWktFromCoordArray(coord) {
18788
18792
  const polygon = coord.map(([lng, lat]) => {
@@ -18864,7 +18868,7 @@ function fetchNgwLayerItems(options) {
18864
18868
  filters,
18865
18869
  }).then((data) => {
18866
18870
  // Additional client-side filter check
18867
- data.filter((y) => {
18871
+ data = data.filter((y) => {
18868
18872
  const fields = prepareNgwFieldsToPropertiesFilter({ ...y.fields });
18869
18873
  const result = propertiesFilter(fields, filters);
18870
18874
  return result;