@brightspace-ui/core 2.138.0 → 2.138.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.
|
@@ -285,6 +285,10 @@ class InputColor extends FocusMixin(FormElementMixin(LocalizeCoreElement(LitElem
|
|
|
285
285
|
|
|
286
286
|
if (changedProperties.has('label') || changedProperties.has('type')) this._validateLabel();
|
|
287
287
|
|
|
288
|
+
if (changedProperties.has('value') || changedProperties.has('type') || changedProperties.has('disallowNone')) {
|
|
289
|
+
this.setFormValue(this.value);
|
|
290
|
+
}
|
|
291
|
+
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
_getLabel() {
|
|
@@ -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]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.138.
|
|
3
|
+
"version": "2.138.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",
|