@itwin/map-layers 6.1.0 → 6.2.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.
- package/CHANGELOG.md +10 -2
- package/lib/cjs/map-layers.d.ts +1 -0
- package/lib/cjs/map-layers.d.ts.map +1 -1
- package/lib/cjs/map-layers.js +3 -0
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +4 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/hooks/useResizeObserver.d.ts +5 -0
- package/lib/cjs/ui/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/cjs/ui/hooks/useResizeObserver.js +3 -3
- package/lib/cjs/ui/hooks/useResizeObserver.js.map +1 -1
- package/lib/cjs/ui/widget/CopyActionButton.d.ts +12 -0
- package/lib/cjs/ui/widget/CopyActionButton.d.ts.map +1 -0
- package/lib/cjs/ui/widget/CopyActionButton.js +49 -0
- package/lib/cjs/ui/widget/CopyActionButton.js.map +1 -0
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +22 -4
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +15 -17
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.scss +0 -5
- package/lib/esm/map-layers.d.ts +1 -0
- package/lib/esm/map-layers.d.ts.map +1 -1
- package/lib/esm/map-layers.js +1 -0
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +4 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/hooks/useResizeObserver.d.ts +5 -0
- package/lib/esm/ui/hooks/useResizeObserver.d.ts.map +1 -1
- package/lib/esm/ui/hooks/useResizeObserver.js +3 -3
- package/lib/esm/ui/hooks/useResizeObserver.js.map +1 -1
- package/lib/esm/ui/widget/CopyActionButton.d.ts +12 -0
- package/lib/esm/ui/widget/CopyActionButton.d.ts.map +1 -0
- package/lib/esm/ui/widget/CopyActionButton.js +46 -0
- package/lib/esm/ui/widget/CopyActionButton.js.map +1 -0
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +22 -4
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +16 -17
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.scss +0 -5
- package/lib/public/locales/en/mapLayers.json +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @itwin/map-layers
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Fri, 06 Mar 2026 19:28:08 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 6.2.0
|
|
8
|
+
|
|
9
|
+
Fri, 06 Mar 2026 19:28:08 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Export FeatureInfoWidget, localize strings, and update copy button ([#1622](https://github.com/iTwin/viewer-components-react/pull/1622))
|
|
14
|
+
|
|
7
15
|
## 6.1.0
|
|
8
16
|
|
|
9
|
-
Tue, 03 Mar 2026 14:55:
|
|
17
|
+
Tue, 03 Mar 2026 14:55:51 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
package/lib/cjs/map-layers.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from "./ui/MapLayersUiItemsProvider";
|
|
|
6
6
|
export * from "./ui/FeatureInfoUiItemsProvider";
|
|
7
7
|
export * from "./ui/widget/MapLayersWidget";
|
|
8
8
|
export * from "./BaseMapPresets";
|
|
9
|
+
export { MapFeatureInfoWidget } from "./ui/widget/FeatureInfoWidget";
|
|
9
10
|
//# sourceMappingURL=map-layers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/lib/cjs/map-layers.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MapFeatureInfoWidget = void 0;
|
|
17
18
|
/*---------------------------------------------------------------------------------------------
|
|
18
19
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
19
20
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -26,4 +27,6 @@ __exportStar(require("./ui/MapLayersUiItemsProvider"), exports);
|
|
|
26
27
|
__exportStar(require("./ui/FeatureInfoUiItemsProvider"), exports);
|
|
27
28
|
__exportStar(require("./ui/widget/MapLayersWidget"), exports);
|
|
28
29
|
__exportStar(require("./BaseMapPresets"), exports);
|
|
30
|
+
var FeatureInfoWidget_1 = require("./ui/widget/FeatureInfoWidget");
|
|
31
|
+
Object.defineProperty(exports, "MapFeatureInfoWidget", { enumerable: true, get: function () { return FeatureInfoWidget_1.MapFeatureInfoWidget; } });
|
|
29
32
|
//# sourceMappingURL=map-layers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,8CAA4B;AAC5B,uDAAqC;AACrC,gEAA8C;AAC9C,kDAAgC;AAChC,gEAA8C;AAC9C,kEAAgD;AAChD,8DAA4C;AAC5C,mDAAiC;AACjC,mEAAqE;AAA5D,yHAAA,oBAAoB,OAAA","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 *--------------------------------------------------------------------------------------------*/\nexport * from \"./mapLayers\";\nexport * from \"./MapLayersActionIds\";\nexport * from \"./MapLayersPrefBrowserStorage\";\nexport * from \"./ui/Interfaces\";\nexport * from \"./ui/MapLayersUiItemsProvider\";\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\nexport * from \"./ui/widget/MapLayersWidget\";\nexport * from \"./BaseMapPresets\";\nexport { MapFeatureInfoWidget } from \"./ui/widget/FeatureInfoWidget\";\n"]}
|
|
@@ -130,7 +130,10 @@
|
|
|
130
130
|
},
|
|
131
131
|
"FeatureInfoWidget": {
|
|
132
132
|
"Label": "Map Layers Info",
|
|
133
|
-
"NoRecords": "No Results"
|
|
133
|
+
"NoRecords": "No Results",
|
|
134
|
+
"Copy": "Copy",
|
|
135
|
+
"Copied": "Copied!",
|
|
136
|
+
"CopyFailed": "Copy failed"
|
|
134
137
|
},
|
|
135
138
|
"LayerMenu": {
|
|
136
139
|
"Detach": "Detach",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EACwD,kBAAkB,EAChF,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGlG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA4B1D,eAAO,MAAM,4BAA4B,iBAAkB,MAAM,8CAAqD,iBAqBrH,CAAC;AAEF,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC;IAQ7C,UAAU,IAAI,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EACwD,kBAAkB,EAChF,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGlG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA4B1D,eAAO,MAAM,4BAA4B,iBAAkB,MAAM,8CAAqD,iBAqBrH,CAAC;AAEF,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC;IAQ7C,UAAU,IAAI,MAAM,EAAE;CAqB9B"}
|
|
@@ -83,7 +83,7 @@ class FeatureInfoUiItemsProvider {
|
|
|
83
83
|
id: FeatureInfoUiItemsProvider.widgetId,
|
|
84
84
|
label: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
|
|
85
85
|
icon: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgMapInfo, {}),
|
|
86
|
-
content: (0, jsx_runtime_1.jsx)(FeatureInfoWidget_1.MapFeatureInfoWidget, {
|
|
86
|
+
content: (0, jsx_runtime_1.jsx)(FeatureInfoWidget_1.MapFeatureInfoWidget, { widgetId: FeatureInfoUiItemsProvider.widgetId, isPropertySelectionEnabled: this._featureInfoOpts.propertyGridOptions?.isPropertySelectionEnabled }),
|
|
87
87
|
defaultState: appui_react_1.WidgetState.Hidden,
|
|
88
88
|
layouts: {
|
|
89
89
|
standard: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,0DAAgE;AAChE,oDAE4B;AAC5B,wDAAiD;AACjD,oEAAwD;AACxD,kEAA+D;AAE/D,4CAA2C;AAC3C,8DAA+D;AAC/D,kEAAkE;AAMlE,MAAM,sBAAsB,GAAG,CAAC,EAAkB,EAAE,SAAkB,EAAE,aAA8B,EAAW,EAAE;IACjH,KA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OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,QAAQ,EAAE,gCAAkB,CAAC,KAAK;oBAClC,OAAO,EAAE,+BAAiB,CAAC,GAAG;iBAC/B;aACF;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;;AAlCH,gEAmCC","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 { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport {\n StagePanelLocation, StagePanelSection, ToolbarItemUtilities, ToolbarOrientation, ToolbarUsage, WidgetState,\n} from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\n\nimport { MapLayersUI } from \"../mapLayers\";\nimport { MapLayersSyncUiEventId } from \"../MapLayersActionIds\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\n\nimport type { ToolbarActionItem, ToolbarItem, UiItemsProvider, Widget } from \"@itwin/appui-react\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport type { MapLayerProps } from \"@itwin/core-common\";\nimport type { MapFeatureInfoOptions } from \"./Interfaces\";\nconst supportsMapFeatureInfo = (vp: ScreenViewport, isOverlay: boolean, mapLayerProps: MapLayerProps[]): boolean => {\n for (let mapLayerIndex = 0; mapLayerIndex < mapLayerProps.length; mapLayerIndex++) {\n if (mapLayerProps[mapLayerIndex].visible && mapLayerProps[mapLayerIndex].transparency !== 1.0) {\n const layerProvider = vp.getMapLayerImageryProvider({ index: mapLayerIndex, isOverlay });\n if (layerProvider?.supportsMapFeatureInfo) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isMapFeatureInfoSupported = (): boolean => {\n const vp = IModelApp.viewManager.selectedView;\n if (vp?.viewFlags.backgroundMap) {\n const backgroundLayers = vp.displayStyle.settings.mapImagery.backgroundLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, false, backgroundLayers)) {\n return true;\n }\n const overlayLayers = vp.displayStyle.settings.mapImagery.overlayLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, true, overlayLayers)) {\n return true;\n }\n }\n return false;\n};\n\nexport const getMapFeatureInfoToolItemDef = (itemPriority: number, toolbarOrientation = ToolbarOrientation.Vertical): ToolbarActionItem => {\n return ToolbarItemUtilities.createActionItem({\n id: MapFeatureInfoTool.toolId,\n icon: <SvgMapInfo />, // TODO: Update to iconNode when moving to 5.x appui-react\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: MapFeatureInfoTool.description,\n itemPriority,\n execute: async () => {\n await IModelApp.tools.run(MapFeatureInfoTool.toolId);\n },\n isHidden: new ConditionalBooleanValue(() => {\n // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active\n return !isMapFeatureInfoSupported();\n }, [MapLayersSyncUiEventId.MapImageryChanged]),\n layouts: {\n standard: {\n orientation: toolbarOrientation,\n usage: ToolbarUsage.ContentManipulation,\n }\n }\n });\n};\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) {}\n\n public getToolbarItems(): ReadonlyArray<ToolbarItem> {\n if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool) {\n return [getMapFeatureInfoToolItemDef(this._featureInfoOpts?.itemPriority ?? 60, this._featureInfoOpts?.toolbarOrientation)];\n }\n\n return [];\n }\n\n public getWidgets(): Widget[] {\n if (this._featureInfoOpts?.disableDefaultFeatureInfoWidget)\n return [];\n\n const widgets: Widget[] = [];\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo />,\n content: <MapFeatureInfoWidget widgetId={FeatureInfoUiItemsProvider.widgetId}\n isPropertySelectionEnabled={this._featureInfoOpts.propertyGridOptions?.isPropertySelectionEnabled} />,\n defaultState: WidgetState.Hidden,\n layouts: {\n standard: {\n location: StagePanelLocation.Right,\n section: StagePanelSection.End,\n },\n },\n });\n return widgets;\n }\n}\n"]}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/** Hook that will observe Window Resize
|
|
2
|
+
* @internal
|
|
3
|
+
* Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx
|
|
4
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx
|
|
5
|
+
*/
|
|
1
6
|
export declare const useResizeObserver: <T extends HTMLElement>(onResize: (size: DOMRectReadOnly) => void) => readonly [(element: T | null | undefined) => void, ResizeObserver | undefined];
|
|
2
7
|
//# sourceMappingURL=useResizeObserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,WAAW,YAC3C,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,yBAK7B,CAAC,GAAG,IAAI,GAAG,SAAS,sCA2BjC,CAAC"}
|
|
@@ -29,14 +29,14 @@ exports.useResizeObserver = void 0;
|
|
|
29
29
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
30
|
*--------------------------------------------------------------------------------------------*/
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
|
+
const getWindow = () => {
|
|
33
|
+
return typeof window === "undefined" ? undefined : window;
|
|
34
|
+
};
|
|
32
35
|
/** Hook that will observe Window Resize
|
|
33
36
|
* @internal
|
|
34
37
|
* Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx
|
|
35
38
|
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx
|
|
36
39
|
*/
|
|
37
|
-
const getWindow = () => {
|
|
38
|
-
return typeof window === "undefined" ? undefined : window;
|
|
39
|
-
};
|
|
40
40
|
const useResizeObserver = (onResize) => {
|
|
41
41
|
const resizeObserver = React.useRef();
|
|
42
42
|
const elementRef = React.useCallback((element) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAE/B
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAE/B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAC/B,QAAyC,EACzC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;IAEtD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,OAA6B,EAAE,EAAE;QAChC,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC;QACvC,IAAI,OAAO,EAAE,CAAC;YACZ,cAAc,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtD,uGAAuG;gBACvG,oDAAoD;gBACpD,qDAAqD;gBACrD,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;oBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;wBAC/C,OAAO;oBACT,CAAC;oBAED,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC;oBAClC,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC/B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAU,CAAC;AACvD,CAAC,CAAC;AAjCW,QAAA,iBAAiB,qBAiC5B","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\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\n/** Hook that will observe Window Resize\n * @internal\n * Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx\n * Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx\n */\nexport const useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null | undefined) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect?.();\n if (element) {\n resizeObserver.current = new ResizeObserver((entries) => {\n // We wrap onResize with requestAnimationFrame to avoid this error - ResizeObserver loop limit exceeded\n // See: https://github.com/iTwin/iTwinUI/issues/1317\n // See: https://stackoverflow.com/a/58701523/11547064\n window.requestAnimationFrame(() => {\n if (!Array.isArray(entries) || !entries.length) {\n return;\n }\n\n const [{ contentRect }] = entries;\n return onResize(contentRect);\n });\n });\n resizeObserver.current?.observe?.(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface CopyActionButtonProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onCopy?: (value: string) => Promise<void> | void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders an icon button that copies a value to the clipboard.
|
|
7
|
+
*
|
|
8
|
+
* After a click, the icon and label briefly switch to a copied state.
|
|
9
|
+
*/
|
|
10
|
+
export declare function CopyActionButton({ value, onCopy }: CopyActionButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=CopyActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyActionButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/CopyActionButton.tsx"],"names":[],"mappings":"AAQA,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,2CA6CxE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CopyActionButton = CopyActionButton;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
6
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
9
|
+
const mapLayers_1 = require("../../mapLayers");
|
|
10
|
+
/**
|
|
11
|
+
* Renders an icon button that copies a value to the clipboard.
|
|
12
|
+
*
|
|
13
|
+
* After a click, the icon and label briefly switch to a copied state.
|
|
14
|
+
*/
|
|
15
|
+
function CopyActionButton({ value, onCopy }) {
|
|
16
|
+
const [isCopied, setIsCopied] = (0, react_1.useState)(false);
|
|
17
|
+
const timeoutRef = (0, react_1.useRef)(undefined);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
return () => {
|
|
20
|
+
if (timeoutRef.current !== undefined) {
|
|
21
|
+
clearTimeout(timeoutRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { styleType: "borderless", label: isCopied ? mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Copied") : mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Copy"), onClick: async () => {
|
|
26
|
+
try {
|
|
27
|
+
if (onCopy) {
|
|
28
|
+
await onCopy(value);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
await navigator.clipboard.writeText(value);
|
|
32
|
+
}
|
|
33
|
+
setIsCopied(true);
|
|
34
|
+
if (timeoutRef.current !== undefined) {
|
|
35
|
+
clearTimeout(timeoutRef.current);
|
|
36
|
+
}
|
|
37
|
+
timeoutRef.current = setTimeout(() => {
|
|
38
|
+
setIsCopied(false);
|
|
39
|
+
timeoutRef.current = undefined;
|
|
40
|
+
}, 1200);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
const copyFailedMessage = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.CopyFailed");
|
|
44
|
+
core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Warning, copyFailedMessage));
|
|
45
|
+
}
|
|
46
|
+
}, disabled: isCopied, children: isCopied ? (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCheckmarkSmall, {}) : (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCopy, {}) }, String(isCopied)));
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
//# sourceMappingURL=CopyActionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyActionButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/CopyActionButton.tsx"],"names":[],"mappings":";;AAkBA,4CA6CC;;AA/DD,oEAAwE;AACxE,wDAAkD;AAClD,iCAAoD;AAEpD,wDAA8F;AAE9F,+CAA8C;AAO9C;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAyB;IACvE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,IAAA,cAAM,EAAqB,SAAS,CAAC,CAAC;IAEzD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACrC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,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AAA,CAAC","sourcesContent":["import { SvgCheckmarkSmall, SvgCopy } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { IModelApp, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\n\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface CopyActionButtonProps {\n value: string;\n onCopy?: (value: string) => Promise<void> | void;\n}\n\n/**\n * Renders an icon button that copies a value to the clipboard.\n *\n * After a click, the icon and label briefly switch to a copied state.\n */\nexport function CopyActionButton({ value, onCopy }: CopyActionButtonProps) {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = useRef<number | undefined>(undefined);\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current !== undefined) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n return (\n <IconButton\n styleType=\"borderless\"\n label={isCopied ? MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Copied\") : MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Copy\")}\n onClick={async () => {\n try {\n if (onCopy) {\n await onCopy(value);\n } else {\n await navigator.clipboard.writeText(value);\n }\n setIsCopied(true);\n\n if (timeoutRef.current !== undefined) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n setIsCopied(false);\n timeoutRef.current = undefined;\n }, 1200);\n } catch {\n const copyFailedMessage = MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.CopyFailed\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, copyFailedMessage));\n }\n }}\n disabled={isCopied}\n // Use key to reset internal state of IconButton when isCopied changes, ensuring the label updates immediately.\n key={String(isCopied)}\n >\n {isCopied ? <SvgCheckmarkSmall /> : <SvgCopy />}\n </IconButton>\n );\n};\n"]}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import "./FeatureInfoWidget.scss";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link MapFeatureInfoWidget}.
|
|
4
|
+
*/
|
|
4
5
|
interface MapFeatureInfoWidgetProps {
|
|
5
|
-
|
|
6
|
+
/** The widget that will be shown/hidden based on feature info data availability. */
|
|
7
|
+
widgetId: string;
|
|
8
|
+
/** Enables property selection support in the property grid when set. */
|
|
9
|
+
isPropertySelectionEnabled?: boolean;
|
|
10
|
+
/** Invoked when feature info data availability changes. */
|
|
11
|
+
onDataChanged?: (hasData: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Optional copy handler used by the copy action button.
|
|
14
|
+
* When omitted, the component copies values using the browser clipboard API.
|
|
15
|
+
*/
|
|
16
|
+
onCopy?: (value: string) => Promise<void> | void;
|
|
6
17
|
}
|
|
7
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Displays map feature info in a virtualized property grid and keeps the
|
|
20
|
+
* owning widget open/hidden based on whether records are available.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Widget configuration and callbacks.
|
|
23
|
+
* @returns The feature info property grid UI, or `null` when no records are available.
|
|
24
|
+
*/
|
|
25
|
+
export declare function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }: MapFeatureInfoWidgetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
26
|
export {};
|
|
9
27
|
//# sourceMappingURL=FeatureInfoWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAIA,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAIA,OAAO,0BAA0B,CAAC;AAiBlC;;GAEG;AACH,UAAU,yBAAyB;IACjC,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,2DAA2D;IAC3D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,yBAAyB,kDAiE9H"}
|
|
@@ -23,7 +23,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useSpecificWidgetDef = useSpecificWidgetDef;
|
|
27
26
|
exports.MapFeatureInfoWidget = MapFeatureInfoWidget;
|
|
28
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
29
28
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -34,29 +33,33 @@ require("./FeatureInfoWidget.scss");
|
|
|
34
33
|
const React = __importStar(require("react"));
|
|
35
34
|
const appui_react_1 = require("@itwin/appui-react");
|
|
36
35
|
const components_react_1 = require("@itwin/components-react");
|
|
37
|
-
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
38
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
39
|
-
const mapLayers_1 = require("../../mapLayers");
|
|
40
|
-
const FeatureInfoUiItemsProvider_1 = require("../FeatureInfoUiItemsProvider");
|
|
41
36
|
const useResizeObserver_1 = require("../hooks/useResizeObserver");
|
|
37
|
+
const CopyActionButton_1 = require("./CopyActionButton");
|
|
42
38
|
const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
|
|
43
39
|
function useSpecificWidgetDef(id) {
|
|
44
40
|
const frontstageDef = (0, appui_react_1.useActiveFrontstageDef)();
|
|
45
41
|
return frontstageDef?.findWidgetDef(id);
|
|
46
42
|
}
|
|
47
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Displays map feature info in a virtualized property grid and keeps the
|
|
45
|
+
* owning widget open/hidden based on whether records are available.
|
|
46
|
+
*
|
|
47
|
+
* @param props - Widget configuration and callbacks.
|
|
48
|
+
* @returns The feature info property grid UI, or `null` when no records are available.
|
|
49
|
+
*/
|
|
50
|
+
function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }) {
|
|
48
51
|
const dataProvider = React.useRef(null);
|
|
49
52
|
const [hasData, setHasData] = React.useState(false);
|
|
50
|
-
const [noRecordsMessage] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
|
|
51
53
|
const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });
|
|
52
|
-
const widgetDef = useSpecificWidgetDef(
|
|
54
|
+
const widgetDef = useSpecificWidgetDef(widgetId);
|
|
53
55
|
const handleDataChanged = React.useCallback(() => {
|
|
54
56
|
const dataAvailable = dataProvider.current !== null && dataProvider.current.hasRecords;
|
|
55
57
|
setHasData(dataAvailable);
|
|
56
58
|
if (widgetDef) {
|
|
57
59
|
widgetDef.setWidgetState(dataAvailable ? appui_react_1.WidgetState.Open : appui_react_1.WidgetState.Hidden);
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
onDataChanged?.(dataAvailable);
|
|
62
|
+
}, [widgetDef, onDataChanged]);
|
|
60
63
|
React.useEffect(() => {
|
|
61
64
|
dataProvider.current = new FeatureInfoDataProvider_1.FeatureInfoDataProvider();
|
|
62
65
|
return () => {
|
|
@@ -75,18 +78,13 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
|
|
|
75
78
|
const [elementRef] = (0, useResizeObserver_1.useResizeObserver)((size) => {
|
|
76
79
|
handleResize(size.width, size.height);
|
|
77
80
|
});
|
|
78
|
-
const copyButton = React.useCallback((props) => props.isPropertyHovered && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(
|
|
79
|
-
const value = props.property.value;
|
|
80
|
-
if (value !== undefined && value.hasOwnProperty("displayValue")) {
|
|
81
|
-
navigator.clipboard.writeText(value.displayValue ?? "").catch((_) => { });
|
|
82
|
-
}
|
|
83
|
-
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCopy, {}) }) })), []);
|
|
81
|
+
const copyButton = React.useCallback((props) => props.isPropertyHovered && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(CopyActionButton_1.CopyActionButton, { value: props.property.value ? props.property.value.displayValue ?? "" : "", onCopy: onCopy }) })), [onCopy]);
|
|
84
82
|
if (hasData && dataProvider.current) {
|
|
85
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: elementRef, className: "feature-info-widget-container", children: (0, jsx_runtime_1.jsx)(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: components_react_1.Orientation.Vertical, isPropertySelectionEnabled:
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: elementRef, className: "feature-info-widget-container", children: (0, jsx_runtime_1.jsx)(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: components_react_1.Orientation.Vertical, isPropertySelectionEnabled: isPropertySelectionEnabled, isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered
|
|
86
84
|
: true, actionButtonRenderers: [copyButton] }) }));
|
|
87
85
|
}
|
|
88
86
|
else {
|
|
89
|
-
return
|
|
87
|
+
return null;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
//# sourceMappingURL=FeatureInfoWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"m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C,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,QAAQ,CAAC,KAAwB,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAI,GAChI,CACP,EACH,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,IAAI,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,CACL,gCAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,+BAA+B,YAC7D,uBAAC,0DAAuC,IACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,CAAC,OAAO,EAClC,WAAW,EAAE,8BAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,0BAA0B,EACtD,sBAAsB,CAAC,yFAAyF;wBAChH,qBAAqB,EAAE,CAAC,UAAU,CAAC,GACnC,GACE,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport \"./FeatureInfoWidget.scss\";\nimport * as React from \"react\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { Orientation, VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\n\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { CopyActionButton } from \"./CopyActionButton\";\nimport { FeatureInfoDataProvider } from \"./FeatureInfoDataProvider\";\n\nimport type { PrimitiveValue } from \"@itwin/appui-abstract\";\nimport type { ActionButtonRendererProps } from \"@itwin/components-react\";\n\nfunction useSpecificWidgetDef(id: string) {\n const frontstageDef = useActiveFrontstageDef();\n return frontstageDef?.findWidgetDef(id);\n}\n\n/**\n * Props for {@link MapFeatureInfoWidget}.\n */\ninterface MapFeatureInfoWidgetProps {\n /** The widget that will be shown/hidden based on feature info data availability. */\n widgetId: string;\n /** Enables property selection support in the property grid when set. */\n isPropertySelectionEnabled?: boolean;\n /** Invoked when feature info data availability changes. */\n onDataChanged?: (hasData: boolean) => void;\n /**\n * Optional copy handler used by the copy action button.\n * When omitted, the component copies values using the browser clipboard API.\n */\n onCopy?: (value: string) => Promise<void> | void;\n}\n\n/**\n * Displays map feature info in a virtualized property grid and keeps the\n * owning widget open/hidden based on whether records are available.\n *\n * @param props - Widget configuration and callbacks.\n * @returns The feature info property grid UI, or `null` when no records are available.\n */\nexport function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }: MapFeatureInfoWidgetProps) {\n const dataProvider = React.useRef<FeatureInfoDataProvider | null>(null);\n const [hasData, setHasData] = React.useState(false);\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const widgetDef = useSpecificWidgetDef(widgetId);\n const handleDataChanged = React.useCallback(() => {\n const dataAvailable = dataProvider.current !== null && dataProvider.current.hasRecords;\n setHasData(dataAvailable);\n if (widgetDef) {\n widgetDef.setWidgetState(dataAvailable ? WidgetState.Open : WidgetState.Hidden);\n }\n onDataChanged?.(dataAvailable);\n }, [widgetDef, onDataChanged]);\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 const [elementRef] = useResizeObserver<HTMLDivElement>((size) => {\n handleResize(size.width, size.height);\n });\n\n const copyButton = React.useCallback(\n (props: ActionButtonRendererProps) =>\n props.isPropertyHovered && (\n <div>\n <CopyActionButton value={props.property.value ? (props.property.value as PrimitiveValue).displayValue ?? \"\" : \"\"} onCopy={onCopy} />\n </div>\n ),\n [onCopy],\n );\n\n if (hasData && dataProvider.current) {\n return (\n <div ref={elementRef} className=\"feature-info-widget-container\">\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={isPropertySelectionEnabled}\n isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered\n actionButtonRenderers={[copyButton]}\n />\n </div>\n );\n } else {\n return null;\n }\n}\n"]}
|
package/lib/esm/map-layers.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from "./ui/MapLayersUiItemsProvider";
|
|
|
6
6
|
export * from "./ui/FeatureInfoUiItemsProvider";
|
|
7
7
|
export * from "./ui/widget/MapLayersWidget";
|
|
8
8
|
export * from "./BaseMapPresets";
|
|
9
|
+
export { MapFeatureInfoWidget } from "./ui/widget/FeatureInfoWidget";
|
|
9
10
|
//# sourceMappingURL=map-layers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/lib/esm/map-layers.js
CHANGED
|
@@ -10,4 +10,5 @@ export * from "./ui/MapLayersUiItemsProvider";
|
|
|
10
10
|
export * from "./ui/FeatureInfoUiItemsProvider";
|
|
11
11
|
export * from "./ui/widget/MapLayersWidget";
|
|
12
12
|
export * from "./BaseMapPresets";
|
|
13
|
+
export { MapFeatureInfoWidget } from "./ui/widget/FeatureInfoWidget";
|
|
13
14
|
//# sourceMappingURL=map-layers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,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 *--------------------------------------------------------------------------------------------*/\nexport * from \"./mapLayers\";\nexport * from \"./MapLayersActionIds\";\nexport * from \"./MapLayersPrefBrowserStorage\";\nexport * from \"./ui/Interfaces\";\nexport * from \"./ui/MapLayersUiItemsProvider\";\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\nexport * from \"./ui/widget/MapLayersWidget\";\nexport * from \"./BaseMapPresets\";\n"]}
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,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 *--------------------------------------------------------------------------------------------*/\nexport * from \"./mapLayers\";\nexport * from \"./MapLayersActionIds\";\nexport * from \"./MapLayersPrefBrowserStorage\";\nexport * from \"./ui/Interfaces\";\nexport * from \"./ui/MapLayersUiItemsProvider\";\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\nexport * from \"./ui/widget/MapLayersWidget\";\nexport * from \"./BaseMapPresets\";\nexport { MapFeatureInfoWidget } from \"./ui/widget/FeatureInfoWidget\";\n"]}
|
|
@@ -130,7 +130,10 @@
|
|
|
130
130
|
},
|
|
131
131
|
"FeatureInfoWidget": {
|
|
132
132
|
"Label": "Map Layers Info",
|
|
133
|
-
"NoRecords": "No Results"
|
|
133
|
+
"NoRecords": "No Results",
|
|
134
|
+
"Copy": "Copy",
|
|
135
|
+
"Copied": "Copied!",
|
|
136
|
+
"CopyFailed": "Copy failed"
|
|
134
137
|
},
|
|
135
138
|
"LayerMenu": {
|
|
136
139
|
"Detach": "Detach",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EACwD,kBAAkB,EAChF,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGlG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA4B1D,eAAO,MAAM,4BAA4B,iBAAkB,MAAM,8CAAqD,iBAqBrH,CAAC;AAEF,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC;IAQ7C,UAAU,IAAI,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EACwD,kBAAkB,EAChF,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGlG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA4B1D,eAAO,MAAM,4BAA4B,iBAAkB,MAAM,8CAAqD,iBAqBrH,CAAC;AAEF,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC;IAQ7C,UAAU,IAAI,MAAM,EAAE;CAqB9B"}
|
|
@@ -79,7 +79,7 @@ export class FeatureInfoUiItemsProvider {
|
|
|
79
79
|
id: FeatureInfoUiItemsProvider.widgetId,
|
|
80
80
|
label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
|
|
81
81
|
icon: _jsx(SvgMapInfo, {}),
|
|
82
|
-
content: _jsx(MapFeatureInfoWidget, {
|
|
82
|
+
content: _jsx(MapFeatureInfoWidget, { widgetId: FeatureInfoUiItemsProvider.widgetId, isPropertySelectionEnabled: this._featureInfoOpts.propertyGridOptions?.isPropertySelectionEnabled }),
|
|
83
83
|
defaultState: WidgetState.Hidden,
|
|
84
84
|
layouts: {
|
|
85
85
|
standard: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,GAC3G,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAMlE,MAAM,sBAAsB,GAAG,CAAC,EAAkB,EAAE,SAAkB,EAAE,aAA8B,EAAW,EAAE;IACjH,KAAK,IAAI,aAAa,GAAG,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,CAAC;QAClF,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC,YAAY,KAAK,GAAG,EAAE,CAAC;YAC9F,MAAM,aAAa,GAAG,EAAE,CAAC,0BAA0B,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;YACzF,IAAI,aAAa,EAAE,sBAAsB,EAAE,CAAC;gBAC1C,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf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H,OAAO,OAAO,CAAC;IACjB,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 { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport {\n StagePanelLocation, StagePanelSection, ToolbarItemUtilities, ToolbarOrientation, ToolbarUsage, WidgetState,\n} from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\n\nimport { MapLayersUI } from \"../mapLayers\";\nimport { MapLayersSyncUiEventId } from \"../MapLayersActionIds\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\n\nimport type { ToolbarActionItem, ToolbarItem, UiItemsProvider, Widget } from \"@itwin/appui-react\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport type { MapLayerProps } from \"@itwin/core-common\";\nimport type { MapFeatureInfoOptions } from \"./Interfaces\";\nconst supportsMapFeatureInfo = (vp: ScreenViewport, isOverlay: boolean, mapLayerProps: MapLayerProps[]): boolean => {\n for (let mapLayerIndex = 0; mapLayerIndex < mapLayerProps.length; mapLayerIndex++) {\n if (mapLayerProps[mapLayerIndex].visible && mapLayerProps[mapLayerIndex].transparency !== 1.0) {\n const layerProvider = vp.getMapLayerImageryProvider({ index: mapLayerIndex, isOverlay });\n if (layerProvider?.supportsMapFeatureInfo) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isMapFeatureInfoSupported = (): boolean => {\n const vp = IModelApp.viewManager.selectedView;\n if (vp?.viewFlags.backgroundMap) {\n const backgroundLayers = vp.displayStyle.settings.mapImagery.backgroundLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, false, backgroundLayers)) {\n return true;\n }\n const overlayLayers = vp.displayStyle.settings.mapImagery.overlayLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, true, overlayLayers)) {\n return true;\n }\n }\n return false;\n};\n\nexport const getMapFeatureInfoToolItemDef = (itemPriority: number, toolbarOrientation = ToolbarOrientation.Vertical): ToolbarActionItem => {\n return ToolbarItemUtilities.createActionItem({\n id: MapFeatureInfoTool.toolId,\n icon: <SvgMapInfo />, // TODO: Update to iconNode when moving to 5.x appui-react\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: MapFeatureInfoTool.description,\n itemPriority,\n execute: async () => {\n await IModelApp.tools.run(MapFeatureInfoTool.toolId);\n },\n isHidden: new ConditionalBooleanValue(() => {\n // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active\n return !isMapFeatureInfoSupported();\n }, [MapLayersSyncUiEventId.MapImageryChanged]),\n layouts: {\n standard: {\n orientation: toolbarOrientation,\n usage: ToolbarUsage.ContentManipulation,\n }\n }\n });\n};\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) {}\n\n public getToolbarItems(): ReadonlyArray<ToolbarItem> {\n if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool) {\n return [getMapFeatureInfoToolItemDef(this._featureInfoOpts?.itemPriority ?? 60, this._featureInfoOpts?.toolbarOrientation)];\n }\n\n return [];\n }\n\n public getWidgets(): Widget[] {\n if (this._featureInfoOpts?.disableDefaultFeatureInfoWidget)\n return [];\n\n const widgets: Widget[] = [];\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo />,\n content: <MapFeatureInfoWidget widgetId={FeatureInfoUiItemsProvider.widgetId}\n isPropertySelectionEnabled={this._featureInfoOpts.propertyGridOptions?.isPropertySelectionEnabled} />,\n defaultState: WidgetState.Hidden,\n layouts: {\n standard: {\n location: StagePanelLocation.Right,\n section: StagePanelSection.End,\n },\n },\n });\n return widgets;\n }\n}\n"]}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/** Hook that will observe Window Resize
|
|
2
|
+
* @internal
|
|
3
|
+
* Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx
|
|
4
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx
|
|
5
|
+
*/
|
|
1
6
|
export declare const useResizeObserver: <T extends HTMLElement>(onResize: (size: DOMRectReadOnly) => void) => readonly [(element: T | null | undefined) => void, ResizeObserver | undefined];
|
|
2
7
|
//# sourceMappingURL=useResizeObserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,WAAW,YAC3C,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,yBAK7B,CAAC,GAAG,IAAI,GAAG,SAAS,sCA2BjC,CAAC"}
|
|
@@ -3,14 +3,14 @@
|
|
|
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
|
+
const getWindow = () => {
|
|
7
|
+
return typeof window === "undefined" ? undefined : window;
|
|
8
|
+
};
|
|
6
9
|
/** Hook that will observe Window Resize
|
|
7
10
|
* @internal
|
|
8
11
|
* Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx
|
|
9
12
|
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx
|
|
10
13
|
*/
|
|
11
|
-
const getWindow = () => {
|
|
12
|
-
return typeof window === "undefined" ? undefined : window;
|
|
13
|
-
};
|
|
14
14
|
export const useResizeObserver = (onResize) => {
|
|
15
15
|
const resizeObserver = React.useRef();
|
|
16
16
|
const elementRef = React.useCallback((element) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAyC,EACzC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;IAEtD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,OAA6B,EAAE,EAAE;QAChC,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC;QACvC,IAAI,OAAO,EAAE,CAAC;YACZ,cAAc,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtD,uGAAuG;gBACvG,oDAAoD;gBACpD,qDAAqD;gBACrD,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;oBAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;wBAC/C,OAAO;oBACT,CAAC;oBAED,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC;oBAClC,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC/B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAU,CAAC;AACvD,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\n/** Hook that will observe Window Resize\n * @internal\n * Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx\n * Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx\n */\nexport const useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null | undefined) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect?.();\n if (element) {\n resizeObserver.current = new ResizeObserver((entries) => {\n // We wrap onResize with requestAnimationFrame to avoid this error - ResizeObserver loop limit exceeded\n // See: https://github.com/iTwin/iTwinUI/issues/1317\n // See: https://stackoverflow.com/a/58701523/11547064\n window.requestAnimationFrame(() => {\n if (!Array.isArray(entries) || !entries.length) {\n return;\n }\n\n const [{ contentRect }] = entries;\n return onResize(contentRect);\n });\n });\n resizeObserver.current?.observe?.(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface CopyActionButtonProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onCopy?: (value: string) => Promise<void> | void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders an icon button that copies a value to the clipboard.
|
|
7
|
+
*
|
|
8
|
+
* After a click, the icon and label briefly switch to a copied state.
|
|
9
|
+
*/
|
|
10
|
+
export declare function CopyActionButton({ value, onCopy }: CopyActionButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=CopyActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyActionButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/CopyActionButton.tsx"],"names":[],"mappings":"AAQA,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,2CA6CxE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SvgCheckmarkSmall, SvgCopy } from "@itwin/itwinui-icons-react";
|
|
3
|
+
import { IconButton } from "@itwin/itwinui-react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { IModelApp, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
|
|
6
|
+
import { MapLayersUI } from "../../mapLayers";
|
|
7
|
+
/**
|
|
8
|
+
* Renders an icon button that copies a value to the clipboard.
|
|
9
|
+
*
|
|
10
|
+
* After a click, the icon and label briefly switch to a copied state.
|
|
11
|
+
*/
|
|
12
|
+
export function CopyActionButton({ value, onCopy }) {
|
|
13
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
14
|
+
const timeoutRef = useRef(undefined);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
return () => {
|
|
17
|
+
if (timeoutRef.current !== undefined) {
|
|
18
|
+
clearTimeout(timeoutRef.current);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
return (_jsx(IconButton, { styleType: "borderless", label: isCopied ? MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Copied") : MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Copy"), onClick: async () => {
|
|
23
|
+
try {
|
|
24
|
+
if (onCopy) {
|
|
25
|
+
await onCopy(value);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
await navigator.clipboard.writeText(value);
|
|
29
|
+
}
|
|
30
|
+
setIsCopied(true);
|
|
31
|
+
if (timeoutRef.current !== undefined) {
|
|
32
|
+
clearTimeout(timeoutRef.current);
|
|
33
|
+
}
|
|
34
|
+
timeoutRef.current = setTimeout(() => {
|
|
35
|
+
setIsCopied(false);
|
|
36
|
+
timeoutRef.current = undefined;
|
|
37
|
+
}, 1200);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
const copyFailedMessage = MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.CopyFailed");
|
|
41
|
+
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, copyFailedMessage));
|
|
42
|
+
}
|
|
43
|
+
}, disabled: isCopied, children: isCopied ? _jsx(SvgCheckmarkSmall, {}) : _jsx(SvgCopy, {}) }, String(isCopied)));
|
|
44
|
+
}
|
|
45
|
+
;
|
|
46
|
+
//# sourceMappingURL=CopyActionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyActionButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/CopyActionButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAyB;IACvE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,MAAM,CAAqB,SAAS,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACrC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,kCAAkC,CAAC,EACrL,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC;gBACH,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACN,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC;gBACD,WAAW,CAAC,IAAI,CAAC,CAAC;gBAElB,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;oBACrC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACnC,CAAC;gBAED,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;oBACnC,WAAW,CAAC,KAAK,CAAC,CAAC;oBACnB,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;gBACjC,CAAC,EAAE,IAAI,CAAC,CAAC;YACX,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,CAAC;gBAChH,SAAS,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;YACpH,CAAC;QACH,CAAC,EACD,QAAQ,EAAE,QAAQ,YAIjB,QAAQ,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,IAF1C,MAAM,CAAC,QAAQ,CAAC,CAGV,CACd,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { SvgCheckmarkSmall, SvgCopy } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { IModelApp, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\n\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface CopyActionButtonProps {\n value: string;\n onCopy?: (value: string) => Promise<void> | void;\n}\n\n/**\n * Renders an icon button that copies a value to the clipboard.\n *\n * After a click, the icon and label briefly switch to a copied state.\n */\nexport function CopyActionButton({ value, onCopy }: CopyActionButtonProps) {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = useRef<number | undefined>(undefined);\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current !== undefined) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n return (\n <IconButton\n styleType=\"borderless\"\n label={isCopied ? MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Copied\") : MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Copy\")}\n onClick={async () => {\n try {\n if (onCopy) {\n await onCopy(value);\n } else {\n await navigator.clipboard.writeText(value);\n }\n setIsCopied(true);\n\n if (timeoutRef.current !== undefined) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n setIsCopied(false);\n timeoutRef.current = undefined;\n }, 1200);\n } catch {\n const copyFailedMessage = MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.CopyFailed\");\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, copyFailedMessage));\n }\n }}\n disabled={isCopied}\n // Use key to reset internal state of IconButton when isCopied changes, ensuring the label updates immediately.\n key={String(isCopied)}\n >\n {isCopied ? <SvgCheckmarkSmall /> : <SvgCopy />}\n </IconButton>\n );\n};\n"]}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import "./FeatureInfoWidget.scss";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link MapFeatureInfoWidget}.
|
|
4
|
+
*/
|
|
4
5
|
interface MapFeatureInfoWidgetProps {
|
|
5
|
-
|
|
6
|
+
/** The widget that will be shown/hidden based on feature info data availability. */
|
|
7
|
+
widgetId: string;
|
|
8
|
+
/** Enables property selection support in the property grid when set. */
|
|
9
|
+
isPropertySelectionEnabled?: boolean;
|
|
10
|
+
/** Invoked when feature info data availability changes. */
|
|
11
|
+
onDataChanged?: (hasData: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Optional copy handler used by the copy action button.
|
|
14
|
+
* When omitted, the component copies values using the browser clipboard API.
|
|
15
|
+
*/
|
|
16
|
+
onCopy?: (value: string) => Promise<void> | void;
|
|
6
17
|
}
|
|
7
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Displays map feature info in a virtualized property grid and keeps the
|
|
20
|
+
* owning widget open/hidden based on whether records are available.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Widget configuration and callbacks.
|
|
23
|
+
* @returns The feature info property grid UI, or `null` when no records are available.
|
|
24
|
+
*/
|
|
25
|
+
export declare function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }: MapFeatureInfoWidgetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
26
|
export {};
|
|
9
27
|
//# sourceMappingURL=FeatureInfoWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAIA,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAIA,OAAO,0BAA0B,CAAC;AAiBlC;;GAEG;AACH,UAAU,yBAAyB;IACjC,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,2DAA2D;IAC3D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,yBAAyB,kDAiE9H"}
|
|
@@ -7,29 +7,33 @@ import "./FeatureInfoWidget.scss";
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { useActiveFrontstageDef, WidgetState } from "@itwin/appui-react";
|
|
9
9
|
import { Orientation, VirtualizedPropertyGridWithDataProvider } from "@itwin/components-react";
|
|
10
|
-
import { SvgCopy } from "@itwin/itwinui-icons-react";
|
|
11
|
-
import { Flex, IconButton } from "@itwin/itwinui-react";
|
|
12
|
-
import { MapLayersUI } from "../../mapLayers";
|
|
13
|
-
import { FeatureInfoUiItemsProvider } from "../FeatureInfoUiItemsProvider";
|
|
14
10
|
import { useResizeObserver } from "../hooks/useResizeObserver";
|
|
11
|
+
import { CopyActionButton } from "./CopyActionButton";
|
|
15
12
|
import { FeatureInfoDataProvider } from "./FeatureInfoDataProvider";
|
|
16
|
-
|
|
13
|
+
function useSpecificWidgetDef(id) {
|
|
17
14
|
const frontstageDef = useActiveFrontstageDef();
|
|
18
15
|
return frontstageDef?.findWidgetDef(id);
|
|
19
16
|
}
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Displays map feature info in a virtualized property grid and keeps the
|
|
19
|
+
* owning widget open/hidden based on whether records are available.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Widget configuration and callbacks.
|
|
22
|
+
* @returns The feature info property grid UI, or `null` when no records are available.
|
|
23
|
+
*/
|
|
24
|
+
export function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }) {
|
|
21
25
|
const dataProvider = React.useRef(null);
|
|
22
26
|
const [hasData, setHasData] = React.useState(false);
|
|
23
|
-
const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
|
|
24
27
|
const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });
|
|
25
|
-
const widgetDef = useSpecificWidgetDef(
|
|
28
|
+
const widgetDef = useSpecificWidgetDef(widgetId);
|
|
26
29
|
const handleDataChanged = React.useCallback(() => {
|
|
27
30
|
const dataAvailable = dataProvider.current !== null && dataProvider.current.hasRecords;
|
|
28
31
|
setHasData(dataAvailable);
|
|
29
32
|
if (widgetDef) {
|
|
30
33
|
widgetDef.setWidgetState(dataAvailable ? WidgetState.Open : WidgetState.Hidden);
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
onDataChanged?.(dataAvailable);
|
|
36
|
+
}, [widgetDef, onDataChanged]);
|
|
33
37
|
React.useEffect(() => {
|
|
34
38
|
dataProvider.current = new FeatureInfoDataProvider();
|
|
35
39
|
return () => {
|
|
@@ -48,18 +52,13 @@ export function MapFeatureInfoWidget({ featureInfoOpts }) {
|
|
|
48
52
|
const [elementRef] = useResizeObserver((size) => {
|
|
49
53
|
handleResize(size.width, size.height);
|
|
50
54
|
});
|
|
51
|
-
const copyButton = React.useCallback((props) => props.isPropertyHovered && (_jsx("div", { children: _jsx(
|
|
52
|
-
const value = props.property.value;
|
|
53
|
-
if (value !== undefined && value.hasOwnProperty("displayValue")) {
|
|
54
|
-
navigator.clipboard.writeText(value.displayValue ?? "").catch((_) => { });
|
|
55
|
-
}
|
|
56
|
-
}, children: _jsx(SvgCopy, {}) }) })), []);
|
|
55
|
+
const copyButton = React.useCallback((props) => props.isPropertyHovered && (_jsx("div", { children: _jsx(CopyActionButton, { value: props.property.value ? props.property.value.displayValue ?? "" : "", onCopy: onCopy }) })), [onCopy]);
|
|
57
56
|
if (hasData && dataProvider.current) {
|
|
58
|
-
return (_jsx("div", { ref: elementRef, className: "feature-info-widget-container", children: _jsx(VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: Orientation.Vertical, isPropertySelectionEnabled:
|
|
57
|
+
return (_jsx("div", { ref: elementRef, className: "feature-info-widget-container", children: _jsx(VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: Orientation.Vertical, isPropertySelectionEnabled: isPropertySelectionEnabled, isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered
|
|
59
58
|
: true, actionButtonRenderers: [copyButton] }) }));
|
|
60
59
|
}
|
|
61
60
|
else {
|
|
62
|
-
return
|
|
61
|
+
return null;
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
//# sourceMappingURL=FeatureInfoWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,SAAS,oBAAoB,CAAC,EAAU;IACtC,MAAM,aAAa,GAAG,sBAAsB,EAAE,CAAC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AY,EAAE,YAAY,CAAC,OAAO,EAClC,WAAW,EAAE,WAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,0BAA0B,EACtD,sBAAsB,CAAC,yFAAyF;wBAChH,qBAAqB,EAAE,CAAC,UAAU,CAAC,GACnC,GACE,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport \"./FeatureInfoWidget.scss\";\nimport * as React from \"react\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { Orientation, VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\n\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { CopyActionButton } from \"./CopyActionButton\";\nimport { FeatureInfoDataProvider } from \"./FeatureInfoDataProvider\";\n\nimport type { PrimitiveValue } from \"@itwin/appui-abstract\";\nimport type { ActionButtonRendererProps } from \"@itwin/components-react\";\n\nfunction useSpecificWidgetDef(id: string) {\n const frontstageDef = useActiveFrontstageDef();\n return frontstageDef?.findWidgetDef(id);\n}\n\n/**\n * Props for {@link MapFeatureInfoWidget}.\n */\ninterface MapFeatureInfoWidgetProps {\n /** The widget that will be shown/hidden based on feature info data availability. */\n widgetId: string;\n /** Enables property selection support in the property grid when set. */\n isPropertySelectionEnabled?: boolean;\n /** Invoked when feature info data availability changes. */\n onDataChanged?: (hasData: boolean) => void;\n /**\n * Optional copy handler used by the copy action button.\n * When omitted, the component copies values using the browser clipboard API.\n */\n onCopy?: (value: string) => Promise<void> | void;\n}\n\n/**\n * Displays map feature info in a virtualized property grid and keeps the\n * owning widget open/hidden based on whether records are available.\n *\n * @param props - Widget configuration and callbacks.\n * @returns The feature info property grid UI, or `null` when no records are available.\n */\nexport function MapFeatureInfoWidget({ widgetId, isPropertySelectionEnabled, onDataChanged, onCopy }: MapFeatureInfoWidgetProps) {\n const dataProvider = React.useRef<FeatureInfoDataProvider | null>(null);\n const [hasData, setHasData] = React.useState(false);\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const widgetDef = useSpecificWidgetDef(widgetId);\n const handleDataChanged = React.useCallback(() => {\n const dataAvailable = dataProvider.current !== null && dataProvider.current.hasRecords;\n setHasData(dataAvailable);\n if (widgetDef) {\n widgetDef.setWidgetState(dataAvailable ? WidgetState.Open : WidgetState.Hidden);\n }\n onDataChanged?.(dataAvailable);\n }, [widgetDef, onDataChanged]);\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 const [elementRef] = useResizeObserver<HTMLDivElement>((size) => {\n handleResize(size.width, size.height);\n });\n\n const copyButton = React.useCallback(\n (props: ActionButtonRendererProps) =>\n props.isPropertyHovered && (\n <div>\n <CopyActionButton value={props.property.value ? (props.property.value as PrimitiveValue).displayValue ?? \"\" : \"\"} onCopy={onCopy} />\n </div>\n ),\n [onCopy],\n );\n\n if (hasData && dataProvider.current) {\n return (\n <div ref={elementRef} className=\"feature-info-widget-container\">\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={isPropertySelectionEnabled}\n isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered\n actionButtonRenderers={[copyButton]}\n />\n </div>\n );\n } else {\n return null;\n }\n}\n"]}
|
|
@@ -130,7 +130,10 @@
|
|
|
130
130
|
},
|
|
131
131
|
"FeatureInfoWidget": {
|
|
132
132
|
"Label": "Map Layers Info",
|
|
133
|
-
"NoRecords": "No Results"
|
|
133
|
+
"NoRecords": "No Results",
|
|
134
|
+
"Copy": "Copy",
|
|
135
|
+
"Copied": "Copied!",
|
|
136
|
+
"CopyFailed": "Copy failed"
|
|
134
137
|
},
|
|
135
138
|
"LayerMenu": {
|
|
136
139
|
"Detach": "Detach",
|