@brightspace-ui/core 3.62.1 → 3.62.3
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/count-badge/demo/count-badge.html +7 -6
- package/components/demo/code-view.js +0 -4
- package/components/demo/demo-snippet.js +7 -10
- package/components/meter/meter-circle.js +2 -1
- package/components/table/demo/table-test.js +37 -20
- package/components/table/table-wrapper.js +3 -4
- package/package.json +1 -1
@@ -27,6 +27,12 @@
|
|
27
27
|
<template>
|
28
28
|
<d2l-count-badge id="badge-announce-changes"size="small" announce-changes tab-stop text=" 1 new notification." type="notification" number="1"></d2l-count-badge>
|
29
29
|
<d2l-button id="increment-count">Increment Count</d2l-button>
|
30
|
+
<script type="module">
|
31
|
+
document.getElementById('increment-count').addEventListener('click', () => {
|
32
|
+
document.getElementById('badge-announce-changes').number += 1;
|
33
|
+
document.getElementById('badge-announce-changes').text = `${document.getElementById('badge-announce-changes').number} new notifications.`;
|
34
|
+
});
|
35
|
+
</script>
|
30
36
|
</template>
|
31
37
|
</d2l-demo-snippet>
|
32
38
|
|
@@ -61,12 +67,7 @@
|
|
61
67
|
<d2l-count-badge size="small" has-tooltip text=" 2 new notifications." type="notification" number="2"></d2l-count-badge>
|
62
68
|
</template>
|
63
69
|
</d2l-demo-snippet>
|
70
|
+
|
64
71
|
</d2l-demo-page>
|
65
|
-
<script type="module">
|
66
|
-
document.getElementById('increment-count').addEventListener('click', () => {
|
67
|
-
document.getElementById('badge-announce-changes').number += 1;
|
68
|
-
document.getElementById('badge-announce-changes').text = `${document.getElementById('badge-announce-changes').number} new notifications.`;
|
69
|
-
});
|
70
|
-
</script>
|
71
72
|
</body>
|
72
73
|
</html>
|
@@ -36,10 +36,6 @@ class CodeView extends LitElement {
|
|
36
36
|
super.attributeChangedCallback(name, oldval, newval);
|
37
37
|
}
|
38
38
|
|
39
|
-
firstUpdated() {
|
40
|
-
this._updateCode(this.shadowRoot.querySelector('slot'));
|
41
|
-
}
|
42
|
-
|
43
39
|
render() {
|
44
40
|
return html`
|
45
41
|
<div class="d2l-code-view-src"><slot @slotchange="${this._handleSlotChange}"></slot></div>
|
@@ -117,10 +117,6 @@ class DemoSnippet extends LitElement {
|
|
117
117
|
this._skeletonOn = false;
|
118
118
|
}
|
119
119
|
|
120
|
-
firstUpdated() {
|
121
|
-
this._updateCode(this.shadowRoot.querySelector('slot:not([name="_demo"])'));
|
122
|
-
}
|
123
|
-
|
124
120
|
render() {
|
125
121
|
const skeleton = this._hasSkeleton ? html`<d2l-switch text="Skeleton" ?on="${this._skeletonOn}" @change="${this._handleSkeletonChange}"></d2l-switch>` : null;
|
126
122
|
const switches = html`
|
@@ -137,7 +133,7 @@ class DemoSnippet extends LitElement {
|
|
137
133
|
<div class="d2l-demo-snippet-demo">
|
138
134
|
<div class="d2l-demo-snippet-demo-padding">
|
139
135
|
<slot name="_demo"></slot>
|
140
|
-
<slot></slot>
|
136
|
+
<slot @slotchange="${this._handleSlotChange}"></slot>
|
141
137
|
</div>
|
142
138
|
</div>
|
143
139
|
${settings}
|
@@ -152,15 +148,10 @@ class DemoSnippet extends LitElement {
|
|
152
148
|
changedProperties.forEach((_, prop) => {
|
153
149
|
if (prop === '_code') {
|
154
150
|
if (this.shadowRoot) this.shadowRoot.querySelector('d2l-code-view').forceUpdate();
|
155
|
-
this._updateHasSkeleton();
|
156
151
|
}
|
157
152
|
});
|
158
153
|
}
|
159
154
|
|
160
|
-
forceCodeUpdate() {
|
161
|
-
if (this.shadowRoot) this._updateCode(this.shadowRoot.querySelector('slot:not([name="_demo"])'));
|
162
|
-
}
|
163
|
-
|
164
155
|
_applyAttr(name, value, applyToShadowRoot) {
|
165
156
|
const query = this._isTemplate ? 'slot[name="_demo"]' : 'slot:not([name="_demo"])';
|
166
157
|
if (!this.shadowRoot) return;
|
@@ -239,6 +230,10 @@ class DemoSnippet extends LitElement {
|
|
239
230
|
this._applyAttr('skeleton', this._skeletonOn, false);
|
240
231
|
}
|
241
232
|
|
233
|
+
_handleSlotChange(e) {
|
234
|
+
this._updateCode(e.target);
|
235
|
+
}
|
236
|
+
|
242
237
|
_removeImportedDemo() {
|
243
238
|
if (!this.shadowRoot) return;
|
244
239
|
const nodes = this.shadowRoot.querySelector('slot[name="_demo"]').assignedNodes();
|
@@ -276,6 +271,8 @@ class DemoSnippet extends LitElement {
|
|
276
271
|
}
|
277
272
|
const textNode = document.createTextNode(this._formatCode(tempContainer.innerHTML));
|
278
273
|
this._code = textNode.textContent;
|
274
|
+
|
275
|
+
this._updateHasSkeleton();
|
279
276
|
}
|
280
277
|
|
281
278
|
_updateHasSkeleton() {
|
@@ -23,7 +23,7 @@ class MeterCircle extends MeterMixin(RtlMixin(LitElement)) {
|
|
23
23
|
.d2l-meter-full-bar {
|
24
24
|
fill: var(--d2l-meter-circle-fill, none);
|
25
25
|
}
|
26
|
-
.d2l-meter-text {
|
26
|
+
.d2l-meter-circle-text {
|
27
27
|
font-size: 0.55rem;
|
28
28
|
}
|
29
29
|
` ];
|
@@ -47,6 +47,7 @@ class MeterCircle extends MeterMixin(RtlMixin(LitElement)) {
|
|
47
47
|
const textClasses = {
|
48
48
|
'd2l-meter-text-ltr': !this.percent,
|
49
49
|
'd2l-body-standard': true,
|
50
|
+
'd2l-meter-circle-text': true,
|
50
51
|
'd2l-meter-text': true
|
51
52
|
};
|
52
53
|
|
@@ -22,16 +22,16 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
22
22
|
import { RtlMixin } from '../../../mixins/rtl/rtl-mixin.js';
|
23
23
|
|
24
24
|
const columns = ['Population', 'Size', 'Elevation'];
|
25
|
-
const thText = ['Additional', 'Placeholder', 'Header', 'Row'];
|
25
|
+
const thText = ['Additional', 'Placeholder', 'Header', 'Row', 'Cells'];
|
26
26
|
|
27
27
|
const data = () => [
|
28
|
-
{ name: 'Ottawa, Canada', data: { 'city': 'Ottawa', 'country': 'Canada', 'population': 994837, 'size': 2790, 'elevation': 70 }, selected: true },
|
29
|
-
{ name: 'Toronto, Canada', data: { 'city': 'Toronto', 'country': 'Canada', 'population': 2930000, 'size': 630, 'elevation': 76 }, selected: true },
|
30
|
-
{ name: 'Sydney, Australia', data: { 'city': 'Sydney', 'country': 'Australia', 'population': 5312000, 'size': 12368, 'elevation': 3 }, selected: false },
|
31
|
-
{ name: 'Cairo, Egypt', data: { 'city': 'Cairo', 'country': 'Egypt', 'population': 9540000, 'size': 3085, 'elevation': 23 }, selected: false },
|
32
|
-
{ name: 'Moscow, Russia', data: { 'city': 'Moscow', 'country': 'Russia', 'population': 12712305, 'size': 2511, 'elevation': 124 }, selected: false },
|
33
|
-
{ name: 'London, England', data: { 'city': 'London', 'country': 'England', 'population': 8982000, 'size': 1572, 'elevation': 11 }, selected: false },
|
34
|
-
{ name: 'Tokyo, Japan', data: { 'city': 'Tokyo', 'country': 'Japan', 'population': 13960000, 'size': 2194, 'elevation': 40 }, selected: false }
|
28
|
+
{ name: 'Ottawa, Canada', data: { 'city': 'Ottawa', 'country': 'Canada', 'population': 994837, 'size': 2790, 'elevation': 70, 'latitude': 45.32, 'longitude': -75.71 }, selected: true },
|
29
|
+
{ name: 'Toronto, Canada', data: { 'city': 'Toronto', 'country': 'Canada', 'population': 2930000, 'size': 630, 'elevation': 76, 'latitude': 43.69, 'longitude': -79.41 }, selected: true },
|
30
|
+
{ name: 'Sydney, Australia', data: { 'city': 'Sydney', 'country': 'Australia', 'population': 5312000, 'size': 12368, 'elevation': 3, 'latitude': -33.86, 'longitude': 151.13 }, selected: false },
|
31
|
+
{ name: 'Cairo, Egypt', data: { 'city': 'Cairo', 'country': 'Egypt', 'population': 9540000, 'size': 3085, 'elevation': 23, 'latitude': 30.05, 'longitude': 31.25 }, selected: false },
|
32
|
+
{ name: 'Moscow, Russia', data: { 'city': 'Moscow', 'country': 'Russia', 'population': 12712305, 'size': 2511, 'elevation': 124, 'latitude': 55.70, 'longitude': 35.59 }, selected: false },
|
33
|
+
{ name: 'London, England', data: { 'city': 'London', 'country': 'England', 'population': 8982000, 'size': 1572, 'elevation': 11, 'latitude': 51.49, 'longitude': -0.12 }, selected: false },
|
34
|
+
{ name: 'Tokyo, Japan', data: { 'city': 'Tokyo', 'country': 'Japan', 'population': 13960000, 'size': 2194, 'elevation': 40, 'latitude': 35.68, 'longitude': 139.74 }, selected: false }
|
35
35
|
];
|
36
36
|
|
37
37
|
const formatter = new Intl.NumberFormat('en-US');
|
@@ -104,20 +104,22 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
104
104
|
${this.multiLine ? html`
|
105
105
|
<tr>
|
106
106
|
<th scope="col" sticky><d2l-selection-select-all></d2l-selection-select-all></th>
|
107
|
-
${this._renderDoubleSortButton('
|
108
|
-
<th scope="col" colspan="${columns.length}" sticky>
|
107
|
+
${this._renderDoubleSortButton('City', 'Country')}
|
108
|
+
<th scope="col" colspan="${columns.length + 1}" sticky>
|
109
109
|
Metrics
|
110
110
|
</th>
|
111
111
|
</tr>
|
112
112
|
<tr>
|
113
113
|
<th scope="col" sticky></th>
|
114
114
|
${columns.map(columnHeading => this._renderSortButton(columnHeading))}
|
115
|
+
${this._renderMenuSortButton('Coordinates', ['Latitude', 'Longitude'])}
|
115
116
|
</tr>
|
116
117
|
` : html`
|
117
118
|
<tr>
|
118
119
|
<th scope="col" sticky><d2l-selection-select-all></d2l-selection-select-all></th>
|
119
|
-
${this._renderDoubleSortButton('
|
120
|
+
${this._renderDoubleSortButton('City', 'Country')}
|
120
121
|
${columns.map(columnHeading => this._renderSortButton(columnHeading))}
|
122
|
+
${this._renderMenuSortButton('Coordinates', ['Latitude', 'Longitude'])}
|
121
123
|
</tr>
|
122
124
|
`}
|
123
125
|
</thead>
|
@@ -145,7 +147,8 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
145
147
|
</d2l-selection-input>
|
146
148
|
</th>
|
147
149
|
<th scope="row">${row.name}</th>
|
148
|
-
${columns.map(columnHeading =>
|
150
|
+
${columns.map(columnHeading => { const val = row.data[columnHeading.toLowerCase()]; return val ? html`<td>${formatter.format(val)}</td>` : null; }) }
|
151
|
+
<td>${[formatter.format(row.data.latitude), formatter.format(row.data.longitude)].join(', ')}</td>
|
149
152
|
</tr>
|
150
153
|
`)}
|
151
154
|
</tbody>
|
@@ -162,7 +165,7 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
162
165
|
_handlePagerLoadMore(e) {
|
163
166
|
const startIndex = this._data.length + 1;
|
164
167
|
for (let i = 0; i < e.target.pageSize; i++) {
|
165
|
-
this._data.push({ name: `City ${startIndex + i}, Country ${startIndex + i}`, data: { 'city': `City ${startIndex + i}`, 'country': `Country ${startIndex + i}`, 'population': 26320000, 'size': 6340, 'elevation': 4 }, selected: false });
|
168
|
+
this._data.push({ name: `City ${startIndex + i}, Country ${startIndex + i}`, data: { 'city': `City ${startIndex + i}`, 'country': `Country ${startIndex + i}`, 'population': 26320000, 'size': 6340, 'elevation': 4, 'latitude': 3, 'longitude': 3 }, selected: false });
|
166
169
|
}
|
167
170
|
this.requestUpdate();
|
168
171
|
e.detail.complete();
|
@@ -195,17 +198,31 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
195
198
|
});
|
196
199
|
}
|
197
200
|
|
198
|
-
_renderDoubleSortButton(
|
199
|
-
const noSort = this._sortField?.toLowerCase() !== 'city' && this._sortField?.toLowerCase() !== 'country';
|
201
|
+
_renderDoubleSortButton(item1, item2) {
|
200
202
|
return html`
|
201
203
|
<th rowspan="${this.multiLine ? 2 : 1}" scope="col">
|
204
|
+
<d2l-table-col-sort-button
|
205
|
+
@click="${this._handleSort}"
|
206
|
+
?desc="${this._sortDesc}"
|
207
|
+
?nosort="${this._sortField !== item1.toLowerCase()}">${item1}</d2l-table-col-sort-button>
|
208
|
+
<d2l-table-col-sort-button
|
209
|
+
@click="${this._handleSort}"
|
210
|
+
?desc="${this._sortDesc}"
|
211
|
+
?nosort="${this._sortField !== item2.toLowerCase()}">${item2}</d2l-table-col-sort-button>
|
212
|
+
</th>
|
213
|
+
`;
|
214
|
+
}
|
215
|
+
|
216
|
+
_renderMenuSortButton(name, items) {
|
217
|
+
const noSort = !items.map(i => i.toLowerCase()).includes(this._sortField?.toLowerCase());
|
218
|
+
return html`
|
219
|
+
<th scope="col">
|
202
220
|
<d2l-table-col-sort-button
|
203
221
|
?desc="${this._sortDesc}"
|
204
|
-
?nosort="${noSort}"
|
205
|
-
<
|
206
|
-
<d2l-table-col-sort-button-item slot="items" text="
|
207
|
-
<d2l-table-col-sort-button-item slot="items" text="
|
208
|
-
<d2l-table-col-sort-button-item slot="items" text="Country, Z to A" data-field="country" data-desc @d2l-table-col-sort-button-item-change="${this._handleSortComplex}" value="4"></d2l-table-col-sort-button-item>
|
222
|
+
?nosort="${noSort}">
|
223
|
+
<span>${name}</span>${items.map((item, idx) => html`
|
224
|
+
<d2l-table-col-sort-button-item slot="items" text="${item}, ascending" data-field="${item.toLowerCase()}" @d2l-table-col-sort-button-item-change="${this._handleSortComplex}" value="${idx * 2 + 1}"></d2l-table-col-sort-button-item>
|
225
|
+
<d2l-table-col-sort-button-item slot="items" text="${item}, descending" data-field="${item.toLowerCase()}" data-desc @d2l-table-col-sort-button-item-change="${this._handleSortComplex}" value="${idx * 2 + 2}"></d2l-table-col-sort-button-item>`)}
|
209
226
|
</d2l-table-col-sort-button>
|
210
227
|
</th>
|
211
228
|
`;
|
@@ -111,9 +111,7 @@ export const tableStyles = css`
|
|
111
111
|
.d2l-table th.d2l-table-header-col-sortable-siblings d2l-table-col-sort-button {
|
112
112
|
--d2l-table-col-sort-button-width: unset;
|
113
113
|
}
|
114
|
-
|
115
|
-
padding-inline-end: calc(0.6rem + 18px);
|
116
|
-
}
|
114
|
+
|
117
115
|
@supports selector(:has(a, b)) {
|
118
116
|
.d2l-table > * > tr > th:has(d2l-table-col-sort-button) {
|
119
117
|
height: calc(var(--d2l-table-cell-overall-height) - var(--d2l-table-cell-col-sort-button-size-offset));
|
@@ -129,7 +127,8 @@ export const tableStyles = css`
|
|
129
127
|
.d2l-table th d2l-table-col-sort-button[nosort] ~ :last-child {
|
130
128
|
padding-inline-end: calc(0.6rem + 18px);
|
131
129
|
}
|
132
|
-
.d2l-table th d2l-table-col-sort-button:not([nosort]) ~ :last-child
|
130
|
+
.d2l-table th d2l-table-col-sort-button:not([nosort]) ~ :last-child,
|
131
|
+
.d2l-table th d2l-table-col-sort-button:last-child:not([nosort]) {
|
133
132
|
padding-inline-end: unset;
|
134
133
|
}
|
135
134
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.62.
|
3
|
+
"version": "3.62.3",
|
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",
|