@nextgis/ngw-leaflet 1.13.7 → 1.13.8

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.13.7; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.13.8; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -15594,16 +15594,17 @@ function updatePaintOptionFromCallback(paint, getPaintFunctions) {
15594
15594
  function createPropertiesPaint(propertiesPaint) {
15595
15595
  var mask = {};
15596
15596
  var paintsFilters = [];
15597
- propertiesPaint.forEach(function (x) {
15598
- if (x) {
15599
- if (Array.isArray(x)) {
15600
- paintsFilters.push(x);
15597
+ for (var _i = 0, propertiesPaint_1 = propertiesPaint; _i < propertiesPaint_1.length; _i++) {
15598
+ var p = propertiesPaint_1[_i];
15599
+ if (p) {
15600
+ if (Array.isArray(p)) {
15601
+ paintsFilters.push(p);
15601
15602
  }
15602
15603
  else {
15603
- mask = x;
15604
+ mask = p;
15604
15605
  }
15605
15606
  }
15606
- });
15607
+ }
15607
15608
  return function (feature) {
15608
15609
  var paint = paintsFilters.find(function (x) { return featureFilter(feature, x[0]); });
15609
15610
  if (paint) {
@@ -15643,9 +15644,11 @@ function preparePaint(paint, defaultPaint, getPaintFunctions) {
15643
15644
  else {
15644
15645
  var expressionCallback_1 = createExpressionCallback(paint);
15645
15646
  if (expressionCallback_1) {
15646
- return function (feature) {
15647
+ var expressionPaintCb = function (feature) {
15647
15648
  return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
15648
15649
  };
15650
+ expressionPaintCb.paint = paint;
15651
+ return expressionPaintCb;
15649
15652
  }
15650
15653
  newPaint = __assign(__assign({}, newPaint), paint);
15651
15654
  newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
@@ -19130,51 +19133,6 @@ var NgwConnector = /** @class */ (function () {
19130
19133
  return NgwConnector;
19131
19134
  }());
19132
19135
 
19133
- function createPopupContent(feature, item) {
19134
- // @ts-ignore
19135
- {
19136
- var element_1 = document.createElement('div');
19137
- if (item && item.feature_layer) {
19138
- item.feature_layer.fields.forEach(function (x) {
19139
- if (x.grid_visibility) {
19140
- var value = feature.properties && feature.properties[x.keyname];
19141
- if (value) {
19142
- var propElem = document.createElement('div');
19143
- element_1.appendChild(propElem);
19144
- propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
19145
- }
19146
- }
19147
- });
19148
- }
19149
- else if (feature.properties) {
19150
- for (var p in feature.properties) {
19151
- var propElem = document.createElement('div');
19152
- element_1.appendChild(propElem);
19153
- propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
19154
- }
19155
- }
19156
- return element_1;
19157
- }
19158
- }
19159
-
19160
- var filterOptionsKeys = [
19161
- 'fields',
19162
- 'intersects',
19163
- 'limit',
19164
- 'orderBy',
19165
- 'strategy',
19166
- ];
19167
- function getLayerFilterOptions(options) {
19168
- var filterOptions = {};
19169
- filterOptionsKeys.forEach(function (x) {
19170
- var opt = options[x];
19171
- if (opt !== undefined) {
19172
- filterOptions[x] = opt;
19173
- }
19174
- });
19175
- return filterOptions;
19176
- }
19177
-
19178
19136
  function getNgwWebmapExtent(webmap) {
19179
19137
  var bottom = webmap['extent_bottom'];
19180
19138
  var left = webmap['extent_left'];
@@ -19242,6 +19200,85 @@ function fetchNgwResourceExtent(item, connector, options) {
19242
19200
  }
19243
19201
  }
19244
19202
 
19203
+ var NgwResource = /** @class */ (function () {
19204
+ function NgwResource() {
19205
+ }
19206
+ /** @deprecated use {@link NgwResource.getBounds} instead */
19207
+ NgwResource.prototype.getExtent = function () {
19208
+ return __awaiter(this, void 0, void 0, function () {
19209
+ return __generator(this, function (_a) {
19210
+ return [2 /*return*/, this.getBounds()];
19211
+ });
19212
+ });
19213
+ };
19214
+ NgwResource.prototype.getBounds = function (options) {
19215
+ return __awaiter(this, void 0, void 0, function () {
19216
+ var _a;
19217
+ return __generator(this, function (_b) {
19218
+ switch (_b.label) {
19219
+ case 0:
19220
+ if (this._extent) {
19221
+ return [2 /*return*/, this._extent];
19222
+ }
19223
+ if (!this.item) return [3 /*break*/, 2];
19224
+ _a = this;
19225
+ return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
19226
+ case 1:
19227
+ _a._extent = _b.sent();
19228
+ return [2 /*return*/, this._extent];
19229
+ case 2: return [2 /*return*/];
19230
+ }
19231
+ });
19232
+ });
19233
+ };
19234
+ return NgwResource;
19235
+ }());
19236
+
19237
+ function createPopupContent(feature, item) {
19238
+ // @ts-ignore
19239
+ {
19240
+ var element_1 = document.createElement('div');
19241
+ if (item && item.feature_layer) {
19242
+ item.feature_layer.fields.forEach(function (x) {
19243
+ if (x.grid_visibility) {
19244
+ var value = feature.properties && feature.properties[x.keyname];
19245
+ if (value) {
19246
+ var propElem = document.createElement('div');
19247
+ element_1.appendChild(propElem);
19248
+ propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
19249
+ }
19250
+ }
19251
+ });
19252
+ }
19253
+ else if (feature.properties) {
19254
+ for (var p in feature.properties) {
19255
+ var propElem = document.createElement('div');
19256
+ element_1.appendChild(propElem);
19257
+ propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
19258
+ }
19259
+ }
19260
+ return element_1;
19261
+ }
19262
+ }
19263
+
19264
+ var filterOptionsKeys = [
19265
+ 'fields',
19266
+ 'intersects',
19267
+ 'limit',
19268
+ 'orderBy',
19269
+ 'strategy',
19270
+ ];
19271
+ function getLayerFilterOptions(options) {
19272
+ var filterOptions = {};
19273
+ filterOptionsKeys.forEach(function (x) {
19274
+ var opt = options[x];
19275
+ if (opt !== undefined) {
19276
+ filterOptions[x] = opt;
19277
+ }
19278
+ });
19279
+ return filterOptions;
19280
+ }
19281
+
19245
19282
  function resourceIdFromLayerOptions(options, connector) {
19246
19283
  return __awaiter(this, void 0, void 0, function () {
19247
19284
  var resource, item, keyname, resourceId, resourceItem;
@@ -19879,6 +19916,7 @@ function getImageAdapterOptions(_a) {
19879
19916
  };
19880
19917
  }
19881
19918
  function ngwApiToAdapterOptions(_a) {
19919
+ var _b;
19882
19920
  var options = _a.options, webMap = _a.webMap, baseUrl = _a.baseUrl;
19883
19921
  var adapter = options.adapter || 'IMAGE';
19884
19922
  var url;
@@ -19918,7 +19956,7 @@ function ngwApiToAdapterOptions(_a) {
19918
19956
  'resource=' +
19919
19957
  resourceId +
19920
19958
  '&simplification=' +
19921
- (options.simplification || 0);
19959
+ ((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
19922
19960
  // url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
19923
19961
  return {
19924
19962
  url: url,
@@ -19986,7 +20024,6 @@ function createRasterAdapter(_a) {
19986
20024
  return [2 /*return*/, /** @class */ (function (_super) {
19987
20025
  __extends(RasterAdapter, _super);
19988
20026
  function RasterAdapter(map, _options) {
19989
- var _a;
19990
20027
  var _this = _super.call(this, map, _options) || this;
19991
20028
  _this.map = map;
19992
20029
  // options = {};
@@ -19998,7 +20035,7 @@ function createRasterAdapter(_a) {
19998
20035
  baseUrl: connector.options.baseUrl || '',
19999
20036
  });
20000
20037
  if (opt) {
20001
- var layerAdapterOptions = __assign(__assign({}, opt), { setViewDelay: (_a = layerOptions.adapterOptions) === null || _a === void 0 ? void 0 : _a.setViewDelay, params: { resource: resourceId_1 },
20038
+ var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
20002
20039
  // @deprecated
20003
20040
  layers: String(resourceId_1), resourceId: resourceId_1 });
20004
20041
  if (layerOptions.adapterOptions &&
@@ -20031,11 +20068,16 @@ function createRasterAdapter(_a) {
20031
20068
  return __awaiter(this, void 0, void 0, function () {
20032
20069
  var id;
20033
20070
  return __generator(this, function (_a) {
20034
- id = this.item && this.item.resource.parent.id;
20035
- if (defined(id)) {
20036
- return [2 /*return*/, [id]];
20071
+ if (this.item) {
20072
+ if (adapter === 'MVT') {
20073
+ return [2 /*return*/, [this.item.resource.id]];
20074
+ }
20075
+ id = this.item.resource.parent.id;
20076
+ if (defined(id)) {
20077
+ return [2 /*return*/, [id]];
20078
+ }
20037
20079
  }
20038
- return [2 /*return*/];
20080
+ return [2 /*return*/, []];
20039
20081
  });
20040
20082
  });
20041
20083
  };
@@ -21441,40 +21483,6 @@ function createWebMapAdapter(_a) {
21441
21483
  });
21442
21484
  }
21443
21485
 
21444
- var NgwResource = /** @class */ (function () {
21445
- function NgwResource() {
21446
- }
21447
- /** @deprecated use {@link NgwResource.getBounds} instead */
21448
- NgwResource.prototype.getExtent = function () {
21449
- return __awaiter(this, void 0, void 0, function () {
21450
- return __generator(this, function (_a) {
21451
- return [2 /*return*/, this.getBounds()];
21452
- });
21453
- });
21454
- };
21455
- NgwResource.prototype.getBounds = function (options) {
21456
- return __awaiter(this, void 0, void 0, function () {
21457
- var _a;
21458
- return __generator(this, function (_b) {
21459
- switch (_b.label) {
21460
- case 0:
21461
- if (this._extent) {
21462
- return [2 /*return*/, this._extent];
21463
- }
21464
- if (!this.item) return [3 /*break*/, 2];
21465
- _a = this;
21466
- return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
21467
- case 1:
21468
- _a._extent = _b.sent();
21469
- return [2 /*return*/, this._extent];
21470
- case 2: return [2 /*return*/];
21471
- }
21472
- });
21473
- });
21474
- };
21475
- return NgwResource;
21476
- }());
21477
-
21478
21486
  var alias = {
21479
21487
  tms: 'TILE',
21480
21488
  };
@@ -21702,7 +21710,7 @@ function createAdapterFromFirstStyle(_a) {
21702
21710
  }
21703
21711
  function createAsyncAdapter(options, webMap, connector) {
21704
21712
  return __awaiter(this, void 0, void 0, function () {
21705
- var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, parentItem, parentOptions, getClassAdapter, classAdapter;
21713
+ var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, type, adapterOptions_, parentItem, parentOptions, getClassAdapter, classAdapter;
21706
21714
  return __generator(this, function (_a) {
21707
21715
  switch (_a.label) {
21708
21716
  case 0:
@@ -21738,6 +21746,12 @@ function createAsyncAdapter(options, webMap, connector) {
21738
21746
  return [3 /*break*/, 11];
21739
21747
  case 5:
21740
21748
  if (!(cls === 'vector_layer')) return [3 /*break*/, 6];
21749
+ type = item.vector_layer &&
21750
+ vectorLayerGeomToPaintTypeAlias[item.vector_layer.geometry_type];
21751
+ adapterOptions_ = adapterOptions.layerOptions.adapterOptions || {};
21752
+ adapterOptions_.type = adapterOptions_.type || type;
21753
+ adapterOptions.layerOptions.adapterOptions = adapterOptions_;
21754
+ options.adapterOptions = adapterOptions;
21741
21755
  if (adapterType !== undefined && adapterType !== 'GEOJSON') {
21742
21756
  if (adapterType === 'MVT') {
21743
21757
  adapter = createRasterAdapter(adapterOptions);
@@ -22918,7 +22932,7 @@ var NgwMap = /** @class */ (function (_super) {
22918
22932
  };
22919
22933
  NgwMap.prototype._selectFromNgwRaster = function (ev) {
22920
22934
  return __awaiter(this, void 0, void 0, function () {
22921
- var promises, layers, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
22935
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
22922
22936
  var _this = this;
22923
22937
  return __generator(this, function (_a) {
22924
22938
  switch (_a.label) {
@@ -22932,15 +22946,16 @@ var NgwMap = /** @class */ (function (_super) {
22932
22946
  }
22933
22947
  return 1;
22934
22948
  });
22935
- layers.forEach(function (l) {
22936
- var layer = l.layer;
22937
- var identFunc = typeof layer.getIdentificationIds === 'function'
22949
+ for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
22950
+ l = layers_1[_i];
22951
+ layer = l.layer;
22952
+ identFunc = typeof layer.getIdentificationIds === 'function'
22938
22953
  ? layer.getIdentificationIds
22939
22954
  : false;
22940
- if (identFunc && layer.options.selectable && _this.isLayerVisible(layer)) {
22955
+ if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22941
22956
  promises.push(identFunc.call(layer));
22942
22957
  }
22943
- });
22958
+ }
22944
22959
  getIdsPromise = Promise.all(promises);
22945
22960
  return [4 /*yield*/, getIdsPromise];
22946
22961
  case 1: