@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.
- package/package.json +14 -14
- package/react/assets/css/button.css +34 -6
- package/react/assets/css/contextMenu.css +118 -0
- package/react/assets/css/notificationsCenter.css +3 -214
- package/react/assets/css/userPreferences.css +2 -2
- package/react/components/common/Checkbox.d.ts +3 -2
- package/react/components/common/Checkbox.js +5 -21
- package/react/components/common/Checkbox.js.map +1 -1
- package/react/components/common/ContextMenu.d.ts +13 -0
- package/react/components/common/ContextMenu.js +69 -0
- package/react/components/common/ContextMenu.js.map +1 -0
- package/react/components/common/DropdownButton.d.ts +0 -4
- package/react/components/common/DropdownButton.js +39 -10
- package/react/components/common/DropdownButton.js.map +1 -1
- package/react/components/common/css/FinsembleToggle.css +0 -1
- package/react/components/common/css/application-edit-page.css +3 -4
- package/react/components/common/css/checkbox.css +60 -21
- package/react/components/common/css/icon.css +2 -2
- package/react/components/common/css/toggle.css +4 -1
- package/react/components/common/helpers.js +9 -0
- package/react/components/common/helpers.js.map +1 -1
- package/react/components/common/stories/ContextMenu.stories.d.ts +38 -0
- package/react/components/common/stories/ContextMenu.stories.js +70 -0
- package/react/components/common/stories/ContextMenu.stories.js.map +1 -0
- package/react/components/common/stories/DropdownButton.stories.d.ts +3 -3
- package/react/components/common/stories/DropdownButton.stories.js +11 -10
- package/react/components/common/stories/DropdownButton.stories.js.map +1 -1
- package/react/components/common/tests/Checkbox.spec.js +10 -12
- package/react/components/common/tests/Checkbox.spec.js.map +1 -1
- package/react/components/common/tests/ContextMenu.spec.d.ts +1 -0
- package/react/components/common/tests/ContextMenu.spec.js +108 -0
- package/react/components/common/tests/ContextMenu.spec.js.map +1 -0
- package/react/components/common/tests/DropdownButton.spec.d.ts +1 -0
- package/react/components/common/tests/DropdownButton.spec.js +32 -0
- package/react/components/common/tests/DropdownButton.spec.js.map +1 -0
- package/react/components/fdc3Resolver/ResolverDialog.js +5 -1
- package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
- package/react/components/notifications/components/drawer/DrawerHeader.js +3 -3
- package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +1 -0
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +2 -0
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
- package/react/components/notifications/components/shared/IconButton.js +2 -1
- package/react/components/notifications/components/shared/IconButton.js.map +1 -1
- package/react/components/notifications/components/shared/NotificationCardShell.d.ts +2 -0
- package/react/components/notifications/components/shared/NotificationCardShell.js +55 -49
- package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -3
- package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.d.ts +4 -0
- package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js +92 -13
- package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
- package/react/components/notifications/components/views/ListView.js +5 -9
- package/react/components/notifications/components/views/ListView.js.map +1 -1
- package/react/components/notifications/css/notification-card.css +165 -0
- package/react/components/notifications/stories/NotificationCardShell.stories.d.ts +14 -0
- package/react/components/notifications/stories/NotificationCardShell.stories.js +108 -0
- package/react/components/notifications/stories/NotificationCardShell.stories.js.map +1 -0
- package/react/components/notifications/tests/NotificationCardShell.spec.d.ts +1 -0
- package/react/components/notifications/tests/NotificationCardShell.spec.js +91 -0
- package/react/components/notifications/tests/NotificationCardShell.spec.js.map +1 -0
- package/react/components/notifications/types.d.ts +4 -2
- package/react/components/notifications/types.js.map +1 -1
- package/react/components/sdd/AddApp.d.ts +3 -3
- package/react/components/sdd/AddApp.js +29 -21
- package/react/components/sdd/AddApp.js.map +1 -1
- package/react/components/sdd/AppEditPage.js +1 -8
- package/react/components/sdd/AppEditPage.js.map +1 -1
- package/react/components/sdd/Appearance.css +2 -1
- package/react/components/sdd/Applications.js +7 -7
- package/react/components/sdd/Applications.js.map +1 -1
- package/react/components/sdd/Navigation.js +2 -4
- package/react/components/sdd/Navigation.js.map +1 -1
- package/react/components/sdd/common/views.js +1 -14
- package/react/components/sdd/common/views.js.map +1 -1
- package/react/components/sdd/css/addApp.css +64 -1
- package/react/components/sdd/css/nav.css +50 -29
- package/react/components/sdd/fixtures/views.js +1 -14
- package/react/components/sdd/fixtures/views.js.map +1 -1
- package/react/components/sdd/tests/AddApp.spec.js +2 -2
- package/react/components/sdd/tests/AddApp.spec.js.map +1 -1
- package/react/components/sdd/tests/AppEditPage.spec.js +5 -8
- package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
- package/react/components/sdd/tests/Export.spec.js +11 -11
- package/react/components/sdd/tests/Export.spec.js.map +1 -1
- package/react/components/sdd/tests/ExportZip.spec.js +3 -3
- package/react/components/sdd/tests/ExportZip.spec.js.map +1 -1
- package/react/components/sdd/tests/Navigation.spec.js +3 -2
- package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -2
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
- package/react/components/toolbar/dashbar/Dashbar.js +18 -14
- package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
- package/react/components/toolbar/workspaceManagementMenu/components/Workspace.d.ts +9 -1
- package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +35 -1
- package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
- package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js +1 -1
- package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
- package/react/components/userPreferences/components/content/Workspaces.d.ts +3 -1
- package/react/components/userPreferences/components/content/Workspaces.js +20 -3
- package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +1 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +3 -2
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
- package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +12 -9
- package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
- package/react/components/userPreferences/tests/UserPreferencesBase.spec.js +2 -0
- package/react/components/userPreferences/tests/UserPreferencesBase.spec.js.map +1 -1
- package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +99 -26
- package/react/components/windowTitleBar/WindowTitleBarShell.js +206 -138
- package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
- package/react/components/windowTitleBar/components/left/LinkerButton.js +30 -21
- package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
- package/react/hooks/useNotifications.js +8 -7
- package/react/hooks/useNotifications.js.map +1 -1
- package/react/tsconfig.tsbuildinfo +1 -1
- package/react/components/notifications/components/shared/OverflowMenu.d.ts +0 -16
- package/react/components/notifications/components/shared/OverflowMenu.js +0 -114
- package/react/components/notifications/components/shared/OverflowMenu.js.map +0 -1
- package/react/components/sdd/GettingStarted.d.ts +0 -8
- package/react/components/sdd/GettingStarted.js +0 -25
- package/react/components/sdd/GettingStarted.js.map +0 -1
- package/react/components/sdd/stories/GettingStarted.stories.d.ts +0 -11
- package/react/components/sdd/stories/GettingStarted.stories.js +0 -18
- 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
|
|
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
|
-
*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
*
|
|
569
|
-
*
|
|
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
|
-
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
-
*
|
|
606
|
-
*
|
|
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
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
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
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
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
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
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
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
720
|
-
*
|
|
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
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
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
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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;
|