@brightspace-ui/core 1.230.4 → 1.231.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/dropdown/dropdown-content-mixin.js +28 -0
- package/components/filter/demo/filter.html +14 -1
- package/components/filter/filter.js +17 -3
- package/components/inputs/docs/input-search.md +1 -1
- package/components/list/demo/list.html +16 -9
- package/components/overflow-group/overflow-group.js +12 -4
- package/components/selection/README.md +33 -1
- package/components/selection/demo/selection.html +4 -4
- package/components/selection/selection-action-dropdown.js +56 -0
- package/components/selection/selection-action-menu-item.js +12 -2
- package/components/selection/selection-action.js +2 -5
- package/components/table/README.md +9 -9
- package/custom-elements.json +105 -1
- package/package.json +1 -1
- package/templates/primary-secondary/primary-secondary.js +0 -2
|
@@ -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() {
|
|
@@ -80,7 +80,7 @@ search.addEventListener('d2l-input-search-searched', (e) => {
|
|
|
80
80
|
When the input is cleared, the same event will be fired with an empty value.
|
|
81
81
|
<!-- docs: end hidden content -->
|
|
82
82
|
|
|
83
|
-
### Accessibility
|
|
83
|
+
### Accessibility Properties
|
|
84
84
|
|
|
85
85
|
To make your usage of `d2l-input-search` accessible, use the following property when applicable:
|
|
86
86
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import '../../menu/menu.js';
|
|
14
14
|
import '../../menu/menu-item.js';
|
|
15
15
|
import '../../selection/selection-action.js';
|
|
16
|
+
import '../../selection/selection-action-dropdown.js';
|
|
16
17
|
import '../../selection/selection-action-menu-item.js';
|
|
17
18
|
import '../../tooltip/tooltip.js';
|
|
18
19
|
import '../list-header.js';
|
|
19
|
-
import '../list-item-button.js';
|
|
20
20
|
import '../list-item-content.js';
|
|
21
21
|
import '../list-item.js';
|
|
22
22
|
import '../list.js';
|
|
@@ -69,7 +69,20 @@
|
|
|
69
69
|
<d2l-list id="allFeatures" item-count="50">
|
|
70
70
|
<d2l-list-header slot="header" select-all-pages-allowed>
|
|
71
71
|
<d2l-selection-action icon="tier1:plus-default" text="Add"></d2l-selection-action>
|
|
72
|
-
<d2l-selection-action
|
|
72
|
+
<d2l-selection-action-dropdown text="Move To" requires-selection>
|
|
73
|
+
<d2l-dropdown-menu>
|
|
74
|
+
<d2l-menu label="Move To Options">
|
|
75
|
+
<d2l-menu-item text="Top of Quiz"></d2l-menu-item>
|
|
76
|
+
<d2l-menu-item text="Bottom of Quiz"></d2l-menu-item>
|
|
77
|
+
<d2l-menu-item text="Section">
|
|
78
|
+
<d2l-menu>
|
|
79
|
+
<d2l-menu-item text="Option 1"></d2l-menu-item>
|
|
80
|
+
<d2l-menu-item text="Option 2"></d2l-menu-item>
|
|
81
|
+
</d2l-menu-item>
|
|
82
|
+
</d2l-menu-item>
|
|
83
|
+
</d2l-menu>
|
|
84
|
+
</d2l-dropdown-menu>
|
|
85
|
+
</d2l-selection-action-dropdown>
|
|
73
86
|
<d2l-dropdown-button-subtle text="Actions">
|
|
74
87
|
<d2l-dropdown-menu>
|
|
75
88
|
<d2l-menu label="Actions">
|
|
@@ -78,7 +91,7 @@
|
|
|
78
91
|
</d2l-menu>
|
|
79
92
|
</d2l-dropdown-menu>
|
|
80
93
|
</d2l-dropdown-button-subtle>
|
|
81
|
-
<d2l-selection-action icon="tier1:gear" text="Settings"></d2l-selection-action>
|
|
94
|
+
<d2l-selection-action icon="tier1:gear" text="Settings" requires-selection></d2l-selection-action>
|
|
82
95
|
</d2l-list-header>
|
|
83
96
|
<d2l-list-item href="http://www.d2l.com" selectable key="1" label="Introductory Earth Sciences">
|
|
84
97
|
<img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg"></img>
|
|
@@ -226,11 +239,5 @@
|
|
|
226
239
|
|
|
227
240
|
</d2l-demo-page>
|
|
228
241
|
|
|
229
|
-
<script>
|
|
230
|
-
document.body.addEventListener('d2l-list-item-button-click', (e) => {
|
|
231
|
-
console.log('d2l-list-item-button clicked!', e);
|
|
232
|
-
});
|
|
233
|
-
</script>
|
|
234
|
-
|
|
235
242
|
</body>
|
|
236
243
|
</html>
|
|
@@ -32,7 +32,7 @@ const OPENER_STYLE = {
|
|
|
32
32
|
|
|
33
33
|
function createMenuItem(node) {
|
|
34
34
|
const childText = node.text || node.firstChild && (node.firstChild.label || node.firstChild.text || node.firstChild.textContent.trim());
|
|
35
|
-
const disabled = node.disabled;
|
|
35
|
+
const disabled = !!node.disabled;
|
|
36
36
|
const handleItemSelect = () => {
|
|
37
37
|
node.dispatchEvent(new CustomEvent('d2l-button-ghost-click'));
|
|
38
38
|
node.click();
|
|
@@ -67,11 +67,14 @@ function createMenuItemMenu(node) {
|
|
|
67
67
|
|| node.querySelector('d2l-dropdown-button-subtle');
|
|
68
68
|
|
|
69
69
|
const openerText = node.text || menuOpener.text;
|
|
70
|
+
const disabled = !!node.disabled;
|
|
70
71
|
const subMenu = node.querySelector('d2l-menu');
|
|
71
72
|
|
|
72
73
|
const subItems = Array.from(subMenu.children).map((node) => convertToDropdownItem(node));
|
|
73
74
|
|
|
74
|
-
return html`<d2l-menu-item
|
|
75
|
+
return html`<d2l-menu-item
|
|
76
|
+
?disabled=${disabled}
|
|
77
|
+
text="${openerText}">
|
|
75
78
|
<d2l-menu>
|
|
76
79
|
${subItems}
|
|
77
80
|
</d2l-menu>
|
|
@@ -96,6 +99,7 @@ function convertToDropdownItem(node) {
|
|
|
96
99
|
case 'd2l-dropdown-button-subtle':
|
|
97
100
|
case 'd2l-dropdown-context-menu':
|
|
98
101
|
case 'd2l-dropdown-more':
|
|
102
|
+
case 'd2l-selection-action-dropdown':
|
|
99
103
|
return createMenuItemMenu(node);
|
|
100
104
|
case 'd2l-menu-item':
|
|
101
105
|
case 'd2l-selection-action-menu-item':
|
|
@@ -199,7 +203,9 @@ class OverflowGroup extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
199
203
|
.d2l-overflow-group-container ::slotted(d2l-dropdown-button),
|
|
200
204
|
.d2l-overflow-group-container ::slotted(d2l-dropdown-button-subtle),
|
|
201
205
|
.d2l-overflow-group-container ::slotted(d2l-dropdown-more),
|
|
202
|
-
.d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu)
|
|
206
|
+
.d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu),
|
|
207
|
+
.d2l-overflow-group-container ::slotted(d2l-selection-action),
|
|
208
|
+
.d2l-overflow-group-container ::slotted(d2l-selection-action-dropdown) {
|
|
203
209
|
margin-right: 0.6rem;
|
|
204
210
|
}
|
|
205
211
|
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-button),
|
|
@@ -210,7 +216,9 @@ class OverflowGroup extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
210
216
|
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-button),
|
|
211
217
|
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-button-subtle),
|
|
212
218
|
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-more),
|
|
213
|
-
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu)
|
|
219
|
+
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu),
|
|
220
|
+
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-selection-action),
|
|
221
|
+
:host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-selection-action-dropdown) {
|
|
214
222
|
margin-left: 0.6rem;
|
|
215
223
|
margin-right: 0;
|
|
216
224
|
}
|
|
@@ -148,9 +148,41 @@ The `d2l-selection-action` is an optional component that provides a button for a
|
|
|
148
148
|
| `d2l-selection-action-click` | Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected. |
|
|
149
149
|
<!-- docs: end hidden content -->
|
|
150
150
|
|
|
151
|
+
## Selection Action Dropdown [d2l-selection-action-dropdown]
|
|
152
|
+
|
|
153
|
+
The `d2l-selection-action-dropdown` is an optional component that provides a button opener for dropdown content associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the opener should be non-interactive if nothing is selected.
|
|
154
|
+
|
|
155
|
+
<!-- docs: demo live name:d2l-selection-action-dropdown -->
|
|
156
|
+
```html
|
|
157
|
+
<script type="module">
|
|
158
|
+
import '@brightspace-ui/core/components/dropdown/dropdown-menu.js';
|
|
159
|
+
import '@brightspace-ui/core/components/menu/menu.js';
|
|
160
|
+
import '@brightspace-ui/core/components/menu/menu-item.js';
|
|
161
|
+
import '@brightspace-ui/core/components/selection/selection-action-dropdown.js';
|
|
162
|
+
</script>
|
|
163
|
+
<d2l-selection-action-dropdown text="Actions" requires-selection>
|
|
164
|
+
<d2l-dropdown-menu>
|
|
165
|
+
<d2l-menu label="Actions">
|
|
166
|
+
<d2l-menu-item text="Action 1"></d2l-menu-item>
|
|
167
|
+
<d2l-menu-item text="Action 2"></d2l-menu-item>
|
|
168
|
+
</d2l-menu>
|
|
169
|
+
</d2l-dropdown-menu>
|
|
170
|
+
</d2l-selection-action-dropdown>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
<!-- docs: start hidden content -->
|
|
174
|
+
### Properties
|
|
175
|
+
|
|
176
|
+
| Property | Type | Description |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `requires-selection` | Boolean | Whether the action dropdown opener requires one or more selected items. If no items are selected, the opener will be focusable and a hint displayed in a tooltip. |
|
|
179
|
+
| `selection-for` | String | Id of the corresponding `SelectionMixin` component, if not placed within it. |
|
|
180
|
+
| `text` | String, required | Text for the dropdown opener button. |
|
|
181
|
+
<!-- docs: end hidden content -->
|
|
182
|
+
|
|
151
183
|
## Selection Action Menu Item [d2l-selection-action-menu-item]
|
|
152
184
|
|
|
153
|
-
The `d2l-selection-action-menu-item` is an optional component that is a menu item for actions associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the
|
|
185
|
+
The `d2l-selection-action-menu-item` is an optional component that is a menu item for actions associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the menu item should be non-interactive if nothing is selected. This component enables the app to define an opener that is enabled regardless of the selection state, while having a menu containing one or more menu items that `requires-selection`.
|
|
154
186
|
|
|
155
187
|
<!-- docs: demo live name:d2l-selection-action-menu-item -->
|
|
156
188
|
```html
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<link rel="stylesheet" href="../../demo/styles.css" type="text/css">
|
|
7
7
|
<script type="module">
|
|
8
8
|
import '../../demo/demo-page.js';
|
|
9
|
-
import '../../dropdown/dropdown-button-subtle.js';
|
|
10
9
|
import '../../dropdown/dropdown-menu.js';
|
|
11
10
|
import '../../menu/menu.js';
|
|
12
11
|
import '../selection-action.js';
|
|
12
|
+
import '../selection-action-dropdown.js';
|
|
13
13
|
import '../selection-action-menu-item.js';
|
|
14
14
|
import '../selection-input.js';
|
|
15
15
|
import '../selection-select-all.js';
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
<d2l-selection-select-all></d2l-selection-select-all>
|
|
62
62
|
<d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
|
|
63
63
|
<d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
|
|
64
|
-
<d2l-
|
|
64
|
+
<d2l-selection-action-dropdown text="Actions 1" requires-selection>
|
|
65
65
|
<d2l-dropdown-menu>
|
|
66
66
|
<d2l-menu label="Actions">
|
|
67
|
-
<d2l-selection-action-menu-item text="Action 1
|
|
67
|
+
<d2l-selection-action-menu-item text="Action 1"></d2l-selection-action-menu-item>
|
|
68
68
|
<d2l-selection-action-menu-item text="Action 2"></d2l-selection-action-menu-item>
|
|
69
69
|
</d2l-menu>
|
|
70
70
|
</d2l-dropdown-menu>
|
|
71
|
-
</d2l-
|
|
71
|
+
</d2l-selection-action-dropdown>
|
|
72
72
|
</div>
|
|
73
73
|
<d2l-selection-summary style="flex: none;"></d2l-selection-summary>
|
|
74
74
|
</div>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import '../button/button-subtle.js';
|
|
2
|
+
import { html, LitElement } from 'lit-element/lit-element.js';
|
|
3
|
+
import { DropdownOpenerMixin } from '../dropdown/dropdown-opener-mixin.js';
|
|
4
|
+
import { dropdownOpenerStyles } from '../dropdown/dropdown-opener-styles.js';
|
|
5
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
6
|
+
import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
|
|
7
|
+
import { SelectionActionMixin } from './selection-action-mixin.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A dropdown opener associated with a selection component.
|
|
11
|
+
* @slot - Dropdown content (e.g., "d2l-dropdown-content", "d2l-dropdown-menu" or "d2l-dropdown-tabs")
|
|
12
|
+
* @fires d2l-selection-observer-subscribe - Internal event
|
|
13
|
+
*/
|
|
14
|
+
class ActionDropdown extends LocalizeCoreElement(SelectionActionMixin(DropdownOpenerMixin(LitElement))) {
|
|
15
|
+
|
|
16
|
+
static get properties() {
|
|
17
|
+
return {
|
|
18
|
+
/**
|
|
19
|
+
* REQUIRED: Text for the dropdown opener button
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
text: { type: String }
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static get styles() {
|
|
27
|
+
return dropdownOpenerStyles;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
render() {
|
|
31
|
+
return html`
|
|
32
|
+
<d2l-button-subtle
|
|
33
|
+
?disabled=${this.disabled}
|
|
34
|
+
disabled-tooltip="${ifDefined(this.disabled ? this.localize('components.selection.action-hint') : undefined)}"
|
|
35
|
+
icon="tier1:chevron-down"
|
|
36
|
+
icon-right
|
|
37
|
+
text=${this.text}></d2l-button-subtle>
|
|
38
|
+
<slot></slot>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
focus() {
|
|
43
|
+
const elem = this.shadowRoot && this.shadowRoot.querySelector('d2l-button-subtle');
|
|
44
|
+
if (elem) elem.focus();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Gets the opener element with class "d2l-dropdown-opener" (required by dropdown-opener-mixin).
|
|
49
|
+
* @return {HTMLElement}
|
|
50
|
+
*/
|
|
51
|
+
getOpenerElement() {
|
|
52
|
+
return this.shadowRoot && this.shadowRoot.querySelector('d2l-button-subtle');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
customElements.define('d2l-selection-action-dropdown', ActionDropdown);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '../icons/icon.js';
|
|
1
2
|
import { css, html, LitElement } from 'lit-element/lit-element.js';
|
|
2
3
|
import { MenuItemMixin } from '../menu/menu-item-mixin.js';
|
|
3
4
|
import { menuItemStyles } from '../menu/menu-item-styles.js';
|
|
@@ -10,7 +11,7 @@ import { SelectionInfo } from './selection-mixin.js';
|
|
|
10
11
|
* @fires d2l-selection-action-click - Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected.
|
|
11
12
|
* @fires d2l-selection-observer-subscribe - Internal event
|
|
12
13
|
*/
|
|
13
|
-
class
|
|
14
|
+
class ActionMenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
|
|
14
15
|
|
|
15
16
|
static get styles() {
|
|
16
17
|
return [ menuItemStyles,
|
|
@@ -20,6 +21,10 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
|
|
|
20
21
|
display: flex;
|
|
21
22
|
padding: 0.75rem 1rem;
|
|
22
23
|
}
|
|
24
|
+
d2l-icon {
|
|
25
|
+
flex: none;
|
|
26
|
+
margin-left: 6px;
|
|
27
|
+
}
|
|
23
28
|
:host([dir="rtl"]) d2l-icon {
|
|
24
29
|
margin-left: 0;
|
|
25
30
|
margin-right: 6px;
|
|
@@ -39,9 +44,14 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
|
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
render() {
|
|
47
|
+
const icon = this.hasChildView ?
|
|
48
|
+
html`<d2l-icon icon="tier1:chevron-right"></d2l-icon>` : null;
|
|
49
|
+
|
|
42
50
|
return html`
|
|
43
51
|
<div class="d2l-menu-item-text">${this.text}</div>
|
|
44
52
|
<div class="d2l-menu-item-supporting"><slot name="supporting"></slot></div>
|
|
53
|
+
${icon}
|
|
54
|
+
<slot></slot>
|
|
45
55
|
`;
|
|
46
56
|
}
|
|
47
57
|
|
|
@@ -58,4 +68,4 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
|
|
|
58
68
|
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
customElements.define('d2l-selection-action-menu-item',
|
|
71
|
+
customElements.define('d2l-selection-action-menu-item', ActionMenuItem);
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import '../button/button-subtle.js';
|
|
2
|
-
import '../icons/icon.js';
|
|
3
|
-
import '../tooltip/tooltip.js';
|
|
4
2
|
import { css, html, LitElement } from 'lit-element/lit-element.js';
|
|
5
3
|
import { ButtonMixin } from '../button/button-mixin.js';
|
|
6
4
|
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
7
5
|
import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
|
|
8
|
-
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
9
6
|
import { SelectionActionMixin } from './selection-action-mixin.js';
|
|
10
7
|
import { SelectionInfo } from './selection-mixin.js';
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
10
|
+
* A button action associated with a selection component.
|
|
14
11
|
* @fires d2l-selection-action-click - Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected.
|
|
15
12
|
* @fires d2l-selection-observer-subscribe - Internal event
|
|
16
13
|
*/
|
|
17
|
-
class Action extends LocalizeCoreElement(SelectionActionMixin(ButtonMixin(
|
|
14
|
+
class Action extends LocalizeCoreElement(SelectionActionMixin(ButtonMixin(LitElement))) {
|
|
18
15
|
|
|
19
16
|
static get properties() {
|
|
20
17
|
return {
|
|
@@ -114,11 +114,11 @@ The `d2l-table-wrapper` element can be combined with table styles to apply defau
|
|
|
114
114
|
<!-- docs: start hidden content -->
|
|
115
115
|
### Properties
|
|
116
116
|
|
|
117
|
-
| Property | Type | Description |
|
|
118
|
-
|
|
119
|
-
| `no-column-border` |
|
|
120
|
-
| `sticky-headers` |
|
|
121
|
-
| `type` |
|
|
117
|
+
| Property | Type | Description | Default Value |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| `no-column-border` | boolean | Hides the column borders on "default" table type | false |
|
|
120
|
+
| `sticky-headers` | boolean | Whether to make the header row sticky | false |
|
|
121
|
+
| `type` | string | Type of the table style. Can be one of `default`, `light`. | 'default' |
|
|
122
122
|
|
|
123
123
|
## Light Type
|
|
124
124
|
|
|
@@ -241,10 +241,10 @@ When tabular data can be sorted, the `<d2l-table-col-sort-button>` can be used t
|
|
|
241
241
|
|
|
242
242
|
### Properties
|
|
243
243
|
|
|
244
|
-
| Property | Type | Description |
|
|
245
|
-
|
|
246
|
-
| `desc` |
|
|
247
|
-
| `nosort` |
|
|
244
|
+
| Property | Type | Description | Default Value |
|
|
245
|
+
|---|---|---|---|
|
|
246
|
+
| `desc` | boolean | Whether sort direction is descending | false |
|
|
247
|
+
| `nosort` | boolean | Column is not currently sorted. Hides the ascending/descending sort icon. | false |
|
|
248
248
|
|
|
249
249
|
## Selection
|
|
250
250
|
|
package/custom-elements.json
CHANGED
|
@@ -8445,6 +8445,110 @@
|
|
|
8445
8445
|
}
|
|
8446
8446
|
]
|
|
8447
8447
|
},
|
|
8448
|
+
{
|
|
8449
|
+
"name": "d2l-selection-action-dropdown",
|
|
8450
|
+
"path": "./components/selection/selection-action-dropdown.js",
|
|
8451
|
+
"description": "A dropdown opener associated with a selection component.",
|
|
8452
|
+
"attributes": [
|
|
8453
|
+
{
|
|
8454
|
+
"name": "text",
|
|
8455
|
+
"description": "REQUIRED: Text for the dropdown opener button",
|
|
8456
|
+
"type": "string"
|
|
8457
|
+
},
|
|
8458
|
+
{
|
|
8459
|
+
"name": "requires-selection",
|
|
8460
|
+
"description": "Whether the action requires one or more selected items",
|
|
8461
|
+
"type": "boolean",
|
|
8462
|
+
"default": "false"
|
|
8463
|
+
},
|
|
8464
|
+
{
|
|
8465
|
+
"name": "selection-for",
|
|
8466
|
+
"description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
|
|
8467
|
+
"type": "string"
|
|
8468
|
+
},
|
|
8469
|
+
{
|
|
8470
|
+
"name": "no-auto-open",
|
|
8471
|
+
"description": "Prevents the dropdown from opening automatically on or on key press",
|
|
8472
|
+
"type": "boolean",
|
|
8473
|
+
"default": "false"
|
|
8474
|
+
},
|
|
8475
|
+
{
|
|
8476
|
+
"name": "open-on-hover",
|
|
8477
|
+
"description": "Optionally open dropdown on click or hover action",
|
|
8478
|
+
"type": "boolean",
|
|
8479
|
+
"default": "false"
|
|
8480
|
+
},
|
|
8481
|
+
{
|
|
8482
|
+
"name": "disabled",
|
|
8483
|
+
"description": "Disables the dropdown opener",
|
|
8484
|
+
"type": "boolean",
|
|
8485
|
+
"default": "false"
|
|
8486
|
+
}
|
|
8487
|
+
],
|
|
8488
|
+
"properties": [
|
|
8489
|
+
{
|
|
8490
|
+
"name": "text",
|
|
8491
|
+
"attribute": "text",
|
|
8492
|
+
"description": "REQUIRED: Text for the dropdown opener button",
|
|
8493
|
+
"type": "string"
|
|
8494
|
+
},
|
|
8495
|
+
{
|
|
8496
|
+
"name": "requiresSelection",
|
|
8497
|
+
"attribute": "requires-selection",
|
|
8498
|
+
"description": "Whether the action requires one or more selected items",
|
|
8499
|
+
"type": "boolean",
|
|
8500
|
+
"default": "false"
|
|
8501
|
+
},
|
|
8502
|
+
{
|
|
8503
|
+
"name": "selectionFor",
|
|
8504
|
+
"attribute": "selection-for",
|
|
8505
|
+
"description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
|
|
8506
|
+
"type": "string"
|
|
8507
|
+
},
|
|
8508
|
+
{
|
|
8509
|
+
"name": "selectionInfo",
|
|
8510
|
+
"type": "SelectionInfo"
|
|
8511
|
+
},
|
|
8512
|
+
{
|
|
8513
|
+
"name": "dropdownOpener",
|
|
8514
|
+
"type": "boolean",
|
|
8515
|
+
"default": "true"
|
|
8516
|
+
},
|
|
8517
|
+
{
|
|
8518
|
+
"name": "noAutoOpen",
|
|
8519
|
+
"attribute": "no-auto-open",
|
|
8520
|
+
"description": "Prevents the dropdown from opening automatically on or on key press",
|
|
8521
|
+
"type": "boolean",
|
|
8522
|
+
"default": "false"
|
|
8523
|
+
},
|
|
8524
|
+
{
|
|
8525
|
+
"name": "openOnHover",
|
|
8526
|
+
"attribute": "open-on-hover",
|
|
8527
|
+
"description": "Optionally open dropdown on click or hover action",
|
|
8528
|
+
"type": "boolean",
|
|
8529
|
+
"default": "false"
|
|
8530
|
+
},
|
|
8531
|
+
{
|
|
8532
|
+
"name": "disabled",
|
|
8533
|
+
"attribute": "disabled",
|
|
8534
|
+
"description": "Disables the dropdown opener",
|
|
8535
|
+
"type": "boolean",
|
|
8536
|
+
"default": "false"
|
|
8537
|
+
}
|
|
8538
|
+
],
|
|
8539
|
+
"events": [
|
|
8540
|
+
{
|
|
8541
|
+
"name": "d2l-selection-observer-subscribe",
|
|
8542
|
+
"description": "Internal event"
|
|
8543
|
+
}
|
|
8544
|
+
],
|
|
8545
|
+
"slots": [
|
|
8546
|
+
{
|
|
8547
|
+
"name": "",
|
|
8548
|
+
"description": "Dropdown content (e.g., \"d2l-dropdown-content\", \"d2l-dropdown-menu\" or \"d2l-dropdown-tabs\")"
|
|
8549
|
+
}
|
|
8550
|
+
]
|
|
8551
|
+
},
|
|
8448
8552
|
{
|
|
8449
8553
|
"name": "d2l-selection-action-menu-item",
|
|
8450
8554
|
"path": "./components/selection/selection-action-menu-item.js",
|
|
@@ -8544,7 +8648,7 @@
|
|
|
8544
8648
|
{
|
|
8545
8649
|
"name": "d2l-selection-action",
|
|
8546
8650
|
"path": "./components/selection/selection-action.js",
|
|
8547
|
-
"description": "
|
|
8651
|
+
"description": "A button action associated with a selection component.",
|
|
8548
8652
|
"attributes": [
|
|
8549
8653
|
{
|
|
8550
8654
|
"name": "icon",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.231.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",
|
|
@@ -542,7 +542,6 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
|
|
|
542
542
|
|
|
543
543
|
main {
|
|
544
544
|
flex: 2 0 0;
|
|
545
|
-
-webkit-overflow-scrolling: touch;
|
|
546
545
|
overflow-x: hidden;
|
|
547
546
|
transition: none;
|
|
548
547
|
}
|
|
@@ -570,7 +569,6 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
|
|
|
570
569
|
aside {
|
|
571
570
|
height: 100%;
|
|
572
571
|
min-width: ${desktopMinSize}px;
|
|
573
|
-
-webkit-overflow-scrolling: touch;
|
|
574
572
|
overflow-x: hidden;
|
|
575
573
|
overflow-y: scroll;
|
|
576
574
|
}
|