@itwin/map-layers 3.1.0-dev.8 → 3.2.0-dev.12

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 (145) hide show
  1. package/CHANGELOG.md +45 -4
  2. package/lib/cjs/MapLayerPreferences.d.ts +8 -8
  3. package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
  4. package/lib/cjs/MapLayerPreferences.js +13 -13
  5. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  6. package/lib/cjs/map-layers.d.ts +2 -0
  7. package/lib/cjs/map-layers.d.ts.map +1 -1
  8. package/lib/cjs/map-layers.js +2 -0
  9. package/lib/cjs/map-layers.js.map +1 -1
  10. package/lib/cjs/mapLayers.d.ts +15 -17
  11. package/lib/cjs/mapLayers.d.ts.map +1 -1
  12. package/lib/cjs/mapLayers.js +25 -35
  13. package/lib/cjs/mapLayers.js.map +1 -1
  14. package/lib/cjs/public/locales/en/mapLayers.json +4 -0
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +11 -0
  16. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -0
  17. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +51 -0
  18. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -0
  19. package/lib/cjs/ui/Interfaces.d.ts +19 -3
  20. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  21. package/lib/cjs/ui/Interfaces.js.map +1 -1
  22. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +14 -0
  23. package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -0
  24. package/lib/cjs/ui/MapFeatureInfoTool.js +51 -0
  25. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -0
  26. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +4 -18
  27. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  28. package/lib/cjs/ui/MapLayersUiItemsProvider.js +13 -29
  29. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  30. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  31. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +72 -48
  32. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  34. package/lib/cjs/ui/widget/BasemapPanel.js +13 -13
  35. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  36. package/lib/cjs/ui/widget/BasemapPanel.scss +5 -1
  37. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +41 -0
  38. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -0
  39. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +140 -0
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -0
  41. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +8 -0
  42. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -0
  43. package/lib/cjs/ui/widget/FeatureInfoWidget.js +72 -0
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -0
  45. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  46. package/lib/cjs/ui/widget/MapLayerDroppable.js +14 -11
  47. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  48. package/lib/cjs/ui/widget/MapLayerManager.d.ts +2 -2
  49. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  50. package/lib/cjs/ui/widget/MapLayerManager.js +25 -23
  51. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  53. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +5 -5
  54. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  56. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  57. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  58. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapLayersWidget.js +2 -2
  60. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapManagerSettings.js +16 -16
  62. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  63. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +3 -3
  64. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  65. package/lib/cjs/ui/widget/MapUrlDialog.js +54 -45
  66. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  67. package/lib/cjs/ui/widget/SubLayersPopupButton.js +3 -3
  68. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  69. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  70. package/lib/cjs/ui/widget/SubLayersTree.js +26 -20
  71. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  72. package/lib/cjs/ui/widget/SubLayersTree.scss +3 -0
  73. package/lib/esm/MapLayerPreferences.d.ts +8 -8
  74. package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
  75. package/lib/esm/MapLayerPreferences.js +13 -13
  76. package/lib/esm/MapLayerPreferences.js.map +1 -1
  77. package/lib/esm/map-layers.d.ts +2 -0
  78. package/lib/esm/map-layers.d.ts.map +1 -1
  79. package/lib/esm/map-layers.js +2 -0
  80. package/lib/esm/map-layers.js.map +1 -1
  81. package/lib/esm/mapLayers.d.ts +15 -17
  82. package/lib/esm/mapLayers.d.ts.map +1 -1
  83. package/lib/esm/mapLayers.js +25 -35
  84. package/lib/esm/mapLayers.js.map +1 -1
  85. package/lib/esm/public/locales/en/mapLayers.json +4 -0
  86. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +11 -0
  87. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -0
  88. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +47 -0
  89. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -0
  90. package/lib/esm/ui/Interfaces.d.ts +19 -3
  91. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  92. package/lib/esm/ui/Interfaces.js.map +1 -1
  93. package/lib/esm/ui/MapFeatureInfoTool.d.ts +14 -0
  94. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -0
  95. package/lib/esm/ui/MapFeatureInfoTool.js +46 -0
  96. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -0
  97. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +4 -18
  98. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  99. package/lib/esm/ui/MapLayersUiItemsProvider.js +14 -29
  100. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  101. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  102. package/lib/esm/ui/widget/AttachLayerPopupButton.js +72 -48
  103. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  104. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  105. package/lib/esm/ui/widget/BasemapPanel.js +14 -14
  106. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  107. package/lib/esm/ui/widget/BasemapPanel.scss +5 -1
  108. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +41 -0
  109. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -0
  110. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +136 -0
  111. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -0
  112. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +8 -0
  113. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -0
  114. package/lib/esm/ui/widget/FeatureInfoWidget.js +68 -0
  115. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -0
  116. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  117. package/lib/esm/ui/widget/MapLayerDroppable.js +14 -11
  118. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  119. package/lib/esm/ui/widget/MapLayerManager.d.ts +2 -2
  120. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  121. package/lib/esm/ui/widget/MapLayerManager.js +25 -23
  122. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  123. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  124. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +5 -5
  125. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  126. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  127. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  128. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  129. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  130. package/lib/esm/ui/widget/MapLayersWidget.js +2 -2
  131. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  132. package/lib/esm/ui/widget/MapManagerSettings.js +16 -16
  133. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  134. package/lib/esm/ui/widget/MapUrlDialog.d.ts +3 -3
  135. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  136. package/lib/esm/ui/widget/MapUrlDialog.js +54 -45
  137. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  138. package/lib/esm/ui/widget/SubLayersPopupButton.js +3 -3
  139. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  140. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  141. package/lib/esm/ui/widget/SubLayersTree.js +26 -20
  142. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  143. package/lib/esm/ui/widget/SubLayersTree.scss +3 -0
  144. package/lib/public/locales/en/mapLayers.json +4 -0
  145. package/package.json +31 -31
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.FeatureInfoUiItemsProvider = void 0;
8
+ const React = require("react");
9
+ const appui_abstract_1 = require("@itwin/appui-abstract");
10
+ const appui_react_1 = require("@itwin/appui-react");
11
+ const FeatureInfoWidget_1 = require("./widget/FeatureInfoWidget");
12
+ const mapLayers_1 = require("../mapLayers");
13
+ const MapFeatureInfoTool_1 = require("./MapFeatureInfoTool");
14
+ class FeatureInfoUiItemsProvider {
15
+ constructor(_featureInfoOpts) {
16
+ this._featureInfoOpts = _featureInfoOpts;
17
+ this.id = "FeatureInfoUiItemsProvider";
18
+ }
19
+ provideToolbarButtonItems(_stageId, stageUsage, toolbarUsage, toolbarOrientation) {
20
+ var _a;
21
+ if (!((_a = this._featureInfoOpts) === null || _a === void 0 ? void 0 : _a.disableDefaultFeatureInfoTool) &&
22
+ stageUsage === appui_abstract_1.StageUsage.General &&
23
+ toolbarUsage === appui_abstract_1.ToolbarUsage.ContentManipulation &&
24
+ toolbarOrientation === appui_abstract_1.ToolbarOrientation.Vertical) {
25
+ MapFeatureInfoTool_1.DefaultMapFeatureInfoTool.register(mapLayers_1.MapLayersUI.localizationNamespace);
26
+ return [
27
+ appui_react_1.ToolbarHelper.createToolbarItemFromItemDef(60, (0, MapFeatureInfoTool_1.getDefaultMapFeatureInfoToolItemDef)()),
28
+ ];
29
+ }
30
+ return [];
31
+ }
32
+ // eslint-disable-next-line deprecation/deprecation
33
+ provideWidgets(_stageId, stageUsage, location, section, zoneLocation) {
34
+ const widgets = [];
35
+ // eslint-disable-next-line deprecation/deprecation
36
+ if ((undefined === section && stageUsage === appui_abstract_1.StageUsage.General && zoneLocation === appui_abstract_1.AbstractZoneLocation.BottomRight) ||
37
+ (stageUsage === appui_abstract_1.StageUsage.General && location === appui_abstract_1.StagePanelLocation.Right && section === appui_abstract_1.StagePanelSection.End && "1" !== appui_react_1.UiFramework.uiVersion)) {
38
+ widgets.push({
39
+ id: FeatureInfoUiItemsProvider.widgetId,
40
+ label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
41
+ icon: "icon-map",
42
+ getWidgetContent: () => React.createElement(FeatureInfoWidget_1.MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
43
+ defaultState: appui_abstract_1.WidgetState.Closed,
44
+ });
45
+ }
46
+ return widgets;
47
+ }
48
+ }
49
+ exports.FeatureInfoUiItemsProvider = FeatureInfoUiItemsProvider;
50
+ FeatureInfoUiItemsProvider.widgetId = "map-layers:mapFeatureInfoWidget";
51
+ //# sourceMappingURL=FeatureInfoUiItemsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,0DAAwN;AACxN,oDAAgE;AAChE,kEAAkE;AAElE,4CAA2C;AAC3C,6DAAsG;AAEtG,MAAa,0BAA0B;IAIrC,YAA2B,gBAAuC;QAAvC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAHlD,OAAE,GAAG,4BAA4B,CAAC;IAGoB,CAAC;IAEhE,yBAAyB,CAC9B,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAsC;;QAEtC,IACE,CAAC,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,6BAA6B,CAAA;YACrD,UAAU,KAAK,2BAAU,CAAC,OAAO;YACjC,YAAY,KAAK,6BAAY,CAAC,mBAAmB;YACjD,kBAAkB,KAAK,mCAAkB,CAAC,QAAQ,EAClD;YACA,8CAAyB,CAAC,QAAQ,CAAC,uBAAW,CAAC,qBAAqB,CAAC,CAAC;YACtE,OAAO;gBACL,2BAAa,CAAC,4BAA4B,CAAC,EAAE,EAAE,IAAA,wDAAmC,GAAE,CAAC;aACtF,CAAC;SACH;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mDAAmD;IAC5C,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B,EAAE,YAAmC;QACxJ,MAAM,OAAO,GAA0B,EAAE,CAAC;QAE1C,mDAAmD;QACnD,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,YAAY,KAAK,qCAAoB,CAAC,WAAW,CAAC;YACnH,CAAC,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,mCAAkB,CAAC,KAAK,IAAI,OAAO,KAAK,kCAAiB,CAAC,GAAG,IAAI,GAAG,KAAK,yBAAW,CAAC,SAAS,CAAC,EAAE;YACpJ,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,wCAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACxF,YAAY,EAAE,4BAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AA5CH,gEA6CC;AA3CwB,mCAAQ,GAAG,iCAAiC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, AbstractZoneLocation, CommonToolbarItem, StagePanelLocation, StagePanelSection, StageUsage, ToolbarOrientation, ToolbarUsage, UiItemsProvider, WidgetState } from \"@itwin/appui-abstract\";\r\nimport { ToolbarHelper, UiFramework } from \"@itwin/appui-react\";\r\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\r\nimport { MapFeatureInfoOptions } from \"./Interfaces\";\r\nimport { MapLayersUI } from \"../mapLayers\";\r\nimport { DefaultMapFeatureInfoTool, getDefaultMapFeatureInfoToolItemDef } from \"./MapFeatureInfoTool\";\r\n\r\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\r\n public readonly id = \"FeatureInfoUiItemsProvider\";\r\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\r\n\r\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) { }\r\n\r\n public provideToolbarButtonItems(\r\n _stageId: string,\r\n stageUsage: string,\r\n toolbarUsage: ToolbarUsage,\r\n toolbarOrientation: ToolbarOrientation,\r\n ): CommonToolbarItem[] {\r\n if (\r\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\r\n stageUsage === StageUsage.General &&\r\n toolbarUsage === ToolbarUsage.ContentManipulation &&\r\n toolbarOrientation === ToolbarOrientation.Vertical\r\n ) {\r\n DefaultMapFeatureInfoTool.register(MapLayersUI.localizationNamespace);\r\n return [\r\n ToolbarHelper.createToolbarItemFromItemDef(60, getDefaultMapFeatureInfoToolItemDef()),\r\n ];\r\n }\r\n\r\n return [];\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps> {\r\n const widgets: AbstractWidgetProps[] = [];\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n if ((undefined === section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.BottomRight) ||\r\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.End && \"1\" !== UiFramework.uiVersion)) {\r\n widgets.push({\r\n id: FeatureInfoUiItemsProvider.widgetId,\r\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\r\n icon: \"icon-map\",\r\n getWidgetContent: () => <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />, // eslint-disable-line react/display-name\r\n defaultState: WidgetState.Closed,\r\n });\r\n }\r\n\r\n return widgets;\r\n }\r\n}\r\n"]}
@@ -1,10 +1,11 @@
1
+ import { BeEvent } from "@itwin/core-bentley";
1
2
  import { MapSubLayerProps } from "@itwin/core-common";
2
- import { MapLayerImageryProvider } from "@itwin/core-frontend";
3
+ import { HitDetail, MapLayerImageryProvider } from "@itwin/core-frontend";
3
4
  export interface StyleMapLayerSettings {
4
5
  /** Name */
5
6
  name: string;
6
- /** URL */
7
- url: string;
7
+ /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */
8
+ source: string;
8
9
  /** Controls visibility of layer */
9
10
  visible: boolean;
10
11
  /** 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. */
@@ -29,4 +30,19 @@ export interface MapLayerOptions {
29
30
  fetchPublicMapLayerSources?: boolean;
30
31
  mapTypeOptions?: MapTypesOptions;
31
32
  }
33
+ export interface MapFeatureInfoPropertyGridOptions {
34
+ isPropertySelectionEnabled?: boolean;
35
+ }
36
+ export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
37
+ export interface MapFeatureInfoOptions {
38
+ /**
39
+ * HitDetail Event whenever the map is clicked.
40
+ * Typically the HitDetail object is provided by ElementLocateManager.doLocate.
41
+ * Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.
42
+ */
43
+ onMapHit: MapHitEvent;
44
+ disableDefaultFeatureInfoTool?: boolean;
45
+ showLoadProgressAnimation?: boolean;
46
+ propertyGridOptions?: MapFeatureInfoPropertyGridOptions;
47
+ }
32
48
  //# sourceMappingURL=Interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,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;CACpC;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,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC"}
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,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,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,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,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;CACpC;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,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC;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;;;;OAIG;IACH,QAAQ,EAAE,WAAW,CAAC;IACtB,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { MapLayerImageryProvider } from \"@itwin/core-frontend\";\r\n\r\nexport interface StyleMapLayerSettings {\r\n /** Name */\r\n name: string;\r\n /** URL */\r\n url: string;\r\n /** Controls visibility of layer */\r\n visible: boolean;\r\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. */\r\n transparency: number;\r\n /** Transparent background */\r\n transparentBackground: boolean;\r\n /** set map as underlay or overlay */\r\n isOverlay: boolean;\r\n /** Available map sub-layer */\r\n subLayers?: MapSubLayerProps[];\r\n /** sub-layer panel displayed. */\r\n showSubLayers: boolean;\r\n /** Some format can publish only a single layer at a time (i.e WMTS) */\r\n provider?: MapLayerImageryProvider;\r\n}\r\n\r\nexport interface MapTypesOptions {\r\n readonly supportTileUrl: boolean;\r\n readonly supportWmsAuthentication: boolean;\r\n}\r\n\r\nexport interface MapLayerOptions {\r\n hideExternalMapLayers?: boolean;\r\n fetchPublicMapLayerSources?: boolean;\r\n mapTypeOptions?: MapTypesOptions;\r\n}\r\n"]}
1
+ {"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { HitDetail, MapLayerImageryProvider } from \"@itwin/core-frontend\";\r\n\r\nexport interface StyleMapLayerSettings {\r\n /** Name */\r\n name: string;\r\n /** source (i.URL for ImageMapLayerSettings or modelId for ModelMapLayerSettings) */\r\n source: string;\r\n /** Controls visibility of layer */\r\n visible: boolean;\r\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. */\r\n transparency: number;\r\n /** Transparent background */\r\n transparentBackground: boolean;\r\n /** set map as underlay or overlay */\r\n isOverlay: boolean;\r\n /** Available map sub-layer */\r\n subLayers?: MapSubLayerProps[];\r\n /** sub-layer panel displayed. */\r\n showSubLayers: boolean;\r\n /** Some format can publish only a single layer at a time (i.e WMTS) */\r\n provider?: MapLayerImageryProvider;\r\n}\r\n\r\nexport interface MapTypesOptions {\r\n readonly supportTileUrl: boolean;\r\n readonly supportWmsAuthentication: boolean;\r\n}\r\n\r\nexport interface MapLayerOptions {\r\n hideExternalMapLayers?: boolean;\r\n fetchPublicMapLayerSources?: boolean;\r\n mapTypeOptions?: MapTypesOptions;\r\n}\r\n\r\nexport interface MapFeatureInfoPropertyGridOptions {\r\n isPropertySelectionEnabled?: boolean;\r\n}\r\n\r\nexport type MapHitEvent = BeEvent<(hit: HitDetail) => void>;\r\n\r\nexport interface MapFeatureInfoOptions {\r\n /**\r\n * HitDetail Event whenever the map is clicked.\r\n * Typically the HitDetail object is provided by ElementLocateManager.doLocate.\r\n * Every time this event is raised, FeatureInfoWidget will attempt to retrieve data from MapLayerImageryProviders.\r\n */\r\n onMapHit: MapHitEvent;\r\n disableDefaultFeatureInfoTool?: boolean;\r\n showLoadProgressAnimation?: boolean;\r\n propertyGridOptions?: MapFeatureInfoPropertyGridOptions;\r\n}\r\n"]}
@@ -0,0 +1,14 @@
1
+ import { BeButtonEvent, EventHandled, HitDetail, PrimitiveTool } from "@itwin/core-frontend";
2
+ import { ToolItemDef } from "@itwin/appui-react";
3
+ import { BeEvent } from "@itwin/core-bentley";
4
+ export declare const getDefaultMapFeatureInfoToolItemDef: () => ToolItemDef;
5
+ export declare class DefaultMapFeatureInfoTool extends PrimitiveTool {
6
+ static readonly onMapHit: BeEvent<(hit: HitDetail) => void>;
7
+ static toolId: string;
8
+ static iconSpec: string;
9
+ requireWriteableTarget(): boolean;
10
+ onDataButtonDown(ev: BeButtonEvent): Promise<EventHandled>;
11
+ onResetButtonUp(_ev: BeButtonEvent): Promise<EventHandled>;
12
+ onRestartTool(): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=MapFeatureInfoTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapFeatureInfoTool.d.ts","sourceRoot":"","sources":["../../../src/ui/MapFeatureInfoTool.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,SAAS,EAGT,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAqB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,eAAO,MAAM,mCAAmC,QAAO,WAOnD,CAAC;AAEL,qBAAa,yBAA0B,SAAQ,aAAa;IAC1D,gBAAuB,QAAQ,gBAAqB,SAAS,KAAK,IAAI,EAAI;IAC1E,OAAuB,MAAM,SAAwB;IACrD,OAAuB,QAAQ,SAAc;IAE7B,sBAAsB,IAAI,OAAO;IAI3B,gBAAgB,CACpC,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,YAAY,CAAC;IAsBF,eAAe,CACnC,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,YAAY,CAAC;IAMX,aAAa;CAI3B"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DefaultMapFeatureInfoTool = exports.getDefaultMapFeatureInfoToolItemDef = void 0;
8
+ const core_frontend_1 = require("@itwin/core-frontend");
9
+ const appui_abstract_1 = require("@itwin/appui-abstract");
10
+ const appui_react_1 = require("@itwin/appui-react");
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const FeatureInfoUiItemsProvider_1 = require("./FeatureInfoUiItemsProvider");
13
+ const getDefaultMapFeatureInfoToolItemDef = () => new appui_react_1.ToolItemDef({
14
+ toolId: DefaultMapFeatureInfoTool.toolId,
15
+ iconSpec: DefaultMapFeatureInfoTool.iconSpec,
16
+ label: () => DefaultMapFeatureInfoTool.flyover,
17
+ description: () => DefaultMapFeatureInfoTool.description,
18
+ execute: async () => { await core_frontend_1.IModelApp.tools.run(DefaultMapFeatureInfoTool.toolId); },
19
+ });
20
+ exports.getDefaultMapFeatureInfoToolItemDef = getDefaultMapFeatureInfoToolItemDef;
21
+ class DefaultMapFeatureInfoTool extends core_frontend_1.PrimitiveTool {
22
+ requireWriteableTarget() {
23
+ return false;
24
+ }
25
+ async onDataButtonDown(ev) {
26
+ const hit = await core_frontend_1.IModelApp.locateManager.doLocate(new core_frontend_1.LocateResponse(), true, ev.point, ev.viewport, ev.inputSource);
27
+ if (hit !== undefined) {
28
+ const widgetDef = appui_react_1.FrontstageManager.findWidget(FeatureInfoUiItemsProvider_1.FeatureInfoUiItemsProvider.widgetId);
29
+ if (widgetDef && widgetDef.state !== appui_abstract_1.WidgetState.Open)
30
+ widgetDef.setWidgetState(appui_abstract_1.WidgetState.Open);
31
+ DefaultMapFeatureInfoTool.onMapHit.raiseEvent(hit);
32
+ return core_frontend_1.EventHandled.Yes;
33
+ }
34
+ return core_frontend_1.EventHandled.No;
35
+ }
36
+ async onResetButtonUp(_ev) {
37
+ /* Common reset behavior for primitive tools is calling onReinitialize to restart or exitTool to terminate. */
38
+ await this.onReinitialize();
39
+ return core_frontend_1.EventHandled.No;
40
+ }
41
+ async onRestartTool() {
42
+ const tool = new DefaultMapFeatureInfoTool();
43
+ if (!(await tool.run()))
44
+ return this.exitTool();
45
+ }
46
+ }
47
+ exports.DefaultMapFeatureInfoTool = DefaultMapFeatureInfoTool;
48
+ DefaultMapFeatureInfoTool.onMapHit = new core_bentley_1.BeEvent();
49
+ DefaultMapFeatureInfoTool.toolId = "MapFeatureInfoTool";
50
+ DefaultMapFeatureInfoTool.iconSpec = "icon-map";
51
+ //# sourceMappingURL=MapFeatureInfoTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapFeatureInfoTool.js","sourceRoot":"","sources":["../../../src/ui/MapFeatureInfoTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,wDAO8B;AAC9B,0DAAoD;AACpD,oDAAoE;AACpE,sDAA8C;AAC9C,6EAA0E;AAEnE,MAAM,mCAAmC,GAAG,GAAgB,EAAE,CACnE,IAAI,yBAAW,CAAC;IACd,MAAM,EAAE,yBAAyB,CAAC,MAAM;IACxC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;IAC5C,KAAK,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,OAAO;IAC9C,WAAW,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,WAAW;IACxD,OAAO,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,yBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACtF,CAAC,CAAC;AAPQ,QAAA,mCAAmC,uCAO3C;AAEL,MAAa,yBAA0B,SAAQ,6BAAa;IAK1C,sBAAsB;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAEe,KAAK,CAAC,gBAAgB,CACpC,EAAiB;QAEjB,MAAM,GAAG,GAAG,MAAM,yBAAS,CAAC,aAAa,CAAC,QAAQ,CAChD,IAAI,8BAAc,EAAE,EACpB,IAAI,EACJ,EAAE,CAAC,KAAK,EACR,EAAE,CAAC,QAAQ,EACX,EAAE,CAAC,WAAW,CACf,CAAC;QACF,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,MAAM,SAAS,GAAG,+BAAiB,CAAC,UAAU,CAC5C,uDAA0B,CAAC,QAAQ,CACpC,CAAC;YACF,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,4BAAW,CAAC,IAAI;gBACnD,SAAS,CAAC,cAAc,CAAC,4BAAW,CAAC,IAAI,CAAC,CAAC;YAE7C,yBAAyB,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACnD,OAAO,4BAAY,CAAC,GAAG,CAAC;SACzB;QAED,OAAO,4BAAY,CAAC,EAAE,CAAC;IACzB,CAAC;IAEe,KAAK,CAAC,eAAe,CACnC,GAAkB;QAElB,8GAA8G;QAC9G,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,OAAO,4BAAY,CAAC,EAAE,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,aAAa;QACxB,MAAM,IAAI,GAAG,IAAI,yBAAyB,EAAE,CAAC;QAC7C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClD,CAAC;;AA5CH,8DA6CC;AA5CwB,kCAAQ,GAAG,IAAI,sBAAO,EAA4B,CAAC;AACnD,gCAAM,GAAG,oBAAoB,CAAC;AAC9B,kCAAQ,GAAG,UAAU,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport {\r\n BeButtonEvent,\r\n EventHandled,\r\n HitDetail,\r\n IModelApp,\r\n LocateResponse,\r\n PrimitiveTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { WidgetState } from \"@itwin/appui-abstract\";\r\nimport { FrontstageManager, ToolItemDef } from \"@itwin/appui-react\";\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureInfoUiItemsProvider } from \"./FeatureInfoUiItemsProvider\";\r\n\r\nexport const getDefaultMapFeatureInfoToolItemDef = (): ToolItemDef =>\r\n new ToolItemDef({\r\n toolId: DefaultMapFeatureInfoTool.toolId,\r\n iconSpec: DefaultMapFeatureInfoTool.iconSpec,\r\n label: () => DefaultMapFeatureInfoTool.flyover,\r\n description: () => DefaultMapFeatureInfoTool.description,\r\n execute: async () => { await IModelApp.tools.run(DefaultMapFeatureInfoTool.toolId); },\r\n });\r\n\r\nexport class DefaultMapFeatureInfoTool extends PrimitiveTool {\r\n public static readonly onMapHit = new BeEvent<(hit: HitDetail) => void>();\r\n public static override toolId = \"MapFeatureInfoTool\";\r\n public static override iconSpec = \"icon-map\";\r\n\r\n public override requireWriteableTarget(): boolean {\r\n return false;\r\n }\r\n\r\n public override async onDataButtonDown(\r\n ev: BeButtonEvent\r\n ): Promise<EventHandled> {\r\n const hit = await IModelApp.locateManager.doLocate(\r\n new LocateResponse(),\r\n true,\r\n ev.point,\r\n ev.viewport,\r\n ev.inputSource\r\n );\r\n if (hit !== undefined) {\r\n const widgetDef = FrontstageManager.findWidget(\r\n FeatureInfoUiItemsProvider.widgetId\r\n );\r\n if (widgetDef && widgetDef.state !== WidgetState.Open)\r\n widgetDef.setWidgetState(WidgetState.Open);\r\n\r\n DefaultMapFeatureInfoTool.onMapHit.raiseEvent(hit);\r\n return EventHandled.Yes;\r\n }\r\n\r\n return EventHandled.No;\r\n }\r\n\r\n public override async onResetButtonUp(\r\n _ev: BeButtonEvent\r\n ): Promise<EventHandled> {\r\n /* Common reset behavior for primitive tools is calling onReinitialize to restart or exitTool to terminate. */\r\n await this.onReinitialize();\r\n return EventHandled.No;\r\n }\r\n\r\n public async onRestartTool() {\r\n const tool = new DefaultMapFeatureInfoTool();\r\n if (!(await tool.run())) return this.exitTool();\r\n }\r\n}\r\n"]}
@@ -1,23 +1,9 @@
1
- import { AbstractWidgetProps, StagePanelLocation, StagePanelSection, UiItemsProvider } from "@itwin/appui-abstract";
2
- import { Localization } from "@itwin/core-common";
3
- import { ConfigurableCreateInfo, WidgetControl } from "@itwin/appui-react";
1
+ import { AbstractWidgetProps, AbstractZoneLocation, StagePanelLocation, StagePanelSection, UiItemsProvider } from "@itwin/appui-abstract";
4
2
  import { MapLayerOptions } from "./Interfaces";
5
3
  export declare class MapLayersUiItemsProvider implements UiItemsProvider {
6
4
  readonly id = "MapLayersUiItemsProvider";
7
- static localization: Localization;
8
- constructor(localization: Localization);
9
- provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined): ReadonlyArray<AbstractWidgetProps>;
10
- }
11
- /** MapLayersWidgetControl provides a widget to attach and remove maps layers from the active view's display style.
12
- * ``` tsx
13
- * <Widget id={MapLayersWidgetControl.id} label={MapLayersWidgetControl.label} control={MapLayersWidgetControl}
14
- * iconSpec={MapLayersWidgetControl.iconSpec} />,
15
- * ```
16
- */
17
- export declare class MapLayersWidgetControl extends WidgetControl {
18
- static id: string;
19
- static iconSpec: string;
20
- static get label(): string;
21
- constructor(info: ConfigurableCreateInfo, mapLayerOptions: MapLayerOptions | undefined);
5
+ private _mapLayerOptions?;
6
+ constructor(mapLayerOptions?: MapLayerOptions);
7
+ provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps>;
22
8
  }
23
9
  //# sourceMappingURL=MapLayersUiItemsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayersUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAc,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,qBAAa,wBAAyB,YAAW,eAAe;IAC9D,SAAgB,EAAE,8BAA8B;IAChD,OAAc,YAAY,EAAE,YAAY,CAAC;gBAEtB,YAAY,EAAE,YAAY;IAItC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC,mBAAmB,CAAC;CAmBtK;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,OAAc,EAAE,SAAqB;IACrC,OAAc,QAAQ,SAAc;IAEpC,WAAkB,KAAK,IAAI,MAAM,CAEhC;gBAEW,IAAI,EAAE,sBAAsB,EAAE,eAAe,EAAE,eAAe,GAAG,SAAS;CAKvF"}
1
+ {"version":3,"file":"MapLayersUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAc,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGtJ,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,qBAAa,wBAAyB,YAAW,eAAe;IAC9D,SAAgB,EAAE,8BAA8B;IAChD,OAAO,CAAC,gBAAgB,CAAC,CAAkB;gBAExB,eAAe,CAAC,EAAE,eAAe;IAS7C,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,EAAE,YAAY,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC,mBAAmB,CAAC;CAgB3M"}
@@ -4,52 +4,36 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MapLayersWidgetControl = exports.MapLayersUiItemsProvider = void 0;
7
+ exports.MapLayersUiItemsProvider = void 0;
8
8
  const React = require("react");
9
9
  const appui_abstract_1 = require("@itwin/appui-abstract");
10
10
  const MapLayersWidget_1 = require("./widget/MapLayersWidget");
11
11
  const appui_react_1 = require("@itwin/appui-react");
12
- const core_frontend_1 = require("@itwin/core-frontend");
12
+ const mapLayers_1 = require("../mapLayers");
13
13
  class MapLayersUiItemsProvider {
14
- constructor(localization) {
14
+ constructor(mapLayerOptions) {
15
15
  this.id = "MapLayersUiItemsProvider";
16
- MapLayersUiItemsProvider.localization = localization;
17
- }
18
- provideWidgets(_stageId, stageUsage, location, section) {
19
- const widgets = [];
20
- const mapLayerOptions = {
16
+ this._mapLayerOptions = mapLayerOptions !== null && mapLayerOptions !== void 0 ? mapLayerOptions : {
21
17
  hideExternalMapLayers: false,
22
18
  mapTypeOptions: { supportTileUrl: false, supportWmsAuthentication: true },
23
19
  fetchPublicMapLayerSources: false,
24
20
  };
25
- if (stageUsage === appui_abstract_1.StageUsage.General && location === appui_abstract_1.StagePanelLocation.Right && section === appui_abstract_1.StagePanelSection.Start) {
21
+ }
22
+ // eslint-disable-next-line deprecation/deprecation
23
+ provideWidgets(_stageId, stageUsage, location, section, zoneLocation) {
24
+ const widgets = [];
25
+ // eslint-disable-next-line deprecation/deprecation
26
+ if ((undefined === section && stageUsage === appui_abstract_1.StageUsage.General && zoneLocation === appui_abstract_1.AbstractZoneLocation.CenterRight) ||
27
+ (stageUsage === appui_abstract_1.StageUsage.General && location === appui_abstract_1.StagePanelLocation.Right && section === appui_abstract_1.StagePanelSection.Start && "1" !== appui_react_1.UiFramework.uiVersion)) {
26
28
  widgets.push({
27
29
  id: "map-layers:mapLayersWidget",
28
- label: core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Widget.Label"),
30
+ label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.Label"),
29
31
  icon: "icon-map",
30
- getWidgetContent: () => React.createElement(MapLayersWidget_1.MapLayersWidget, { mapLayerOptions: mapLayerOptions }), // eslint-disable-line react/display-name
32
+ getWidgetContent: () => React.createElement(MapLayersWidget_1.MapLayersWidget, { mapLayerOptions: this._mapLayerOptions }), // eslint-disable-line react/display-name
31
33
  });
32
34
  }
33
35
  return widgets;
34
36
  }
35
37
  }
36
38
  exports.MapLayersUiItemsProvider = MapLayersUiItemsProvider;
37
- /** MapLayersWidgetControl provides a widget to attach and remove maps layers from the active view's display style.
38
- * ``` tsx
39
- * <Widget id={MapLayersWidgetControl.id} label={MapLayersWidgetControl.label} control={MapLayersWidgetControl}
40
- * iconSpec={MapLayersWidgetControl.iconSpec} />,
41
- * ```
42
- */
43
- class MapLayersWidgetControl extends appui_react_1.WidgetControl {
44
- constructor(info, mapLayerOptions) {
45
- super(info, mapLayerOptions);
46
- this.reactNode = React.createElement(MapLayersWidget_1.MapLayersWidget, { mapLayerOptions: mapLayerOptions });
47
- }
48
- static get label() {
49
- return core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Widget.Label");
50
- }
51
- }
52
- exports.MapLayersWidgetControl = MapLayersWidgetControl;
53
- MapLayersWidgetControl.id = "MapLayersWidget";
54
- MapLayersWidgetControl.iconSpec = "icon-map";
55
39
  //# sourceMappingURL=MapLayersUiItemsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayersUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,0DAAgI;AAEhI,8DAA2D;AAC3D,oDAA2E;AAC3E,wDAAiD;AAGjD,MAAa,wBAAwB;IAInC,YAAmB,YAA0B;QAH7B,OAAE,GAAG,0BAA0B,CAAC;QAI9C,wBAAwB,CAAC,YAAY,GAAG,YAAY,CAAC;IACvD,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAAsC;QAC9H,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C,MAAM,eAAe,GAAoB;YACvC,qBAAqB,EAAE,KAAK;YAC5B,cAAc,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE;YACzE,0BAA0B,EAAE,KAAK;SAClC,CAAC;QAEF,IAAI,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,mCAAkB,CAAC,KAAK,IAAI,OAAO,KAAK,kCAAiB,CAAC,KAAK,EAAE;YACrH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE,yBAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;gBAC1E,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,iCAAe,IAAC,eAAe,EAAE,eAAe,GAAI,EAAE,yCAAyC;aACzH,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA3BD,4DA2BC;AAED;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,2BAAa;IAQvD,YAAY,IAA4B,EAAE,eAA4C;QACpF,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAE7B,IAAI,CAAC,SAAS,GAAG,oBAAC,iCAAe,IAAC,eAAe,EAAE,eAAe,GAAI,CAAC;IACzE,CAAC;IARM,MAAM,KAAK,KAAK;QACrB,OAAO,yBAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;IAC7E,CAAC;;AANH,wDAaC;AAZe,yBAAE,GAAG,iBAAiB,CAAC;AACvB,+BAAQ,GAAG,UAAU,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, StagePanelLocation, StagePanelSection, StageUsage, UiItemsProvider } from \"@itwin/appui-abstract\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { MapLayersWidget } from \"./widget/MapLayersWidget\";\r\nimport { ConfigurableCreateInfo, WidgetControl } from \"@itwin/appui-react\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { MapLayerOptions } from \"./Interfaces\";\r\n\r\nexport class MapLayersUiItemsProvider implements UiItemsProvider {\r\n public readonly id = \"MapLayersUiItemsProvider\";\r\n public static localization: Localization;\r\n\r\n public constructor(localization: Localization) {\r\n MapLayersUiItemsProvider.localization = localization;\r\n }\r\n\r\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined): ReadonlyArray<AbstractWidgetProps> {\r\n const widgets: AbstractWidgetProps[] = [];\r\n const mapLayerOptions: MapLayerOptions = {\r\n hideExternalMapLayers: false,\r\n mapTypeOptions: { supportTileUrl: false, supportWmsAuthentication: true },\r\n fetchPublicMapLayerSources: false,\r\n };\r\n\r\n if (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.Start) {\r\n widgets.push({\r\n id: \"map-layers:mapLayersWidget\",\r\n label: IModelApp.localization.getLocalizedString(\"mapLayers:Widget.Label\"),\r\n icon: \"icon-map\",\r\n getWidgetContent: () => <MapLayersWidget mapLayerOptions={mapLayerOptions} />, // eslint-disable-line react/display-name\r\n });\r\n }\r\n\r\n return widgets;\r\n }\r\n}\r\n\r\n/** MapLayersWidgetControl provides a widget to attach and remove maps layers from the active view's display style.\r\n * ``` tsx\r\n * <Widget id={MapLayersWidgetControl.id} label={MapLayersWidgetControl.label} control={MapLayersWidgetControl}\r\n * iconSpec={MapLayersWidgetControl.iconSpec} />,\r\n * ```\r\n */\r\nexport class MapLayersWidgetControl extends WidgetControl {\r\n public static id = \"MapLayersWidget\";\r\n public static iconSpec = \"icon-map\";\r\n\r\n public static get label(): string {\r\n return IModelApp.localization.getLocalizedString(\"mapLayers:Widget.Label\");\r\n }\r\n\r\n constructor(info: ConfigurableCreateInfo, mapLayerOptions: MapLayerOptions | undefined) {\r\n super(info, mapLayerOptions);\r\n\r\n this.reactNode = <MapLayersWidget mapLayerOptions={mapLayerOptions} />;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MapLayersUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,0DAAsJ;AACtJ,8DAA2D;AAC3D,oDAAiD;AAEjD,4CAA2C;AAE3C,MAAa,wBAAwB;IAInC,YAAmB,eAAiC;QAHpC,OAAE,GAAG,0BAA0B,CAAC;QAI9C,IAAI,CAAC,gBAAgB,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI;YACzC,qBAAqB,EAAE,KAAK;YAC5B,cAAc,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE;YACzE,0BAA0B,EAAE,KAAK;SAClC,CAAC;IACJ,CAAC;IAED,mDAAmD;IAC5C,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAAsC,EAAE,YAAmC;QACnK,MAAM,OAAO,GAA0B,EAAE,CAAC;QAE1C,mDAAmD;QACnD,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,YAAY,KAAK,qCAAoB,CAAC,WAAW,CAAC;YACnH,CAAC,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,mCAAkB,CAAC,KAAK,IAAI,OAAO,KAAK,kCAAiB,CAAC,KAAK,IAAI,GAAG,KAAK,yBAAW,CAAC,SAAS,CAAC,EAAE;YACtJ,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;gBAC5E,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,iCAAe,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI,EAAE,yCAAyC;aAC/H,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7BD,4DA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, AbstractZoneLocation, StagePanelLocation, StagePanelSection, StageUsage, UiItemsProvider } from \"@itwin/appui-abstract\";\r\nimport { MapLayersWidget } from \"./widget/MapLayersWidget\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { MapLayerOptions } from \"./Interfaces\";\r\nimport { MapLayersUI } from \"../mapLayers\";\r\n\r\nexport class MapLayersUiItemsProvider implements UiItemsProvider {\r\n public readonly id = \"MapLayersUiItemsProvider\";\r\n private _mapLayerOptions?: MapLayerOptions;\r\n\r\n public constructor(mapLayerOptions?: MapLayerOptions) {\r\n this._mapLayerOptions = mapLayerOptions ?? {\r\n hideExternalMapLayers: false,\r\n mapTypeOptions: { supportTileUrl: false, supportWmsAuthentication: true },\r\n fetchPublicMapLayerSources: false,\r\n };\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section: StagePanelSection | undefined, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps> {\r\n const widgets: AbstractWidgetProps[] = [];\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n if ((undefined === section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||\r\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && section === StagePanelSection.Start && \"1\" !== UiFramework.uiVersion)) {\r\n widgets.push({\r\n id: \"map-layers:mapLayersWidget\",\r\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.Label\"),\r\n icon: \"icon-map\",\r\n getWidgetContent: () => <MapLayersWidget mapLayerOptions={this._mapLayerOptions} />, // eslint-disable-line react/display-name\r\n });\r\n }\r\n\r\n return widgets;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA0TA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAqHxE"}
1
+ {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AAsWA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAiHxE"}
@@ -12,24 +12,39 @@ const UiCore = require("@itwin/core-react");
12
12
  const appui_react_1 = require("@itwin/appui-react");
13
13
  const MapLayerManager_1 = require("./MapLayerManager");
14
14
  const MapUrlDialog_1 = require("./MapUrlDialog");
15
- const MapLayersUiItemsProvider_1 = require("../MapLayersUiItemsProvider");
16
15
  const ConfirmMessageDialog_1 = require("./ConfirmMessageDialog");
17
16
  const itwinui_react_1 = require("@itwin/itwinui-react");
18
17
  const MapLayerPreferences_1 = require("../../MapLayerPreferences");
18
+ const mapLayers_1 = require("../../mapLayers");
19
+ // cSpell:ignore droppable Sublayer
20
+ var LayerAction;
21
+ (function (LayerAction) {
22
+ LayerAction[LayerAction["Attached"] = 0] = "Attached";
23
+ LayerAction[LayerAction["Edited"] = 1] = "Edited";
24
+ })(LayerAction || (LayerAction = {}));
19
25
  // eslint-disable-next-line @typescript-eslint/naming-convention
20
- function AttachLayerPanel({ isOverlay, onLayerAttached }) {
26
+ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }) {
21
27
  var _a, _b;
22
28
  const [layerNameToAdd, setLayerNameToAdd] = React.useState();
23
29
  const [sourceFilterString, setSourceFilterString] = React.useState();
24
- const [placeholderLabel] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.SearchPlaceholder"));
25
- const [addCustomLayerLabel] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.Custom"));
26
- const [addCustomLayerToolTip] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.AttachCustomLayer"));
27
- const [loadingMapSources] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.LoadingMapSources"));
28
- const [removeLayerDefButtonTitle] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefButtonTitle"));
29
- const [editLayerDefButtonTitle] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.EditLayerDefButtonTitle"));
30
- const [removeLayerDefDialogTitle] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogTitle"));
30
+ const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {
31
+ return {
32
+ placeholderLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.SearchPlaceholder"),
33
+ addCustomLayerLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.Custom"),
34
+ addCustomLayerToolTip: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.AttachCustomLayer"),
35
+ loadingMapSources: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.LoadingMapSources"),
36
+ removeLayerDefButtonTitle: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefButtonTitle"),
37
+ editLayerDefButtonTitle: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.EditLayerDefButtonTitle"),
38
+ removeLayerDefDialogTitle: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogTitle"),
39
+ };
40
+ }, []);
31
41
  const [loading, setLoading] = React.useState(false);
32
42
  const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState();
43
+ const resumeOutsideClick = React.useCallback(() => {
44
+ if (onHandleOutsideClick) {
45
+ onHandleOutsideClick(true);
46
+ }
47
+ }, [onHandleOutsideClick]);
33
48
  // 'isMounted' is used to prevent any async operation once the hook has been
34
49
  // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.
35
50
  const isMounted = React.useRef(false);
@@ -59,15 +74,19 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
59
74
  }
60
75
  return false;
61
76
  }, [backgroundLayers, overlayLayers]);
62
- const handleModalUrlDialogOk = React.useCallback(() => {
63
- // close popup and refresh UI
64
- onLayerAttached();
65
- }, [onLayerAttached]);
77
+ const handleModalUrlDialogOk = React.useCallback((action) => {
78
+ if (LayerAction.Attached === action) {
79
+ // close popup and refresh UI
80
+ onLayerAttached();
81
+ }
82
+ resumeOutsideClick();
83
+ }, [onLayerAttached, resumeOutsideClick]);
66
84
  const handleModalUrlDialogCancel = React.useCallback(() => {
67
85
  // close popup and refresh UI
68
86
  setLoading(false);
69
87
  appui_react_1.ModalDialogManager.closeDialog();
70
- }, []);
88
+ resumeOutsideClick();
89
+ }, [resumeOutsideClick]);
71
90
  React.useEffect(() => {
72
91
  async function attemptToAddLayer(layerName) {
73
92
  if (layerName && activeViewport) {
@@ -99,7 +118,10 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
99
118
  }
100
119
  }
101
120
  else if (status === core_frontend_1.MapLayerSourceStatus.RequireAuth && isMounted.current) {
102
- appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, layerRequiringCredentials: mapLayerSettings.toJSON(), onOkResult: handleModalUrlDialogOk, onCancelResult: handleModalUrlDialogCancel, mapTypesOptions: mapTypesOptions }));
121
+ appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, layerRequiringCredentials: mapLayerSettings.toJSON(), onOkResult: () => handleModalUrlDialogOk(LayerAction.Attached), onCancelResult: handleModalUrlDialogCancel, mapTypesOptions: mapTypesOptions }));
122
+ if (onHandleOutsideClick) {
123
+ onHandleOutsideClick(false);
124
+ }
103
125
  }
104
126
  }
105
127
  else {
@@ -127,7 +149,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
127
149
  setLayerNameToAdd(undefined);
128
150
  }
129
151
  }
130
- }, [setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, mapTypesOptions, handleModalUrlDialogCancel]);
152
+ }, [setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, mapTypesOptions, handleModalUrlDialogCancel, onHandleOutsideClick]);
131
153
  const options = React.useMemo(() => sources === null || sources === void 0 ? void 0 : sources.filter((source) => !styleContainsLayer(source.name)), [sources, styleContainsLayer]);
132
154
  const filteredOptions = React.useMemo(() => {
133
155
  if (undefined === sourceFilterString || 0 === sourceFilterString.length) {
@@ -138,9 +160,12 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
138
160
  }
139
161
  }, [options, sourceFilterString]);
140
162
  const handleAddNewMapSource = React.useCallback(() => {
141
- appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: handleModalUrlDialogOk, mapTypesOptions: mapTypesOptions }));
163
+ appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: () => handleModalUrlDialogOk(LayerAction.Attached), onCancelResult: handleModalUrlDialogCancel, mapTypesOptions: mapTypesOptions }));
164
+ if (onHandleOutsideClick) {
165
+ onHandleOutsideClick(false);
166
+ }
142
167
  return;
143
- }, [activeViewport, handleModalUrlDialogOk, isOverlay, mapTypesOptions]);
168
+ }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);
144
169
  const handleAttach = React.useCallback((mapName) => {
145
170
  setLayerNameToAdd(mapName);
146
171
  }, []);
@@ -160,31 +185,36 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
160
185
  }, []);
161
186
  const handleNoConfirmation = React.useCallback((_layerName) => {
162
187
  appui_react_1.ModalDialogManager.closeDialog();
163
- }, []);
188
+ resumeOutsideClick();
189
+ }, [resumeOutsideClick]);
164
190
  const handleYesConfirmation = React.useCallback(async (source) => {
165
191
  const layerName = source.name;
166
192
  if (!!iTwinId && !!iModelId) {
167
193
  try {
168
194
  await MapLayerPreferences_1.MapLayerPreferences.deleteByName(source, iTwinId, iModelId);
169
- const msg = MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefSuccess", { layerName });
195
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefSuccess", { layerName });
170
196
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Info, msg));
171
197
  }
172
198
  catch (err) {
173
- const msg = MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefError", { layerName });
199
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefError", { layerName });
174
200
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msg));
175
201
  }
176
202
  }
177
203
  appui_react_1.ModalDialogManager.closeDialog();
178
- }, [iTwinId, iModelId]);
204
+ resumeOutsideClick();
205
+ }, [iTwinId, iModelId, resumeOutsideClick]);
179
206
  /*
180
207
  Handle Remove layer button clicked
181
208
  */
182
209
  const onItemRemoveButtonClicked = React.useCallback((source, event) => {
183
210
  event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.
184
211
  const layerName = source.name;
185
- const msg = MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogMessage", { layerName });
212
+ const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogMessage", { layerName });
186
213
  appui_react_1.ModalDialogManager.openDialog(React.createElement(ConfirmMessageDialog_1.ConfirmMessageDialog, { className: "map-sources-delete-confirmation", title: removeLayerDefDialogTitle, message: msg, maxWidth: 400, onClose: () => handleNoConfirmation(layerName), onEscape: () => handleNoConfirmation(layerName), onYesResult: async () => handleYesConfirmation(source), onNoResult: () => handleNoConfirmation(layerName) }));
187
- }, [handleNoConfirmation, handleYesConfirmation, removeLayerDefDialogTitle]);
214
+ if (onHandleOutsideClick) {
215
+ onHandleOutsideClick(false);
216
+ }
217
+ }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);
188
218
  /*
189
219
  Handle Edit layer button clicked
190
220
  */
@@ -197,8 +227,11 @@ function AttachLayerPanel({ isOverlay, onLayerAttached }) {
197
227
  if (matchingSource === undefined) {
198
228
  return;
199
229
  }
200
- appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: handleModalUrlDialogOk, mapTypesOptions: mapTypesOptions }));
201
- }, [activeViewport, handleModalUrlDialogOk, isOverlay, mapTypesOptions, sources]);
230
+ appui_react_1.ModalDialogManager.openDialog(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: () => handleModalUrlDialogOk(LayerAction.Edited), onCancelResult: handleModalUrlDialogCancel, mapTypesOptions: mapTypesOptions }));
231
+ if (onHandleOutsideClick) {
232
+ onHandleOutsideClick(false);
233
+ }
234
+ }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);
202
235
  return (React.createElement("div", { className: "map-manager-header" },
203
236
  (loading || loadingSources) && React.createElement(UiCore.LoadingSpinner, { message: loadingMapSources }),
204
237
  React.createElement("div", { className: "map-manager-source-listbox-header" },
@@ -225,9 +258,14 @@ var AttachLayerButtonType;
225
258
  /** @internal */
226
259
  // eslint-disable-next-line @typescript-eslint/naming-convention
227
260
  function AttachLayerPopupButton(props) {
228
- const [showAttachLayerLabel] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:AttachLayerPopup.Attach"));
229
- const [hideAttachLayerLabel] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:AttachLayerPopup.Close"));
230
- const [addCustomLayerButtonLabel] = React.useState(MapLayersUiItemsProvider_1.MapLayersUiItemsProvider.localization.getLocalizedString("mapLayers:CustomAttach.AddCustomLayerButtonLabel"));
261
+ const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {
262
+ return {
263
+ showAttachLayerLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:AttachLayerPopup.Attach"),
264
+ hideAttachLayerLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:AttachLayerPopup.Close"),
265
+ addCustomLayerButtonLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.AddCustomLayerButtonLabel"),
266
+ };
267
+ }, []);
268
+ const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);
231
269
  const [popupOpen, setPopupOpen] = React.useState(false);
232
270
  const buttonRef = React.useRef(null);
233
271
  const panelRef = React.useRef(null);
@@ -246,22 +284,8 @@ function AttachLayerPopupButton(props) {
246
284
  const handleClosePopup = React.useCallback(() => {
247
285
  setPopupOpen(false);
248
286
  }, []);
249
- const isInsideCoreDialog = React.useCallback((element) => {
250
- if (element.nodeName === "DIV") {
251
- if (element.classList && element.classList.contains("core-dialog"))
252
- return true;
253
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
254
- return true;
255
- }
256
- else {
257
- // istanbul ignore else
258
- if (element.parentElement && isInsideCoreDialog(element.parentElement))
259
- return true;
260
- }
261
- return false;
262
- }, []);
263
- const handleOutsideClick = React.useCallback((event) => {
264
- if (isInsideCoreDialog(event.target)) {
287
+ const onHandleOutsideClick = React.useCallback((event) => {
288
+ if (!handleOutsideClick) {
265
289
  return;
266
290
  }
267
291
  // If clicking on button that open panel - don't trigger outside click processing
@@ -274,7 +298,7 @@ function AttachLayerPopupButton(props) {
274
298
  }
275
299
  // If we reach this point, we got an outside clicked, no close the popup
276
300
  setPopupOpen(false);
277
- }, [isInsideCoreDialog]);
301
+ }, [handleOutsideClick]);
278
302
  const { refreshFromStyle } = (0, MapLayerManager_1.useSourceMapContext)();
279
303
  const handleLayerAttached = React.useCallback(() => {
280
304
  if (!isMounted.current) {
@@ -306,9 +330,9 @@ function AttachLayerPopupButton(props) {
306
330
  }
307
331
  return (React.createElement(React.Fragment, null,
308
332
  renderButton(),
309
- React.createElement(UiCore.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: handleOutsideClick, target: buttonRef.current, closeOnEnter: false },
333
+ React.createElement(UiCore.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: onHandleOutsideClick, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false },
310
334
  React.createElement("div", { ref: panelRef, className: "map-sources-popup-panel" },
311
- React.createElement(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached })))));
335
+ React.createElement(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached, onHandleOutsideClick: setHandleOutsideClick })))));
312
336
  }
313
337
  exports.AttachLayerPopupButton = AttachLayerPopupButton;
314
338
  //# sourceMappingURL=AttachLayerPopupButton.js.map