@itwin/map-layers 6.0.0-dev.1 → 6.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ui/hooks/useCrossOriginPopup.d.ts +7 -0
- package/lib/cjs/ui/hooks/useCrossOriginPopup.d.ts.map +1 -0
- package/lib/cjs/ui/hooks/useCrossOriginPopup.js +123 -0
- package/lib/cjs/ui/hooks/useCrossOriginPopup.js.map +1 -0
- package/lib/cjs/ui/hooks/useInterval.d.ts +7 -0
- package/lib/cjs/ui/hooks/useInterval.d.ts.map +1 -0
- package/lib/cjs/ui/hooks/useInterval.js +60 -0
- package/lib/cjs/ui/hooks/useInterval.js.map +1 -0
- package/lib/cjs/ui/hooks/useResizeObserver.d.ts +2 -0
- package/lib/cjs/ui/hooks/useResizeObserver.d.ts.map +1 -0
- package/lib/cjs/ui/hooks/useResizeObserver.js +66 -0
- package/lib/cjs/ui/hooks/useResizeObserver.js.map +1 -0
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +7 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +5 -4
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +2 -2
- package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.js +8 -6
- package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +2 -3
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +9 -11
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/ui/hooks/useCrossOriginPopup.d.ts +7 -0
- package/lib/esm/ui/hooks/useCrossOriginPopup.d.ts.map +1 -0
- package/lib/esm/ui/hooks/useCrossOriginPopup.js +96 -0
- package/lib/esm/ui/hooks/useCrossOriginPopup.js.map +1 -0
- package/lib/esm/ui/hooks/useInterval.d.ts +7 -0
- package/lib/esm/ui/hooks/useInterval.d.ts.map +1 -0
- package/lib/esm/ui/hooks/useInterval.js +33 -0
- package/lib/esm/ui/hooks/useInterval.js.map +1 -0
- package/lib/esm/ui/hooks/useResizeObserver.d.ts +2 -0
- package/lib/esm/ui/hooks/useResizeObserver.d.ts.map +1 -0
- package/lib/esm/ui/hooks/useResizeObserver.js +39 -0
- package/lib/esm/ui/hooks/useResizeObserver.js.map +1 -0
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +7 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +5 -4
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +2 -2
- package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.js +9 -7
- package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +1 -2
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +10 -12
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/package.json +43 -81
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Hook that will show a popup window
|
|
2
|
+
* @internal
|
|
3
|
+
* Reference: https://github.com/iTwin/appui/commit/b8c0ac6eec4b8f1551cde3b7913df135ccd0f4f5
|
|
4
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useCrossOriginPopup.tsx
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCrossOriginPopup(visible: boolean, url: string | undefined, title: string, width: number, height: number, onClose: () => void): void;
|
|
7
|
+
//# sourceMappingURL=useCrossOriginPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCrossOriginPopup.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useCrossOriginPopup.tsx"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,IAAI,QAsGpB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useCrossOriginPopup = void 0;
|
|
27
|
+
/*---------------------------------------------------------------------------------------------
|
|
28
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
+
*--------------------------------------------------------------------------------------------*/
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
const useInterval_1 = require("./useInterval");
|
|
33
|
+
/** Hook that will show a popup window
|
|
34
|
+
* @internal
|
|
35
|
+
* Reference: https://github.com/iTwin/appui/commit/b8c0ac6eec4b8f1551cde3b7913df135ccd0f4f5
|
|
36
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useCrossOriginPopup.tsx
|
|
37
|
+
*/
|
|
38
|
+
function useCrossOriginPopup(visible, url, title, width, height, onClose) {
|
|
39
|
+
const [checkPopupAliveDelay, setCheckPopupAliveDelay] = React.useState();
|
|
40
|
+
// ONLY re-render the popup when visibility changes, any other changes get deferred until next visibility change
|
|
41
|
+
// hence the massive use of 'useRef'
|
|
42
|
+
const popupWindow = React.useRef();
|
|
43
|
+
const savedUrl = React.useRef(url);
|
|
44
|
+
const savedTitle = React.useRef(title);
|
|
45
|
+
const savedWidth = React.useRef(width);
|
|
46
|
+
const savedHeight = React.useRef(height);
|
|
47
|
+
const savedOnClose = React.useRef(onClose);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
savedUrl.current = url;
|
|
50
|
+
}, [url]);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
savedTitle.current = title;
|
|
53
|
+
}, [title]);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
savedWidth.current = width;
|
|
56
|
+
}, [width]);
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
savedHeight.current = height;
|
|
59
|
+
}, [height]);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
savedOnClose.current = onClose;
|
|
62
|
+
}, [onClose]);
|
|
63
|
+
// Cleanup method after a popup closure. Also calls the OnClose callback.
|
|
64
|
+
const handleClosedPopup = React.useCallback(() => {
|
|
65
|
+
savedOnClose.current();
|
|
66
|
+
setCheckPopupAliveDelay(undefined);
|
|
67
|
+
popupWindow.current = undefined;
|
|
68
|
+
}, []);
|
|
69
|
+
const closePopup = React.useCallback(() => {
|
|
70
|
+
if (popupWindow.current !== undefined) {
|
|
71
|
+
popupWindow.current.close(); // Manually close the popup
|
|
72
|
+
handleClosedPopup();
|
|
73
|
+
}
|
|
74
|
+
}, [handleClosedPopup]);
|
|
75
|
+
const checkPopupClosed = React.useCallback(() => {
|
|
76
|
+
if (popupWindow.current?.closed) {
|
|
77
|
+
// Popup has been closed by end-user, inform our host and cleanup
|
|
78
|
+
handleClosedPopup();
|
|
79
|
+
}
|
|
80
|
+
}, [handleClosedPopup]);
|
|
81
|
+
// Close popup when parent window get closed
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
window.onbeforeunload = (_event) => {
|
|
84
|
+
closePopup();
|
|
85
|
+
};
|
|
86
|
+
return () => {
|
|
87
|
+
window.onbeforeunload = null;
|
|
88
|
+
};
|
|
89
|
+
}, [closePopup]);
|
|
90
|
+
// Whenever the hook is unloaded, make sure the underlying popup get closed.
|
|
91
|
+
// Note: An interval is used to check if popup was closed by user: because we access
|
|
92
|
+
// a cross domain resource inside the popup, we don't have access to popup window events.
|
|
93
|
+
// As a workaround, we periodically check if popup is still alive.
|
|
94
|
+
// Reference: https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
|
|
95
|
+
React.useEffect(() => {
|
|
96
|
+
return () => {
|
|
97
|
+
closePopup();
|
|
98
|
+
};
|
|
99
|
+
}, [closePopup]);
|
|
100
|
+
// Timer that checks if popup was closed by end-user
|
|
101
|
+
(0, useInterval_1.useInterval)(checkPopupClosed, checkPopupAliveDelay);
|
|
102
|
+
// ==> Main render effect
|
|
103
|
+
// Monitors visibility changes and open/close the popup accordingly.
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
// If visible and a popup window is not already open, open a new popup window
|
|
106
|
+
if (visible && popupWindow.current === undefined) {
|
|
107
|
+
const popup = window.open(savedUrl.current, savedTitle.current, `width=${savedWidth.current},height=${savedHeight.current}`);
|
|
108
|
+
if (popup) {
|
|
109
|
+
popup.focus();
|
|
110
|
+
popupWindow.current = popup;
|
|
111
|
+
// Start and interval that will check if popup got closed by user
|
|
112
|
+
setCheckPopupAliveDelay(1000);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// If not visible but a previous popup window is still open, close it.
|
|
116
|
+
if (!visible && popupWindow.current !== undefined) {
|
|
117
|
+
popupWindow.current.close();
|
|
118
|
+
handleClosedPopup();
|
|
119
|
+
}
|
|
120
|
+
}, [handleClosedPopup, visible]);
|
|
121
|
+
}
|
|
122
|
+
exports.useCrossOriginPopup = useCrossOriginPopup;
|
|
123
|
+
//# sourceMappingURL=useCrossOriginPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCrossOriginPopup.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useCrossOriginPopup.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAC/B,+CAA4C;AAE5C;;;;GAIG;AACH,SAAgB,mBAAmB,CACjC,OAAgB,EAChB,GAAuB,EACvB,KAAa,E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W,EAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;IAEpD,yBAAyB;IACzB,oEAAoE;IACpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,6EAA6E;QAC7E,IAAI,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CACvB,QAAQ,CAAC,OAAO,EAChB,UAAU,CAAC,OAAO,EAClB,SAAS,UAAU,CAAC,OAAO,WAAW,WAAW,CAAC,OAAO,EAAE,CAC5D,CAAC;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;gBAE5B,iEAAiE;gBACjE,uBAAuB,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,sEAAsE;QACtE,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClD,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAE5B,iBAAiB,EAAE,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AA5GD,kDA4GC","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 { useInterval } from \"./useInterval\";\n\n/** Hook that will show a popup window\n * @internal\n * Reference: https://github.com/iTwin/appui/commit/b8c0ac6eec4b8f1551cde3b7913df135ccd0f4f5\n * Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useCrossOriginPopup.tsx\n */\nexport function useCrossOriginPopup(\n visible: boolean,\n url: string | undefined,\n title: string,\n width: number,\n height: number,\n onClose: () => void\n) {\n const [checkPopupAliveDelay, setCheckPopupAliveDelay] = React.useState<\n number | undefined\n >();\n\n // ONLY re-render the popup when visibility changes, any other changes get deferred until next visibility change\n // hence the massive use of 'useRef'\n const popupWindow = React.useRef<Window>();\n const savedUrl = React.useRef(url);\n const savedTitle = React.useRef(title);\n const savedWidth = React.useRef(width);\n const savedHeight = React.useRef(height);\n const savedOnClose = React.useRef(onClose);\n\n React.useEffect(() => {\n savedUrl.current = url;\n }, [url]);\n React.useEffect(() => {\n savedTitle.current = title;\n }, [title]);\n React.useEffect(() => {\n savedWidth.current = width;\n }, [width]);\n React.useEffect(() => {\n savedHeight.current = height;\n }, [height]);\n React.useEffect(() => {\n savedOnClose.current = onClose;\n }, [onClose]);\n\n // Cleanup method after a popup closure. Also calls the OnClose callback.\n const handleClosedPopup = React.useCallback(() => {\n savedOnClose.current();\n setCheckPopupAliveDelay(undefined);\n popupWindow.current = undefined;\n }, []);\n\n const closePopup = React.useCallback(() => {\n if (popupWindow.current !== undefined) {\n popupWindow.current.close(); // Manually close the popup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n const checkPopupClosed = React.useCallback(() => {\n if (popupWindow.current?.closed) {\n // Popup has been closed by end-user, inform our host and cleanup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n // Close popup when parent window get closed\n React.useEffect(() => {\n window.onbeforeunload = (_event) => {\n closePopup();\n };\n return () => {\n window.onbeforeunload = null;\n };\n }, [closePopup]);\n\n // Whenever the hook is unloaded, make sure the underlying popup get closed.\n // Note: An interval is used to check if popup was closed by user: because we access\n // a cross domain resource inside the popup, we don't have access to popup window events.\n // As a workaround, we periodically check if popup is still alive.\n // Reference: https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128\n React.useEffect(() => {\n return () => {\n closePopup();\n };\n }, [closePopup]);\n\n // Timer that checks if popup was closed by end-user\n useInterval(checkPopupClosed, checkPopupAliveDelay);\n\n // ==> Main render effect\n // Monitors visibility changes and open/close the popup accordingly.\n React.useEffect(() => {\n // If visible and a popup window is not already open, open a new popup window\n if (visible && popupWindow.current === undefined) {\n const popup = window.open(\n savedUrl.current,\n savedTitle.current,\n `width=${savedWidth.current},height=${savedHeight.current}`\n );\n if (popup) {\n popup.focus();\n popupWindow.current = popup;\n\n // Start and interval that will check if popup got closed by user\n setCheckPopupAliveDelay(1000);\n }\n }\n\n // If not visible but a previous popup window is still open, close it.\n if (!visible && popupWindow.current !== undefined) {\n popupWindow.current.close();\n\n handleClosedPopup();\n }\n }, [handleClosedPopup, visible]);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Hook that create an interval and clears it when unloaded
|
|
2
|
+
* Reference: https://github.com/gaearon/overreacted.io/blob/master/src/pages/making-setinterval-declarative-with-react-hooks/index.md
|
|
3
|
+
* @internal
|
|
4
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useInterval.tsx
|
|
5
|
+
*/
|
|
6
|
+
export declare function useInterval(callback: (...args: any[]) => void, delay: number | undefined): void;
|
|
7
|
+
//# sourceMappingURL=useInterval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useInterval.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAClC,KAAK,EAAE,MAAM,GAAG,SAAS,QAuB1B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useInterval = void 0;
|
|
27
|
+
/*---------------------------------------------------------------------------------------------
|
|
28
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
+
*--------------------------------------------------------------------------------------------*/
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
/** Hook that create an interval and clears it when unloaded
|
|
33
|
+
* Reference: https://github.com/gaearon/overreacted.io/blob/master/src/pages/making-setinterval-declarative-with-react-hooks/index.md
|
|
34
|
+
* @internal
|
|
35
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useInterval.tsx
|
|
36
|
+
*/
|
|
37
|
+
function useInterval(callback, delay) {
|
|
38
|
+
const savedCallback = React.useRef(callback);
|
|
39
|
+
// Remember the latest function.
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
savedCallback.current = callback;
|
|
42
|
+
}, [callback]);
|
|
43
|
+
// Set up the interval.
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
function tick() {
|
|
46
|
+
savedCallback.current();
|
|
47
|
+
}
|
|
48
|
+
if (delay !== undefined) {
|
|
49
|
+
const id = setInterval(tick, delay);
|
|
50
|
+
return () => {
|
|
51
|
+
clearInterval(id);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}, [delay]);
|
|
58
|
+
}
|
|
59
|
+
exports.useInterval = useInterval;
|
|
60
|
+
//# sourceMappingURL=useInterval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInterval.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useInterval.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAE/B;;;;GAIG;AACH,SAAgB,WAAW,CACzB,QAAkC,EAClC,KAAyB;IAEzB,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA2B,QAAQ,CAAC,CAAC;IAEvE,gCAAgC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;IACnC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,uBAAuB;IACvB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,IAAI;YACX,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACpC,OAAO,GAAG,EAAE;gBACV,aAAa,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC;AAzBD,kCAyBC","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\n/** Hook that create an interval and clears it when unloaded\n * Reference: https://github.com/gaearon/overreacted.io/blob/master/src/pages/making-setinterval-declarative-with-react-hooks/index.md\n * @internal\n * Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useInterval.tsx\n */\nexport function useInterval(\n callback: (...args: any[]) => void,\n delay: number | undefined\n) {\n const savedCallback = React.useRef<(...args: any[]) => void>(callback);\n\n // Remember the latest function.\n React.useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n React.useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== undefined) {\n const id = setInterval(tick, delay);\n return () => {\n clearInterval(id);\n };\n } else {\n return undefined;\n }\n }, [delay]);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB,oCAClB,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,yBAK7B,CAAC,GAAG,IAAI,GAAG,SAAS,sCA2BjC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useResizeObserver = void 0;
|
|
27
|
+
/*---------------------------------------------------------------------------------------------
|
|
28
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
+
*--------------------------------------------------------------------------------------------*/
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
/** Hook that will observe Window Resize
|
|
33
|
+
* @internal
|
|
34
|
+
* Reference: https://github.com/iTwin/iTwinUI/blob/87bbc99316c17bd2b763a730135fbb45c84b0e82/packages/itwinui-react/src/utils/hooks/useResizeObserver.tsx
|
|
35
|
+
* Copied from: https://github.com/iTwin/appui/blob/master/ui/core-react/src/core-react/utils/hooks/useResizeObserver.tsx
|
|
36
|
+
*/
|
|
37
|
+
const getWindow = () => {
|
|
38
|
+
return typeof window === "undefined" ? undefined : window;
|
|
39
|
+
};
|
|
40
|
+
const useResizeObserver = (onResize) => {
|
|
41
|
+
const resizeObserver = React.useRef();
|
|
42
|
+
const elementRef = React.useCallback((element) => {
|
|
43
|
+
if (!getWindow()?.ResizeObserver) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
resizeObserver.current?.disconnect?.();
|
|
47
|
+
if (element) {
|
|
48
|
+
resizeObserver.current = new ResizeObserver((entries) => {
|
|
49
|
+
// We wrap onResize with requestAnimationFrame to avoid this error - ResizeObserver loop limit exceeded
|
|
50
|
+
// See: https://github.com/iTwin/iTwinUI/issues/1317
|
|
51
|
+
// See: https://stackoverflow.com/a/58701523/11547064
|
|
52
|
+
window.requestAnimationFrame(() => {
|
|
53
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const [{ contentRect }] = entries;
|
|
57
|
+
return onResize(contentRect);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
resizeObserver.current?.observe?.(element);
|
|
61
|
+
}
|
|
62
|
+
}, [onResize]);
|
|
63
|
+
return [elementRef, resizeObserver.current];
|
|
64
|
+
};
|
|
65
|
+
exports.useResizeObserver = useResizeObserver;
|
|
66
|
+
//# sourceMappingURL=useResizeObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../src/ui/hooks/useResizeObserver.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAE/B;;;;GAIG;AACH,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEK,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\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 */\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AA8gBA,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;AAChB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAsGxE"}
|
|
@@ -351,7 +351,13 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick, se
|
|
|
351
351
|
onHandleOutsideClick(false);
|
|
352
352
|
}
|
|
353
353
|
}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, mapLayerOptions, onHandleOutsideClick, setMapUrlModalOpen, sources]);
|
|
354
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "map-manager-header", children: [(loading || loadingSources) && ((0, jsx_runtime_1.jsx)(
|
|
354
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "map-manager-header", children: [(loading || loadingSources) && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
355
|
+
position: "absolute",
|
|
356
|
+
inset: 0,
|
|
357
|
+
display: "grid",
|
|
358
|
+
placeItems: "center",
|
|
359
|
+
zIndex: 100,
|
|
360
|
+
}, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.ProgressRadial, { as: "div", children: (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { variant: 'small', children: loadingMapSources }) }) })), (0, jsx_runtime_1.jsxs)("div", { className: "map-manager-source-listbox-header", children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: sourceFilterString, onChange: handleFilterTextChanged, size: "small" }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { className: "map-manager-add-source-button", title: addCustomLayerToolTip, onClick: handleAddNewMapSource, children: addCustomLayerLabel })] }), (0, jsx_runtime_1.jsx)("div", { className: "map-manager-sources", children: (0, jsx_runtime_1.jsx)(itwinui_react_1.List, { id: "map-sources", as: "div", className: "map-manager-source-list", children: filteredOptions?.map((source) => ((0, jsx_runtime_1.jsxs)(itwinui_react_1.ListItem, { as: "div", className: "map-source-list-entry", actionable: true, onClick: () => handleAttach(source.name), onMouseEnter: () => setLayerNameUnderCursor(source.name), onMouseLeave: () => setLayerNameUnderCursor(undefined), children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.ListItem.Content, { children: source.name }),
|
|
355
361
|
// Display the delete icon only when the mouse over a specific item
|
|
356
362
|
// otherwise list feels cluttered.
|
|
357
363
|
!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: editLayerDefButtonTitle, onClick: onItemEditButtonClicked, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgEdit, {}) }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: removeLayerDefButtonTitle, onClick: (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAC/B,oDAAiD;AACjD,wDAAoI;AACpI,oEAAwE;AACxE,wDAAgH;AAChH,mEAAgE;AAChE,+CAA8C;AAC9C,iEAA8D;AAC9D,uDAAwD;AACxD,uEAAoE;AACpE,iDAA8C;AAK9C,mCAAmC;AAEnC,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,2CAAG,CAAA;IACH,6CAAI,CAAA;AACN,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AASD,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAwB;IACtH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IACjF,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IAEzF,MAAM,EACJ,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,GAC1B,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrB,OAAO;YACL,gBAAgB,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0CAA0C,CAAC;YACzG,mBAAmB,EAA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AAG,CACP,uBAAC,sBAAM,IACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EAC9D,OAAO,EAAE,WAAW,YAEnB,yBAAyB,GACnB,CACV,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL,2DACE,uBAAC,uBAAO,IACN,OAAO,EACL,gCAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB,YACrD,uBAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,GAAI,GACvK,EAER,eAAe,QACf,OAAO,EAAE,SAAS,IAAI,eAAe,EACrC,eAAe,EAAE,YAAY,EAC7B,mBAAmB,EAAE,kBAAkB,EACvC,SAAS,EAAE,YAAY,YAEtB,YAAY,EAAE,GACP,GACT,CACJ,CAAC;AACJ,CAAC;AAtGD,wDAsGC","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 { UiFramework } from \"@itwin/appui-react\";\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { SvgAdd, SvgDelete, SvgEdit } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, Input, List, ListItem, Popover, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\n\nimport type { MapSubLayerProps } from \"@itwin/core-common\";\nimport type { MapLayerSourceValidation } from \"@itwin/core-frontend\";\nimport type { SourceState } from \"./MapUrlDialog\";\n// cSpell:ignore droppable Sublayer\n\nenum LayerAction {\n New,\n Edit,\n}\n\ninterface AttachLayerPanelProps {\n isOverlay: boolean;\n onLayerAttached: () => void;\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\n setMapUrlModalOpen: (open: boolean) => void;\n}\n\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick, setMapUrlModalOpen}: AttachLayerPanelProps) {\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\n\n const {\n placeholderLabel,\n addCustomLayerLabel,\n addCustomLayerToolTip,\n loadingMapSources,\n removeLayerDefButtonTitle,\n editLayerDefButtonTitle,\n removeLayerDefDialogTitle,\n } = React.useMemo(() => {\n return {\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\n };\n }, []);\n\n const [loading, setLoading] = React.useState(false);\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\n\n const resumeOutsideClick = React.useCallback(() => {\n if (onHandleOutsideClick) {\n onHandleOutsideClick(true);\n }\n }, [onHandleOutsideClick]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n\n // We close any open dialogs that we might have opened\n // This was added because the modal dialog remained remained displayed after the session expired.\n UiFramework.dialogs.modal.close();\n };\n }, []);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setSourceFilterString(event.target.value);\n }, []);\n\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\n const iTwinId = activeViewport?.iModel?.iTwinId;\n const iModelId = activeViewport?.iModel?.iModelId;\n\n const attachLayer = React.useCallback(\n (source: MapLayerSource, subLayers: MapSubLayerProps[] | undefined, oneMapLayerPerSubLayer: boolean) => {\n if (activeViewport) {\n const generateUniqueMapLayerName = (layerName: string) => {\n let uniqueLayerName = layerName;\n let layerNameIdx = 1;\n while (\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name)) ||\n (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name))\n ) {\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\n }\n return { layerNameUpdate: layerNameIdx > 1, uniqueLayerName };\n };\n\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\n const generatedName = generateUniqueMapLayerName(layerName);\n let sourceToAdd = source;\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\n // create a source with a unique name\n const clonedSource = MapLayerSource.fromJSON({ ...source.toJSON(), name: generatedName.uniqueLayerName });\n if (clonedSource !== undefined) {\n clonedSource.userName = source.userName;\n clonedSource.password = source.password;\n clonedSource.unsavedQueryParams = { ...source.unsavedQueryParams };\n clonedSource.savedQueryParams = { ...source.savedQueryParams };\n sourceToAdd = clonedSource;\n }\n }\n\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\n if (settings) {\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });\n return generatedName.uniqueLayerName;\n }\n return undefined;\n };\n\n if (oneMapLayerPerSubLayer && subLayers) {\n const layerNamesAttached: string[] = [];\n for (const subLayer of subLayers) {\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\n if (attachedLayerName !== undefined) {\n layerNamesAttached.push(attachedLayerName);\n }\n }\n\n if (layerNamesAttached.length > 0) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n } else {\n const attachedLayerName = doAttachLayer(source.name, undefined);\n if (attachedLayerName !== undefined) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n }\n\n if (isMounted.current) {\n setLoading(false);\n }\n }\n if (isMounted.current) {\n onLayerAttached();\n resumeOutsideClick();\n }\n },\n [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick],\n );\n\n const handleSelectFeaturesCancel = React.useCallback(() => {\n if (isMounted.current) {\n setLoading(false);\n }\n resumeOutsideClick();\n UiFramework.dialogs.modal.close();\n }, [resumeOutsideClick, setLoading]);\n\n const handleSelectFeaturesOk = React.useCallback(\n (source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[]) => {\n // keep only visible subLayers\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\n\n // Re-apply default visibility from the source validation\n visibleSubLayers.forEach((visible) => {\n const found = sourceSubLayers.find((value) => {\n visible.name === value.name;\n });\n if (found) {\n visible.visible = found?.visible;\n }\n });\n attachLayer(source, visibleSubLayers, true);\n },\n [attachLayer],\n );\n\n const openFeatureSelectionDialog = React.useCallback(\n (subLayers: MapSubLayerProps[], source: MapLayerSource) => {\n // Keep leafs sub-layers and force default visibility to false\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {\n return { ...value, visible: false };\n });\n UiFramework.dialogs.modal.open(\n <MapSelectFeaturesDialog\n handleOk={(selectedLayers) => {\n handleSelectFeaturesOk(source, subLayers, selectedLayers);\n }}\n handleCancel={handleSelectFeaturesCancel}\n source={source}\n subLayers={visibleLayers}\n />,\n );\n },\n [handleSelectFeaturesCancel, handleSelectFeaturesOk],\n );\n\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation) => {\n return (\n (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") && // TODO, replace this with a flag in MapLayerSourceStatus\n validation.subLayers &&\n validation.subLayers.length > 1\n );\n }, []);\n\n const handleModalUrlDialogOk = React.useCallback(\n (action: LayerAction, sourceState?: SourceState) => {\n setMapUrlModalOpen(false);\n UiFramework.dialogs.modal.close();\n if (LayerAction.New === action && sourceState && sourceState.validation.status === MapLayerSourceStatus.Valid) {\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\n } else {\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\n }\n } else {\n resumeOutsideClick();\n }\n },\n [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick, setMapUrlModalOpen],\n );\n\n const handleModalUrlDialogCancel = React.useCallback(() => {\n // close popup and refresh UI\n setLoading(false);\n setMapUrlModalOpen(false);\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n }, [setLoading, resumeOutsideClick, setMapUrlModalOpen]);\n\n React.useEffect(() => {\n async function attemptToAddLayer() {\n if (layerNameToAdd && activeViewport) {\n // if the layer is not in the style add it now.\n const foundSource = sources?.find((source) => source.name === layerNameToAdd);\n if (foundSource === undefined) {\n return;\n }\n\n try {\n if (isMounted.current) {\n setLoading(true);\n }\n\n const sourceValidation = await foundSource.validateSource();\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\n if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {\n openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n } else {\n attachLayer(foundSource, sourceValidation.subLayers, false);\n }\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\n const layer = foundSource.toLayerSettings();\n if (layer) {\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n signInModeArgs={{ layer, validation: sourceValidation, source: foundSource }}\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n }\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n }\n } else {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: foundSource.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n if (isMounted.current) {\n setLoading(false);\n }\n }\n } catch (err) {\n if (isMounted.current) {\n setLoading(false);\n }\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: foundSource.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n return;\n }\n\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\n\n if (isMounted.current) {\n setLayerNameToAdd(undefined);\n }\n }, [\n attachLayer,\n needsFeatureSelection,\n setLayerNameToAdd,\n layerNameToAdd,\n activeViewport,\n sources,\n backgroundLayers,\n isOverlay,\n overlayLayers,\n onLayerAttached,\n handleModalUrlDialogOk,\n handleSelectFeaturesCancel,\n handleSelectFeaturesOk,\n handleModalUrlDialogCancel,\n onHandleOutsideClick,\n openFeatureSelectionDialog,\n mapLayerOptions,\n setMapUrlModalOpen,\n ]);\n\n const options = React.useMemo(() => sources, [sources]);\n\n const filteredOptions = React.useMemo(() => {\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\n return options;\n } else {\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\n }\n }, [options, sourceFilterString]);\n\n const handleAddNewMapSource = React.useCallback((event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, mapLayerOptions, onHandleOutsideClick, setMapUrlModalOpen]);\n\n const handleAttach = React.useCallback((mapName: string) => {\n setLayerNameToAdd(mapName);\n }, []);\n\n const handleNoConfirmation = React.useCallback(\n (_layerName: string) => {\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [resumeOutsideClick],\n );\n\n const handleYesConfirmation = React.useCallback(\n async (source: MapLayerSource) => {\n const layerName = source.name;\n if (!!iTwinId) {\n try {\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n } catch {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [iTwinId, iModelId, resumeOutsideClick],\n );\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback(\n (source: MapLayerSource, event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n\n const layerName = source.name;\n\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\n UiFramework.dialogs.modal.open(\n <ConfirmMessageDialog\n className=\"map-sources-delete-confirmation\"\n title={removeLayerDefDialogTitle}\n message={msg}\n maxWidth={400}\n opened\n onYesResult={async () => handleYesConfirmation(source)}\n onNoResult={() => handleNoConfirmation(layerName)}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle],\n );\n\n /*\n Handle Edit layer button clicked\n */\n const onItemEditButtonClicked = React.useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n const targetLayerName = (event?.currentTarget?.parentNode as HTMLElement)?.textContent;\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\n\n // we expect a single layer source matching this name\n if (matchingSource === undefined) {\n return;\n }\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n mapLayerSourceToEdit={matchingSource}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, mapLayerOptions, onHandleOutsideClick,setMapUrlModalOpen, sources],\n );\n\n return (\n <div className=\"map-manager-header\">\n {(loading || loadingSources) && (\n <ProgressRadial as=\"div\">\n <Text variant='small'>{loadingMapSources}</Text>\n </ProgressRadial>\n )}\n <div className=\"map-manager-source-listbox-header\">\n <Input\n type=\"text\"\n className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={sourceFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\"\n />\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\n {addCustomLayerLabel}\n </Button>\n </div>\n <div className=\"map-manager-sources\">\n <List\n id=\"map-sources\"\n as=\"div\"\n className=\"map-manager-source-list\"\n >\n {filteredOptions?.map((source) => (\n <ListItem\n as=\"div\"\n key={source.name}\n className=\"map-source-list-entry\"\n actionable\n onClick={() => handleAttach(source.name)}\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}\n >\n <ListItem.Content>{source.name}</ListItem.Content>\n {\n // Display the delete icon only when the mouse over a specific item\n // otherwise list feels cluttered.\n !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && (\n <>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={editLayerDefButtonTitle}\n onClick={onItemEditButtonClicked}\n >\n <SvgEdit />\n </Button>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={removeLayerDefButtonTitle}\n onClick={(event: React.MouseEvent) => {\n onItemRemoveButtonClicked(source, event);\n }}\n >\n <SvgDelete />\n </Button>\n </>\n )\n }\n </ListItem>\n ))}\n </List>\n </div>\n </div>\n );\n}\n\n/** @internal */\nexport enum AttachLayerButtonType {\n Primary,\n Blue,\n Icon,\n}\nexport interface AttachLayerPopupButtonProps {\n isOverlay: boolean;\n buttonType?: AttachLayerButtonType;\n disabled?: boolean;\n}\n\n/** @internal */\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\n return {\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\n };\n }, []);\n\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\n const [mapUrlModalOpen, setMapUrlModalOpen] = React.useState(false);\n const [popupOpen, setPopupOpen] = React.useState(false);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setPopupOpen(!popupOpen);\n }, [popupOpen]);\n\n\n const { refreshFromStyle } = useSourceMapContext();\n\n const handleLayerAttached = React.useCallback(() => {\n if (!isMounted.current) {\n return;\n }\n setPopupOpen(false);\n refreshFromStyle();\n }, [refreshFromStyle]);\n\n function renderButton(): React.ReactNode {\n let button: React.ReactNode;\n\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\n button = (\n <IconButton\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n ref={buttonRef}\n className=\"map-manager-attach-layer-button\"\n label={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n <SvgAdd />\n </IconButton>\n );\n } else {\n const determineStyleType = () => {\n switch (props.buttonType) {\n case AttachLayerButtonType.Blue:\n return \"high-visibility\";\n case AttachLayerButtonType.Primary:\n default:\n return \"cta\";\n }\n };\n const styleType = determineStyleType();\n button = (\n <Button\n disabled={props.disabled}\n ref={buttonRef}\n styleType={styleType}\n title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n {addCustomLayerButtonLabel}\n </Button>\n );\n }\n\n return button;\n }\n\n return (\n <>\n <Popover\n content={\n <div ref={panelRef} className=\"map-sources-popup-panel\">\n <AttachLayerPanel isOverlay={props.isOverlay} onLayerAttached={handleLayerAttached} onHandleOutsideClick={setHandleOutsideClick} setMapUrlModalOpen={setMapUrlModalOpen} />\n </div>\n }\n applyBackground\n visible={popupOpen || mapUrlModalOpen} // keep the Popover open while the mapUrlModal is active\n onVisibleChange={setPopupOpen}\n closeOnOutsideClick={handleOutsideClick}\n placement={\"bottom-end\"}\n >\n {renderButton()}\n </Popover>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAC/B,oDAAiD;AACjD,wDAAoI;AACpI,oEAAwE;AACxE,wDAAgH;AAChH,mEAAgE;AAChE,+CAA8C;AAC9C,iEAA8D;AAC9D,uDAAwD;AACxD,uEAAoE;AACpE,iDAA8C;AAK9C,mCAAmC;AAEnC,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,2CAAG,CAAA;IACH,6CAAI,CAAA;AACN,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AASD,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAwB;IACtH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK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GACP,GACT,CACJ,CAAC;AACJ,CAAC;AAtGD,wDAsGC","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 { UiFramework } from \"@itwin/appui-react\";\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { SvgAdd, SvgDelete, SvgEdit } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, Input, List, ListItem, Popover, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\n\nimport type { MapSubLayerProps } from \"@itwin/core-common\";\nimport type { MapLayerSourceValidation } from \"@itwin/core-frontend\";\nimport type { SourceState } from \"./MapUrlDialog\";\n// cSpell:ignore droppable Sublayer\n\nenum LayerAction {\n New,\n Edit,\n}\n\ninterface AttachLayerPanelProps {\n isOverlay: boolean;\n onLayerAttached: () => void;\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\n setMapUrlModalOpen: (open: boolean) => void;\n}\n\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick, setMapUrlModalOpen}: AttachLayerPanelProps) {\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\n\n const {\n placeholderLabel,\n addCustomLayerLabel,\n addCustomLayerToolTip,\n loadingMapSources,\n removeLayerDefButtonTitle,\n editLayerDefButtonTitle,\n removeLayerDefDialogTitle,\n } = React.useMemo(() => {\n return {\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\n };\n }, []);\n\n const [loading, setLoading] = React.useState(false);\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\n\n const resumeOutsideClick = React.useCallback(() => {\n if (onHandleOutsideClick) {\n onHandleOutsideClick(true);\n }\n }, [onHandleOutsideClick]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n\n // We close any open dialogs that we might have opened\n // This was added because the modal dialog remained remained displayed after the session expired.\n UiFramework.dialogs.modal.close();\n };\n }, []);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setSourceFilterString(event.target.value);\n }, []);\n\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\n const iTwinId = activeViewport?.iModel?.iTwinId;\n const iModelId = activeViewport?.iModel?.iModelId;\n\n const attachLayer = React.useCallback(\n (source: MapLayerSource, subLayers: MapSubLayerProps[] | undefined, oneMapLayerPerSubLayer: boolean) => {\n if (activeViewport) {\n const generateUniqueMapLayerName = (layerName: string) => {\n let uniqueLayerName = layerName;\n let layerNameIdx = 1;\n while (\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name)) ||\n (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name))\n ) {\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\n }\n return { layerNameUpdate: layerNameIdx > 1, uniqueLayerName };\n };\n\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\n const generatedName = generateUniqueMapLayerName(layerName);\n let sourceToAdd = source;\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\n // create a source with a unique name\n const clonedSource = MapLayerSource.fromJSON({ ...source.toJSON(), name: generatedName.uniqueLayerName });\n if (clonedSource !== undefined) {\n clonedSource.userName = source.userName;\n clonedSource.password = source.password;\n clonedSource.unsavedQueryParams = { ...source.unsavedQueryParams };\n clonedSource.savedQueryParams = { ...source.savedQueryParams };\n sourceToAdd = clonedSource;\n }\n }\n\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\n if (settings) {\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });\n return generatedName.uniqueLayerName;\n }\n return undefined;\n };\n\n if (oneMapLayerPerSubLayer && subLayers) {\n const layerNamesAttached: string[] = [];\n for (const subLayer of subLayers) {\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\n if (attachedLayerName !== undefined) {\n layerNamesAttached.push(attachedLayerName);\n }\n }\n\n if (layerNamesAttached.length > 0) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n } else {\n const attachedLayerName = doAttachLayer(source.name, undefined);\n if (attachedLayerName !== undefined) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n }\n\n if (isMounted.current) {\n setLoading(false);\n }\n }\n if (isMounted.current) {\n onLayerAttached();\n resumeOutsideClick();\n }\n },\n [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick],\n );\n\n const handleSelectFeaturesCancel = React.useCallback(() => {\n if (isMounted.current) {\n setLoading(false);\n }\n resumeOutsideClick();\n UiFramework.dialogs.modal.close();\n }, [resumeOutsideClick, setLoading]);\n\n const handleSelectFeaturesOk = React.useCallback(\n (source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[]) => {\n // keep only visible subLayers\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\n\n // Re-apply default visibility from the source validation\n visibleSubLayers.forEach((visible) => {\n const found = sourceSubLayers.find((value) => {\n visible.name === value.name;\n });\n if (found) {\n visible.visible = found?.visible;\n }\n });\n attachLayer(source, visibleSubLayers, true);\n },\n [attachLayer],\n );\n\n const openFeatureSelectionDialog = React.useCallback(\n (subLayers: MapSubLayerProps[], source: MapLayerSource) => {\n // Keep leafs sub-layers and force default visibility to false\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {\n return { ...value, visible: false };\n });\n UiFramework.dialogs.modal.open(\n <MapSelectFeaturesDialog\n handleOk={(selectedLayers) => {\n handleSelectFeaturesOk(source, subLayers, selectedLayers);\n }}\n handleCancel={handleSelectFeaturesCancel}\n source={source}\n subLayers={visibleLayers}\n />,\n );\n },\n [handleSelectFeaturesCancel, handleSelectFeaturesOk],\n );\n\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation) => {\n return (\n (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") && // TODO, replace this with a flag in MapLayerSourceStatus\n validation.subLayers &&\n validation.subLayers.length > 1\n );\n }, []);\n\n const handleModalUrlDialogOk = React.useCallback(\n (action: LayerAction, sourceState?: SourceState) => {\n setMapUrlModalOpen(false);\n UiFramework.dialogs.modal.close();\n if (LayerAction.New === action && sourceState && sourceState.validation.status === MapLayerSourceStatus.Valid) {\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\n } else {\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\n }\n } else {\n resumeOutsideClick();\n }\n },\n [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick, setMapUrlModalOpen],\n );\n\n const handleModalUrlDialogCancel = React.useCallback(() => {\n // close popup and refresh UI\n setLoading(false);\n setMapUrlModalOpen(false);\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n }, [setLoading, resumeOutsideClick, setMapUrlModalOpen]);\n\n React.useEffect(() => {\n async function attemptToAddLayer() {\n if (layerNameToAdd && activeViewport) {\n // if the layer is not in the style add it now.\n const foundSource = sources?.find((source) => source.name === layerNameToAdd);\n if (foundSource === undefined) {\n return;\n }\n\n try {\n if (isMounted.current) {\n setLoading(true);\n }\n\n const sourceValidation = await foundSource.validateSource();\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\n if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {\n openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n } else {\n attachLayer(foundSource, sourceValidation.subLayers, false);\n }\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\n const layer = foundSource.toLayerSettings();\n if (layer) {\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n signInModeArgs={{ layer, validation: sourceValidation, source: foundSource }}\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n }\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n }\n } else {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: foundSource.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n if (isMounted.current) {\n setLoading(false);\n }\n }\n } catch (err) {\n if (isMounted.current) {\n setLoading(false);\n }\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: foundSource.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n return;\n }\n\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\n\n if (isMounted.current) {\n setLayerNameToAdd(undefined);\n }\n }, [\n attachLayer,\n needsFeatureSelection,\n setLayerNameToAdd,\n layerNameToAdd,\n activeViewport,\n sources,\n backgroundLayers,\n isOverlay,\n overlayLayers,\n onLayerAttached,\n handleModalUrlDialogOk,\n handleSelectFeaturesCancel,\n handleSelectFeaturesOk,\n handleModalUrlDialogCancel,\n onHandleOutsideClick,\n openFeatureSelectionDialog,\n mapLayerOptions,\n setMapUrlModalOpen,\n ]);\n\n const options = React.useMemo(() => sources, [sources]);\n\n const filteredOptions = React.useMemo(() => {\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\n return options;\n } else {\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\n }\n }, [options, sourceFilterString]);\n\n const handleAddNewMapSource = React.useCallback((event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n}, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, mapLayerOptions, onHandleOutsideClick, setMapUrlModalOpen]);\n\n const handleAttach = React.useCallback((mapName: string) => {\n setLayerNameToAdd(mapName);\n }, []);\n\n const handleNoConfirmation = React.useCallback(\n (_layerName: string) => {\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [resumeOutsideClick],\n );\n\n const handleYesConfirmation = React.useCallback(\n async (source: MapLayerSource) => {\n const layerName = source.name;\n if (!!iTwinId) {\n try {\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n } catch {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [iTwinId, iModelId, resumeOutsideClick],\n );\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback(\n (source: MapLayerSource, event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n\n const layerName = source.name;\n\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\n UiFramework.dialogs.modal.open(\n <ConfirmMessageDialog\n className=\"map-sources-delete-confirmation\"\n title={removeLayerDefDialogTitle}\n message={msg}\n maxWidth={400}\n opened\n onYesResult={async () => handleYesConfirmation(source)}\n onNoResult={() => handleNoConfirmation(layerName)}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle],\n );\n\n /*\n Handle Edit layer button clicked\n */\n const onItemEditButtonClicked = React.useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n const targetLayerName = (event?.currentTarget?.parentNode as HTMLElement)?.textContent;\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\n\n // we expect a single layer source matching this name\n if (matchingSource === undefined) {\n return;\n }\n setMapUrlModalOpen(true);\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n mapLayerSourceToEdit={matchingSource}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, mapLayerOptions, onHandleOutsideClick,setMapUrlModalOpen, sources],\n );\n\n return (\n <div className=\"map-manager-header\">\n {(loading || loadingSources) && (\n <div style={{\n position: \"absolute\",\n inset: 0,\n display: \"grid\",\n placeItems: \"center\",\n zIndex: 100,\n }}>\n <ProgressRadial as=\"div\">\n <Text variant='small'>{loadingMapSources}</Text>\n </ProgressRadial>\n </div>\n )}\n <div className=\"map-manager-source-listbox-header\">\n <Input\n type=\"text\"\n className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={sourceFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\"\n />\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\n {addCustomLayerLabel}\n </Button>\n </div>\n <div className=\"map-manager-sources\">\n <List\n id=\"map-sources\"\n as=\"div\"\n className=\"map-manager-source-list\"\n >\n {filteredOptions?.map((source) => (\n <ListItem\n as=\"div\"\n key={source.name}\n className=\"map-source-list-entry\"\n actionable\n onClick={() => handleAttach(source.name)}\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}\n >\n <ListItem.Content>{source.name}</ListItem.Content>\n {\n // Display the delete icon only when the mouse over a specific item\n // otherwise list feels cluttered.\n !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && (\n <>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={editLayerDefButtonTitle}\n onClick={onItemEditButtonClicked}\n >\n <SvgEdit />\n </Button>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={removeLayerDefButtonTitle}\n onClick={(event: React.MouseEvent) => {\n onItemRemoveButtonClicked(source, event);\n }}\n >\n <SvgDelete />\n </Button>\n </>\n )\n }\n </ListItem>\n ))}\n </List>\n </div>\n </div>\n );\n}\n\n/** @internal */\nexport enum AttachLayerButtonType {\n Primary,\n Blue,\n Icon,\n}\nexport interface AttachLayerPopupButtonProps {\n isOverlay: boolean;\n buttonType?: AttachLayerButtonType;\n disabled?: boolean;\n}\n\n/** @internal */\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\n return {\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\n };\n }, []);\n\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\n const [mapUrlModalOpen, setMapUrlModalOpen] = React.useState(false);\n const [popupOpen, setPopupOpen] = React.useState(false);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setPopupOpen(!popupOpen);\n }, [popupOpen]);\n\n\n const { refreshFromStyle } = useSourceMapContext();\n\n const handleLayerAttached = React.useCallback(() => {\n if (!isMounted.current) {\n return;\n }\n setPopupOpen(false);\n refreshFromStyle();\n }, [refreshFromStyle]);\n\n function renderButton(): React.ReactNode {\n let button: React.ReactNode;\n\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\n button = (\n <IconButton\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n ref={buttonRef}\n className=\"map-manager-attach-layer-button\"\n label={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n <SvgAdd />\n </IconButton>\n );\n } else {\n const determineStyleType = () => {\n switch (props.buttonType) {\n case AttachLayerButtonType.Blue:\n return \"high-visibility\";\n case AttachLayerButtonType.Primary:\n default:\n return \"cta\";\n }\n };\n const styleType = determineStyleType();\n button = (\n <Button\n disabled={props.disabled}\n ref={buttonRef}\n styleType={styleType}\n title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n {addCustomLayerButtonLabel}\n </Button>\n );\n }\n\n return button;\n }\n\n return (\n <>\n <Popover\n content={\n <div ref={panelRef} className=\"map-sources-popup-panel\">\n <AttachLayerPanel isOverlay={props.isOverlay} onLayerAttached={handleLayerAttached} onHandleOutsideClick={setHandleOutsideClick} setMapUrlModalOpen={setMapUrlModalOpen} />\n </div>\n }\n applyBackground\n visible={popupOpen || mapUrlModalOpen} // keep the Popover open while the mapUrlModal is active\n onVisibleChange={setPopupOpen}\n closeOnOutsideClick={handleOutsideClick}\n placement={\"bottom-end\"}\n >\n {renderButton()}\n </Popover>\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,sDAG9C;AAGD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAED,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,sDAG9C;AAGD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAED,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,2CAmFlF"}
|
|
@@ -32,12 +32,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
32
32
|
const React = __importStar(require("react"));
|
|
33
33
|
const appui_react_1 = require("@itwin/appui-react");
|
|
34
34
|
const components_react_1 = require("@itwin/components-react");
|
|
35
|
-
const core_react_1 = require("@itwin/core-react");
|
|
36
35
|
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
37
36
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
38
37
|
const mapLayers_1 = require("../../mapLayers");
|
|
39
38
|
const FeatureInfoUiItemsProvider_1 = require("../FeatureInfoUiItemsProvider");
|
|
40
39
|
const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
|
|
40
|
+
const useResizeObserver_1 = require("../hooks/useResizeObserver");
|
|
41
41
|
function useSpecificWidgetDef(id) {
|
|
42
42
|
const frontstageDef = (0, appui_react_1.useActiveFrontstageDef)();
|
|
43
43
|
return frontstageDef?.findWidgetDef(id);
|
|
@@ -71,6 +71,9 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
|
|
|
71
71
|
const handleResize = React.useCallback((w, h) => {
|
|
72
72
|
setSize({ width: w, height: h });
|
|
73
73
|
}, []);
|
|
74
|
+
const [elementRef] = (0, useResizeObserver_1.useResizeObserver)((size) => {
|
|
75
|
+
handleResize(size.width, size.height);
|
|
76
|
+
});
|
|
74
77
|
const copyButton = React.useCallback((props) => props.isPropertyHovered && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { styleType: "borderless", label: "Copy", onClick: () => {
|
|
75
78
|
const value = props.property.value;
|
|
76
79
|
if (value !== undefined && value.hasOwnProperty("displayValue")) {
|
|
@@ -78,9 +81,7 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
|
|
|
78
81
|
}
|
|
79
82
|
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCopy, {}) }) })), []);
|
|
80
83
|
if (hasData && dataProvider.current) {
|
|
81
|
-
return (
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
83
|
-
(0, jsx_runtime_1.jsx)(core_react_1.ResizableContainerObserver, { onResize: handleResize, children: (0, jsx_runtime_1.jsx)(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: components_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled, isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: elementRef, children: (0, jsx_runtime_1.jsx)(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: components_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled, isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered
|
|
84
85
|
: true, actionButtonRenderers: [copyButton] }) }));
|
|
85
86
|
}
|
|
86
87
|
else {
|