@itwin/map-layers 5.2.1 → 5.2.3

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 (85) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/mapLayers.d.ts +2 -1
  3. package/lib/cjs/mapLayers.d.ts.map +1 -1
  4. package/lib/cjs/mapLayers.js +3 -0
  5. package/lib/cjs/mapLayers.js.map +1 -1
  6. package/lib/cjs/public/locales/en/mapLayers.json +23 -5
  7. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -1
  8. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  9. package/lib/cjs/ui/Interfaces.d.ts +4 -2
  10. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  11. package/lib/cjs/ui/Interfaces.js.map +1 -1
  12. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  13. package/lib/cjs/ui/widget/BasemapPanel.js +58 -38
  14. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  15. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +1 -0
  16. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  17. package/lib/cjs/ui/widget/FeatureInfoWidget.js +17 -1
  18. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  19. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  20. package/lib/cjs/ui/widget/MapLayerDroppable.js +7 -4
  21. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  22. package/lib/cjs/ui/widget/MapLayerManager.d.ts +4 -1
  23. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  24. package/lib/cjs/ui/widget/MapLayerManager.js +10 -6
  25. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  26. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  27. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +3 -2
  28. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  29. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  30. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +17 -18
  31. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  32. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  33. package/lib/cjs/ui/widget/MapUrlDialog.js +37 -17
  34. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  35. package/lib/cjs/ui/widget/MapUrlDialog.scss +39 -10
  36. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  37. package/lib/cjs/ui/widget/SelectMapFormat.js +2 -2
  38. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  39. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  40. package/lib/cjs/ui/widget/SubLayersTree.js +8 -7
  41. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  42. package/lib/cjs/ui/widget/SubLayersTree.scss +27 -31
  43. package/lib/esm/mapLayers.d.ts +2 -1
  44. package/lib/esm/mapLayers.d.ts.map +1 -1
  45. package/lib/esm/mapLayers.js +3 -0
  46. package/lib/esm/mapLayers.js.map +1 -1
  47. package/lib/esm/public/locales/en/mapLayers.json +23 -5
  48. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -1
  49. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  50. package/lib/esm/ui/Interfaces.d.ts +4 -2
  51. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  52. package/lib/esm/ui/Interfaces.js.map +1 -1
  53. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  54. package/lib/esm/ui/widget/BasemapPanel.js +59 -39
  55. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  56. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +1 -0
  57. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  58. package/lib/esm/ui/widget/FeatureInfoWidget.js +15 -0
  59. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  60. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  61. package/lib/esm/ui/widget/MapLayerDroppable.js +7 -4
  62. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  63. package/lib/esm/ui/widget/MapLayerManager.d.ts +4 -1
  64. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  65. package/lib/esm/ui/widget/MapLayerManager.js +10 -6
  66. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  67. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  68. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +5 -4
  69. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  70. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  71. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +18 -19
  72. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  73. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  74. package/lib/esm/ui/widget/MapUrlDialog.js +40 -20
  75. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  76. package/lib/esm/ui/widget/MapUrlDialog.scss +39 -10
  77. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  78. package/lib/esm/ui/widget/SelectMapFormat.js +3 -3
  79. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  80. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  81. package/lib/esm/ui/widget/SubLayersTree.js +10 -9
  82. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  83. package/lib/esm/ui/widget/SubLayersTree.scss +27 -31
  84. package/lib/public/locales/en/mapLayers.json +23 -5
  85. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  # Change Log - @itwin/map-layers
2
2
 
3
- This log was last generated on Mon, 02 Oct 2023 20:32:55 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 26 Oct 2023 13:09:22 GMT and should not be manually modified.
4
+
5
+ ## 5.2.3
6
+ Thu, 26 Oct 2023 13:09:22 GMT
7
+
8
+ ### Patches
9
+
10
+ - Fixed base map translation issues
11
+ - Fix warning message after a failed attempt to provide credentials
12
+ - Fix an issue in the 'Add New Layer' dialog where invalid credentials warning would not appear after a first invalid attempt.
13
+ - Make the MapFeatureInfo Widget appear only when results are available.
14
+
15
+ ## 5.2.2
16
+ Thu, 05 Oct 2023 18:48:11 GMT
17
+
18
+ ### Patches
19
+
20
+ - Several UI fixes and fine tuning.
4
21
 
5
22
  ## 5.2.1
6
23
  Mon, 02 Oct 2023 20:32:55 GMT
@@ -1,4 +1,4 @@
1
- import { Localization } from "@itwin/core-common";
1
+ import { Localization, TranslationOptions } from "@itwin/core-common";
2
2
  import { UserPreferencesAccess } from "@itwin/core-frontend";
3
3
  export interface MapLayersConfig {
4
4
  localization?: Localization;
@@ -23,5 +23,6 @@ export declare class MapLayersUI {
23
23
  static terminate(): void;
24
24
  /** The internationalization service namespace. */
25
25
  static get localizationNamespace(): string;
26
+ static translate(key: string | string[], options?: TranslationOptions): string;
26
27
  }
27
28
  //# sourceMappingURL=mapLayers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAa,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIxE,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,WAAW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kBAAkB,GAAG,MAAM;CAGtF"}
@@ -27,6 +27,9 @@ class MapLayersUI {
27
27
  static get localizationNamespace() {
28
28
  return MapLayersUI._defaultNs;
29
29
  }
30
+ static translate(key, options) {
31
+ return MapLayersUI.localization.getLocalizedString(key, { ...options, ns: MapLayersUI._defaultNs });
32
+ }
30
33
  }
31
34
  exports.MapLayersUI = MapLayersUI;
32
35
  MapLayersUI._defaultNs = "mapLayers";
@@ -1 +1 @@
1
- {"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":";;;AAKA,wDAAwE;AAUxE;;;;;GAKG;AACH,MAAa,WAAW;IAMf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB;QACrD,mEAAmE;QACnE,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,yBAAS,CAAC,YAAY,CAAC;QAC1E,MAAM,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAC9C,WAAW,CAAC,qBAAqB,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,WAAW,CAAC;IACjD,CAAC;IAED,4EAA4E;IACrE,MAAM,CAAC,SAAS;QACrB,yBAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChF,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,WAAW,CAAC,UAAU,CAAC;IAChC,CAAC;;AA7BH,kCA8BC;AA7BgB,sBAAU,GAAG,WAAW,CAAC;AAEzB,+BAAmB,GAAa,EAAE,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*--------------------------------------------------------------------------------------------*/\nimport { Localization } from \"@itwin/core-common\";\nimport { IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\n// import { MapLayersUiItemsProvider } from \"./ui/MapLayersUiItemsProvider\";\n// import { FeatureInfoUiItemsProvider } from \"./ui/FeatureInfoUiItemsProvider\";\n\nexport interface MapLayersConfig {\n localization?: Localization;\n /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */\n iTwinConfig?: UserPreferencesAccess;\n}\n\n/** MapLayersUI is use when the package is used as a dependency to another app.\n * '''ts\n * await MapLayersUI.initialize({...MapLayersInitProps});\n * '''\n * @beta\n */\nexport class MapLayersUI {\n private static _defaultNs = \"mapLayers\";\n public static localization: Localization;\n private static _uiItemsProvidersId: string[] = [];\n private static _iTwinConfig?: UserPreferencesAccess;\n\n public static get iTwinConfig(): UserPreferencesAccess | undefined {\n return this._iTwinConfig;\n }\n\n /** Used to initialize the Map Layers */\n public static async initialize(config?: MapLayersConfig): Promise<void> {\n // register namespace containing localized strings for this package\n MapLayersUI.localization = config?.localization ?? IModelApp.localization;\n await MapLayersUI.localization.registerNamespace(\n MapLayersUI.localizationNamespace\n );\n\n MapLayersUI._iTwinConfig = config?.iTwinConfig;\n }\n\n /** Unregisters internationalization service namespace and UiItemManager */\n public static terminate() {\n IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return MapLayersUI._defaultNs;\n }\n}\n"]}
1
+ {"version":3,"file":"mapLayers.js","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":";;;AAKA,wDAAwE;AAQxE;;;;;GAKG;AACH,MAAa,WAAW;IAMf,MAAM,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAwB;QACrD,mEAAmE;QACnE,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,yBAAS,CAAC,YAAY,CAAC;QAC1E,MAAM,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAC9C,WAAW,CAAC,qBAAqB,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,GAAG,MAAM,EAAE,WAAW,CAAC;IACjD,CAAC;IAED,4EAA4E;IACrE,MAAM,CAAC,SAAS;QACrB,yBAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChF,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,WAAW,CAAC,UAAU,CAAC;IAChC,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,GAAsB,EAAE,OAA4B;QAC1E,OAAO,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,UAAU,EAAC,CAAC,CAAC;IACpG,CAAC;;AAjCH,kCAkCC;AAjCgB,sBAAU,GAAG,WAAW,CAAC;AAEzB,+BAAmB,GAAa,EAAE,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*--------------------------------------------------------------------------------------------*/\nimport { Localization, TranslationOptions } from \"@itwin/core-common\";\nimport { IModelApp, UserPreferencesAccess } from \"@itwin/core-frontend\";\n\nexport interface MapLayersConfig {\n localization?: Localization;\n /** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */\n iTwinConfig?: UserPreferencesAccess;\n}\n\n/** MapLayersUI is use when the package is used as a dependency to another app.\n * '''ts\n * await MapLayersUI.initialize({...MapLayersInitProps});\n * '''\n * @beta\n */\nexport class MapLayersUI {\n private static _defaultNs = \"mapLayers\";\n public static localization: Localization;\n private static _uiItemsProvidersId: string[] = [];\n private static _iTwinConfig?: UserPreferencesAccess;\n\n public static get iTwinConfig(): UserPreferencesAccess | undefined {\n return this._iTwinConfig;\n }\n\n /** Used to initialize the Map Layers */\n public static async initialize(config?: MapLayersConfig): Promise<void> {\n // register namespace containing localized strings for this package\n MapLayersUI.localization = config?.localization ?? IModelApp.localization;\n await MapLayersUI.localization.registerNamespace(\n MapLayersUI.localizationNamespace\n );\n\n MapLayersUI._iTwinConfig = config?.iTwinConfig;\n }\n\n /** Unregisters internationalization service namespace and UiItemManager */\n public static terminate() {\n IModelApp.localization.unregisterNamespace(MapLayersUI.localizationNamespace);\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return MapLayersUI._defaultNs;\n }\n\n public static translate(key: string | string[], options?: TranslationOptions): string {\n return MapLayersUI.localization.getLocalizedString(key, {...options, ns: MapLayersUI._defaultNs});\n }\n}\n"]}
@@ -4,14 +4,25 @@
4
4
  "Close": "Close source map layers pop-up"
5
5
  },
6
6
  "Basemap": {
7
- "BaseLayer": "Base:",
7
+ "BaseLayer": "Base",
8
8
  "BaseMapPanelTitle": "Map Layers",
9
9
  "ColorFill": "Solid Fill Color",
10
- "SelectBaseMap": "Select Map for base layer"
10
+ "SelectBaseMap": "Select base layer"
11
11
  },
12
12
  "ColorDialog": {
13
13
  "Title": "Specify Base Color"
14
14
  },
15
+ "Dialog":
16
+ {
17
+ "Add" : "Add",
18
+ "Cancel" : "Cancel",
19
+ "Edit" : "Edit"
20
+ },
21
+ "SelectFeaturesDialog":
22
+ {
23
+ "AllOn": "Select All",
24
+ "AllOff": "Select None"
25
+ },
15
26
  "MapLayerActionButtons": {
16
27
  "ShowAllLabel": "Show all",
17
28
  "HideAllLabel": "Hide all",
@@ -24,7 +35,7 @@
24
35
  "LayerExistsOverwriting": "Map layer {{layer}} already exists, overwriting info for that layer.",
25
36
  "LayerExistsAsITwinSetting": "Map layer {{layer}} already exists as a iTwin setting. Cannot overwrite with a model setting!",
26
37
  "AddCustomLayerButtonLabel": "Add Layer",
27
- "AttachCustomLayer": "Attach New Layer",
38
+ "AttachCustomLayer": "Add New Layer",
28
39
  "AttacheInfo": "Map layer attached from URL:",
29
40
  "Custom": "New",
30
41
  "LoadingMapSources": "Loading Map Sources",
@@ -52,11 +63,11 @@
52
63
  "RemoveLayerDefError": "Could not delete map layer definition: {{layerName}}",
53
64
  "RemoveLayerDefSuccess": "Successfully deleted map layer definition: {{layerName}}",
54
65
  "SearchPlaceholder": "Search...",
55
- "SelectLayersToCreate": "Select layers to be created",
66
+ "SelectLayersToCreate": "Select Layers To Add",
56
67
  "StoreOnModelSettings": "Store on Model Settings",
57
68
  "StoreOnITwinSettings": "Store on iTwin Settings",
58
69
  "TechPreviewBadgeTooltip": "Technology preview",
59
- "TooManyLayersSelected": "There are currently {{layerCount}} layers selected; Adding too many layers may impact performance.",
70
+ "TooManyLayersSelected": "{{layerCount}} layers selected; performance may be affected.",
60
71
  "Type": "Type",
61
72
  "URL": "URL",
62
73
  "UrlInputPlaceHolder": "Enter Map Source URL",
@@ -136,5 +147,12 @@
136
147
  },
137
148
  "TransparencyPopup": {
138
149
  "SetTransparency": "Set transparency"
150
+ },
151
+ "WellKnownBaseMaps" : {
152
+ "BingProvider" : {
153
+ "Aerial" : "Bing Maps: Aerial Imagery",
154
+ "Hybrid" : "Bing Maps: Aerial Imagery with labels",
155
+ "Street" : "Bing Maps: Streets"
156
+ }
139
157
  }
140
158
  }
@@ -45,7 +45,7 @@ class FeatureInfoUiItemsProvider {
45
45
  label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
46
46
  icon: React.createElement(itwinui_icons_react_1.SvgMapInfo, null),
47
47
  content: React.createElement(FeatureInfoWidget_1.MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
48
- defaultState: appui_react_1.WidgetState.Closed,
48
+ defaultState: appui_react_1.WidgetState.Hidden,
49
49
  });
50
50
  }
51
51
  return widgets;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":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,IAAI,+BAAiB,CAAC,GAAG,CAAC;QACpD,IAAI,UAAU,KAAK,+BAAiB,CAAC,GAAG,IAAK,UAAU,KAAK,wBAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,gCAAkB,CAAC,KAAK,EAAI;YACzH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,oBAAC,gCAAU,OAAE;gBACnB,OAAO,EAAE,oBAAC,wCAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,yBAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAzCH,gEA0CC;AAxCwB,mCAAQ,GAAG,iCAAiC,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\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarItem, ToolbarOrientation, ToolbarUsage, ToolItemDef, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\n\nexport const getMapFeatureInfoToolItemDef = (): ToolItemDef =>\n new ToolItemDef({\n toolId: MapFeatureInfoTool.toolId,\n iconSpec: <SvgMapInfo/>,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: () => MapFeatureInfoTool.description,\n execute: async () => { await IModelApp.tools.run(MapFeatureInfoTool.toolId); },\n });\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider { // eslint-disable-line deprecation/deprecation\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\n\n public provideToolbarItems(\n _stageId: string,\n stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n ): ReadonlyArray<ToolbarItem> {\n if (\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\n stageUsage === StageUsage.General &&\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef()),\n ];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right ) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo/>,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Closed,\n });\n }\n\n return widgets;\n }\n}\n"]}
1
+ {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,oDAAgM;AAChM,kEAAkE;AAElE,4CAA2C;AAC3C,wDAAiD;AACjD,kEAA+D;AAC/D,oEAAwD;AAEjD,MAAM,4BAA4B,GAAG,GAAgB,EAAE,CAC5D,IAAI,yBAA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ACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,oBAAC,gCAAU,OAAE;gBACnB,OAAO,EAAE,oBAAC,wCAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,yBAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAzCH,gEA0CC;AAxCwB,mCAAQ,GAAG,iCAAiC,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\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarItem, ToolbarOrientation, ToolbarUsage, ToolItemDef, UiItemsProvider, WidgetState } from \"@itwin/appui-react\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\n\nexport const getMapFeatureInfoToolItemDef = (): ToolItemDef =>\n new ToolItemDef({\n toolId: MapFeatureInfoTool.toolId,\n iconSpec: <SvgMapInfo/>,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: () => MapFeatureInfoTool.description,\n execute: async () => { await IModelApp.tools.run(MapFeatureInfoTool.toolId); },\n });\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider { // eslint-disable-line deprecation/deprecation\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\n\n public provideToolbarItems(\n _stageId: string,\n stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n ): ReadonlyArray<ToolbarItem> {\n if (\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\n stageUsage === StageUsage.General &&\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n return [\n ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef()),\n ];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right ) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo/>,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Hidden,\n });\n }\n\n return widgets;\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { BeEvent } from "@itwin/core-bentley";
2
- import { MapSubLayerProps } from "@itwin/core-common";
2
+ import { BaseMapLayerSettings, MapSubLayerProps } from "@itwin/core-common";
3
3
  import { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from "@itwin/core-frontend";
4
4
  export interface StyleMapLayerSettings {
5
5
  /** Name */
6
6
  name: string;
7
- /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */
7
+ /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */
8
8
  source: string;
9
9
  /** Controls visibility of layer */
10
10
  visible: boolean;
@@ -33,6 +33,8 @@ export interface MapLayerOptions {
33
33
  hideExternalMapLayers?: boolean;
34
34
  fetchPublicMapLayerSources?: boolean;
35
35
  mapTypeOptions?: MapTypesOptions;
36
+ /** Optional list of base map-layers to display in the base map select control */
37
+ baseMapLayers?: BaseMapLayerSettings[];
36
38
  }
37
39
  export interface MapFeatureInfoPropertyGridOptions {
38
40
  isPropertySelectionEnabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAG,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAE3G,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,+BAA+B,CAAC;IAChD,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IAEnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,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AW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;IAEjC,iFAAiF;IACjF,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,iCAAiC;IAChD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,oBAAY,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC;AAE5D,MAAM,WAAW,qBAAqB;IACpC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,iCAAiC,CAAC;CACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps } from \"@itwin/core-common\";\nimport { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from \"@itwin/core-frontend\";\n\nexport interface StyleMapLayerSettings {\n /** Name */\n name: string;\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\n source: string;\n /** Controls visibility of layer */\n visible: boolean;\n treeVisibility: MapTileTreeScaleRangeVisibility;\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\n transparency: number;\n /** Transparent background */\n transparentBackground: boolean;\n /** set map as underlay or overlay */\n isOverlay: boolean;\n /** layer index in the viewport */\n layerIndex: number;\n /** Available map sub-layer */\n subLayers?: MapSubLayerProps[];\n /** sub-layer panel displayed. */\n showSubLayers: boolean;\n /** Some format can publish only a single layer at a time (i.e WMTS) */\n provider?: MapLayerImageryProvider;\n\n selected: boolean;\n}\n\nexport interface MapTypesOptions {\n readonly supportTileUrl: boolean;\n readonly supportWmsAuthentication: boolean;\n}\n\nexport interface MapLayerOptions {\n hideExternalMapLayers?: boolean;\n fetchPublicMapLayerSources?: boolean;\n mapTypeOptions?: MapTypesOptions;\n}\n\nexport interface MapFeatureInfoPropertyGridOptions {\n isPropertySelectionEnabled?: boolean;\n}\n\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\n\nexport interface MapFeatureInfoOptions {\n disableDefaultFeatureInfoTool?: boolean;\n showLoadProgressAnimation?: boolean;\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\n}\n"]}
1
+ {"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { BaseMapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\nimport { HitDetail, MapLayerImageryProvider, MapTileTreeScaleRangeVisibility } from \"@itwin/core-frontend\";\n\nexport interface StyleMapLayerSettings {\n /** Name */\n name: string;\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\n source: string;\n /** Controls visibility of layer */\n visible: boolean;\n treeVisibility: MapTileTreeScaleRangeVisibility;\n /** A transparency value from 0.0 (fully opaque) to 1.0 (fully transparent) to apply to map graphics when drawing, or false to indicate the transparency should not be overridden. Default value: false. */\n transparency: number;\n /** Transparent background */\n transparentBackground: boolean;\n /** set map as underlay or overlay */\n isOverlay: boolean;\n /** layer index in the viewport */\n layerIndex: number;\n /** Available map sub-layer */\n subLayers?: MapSubLayerProps[];\n /** sub-layer panel displayed. */\n showSubLayers: boolean;\n /** Some format can publish only a single layer at a time (i.e WMTS) */\n provider?: MapLayerImageryProvider;\n\n selected: boolean;\n}\n\nexport interface MapTypesOptions {\n readonly supportTileUrl: boolean;\n readonly supportWmsAuthentication: boolean;\n}\n\nexport interface MapLayerOptions {\n hideExternalMapLayers?: boolean;\n fetchPublicMapLayerSources?: boolean;\n mapTypeOptions?: MapTypesOptions;\n\n /** Optional list of base map-layers to display in the base map select control */\n baseMapLayers?: BaseMapLayerSettings[];\n}\n\nexport interface MapFeatureInfoPropertyGridOptions {\n isPropertySelectionEnabled?: boolean;\n}\n\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\n\nexport interface MapFeatureInfoOptions {\n disableDefaultFeatureInfoTool?: boolean;\n showLoadProgressAnimation?: boolean;\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAgBA,OAAO,qBAAqB,CAAC;AAY7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAiLpD"}
1
+ {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAgBA,OAAO,qBAAqB,CAAC;AAK7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAwMpD"}
@@ -12,24 +12,19 @@ const core_common_1 = require("@itwin/core-common");
12
12
  const core_react_1 = require("@itwin/core-react");
13
13
  const imodel_components_react_1 = require("@itwin/imodel-components-react");
14
14
  const itwinui_react_1 = require("@itwin/itwinui-react");
15
- const React = require("react");
16
15
  const mapLayers_1 = require("../../mapLayers");
17
16
  const MapLayerManager_1 = require("./MapLayerManager");
18
17
  const TransparencyPopupButton_1 = require("./TransparencyPopupButton");
18
+ const React = require("react");
19
19
  require("./BasemapPanel.scss");
20
- function getBaseMapFromStyle(backgroundBase) {
21
- if (!backgroundBase)
22
- return undefined;
23
- if (backgroundBase instanceof core_common_1.ImageMapLayerSettings || backgroundBase instanceof core_common_1.ColorDef)
24
- return backgroundBase.toJSON();
25
- return undefined;
26
- }
20
+ const customBaseMapValue = "customBaseMap";
21
+ const getSelectKeyFromProvider = (base) => `${base.provider ? `${base.provider.name}.${core_common_1.BackgroundMapType[base.provider.type]}` : `${base.name}`}`;
27
22
  /** @internal */
28
23
  // eslint-disable-next-line @typescript-eslint/naming-convention
29
24
  function BasemapPanel(props) {
30
25
  const [useColorLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.ColorFill"));
31
26
  const { activeViewport, bases } = (0, MapLayerManager_1.useSourceMapContext)();
32
- const [selectedBaseMap, setSelectedBaseMap] = React.useState(getBaseMapFromStyle(activeViewport?.displayStyle.settings.mapImagery.backgroundBase));
27
+ const [selectedBaseMap, setSelectedBaseMap] = React.useState(activeViewport?.displayStyle.settings.mapImagery.backgroundBase);
33
28
  const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {
34
29
  if (activeViewport) {
35
30
  const mapImagery = activeViewport.displayStyle.settings.mapImagery;
@@ -47,6 +42,7 @@ function BasemapPanel(props) {
47
42
  return 0;
48
43
  }
49
44
  });
45
+ const [customBaseMap, setCustomBaseMap] = React.useState();
50
46
  const [baseMapVisible, setBaseMapVisible] = React.useState(() => {
51
47
  if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ImageMapLayerSettings) {
52
48
  return activeViewport.displayStyle.backgroundMapBase.visible;
@@ -55,7 +51,7 @@ function BasemapPanel(props) {
55
51
  });
56
52
  const handleMapImageryChanged = React.useCallback((args) => {
57
53
  // selectedBaseMap
58
- const baseMap = getBaseMapFromStyle(args.backgroundBase);
54
+ const baseMap = args.backgroundBase;
59
55
  if (JSON.stringify(baseMap) !== JSON.stringify(selectedBaseMap))
60
56
  setSelectedBaseMap(baseMap);
61
57
  // baseMapTransparencyValue
@@ -90,10 +86,18 @@ function BasemapPanel(props) {
90
86
  const baseMapOptions = React.useMemo(() => {
91
87
  const baseOptions = [];
92
88
  baseOptions.push({ value: useColorLabel, label: useColorLabel });
93
- if (bases)
94
- baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));
89
+ if (bases) {
90
+ baseOptions.push(...bases.map((bgProvider) => {
91
+ const value = getSelectKeyFromProvider(bgProvider);
92
+ const label = mapLayers_1.MapLayersUI.translate(`WellKnownBaseMaps.${value}`);
93
+ return { value, label };
94
+ }));
95
+ }
96
+ if (customBaseMap) {
97
+ baseOptions.push({ value: customBaseMapValue, label: customBaseMap.name });
98
+ }
95
99
  return baseOptions;
96
- }, [bases, useColorLabel]);
100
+ }, [bases, useColorLabel, customBaseMap]);
97
101
  const [presetColors] = React.useState([
98
102
  core_common_1.ColorDef.create(core_common_1.ColorByName.grey),
99
103
  core_common_1.ColorDef.create(core_common_1.ColorByName.lightGrey),
@@ -104,26 +108,36 @@ function BasemapPanel(props) {
104
108
  core_common_1.ColorDef.create(core_common_1.ColorByName.tan),
105
109
  core_common_1.ColorDef.create(core_common_1.ColorByName.darkBrown),
106
110
  ]);
107
- const baseIsColor = React.useMemo(() => typeof selectedBaseMap === "number", [selectedBaseMap]);
111
+ const baseIsColor = React.useMemo(() => selectedBaseMap instanceof core_common_1.ColorDef, [selectedBaseMap]);
108
112
  const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);
109
- const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);
113
+ const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap.toJSON() : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);
110
114
  const [colorDialogTitle] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:ColorDialog.Title"));
111
115
  const selectedBaseMapValue = React.useMemo(() => {
112
116
  if (baseIsMap) {
113
- const mapName = selectedBaseMap.name;
114
- const foundItem = baseMapOptions.find((value) => value.label === mapName);
115
- if (foundItem)
116
- return foundItem;
117
+ if (selectedBaseMap instanceof core_common_1.BaseMapLayerSettings && selectedBaseMap.provider) {
118
+ const mapName = getSelectKeyFromProvider(selectedBaseMap);
119
+ const foundItem = baseMapOptions.find((value) => value.value === mapName);
120
+ if (foundItem)
121
+ return foundItem;
122
+ }
123
+ else if (selectedBaseMap instanceof core_common_1.BaseMapLayerSettings) {
124
+ // We got a custom base map, create en entry for it.
125
+ setCustomBaseMap(selectedBaseMap);
126
+ return { value: customBaseMapValue, label: selectedBaseMap.name };
127
+ }
128
+ }
129
+ else if (baseIsColor) {
130
+ return baseMapOptions[0];
117
131
  }
118
- return baseMapOptions[0];
119
- }, [selectedBaseMap, baseMapOptions, baseIsMap]);
132
+ return { value: "", label: "" }; // will display the place holder
133
+ }, [baseIsMap, baseIsColor, selectedBaseMap, baseMapOptions]);
120
134
  const handleBackgroundColorDialogOk = React.useCallback((bgColorDef) => {
121
135
  appui_react_1.UiFramework.dialogs.modal.close();
122
136
  if (activeViewport) {
123
137
  // change color and make sure previously set transparency is not lost.
124
138
  const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
125
139
  activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
126
- setSelectedBaseMap(bgColorDef.toJSON());
140
+ setSelectedBaseMap(bgColorDef);
127
141
  }
128
142
  }, [activeViewport]);
129
143
  const handleBackgroundColorDialogCancel = React.useCallback(() => {
@@ -134,26 +148,32 @@ function BasemapPanel(props) {
134
148
  appui_react_1.UiFramework.dialogs.modal.open(React.createElement(imodel_components_react_1.ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
135
149
  }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps
136
150
  const handleBaseMapSelection = React.useCallback((value) => {
137
- if (bases && activeViewport && value) {
138
- const baseMap = bases.find((map) => map.name === value);
139
- if (baseMap) {
140
- const baseProps = baseMap.toJSON();
141
- if (activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.BaseMapLayerSettings) {
142
- activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ ...baseProps, visible: baseMapVisible });
151
+ if (activeViewport && value) {
152
+ if (value === customBaseMapValue && customBaseMap) {
153
+ setSelectedBaseMap(customBaseMap);
154
+ activeViewport.displayStyle.backgroundMapBase = customBaseMap;
155
+ }
156
+ else if (bases) {
157
+ const baseMap = bases.find((provider) => getSelectKeyFromProvider(provider) === value);
158
+ if (baseMap) {
159
+ const baseProps = baseMap.toJSON();
160
+ if (activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.BaseMapLayerSettings) {
161
+ activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ ...baseProps, visible: baseMapVisible });
162
+ }
163
+ else {
164
+ activeViewport.displayStyle.backgroundMapBase = core_common_1.BaseMapLayerSettings.fromJSON({ ...baseProps, visible: baseMapVisible });
165
+ }
166
+ setSelectedBaseMap(baseMap);
143
167
  }
144
168
  else {
145
- activeViewport.displayStyle.backgroundMapBase = core_common_1.BaseMapLayerSettings.fromJSON({ ...baseProps, visible: baseMapVisible });
169
+ const bgColorDef = core_common_1.ColorDef.fromJSON(bgColor);
170
+ const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
171
+ activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
172
+ setSelectedBaseMap(bgColorDef);
146
173
  }
147
- setSelectedBaseMap(baseProps);
148
- }
149
- else {
150
- const bgColorDef = core_common_1.ColorDef.fromJSON(bgColor);
151
- const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
152
- activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);
153
- setSelectedBaseMap(bgColorDef.toJSON());
154
174
  }
155
175
  }
156
- }, [baseMapVisible, bases, activeViewport, bgColor]);
176
+ }, [activeViewport, bases, customBaseMap, baseMapVisible, bgColor]);
157
177
  const handleVisibilityChange = React.useCallback(() => {
158
178
  if (activeViewport) {
159
179
  const newState = !baseMapVisible;
@@ -168,10 +188,10 @@ function BasemapPanel(props) {
168
188
  const [selectBaseMapLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.SelectBaseMap"));
169
189
  const [toggleVisibility] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.ToggleVisibility"));
170
190
  return (React.createElement(React.Fragment, null,
191
+ React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
171
192
  React.createElement("div", { className: "map-manager-base-item" },
172
193
  React.createElement(itwinui_react_1.Button, { className: "map-manager-basemap-visibility map-manager-visibility-icon", size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ImageMapLayerSettings) },
173
194
  React.createElement(core_react_1.WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" })),
174
- React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
175
195
  React.createElement(itwinui_react_1.Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }),
176
196
  baseIsColor &&
177
197
  React.createElement(imodel_components_react_1.ColorSwatch, { className: "map-manager-base-item-color", colorDef: core_common_1.ColorDef.fromJSON(bgColor), round: false, onColorPick: handleBgColorClick }),
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;;;AAE3C,oDAAiD;AACjD,oDAA8K;AAC9K,kDAAgD;AAChD,4EAAgF;AAChF,wDAAoE;AACpE,+BAA+B;AAC/B,+CAA8C;AAC9C,uDAAwD;AACxD,uEAAoE;AACpE,+BAA6B;AAE7B,SAAS,mBAAmB,CAAC,cAA6C;IACxE,IAAI,CAAC,cAAc;QACjB,OAAO,SAAS,CAAC;IAEnB,IAAI,cAAc,YAAY,mCAAqB,IAAI,cAAc,YAAY,sBAAQ;QACvF,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC;IAEjC,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACnH,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,IAAA,qCAAmB,GAAE,CAAC;IACxD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA6B,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,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AAC,QAAQ,EAAE,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,iDAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,CAAC;AAjLD,oCAiLC","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/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BaseLayerProps, BaseLayerSettings, BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\nimport \"./BasemapPanel.scss\";\n\nfunction getBaseMapFromStyle(backgroundBase: BaseLayerSettings | undefined) {\n if (!backgroundBase)\n return undefined;\n\n if (backgroundBase instanceof ImageMapLayerSettings || backgroundBase instanceof ColorDef)\n return backgroundBase.toJSON();\n\n return undefined;\n}\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<BaseLayerProps | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle.settings.mapImagery.backgroundBase));\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport) {\n const mapImagery = activeViewport.displayStyle.settings.mapImagery;\n if (mapImagery.backgroundBase instanceof ImageMapLayerSettings) {\n return mapImagery.backgroundBase.transparency;\n } else if (mapImagery.backgroundBase instanceof ColorDef ) {\n return mapImagery.backgroundBase.getAlpha()/255;\n } else {\n return 0;\n }\n } else {\n return 0;\n }\n });\n\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n const handleMapImageryChanged = React.useCallback((args: Readonly<MapImagerySettings>) => {\n // selectedBaseMap\n const baseMap = getBaseMapFromStyle(args.backgroundBase);\n if (JSON.stringify(baseMap) !== JSON.stringify(selectedBaseMap))\n setSelectedBaseMap(baseMap);\n\n // baseMapTransparencyValue\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.transparency !== baseMapTransparencyValue) {\n setBaseMapTransparencyValue(args.backgroundBase.transparency);\n } else if (args.backgroundBase instanceof ColorDef && args.backgroundBase.getAlpha() !== baseMapTransparencyValue ) {\n setBaseMapTransparencyValue(args.backgroundBase.getAlpha()/255);\n }\n\n // baseMapVisible\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.visible !== baseMapVisible) {\n setBaseMapVisible(args.backgroundBase.visible);\n }\n }, [baseMapTransparencyValue, baseMapVisible, selectedBaseMap, setBaseMapTransparencyValue, setBaseMapVisible, setSelectedBaseMap]);\n\n // Monitor display style's onMapImageryChanged event\n React.useEffect(() => {\n return activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n }, [activeViewport, handleMapImageryChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n handleMapImageryChanged(activeViewport.displayStyle.settings.mapImagery);\n }\n }, [activeViewport, handleMapImageryChanged]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases)\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\n return baseOptions;\n }, [bases, useColorLabel]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n const mapName = (selectedBaseMap! as MapLayerProps).name;\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\n if (foundItem)\n return foundItem;\n }\n return baseMapOptions[0];\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (bases && activeViewport && value) {\n const baseMap = bases.find((map) => map.name === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({...baseProps, visible: baseMapVisible});\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON({...baseProps, visible: baseMapVisible});\n }\n setSelectedBaseMap(baseProps);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }\n }, [baseMapVisible, bases, activeViewport, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <div className=\"map-manager-base-item\" >\n <Button className=\"map-manager-basemap-visibility map-manager-visibility-icon\" size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange} />\n </div>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;;;AAE3C,oDA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,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,iBAAiB,YAAY,mCAAqB,CAAC;gBAC3S,oBAAC,wBAAW,IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,GAAI,CACjF;YACT,oBAAC,sBAAM,IAAC,SAAS,EAAC,8BAA8B,EAC9C,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,oBAAoB,CAAC,KAAK,EACjC,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAC,OAAO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,qCAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,iDAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAI,CAChJ,CACL,CACJ,CAAC;AACJ,CAAC;AAxMD,oCAwMC","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/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BackgroundMapType, BaseLayerSettings, BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\nimport * as React from \"react\";\nimport \"./BasemapPanel.scss\";\n\nconst customBaseMapValue = \"customBaseMap\";\nconst getSelectKeyFromProvider = (base: BaseMapLayerSettings) => `${base.provider ? `${base.provider.name}.${BackgroundMapType[base.provider.type]}` : `${base.name}`}`;\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<BaseLayerSettings | undefined>(activeViewport?.displayStyle.settings.mapImagery.backgroundBase);\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport) {\n const mapImagery = activeViewport.displayStyle.settings.mapImagery;\n if (mapImagery.backgroundBase instanceof ImageMapLayerSettings) {\n return mapImagery.backgroundBase.transparency;\n } else if (mapImagery.backgroundBase instanceof ColorDef ) {\n return mapImagery.backgroundBase.getAlpha()/255;\n } else {\n return 0;\n }\n } else {\n return 0;\n }\n });\n const [customBaseMap, setCustomBaseMap] = React.useState<BaseMapLayerSettings|undefined>();\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n const handleMapImageryChanged = React.useCallback((args: Readonly<MapImagerySettings>) => {\n // selectedBaseMap\n const baseMap = args.backgroundBase;\n if (JSON.stringify(baseMap) !== JSON.stringify(selectedBaseMap))\n setSelectedBaseMap(baseMap);\n\n // baseMapTransparencyValue\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.transparency !== baseMapTransparencyValue) {\n setBaseMapTransparencyValue(args.backgroundBase.transparency);\n } else if (args.backgroundBase instanceof ColorDef && args.backgroundBase.getAlpha() !== baseMapTransparencyValue ) {\n setBaseMapTransparencyValue(args.backgroundBase.getAlpha()/255);\n }\n\n // baseMapVisible\n if (args.backgroundBase instanceof ImageMapLayerSettings && args.backgroundBase.visible !== baseMapVisible) {\n setBaseMapVisible(args.backgroundBase.visible);\n }\n }, [baseMapTransparencyValue, baseMapVisible, selectedBaseMap, setBaseMapTransparencyValue, setBaseMapVisible, setSelectedBaseMap]);\n\n // Monitor display style's onMapImageryChanged event\n React.useEffect(() => {\n return activeViewport?.displayStyle.settings.onMapImageryChanged.addListener(handleMapImageryChanged);\n }, [activeViewport, handleMapImageryChanged]);\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n handleMapImageryChanged(activeViewport.displayStyle.settings.mapImagery);\n }\n }, [activeViewport, handleMapImageryChanged]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases) {\n baseOptions.push(...bases.map((bgProvider) => {\n const value = getSelectKeyFromProvider(bgProvider);\n const label = MapLayersUI.translate(`WellKnownBaseMaps.${value}`);\n return { value, label };\n } ));\n }\n if (customBaseMap) {\n baseOptions.push({value: customBaseMapValue, label: customBaseMap.name});\n }\n return baseOptions;\n }, [bases, useColorLabel, customBaseMap]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => selectedBaseMap instanceof ColorDef, [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? (selectedBaseMap as ColorDef).toJSON(): presetColors[0].toJSON(),\n [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n if (selectedBaseMap instanceof BaseMapLayerSettings && selectedBaseMap.provider) {\n const mapName = getSelectKeyFromProvider(selectedBaseMap);\n const foundItem = baseMapOptions.find((value) => value.value === mapName);\n if (foundItem)\n return foundItem;\n } else if (selectedBaseMap instanceof BaseMapLayerSettings) {\n // We got a custom base map, create en entry for it.\n setCustomBaseMap(selectedBaseMap);\n return {value: customBaseMapValue, label: selectedBaseMap.name};\n }\n } else if (baseIsColor) {\n return baseMapOptions[0];\n }\n return {value: \"\", label: \"\"}; // will display the place holder\n\n }, [baseIsMap, baseIsColor, selectedBaseMap, baseMapOptions]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef);\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (activeViewport && value) {\n if (value === customBaseMapValue && customBaseMap) {\n setSelectedBaseMap(customBaseMap);\n activeViewport.displayStyle.backgroundMapBase = customBaseMap;\n } else if (bases) {\n const baseMap = bases.find((provider) => getSelectKeyFromProvider(provider) === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({...baseProps, visible: baseMapVisible});\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON({...baseProps, visible: baseMapVisible});\n }\n setSelectedBaseMap(baseMap);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n setSelectedBaseMap(bgColorDef);\n }\n }\n }\n }, [activeViewport, bases, customBaseMap, baseMapVisible, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <div className=\"map-manager-base-item\" >\n <Button className=\"map-manager-basemap-visibility map-manager-visibility-icon\" size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange} />\n </div>\n </>\n );\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { MapFeatureInfoOptions } from "../Interfaces";
2
+ export declare function useSpecificWidgetDef(id: string): import("@itwin/appui-react").WidgetDef | undefined;
2
3
  interface MapFeatureInfoWidgetProps {
3
4
  featureInfoOpts: MapFeatureInfoOptions;
4
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAkDlF"}
1
+ {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAKtD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,sDAG9C;AAGD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eA4DlF"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MapFeatureInfoWidget = void 0;
3
+ exports.MapFeatureInfoWidget = exports.useSpecificWidgetDef = void 0;
4
4
  /*---------------------------------------------------------------------------------------------
5
5
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
6
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -10,6 +10,13 @@ const components_react_1 = require("@itwin/components-react");
10
10
  const core_react_1 = require("@itwin/core-react");
11
11
  const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
12
12
  const mapLayers_1 = require("../../mapLayers");
13
+ const appui_react_1 = require("@itwin/appui-react");
14
+ const FeatureInfoUiItemsProvider_1 = require("../FeatureInfoUiItemsProvider");
15
+ function useSpecificWidgetDef(id) {
16
+ const frontstageDef = (0, appui_react_1.useActiveFrontstageDef)();
17
+ return frontstageDef?.findWidgetDef(id);
18
+ }
19
+ exports.useSpecificWidgetDef = useSpecificWidgetDef;
13
20
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
21
  function MapFeatureInfoWidget({ featureInfoOpts }) {
15
22
  const dataProvider = React.useRef();
@@ -25,6 +32,15 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
25
32
  dataProvider?.current?.onUnload();
26
33
  };
27
34
  }, []);
35
+ const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider_1.FeatureInfoUiItemsProvider.widgetId);
36
+ React.useEffect(() => {
37
+ if (hasData) {
38
+ widgetDef?.setWidgetState(appui_react_1.WidgetState.Open);
39
+ }
40
+ else {
41
+ widgetDef?.setWidgetState(appui_react_1.WidgetState.Hidden);
42
+ }
43
+ }, [widgetDef, hasData]);
28
44
  React.useEffect(() => {
29
45
  dataProvider.current?.onDataChanged.addListener(handleDataChanged);
30
46
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,8DAAkF;AAClF,kDAA0F;AAE1F,uEAAmE;AAEnE,+CAA8C;AAM9C,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAE7E,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,UAAU,CAAC,YAAY,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC;IA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------------------------------------------------------------------------------\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 * as React from \"react\";\n\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider} from \"./FeatureInfoDataProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [hasData, setHasData] = React.useState<boolean>(false);\n\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const handleDataChanged = () => {\n setHasData(dataProvider.current !== undefined && dataProvider.current.hasRecords);\n };\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n\n }, []);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />\n </ResizableContainerObserver>\n );\n else\n return (<></>);\n }\n}\n"]}
1
+ {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,8DAAkF;AAClF,kDAA0F;AAE1F,uEAAmE;AAEnE,+CAA8C;AAC9C,oDAAyE;AACzE,8EAA2E;AAE3E,SAAgB,oBAAoB,CAAC,EAAU;IAC7C,MAAM,aAAa,GAAG,IAAA,oCAAsB,GAAE,CAAC;IAC/C,OAAO,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAHD,oDAGC;AAOD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAE7E,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,UAAU,CAAC,YAAY,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,YAAY,CAAC,OAAO,GAAG,IAAI,iDAAuB,EAAE,CAAC;QACrD,OAAO,GAAG,EAA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AAY,CAAC,OAAO,EAClC,WAAW,EAAE,wBAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,GAAI,CACvE,CAC9B,CAAC;;YAEF,OAAO,CAAC,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC;AA5DD,oDA4DC","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 * as React from \"react\";\n\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider} from \"./FeatureInfoDataProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { FeatureInfoUiItemsProvider } from \"../FeatureInfoUiItemsProvider\";\n\nexport function useSpecificWidgetDef(id: string) {\n const frontstageDef = useActiveFrontstageDef();\n return frontstageDef?.findWidgetDef(id);\n}\n\n// MapFeatureInfoWidgetProps\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [hasData, setHasData] = React.useState<boolean>(false);\n\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const handleDataChanged = () => {\n setHasData(dataProvider.current !== undefined && dataProvider.current.hasRecords);\n };\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider.widgetId);\n\n React.useEffect(() => {\n if (hasData) {\n widgetDef?.setWidgetState(WidgetState.Open);\n } else {\n widgetDef?.setWidgetState(WidgetState.Hidden);\n }\n }, [widgetDef, hasData]);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n\n }, []);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />\n </ResizableContainerObserver>\n );\n else\n return (<></>);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerDroppable.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAyI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO7L,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,wBAAwB,CAAC;AAIhC,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,EAAE,MAAM,WAAW,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtF,6BAA6B,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