@nextgis/ngw-map 1.12.0 → 1.12.1

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.12.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.12.1; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.12.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.12.1; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -1305,6 +1305,9 @@ function objectRemoveEmpty(obj) {
1305
1305
 
1306
1306
  function isObject$1(val) {
1307
1307
  return Object.prototype.toString.call(val) === '[object Object]';
1308
+ }
1309
+ function isArray(val) {
1310
+ return Object.prototype.toString.call(val) === '[object Array]';
1308
1311
  }
1309
1312
 
1310
1313
  function fixUrlStr(url) {
@@ -2368,6 +2371,9 @@ var WebMapMain = /** @class */ (function () {
2368
2371
  'movestart',
2369
2372
  'move',
2370
2373
  'moveend',
2374
+ 'mousemove',
2375
+ 'mouseout',
2376
+ 'mouseover',
2371
2377
  ];
2372
2378
  if (opt && opt.include) {
2373
2379
  events = events.filter(function (x) { return opt.include.includes(x); });
@@ -4175,6 +4181,11 @@ var loadData;
4175
4181
  xhr.abort();
4176
4182
  });
4177
4183
  }
4184
+ if (options.signal) {
4185
+ options.signal.addEventListener('abort', function () {
4186
+ xhr.abort();
4187
+ });
4188
+ }
4178
4189
  xhr.send(data);
4179
4190
  };
4180
4191
  }
@@ -4316,7 +4327,12 @@ var ResourcesControl = /** @class */ (function () {
4316
4327
  forCache.id = resource;
4317
4328
  }
4318
4329
  else if (isObject(resource)) {
4319
- forCache.id = resource.id;
4330
+ if (resource.id !== undefined) {
4331
+ forCache.id = resource.id;
4332
+ }
4333
+ else if (resource.keyname) {
4334
+ forCache.keyname = resource.keyname;
4335
+ }
4320
4336
  }
4321
4337
  var makeRequest = function () {
4322
4338
  if (typeof resource === 'string') {
@@ -4418,20 +4434,35 @@ var ResourcesControl = /** @class */ (function () {
4418
4434
  };
4419
4435
  ResourcesControl.prototype.getChildrenOf = function (resource, requestOptions) {
4420
4436
  var _this = this;
4421
- return this.getId(resource).then(function (parent) {
4422
- return _this.connector
4423
- .get('resource.collection', __assign({ cache: true }, requestOptions), {
4424
- parent: parent,
4425
- })
4426
- .then(function (items) {
4427
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
4428
- var i = items_1[_i];
4429
- _this.cache.add('resource.item', CancelablePromise.resolve(i), {
4430
- id: i.resource.id,
4431
- });
4437
+ return this.getIdOrFail(resource).then(function (parent) {
4438
+ return _this._getChildrenOf(parent, requestOptions);
4439
+ });
4440
+ };
4441
+ ResourcesControl.prototype._getChildrenOf = function (parent, requestOptions, _items) {
4442
+ var _this = this;
4443
+ if (_items === void 0) { _items = []; }
4444
+ return this.connector
4445
+ .get('resource.collection', __assign({ cache: true }, requestOptions), {
4446
+ parent: parent,
4447
+ })
4448
+ .then(function (items) {
4449
+ var recursivePromises = [];
4450
+ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
4451
+ var item = items_1[_i];
4452
+ _this.cache.add('resource.item', CancelablePromise.resolve(item), {
4453
+ id: item.resource.id,
4454
+ });
4455
+ _items.push(item);
4456
+ if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.recursive) && item.resource.children) {
4457
+ recursivePromises.push(_this._getChildrenOf(item.resource.id, requestOptions, _items));
4432
4458
  }
4433
- return items;
4434
- });
4459
+ }
4460
+ if (recursivePromises.length) {
4461
+ return CancelablePromise.all(recursivePromises).then(function () {
4462
+ return _items;
4463
+ });
4464
+ }
4465
+ return _items;
4435
4466
  });
4436
4467
  };
4437
4468
  ResourcesControl.prototype.update = function (resource, data) {
@@ -5324,6 +5355,7 @@ function fetchNgwLayerItemsRequest(options) {
5324
5355
  }
5325
5356
 
5326
5357
  function prepareNgwFieldsToPropertiesFilter(fields) {
5358
+ console.log(fields);
5327
5359
  var f;
5328
5360
  var _loop_1 = function () {
5329
5361
  var field = fields[f];
@@ -5343,6 +5375,9 @@ function prepareNgwFieldsToPropertiesFilter(fields) {
5343
5375
  fields[f] = new (Date.bind.apply(Date, __spreadArray([void 0], dt_1, false)))().toISOString();
5344
5376
  }
5345
5377
  }
5378
+ else if (f === 'id' && typeof field === 'string') {
5379
+ fields[f] = field.split(',').map(Number);
5380
+ }
5346
5381
  };
5347
5382
  for (f in fields) {
5348
5383
  _loop_1();
@@ -5355,7 +5390,7 @@ function fetchNgwLayerItems(options) {
5355
5390
  if (filters) {
5356
5391
  return createFeatureFieldFilterQueries(__assign(__assign({}, options), { filters: filters })).then(function (data) {
5357
5392
  var _a;
5358
- var clientFilterValidate = (_a = options.clientFilterValidate) !== null && _a !== void 0 ? _a : true;
5393
+ var clientFilterValidate = (_a = options.clientFilterValidate) !== null && _a !== void 0 ? _a : isFilterWithAnyCase(filters);
5359
5394
  // Additional client-side filter check
5360
5395
  if (clientFilterValidate) {
5361
5396
  data = data.filter(function (y) {
@@ -5370,6 +5405,21 @@ function fetchNgwLayerItems(options) {
5370
5405
  else {
5371
5406
  return fetchNgwLayerItemsRequest(options);
5372
5407
  }
5408
+ }
5409
+ function isFilterWithAnyCase(filters) {
5410
+ if (filters[0] === 'any') {
5411
+ return true;
5412
+ }
5413
+ for (var i = 1; i < filters.length; i++) {
5414
+ var p = filters[i];
5415
+ if (isArray(p)) {
5416
+ var deep = isFilterWithAnyCase(p);
5417
+ if (deep) {
5418
+ return true;
5419
+ }
5420
+ }
5421
+ }
5422
+ return false;
5373
5423
  }
5374
5424
 
5375
5425
  function fetchNgwLayerFeatures(options) {
@@ -7919,7 +7969,6 @@ function fetchNgwLayerFeature(options) {
7919
7969
 
7920
7970
  function getIdentifyItems(identify, multiple) {
7921
7971
  if (multiple === void 0) { multiple = false; }
7922
- var params;
7923
7972
  var resources = [];
7924
7973
  var paramsList = [];
7925
7974
  for (var l in identify) {
@@ -7940,14 +7989,9 @@ function getIdentifyItems(identify, multiple) {
7940
7989
  if ('features' in identifyItem) {
7941
7990
  var layerFeatures = identifyItem.features;
7942
7991
  var resourceId = Number(l);
7943
- var feature = layerFeatures[0];
7944
- if (feature) {
7945
- params = {
7946
- featureId: feature.id,
7947
- resourceId: resourceId,
7948
- feature: feature,
7949
- };
7950
- paramsList.push(params);
7992
+ var featureParams = createParamsFromFeatures(layerFeatures, resourceId, multiple);
7993
+ if (featureParams.length) {
7994
+ paramsList.push.apply(paramsList, featureParams);
7951
7995
  if (!multiple) {
7952
7996
  break;
7953
7997
  }
@@ -7956,6 +8000,22 @@ function getIdentifyItems(identify, multiple) {
7956
8000
  }
7957
8001
  return paramsList;
7958
8002
  }
8003
+ function createParamsFromFeatures(features, resourceId, multiple) {
8004
+ var featureParams = [];
8005
+ for (var _i = 0, features_1 = features; _i < features_1.length; _i++) {
8006
+ var feature = features_1[_i];
8007
+ var params = {
8008
+ featureId: feature.id,
8009
+ resourceId: resourceId,
8010
+ feature: feature,
8011
+ };
8012
+ featureParams.push(params);
8013
+ if (!multiple) {
8014
+ break;
8015
+ }
8016
+ }
8017
+ return featureParams;
8018
+ }
7959
8019
  function fetchIdentifyGeoJson(options) {
7960
8020
  var connector = options.connector, identify = options.identify;
7961
8021
  for (var l in identify) {