@brightspace-ui/core 2.110.1 → 2.111.1
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/inputs/input-time.js +2 -1
- package/components/overflow-group/overflow-group-mixin.js +2 -1
- package/components/paging/pager-load-more.js +2 -1
- package/components/table/README.md +4 -0
- package/components/table/demo/table-test.js +27 -4
- package/components/table/demo/table.html +7 -0
- package/components/table/table-wrapper.js +5 -0
- package/custom-elements.json +31 -4
- package/mixins/interactive/interactive-mixin.js +2 -1
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ import { inputStyles } from './input-styles.js';
|
|
|
16
16
|
import { LabelledMixin } from '../../mixins/labelled/labelled-mixin.js';
|
|
17
17
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
18
18
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
19
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
19
20
|
import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
|
|
20
21
|
|
|
21
22
|
const MIDNIGHT = new Date(2020, 0, 1, 0, 0, 0);
|
|
@@ -117,7 +118,7 @@ function initIntervals(size, enforceTimeIntervals) {
|
|
|
117
118
|
* A component that consists of a text input field for typing a time and an attached dropdown for time selection. It displays the "value" if one is specified, or a placeholder if not, and reflects the selected value when one is selected in the dropdown or entered in the text input.
|
|
118
119
|
* @fires change - Dispatched when there is a change to selected time. `value` corresponds to the selected value and is formatted in ISO 8601 time format (`hh:mm:ss`).
|
|
119
120
|
*/
|
|
120
|
-
class InputTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(LitElement)))) {
|
|
121
|
+
class InputTime extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixin(RtlMixin(LitElement))))) {
|
|
121
122
|
|
|
122
123
|
static get properties() {
|
|
123
124
|
return {
|
|
@@ -2,6 +2,7 @@ import { css, html, nothing } from 'lit';
|
|
|
2
2
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
3
3
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
4
4
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
5
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
5
6
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
6
7
|
|
|
7
8
|
export const OVERFLOW_CLASS = 'd2l-overflow-container';
|
|
@@ -24,7 +25,7 @@ async function filterAsync(arr, callback) {
|
|
|
24
25
|
return results.filter(i => i !== fail);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export const OverflowGroupMixin = superclass => class extends LocalizeCoreElement(superclass) {
|
|
28
|
+
export const OverflowGroupMixin = superclass => class extends LocalizeCoreElement(RtlMixin(superclass)) {
|
|
28
29
|
|
|
29
30
|
static get properties() {
|
|
30
31
|
return {
|
|
@@ -10,6 +10,7 @@ import { labelStyles } from '../typography/styles.js';
|
|
|
10
10
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
11
11
|
import { offscreenStyles } from '../offscreen/offscreen.js';
|
|
12
12
|
import { PageableSubscriberMixin } from './pageable-subscriber-mixin.js';
|
|
13
|
+
import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
|
|
13
14
|
|
|
14
15
|
const nativeFocus = document.createElement('div').focus;
|
|
15
16
|
|
|
@@ -17,7 +18,7 @@ const nativeFocus = document.createElement('div').focus;
|
|
|
17
18
|
* A pager component for load-more paging.
|
|
18
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.
|
|
19
20
|
*/
|
|
20
|
-
class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(LitElement))) {
|
|
21
|
+
class LoadMore extends PageableSubscriberMixin(FocusMixin(LocalizeCoreElement(RtlMixin(LitElement)))) {
|
|
21
22
|
|
|
22
23
|
static get properties() {
|
|
23
24
|
return {
|
|
@@ -292,6 +292,10 @@ If your table supports row selection, apply the `selected` attribute to `<tr>` r
|
|
|
292
292
|
</tr>
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
+
## Pageable Tables
|
|
296
|
+
|
|
297
|
+
Load-More paging functionality can be implemented in tables by placing a `d2l-pager-load-more` in `d2l-table-wrapper`'s `pager` slot. The consumer must handle the `d2l-pager-load-more` event by loading more items, updating the pager state, and signalling completion by calling `complete()` on the event detail. Focus will be automatically moved on the first new item once complete. See [Paging](../../components/paging) for more details.
|
|
298
|
+
|
|
295
299
|
## Table Controls [d2l-table-controls]
|
|
296
300
|
|
|
297
301
|
The `d2l-table-controls` component can be placed in the `d2l-table-wrapper`'s `controls` slot to provide a selection summary, a slot for `d2l-selection-action`s, and overflow-group behaviour.
|
|
@@ -4,14 +4,16 @@ import '../../dropdown/dropdown-button-subtle.js';
|
|
|
4
4
|
import '../../dropdown/dropdown-menu.js';
|
|
5
5
|
import '../../menu/menu.js';
|
|
6
6
|
import '../../menu/menu-item.js';
|
|
7
|
+
import '../../paging/pager-load-more.js';
|
|
7
8
|
import '../../selection/selection-action.js';
|
|
8
9
|
import '../../selection/selection-action-dropdown.js';
|
|
9
10
|
import '../../selection/selection-action-menu-item.js';
|
|
10
11
|
import '../../selection/selection-input.js';
|
|
11
12
|
|
|
12
|
-
import { css, html } from 'lit';
|
|
13
|
+
import { css, html, nothing } from 'lit';
|
|
13
14
|
import { tableStyles, TableWrapper } from '../table-wrapper.js';
|
|
14
15
|
import { DemoPassthroughMixin } from '../../demo/demo-passthrough-mixin.js';
|
|
16
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
15
17
|
import { RtlMixin } from '../../../mixins/rtl/rtl-mixin.js';
|
|
16
18
|
|
|
17
19
|
const fruits = ['Apples', 'Oranges', 'Bananas'];
|
|
@@ -33,11 +35,12 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
|
33
35
|
|
|
34
36
|
static get properties() {
|
|
35
37
|
return {
|
|
38
|
+
paging: { type: Boolean, reflect: true },
|
|
36
39
|
stickyControls: { attribute: 'sticky-controls', type: Boolean, reflect: true },
|
|
37
40
|
visibleBackground: { attribute: 'visible-background', type: Boolean, reflect: true },
|
|
38
41
|
_data: { state: true },
|
|
39
|
-
_sortField: {
|
|
40
|
-
_sortDesc: {
|
|
42
|
+
_sortField: { state: true },
|
|
43
|
+
_sortDesc: { state: true }
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -54,7 +57,13 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
|
54
57
|
|
|
55
58
|
constructor() {
|
|
56
59
|
super();
|
|
60
|
+
|
|
61
|
+
this.paging = false;
|
|
62
|
+
this.stickyControls = false;
|
|
63
|
+
this.visibleBackground = false;
|
|
57
64
|
this._data = data();
|
|
65
|
+
this._sortField = undefined;
|
|
66
|
+
this._sortDesc = false;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
render() {
|
|
@@ -65,7 +74,7 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
|
65
74
|
return a.fruit[this._sortField] - b.fruit[this._sortField];
|
|
66
75
|
});
|
|
67
76
|
return html`
|
|
68
|
-
<d2l-table-wrapper item-count="500">
|
|
77
|
+
<d2l-table-wrapper item-count="${ifDefined(this.paging ? 500 : undefined)}">
|
|
69
78
|
<d2l-table-controls slot="controls" ?no-sticky="${!this.stickyControls}" select-all-pages-allowed>
|
|
70
79
|
<d2l-selection-action
|
|
71
80
|
text="Sticky controls"
|
|
@@ -112,10 +121,24 @@ class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-w
|
|
|
112
121
|
`)}
|
|
113
122
|
</tbody>
|
|
114
123
|
</table>
|
|
124
|
+
${this.paging ? html`<d2l-pager-load-more slot="pager"
|
|
125
|
+
has-more
|
|
126
|
+
page-size="3"
|
|
127
|
+
@d2l-pager-load-more="${this._handlePagerLoadMore}"
|
|
128
|
+
></d2l-pager-load-more>` : nothing}
|
|
115
129
|
</d2l-table-wrapper>
|
|
116
130
|
`;
|
|
117
131
|
}
|
|
118
132
|
|
|
133
|
+
_handlePagerLoadMore(e) {
|
|
134
|
+
const startIndex = this._data.length + 1;
|
|
135
|
+
for (let i = 0; i < e.target.pageSize; i++) {
|
|
136
|
+
this._data.push({ name: `Country ${startIndex + i}`, fruit: { 'apples': 8534, 'oranges': 1325, 'bananas': 78382756 }, selected: false });
|
|
137
|
+
}
|
|
138
|
+
this.requestUpdate();
|
|
139
|
+
e.detail.complete();
|
|
140
|
+
}
|
|
141
|
+
|
|
119
142
|
_handleSort(e) {
|
|
120
143
|
const field = e.target.innerText.toLowerCase();
|
|
121
144
|
const desc = e.target.hasAttribute('desc');
|
|
@@ -41,6 +41,13 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
</d2l-demo-snippet>
|
|
43
43
|
|
|
44
|
+
<h2>Default, Paging</h2>
|
|
45
|
+
<d2l-demo-snippet>
|
|
46
|
+
<template>
|
|
47
|
+
<d2l-test-table type="default" sticky-controls paging></d2l-test-table>
|
|
48
|
+
</template>
|
|
49
|
+
</d2l-demo-snippet>
|
|
50
|
+
|
|
44
51
|
<h2>Default, Visible controls background</h2>
|
|
45
52
|
<d2l-demo-snippet>
|
|
46
53
|
<template>
|
|
@@ -166,6 +166,7 @@ export const tableStyles = css`
|
|
|
166
166
|
* Wraps a native <table> element, providing styling and scroll buttons for overflow.
|
|
167
167
|
* @slot - Content to wrap
|
|
168
168
|
* @slot controls - Slot for `d2l-table-controls` to be rendered above the table
|
|
169
|
+
* @slot pager - Slot for `d2l-pager-load-more` to be rendered below the table
|
|
169
170
|
*/
|
|
170
171
|
export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitElement))) {
|
|
171
172
|
|
|
@@ -246,6 +247,9 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
|
246
247
|
top: calc(-7px - var(--d2l-table-border-radius)); /* 6px for the d2l-table-controls margin-bottom, 1px overlap to fix zoom issues */
|
|
247
248
|
width: 100%;
|
|
248
249
|
}
|
|
250
|
+
slot[name="pager"]::slotted(*) {
|
|
251
|
+
margin-top: 12px;
|
|
252
|
+
}
|
|
249
253
|
`;
|
|
250
254
|
}
|
|
251
255
|
|
|
@@ -279,6 +283,7 @@ export class TableWrapper extends RtlMixin(PageableMixin(SelectionMixin(LitEleme
|
|
|
279
283
|
<slot name="controls" @slotchange="${this._handleControlsSlotChange}"></slot>
|
|
280
284
|
${this.stickyHeaders && this._controlsScrolled ? html`<div class="d2l-sticky-headers-backdrop"></div>` : nothing}
|
|
281
285
|
${this.stickyHeaders ? slot : html`<d2l-scroll-wrapper>${slot}</d2l-scroll-wrapper>`}
|
|
286
|
+
${this._renderPagerContainer()}
|
|
282
287
|
`;
|
|
283
288
|
}
|
|
284
289
|
|
package/custom-elements.json
CHANGED
|
@@ -11494,13 +11494,20 @@
|
|
|
11494
11494
|
"name": "d2l-test-table",
|
|
11495
11495
|
"path": "./components/table/demo/table-test.js",
|
|
11496
11496
|
"attributes": [
|
|
11497
|
+
{
|
|
11498
|
+
"name": "paging",
|
|
11499
|
+
"type": "boolean",
|
|
11500
|
+
"default": "false"
|
|
11501
|
+
},
|
|
11497
11502
|
{
|
|
11498
11503
|
"name": "sticky-controls",
|
|
11499
|
-
"type": "boolean"
|
|
11504
|
+
"type": "boolean",
|
|
11505
|
+
"default": "false"
|
|
11500
11506
|
},
|
|
11501
11507
|
{
|
|
11502
11508
|
"name": "visible-background",
|
|
11503
|
-
"type": "boolean"
|
|
11509
|
+
"type": "boolean",
|
|
11510
|
+
"default": "false"
|
|
11504
11511
|
},
|
|
11505
11512
|
{
|
|
11506
11513
|
"name": "no-column-border",
|
|
@@ -11538,15 +11545,23 @@
|
|
|
11538
11545
|
}
|
|
11539
11546
|
],
|
|
11540
11547
|
"properties": [
|
|
11548
|
+
{
|
|
11549
|
+
"name": "paging",
|
|
11550
|
+
"attribute": "paging",
|
|
11551
|
+
"type": "boolean",
|
|
11552
|
+
"default": "false"
|
|
11553
|
+
},
|
|
11541
11554
|
{
|
|
11542
11555
|
"name": "stickyControls",
|
|
11543
11556
|
"attribute": "sticky-controls",
|
|
11544
|
-
"type": "boolean"
|
|
11557
|
+
"type": "boolean",
|
|
11558
|
+
"default": "false"
|
|
11545
11559
|
},
|
|
11546
11560
|
{
|
|
11547
11561
|
"name": "visibleBackground",
|
|
11548
11562
|
"attribute": "visible-background",
|
|
11549
|
-
"type": "boolean"
|
|
11563
|
+
"type": "boolean",
|
|
11564
|
+
"default": "false"
|
|
11550
11565
|
},
|
|
11551
11566
|
{
|
|
11552
11567
|
"name": "noColumnBorder",
|
|
@@ -11597,6 +11612,10 @@
|
|
|
11597
11612
|
{
|
|
11598
11613
|
"name": "controls",
|
|
11599
11614
|
"description": "Slot for `d2l-table-controls` to be rendered above the table"
|
|
11615
|
+
},
|
|
11616
|
+
{
|
|
11617
|
+
"name": "pager",
|
|
11618
|
+
"description": "Slot for `d2l-pager-load-more` to be rendered below the table"
|
|
11600
11619
|
}
|
|
11601
11620
|
]
|
|
11602
11621
|
},
|
|
@@ -11819,6 +11838,10 @@
|
|
|
11819
11838
|
{
|
|
11820
11839
|
"name": "controls",
|
|
11821
11840
|
"description": "Slot for `d2l-table-controls` to be rendered above the table"
|
|
11841
|
+
},
|
|
11842
|
+
{
|
|
11843
|
+
"name": "pager",
|
|
11844
|
+
"description": "Slot for `d2l-pager-load-more` to be rendered below the table"
|
|
11822
11845
|
}
|
|
11823
11846
|
]
|
|
11824
11847
|
},
|
|
@@ -11826,6 +11849,10 @@
|
|
|
11826
11849
|
"name": "d2l-test-table-controls-visual-diff",
|
|
11827
11850
|
"path": "./components/table/test/table-test-controls-visual-diff.js"
|
|
11828
11851
|
},
|
|
11852
|
+
{
|
|
11853
|
+
"name": "d2l-test-table-paging-visual-diff",
|
|
11854
|
+
"path": "./components/table/test/table-test-paging-visual-diff.js"
|
|
11855
|
+
},
|
|
11829
11856
|
{
|
|
11830
11857
|
"name": "d2l-test-table-sticky-visual-diff",
|
|
11831
11858
|
"path": "./components/table/test/table-test-sticky-visual-diff.js"
|
|
@@ -5,6 +5,7 @@ import { getNextFocusable } from '../../helpers/focus.js';
|
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
7
7
|
import { offscreenStyles } from '../../components/offscreen/offscreen.js';
|
|
8
|
+
import { RtlMixin } from '../rtl/rtl-mixin.js';
|
|
8
9
|
|
|
9
10
|
const keyCodes = {
|
|
10
11
|
ENTER: 13,
|
|
@@ -18,7 +19,7 @@ export function isInteractiveDescendant(node) {
|
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export const InteractiveMixin = superclass => class extends LocalizeCoreElement(superclass) {
|
|
22
|
+
export const InteractiveMixin = superclass => class extends LocalizeCoreElement(RtlMixin(superclass)) {
|
|
22
23
|
|
|
23
24
|
static get properties() {
|
|
24
25
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.111.1",
|
|
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",
|