@itwin/appui-react 4.5.1 → 4.6.1
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 +20 -1
- package/lib/cjs/appui-react/accudraw/MenuButton.d.ts +2 -2
- package/lib/cjs/appui-react/accudraw/MenuButton.d.ts.map +1 -1
- package/lib/cjs/appui-react/accudraw/MenuButton.js.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposer.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.js +3 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +2 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/cursor/CursorInformation.d.ts +6 -6
- package/lib/cjs/appui-react/cursor/CursorInformation.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/CursorInformation.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.d.ts +4 -4
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts +5 -5
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopupManager.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.d.ts +2 -2
- package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
- package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts +1 -2
- package/lib/cjs/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
- package/lib/cjs/appui-react/feedback/ElementTooltip.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +22 -26
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +185 -254
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts +1 -7
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js +0 -6
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useActiveIModelConnection.d.ts.map +1 -1
- package/lib/cjs/appui-react/hooks/useActiveIModelConnection.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useActiveViewport.d.ts.map +1 -1
- package/lib/cjs/appui-react/hooks/useActiveViewport.js.map +1 -1
- package/lib/cjs/appui-react/keyboardshortcut/InternalKeyboardShortcut.d.ts.map +1 -1
- package/lib/cjs/appui-react/keyboardshortcut/InternalKeyboardShortcut.js.map +1 -1
- package/lib/cjs/appui-react/messages/MessageManager.d.ts +0 -1
- package/lib/cjs/appui-react/messages/MessageManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/messages/MessageManager.js +1 -2
- package/lib/cjs/appui-react/messages/MessageManager.js.map +1 -1
- package/lib/cjs/appui-react/messages/Pointer.d.ts +1 -2
- package/lib/cjs/appui-react/messages/Pointer.d.ts.map +1 -1
- package/lib/cjs/appui-react/messages/Pointer.js +1 -1
- package/lib/cjs/appui-react/messages/Pointer.js.map +1 -1
- package/lib/cjs/appui-react/popup/PositionPopup.d.ts +2 -2
- package/lib/cjs/appui-react/popup/PositionPopup.d.ts.map +1 -1
- package/lib/cjs/appui-react/popup/PositionPopup.js.map +1 -1
- package/lib/cjs/appui-react/settings/ui/UiSettingsPage.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts +16 -20
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +80 -115
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/MessageCenter.js +1 -2
- package/lib/cjs/appui-react/statusfields/MessageCenter.js.map +1 -1
- package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts +36 -0
- package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts.map +1 -0
- package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.js +134 -0
- package/lib/cjs/appui-react/syncui/InternalSyncUiEventDispatcher.js.map +1 -0
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +2 -2
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/cjs/appui-react/syncui/UiSyncEvent.d.ts +16 -0
- package/lib/cjs/appui-react/syncui/UiSyncEvent.d.ts.map +1 -0
- package/lib/cjs/appui-react/syncui/UiSyncEvent.js +18 -0
- package/lib/cjs/appui-react/syncui/UiSyncEvent.js.map +1 -0
- package/lib/cjs/appui-react/uistate/AppUiSettings.d.ts.map +1 -1
- package/lib/cjs/appui-react/uistate/AppUiSettings.js.map +1 -1
- package/lib/cjs/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
- package/lib/cjs/appui-react/uistate/useUiStateStorage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts +7 -29
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +101 -434
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js +16 -3
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/cjs/appui-react/widgets/Widget.d.ts +10 -4
- package/lib/cjs/appui-react/widgets/Widget.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/Widget.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +9 -29
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +89 -46
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +1 -0
- package/lib/cjs/appui-react.d.ts.map +1 -1
- package/lib/cjs/appui-react.js +1 -0
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/accudraw/MenuButton.d.ts +2 -2
- package/lib/esm/appui-react/accudraw/MenuButton.d.ts.map +1 -1
- package/lib/esm/appui-react/accudraw/MenuButton.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposer.js.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.js +3 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +2 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/cursor/CursorInformation.d.ts +6 -6
- package/lib/esm/appui-react/cursor/CursorInformation.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/CursorInformation.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.d.ts +4 -4
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts +5 -5
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopupManager.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.d.ts +2 -2
- package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
- package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/esm/appui-react/feedback/ElementTooltip.d.ts +1 -2
- package/lib/esm/appui-react/feedback/ElementTooltip.d.ts.map +1 -1
- package/lib/esm/appui-react/feedback/ElementTooltip.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +22 -26
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +189 -258
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts +1 -7
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js +0 -6
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/esm/appui-react/hooks/useActiveIModelConnection.d.ts.map +1 -1
- package/lib/esm/appui-react/hooks/useActiveIModelConnection.js.map +1 -1
- package/lib/esm/appui-react/hooks/useActiveViewport.d.ts.map +1 -1
- package/lib/esm/appui-react/hooks/useActiveViewport.js.map +1 -1
- package/lib/esm/appui-react/keyboardshortcut/InternalKeyboardShortcut.d.ts.map +1 -1
- package/lib/esm/appui-react/keyboardshortcut/InternalKeyboardShortcut.js.map +1 -1
- package/lib/esm/appui-react/messages/MessageManager.d.ts +0 -1
- package/lib/esm/appui-react/messages/MessageManager.d.ts.map +1 -1
- package/lib/esm/appui-react/messages/MessageManager.js +1 -2
- package/lib/esm/appui-react/messages/MessageManager.js.map +1 -1
- package/lib/esm/appui-react/messages/Pointer.d.ts +1 -2
- package/lib/esm/appui-react/messages/Pointer.d.ts.map +1 -1
- package/lib/esm/appui-react/messages/Pointer.js +1 -1
- package/lib/esm/appui-react/messages/Pointer.js.map +1 -1
- package/lib/esm/appui-react/popup/PositionPopup.d.ts +2 -2
- package/lib/esm/appui-react/popup/PositionPopup.d.ts.map +1 -1
- package/lib/esm/appui-react/popup/PositionPopup.js.map +1 -1
- package/lib/esm/appui-react/settings/ui/UiSettingsPage.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts +16 -20
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +78 -114
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/MessageCenter.js +1 -2
- package/lib/esm/appui-react/statusfields/MessageCenter.js.map +1 -1
- package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts +36 -0
- package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.d.ts.map +1 -0
- package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.js +130 -0
- package/lib/esm/appui-react/syncui/InternalSyncUiEventDispatcher.js.map +1 -0
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +2 -2
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/esm/appui-react/syncui/UiSyncEvent.d.ts +16 -0
- package/lib/esm/appui-react/syncui/UiSyncEvent.d.ts.map +1 -0
- package/lib/esm/appui-react/syncui/UiSyncEvent.js +14 -0
- package/lib/esm/appui-react/syncui/UiSyncEvent.js.map +1 -0
- package/lib/esm/appui-react/uistate/AppUiSettings.d.ts.map +1 -1
- package/lib/esm/appui-react/uistate/AppUiSettings.js.map +1 -1
- package/lib/esm/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
- package/lib/esm/appui-react/uistate/useUiStateStorage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts +7 -29
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +104 -433
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.js +16 -3
- package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/esm/appui-react/widgets/Widget.d.ts +10 -4
- package/lib/esm/appui-react/widgets/Widget.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/Widget.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts +9 -29
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +89 -46
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react.d.ts +1 -0
- package/lib/esm/appui-react.d.ts.map +1 -1
- package/lib/esm/appui-react.js +1 -0
- package/lib/esm/appui-react.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# Change Log - @itwin/appui-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 12 Oct 2023 16:59:20 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.6.1
|
|
6
|
+
Thu, 12 Oct 2023 16:59:20 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Fix an issue where `onWidgetStateChangedEvent` is not emitted for a hidden widget.
|
|
11
|
+
|
|
12
|
+
## 4.6.0
|
|
13
|
+
Wed, 04 Oct 2023 18:05:34 GMT
|
|
14
|
+
|
|
15
|
+
### Updates
|
|
16
|
+
|
|
17
|
+
- Disable user select when dragging or resizing a widget.
|
|
18
|
+
- Correctly configure `resizable` flag of a floating widget after docking and undocking.
|
|
19
|
+
- Fixed tool settings widget so that can set to dockings not allowed
|
|
20
|
+
- Fix message center messages icon colors based on message severity.
|
|
21
|
+
- Fix an issue with closing tool settings dropdown when main UI hides.
|
|
22
|
+
- React to core/appui-abstract deprecations
|
|
4
23
|
|
|
5
24
|
## 4.5.1
|
|
6
25
|
Fri, 08 Sep 2023 16:10:53 GMT
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import "./MenuButton.scss";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import type {
|
|
6
|
+
import type { XAndY } from "@itwin/core-geometry";
|
|
7
7
|
import type { SizeProps } from "@itwin/core-react";
|
|
8
8
|
import type { SquareButtonProps } from "./SquareButton";
|
|
9
9
|
/** @alpha */
|
|
10
10
|
export interface MenuButtonProps extends SquareButtonProps {
|
|
11
11
|
/** Center point */
|
|
12
|
-
point:
|
|
12
|
+
point: XAndY;
|
|
13
13
|
/** Function called when size is known. */
|
|
14
14
|
onSizeKnown?: (size: SizeProps) => void;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/accudraw/MenuButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"MenuButton.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/accudraw/MenuButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,aAAa;AACb,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,0CAA0C;IAC1C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACzC;AAED,gBAAgB;AAChB,UAAU,eAAe;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,aAAa;AACb,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CACjD,eAAe,EACf,eAAe,CAChB;IACC,OAAO,CAAC,KAAK,CAA4B;gBAE7B,KAAK,EAAE,eAAe;IAQlB,MAAM;IAuCtB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,KAAK,CAKX;IAEF,OAAO,CAAC,YAAY,CAOlB;IAGF,OAAO,CAAC,YAAY,CAElB;CACH"}
|
|
@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ent":["/*---------------------------------------------------------------------------------------------\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 AccuDraw\n */\n\nimport \"./MenuButton.scss\";\nimport * as React from \"react\";\nimport type {
|
|
1
|
+
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../../src/appui-react/accudraw/MenuButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6BAA2B;AAC3B,+BAA+B;AAG/B,kDAA4D;AAE5D,iDAA8C;AAC9C,oEAAqD;AAerD,aAAa;AACb,MAAa,UAAW,SAAQ,KAAK,CAAC,aAGrC;IAGC,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,UAAK,GAAuB,IAAI,CAAC;QA4DjC,UAAK,GAAG,GAAG,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;gBACrC,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK;oBAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEM,iBAAY,GAAG,CAAC,KAAU,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACvB,KAAK,CAAC,eAAe,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;aACpC;iBAAM;gBACL,IAAI,CAAC,KAAK,EAAE,CAAC;aACd;QACH,CAAC,CAAC;QAEF,uBAAuB;QACf,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC;QA1EA,IAAI,CAAC,KA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MAAM,CAAC,CAAC;YAE/C,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW;gBAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAC1D;IACH,CAAC;CAsBF;AApFD,gCAoFC","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 AccuDraw\n */\n\nimport \"./MenuButton.scss\";\nimport * as React from \"react\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport type { SizeProps } from \"@itwin/core-react\";\nimport { ContextMenu, Icon, Size } from \"@itwin/core-react\";\nimport type { SquareButtonProps } from \"./SquareButton\";\nimport { SquareButton } from \"./SquareButton\";\nimport { SvgMore } from \"@itwin/itwinui-icons-react\";\n\n/** @alpha */\nexport interface MenuButtonProps extends SquareButtonProps {\n /** Center point */\n point: XAndY;\n /** Function called when size is known. */\n onSizeKnown?: (size: SizeProps) => void;\n}\n\n/** @internal */\ninterface MenuButtonState {\n expanded: boolean;\n}\n\n/** @alpha */\nexport class MenuButton extends React.PureComponent<\n MenuButtonProps,\n MenuButtonState\n> {\n private _menu: ContextMenu | null = null;\n\n constructor(props: MenuButtonProps) {\n super(props);\n\n this.state = {\n expanded: false,\n };\n }\n\n public override render() {\n const { point, className, style, onSizeKnown, ...buttonProps } = this.props;\n\n const divStyle: React.CSSProperties = {\n top: point.y,\n left: point.x,\n };\n\n return (\n <div\n className=\"uifw-menu-button\"\n style={divStyle}\n ref={(e) => this.setDivRef(e)}\n >\n <SquareButton\n {...buttonProps}\n className={className}\n style={style}\n onClick={this._handleClick}\n >\n <Icon iconSpec={<SvgMore />} />\n </SquareButton>\n <ContextMenu\n ref={(el) => {\n this._menu = el;\n }}\n selectedIndex={0}\n onSelect={this._handleClose}\n onOutsideClick={this._handleClose}\n onEsc={this._handleClose}\n opened={this.state.expanded}\n autoflip={false}\n >\n {this.props.children}\n </ContextMenu>\n </div>\n );\n }\n\n private setDivRef(div: HTMLDivElement | null) {\n // istanbul ignore else\n if (div) {\n const rect = div.getBoundingClientRect();\n const size = new Size(rect.width, rect.height);\n\n // istanbul ignore else\n if (this.props.onSizeKnown) this.props.onSizeKnown(size);\n }\n }\n\n private _open = () => {\n this.setState({ expanded: true }, () => {\n // istanbul ignore else\n if (this._menu) this._menu.focus();\n });\n };\n\n private _handleClick = (event: any) => {\n if (this.state.expanded) {\n event.stopPropagation();\n this.setState({ expanded: false });\n } else {\n this._open();\n }\n };\n\n // istanbul ignore next\n private _handleClose = () => {\n this.setState({ expanded: false });\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackstageComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/backstage/BackstageComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"BackstageComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/backstage/BackstageComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA6ErD,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AAEvE,gBAAgB;AAChB,eAAO,MAAM,eAAe,UACnB,cAAc,aAAa,CAAC,iBA0BpC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,gGAAgG;IAChG,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,mHAAmH;IACnH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,wFAAwF;IACxF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAmE9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackstageComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/backstage/BackstageComposer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,0DAAgE;AAEhE,kEAGmC;AACnC,iEAA8D;AAC9D,2EAAwE;AACxE,mEAAgE;AAChE,yDAA6E;AAC7E,yEAAsE;AACtE,yFAAsF;AACtF,iEAAqE;AAErE,mDAA2D;AAC3D,mEAAgE;AAEhE,yBAAyB;AAEzB,0EAA0E;AAC1E,SAAS,0BAA0B,CACjC,YAAmC,EACnC,iBAA2B;IAE3B,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,cAAc,CAAC,OAAO,EAAE;YAC1B,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;YAC/B,2EAA2E;YAC3E,YAAY,CAAC,oBAAoB,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;SAC/D;QAED,OAAO,6CAAqB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9D,IAAI,CAAC,KAAK,iBAAiB,CAAC,MAAM;gBAAE,OAAO;YAE3C,uBAAuB;YACvB,IACE,iBAAiB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E,IAAA,wCAAsB,EAAC,cAAc,CAAC,EACtD,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAEjB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAChC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;QAC5B,MAAM,YAAY,GAAG,CACnB,oBAAC,6CAAqB,IAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAI,CACpD,CAAC;QACF,OAAO,SAAS,KAAK,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CACzC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,UAAU;YAC7B,oBAAC,uCAAkB,OAAG;YACrB,YAAY,CACE,CAClB,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CAAC;IACJ,CAAC,CAAC,CACH,CACY,CAChB,CAAC;AACJ,CAAC;AAnED,8CAmEC","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 Backstage\n */\n\nimport * as React from \"react\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport {\n BackstageSeparator,\n Backstage as NZ_Backstage,\n} from \"@itwin/appui-layout-react\";\nimport { SafeAreaContext } from \"../safearea/SafeAreaContext\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\nimport { BackstageComposerItem } from \"./BackstageComposerItem\";\nimport { useBackstageManager, useIsBackstageOpen } from \"./BackstageManager\";\nimport { useDefaultBackstageItems } from \"./useDefaultBackstageItems\";\nimport { useUiItemsProviderBackstageItems } from \"./useUiItemsProviderBackstageItems\";\nimport { toLayoutSafeAreaInsets } from \"../safearea/SafeAreaHelpers\";\nimport type { BackstageItem } from \"./BackstageItem\";\nimport { isBackstageStageLauncher } from \"./BackstageItem\";\nimport { BackstageItemsManager } from \"./BackstageItemsManager\";\n\n// cSpell:ignore safearea\n\n/** Private function to set up sync event monitoring of backstage items */\nfunction useBackstageItemSyncEffect(\n itemsManager: BackstageItemsManager,\n syncIdsOfInterest: string[]\n) {\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n // initialize the display state of any items with syncIds/condition defined\n itemsManager.refreshAffectedItems(new Set(syncIdsOfInterest));\n }\n\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n if (0 === syncIdsOfInterest.length) return;\n\n // istanbul ignore else\n if (\n syncIdsOfInterest.some((value: string): boolean =>\n args.eventIds.has(value.toLowerCase())\n )\n ) {\n // process each item that has interest\n itemsManager.refreshAffectedItems(args.eventIds);\n }\n });\n }, [itemsManager, itemsManager.items, syncIdsOfInterest]);\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n stageItems: ReadonlyArray<BackstageItem>,\n addonItems: ReadonlyArray<BackstageItem>,\n hideSoloStageEntry: boolean\n): ReadonlyArray<BackstageItem> {\n let items: Array<BackstageItem> = [];\n if (stageItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n stageItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n if (addonItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n addonItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n\n if (hideSoloStageEntry) {\n // per user request don't show stage launcher if only one stage is available\n const numberOfFrontstageItems = items.reduce(\n (accumulator, item) =>\n accumulator + (isBackstageStageLauncher(item) ? 1 : 0),\n 0\n );\n if (1 === numberOfFrontstageItems)\n items = items.filter((item) => !isBackstageStageLauncher(item));\n }\n\n return items;\n}\n\n/** @internal */\nexport type GroupedItems = ReadonlyArray<ReadonlyArray<BackstageItem>>;\n\n/** @internal */\nexport const useGroupedItems = (\n items: ReadonlyArray<BackstageItem>\n): GroupedItems => {\n return React.useMemo(() => {\n const grouped = items.reduce<GroupedItems>((acc, item) => {\n if (ConditionalBooleanValue.getValue(item.isHidden)) return acc;\n const groupIndex = acc.findIndex(\n (group) => group[0].groupPriority === item.groupPriority\n );\n if (groupIndex >= 0)\n return [\n ...acc.slice(0, groupIndex),\n [...acc[groupIndex], item],\n ...acc.slice(groupIndex + 1),\n ];\n return [...acc, [item]];\n }, []);\n const sortedGroups = grouped.reduce<GroupedItems>((acc, group) => {\n const sortedGroup = [...group].sort(\n (a, b) => a.itemPriority - b.itemPriority\n );\n return [...acc, sortedGroup];\n }, []);\n return [...sortedGroups].sort(\n (a, b) => a[0].groupPriority - b[0].groupPriority\n );\n }, [items]);\n};\n\n/** Props of [[BackstageComposer]] component.\n * @public\n */\nexport interface BackstageComposerProps extends CommonProps {\n /** React node for an optional header item */\n readonly header?: React.ReactNode;\n /** Indicates whether to place an overlay over the frontstage when the backstage is displayed */\n readonly showOverlay?: boolean;\n /** List of static backstage items to show. Can be undefined in UiItemsProviders are used to populate backstage. */\n readonly items?: BackstageItem[];\n /** If true and only one stage launcher item is found, do not show entry in backstage */\n readonly hideSoloStageEntry?: boolean;\n}\n\n/** Backstage component composed from [[UiFramework.backstage]] items.\n * @public\n */\nexport function BackstageComposer(props: BackstageComposerProps) {\n const [defaultItemsManager, setDefaultItemsManager] = React.useState(\n new BackstageItemsManager(props.items)\n );\n const initialItems = React.useRef(props.items);\n\n React.useEffect(() => {\n if (initialItems.current !== props.items) {\n initialItems.current = props.items;\n setDefaultItemsManager(new BackstageItemsManager(props.items));\n }\n }, [props.items]);\n\n const manager = useBackstageManager();\n const isOpen = useIsBackstageOpen(manager);\n const safeAreaInsets = React.useContext(SafeAreaContext);\n const handleClose = React.useCallback(() => {\n manager.close();\n }, [manager]);\n\n const defaultItems = useDefaultBackstageItems(defaultItemsManager);\n const syncIdsOfInterest = React.useMemo(\n () => BackstageItemsManager.getSyncIdsOfInterest(defaultItems),\n [defaultItems]\n );\n useBackstageItemSyncEffect(defaultItemsManager, syncIdsOfInterest);\n\n const [addonItemsManager] = React.useState(new BackstageItemsManager());\n const addonItems = useUiItemsProviderBackstageItems(addonItemsManager);\n const addonSyncIdsOfInterest = React.useMemo(\n () => BackstageItemsManager.getSyncIdsOfInterest(addonItems),\n [addonItems]\n );\n useBackstageItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);\n\n const combinedBackstageItems = React.useMemo(\n () => combineItems(defaultItems, addonItems, !!props.hideSoloStageEntry),\n [defaultItems, addonItems, props.hideSoloStageEntry]\n );\n const groups = useGroupedItems(combinedBackstageItems);\n return (\n <NZ_Backstage\n className={props.className}\n header={props.header}\n isOpen={isOpen}\n onClose={handleClose}\n safeAreaInsets={toLayoutSafeAreaInsets(safeAreaInsets)}\n showOverlay={props.showOverlay}\n style={props.style}\n >\n {groups.map((group, groupIndex) =>\n group.map((item, itemIndex) => {\n const composerItem = (\n <BackstageComposerItem item={item} key={item.id} />\n );\n return itemIndex === 0 && groupIndex > 0 ? (\n <React.Fragment key={groupIndex}>\n <BackstageSeparator />\n {composerItem}\n </React.Fragment>\n ) : (\n composerItem\n );\n })\n )}\n </NZ_Backstage>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BackstageComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/backstage/BackstageComposer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,0DAAgE;AAEhE,kEAGmC;AACnC,iEAA8D;AAC9D,2EAAwE;AACxE,mEAAgE;AAChE,yDAA6E;AAC7E,yEAAsE;AACtE,yFAAsF;AACtF,iEAAqE;AAErE,mDAA2D;AAC3D,mEAAgE;AAGhE,yBAAyB;AAEzB,0EAA0E;AAC1E,SAAS,0BAA0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AC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;IAEtE,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,CAC1C,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,EACxE,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,kBAAkB,CAAC,CACrD,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,sBAAsB,CAAC,CAAC;IACvD,OAAO,CACL,oBAAC,8BAAY,IACX,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,IAAA,wCAAsB,EAAC,cAAc,CAAC,EACtD,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAEjB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAChC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;QAC5B,MAAM,YAAY,GAAG,CACnB,oBAAC,6CAAqB,IAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAI,CACpD,CAAC;QACF,OAAO,SAAS,KAAK,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CACzC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,UAAU;YAC7B,oBAAC,uCAAkB,OAAG;YACrB,YAAY,CACE,CAClB,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CAAC;IACJ,CAAC,CAAC,CACH,CACY,CAChB,CAAC;AACJ,CAAC;AAnED,8CAmEC","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 Backstage\n */\n\nimport * as React from \"react\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport {\n BackstageSeparator,\n Backstage as NZ_Backstage,\n} from \"@itwin/appui-layout-react\";\nimport { SafeAreaContext } from \"../safearea/SafeAreaContext\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\nimport { BackstageComposerItem } from \"./BackstageComposerItem\";\nimport { useBackstageManager, useIsBackstageOpen } from \"./BackstageManager\";\nimport { useDefaultBackstageItems } from \"./useDefaultBackstageItems\";\nimport { useUiItemsProviderBackstageItems } from \"./useUiItemsProviderBackstageItems\";\nimport { toLayoutSafeAreaInsets } from \"../safearea/SafeAreaHelpers\";\nimport type { BackstageItem } from \"./BackstageItem\";\nimport { isBackstageStageLauncher } from \"./BackstageItem\";\nimport { BackstageItemsManager } from \"./BackstageItemsManager\";\nimport type { UiSyncEventArgs } from \"../syncui/UiSyncEvent\";\n\n// cSpell:ignore safearea\n\n/** Private function to set up sync event monitoring of backstage items */\nfunction useBackstageItemSyncEffect(\n itemsManager: BackstageItemsManager,\n syncIdsOfInterest: string[]\n) {\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n // initialize the display state of any items with syncIds/condition defined\n itemsManager.refreshAffectedItems(new Set(syncIdsOfInterest));\n }\n\n return SyncUiEventDispatcher.onSyncUiEvent.addListener(\n (args: UiSyncEventArgs) => {\n if (0 === syncIdsOfInterest.length) return;\n\n // istanbul ignore else\n if (\n syncIdsOfInterest.some((value: string): boolean =>\n args.eventIds.has(value.toLowerCase())\n )\n ) {\n // process each item that has interest\n itemsManager.refreshAffectedItems(args.eventIds);\n }\n }\n );\n }, [itemsManager, itemsManager.items, syncIdsOfInterest]);\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n stageItems: ReadonlyArray<BackstageItem>,\n addonItems: ReadonlyArray<BackstageItem>,\n hideSoloStageEntry: boolean\n): ReadonlyArray<BackstageItem> {\n let items: Array<BackstageItem> = [];\n if (stageItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n stageItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n if (addonItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n addonItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n\n if (hideSoloStageEntry) {\n // per user request don't show stage launcher if only one stage is available\n const numberOfFrontstageItems = items.reduce(\n (accumulator, item) =>\n accumulator + (isBackstageStageLauncher(item) ? 1 : 0),\n 0\n );\n if (1 === numberOfFrontstageItems)\n items = items.filter((item) => !isBackstageStageLauncher(item));\n }\n\n return items;\n}\n\n/** @internal */\nexport type GroupedItems = ReadonlyArray<ReadonlyArray<BackstageItem>>;\n\n/** @internal */\nexport const useGroupedItems = (\n items: ReadonlyArray<BackstageItem>\n): GroupedItems => {\n return React.useMemo(() => {\n const grouped = items.reduce<GroupedItems>((acc, item) => {\n if (ConditionalBooleanValue.getValue(item.isHidden)) return acc;\n const groupIndex = acc.findIndex(\n (group) => group[0].groupPriority === item.groupPriority\n );\n if (groupIndex >= 0)\n return [\n ...acc.slice(0, groupIndex),\n [...acc[groupIndex], item],\n ...acc.slice(groupIndex + 1),\n ];\n return [...acc, [item]];\n }, []);\n const sortedGroups = grouped.reduce<GroupedItems>((acc, group) => {\n const sortedGroup = [...group].sort(\n (a, b) => a.itemPriority - b.itemPriority\n );\n return [...acc, sortedGroup];\n }, []);\n return [...sortedGroups].sort(\n (a, b) => a[0].groupPriority - b[0].groupPriority\n );\n }, [items]);\n};\n\n/** Props of [[BackstageComposer]] component.\n * @public\n */\nexport interface BackstageComposerProps extends CommonProps {\n /** React node for an optional header item */\n readonly header?: React.ReactNode;\n /** Indicates whether to place an overlay over the frontstage when the backstage is displayed */\n readonly showOverlay?: boolean;\n /** List of static backstage items to show. Can be undefined in UiItemsProviders are used to populate backstage. */\n readonly items?: BackstageItem[];\n /** If true and only one stage launcher item is found, do not show entry in backstage */\n readonly hideSoloStageEntry?: boolean;\n}\n\n/** Backstage component composed from [[UiFramework.backstage]] items.\n * @public\n */\nexport function BackstageComposer(props: BackstageComposerProps) {\n const [defaultItemsManager, setDefaultItemsManager] = React.useState(\n new BackstageItemsManager(props.items)\n );\n const initialItems = React.useRef(props.items);\n\n React.useEffect(() => {\n if (initialItems.current !== props.items) {\n initialItems.current = props.items;\n setDefaultItemsManager(new BackstageItemsManager(props.items));\n }\n }, [props.items]);\n\n const manager = useBackstageManager();\n const isOpen = useIsBackstageOpen(manager);\n const safeAreaInsets = React.useContext(SafeAreaContext);\n const handleClose = React.useCallback(() => {\n manager.close();\n }, [manager]);\n\n const defaultItems = useDefaultBackstageItems(defaultItemsManager);\n const syncIdsOfInterest = React.useMemo(\n () => BackstageItemsManager.getSyncIdsOfInterest(defaultItems),\n [defaultItems]\n );\n useBackstageItemSyncEffect(defaultItemsManager, syncIdsOfInterest);\n\n const [addonItemsManager] = React.useState(new BackstageItemsManager());\n const addonItems = useUiItemsProviderBackstageItems(addonItemsManager);\n const addonSyncIdsOfInterest = React.useMemo(\n () => BackstageItemsManager.getSyncIdsOfInterest(addonItems),\n [addonItems]\n );\n useBackstageItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);\n\n const combinedBackstageItems = React.useMemo(\n () => combineItems(defaultItems, addonItems, !!props.hideSoloStageEntry),\n [defaultItems, addonItems, props.hideSoloStageEntry]\n );\n const groups = useGroupedItems(combinedBackstageItems);\n return (\n <NZ_Backstage\n className={props.className}\n header={props.header}\n isOpen={isOpen}\n onClose={handleClose}\n safeAreaInsets={toLayoutSafeAreaInsets(safeAreaInsets)}\n showOverlay={props.showOverlay}\n style={props.style}\n >\n {groups.map((group, groupIndex) =>\n group.map((item, itemIndex) => {\n const composerItem = (\n <BackstageComposerItem item={item} key={item.id} />\n );\n return itemIndex === 0 && groupIndex > 0 ? (\n <React.Fragment key={groupIndex}>\n <BackstageSeparator />\n {composerItem}\n </React.Fragment>\n ) : (\n composerItem\n );\n })\n )}\n </NZ_Backstage>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,
|
|
1
|
+
{"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,QA+B/B"}
|
|
@@ -12,7 +12,9 @@ exports.copyStyles = void 0;
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
function copyStyles(targetDoc, sourceDoc = document) {
|
|
15
|
-
const stylesheets =
|
|
15
|
+
const stylesheets = sourceDoc.adoptedStyleSheets
|
|
16
|
+
? Array.from([...sourceDoc.styleSheets, ...sourceDoc.adoptedStyleSheets])
|
|
17
|
+
: Array.from(sourceDoc.styleSheets);
|
|
16
18
|
// istanbul ignore next
|
|
17
19
|
stylesheets.forEach((stylesheet) => {
|
|
18
20
|
const css = stylesheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,SAAmB,EACnB,YAAsB,QAAQ;IAE9B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,C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eAAe,CAAC,CAAC;aAC7C;SACF;IACH,CAAC,CAAC,CAAC;IAEH,eAAe;IACf,MAAM,eAAe,GAAG,SAAS,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;IACxE,uBAAuB;IACvB,IAAI,eAAe,EAAE;QACnB,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KAC7D;AACH,CAAC;AAjCD,gCAiCC","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 * Copies the source CSS into the destination\n * @param targetDoc - target document\n * @param sourceDoc - source document\n * @internal\n */\nexport function copyStyles(\n targetDoc: Document,\n sourceDoc: Document = document\n) {\n const stylesheets = sourceDoc.adoptedStyleSheets\n ? Array.from([...sourceDoc.styleSheets, ...sourceDoc.adoptedStyleSheets])\n : Array.from(sourceDoc.styleSheets);\n\n // istanbul ignore next\n stylesheets.forEach((stylesheet) => {\n const css = stylesheet;\n if (stylesheet.href) {\n const newStyleElement = targetDoc.createElement(\"link\");\n newStyleElement.rel = \"stylesheet\";\n newStyleElement.href = stylesheet.href;\n targetDoc.head.appendChild(newStyleElement);\n } else {\n if (css && css.cssRules && css.cssRules.length > 0) {\n const newStyleElement = targetDoc.createElement(\"style\");\n Array.from(css.cssRules).forEach((rule) => {\n newStyleElement.appendChild(targetDoc.createTextNode(rule.cssText));\n });\n targetDoc.head.appendChild(newStyleElement);\n }\n }\n });\n\n // copy sprites\n const svgSymbolParent = sourceDoc.getElementById(\"__SVG_SPRITE_NODE__\");\n // istanbul ignore else\n if (svgSymbolParent) {\n targetDoc.body.appendChild(svgSymbolParent.cloneNode(true));\n }\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,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;IAEjC,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IAEI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IAEH,OAAO,CAAC,MAAM;IAWd;;;;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;IAoDjC,gGAAgG;IACzF,QAAQ;IAQf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,
|
|
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;IAEjC,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IAEI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IAEH,OAAO,CAAC,MAAM;IAWd;;;;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;IAoDjC,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"}
|
|
@@ -68,7 +68,8 @@ class InternalChildWindowManager {
|
|
|
68
68
|
else {
|
|
69
69
|
// call the following to convert popout to docked widget
|
|
70
70
|
const frontStageDef = UiFramework_1.UiFramework.frontstages.activeFrontstageDef;
|
|
71
|
-
frontStageDef &&
|
|
71
|
+
frontStageDef &&
|
|
72
|
+
frontStageDef.dockWidgetContainerByContainerId(childWindowId);
|
|
72
73
|
}
|
|
73
74
|
return true;
|
|
74
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gG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E;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;AA9OD,gEA8OC","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 && frontStageDef.dockPopoutWidgetContainer(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,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,CAAC,SAAS,CACjD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,KAAK,aAAa,CAC3D,CAAC;YACF,IAAI,CAAC,CAAC,KAAK,WAAW;gBAAE,OAAO,KAAK,CAAC;YACrC,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACvD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YAC7C,IAAI,kBAAkB,EAAE;gBACtB,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;aAC5B;iBAAM;gBACL,wDAAwD;gBACxD,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;gBAClE,aAAa;oBACX,aAAa,CAAC,gCAAgC,CAAC,aAAa,CAAC,CAAC;aACjE;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAuFJ,CAAC;IA3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,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,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Cursor
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { XAndY } from "@itwin/core-geometry";
|
|
5
5
|
import { RelativePosition, UiEvent } from "@itwin/appui-abstract";
|
|
6
6
|
/** Enum for Cursor Direction parts
|
|
7
7
|
* @public
|
|
@@ -30,8 +30,8 @@ export declare enum CursorDirection {
|
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
32
|
export interface CursorUpdatedEventArgs {
|
|
33
|
-
oldPt:
|
|
34
|
-
newPt:
|
|
33
|
+
oldPt: XAndY;
|
|
34
|
+
newPt: XAndY;
|
|
35
35
|
direction: CursorDirection;
|
|
36
36
|
}
|
|
37
37
|
/** Cursor Updated Event class.
|
|
@@ -47,8 +47,8 @@ export declare class CursorInformation {
|
|
|
47
47
|
private static _cursorDirection;
|
|
48
48
|
private static _cursorDirections;
|
|
49
49
|
/** The cursor position. */
|
|
50
|
-
static get cursorPosition():
|
|
51
|
-
static set cursorPosition(pt:
|
|
50
|
+
static get cursorPosition(): XAndY;
|
|
51
|
+
static set cursorPosition(pt: XAndY);
|
|
52
52
|
/** Gets the cursor X position. */
|
|
53
53
|
static get cursorX(): number;
|
|
54
54
|
/** Gets the cursor Y position. */
|
|
@@ -58,7 +58,7 @@ export declare class CursorInformation {
|
|
|
58
58
|
/** Gets the [[CursorUpdatedEvent]]. */
|
|
59
59
|
static readonly onCursorUpdatedEvent: CursorUpdatedEvent;
|
|
60
60
|
/** Handles the mouse movement. Sets the cursor position and direction and emits onCursorUpdatedEvent. */
|
|
61
|
-
static handleMouseMove(point:
|
|
61
|
+
static handleMouseMove(point: XAndY): void;
|
|
62
62
|
private static _determineMostFrequentDirection;
|
|
63
63
|
private static _mostFrequent;
|
|
64
64
|
private static _determineCursorDirection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorInformation.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/cursor/CursorInformation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CursorInformation.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/cursor/CursorInformation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,GAAG,OAAS;IACZ,IAAI,MAAS;IACb,KAAK,KAAS;IACd,MAAM,IAAS;CAChB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,GAAG,OAA2B;IAC9B,IAAI,MAA4B;IAChC,KAAK,KAA6B;IAClC,MAAM,IAA8B;IACpC,OAAO,OAAuD;IAC9D,QAAQ,OAAwD;IAChE,UAAU,MAA0D;IACpE,WAAW,KAA2D;CACvE;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,sBAAsB,CAAC;CAAG;AAE1E;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,eAAe,CAAsB;IACpD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CACD;IAE9B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAgC;IAEhE,2BAA2B;IAC3B,WAAkB,cAAc,IAAI,KAAK,CAExC;IACD,WAAkB,cAAc,CAAC,EAAE,EAAE,KAAK,EAEzC;IAED,kCAAkC;IAClC,WAAkB,OAAO,IAAI,MAAM,CAElC;IACD,kCAAkC;IAClC,WAAkB,OAAO,IAAI,MAAM,CAElC;IAED,kDAAkD;IAClD,WAAkB,eAAe,IAAI,eAAe,CAEnD;IAED,uCAAuC;IACvC,gBAAuB,oBAAoB,qBAA4B;IAEvE,0GAA0G;WAC5F,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAcjD,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAW9C,OAAO,CAAC,MAAM,CAAC,aAAa;IAuB5B,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAiBxC,gEAAgE;WAClD,sCAAsC,CAClD,eAAe,EAAE,eAAe,GAC/B,gBAAgB;IAiCnB,8BAA8B;WAChB,qBAAqB,IAAI,IAAI;CAG5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorInformation.js","sourceRoot":"","sources":["../../../../src/appui-react/cursor/CursorInformation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAAkE;AAClE,kDAA0C;AAE1C;;GAEG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,gEAAY,CAAA;IACZ,iEAAa,CAAA;IACb,kEAAc,CAAA;IACd,mEAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B;AAED;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,sDAA8B,CAAA;IAC9B,uDAAgC,CAAA;IAChC,wDAAkC,CAAA;IAClC,yDAAoC,CAAA;IACpC,8DAA8D,CAAA;IAC9D,gEAAgE,CAAA;IAChE,mEAAoE,CAAA;IACpE,oEAAsE,CAAA;AACxE,CAAC,EAVW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU1B;AAWD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAA+B;CAAG;AAA1E,gDAA0E;AAE1E;;GAEG;AACH,MAAa,iBAAiB;IAO5B,2BAA2B;IACpB,MAAM,KAAK,cAAc;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACM,MAAM,KAAK,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"CursorInformation.js","sourceRoot":"","sources":["../../../../src/appui-react/cursor/CursorInformation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAAkE;AAClE,kDAA0C;AAE1C;;GAEG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,gEAAY,CAAA;IACZ,iEAAa,CAAA;IACb,kEAAc,CAAA;IACd,mEAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B;AAED;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,sDAA8B,CAAA;IAC9B,uDAAgC,CAAA;IAChC,wDAAkC,CAAA;IAClC,yDAAoC,CAAA;IACpC,8DAA8D,CAAA;IAC9D,gEAAgE,CAAA;IAChE,mEAAoE,CAAA;IACpE,oEAAsE,CAAA;AACxE,CAAC,EAVW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU1B;AAWD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAA+B;CAAG;AAA1E,gDAA0E;AAE1E;;GAEG;AACH,MAAa,iBAAiB;IAO5B,2BAA2B;IACpB,MAAM,KAAK,cAAc;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACM,MAAM,KAAK,cAAc,CAAC,EAAS;QACxC,IAAI,CAAC,eAAe,GAAG,kBAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,kCAAkC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BAAgB,GAAG,iCAAgB,CAAC,GAAG,CAAC;gBACxC,MAAM;YACR,KAAK,eAAe,CAAC,IAAI;gBACvB,gBAAgB,GAAG,iCAAgB,CAAC,IAAI,CAAC;gBACzC,MAAM;YACR,KAAK,eAAe,CAAC,KAAK;gBACxB,gBAAgB,GAAG,iCAAgB,CAAC,KAAK,CAAC;gBAC1C,MAAM;YACR,KAAK,eAAe,CAAC,MAAM;gBACzB,gBAAgB,GAAG,iCAAgB,CAAC,MAAM,CAAC;gBAC3C,MAAM;YACR,KAAK,eAAe,CAAC,OAAO;gBAC1B,gBAAgB,GAAG,iCAAgB,CAAC,OAAO,CAAC;gBAC5C,MAAM;YACR,KAAK,eAAe,CAAC,QAAQ;gBAC3B,gBAAgB,GAAG,iCAAgB,CAAC,QAAQ,CAAC;gBAC7C,MAAM;YACR,KAAK,eAAe,CAAC,UAAU;gBAC7B,gBAAgB,GAAG,iCAAgB,CAAC,UAAU,CAAC;gBAC/C,MAAM;YACR,KAAK,eAAe,CAAC,WAAW;gBAC9B,gBAAgB,GAAG,iCAAgB,CAAC,WAAW,CAAC;gBAChD,MAAM;SACT;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,8BAA8B;IACvB,MAAM,CAAC,qBAAqB;QACjC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,CAAC;;AAxIc,iCAAe,GAAU,IAAI,kBAAK,EAAE,CAAC;AACrC,kCAAgB,GAC7B,eAAe,CAAC,WAAW,CAAC;AAEf,mCAAiB,GAAG,IAAI,KAAK,EAAmB,CAAC;AAwBhE,uCAAuC;AAChB,sCAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AA9B5D,8CAAiB","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 Cursor\n */\n\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport { RelativePosition, UiEvent } from \"@itwin/appui-abstract\";\nimport { Point } from \"@itwin/core-react\";\n\n/** Enum for Cursor Direction parts\n * @public\n */\nexport enum CursorDirectionParts {\n Top = 0x1000,\n Left = 0x0100,\n Right = 0x0010,\n Bottom = 0x0001,\n}\n\n/** Enum for Cursor Direction\n * @public\n */\nexport enum CursorDirection {\n None = 0,\n Top = CursorDirectionParts.Top,\n Left = CursorDirectionParts.Left,\n Right = CursorDirectionParts.Right,\n Bottom = CursorDirectionParts.Bottom,\n TopLeft = CursorDirectionParts.Top | CursorDirectionParts.Left,\n TopRight = CursorDirectionParts.Top | CursorDirectionParts.Right,\n BottomLeft = CursorDirectionParts.Bottom | CursorDirectionParts.Left,\n BottomRight = CursorDirectionParts.Bottom | CursorDirectionParts.Right,\n}\n\n/** Cursor Updated Event Args interface.\n * @public\n */\nexport interface CursorUpdatedEventArgs {\n oldPt: XAndY;\n newPt: XAndY;\n direction: CursorDirection;\n}\n\n/** Cursor Updated Event class.\n * @public\n */\nexport class CursorUpdatedEvent extends UiEvent<CursorUpdatedEventArgs> {}\n\n/** Cursor Information class\n * @public\n */\nexport class CursorInformation {\n private static _cursorPosition: Point = new Point();\n private static _cursorDirection: CursorDirection =\n CursorDirection.BottomRight;\n\n private static _cursorDirections = new Array<CursorDirection>();\n\n /** The cursor position. */\n public static get cursorPosition(): XAndY {\n return this._cursorPosition;\n }\n public static set cursorPosition(pt: XAndY) {\n this._cursorPosition = Point.create(pt);\n }\n\n /** Gets the cursor X position. */\n public static get cursorX(): number {\n return this._cursorPosition.x;\n }\n /** Gets the cursor Y position. */\n public static get cursorY(): number {\n return this._cursorPosition.y;\n }\n\n /** Gets the general cursor movement direction. */\n public static get cursorDirection(): CursorDirection {\n return this._cursorDirection;\n }\n\n /** Gets the [[CursorUpdatedEvent]]. */\n public static readonly onCursorUpdatedEvent = new CursorUpdatedEvent();\n\n /** Handles the mouse movement. Sets the cursor position and direction and emits onCursorUpdatedEvent. */\n public static handleMouseMove(point: XAndY): void {\n const oldPt = CursorInformation.cursorPosition;\n const direction = this._determineMostFrequentDirection(\n this._cursorDirections,\n this._cursorPosition,\n Point.create(point)\n );\n\n this.cursorPosition = point;\n this._cursorDirection = direction;\n\n this.onCursorUpdatedEvent.emit({ oldPt, newPt: point, direction });\n }\n\n private static _determineMostFrequentDirection(\n cursorDirections: CursorDirection[],\n oldPt: Point,\n newPt: Point\n ): CursorDirection {\n const cursorDirection = this._determineCursorDirection(oldPt, newPt);\n cursorDirections.push(cursorDirection);\n if (cursorDirections.length > 10) cursorDirections.shift();\n return this._mostFrequent(cursorDirections);\n }\n\n private static _mostFrequent(array: CursorDirection[]): CursorDirection {\n const hashMap = new Map<CursorDirection, number>();\n let maxCount = 0,\n mostFrequent = CursorDirection.None;\n\n array.forEach((value: CursorDirection) => {\n const key = value;\n let frequency = hashMap.get(key);\n\n if (frequency !== undefined) frequency++;\n else frequency = 1;\n\n hashMap.set(key, frequency);\n\n if (frequency > maxCount) {\n mostFrequent = key;\n maxCount = frequency;\n }\n });\n\n return mostFrequent;\n }\n\n private static _determineCursorDirection(\n oldPt: Point,\n newPt: Point\n ): CursorDirection {\n let directionParts: number = 0;\n\n if (newPt.x < oldPt.x) directionParts |= CursorDirectionParts.Left;\n else if (newPt.x > oldPt.x) directionParts |= CursorDirectionParts.Right;\n\n if (newPt.y < oldPt.y) directionParts |= CursorDirectionParts.Top;\n else if (newPt.y > oldPt.y) directionParts |= CursorDirectionParts.Bottom;\n\n const direction = directionParts as CursorDirection;\n\n return direction;\n }\n\n /** Gets the relative position based on the cursor direction. */\n public static getRelativePositionFromCursorDirection(\n cursorDirection: CursorDirection\n ): RelativePosition {\n let relativePosition: RelativePosition = RelativePosition.BottomRight;\n\n switch (cursorDirection) {\n case CursorDirection.Top:\n relativePosition = RelativePosition.Top;\n break;\n case CursorDirection.Left:\n relativePosition = RelativePosition.Left;\n break;\n case CursorDirection.Right:\n relativePosition = RelativePosition.Right;\n break;\n case CursorDirection.Bottom:\n relativePosition = RelativePosition.Bottom;\n break;\n case CursorDirection.TopLeft:\n relativePosition = RelativePosition.TopLeft;\n break;\n case CursorDirection.TopRight:\n relativePosition = RelativePosition.TopRight;\n break;\n case CursorDirection.BottomLeft:\n relativePosition = RelativePosition.BottomLeft;\n break;\n case CursorDirection.BottomRight:\n relativePosition = RelativePosition.BottomRight;\n break;\n }\n\n return relativePosition;\n }\n\n /** @internal - for testing */\n public static clearCursorDirections(): void {\n this._cursorDirections.length = 0;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorMenu.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursormenu/CursorMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CursorMenu.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursormenu/CursorMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;CACzB;AAED;;GAEG;AAEH,qBAAa,eAAgB,SAAQ,KAAK,CAAC,aAAa,CACtD,WAAW,EACX,oBAAoB,CACrB;IACC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,kBAAkB,CAAC,CAAS;IAEpC,gBAAgB;IAChB,SAAyB,KAAK,EAAE,oBAAoB,CAKlD;IAEF,OAAO,CAAC,kBAAkB,CAsBxB;IAEc,iBAAiB;IAKjB,oBAAoB;IAKpC,OAAO,CAAC,aAAa,CAQnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;IA4BzC,OAAO,CAAC,gBAAgB,CAEtB;IAEF,OAAO,CAAC,WAAW,CAEjB;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorMenu.js","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursormenu/CursorMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;
|
|
1
|
+
{"version":3,"file":"CursorMenu.js","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursormenu/CursorMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAE/B,kDAAsD,CAAC,kBAAkB;AACzE,2DAAgE;AAEhE,oDAAwD;AACxD,8EAA2E;AAC3E,mDAAgD;AAChD,sDAA6C;AAa7C;;GAEG;AACH,uBAAuB;AACvB,MAAa,eAAgB,SAAQ,KAAK,CAAC,aAG1C;IAHD;;QAIU,eAAU,GAAG,KAAK,CAAC,CAAC,mGAAmG;QAG/H,gBAAgB;QACS,UAAK,GAAyB;YACrD,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;YACR,WAAW,EAAE,KAAK;YAClB,KAAK,EAAE,SAAS;SACjB,CAAC;QAEM,uBAAkB,GAAG,CAAC,IAAqB,EAAQ,EAAE;YAC3D,0BAA0B;YAC1B,IAAI,CAAC,IAAI,CAAC,UAAU;gBAAE,OAAO;YAE7B,0BAA0B;YAC1B,IACE,6CAAqB,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACtD,mCAAoB,CAAC,gBAAgB;aACtC,CAAC,EACF;gBACA,MAAM,QAAQ,GAAG,yBAAW,CAAC,iBAAiB,EAAE,CAAC;gBACjD,IAAI,QAAQ,IAAI,IAAI,CAAC,kBAAkB,KAAK,QAAQ,CAAC,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G,KAAK,CAAC;QACxB,6CAAqB,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC9E,CAAC;IAYe,MAAM;QACpB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAEtC,OAAO,CACL,6BAAK,SAAS,EAAC,gCAAgC,EAAC,GAAG,EAAE,IAAI,CAAC,aAAa,IACpE,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,IAAI,CAC3C,oBAAC,8BAAiB,IAChB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,UAAU,EAAC,mBAAmB,EAC9B,CAAC,EAAE,KAAK,EACR,CAAC,EAAE,KAAK,EACR,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,IAAI,IAEb,0BAAe,CAAC,mBAAmB,CAClC,0BAAe,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CACzD,CACiB,CACrB,CACG,CACP,CAAC;IACJ,CAAC;CASF;AA9FD,0CA8FC","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 Cursor\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { GlobalContextMenu } from \"@itwin/core-react\"; // ContextSubMenu,\nimport { SessionStateActionId } from \"../../redux/SessionState\";\nimport type { MenuItemProps } from \"../../shared/MenuItem\";\nimport { MenuItemHelpers } from \"../../shared/MenuItem\";\nimport { SyncUiEventDispatcher } from \"../../syncui/SyncUiEventDispatcher\";\nimport { UiFramework } from \"../../UiFramework\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { UiSyncEventArgs } from \"../../syncui/UiSyncEvent\";\n\n/** State for [[CursorPopupMenu]] component\n * @alpha\n */\ninterface CursorPopupMenuState {\n menuX: number;\n menuY: number;\n menuVisible: boolean;\n items?: MenuItemProps[];\n}\n\n/** Popup Menu to show at cursor typically used by tools to provide a right-click context menu.\n * @alpha\n */\n// istanbul ignore next\nexport class CursorPopupMenu extends React.PureComponent<\n CommonProps,\n CursorPopupMenuState\n> {\n private _isMounted = false; // used to ensure _handleSyncUiEvent callback is not processed after componentWillUnmount is called\n private _hostChildWindowId?: string;\n\n /** @internal */\n public override readonly state: CursorPopupMenuState = {\n menuX: 0,\n menuY: 0,\n menuVisible: false,\n items: undefined,\n };\n\n private _handleSyncUiEvent = (args: UiSyncEventArgs): void => {\n /* istanbul ignore next */\n if (!this._isMounted) return;\n\n /* istanbul ignore else */\n if (\n SyncUiEventDispatcher.hasEventOfInterest(args.eventIds, [\n SessionStateActionId.UpdateCursorMenu,\n ])\n ) {\n const menuData = UiFramework.getCursorMenuData();\n if (menuData && this._hostChildWindowId === menuData.childWindowId) {\n this.setState({\n menuVisible: menuData.items && menuData.items.length > 0,\n items: menuData.items,\n menuX: menuData.position.x,\n menuY: menuData.position.y,\n });\n } else {\n this.setState({ menuVisible: false, items: undefined });\n }\n }\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n SyncUiEventDispatcher.onSyncUiEvent.addListener(this._handleSyncUiEvent);\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n SyncUiEventDispatcher.onSyncUiEvent.removeListener(this._handleSyncUiEvent);\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentWindow = popupDiv?.ownerDocument.defaultView ?? undefined;\n // if the window is not a pop out set to undefined\n this._hostChildWindowId = UiFramework.childWindows.findId(parentWindow);\n Logger.logInfo(\n UiFramework.loggerCategory(UiFramework),\n `Cursor Menu for ${this._hostChildWindowId ?? \"main\"} window`\n );\n };\n\n public override render(): React.ReactNode {\n const { menuX, menuY, items, menuVisible } = this.state;\n const onClose = this._hideContextMenu;\n\n return (\n <div className=\"uifw-cursor-menu-container-div\" ref={this._handleRefSet}>\n {items && items.length > 0 && menuVisible && (\n <GlobalContextMenu\n className={this.props.className}\n style={this.props.style}\n identifier=\"cursor-popup-menu\"\n x={menuX}\n y={menuY}\n opened={menuVisible}\n onEsc={onClose}\n onOutsideClick={onClose}\n edgeLimit={false}\n autoflip={true}\n >\n {MenuItemHelpers.createMenuItemNodes(\n MenuItemHelpers.createMenuItems(items, this._itemPicked)\n )}\n </GlobalContextMenu>\n )}\n </div>\n );\n }\n\n private _hideContextMenu = () => {\n this.setState({ menuVisible: false });\n };\n\n private _itemPicked = (): void => {\n this._hideContextMenu();\n };\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import "./CursorPopup.scss";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import type {
|
|
6
|
+
import type { XAndY } from "@itwin/core-geometry";
|
|
7
7
|
import { RelativePosition } from "@itwin/appui-abstract";
|
|
8
8
|
import type { CommonDivProps, CommonProps, RectangleProps, SizeProps } from "@itwin/core-react";
|
|
9
9
|
import { Size } from "@itwin/core-react";
|
|
@@ -13,8 +13,8 @@ import { Size } from "@itwin/core-react";
|
|
|
13
13
|
export interface CursorPopupProps extends CommonProps {
|
|
14
14
|
id: string;
|
|
15
15
|
content: React.ReactNode;
|
|
16
|
-
pt:
|
|
17
|
-
offset:
|
|
16
|
+
pt: XAndY;
|
|
17
|
+
offset: XAndY;
|
|
18
18
|
relativePosition: RelativePosition;
|
|
19
19
|
title?: string;
|
|
20
20
|
shadow?: boolean;
|
|
@@ -48,7 +48,7 @@ export declare class CursorPopup extends React.Component<CursorPopupProps, Curso
|
|
|
48
48
|
componentWillUnmount(): void;
|
|
49
49
|
private _handleCursorPopupFadeOutEvent;
|
|
50
50
|
/** @internal */
|
|
51
|
-
static getPopupRect(pt:
|
|
51
|
+
static getPopupRect(pt: XAndY, offset: XAndY, popupSize: SizeProps | undefined, relativePosition: RelativePosition): RectangleProps;
|
|
52
52
|
private setDivRef;
|
|
53
53
|
/** @internal */
|
|
54
54
|
render(): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPopup.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CursorPopup.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAO,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,KAAK,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACzC;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,IAAI,IAAA;IACJ,OAAO,IAAA;CACR;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAC9C,gBAAgB,EAChB,gBAAgB,CACjB;IACC,OAAO,CAAC,UAAU,CAAkB;IAEpC,gBAAgB;IAChB,OAAc,WAAW,SAAO;IAEhC,gBAAgB;gBACJ,KAAK,EAAE,gBAAgB;IASnB,iBAAiB;IAOjB,oBAAoB;IAOpC,OAAO,CAAC,8BAA8B,CAQpC;IAEF,gBAAgB;WACF,YAAY,CACxB,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,cAAc;IA2DjB,OAAO,CAAC,SAAS;IAiBjB,gBAAgB;IACA,MAAM;CAoCvB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,eAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPopup.js","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopup.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,8BAA4B;AAC5B,+BAA+B;AAC/B,2CAAoC;AAEpC,0DAAyD;AAOzD,kDAA8C;AAC9C,kEAAqD;AAErD,6DAA0D;AAiB1D;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,qDAAI,CAAA;IACJ,2DAAO,CAAA;AACT,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAUD;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,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AAK,CAAC,gBAAgB,CAC5B,CAAC;QAEF,MAAM,gBAAgB,GAAwB;YAC5C,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,GAAG,EAAE,SAAS,CAAC,GAAG;SACnB,CAAC;QAEF,MAAM,UAAU,GAAG,IAAA,oBAAU,EAC3B,kBAAkB,EAClB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,mBAAmB,EACxC,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,OAAO;YAC9C,0BAA0B,CAC7B,CAAC;QAEF,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAC7B,KAAK,EAAE,gBAAgB;YAEtB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CACnB,oBAAC,6BAAQ,IACP,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAC,wBAAwB,GAClC,CACH;YACA,IAAI,CAAC,KAAK,CAAC,OAAO,CACf,CACP,CAAC;IACJ,CAAC;;AA3JD,gBAAgB;AACF,uBAAW,GAAG,GAAG,AAAN,CAAO;AAPrB,kCAAW;AAoKxB;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAqB;IACtD,OAAO,oBAAC,gBAAG,OAAK,KAAK,EAAE,aAAa,EAAC,0BAA0B,GAAG,CAAC;AACrE,CAAC;AAFD,gDAEC","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 Cursor\n */\n\nimport \"./CursorPopup.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { PointProps } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type {\n CommonDivProps,\n CommonProps,\n RectangleProps,\n SizeProps,\n} from \"@itwin/core-react\";\nimport { Div, Size } from \"@itwin/core-react\";\nimport { TitleBar } from \"@itwin/appui-layout-react\";\nimport type { CursorPopupFadeOutEventArgs } from \"./CursorPopupManager\";\nimport { CursorPopupManager } from \"./CursorPopupManager\";\n\n/** Properties for the [[CursorPopup]] React component\n * @public\n */\nexport interface CursorPopupProps extends CommonProps {\n id: string;\n content: React.ReactNode;\n pt: PointProps;\n offset: PointProps;\n relativePosition: RelativePosition;\n title?: string;\n shadow?: boolean;\n /** Function called when size is known. */\n onSizeKnown?: (size: SizeProps) => void;\n}\n\n/** Enum for showing CursorPopup\n * @internal - unit testing\n */\nexport enum CursorPopupShow {\n Open,\n FadeOut,\n}\n\n/** State for the [[CursorPopup]] React component\n * @internal\n */\ninterface CursorPopupState {\n showPopup: CursorPopupShow;\n size: Size;\n}\n\n/** CursorPopup React component\n * @public\n */\nexport class CursorPopup extends React.Component<\n CursorPopupProps,\n CursorPopupState\n> {\n private _isMounted: boolean = false;\n\n /** @internal */\n public static fadeOutTime = 500;\n\n /** @internal */\n constructor(props: CursorPopupProps) {\n super(props);\n\n this.state = {\n showPopup: CursorPopupShow.Open,\n size: new Size(-1, -1),\n };\n }\n\n public override componentDidMount() {\n this._isMounted = true;\n CursorPopupManager.onCursorPopupFadeOutEvent.addListener(\n this._handleCursorPopupFadeOutEvent\n );\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n CursorPopupManager.onCursorPopupFadeOutEvent.removeListener(\n this._handleCursorPopupFadeOutEvent\n );\n }\n\n private _handleCursorPopupFadeOutEvent = (\n args: CursorPopupFadeOutEventArgs\n ) => {\n if (this.props.id === args.id) {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ showPopup: CursorPopupShow.FadeOut });\n }\n };\n\n /** @internal */\n public static getPopupRect(\n pt: PointProps,\n offset: PointProps,\n popupSize: SizeProps | undefined,\n relativePosition: RelativePosition\n ): RectangleProps {\n const popupRect = { top: 0, left: 0, right: 0, bottom: 0 };\n\n if (popupSize === undefined) return popupRect;\n\n switch (relativePosition) {\n case RelativePosition.Top:\n popupRect.bottom = pt.y - offset.y;\n popupRect.left = pt.x - popupSize.width / 2;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.Left:\n popupRect.right = pt.x - offset.x;\n popupRect.top = pt.y - popupSize.height / 2;\n popupRect.left = popupRect.right - popupSize.width;\n popupRect.bottom = popupRect.top + popupSize.height;\n break;\n case RelativePosition.Right:\n popupRect.left = pt.x + offset.x;\n popupRect.top = pt.y - popupSize.height / 2;\n popupRect.right = popupRect.left + popupSize.width;\n popupRect.bottom = popupRect.top + popupSize.height;\n break;\n case RelativePosition.Bottom:\n popupRect.top = pt.y + offset.y;\n popupRect.left = pt.x - popupSize.width / 2;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.TopLeft:\n popupRect.bottom = pt.y - offset.y;\n popupRect.right = pt.x - offset.x;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.left = popupRect.right - popupSize.width;\n break;\n case RelativePosition.TopRight:\n popupRect.bottom = pt.y - offset.y;\n popupRect.left = pt.x + offset.x;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.BottomLeft:\n popupRect.top = pt.y + offset.y;\n popupRect.right = pt.x - offset.x;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.left = popupRect.right - popupSize.width;\n break;\n case RelativePosition.BottomRight:\n popupRect.top = pt.y + offset.y;\n popupRect.left = pt.x + offset.x;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n }\n\n return popupRect;\n }\n\n private setDivRef(div: HTMLDivElement | null) {\n // istanbul ignore else\n if (div) {\n const rect = div.getBoundingClientRect();\n const newSize = new Size(rect.width, rect.height);\n\n // istanbul ignore else\n if (!this.state.size.equals(newSize)) {\n // istanbul ignore else\n if (this.props.onSizeKnown) this.props.onSizeKnown(newSize);\n\n // istanbul ignore else\n if (this._isMounted) this.setState({ size: newSize });\n }\n }\n }\n\n /** @internal */\n public override render() {\n const popupRect = CursorPopup.getPopupRect(\n this.props.pt,\n this.props.offset,\n this.state.size,\n this.props.relativePosition\n );\n\n const positioningStyle: React.CSSProperties = {\n left: popupRect.left,\n top: popupRect.top,\n };\n\n const classNames = classnames(\n \"uifw-cursorpopup\",\n this.props.shadow && \"core-popup-shadow\",\n this.state.showPopup === CursorPopupShow.FadeOut &&\n \"uifw-cursorpopup-fadeOut\"\n );\n\n return (\n <div\n className={classNames}\n ref={(e) => this.setDivRef(e)}\n style={positioningStyle}\n >\n {this.props.title && (\n <TitleBar\n title={this.props.title}\n className=\"uifw-cursorpopup-title\"\n />\n )}\n {this.props.content}\n </div>\n );\n }\n}\n\n/** CursorPopup content with padding\n * @public\n */\nexport function CursorPopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"uifw-cursorpopup-content\" />;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CursorPopup.js","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopup.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,8BAA4B;AAC5B,+BAA+B;AAC/B,2CAAoC;AAEpC,0DAAyD;AAOzD,kDAA8C;AAC9C,kEAAqD;AAErD,6DAA0D;AAiB1D;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,qDAAI,CAAA;IACJ,2DAAO,CAAA;AACT,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAUD;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,SAGtC;IAMC,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QAPP,eAAU,GAAY,KAAK,CAAC;QA6B5B,mCAA8B,GA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ACnB,CAAC;QAEF,MAAM,UAAU,GAAG,IAAA,oBAAU,EAC3B,kBAAkB,EAClB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,mBAAmB,EACxC,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,OAAO;YAC9C,0BAA0B,CAC7B,CAAC;QAEF,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAC7B,KAAK,EAAE,gBAAgB;YAEtB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CACnB,oBAAC,6BAAQ,IACP,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAC,wBAAwB,GAClC,CACH;YACA,IAAI,CAAC,KAAK,CAAC,OAAO,CACf,CACP,CAAC;IACJ,CAAC;;AA3JD,gBAAgB;AACF,uBAAW,GAAG,GAAG,AAAN,CAAO;AAPrB,kCAAW;AAoKxB;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAqB;IACtD,OAAO,oBAAC,gBAAG,OAAK,KAAK,EAAE,aAAa,EAAC,0BAA0B,GAAG,CAAC;AACrE,CAAC;AAFD,gDAEC","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 Cursor\n */\n\nimport \"./CursorPopup.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type {\n CommonDivProps,\n CommonProps,\n RectangleProps,\n SizeProps,\n} from \"@itwin/core-react\";\nimport { Div, Size } from \"@itwin/core-react\";\nimport { TitleBar } from \"@itwin/appui-layout-react\";\nimport type { CursorPopupFadeOutEventArgs } from \"./CursorPopupManager\";\nimport { CursorPopupManager } from \"./CursorPopupManager\";\n\n/** Properties for the [[CursorPopup]] React component\n * @public\n */\nexport interface CursorPopupProps extends CommonProps {\n id: string;\n content: React.ReactNode;\n pt: XAndY;\n offset: XAndY;\n relativePosition: RelativePosition;\n title?: string;\n shadow?: boolean;\n /** Function called when size is known. */\n onSizeKnown?: (size: SizeProps) => void;\n}\n\n/** Enum for showing CursorPopup\n * @internal - unit testing\n */\nexport enum CursorPopupShow {\n Open,\n FadeOut,\n}\n\n/** State for the [[CursorPopup]] React component\n * @internal\n */\ninterface CursorPopupState {\n showPopup: CursorPopupShow;\n size: Size;\n}\n\n/** CursorPopup React component\n * @public\n */\nexport class CursorPopup extends React.Component<\n CursorPopupProps,\n CursorPopupState\n> {\n private _isMounted: boolean = false;\n\n /** @internal */\n public static fadeOutTime = 500;\n\n /** @internal */\n constructor(props: CursorPopupProps) {\n super(props);\n\n this.state = {\n showPopup: CursorPopupShow.Open,\n size: new Size(-1, -1),\n };\n }\n\n public override componentDidMount() {\n this._isMounted = true;\n CursorPopupManager.onCursorPopupFadeOutEvent.addListener(\n this._handleCursorPopupFadeOutEvent\n );\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n CursorPopupManager.onCursorPopupFadeOutEvent.removeListener(\n this._handleCursorPopupFadeOutEvent\n );\n }\n\n private _handleCursorPopupFadeOutEvent = (\n args: CursorPopupFadeOutEventArgs\n ) => {\n if (this.props.id === args.id) {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ showPopup: CursorPopupShow.FadeOut });\n }\n };\n\n /** @internal */\n public static getPopupRect(\n pt: XAndY,\n offset: XAndY,\n popupSize: SizeProps | undefined,\n relativePosition: RelativePosition\n ): RectangleProps {\n const popupRect = { top: 0, left: 0, right: 0, bottom: 0 };\n\n if (popupSize === undefined) return popupRect;\n\n switch (relativePosition) {\n case RelativePosition.Top:\n popupRect.bottom = pt.y - offset.y;\n popupRect.left = pt.x - popupSize.width / 2;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.Left:\n popupRect.right = pt.x - offset.x;\n popupRect.top = pt.y - popupSize.height / 2;\n popupRect.left = popupRect.right - popupSize.width;\n popupRect.bottom = popupRect.top + popupSize.height;\n break;\n case RelativePosition.Right:\n popupRect.left = pt.x + offset.x;\n popupRect.top = pt.y - popupSize.height / 2;\n popupRect.right = popupRect.left + popupSize.width;\n popupRect.bottom = popupRect.top + popupSize.height;\n break;\n case RelativePosition.Bottom:\n popupRect.top = pt.y + offset.y;\n popupRect.left = pt.x - popupSize.width / 2;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.TopLeft:\n popupRect.bottom = pt.y - offset.y;\n popupRect.right = pt.x - offset.x;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.left = popupRect.right - popupSize.width;\n break;\n case RelativePosition.TopRight:\n popupRect.bottom = pt.y - offset.y;\n popupRect.left = pt.x + offset.x;\n popupRect.top = popupRect.bottom - popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n case RelativePosition.BottomLeft:\n popupRect.top = pt.y + offset.y;\n popupRect.right = pt.x - offset.x;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.left = popupRect.right - popupSize.width;\n break;\n case RelativePosition.BottomRight:\n popupRect.top = pt.y + offset.y;\n popupRect.left = pt.x + offset.x;\n popupRect.bottom = popupRect.top + popupSize.height;\n popupRect.right = popupRect.left + popupSize.width;\n break;\n }\n\n return popupRect;\n }\n\n private setDivRef(div: HTMLDivElement | null) {\n // istanbul ignore else\n if (div) {\n const rect = div.getBoundingClientRect();\n const newSize = new Size(rect.width, rect.height);\n\n // istanbul ignore else\n if (!this.state.size.equals(newSize)) {\n // istanbul ignore else\n if (this.props.onSizeKnown) this.props.onSizeKnown(newSize);\n\n // istanbul ignore else\n if (this._isMounted) this.setState({ size: newSize });\n }\n }\n }\n\n /** @internal */\n public override render() {\n const popupRect = CursorPopup.getPopupRect(\n this.props.pt,\n this.props.offset,\n this.state.size,\n this.props.relativePosition\n );\n\n const positioningStyle: React.CSSProperties = {\n left: popupRect.left,\n top: popupRect.top,\n };\n\n const classNames = classnames(\n \"uifw-cursorpopup\",\n this.props.shadow && \"core-popup-shadow\",\n this.state.showPopup === CursorPopupShow.FadeOut &&\n \"uifw-cursorpopup-fadeOut\"\n );\n\n return (\n <div\n className={classNames}\n ref={(e) => this.setDivRef(e)}\n style={positioningStyle}\n >\n {this.props.title && (\n <TitleBar\n title={this.props.title}\n className=\"uifw-cursorpopup-title\"\n />\n )}\n {this.props.content}\n </div>\n );\n }\n}\n\n/** CursorPopup content with padding\n * @public\n */\nexport function CursorPopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"uifw-cursorpopup-content\" />;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Cursor
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import type {
|
|
5
|
+
import type { XAndY } from "@itwin/core-geometry";
|
|
6
6
|
import { RelativePosition, UiEvent } from "@itwin/appui-abstract";
|
|
7
7
|
import { Point, Size } from "@itwin/core-react";
|
|
8
8
|
/** Options for the [[CursorPopupManager]] open method
|
|
@@ -22,7 +22,7 @@ export interface CursorPopupOptions {
|
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
24
|
export interface CursorPopupUpdatePositionEventArgs {
|
|
25
|
-
pt:
|
|
25
|
+
pt: XAndY;
|
|
26
26
|
}
|
|
27
27
|
/** CursorPopup Update Position Event class.
|
|
28
28
|
* @internal
|
|
@@ -77,13 +77,13 @@ export declare class CursorPopupManager {
|
|
|
77
77
|
private static pushPopup;
|
|
78
78
|
/** Called to open popup with a new set of properties
|
|
79
79
|
*/
|
|
80
|
-
static open(id: string, content: React.ReactNode, pt:
|
|
80
|
+
static open(id: string, content: React.ReactNode, pt: XAndY, offset: XAndY, relativePosition: RelativePosition, priority?: number, options?: CursorPopupOptions): void;
|
|
81
81
|
/** Called to update popup with a new set of properties
|
|
82
82
|
*/
|
|
83
|
-
static update(id: string, content: React.ReactNode, pt:
|
|
83
|
+
static update(id: string, content: React.ReactNode, pt: XAndY, offset: XAndY, relativePosition: RelativePosition, priority?: number): void;
|
|
84
84
|
/** Called to move the open popup to new location
|
|
85
85
|
*/
|
|
86
|
-
static updatePosition(pt:
|
|
86
|
+
static updatePosition(pt: XAndY): void;
|
|
87
87
|
/** Called when tool wants to close the popup
|
|
88
88
|
*/
|
|
89
89
|
static close(id: string, apply: boolean, fadeOut?: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPopupManager.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopupManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CursorPopupManager.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/cursor/cursorpopup/CursorPopupManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH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