@brightspace-ui/core 3.17.0 → 3.17.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.
@@ -2,6 +2,7 @@ import '../colors/colors.js';
|
|
2
2
|
import '../scroll-wrapper/scroll-wrapper.js';
|
3
3
|
import { css, html, LitElement, nothing } from 'lit';
|
4
4
|
import { cssSizes } from '../inputs/input-checkbox.js';
|
5
|
+
import { getComposedParent } from '../../helpers/dom.js';
|
5
6
|
import { PageableMixin } from '../paging/pageable-mixin.js';
|
6
7
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
7
8
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
@@ -252,6 +253,10 @@ export const tableStyles = css`
|
|
252
253
|
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper] .d2l-table > tbody {
|
253
254
|
display: block;
|
254
255
|
}
|
256
|
+
|
257
|
+
[data-popover-count] {
|
258
|
+
z-index: 6 !important; /* if opened above, we want to stack on top of sticky table-controls */
|
259
|
+
}
|
255
260
|
`;
|
256
261
|
|
257
262
|
/**
|
@@ -370,9 +375,19 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
370
375
|
this._tableScrollers = {};
|
371
376
|
}
|
372
377
|
|
378
|
+
connectedCallback() {
|
379
|
+
super.connectedCallback();
|
380
|
+
|
381
|
+
this.addEventListener('d2l-dropdown-open', this._handlePopoverOpen);
|
382
|
+
this.addEventListener('d2l-dropdown-close', this._handlePopoverClose);
|
383
|
+
}
|
384
|
+
|
373
385
|
disconnectedCallback() {
|
374
386
|
super.disconnectedCallback();
|
375
387
|
|
388
|
+
this.removeEventListener('d2l-dropdown-open', this._handlePopoverOpen);
|
389
|
+
this.removeEventListener('d2l-dropdown-close', this._handlePopoverClose);
|
390
|
+
|
376
391
|
this._controlsMutationObserver?.disconnect();
|
377
392
|
this._controlsScrolledMutationObserver?.disconnect();
|
378
393
|
this._tableMutationObserver?.disconnect();
|
@@ -499,6 +514,14 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
499
514
|
this._handleControlsChange();
|
500
515
|
}
|
501
516
|
|
517
|
+
_handlePopoverClose(e) {
|
518
|
+
this._updateStickyAncestor(e.target, false);
|
519
|
+
}
|
520
|
+
|
521
|
+
_handlePopoverOpen(e) {
|
522
|
+
this._updateStickyAncestor(e.target, true);
|
523
|
+
}
|
524
|
+
|
502
525
|
_handleSlotChange(e) {
|
503
526
|
this._table = e.target.assignedNodes({ flatten: true }).find(
|
504
527
|
node => (node.nodeType === Node.ELEMENT_NODE && node.tagName === 'TABLE' && node.classList.contains('d2l-table'))
|
@@ -589,6 +612,30 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
589
612
|
}
|
590
613
|
}
|
591
614
|
|
615
|
+
_updateStickyAncestor(node, popoverOpened) {
|
616
|
+
if (!this.stickyHeaders) return;
|
617
|
+
|
618
|
+
node = getComposedParent(node);
|
619
|
+
while (node) {
|
620
|
+
if (node === this) break;
|
621
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
622
|
+
const style = window.getComputedStyle(node, null);
|
623
|
+
if (style.getPropertyValue('position') === 'sticky') {
|
624
|
+
|
625
|
+
let popoverCount = Number.parseInt(node.getAttribute('data-popover-count'));
|
626
|
+
if (Number.isNaN(popoverCount)) popoverCount = 0;
|
627
|
+
popoverOpened ? popoverCount++ : popoverCount--;
|
628
|
+
|
629
|
+
if (popoverCount > 0) node.setAttribute('data-popover-count', popoverCount);
|
630
|
+
else node.removeAttribute('data-popover-count');
|
631
|
+
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
}
|
635
|
+
node = getComposedParent(node);
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
592
639
|
_updateStickyTops() {
|
593
640
|
const hasStickyControls = this._controls && !this._controls.noSticky;
|
594
641
|
let rowTop = hasStickyControls ? this._controls.offsetHeight + 6 : 0; // +6 for the internal `margin-bottom`.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.17.
|
3
|
+
"version": "3.17.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",
|