@brightspace-ui/core 2.118.2 → 2.118.4
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/collapsible-panel/README.md +2 -2
- package/components/list/list-item-drag-drop-mixin.js +7 -7
- package/components/list/list-item-generic-layout.js +10 -3
- package/components/list/list-item-mixin.js +11 -11
- package/package.json +1 -1
- package/templates/primary-secondary/primary-secondary.js +25 -14
|
@@ -87,7 +87,7 @@ The collapsible panel is a container that can show or hide additional content. I
|
|
|
87
87
|
|
|
88
88
|
## Collapsible Panel [d2l-collapsible-panel]
|
|
89
89
|
|
|
90
|
-
The `d2l-collapsible-panel` element is a container that provides specific layout slots such as `header`, `summary`, `actions`, and a default slot for the expanded content.
|
|
90
|
+
The `d2l-collapsible-panel` element is a container that provides specific layout slots such as `before`, `header`, `summary`, `actions`, and a default slot for the expanded content.
|
|
91
91
|
|
|
92
92
|
<!-- docs: demo live name:d2l-collapsible-panel -->
|
|
93
93
|
```html
|
|
@@ -205,7 +205,7 @@ Use an inline collapsible panel to progressively disclose sections of a complex
|
|
|
205
205
|
## Summary Items [d2l-collapsible-panel-summary-item]
|
|
206
206
|
An optional summary can help the user understand what’s inside the collapsible panel without having to expand it. This can be helpful if the user needs more than the heading to explain what’s inside.
|
|
207
207
|
|
|
208
|
-
<!-- docs: demo -->
|
|
208
|
+
<!-- docs: demo live name:d2l-collapsible-panel-summary-item -->
|
|
209
209
|
```html
|
|
210
210
|
<script type="module">
|
|
211
211
|
import '@brightspace-ui/core/components/collapsible-panel/collapsible-panel.js';
|
|
@@ -381,7 +381,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
381
381
|
|
|
382
382
|
_dispatchListItemsMove(sourceItems, targetItem, moveLocation, keyboardActive) {
|
|
383
383
|
if (!keyboardActive) keyboardActive = false;
|
|
384
|
-
const rootList = this.
|
|
384
|
+
const rootList = this.getRootList();
|
|
385
385
|
/** @ignore */
|
|
386
386
|
rootList.dispatchEvent(new CustomEvent('d2l-list-items-move', {
|
|
387
387
|
detail: {
|
|
@@ -408,13 +408,13 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
_dispatchMoveListItemFirst(moveToRoot) {
|
|
411
|
-
const list = (moveToRoot ? this.
|
|
411
|
+
const list = (moveToRoot ? this.getRootList() : findComposedAncestor(this, node => node.tagName === 'D2L-LIST'));
|
|
412
412
|
const items = list.getItems();
|
|
413
413
|
this._dispatchListItemsMove([this], items[0], moveLocations.above, true);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
_dispatchMoveListItemLast(moveToRoot) {
|
|
417
|
-
const list = (moveToRoot ? this.
|
|
417
|
+
const list = (moveToRoot ? this.getRootList() : findComposedAncestor(this, node => node.tagName === 'D2L-LIST'));
|
|
418
418
|
const items = list.getItems();
|
|
419
419
|
this._dispatchListItemsMove([this], items[items.length - 1], moveLocations.below, true);
|
|
420
420
|
}
|
|
@@ -483,7 +483,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
_dispatchMoveRootItem(moveAbove) {
|
|
486
|
-
const rootList = this.
|
|
486
|
+
const rootList = this.getRootList();
|
|
487
487
|
const items = rootList.getItems();
|
|
488
488
|
const currentIndex = items.indexOf(this);
|
|
489
489
|
if (moveAbove && currentIndex !== 0) {
|
|
@@ -610,7 +610,7 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
610
610
|
return dragImage;
|
|
611
611
|
};
|
|
612
612
|
|
|
613
|
-
const rootList = this.
|
|
613
|
+
const rootList = this.getRootList(this);
|
|
614
614
|
const selectionInfo = rootList.getSelectionInfo(rootList.dragMultiple);
|
|
615
615
|
if (rootList.dragMultiple && selectionInfo.keys.length > 1) {
|
|
616
616
|
const lazyLoadListItems = this._getFlattenedListItems().lazyLoadListItems;
|
|
@@ -750,8 +750,8 @@ export const ListItemDragDropMixin = superclass => class extends superclass {
|
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
// assert that both the source and target are from the same list - may allow this in the future
|
|
753
|
-
const targetRoot = dragState.dragTargets[0] && dragState.dragTargets[0].
|
|
754
|
-
if (this.
|
|
753
|
+
const targetRoot = dragState.dragTargets[0] && dragState.dragTargets[0].getRootList();
|
|
754
|
+
if (this.getRootList() !== targetRoot) return;
|
|
755
755
|
|
|
756
756
|
dragState.addDropTarget(this);
|
|
757
757
|
this._draggingOver = true;
|
|
@@ -283,7 +283,8 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
283
283
|
|
|
284
284
|
_focusNextRow(previous = false, num = 1) {
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
const curListItem = findComposedAncestor(this, node => node.role === 'rowgroup');
|
|
287
|
+
let listItem = curListItem;
|
|
287
288
|
|
|
288
289
|
while (num > 0) {
|
|
289
290
|
const tempListItem = (previous ? this._getPreviousFlattenedListItem(listItem) : this._getNextFlattenedListItem(listItem));
|
|
@@ -301,7 +302,9 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
301
302
|
if (!listItem._tryFocus()) {
|
|
302
303
|
// ultimate fallback to generic method for getting next/previous focusable
|
|
303
304
|
const nextFocusable = previous ? getPreviousFocusable(listItem) : getNextFocusable(listItem);
|
|
304
|
-
if (nextFocusable
|
|
305
|
+
if (nextFocusable && this._isContainedInSameRootList(curListItem, nextFocusable)) {
|
|
306
|
+
nextFocusable.focus();
|
|
307
|
+
}
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
|
|
@@ -442,9 +445,13 @@ class ListItemGenericLayout extends RtlMixin(LitElement) {
|
|
|
442
445
|
this.shadowRoot.querySelector(`.d2l-cell[data-cell-num="${this._cellNum}"]`);
|
|
443
446
|
}
|
|
444
447
|
|
|
448
|
+
_isContainedInSameRootList(item, node) {
|
|
449
|
+
const rootList = item?.getRootList?.(item);
|
|
450
|
+
return isComposedAncestor(rootList, node);
|
|
451
|
+
}
|
|
452
|
+
|
|
445
453
|
_onKeydown(event) {
|
|
446
454
|
if (!this.gridActive) return;
|
|
447
|
-
|
|
448
455
|
let node = null;
|
|
449
456
|
let preventDefault = true;
|
|
450
457
|
switch (event.keyCode) {
|
|
@@ -440,6 +440,16 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
|
440
440
|
this._tryFocus();
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
getRootList(node) {
|
|
444
|
+
if (!node) node = this;
|
|
445
|
+
let rootList;
|
|
446
|
+
while (node) {
|
|
447
|
+
if (node.tagName === 'D2L-LIST') rootList = node;
|
|
448
|
+
node = getComposedParent(node);
|
|
449
|
+
}
|
|
450
|
+
return rootList;
|
|
451
|
+
}
|
|
452
|
+
|
|
443
453
|
async highlight() {
|
|
444
454
|
if (this._highlight) return;
|
|
445
455
|
const elem = this.shadowRoot.querySelector('[slot="outside-control-container"]');
|
|
@@ -487,7 +497,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
|
487
497
|
|
|
488
498
|
_getListItems(listItems, lazyLoadListItems, listItem) {
|
|
489
499
|
if (!listItem) {
|
|
490
|
-
const rootList = this.
|
|
500
|
+
const rootList = this.getRootList();
|
|
491
501
|
const rootListItems = rootList.getItems();
|
|
492
502
|
rootListItems.forEach(listItem => this._getListItems(listItems, lazyLoadListItems, listItem));
|
|
493
503
|
} else {
|
|
@@ -544,16 +554,6 @@ export const ListItemMixin = superclass => class extends composeMixins(
|
|
|
544
554
|
}
|
|
545
555
|
}
|
|
546
556
|
|
|
547
|
-
_getRootList(node) {
|
|
548
|
-
if (!node) node = this;
|
|
549
|
-
let rootList;
|
|
550
|
-
while (node) {
|
|
551
|
-
if (node.tagName === 'D2L-LIST') rootList = node;
|
|
552
|
-
node = getComposedParent(node);
|
|
553
|
-
}
|
|
554
|
-
return rootList;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
557
|
_isListItem(node) {
|
|
558
558
|
if (!node) node = this;
|
|
559
559
|
return node.role === 'rowgroup' || node.role === 'listitem';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.118.
|
|
3
|
+
"version": "2.118.4",
|
|
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",
|
|
@@ -24,7 +24,9 @@ const keyCodes = Object.freeze({
|
|
|
24
24
|
LEFT: 37,
|
|
25
25
|
UP: 38,
|
|
26
26
|
RIGHT: 39,
|
|
27
|
-
DOWN: 40
|
|
27
|
+
DOWN: 40,
|
|
28
|
+
ENTER: 13,
|
|
29
|
+
SPACE: 32
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
function isMobile() {
|
|
@@ -303,27 +305,36 @@ class MobileKeyboardResizer extends Resizer {
|
|
|
303
305
|
if (!this.isMobile) {
|
|
304
306
|
return;
|
|
305
307
|
}
|
|
306
|
-
if (e.keyCode !== keyCodes.UP && e.keyCode !== keyCodes.DOWN) {
|
|
308
|
+
if (e.keyCode !== keyCodes.UP && e.keyCode !== keyCodes.DOWN && e.keyCode !== keyCodes.ENTER && e.keyCode !== keyCodes.SPACE) {
|
|
307
309
|
return;
|
|
308
310
|
}
|
|
309
311
|
let secondaryHeight;
|
|
310
|
-
if (
|
|
311
|
-
if (
|
|
312
|
-
secondaryHeight = this.contentBounds.minHeight;
|
|
312
|
+
if (e.keyCode === keyCodes.ENTER || e.keyCode === keyCodes.SPACE) {
|
|
313
|
+
if (this.panelSize === 0) {
|
|
314
|
+
secondaryHeight = this._restoreSize || this.contentBounds.minHeight;
|
|
313
315
|
} else {
|
|
316
|
+
this._restoreSize = this.panelSize;
|
|
314
317
|
secondaryHeight = 0;
|
|
315
318
|
}
|
|
316
319
|
} else {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (desiredSteppedHeight < actualSecondaryHeight) {
|
|
324
|
-
secondaryHeight = 0;
|
|
320
|
+
if (this.panelSize === 0) {
|
|
321
|
+
if (e.keyCode === keyCodes.UP) {
|
|
322
|
+
secondaryHeight = this.contentBounds.minHeight;
|
|
323
|
+
} else {
|
|
324
|
+
secondaryHeight = 0;
|
|
325
|
+
}
|
|
325
326
|
} else {
|
|
326
|
-
|
|
327
|
+
const delta = (this.contentBounds.maxHeight - this.contentBounds.minHeight) / (this._steps - 1);
|
|
328
|
+
const direction = e.keyCode === keyCodes.UP ? 1 : -1;
|
|
329
|
+
const desiredHeight = this.panelSize + delta * direction;
|
|
330
|
+
const desiredSteppedHeight = this.contentBounds.minHeight + delta * Math.round((desiredHeight - this.contentBounds.minHeight) / delta);
|
|
331
|
+
|
|
332
|
+
const actualSecondaryHeight = this.clampHeight(desiredSteppedHeight);
|
|
333
|
+
if (desiredSteppedHeight < actualSecondaryHeight) {
|
|
334
|
+
secondaryHeight = 0;
|
|
335
|
+
} else {
|
|
336
|
+
secondaryHeight = actualSecondaryHeight;
|
|
337
|
+
}
|
|
327
338
|
}
|
|
328
339
|
}
|
|
329
340
|
this.dispatchResize(secondaryHeight, true);
|