@brightspace-ui/core 3.55.0 → 3.57.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -101,3 +101,4 @@ pager.addEventListener('d2l-pager-load-more', e => {
|
|
101
101
|
| Event | Description |
|
102
102
|
|---|---|
|
103
103
|
| `d2l-pager-load-more` | Dispatched when the user clicks the Load More button. The `pageSize` can be accessed from the event `target`. The consumer must call the `complete()` method on the event detail to signal completion after the new items have been loaded. |
|
104
|
+
| `d2l-pager-load-more-loaded` | Dispatched after more items have been loaded.
|
@@ -17,6 +17,7 @@ const nativeFocus = document.createElement('div').focus;
|
|
17
17
|
/**
|
18
18
|
* A pager component for load-more paging.
|
19
19
|
* @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
|
+
* @fires d2l-pager-load-more-loaded - Dispatched after more items have been loaded.
|
20
21
|
*/
|
21
22
|
class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))) {
|
22
23
|
|
@@ -125,19 +126,34 @@ class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(Rt
|
|
125
126
|
this._loading = false;
|
126
127
|
|
127
128
|
// wait a frame for async sub-components to render
|
128
|
-
await new Promise(
|
129
|
+
await new Promise(requestAnimationFrame);
|
129
130
|
|
130
131
|
const item = pageable._getItemByIndex(lastItemIndex + 1);
|
131
132
|
|
132
|
-
|
133
|
-
if (item
|
133
|
+
let itemToFocus;
|
134
|
+
if (item) {
|
135
|
+
if (item.updateComplete) await item.updateComplete;
|
136
|
+
if (item.focus !== nativeFocus) {
|
137
|
+
itemToFocus = item;
|
138
|
+
} else {
|
139
|
+
const firstFocusable = getFirstFocusableDescendant(item);
|
140
|
+
if (firstFocusable) {
|
141
|
+
itemToFocus = firstFocusable;
|
142
|
+
} else if (item.focus === nativeFocus) {
|
143
|
+
item.tabIndex = -1;
|
144
|
+
itemToFocus = item;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
134
148
|
|
135
|
-
if (
|
136
|
-
|
137
|
-
|
138
|
-
const firstFocusable = getFirstFocusableDescendant(item);
|
139
|
-
if (firstFocusable) firstFocusable.focus();
|
149
|
+
if (itemToFocus) {
|
150
|
+
await new Promise(requestAnimationFrame);
|
151
|
+
itemToFocus.focus();
|
140
152
|
}
|
153
|
+
|
154
|
+
await new Promise(requestAnimationFrame);
|
155
|
+
this.dispatchEvent(new CustomEvent('d2l-pager-load-more-loaded'));
|
156
|
+
|
141
157
|
}
|
142
158
|
|
143
159
|
}
|
package/custom-elements.json
CHANGED
@@ -10535,6 +10535,10 @@
|
|
10535
10535
|
{
|
10536
10536
|
"name": "d2l-pager-load-more",
|
10537
10537
|
"description": "Dispatched when the user clicks the load-more button. Consumers must call the provided \"complete\" method once items have been loaded."
|
10538
|
+
},
|
10539
|
+
{
|
10540
|
+
"name": "d2l-pager-load-more-loaded",
|
10541
|
+
"description": "Dispatched after more items have been loaded."
|
10538
10542
|
}
|
10539
10543
|
]
|
10540
10544
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.57.0",
|
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",
|