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