azure-maps-control 2.2.3 → 2.2.4

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.
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
265
265
  return Url;
266
266
  }());
267
267
 
268
- var version = "2.2.3";
268
+ var version = "2.2.4";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -306,27 +306,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
306
306
  var tooltipContent = document.createElement("span");
307
307
  tooltipContent.innerText = name;
308
308
  tooltipContent.classList.add('tooltiptext');
309
- // mimics default edge tooltip theming
310
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
311
- tooltipContent.classList.add('dark');
312
- }
313
- var themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
314
- var onThemeChange = function (e) {
315
- var isDark = e.matches;
316
- if (isDark && !tooltipContent.classList.contains('dark')) {
317
- tooltipContent.classList.add('dark');
318
- }
319
- else if (!isDark && tooltipContent.classList.contains('dark')) {
320
- tooltipContent.classList.remove('dark');
321
- }
322
- };
323
- // compensate for browsers where MediaQueryList is not derived from EventTarget (pre iOS13 Safari)
324
- if (typeof themeQuery.addEventListener === 'function') {
325
- themeQuery.addEventListener('change', function (e) { return onThemeChange(e); });
326
- }
327
- else if (typeof themeQuery.addListener === 'function') {
328
- themeQuery.addListener(function (e) { return onThemeChange(e); });
329
- }
330
309
  if (navigator.userAgent.indexOf('Edg') != -1) {
331
310
  tooltipContent.classList.add('edge');
332
311
  }
@@ -4514,6 +4493,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4514
4493
  }
4515
4494
  });
4516
4495
  container.addEventListener("focusout", function (event) {
4496
+ if (event.target === currStyleButton) {
4497
+ // on focusout from reveal button -> reset the tabIndex on the styleOpsGrid elements that could have been set to -1 on esc key press
4498
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.removeAttribute('tabIndex'); });
4499
+ }
4517
4500
  if (!(event.relatedTarget instanceof Node && container.contains(event.relatedTarget))) {
4518
4501
  _this.hasFocus = false;
4519
4502
  if (!_this.hasMouse) {
@@ -4528,6 +4511,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4528
4511
  if (event.keyCode === 27) {
4529
4512
  event.stopPropagation();
4530
4513
  currStyleButton.focus();
4514
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.setAttribute('tabIndex', "-1"); });
4531
4515
  if (container.classList.contains(StyleControl.Css.inUse)) {
4532
4516
  container.classList.remove(StyleControl.Css.inUse);
4533
4517
  styleOpsGrid.classList.add("hidden-accessible-element");
@@ -16004,6 +15988,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
16004
15988
  }
16005
15989
  return ar;
16006
15990
  };
15991
+ var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
15992
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
15993
+ to[j] = from[i];
15994
+ return to;
15995
+ };
16007
15996
 
16008
15997
  /**
16009
15998
  * @private
@@ -17635,7 +17624,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17635
17624
  }
17636
17625
  return ar;
17637
17626
  };
17638
- var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
17627
+ var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
17639
17628
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
17640
17629
  to[j] = from[i];
17641
17630
  return to;
@@ -18071,7 +18060,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18071
18060
  // If a specified layer hasn't been added to the map throw an error.
18072
18061
  var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
18073
18062
  if (index > -1) {
18074
- layerIds.push.apply(layerIds, __spreadArray$2([], __read$8(this_1.layerIndex[index]._getLayerIds()
18063
+ layerIds.push.apply(layerIds, __spreadArray$3([], __read$8(this_1.layerIndex[index]._getLayerIds()
18075
18064
  .filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
18076
18065
  }
18077
18066
  else {
@@ -18830,7 +18819,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18830
18819
  }
18831
18820
  return ar;
18832
18821
  };
18833
- var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
18822
+ var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
18834
18823
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
18835
18824
  to[j] = from[i];
18836
18825
  return to;
@@ -18905,7 +18894,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18905
18894
  }
18906
18895
  finally { if (e_1) throw e_1.error; }
18907
18896
  }
18908
- return _super.prototype.merge.apply(this, __spreadArray$3([], __read$9(valuesList)));
18897
+ return _super.prototype.merge.apply(this, __spreadArray$4([], __read$9(valuesList)));
18909
18898
  };
18910
18899
  return CameraBoundsOptions;
18911
18900
  }(Options));
@@ -19394,7 +19383,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19394
19383
  }
19395
19384
  return ar;
19396
19385
  };
19397
- var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
19386
+ var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
19398
19387
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19399
19388
  to[j] = from[i];
19400
19389
  return to;
@@ -19553,7 +19542,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19553
19542
  finally { if (e_1) throw e_1.error; }
19554
19543
  }
19555
19544
  // Then execute the standard merge behavior.
19556
- return _super.prototype.merge.apply(this, __spreadArray$4([], __read$a(valueList)));
19545
+ return _super.prototype.merge.apply(this, __spreadArray$5([], __read$a(valueList)));
19557
19546
  };
19558
19547
  return StyleOptions;
19559
19548
  }(Options));
@@ -19611,7 +19600,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19611
19600
  }
19612
19601
  return ar;
19613
19602
  };
19614
- var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
19603
+ var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
19615
19604
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19616
19605
  to[j] = from[i];
19617
19606
  return to;
@@ -19846,10 +19835,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19846
19835
  // won't change default behavior in Options as usually that's what desired
19847
19836
  // instead capture it here and reassign.
19848
19837
  var currentTransforms = this._transformers;
19849
- var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$5(__spreadArray$5([], __read$b(flattened)), __read$b(value._transformers || [])); }, []) : [];
19838
+ var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$6(__spreadArray$6([], __read$b(flattened)), __read$b(value._transformers || [])); }, []) : [];
19850
19839
  // Then execute the standard merge behavior.
19851
19840
  // If subscription key auth method isn't being used then the subscription key property should be undefined.
19852
- var merged = _super.prototype.merge.apply(this, __spreadArray$5([], __read$b(valueList)));
19841
+ var merged = _super.prototype.merge.apply(this, __spreadArray$6([], __read$b(valueList)));
19853
19842
  if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
19854
19843
  merged["subscription-key"] = merged.subscriptionKey = undefined;
19855
19844
  }
@@ -19861,7 +19850,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19861
19850
  if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
19862
19851
  merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
19863
19852
  }
19864
- this._transformers = __spreadArray$5(__spreadArray$5([], __read$b(currentTransforms || [])), __read$b(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
19853
+ this._transformers = __spreadArray$6(__spreadArray$6([], __read$b(currentTransforms || [])), __read$b(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
19865
19854
  if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
19866
19855
  this._transformers.push(this.transformRequest);
19867
19856
  }
@@ -20109,7 +20098,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20109
20098
  }
20110
20099
  return ar;
20111
20100
  };
20112
- var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
20101
+ var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
20113
20102
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20114
20103
  to[j] = from[i];
20115
20104
  return to;
@@ -20162,7 +20151,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20162
20151
  var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
20163
20152
  var _b = __read$c(_a, 2), groupName = _b[0], layers = _b[1];
20164
20153
  var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
20165
- return __spreadArray$6(__spreadArray$6([], __read$c(deferred)), __read$c(layers.filter(function (layer) {
20154
+ return __spreadArray$7(__spreadArray$7([], __read$c(deferred)), __read$c(layers.filter(function (layer) {
20166
20155
  var _a;
20167
20156
  // Exclude custom layers
20168
20157
  if (layer.type === 'custom')
@@ -20354,7 +20343,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20354
20343
  domain: _this.serviceOptions.staticAssetsDomain,
20355
20344
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
20356
20345
  queryParams: {
20357
- styleVersion: _this.serviceOptions.styleDefinitionsVersion,
20346
+ // Use the style version from the API response if it's available,
20347
+ // otherwise fallback to the version specified in the serviceOptions.
20348
+ // This is needed for flight testing the 2023-01-01 style version.
20349
+ styleVersion: definitions.version !== undefined && definitions.version !== null
20350
+ ? definitions.version
20351
+ : _this.serviceOptions.styleDefinitionsVersion
20358
20352
  // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
20359
20353
  //language: styleOptions.language
20360
20354
  },
@@ -20645,27 +20639,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20645
20639
  * Fetches a json resource at the specified domain and path.
20646
20640
  */
20647
20641
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
20648
- var _a;
20642
+ var _a, _b;
20649
20643
  if (customQueryParams === void 0) { customQueryParams = {}; }
20650
20644
  return __awaiter$2(this, void 0, void 0, function () {
20651
20645
  var requestParams, fetchOptions;
20652
- var _b;
20653
- return __generator$2(this, function (_c) {
20654
- switch (_c.label) {
20646
+ var _c;
20647
+ return __generator$2(this, function (_d) {
20648
+ switch (_d.label) {
20655
20649
  case 0:
20656
20650
  requestParams = {
20657
20651
  url: new Url({
20658
20652
  protocol: "https",
20659
20653
  domain: domain,
20660
20654
  path: path,
20661
- queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
20655
+ queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
20656
+ // Generate a hash code to avoid cache conflict
20657
+ // TODO: Remove this once style version 2023-01-01 is publicly available
20658
+ _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
20662
20659
  }).toString()
20663
20660
  };
20664
20661
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
20665
20662
  // If a transformRequest(...) was specified use it.
20666
20663
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
20667
20664
  }
20668
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
20665
+ (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
20669
20666
  fetchOptions = {
20670
20667
  method: "GET",
20671
20668
  mode: "cors",
@@ -20682,11 +20679,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20682
20679
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
20683
20680
  }
20684
20681
  })];
20685
- case 1: return [2 /*return*/, _c.sent()];
20682
+ case 1: return [2 /*return*/, _d.sent()];
20686
20683
  }
20687
20684
  });
20688
20685
  });
20689
20686
  };
20687
+ /**
20688
+ * A basic helper function to generate a hash from an input string.
20689
+ */
20690
+ StyleManager._hashCode = function (str) {
20691
+ if (str === void 0) { str = ""; }
20692
+ var chr, hash = 0;
20693
+ if (!str)
20694
+ return hash;
20695
+ for (var i = 0; i < str.length; i++) {
20696
+ chr = str.charCodeAt(i);
20697
+ hash = (hash << 5) - hash + chr;
20698
+ hash |= 0; // Convert to 32bit integer
20699
+ }
20700
+ return hash;
20701
+ };
20690
20702
  return StyleManager;
20691
20703
  }());
20692
20704
 
@@ -20773,7 +20785,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20773
20785
  }
20774
20786
  return ar;
20775
20787
  };
20776
- var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
20788
+ var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
20777
20789
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20778
20790
  to[j] = from[i];
20779
20791
  return to;
@@ -20956,7 +20968,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20956
20968
  _this.events.invoke("error", errorData);
20957
20969
  });
20958
20970
  // --> Set initial camera state of map
20959
- _this.setCamera(__assign$9(__assign$9({}, options), { type: "jump", duration: 0 }));
20971
+ _this.setCamera(__assign$9(__assign$9({
20972
+ // Default minZoom to ensure the map doesn't zoom out to unsupported zoom levels.
20973
+ minZoom: 1 }, options), { type: "jump", duration: 0 }));
20960
20974
  _this.flowDelegate = new FlowServiceDelegate(_this);
20961
20975
  _this.accessibleMapDelegate = new AccessibleMapDelegate(_this);
20962
20976
  _this.userInteractionDelegate = new UserInteractionDelegate(_this, options);
@@ -21572,7 +21586,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21572
21586
  urls = layer.getOptions().subdomains || [];
21573
21587
  }
21574
21588
  // Add the tile urls to the layer, but don't update the map yet.
21575
- urls.push.apply(urls, __spreadArray$7([], __read$d(tileSources)));
21589
+ urls.push.apply(urls, __spreadArray$8([], __read$d(tileSources)));
21576
21590
  layer._setOptionsNoUpdate({
21577
21591
  subdomains: urls
21578
21592
  });
@@ -21741,9 +21755,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21741
21755
  * Clean up the map's resources. Map will not function correctly after calling this method.
21742
21756
  */
21743
21757
  Map.prototype.dispose = function () {
21758
+ var _a;
21744
21759
  this.clear();
21745
21760
  this.map.remove();
21761
+ (_a = this.authentication) === null || _a === void 0 ? void 0 : _a.dispose();
21746
21762
  this.removed = true;
21763
+ // Remove event listeners
21764
+ window.removeEventListener("resize", this._windowResizeCallback);
21747
21765
  while (this.getMapContainer().firstChild) {
21748
21766
  var currChild = this.getMapContainer().firstChild;
21749
21767
  this.getMapContainer().removeChild(currChild);
@@ -22088,7 +22106,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22088
22106
  }
22089
22107
  return ar;
22090
22108
  };
22091
- var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
22109
+ var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
22092
22110
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
22093
22111
  to[j] = from[i];
22094
22112
  return to;
@@ -22234,7 +22252,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22234
22252
  lineLength = 50;
22235
22253
  }
22236
22254
  var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
22237
- longestStringLength = Math.max.apply(Math, __spreadArray$8([], __read$e((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
22255
+ longestStringLength = Math.max.apply(Math, __spreadArray$9([], __read$e((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
22238
22256
  var w = Math.ceil(longestStringLength * 3.5);
22239
22257
  if (w < width) {
22240
22258
  width = w;