@brightspace-ui/core 3.219.5 → 3.219.7
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/components/dropdown/README.md +0 -1
- package/components/dropdown/dropdown-content.js +10 -38
- package/components/dropdown/dropdown-menu.js +126 -316
- package/components/dropdown/dropdown-opener-mixin.js +3 -28
- package/components/dropdown/dropdown-popover-mixin.js +2 -7
- package/components/dropdown/dropdown-tabs.js +45 -113
- package/components/filter/filter.js +1 -20
- package/components/table/table-col-sort-button.js +1 -2
- package/components/table/table-wrapper.js +17 -28
- package/custom-elements.json +99 -144
- package/helpers/README.md +0 -14
- package/helpers/demo/prism.html +0 -1784
- package/helpers/visualReady.js +0 -2
- package/package.json +1 -1
- package/components/dropdown/dropdown-content-mixin.js +0 -1299
- package/components/dropdown/dropdown-content-styles.js +0 -327
|
@@ -1,127 +1,59 @@
|
|
|
1
1
|
import { css, LitElement } from 'lit';
|
|
2
|
-
import { DropdownPopoverMixin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
::slotted(d2l-tabs) {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
`];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
firstUpdated(changedProperties) {
|
|
26
|
-
super.firstUpdated(changedProperties);
|
|
27
|
-
|
|
28
|
-
this.addEventListener('d2l-dropdown-open', this.#handleOpen);
|
|
29
|
-
this.addEventListener('d2l-menu-resize', this.#handleMenuResize);
|
|
30
|
-
this.addEventListener('d2l-tab-panel-selected', this.#handleTabSelected);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#initializingHeight;
|
|
34
|
-
|
|
35
|
-
#handleMenuResize(e) {
|
|
36
|
-
|
|
37
|
-
const tabs = this.shadowRoot?.querySelector('.dropdown-content > slot')
|
|
38
|
-
.assignedNodes()
|
|
39
|
-
.filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
|
|
40
|
-
|
|
41
|
-
if (!tabs) return;
|
|
42
|
-
const tabListRect = tabs.getTabListRect();
|
|
43
|
-
|
|
44
|
-
// need to include height of tablist, dropdown padding, tab margins
|
|
45
|
-
const rect = {
|
|
46
|
-
height: e.detail.height + tabListRect.height + 52,
|
|
47
|
-
width: e.detail.width
|
|
48
|
-
};
|
|
49
|
-
this.position(rect, { updateLocation: this.#initializingHeight });
|
|
50
|
-
this.#initializingHeight = false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#handleOpen(e) {
|
|
54
|
-
if (e.target !== this) return;
|
|
55
|
-
this.#initializingHeight = true;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
#handleTabSelected() {
|
|
59
|
-
this.position();
|
|
60
|
-
}
|
|
61
|
-
|
|
2
|
+
import { DropdownPopoverMixin } from './dropdown-popover-mixin.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A container for a "d2l-tabs" component. It provides additional support on top of "d2l-dropdown-content" for automatic resizing when the tab changes.
|
|
6
|
+
* @slot - Anything inside of "d2l-dropdown-content" that isn't in the "header" or "footer" slots appears as regular content
|
|
7
|
+
* @slot header - Sticky container at the top of the dropdown
|
|
8
|
+
* @slot footer - Sticky container at the bottom of the dropdown
|
|
9
|
+
* @fires d2l-dropdown-open - Dispatched when the dropdown is opened
|
|
10
|
+
*/
|
|
11
|
+
class DropdownTabs extends DropdownPopoverMixin(LitElement) {
|
|
12
|
+
|
|
13
|
+
static get styles() {
|
|
14
|
+
return [super.styles, css`
|
|
15
|
+
::slotted(d2l-tabs) {
|
|
16
|
+
margin-bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
`];
|
|
62
19
|
}
|
|
63
|
-
customElements.define('d2l-dropdown-tabs', DropdownTabs);
|
|
64
|
-
|
|
65
|
-
} else {
|
|
66
20
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* @slot - Anything inside of "d2l-dropdown-content" that isn't in the "header" or "footer" slots appears as regular content
|
|
70
|
-
* @slot header - Sticky container at the top of the dropdown
|
|
71
|
-
* @slot footer - Sticky container at the bottom of the dropdown
|
|
72
|
-
* @fires d2l-dropdown-open - Dispatched when the dropdown is opened
|
|
73
|
-
*/
|
|
74
|
-
class DropdownTabs extends DropdownContentMixin(LitElement) {
|
|
21
|
+
firstUpdated(changedProperties) {
|
|
22
|
+
super.firstUpdated(changedProperties);
|
|
75
23
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
`];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
firstUpdated(changedProperties) {
|
|
85
|
-
super.firstUpdated(changedProperties);
|
|
24
|
+
this.addEventListener('d2l-dropdown-open', this.#handleOpen);
|
|
25
|
+
this.addEventListener('d2l-menu-resize', this.#handleMenuResize);
|
|
26
|
+
this.addEventListener('d2l-tab-panel-selected', this.#handleTabSelected);
|
|
27
|
+
}
|
|
86
28
|
|
|
87
|
-
|
|
88
|
-
this.addEventListener('d2l-menu-resize', this._onMenuResize);
|
|
89
|
-
this.addEventListener('d2l-tab-panel-selected', this._onTabSelected);
|
|
90
|
-
}
|
|
29
|
+
#initializingHeight;
|
|
91
30
|
|
|
92
|
-
|
|
93
|
-
return this._renderContent();
|
|
94
|
-
}
|
|
31
|
+
#handleMenuResize(e) {
|
|
95
32
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.assignedNodes()
|
|
100
|
-
.filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
|
|
101
|
-
}
|
|
33
|
+
const tabs = this.shadowRoot?.querySelector('.dropdown-content > slot')
|
|
34
|
+
.assignedNodes()
|
|
35
|
+
.filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
|
|
102
36
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const tabListRect = tabs.getTabListRect();
|
|
106
|
-
// need to include height of tablist, dropdown padding, tab margins
|
|
107
|
-
const rect = {
|
|
108
|
-
height: e.detail.height + tabListRect.height + 52,
|
|
109
|
-
width: e.detail.width
|
|
110
|
-
};
|
|
111
|
-
this.__position(rect, { updateAboveBelow: this._initializingHeight });
|
|
112
|
-
this._initializingHeight = false;
|
|
113
|
-
}
|
|
37
|
+
if (!tabs) return;
|
|
38
|
+
const tabListRect = tabs.getTabListRect();
|
|
114
39
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
40
|
+
// need to include height of tablist, dropdown padding, tab margins
|
|
41
|
+
const rect = {
|
|
42
|
+
height: e.detail.height + tabListRect.height + 52,
|
|
43
|
+
width: e.detail.width
|
|
44
|
+
};
|
|
45
|
+
this.position(rect, { updateLocation: this.#initializingHeight });
|
|
46
|
+
this.#initializingHeight = false;
|
|
47
|
+
}
|
|
119
48
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
49
|
+
#handleOpen(e) {
|
|
50
|
+
if (e.target !== this) return;
|
|
51
|
+
this.#initializingHeight = true;
|
|
52
|
+
}
|
|
123
53
|
|
|
54
|
+
#handleTabSelected() {
|
|
55
|
+
this.position();
|
|
124
56
|
}
|
|
125
|
-
customElements.define('d2l-dropdown-tabs', DropdownTabs);
|
|
126
57
|
|
|
127
58
|
}
|
|
59
|
+
customElements.define('d2l-dropdown-tabs', DropdownTabs);
|
|
@@ -821,8 +821,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
|
|
|
821
821
|
|
|
822
822
|
let shouldUpdate = false,
|
|
823
823
|
shouldSearch = false,
|
|
824
|
-
shouldRecount = false
|
|
825
|
-
shouldResizeDropdown = false;
|
|
824
|
+
shouldRecount = false;
|
|
826
825
|
changes.forEach((newValue, prop) => {
|
|
827
826
|
if (toUpdate[prop] === newValue) return;
|
|
828
827
|
|
|
@@ -841,10 +840,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
|
|
|
841
840
|
} else if (prop === 'values') {
|
|
842
841
|
if (dimension.searchValue || dimension.searchType === 'manual') shouldSearch = true;
|
|
843
842
|
shouldRecount = true;
|
|
844
|
-
shouldResizeDropdown = true;
|
|
845
843
|
this._activeFiltersSubscribers.updateSubscribers();
|
|
846
|
-
} else if (prop === 'loading') {
|
|
847
|
-
shouldResizeDropdown = true;
|
|
848
844
|
} else if (prop === 'text') {
|
|
849
845
|
this._activeFiltersSubscribers.updateSubscribers();
|
|
850
846
|
}
|
|
@@ -853,10 +849,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
|
|
|
853
849
|
if (shouldSearch) this._performDimensionSearch(dimension);
|
|
854
850
|
if (shouldRecount) this._setFilterCounts(dimension);
|
|
855
851
|
if (shouldUpdate) this.requestUpdate();
|
|
856
|
-
if (shouldResizeDropdown) {
|
|
857
|
-
// todo: remove this when removing GAUD-7472-dropdown-popover flag (this request is no longer needed)
|
|
858
|
-
this._requestDropdownResize();
|
|
859
|
-
}
|
|
860
852
|
if (e.detail.dispatchChangeEvent) this._dispatchChangeEventValueDataChange(dimension, value, e.detail.valueKey);
|
|
861
853
|
}
|
|
862
854
|
|
|
@@ -1070,20 +1062,9 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
|
|
|
1070
1062
|
break;
|
|
1071
1063
|
}
|
|
1072
1064
|
|
|
1073
|
-
// todo: remove this when removing GAUD-7472-dropdown-popover flag (this request is no longer needed)
|
|
1074
|
-
this._requestDropdownResize();
|
|
1075
1065
|
this.requestUpdate();
|
|
1076
1066
|
}
|
|
1077
1067
|
|
|
1078
|
-
// todo: remove this method when removing GAUD-7472-dropdown-popover flag (d2l-filter calls requestRepositionNextResize)
|
|
1079
|
-
_requestDropdownResize() {
|
|
1080
|
-
const singleDimension = this._dimensions.length === 1;
|
|
1081
|
-
if (singleDimension && this.opened) {
|
|
1082
|
-
const dropdown = this.shadowRoot.querySelector('d2l-dropdown-content');
|
|
1083
|
-
dropdown.requestRepositionNextResize(this.shadowRoot.querySelector('.d2l-filter-container'));
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
1068
|
_search(dimension) {
|
|
1088
1069
|
if (dimension.searchType === 'automatic') {
|
|
1089
1070
|
this._performDimensionSearch(dimension);
|
|
@@ -10,7 +10,6 @@ import { getFocusRingStyles } from '../../helpers/focus.js';
|
|
|
10
10
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
11
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
12
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
13
|
-
import { usePopoverMixin } from '../dropdown/dropdown-popover-mixin.js';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Button for sorting a table column in ascending/descending order.
|
|
@@ -185,7 +184,7 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
|
|
|
185
184
|
if (this._hasDropdownItems) {
|
|
186
185
|
return html`<d2l-dropdown>
|
|
187
186
|
${button}
|
|
188
|
-
<d2l-dropdown-menu no-pointer align="start" vertical-offset="
|
|
187
|
+
<d2l-dropdown-menu no-pointer align="start" vertical-offset="0">
|
|
189
188
|
<d2l-menu label="${ifDefined(this._label)}" @d2l-table-col-sort-button-item-change="${this._handleTablColSortButtonItemChange}">
|
|
190
189
|
<slot name="items" @slotchange="${this._handleSlotChange}"></slot>
|
|
191
190
|
</d2l-menu>
|
|
@@ -4,17 +4,13 @@ import '../backdrop/backdrop-loading.js';
|
|
|
4
4
|
import { css, html, LitElement, nothing } from 'lit';
|
|
5
5
|
import { cssSizes } from '../inputs/input-checkbox.js';
|
|
6
6
|
import { getComposedParent } from '../../helpers/dom.js';
|
|
7
|
-
import { getFlag } from '../../helpers/flags.js';
|
|
8
7
|
import { isPopoverSupported } from '../popover/popover-mixin.js';
|
|
9
8
|
import { PageableMixin } from '../paging/pageable-mixin.js';
|
|
10
9
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
11
10
|
import { SelectionMixin } from '../selection/selection-mixin.js';
|
|
12
|
-
import { usePopoverMixin as useDropdownPopover } from '../dropdown/dropdown-popover-mixin.js';
|
|
13
11
|
import { usePopoverMixin as useTooltipPopover } from '../tooltip/tooltip.js';
|
|
14
12
|
|
|
15
|
-
export const isUsingNativePopover = isPopoverSupported &&
|
|
16
|
-
|
|
17
|
-
const colSyncFix = getFlag('GAUD-8228-8186-improved-table-col-sync', true);
|
|
13
|
+
export const isUsingNativePopover = isPopoverSupported && useTooltipPopover;
|
|
18
14
|
|
|
19
15
|
export const tableStyles = css`
|
|
20
16
|
.d2l-table {
|
|
@@ -228,22 +224,17 @@ export const tableStyles = css`
|
|
|
228
224
|
}
|
|
229
225
|
|
|
230
226
|
/* sticky + scroll-wrapper */
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
227
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper]:not([_no-scroll-width]) .d2l-table {
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-direction: column;
|
|
230
|
+
}
|
|
236
231
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
232
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper][_no-scroll-width] .d2l-table > thead {
|
|
233
|
+
display: table-header-group;
|
|
234
|
+
}
|
|
240
235
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}` : css`
|
|
244
|
-
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper] .d2l-table {
|
|
245
|
-
display: block;
|
|
246
|
-
}`
|
|
236
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper][_no-scroll-width] .d2l-table > tbody {
|
|
237
|
+
display: table-row-group;
|
|
247
238
|
}
|
|
248
239
|
|
|
249
240
|
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper] .d2l-table > thead {
|
|
@@ -392,7 +383,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
392
383
|
this._controlsMutationObserver = null;
|
|
393
384
|
this._controlsScrolled = false;
|
|
394
385
|
this._controlsScrolledMutationObserver = null;
|
|
395
|
-
this._noScrollWidth =
|
|
386
|
+
this._noScrollWidth = true;
|
|
396
387
|
this._table = null;
|
|
397
388
|
this._tableIntersectionObserver = null;
|
|
398
389
|
this._tableMutationObserver = null;
|
|
@@ -598,7 +589,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
598
589
|
|
|
599
590
|
if (!this._tableResizeObserver) this._tableResizeObserver = new ResizeObserver(entries => this._syncColumnWidths(entries));
|
|
600
591
|
this._tableResizeObserver.observe(this._table);
|
|
601
|
-
|
|
592
|
+
this.querySelectorAll('tr:first-child *').forEach(el => this._tableResizeObserver.observe(el));
|
|
602
593
|
|
|
603
594
|
this._handleTableChange();
|
|
604
595
|
}
|
|
@@ -633,7 +624,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
633
624
|
|
|
634
625
|
if (updates.count) this._updateItemShowingCount();
|
|
635
626
|
if (updates.classNames) this._applyClassNames();
|
|
636
|
-
|
|
627
|
+
await Promise.all([...updateList, ...this.querySelectorAll('d2l-table-col-sort-button')].map(n => n.updateComplete));
|
|
637
628
|
if (updates.syncWidths) this._syncColumnWidths();
|
|
638
629
|
if (updates.sticky) this._updateStickyTops();
|
|
639
630
|
}
|
|
@@ -652,12 +643,10 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
652
643
|
const head = this._table.querySelector('thead');
|
|
653
644
|
const body = this._table.querySelector('tbody');
|
|
654
645
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
});
|
|
660
|
-
}
|
|
646
|
+
const maxScrollWidth = Math.max(head?.scrollWidth, body?.scrollWidth);
|
|
647
|
+
setTimeout(() => {
|
|
648
|
+
this._noScrollWidth = this.clientWidth === maxScrollWidth;
|
|
649
|
+
});
|
|
661
650
|
if (!head || !body || !this._table || !this.stickyHeaders || !this.stickyHeadersScrollWrapper || this._noScrollWidth) return;
|
|
662
651
|
|
|
663
652
|
const candidateRowHeadCells = [];
|