@itwin/appui-react 3.4.0-dev.8 → 3.5.0-dev.11

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/lib/cjs/appui-react/childwindow/ChildWindowManager.d.ts.map +1 -1
  3. package/lib/cjs/appui-react/childwindow/ChildWindowManager.js +4 -5
  4. package/lib/cjs/appui-react/childwindow/ChildWindowManager.js.map +1 -1
  5. package/lib/cjs/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
  6. package/lib/cjs/appui-react/content/FloatingViewportContent.js +5 -5
  7. package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
  8. package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts +7 -0
  9. package/lib/cjs/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
  10. package/lib/cjs/appui-react/dialog/DialogManagerBase.js +23 -0
  11. package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
  12. package/lib/cjs/appui-react/dialog/ModelessDialogManager.d.ts +0 -2
  13. package/lib/cjs/appui-react/dialog/ModelessDialogManager.d.ts.map +1 -1
  14. package/lib/cjs/appui-react/dialog/ModelessDialogManager.js +6 -18
  15. package/lib/cjs/appui-react/dialog/ModelessDialogManager.js.map +1 -1
  16. package/lib/cjs/appui-react/dialog/StandardMessageBox.d.ts.map +1 -1
  17. package/lib/cjs/appui-react/dialog/StandardMessageBox.js +2 -1
  18. package/lib/cjs/appui-react/dialog/StandardMessageBox.js.map +1 -1
  19. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +13 -1
  20. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  21. package/lib/cjs/appui-react/frontstage/FrontstageDef.js +140 -96
  22. package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
  23. package/lib/cjs/appui-react/imodel-components/category-tree/Categories.json +2 -2
  24. package/lib/cjs/appui-react/imodel-components/models-tree/Hierarchy.GroupedByClass.json +1 -0
  25. package/lib/cjs/appui-react/imodel-components/models-tree/Hierarchy.json +1 -0
  26. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.d.ts +1 -1
  27. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.d.ts.map +1 -1
  28. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.js +11 -8
  29. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.js.map +1 -1
  30. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts +15 -1
  31. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts.map +1 -1
  32. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js +5 -2
  33. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js.map +1 -1
  34. package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts +0 -6
  35. package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
  36. package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts +1 -0
  37. package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
  38. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +23 -4
  39. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  40. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts.map +1 -1
  41. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.js +2 -0
  42. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.js.map +1 -1
  43. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts +1 -0
  44. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts.map +1 -1
  45. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js +2 -0
  46. package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js.map +1 -1
  47. package/lib/cjs/appui-react/widget-panels/FloatingWidget.d.ts +7 -0
  48. package/lib/cjs/appui-react/widget-panels/FloatingWidget.d.ts.map +1 -0
  49. package/lib/cjs/appui-react/widget-panels/FloatingWidget.js +19 -0
  50. package/lib/cjs/appui-react/widget-panels/FloatingWidget.js.map +1 -0
  51. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts +20 -697
  52. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  53. package/lib/cjs/appui-react/widget-panels/Frontstage.js +300 -271
  54. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  55. package/lib/cjs/appui-react/widget-panels/useWidgetDirection.js +1 -1
  56. package/lib/cjs/appui-react/widget-panels/useWidgetDirection.js.map +1 -1
  57. package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +16 -6
  58. package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
  59. package/lib/cjs/appui-react/widgets/WidgetDef.js +13 -1
  60. package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
  61. package/lib/esm/appui-react/childwindow/ChildWindowManager.d.ts.map +1 -1
  62. package/lib/esm/appui-react/childwindow/ChildWindowManager.js +4 -5
  63. package/lib/esm/appui-react/childwindow/ChildWindowManager.js.map +1 -1
  64. package/lib/esm/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
  65. package/lib/esm/appui-react/content/FloatingViewportContent.js +5 -5
  66. package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
  67. package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts +7 -0
  68. package/lib/esm/appui-react/dialog/DialogManagerBase.d.ts.map +1 -1
  69. package/lib/esm/appui-react/dialog/DialogManagerBase.js +23 -0
  70. package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
  71. package/lib/esm/appui-react/dialog/ModelessDialogManager.d.ts +0 -2
  72. package/lib/esm/appui-react/dialog/ModelessDialogManager.d.ts.map +1 -1
  73. package/lib/esm/appui-react/dialog/ModelessDialogManager.js +6 -18
  74. package/lib/esm/appui-react/dialog/ModelessDialogManager.js.map +1 -1
  75. package/lib/esm/appui-react/dialog/StandardMessageBox.d.ts.map +1 -1
  76. package/lib/esm/appui-react/dialog/StandardMessageBox.js +2 -1
  77. package/lib/esm/appui-react/dialog/StandardMessageBox.js.map +1 -1
  78. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +13 -1
  79. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  80. package/lib/esm/appui-react/frontstage/FrontstageDef.js +142 -98
  81. package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
  82. package/lib/esm/appui-react/imodel-components/category-tree/Categories.json +2 -2
  83. package/lib/esm/appui-react/imodel-components/models-tree/Hierarchy.GroupedByClass.json +1 -0
  84. package/lib/esm/appui-react/imodel-components/models-tree/Hierarchy.json +1 -0
  85. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.d.ts +1 -1
  86. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.d.ts.map +1 -1
  87. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.js +12 -9
  88. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.js.map +1 -1
  89. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts +15 -1
  90. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts.map +1 -1
  91. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js +4 -2
  92. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js.map +1 -1
  93. package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts +0 -6
  94. package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
  95. package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts +1 -0
  96. package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
  97. package/lib/esm/appui-react/tools/CoreToolDefinitions.js +25 -6
  98. package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  99. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts.map +1 -1
  100. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.js +2 -0
  101. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.js.map +1 -1
  102. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts +1 -0
  103. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts.map +1 -1
  104. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js +2 -0
  105. package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js.map +1 -1
  106. package/lib/esm/appui-react/widget-panels/FloatingWidget.d.ts +7 -0
  107. package/lib/esm/appui-react/widget-panels/FloatingWidget.d.ts.map +1 -0
  108. package/lib/esm/appui-react/widget-panels/FloatingWidget.js +15 -0
  109. package/lib/esm/appui-react/widget-panels/FloatingWidget.js.map +1 -0
  110. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts +20 -697
  111. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  112. package/lib/esm/appui-react/widget-panels/Frontstage.js +291 -265
  113. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  114. package/lib/esm/appui-react/widget-panels/useWidgetDirection.js +2 -2
  115. package/lib/esm/appui-react/widget-panels/useWidgetDirection.js.map +1 -1
  116. package/lib/esm/appui-react/widgets/WidgetDef.d.ts +16 -6
  117. package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
  118. package/lib/esm/appui-react/widgets/WidgetDef.js +13 -1
  119. package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
  120. package/lib/public/locales/en/UiFramework.json +3 -1
  121. package/package.json +37 -35
@@ -10,7 +10,8 @@
10
10
  import * as React from "react";
11
11
  import { IModelApp } from "@itwin/core-frontend";
12
12
  import { StagePanelLocation, StageUsage, UiError, WidgetState } from "@itwin/appui-abstract";
13
- import { dockWidgetContainer, findTab, findWidget, floatWidget, isFloatingLocation, isPanelLocation, isPopoutLocation, isPopoutWidgetLocation, panelSides, popoutWidgetToChildWindow, setFloatingWidgetContainerBounds, } from "@itwin/appui-layout-react";
13
+ import { Rectangle } from "@itwin/core-react";
14
+ import { dockWidgetContainer, floatWidget, getTabLocation, getWidgetLocation, isFloatingTabLocation, isPanelTabLocation, isPopoutTabLocation, isPopoutWidgetLocation, panelSides, popoutWidgetToChildWindow, setFloatingWidgetContainerBounds, } from "@itwin/appui-layout-react";
14
15
  import { ContentGroupProvider } from "../content/ContentGroup";
15
16
  import { ContentLayoutManager } from "../content/ContentLayoutManager";
16
17
  import { ContentViewManager } from "../content/ContentViewManager";
@@ -21,8 +22,7 @@ import { Frontstage } from "./Frontstage";
21
22
  import { FrontstageManager } from "./FrontstageManager";
22
23
  import { TimeTracker } from "../configurableui/TimeTracker";
23
24
  import { PopoutWidget } from "../childwindow/PopoutWidget";
24
- import { saveFrontstagePopoutWidgetSizeAndPosition } from "../widget-panels/Frontstage";
25
- import { BentleyStatus } from "@itwin/core-bentley";
25
+ import { assert, BentleyStatus, ProcessDetector } from "@itwin/core-bentley";
26
26
  import { ContentDialogManager } from "../dialog/ContentDialogManager";
27
27
  /** FrontstageDef class provides an API for a Frontstage.
28
28
  * @public
@@ -183,6 +183,11 @@ export class FrontstageDef {
183
183
  }
184
184
  }
185
185
  /** @internal */
186
+ get savedWidgetDefs() { return this._savedWidgetDefs; }
187
+ set savedWidgetDefs(widgets) {
188
+ this._savedWidgetDefs = widgets;
189
+ }
190
+ /** @internal */
186
191
  get timeTracker() { return this._timeTracker; }
187
192
  /** Created a [[FrontstageDef]] and initialize it */
188
193
  static async create(provider) {
@@ -552,17 +557,12 @@ export class FrontstageDef {
552
557
  }
553
558
  /** @beta */
554
559
  restoreLayout() {
555
- for (const zoneDef of this.zoneDefs) {
556
- for (const widgetDef of zoneDef.widgetDefs) {
557
- widgetDef.setWidgetState(widgetDef.defaultState);
558
- }
559
- }
560
560
  for (const panelDef of this.panelDefs) {
561
561
  panelDef.size = panelDef.defaultSize;
562
562
  panelDef.panelState = panelDef.defaultState;
563
- for (const widgetDef of panelDef.widgetDefs) {
564
- widgetDef.setWidgetState(widgetDef.defaultState);
565
- }
563
+ }
564
+ for (const widgetDef of this.widgetDefs) {
565
+ widgetDef.setWidgetState(widgetDef.defaultState);
566
566
  }
567
567
  FrontstageManager.onFrontstageRestoreLayoutEvent.emit({ frontstageDef: this });
568
568
  }
@@ -572,11 +572,11 @@ export class FrontstageDef {
572
572
  getWidgetCurrentState(widgetDef) {
573
573
  // istanbul ignore else
574
574
  if (this.nineZoneState) {
575
- const location = findTab(this.nineZoneState, widgetDef.id);
575
+ const location = getTabLocation(this.nineZoneState, widgetDef.id);
576
576
  // istanbul ignore next
577
577
  if (!location)
578
578
  return WidgetState.Hidden;
579
- if (isFloatingLocation(location)) {
579
+ if (isFloatingTabLocation(location)) {
580
580
  const floatingWidget = this.nineZoneState.floatingWidgets.byId[location.floatingWidgetId];
581
581
  if (floatingWidget && floatingWidget.hidden)
582
582
  return WidgetState.Hidden;
@@ -615,20 +615,20 @@ export class FrontstageDef {
615
615
  isPopoutWidget(widgetId) {
616
616
  // istanbul ignore else
617
617
  if (this.nineZoneState) {
618
- const location = findTab(this.nineZoneState, widgetId);
618
+ const location = getTabLocation(this.nineZoneState, widgetId);
619
619
  // istanbul ignore else
620
620
  if (location)
621
- return isPopoutLocation(location);
621
+ return isPopoutTabLocation(location);
622
622
  }
623
623
  return false;
624
624
  }
625
625
  isFloatingWidget(widgetId) {
626
626
  // istanbul ignore else
627
627
  if (this.nineZoneState) {
628
- const location = findTab(this.nineZoneState, widgetId);
628
+ const location = getTabLocation(this.nineZoneState, widgetId);
629
629
  // istanbul ignore else
630
630
  if (location)
631
- return isFloatingLocation(location);
631
+ return isFloatingTabLocation(location);
632
632
  }
633
633
  return false;
634
634
  }
@@ -643,10 +643,10 @@ export class FrontstageDef {
643
643
  floatWidget(widgetId, point, size) {
644
644
  // istanbul ignore else
645
645
  if (this.nineZoneState) {
646
- const location = findTab(this.nineZoneState, widgetId);
646
+ const location = getTabLocation(this.nineZoneState, widgetId);
647
647
  if (location) {
648
648
  let popoutWidgetContainerId;
649
- if (isPopoutLocation(location)) {
649
+ if (isPopoutTabLocation(location)) {
650
650
  popoutWidgetContainerId = location.popoutWidgetId;
651
651
  }
652
652
  const state = floatWidget(this.nineZoneState, widgetId, point, size);
@@ -668,21 +668,21 @@ export class FrontstageDef {
668
668
  let widgetIsVisible = false;
669
669
  // istanbul ignore else
670
670
  if (this.nineZoneState) {
671
- const tabLocation = findTab(this.nineZoneState, widgetId);
671
+ const tabLocation = getTabLocation(this.nineZoneState, widgetId);
672
672
  // istanbul ignore else
673
673
  if (tabLocation) {
674
- if (isFloatingLocation(tabLocation)) {
674
+ if (isFloatingTabLocation(tabLocation)) {
675
675
  const floatingWidget = this.nineZoneState.floatingWidgets.byId[tabLocation.floatingWidgetId];
676
676
  // istanbul ignore else
677
677
  if (!!!floatingWidget.hidden)
678
678
  widgetIsVisible = true;
679
679
  }
680
- else if (isPopoutLocation(tabLocation)) {
680
+ else if (isPopoutTabLocation(tabLocation)) {
681
681
  widgetIsVisible = true;
682
682
  }
683
683
  else {
684
684
  // istanbul ignore else
685
- if (isPanelLocation(tabLocation)) {
685
+ if (isPanelTabLocation(tabLocation)) {
686
686
  const panel = this.nineZoneState.panels[tabLocation.side];
687
687
  const widgetDef = this.findWidgetDef(widgetId);
688
688
  if (widgetDef && widgetDef.state === WidgetState.Open && !panel.collapsed)
@@ -696,25 +696,33 @@ export class FrontstageDef {
696
696
  /** Opens window for specified PopoutWidget container. Used to reopen popout when running in Electron.
697
697
  * @internal */
698
698
  openPopoutWidgetContainer(state, widgetContainerId) {
699
- var _a, _b, _c, _d, _e, _f, _g, _h;
700
- const location = findWidget(state, widgetContainerId);
701
- // istanbul ignore else
702
- if (location && isPopoutWidgetLocation(location) && 1 === state.widgets[widgetContainerId].tabs.length) {
703
- // NOTE: Popout Widget Container will only contain a single WidgetTab
704
- const widgetDef = this.findWidgetDef(state.widgets[widgetContainerId].tabs[0]);
705
- // istanbul ignore else
706
- if (widgetDef) {
707
- const tab = state.tabs[widgetDef.id];
708
- const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
709
- const position = {
710
- width: (_b = (_a = tab.preferredPopoutWidgetSize) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 600,
711
- height: (_d = (_c = tab.preferredPopoutWidgetSize) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 800,
712
- left: (_f = (_e = tab.preferredPopoutWidgetSize) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0,
713
- top: (_h = (_g = tab.preferredPopoutWidgetSize) === null || _g === void 0 ? void 0 : _g.y) !== null && _h !== void 0 ? _h : 0,
714
- };
715
- UiFramework.childWindowManager.openChildWindow(widgetContainerId, widgetDef.label, popoutContent, position, UiFramework.useDefaultPopoutUrl);
716
- }
717
- }
699
+ const location = getWidgetLocation(state, widgetContainerId);
700
+ // istanbul ignore next
701
+ if (!location)
702
+ return;
703
+ // istanbul ignore next
704
+ if (!isPopoutWidgetLocation(location))
705
+ return;
706
+ const widget = state.widgets[widgetContainerId];
707
+ const popoutWidget = state.popoutWidgets.byId[location.popoutWidgetId];
708
+ // Popout widget should only contain a single tab.
709
+ // istanbul ignore next
710
+ if (widget.tabs.length !== 1)
711
+ return;
712
+ const tabId = widget.tabs[0];
713
+ const widgetDef = this.findWidgetDef(tabId);
714
+ // istanbul ignore next
715
+ if (!widgetDef)
716
+ return;
717
+ const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
718
+ const bounds = Rectangle.create(popoutWidget.bounds);
719
+ const position = {
720
+ width: bounds.getWidth(),
721
+ height: bounds.getHeight(),
722
+ left: bounds.left,
723
+ top: bounds.top,
724
+ };
725
+ UiFramework.childWindowManager.openChildWindow(widgetContainerId, widgetDef.label, popoutContent, position, UiFramework.useDefaultPopoutUrl);
718
726
  }
719
727
  /** Create a new popout/child window that contains the widget specified by its Id. Supported only when in
720
728
  * UI 2.0 or higher.
@@ -725,42 +733,43 @@ export class FrontstageDef {
725
733
  * @beta
726
734
  */
727
735
  popoutWidget(widgetId, point, size) {
728
- // istanbul ignore else
729
- if (this.nineZoneState) {
730
- let location = findTab(this.nineZoneState, widgetId);
731
- // istanbul ignore else
732
- if (location) {
733
- if (isPopoutLocation(location))
734
- return;
735
- // get the state to apply that will pop-out the specified WidgetTab to child window.
736
- const state = popoutWidgetToChildWindow(this.nineZoneState, widgetId, point, size);
737
- // istanbul ignore else
738
- if (state) {
739
- // now that the state is updated get the id of the container that houses the widgetTab/widgetId
740
- location = findTab(state, widgetId);
741
- // istanbul ignore else
742
- if (location && isPopoutLocation(location)) {
743
- const widgetDef = this.findWidgetDef(widgetId);
744
- // istanbul ignore else
745
- if (widgetDef) {
746
- const widgetContainerId = location.widgetId;
747
- const tab = state.tabs[widgetId];
748
- this.nineZoneState = state;
749
- setTimeout(() => {
750
- const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
751
- const position = {
752
- width: tab.preferredPopoutWidgetSize.width,
753
- height: tab.preferredPopoutWidgetSize.height,
754
- left: tab.preferredPopoutWidgetSize.x,
755
- top: tab.preferredPopoutWidgetSize.y,
756
- };
757
- UiFramework.childWindowManager.openChildWindow(widgetContainerId, widgetDef.label, popoutContent, position, UiFramework.useDefaultPopoutUrl);
758
- });
759
- }
760
- }
761
- }
762
- }
763
- }
736
+ // istanbul ignore next
737
+ if (!this.nineZoneState)
738
+ return;
739
+ let location = getTabLocation(this.nineZoneState, widgetId);
740
+ if (!location || isPopoutTabLocation(location))
741
+ return;
742
+ const widgetDef = this.findWidgetDef(widgetId);
743
+ // istanbul ignore next
744
+ if (!widgetDef)
745
+ return;
746
+ // get the state to apply that will pop-out the specified WidgetTab to child window.
747
+ let preferredBounds = Rectangle.createFromSize({ height: 800, width: 600 });
748
+ // istanbul ignore next
749
+ if (widgetDef.popoutBounds)
750
+ preferredBounds = widgetDef.popoutBounds;
751
+ if (size)
752
+ preferredBounds = preferredBounds.setSize(size);
753
+ if (point)
754
+ preferredBounds = preferredBounds.setPosition(point);
755
+ const state = popoutWidgetToChildWindow(this.nineZoneState, widgetId, preferredBounds);
756
+ this.nineZoneState = state;
757
+ // now that the state is updated get the id of the container that houses the widgetTab/widgetId
758
+ location = getTabLocation(state, widgetId);
759
+ assert(!!location && isPopoutTabLocation(location));
760
+ const widgetContainerId = location.widgetId;
761
+ const popoutWidget = state.popoutWidgets.byId[widgetContainerId];
762
+ const bounds = Rectangle.create(popoutWidget.bounds);
763
+ setTimeout(() => {
764
+ const popoutContent = (React.createElement(PopoutWidget, { widgetContainerId: widgetContainerId, widgetDef: widgetDef }));
765
+ const position = {
766
+ width: bounds.getWidth(),
767
+ height: bounds.getHeight(),
768
+ left: bounds.left,
769
+ top: bounds.top,
770
+ };
771
+ UiFramework.childWindowManager.openChildWindow(widgetContainerId, widgetDef.label, popoutContent, position, UiFramework.useDefaultPopoutUrl);
772
+ });
764
773
  }
765
774
  get isStageClosing() {
766
775
  return this._isStageClosing;
@@ -772,12 +781,23 @@ export class FrontstageDef {
772
781
  return this._isReady;
773
782
  }
774
783
  /** @internal */
775
- async saveChildWindowSizeAndPosition(childWindowId, childWindow) {
776
- // istanbul ignore else
777
- if (this.nineZoneState) {
778
- const newState = await saveFrontstagePopoutWidgetSizeAndPosition(this.nineZoneState, this.id, this.version, childWindowId, childWindow);
779
- this._nineZoneState = newState; // set without triggering new render as only preferred floating position set
780
- }
784
+ saveChildWindowSizeAndPosition(childWindowId, childWindow) {
785
+ if (!this.nineZoneState)
786
+ return;
787
+ const location = getWidgetLocation(this.nineZoneState, childWindowId);
788
+ if (!location || !isPopoutWidgetLocation(location))
789
+ return;
790
+ const widget = this.nineZoneState.widgets[location.popoutWidgetId];
791
+ const tabId = widget.tabs[0];
792
+ const widgetDef = this.findWidgetDef(tabId);
793
+ if (!widgetDef)
794
+ return;
795
+ const adjustmentWidth = ProcessDetector.isElectronAppFrontend ? 16 : 0;
796
+ const adjustmentHeight = ProcessDetector.isElectronAppFrontend ? 39 : 0;
797
+ const width = childWindow.innerWidth + adjustmentWidth;
798
+ const height = childWindow.innerHeight + adjustmentHeight;
799
+ const bounds = Rectangle.createFromSize({ width, height }).offset({ x: childWindow.screenX, y: childWindow.screenY });
800
+ widgetDef.popoutBounds = bounds;
781
801
  }
782
802
  /** @internal */
783
803
  setFloatingWidgetBoundsInternal(floatingWidgetId, bounds, inhibitNineZoneStateChangedEvent = false) {
@@ -795,16 +815,16 @@ export class FrontstageDef {
795
815
  * @internal
796
816
  */
797
817
  dockPopoutWidgetContainer(widgetContainerId) {
798
- if (this.nineZoneState) {
799
- const location = findWidget(this.nineZoneState, widgetContainerId);
800
- // Make sure the widgetContainerId is still in popout state. We don't want to set it to docked if the window is being closed because
801
- // an API call has moved the widget from a popout state to a floating state.
802
- // istanbul ignore else
803
- if (location && isPopoutWidgetLocation(location)) {
804
- const state = dockWidgetContainer(this.nineZoneState, widgetContainerId, true);
805
- state && (this.nineZoneState = state);
806
- }
807
- }
818
+ if (!this.nineZoneState)
819
+ return;
820
+ // Make sure the widgetContainerId is still in popout state. We don't want to set it to docked if the window is being closed because
821
+ // an API call has moved the widget from a popout state to a floating state.
822
+ // istanbul ignore else
823
+ const location = getWidgetLocation(this.nineZoneState, widgetContainerId);
824
+ if (!location || !isPopoutWidgetLocation(location))
825
+ return;
826
+ const state = dockWidgetContainer(this.nineZoneState, widgetContainerId, true);
827
+ this.nineZoneState = state;
808
828
  }
809
829
  /** Finds the container with the specified widget and re-docks all widgets
810
830
  * back to the panel zone location that was used when the floating container
@@ -815,12 +835,12 @@ export class FrontstageDef {
815
835
  dockWidgetContainer(widgetId) {
816
836
  // istanbul ignore else
817
837
  if (this.nineZoneState) {
818
- const location = findTab(this.nineZoneState, widgetId);
838
+ const location = getTabLocation(this.nineZoneState, widgetId);
819
839
  if (location) {
820
840
  const widgetContainerId = location.widgetId;
821
841
  const state = dockWidgetContainer(this.nineZoneState, widgetContainerId, true);
822
842
  state && (this.nineZoneState = state);
823
- if (isPopoutLocation(location)) {
843
+ if (isPopoutTabLocation(location)) {
824
844
  UiFramework.childWindowManager.closeChildWindow(location.widgetId, true);
825
845
  }
826
846
  }
@@ -840,9 +860,9 @@ export class FrontstageDef {
840
860
  getFloatingWidgetContainerIdByWidgetId(widgetId) {
841
861
  if (!this.nineZoneState)
842
862
  return undefined;
843
- const location = findTab(this.nineZoneState, widgetId);
863
+ const location = getTabLocation(this.nineZoneState, widgetId);
844
864
  // istanbul ignore else
845
- if (location && isFloatingLocation(location)) {
865
+ if (location && isFloatingTabLocation(location)) {
846
866
  return location.floatingWidgetId;
847
867
  }
848
868
  // istanbul ignore next
@@ -863,5 +883,29 @@ export class FrontstageDef {
863
883
  }
864
884
  return undefined;
865
885
  }
886
+ *_widgetDefs() {
887
+ for (const zoneDef of this.zoneDefs) {
888
+ for (const widgetDef of zoneDef.widgetDefs) {
889
+ yield widgetDef;
890
+ }
891
+ }
892
+ for (const panelDef of this.panelDefs) {
893
+ for (const widgetDef of panelDef.widgetDefs) {
894
+ yield widgetDef;
895
+ }
896
+ }
897
+ return undefined;
898
+ }
899
+ /** Iterable of all widget definitions in a frontstage.
900
+ * @internal
901
+ */
902
+ get widgetDefs() {
903
+ const defs = this._widgetDefs();
904
+ return {
905
+ [Symbol.iterator]() {
906
+ return defs;
907
+ },
908
+ };
909
+ }
866
910
  }
867
911
  //# sourceMappingURL=FrontstageDef.js.map