@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
|
@@ -9,16 +9,15 @@
|
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { IModelApp } from "@itwin/core-frontend";
|
|
11
11
|
import { UiError } from "@itwin/appui-abstract";
|
|
12
|
-
import { Rectangle } from "@itwin/core-react";
|
|
13
|
-
import {
|
|
12
|
+
import { Rectangle, Size } from "@itwin/core-react";
|
|
13
|
+
import { getTabLocation, getWidgetLocation, isFloatingTabLocation, isFloatingWidgetLocation, isPanelTabLocation, isPopoutTabLocation, isPopoutWidgetLocation, NineZoneStateReducer, panelSides, } from "@itwin/appui-layout-react";
|
|
14
14
|
import { ContentGroupProvider } from "../content/ContentGroup";
|
|
15
|
-
import { StagePanelDef, StagePanelState
|
|
15
|
+
import { StagePanelDef, StagePanelState } from "../stagepanels/StagePanelDef";
|
|
16
16
|
import { UiFramework } from "../UiFramework";
|
|
17
17
|
import { WidgetDef, WidgetType } from "../widgets/WidgetDef";
|
|
18
18
|
import { TimeTracker } from "../configurableui/TimeTracker";
|
|
19
19
|
import { PopoutWidget } from "../childwindow/PopoutWidget";
|
|
20
|
-
import {
|
|
21
|
-
import { assert, BentleyStatus, ProcessDetector } from "@itwin/core-bentley";
|
|
20
|
+
import { BentleyStatus, ProcessDetector } from "@itwin/core-bentley";
|
|
22
21
|
import { StageUsage } from "./StageUsage";
|
|
23
22
|
import { StagePanelLocation } from "../stagepanels/StagePanelLocation";
|
|
24
23
|
import { WidgetState } from "../widgets/WidgetState";
|
|
@@ -101,101 +100,90 @@ export class FrontstageDef {
|
|
|
101
100
|
const panel = nineZone.panels[panelSide];
|
|
102
101
|
const location = this.toStagePanelLocation(panelSide);
|
|
103
102
|
const panelDef = this.getStagePanelDef(location);
|
|
104
|
-
if (panelDef)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
for (const widgetId of panel.widgets) {
|
|
111
|
-
const widget = nineZone.widgets[widgetId];
|
|
112
|
-
// istanbul ignore else
|
|
113
|
-
if (widget) {
|
|
114
|
-
for (const tabId of widget.tabs) {
|
|
115
|
-
const widgetDef = this.findWidgetDef(tabId);
|
|
116
|
-
if (widgetDef) {
|
|
117
|
-
let widgetState = WidgetState.Open;
|
|
118
|
-
if (widget.minimized || tabId !== widget.activeTabId)
|
|
119
|
-
widgetState = WidgetState.Closed;
|
|
120
|
-
widgetMap.set(widgetDef, widgetState);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
103
|
+
if (!panelDef)
|
|
104
|
+
continue;
|
|
105
|
+
const panelState = panel.collapsed
|
|
106
|
+
? StagePanelState.Minimized
|
|
107
|
+
: StagePanelState.Open;
|
|
108
|
+
panelMap.set(panelDef, panelState);
|
|
125
109
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
widgetMap.set(widgetDef, widgetState);
|
|
137
|
-
}
|
|
110
|
+
for (const widgetDef of this.widgetDefs) {
|
|
111
|
+
const widgetId = widgetDef.id;
|
|
112
|
+
if (widgetDef === this.toolSettings) {
|
|
113
|
+
if (!nineZone.toolSettings) {
|
|
114
|
+
widgetMap.set(widgetDef, WidgetState.Hidden);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
else if (nineZone.toolSettings.type === "docked") {
|
|
118
|
+
widgetMap.set(widgetDef, WidgetState.Open);
|
|
119
|
+
continue;
|
|
138
120
|
}
|
|
139
121
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
widgetMap.set(toolSettingsDef, WidgetState.Hidden);
|
|
145
|
-
}
|
|
146
|
-
else if (nineZone.toolSettings.type === "docked") {
|
|
147
|
-
widgetMap.set(toolSettingsDef, WidgetState.Open);
|
|
122
|
+
const tabLocation = getTabLocation(nineZone, widgetId);
|
|
123
|
+
if (!tabLocation) {
|
|
124
|
+
widgetMap.set(widgetDef, WidgetState.Hidden);
|
|
125
|
+
continue;
|
|
148
126
|
}
|
|
127
|
+
const widget = nineZone.widgets[tabLocation.widgetId];
|
|
128
|
+
let widgetState = WidgetState.Open;
|
|
129
|
+
if (widget.minimized || widgetId !== widget.activeTabId)
|
|
130
|
+
widgetState = WidgetState.Closed;
|
|
131
|
+
widgetMap.set(widgetDef, widgetState);
|
|
149
132
|
}
|
|
150
133
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (!
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const panel = state.panels[panelSide];
|
|
186
|
-
const location = this.toStagePanelLocation(panelSide);
|
|
187
|
-
const panelDef = this.getStagePanelDef(location);
|
|
188
|
-
if (panelDef) {
|
|
189
|
-
panelDef.size = panel.size;
|
|
190
|
-
panelDef.pinned = panel.pinned;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
134
|
+
triggerStateChangeEvents(oldState) {
|
|
135
|
+
const newState = this.nineZoneState;
|
|
136
|
+
if (!newState)
|
|
137
|
+
return;
|
|
138
|
+
if (this._isStageClosing || this._isApplicationClosing)
|
|
139
|
+
return;
|
|
140
|
+
const originalPanelStateMap = new Map();
|
|
141
|
+
const originalWidgetStateMap = new Map();
|
|
142
|
+
const newPanelStateMap = new Map();
|
|
143
|
+
const newWidgetStateMap = new Map();
|
|
144
|
+
this.populateStateMaps(oldState, originalPanelStateMap, originalWidgetStateMap);
|
|
145
|
+
this.populateStateMaps(newState, newPanelStateMap, newWidgetStateMap);
|
|
146
|
+
// Now walk and trigger set state events
|
|
147
|
+
newWidgetStateMap.forEach((newWidgetState, widgetDef) => {
|
|
148
|
+
const originalState = originalWidgetStateMap.get(widgetDef);
|
|
149
|
+
if (originalState === newWidgetState)
|
|
150
|
+
return;
|
|
151
|
+
widgetDef.handleWidgetStateChanged(newWidgetState);
|
|
152
|
+
});
|
|
153
|
+
newPanelStateMap.forEach((newPanelState, panelDef) => {
|
|
154
|
+
const originalState = originalPanelStateMap.get(panelDef);
|
|
155
|
+
if (originalState === newPanelState)
|
|
156
|
+
return;
|
|
157
|
+
panelDef.handlePanelStateChanged(newPanelState);
|
|
158
|
+
});
|
|
159
|
+
for (const panelSide of panelSides) {
|
|
160
|
+
const panel = newState.panels[panelSide];
|
|
161
|
+
const oldPanel = oldState.panels[panelSide];
|
|
162
|
+
const location = this.toStagePanelLocation(panelSide);
|
|
163
|
+
const panelDef = this.getStagePanelDef(location);
|
|
164
|
+
if (!panelDef)
|
|
165
|
+
continue;
|
|
166
|
+
if (panel.size !== oldPanel.size) {
|
|
167
|
+
panelDef.handleSizeChanged(panel.size);
|
|
193
168
|
}
|
|
194
|
-
|
|
195
|
-
|
|
169
|
+
if (panel.pinned !== oldPanel.pinned) {
|
|
170
|
+
panelDef.handlePinnedChanged(panel.pinned);
|
|
196
171
|
}
|
|
197
172
|
}
|
|
198
173
|
}
|
|
174
|
+
handlePopouts(oldState) {
|
|
175
|
+
const newState = this.nineZoneState;
|
|
176
|
+
const oldPopouts = oldState?.popoutWidgets.allIds || [];
|
|
177
|
+
const newPopouts = newState?.popoutWidgets.allIds || [];
|
|
178
|
+
const popoutsToClose = oldPopouts.filter((p) => !newPopouts.includes(p));
|
|
179
|
+
const popoutsToOpen = newPopouts.filter((p) => !oldPopouts.includes(p));
|
|
180
|
+
for (const popoutId of popoutsToClose) {
|
|
181
|
+
UiFramework.childWindows.close(popoutId, true);
|
|
182
|
+
}
|
|
183
|
+
for (const popoutId of popoutsToOpen) {
|
|
184
|
+
this.openPopoutWidgetContainer(popoutId);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
199
187
|
/** @internal */
|
|
200
188
|
get nineZoneState() {
|
|
201
189
|
return this._nineZoneState;
|
|
@@ -203,26 +191,31 @@ export class FrontstageDef {
|
|
|
203
191
|
set nineZoneState(state) {
|
|
204
192
|
if (this._nineZoneState === state)
|
|
205
193
|
return;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
194
|
+
const oldState = this._nineZoneState;
|
|
195
|
+
this._nineZoneState = state;
|
|
196
|
+
this.handlePopouts(oldState);
|
|
197
|
+
if (oldState) {
|
|
198
|
+
this.triggerStateChangeEvents(oldState);
|
|
199
|
+
}
|
|
200
|
+
const isClosing = this._isStageClosing || this._isApplicationClosing;
|
|
201
|
+
if (isClosing && !this.isReady)
|
|
202
|
+
return;
|
|
203
|
+
InternalFrontstageManager.onFrontstageNineZoneStateChangedEvent.emit({
|
|
204
|
+
frontstageDef: this,
|
|
205
|
+
state,
|
|
206
|
+
});
|
|
219
207
|
}
|
|
220
208
|
/** @internal */
|
|
221
|
-
get
|
|
222
|
-
return this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
209
|
+
get dispatch() {
|
|
210
|
+
return (this._dispatch ??= (action) => {
|
|
211
|
+
if (action.type === "RESIZE") {
|
|
212
|
+
InternalFrontstageManager.nineZoneSize = Size.create(action.size);
|
|
213
|
+
}
|
|
214
|
+
const state = this.nineZoneState;
|
|
215
|
+
if (!state)
|
|
216
|
+
return;
|
|
217
|
+
this.nineZoneState = NineZoneStateReducer(state, action);
|
|
218
|
+
});
|
|
226
219
|
}
|
|
227
220
|
/** @internal */
|
|
228
221
|
get timeTracker() {
|
|
@@ -512,7 +505,9 @@ export class FrontstageDef {
|
|
|
512
505
|
frontstageDef: this,
|
|
513
506
|
});
|
|
514
507
|
}
|
|
515
|
-
/**
|
|
508
|
+
/** Restores frontstage layout to initial configuration.
|
|
509
|
+
* @beta
|
|
510
|
+
*/
|
|
516
511
|
restoreLayout() {
|
|
517
512
|
for (const panelDef of this.panelDefs) {
|
|
518
513
|
panelDef.size = panelDef.defaultSize;
|
|
@@ -542,11 +537,7 @@ export class FrontstageDef {
|
|
|
542
537
|
if (!location)
|
|
543
538
|
return WidgetState.Hidden;
|
|
544
539
|
if (isFloatingTabLocation(location)) {
|
|
545
|
-
|
|
546
|
-
if (floatingWidget && floatingWidget.hidden)
|
|
547
|
-
return WidgetState.Hidden;
|
|
548
|
-
else
|
|
549
|
-
return WidgetState.Floating;
|
|
540
|
+
return WidgetState.Floating;
|
|
550
541
|
}
|
|
551
542
|
let collapsedPanel = false;
|
|
552
543
|
// istanbul ignore else
|
|
@@ -563,24 +554,6 @@ export class FrontstageDef {
|
|
|
563
554
|
}
|
|
564
555
|
return widgetDef.defaultState;
|
|
565
556
|
}
|
|
566
|
-
/** Used only in UI 2.0 to determine StagePanelState and size from NinezoneState
|
|
567
|
-
* @internal
|
|
568
|
-
*/
|
|
569
|
-
getPanelCurrentState(panelDef) {
|
|
570
|
-
// istanbul ignore next
|
|
571
|
-
if (this.nineZoneState) {
|
|
572
|
-
const side = toPanelSide(panelDef.location);
|
|
573
|
-
const panel = this.nineZoneState.panels[side];
|
|
574
|
-
if (panel)
|
|
575
|
-
return [
|
|
576
|
-
panel.collapsed ? StagePanelState.Minimized : StagePanelState.Open,
|
|
577
|
-
panel.size ?? 0,
|
|
578
|
-
panel.pinned,
|
|
579
|
-
];
|
|
580
|
-
return [StagePanelState.Off, 0, false];
|
|
581
|
-
}
|
|
582
|
-
return [panelDef.defaultState, panelDef.defaultSize ?? 0, true];
|
|
583
|
-
}
|
|
584
557
|
isPopoutWidget(widgetId) {
|
|
585
558
|
// istanbul ignore else
|
|
586
559
|
if (this.nineZoneState) {
|
|
@@ -604,89 +577,65 @@ export class FrontstageDef {
|
|
|
604
577
|
/** Create a new floating panel that contains the widget specified by its Id. Supported only when in
|
|
605
578
|
* UI 2.0 or higher.
|
|
606
579
|
* @param widgetId case sensitive Widget Id
|
|
607
|
-
* @param
|
|
580
|
+
* @param position Position of top left corner of floating panel in pixels. If undefined {x:50, y:100} is used.
|
|
608
581
|
* @param size defines the width and height of the floating panel. If undefined and widget has been floated before
|
|
609
582
|
* the previous size is used, else {height:400, width:400} is used.
|
|
610
583
|
* @beta
|
|
611
584
|
*/
|
|
612
|
-
floatWidget(widgetId,
|
|
613
|
-
|
|
614
|
-
if (
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
setTimeout(() => {
|
|
626
|
-
popoutWidgetContainerId &&
|
|
627
|
-
UiFramework.childWindows.close(popoutWidgetContainerId, true);
|
|
628
|
-
}, 600);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
585
|
+
floatWidget(widgetId, position, size) {
|
|
586
|
+
const state = this.nineZoneState;
|
|
587
|
+
if (!state)
|
|
588
|
+
return;
|
|
589
|
+
const widgetDef = this.findWidgetDef(widgetId);
|
|
590
|
+
if (!widgetDef)
|
|
591
|
+
return;
|
|
592
|
+
this.dispatch({
|
|
593
|
+
type: "WIDGET_TAB_FLOAT",
|
|
594
|
+
id: widgetId,
|
|
595
|
+
position,
|
|
596
|
+
size,
|
|
597
|
+
});
|
|
632
598
|
}
|
|
633
599
|
/** Check widget and panel state to determine whether the widget is currently displayed
|
|
634
600
|
* @param widgetId case-sensitive Widget Id
|
|
635
601
|
* @public
|
|
636
602
|
*/
|
|
637
603
|
isWidgetDisplayed(widgetId) {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
widgetIsVisible = true;
|
|
649
|
-
}
|
|
650
|
-
else if (isPopoutTabLocation(tabLocation)) {
|
|
651
|
-
widgetIsVisible = true;
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
// istanbul ignore else
|
|
655
|
-
if (isPanelTabLocation(tabLocation)) {
|
|
656
|
-
const panel = this.nineZoneState.panels[tabLocation.side];
|
|
657
|
-
const widgetDef = this.findWidgetDef(widgetId);
|
|
658
|
-
if (widgetDef &&
|
|
659
|
-
widgetDef.state === WidgetState.Open &&
|
|
660
|
-
!panel.collapsed)
|
|
661
|
-
widgetIsVisible = true;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
604
|
+
if (!this.nineZoneState)
|
|
605
|
+
return false;
|
|
606
|
+
const tabLocation = getTabLocation(this.nineZoneState, widgetId);
|
|
607
|
+
if (!tabLocation)
|
|
608
|
+
return false;
|
|
609
|
+
if (isPanelTabLocation(tabLocation)) {
|
|
610
|
+
const panel = this.nineZoneState.panels[tabLocation.side];
|
|
611
|
+
const widgetDef = this.findWidgetDef(widgetId);
|
|
612
|
+
const isVisible = !!widgetDef && widgetDef.state === WidgetState.Open && !panel.collapsed;
|
|
613
|
+
return isVisible;
|
|
665
614
|
}
|
|
666
|
-
return
|
|
615
|
+
return true;
|
|
667
616
|
}
|
|
668
617
|
/** Opens window for specified PopoutWidget container. Used to reopen popout when running in Electron.
|
|
669
|
-
* @internal
|
|
670
|
-
|
|
618
|
+
* @internal
|
|
619
|
+
*/
|
|
620
|
+
openPopoutWidgetContainer(widgetContainerId) {
|
|
621
|
+
const state = this.nineZoneState;
|
|
622
|
+
if (!state)
|
|
623
|
+
return;
|
|
671
624
|
const location = getWidgetLocation(state, widgetContainerId);
|
|
672
|
-
// istanbul ignore next
|
|
673
625
|
if (!location)
|
|
674
626
|
return;
|
|
675
|
-
// istanbul ignore next
|
|
676
627
|
if (!isPopoutWidgetLocation(location))
|
|
677
628
|
return;
|
|
678
629
|
const widget = state.widgets[widgetContainerId];
|
|
679
|
-
const popoutWidget = state.popoutWidgets.byId[location.popoutWidgetId];
|
|
680
630
|
// Popout widget should only contain a single tab.
|
|
681
|
-
// istanbul ignore next
|
|
682
631
|
if (widget.tabs.length !== 1)
|
|
683
632
|
return;
|
|
684
633
|
const tabId = widget.tabs[0];
|
|
685
634
|
const widgetDef = this.findWidgetDef(tabId);
|
|
686
|
-
// istanbul ignore next
|
|
687
635
|
if (!widgetDef)
|
|
688
636
|
return;
|
|
689
637
|
const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
|
|
638
|
+
const popoutWidget = state.popoutWidgets.byId[location.popoutWidgetId];
|
|
690
639
|
const bounds = Rectangle.create(popoutWidget.bounds);
|
|
691
640
|
const position = {
|
|
692
641
|
width: bounds.getWidth(),
|
|
@@ -699,48 +648,23 @@ export class FrontstageDef {
|
|
|
699
648
|
/** Create a new popout/child window that contains the widget specified by its Id. Supported only when in
|
|
700
649
|
* UI 2.0 or higher.
|
|
701
650
|
* @param widgetId case sensitive Widget Id
|
|
702
|
-
* @param
|
|
651
|
+
* @param position Position of top left corner of floating panel in pixels. If undefined {x:0, y:0} is used.
|
|
703
652
|
* @param size defines the width and height of the floating panel. If undefined and widget has been floated before
|
|
704
653
|
* the previous size is used, else {height:800, width:600} is used.
|
|
705
654
|
* @beta
|
|
706
655
|
*/
|
|
707
|
-
popoutWidget(widgetId,
|
|
708
|
-
|
|
709
|
-
if (!
|
|
710
|
-
return;
|
|
711
|
-
let location = getTabLocation(this.nineZoneState, widgetId);
|
|
712
|
-
if (!location || isPopoutTabLocation(location))
|
|
656
|
+
popoutWidget(widgetId, position, size) {
|
|
657
|
+
const state = this.nineZoneState;
|
|
658
|
+
if (!state)
|
|
713
659
|
return;
|
|
714
660
|
const widgetDef = this.findWidgetDef(widgetId);
|
|
715
|
-
// istanbul ignore next
|
|
716
661
|
if (!widgetDef)
|
|
717
662
|
return;
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
if (size)
|
|
724
|
-
preferredBounds = preferredBounds.setSize(size);
|
|
725
|
-
if (point)
|
|
726
|
-
preferredBounds = preferredBounds.setPosition(point);
|
|
727
|
-
const state = popoutWidgetToChildWindow(this.nineZoneState, widgetId, preferredBounds);
|
|
728
|
-
this.nineZoneState = state;
|
|
729
|
-
// now that the state is updated get the id of the container that houses the widgetTab/widgetId
|
|
730
|
-
location = getTabLocation(state, widgetId);
|
|
731
|
-
assert(!!location && isPopoutTabLocation(location));
|
|
732
|
-
const widgetContainerId = location.widgetId;
|
|
733
|
-
const popoutWidget = state.popoutWidgets.byId[widgetContainerId];
|
|
734
|
-
const bounds = Rectangle.create(popoutWidget.bounds);
|
|
735
|
-
setTimeout(() => {
|
|
736
|
-
const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
|
|
737
|
-
const position = {
|
|
738
|
-
width: bounds.getWidth(),
|
|
739
|
-
height: bounds.getHeight(),
|
|
740
|
-
left: bounds.left,
|
|
741
|
-
top: bounds.top,
|
|
742
|
-
};
|
|
743
|
-
UiFramework.childWindows.open(widgetContainerId, widgetDef.label, popoutContent, position, UiFramework.useDefaultPopoutUrl);
|
|
663
|
+
this.dispatch({
|
|
664
|
+
type: "WIDGET_TAB_POPOUT",
|
|
665
|
+
id: widgetId,
|
|
666
|
+
position,
|
|
667
|
+
size,
|
|
744
668
|
});
|
|
745
669
|
}
|
|
746
670
|
get isStageClosing() {
|
|
@@ -754,12 +678,13 @@ export class FrontstageDef {
|
|
|
754
678
|
}
|
|
755
679
|
/** @internal */
|
|
756
680
|
saveChildWindowSizeAndPosition(childWindowId, childWindow) {
|
|
757
|
-
|
|
681
|
+
const state = this.nineZoneState;
|
|
682
|
+
if (!state)
|
|
758
683
|
return;
|
|
759
|
-
const location = getWidgetLocation(
|
|
684
|
+
const location = getWidgetLocation(state, childWindowId);
|
|
760
685
|
if (!location || !isPopoutWidgetLocation(location))
|
|
761
686
|
return;
|
|
762
|
-
const widget =
|
|
687
|
+
const widget = state.widgets[location.popoutWidgetId];
|
|
763
688
|
const tabId = widget.tabs[0];
|
|
764
689
|
const widgetDef = this.findWidgetDef(tabId);
|
|
765
690
|
if (!widgetDef)
|
|
@@ -772,23 +697,34 @@ export class FrontstageDef {
|
|
|
772
697
|
x: childWindow.screenX,
|
|
773
698
|
y: childWindow.screenY,
|
|
774
699
|
});
|
|
775
|
-
|
|
700
|
+
this.dispatch({
|
|
701
|
+
type: "WIDGET_TAB_SET_POPOUT_BOUNDS",
|
|
702
|
+
id: tabId,
|
|
703
|
+
bounds,
|
|
704
|
+
});
|
|
776
705
|
}
|
|
777
|
-
/**
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
dockPopoutWidgetContainer(widgetContainerId) {
|
|
782
|
-
if (!this.nineZoneState)
|
|
706
|
+
/** @internal */
|
|
707
|
+
dockWidgetContainerByContainerId(widgetContainerId) {
|
|
708
|
+
const state = this.nineZoneState;
|
|
709
|
+
if (!state)
|
|
783
710
|
return;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
711
|
+
const location = getWidgetLocation(state, widgetContainerId);
|
|
712
|
+
if (!location)
|
|
713
|
+
return;
|
|
714
|
+
if (isFloatingWidgetLocation(location)) {
|
|
715
|
+
this.dispatch({
|
|
716
|
+
type: "FLOATING_WIDGET_SEND_BACK",
|
|
717
|
+
id: location.floatingWidgetId,
|
|
718
|
+
});
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
if (isPopoutWidgetLocation(location)) {
|
|
722
|
+
this.dispatch({
|
|
723
|
+
type: "POPOUT_WIDGET_SEND_BACK",
|
|
724
|
+
id: location.popoutWidgetId,
|
|
725
|
+
});
|
|
789
726
|
return;
|
|
790
|
-
|
|
791
|
-
this.nineZoneState = state;
|
|
727
|
+
}
|
|
792
728
|
}
|
|
793
729
|
/** Finds the container with the specified widget and re-docks all widgets
|
|
794
730
|
* back to the panel zone location that was used when the floating container
|
|
@@ -797,34 +733,28 @@ export class FrontstageDef {
|
|
|
797
733
|
* @beta
|
|
798
734
|
*/
|
|
799
735
|
dockWidgetContainer(widgetId) {
|
|
800
|
-
|
|
801
|
-
if (
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if (isPopoutTabLocation(location)) {
|
|
808
|
-
UiFramework.childWindows.close(location.widgetId, true);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
736
|
+
const state = this.nineZoneState;
|
|
737
|
+
if (!state)
|
|
738
|
+
return;
|
|
739
|
+
const location = getTabLocation(state, widgetId);
|
|
740
|
+
if (!location)
|
|
741
|
+
return;
|
|
742
|
+
this.dockWidgetContainerByContainerId(location.widgetId);
|
|
812
743
|
}
|
|
813
744
|
setFloatingWidgetContainerBounds(floatingWidgetId, bounds) {
|
|
814
745
|
if (!this.nineZoneState ||
|
|
815
746
|
!(floatingWidgetId in this.nineZoneState.floatingWidgets.byId))
|
|
816
747
|
return false;
|
|
817
|
-
|
|
748
|
+
this.dispatch({
|
|
818
749
|
type: "FLOATING_WIDGET_SET_BOUNDS",
|
|
819
750
|
id: floatingWidgetId,
|
|
820
751
|
bounds,
|
|
821
|
-
}
|
|
822
|
-
|
|
752
|
+
});
|
|
753
|
+
this.dispatch({
|
|
823
754
|
type: "FLOATING_WIDGET_SET_USER_SIZED",
|
|
824
755
|
id: floatingWidgetId,
|
|
825
756
|
userSized: true,
|
|
826
|
-
}
|
|
827
|
-
this.nineZoneState = state;
|
|
757
|
+
});
|
|
828
758
|
return true;
|
|
829
759
|
}
|
|
830
760
|
getFloatingWidgetContainerIds() {
|
|
@@ -920,8 +850,9 @@ export const useActiveFrontstageId = () => {
|
|
|
920
850
|
const id = React.useMemo(() => (def ? /* istanbul ignore next */ def.id : ""), [def]);
|
|
921
851
|
return id;
|
|
922
852
|
};
|
|
923
|
-
/** Hook to return the active Frontstage def
|
|
924
|
-
|
|
853
|
+
/** Hook to return the active Frontstage def.
|
|
854
|
+
* @public
|
|
855
|
+
*/
|
|
925
856
|
export function useActiveFrontstageDef() {
|
|
926
857
|
const [def, setDef] = React.useState(UiFramework.frontstages.activeFrontstageDef);
|
|
927
858
|
React.useEffect(() => {
|