@nextgis/ngw-leaflet 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-leaflet; version: 1.12.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.12.1; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -15396,6 +15396,9 @@ function objectRemoveEmpty(obj) {
15396
15396
 
15397
15397
  function isObject$1(val) {
15398
15398
  return Object.prototype.toString.call(val) === '[object Object]';
15399
+ }
15400
+ function isArray(val) {
15401
+ return Object.prototype.toString.call(val) === '[object Array]';
15399
15402
  }
15400
15403
 
15401
15404
  function fixUrlStr(url) {
@@ -16459,6 +16462,9 @@ var WebMapMain = /** @class */ (function () {
16459
16462
  'movestart',
16460
16463
  'move',
16461
16464
  'moveend',
16465
+ 'mousemove',
16466
+ 'mouseout',
16467
+ 'mouseover',
16462
16468
  ];
16463
16469
  if (opt && opt.include) {
16464
16470
  events = events.filter(function (x) { return opt.include.includes(x); });
@@ -18248,6 +18254,11 @@ var loadData;
18248
18254
  xhr.abort();
18249
18255
  });
18250
18256
  }
18257
+ if (options.signal) {
18258
+ options.signal.addEventListener('abort', function () {
18259
+ xhr.abort();
18260
+ });
18261
+ }
18251
18262
  xhr.send(data);
18252
18263
  };
18253
18264
  }
@@ -18389,7 +18400,12 @@ var ResourcesControl = /** @class */ (function () {
18389
18400
  forCache.id = resource;
18390
18401
  }
18391
18402
  else if (isObject(resource)) {
18392
- forCache.id = resource.id;
18403
+ if (resource.id !== undefined) {
18404
+ forCache.id = resource.id;
18405
+ }
18406
+ else if (resource.keyname) {
18407
+ forCache.keyname = resource.keyname;
18408
+ }
18393
18409
  }
18394
18410
  var makeRequest = function () {
18395
18411
  if (typeof resource === 'string') {
@@ -18491,20 +18507,35 @@ var ResourcesControl = /** @class */ (function () {
18491
18507
  };
18492
18508
  ResourcesControl.prototype.getChildrenOf = function (resource, requestOptions) {
18493
18509
  var _this = this;
18494
- return this.getId(resource).then(function (parent) {
18495
- return _this.connector
18496
- .get('resource.collection', __assign({ cache: true }, requestOptions), {
18497
- parent: parent,
18498
- })
18499
- .then(function (items) {
18500
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
18501
- var i = items_1[_i];
18502
- _this.cache.add('resource.item', CancelablePromise.resolve(i), {
18503
- id: i.resource.id,
18504
- });
18510
+ return this.getIdOrFail(resource).then(function (parent) {
18511
+ return _this._getChildrenOf(parent, requestOptions);
18512
+ });
18513
+ };
18514
+ ResourcesControl.prototype._getChildrenOf = function (parent, requestOptions, _items) {
18515
+ var _this = this;
18516
+ if (_items === void 0) { _items = []; }
18517
+ return this.connector
18518
+ .get('resource.collection', __assign({ cache: true }, requestOptions), {
18519
+ parent: parent,
18520
+ })
18521
+ .then(function (items) {
18522
+ var recursivePromises = [];
18523
+ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
18524
+ var item = items_1[_i];
18525
+ _this.cache.add('resource.item', CancelablePromise.resolve(item), {
18526
+ id: item.resource.id,
18527
+ });
18528
+ _items.push(item);
18529
+ if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.recursive) && item.resource.children) {
18530
+ recursivePromises.push(_this._getChildrenOf(item.resource.id, requestOptions, _items));
18505
18531
  }
18506
- return items;
18507
- });
18532
+ }
18533
+ if (recursivePromises.length) {
18534
+ return CancelablePromise.all(recursivePromises).then(function () {
18535
+ return _items;
18536
+ });
18537
+ }
18538
+ return _items;
18508
18539
  });
18509
18540
  };
18510
18541
  ResourcesControl.prototype.update = function (resource, data) {
@@ -19385,6 +19416,7 @@ function fetchNgwLayerItemsRequest(options) {
19385
19416
  }
19386
19417
 
19387
19418
  function prepareNgwFieldsToPropertiesFilter(fields) {
19419
+ console.log(fields);
19388
19420
  var f;
19389
19421
  var _loop_1 = function () {
19390
19422
  var field = fields[f];
@@ -19404,6 +19436,9 @@ function prepareNgwFieldsToPropertiesFilter(fields) {
19404
19436
  fields[f] = new (Date.bind.apply(Date, __spreadArray([void 0], dt_1, false)))().toISOString();
19405
19437
  }
19406
19438
  }
19439
+ else if (f === 'id' && typeof field === 'string') {
19440
+ fields[f] = field.split(',').map(Number);
19441
+ }
19407
19442
  };
19408
19443
  for (f in fields) {
19409
19444
  _loop_1();
@@ -19416,7 +19451,7 @@ function fetchNgwLayerItems(options) {
19416
19451
  if (filters) {
19417
19452
  return createFeatureFieldFilterQueries(__assign(__assign({}, options), { filters: filters })).then(function (data) {
19418
19453
  var _a;
19419
- var clientFilterValidate = (_a = options.clientFilterValidate) !== null && _a !== void 0 ? _a : true;
19454
+ var clientFilterValidate = (_a = options.clientFilterValidate) !== null && _a !== void 0 ? _a : isFilterWithAnyCase(filters);
19420
19455
  // Additional client-side filter check
19421
19456
  if (clientFilterValidate) {
19422
19457
  data = data.filter(function (y) {
@@ -19431,6 +19466,21 @@ function fetchNgwLayerItems(options) {
19431
19466
  else {
19432
19467
  return fetchNgwLayerItemsRequest(options);
19433
19468
  }
19469
+ }
19470
+ function isFilterWithAnyCase(filters) {
19471
+ if (filters[0] === 'any') {
19472
+ return true;
19473
+ }
19474
+ for (var i = 1; i < filters.length; i++) {
19475
+ var p = filters[i];
19476
+ if (isArray(p)) {
19477
+ var deep = isFilterWithAnyCase(p);
19478
+ if (deep) {
19479
+ return true;
19480
+ }
19481
+ }
19482
+ }
19483
+ return false;
19434
19484
  }
19435
19485
 
19436
19486
  function fetchNgwLayerFeatures(options) {
@@ -21980,7 +22030,6 @@ function fetchNgwLayerFeature(options) {
21980
22030
 
21981
22031
  function getIdentifyItems(identify, multiple) {
21982
22032
  if (multiple === void 0) { multiple = false; }
21983
- var params;
21984
22033
  var resources = [];
21985
22034
  var paramsList = [];
21986
22035
  for (var l in identify) {
@@ -22001,14 +22050,9 @@ function getIdentifyItems(identify, multiple) {
22001
22050
  if ('features' in identifyItem) {
22002
22051
  var layerFeatures = identifyItem.features;
22003
22052
  var resourceId = Number(l);
22004
- var feature = layerFeatures[0];
22005
- if (feature) {
22006
- params = {
22007
- featureId: feature.id,
22008
- resourceId: resourceId,
22009
- feature: feature,
22010
- };
22011
- paramsList.push(params);
22053
+ var featureParams = createParamsFromFeatures(layerFeatures, resourceId, multiple);
22054
+ if (featureParams.length) {
22055
+ paramsList.push.apply(paramsList, featureParams);
22012
22056
  if (!multiple) {
22013
22057
  break;
22014
22058
  }
@@ -22017,6 +22061,22 @@ function getIdentifyItems(identify, multiple) {
22017
22061
  }
22018
22062
  return paramsList;
22019
22063
  }
22064
+ function createParamsFromFeatures(features, resourceId, multiple) {
22065
+ var featureParams = [];
22066
+ for (var _i = 0, features_1 = features; _i < features_1.length; _i++) {
22067
+ var feature = features_1[_i];
22068
+ var params = {
22069
+ featureId: feature.id,
22070
+ resourceId: resourceId,
22071
+ feature: feature,
22072
+ };
22073
+ featureParams.push(params);
22074
+ if (!multiple) {
22075
+ break;
22076
+ }
22077
+ }
22078
+ return featureParams;
22079
+ }
22020
22080
  function fetchIdentifyGeoJson(options) {
22021
22081
  var connector = options.connector, identify = options.identify;
22022
22082
  for (var l in identify) {
@@ -24244,11 +24304,16 @@ var LeafletMapAdapter = /** @class */ (function () {
24244
24304
  this._universalEvents = [
24245
24305
  'move',
24246
24306
  'zoom',
24247
- 'moveend',
24248
24307
  'zoomend',
24249
24308
  'zoomstart',
24309
+ 'moveend',
24250
24310
  'movestart',
24251
24311
  ];
24312
+ this._positionEvents = [
24313
+ 'mousemove',
24314
+ 'mouseout',
24315
+ 'mouseover',
24316
+ ];
24252
24317
  }
24253
24318
  LeafletMapAdapter.prototype.create = function (options) {
24254
24319
  var _this = this;
@@ -24501,9 +24566,22 @@ var LeafletMapAdapter = /** @class */ (function () {
24501
24566
  map.on('click', function (evt) {
24502
24567
  _this.onMapClick(evt);
24503
24568
  });
24504
- this._universalEvents.forEach(function (e) {
24569
+ var _loop_1 = function (e) {
24505
24570
  map.on(e, function () { return _this.emitter.emit(e, _this); }, map);
24506
- });
24571
+ };
24572
+ for (var _i = 0, _a = this._universalEvents; _i < _a.length; _i++) {
24573
+ var e = _a[_i];
24574
+ _loop_1(e);
24575
+ }
24576
+ var _loop_2 = function (e) {
24577
+ map.on(e, function (evt) {
24578
+ return _this.emitter.emit(e, convertMapClickEvent(evt));
24579
+ }, map);
24580
+ };
24581
+ for (var _b = 0, _c = this._positionEvents; _b < _c.length; _b++) {
24582
+ var e = _c[_b];
24583
+ _loop_2(e);
24584
+ }
24507
24585
  }
24508
24586
  };
24509
24587
  LeafletMapAdapter.layerAdapters = {