@brightspace-ui/core 1.231.0 → 1.231.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.
|
@@ -273,6 +273,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
273
273
|
this.__onAutoCloseClick = this.__onAutoCloseClick.bind(this);
|
|
274
274
|
this.__toggleScrollStyles = this.__toggleScrollStyles.bind(this);
|
|
275
275
|
this._handleMobileResize = this._handleMobileResize.bind(this);
|
|
276
|
+
this.__disconnectResizeObserver = this.__disconnectResizeObserver.bind(this);
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
get opened() {
|
|
@@ -312,6 +313,8 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
312
313
|
}
|
|
313
314
|
clearDismissible(this.__dismissibleId);
|
|
314
315
|
this.__dismissibleId = null;
|
|
316
|
+
|
|
317
|
+
if (this.__resizeObserver) this.__resizeObserver.disconnect();
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
firstUpdated(changedProperties) {
|
|
@@ -374,6 +377,17 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
374
377
|
this._showBackdrop = this._useMobileStyling && this.mobileTray;
|
|
375
378
|
}
|
|
376
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Waits for the next resize when elem has a height > 0px,
|
|
382
|
+
* then calls the __position function.
|
|
383
|
+
*/
|
|
384
|
+
requestRepositionNextResize(elem) {
|
|
385
|
+
if (!elem) return;
|
|
386
|
+
if (this.__resizeObserver) this.__resizeObserver.disconnect();
|
|
387
|
+
this.__resizeObserver = new ResizeObserver(this.__disconnectResizeObserver);
|
|
388
|
+
this.__resizeObserver.observe(elem);
|
|
389
|
+
}
|
|
390
|
+
|
|
377
391
|
async resize() {
|
|
378
392
|
if (!this.opened) {
|
|
379
393
|
return;
|
|
@@ -403,6 +417,20 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
|
|
|
403
417
|
}
|
|
404
418
|
}
|
|
405
419
|
|
|
420
|
+
__disconnectResizeObserver(entries) {
|
|
421
|
+
for (let i = 0; i < entries.length; i++) {
|
|
422
|
+
const entry = entries[i];
|
|
423
|
+
if (this.__resizeObserver && entry.contentRect.height !== 0) {
|
|
424
|
+
this.__resizeObserver.disconnect();
|
|
425
|
+
// wrap in rAF for Firefox
|
|
426
|
+
requestAnimationFrame(() => {
|
|
427
|
+
if (this.opened) this.__position();
|
|
428
|
+
});
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
406
434
|
__getContentBottom() {
|
|
407
435
|
return this.shadowRoot && this.shadowRoot.querySelector('.d2l-dropdown-content-bottom');
|
|
408
436
|
}
|
|
@@ -90,7 +90,20 @@
|
|
|
90
90
|
<d2l-demo-snippet>
|
|
91
91
|
<template>
|
|
92
92
|
<d2l-filter>
|
|
93
|
-
<d2l-filter-dimension-set key="course" text="Course" loading select-all
|
|
93
|
+
<d2l-filter-dimension-set key="course" text="Course" loading select-all>
|
|
94
|
+
<d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
|
|
95
|
+
<d2l-filter-dimension-set-value key="astronomy" text="Astronomy" selected></d2l-filter-dimension-set-value>
|
|
96
|
+
<d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
|
|
97
|
+
<d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
|
|
98
|
+
<d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
|
|
99
|
+
<d2l-filter-dimension-set-value key="english" text="English"></d2l-filter-dimension-set-value>
|
|
100
|
+
<d2l-filter-dimension-set-value key="how-to" text="How To Write a How To Article With a Flashy Title"></d2l-filter-dimension-set-value>
|
|
101
|
+
<d2l-filter-dimension-set-value key="math" text="Math"></d2l-filter-dimension-set-value>
|
|
102
|
+
<d2l-filter-dimension-set-value key="physics" text="Physics"></d2l-filter-dimension-set-value>
|
|
103
|
+
<d2l-filter-dimension-set-value key="stats" text="Statistics"></d2l-filter-dimension-set-value>
|
|
104
|
+
<d2l-filter-dimension-set-value key="writerscraft" text="Writer's Craft"></d2l-filter-dimension-set-value>
|
|
105
|
+
</d2l-filter-dimension-set>
|
|
106
|
+
|
|
94
107
|
</d2l-filter>
|
|
95
108
|
<d2l-filter>
|
|
96
109
|
<d2l-filter-dimension-set key="course" text="Course" loading select-all></d2l-filter-dimension-set>
|
|
@@ -256,7 +256,10 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
256
256
|
let dimensionHTML;
|
|
257
257
|
switch (dimension.type) {
|
|
258
258
|
case 'd2l-filter-dimension-set':
|
|
259
|
-
dimensionHTML = html
|
|
259
|
+
dimensionHTML = html`
|
|
260
|
+
<div aria-live="polite" class="d2l-filter-container">
|
|
261
|
+
${this._createSetDimension(dimension)}
|
|
262
|
+
</div>`;
|
|
260
263
|
break;
|
|
261
264
|
}
|
|
262
265
|
|
|
@@ -519,7 +522,8 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
519
522
|
|
|
520
523
|
let shouldUpdate = false,
|
|
521
524
|
shouldSearch = false,
|
|
522
|
-
shouldRecount = false
|
|
525
|
+
shouldRecount = false,
|
|
526
|
+
shouldResizeDropdown = false;
|
|
523
527
|
changes.forEach((newValue, prop) => {
|
|
524
528
|
if (toUpdate[prop] === newValue) return;
|
|
525
529
|
|
|
@@ -538,13 +542,23 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
|
|
|
538
542
|
} else if (prop === 'values') {
|
|
539
543
|
if (dimension.searchValue) shouldSearch = true;
|
|
540
544
|
shouldRecount = true;
|
|
545
|
+
shouldResizeDropdown = true;
|
|
541
546
|
this._activeFiltersSubscribers.updateSubscribers();
|
|
547
|
+
} else if (prop === 'loading') {
|
|
548
|
+
shouldResizeDropdown = true;
|
|
542
549
|
}
|
|
543
550
|
});
|
|
544
551
|
|
|
545
552
|
if (shouldSearch) this._performDimensionSearch(dimension);
|
|
546
553
|
if (shouldRecount) this._setFilterCounts(dimension);
|
|
547
|
-
if (shouldUpdate)
|
|
554
|
+
if (shouldUpdate) this.requestUpdate();
|
|
555
|
+
if (shouldResizeDropdown) {
|
|
556
|
+
const singleDimension = this._dimensions.length === 1;
|
|
557
|
+
if (singleDimension && this.opened) {
|
|
558
|
+
const dropdown = this.shadowRoot.querySelector('d2l-dropdown-content');
|
|
559
|
+
dropdown.requestRepositionNextResize(this.shadowRoot.querySelector('.d2l-filter-container'));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
548
562
|
}
|
|
549
563
|
|
|
550
564
|
_handleDimensionHide() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.231.
|
|
3
|
+
"version": "1.231.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",
|