@brightspace-ui/core 3.153.0 → 3.153.2
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.
@@ -26,8 +26,6 @@ class CountBadgeIcon extends FocusMixin(CountBadgeMixin(LitElement)) {
|
|
26
26
|
return [super.styles, css`
|
27
27
|
${getFocusRingStyles(pseudoClass => `:host([focus-ring]) d2l-icon, d2l-icon:${pseudoClass}`)}
|
28
28
|
:host {
|
29
|
-
/* for long numbers, center the number on the icon */
|
30
|
-
--d2l-count-badge-icon-padding: calc(-50% + (var(--d2l-count-badge-icon-height) / 2) + 2px);
|
31
29
|
display: inline-block;
|
32
30
|
/* symmetrical padding to prevent overflows for most numbers */
|
33
31
|
padding-left: 0.5rem;
|
@@ -45,16 +43,6 @@ class CountBadgeIcon extends FocusMixin(CountBadgeMixin(LitElement)) {
|
|
45
43
|
padding-top: var(--d2l-count-badge-icon-padding-top);
|
46
44
|
}
|
47
45
|
|
48
|
-
:host([icon*="tier1:"]) {
|
49
|
-
--d2l-count-badge-icon-height: 18px;
|
50
|
-
}
|
51
|
-
:host([icon*="tier2:"]) {
|
52
|
-
--d2l-count-badge-icon-height: 24px;
|
53
|
-
}
|
54
|
-
:host([icon*="tier3:"]) {
|
55
|
-
--d2l-count-badge-icon-height: 30px;
|
56
|
-
}
|
57
|
-
|
58
46
|
d2l-tooltip[_open-dir="top"] {
|
59
47
|
margin-top: calc(0px - var(--d2l-count-badge-icon-padding-top));
|
60
48
|
}
|
@@ -87,17 +75,16 @@ class CountBadgeIcon extends FocusMixin(CountBadgeMixin(LitElement)) {
|
|
87
75
|
const centerNumber = this.getNumberString().length >= 4;
|
88
76
|
|
89
77
|
if (centerNumber) {
|
90
|
-
|
78
|
+
// left 50% + translateX(-50%) will center for both LTR and RTL
|
91
79
|
numberStyles = {
|
92
80
|
... numberStyles,
|
93
|
-
|
94
|
-
|
95
|
-
: `translateY(-50%) translateX(${xPadding})`
|
81
|
+
left: '50%',
|
82
|
+
transform: 'translate(-50%, -50%)'
|
96
83
|
};
|
97
84
|
} else {
|
98
85
|
numberStyles = {
|
99
86
|
... numberStyles,
|
100
|
-
|
87
|
+
insetInlineEnd: '-0.1rem',
|
101
88
|
transform: 'translateY(-50%)'
|
102
89
|
};
|
103
90
|
}
|
@@ -5,13 +5,12 @@ import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
|
|
5
5
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
6
6
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
7
7
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
8
|
-
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
9
8
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
10
9
|
import { styleMap } from 'lit/directives/style-map.js';
|
11
10
|
|
12
11
|
const maxBadgeDigits = 5;
|
13
12
|
|
14
|
-
export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(SkeletonMixin(
|
13
|
+
export const CountBadgeMixin = superclass => class extends LocalizeCoreElement(SkeletonMixin(superclass)) {
|
15
14
|
|
16
15
|
static get properties() {
|
17
16
|
return {
|
@@ -10,7 +10,6 @@ import { labelStyles } from '../typography/styles.js';
|
|
10
10
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
11
11
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
12
12
|
import { PageableSubscriberMixin } from './pageable-subscriber-mixin.js';
|
13
|
-
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
14
13
|
|
15
14
|
const nativeFocus = document.createElement('div').focus;
|
16
15
|
|
@@ -19,7 +18,7 @@ const nativeFocus = document.createElement('div').focus;
|
|
19
18
|
* @fires d2l-pager-load-more - Dispatched when the user clicks the load-more button. Consumers must call the provided "complete" method once items have been loaded.
|
20
19
|
* @fires d2l-pager-load-more-loaded - Dispatched after more items have been loaded.
|
21
20
|
*/
|
22
|
-
class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(
|
21
|
+
class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(LitElement))) {
|
23
22
|
|
24
23
|
static get properties() {
|
25
24
|
return {
|
@@ -3,11 +3,14 @@ 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
5
|
import { getComposedParent } from '../../helpers/dom.js';
|
6
|
+
import { getFlag } from '../../helpers/flags.js';
|
6
7
|
import { PageableMixin } from '../paging/pageable-mixin.js';
|
7
8
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
8
9
|
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
9
10
|
import { SelectionMixin } from '../selection/selection-mixin.js';
|
10
11
|
|
12
|
+
const colSyncFix = getFlag('GAUD-8228-8186-improved-table-col-sync', true);
|
13
|
+
|
11
14
|
export const tableStyles = css`
|
12
15
|
.d2l-table {
|
13
16
|
border-collapse: separate; /* needed to override reset stylesheets */
|
@@ -248,8 +251,22 @@ export const tableStyles = css`
|
|
248
251
|
}
|
249
252
|
|
250
253
|
/* sticky + scroll-wrapper */
|
251
|
-
|
252
|
-
|
254
|
+
${colSyncFix ? css`
|
255
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper]:not([_no-scroll-width]) .d2l-table {
|
256
|
+
display: flex;
|
257
|
+
flex-direction: column;
|
258
|
+
}
|
259
|
+
|
260
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper][_no-scroll-width] .d2l-table > thead {
|
261
|
+
display: table-header-group;
|
262
|
+
}
|
263
|
+
|
264
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper][_no-scroll-width] .d2l-table > tbody {
|
265
|
+
display: table-row-group;
|
266
|
+
}` : css`
|
267
|
+
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper] .d2l-table {
|
268
|
+
display: block;
|
269
|
+
}`
|
253
270
|
}
|
254
271
|
|
255
272
|
d2l-table-wrapper[sticky-headers][sticky-headers-scroll-wrapper] .d2l-table > thead {
|
@@ -318,7 +335,12 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
318
335
|
reflect: true,
|
319
336
|
type: String
|
320
337
|
},
|
321
|
-
_controlsScrolled: { state: true }
|
338
|
+
_controlsScrolled: { state: true },
|
339
|
+
_noScrollWidth: {
|
340
|
+
attribute: '_no-scroll-width',
|
341
|
+
reflect: true,
|
342
|
+
type: Boolean,
|
343
|
+
},
|
322
344
|
};
|
323
345
|
}
|
324
346
|
|
@@ -383,6 +405,7 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
383
405
|
this._controlsMutationObserver = null;
|
384
406
|
this._controlsScrolled = false;
|
385
407
|
this._controlsScrolledMutationObserver = null;
|
408
|
+
this._noScrollWidth = colSyncFix;
|
386
409
|
this._table = null;
|
387
410
|
this._tableIntersectionObserver = null;
|
388
411
|
this._tableMutationObserver = null;
|
@@ -582,13 +605,16 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
582
605
|
this._tableIntersectionObserver.observe(this._table);
|
583
606
|
}
|
584
607
|
|
585
|
-
if (!this._tableResizeObserver) this._tableResizeObserver = new ResizeObserver(
|
608
|
+
if (!this._tableResizeObserver) this._tableResizeObserver = new ResizeObserver(entries => this._syncColumnWidths(entries));
|
586
609
|
this._tableResizeObserver.observe(this._table);
|
610
|
+
colSyncFix && this.querySelectorAll('tr:first-child *').forEach(el => this._tableResizeObserver.observe(el));
|
587
611
|
|
588
612
|
this._handleTableChange();
|
589
613
|
}
|
590
614
|
|
591
615
|
async _handleTableChange(mutationRecords) {
|
616
|
+
const updateList = [];
|
617
|
+
|
592
618
|
const updates = { count: true, classNames: true, sticky: true, syncWidths: true };
|
593
619
|
if (mutationRecords) {
|
594
620
|
for (const key in updates) updates[key] = false;
|
@@ -601,6 +627,8 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
601
627
|
updates.sticky ||= target.matches(SELECTORS.headers);
|
602
628
|
const affectedNodes = [...removedNodes, ...addedNodes];
|
603
629
|
for (const node of affectedNodes) {
|
630
|
+
updateList.push(target, ...addedNodes);
|
631
|
+
|
604
632
|
if (!(node instanceof Element)) continue;
|
605
633
|
updates.classNames ||= node.matches('tr, td, th');
|
606
634
|
updates.syncWidths ||= node.matches('tr');
|
@@ -614,6 +642,7 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
614
642
|
|
615
643
|
if (updates.count) this._updateItemShowingCount();
|
616
644
|
if (updates.classNames) this._applyClassNames();
|
645
|
+
colSyncFix && await Promise.all([...updateList, ...this.querySelectorAll('d2l-table-col-sort-button')].map(n => n.updateComplete));
|
617
646
|
if (updates.syncWidths) this._syncColumnWidths();
|
618
647
|
if (updates.sticky) this._updateStickyTops();
|
619
648
|
}
|
@@ -628,11 +657,14 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
628
657
|
}
|
629
658
|
|
630
659
|
_syncColumnWidths() {
|
631
|
-
if (!this._table || !this.stickyHeaders || !this.stickyHeadersScrollWrapper) return;
|
632
|
-
|
633
660
|
const head = this._table.querySelector('thead');
|
634
661
|
const body = this._table.querySelector('tbody');
|
635
|
-
|
662
|
+
|
663
|
+
if (colSyncFix) {
|
664
|
+
const maxScrollWidth = Math.max(head?.scrollWidth, body?.scrollWidth);
|
665
|
+
this._noScrollWidth = this.clientWidth === maxScrollWidth;
|
666
|
+
}
|
667
|
+
if (!head || !body || !this._table || !this.stickyHeaders || !this.stickyHeadersScrollWrapper || this._noScrollWidth) return;
|
636
668
|
|
637
669
|
const candidateRowHeadCells = [];
|
638
670
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.153.
|
3
|
+
"version": "3.153.2",
|
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",
|