@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
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -15555,9 +15555,6 @@ const paintTypeAlias = {
15555
15555
  line: 'path',
15556
15556
  point: 'circle',
15557
15557
  };
15558
- /**
15559
- * @internal
15560
- */
15561
15558
  const typeAlias$1 = {
15562
15559
  Point: 'point',
15563
15560
  LineString: 'line',
@@ -18622,6 +18619,13 @@ function fetchNgwLayerItemExtent({ resourceId, featureId, connector, cache = tru
18622
18619
  }
18623
18620
  });
18624
18621
  }
18622
+ function fetchNgwExtent(options) {
18623
+ return options.connector.getResource(options.resourceId).then((resource) => {
18624
+ if (resource) {
18625
+ return fetchNgwResourceExtent(resource, options.connector);
18626
+ }
18627
+ });
18628
+ }
18625
18629
  /** @deprecated use {@link fetchNgwExtent} instead */
18626
18630
  function fetchNgwResourceExtent(item, connector) {
18627
18631
  if (item.webmap) {
@@ -18709,7 +18713,19 @@ function updateItemRequestParam(params, options) {
18709
18713
  }
18710
18714
  // NGW REST API is not able to filtering by combined queries
18711
18715
  // therefore the filter is divided into several requests
18712
- 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 = []) {
18713
18729
  const { filters } = opt;
18714
18730
  const logic = typeof filters[0] === 'string' ? filters[0] : 'all';
18715
18731
  const filters_ = filters.filter((x) => Array.isArray(x));
@@ -18729,7 +18745,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18729
18745
  return [`${isFldStr}${field_}__${operation}`, v];
18730
18746
  };
18731
18747
  if (logic === 'any') {
18732
- filters_.forEach((f) => {
18748
+ for (const f of filters_) {
18733
18749
  if (isPropertyFilter(f)) {
18734
18750
  _queries.push(fetchNgwLayerItemsRequest({
18735
18751
  ...opt,
@@ -18737,12 +18753,12 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18737
18753
  }));
18738
18754
  }
18739
18755
  else {
18740
- createFeatureFieldFilterQueries({
18756
+ getQueries({
18741
18757
  ...opt,
18742
18758
  filters: f,
18743
18759
  }, _queries, [..._parentAllParams]);
18744
18760
  }
18745
- });
18761
+ }
18746
18762
  }
18747
18763
  else if (logic === 'all') {
18748
18764
  const filters = [];
@@ -18757,7 +18773,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18757
18773
  }
18758
18774
  if (propertiesFilterList.length) {
18759
18775
  for (const x of propertiesFilterList) {
18760
- createFeatureFieldFilterQueries({
18776
+ getQueries({
18761
18777
  ...opt,
18762
18778
  filters: x,
18763
18779
  }, _queries, [..._parentAllParams, ...filters]);
@@ -18770,15 +18786,7 @@ function createFeatureFieldFilterQueries(opt, _queries = [], _parentAllParams =
18770
18786
  }));
18771
18787
  }
18772
18788
  }
18773
- return CancelablePromise.all(_queries).then((itemsParts) => {
18774
- const items = itemsParts.reduce((a, b) => a.concat(b), []);
18775
- const offset = opt.offset !== undefined ? opt.offset : 0;
18776
- const limit = opt.limit !== undefined ? opt.limit : items.length;
18777
- if (opt.offset || opt.limit) {
18778
- return items.splice(offset, limit);
18779
- }
18780
- return items;
18781
- });
18789
+ return _queries;
18782
18790
  }
18783
18791
  function createWktFromCoordArray(coord) {
18784
18792
  const polygon = coord.map(([lng, lat]) => {
@@ -18860,7 +18868,7 @@ function fetchNgwLayerItems(options) {
18860
18868
  filters,
18861
18869
  }).then((data) => {
18862
18870
  // Additional client-side filter check
18863
- data.filter((y) => {
18871
+ data = data.filter((y) => {
18864
18872
  const fields = prepareNgwFieldsToPropertiesFilter({ ...y.fields });
18865
18873
  const result = propertiesFilter(fields, filters);
18866
18874
  return result;
@@ -19001,7 +19009,7 @@ async function createGeoJsonAdapter(props) {
19001
19009
  const hasData = this.getLayers && this.getLayers().length;
19002
19010
  const strategy = this.options.strategy;
19003
19011
  if ((strategy === null || strategy === void 0 ? void 0 : strategy.startsWith('BBOX')) || hasData) {
19004
- return fetchNgwResourceExtent(item, connector);
19012
+ return fetchNgwExtent({ connector, resourceId: item.resource.id });
19005
19013
  }
19006
19014
  else {
19007
19015
  if (super.getBounds) {
@@ -21423,9 +21431,9 @@ class NgwMap extends WebMap {
21423
21431
  *
21424
21432
  * @example
21425
21433
  * ```javascript
21426
- * // add raster layer resourceId is the style of 4004 layer
21434
+ * // Add raster layer resourceId is the style of 4004 layer
21427
21435
  * ngwMap.addNgwLayer({ resource: 4005 });
21428
- * // add vector data from layer GEOJSON source
21436
+ * // Add vector data from layer GEOJSON source
21429
21437
  * ngwMap.addNgwLayer({
21430
21438
  * resource: 4038,
21431
21439
  * adapter: 'GEOJSON',
@@ -21584,7 +21592,7 @@ class NgwMap extends WebMap {
21584
21592
  *
21585
21593
  * @example
21586
21594
  * ```javascript
21587
- * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resourceId: 4005 });
21595
+ * const ngwLayer = ngwMap.addNgwLayer({ id: 'ngw_layer_name', resource: 4005 });
21588
21596
  * ngwMap.fitLayer(ngwLayer);
21589
21597
  * ngwMap.fitLayer('ngw_layer_name');
21590
21598
  * ```