@itwin/map-layers 5.0.0 → 5.1.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/README.md +1 -1
  3. package/lib/cjs/public/locales/en/mapLayers.json +7 -2
  4. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  5. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +144 -64
  6. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  7. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  8. package/lib/cjs/ui/widget/BasemapPanel.js +47 -18
  9. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  10. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  11. package/lib/cjs/ui/widget/MapLayerDroppable.js +26 -3
  12. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  13. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  14. package/lib/cjs/ui/widget/MapLayerManager.js +35 -57
  15. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  16. package/lib/cjs/ui/widget/MapLayerManager.scss +7 -9
  17. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  18. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +12 -20
  19. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  20. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
  21. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
  22. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +58 -0
  23. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
  24. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.scss +17 -0
  25. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +7 -2
  26. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  27. package/lib/cjs/ui/widget/MapUrlDialog.js +38 -134
  28. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  29. package/lib/cjs/ui/widget/MapUrlDialog.scss +10 -10
  30. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +3 -1
  31. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  32. package/lib/cjs/ui/widget/SubLayersDataProvider.js +3 -3
  33. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  34. package/lib/cjs/ui/widget/SubLayersPopupButton.js +1 -1
  35. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  36. package/lib/cjs/ui/widget/SubLayersTree.d.ts +5 -0
  37. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  38. package/lib/cjs/ui/widget/SubLayersTree.js +12 -36
  39. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  40. package/lib/cjs/ui/widget/SubLayersTree.scss +12 -3
  41. package/lib/esm/public/locales/en/mapLayers.json +7 -2
  42. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  43. package/lib/esm/ui/widget/AttachLayerPopupButton.js +145 -65
  44. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  45. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  46. package/lib/esm/ui/widget/BasemapPanel.js +47 -18
  47. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  48. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  49. package/lib/esm/ui/widget/MapLayerDroppable.js +27 -4
  50. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  51. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  52. package/lib/esm/ui/widget/MapLayerManager.js +36 -58
  53. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  54. package/lib/esm/ui/widget/MapLayerManager.scss +7 -9
  55. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  56. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +13 -21
  57. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  58. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +11 -0
  59. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -0
  60. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +54 -0
  61. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -0
  62. package/lib/esm/ui/widget/MapSelectFeaturesDialog.scss +17 -0
  63. package/lib/esm/ui/widget/MapUrlDialog.d.ts +7 -2
  64. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  65. package/lib/esm/ui/widget/MapUrlDialog.js +38 -134
  66. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  67. package/lib/esm/ui/widget/MapUrlDialog.scss +10 -10
  68. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +3 -1
  69. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  70. package/lib/esm/ui/widget/SubLayersDataProvider.js +3 -3
  71. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  72. package/lib/esm/ui/widget/SubLayersPopupButton.js +1 -1
  73. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  74. package/lib/esm/ui/widget/SubLayersTree.d.ts +5 -0
  75. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  76. package/lib/esm/ui/widget/SubLayersTree.js +13 -37
  77. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  78. package/lib/esm/ui/widget/SubLayersTree.scss +12 -3
  79. package/lib/public/locales/en/mapLayers.json +7 -2
  80. package/package.json +17 -16
@@ -4,16 +4,15 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  // cSpell:ignore Modeless WMTS
6
6
  import { DialogButtonType, SpecialKey } from "@itwin/appui-abstract";
7
- import { UiFramework } from "@itwin/appui-react";
8
7
  import { Button, Input, LabeledInput, ProgressLinear, Radio } from "@itwin/itwinui-react";
9
8
  import { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority, } from "@itwin/core-frontend";
10
9
  import { Dialog, Icon, useCrossOriginPopup } from "@itwin/core-react";
11
10
  import * as React from "react";
12
11
  import { MapLayerPreferences } from "../../MapLayerPreferences";
13
12
  import { MapLayersUI } from "../../mapLayers";
14
- import "./MapUrlDialog.scss";
15
13
  import { BeEvent, Guid } from "@itwin/core-bentley";
16
14
  import { SelectMapFormat } from "./SelectMapFormat";
15
+ import "./MapUrlDialog.scss";
17
16
  export const MAP_TYPES = {
18
17
  wms: "WMS",
19
18
  arcGis: "ArcGIS",
@@ -23,7 +22,7 @@ export const MAP_TYPES = {
23
22
  };
24
23
  // eslint-disable-next-line @typescript-eslint/naming-convention
25
24
  export function MapUrlDialog(props) {
26
- const { isOverlay, onOkResult, mapTypesOptions } = props;
25
+ const { onOkResult, mapTypesOptions } = props;
27
26
  const getMapUrlFromProps = React.useCallback(() => {
28
27
  if (props.mapLayerSourceToEdit) {
29
28
  return props.mapLayerSourceToEdit.url;
@@ -101,27 +100,11 @@ export function MapUrlDialog(props) {
101
100
  && props.activeViewport.iModel.iTwinId !== Guid.empty
102
101
  && props?.activeViewport?.iModel?.iModelId !== undefined
103
102
  && props?.activeViewport.iModel.iModelId !== Guid.empty);
104
- // Even though the settings storage is available,
105
- // we don't always want to enable it in the UI.
106
- const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);
107
- const [layerRequiringCredentialsIdx] = React.useState(() => {
108
- if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {
109
- return undefined;
110
- }
111
- const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
112
- if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {
113
- return undefined;
114
- }
115
- else {
116
- return indexInDisplayStyle;
117
- }
118
- });
119
103
  const handleCancel = React.useCallback(() => {
120
104
  if (props.onCancelResult) {
121
105
  props.onCancelResult();
122
106
  return;
123
107
  }
124
- UiFramework.dialogs.modal.close();
125
108
  }, [props]);
126
109
  const onUsernameChange = React.useCallback((event) => {
127
110
  setUserName(event.target.value);
@@ -167,105 +150,6 @@ export function MapUrlDialog(props) {
167
150
  }
168
151
  return sourceRequireAuth || invalidCredentials;
169
152
  }, [accessClient, invalidCredentialsProvided]);
170
- const updateAttachedLayer = React.useCallback(async (source, validation) => {
171
- const vp = props?.activeViewport;
172
- if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {
173
- const error = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
174
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
175
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
176
- return true;
177
- }
178
- // Layer is already attached,
179
- // This calls invalidateRenderPlan()
180
- vp.displayStyle.changeMapLayerProps({
181
- subLayers: validation.subLayers,
182
- }, { index: layerRequiringCredentialsIdx, isOverlay });
183
- vp.displayStyle.changeMapLayerCredentials({ index: layerRequiringCredentialsIdx, isOverlay }, source.userName, source.password);
184
- // Either initial attach/initialize failed or the layer failed to load at least one tile
185
- // because of an invalid token; in both cases tile tree needs to be fully reset
186
- const provider = vp.getMapLayerImageryProvider({ index: layerRequiringCredentialsIdx, isOverlay });
187
- provider?.resetStatus();
188
- vp.resetMapLayer({ index: layerRequiringCredentialsIdx, isOverlay });
189
- // This handler will close the layer source handler, and therefore the MapUrl dialog.
190
- // don't call it if the dialog needs to remains open.
191
- onOkResult();
192
- return true;
193
- }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);
194
- // Returns true if no further input is needed from end-user.
195
- const doAttach = React.useCallback(async (source, validation) => {
196
- const vp = props?.activeViewport;
197
- if (vp === undefined || source === undefined) {
198
- const error = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
199
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
200
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
201
- return true;
202
- }
203
- // Update service settings if storage is available and we are not prompting user for credentials
204
- if (!settingsStorageDisabled && !props.layerRequiringCredentials) {
205
- const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
206
- if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
207
- const msgError = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
208
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));
209
- }
210
- }
211
- // Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)
212
- // we force the sub-layer visibility to ON.
213
- let subLayers = validation.subLayers;
214
- if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {
215
- subLayers = [{ ...validation.subLayers[0], visible: true }];
216
- }
217
- const settings = source.toLayerSettings(subLayers);
218
- if (settings) {
219
- vp.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });
220
- const msg = IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttached", { sourceName: source.name, sourceUrl: source.url });
221
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));
222
- }
223
- else {
224
- const msgError = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSettingsConversionError");
225
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.MapLayerAttachError", { error: msgError, sourceUrl: source.url });
226
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
227
- }
228
- // This handler will close the layer source handler, and therefore the MapUrl dialog.
229
- // don't call it if the dialog needs to remains open.
230
- onOkResult();
231
- return true;
232
- }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
233
- // Validate the layer source and attempt to attach (or update) the layer.
234
- // Returns true if no further input is needed from end-user (i.e. close the dialog)
235
- const attemptAttachSource = React.useCallback(async (source) => {
236
- try {
237
- const validation = await source.validateSource(true);
238
- if (validation.status === MapLayerSourceStatus.Valid) {
239
- if (layerRequiringCredentialsIdx === undefined) {
240
- return await doAttach(source, validation);
241
- }
242
- else {
243
- return await updateAttachedLayer(source, validation);
244
- }
245
- }
246
- else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem) {
247
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
248
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
249
- return true;
250
- }
251
- else {
252
- const authNeeded = await updateAuthState(source, validation);
253
- if (authNeeded) {
254
- return false;
255
- }
256
- else {
257
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
258
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));
259
- return true;
260
- }
261
- }
262
- }
263
- catch (error) {
264
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
265
- IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
266
- return true;
267
- }
268
- }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);
269
153
  const onNameChange = React.useCallback((event) => {
270
154
  setMapName(event.target.value);
271
155
  }, [setMapName]);
@@ -294,12 +178,11 @@ export function MapUrlDialog(props) {
294
178
  const handleOk = React.useCallback(() => {
295
179
  const source = createSource();
296
180
  if (source === undefined || props.mapLayerSourceToEdit) {
297
- UiFramework.dialogs.modal.close();
298
181
  onOkResult();
299
182
  if (source === undefined) {
300
183
  // Close the dialog and inform end user something went wrong.
301
184
  const msgError = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerLayerSourceCreationFailed");
302
- const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError, sourceUrl: mapUrl });
185
+ const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error: msgError, sourceName: mapName });
303
186
  IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
304
187
  return;
305
188
  }
@@ -321,27 +204,47 @@ export function MapUrlDialog(props) {
321
204
  return;
322
205
  }
323
206
  }
324
- setLayerAttachPending(true);
325
207
  // Attach source asynchronously.
326
208
  void (async () => {
327
209
  try {
328
- const closeDialog = await attemptAttachSource(source);
210
+ setLayerAttachPending(true);
211
+ const validation = await source.validateSource(true);
329
212
  if (isMounted.current) {
330
213
  setLayerAttachPending(false);
331
214
  }
332
- // In theory the modal dialog should always get closed by the parent
333
- // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.
334
- if (closeDialog) {
335
- UiFramework.dialogs.modal.close();
336
- onOkResult();
215
+ if (validation.status === MapLayerSourceStatus.Valid) {
216
+ // Update service settings if storage is available and we are not prompting user for credentials
217
+ if (isSettingsStorageAvailable && !props.layerRequiringCredentials) {
218
+ const storeOnIModel = (hasImodelContext ? "Model" === settingsStorage : undefined);
219
+ const vp = props.activeViewport;
220
+ if (vp?.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {
221
+ const msgError = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerPreferencesStoreFailed");
222
+ IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));
223
+ }
224
+ }
225
+ onOkResult({ source, validation });
226
+ }
227
+ else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem) {
228
+ const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.InvalidCoordinateSystem");
229
+ IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
230
+ onOkResult({ source, validation });
231
+ }
232
+ else {
233
+ const authNeeded = await updateAuthState(source, validation);
234
+ if (!authNeeded) {
235
+ const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.ValidationError");
236
+ IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));
237
+ onOkResult({ source, validation });
238
+ }
337
239
  }
338
240
  }
339
- catch (_error) {
241
+ catch (error) {
242
+ const msg = MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceName: source.name });
243
+ IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
340
244
  onOkResult();
341
- UiFramework.dialogs.modal.close();
342
245
  }
343
246
  })();
344
- }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);
247
+ }, [createSource, mapName, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, isSettingsStorageAvailable, updateAuthState, hasImodelContext, props.layerRequiringCredentials, settingsStorage]);
345
248
  React.useEffect(() => {
346
249
  const handleOAuthProcessEnd = (success, _state) => {
347
250
  onOauthProcessEnd.raiseEvent(success, _state);
@@ -512,11 +415,12 @@ export function MapUrlDialog(props) {
512
415
  React.createElement(LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", placeholder: serverRequireCredentials ? userNameRequiredLabel : userNameLabel, status: (!userName && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onUsernameChange, value: userName, size: "small" }),
513
416
  React.createElement("span", { className: "map-layer-source-label" }, passwordLabel),
514
417
  React.createElement(LabeledInput, { className: "map-layer-source-input", displayStyle: "inline", type: "password", placeholder: serverRequireCredentials ? passwordRequiredLabel : passwordLabel, status: (!password && serverRequireCredentials) || invalidCredentialsProvided ? "warning" : undefined, disabled: layerAttachPending || layerAuthPending, onChange: onPasswordChange, onKeyPress: handleOnKeyDown, value: password, size: "small" })),
515
- isSettingsStorageAvailable &&
516
- React.createElement("div", { title: settingsStorageDisabled ? noSaveSettingsWarning : "" }, hasImodelContext &&
418
+ !props.layerRequiringCredentials
419
+ && !props.mapLayerSourceToEdit
420
+ && React.createElement("div", { title: !isSettingsStorageAvailable ? noSaveSettingsWarning : "" }, hasImodelContext &&
517
421
  React.createElement("div", null,
518
- React.createElement(Radio, { disabled: settingsStorageDisabled, name: "settingsStorage", value: "iTwin", label: iTwinSettingsLabel, checked: settingsStorage === "iTwin", onChange: onRadioChange }),
519
- React.createElement(Radio, { disabled: settingsStorageDisabled, name: "settingsStorage", value: "Model", label: modelSettingsLabel, checked: settingsStorage === "Model", onChange: onRadioChange }))))),
422
+ React.createElement(Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "iTwin", label: iTwinSettingsLabel, checked: settingsStorage === "iTwin", onChange: onRadioChange }),
423
+ React.createElement(Radio, { disabled: !isSettingsStorageAvailable, name: "settingsStorage", value: "Model", label: modelSettingsLabel, checked: settingsStorage === "Model", onChange: onRadioChange }))))),
520
424
  renderWarningMessage(),
521
425
  (layerAttachPending || layerAuthPending) &&
522
426
  React.createElement("div", { className: "map-layer-source-progressBar" },
@@ -1 +1 @@
1
- {"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,W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AK,EAAE,uBAAuB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,IAC7D,gBAAgB;4BACf;gCACE,oBAAC,KAAK,IAAC,QAAQ,EAAE,uBAAuB,EACtC,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,OAAO,EACpC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI;gCAC7B,oBAAC,KAAK,IAAC,QAAQ,EAAE,uBAAuB,EACtC,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,OAAO,EACpC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI,CACzB,CACJ,CACJ,CACF;YAGL,oBAAoB,EAAE;YAGtB,CAAC,kBAAkB,IAAI,gBAAgB,CAAC;gBACvC,6BAAK,SAAS,EAAC,8BAA8B;oBAC3C,oBAAC,cAAc,IAAC,aAAa,SAAG,CAC5B,CAED,CACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore Modeless WMTS\n\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\nimport {\n IModelApp, MapLayerAccessClient, MapLayerSource,\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\n} from \"@itwin/core-frontend\";\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapTypesOptions } from \"../Interfaces\";\nimport \"./MapUrlDialog.scss\";\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\nimport { SelectMapFormat } from \"./SelectMapFormat\";\n\nexport const MAP_TYPES = {\n wms: \"WMS\",\n arcGis: \"ArcGIS\",\n wmts: \"WMTS\",\n tileUrl: \"TileURL\",\n arcGisFeature: \"ArcGISFeature\",\n};\n\ninterface MapUrlDialogProps {\n activeViewport?: ScreenViewport;\n isOverlay: boolean;\n onOkResult: () => void;\n onCancelResult?: () => void;\n mapTypesOptions?: MapTypesOptions;\n\n // An optional layer definition can be provide to enable the edit mode\n layerRequiringCredentials?: ImageMapLayerProps;\n\n mapLayerSourceToEdit?: MapLayerSource;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapUrlDialog(props: MapUrlDialogProps) {\n const { isOverlay, onOkResult, mapTypesOptions } = props;\n\n const getMapUrlFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.url;\n } else if (props.layerRequiringCredentials?.url) {\n return props.layerRequiringCredentials.url;\n }\n return \"\";\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const getMapNameFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.name;\n } else if (props.layerRequiringCredentials?.name) {\n return props.layerRequiringCredentials.name;\n }\n return \"\";\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const getFormatFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.formatId;\n } else if (props.layerRequiringCredentials?.formatId) {\n return props.layerRequiringCredentials.formatId;\n }\n return undefined;\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\n const [userName, setUserName] = React.useState(\"\");\n const [password, setPassword] = React.useState(\"\");\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined | boolean>(undefined);\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string | undefined>();\n const [onOauthProcessEnd] = React.useState(new BeEvent());\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\n\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\n const [hasImodelContext] = React.useState(\n props?.activeViewport?.iModel?.iTwinId !== undefined\n && props.activeViewport.iModel.iTwinId !== Guid.empty\n && props?.activeViewport?.iModel?.iModelId !== undefined\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\n\n // Even though the settings storage is available,\n // we don't always want to enable it in the UI.\n const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);\n\n const [layerRequiringCredentialsIdx] = React.useState((): number | undefined => {\n if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {\n return undefined;\n }\n\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);\n if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {\n return undefined;\n } else {\n return indexInDisplayStyle;\n }\n });\n\n const handleCancel = React.useCallback(() => {\n if (props.onCancelResult) {\n props.onCancelResult();\n return;\n }\n UiFramework.dialogs.modal.close();\n }, [props]);\n\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setUserName(event.target.value);\n if (invalidCredentialsProvided)\n setInvalidCredentialsProvided(false);\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\n\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setPassword(event.target.value);\n if (invalidCredentialsProvided)\n setInvalidCredentialsProvided(false);\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\n\n const handleArcGisLogin = React.useCallback(() => {\n setLayerAuthPending(true);\n setShowOauthPopup(true);\n if (oauthProcessSucceeded === false) {\n setOAuthProcessSucceeded(undefined);\n }\n\n }, [oauthProcessSucceeded]);\n\n // return true if authorization is needed\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\n if (sourceRequireAuth) {\n const settings = source.toLayerSettings();\n\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\n try {\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\n if (tokenEndpoint !== undefined) {\n const loginUrl = tokenEndpoint.getLoginUrl();\n setExternalLoginUrl(loginUrl);\n }\n\n } catch (_error) {\n\n }\n }\n\n }\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\n if (invalidCredentials) {\n setInvalidCredentialsProvided(true);\n } else if (invalidCredentialsProvided) {\n setInvalidCredentialsProvided(false); // flag reset\n }\n\n return sourceRequireAuth || invalidCredentials;\n }, [accessClient, invalidCredentialsProvided]);\n\n const updateAttachedLayer = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation) => {\n const vp = props?.activeViewport;\n if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return true;\n }\n\n // Layer is already attached,\n // This calls invalidateRenderPlan()\n vp.displayStyle.changeMapLayerProps({\n subLayers: validation.subLayers,\n }, {index: layerRequiringCredentialsIdx, isOverlay});\n vp.displayStyle.changeMapLayerCredentials({index: layerRequiringCredentialsIdx, isOverlay}, source.userName, source.password);\n\n // Either initial attach/initialize failed or the layer failed to load at least one tile\n // because of an invalid token; in both cases tile tree needs to be fully reset\n const provider = vp.getMapLayerImageryProvider({index: layerRequiringCredentialsIdx, isOverlay});\n provider?.resetStatus();\n vp.resetMapLayer({index: layerRequiringCredentialsIdx, isOverlay});\n\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\n // don't call it if the dialog needs to remains open.\n onOkResult();\n\n return true;\n }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);\n\n // Returns true if no further input is needed from end-user.\n const doAttach = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation): Promise<boolean> => {\n const vp = props?.activeViewport;\n if (vp === undefined || source === undefined) {\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return true;\n }\n\n // Update service settings if storage is available and we are not prompting user for credentials\n if (!settingsStorageDisabled && !props.layerRequiringCredentials) {\n const storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\n if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\n\t }\n }\n\n // Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)\n // we force the sub-layer visibility to ON.\n let subLayers = validation.subLayers;\n if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {\n subLayers = [{...validation.subLayers[0], visible: true}];\n }\n const settings = source.toLayerSettings(subLayers);\n if (settings) {\n vp.displayStyle.attachMapLayer({settings, mapLayerIndex: {index: -1, isOverlay}});\n\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: source.name, sourceUrl: source.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n } else {\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSettingsConversionError\");\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MapLayerAttachError\", { error: msgError, sourceUrl: source.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\n // don't call it if the dialog needs to remains open.\n onOkResult();\n\n return true;\n }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);\n\n // Validate the layer source and attempt to attach (or update) the layer.\n // Returns true if no further input is needed from end-user (i.e. close the dialog)\n const attemptAttachSource = React.useCallback(async (source: MapLayerSource): Promise<boolean> => {\n try {\n const validation = await source.validateSource(true);\n\n if (validation.status === MapLayerSourceStatus.Valid) {\n if (layerRequiringCredentialsIdx === undefined) {\n return await doAttach(source, validation);\n } else {\n return await updateAttachedLayer(source, validation);\n }\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return true;\n } else {\n const authNeeded = await updateAuthState(source, validation);\n if (authNeeded) {\n return false;\n } else {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\n return true;\n }\n }\n\n } catch (error) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return true;\n }\n\n }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);\n\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setMapName(event.target.value);\n }, [setMapName]);\n\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setSettingsStorageRadio(event.target.value);\n }, [setSettingsStorageRadio]);\n\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setMapUrl(event.target.value);\n }, [setMapUrl]);\n\n const createSource = React.useCallback(() => {\n let source: MapLayerSource | undefined;\n if (mapUrl && mapName) {\n source = MapLayerSource.fromJSON({\n url: mapUrl,\n name: mapName,\n formatId: mapType,\n });\n\n // Set credentials separately since they are not part of JSON\n if (source) {\n source.userName = userName || undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\n source.password = password || undefined;\n }\n\n }\n return source;\n }, [mapName, mapType, mapUrl, password, userName]);\n\n const handleOk = React.useCallback(() => {\n const source = createSource();\n if (source === undefined || props.mapLayerSourceToEdit) {\n\n UiFramework.dialogs.modal.close();\n onOkResult();\n\n if (source === undefined) {\n // Close the dialog and inform end user something went wrong.\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceUrl: mapUrl });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return;\n }\n\n // Simply change the source definition in the setting service\n if (props.mapLayerSourceToEdit !== undefined) {\n const vp = props.activeViewport;\n void (async () => {\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\n try {\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\n } catch (err: any) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return;\n }\n }\n })();\n return;\n }\n }\n\n setLayerAttachPending(true);\n\n // Attach source asynchronously.\n void (async () => {\n try {\n const closeDialog = await attemptAttachSource(source);\n if (isMounted.current) {\n setLayerAttachPending(false);\n }\n\n // In theory the modal dialog should always get closed by the parent\n // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.\n if (closeDialog) {\n UiFramework.dialogs.modal.close();\n onOkResult();\n }\n } catch (_error) {\n onOkResult();\n UiFramework.dialogs.modal.close();\n }\n })();\n\n }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);\n\n React.useEffect(() => {\n const handleOAuthProcessEnd = (success: boolean, _state: any) => {\n onOauthProcessEnd.raiseEvent(success, _state);\n };\n\n // Currently only arcgis support AccessClient\n\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\n if (ac?.onOAuthProcessEnd) {\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\n }\n setAccessClientInitialized(true);\n return () => {\n if (ac?.onOAuthProcessEnd) {\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\n }\n\n setAccessClient(undefined);\n setAccessClientInitialized(false);\n };\n }, [mapType, onOauthProcessEnd, setAccessClient]);\n\n // After a map type change, make sure the different Oauth states are reset.\n React.useEffect(() => {\n // Reset few states\n setServerRequireCredentials(false);\n setInvalidCredentialsProvided(false);\n setShowOauthPopup(false);\n setOAuthProcessSucceeded(undefined);\n setExternalLoginUrl(undefined);\n\n }, [mapType]);\n\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\n React.useEffect(() => {\n // Attach source asynchronously.\n void (async () => {\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\n try {\n const source = MapLayerSource.fromJSON({\n url: props.layerRequiringCredentials.url,\n name: props.layerRequiringCredentials.name,\n formatId: props.layerRequiringCredentials.formatId,\n });\n\n if (source !== undefined) {\n setLayerAttachPending(true);\n const validation = await source.validateSource(true);\n if (isMounted.current) {\n setLayerAttachPending(false);\n }\n await updateAuthState(source, validation);\n }\n } catch (_error) { }\n }\n })();\n\n }, [isAccessClientInitialized,\n props.layerRequiringCredentials?.formatId,\n props.layerRequiringCredentials?.name,\n props.layerRequiringCredentials?.url,\n updateAuthState]);\n\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const readyToSave = React.useCallback(() => {\n const credentialsSet = !!userName && !!password;\n return (!!mapUrl && !!mapName)\n && !layerAttachPending\n && (!serverRequireCredentials || credentialsSet)\n && !invalidCredentialsProvided\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\n\n const buttonCluster = React.useMemo(() => [\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ], [readyToSave, handleCancel, handleOk]);\n\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === SpecialKey.Enter) {\n if (readyToSave())\n handleOk();\n }\n }, [handleOk, readyToSave]);\n\n // onOauthProcessEnd events handler\n React.useEffect(() => {\n const handleOauthProcess = (success: boolean, _state: any) => {\n setLayerAuthPending(false);\n if (success) {\n setOAuthProcessSucceeded(true);\n setShowOauthPopup(false);\n setLayerAttachPending(false);\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\n } else {\n setShowOauthPopup(false);\n setLayerAttachPending(false);\n setOAuthProcessSucceeded(false);\n }\n };\n\n onOauthProcessEnd.addListener(handleOauthProcess);\n return () => {\n onOauthProcessEnd.removeListener(handleOauthProcess);\n };\n }, [handleOk, onOauthProcessEnd]);\n\n //\n // Monitors authentication method changes\n React.useEffect(() => {\n\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\n handleArcGisLogin();\n }\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\n\n // Monitors Oauth2 popup was closed\n const handleOAuthPopupClose = React.useCallback(() => {\n setShowOauthPopup(false);\n setLayerAuthPending(false);\n if (oauthProcessSucceeded === undefined)\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\n }, [oauthProcessSucceeded]);\n\n // Utility function to get warning message section\n function renderWarningMessage(): React.ReactNode {\n let node: React.ReactNode;\n let warningMessage: string | undefined;\n\n // Get the proper warning message\n if (showOauthPopup) {\n warningMessage = externalLoginWaitingMsg;\n } else if (oauthProcessSucceeded === false) {\n warningMessage = externalLoginFailedMsg;\n } else if (oauthProcessSucceeded === true) {\n warningMessage = externalLoginSucceededMsg;\n } else if (invalidCredentialsProvided) {\n warningMessage = invalidCredentialsLabel;\n } else if (serverRequireCredentials && (!userName || !password)) {\n warningMessage = missingCredentialsLabel;\n }\n\n // Sometimes we want to add an extra node, such as a button\n let extraNode: React.ReactNode;\n if (oauthProcessSucceeded === false) {\n extraNode = <div>\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\n </div>;\n }\n\n if (warningMessage !== undefined) {\n return (\n <div className=\"map-layer-source-warnMessage\">\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\n {extraNode}\n </div>);\n } else {\n return (<span className=\"map-layer-source-placeholder\">&nbsp;</span>);\n }\n return node;\n }\n\n // Use a hook to display the popup.\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\n return (\n <div ref={dialogContainer}>\n <Dialog\n className=\"map-layer-url-dialog\"\n title={dialogTitle}\n opened={true}\n resizable={true}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n minHeight={120}\n maxWidth={600}\n titleStyle={{ paddingLeft: \"10px\" }}\n footerStyle={{ paddingBottom: \"10px\", paddingRight: \"10px\" }}\n trapFocus={false}\n >\n <div className=\"map-layer-url-dialog-content\">\n <div className=\"map-layer-source-url\">\n <span className=\"map-layer-source-label\">{typeLabel}</span>\n <SelectMapFormat\n value={mapType}\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\n onChange={setMapType}\n mapTypesOptions={mapTypesOptions}\n />\n <span className=\"map-layer-source-label\">{nameLabel}</span>\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\n <span className=\"map-layer-source-label\">{urlLabel}</span>\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\n {serverRequireCredentials\n && externalLoginUrl === undefined // external login is handled in popup\n && props.mapLayerSourceToEdit === undefined &&\n <>\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\n <LabeledInput className=\"map-layer-source-input\"\n displayStyle=\"inline\"\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\n disabled={layerAttachPending || layerAuthPending}\n onChange={onUsernameChange}\n value={userName}\n size=\"small\" />\n\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\n <LabeledInput className=\"map-layer-source-input\"\n\n displayStyle=\"inline\"\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\n disabled={layerAttachPending || layerAuthPending}\n onChange={onPasswordChange}\n onKeyPress={handleOnKeyDown}\n value={password}\n size=\"small\" />\n\n </>\n }\n\n {/* Store settings options, not shown when editing a layer */}\n {isSettingsStorageAvailable &&\n <div title={settingsStorageDisabled ? noSaveSettingsWarning : \"\"}>\n {hasImodelContext &&\n <div>\n <Radio disabled={settingsStorageDisabled}\n name=\"settingsStorage\" value=\"iTwin\"\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\n onChange={onRadioChange} />\n <Radio disabled={settingsStorageDisabled}\n name=\"settingsStorage\" value=\"Model\"\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\n onChange={onRadioChange} />\n </div>}\n </div>}\n </div>\n </div>\n\n {/* Warning message */}\n {renderWarningMessage()}\n\n {/* Progress bar */}\n {(layerAttachPending || layerAuthPending) &&\n <div className=\"map-layer-source-progressBar\">\n <ProgressLinear indeterminate />\n </div>\n }\n </Dialog>\n </div >\n );\n}\n"]}
1
+ {"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EACL,SAAS,EAAwB,cAAc,EAC/C,oBAAoB,EAA4B,oBAAoB,EAAE,qBAAqB,GAC5F,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAA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pC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI,CACzB,CACJ,CACF,CACF;YAGL,oBAAoB,EAAE;YAGtB,CAAC,kBAAkB,IAAI,gBAAgB,CAAC;gBACvC,6BAAK,SAAS,EAAC,8BAA8B;oBAC3C,oBAAC,cAAc,IAAC,aAAa,SAAG,CAC5B,CAED,CACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore Modeless WMTS\n\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\nimport {\n IModelApp, MapLayerAccessClient, MapLayerSource,\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\n} from \"@itwin/core-frontend\";\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { MapTypesOptions } from \"../Interfaces\";\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\nimport { SelectMapFormat } from \"./SelectMapFormat\";\nimport \"./MapUrlDialog.scss\";\n\nexport const MAP_TYPES = {\n wms: \"WMS\",\n arcGis: \"ArcGIS\",\n wmts: \"WMTS\",\n tileUrl: \"TileURL\",\n arcGisFeature: \"ArcGISFeature\",\n};\n\nexport type LayerCreationMode = \"single\"|\"multiple\";\ninterface MapUrlDialogProps {\n activeViewport?: ScreenViewport;\n isOverlay: boolean;\n onOkResult: (result?: SourceState) => void;\n onCancelResult?: () => void;\n mapTypesOptions?: MapTypesOptions;\n\n // An optional layer definition can be provide to enable the edit mode\n layerRequiringCredentials?: ImageMapLayerProps;\n\n mapLayerSourceToEdit?: MapLayerSource;\n}\n\nexport interface SourceState {\n source: MapLayerSource;\n validation: MapLayerSourceValidation;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapUrlDialog(props: MapUrlDialogProps) {\n const { onOkResult, mapTypesOptions } = props;\n\n const getMapUrlFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.url;\n } else if (props.layerRequiringCredentials?.url) {\n return props.layerRequiringCredentials.url;\n }\n return \"\";\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const getMapNameFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.name;\n } else if (props.layerRequiringCredentials?.name) {\n return props.layerRequiringCredentials.name;\n }\n return \"\";\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const getFormatFromProps = React.useCallback(() => {\n if (props.mapLayerSourceToEdit) {\n return props.mapLayerSourceToEdit.formatId;\n } else if (props.layerRequiringCredentials?.formatId) {\n return props.layerRequiringCredentials.formatId;\n }\n return undefined;\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\n\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\n const [userName, setUserName] = React.useState(\"\");\n const [password, setPassword] = React.useState(\"\");\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined | boolean>(undefined);\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string | undefined>();\n const [onOauthProcessEnd] = React.useState(new BeEvent());\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\n\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\n const [hasImodelContext] = React.useState(\n props?.activeViewport?.iModel?.iTwinId !== undefined\n && props.activeViewport.iModel.iTwinId !== Guid.empty\n && props?.activeViewport?.iModel?.iModelId !== undefined\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\n\n const handleCancel = React.useCallback(() => {\n if (props.onCancelResult) {\n props.onCancelResult();\n return;\n }\n }, [props]);\n\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setUserName(event.target.value);\n if (invalidCredentialsProvided)\n setInvalidCredentialsProvided(false);\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\n\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setPassword(event.target.value);\n if (invalidCredentialsProvided)\n setInvalidCredentialsProvided(false);\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\n\n const handleArcGisLogin = React.useCallback(() => {\n setLayerAuthPending(true);\n setShowOauthPopup(true);\n if (oauthProcessSucceeded === false) {\n setOAuthProcessSucceeded(undefined);\n }\n\n }, [oauthProcessSucceeded]);\n\n // return true if authorization is needed\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\n if (sourceRequireAuth) {\n const settings = source.toLayerSettings();\n\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\n try {\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\n if (tokenEndpoint !== undefined) {\n const loginUrl = tokenEndpoint.getLoginUrl();\n setExternalLoginUrl(loginUrl);\n }\n\n } catch (_error) {\n\n }\n }\n\n }\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\n if (invalidCredentials) {\n setInvalidCredentialsProvided(true);\n } else if (invalidCredentialsProvided) {\n setInvalidCredentialsProvided(false); // flag reset\n }\n\n return sourceRequireAuth || invalidCredentials;\n }, [accessClient, invalidCredentialsProvided]);\n\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setMapName(event.target.value);\n }, [setMapName]);\n\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setSettingsStorageRadio(event.target.value);\n }, [setSettingsStorageRadio]);\n\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setMapUrl(event.target.value);\n }, [setMapUrl]);\n\n const createSource = React.useCallback(() => {\n let source: MapLayerSource | undefined;\n if (mapUrl && mapName) {\n source = MapLayerSource.fromJSON({\n url: mapUrl,\n name: mapName,\n formatId: mapType,\n });\n\n // Set credentials separately since they are not part of JSON\n if (source) {\n source.userName = userName || undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\n source.password = password || undefined;\n }\n\n }\n return source;\n }, [mapName, mapType, mapUrl, password, userName]);\n\n const handleOk = React.useCallback(() => {\n const source = createSource();\n if (source === undefined || props.mapLayerSourceToEdit) {\n onOkResult();\n\n if (source === undefined) {\n // Close the dialog and inform end user something went wrong.\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceName: mapName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n return;\n }\n\n // Simply change the source definition in the setting service\n if (props.mapLayerSourceToEdit !== undefined) {\n const vp = props.activeViewport;\n void (async () => {\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\n try {\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\n } catch (err: any) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return;\n }\n }\n })();\n return;\n }\n }\n\n // Attach source asynchronously.\n void (async () => {\n\n try {\n setLayerAttachPending(true);\n const validation = await source.validateSource(true);\n\n if (isMounted.current) {\n setLayerAttachPending(false);\n }\n\n if (validation.status === MapLayerSourceStatus.Valid) {\n // Update service settings if storage is available and we are not prompting user for credentials\n if (isSettingsStorageAvailable && !props.layerRequiringCredentials) {\n const storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\n const vp = props.activeViewport;\n if (vp?.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\n }\n }\n\n onOkResult({source, validation});\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n onOkResult({source, validation});\n } else {\n const authNeeded = await updateAuthState(source, validation);\n if (!authNeeded) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\n onOkResult({source, validation});\n }\n }\n } catch (error) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceName: source.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n onOkResult();\n }\n })();\n\n }, [createSource, mapName, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, isSettingsStorageAvailable, updateAuthState, hasImodelContext, props.layerRequiringCredentials, settingsStorage]);\n\n React.useEffect(() => {\n const handleOAuthProcessEnd = (success: boolean, _state: any) => {\n onOauthProcessEnd.raiseEvent(success, _state);\n };\n\n // Currently only arcgis support AccessClient\n\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\n if (ac?.onOAuthProcessEnd) {\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\n }\n setAccessClientInitialized(true);\n return () => {\n if (ac?.onOAuthProcessEnd) {\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\n }\n\n setAccessClient(undefined);\n setAccessClientInitialized(false);\n };\n }, [mapType, onOauthProcessEnd, setAccessClient]);\n\n // After a map type change, make sure the different Oauth states are reset.\n React.useEffect(() => {\n // Reset few states\n setServerRequireCredentials(false);\n setInvalidCredentialsProvided(false);\n setShowOauthPopup(false);\n setOAuthProcessSucceeded(undefined);\n setExternalLoginUrl(undefined);\n\n }, [mapType]);\n\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\n React.useEffect(() => {\n // Attach source asynchronously.\n void (async () => {\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\n try {\n const source = MapLayerSource.fromJSON({\n url: props.layerRequiringCredentials.url,\n name: props.layerRequiringCredentials.name,\n formatId: props.layerRequiringCredentials.formatId,\n });\n\n if (source !== undefined) {\n setLayerAttachPending(true);\n const validation = await source.validateSource(true);\n if (isMounted.current) {\n setLayerAttachPending(false);\n }\n await updateAuthState(source, validation);\n }\n } catch (_error) { }\n }\n })();\n\n }, [isAccessClientInitialized,\n props.layerRequiringCredentials?.formatId,\n props.layerRequiringCredentials?.name,\n props.layerRequiringCredentials?.url,\n updateAuthState]);\n\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const readyToSave = React.useCallback(() => {\n const credentialsSet = !!userName && !!password;\n return (!!mapUrl && !!mapName)\n && !layerAttachPending\n && (!serverRequireCredentials || credentialsSet)\n && !invalidCredentialsProvided\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\n\n const buttonCluster = React.useMemo(() => [\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ], [readyToSave, handleCancel, handleOk]);\n\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === SpecialKey.Enter) {\n if (readyToSave())\n handleOk();\n }\n }, [handleOk, readyToSave]);\n\n // onOauthProcessEnd events handler\n React.useEffect(() => {\n const handleOauthProcess = (success: boolean, _state: any) => {\n setLayerAuthPending(false);\n if (success) {\n setOAuthProcessSucceeded(true);\n setShowOauthPopup(false);\n setLayerAttachPending(false);\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\n } else {\n setShowOauthPopup(false);\n setLayerAttachPending(false);\n setOAuthProcessSucceeded(false);\n }\n };\n\n onOauthProcessEnd.addListener(handleOauthProcess);\n return () => {\n onOauthProcessEnd.removeListener(handleOauthProcess);\n };\n }, [handleOk, onOauthProcessEnd]);\n\n //\n // Monitors authentication method changes\n React.useEffect(() => {\n\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\n handleArcGisLogin();\n }\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\n\n // Monitors Oauth2 popup was closed\n const handleOAuthPopupClose = React.useCallback(() => {\n setShowOauthPopup(false);\n setLayerAuthPending(false);\n if (oauthProcessSucceeded === undefined)\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\n }, [oauthProcessSucceeded]);\n\n // Utility function to get warning message section\n function renderWarningMessage(): React.ReactNode {\n let node: React.ReactNode;\n let warningMessage: string | undefined;\n\n // Get the proper warning message\n if (showOauthPopup) {\n warningMessage = externalLoginWaitingMsg;\n } else if (oauthProcessSucceeded === false) {\n warningMessage = externalLoginFailedMsg;\n } else if (oauthProcessSucceeded === true) {\n warningMessage = externalLoginSucceededMsg;\n } else if (invalidCredentialsProvided) {\n warningMessage = invalidCredentialsLabel;\n } else if (serverRequireCredentials && (!userName || !password)) {\n warningMessage = missingCredentialsLabel;\n }\n\n // Sometimes we want to add an extra node, such as a button\n let extraNode: React.ReactNode;\n if (oauthProcessSucceeded === false) {\n extraNode = <div>\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\n </div>;\n }\n\n if (warningMessage !== undefined) {\n return (\n <div className=\"map-layer-source-warnMessage\">\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\n {extraNode}\n </div>);\n } else {\n return (<span className=\"map-layer-source-placeholder\">&nbsp;</span>);\n }\n return node;\n }\n\n // Use a hook to display the popup.\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\n return (\n <div ref={dialogContainer}>\n <Dialog\n className=\"map-layer-url-dialog\"\n title={dialogTitle}\n opened={true}\n resizable={true}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n minHeight={120}\n maxWidth={600}\n titleStyle={{ paddingLeft: \"10px\" }}\n footerStyle={{ paddingBottom: \"10px\", paddingRight: \"10px\" }}\n trapFocus={false}\n >\n <div className=\"map-layer-url-dialog-content\">\n <div className=\"map-layer-source-url\">\n <span className=\"map-layer-source-label\">{typeLabel}</span>\n <SelectMapFormat\n value={mapType}\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\n onChange={setMapType}\n mapTypesOptions={mapTypesOptions}\n />\n <span className=\"map-layer-source-label\">{nameLabel}</span>\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\n <span className=\"map-layer-source-label\">{urlLabel}</span>\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\n {serverRequireCredentials\n && externalLoginUrl === undefined // external login is handled in popup\n && props.mapLayerSourceToEdit === undefined &&\n <>\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\n <LabeledInput className=\"map-layer-source-input\"\n displayStyle=\"inline\"\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\n disabled={layerAttachPending || layerAuthPending}\n onChange={onUsernameChange}\n value={userName}\n size=\"small\" />\n\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\n <LabeledInput className=\"map-layer-source-input\"\n\n displayStyle=\"inline\"\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\n disabled={layerAttachPending || layerAuthPending}\n onChange={onPasswordChange}\n onKeyPress={handleOnKeyDown}\n value={password}\n size=\"small\" />\n\n </>\n }\n\n {/* Store settings options, not shown when editing a layer */}\n {!props.layerRequiringCredentials\n && !props.mapLayerSourceToEdit\n && <div title={!isSettingsStorageAvailable ? noSaveSettingsWarning : \"\"}>\n {hasImodelContext &&\n <div>\n <Radio disabled={!isSettingsStorageAvailable}\n name=\"settingsStorage\" value=\"iTwin\"\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\n onChange={onRadioChange} />\n <Radio disabled={!isSettingsStorageAvailable}\n name=\"settingsStorage\" value=\"Model\"\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\n onChange={onRadioChange} />\n </div>}\n </div>}\n </div>\n </div>\n\n {/* Warning message */}\n {renderWarningMessage()}\n\n {/* Progress bar */}\n {(layerAttachPending || layerAuthPending) &&\n <div className=\"map-layer-source-progressBar\">\n <ProgressLinear indeterminate />\n </div>\n }\n </Dialog>\n </div >\n );\n}\n"]}
@@ -24,6 +24,15 @@ $default-font-size: --iui-font-size-1;
24
24
  padding: 0;
25
25
  }
26
26
 
27
+ .map-layer-source-url-subLayers {
28
+
29
+ height: 200px;
30
+ width: 500px;
31
+ // height: calc(100% - 40px);
32
+ // width: calc(100% - 40px);
33
+ // border: 1px solid #ccc;
34
+ // border-radius: 16px
35
+ }
27
36
  .map-layer-source-url {
28
37
 
29
38
  height: 100%;
@@ -84,17 +93,8 @@ $default-font-size: --iui-font-size-1;
84
93
  .map-layer-source-warnMessage-icon {
85
94
  background-color: transparent;
86
95
  border: none;
87
- color: $buic-foreground-warning;
96
+ color: var(--iui-color-icon-warning);
88
97
  background-color: transparent;
89
-
90
- &:hover {
91
- color: $hovered-icon-color;
92
- }
93
-
94
- &:focus {
95
- outline: none;
96
- box-shadow: rgba(var(--iui-color-border-accent), var(--iui-opacity-4)) 0px 0px 0px 2px;
97
- }
98
98
  }
99
99
 
100
100
  }
@@ -1,11 +1,13 @@
1
1
  import { MapSubLayerProps } from "@itwin/core-common";
2
2
  import { ITreeDataProvider, TreeNodeItem } from "@itwin/components-react";
3
+ export declare type SubLayersTreeExpandMode = "full" | "rootGroupOnly";
3
4
  /**
4
5
  * Data provider that returns some fake nodes to show in tree.
5
6
  */
6
7
  export declare class SubLayersDataProvider implements ITreeDataProvider {
7
8
  private readonly _nodeMap;
8
- constructor(subLayers: MapSubLayerProps[]);
9
+ private readonly _expandMode;
10
+ constructor(subLayers: MapSubLayerProps[], expandMode?: SubLayersTreeExpandMode);
9
11
  static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean;
10
12
  private createId;
11
13
  private createNode;
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAA2B,iBAAiB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGnG;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;gBAElD,SAAS,EAAE,gBAAgB,EAAE;WAI3B,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO;IAO7E,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,SAAS;IAOJ,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY;IAQnC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY;CAO5C"}
1
+ {"version":3,"file":"SubLayersDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAA2B,iBAAiB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGnG,oBAAY,uBAAuB,GAAG,MAAM,GAAG,eAAe,CAAC;AAE/D;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAEjB,SAAS,EAAE,gBAAgB,EAAE,EAAE,UAAU,GAAE,uBAAyC;WAKlF,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO;IAO7E,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,SAAS;IAOJ,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY;IAQnC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY;CAO5C"}
@@ -9,8 +9,9 @@ import { CheckBoxState } from "@itwin/core-react";
9
9
  * Data provider that returns some fake nodes to show in tree.
10
10
  */
11
11
  export class SubLayersDataProvider {
12
- constructor(subLayers) {
12
+ constructor(subLayers, expandMode = "rootGroupOnly") {
13
13
  this._nodeMap = new Map();
14
+ this._expandMode = expandMode;
14
15
  this.loadNodes(subLayers);
15
16
  }
16
17
  static isUnnamedGroup(subLayer) {
@@ -40,8 +41,7 @@ export class SubLayersDataProvider {
40
41
  filteredProps?.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
41
42
  const treeNodes = [];
42
43
  filteredProps.forEach((props) => {
43
- treeNodes.push(this.createNode(props, (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
44
- undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
44
+ treeNodes.push(this.createNode(props, (this._expandMode === "full" ? true : (!parentId && props?.children !== undefined) ? true : undefined), undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
45
45
  if (props.children)
46
46
  this.loadChildNodes(allSubLayers, props.id);
47
47
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAGhC,YAAY,SAA6B;QAFxB,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAG5D,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,QAAsC;QACjE,IAAI,CAAC,QAAQ;YACX,OAAO,KAAK,CAAC;QAEf,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,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CAAC;IACX,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeNodeItem } from \"@itwin/components-react\";\nimport { CheckBoxState } from \"@itwin/core-react\";\n\n/**\n * Data provider that returns some fake nodes to show in tree.\n */\nexport class SubLayersDataProvider implements ITreeDataProvider {\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\n\n constructor(subLayers: MapSubLayerProps[]) {\n this.loadNodes(subLayers);\n }\n\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n private createId(props: MapSubLayerProps): string {\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\n }\n\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\n return {\n id: this.createId(props),\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\n hasChildren: !!props.children,\n isCheckboxVisible: true,\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\n extendedData: { subLayerId: props.id },\n isCheckboxDisabled,\n autoExpand: expanded,\n icon,\n };\n }\n\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\n if (filteredProps.length) {\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n const treeNodes: TreeNodeItem[] = [];\n\n filteredProps.forEach((props) => {\n treeNodes.push(this.createNode(props,\n (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),\n undefined,\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\n\n ));\n if (props.children)\n this.loadChildNodes(allSubLayers, props.id);\n });\n\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\n }\n }\n\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n if (subLayerNodes) {\n this.loadChildNodes(subLayerNodes, undefined);\n }\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray.length;\n\n return 0;\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray;\n\n return [];\n }\n}\n"]}
1
+ {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE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AE,EAAE,SAAS,CAAC,CAAC;SAC3E;IACH,CAAC;IAEO,SAAS,CAAC,aAA6C;QAC7D,aAAa,EAAE,IAAI,CAAC,CAAC,CAAmB,EAAE,CAAmB,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/G,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SAC/C;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeNodeItem } from \"@itwin/components-react\";\nimport { CheckBoxState } from \"@itwin/core-react\";\n\nexport type SubLayersTreeExpandMode = \"full\" | \"rootGroupOnly\";\n\n/**\n * Data provider that returns some fake nodes to show in tree.\n */\nexport class SubLayersDataProvider implements ITreeDataProvider {\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\n private readonly _expandMode;\n\n constructor(subLayers: MapSubLayerProps[], expandMode: SubLayersTreeExpandMode = \"rootGroupOnly\") {\n this._expandMode = expandMode;\n this.loadNodes(subLayers);\n }\n\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n private createId(props: MapSubLayerProps): string {\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\n }\n\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\n return {\n id: this.createId(props),\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\n hasChildren: !!props.children,\n isCheckboxVisible: true,\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\n extendedData: { subLayerId: props.id },\n isCheckboxDisabled,\n autoExpand: expanded,\n icon,\n };\n }\n\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\n if (filteredProps.length) {\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n const treeNodes: TreeNodeItem[] = [];\n\n filteredProps.forEach((props) => {\n treeNodes.push(this.createNode(props,\n (this._expandMode === \"full\" ? true : (!parentId && props?.children !== undefined) ? true : undefined),\n undefined,\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\n\n ));\n if (props.children)\n this.loadChildNodes(allSubLayers, props.id);\n });\n\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\n }\n }\n\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n if (subLayerNodes) {\n this.loadChildNodes(subLayerNodes, undefined);\n }\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray.length;\n\n return 0;\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray;\n\n return [];\n }\n}\n"]}