@itwin/appui-react 4.6.1 → 4.6.2
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 +8 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -0
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +17 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/popup/PopupManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/popup/PopupManager.js +2 -0
- package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -0
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +17 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/popup/PopupManager.d.ts.map +1 -1
- package/lib/esm/appui-react/popup/PopupManager.js +2 -0
- package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @itwin/appui-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 17 Oct 2023 19:16:23 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.6.2
|
|
6
|
+
Tue, 17 Oct 2023 19:16:23 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Unmount childWindowManager whenever window is closed
|
|
4
11
|
|
|
5
12
|
## 4.6.1
|
|
6
13
|
Thu, 12 Oct 2023 16:59:20 GMT
|
|
@@ -18,6 +18,7 @@ export type CreateRoot = Parameters<FrameworkChildWindows["useCreateRoot"]>[0];
|
|
|
18
18
|
export declare class InternalChildWindowManager implements FrameworkChildWindows {
|
|
19
19
|
private _openChildWindows;
|
|
20
20
|
private _createRoot?;
|
|
21
|
+
private _roots;
|
|
21
22
|
get openChildWindows(): OpenChildWindowInfo[];
|
|
22
23
|
/**
|
|
23
24
|
* When using React18, the `createRoot` function must be provided in order to render Popout content with React18.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAyB5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;
|
|
1
|
+
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAyB5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IAEI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IAEH,OAAO,CAAC,MAAM;IAoBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAU3E,OAAO,CAAC,yBAAyB;IA0DjC,gGAAgG;IACzF,QAAQ;IAQf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAgBnC;IAGF,OAAO,CAAC,mBAAmB;IAc3B;;;;;;;;OAQG;IAEI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CAuDhC"}
|
|
@@ -50,6 +50,7 @@ const childHtml = `<!DOCTYPE html>
|
|
|
50
50
|
class InternalChildWindowManager {
|
|
51
51
|
constructor() {
|
|
52
52
|
this._openChildWindows = [];
|
|
53
|
+
this._roots = {};
|
|
53
54
|
/**
|
|
54
55
|
* Close a specific child window.
|
|
55
56
|
* @param childWindowId Id of the window to close
|
|
@@ -97,8 +98,15 @@ class InternalChildWindowManager {
|
|
|
97
98
|
*/
|
|
98
99
|
// istanbul ignore next: Used in `open` which is not tested.
|
|
99
100
|
render(element, container) {
|
|
101
|
+
// If createRoot is passed in for React 18 we have to render differently
|
|
102
|
+
// than without it. React 17 vs React 18. We need to save the root to
|
|
103
|
+
// unmount it.
|
|
100
104
|
if (this._createRoot) {
|
|
101
|
-
|
|
105
|
+
const childWindowId = UiFramework_1.UiFramework.childWindows.findId(container.ownerDocument.defaultView);
|
|
106
|
+
if (childWindowId) {
|
|
107
|
+
this._roots[childWindowId] = this._createRoot(container);
|
|
108
|
+
this._roots[childWindowId].render(element);
|
|
109
|
+
}
|
|
102
110
|
}
|
|
103
111
|
else {
|
|
104
112
|
ReactDOM.render(element, container);
|
|
@@ -156,6 +164,14 @@ class InternalChildWindowManager {
|
|
|
156
164
|
return;
|
|
157
165
|
frontStageDef.saveChildWindowSizeAndPosition(childWindowId, childWindow);
|
|
158
166
|
this.close(childWindowId, false);
|
|
167
|
+
// UnmountComponentAtNode is deprecated in React 18, so if they are
|
|
168
|
+
// using React 18 and passing in a createRoot function, unmount()
|
|
169
|
+
// will be used
|
|
170
|
+
if (this._roots[childWindowId]) {
|
|
171
|
+
this._roots[childWindowId].unmount();
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
ReactDOM.unmountComponentAtNode(reactConnectionDiv);
|
|
159
175
|
});
|
|
160
176
|
}
|
|
161
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,6CAA2C;AAC3C,+BAA+B;AAC/B,sCAAsC;AACtC,6CAA0C;AAC1C,6CAAuC;AACvC,oEAAqE;AACrE,wDAAsD;AACtD,2EAAyE;AACzE,qEAAmE;AACnE,gEAAkE;AAClE,wDAAqD;AACrD,gDAA6C;AAO7C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAa,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAiItD;;;;;WAKG;QACI,UAAK,GAAG,CAAC,aAAqB,EAAE,kBAAkB,GAAG,IAAI,EAAE,EAAE;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB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CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,KAAK,aAAa,CAC3D,IAAI,CAAC,EACN;YACA,OAAO,KAAK,CAAC;SACd;QAED,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAC7B,GAAG,EACH,EAAE,EACF,SAAS,QAAQ,CAAC,KAAK,WAAW,QAAQ,CAAC,MAAM,SAAS,QAAQ,CAAC,IAAI,QAAQ,QAAQ,CAAC,GAAG,+DAA+D,CAC3J,CAAC;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,EAAE;YACpB,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;SACH;aAAM;YACL,WAAW,CAAC,gBAAgB,CAC1B,MAAM,EACN,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;SACH;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACjC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/OD,gEA+OC","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { Provider } from \"react-redux\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiFramework } from \"../UiFramework\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body class=\"iui-root\">\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React18, the `createRoot` function must be provided in order to render Popout content with React18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to react 18 is complete.\n */\n // istanbul ignore next: Result of this assignment is only visible in `open`, which is not tested.\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n // istanbul ignore next: Used in `open` which is not tested.\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n if (this._createRoot) {\n this._createRoot(container).render(element);\n } else {\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n // istanbul ignore next: Used in `open` which is not tested.\n private renderChildWindowContents(\n childWindow: Window,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(\n <Provider store={UiFramework.store}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n </ThemeManager>\n </UiStateStorageHandler>\n </Provider>,\n reactConnectionDiv\n );\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n this.close(childWindowId, false);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n // istanbul ignore next\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true)\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (-1 === windowIndex) return false;\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef &&\n frontStageDef.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n // istanbul ignore next: Used in `open` which is not tested.\n private adjustWidowLocation(\n location: ChildWindowLocationProps\n ): ChildWindowLocationProps {\n const outLocation = { ...location };\n if (0 === location.top && 0 === location.left) {\n // If no location is provided, prepare position of the new window to be centered against the current window.\n outLocation.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n outLocation.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n return outLocation;\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n // istanbul ignore next: Would require mocking window.open to return a window object.\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n // first check to see if content is already open in child window\n if (\n this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n ) >= 0\n ) {\n return false;\n }\n\n location = this.adjustWidowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n if (0 === url.length) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"load\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,6CAA2C;AAC3C,+BAA+B;AAC/B,sCAAsC;AACtC,6CAA0C;AAC1C,6CAAuC;AACvC,oEAAqE;AACrE,wDAAsD;AACtD,2EAAyE;AACzE,qEAAmE;AACnE,gEAAkE;AAClE,wDAAqD;AACrD,gDAA6C;AAO7C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAa,0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C,KAAK,GAAG,CAAC,MAAM,EAAE;YACpB,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;SACH;aAAM;YACL,WAAW,CAAC,gBAAgB,CAC1B,MAAM,EACN,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;SACH;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACjC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/PD,gEA+PC","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { Provider } from \"react-redux\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiFramework } from \"../UiFramework\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body class=\"iui-root\">\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React18, the `createRoot` function must be provided in order to render Popout content with React18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to react 18 is complete.\n */\n // istanbul ignore next: Result of this assignment is only visible in `open`, which is not tested.\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n // istanbul ignore next: Used in `open` which is not tested.\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n // istanbul ignore next: Used in `open` which is not tested.\n private renderChildWindowContents(\n childWindow: Window,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(\n <Provider store={UiFramework.store}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n </ThemeManager>\n </UiStateStorageHandler>\n </Provider>,\n reactConnectionDiv\n );\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n this.close(childWindowId, false);\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n // istanbul ignore next\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true)\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (-1 === windowIndex) return false;\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef &&\n frontStageDef.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n // istanbul ignore next: Used in `open` which is not tested.\n private adjustWidowLocation(\n location: ChildWindowLocationProps\n ): ChildWindowLocationProps {\n const outLocation = { ...location };\n if (0 === location.top && 0 === location.left) {\n // If no location is provided, prepare position of the new window to be centered against the current window.\n outLocation.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n outLocation.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n return outLocation;\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n // istanbul ignore next: Would require mocking window.open to return a window object.\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n // first check to see if content is already open in child window\n if (\n this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n ) >= 0\n ) {\n return false;\n }\n\n location = this.adjustWidowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n if (0 === url.length) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"load\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/popup/PopupManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EAEV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EAEd,OAAO,EACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAW9D;;GAEG;AACH,M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component {
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
componentDidMount() {
|
|
241
|
+
core_bentley_1.Logger.logInfo("PopupManager", `mounting PopupManager`);
|
|
241
242
|
PopupManager.onPopupsChangedEvent.addListener(this._handlePopupsChangedEvent);
|
|
242
243
|
}
|
|
243
244
|
componentWillUnmount() {
|
|
245
|
+
core_bentley_1.Logger.logInfo("PopupManager", `un-mounting PopupManager`);
|
|
244
246
|
PopupManager.onPopupsChangedEvent.removeListener(this._handlePopupsChangedEvent);
|
|
245
247
|
}
|
|
246
248
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":["../../../../src/appui-react/popup/PopupManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,sDAA6C;AAa7C,0DAI+B;AAE/B,kDAA2D;AAC3D,kEAAwE;AAExE,gDAA6C;AAC7C,2CAAwC;AACxC,yDAAsD;AACtD,yDAAgF;AAChF,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAwD;AAmBxD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAA+B;CAAG;AAA1E,gDAA0E;AAwB1E;;GAEG;AACI,MAAM,cAAc,GAAG,CAC5B,OAAyB,EACA,EAAE;IAC3B,OAAQ,OAAwB,CAAC,SAAS,KAAK,SAAS,CAAC;AAC3D,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB;AAEF;;GAEG;AACH,MAAa,YAAY;IAahB,MAAM,KAAK,UAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IACM,MAAM,KAAK,MAAM;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,MAAM,KAAK,MAAM,CAAC,MAAgC;QACvD,qBAAqB;QACrB,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM;YAAE,OAAO;QACpC,IAAI,CAAC,OAA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AAE,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;iBACnE,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;gBAC5B,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAC9B,SAAS,CAAC,SAAS,CACL,CAClB,CAAC;YACJ,CAAC,CAAC,CACF,CACP,CAAC;IACJ,CAAC;CAKF;AAhDD,sCAgDC","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/** @packageDocumentation\n * @module Popup\n */\n\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type {\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnValueCommitFunc,\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n RelativePosition,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyRecord,\n PropertyValueFormat,\n UiEvent,\n} from \"@itwin/appui-abstract\";\nimport type { Point, SizeProps } from \"@itwin/core-react\";\nimport { Orientation, Rectangle } from \"@itwin/core-react\";\nimport { offsetAndContainInContainer } from \"@itwin/appui-layout-react\";\nimport type { KeyinEntry } from \"../uiadmin/FrameworkUiAdmin\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CardPopup } from \"./CardPopup\";\nimport { HTMLElementPopup } from \"./HTMLElementPopup\";\nimport { InputEditorCommitHandler, InputEditorPopup } from \"./InputEditorPopup\";\nimport { KeyinPalettePopup } from \"./KeyinPalettePopup\";\nimport { ToolbarPopup } from \"./ToolbarPopup\";\nimport { ToolSettingsPopup } from \"./ToolSettingsPopup\";\n\n// cSpell:ignore uiadmin\n\n/** Information maintained by PopupManager about a Popup\n * @public\n */\nexport interface PopupInfo {\n id: string;\n pt: XAndY;\n component: React.ReactNode;\n parentDocument: Document;\n}\n\n/** @public */\nexport interface PopupsChangedEventArgs {\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popups Changed Event class.\n * @public\n */\nexport class PopupsChangedEvent extends UiEvent<PopupsChangedEventArgs> {}\n\n/** Props for each popup managed by the PopupManager\n * @public\n */\nexport interface PopupPropsBase {\n id: string;\n el: HTMLElement;\n pt: XAndY;\n offset: XAndY;\n}\n\n/** Describes React based content\n * @public\n */\nexport interface ReactContent {\n reactNode: React.ReactNode;\n}\n\n/** Type for Popup Content\n * @public\n */\nexport type PopupContentType = HTMLElement | ReactContent;\n\n/** ReactContent type guard.\n * @internal\n */\nexport const isReactContent = (\n content: PopupContentType\n): content is ReactContent => {\n return (content as ReactContent).reactNode !== undefined;\n};\n\n/** Popup Manager class\n * @public\n */\nexport class PopupManager {\n private static _popups: ReadonlyArray<PopupInfo> = [];\n private static _editorId = \"InputEditor\";\n private static _toolbarId = \"Toolbar\";\n private static _htmlElementId = \"HTMLElement\";\n private static _cardId = \"Card\";\n private static _toolSettingsId = \"ToolSettings\";\n private static _keyPalettePopupId = \"KeyinPalette\";\n\n private static _defaultOffset = { x: 8, y: 8 };\n\n public static readonly onPopupsChangedEvent = new PopupsChangedEvent();\n\n public static get popupCount() {\n return this._popups.length;\n }\n public static get popups() {\n return this._popups;\n }\n\n public static set popups(popups: ReadonlyArray<PopupInfo>) {\n // istanbul ignore if\n if (this._popups === popups) return;\n this._popups = popups;\n this.onPopupsChangedEvent.emit({ popups });\n }\n\n /** @internal */\n public static clearPopups() {\n this.popups = [];\n }\n\n private static addPopup(popupInfo: PopupInfo): void {\n const popups = [...PopupManager._popups, popupInfo];\n this.popups = popups;\n }\n\n private static updatePopup(popupInfo: PopupInfo, itemIndex: number): void {\n // istanbul ignore if\n if (itemIndex < 0) return;\n\n const popups = [\n ...PopupManager._popups.slice(0, itemIndex),\n popupInfo,\n ...PopupManager._popups.slice(itemIndex + 1),\n ];\n this.popups = popups;\n }\n\n public static addOrUpdatePopup(popupInfo: PopupInfo): void {\n const itemIndex = PopupManager._popups.findIndex(\n (info: PopupInfo) => info.id === popupInfo.id\n );\n if (itemIndex >= 0) PopupManager.updatePopup(popupInfo, itemIndex);\n else PopupManager.addPopup(popupInfo);\n }\n\n public static removePopup(id: string): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => id === info.id\n );\n let result = true;\n\n if (index >= 0) {\n const popups = PopupManager._popups.filter((info: PopupInfo) => {\n return info.id !== id;\n });\n this.popups = popups;\n } else {\n Logger.logError(\n UiFramework.loggerCategory(this),\n `removePopup: Could not find popup with id of '${id}'`\n );\n result = false;\n }\n\n return result;\n }\n\n public static get defaultOffset(): XAndY {\n return PopupManager._defaultOffset;\n }\n public static set defaultOffset(offset: XAndY) {\n PopupManager._defaultOffset = offset;\n }\n\n public static showInputEditor(\n el: HTMLElement,\n pt: XAndY,\n value: Primitives.Value,\n propertyDescription: PropertyDescription,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc\n ): boolean {\n const primitiveValue: PrimitiveValue = {\n value,\n valueFormat: PropertyValueFormat.Primitive,\n };\n const record = new PropertyRecord(primitiveValue, propertyDescription);\n const commitHandler = new InputEditorCommitHandler(onCommit);\n const id = PopupManager._editorId;\n const component = (\n <InputEditorPopup\n id={id}\n el={el}\n pt={pt}\n offset={PopupManager.defaultOffset}\n record={record}\n onCancel={onCancel}\n commitHandler={commitHandler}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideInputEditor(): boolean {\n return PopupManager.removePopup(PopupManager._editorId);\n }\n\n public static showKeyinPalette(\n keyins: KeyinEntry[],\n el: HTMLElement,\n onItemExecuted?: OnItemExecutedFunc,\n onCancel?: OnCancelFunc\n ): boolean {\n const id = PopupManager._keyPalettePopupId;\n const component = (\n <KeyinPalettePopup\n keyins={keyins}\n id={id}\n el={el}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n // since the command palette popup is always at top center of specified HTML element and it does not need to move like\n // cursor popups just set pt to 0,0.\n const pt = { x: 0, y: 0 };\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideKeyinPalette(): boolean {\n return PopupManager.removePopup(PopupManager._keyPalettePopupId);\n }\n\n public static showToolbar(\n toolbarProps: AbstractToolbarProps,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolbarId;\n const component = (\n <ToolbarPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n items={toolbarProps.items}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideToolbar(): boolean {\n return PopupManager.removePopup(PopupManager._toolbarId);\n }\n\n public static showHTMLElement(\n displayElement: HTMLElement,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._htmlElementId;\n const component = (\n <HTMLElementPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n element={displayElement}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideHTMLElement(): boolean {\n return PopupManager.removePopup(PopupManager._htmlElementId);\n }\n\n public static showCard(\n content: PopupContentType,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._cardId;\n const component = (\n <CardPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n content={content}\n title={title}\n items={\n toolbarProps\n ? toolbarProps.items\n : /* istanbul ignore next */ undefined\n }\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideCard(): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => PopupManager._cardId === info.id\n );\n if (index >= 0) return PopupManager.removePopup(PopupManager._cardId);\n return false;\n }\n\n public static openToolSettings(\n dataProvider: DialogLayoutDataProvider,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolSettingsId;\n const component = (\n <ToolSettingsPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n dataProvider={dataProvider}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static closeToolSettings(): boolean {\n return PopupManager.removePopup(PopupManager._toolSettingsId);\n }\n\n public static getPopupPosition(\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n size: SizeProps\n ): Point {\n const containerBounds = Rectangle.create(el.getBoundingClientRect());\n const relativeBounds = Rectangle.createFromSize(size).offset(pt);\n const adjustedPosition: Point = offsetAndContainInContainer(\n relativeBounds,\n containerBounds.getSize(),\n offset\n );\n const position = adjustedPosition.offset(containerBounds.topLeft());\n\n return position;\n }\n}\n\n/** @internal */\ninterface PopupRendererState {\n parentDocument: Document | null;\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popup Renderer\n * @public\n */\nexport class PopupRenderer extends React.Component<{}, PopupRendererState> {\n /** @internal */\n public override readonly state: PopupRendererState = {\n parentDocument: null,\n popups: PopupManager.popups,\n };\n\n public override componentDidMount(): void {\n PopupManager.onPopupsChangedEvent.addListener(\n this._handlePopupsChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n PopupManager.onPopupsChangedEvent.removeListener(\n this._handlePopupsChangedEvent\n );\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n this.setState({ parentDocument: popupDiv?.ownerDocument ?? null });\n };\n\n public override render(): React.ReactNode {\n if (PopupManager.popupCount <= 0) return null;\n\n return (\n <div\n className=\"appui-react-popup-render-container\"\n ref={this._handleRefSet}\n >\n {this.state.parentDocument &&\n this.state.popups\n .filter((info) => info.parentDocument === this.state.parentDocument)\n .map((popupInfo: PopupInfo) => {\n return (\n <React.Fragment key={popupInfo.id}>\n {popupInfo.component}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n\n private _handlePopupsChangedEvent = (args: PopupsChangedEventArgs) => {\n this.setState({ popups: args.popups });\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":["../../../../src/appui-react/popup/PopupManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,sDAA6C;AAa7C,0DAI+B;AAE/B,kDAA2D;AAC3D,kEAAwE;AAExE,gDAA6C;AAC7C,2CAAwC;AACxC,yDAAsD;AACtD,yDAAgF;AAChF,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAwD;AAmBxD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAA+B;CAA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J,CAAC;IA3CiB,iBAAiB;QAC/B,qBAAM,CAAC,OAAO,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;QACxD,YAAY,CAAC,oBAAoB,CAAC,WAAW,CAC3C,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;IAEe,oBAAoB;QAClC,qBAAM,CAAC,OAAO,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAC;QAC3D,YAAY,CAAC,oBAAoB,CAAC,cAAc,CAC9C,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;IAMe,MAAM;QACpB,IAAI,YAAY,CAAC,UAAU,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAE9C,OAAO,CACL,6BACE,SAAS,EAAC,oCAAoC,EAC9C,GAAG,EAAE,IAAI,CAAC,aAAa,IAEtB,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,IAAI,CAAC,KAAK,CAAC,MAAM;iBACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;iBACnE,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;gBAC5B,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAC9B,SAAS,CAAC,SAAS,CACL,CAClB,CAAC;YACJ,CAAC,CAAC,CACF,CACP,CAAC;IACJ,CAAC;CAKF;AAlDD,sCAkDC","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/** @packageDocumentation\n * @module Popup\n */\n\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type {\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnValueCommitFunc,\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n RelativePosition,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyRecord,\n PropertyValueFormat,\n UiEvent,\n} from \"@itwin/appui-abstract\";\nimport type { Point, SizeProps } from \"@itwin/core-react\";\nimport { Orientation, Rectangle } from \"@itwin/core-react\";\nimport { offsetAndContainInContainer } from \"@itwin/appui-layout-react\";\nimport type { KeyinEntry } from \"../uiadmin/FrameworkUiAdmin\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CardPopup } from \"./CardPopup\";\nimport { HTMLElementPopup } from \"./HTMLElementPopup\";\nimport { InputEditorCommitHandler, InputEditorPopup } from \"./InputEditorPopup\";\nimport { KeyinPalettePopup } from \"./KeyinPalettePopup\";\nimport { ToolbarPopup } from \"./ToolbarPopup\";\nimport { ToolSettingsPopup } from \"./ToolSettingsPopup\";\n\n// cSpell:ignore uiadmin\n\n/** Information maintained by PopupManager about a Popup\n * @public\n */\nexport interface PopupInfo {\n id: string;\n pt: XAndY;\n component: React.ReactNode;\n parentDocument: Document;\n}\n\n/** @public */\nexport interface PopupsChangedEventArgs {\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popups Changed Event class.\n * @public\n */\nexport class PopupsChangedEvent extends UiEvent<PopupsChangedEventArgs> {}\n\n/** Props for each popup managed by the PopupManager\n * @public\n */\nexport interface PopupPropsBase {\n id: string;\n el: HTMLElement;\n pt: XAndY;\n offset: XAndY;\n}\n\n/** Describes React based content\n * @public\n */\nexport interface ReactContent {\n reactNode: React.ReactNode;\n}\n\n/** Type for Popup Content\n * @public\n */\nexport type PopupContentType = HTMLElement | ReactContent;\n\n/** ReactContent type guard.\n * @internal\n */\nexport const isReactContent = (\n content: PopupContentType\n): content is ReactContent => {\n return (content as ReactContent).reactNode !== undefined;\n};\n\n/** Popup Manager class\n * @public\n */\nexport class PopupManager {\n private static _popups: ReadonlyArray<PopupInfo> = [];\n private static _editorId = \"InputEditor\";\n private static _toolbarId = \"Toolbar\";\n private static _htmlElementId = \"HTMLElement\";\n private static _cardId = \"Card\";\n private static _toolSettingsId = \"ToolSettings\";\n private static _keyPalettePopupId = \"KeyinPalette\";\n\n private static _defaultOffset = { x: 8, y: 8 };\n\n public static readonly onPopupsChangedEvent = new PopupsChangedEvent();\n\n public static get popupCount() {\n return this._popups.length;\n }\n public static get popups() {\n return this._popups;\n }\n\n public static set popups(popups: ReadonlyArray<PopupInfo>) {\n // istanbul ignore if\n if (this._popups === popups) return;\n this._popups = popups;\n this.onPopupsChangedEvent.emit({ popups });\n }\n\n /** @internal */\n public static clearPopups() {\n this.popups = [];\n }\n\n private static addPopup(popupInfo: PopupInfo): void {\n const popups = [...PopupManager._popups, popupInfo];\n this.popups = popups;\n }\n\n private static updatePopup(popupInfo: PopupInfo, itemIndex: number): void {\n // istanbul ignore if\n if (itemIndex < 0) return;\n\n const popups = [\n ...PopupManager._popups.slice(0, itemIndex),\n popupInfo,\n ...PopupManager._popups.slice(itemIndex + 1),\n ];\n this.popups = popups;\n }\n\n public static addOrUpdatePopup(popupInfo: PopupInfo): void {\n const itemIndex = PopupManager._popups.findIndex(\n (info: PopupInfo) => info.id === popupInfo.id\n );\n if (itemIndex >= 0) PopupManager.updatePopup(popupInfo, itemIndex);\n else PopupManager.addPopup(popupInfo);\n }\n\n public static removePopup(id: string): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => id === info.id\n );\n let result = true;\n\n if (index >= 0) {\n const popups = PopupManager._popups.filter((info: PopupInfo) => {\n return info.id !== id;\n });\n this.popups = popups;\n } else {\n Logger.logError(\n UiFramework.loggerCategory(this),\n `removePopup: Could not find popup with id of '${id}'`\n );\n result = false;\n }\n\n return result;\n }\n\n public static get defaultOffset(): XAndY {\n return PopupManager._defaultOffset;\n }\n public static set defaultOffset(offset: XAndY) {\n PopupManager._defaultOffset = offset;\n }\n\n public static showInputEditor(\n el: HTMLElement,\n pt: XAndY,\n value: Primitives.Value,\n propertyDescription: PropertyDescription,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc\n ): boolean {\n const primitiveValue: PrimitiveValue = {\n value,\n valueFormat: PropertyValueFormat.Primitive,\n };\n const record = new PropertyRecord(primitiveValue, propertyDescription);\n const commitHandler = new InputEditorCommitHandler(onCommit);\n const id = PopupManager._editorId;\n const component = (\n <InputEditorPopup\n id={id}\n el={el}\n pt={pt}\n offset={PopupManager.defaultOffset}\n record={record}\n onCancel={onCancel}\n commitHandler={commitHandler}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideInputEditor(): boolean {\n return PopupManager.removePopup(PopupManager._editorId);\n }\n\n public static showKeyinPalette(\n keyins: KeyinEntry[],\n el: HTMLElement,\n onItemExecuted?: OnItemExecutedFunc,\n onCancel?: OnCancelFunc\n ): boolean {\n const id = PopupManager._keyPalettePopupId;\n const component = (\n <KeyinPalettePopup\n keyins={keyins}\n id={id}\n el={el}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n // since the command palette popup is always at top center of specified HTML element and it does not need to move like\n // cursor popups just set pt to 0,0.\n const pt = { x: 0, y: 0 };\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideKeyinPalette(): boolean {\n return PopupManager.removePopup(PopupManager._keyPalettePopupId);\n }\n\n public static showToolbar(\n toolbarProps: AbstractToolbarProps,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolbarId;\n const component = (\n <ToolbarPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n items={toolbarProps.items}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideToolbar(): boolean {\n return PopupManager.removePopup(PopupManager._toolbarId);\n }\n\n public static showHTMLElement(\n displayElement: HTMLElement,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._htmlElementId;\n const component = (\n <HTMLElementPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n element={displayElement}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideHTMLElement(): boolean {\n return PopupManager.removePopup(PopupManager._htmlElementId);\n }\n\n public static showCard(\n content: PopupContentType,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._cardId;\n const component = (\n <CardPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n content={content}\n title={title}\n items={\n toolbarProps\n ? toolbarProps.items\n : /* istanbul ignore next */ undefined\n }\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideCard(): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => PopupManager._cardId === info.id\n );\n if (index >= 0) return PopupManager.removePopup(PopupManager._cardId);\n return false;\n }\n\n public static openToolSettings(\n dataProvider: DialogLayoutDataProvider,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolSettingsId;\n const component = (\n <ToolSettingsPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n dataProvider={dataProvider}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static closeToolSettings(): boolean {\n return PopupManager.removePopup(PopupManager._toolSettingsId);\n }\n\n public static getPopupPosition(\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n size: SizeProps\n ): Point {\n const containerBounds = Rectangle.create(el.getBoundingClientRect());\n const relativeBounds = Rectangle.createFromSize(size).offset(pt);\n const adjustedPosition: Point = offsetAndContainInContainer(\n relativeBounds,\n containerBounds.getSize(),\n offset\n );\n const position = adjustedPosition.offset(containerBounds.topLeft());\n\n return position;\n }\n}\n\n/** @internal */\ninterface PopupRendererState {\n parentDocument: Document | null;\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popup Renderer\n * @public\n */\nexport class PopupRenderer extends React.Component<{}, PopupRendererState> {\n /** @internal */\n public override readonly state: PopupRendererState = {\n parentDocument: null,\n popups: PopupManager.popups,\n };\n\n public override componentDidMount(): void {\n Logger.logInfo(\"PopupManager\", `mounting PopupManager`);\n PopupManager.onPopupsChangedEvent.addListener(\n this._handlePopupsChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n Logger.logInfo(\"PopupManager\", `un-mounting PopupManager`);\n PopupManager.onPopupsChangedEvent.removeListener(\n this._handlePopupsChangedEvent\n );\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n this.setState({ parentDocument: popupDiv?.ownerDocument ?? null });\n };\n\n public override render(): React.ReactNode {\n if (PopupManager.popupCount <= 0) return null;\n\n return (\n <div\n className=\"appui-react-popup-render-container\"\n ref={this._handleRefSet}\n >\n {this.state.parentDocument &&\n this.state.popups\n .filter((info) => info.parentDocument === this.state.parentDocument)\n .map((popupInfo: PopupInfo) => {\n return (\n <React.Fragment key={popupInfo.id}>\n {popupInfo.component}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n\n private _handlePopupsChangedEvent = (args: PopupsChangedEventArgs) => {\n this.setState({ popups: args.popups });\n };\n}\n"]}
|
|
@@ -18,6 +18,7 @@ export type CreateRoot = Parameters<FrameworkChildWindows["useCreateRoot"]>[0];
|
|
|
18
18
|
export declare class InternalChildWindowManager implements FrameworkChildWindows {
|
|
19
19
|
private _openChildWindows;
|
|
20
20
|
private _createRoot?;
|
|
21
|
+
private _roots;
|
|
21
22
|
get openChildWindows(): OpenChildWindowInfo[];
|
|
22
23
|
/**
|
|
23
24
|
* When using React18, the `createRoot` function must be provided in order to render Popout content with React18.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAyB5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;
|
|
1
|
+
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAyB5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IAEI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IAEH,OAAO,CAAC,MAAM;IAoBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAU3E,OAAO,CAAC,yBAAyB;IA0DjC,gGAAgG;IACzF,QAAQ;IAQf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAgBnC;IAGF,OAAO,CAAC,mBAAmB;IAc3B;;;;;;;;OAQG;IAEI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CAuDhC"}
|
|
@@ -47,6 +47,7 @@ const childHtml = `<!DOCTYPE html>
|
|
|
47
47
|
export class InternalChildWindowManager {
|
|
48
48
|
constructor() {
|
|
49
49
|
this._openChildWindows = [];
|
|
50
|
+
this._roots = {};
|
|
50
51
|
/**
|
|
51
52
|
* Close a specific child window.
|
|
52
53
|
* @param childWindowId Id of the window to close
|
|
@@ -94,8 +95,15 @@ export class InternalChildWindowManager {
|
|
|
94
95
|
*/
|
|
95
96
|
// istanbul ignore next: Used in `open` which is not tested.
|
|
96
97
|
render(element, container) {
|
|
98
|
+
// If createRoot is passed in for React 18 we have to render differently
|
|
99
|
+
// than without it. React 17 vs React 18. We need to save the root to
|
|
100
|
+
// unmount it.
|
|
97
101
|
if (this._createRoot) {
|
|
98
|
-
|
|
102
|
+
const childWindowId = UiFramework.childWindows.findId(container.ownerDocument.defaultView);
|
|
103
|
+
if (childWindowId) {
|
|
104
|
+
this._roots[childWindowId] = this._createRoot(container);
|
|
105
|
+
this._roots[childWindowId].render(element);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
108
|
else {
|
|
101
109
|
ReactDOM.render(element, container);
|
|
@@ -153,6 +161,14 @@ export class InternalChildWindowManager {
|
|
|
153
161
|
return;
|
|
154
162
|
frontStageDef.saveChildWindowSizeAndPosition(childWindowId, childWindow);
|
|
155
163
|
this.close(childWindowId, false);
|
|
164
|
+
// UnmountComponentAtNode is deprecated in React 18, so if they are
|
|
165
|
+
// using React 18 and passing in a createRoot function, unmount()
|
|
166
|
+
// will be used
|
|
167
|
+
if (this._roots[childWindowId]) {
|
|
168
|
+
this._roots[childWindowId].unmount();
|
|
169
|
+
}
|
|
170
|
+
else
|
|
171
|
+
ReactDOM.unmountComponentAtNode(reactConnectionDiv);
|
|
156
172
|
});
|
|
157
173
|
}
|
|
158
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK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D,CAC3J,CAAC;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,EAAE;YACpB,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;SACH;aAAM;YACL,WAAW,CAAC,gBAAgB,CAC1B,MAAM,EACN,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;SACH;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACjC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { Provider } from \"react-redux\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiFramework } from \"../UiFramework\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body class=\"iui-root\">\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React18, the `createRoot` function must be provided in order to render Popout content with React18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to react 18 is complete.\n */\n // istanbul ignore next: Result of this assignment is only visible in `open`, which is not tested.\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n // istanbul ignore next: Used in `open` which is not tested.\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n if (this._createRoot) {\n this._createRoot(container).render(element);\n } else {\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n // istanbul ignore next: Used in `open` which is not tested.\n private renderChildWindowContents(\n childWindow: Window,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(\n <Provider store={UiFramework.store}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n </ThemeManager>\n </UiStateStorageHandler>\n </Provider>,\n reactConnectionDiv\n );\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n this.close(childWindowId, false);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n // istanbul ignore next\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true)\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (-1 === windowIndex) return false;\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef &&\n frontStageDef.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n // istanbul ignore next: Used in `open` which is not tested.\n private adjustWidowLocation(\n location: ChildWindowLocationProps\n ): ChildWindowLocationProps {\n const outLocation = { ...location };\n if (0 === location.top && 0 === location.left) {\n // If no location is provided, prepare position of the new window to be centered against the current window.\n outLocation.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n outLocation.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n return outLocation;\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n // istanbul ignore next: Would require mocking window.open to return a window object.\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n // first check to see if content is already open in child window\n if (\n this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n ) >= 0\n ) {\n return false;\n }\n\n location = this.adjustWidowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n if (0 === url.length) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"load\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAM,OAAO,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAE9C,WAAM,GA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S,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;SACH;aAAM;YACL,WAAW,CAAC,gBAAgB,CAC1B,MAAM,EACN,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;SACH;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACjC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { Provider } from \"react-redux\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiFramework } from \"../UiFramework\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body class=\"iui-root\">\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React18, the `createRoot` function must be provided in order to render Popout content with React18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to react 18 is complete.\n */\n // istanbul ignore next: Result of this assignment is only visible in `open`, which is not tested.\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n // istanbul ignore next: Used in `open` which is not tested.\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n // istanbul ignore next: Used in `open` which is not tested.\n private renderChildWindowContents(\n childWindow: Window,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(\n <Provider store={UiFramework.store}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n </ThemeManager>\n </UiStateStorageHandler>\n </Provider>,\n reactConnectionDiv\n );\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n this.close(childWindowId, false);\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n // istanbul ignore next\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true)\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (-1 === windowIndex) return false;\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef &&\n frontStageDef.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n // istanbul ignore next: Used in `open` which is not tested.\n private adjustWidowLocation(\n location: ChildWindowLocationProps\n ): ChildWindowLocationProps {\n const outLocation = { ...location };\n if (0 === location.top && 0 === location.left) {\n // If no location is provided, prepare position of the new window to be centered against the current window.\n outLocation.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n outLocation.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n return outLocation;\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n // istanbul ignore next: Would require mocking window.open to return a window object.\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n // first check to see if content is already open in child window\n if (\n this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n ) >= 0\n ) {\n return false;\n }\n\n location = this.adjustWidowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n if (0 === url.length) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"load\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/popup/PopupManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EAEV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EAEd,OAAO,EACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAW9D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,KAAK,CAAC;IACV,SAAS,EAAE,KAA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AAO;WAI1B,QAAQ,CACpB,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,EAC1C,YAAY,EAAE,oBAAoB,GAAG,SAAS,EAC9C,EAAE,EAAE,WAAW,EACf,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,KAAK,EACb,cAAc,EAAE,kBAAkB,EAClC,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO;WAiCI,QAAQ,IAAI,OAAO;WAQnB,gBAAgB,CAC5B,YAAY,EAAE,wBAAwB,EACtC,EAAE,EAAE,WAAW,EACf,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO;WA0BI,iBAAiB,IAAI,OAAO;WAI5B,gBAAgB,CAC5B,EAAE,EAAE,WAAW,EACf,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,SAAS,GACd,KAAK;CAYT;AAED,gBAAgB;AAChB,UAAU,kBAAkB;IAC1B,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,kBAAkB,CAAC;IACxE,gBAAgB;IAChB,SAAyB,KAAK,EAAE,kBAAkB,CAGhD;IAEc,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAO5C,OAAO,CAAC,aAAa,CAEnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;IAsBzC,OAAO,CAAC,yBAAyB,CAE/B;CACH"}
|
|
@@ -233,9 +233,11 @@ export class PopupRenderer extends React.Component {
|
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
componentDidMount() {
|
|
236
|
+
Logger.logInfo("PopupManager", `mounting PopupManager`);
|
|
236
237
|
PopupManager.onPopupsChangedEvent.addListener(this._handlePopupsChangedEvent);
|
|
237
238
|
}
|
|
238
239
|
componentWillUnmount() {
|
|
240
|
+
Logger.logInfo("PopupManager", `un-mounting PopupManager`);
|
|
239
241
|
PopupManager.onPopupsChangedEvent.removeListener(this._handlePopupsChangedEvent);
|
|
240
242
|
}
|
|
241
243
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":["../../../../src/appui-react/popup/PopupManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,OAAO,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAmBxD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,OAA+B;CAAG;AAwB1E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,OAAyB,EACA,EAAE;IAC3B,OAAQ,OAAwB,CAAC,SAAS,KAAK,SAAS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Ac,CAC9C,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;IAMe,MAAM;QACpB,IAAI,YAAY,CAAC,UAAU,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAE9C,OAAO,CACL,6BACE,SAAS,EAAC,oCAAoC,EAC9C,GAAG,EAAE,IAAI,CAAC,aAAa,IAEtB,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,IAAI,CAAC,KAAK,CAAC,MAAM;iBACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;iBACnE,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;gBAC5B,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAC9B,SAAS,CAAC,SAAS,CACL,CAClB,CAAC;YACJ,CAAC,CAAC,CACF,CACP,CAAC;IACJ,CAAC;CAKF","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/** @packageDocumentation\n * @module Popup\n */\n\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type {\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnValueCommitFunc,\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n RelativePosition,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyRecord,\n PropertyValueFormat,\n UiEvent,\n} from \"@itwin/appui-abstract\";\nimport type { Point, SizeProps } from \"@itwin/core-react\";\nimport { Orientation, Rectangle } from \"@itwin/core-react\";\nimport { offsetAndContainInContainer } from \"@itwin/appui-layout-react\";\nimport type { KeyinEntry } from \"../uiadmin/FrameworkUiAdmin\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CardPopup } from \"./CardPopup\";\nimport { HTMLElementPopup } from \"./HTMLElementPopup\";\nimport { InputEditorCommitHandler, InputEditorPopup } from \"./InputEditorPopup\";\nimport { KeyinPalettePopup } from \"./KeyinPalettePopup\";\nimport { ToolbarPopup } from \"./ToolbarPopup\";\nimport { ToolSettingsPopup } from \"./ToolSettingsPopup\";\n\n// cSpell:ignore uiadmin\n\n/** Information maintained by PopupManager about a Popup\n * @public\n */\nexport interface PopupInfo {\n id: string;\n pt: XAndY;\n component: React.ReactNode;\n parentDocument: Document;\n}\n\n/** @public */\nexport interface PopupsChangedEventArgs {\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popups Changed Event class.\n * @public\n */\nexport class PopupsChangedEvent extends UiEvent<PopupsChangedEventArgs> {}\n\n/** Props for each popup managed by the PopupManager\n * @public\n */\nexport interface PopupPropsBase {\n id: string;\n el: HTMLElement;\n pt: XAndY;\n offset: XAndY;\n}\n\n/** Describes React based content\n * @public\n */\nexport interface ReactContent {\n reactNode: React.ReactNode;\n}\n\n/** Type for Popup Content\n * @public\n */\nexport type PopupContentType = HTMLElement | ReactContent;\n\n/** ReactContent type guard.\n * @internal\n */\nexport const isReactContent = (\n content: PopupContentType\n): content is ReactContent => {\n return (content as ReactContent).reactNode !== undefined;\n};\n\n/** Popup Manager class\n * @public\n */\nexport class PopupManager {\n private static _popups: ReadonlyArray<PopupInfo> = [];\n private static _editorId = \"InputEditor\";\n private static _toolbarId = \"Toolbar\";\n private static _htmlElementId = \"HTMLElement\";\n private static _cardId = \"Card\";\n private static _toolSettingsId = \"ToolSettings\";\n private static _keyPalettePopupId = \"KeyinPalette\";\n\n private static _defaultOffset = { x: 8, y: 8 };\n\n public static readonly onPopupsChangedEvent = new PopupsChangedEvent();\n\n public static get popupCount() {\n return this._popups.length;\n }\n public static get popups() {\n return this._popups;\n }\n\n public static set popups(popups: ReadonlyArray<PopupInfo>) {\n // istanbul ignore if\n if (this._popups === popups) return;\n this._popups = popups;\n this.onPopupsChangedEvent.emit({ popups });\n }\n\n /** @internal */\n public static clearPopups() {\n this.popups = [];\n }\n\n private static addPopup(popupInfo: PopupInfo): void {\n const popups = [...PopupManager._popups, popupInfo];\n this.popups = popups;\n }\n\n private static updatePopup(popupInfo: PopupInfo, itemIndex: number): void {\n // istanbul ignore if\n if (itemIndex < 0) return;\n\n const popups = [\n ...PopupManager._popups.slice(0, itemIndex),\n popupInfo,\n ...PopupManager._popups.slice(itemIndex + 1),\n ];\n this.popups = popups;\n }\n\n public static addOrUpdatePopup(popupInfo: PopupInfo): void {\n const itemIndex = PopupManager._popups.findIndex(\n (info: PopupInfo) => info.id === popupInfo.id\n );\n if (itemIndex >= 0) PopupManager.updatePopup(popupInfo, itemIndex);\n else PopupManager.addPopup(popupInfo);\n }\n\n public static removePopup(id: string): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => id === info.id\n );\n let result = true;\n\n if (index >= 0) {\n const popups = PopupManager._popups.filter((info: PopupInfo) => {\n return info.id !== id;\n });\n this.popups = popups;\n } else {\n Logger.logError(\n UiFramework.loggerCategory(this),\n `removePopup: Could not find popup with id of '${id}'`\n );\n result = false;\n }\n\n return result;\n }\n\n public static get defaultOffset(): XAndY {\n return PopupManager._defaultOffset;\n }\n public static set defaultOffset(offset: XAndY) {\n PopupManager._defaultOffset = offset;\n }\n\n public static showInputEditor(\n el: HTMLElement,\n pt: XAndY,\n value: Primitives.Value,\n propertyDescription: PropertyDescription,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc\n ): boolean {\n const primitiveValue: PrimitiveValue = {\n value,\n valueFormat: PropertyValueFormat.Primitive,\n };\n const record = new PropertyRecord(primitiveValue, propertyDescription);\n const commitHandler = new InputEditorCommitHandler(onCommit);\n const id = PopupManager._editorId;\n const component = (\n <InputEditorPopup\n id={id}\n el={el}\n pt={pt}\n offset={PopupManager.defaultOffset}\n record={record}\n onCancel={onCancel}\n commitHandler={commitHandler}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideInputEditor(): boolean {\n return PopupManager.removePopup(PopupManager._editorId);\n }\n\n public static showKeyinPalette(\n keyins: KeyinEntry[],\n el: HTMLElement,\n onItemExecuted?: OnItemExecutedFunc,\n onCancel?: OnCancelFunc\n ): boolean {\n const id = PopupManager._keyPalettePopupId;\n const component = (\n <KeyinPalettePopup\n keyins={keyins}\n id={id}\n el={el}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n // since the command palette popup is always at top center of specified HTML element and it does not need to move like\n // cursor popups just set pt to 0,0.\n const pt = { x: 0, y: 0 };\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideKeyinPalette(): boolean {\n return PopupManager.removePopup(PopupManager._keyPalettePopupId);\n }\n\n public static showToolbar(\n toolbarProps: AbstractToolbarProps,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolbarId;\n const component = (\n <ToolbarPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n items={toolbarProps.items}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideToolbar(): boolean {\n return PopupManager.removePopup(PopupManager._toolbarId);\n }\n\n public static showHTMLElement(\n displayElement: HTMLElement,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._htmlElementId;\n const component = (\n <HTMLElementPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n element={displayElement}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideHTMLElement(): boolean {\n return PopupManager.removePopup(PopupManager._htmlElementId);\n }\n\n public static showCard(\n content: PopupContentType,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._cardId;\n const component = (\n <CardPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n content={content}\n title={title}\n items={\n toolbarProps\n ? toolbarProps.items\n : /* istanbul ignore next */ undefined\n }\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideCard(): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => PopupManager._cardId === info.id\n );\n if (index >= 0) return PopupManager.removePopup(PopupManager._cardId);\n return false;\n }\n\n public static openToolSettings(\n dataProvider: DialogLayoutDataProvider,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolSettingsId;\n const component = (\n <ToolSettingsPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n dataProvider={dataProvider}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static closeToolSettings(): boolean {\n return PopupManager.removePopup(PopupManager._toolSettingsId);\n }\n\n public static getPopupPosition(\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n size: SizeProps\n ): Point {\n const containerBounds = Rectangle.create(el.getBoundingClientRect());\n const relativeBounds = Rectangle.createFromSize(size).offset(pt);\n const adjustedPosition: Point = offsetAndContainInContainer(\n relativeBounds,\n containerBounds.getSize(),\n offset\n );\n const position = adjustedPosition.offset(containerBounds.topLeft());\n\n return position;\n }\n}\n\n/** @internal */\ninterface PopupRendererState {\n parentDocument: Document | null;\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popup Renderer\n * @public\n */\nexport class PopupRenderer extends React.Component<{}, PopupRendererState> {\n /** @internal */\n public override readonly state: PopupRendererState = {\n parentDocument: null,\n popups: PopupManager.popups,\n };\n\n public override componentDidMount(): void {\n PopupManager.onPopupsChangedEvent.addListener(\n this._handlePopupsChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n PopupManager.onPopupsChangedEvent.removeListener(\n this._handlePopupsChangedEvent\n );\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n this.setState({ parentDocument: popupDiv?.ownerDocument ?? null });\n };\n\n public override render(): React.ReactNode {\n if (PopupManager.popupCount <= 0) return null;\n\n return (\n <div\n className=\"appui-react-popup-render-container\"\n ref={this._handleRefSet}\n >\n {this.state.parentDocument &&\n this.state.popups\n .filter((info) => info.parentDocument === this.state.parentDocument)\n .map((popupInfo: PopupInfo) => {\n return (\n <React.Fragment key={popupInfo.id}>\n {popupInfo.component}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n\n private _handlePopupsChangedEvent = (args: PopupsChangedEventArgs) => {\n this.setState({ popups: args.popups });\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":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C,GAAG,EAAE,IAAI,CAAC,aAAa,IAEtB,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,IAAI,CAAC,KAAK,CAAC,MAAM;iBACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;iBACnE,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;gBAC5B,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAC9B,SAAS,CAAC,SAAS,CACL,CAClB,CAAC;YACJ,CAAC,CAAC,CACF,CACP,CAAC;IACJ,CAAC;CAKF","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/** @packageDocumentation\n * @module Popup\n */\n\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type {\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnValueCommitFunc,\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n RelativePosition,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyRecord,\n PropertyValueFormat,\n UiEvent,\n} from \"@itwin/appui-abstract\";\nimport type { Point, SizeProps } from \"@itwin/core-react\";\nimport { Orientation, Rectangle } from \"@itwin/core-react\";\nimport { offsetAndContainInContainer } from \"@itwin/appui-layout-react\";\nimport type { KeyinEntry } from \"../uiadmin/FrameworkUiAdmin\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CardPopup } from \"./CardPopup\";\nimport { HTMLElementPopup } from \"./HTMLElementPopup\";\nimport { InputEditorCommitHandler, InputEditorPopup } from \"./InputEditorPopup\";\nimport { KeyinPalettePopup } from \"./KeyinPalettePopup\";\nimport { ToolbarPopup } from \"./ToolbarPopup\";\nimport { ToolSettingsPopup } from \"./ToolSettingsPopup\";\n\n// cSpell:ignore uiadmin\n\n/** Information maintained by PopupManager about a Popup\n * @public\n */\nexport interface PopupInfo {\n id: string;\n pt: XAndY;\n component: React.ReactNode;\n parentDocument: Document;\n}\n\n/** @public */\nexport interface PopupsChangedEventArgs {\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popups Changed Event class.\n * @public\n */\nexport class PopupsChangedEvent extends UiEvent<PopupsChangedEventArgs> {}\n\n/** Props for each popup managed by the PopupManager\n * @public\n */\nexport interface PopupPropsBase {\n id: string;\n el: HTMLElement;\n pt: XAndY;\n offset: XAndY;\n}\n\n/** Describes React based content\n * @public\n */\nexport interface ReactContent {\n reactNode: React.ReactNode;\n}\n\n/** Type for Popup Content\n * @public\n */\nexport type PopupContentType = HTMLElement | ReactContent;\n\n/** ReactContent type guard.\n * @internal\n */\nexport const isReactContent = (\n content: PopupContentType\n): content is ReactContent => {\n return (content as ReactContent).reactNode !== undefined;\n};\n\n/** Popup Manager class\n * @public\n */\nexport class PopupManager {\n private static _popups: ReadonlyArray<PopupInfo> = [];\n private static _editorId = \"InputEditor\";\n private static _toolbarId = \"Toolbar\";\n private static _htmlElementId = \"HTMLElement\";\n private static _cardId = \"Card\";\n private static _toolSettingsId = \"ToolSettings\";\n private static _keyPalettePopupId = \"KeyinPalette\";\n\n private static _defaultOffset = { x: 8, y: 8 };\n\n public static readonly onPopupsChangedEvent = new PopupsChangedEvent();\n\n public static get popupCount() {\n return this._popups.length;\n }\n public static get popups() {\n return this._popups;\n }\n\n public static set popups(popups: ReadonlyArray<PopupInfo>) {\n // istanbul ignore if\n if (this._popups === popups) return;\n this._popups = popups;\n this.onPopupsChangedEvent.emit({ popups });\n }\n\n /** @internal */\n public static clearPopups() {\n this.popups = [];\n }\n\n private static addPopup(popupInfo: PopupInfo): void {\n const popups = [...PopupManager._popups, popupInfo];\n this.popups = popups;\n }\n\n private static updatePopup(popupInfo: PopupInfo, itemIndex: number): void {\n // istanbul ignore if\n if (itemIndex < 0) return;\n\n const popups = [\n ...PopupManager._popups.slice(0, itemIndex),\n popupInfo,\n ...PopupManager._popups.slice(itemIndex + 1),\n ];\n this.popups = popups;\n }\n\n public static addOrUpdatePopup(popupInfo: PopupInfo): void {\n const itemIndex = PopupManager._popups.findIndex(\n (info: PopupInfo) => info.id === popupInfo.id\n );\n if (itemIndex >= 0) PopupManager.updatePopup(popupInfo, itemIndex);\n else PopupManager.addPopup(popupInfo);\n }\n\n public static removePopup(id: string): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => id === info.id\n );\n let result = true;\n\n if (index >= 0) {\n const popups = PopupManager._popups.filter((info: PopupInfo) => {\n return info.id !== id;\n });\n this.popups = popups;\n } else {\n Logger.logError(\n UiFramework.loggerCategory(this),\n `removePopup: Could not find popup with id of '${id}'`\n );\n result = false;\n }\n\n return result;\n }\n\n public static get defaultOffset(): XAndY {\n return PopupManager._defaultOffset;\n }\n public static set defaultOffset(offset: XAndY) {\n PopupManager._defaultOffset = offset;\n }\n\n public static showInputEditor(\n el: HTMLElement,\n pt: XAndY,\n value: Primitives.Value,\n propertyDescription: PropertyDescription,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc\n ): boolean {\n const primitiveValue: PrimitiveValue = {\n value,\n valueFormat: PropertyValueFormat.Primitive,\n };\n const record = new PropertyRecord(primitiveValue, propertyDescription);\n const commitHandler = new InputEditorCommitHandler(onCommit);\n const id = PopupManager._editorId;\n const component = (\n <InputEditorPopup\n id={id}\n el={el}\n pt={pt}\n offset={PopupManager.defaultOffset}\n record={record}\n onCancel={onCancel}\n commitHandler={commitHandler}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideInputEditor(): boolean {\n return PopupManager.removePopup(PopupManager._editorId);\n }\n\n public static showKeyinPalette(\n keyins: KeyinEntry[],\n el: HTMLElement,\n onItemExecuted?: OnItemExecutedFunc,\n onCancel?: OnCancelFunc\n ): boolean {\n const id = PopupManager._keyPalettePopupId;\n const component = (\n <KeyinPalettePopup\n keyins={keyins}\n id={id}\n el={el}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n // since the command palette popup is always at top center of specified HTML element and it does not need to move like\n // cursor popups just set pt to 0,0.\n const pt = { x: 0, y: 0 };\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideKeyinPalette(): boolean {\n return PopupManager.removePopup(PopupManager._keyPalettePopupId);\n }\n\n public static showToolbar(\n toolbarProps: AbstractToolbarProps,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolbarId;\n const component = (\n <ToolbarPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n items={toolbarProps.items}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideToolbar(): boolean {\n return PopupManager.removePopup(PopupManager._toolbarId);\n }\n\n public static showHTMLElement(\n displayElement: HTMLElement,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._htmlElementId;\n const component = (\n <HTMLElementPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n element={displayElement}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideHTMLElement(): boolean {\n return PopupManager.removePopup(PopupManager._htmlElementId);\n }\n\n public static showCard(\n content: PopupContentType,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._cardId;\n const component = (\n <CardPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n content={content}\n title={title}\n items={\n toolbarProps\n ? toolbarProps.items\n : /* istanbul ignore next */ undefined\n }\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n onItemExecuted={onItemExecuted}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static hideCard(): boolean {\n const index = PopupManager._popups.findIndex(\n (info: PopupInfo) => PopupManager._cardId === info.id\n );\n if (index >= 0) return PopupManager.removePopup(PopupManager._cardId);\n return false;\n }\n\n public static openToolSettings(\n dataProvider: DialogLayoutDataProvider,\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition: RelativePosition\n ): boolean {\n const id = PopupManager._toolSettingsId;\n const component = (\n <ToolSettingsPopup\n id={id}\n el={el}\n pt={pt}\n offset={offset}\n dataProvider={dataProvider}\n relativePosition={relativePosition}\n orientation={Orientation.Horizontal}\n onCancel={onCancel}\n />\n );\n\n const popupInfo: PopupInfo = {\n id,\n pt,\n component,\n parentDocument: el.ownerDocument,\n };\n PopupManager.addOrUpdatePopup(popupInfo);\n\n return true;\n }\n\n public static closeToolSettings(): boolean {\n return PopupManager.removePopup(PopupManager._toolSettingsId);\n }\n\n public static getPopupPosition(\n el: HTMLElement,\n pt: XAndY,\n offset: XAndY,\n size: SizeProps\n ): Point {\n const containerBounds = Rectangle.create(el.getBoundingClientRect());\n const relativeBounds = Rectangle.createFromSize(size).offset(pt);\n const adjustedPosition: Point = offsetAndContainInContainer(\n relativeBounds,\n containerBounds.getSize(),\n offset\n );\n const position = adjustedPosition.offset(containerBounds.topLeft());\n\n return position;\n }\n}\n\n/** @internal */\ninterface PopupRendererState {\n parentDocument: Document | null;\n popups: ReadonlyArray<PopupInfo>;\n}\n\n/** Popup Renderer\n * @public\n */\nexport class PopupRenderer extends React.Component<{}, PopupRendererState> {\n /** @internal */\n public override readonly state: PopupRendererState = {\n parentDocument: null,\n popups: PopupManager.popups,\n };\n\n public override componentDidMount(): void {\n Logger.logInfo(\"PopupManager\", `mounting PopupManager`);\n PopupManager.onPopupsChangedEvent.addListener(\n this._handlePopupsChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n Logger.logInfo(\"PopupManager\", `un-mounting PopupManager`);\n PopupManager.onPopupsChangedEvent.removeListener(\n this._handlePopupsChangedEvent\n );\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n this.setState({ parentDocument: popupDiv?.ownerDocument ?? null });\n };\n\n public override render(): React.ReactNode {\n if (PopupManager.popupCount <= 0) return null;\n\n return (\n <div\n className=\"appui-react-popup-render-container\"\n ref={this._handleRefSet}\n >\n {this.state.parentDocument &&\n this.state.popups\n .filter((info) => info.parentDocument === this.state.parentDocument)\n .map((popupInfo: PopupInfo) => {\n return (\n <React.Fragment key={popupInfo.id}>\n {popupInfo.component}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n\n private _handlePopupsChangedEvent = (args: PopupsChangedEventArgs) => {\n this.setState({ popups: args.popups });\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/appui-react",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
4
4
|
"description": "UI framework",
|
|
5
5
|
"main": "lib/cjs/appui-react.js",
|
|
6
6
|
"module": "lib/esm/appui-react.js",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@itwin/appui-abstract": "^3.7.0 || ^4.0.0",
|
|
26
|
-
"@itwin/appui-layout-react": "^4.6.
|
|
27
|
-
"@itwin/components-react": "^4.6.
|
|
26
|
+
"@itwin/appui-layout-react": "^4.6.2",
|
|
27
|
+
"@itwin/components-react": "^4.6.2",
|
|
28
28
|
"@itwin/core-bentley": "^3.7.0 || ^4.0.0",
|
|
29
29
|
"@itwin/core-common": "^3.7.0 || ^4.0.0",
|
|
30
30
|
"@itwin/core-frontend": "^3.7.0 || ^4.0.0",
|
|
31
31
|
"@itwin/core-geometry": "^3.7.0 || ^4.0.0",
|
|
32
32
|
"@itwin/core-quantity": "^3.7.0 || ^4.0.0",
|
|
33
|
-
"@itwin/core-react": "^4.6.
|
|
33
|
+
"@itwin/core-react": "^4.6.2",
|
|
34
34
|
"@itwin/core-telemetry": "^3.7.0 || ^4.0.0",
|
|
35
|
-
"@itwin/imodel-components-react": "^4.6.
|
|
35
|
+
"@itwin/imodel-components-react": "^4.6.2",
|
|
36
36
|
"react": "^17.0.0 || ^18.0.0",
|
|
37
37
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
38
38
|
"react-redux": "^7.2.2",
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@itwin/appui-abstract": "^3.7.0",
|
|
47
|
-
"@itwin/appui-layout-react": "4.6.
|
|
47
|
+
"@itwin/appui-layout-react": "4.6.2",
|
|
48
48
|
"@itwin/build-tools": "^3.7.0",
|
|
49
|
-
"@itwin/components-react": "4.6.
|
|
49
|
+
"@itwin/components-react": "4.6.2",
|
|
50
50
|
"@itwin/core-bentley": "^3.7.0",
|
|
51
51
|
"@itwin/core-common": "^3.7.0",
|
|
52
52
|
"@itwin/core-frontend": "^3.7.0",
|
|
53
53
|
"@itwin/core-geometry": "^3.7.0",
|
|
54
54
|
"@itwin/core-orbitgt": "^3.7.0",
|
|
55
55
|
"@itwin/core-quantity": "^3.7.0",
|
|
56
|
-
"@itwin/core-react": "4.6.
|
|
56
|
+
"@itwin/core-react": "4.6.2",
|
|
57
57
|
"@itwin/core-telemetry": "^3.7.0",
|
|
58
58
|
"@itwin/ecschema-metadata": "^3.7.0",
|
|
59
59
|
"@itwin/eslint-plugin": "^4.0.0-dev.45",
|
|
60
|
-
"@itwin/imodel-components-react": "4.6.
|
|
60
|
+
"@itwin/imodel-components-react": "4.6.2",
|
|
61
61
|
"@itwin/webgl-compatibility": "^3.7.0",
|
|
62
62
|
"@testing-library/dom": "^8.11.2",
|
|
63
63
|
"@testing-library/react": "^12.0.0",
|