azure-maps-control 2.1.16 → 2.1.17

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.
package/dist/atlas.js CHANGED
@@ -43217,6 +43217,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43217
43217
  apiVersionQueryParameter: "api-version",
43218
43218
  authorizationHeaderName: "Authorization",
43219
43219
  authorizationTokenPrefix: "Bearer ",
43220
+ jwtSasPrefix: "jwt-sas ",
43220
43221
  domainPlaceHolder: "{{azMapsDomain}}",
43221
43222
  legacyDomainPlaceHolder: "{azMapsDomain}",
43222
43223
  viewPlaceHolder: "{{azMapsView}}",
@@ -43487,7 +43488,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43488
  return Url;
43488
43489
  }());
43489
43490
 
43490
- var version = "2.1.16";
43491
+ var version = "2.1.17";
43491
43492
 
43492
43493
  /**
43493
43494
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43845,7 +43846,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43845
43846
  delete this._container;
43846
43847
  }
43847
43848
  if (this._map) {
43848
- this._map.events.remove("styledata", this._onStyleChange);
43849
+ this._map.events.remove("stylechanged", this._onStyleChange);
43849
43850
  delete this._map;
43850
43851
  }
43851
43852
  if (this._observer) {
@@ -43869,7 +43870,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43869
43870
  if (style.toLowerCase() === exports.ControlStyle.auto) {
43870
43871
  this._map.styles.definitions().then(function (definitions) {
43871
43872
  if (_this._map) {
43872
- _this._map.events.add("styledata", _this._onStyleChange);
43873
+ _this._map.events.add("stylechanged", _this._onStyleChange);
43873
43874
  }
43874
43875
  });
43875
43876
  }
@@ -43982,6 +43983,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43982
43983
  }
43983
43984
  }
43984
43985
  });
43986
+ // Keep the focus on this control when esc key is pressed on the grid
43987
+ grid.addEventListener("keydown", function (event) {
43988
+ if (event.key === "Escape" || event.key === "Esc") {
43989
+ event.stopPropagation();
43990
+ rotationButton.focus();
43991
+ container.classList.remove("in-use");
43992
+ grid.classList.add("hidden-accessible-element");
43993
+ }
43994
+ });
43985
43995
  // If the control's position will require inverting the element order
43986
43996
  // add them in the opposite order to preserve tabindex.
43987
43997
  if (options && CompassControl.InvertOrderPositions.includes(options.position)) {
@@ -44129,6 +44139,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44129
44139
  var _this = _super.call(this) || this;
44130
44140
  _this.container = null;
44131
44141
  _this.map = null;
44142
+ _this.pitchButton = null;
44132
44143
  _this.pitchIncrementButton = null;
44133
44144
  _this.pitchDecrementButton = null;
44134
44145
  _this.hasMouse = false;
@@ -44137,6 +44148,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44137
44148
  _this.updatePitchButtonsState = function () {
44138
44149
  var minPitchReached = _this.map.getCamera().pitch <= 0;
44139
44150
  var maxPitchReached = _this.map.getCamera().pitch >= 60;
44151
+ // Keep the focus on this control when max/min pitch is reached
44152
+ if (_this.hasFocus && _this.pitchButton && (minPitchReached || maxPitchReached)) {
44153
+ _this.pitchButton.focus();
44154
+ }
44140
44155
  if (_this.options.inverted) {
44141
44156
  if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != minPitchReached) {
44142
44157
  _this.pitchIncrementButton.disabled = minPitchReached;
@@ -44199,6 +44214,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44199
44214
  }
44200
44215
  }
44201
44216
  });
44217
+ // Keep the focus on this control when esc key is pressed on the grid
44218
+ grid.addEventListener("keydown", function (event) {
44219
+ if (event.key === "Escape" || event.key === "Esc") {
44220
+ event.stopPropagation();
44221
+ pitchButton.focus();
44222
+ container.classList.remove("in-use");
44223
+ grid.classList.add("hidden-accessible-element");
44224
+ }
44225
+ });
44202
44226
  // If the control's position will require inverting the element order
44203
44227
  // add them in the opposite order to preserve tabindex.
44204
44228
  if (options && PitchControl.INVERT_ORDER_POSITIONS.includes(options.position)) {
@@ -44215,6 +44239,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44215
44239
  }
44216
44240
  this.map = map;
44217
44241
  this.container = container;
44242
+ this.pitchButton = pitchButton;
44218
44243
  map.events.add('pitch', this.pitchChanged);
44219
44244
  this.updatePitchButtonsState();
44220
44245
  return container;
@@ -44223,6 +44248,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44223
44248
  if (this.container) {
44224
44249
  this.container.remove();
44225
44250
  this.container = null;
44251
+ this.pitchButton = null;
44226
44252
  this.pitchIncrementButton = null;
44227
44253
  this.pitchDecrementButton = null;
44228
44254
  }
@@ -47577,7 +47603,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47577
47603
  _super.prototype.onRemove.call(this);
47578
47604
  this.styleOpsGrid = null;
47579
47605
  this.styleButtons.clear();
47580
- this.map.events.remove("styledata", this.onStyleChange);
47606
+ this.map.events.remove("stylechanged", this.onStyleChange);
47581
47607
  this.map.events.remove("stylesetchanged", this.onStylesetChange);
47582
47608
  };
47583
47609
  /**
@@ -47632,7 +47658,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47632
47658
  var _this = this;
47633
47659
  var styleOptionButton = document.createElement("button");
47634
47660
  var friendlyName = this.mapToFriendlyStyleName(name, styleset);
47635
- styleOptionButton.setAttribute("alt", friendlyName);
47661
+ styleOptionButton.setAttribute("aria-label", friendlyName);
47636
47662
  styleOptionButton.setAttribute("type", "button");
47637
47663
  var styleIconImage = new Image();
47638
47664
  fetchIconPromise
@@ -47652,9 +47678,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47652
47678
  }
47653
47679
  _this.styleIcons.set(name, iconUrl);
47654
47680
  });
47655
- if (this.options.layout === "icons") {
47656
- styleIconImage.alt = friendlyName;
47657
- }
47681
+ styleIconImage.setAttribute("aria-hidden", "true");
47658
47682
  styleOptionButton.appendChild(styleIconImage);
47659
47683
  if (this.options.layout === "icons") {
47660
47684
  styleOptionButton.classList.add(StyleControl.Css.button);
@@ -47694,7 +47718,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47694
47718
  }
47695
47719
  selectCurrButton.classList.add(StyleControl.Css.currentStyle);
47696
47720
  selectCurrButton.setAttribute("aria-label", "Select Style");
47697
- selectCurrButton.setAttribute("alt", "Select Style");
47698
47721
  selectCurrButton.setAttribute("tabindex", "-1");
47699
47722
  this.currStyleImage = new Image();
47700
47723
  selectCurrButton.appendChild(this.currStyleImage);
@@ -47720,7 +47743,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47720
47743
  this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
47721
47744
  return __generator(this, function (_a) {
47722
47745
  this.onStylesetChange(definitions);
47723
- this.map.events.add("styledata", this.onStyleChange);
47746
+ this.map.events.add("stylechanged", this.onStyleChange);
47724
47747
  return [2 /*return*/];
47725
47748
  });
47726
47749
  }); });
@@ -47970,6 +47993,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47970
47993
  _this.table = ["Fast",
47971
47994
  ["green", "yellow", "red", "dark-red"],
47972
47995
  "Slow"];
47996
+ _this.map = null;
47997
+ _this.syncHiddenState = null;
47973
47998
  return _this;
47974
47999
  }
47975
48000
  /**
@@ -47979,11 +48004,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47979
48004
  * @return An HTMLElement to be placed on the map for the control.
47980
48005
  */
47981
48006
  TrafficLegendControl.prototype.onAdd = function (map) {
48007
+ this.map = map;
47982
48008
  var container = this.buildContainer(map, exports.ControlStyle.auto, "Traffic Legend");
47983
48009
  var TrafficLegendDiv = this.buildTrafficLegendDiv(map);
48010
+ container.setAttribute("role", "definition");
47984
48011
  container.appendChild(TrafficLegendDiv);
47985
48012
  return container;
47986
48013
  };
48014
+ TrafficLegendControl.prototype.onRemove = function () {
48015
+ _super.prototype.onRemove.call(this);
48016
+ if (this.syncHiddenState) {
48017
+ this.map.events.remove('styledata', this.syncHiddenState);
48018
+ this.syncHiddenState = null;
48019
+ }
48020
+ this.map = null;
48021
+ };
47987
48022
  TrafficLegendControl.prototype.buildTrafficLegendDiv = function (map) {
47988
48023
  var e_1, _a, e_2, _b;
47989
48024
  var trafficLegend = document.createElement("div");
@@ -48048,8 +48083,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48048
48083
  }
48049
48084
  trafficLegendTable.appendChild(tr2);
48050
48085
  trafficLegend.appendChild(trafficLegendTable);
48051
- // display legend when the traffic flow is shown, hide it otherwise
48052
- map.events.add("styledata", function (eventData) {
48086
+ this.syncHiddenState = function (eventData) {
48053
48087
  if (eventData.dataType === "style") {
48054
48088
  var trafficOptions = map.getTraffic();
48055
48089
  if (trafficOptions.flow && trafficOptions.flow !== "none") {
@@ -48059,7 +48093,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48059
48093
  trafficLegend.classList.add("hidden");
48060
48094
  }
48061
48095
  }
48062
- });
48096
+ };
48097
+ // display legend when the traffic flow is shown, hide it otherwise
48098
+ this.syncHiddenState({ dataType: 'style' });
48099
+ map.events.add("styledata", this.syncHiddenState);
48063
48100
  return trafficLegend;
48064
48101
  };
48065
48102
  return TrafficLegendControl;
@@ -55890,6 +55927,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55890
55927
  // They must use setOptions(...).
55891
55928
  return cloneDeepWith_1(this.options, PopupOptions._cloneCustomizer);
55892
55929
  };
55930
+ /**
55931
+ * Returns popup container element.
55932
+ */
55933
+ Popup.prototype.getPopupContainer = function () {
55934
+ return this.containerDiv;
55935
+ };
55893
55936
  /**
55894
55937
  * Drags the popup to the specified pixel.
55895
55938
  * Accounts for the pixel offset when dragging started.
@@ -56919,6 +56962,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56919
56962
  * Literal value `"anonymous"`
56920
56963
  */
56921
56964
  AuthenticationType["anonymous"] = "anonymous";
56965
+ /**
56966
+ * The shared access signature authentication mechanism. Allows a callback responsible for acquiring a token to be provided on requests.
56967
+ * Literal value `"sas"`.
56968
+ */
56969
+ AuthenticationType["sas"] = "sas";
56922
56970
  })(exports.AuthenticationType || (exports.AuthenticationType = {}));
56923
56971
  /**
56924
56972
  * Options for specifying how the map control should authenticate with the Azure Maps services.
@@ -56958,11 +57006,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56958
57006
  */
56959
57007
  _this.aadInstance = undefined;
56960
57008
  /**
56961
- * A callback to use with the anonymous authentication mechanism.
57009
+ * A callback to use with the anonymous/sas authentication mechanism.
56962
57010
  * This callback will be responsible for resolving to a authentication token.
56963
57011
  * E.g. fetching a CORS protected token from an endpoint.
56964
57012
  */
56965
57013
  _this.getToken = undefined;
57014
+ /**
57015
+ * Optionally provide an initial token for sas authentication.
57016
+ */
57017
+ _this.sasToken = undefined;
56966
57018
  /**
56967
57019
  * Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
56968
57020
  * This authentication context will be used to acquire the AAD token.
@@ -57005,6 +57057,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57005
57057
  this.authType = exports.AuthenticationType.anonymous;
57006
57058
  this.getToken = getTokenCallback;
57007
57059
  };
57060
+ /**
57061
+ * Sets the required options to configure the sas authentication method.
57062
+ * @param getTokenCallback Callback function responsible for resolving to an authentication token.
57063
+ */
57064
+ AuthenticationOptions.prototype.setSasCallbackFunction = function (getTokenCallback) {
57065
+ this.authType = exports.AuthenticationType.sas;
57066
+ this.getToken = getTokenCallback;
57067
+ };
57008
57068
  /**
57009
57069
  * Override the standard merge behavior to handle mutually exclusive options.
57010
57070
  * @internal
@@ -57024,6 +57084,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57024
57084
  else if (merged.authType === exports.AuthenticationType.anonymous) {
57025
57085
  merged.subscriptionKey = merged.authContext = merged.aadAppId = undefined;
57026
57086
  }
57087
+ else if (merged.authType === exports.AuthenticationType.sas) {
57088
+ merged.authContext = merged.subscriptionKey = merged.aadAppId = undefined;
57089
+ }
57027
57090
  return merged;
57028
57091
  };
57029
57092
  return AuthenticationOptions;
@@ -67931,7 +67994,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
67931
67994
  path: "search/address/reverse/json",
67932
67995
  queryParams: __assign({ "api-version": "1.0", "language": options.style.language, "limit": 1, "query": normalizeLatitude(options.position[1]) + "," + normalizeLongitude(options.position[0]) }, (options.style.view && { view: options.style.view }))
67933
67996
  };
67934
- return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
67997
+ return new Url(((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)) || urlOptions).get();
67935
67998
  };
67936
67999
  return NearbyGeographySearchService;
67937
68000
  }());
@@ -69135,8 +69198,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69135
69198
  _this.createMapKeyBindingInfo();
69136
69199
  _this.map.getMapContainer().setAttribute("role", "application");
69137
69200
  _this.map.getMapContainer().setAttribute("aria-label", "Map Application");
69201
+ _this.map.getCanvasContainer().setAttribute("aria-live", "polite");
69202
+ _this.map.getCanvasContainer().setAttribute("aria-describedby", "atlas-map-state atlas-map-style");
69138
69203
  _this.map.getCanvas().setAttribute("aria-label", "Interactive Map");
69139
- _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-state atlas-map-style atlas-map-shortcuts");
69204
+ _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-shortcuts");
69140
69205
  _this.map.getCanvas().setAttribute("alt", "Interactive Map");
69141
69206
  };
69142
69207
  this.removeFromMap = function () {
@@ -69158,10 +69223,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69158
69223
  delete _this.atlasMapStyleInfo;
69159
69224
  _this.map.getMapContainer().removeAttribute("role");
69160
69225
  _this.map.getMapContainer().removeAttribute("aria-label");
69226
+ _this.map.getCanvasContainer().removeAttribute("aria-live");
69227
+ _this.map.getCanvasContainer().removeAttribute("aria-describedby");
69161
69228
  _this.map.getCanvas().removeAttribute("aria-label");
69162
69229
  _this.map.getCanvas().removeAttribute("aria-describedby");
69163
69230
  _this.map.getCanvas().removeAttribute("alt");
69164
- _this.map.events.remove("styledata", _this.updateMapStyle);
69231
+ _this.map.events.remove("stylechanged", _this.updateMapStyle);
69165
69232
  };
69166
69233
  this.createMapKeyBindingInfo = function () {
69167
69234
  _this.atlasMapKeyBindings = document.createElement("div");
@@ -69186,7 +69253,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69186
69253
  "Jump focus to the map: Escape."
69187
69254
  ].join("\n");
69188
69255
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
69189
- _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
69190
69256
  var baseShortcutKeyCodes = [
69191
69257
  // - (zoom out)
69192
69258
  189,
@@ -69218,7 +69284,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69218
69284
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
69219
69285
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
69220
69286
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
69221
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
69222
69287
  }
69223
69288
  };
69224
69289
  this.initializeMapStyleInfo = function () {
@@ -69227,10 +69292,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69227
69292
  _this.atlasMapStyleInfo.setAttribute("aria-hidden", "true");
69228
69293
  _this.atlasMapStyleInfo.id = "atlas-map-style";
69229
69294
  _this.atlasMapStyleInfo.classList.add("hidden-accessible-element");
69230
- _this.updateMapStyle();
69231
- _this.map.events.add("styledata", _this.updateMapStyle);
69295
+ _this.map.events.add("stylechanged", _this.updateMapStyle);
69232
69296
  _this.map.getCanvasContainer().appendChild(_this.atlasMapStyleInfo);
69233
- _this.atlasMapStyleInfo.setAttribute("aria-live", "polite");
69234
69297
  };
69235
69298
  this.updateMapStyle = function () {
69236
69299
  _this.atlasMapStyleInfo.innerHTML = "<p>Map style: " + _this.map.getStyle().style + ".</p>";
@@ -69528,15 +69591,106 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69528
69591
  _this.map.layers.add(_this.incidentLayer, "labels");
69529
69592
  }
69530
69593
  //Create a popup but leave it closed so we can update it and display it later.
69531
- _this.popup = new Popup({
69594
+ _this.clickPopup = new Popup({
69532
69595
  position: [0, 0],
69533
69596
  pixelOffset: [0, -18]
69534
69597
  });
69535
69598
  _this.map.addEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
69536
69599
  _this.map.addEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
69537
69600
  _this.map.addEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
69601
+ _this.map.events.addOnce('idle', _this.setAccessiblePopups);
69602
+ _this.map.events.add('moveend', _this.setAccessiblePopups);
69538
69603
  };
69604
+ this.accessiblePopups = [];
69605
+ this.setAccessiblePopups = function () { return __awaiter(_this, void 0, void 0, function () {
69606
+ var features, localizedStrings, createPopup, insertHiddenBefore, insertHiddenInFront, addHidden;
69607
+ var _this = this;
69608
+ return __generator(this, function (_a) {
69609
+ switch (_a.label) {
69610
+ case 0:
69611
+ this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
69612
+ this.accessiblePopups = [];
69613
+ features = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this.incidentLayer);
69614
+ return [4 /*yield*/, this.map._getLocalizedStrings()];
69615
+ case 1:
69616
+ localizedStrings = _a.sent();
69617
+ createPopup = function (features, idx) {
69618
+ var incidentFeature = features[idx];
69619
+ var incidentPosition = incidentFeature.geometry.coordinates;
69620
+ var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
69621
+ var incident = new Incident(incidentFeature.properties, point, localizedStrings);
69622
+ var popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
69623
+ var element = popup.getPopupContainer();
69624
+ element.addEventListener('focusin', function (event) {
69625
+ // side effects: clear other managed popups
69626
+ _this.clickPopup.remove();
69627
+ _this.accessiblePopups.filter(function (p) { return p !== popup; }).forEach(function (popup) { return popup.remove(); });
69628
+ // insert previous and next popups
69629
+ if (idx - 1 >= 0) {
69630
+ insertHiddenBefore(popup, createPopup(features, idx - 1));
69631
+ }
69632
+ if (idx + 1 < features.length) {
69633
+ addHidden(createPopup(features, idx + 1));
69634
+ }
69635
+ // if we are on boundaries: add the first / last popup
69636
+ // to maintain popups on full page navigation cycle
69637
+ if (idx >= 2 && idx == features.length - 1) {
69638
+ insertHiddenInFront(createPopup(features, 0));
69639
+ }
69640
+ if (idx == 0 && features.length >= 2) {
69641
+ addHidden(createPopup(features, features.length - 1));
69642
+ }
69643
+ });
69644
+ if (idx == features.length - 1) {
69645
+ element.addEventListener('focusout', function (event) {
69646
+ // close the popup if we detect the focus moving away from the page (relatedTarget === null)
69647
+ // (will remain open otherwise)
69648
+ if (event.relatedTarget === null) {
69649
+ popup.close();
69650
+ }
69651
+ });
69652
+ }
69653
+ _this.accessiblePopups.push(popup);
69654
+ return popup;
69655
+ };
69656
+ insertHiddenBefore = function (base, toInsert) {
69657
+ toInsert.open(_this.map);
69658
+ toInsert.close();
69659
+ var containerToSwapIn = toInsert.getPopupContainer();
69660
+ var baseContainer = base.getPopupContainer();
69661
+ baseContainer.parentElement.insertBefore(containerToSwapIn, baseContainer);
69662
+ };
69663
+ insertHiddenInFront = function (toInsert) {
69664
+ toInsert.open(_this.map);
69665
+ toInsert.close();
69666
+ var containerToSwapIn = toInsert.getPopupContainer();
69667
+ var parent = containerToSwapIn.parentElement;
69668
+ parent.insertBefore(containerToSwapIn, parent.firstElementChild);
69669
+ };
69670
+ addHidden = function (popup) {
69671
+ popup.open(_this.map);
69672
+ popup.close();
69673
+ };
69674
+ if (features.length > 0) {
69675
+ addHidden(createPopup(features, 0));
69676
+ }
69677
+ if (features.length > 1) {
69678
+ addHidden(createPopup(features, features.length - 1));
69679
+ }
69680
+ return [2 /*return*/];
69681
+ }
69682
+ });
69683
+ }); };
69539
69684
  this.removeFromMap = function () {
69685
+ var _a;
69686
+ _this.map.removeEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
69687
+ _this.map.removeEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
69688
+ _this.map.removeEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
69689
+ _this.map.events.remove('idle', _this.setAccessiblePopups);
69690
+ _this.map.events.remove('moveend', _this.setAccessiblePopups);
69691
+ _this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
69692
+ _this.accessiblePopups = [];
69693
+ (_a = _this.clickPopup) === null || _a === void 0 ? void 0 : _a.remove();
69540
69694
  if (_this.map.layers.getLayerById(_this.incidentLayerName) != null) {
69541
69695
  _this.map.layers.remove(_this.incidentLayerName);
69542
69696
  }
@@ -69551,14 +69705,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69551
69705
  _this.map.getCanvas().style.cursor = "";
69552
69706
  };
69553
69707
  this.openIncidentPopup = function (data) {
69554
- _this.popup.remove();
69708
+ _this.clickPopup.remove();
69709
+ _this.accessiblePopups.forEach(function (popup) { return popup.close(); });
69555
69710
  var incidentPosition = data.position;
69556
69711
  var incidentFeature = data.features[0];
69557
69712
  _this.map._getLocalizedStrings().then(function (localizedStrings) {
69558
69713
  var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
69559
69714
  var incident = new Incident(incidentFeature.properties, point, localizedStrings);
69560
- _this.popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
69561
- _this.popup.open(_this.map);
69715
+ _this.clickPopup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
69716
+ _this.clickPopup.open(_this.map);
69717
+ var element = _this.clickPopup.getPopupContainer();
69718
+ // ensures popup is closed on tabbing when the focus is moved away from the window
69719
+ element.addEventListener('focusout', function (event) {
69720
+ if (event.relatedTarget === null) {
69721
+ _this.clickPopup.close();
69722
+ }
69723
+ });
69562
69724
  });
69563
69725
  };
69564
69726
  this.map = map;
@@ -75266,17 +75428,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75266
75428
  * Triggers the user provided function to fetch the token and stores it.
75267
75429
  * @internal
75268
75430
  */
75269
- this._triggerTokenFetch = function () {
75431
+ this._triggerTokenFetch = function (isAnonymousAuth) {
75432
+ if (isAnonymousAuth === void 0) { isAnonymousAuth = false; }
75270
75433
  return new Promise(function (resolve, reject) {
75434
+ if (typeof _this.options.getToken !== "function") {
75435
+ reject(new Error("Token cannot be " + (isAnonymousAuth ? 'fetched' : 'renewed') + " because getToken was not set or is not a function."));
75436
+ return;
75437
+ }
75271
75438
  _this.options.getToken(function (token) {
75272
75439
  try {
75273
75440
  // Try to get the timeout first as this will guarantee the token is correctly formatted.
75274
75441
  var timeout = _this._getTokenExpiry(token) - AuthenticationManager.constants.tokenRefreshClockSkew;
75275
- _this._storeAccessToken(token);
75276
- clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
75277
- // @ts-ignore
75278
- // tslint:disable-next-line: no-string-based-set-timeout
75279
- _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
75442
+ _this._storeToken(token);
75443
+ _this._setTimeoutTokenFetch(timeout);
75280
75444
  resolve();
75281
75445
  }
75282
75446
  catch (_a) {
@@ -75287,6 +75451,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75287
75451
  }, _this.map);
75288
75452
  });
75289
75453
  };
75454
+ /**
75455
+ * Create a timer to trigger the user provided function to fetch the token.
75456
+ * @param seconds delay in seconds
75457
+ * @internal
75458
+ */
75459
+ this._setTimeoutTokenFetch = function (seconds) {
75460
+ clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
75461
+ // @ts-ignore
75462
+ // tslint:disable-next-line: no-string-based-set-timeout
75463
+ _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, Math.min(seconds * 1000, 0x7fffffff) // setTimeout will fire immediately if the delay is greater than 2^31-1.
75464
+ );
75465
+ };
75290
75466
  var serviceOptions = map.getServiceOptions();
75291
75467
  this.options = serviceOptions.authOptions;
75292
75468
  this.sessionId = serviceOptions.sessionId;
@@ -75328,6 +75504,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75328
75504
  }
75329
75505
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
75330
75506
  // Anonymous authentication, just call the users provided callback.
75507
+ resolve(_this._triggerTokenFetch(true));
75508
+ }
75509
+ else if (_this.options.authType === exports.AuthenticationType.sas) {
75510
+ if (_this.options.sasToken) {
75511
+ var expiresIn = -1;
75512
+ try {
75513
+ expiresIn = _this._getTokenExpiry(_this.options.sasToken);
75514
+ }
75515
+ catch (_a) {
75516
+ reject(new Error("An invalid sasToken was provided."));
75517
+ return;
75518
+ }
75519
+ if (expiresIn > AuthenticationManager.constants.tokenRefreshClockSkew) {
75520
+ // Save the initial token
75521
+ _this._storeToken(_this.options.sasToken);
75522
+ // Create a timer to refresh the token
75523
+ _this._setTimeoutTokenFetch(expiresIn - AuthenticationManager.constants.tokenRefreshClockSkew);
75524
+ resolve();
75525
+ return;
75526
+ }
75527
+ }
75528
+ // Call the users provided callback to fetch the token.
75331
75529
  resolve(_this._triggerTokenFetch());
75332
75530
  }
75333
75531
  else {
@@ -75453,8 +75651,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75453
75651
  }
75454
75652
  return token_1;
75455
75653
  }
75456
- else if (this.options.authType === exports.AuthenticationType.anonymous) {
75457
- var token = this._getItem(AuthenticationManager.constants.storage.accessTokenKey);
75654
+ else if (this.options.authType === exports.AuthenticationType.anonymous
75655
+ || this.options.authType === exports.AuthenticationType.sas) {
75656
+ var token = this._getItem(AuthenticationManager.constants.storage.tokenKey);
75458
75657
  if (!token) {
75459
75658
  // Cached Token not present, invoke the user provided callback function to fetch function
75460
75659
  this._triggerTokenFetch();
@@ -75469,7 +75668,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75469
75668
  }
75470
75669
  else if (expiresIn <= 0) {
75471
75670
  // token renew failed and dont have a token.
75472
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, "");
75671
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, "");
75473
75672
  throw new Error(AuthenticationManager.constants.errors.tokenExpired);
75474
75673
  }
75475
75674
  }
@@ -75498,9 +75697,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75498
75697
  * @param token token fetched from the user's server endpoint
75499
75698
  * @internal
75500
75699
  */
75501
- AuthenticationManager.prototype._storeAccessToken = function (token) {
75700
+ AuthenticationManager.prototype._storeToken = function (token) {
75502
75701
  // Store the value
75503
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, token);
75702
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, token);
75504
75703
  var tokenEvent = {
75505
75704
  map: this.map,
75506
75705
  type: AuthenticationManager.constants.events.tokenAcquired
@@ -75589,7 +75788,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75589
75788
  }
75590
75789
  };
75591
75790
  /**
75592
- * Return the number of milliseconds since 1970/01/01
75791
+ * Return the number of seconds since 1970/01/01
75593
75792
  * @ignore
75594
75793
  */
75595
75794
  AuthenticationManager.prototype._getCurrentTime = function () {
@@ -75608,6 +75807,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75608
75807
  request.headers[constants.msClientIdHeaderName] = this.options.clientId;
75609
75808
  request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
75610
75809
  break;
75810
+ case exports.AuthenticationType.sas:
75811
+ request.headers[constants.authorizationHeaderName] = constants.jwtSasPrefix + token;
75812
+ break;
75611
75813
  case exports.AuthenticationType.subscriptionKey:
75612
75814
  request.headers["subscription-key"] = token;
75613
75815
  break;
@@ -75623,7 +75825,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75623
75825
  // Enable localStorage for IE, as sessionStorage does not work for localhost.
75624
75826
  preferredCacheLocation: "localStorage",
75625
75827
  storage: {
75626
- accessTokenKey: "access.token.key",
75828
+ tokenKey: "access.token.key",
75627
75829
  testStorageKey: "testStorage"
75628
75830
  },
75629
75831
  events: {
@@ -78208,6 +78410,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78208
78410
  * @default true
78209
78411
  */
78210
78412
  _this.showLogo = true;
78413
+ /**
78414
+ * Specifies if the map should display labels
78415
+ * @default true
78416
+ */
78417
+ _this.showLabels = true;
78211
78418
  /**
78212
78419
  * Additional custom attribution appended to map attribution.
78213
78420
  * Default `undefined`
@@ -78779,6 +78986,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78779
78986
  }
78780
78987
  StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
78781
78988
  var _this = this;
78989
+ var _a;
78782
78990
  var styleset = this.map.styles.getMapConfiguration();
78783
78991
  if (styleset) {
78784
78992
  this.preservedPreindoorStyleset = styleset;
@@ -78788,6 +78996,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78788
78996
  this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, styleset === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
78789
78997
  }
78790
78998
  else {
78999
+ var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
78791
79000
  this.indoorState = {
78792
79001
  tilesetId: tilesetId,
78793
79002
  theme: theme
@@ -78801,7 +79010,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78801
79010
  var targetStylePrefix = currentStyle + "_indoor";
78802
79011
  var candidateStyle = definitions.styles.find(function (style) { return style.name.startsWith(targetStylePrefix); });
78803
79012
  if (candidateStyle) {
78804
- _this.map.setStyle({ style: candidateStyle.name });
79013
+ // force style reload if tileset id has changed to make sure the tiles will be re-requested with new tileset applied in indoor source placeholder
79014
+ _this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
78805
79015
  }
78806
79016
  });
78807
79017
  }
@@ -78839,7 +79049,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78839
79049
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
78840
79050
  };
78841
79051
  if (!this.serviceOptions.styleSet) {
78842
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
79052
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
78843
79053
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
78844
79054
  defaultStyle: definitions.defaultStyle,
78845
79055
  styles: definitions.styles
@@ -78866,9 +79076,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78866
79076
  domain: _this.serviceOptions.staticAssetsDomain,
78867
79077
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
78868
79078
  queryParams: {
78869
- //[constants.apiVersionQueryParameter]: this.serviceOptions.styleDefinitionsVersion,
78870
- // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
78871
- //language: styleOptions.language
79079
+ styleVersion: _this.serviceOptions.styleDefinitionsVersion,
78872
79080
  },
78873
79081
  protocol: "https"
78874
79082
  }).toString(),
@@ -78912,10 +79120,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78912
79120
  /**
78913
79121
  * @internal
78914
79122
  */
78915
- StyleManager.prototype.setStyle = function (styleOptions) {
79123
+ StyleManager.prototype.setStyle = function (styleOptions, diff) {
79124
+ if (diff === void 0) { diff = true; }
78916
79125
  try {
78917
79126
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
78918
- diff: true,
79127
+ diff: diff,
78919
79128
  stylePatch: this._stylePatch.bind(this),
78920
79129
  validate: this.serviceOptions.validateStyle
78921
79130
  });
@@ -79026,7 +79235,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79026
79235
  currentLayerGroupLayers = [];
79027
79236
  };
79028
79237
  nextStyle.layers.forEach(function (nextLayer) {
79029
- var _a, _b, _c;
79238
+ var _a, _b, _c, _d, _e;
79030
79239
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
79031
79240
  currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
79032
79241
  // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
@@ -79048,6 +79257,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79048
79257
  nextLayer.layout.visibility = "visible";
79049
79258
  }
79050
79259
  }
79260
+ // Set visibility of labels
79261
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
79262
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
79263
+ if (styleOptions.showLabels) {
79264
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
79265
+ nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
79266
+ nextLayer.layout.visibility = "visible";
79267
+ }
79268
+ else {
79269
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
79270
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
79271
+ nextLayer.layout.visibility = "none";
79272
+ }
79273
+ }
79051
79274
  // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
79052
79275
  // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
79053
79276
  // waiting for a styledata.load event to trigger a sync in a different context.
@@ -79110,7 +79333,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79110
79333
  // If there was a previous styledata change event attached, remove it.
79111
79334
  // When the sprite url changes between style changes then mapbox can't perform the diff
79112
79335
  // In such cases it recalculate the style again. Removing previous attached
79113
- // event listner makes sure that style changed event is not fired twice in these cases.
79336
+ // event listener makes sure that style changed event is not fired twice in these cases.
79114
79337
  this.map.events.remove("styledata", this._onStyleData);
79115
79338
  this.map.events.addOnce("styledata", this._onStyleData);
79116
79339
  };
@@ -79139,8 +79362,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79139
79362
  if (url.includes(constants.styleResourcePlaceholder)) {
79140
79363
  params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
79141
79364
  }
79142
- params.url = params.url + ("" + (url.includes('?') ? '&' : '?') + constants.apiVersionQueryParameter + "=" + this.serviceOptions.styleAPIVersion);
79143
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
79365
+ if (params.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase()) ||
79366
+ params.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase())) {
79367
+ // Only add API version param for Azure maps domain requests
79368
+ var targetUrl = new URL(params.url);
79369
+ if (!targetUrl.searchParams.get(constants.apiVersionQueryParameter)) {
79370
+ targetUrl.searchParams.set(constants.apiVersionQueryParameter, this.serviceOptions.styleAPIVersion);
79371
+ params.url = targetUrl.href;
79372
+ }
79373
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
79374
+ }
79144
79375
  };
79145
79376
  /**
79146
79377
  * Fetches a json resource at the specified domain and path.
@@ -79548,8 +79779,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79548
79779
  /**
79549
79780
  * Set the map control's style options. Any options not specified will default to their current values.
79550
79781
  * @param options The options for setting the style of the map control.
79782
+ * @param diff [true] If false, forces a 'full' style update, removing the current style and building the given one instead of attempting a diff-based update. Defaults to true.
79551
79783
  */
79552
- Map.prototype.setStyle = function (options) {
79784
+ Map.prototype.setStyle = function (options, diff) {
79785
+ if (diff === void 0) { diff = true; }
79553
79786
  // This option may only be set when initializing the map.
79554
79787
  // The delete operation will handle non-exist property.
79555
79788
  delete options.preserveDrawingBuffer;
@@ -79587,7 +79820,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79587
79820
  // if the language is changed, then either those delegates need changed
79588
79821
  // or the styledata event manually invoked.
79589
79822
  this.styleOptions = newOptions;
79590
- this._setStyleComponents(newOptions);
79823
+ this._setStyleComponents(newOptions, diff);
79591
79824
  };
79592
79825
  /**
79593
79826
  * Returns the map control's current style settings.
@@ -80249,10 +80482,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80249
80482
  /**
80250
80483
  * @internal
80251
80484
  */
80252
- Map.prototype._rebuildStyle = function () {
80485
+ Map.prototype._rebuildStyle = function (diff) {
80486
+ if (diff === void 0) { diff = true; }
80253
80487
  return __awaiter(this, void 0, void 0, function () {
80254
80488
  return __generator(this, function (_a) {
80255
- this.styles.setStyle(this.styleOptions);
80489
+ this.styles.setStyle(this.styleOptions, diff);
80256
80490
  this.imageSprite._restoreImages();
80257
80491
  return [2 /*return*/];
80258
80492
  });
@@ -80363,8 +80597,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80363
80597
  * Removes sources and layers that aren't used by the new style or any remaining layers.
80364
80598
  * @private
80365
80599
  */
80366
- Map.prototype._setStyleComponents = function (styleOptions) {
80600
+ Map.prototype._setStyleComponents = function (styleOptions, diff) {
80367
80601
  var _this = this;
80602
+ if (diff === void 0) { diff = true; }
80368
80603
  if (this.removed) {
80369
80604
  return;
80370
80605
  }
@@ -80374,7 +80609,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80374
80609
  _this.styleOptions.style = styleSet.defaultStyle;
80375
80610
  }
80376
80611
  _this.styleOptions = styleOptions;
80377
- _this._rebuildStyle();
80612
+ _this._rebuildStyle(diff);
80378
80613
  });
80379
80614
  return;
80380
80615
  };
@@ -80420,7 +80655,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80420
80655
  var w = BoundingBox.getWest(bounds);
80421
80656
  var n = BoundingBox.getNorth(bounds);
80422
80657
  var e = BoundingBox.getEast(bounds);
80423
- if (isNaN(s) || isNaN(w) || isNaN(n) || isNaN(e)) {
80658
+ if (!isFinite(s) || !isFinite(w) || !isFinite(n) || !isFinite(e)) {
80424
80659
  throw new Error("The bounds specified are invalid: [" + bounds + "]");
80425
80660
  }
80426
80661
  while (w > e) {