@itwin/appui-react 4.14.0 → 4.14.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 +18 -1
- package/lib/cjs/appui-react/childwindow/ChildWindowConfig.d.ts +4 -0
- package/lib/cjs/appui-react/childwindow/ChildWindowConfig.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/ChildWindowConfig.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +8 -2
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js +8 -8
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.scss +0 -25
- package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts +3 -2
- package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js +16 -9
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/cjs/appui-react/dialog/DialogManagerBase.scss +11 -0
- package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts +4 -17
- package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
- package/lib/cjs/appui-react/feedback/ElementTooltip.js +50 -86
- package/lib/cjs/appui-react/feedback/ElementTooltip.js.map +1 -1
- package/lib/cjs/appui-react/feedback/ElementTooltip.scss +29 -0
- package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.d.ts +2 -2
- package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.js +6 -2
- package/lib/cjs/appui-react/statusbar/popup/StatusBarPopover.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +14 -3
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +2 -2
- package/lib/cjs/appui-react.js +2 -2
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/childwindow/ChildWindowConfig.d.ts +4 -0
- package/lib/esm/appui-react/childwindow/ChildWindowConfig.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/ChildWindowConfig.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +8 -2
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js +8 -8
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.scss +0 -25
- package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts +3 -2
- package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
- package/lib/esm/appui-react/dialog/DialogManagerBase.js +16 -9
- package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/esm/appui-react/dialog/DialogManagerBase.scss +11 -0
- package/lib/esm/appui-react/feedback/ElementTooltip.d.ts +4 -17
- package/lib/esm/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
- package/lib/esm/appui-react/feedback/ElementTooltip.js +49 -85
- package/lib/esm/appui-react/feedback/ElementTooltip.js.map +1 -1
- package/lib/esm/appui-react/feedback/ElementTooltip.scss +29 -0
- package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.d.ts +2 -2
- package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.js +6 -2
- package/lib/esm/appui-react/statusbar/popup/StatusBarPopover.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +14 -3
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react.d.ts +2 -2
- package/lib/esm/appui-react.js +2 -2
- package/lib/esm/appui-react.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Change Log - @itwin/appui-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 22 Jul 2024 21:23:09 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.14.2
|
|
6
|
+
Mon, 22 Jul 2024 21:23:09 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Fix an issue where Popup is rendered outside of a StatusBarPopover.
|
|
11
|
+
- Fix an issue where widget is rendered above the dialog backdrop.
|
|
12
|
+
- Fixed popout widget changing position on a secondary montitor.
|
|
13
|
+
|
|
14
|
+
## 4.14.1
|
|
15
|
+
Tue, 11 Jun 2024 15:58:29 GMT
|
|
16
|
+
|
|
17
|
+
### Updates
|
|
18
|
+
|
|
19
|
+
- Fix ElementTooltip to correctly open in a popup window.
|
|
20
|
+
- Re-open popout widgets when switching frontstages in an electron app.
|
|
4
21
|
|
|
5
22
|
## 4.14.0
|
|
6
23
|
Thu, 06 Jun 2024 08:24:21 GMT
|
|
@@ -7,6 +7,10 @@ export interface ChildWindow extends Window {
|
|
|
7
7
|
expectedWidth?: number;
|
|
8
8
|
/** Expected height of the child window. */
|
|
9
9
|
expectedHeight?: number;
|
|
10
|
+
/** Expected top value of the child window. */
|
|
11
|
+
expectedTop?: number;
|
|
12
|
+
/** Expected left value of the child window. */
|
|
13
|
+
expectedLeft?: number;
|
|
10
14
|
/** Difference between expected child window width and actual value when opened. */
|
|
11
15
|
deltaWidth?: number;
|
|
12
16
|
/** Difference between expected child window height and actual value when opened. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChildWindowConfig.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/ChildWindowConfig.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"ChildWindowConfig.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/ChildWindowConfig.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChildWindowConfig.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/ChildWindowConfig.ts"],"names":[],"mappings":"","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 * An extension of a Window to be used for Popout Widgets.\n * @internal\n */\nexport interface ChildWindow extends Window {\n /** Expected width of the child window. */\n expectedWidth?: number;\n /** Expected height of the child window. */\n expectedHeight?: number;\n /** Difference between expected child window width and actual value when opened. */\n deltaWidth?: number;\n /** Difference between expected child window height and actual value when opened. */\n deltaHeight?: number;\n /** Difference between expected child window left value and actual value when opened. */\n deltaLeft?: number;\n /** Difference between expected child window top value and actual value when opened. */\n deltaTop?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChildWindowConfig.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/ChildWindowConfig.ts"],"names":[],"mappings":"","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 * An extension of a Window to be used for Popout Widgets.\n * @internal\n */\nexport interface ChildWindow extends Window {\n /** Expected width of the child window. */\n expectedWidth?: number;\n /** Expected height of the child window. */\n expectedHeight?: number;\n /** Expected top value of the child window. */\n expectedTop?: number;\n /** Expected left value of the child window. */\n expectedLeft?: number;\n /** Difference between expected child window width and actual value when opened. */\n deltaWidth?: number;\n /** Difference between expected child window height and actual value when opened. */\n deltaHeight?: number;\n /** Difference between expected child window left value and actual value when opened. */\n deltaLeft?: number;\n /** Difference between expected child window top value and actual value when opened. */\n deltaTop?: number;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,mCAAmC,CAAC;AA0B3C;;;;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;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;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;IAS3E,OAAO,CAAC,yBAAyB;
|
|
1
|
+
{"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,mCAAmC,CAAC;AA0B3C;;;;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;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;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;IAS3E,OAAO,CAAC,yBAAyB;IAqGjC,gGAAgG;IACzF,QAAQ;IAOf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAkBnC;IAEF,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;OAQG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CA2DhC"}
|
|
@@ -180,6 +180,12 @@ class InternalChildWindowManager {
|
|
|
180
180
|
childWindow.deltaHeight =
|
|
181
181
|
childWindow.expectedHeight - childWindow.innerHeight;
|
|
182
182
|
}
|
|
183
|
+
if (childWindow.expectedLeft && childWindow.expectedTop) {
|
|
184
|
+
childWindow.deltaLeft =
|
|
185
|
+
childWindow.expectedLeft - childWindow.screenLeft;
|
|
186
|
+
childWindow.deltaTop =
|
|
187
|
+
childWindow.expectedTop - childWindow.screenTop;
|
|
188
|
+
}
|
|
183
189
|
});
|
|
184
190
|
});
|
|
185
191
|
childWindow.addEventListener("pagehide", () => {
|
|
@@ -235,8 +241,8 @@ class InternalChildWindowManager {
|
|
|
235
241
|
return false;
|
|
236
242
|
childWindow.expectedHeight = location.height;
|
|
237
243
|
childWindow.expectedWidth = location.width;
|
|
238
|
-
childWindow.
|
|
239
|
-
childWindow.
|
|
244
|
+
childWindow.expectedLeft = location.left;
|
|
245
|
+
childWindow.expectedTop = location.top;
|
|
240
246
|
if (url.length === 0) {
|
|
241
247
|
childWindow.document.write(childHtml);
|
|
242
248
|
this.renderChildWindowContents(childWindow, childWindowId, content, title);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,+BAA+B;AAC/B,sCAAsC;AACtC,6CAAuC;AACvC,gDAA6C;AAC7C,gEAAkE;AAClE,qEAAmE;AACnE,2EAAyE;AAMzE,sEAAgE;AAChE,wDAAsD;AACtD,wDAAqD;AACrD,oEAAqE;AAErE,6CAA0C;AAC1C,6CAA2C;AAC3C,wFAAqF;AAErF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAa,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAE9C,WAAM,GAAqC,EAAE,CAAC;QAgLtD;;;;;WAKG;QACI,UAAK,GAAG,CAAC,aAAqB,EAAE,kBAAkB,GAAG,IAAI,EAAE,EAAE;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CACjD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,KAAK,aAAa,CAC3D,CAAC;YACF,IAAI,WAAW,KAAK,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;YACrC,MAAM,EAAE,mBAAmB,EAAE,GAAG,iCAAe,CAAC,QAAQ,EAAE,CAAC;YAC3D,mBAAmB,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;YAE5D,MAAM,WAAW,GAAG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,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhSD,gEAgSC","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 * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport \"./InternalChildWindowManager.scss\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\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>\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 React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\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 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 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 // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\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 private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\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 let element: React.FunctionComponentElement<any>;\n if (content.props.widgetDef) {\n const tabId = content.props.widgetDef.id as string;\n element = (\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\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 </TabIdContext.Provider>\n </Provider>\n );\n } else {\n element = (\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 );\n }\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\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\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\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 // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\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 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 (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\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?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\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 public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = 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 childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.deltaLeft = location.left - childWindow.screenLeft;\n childWindow.deltaTop = location.top - childWindow.screenTop;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\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,+BAA+B;AAC/B,sCAAsC;AACtC,6CAAuC;AACvC,gDAA6C;AAC7C,gEAAkE;AAClE,qEAAmE;AACnE,2EAAyE;AAMzE,sEAAgE;AAChE,wDAAsD;AACtD,wDAAqD;AACrD,oEAAqE;AAErE,6CAA0C;AAC1C,6CAA2C;AA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CAAC,MAAM,SAAS,QAAQ,CAAC,IAAI,QAAQ,QAAQ,CAAC,GAAG,+DAA+D,CAC3J,CAAC;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/B,WAAW,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC7C,WAAW,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC3C,WAAW,CAAC,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;QACzC,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC;QAEvC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,gBAAgB,CAC1B,kBAAkB,EAClB,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvSD,gEAuSC","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 * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport \"./InternalChildWindowManager.scss\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\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>\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 React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\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 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 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 // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\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 private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\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 let element: React.FunctionComponentElement<any>;\n if (content.props.widgetDef) {\n const tabId = content.props.widgetDef.id as string;\n element = (\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\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 </TabIdContext.Provider>\n </Provider>\n );\n } else {\n element = (\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 );\n }\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\n }\n\n if (childWindow.expectedLeft && childWindow.expectedTop) {\n childWindow.deltaLeft =\n childWindow.expectedLeft - childWindow.screenLeft;\n childWindow.deltaTop =\n childWindow.expectedTop - childWindow.screenTop;\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\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\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 // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\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 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 (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\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?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\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 public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = 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 childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.expectedLeft = location.left;\n childWindow.expectedTop = location.top;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\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":"ConfigurableUiContent.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqBrD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,kCAAkC;IAClC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE/B,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,4BAAkD,CAAC;AAE9E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"ConfigurableUiContent.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqBrD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,kCAAkC;IAClC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE/B,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,4BAAkD,CAAC;AAE9E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,qBA0DtE"}
|
|
@@ -36,7 +36,7 @@ exports.WrapperContext = React.createContext(document.body);
|
|
|
36
36
|
* @public
|
|
37
37
|
*/
|
|
38
38
|
function ConfigurableUiContent(props) {
|
|
39
|
-
const [mainElement, setMainElement] = React.useState(
|
|
39
|
+
const [mainElement, setMainElement] = React.useState();
|
|
40
40
|
const [portalContainer, setPortalContainer] = React.useState();
|
|
41
41
|
React.useEffect(() => {
|
|
42
42
|
UiFramework_1.UiFramework.keyboardShortcuts.setFocusToHome();
|
|
@@ -54,14 +54,11 @@ function ConfigurableUiContent(props) {
|
|
|
54
54
|
const point = new core_react_1.Point(e.pageX, e.pageY);
|
|
55
55
|
CursorInformation_1.CursorInformation.handleMouseMove(point);
|
|
56
56
|
}, []);
|
|
57
|
-
return (React.createElement("main", { role: "main", id: "uifw-configurableui-wrapper", className: props.className, style: props.style, onMouseMove: handleMouseMove, ref: setMainElement },
|
|
58
|
-
React.createElement(exports.WrapperContext.Provider, { value: mainElement },
|
|
57
|
+
return (React.createElement("main", { role: "main", id: "uifw-configurableui-wrapper", className: props.className, style: props.style, onMouseMove: handleMouseMove, ref: (el) => setMainElement(el ?? undefined) },
|
|
58
|
+
React.createElement(exports.WrapperContext.Provider, { value: mainElement ?? document.body },
|
|
59
59
|
React.createElement(itwinui_react_1.ThemeProvider, { style: { height: "100%" }, portalContainer: portalContainer },
|
|
60
60
|
props.appBackstage,
|
|
61
61
|
React.createElement(Frontstage_1.WidgetPanelsFrontstage, null),
|
|
62
|
-
React.createElement(ContentDialogManager_1.ContentDialogRenderer, null),
|
|
63
|
-
React.createElement(ModelessDialogManager_1.ModelessDialogRenderer, null),
|
|
64
|
-
React.createElement(ModalDialogManager_1.ModalDialogRenderer, null),
|
|
65
62
|
React.createElement(ElementTooltip_1.ElementTooltip, null),
|
|
66
63
|
React.createElement(Pointer_1.PointerMessage, null),
|
|
67
64
|
React.createElement(KeyboardShortcutMenu_1.KeyboardShortcutMenu, null),
|
|
@@ -69,8 +66,11 @@ function ConfigurableUiContent(props) {
|
|
|
69
66
|
React.createElement(CursorMenu_1.CursorPopupMenu, null),
|
|
70
67
|
React.createElement(CursorPopupManager_1.CursorPopupRenderer, null),
|
|
71
68
|
React.createElement(PopupManager_1.PopupRenderer, null),
|
|
72
|
-
React.createElement(MessageRenderer_1.MessageRenderer, null)
|
|
73
|
-
|
|
69
|
+
React.createElement(MessageRenderer_1.MessageRenderer, null),
|
|
70
|
+
React.createElement("div", { className: "uifw-configurableui-portalContainer", ref: (instance) => setPortalContainer(instance ?? undefined) },
|
|
71
|
+
React.createElement(ContentDialogManager_1.ContentDialogRenderer, null),
|
|
72
|
+
React.createElement(ModelessDialogManager_1.ModelessDialogRenderer, null),
|
|
73
|
+
React.createElement(ModalDialogManager_1.ModalDialogRenderer, null))))));
|
|
74
74
|
}
|
|
75
75
|
exports.ConfigurableUiContent = ConfigurableUiContent;
|
|
76
76
|
//# sourceMappingURL=ConfigurableUiContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableUiContent.js","sourceRoot":"","sources":["../../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wCAAsC;AACtC,+BAA+B;AAE/B,kDAA0C;AAC1C,wDAAqD;AACrD,mEAAgE;AAChE,gEAAkE;AAClE,iFAA+E;AAC/E,qEAAmE;AACnE,2EAAyE;AACzE,+DAA4D;AAC5D,mFAAgF;AAChF,uDAA2D;AAC3D,iDAAqD;AACrD,wDAAsD;AACtD,4DAAqE;AACrE,yEAAuE;AACvE,gDAA6C;AAC7C,mFAAgF;AAChF,iEAA8D;AAiB9D;;;GAGG;AACU,QAAA,cAAc,GAAG,KAAK,CAAC,aAAa,CAAc,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE9E;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"ConfigurableUiContent.js","sourceRoot":"","sources":["../../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wCAAsC;AACtC,+BAA+B;AAE/B,kDAA0C;AAC1C,wDAAqD;AACrD,mEAAgE;AAChE,gEAAkE;AAClE,iFAA+E;AAC/E,qEAAmE;AACnE,2EAAyE;AACzE,+DAA4D;AAC5D,mFAAgF;AAChF,uDAA2D;AAC3D,iDAAqD;AACrD,wDAAsD;AACtD,4DAAqE;AACrE,yEAAuE;AACvE,gDAA6C;AAC7C,mFAAgF;AAChF,iEAA8D;AAiB9D;;;GAGG;AACU,QAAA,cAAc,GAAG,KAAK,CAAC,aAAa,CAAc,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE9E;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAe,CAAC;IACp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,eAAe,EAAE,eAAe;gBAE/B,KAAK,CAAC,YAAY;gBACnB,oBAAC,mCAAsB,OAAG;gBAC1B,oBAAC,+BAAc,OAAG;gBAClB,oBAAC,wBAAc,OAAG;gBAClB,oBAAC,2CAAoB,OAAG;gBACxB,oBAAC,8BAAiB,OAAG;gBACrB,oBAAC,4BAAe,OAAG;gBACnB,oBAAC,wCAAmB,OAAG;gBACvB,oBAAC,4BAAa,OAAG;gBACjB,oBAAC,iCAAe,OAAG;gBACnB,6BACE,SAAS,EAAC,qCAAqC,EAC/C,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,IAAI,SAAS,CAAC;oBAE5D,oBAAC,4CAAqB,OAAG;oBACzB,oBAAC,8CAAsB,OAAG;oBAC1B,oBAAC,wCAAmB,OAAG,CACnB,CACQ,CACQ,CACrB,CACR,CAAC;AACJ,CAAC;AA1DD,sDA0DC","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 ConfigurableUi\n */\n\nimport \"./ConfigurableUiContent.scss\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Point } from \"@itwin/core-react\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\nimport { CursorInformation } from \"../cursor/CursorInformation\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { CursorPopupRenderer } from \"../cursor/cursorpopup/CursorPopupManager\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport { ElementTooltip } from \"../feedback/ElementTooltip\";\nimport { KeyboardShortcutMenu } from \"../keyboardshortcut/KeyboardShortcutMenu\";\nimport { InputFieldMessage } from \"../messages/InputField\";\nimport { PointerMessage } from \"../messages/Pointer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { WidgetPanelsFrontstage } from \"../widget-panels/Frontstage\";\nimport { ContentDialogRenderer } from \"../dialog/ContentDialogManager\";\nimport { UiFramework } from \"../UiFramework\";\nimport { InternalConfigurableUiManager } from \"./InternalConfigurableUiManager\";\nimport { MessageRenderer } from \"../messages/MessageRenderer\";\n\n// cSpell:ignore cursormenu cursorpopup\n\n/** Properties for [[ConfigurableUiContent]]\n * @public\n */\nexport interface ConfigurableUiContentProps extends CommonProps {\n /** React node of the Backstage */\n appBackstage?: React.ReactNode;\n\n /** @internal */\n idleTimeout?: number;\n /** @internal */\n intervalTimeout?: number;\n}\n\n/**\n * Allows children to get the bounds or other properties of the wrapper element.\n * @internal\n */\nexport const WrapperContext = React.createContext<HTMLElement>(document.body);\n\n/** The ConfigurableUiContent component is the component the pages specified using ConfigurableUi\n * @public\n */\nexport function ConfigurableUiContent(props: ConfigurableUiContentProps) {\n const [mainElement, setMainElement] = React.useState<HTMLElement>();\n const [portalContainer, setPortalContainer] = React.useState<HTMLElement>();\n React.useEffect(() => {\n UiFramework.keyboardShortcuts.setFocusToHome();\n }, []);\n\n React.useEffect(() => {\n InternalConfigurableUiManager.activityTracker.initialize({\n idleTimeout: props.idleTimeout,\n intervalTimeout: props.intervalTimeout,\n });\n return () => {\n InternalConfigurableUiManager.activityTracker.terminate();\n };\n }, [props.idleTimeout, props.intervalTimeout]);\n\n const handleMouseMove = React.useCallback((e: React.MouseEvent) => {\n const point = new Point(e.pageX, e.pageY);\n CursorInformation.handleMouseMove(point);\n }, []);\n\n return (\n <main\n role=\"main\"\n id=\"uifw-configurableui-wrapper\"\n className={props.className}\n style={props.style}\n onMouseMove={handleMouseMove}\n ref={(el) => setMainElement(el ?? undefined)}\n >\n <WrapperContext.Provider value={mainElement ?? document.body}>\n <ThemeProvider\n style={{ height: \"100%\" }}\n portalContainer={portalContainer}\n >\n {props.appBackstage}\n <WidgetPanelsFrontstage />\n <ElementTooltip />\n <PointerMessage />\n <KeyboardShortcutMenu />\n <InputFieldMessage />\n <CursorPopupMenu />\n <CursorPopupRenderer />\n <PopupRenderer />\n <MessageRenderer />\n <div\n className=\"uifw-configurableui-portalContainer\"\n ref={(instance) => setPortalContainer(instance ?? undefined)}\n >\n <ContentDialogRenderer />\n <ModelessDialogRenderer />\n <ModalDialogRenderer />\n </div>\n </ThemeProvider>\n </WrapperContext.Provider>\n </main>\n );\n}\n"]}
|
|
@@ -43,31 +43,6 @@
|
|
|
43
43
|
width: 100%;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.uifw-element-tooltip-container {
|
|
47
|
-
position: fixed;
|
|
48
|
-
left: 0;
|
|
49
|
-
top: 0;
|
|
50
|
-
width: 100%;
|
|
51
|
-
height: 100%;
|
|
52
|
-
pointer-events: none;
|
|
53
|
-
|
|
54
|
-
@include uicore-z-index(tooltip);
|
|
55
|
-
|
|
56
|
-
> .uifw-element-tooltip {
|
|
57
|
-
width: max-content;
|
|
58
|
-
font-size: var(--iui-font-size-1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
> .nz-popup-tooltip {
|
|
62
|
-
border: {
|
|
63
|
-
color: $uifw-popup-border-color;
|
|
64
|
-
radius: $uifw-popup-border-radius;
|
|
65
|
-
style: solid;
|
|
66
|
-
width: $uifw-popup-border-width;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
46
|
.uifw-app-button-small {
|
|
72
47
|
margin-bottom: 6px;
|
|
73
48
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Dialog
|
|
3
3
|
*/
|
|
4
|
+
import "./DialogManagerBase.scss";
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
import type { BeUiEvent } from "@itwin/core-bentley";
|
|
6
7
|
import { UiEvent } from "@itwin/appui-abstract";
|
|
@@ -68,9 +69,9 @@ export interface DialogRendererProps {
|
|
|
68
69
|
dialogManager: DialogManagerBase;
|
|
69
70
|
style?: React.CSSProperties;
|
|
70
71
|
}
|
|
71
|
-
/** @internal */
|
|
72
72
|
interface DialogRendererState {
|
|
73
|
-
parentDocument: Document |
|
|
73
|
+
parentDocument: Document | undefined;
|
|
74
|
+
renderer: HTMLElement | undefined;
|
|
74
75
|
}
|
|
75
76
|
/** DialogRenderer React component.
|
|
76
77
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogManagerBase.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/dialog/DialogManagerBase.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogManagerBase.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/dialog/DialogManagerBase.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKhD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;CAC3C;AAED;;;GAGG;AAEH,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,sBAAsB,CAAC;CAAG;AAE1E;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,QAAQ,CAAC;CAC1B;AAKD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAA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BAAmB,SAAQ,KAAK,CAAC,aAAa,CACzD,mBAAmB,EACnB,mBAAmB,CACpB;IACC,gBAAgB;IAChB,SAAyB,KAAK,EAAE,mBAAmB,CAGjD;IAEF,OAAO,CAAC,aAAa,CAKnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;IA0BzB,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAO5C,OAAO,CAAC,yBAAyB,CAE/B;CACH"}
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.DialogRendererBase = exports.DialogManagerBase = exports.DialogChangedEvent = void 0;
|
|
11
|
+
require("./DialogManagerBase.scss");
|
|
11
12
|
const React = require("react");
|
|
12
13
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
14
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
14
15
|
const UiFramework_1 = require("../UiFramework");
|
|
15
16
|
const core_react_1 = require("@itwin/core-react");
|
|
17
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
16
18
|
/** Dialog Changed Event class.
|
|
17
19
|
* @public
|
|
18
20
|
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
|
|
@@ -125,10 +127,14 @@ class DialogRendererBase extends React.PureComponent {
|
|
|
125
127
|
super(...arguments);
|
|
126
128
|
/** @internal */
|
|
127
129
|
this.state = {
|
|
128
|
-
parentDocument:
|
|
130
|
+
parentDocument: undefined,
|
|
131
|
+
renderer: undefined,
|
|
129
132
|
};
|
|
130
|
-
this._handleRefSet = (
|
|
131
|
-
this.setState({
|
|
133
|
+
this._handleRefSet = (el) => {
|
|
134
|
+
this.setState({
|
|
135
|
+
parentDocument: el?.ownerDocument ?? undefined,
|
|
136
|
+
renderer: el ?? undefined,
|
|
137
|
+
});
|
|
132
138
|
};
|
|
133
139
|
// eslint-disable-next-line deprecation/deprecation
|
|
134
140
|
this._handleDialogChangedEvent = (_args) => {
|
|
@@ -138,12 +144,13 @@ class DialogRendererBase extends React.PureComponent {
|
|
|
138
144
|
render() {
|
|
139
145
|
if (this.props.dialogManager.dialogCount <= 0)
|
|
140
146
|
return null;
|
|
141
|
-
return (React.createElement("div", { className: "
|
|
142
|
-
this.
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
return (React.createElement("div", { className: "uifw-dialog-dialogManagerBase_renderer", ref: this._handleRefSet },
|
|
148
|
+
React.createElement(itwinui_react_1.ThemeProvider, { portalContainer: this.state.renderer }, this.state.parentDocument &&
|
|
149
|
+
this.props.dialogManager.dialogs
|
|
150
|
+
.filter((info) => info.parentDocument === this.state.parentDocument)
|
|
151
|
+
.map((info) => {
|
|
152
|
+
return (React.createElement(React.Fragment, { key: info.id }, info.reactNode));
|
|
153
|
+
}))));
|
|
147
154
|
}
|
|
148
155
|
componentDidMount() {
|
|
149
156
|
this.props.dialogManager.onDialogChangedEvent.addListener(this._handleDialogChangedEvent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogManagerBase.js","sourceRoot":"","sources":["../../../../src/appui-react/dialog/DialogManagerBase.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAE/B,sDAA6C;AAC7C,0DAAgD;AAChD,gDAA6C;AAC7C,kDAA2D;AAW3D;;;GAGG;AACH,mDAAmD;AACnD,MAAa,kBAAmB,SAAQ,wBAA+B;CAAG;AAA1E,gDAA0E;AAW1E,+DAA+D;AAC/D,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAa,iBAAiB;IAO5B,mDAAmD;IACnD,YAAY,oBAAuD;QAN3D,aAAQ,GAAiB,IAAI,KAAK,EAAc,CAAC;QAOvD,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;IACpD,CAAC;IAED,6CAA6C;IACtC,MAAM,CAAC,UAAU;QACtB,iBAAiB,CA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WAAW,CACvD,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;IAEe,oBAAoB;QAClC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,cAAc,CAC1D,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;CAMF;AAnDD,gDAmDC","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 Dialog\n */\n\nimport * as React from \"react\";\nimport type { BeUiEvent } from \"@itwin/core-bentley\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { UiFramework } from \"../UiFramework\";\nimport { getCssVariableAsNumber } from \"@itwin/core-react\";\n\n/** Dialog Stack Changed Event Args class.\n * @public\n * @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface DialogChangedEventArgs {\n dialogCount: number;\n activeDialog: React.ReactNode | undefined;\n}\n\n/** Dialog Changed Event class.\n * @public\n * @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class DialogChangedEvent extends UiEvent<DialogChangedEventArgs> {}\n\n/** Information maintained by a Dialog Manager about a dialog\n * @public\n */\nexport interface DialogInfo {\n reactNode: React.ReactNode;\n id: string;\n parentDocument: Document;\n}\n\n/** Used if the 'dialog' z-index CSS variable cannot be read */\nconst ZINDEX_DEFAULT = 12000;\n\n/** Dialog Manager class.\n * @internal\n */\nexport class DialogManagerBase {\n private static _sId = 0;\n private _dialogs: DialogInfo[] = new Array<DialogInfo>();\n // eslint-disable-next-line deprecation/deprecation\n private _onDialogChangedEvent: BeUiEvent<DialogChangedEventArgs>;\n private static _topZIndex = ZINDEX_DEFAULT;\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(onDialogChangedEvent: BeUiEvent<DialogChangedEventArgs>) {\n this._onDialogChangedEvent = onDialogChangedEvent;\n }\n\n /** Initialize the modeless dialog manager */\n public static initialize(): void {\n DialogManagerBase._topZIndex = DialogManagerBase.getDialogZIndexDefault();\n }\n\n public static get topZIndex(): number {\n return DialogManagerBase._topZIndex;\n }\n\n public static set topZIndex(zIndex: number) {\n DialogManagerBase._topZIndex = zIndex;\n }\n public get dialogs() {\n return this._dialogs;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public get onDialogChangedEvent(): BeUiEvent<DialogChangedEventArgs> {\n return this._onDialogChangedEvent;\n }\n\n public static getDialogZIndexDefault(): number {\n const variable = \"--uicore-z-index-dialog\";\n const value = getCssVariableAsNumber(variable);\n\n if (!isNaN(value)) return value;\n\n Logger.logError(\n UiFramework.loggerCategory(this),\n `'${variable}' CSS variable not found`\n );\n return ZINDEX_DEFAULT;\n }\n\n /**\n * Triggers opening a dialog.\n * @param dialog Dialog React component.\n * @param id The unique Id the identifies the dialog.\n * @param parentDocument Optional document required when displaying a dialog in a child popup window.\n */\n public openDialog(\n dialog: React.ReactNode,\n id?: string,\n parentDocument?: Document\n ): void {\n if (!id) id = `Dialog-${++DialogManagerBase._sId}`;\n\n const owningDoc = parentDocument ?? document;\n this.pushDialog({ reactNode: dialog, id, parentDocument: owningDoc });\n }\n\n /** @internal */\n public pushDialog(dialogInfo: DialogInfo): void {\n this._dialogs.push(dialogInfo);\n this.emitDialogChangedEvent();\n }\n\n public closeDialog(dialog?: React.ReactNode): void {\n let targetDialog = dialog;\n if (!dialog) targetDialog = this.activeDialog;\n\n this.removeDialog(targetDialog);\n this.emitDialogChangedEvent();\n }\n\n /** @internal */\n public closeAll(): void {\n this._dialogs = [];\n this.emitDialogChangedEvent();\n }\n\n /** @internal */\n public removeDialog(dialog: React.ReactNode): void {\n const index = this._dialogs.findIndex((dialogInfo: DialogInfo) => {\n return dialog === dialogInfo.reactNode;\n });\n if (index >= 0) this._dialogs.splice(index, 1);\n if (this._dialogs.length < 1)\n DialogManagerBase.topZIndex = DialogManagerBase.getDialogZIndexDefault();\n }\n\n public emitDialogChangedEvent(): void {\n this._onDialogChangedEvent.emit({\n dialogCount: this.dialogCount,\n activeDialog: this.activeDialog,\n });\n }\n\n public update(): void {\n this.emitDialogChangedEvent();\n }\n\n public get activeDialog(): React.ReactNode | undefined {\n if (this._dialogs.length > 0)\n return this._dialogs[this._dialogs.length - 1].reactNode;\n\n return undefined;\n }\n\n public get dialogCount(): number {\n return this._dialogs.length;\n }\n}\n\n/** Properties for the [[DialogRendererBase]] component\n * @internal\n */\nexport interface DialogRendererProps {\n dialogManager: DialogManagerBase;\n style?: React.CSSProperties;\n}\n\n/** @internal */\ninterface DialogRendererState {\n parentDocument: Document | null;\n}\n/** DialogRenderer React component.\n * @internal\n */\nexport class DialogRendererBase extends React.PureComponent<\n DialogRendererProps,\n DialogRendererState\n> {\n /** @internal */\n public override readonly state: DialogRendererState = {\n parentDocument: null,\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 (this.props.dialogManager.dialogCount <= 0) return null;\n\n return (\n <div\n className=\"appui-react-dialog-render-container\"\n ref={this._handleRefSet}\n >\n {this.state.parentDocument &&\n this.props.dialogManager.dialogs\n .filter((info) => info.parentDocument === this.state.parentDocument)\n .map((dialogInfo: DialogInfo) => {\n return (\n <React.Fragment key={dialogInfo.id}>\n {dialogInfo.reactNode}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n\n public override componentDidMount(): void {\n this.props.dialogManager.onDialogChangedEvent.addListener(\n this._handleDialogChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n this.props.dialogManager.onDialogChangedEvent.removeListener(\n this._handleDialogChangedEvent\n );\n }\n\n // eslint-disable-next-line deprecation/deprecation\n private _handleDialogChangedEvent = (_args: DialogChangedEventArgs) => {\n this.forceUpdate();\n };\n}\n"]}
|
|
1
|
+
{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MAAM;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAE3D,OAAO,CACL,6BACE,SAAS,EAAC,wCAAwC,EAClD,GAAG,EAAE,IAAI,CAAC,aAAa;YAEvB,oBAAC,6BAAa,IAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAChD,IAAI,CAAC,KAAK,CAAC,cAAc;gBACxB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO;qBAC7B,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,CAC5D;qBACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBACZ,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IACzB,IAAI,CAAC,SAAS,CACA,CAClB,CAAC;gBACJ,CAAC,CAAC,CACQ,CACZ,CACP,CAAC;IACJ,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,WAAW,CACvD,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;IAEe,oBAAoB;QAClC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,cAAc,CAC1D,IAAI,CAAC,yBAAyB,CAC/B,CAAC;IACJ,CAAC;CAMF;AA3DD,gDA2DC","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 Dialog\n */\n\nimport \"./DialogManagerBase.scss\";\nimport * as React from \"react\";\nimport type { BeUiEvent } from \"@itwin/core-bentley\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { UiFramework } from \"../UiFramework\";\nimport { getCssVariableAsNumber } from \"@itwin/core-react\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\n\n/** Dialog Stack Changed Event Args class.\n * @public\n * @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface DialogChangedEventArgs {\n dialogCount: number;\n activeDialog: React.ReactNode | undefined;\n}\n\n/** Dialog Changed Event class.\n * @public\n * @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class DialogChangedEvent extends UiEvent<DialogChangedEventArgs> {}\n\n/** Information maintained by a Dialog Manager about a dialog\n * @public\n */\nexport interface DialogInfo {\n reactNode: React.ReactNode;\n id: string;\n parentDocument: Document;\n}\n\n/** Used if the 'dialog' z-index CSS variable cannot be read */\nconst ZINDEX_DEFAULT = 12000;\n\n/** Dialog Manager class.\n * @internal\n */\nexport class DialogManagerBase {\n private static _sId = 0;\n private _dialogs: DialogInfo[] = new Array<DialogInfo>();\n // eslint-disable-next-line deprecation/deprecation\n private _onDialogChangedEvent: BeUiEvent<DialogChangedEventArgs>;\n private static _topZIndex = ZINDEX_DEFAULT;\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(onDialogChangedEvent: BeUiEvent<DialogChangedEventArgs>) {\n this._onDialogChangedEvent = onDialogChangedEvent;\n }\n\n /** Initialize the modeless dialog manager */\n public static initialize(): void {\n DialogManagerBase._topZIndex = DialogManagerBase.getDialogZIndexDefault();\n }\n\n public static get topZIndex(): number {\n return DialogManagerBase._topZIndex;\n }\n\n public static set topZIndex(zIndex: number) {\n DialogManagerBase._topZIndex = zIndex;\n }\n public get dialogs() {\n return this._dialogs;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public get onDialogChangedEvent(): BeUiEvent<DialogChangedEventArgs> {\n return this._onDialogChangedEvent;\n }\n\n public static getDialogZIndexDefault(): number {\n const variable = \"--uicore-z-index-dialog\";\n const value = getCssVariableAsNumber(variable);\n\n if (!isNaN(value)) return value;\n\n Logger.logError(\n UiFramework.loggerCategory(this),\n `'${variable}' CSS variable not found`\n );\n return ZINDEX_DEFAULT;\n }\n\n /**\n * Triggers opening a dialog.\n * @param dialog Dialog React component.\n * @param id The unique Id the identifies the dialog.\n * @param parentDocument Optional document required when displaying a dialog in a child popup window.\n */\n public openDialog(\n dialog: React.ReactNode,\n id?: string,\n parentDocument?: Document\n ): void {\n if (!id) id = `Dialog-${++DialogManagerBase._sId}`;\n\n const owningDoc = parentDocument ?? document;\n this.pushDialog({ reactNode: dialog, id, parentDocument: owningDoc });\n }\n\n /** @internal */\n public pushDialog(dialogInfo: DialogInfo): void {\n this._dialogs.push(dialogInfo);\n this.emitDialogChangedEvent();\n }\n\n public closeDialog(dialog?: React.ReactNode): void {\n let targetDialog = dialog;\n if (!dialog) targetDialog = this.activeDialog;\n\n this.removeDialog(targetDialog);\n this.emitDialogChangedEvent();\n }\n\n /** @internal */\n public closeAll(): void {\n this._dialogs = [];\n this.emitDialogChangedEvent();\n }\n\n /** @internal */\n public removeDialog(dialog: React.ReactNode): void {\n const index = this._dialogs.findIndex((dialogInfo: DialogInfo) => {\n return dialog === dialogInfo.reactNode;\n });\n if (index >= 0) this._dialogs.splice(index, 1);\n if (this._dialogs.length < 1)\n DialogManagerBase.topZIndex = DialogManagerBase.getDialogZIndexDefault();\n }\n\n public emitDialogChangedEvent(): void {\n this._onDialogChangedEvent.emit({\n dialogCount: this.dialogCount,\n activeDialog: this.activeDialog,\n });\n }\n\n public update(): void {\n this.emitDialogChangedEvent();\n }\n\n public get activeDialog(): React.ReactNode | undefined {\n if (this._dialogs.length > 0)\n return this._dialogs[this._dialogs.length - 1].reactNode;\n\n return undefined;\n }\n\n public get dialogCount(): number {\n return this._dialogs.length;\n }\n}\n\n/** Properties for the [[DialogRendererBase]] component\n * @internal\n */\nexport interface DialogRendererProps {\n dialogManager: DialogManagerBase;\n style?: React.CSSProperties;\n}\n\ninterface DialogRendererState {\n parentDocument: Document | undefined;\n renderer: HTMLElement | undefined;\n}\n/** DialogRenderer React component.\n * @internal\n */\nexport class DialogRendererBase extends React.PureComponent<\n DialogRendererProps,\n DialogRendererState\n> {\n /** @internal */\n public override readonly state: DialogRendererState = {\n parentDocument: undefined,\n renderer: undefined,\n };\n\n private _handleRefSet = (el: HTMLElement | null) => {\n this.setState({\n parentDocument: el?.ownerDocument ?? undefined,\n renderer: el ?? undefined,\n });\n };\n\n public override render(): React.ReactNode {\n if (this.props.dialogManager.dialogCount <= 0) return null;\n\n return (\n <div\n className=\"uifw-dialog-dialogManagerBase_renderer\"\n ref={this._handleRefSet}\n >\n <ThemeProvider portalContainer={this.state.renderer}>\n {this.state.parentDocument &&\n this.props.dialogManager.dialogs\n .filter(\n (info) => info.parentDocument === this.state.parentDocument\n )\n .map((info) => {\n return (\n <React.Fragment key={info.id}>\n {info.reactNode}\n </React.Fragment>\n );\n })}\n </ThemeProvider>\n </div>\n );\n }\n\n public override componentDidMount(): void {\n this.props.dialogManager.onDialogChangedEvent.addListener(\n this._handleDialogChangedEvent\n );\n }\n\n public override componentWillUnmount(): void {\n this.props.dialogManager.onDialogChangedEvent.removeListener(\n this._handleDialogChangedEvent\n );\n }\n\n // eslint-disable-next-line deprecation/deprecation\n private _handleDialogChangedEvent = (_args: DialogChangedEventArgs) => {\n this.forceUpdate();\n };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/core-react/lib/cjs/core-react/z-index";
|
|
6
|
+
|
|
7
|
+
.uifw-dialog-dialogManagerBase_renderer {
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
10
|
+
@include uicore-z-index(dialog);
|
|
11
|
+
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Notification
|
|
3
3
|
*/
|
|
4
|
+
import "./ElementTooltip.scss";
|
|
5
|
+
import * as React from "react";
|
|
4
6
|
import { UiEvent } from "@itwin/appui-abstract";
|
|
5
7
|
import type { ToolTipOptions } from "@itwin/core-frontend";
|
|
6
8
|
import type { XAndY } from "@itwin/core-geometry";
|
|
7
9
|
import type { CommonProps } from "@itwin/core-react";
|
|
8
|
-
import * as React from "react";
|
|
9
10
|
import type { NotifyMessageType } from "../messages/ReactNotifyMessageDetails";
|
|
10
|
-
/** [[ElementTooltip]]
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
11
|
+
/** [[ElementTooltip]] state. */
|
|
13
12
|
interface ElementTooltipState {
|
|
14
13
|
isVisible: boolean;
|
|
15
14
|
message: NotifyMessageType;
|
|
@@ -46,19 +45,7 @@ export declare class ElementTooltip extends React.Component<CommonProps, Element
|
|
|
46
45
|
static hideTooltip(): void;
|
|
47
46
|
static get isTooltipHalted(): boolean;
|
|
48
47
|
static set isTooltipHalted(halt: boolean);
|
|
49
|
-
|
|
50
|
-
private _element?;
|
|
51
|
-
private _position?;
|
|
52
|
-
/** @internal */
|
|
53
|
-
readonly state: Readonly<ElementTooltipState>;
|
|
54
|
-
constructor(props: CommonProps);
|
|
55
|
-
render(): React.JSX.Element | null;
|
|
56
|
-
componentDidMount(): void;
|
|
57
|
-
componentWillUnmount(): void;
|
|
58
|
-
private static _handleMouseMove;
|
|
59
|
-
private _handleElementTooltipChangedEvent;
|
|
60
|
-
private _handleSizeChanged;
|
|
61
|
-
private updatePosition;
|
|
48
|
+
render(): React.JSX.Element;
|
|
62
49
|
}
|
|
63
50
|
export {};
|
|
64
51
|
//# sourceMappingURL=ElementTooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTooltip.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/feedback/ElementTooltip.tsx"],"names":[],"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