@finsemble/finsemble-ui 7.2.0 → 7.3.0

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 (126) hide show
  1. package/package.json +14 -14
  2. package/react/assets/css/button.css +34 -6
  3. package/react/assets/css/contextMenu.css +118 -0
  4. package/react/assets/css/notificationsCenter.css +3 -214
  5. package/react/assets/css/userPreferences.css +2 -2
  6. package/react/components/common/Checkbox.d.ts +3 -2
  7. package/react/components/common/Checkbox.js +5 -21
  8. package/react/components/common/Checkbox.js.map +1 -1
  9. package/react/components/common/ContextMenu.d.ts +13 -0
  10. package/react/components/common/ContextMenu.js +69 -0
  11. package/react/components/common/ContextMenu.js.map +1 -0
  12. package/react/components/common/DropdownButton.d.ts +0 -4
  13. package/react/components/common/DropdownButton.js +39 -10
  14. package/react/components/common/DropdownButton.js.map +1 -1
  15. package/react/components/common/css/FinsembleToggle.css +0 -1
  16. package/react/components/common/css/application-edit-page.css +3 -4
  17. package/react/components/common/css/checkbox.css +60 -21
  18. package/react/components/common/css/icon.css +2 -2
  19. package/react/components/common/css/toggle.css +4 -1
  20. package/react/components/common/helpers.js +9 -0
  21. package/react/components/common/helpers.js.map +1 -1
  22. package/react/components/common/stories/ContextMenu.stories.d.ts +38 -0
  23. package/react/components/common/stories/ContextMenu.stories.js +70 -0
  24. package/react/components/common/stories/ContextMenu.stories.js.map +1 -0
  25. package/react/components/common/stories/DropdownButton.stories.d.ts +3 -3
  26. package/react/components/common/stories/DropdownButton.stories.js +11 -10
  27. package/react/components/common/stories/DropdownButton.stories.js.map +1 -1
  28. package/react/components/common/tests/Checkbox.spec.js +10 -12
  29. package/react/components/common/tests/Checkbox.spec.js.map +1 -1
  30. package/react/components/common/tests/ContextMenu.spec.d.ts +1 -0
  31. package/react/components/common/tests/ContextMenu.spec.js +108 -0
  32. package/react/components/common/tests/ContextMenu.spec.js.map +1 -0
  33. package/react/components/common/tests/DropdownButton.spec.d.ts +1 -0
  34. package/react/components/common/tests/DropdownButton.spec.js +32 -0
  35. package/react/components/common/tests/DropdownButton.spec.js.map +1 -0
  36. package/react/components/fdc3Resolver/ResolverDialog.js +5 -1
  37. package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
  38. package/react/components/notifications/components/drawer/DrawerHeader.js +3 -3
  39. package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
  40. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +1 -0
  41. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
  42. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +2 -0
  43. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
  44. package/react/components/notifications/components/shared/IconButton.js +2 -1
  45. package/react/components/notifications/components/shared/IconButton.js.map +1 -1
  46. package/react/components/notifications/components/shared/NotificationCardShell.d.ts +2 -0
  47. package/react/components/notifications/components/shared/NotificationCardShell.js +55 -49
  48. package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
  49. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -3
  50. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
  51. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.d.ts +4 -0
  52. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js +92 -13
  53. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
  54. package/react/components/notifications/components/views/ListView.js +5 -9
  55. package/react/components/notifications/components/views/ListView.js.map +1 -1
  56. package/react/components/notifications/css/notification-card.css +165 -0
  57. package/react/components/notifications/stories/NotificationCardShell.stories.d.ts +14 -0
  58. package/react/components/notifications/stories/NotificationCardShell.stories.js +108 -0
  59. package/react/components/notifications/stories/NotificationCardShell.stories.js.map +1 -0
  60. package/react/components/notifications/tests/NotificationCardShell.spec.d.ts +1 -0
  61. package/react/components/notifications/tests/NotificationCardShell.spec.js +91 -0
  62. package/react/components/notifications/tests/NotificationCardShell.spec.js.map +1 -0
  63. package/react/components/notifications/types.d.ts +4 -2
  64. package/react/components/notifications/types.js.map +1 -1
  65. package/react/components/sdd/AddApp.d.ts +3 -3
  66. package/react/components/sdd/AddApp.js +29 -21
  67. package/react/components/sdd/AddApp.js.map +1 -1
  68. package/react/components/sdd/AppEditPage.js +1 -8
  69. package/react/components/sdd/AppEditPage.js.map +1 -1
  70. package/react/components/sdd/Appearance.css +2 -1
  71. package/react/components/sdd/Applications.js +7 -7
  72. package/react/components/sdd/Applications.js.map +1 -1
  73. package/react/components/sdd/Navigation.js +2 -4
  74. package/react/components/sdd/Navigation.js.map +1 -1
  75. package/react/components/sdd/common/views.js +1 -14
  76. package/react/components/sdd/common/views.js.map +1 -1
  77. package/react/components/sdd/css/addApp.css +64 -1
  78. package/react/components/sdd/css/nav.css +50 -29
  79. package/react/components/sdd/fixtures/views.js +1 -14
  80. package/react/components/sdd/fixtures/views.js.map +1 -1
  81. package/react/components/sdd/tests/AddApp.spec.js +2 -2
  82. package/react/components/sdd/tests/AddApp.spec.js.map +1 -1
  83. package/react/components/sdd/tests/AppEditPage.spec.js +5 -8
  84. package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
  85. package/react/components/sdd/tests/Export.spec.js +11 -11
  86. package/react/components/sdd/tests/Export.spec.js.map +1 -1
  87. package/react/components/sdd/tests/ExportZip.spec.js +3 -3
  88. package/react/components/sdd/tests/ExportZip.spec.js.map +1 -1
  89. package/react/components/sdd/tests/Navigation.spec.js +3 -2
  90. package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
  91. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -2
  92. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
  93. package/react/components/toolbar/dashbar/Dashbar.js +18 -14
  94. package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
  95. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.d.ts +9 -1
  96. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +35 -1
  97. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
  98. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js +1 -1
  99. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
  100. package/react/components/userPreferences/components/content/Workspaces.d.ts +3 -1
  101. package/react/components/userPreferences/components/content/Workspaces.js +20 -3
  102. package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
  103. package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +1 -0
  104. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +3 -2
  105. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
  106. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +12 -9
  107. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
  108. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js +2 -0
  109. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js.map +1 -1
  110. package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +99 -26
  111. package/react/components/windowTitleBar/WindowTitleBarShell.js +206 -138
  112. package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
  113. package/react/components/windowTitleBar/components/left/LinkerButton.js +30 -21
  114. package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
  115. package/react/hooks/useNotifications.js +8 -7
  116. package/react/hooks/useNotifications.js.map +1 -1
  117. package/react/tsconfig.tsbuildinfo +1 -1
  118. package/react/components/notifications/components/shared/OverflowMenu.d.ts +0 -16
  119. package/react/components/notifications/components/shared/OverflowMenu.js +0 -114
  120. package/react/components/notifications/components/shared/OverflowMenu.js.map +0 -1
  121. package/react/components/sdd/GettingStarted.d.ts +0 -8
  122. package/react/components/sdd/GettingStarted.js +0 -25
  123. package/react/components/sdd/GettingStarted.js.map +0 -1
  124. package/react/components/sdd/stories/GettingStarted.stories.d.ts +0 -11
  125. package/react/components/sdd/stories/GettingStarted.stories.js +0 -18
  126. package/react/components/sdd/stories/GettingStarted.stories.js.map +0 -1
@@ -531,6 +531,24 @@ export class WindowTitleBarShell extends React.Component {
531
531
  bodyElement.style.overflowY = "auto";
532
532
  }
533
533
  }
534
+ /**
535
+ * Once document is ready and header is injected into DOM, begin adjusting the height of elements and bump fixed/absolute elements
536
+ */
537
+ async maybeAdjustWindow() {
538
+ // don't start pushing stuff down until page is ready. This is needed for preloaded titlebars because they can happen before the page is ready.
539
+ if (document.readyState === "complete") {
540
+ this.beginAdjustment();
541
+ }
542
+ else {
543
+ document.addEventListener("readystatechange", () => {
544
+ if (document.readyState === "complete")
545
+ this.beginAdjustment();
546
+ });
547
+ }
548
+ }
549
+ /**
550
+ * Begin adjusting the body and top level elements and their direct descendants by the header height.
551
+ */
534
552
  beginAdjustment() {
535
553
  const header = document.getElementsByClassName("fsbl-header")[0];
536
554
  if (header) {
@@ -540,7 +558,7 @@ export class WindowTitleBarShell extends React.Component {
540
558
  bodyElement.style.height = `calc(100vh - ${headerHeight})`;
541
559
  }
542
560
  if (this.state.adjustContentHeights)
543
- this.adjustTopLevelHeight(Number(headerHeight.split("px")[0]));
561
+ this.adjustTopLevelHeight(Number.parseInt(headerHeight, 10));
544
562
  this.bumpElements(this.state.bumpElements);
545
563
  if (this.state.bumpElements.monitorFixedAdditions)
546
564
  this.monitorFixedPositionedElements(headerHeight);
@@ -550,76 +568,94 @@ export class WindowTitleBarShell extends React.Component {
550
568
  }
551
569
  }
552
570
  /**
553
- * Once document is ready and header is injected into DOM, begin adjusting the height of elements and bump fixed/absolute elements
554
- */
555
- async maybeAdjustWindow() {
556
- // don't start pushing stuff down until page is ready. This is needed for preloaded titlebars because they can happen before the page is ready.
557
- if (document.readyState === "complete") {
558
- this.beginAdjustment();
559
- }
560
- else {
561
- document.addEventListener("readystatechange", () => {
562
- if (document.readyState === "complete")
563
- this.beginAdjustment();
564
- });
565
- }
566
- }
567
- /**
568
- * Monitors the DOM for mutations, if the added node has a fixed position with a top style of 0px, it will be bumped by the title bar height.
569
- * @param headerHeight the height of the header
571
+ * Togglable setting found in `foreign.components.["Window Manager"].FSBLHeader.adjustContentHeights`
572
+ * Called from beginAdjustment()
573
+ *
574
+ * Adjusts the top level content maxHeight to be 100vh subtracted by the total height of the previous elements.
575
+ * The height of the previous elements are added to this calculation if they are not fixed or absolute.
576
+ * These top level elements will be passed into adjustContentHeight where their descendants
577
+ * will also have their heights adjusted.
578
+ * Example:
579
+ * In this below situation, the B element extends passed the view because the header is injected. B doesn't have a
580
+ * set height so it'll extend as far as it needs.
581
+ * --------------------
582
+ * |******************|
583
+ * |* Titlebar *|
584
+ * |******************|
585
+ * |******************|
586
+ * |* A *|
587
+ * |* *|
588
+ * |******************|
589
+ * |******************|
590
+ * |* *|
591
+ * |* *|
592
+ * |* B *|
593
+ * |* *|
594
+ * |* *|
595
+ * |* *|
596
+ * --------------------
597
+ * The chain of adjust functions will set the maxHeight of A and B to ensure they both occupy space that the above element doesn't
598
+ * and keep it within the bounds of the view.
599
+ * --------------------
600
+ * |******************|
601
+ * |* Titlebar *|
602
+ * |******************|
603
+ * |******************|
604
+ * |* A *|
605
+ * |* *|
606
+ * |******************|
607
+ * |******************|
608
+ * |* *|
609
+ * |* *|
610
+ * |* B *|
611
+ * |* *|
612
+ * |* *|
613
+ * |******************|
614
+ * --------------------
615
+ * @param {number} headerHeight the height of the header
570
616
  */
571
- monitorFixedPositionedElements(headerHeight) {
572
- const options = {
573
- childList: true,
574
- subtree: true,
575
- };
576
- /**
577
- * MutationObserver interface provides the ability to watch for
578
- * changes to the DOM tree using the observe method
579
- */
580
- const mutationObserver = new MutationObserver((mutations) => {
581
- mutations.forEach((mutation) => {
582
- mutation.addedNodes.forEach((node) => {
583
- var _a;
584
- if (!((_a = node.className) === null || _a === void 0 ? void 0 : _a.includes("bumped-element"))) {
585
- try {
586
- const nodeStyle = window.getComputedStyle(node);
587
- const topStyle = nodeStyle.top;
588
- // make sure node is fixed, has top style set to 0, and has not been bumped
589
- if (nodeStyle.position === "fixed" && possibleZeros.includes(topStyle)) {
590
- node.style.top = this.calculateBumpValue("0Positioned", topStyle, headerHeight);
591
- node.classList.add("bumped-element");
592
- }
593
- }
594
- catch (err) {
595
- // Expected to error if the node is not an Element e.g text is not of type Element
596
- }
597
- }
598
- });
599
- });
617
+ adjustTopLevelHeight(headerHeight) {
618
+ const elems = document.body.querySelectorAll(":scope > *:not(#FSBLHeader, .fsbl-header)");
619
+ let prev = headerHeight;
620
+ elems.forEach((elem) => {
621
+ this.adjust(elem, prev);
622
+ // Heights of fixed and absolute positioned elements are not added to the total heights of previous elements
623
+ // since they are removed from the document flow and can be positioned anywhere in the page.
624
+ if (elem.style.position !== "fixed" && elem.style.position !== "absolute")
625
+ prev = prev + elem.offsetHeight;
626
+ this.adjustContentHeight(elem);
600
627
  });
601
- // We observe the body and do not disconnect because there may be other elements that are dynamically loaded, such as a dialogue menu.
602
- mutationObserver.observe(document.body, options);
603
628
  }
604
629
  /**
605
- * Calls functions to bump fixed and/or absolute elements if configured to do so.
606
- * @param {object} config bumpElements object
630
+ * Adjusts the content view height to be maximum of the parent container (passed in by adjustTopLevelHeight()) height
631
+ * subtracted by the total height of elements above it. The height of the previous elements are added to this calculation
632
+ * if they are not fixed or absolute.
633
+ * @param {object} parentElem parent element
607
634
  */
608
- bumpElements(config) {
609
- if ((config === null || config === void 0 ? void 0 : config.bumpBy) && (config === null || config === void 0 ? void 0 : config.bumpBy) !== "0px") {
610
- if (config.fixed)
611
- this.bumpFixedElements(config);
612
- if (config.absolute)
613
- this.bumpAbsoluteElements(config);
635
+ adjustContentHeight(parentElem) {
636
+ const elem = parentElem;
637
+ const maxHeight = `100%`;
638
+ const { children } = elem;
639
+ const len = children.length;
640
+ let prev = 0;
641
+ for (let i = 0; i < len; i++) {
642
+ // Fixed and absolute positioned elements are ignored since they are removed from the document flow.
643
+ if (children[i].style.position !== "fixed" && children[i].style.position !== "absolute") {
644
+ this.adjust(children[i], prev, maxHeight);
645
+ prev = prev + children[i].offsetHeight;
646
+ }
614
647
  }
615
648
  }
616
649
  /**
650
+ * This is used in adjustTopLevelHeight() and adjustContentHeight()
651
+ *
617
652
  * Set the max height of each element to be the height of the parent container
618
653
  * subtracted by the height of the previous element. This forces the element to either obey its
619
654
  * predefined height or stay within the bounds of the max height.
655
+ *
620
656
  * @param {object} elem HTML element
621
657
  * @param {number} prev height of previous sibling
622
- * @param maxHeight
658
+ * @param {string} maxHeight maximum height of the element
623
659
  */
624
660
  adjust(elem, prev, maxHeight = "100vh") {
625
661
  var _a, _b;
@@ -635,44 +671,84 @@ export class WindowTitleBarShell extends React.Component {
635
671
  }
636
672
  }
637
673
  /**
638
- * Adjusts the top level content view height to be its height subtracted by the headerHeight and its
639
- * maxHeight to be 100vh subtracted by the total height of the previous elements.
640
- * The height of the previous elements are added to this calculation if they are not fixed or absolute.
641
- * @param {number} headerHeight the height of the header
674
+ * Togglable setting found in `foreign.components.["Window Manager"].FSBLHeader.bumpElements.[bumpBy|fixed|absolute]`
675
+ * Called from beginAdjustment()
676
+ *
677
+ * Calls bumpFixedElements and bumpAbsoluteElements to bump fixed and/or absolute elements by the value of bumpBy if configured to do so.
678
+ * Since absolute and fixed positioned elements are removed from the document flow their positions will not be adjusted when the titlebar
679
+ * is injected and they have a set top style. However, if the element is an absolute positioned element and it's
680
+ * parent container has a position that is not set to static, then it'll adjust relative to the parent. Fixed positioned elements, on the otherhand,
681
+ * won't adjust unless their top stlyes are changed.
682
+ * @param {object} config bumpElements object
642
683
  */
643
- adjustTopLevelHeight(headerHeight) {
644
- const elems = document.body.querySelectorAll(":scope > *:not(#FSBLHeader, .fsbl-header)");
645
- let prev = headerHeight;
646
- elems.forEach((elem) => {
647
- this.adjust(elem, prev);
648
- // Heights of fixed and absolute positioned elements are not added to the total heights of previous elements
649
- // since they are removed from the document flow and can be positioned anywhere in the page.
650
- if (elem.style.position !== "fixed" && elem.style.position !== "absolute")
651
- prev = prev + elem.offsetHeight;
652
- this.adjustContentHeight(elem);
653
- });
684
+ bumpElements(config) {
685
+ if ((config === null || config === void 0 ? void 0 : config.bumpBy) !== "0px") {
686
+ if (config.fixed)
687
+ this.bumpFixedElements(config);
688
+ if (config.absolute)
689
+ this.bumpAbsoluteElements(config);
690
+ }
654
691
  }
655
692
  /**
656
- * Adjusts the content view height to be maximum the parent container height subtracted by the total height elements above it.
657
- * The height of the previous elements are added to this calculation if they are not fixed or absolute.
658
- * @param {object} headerNode window titlebar
693
+ * Called from bumpElements
694
+ *
695
+ * Bumps all elements with fixed positioning, that are not in the header, down by the configured amount.
696
+ * @private
697
+ * @param {object} params bumpElements object
659
698
  */
660
- adjustContentHeight(headerNode) {
661
- const elem = headerNode;
662
- const maxHeight = `100%`;
663
- const { children } = elem;
664
- const len = children.length;
665
- let prev = 0;
699
+ bumpFixedElements(params) {
700
+ var _a, _b;
701
+ let { fixed, bumpBy } = params;
702
+ const getFixedElements = (selector) => {
703
+ const fixedElems = [];
704
+ const nodes = document.body.querySelectorAll(selector);
705
+ nodes.forEach((node) => {
706
+ const style = window.getComputedStyle(node, null);
707
+ if (style.getPropertyValue("position") == "fixed")
708
+ fixedElems.push(node);
709
+ });
710
+ return fixedElems;
711
+ };
712
+ const selector = "*:not(#FSBLHeader, .fsbl-header)";
713
+ // Get all fixed positioned elements
714
+ const elems = getFixedElements(selector);
715
+ const len = elems.length;
666
716
  for (let i = 0; i < len; i++) {
667
- // Fixed and absolute positioned elements are ignored since they are removed from the document flow.
668
- if (children[i].style.position !== "fixed" && children[i].style.position !== "absolute") {
669
- this.adjust(children[i], prev, maxHeight);
670
- prev = prev + children[i].offsetHeight;
717
+ const style = window.getComputedStyle(elems[i], null);
718
+ const topStyle = style.getPropertyValue("top");
719
+ if (!((_b = (_a = elems[i]) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains("bumped-element"))) {
720
+ elems[i].style.top = this.calculateBumpValue(fixed, topStyle, bumpBy);
721
+ elems[i].classList.add("bumped-element");
722
+ }
723
+ }
724
+ }
725
+ /**
726
+ * Called from bumpElements
727
+ *
728
+ * Bumps all absolute positioned elements with static parents, that are not in the header, down by the configured amount.
729
+ * @private
730
+ * @param {object} params bumpElements object
731
+ */
732
+ bumpAbsoluteElements(params) {
733
+ var _a, _b;
734
+ let { absolute, bumpBy } = params;
735
+ const selector = "*:not(#FSBLHeader, .fsbl-header)";
736
+ // Get top level absolute positioned elements and elements who have static parents
737
+ const elems = this.traverseHtml({ children: document.body.querySelectorAll(`:scope > ${selector}`) });
738
+ const len = elems.length;
739
+ for (let i = 0; i < len; i++) {
740
+ const style = window.getComputedStyle(elems[i], null);
741
+ const topStyle = style.getPropertyValue("top");
742
+ // Target absolute positioned elements
743
+ if (style.getPropertyValue("position") == "absolute" && !((_b = (_a = elems[i]) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains("bumped-element"))) {
744
+ elems[i].style.top = this.calculateBumpValue(absolute, topStyle, bumpBy);
745
+ elems[i].classList.add("bumped-element");
671
746
  }
672
747
  }
673
748
  }
674
749
  /**
675
- * Calculates value to bump element by. If 'all' return top style and header height, if '0Positioned' return header height
750
+ * Used in bumpFixedElements and bumpAbsoluteElements
751
+ * Calculates value to bump element by. If 'all' return top style plus the header height, if '0Positioned' return just header height
676
752
  * @param type Whether all elements are being bumped by the header height and their top style or just header height
677
753
  * @param topStyle Element top value
678
754
  * @param bumpBy Value to bump element by
@@ -689,6 +765,8 @@ export class WindowTitleBarShell extends React.Component {
689
765
  return topVal;
690
766
  }
691
767
  /**
768
+ * Used in bumpAbsoluteElements
769
+ *
692
770
  * Recursively traverse through the HTML document and return an array of the top level elements
693
771
  * and elements with static parents
694
772
  * @param {object} element The HTML element
@@ -716,60 +794,50 @@ export class WindowTitleBarShell extends React.Component {
716
794
  return acc;
717
795
  }
718
796
  /**
719
- * Bumps elements with fixed positioning down by the configured amount.
720
- * @private
797
+ * Togglable setting found in `foreign.components.["Window Manager"].FSBLHeader.bumpElements.[monitorFixedAdditions]`
798
+ * Called from beginAdjustment()
799
+ *
800
+ * Monitors the DOM for mutations, if the added node has a fixed position with a top style of 0px, it will be bumped by the title bar height.
801
+ * This ensures that if a fixed positioned element is dynamically added to the DOM, for example a pop-up modal, it'll have it's height adjusted
802
+ * by the header height since the initial bumping of elements can happen before this element exists.
803
+ *
804
+ * Element heights are not monitored and adjusted since this would require that all pre-existing elements have ther height recalculated each time
805
+ * a new element is dynamically added onto the page. Absolute postioned elements, however, could be monitored and adjusted since all we would
806
+ * need to check for is that it's parent has a static position or not, if it does then it can be adjusted.
807
+ * @param headerHeight the height of the header
721
808
  */
722
- bumpFixedElements(params) {
723
- var _a;
724
- let { fixed, bumpBy } = params;
725
- const getFixedElements = (nodes) => {
726
- const fixedElems = [];
727
- nodes.forEach((node) => {
728
- const style = window.getComputedStyle(node, null);
729
- if (style.getPropertyValue("position") == "fixed")
730
- fixedElems.push(node);
731
- const elems = node.querySelectorAll("*");
732
- elems.forEach((elem) => {
733
- const childStyle = window.getComputedStyle(elem, null);
734
- if (childStyle.getPropertyValue("position") == "fixed")
735
- fixedElems.push(elem);
809
+ monitorFixedPositionedElements(headerHeight) {
810
+ const options = {
811
+ childList: true,
812
+ subtree: true,
813
+ };
814
+ /**
815
+ * MutationObserver interface provides the ability to watch for
816
+ * changes to the DOM tree using the observe method
817
+ */
818
+ const mutationObserver = new MutationObserver((mutations) => {
819
+ mutations.forEach((mutation) => {
820
+ mutation.addedNodes.forEach((node) => {
821
+ var _a;
822
+ if (!((_a = node === null || node === void 0 ? void 0 : node.classList) === null || _a === void 0 ? void 0 : _a.contains("bumped-element"))) {
823
+ try {
824
+ const nodeStyle = window.getComputedStyle(node);
825
+ const topStyle = nodeStyle.top;
826
+ // make sure node is fixed, has top style set to 0, and has not been bumped
827
+ if (nodeStyle.position === "fixed" && possibleZeros.includes(topStyle)) {
828
+ node.style.top = this.calculateBumpValue("0Positioned", topStyle, headerHeight);
829
+ node.classList.add("bumped-element");
830
+ }
831
+ }
832
+ catch (err) {
833
+ // Expected to error if the node is not an Element e.g text is not of type Element
834
+ }
835
+ }
736
836
  });
737
837
  });
738
- return fixedElems;
739
- };
740
- const selector = "*:not(#FSBLHeader, .fsbl-header)";
741
- // Get all fixed positioned elements
742
- const elems = getFixedElements(document.body.querySelectorAll(`${selector}`));
743
- const len = elems.length;
744
- for (let i = 0; i < len; i++) {
745
- const style = window.getComputedStyle(elems[i], null);
746
- const topStyle = style.getPropertyValue("top");
747
- if (!((_a = elems[i].className) === null || _a === void 0 ? void 0 : _a.includes("bumped-element"))) {
748
- elems[i].style.top = this.calculateBumpValue(fixed, topStyle, bumpBy);
749
- elems[i].classList.add("bumped-element");
750
- }
751
- }
752
- }
753
- /**
754
- * Bumps absolute positioned elements with static parents down by the configured amount.
755
- * @private
756
- */
757
- bumpAbsoluteElements(params) {
758
- var _a;
759
- let { absolute, bumpBy } = params;
760
- const selector = "*:not(#FSBLHeader, .fsbl-header)";
761
- // Get top level absolute positioned elements and elements who have static parents
762
- const elems = this.traverseHtml({ children: document.body.querySelectorAll(`:scope > ${selector}`) });
763
- const len = elems.length;
764
- for (let i = 0; i < len; i++) {
765
- const style = window.getComputedStyle(elems[i], null);
766
- const topStyle = style.getPropertyValue("top");
767
- // Target absolute positioned elements
768
- if (style.getPropertyValue("position") == "absolute" && !((_a = elems[i].className) === null || _a === void 0 ? void 0 : _a.includes("bumped-element"))) {
769
- elems[i].style.top = this.calculateBumpValue(absolute, topStyle, bumpBy);
770
- elems[i].classList.add("bumped-element");
771
- }
772
- }
838
+ });
839
+ // We observe the body and do not disconnect because there may be other elements that are dynamically loaded, such as a dialogue menu.
840
+ mutationObserver.observe(document.body, options);
773
841
  }
774
842
  render() {
775
843
  let showDockingIcon = !this.state.dockingEnabled ? false : this.state.dockingIcon;