@brightspace-ui/core 2.138.1 → 2.138.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/dialog/demo/dialog-fullscreen.html +3 -0
- package/components/dialog/demo/dialog.html +2 -0
- package/components/dialog/dialog-fullscreen.js +3 -4
- package/components/dialog/dialog-styles.js +2 -0
- package/components/list/demo/demo-list.js +3 -1
- package/components/list/list-controls.js +2 -0
- package/components/paging/README.md +58 -1
- package/components/selection/selection-controls.js +8 -4
- package/custom-elements.json +11 -0
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import '../../filter/filter.js';
|
|
21
21
|
import '../../filter/filter-dimension-set.js';
|
|
22
22
|
import '../../filter/filter-dimension-set-value.js';
|
|
23
|
+
import '../../list/demo/demo-list.js';
|
|
23
24
|
import '../../menu/menu.js';
|
|
24
25
|
import '../../menu/menu-item.js';
|
|
25
26
|
import '../../tabs/tabs.js';
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
51
52
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
52
53
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
54
|
+
<d2l-demo-list></d2l-demo-list>
|
|
53
55
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
54
56
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
55
57
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
@@ -101,6 +103,7 @@
|
|
|
101
103
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
102
104
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
103
105
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
106
|
+
<d2l-demo-list extend-separators></d2l-demo-list>
|
|
104
107
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
105
108
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
106
109
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import '../../filter/filter.js';
|
|
16
16
|
import '../../filter/filter-dimension-set.js';
|
|
17
17
|
import '../../filter/filter-dimension-set-value.js';
|
|
18
|
+
import '../../list/demo/demo-list.js';
|
|
18
19
|
import '../dialog.js';
|
|
19
20
|
import './dialog-async-content.js';
|
|
20
21
|
import './dialog-container.js';
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
<d2l-dialog id="dialog" title-text="Dialog Title">
|
|
37
38
|
<div>
|
|
38
39
|
<p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
|
|
40
|
+
<d2l-demo-list></d2l-demo-list>
|
|
39
41
|
<p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
|
|
40
42
|
<p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
|
|
41
43
|
<d2l-dropdown-button-subtle text="More">
|
|
@@ -59,6 +59,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
:host([no-padding]) .d2l-dialog-content {
|
|
62
|
+
--d2l-list-controls-padding: 0px; /* stylelint-disable-line length-zero-no-unit */
|
|
62
63
|
padding: 0;
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -70,20 +71,18 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
|
|
|
70
71
|
padding-top: 1rem;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
.d2l-dialog-content {
|
|
74
|
-
padding-top: 1rem;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
74
|
.d2l-dialog-content > div {
|
|
78
75
|
/* required to properly calculate preferred height when there are bottom
|
|
79
76
|
margins at the end of the slotted content */
|
|
80
77
|
border-bottom: 1px solid transparent;
|
|
81
78
|
box-sizing: border-box;
|
|
82
79
|
height: calc(100% - 1rem);
|
|
80
|
+
padding-top: 1rem;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
:host([no-padding]) .d2l-dialog-content > div {
|
|
86
84
|
height: 100%;
|
|
85
|
+
padding-top: 0;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
.d2l-dialog-header > div > d2l-button-icon {
|
|
@@ -116,6 +116,7 @@ export const dialogStyles = css`
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
.d2l-dialog-content {
|
|
119
|
+
--d2l-list-controls-padding: 30px;
|
|
119
120
|
box-sizing: border-box;
|
|
120
121
|
flex: 1 0 0;
|
|
121
122
|
overflow: hidden; /* scrollbar is kept hidden while we update the scroll position to avoid scrollbar flash */
|
|
@@ -175,6 +176,7 @@ export const dialogStyles = css`
|
|
|
175
176
|
margin-right: 15px;
|
|
176
177
|
}
|
|
177
178
|
.d2l-dialog-content {
|
|
179
|
+
--d2l-list-controls-padding: 20px;
|
|
178
180
|
padding: 0 20px;
|
|
179
181
|
}
|
|
180
182
|
.d2l-dialog-footer {
|
|
@@ -117,6 +117,7 @@ class DemoList extends LitElement {
|
|
|
117
117
|
static get properties() {
|
|
118
118
|
return {
|
|
119
119
|
grid: { type: Boolean },
|
|
120
|
+
extendSeparators: { type: Boolean, attribute: 'extend-separators' },
|
|
120
121
|
_lastItemLoadedIndex: { state: true }
|
|
121
122
|
};
|
|
122
123
|
}
|
|
@@ -138,6 +139,7 @@ class DemoList extends LitElement {
|
|
|
138
139
|
|
|
139
140
|
constructor() {
|
|
140
141
|
super();
|
|
142
|
+
this.extendSeparators = false;
|
|
141
143
|
this.items = JSON.parse(JSON.stringify(items));
|
|
142
144
|
this._lastItemLoadedIndex = 2;
|
|
143
145
|
this._pageSize = 2;
|
|
@@ -147,7 +149,7 @@ class DemoList extends LitElement {
|
|
|
147
149
|
const loadedItems = this.items.slice(0, this._lastItemLoadedIndex + 1);
|
|
148
150
|
const remainingItemCount = this.items.length - loadedItems.length;
|
|
149
151
|
return html`
|
|
150
|
-
<d2l-list ?grid="${this.grid}" item-count="${this.items.length}">
|
|
152
|
+
<d2l-list ?grid="${this.grid}" item-count="${this.items.length}" ?extend-separators="${this.extendSeparators}">
|
|
151
153
|
<d2l-list-controls slot="controls" select-all-pages-allowed>
|
|
152
154
|
<d2l-selection-action icon="tier1:plus-default" text="Add" @d2l-selection-action-click="${this._handleAddItem}"></d2l-selection-action>
|
|
153
155
|
<d2l-selection-action-dropdown text="Move To" requires-selection>
|
|
@@ -16,6 +16,7 @@ export class ListControls extends SelectionControls {
|
|
|
16
16
|
return [super.styles, css`
|
|
17
17
|
:host {
|
|
18
18
|
--d2l-selection-controls-background-color: var(--d2l-list-controls-background-color);
|
|
19
|
+
--d2l-selection-controls-padding: var(--d2l-list-controls-padding, 18px);
|
|
19
20
|
z-index: 6; /* must be greater than d2l-list-item-active-border */
|
|
20
21
|
}
|
|
21
22
|
:host([no-sticky]) {
|
|
@@ -37,6 +38,7 @@ export class ListControls extends SelectionControls {
|
|
|
37
38
|
|
|
38
39
|
const parent = findComposedAncestor(this.parentNode, node => node && node.tagName === 'D2L-LIST');
|
|
39
40
|
if (parent) this._extendSeparator = parent.hasAttribute('extend-separators');
|
|
41
|
+
if (this._extendSeparator) this.style.setProperty('--d2l-selection-controls-padding', '0px');
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
_getSelectionControlsContainerClasses() {
|
|
@@ -6,8 +6,65 @@ The paging components and mixins can be used to provide consistent paging functi
|
|
|
6
6
|
```html
|
|
7
7
|
<script type="module">
|
|
8
8
|
import '@brightspace-ui/core/components/paging/pager-load-more.js';
|
|
9
|
+
import { html, LitElement } from 'lit';
|
|
10
|
+
import { PageableMixin } from '@brightspace-ui/core/components/paging/pageable-mixin.js';
|
|
11
|
+
|
|
12
|
+
class PageableExample extends PageableMixin(LitElement) {
|
|
13
|
+
render() {
|
|
14
|
+
return html`
|
|
15
|
+
<slot @slotchange="${this._handleSlotChange}"></slot>
|
|
16
|
+
${this._renderPagerContainer()}
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
_getItemByIndex(index) {
|
|
20
|
+
return this._getItems()[index];
|
|
21
|
+
}
|
|
22
|
+
_getItems() {
|
|
23
|
+
return this.shadowRoot.querySelector('slot').assignedElements().find(node => node.tagName === 'UL').querySelectorAll('li');
|
|
24
|
+
}
|
|
25
|
+
_getItemShowingCount() {
|
|
26
|
+
return this._getItems().length;
|
|
27
|
+
}
|
|
28
|
+
_handleSlotChange(e) {
|
|
29
|
+
const list = e.target.assignedElements().find(node => node.tagName === 'UL');
|
|
30
|
+
if (!this._mutationObserver) {
|
|
31
|
+
this._mutationObserver = new MutationObserver(() => this._updateItemShowingCount());
|
|
32
|
+
} else {
|
|
33
|
+
this._mutationObserver.disconnect();
|
|
34
|
+
}
|
|
35
|
+
this._mutationObserver.observe(list, { childList: true });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
customElements.define('d2l-pageable-example', PageableExample);
|
|
39
|
+
|
|
40
|
+
document.querySelector('d2l-pager-load-more').addEventListener('d2l-pager-load-more', (e) => {
|
|
41
|
+
const ITEM_COUNT = 12;
|
|
42
|
+
const PAGE_SIZE = 3;
|
|
43
|
+
|
|
44
|
+
const list = e.target.parentNode.querySelector('ul');
|
|
45
|
+
let remainingCount = ITEM_COUNT - list.children.length;
|
|
46
|
+
const numberToLoad = remainingCount < PAGE_SIZE ? remainingCount : PAGE_SIZE;
|
|
47
|
+
for (let i = 0; i < numberToLoad; i++) {
|
|
48
|
+
const newItem = list.lastElementChild.cloneNode(true);
|
|
49
|
+
newItem.textContent = `item ${list.children.length + 1}`;
|
|
50
|
+
list.appendChild(newItem);
|
|
51
|
+
}
|
|
52
|
+
if (list.children.length === ITEM_COUNT) {
|
|
53
|
+
e.target.hasMore = false;
|
|
54
|
+
} else {
|
|
55
|
+
remainingCount = ITEM_COUNT - list.children.length;
|
|
56
|
+
if (remainingCount < PAGE_SIZE && e.target.pageSize) e.target.pageSize = remainingCount;
|
|
57
|
+
}
|
|
58
|
+
e.detail.complete();
|
|
59
|
+
});
|
|
9
60
|
</script>
|
|
10
|
-
<d2l-
|
|
61
|
+
<d2l-pageable-example item-count="12" style="width: 100%;">
|
|
62
|
+
<ul>
|
|
63
|
+
<li>item 1</li>
|
|
64
|
+
<li>item 2</li>
|
|
65
|
+
</ul>
|
|
66
|
+
<d2l-pager-load-more slot="pager" has-more page-size="3"></d2l-pager-load-more>
|
|
67
|
+
</d2l-pageable-example>
|
|
11
68
|
```
|
|
12
69
|
|
|
13
70
|
## Load More Paging [d2l-pager-load-more]
|
|
@@ -48,13 +48,11 @@ export class SelectionControls extends PageableSubscriberMixin(SelectionObserver
|
|
|
48
48
|
static get styles() {
|
|
49
49
|
return css`
|
|
50
50
|
:host {
|
|
51
|
-
background-color: var(--d2l-selection-controls-background-color, white);
|
|
52
51
|
display: block;
|
|
53
52
|
position: sticky;
|
|
54
53
|
top: 0;
|
|
55
54
|
}
|
|
56
55
|
:host([no-sticky]) {
|
|
57
|
-
background-color: transparent;
|
|
58
56
|
position: static;
|
|
59
57
|
}
|
|
60
58
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -69,6 +67,8 @@ export class SelectionControls extends PageableSubscriberMixin(SelectionObserver
|
|
|
69
67
|
clip: rect(30px, auto, 200px, auto);
|
|
70
68
|
display: var(--d2l-selection-controls-shadow-display, block);
|
|
71
69
|
height: 40px;
|
|
70
|
+
margin: 0 calc(-1*var(--d2l-selection-controls-padding, 0px));
|
|
71
|
+
padding: 0 var(--d2l-selection-controls-padding, 0);
|
|
72
72
|
position: absolute;
|
|
73
73
|
width: 100%;
|
|
74
74
|
z-index: -1;
|
|
@@ -78,10 +78,14 @@ export class SelectionControls extends PageableSubscriberMixin(SelectionObserver
|
|
|
78
78
|
}
|
|
79
79
|
.d2l-selection-controls-container {
|
|
80
80
|
align-items: center;
|
|
81
|
+
background-color: var(--d2l-selection-controls-background-color, white);
|
|
81
82
|
display: flex;
|
|
82
|
-
margin
|
|
83
|
-
margin-top: 6px;
|
|
83
|
+
margin: 6px calc(-1*var(--d2l-selection-controls-padding, 0px));
|
|
84
84
|
min-height: 54px;
|
|
85
|
+
padding: 0 var(--d2l-selection-controls-padding, 0);
|
|
86
|
+
}
|
|
87
|
+
:host([no-sticky]) .d2l-selection-controls-container {
|
|
88
|
+
background-color: transparent;
|
|
85
89
|
}
|
|
86
90
|
.d2l-selection-controls-container-slim {
|
|
87
91
|
min-height: 36px;
|
package/custom-elements.json
CHANGED
|
@@ -7799,6 +7799,11 @@
|
|
|
7799
7799
|
{
|
|
7800
7800
|
"name": "grid",
|
|
7801
7801
|
"type": "boolean"
|
|
7802
|
+
},
|
|
7803
|
+
{
|
|
7804
|
+
"name": "extend-separators",
|
|
7805
|
+
"type": "boolean",
|
|
7806
|
+
"default": "false"
|
|
7802
7807
|
}
|
|
7803
7808
|
],
|
|
7804
7809
|
"properties": [
|
|
@@ -7807,6 +7812,12 @@
|
|
|
7807
7812
|
"attribute": "grid",
|
|
7808
7813
|
"type": "boolean"
|
|
7809
7814
|
},
|
|
7815
|
+
{
|
|
7816
|
+
"name": "extendSeparators",
|
|
7817
|
+
"attribute": "extend-separators",
|
|
7818
|
+
"type": "boolean",
|
|
7819
|
+
"default": "false"
|
|
7820
|
+
},
|
|
7810
7821
|
{
|
|
7811
7822
|
"name": "items"
|
|
7812
7823
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.138.
|
|
3
|
+
"version": "2.138.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",
|