@brightspace-ui/core 3.15.0 → 3.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -698,7 +698,9 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
698
698
|
}
|
699
699
|
}
|
700
700
|
|
701
|
-
async __position(
|
701
|
+
async __position(contentRect, options) {
|
702
|
+
|
703
|
+
options = Object.assign({ updateAboveBelow: true, updateHeight: true }, options);
|
702
704
|
|
703
705
|
const opener = this.__getOpener();
|
704
706
|
if (!opener) {
|
@@ -713,7 +715,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
713
715
|
const header = this.__getContentTop(); // todo: rename
|
714
716
|
const footer = this.__getContentBottom(); // todo: rename
|
715
717
|
|
716
|
-
if (!this.noAutoFit) {
|
718
|
+
if (!this.noAutoFit && options.updateHeight) {
|
717
719
|
this._contentHeight = null;
|
718
720
|
}
|
719
721
|
|
@@ -783,25 +785,27 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
783
785
|
|
784
786
|
}
|
785
787
|
|
786
|
-
if (
|
788
|
+
if (options.updateAboveBelow) {
|
787
789
|
this.openedAbove = this._getOpenedAbove(spaceAround, spaceAroundScroll, spaceRequired);
|
788
790
|
}
|
789
791
|
|
790
792
|
this._position = this._getPosition(spaceAround, targetRect, contentRect);
|
791
793
|
this._pointerPosition = this._getPointerPosition(targetRect);
|
792
794
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
795
|
+
if (options.updateHeight) {
|
796
|
+
// calculate height available to the dropdown contents for overflow because that is the only area capable of scrolling
|
797
|
+
const availableHeight = this.openedAbove ? spaceAround.above : spaceAround.below;
|
798
|
+
if (!this.noAutoFit && availableHeight && availableHeight > 0) {
|
799
|
+
// only apply maximum if it's less than space available and the header/footer alone won't exceed it (content must be visible)
|
800
|
+
this._contentHeight = this.maxHeight !== null
|
801
|
+
&& availableHeight > this.maxHeight
|
802
|
+
&& headerFooterHeight < this.maxHeight
|
803
|
+
? this.maxHeight - headerFooterHeight - 2
|
804
|
+
: availableHeight - headerFooterHeight;
|
805
|
+
|
806
|
+
// ensure the content height has updated when the __toggleScrollStyles event handler runs
|
807
|
+
await this.updateComplete;
|
808
|
+
}
|
805
809
|
}
|
806
810
|
|
807
811
|
/** Dispatched when the dropdown position finishes adjusting */
|
@@ -832,7 +836,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
832
836
|
// throttle repositioning (https://developer.mozilla.org/en-US/docs/Web/API/Document/scroll_event#scroll_event_throttling)
|
833
837
|
if (!this.__repositioning) {
|
834
838
|
requestAnimationFrame(() => {
|
835
|
-
this.__position(
|
839
|
+
this.__position(undefined, { updateAboveBelow: false, updateHeight: false });
|
836
840
|
this.__repositioning = false;
|
837
841
|
});
|
838
842
|
}
|
@@ -148,7 +148,7 @@ class DropdownMenu extends ThemeMixin(DropdownContentMixin(LitElement)) {
|
|
148
148
|
this.maxHeight = this._maxHeightNonTray;
|
149
149
|
}
|
150
150
|
|
151
|
-
this.__position(
|
151
|
+
this.__position(e.detail, { updateAboveBelow: this._initializingHeight });
|
152
152
|
this._initializingHeight = false;
|
153
153
|
|
154
154
|
const menu = this.__getMenuElement();
|
@@ -46,7 +46,7 @@ class DropdownTabs extends DropdownContentMixin(LitElement) {
|
|
46
46
|
height: e.detail.height + tabListRect.height + 52,
|
47
47
|
width: e.detail.width
|
48
48
|
};
|
49
|
-
this.__position(
|
49
|
+
this.__position(rect, { updateAboveBelow: this._initializingHeight });
|
50
50
|
this._initializingHeight = false;
|
51
51
|
}
|
52
52
|
|
@@ -56,7 +56,7 @@ class DropdownTabs extends DropdownContentMixin(LitElement) {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
_onTabSelected() {
|
59
|
-
this.__position(
|
59
|
+
this.__position();
|
60
60
|
}
|
61
61
|
|
62
62
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.15.
|
3
|
+
"version": "3.15.1",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|