@itwin/map-layers 5.2.6 → 5.3.0

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 (30) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +2 -0
  3. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  4. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +3 -0
  5. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  6. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  7. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +10 -8
  8. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  9. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +2 -0
  10. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  11. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +19 -13
  12. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  13. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  14. package/lib/cjs/ui/widget/FeatureInfoWidget.js +19 -26
  15. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  16. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +2 -0
  17. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  18. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +3 -0
  19. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  20. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  21. package/lib/esm/ui/widget/AttachLayerPopupButton.js +10 -8
  22. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  23. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +2 -0
  24. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  25. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +19 -13
  26. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  27. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  28. package/lib/esm/ui/widget/FeatureInfoWidget.js +19 -26
  29. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  30. package/package.json +1 -1
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MapFeatureInfoWidget = exports.useSpecificWidgetDef = void 0;
4
4
  /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
8
  const React = require("react");
9
+ const appui_react_1 = require("@itwin/appui-react");
9
10
  const components_react_1 = require("@itwin/components-react");
10
11
  const core_react_1 = require("@itwin/core-react");
11
- const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
12
12
  const mapLayers_1 = require("../../mapLayers");
13
- const appui_react_1 = require("@itwin/appui-react");
14
13
  const FeatureInfoUiItemsProvider_1 = require("../FeatureInfoUiItemsProvider");
14
+ const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
15
15
  function useSpecificWidgetDef(id) {
16
16
  const frontstageDef = (0, appui_react_1.useActiveFrontstageDef)();
17
17
  return frontstageDef?.findWidgetDef(id);
@@ -23,45 +23,38 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
23
23
  const [hasData, setHasData] = React.useState(false);
24
24
  const [noRecordsMessage] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
25
25
  const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });
26
- const handleDataChanged = () => {
27
- setHasData(dataProvider.current !== undefined && dataProvider.current.hasRecords);
28
- };
26
+ const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider_1.FeatureInfoUiItemsProvider.widgetId);
27
+ const handleDataChanged = React.useCallback(() => {
28
+ const dataAvailable = dataProvider.current !== undefined && dataProvider.current.hasRecords;
29
+ setHasData(dataAvailable);
30
+ if (widgetDef) {
31
+ widgetDef.setWidgetState(dataAvailable ? appui_react_1.WidgetState.Open : appui_react_1.WidgetState.Hidden);
32
+ }
33
+ }, [widgetDef]);
29
34
  React.useEffect(() => {
30
35
  dataProvider.current = new FeatureInfoDataProvider_1.FeatureInfoDataProvider();
31
36
  return () => {
32
37
  dataProvider?.current?.onUnload();
33
38
  };
34
39
  }, []);
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]);
44
40
  React.useEffect(() => {
45
41
  dataProvider.current?.onDataChanged.addListener(handleDataChanged);
46
42
  return () => {
47
43
  dataProvider.current?.onDataChanged.removeListener(handleDataChanged);
48
44
  };
49
- }, []);
45
+ }, [handleDataChanged]);
50
46
  const handleResize = React.useCallback((w, h) => {
51
47
  setSize({ width: w, height: h });
52
48
  }, []);
53
- if (!hasData) {
49
+ if (hasData && dataProvider.current) {
50
+ return (React.createElement(core_react_1.ResizableContainerObserver, { onResize: handleResize },
51
+ React.createElement(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled })));
52
+ }
53
+ else {
54
54
  return (React.createElement(core_react_1.FillCentered, null,
55
55
  React.createElement("span", null,
56
56
  React.createElement("i", null, noRecordsMessage))));
57
57
  }
58
- else {
59
- if (dataProvider.current)
60
- return (React.createElement(core_react_1.ResizableContainerObserver, { onResize: handleResize },
61
- React.createElement(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled })));
62
- else
63
- return (React.createElement(React.Fragment, null));
64
- }
65
58
  }
66
59
  exports.MapFeatureInfoWidget = MapFeatureInfoWidget;
67
60
  //# sourceMappingURL=FeatureInfoWidget.js.map
@@ -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;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,CAA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nC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,oBAAC,yBAAY;YAAC;gBAAM,+BAAI,gBAAgB,CAAK,CAAO,CAAe,CAAC,CAAC;KAC9E;SAAM;QACL,IAAI,YAAY,CAAC,OAAO;YACtB,OAAO,CACL,oBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY;gBAChD,oBAAC,0DAAuC,IACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,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
+ {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,+BAA+B;AAC/B,oDAAyE;AACzE,8DAAkF;AAClF,kDAA0F;AAC1F,+CAA8C;AAC9C,8EAA2E;AAE3E,uEAAoE;AAEpE,SAAg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C;QACrD,OAAO,GAAG,EAAE;YACV,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QACpC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QACnE,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;QACxE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;QAC9D,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE;QACnC,OAAO,CACL,oBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY;YAChD,oBAAC,0DAAuC,IACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,CAAC,OAAO,EAClC,WAAW,EAAE,wBAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,GAC5F,CACyB,CAC9B,CAAC;KACH;SAAM;QACL,OAAO,CACL,oBAAC,yBAAY;YACX;gBACE,+BAAI,gBAAgB,CAAK,CACpB,CACM,CAChB,CAAC;KACH;AACH,CAAC;AAzDD,oDAyDC","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\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { FeatureInfoUiItemsProvider } from \"../FeatureInfoUiItemsProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { FeatureInfoDataProvider } from \"./FeatureInfoDataProvider\";\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 widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider.widgetId);\n const handleDataChanged = React.useCallback(() => {\n const dataAvailable = dataProvider.current !== undefined && dataProvider.current.hasRecords;\n setHasData(dataAvailable);\n if (widgetDef) {\n widgetDef.setWidgetState(dataAvailable ? WidgetState.Open : WidgetState.Hidden);\n }\n }, [widgetDef]);\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n React.useEffect(() => {\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n }, [handleDataChanged]);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (hasData && 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 />\n </ResizableContainerObserver>\n );\n } else {\n return (\n <FillCentered>\n <span>\n <i>{noRecordsMessage}</i>\n </span>\n </FillCentered>\n );\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { StagePanelLocation, StagePanelSection, ToolbarItem, ToolbarOrientation, ToolbarUsage, ToolItemDef, UiItemsProvider, WidgetState } from "@itwin/appui-react";
3
3
  import { MapFeatureInfoOptions } from "./Interfaces";
4
+ import { BadgeType } from "@itwin/appui-abstract";
4
5
  export declare const getMapFeatureInfoToolItemDef: () => ToolItemDef;
5
6
  export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
6
7
  private _featureInfoOpts;
@@ -14,6 +15,7 @@ export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
14
15
  icon: JSX.Element;
15
16
  content: JSX.Element;
16
17
  defaultState: WidgetState;
18
+ badgeType: BadgeType;
17
19
  }[];
18
20
  }
19
21
  //# sourceMappingURL=FeatureInfoUiItemsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAA6B,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhM,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAMrD,eAAO,MAAM,4BAA4B,QAAO,WAO5C,CAAC;AAEL,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,S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{ MapLayersUI } from "../mapLayers";
9
9
  import { IModelApp } from "@itwin/core-frontend";
10
10
  import { MapFeatureInfoTool } from "@itwin/map-layers-formats";
11
11
  import { SvgMapInfo } from "@itwin/itwinui-icons-react";
12
+ import { BadgeType } from "@itwin/appui-abstract";
12
13
  export const getMapFeatureInfoToolItemDef = () => new ToolItemDef({
13
14
  toolId: MapFeatureInfoTool.toolId,
14
15
  iconSpec: React.createElement(SvgMapInfo, null),
15
16
  label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
16
17
  description: () => MapFeatureInfoTool.description,
17
18
  execute: async () => { await IModelApp.tools.run(MapFeatureInfoTool.toolId); },
19
+ badgeType: BadgeType.TechnicalPreview,
18
20
  });
19
21
  export class FeatureInfoUiItemsProvider {
20
22
  constructor(_featureInfoOpts) {
@@ -42,6 +44,7 @@ export class FeatureInfoUiItemsProvider {
42
44
  icon: React.createElement(SvgMapInfo, null),
43
45
  content: React.createElement(MapFeatureInfoWidget, { featureInfoOpts: this._featureInfoOpts }),
44
46
  defaultState: WidgetState.Hidden,
47
+ badgeType: BadgeType.TechnicalPreview,
45
48
  });
46
49
  }
47
50
  return widgets;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAe,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChM,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAA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U,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,EAAI;YACzH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,oBAAC,UAAU,OAAE;gBACnB,OAAO,EAAE,oBAAC,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,WAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAvCsB,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
+ {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAe,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChM,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAA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AkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,MAAM,UAAU,GAAG,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC;QACpD,IAAI,UAAU,KAAK,iBAAiB,CAAC,GAAG,IAAK,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,EAAI;YACzH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,oBAAC,UAAU,OAAE;gBACnB,OAAO,EAAE,oBAAC,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,WAAW,CAAC,MAAM;gBAChC,SAAS,EAAE,SAAS,CAAC,gBAAgB;aACtC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AAxCsB,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\";\nimport { BadgeType } from \"@itwin/appui-abstract\";\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 badgeType: BadgeType.TechnicalPreview,\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 badgeType: BadgeType.TechnicalPreview,\n });\n }\n\n return widgets;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AAqcA,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;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAkHxE"}
1
+ {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA0cA,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;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAkHxE"}
@@ -3,18 +3,18 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from "react";
6
- import { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
7
6
  import { RelativePosition } from "@itwin/appui-abstract";
8
- import * as UiCore from "@itwin/core-react";
9
7
  import { UiFramework } from "@itwin/appui-react";
10
- import { useSourceMapContext } from "./MapLayerManager";
11
- import { MapUrlDialog } from "./MapUrlDialog";
12
- import { ConfirmMessageDialog } from "./ConfirmMessageDialog";
8
+ import { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority, } from "@itwin/core-frontend";
9
+ import * as UiCore from "@itwin/core-react";
10
+ import { SvgAdd } from "@itwin/itwinui-icons-react";
13
11
  import { Button, IconButton, Input } from "@itwin/itwinui-react";
14
12
  import { MapLayerPreferences } from "../../MapLayerPreferences";
15
13
  import { MapLayersUI } from "../../mapLayers";
14
+ import { ConfirmMessageDialog } from "./ConfirmMessageDialog";
15
+ import { useSourceMapContext } from "./MapLayerManager";
16
16
  import { MapSelectFeaturesDialog } from "./MapSelectFeaturesDialog";
17
- import { SvgAdd } from "@itwin/itwinui-icons-react";
17
+ import { MapUrlDialog } from "./MapUrlDialog";
18
18
  // cSpell:ignore droppable Sublayer
19
19
  var LayerAction;
20
20
  (function (LayerAction) {
@@ -116,8 +116,10 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
116
116
  setLoading(false);
117
117
  }
118
118
  }
119
- onLayerAttached();
120
- resumeOutsideClick();
119
+ if (isMounted.current) {
120
+ onLayerAttached();
121
+ resumeOutsideClick();
122
+ }
121
123
  }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);
122
124
  const handleSelectFeaturesCancel = React.useCallback(() => {
123
125
  if (isMounted.current) {
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAA4B,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9J,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAe,MA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QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACpI,OAAO,EAAE,WAAW,IAAG,yBAAyB,CAAU,CAC7D,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,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\nimport * as React from \"react\";\r\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const mapTypesOptions = mapLayerOptions?.mapTypeOptions;\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n sourceToAdd = clonedSource;\r\n }\r\n\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const mapLayerSettings = sources?.find((source) => source.name === layerNameToAdd);\r\n if (mapLayerSettings === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await mapLayerSettings.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(mapLayerSettings, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, mapLayerSettings);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(mapLayerSettings, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n layerRequiringCredentials={mapLayerSettings.toJSON()}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: mapLayerSettings.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: mapLayerSettings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,\r\n onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,\r\n handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM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E,CACd,CAAC;SACH;aAAM;YACL,MAAM,kBAAkB,GAAG,GAAG,EAAE;gBAC9B,QAAQ,KAAK,CAAC,UAAU,EAAE;oBACxB,KAAK,qBAAqB,CAAC,IAAI;wBAC7B,OAAO,iBAAiB,CAAC;oBAC3B,KAAK,qBAAqB,CAAC,OAAO,CAAC;oBACnC;wBACE,OAAO,KAAK,CAAC;iBAChB;YACH,CAAC,CAAC;YACF,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;YACvC,MAAM,GAAG,CACP,oBAAC,MAAM,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACpI,OAAO,EAAE,WAAW,IAAG,yBAAyB,CAAU,CAC7D,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,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\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority,\r\n} from \"@itwin/core-frontend\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const mapTypesOptions = mapLayerOptions?.mapTypeOptions;\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n sourceToAdd = clonedSource;\r\n }\r\n\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n if (isMounted.current) {\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }\r\n\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const mapLayerSettings = sources?.find((source) => source.name === layerNameToAdd);\r\n if (mapLayerSettings === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await mapLayerSettings.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(mapLayerSettings, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, mapLayerSettings);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(mapLayerSettings, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n layerRequiringCredentials={mapLayerSettings.toJSON()}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: mapLayerSettings.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: mapLayerSettings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,\r\n onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,\r\n handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
@@ -12,6 +12,8 @@ export declare class FeatureInfoDataProvider implements IPropertyDataProvider {
12
12
  constructor();
13
13
  private handleActiveToolChanged;
14
14
  private handleOnInfoReadyChanged;
15
+ private generateLayerCategoryName;
16
+ private generateSubLayerCategoryName;
15
17
  onUnload(): void;
16
18
  get hasRecords(): boolean;
17
19
  private setInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAqD,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AAetI;;GAEG;AACH,qBAAa,uBAAwB,YAAW,qBAAqB;IACnE,OAAO,CAAC,yBAAyB,CAAyB;IAC1D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAe;IAEjD,aAAa,0BAAiC;IACrD,OAAO,CAAC,KAAK,CAA4B;;IAMzC,OAAO,CAAC,uBAAuB,CAa7B;IAEF,OAAO,CAAC,wBAAwB,CAG9B;IAEK,QAAQ;IAQf,IAAW,UAAU,YAEpB;YAEa,OAAO;IAmCd,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,gBAAgB;IAYzF,cAAc,CAAC,YAAY,EAAE,MAAM;IAInC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM;IAO/C,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM;IAM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AAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO7C,WAAW,CAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAUvE,cAAc,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAe5E,eAAe,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO;IAclG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;CAG9C"}
@@ -1,13 +1,13 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  import { PropertyRecord } from "@itwin/appui-abstract";
6
6
  import { PropertyDataChangeEvent } from "@itwin/components-react";
7
7
  import { IModelApp, MapLayerFeatureRecord } from "@itwin/core-frontend";
8
8
  import { MapFeatureInfoTool } from "@itwin/map-layers-formats";
9
9
  /**
10
- * Implementation of [IPropertyDataProvider] that uses an associative array.
10
+ * Implementation of [IPropertyDataProvider] that uses an associative array.
11
11
  * @internal
12
12
  */
13
13
  class SimplePropertyData {
@@ -39,7 +39,13 @@ export class FeatureInfoDataProvider {
39
39
  this.handleOnInfoReadyChanged = (data) => {
40
40
  void this.setInfo(data.mapInfo).then(); // No need to wait for data parsing.
41
41
  };
42
- this._detachToolAdminListener = (IModelApp.toolAdmin.activeToolChanged.addListener(this.handleActiveToolChanged));
42
+ this._detachToolAdminListener = IModelApp.toolAdmin.activeToolChanged.addListener(this.handleActiveToolChanged);
43
+ }
44
+ generateLayerCategoryName(subLayerName) {
45
+ return `_layer_${subLayerName}`;
46
+ }
47
+ generateSubLayerCategoryName(subLayerName) {
48
+ return `_subLayer_${subLayerName}`;
43
49
  }
44
50
  onUnload() {
45
51
  this._detachToolAdminListener();
@@ -55,11 +61,10 @@ export class FeatureInfoDataProvider {
55
61
  this._data = new SimplePropertyData();
56
62
  if (mapInfo?.layerInfos) {
57
63
  for (const curLayerInfo of mapInfo.layerInfos) {
58
- const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
64
+ const categoryName = this.generateLayerCategoryName(curLayerInfo.layerName);
65
+ const layerCatIdx = this.findCategoryIndexByName(categoryName);
59
66
  let nbRecords = 0;
60
- const layerCategory = (layerCatIdx === -1 ?
61
- { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
62
- : this._data.categories[layerCatIdx]);
67
+ const layerCategory = layerCatIdx === -1 ? { name: categoryName, label: curLayerInfo.layerName, expand: true, childCategories: [] } : this._data.categories[layerCatIdx];
63
68
  if (curLayerInfo.subLayerInfos) {
64
69
  for (const subLayerInfo of curLayerInfo.subLayerInfos) {
65
70
  this.addSubLayerCategory(subLayerInfo, layerCategory);
@@ -68,7 +73,7 @@ export class FeatureInfoDataProvider {
68
73
  nbRecords++;
69
74
  for (const attribute of feature.attributes) {
70
75
  // Always use the string value for now
71
- this.addProperty(MapLayerFeatureRecord.createRecordFromAttribute(attribute), subLayerInfo.subLayerName);
76
+ this.addProperty(MapLayerFeatureRecord.createRecordFromAttribute(attribute), this.generateSubLayerCategoryName(subLayerInfo.subLayerName));
72
77
  }
73
78
  }
74
79
  }
@@ -80,13 +85,14 @@ export class FeatureInfoDataProvider {
80
85
  this.onDataChanged.raiseEvent();
81
86
  }
82
87
  addSubLayerCategory(subLayerInfo, layerCategory) {
88
+ const subLayerName = this.generateSubLayerCategoryName(subLayerInfo.subLayerName);
83
89
  const subCatIdx = layerCategory.childCategories?.findIndex((testCategory) => {
84
- return testCategory.name === subLayerInfo.subLayerName;
90
+ return testCategory.name === subLayerName;
85
91
  });
86
92
  let subLayerCategory;
87
93
  if (subCatIdx === -1) {
88
- subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
89
- this.addSubCategory(subLayerCategory.name);
94
+ subLayerCategory = { name: subLayerName, label: subLayerInfo.subLayerName, expand: true };
95
+ this.addSubCategory(subLayerName);
90
96
  layerCategory.childCategories?.push(subLayerCategory);
91
97
  }
92
98
  }