@brightspace-ui/core 2.75.4 → 2.75.5
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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Lit component that mirrors properties of another, and passes its properties through to
|
|
5
|
+
* a specific rendered element.
|
|
6
|
+
*
|
|
7
|
+
* @param superclass The Lit class to mirror (will copy all its properties).
|
|
8
|
+
* @param { String } target The element name or other selector string of the element to pass properties to.
|
|
9
|
+
*/
|
|
10
|
+
export const DemoPassthroughMixin = (superclass, target) => class extends LitElement {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return Object.fromEntries(superclass.elementProperties);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
firstUpdated() {
|
|
16
|
+
this.target = this.shadowRoot.querySelector(target);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
updated(changedProperties) {
|
|
20
|
+
const propertyDefinitions = superclass.elementProperties;
|
|
21
|
+
changedProperties.forEach((_value, key) => {
|
|
22
|
+
if (propertyDefinitions.get(key)?.attribute !== false) this.target[key] = this[key];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -29,7 +29,7 @@ Tables are used to display tabular data in rows and columns. They can allow user
|
|
|
29
29
|
## Responsive Behavior
|
|
30
30
|
If the browser window is too narrow to display the table’s contents, a scroll button appears. This alerts users to overflowing content and provides a way for users to scroll horizontally. The scroll button sticks to the top of the screen so that it's available as long as the table is in the viewport.
|
|
31
31
|
|
|
32
|
-
<!-- docs: demo
|
|
32
|
+
<!-- docs: demo size:large -->
|
|
33
33
|
```html
|
|
34
34
|
<script type="module">
|
|
35
35
|
import '@brightspace-ui/core/components/table/demo/table-test.js';
|
|
@@ -45,7 +45,7 @@ If the viewport is very narrow — for example, on a mobile device — it may be
|
|
|
45
45
|
|
|
46
46
|
The `d2l-table-wrapper` element can be combined with table styles to apply default/light styling, row selection styles, overflow scrolling and sticky headers to native `<table>` elements within your Lit components.
|
|
47
47
|
|
|
48
|
-
<!-- docs: demo live name:d2l-
|
|
48
|
+
<!-- docs: demo live name:d2l-table-wrapper display:block -->
|
|
49
49
|
```html
|
|
50
50
|
<script type="module">
|
|
51
51
|
import { html, LitElement } from 'lit';
|
|
@@ -63,15 +63,7 @@ The `d2l-table-wrapper` element can be combined with table styles to apply defau
|
|
|
63
63
|
{ name: 'Japan', fruit: { 'apples': 8534, 'oranges': 1325, 'bananas': 78382756 }, selected: false }
|
|
64
64
|
];
|
|
65
65
|
|
|
66
|
-
class
|
|
67
|
-
|
|
68
|
-
static get properties() {
|
|
69
|
-
return {
|
|
70
|
-
noColumnBorder: { attribute: 'no-column-border', type: Boolean },
|
|
71
|
-
type: { type: String },
|
|
72
|
-
stickyHeaders: { attribute: 'sticky-headers', type: Boolean }
|
|
73
|
-
};
|
|
74
|
-
}
|
|
66
|
+
class SampleTable extends LitElement {
|
|
75
67
|
|
|
76
68
|
static get styles() {
|
|
77
69
|
return tableStyles;
|
|
@@ -81,7 +73,7 @@ The `d2l-table-wrapper` element can be combined with table styles to apply defau
|
|
|
81
73
|
const type = this.type === 'light' ? 'light' : 'default';
|
|
82
74
|
|
|
83
75
|
return html`
|
|
84
|
-
<d2l-table-wrapper
|
|
76
|
+
<d2l-table-wrapper>
|
|
85
77
|
<table class="d2l-table">
|
|
86
78
|
<thead>
|
|
87
79
|
<tr>
|
|
@@ -103,9 +95,9 @@ The `d2l-table-wrapper` element can be combined with table styles to apply defau
|
|
|
103
95
|
}
|
|
104
96
|
|
|
105
97
|
}
|
|
106
|
-
customElements.define('d2l-
|
|
98
|
+
customElements.define('d2l-sample-table', SampleTable);
|
|
107
99
|
</script>
|
|
108
|
-
<d2l-
|
|
100
|
+
<d2l-sample-table></d2l-sample-table>
|
|
109
101
|
```
|
|
110
102
|
|
|
111
103
|
<!-- docs: start hidden content -->
|
|
@@ -304,7 +296,7 @@ If your table supports row selection, apply the `selected` attribute to `<tr>` r
|
|
|
304
296
|
|
|
305
297
|
The `d2l-table-header` component can be placed in the `d2l-table-wrapper`'s `header` slot to provide a selection summary, a slot for `d2l-selection-action`s, and overflow-group behaviour.
|
|
306
298
|
|
|
307
|
-
<!-- docs: demo live name:d2l-table-header -->
|
|
299
|
+
<!-- docs: demo live name:d2l-table-header display:block -->
|
|
308
300
|
```html
|
|
309
301
|
<script type="module">
|
|
310
302
|
import '@brightspace-ui/core/components/selection/selection-action.js';
|
|
@@ -314,7 +306,7 @@ The `d2l-table-header` component can be placed in the `d2l-table-wrapper`'s `hea
|
|
|
314
306
|
import { html, LitElement } from 'lit';
|
|
315
307
|
import { tableStyles } from '@brightspace-ui/core/components/table/table-wrapper.js';
|
|
316
308
|
|
|
317
|
-
class
|
|
309
|
+
class SampleTableWithHeader extends LitElement {
|
|
318
310
|
|
|
319
311
|
static get properties() {
|
|
320
312
|
return {
|
|
@@ -369,9 +361,9 @@ The `d2l-table-header` component can be placed in the `d2l-table-wrapper`'s `hea
|
|
|
369
361
|
}
|
|
370
362
|
|
|
371
363
|
}
|
|
372
|
-
customElements.define('d2l-
|
|
364
|
+
customElements.define('d2l-sample-table-with-header', SampleTableWithHeader);
|
|
373
365
|
</script>
|
|
374
|
-
<d2l-
|
|
366
|
+
<d2l-sample-table-with-header></d2l-sample-table-with-header>
|
|
375
367
|
```
|
|
376
368
|
|
|
377
369
|
<!-- docs: start hidden content -->
|
|
@@ -9,9 +9,10 @@ import '../../selection/selection-action-dropdown.js';
|
|
|
9
9
|
import '../../selection/selection-action-menu-item.js';
|
|
10
10
|
import '../../selection/selection-input.js';
|
|
11
11
|
|
|
12
|
-
import { css, html
|
|
12
|
+
import { css, html } from 'lit';
|
|
13
|
+
import { tableStyles, TableWrapper } from '../table-wrapper.js';
|
|
14
|
+
import { DemoPassthroughMixin } from '../../demo/demo-passthrough-mixin.js';
|
|
13
15
|
import { RtlMixin } from '../../../mixins/rtl-mixin.js';
|
|
14
|
-
import { tableStyles } from '../table-wrapper.js';
|
|
15
16
|
|
|
16
17
|
const fruits = ['Apples', 'Oranges', 'Bananas'];
|
|
17
18
|
|
|
@@ -27,25 +28,10 @@ const data = () => [
|
|
|
27
28
|
|
|
28
29
|
const formatter = new Intl.NumberFormat('en-US');
|
|
29
30
|
|
|
30
|
-
class TestTable extends RtlMixin(
|
|
31
|
+
class TestTable extends RtlMixin(DemoPassthroughMixin(TableWrapper, 'd2l-table-wrapper')) {
|
|
31
32
|
|
|
32
33
|
static get properties() {
|
|
33
34
|
return {
|
|
34
|
-
/**
|
|
35
|
-
* Hides the column borders on "default" table type
|
|
36
|
-
* @type {boolean}
|
|
37
|
-
*/
|
|
38
|
-
noColumnBorder: { attribute: 'no-column-border', type: Boolean },
|
|
39
|
-
/**
|
|
40
|
-
* Type of table style to apply
|
|
41
|
-
* @type {'default'|'light'}
|
|
42
|
-
*/
|
|
43
|
-
type: { type: String },
|
|
44
|
-
/**
|
|
45
|
-
* Whether header row is sticky
|
|
46
|
-
* @type {boolean}
|
|
47
|
-
*/
|
|
48
|
-
stickyHeaders: { attribute: 'sticky-headers', type: Boolean },
|
|
49
35
|
_data: { state: true },
|
|
50
36
|
_sortField: { attribute: false, type: String },
|
|
51
37
|
_sortDesc: { attribute: false, type: Boolean }
|
|
@@ -62,15 +48,10 @@ class TestTable extends RtlMixin(LitElement) {
|
|
|
62
48
|
|
|
63
49
|
constructor() {
|
|
64
50
|
super();
|
|
65
|
-
this.noColumnBorder = false;
|
|
66
|
-
this.sortDesc = false;
|
|
67
|
-
this.stickyHeaders = false;
|
|
68
|
-
this.type = 'default';
|
|
69
51
|
this._data = data();
|
|
70
52
|
}
|
|
71
53
|
|
|
72
54
|
render() {
|
|
73
|
-
const type = this.type === 'light' ? 'light' : 'default';
|
|
74
55
|
const sorted = this._data.sort((a, b) => {
|
|
75
56
|
if (this._sortDesc) {
|
|
76
57
|
return b.fruit[this._sortField] - a.fruit[this._sortField];
|
|
@@ -78,7 +59,7 @@ class TestTable extends RtlMixin(LitElement) {
|
|
|
78
59
|
return a.fruit[this._sortField] - b.fruit[this._sortField];
|
|
79
60
|
});
|
|
80
61
|
return html`
|
|
81
|
-
<d2l-table-wrapper
|
|
62
|
+
<d2l-table-wrapper>
|
|
82
63
|
<d2l-table-header slot="header" no-sticky>
|
|
83
64
|
<d2l-selection-action icon="tier1:plus-default" text="Add" @d2l-selection-action-click="${this._handleAddItem}"></d2l-selection-action>
|
|
84
65
|
<d2l-selection-action-dropdown text="Move To" requires-selection>
|
|
@@ -7,6 +7,16 @@ import { SelectionHeader } from '../selection/selection-header.js';
|
|
|
7
7
|
* A header for table components containing a selection summary and selection actions.
|
|
8
8
|
*/
|
|
9
9
|
class TableHeader extends SelectionHeader {
|
|
10
|
+
static get properties() {
|
|
11
|
+
return {
|
|
12
|
+
/**
|
|
13
|
+
* Whether to render the selection summary
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
*/
|
|
16
|
+
noSelection: { type: Boolean, attribute: 'no-selection' }
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
_renderSelection() {
|
|
11
21
|
return html`
|
|
12
22
|
<d2l-selection-summary
|
package/custom-elements.json
CHANGED
|
@@ -10601,15 +10601,32 @@
|
|
|
10601
10601
|
},
|
|
10602
10602
|
{
|
|
10603
10603
|
"name": "sticky-headers",
|
|
10604
|
-
"description": "Whether header row is sticky",
|
|
10604
|
+
"description": "Whether the header row is sticky. Useful for long tables to \"stick\" the header row in place as the user scrolls.",
|
|
10605
10605
|
"type": "boolean",
|
|
10606
10606
|
"default": "false"
|
|
10607
10607
|
},
|
|
10608
10608
|
{
|
|
10609
10609
|
"name": "type",
|
|
10610
|
-
"description": "Type of table style to apply",
|
|
10610
|
+
"description": "Type of table style to apply. The \"light\" style has fewer borders and tighter padding.",
|
|
10611
10611
|
"type": "'default'|'light'",
|
|
10612
10612
|
"default": "\"default\""
|
|
10613
|
+
},
|
|
10614
|
+
{
|
|
10615
|
+
"name": "selection-count-override",
|
|
10616
|
+
"description": "ADVANCED: Temporary optional parameter used to override existing count. Will be removed soon, use with caution.",
|
|
10617
|
+
"type": "number"
|
|
10618
|
+
},
|
|
10619
|
+
{
|
|
10620
|
+
"name": "item-count",
|
|
10621
|
+
"description": "Total number of items. Required when selecting all pages is allowed.",
|
|
10622
|
+
"type": "number",
|
|
10623
|
+
"default": "0"
|
|
10624
|
+
},
|
|
10625
|
+
{
|
|
10626
|
+
"name": "selection-single",
|
|
10627
|
+
"description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
|
|
10628
|
+
"type": "boolean",
|
|
10629
|
+
"default": "false"
|
|
10613
10630
|
}
|
|
10614
10631
|
],
|
|
10615
10632
|
"properties": [
|
|
@@ -10620,24 +10637,49 @@
|
|
|
10620
10637
|
"type": "boolean",
|
|
10621
10638
|
"default": "false"
|
|
10622
10639
|
},
|
|
10623
|
-
{
|
|
10624
|
-
"name": "sortDesc",
|
|
10625
|
-
"type": "boolean",
|
|
10626
|
-
"default": "false"
|
|
10627
|
-
},
|
|
10628
10640
|
{
|
|
10629
10641
|
"name": "stickyHeaders",
|
|
10630
10642
|
"attribute": "sticky-headers",
|
|
10631
|
-
"description": "Whether header row is sticky",
|
|
10643
|
+
"description": "Whether the header row is sticky. Useful for long tables to \"stick\" the header row in place as the user scrolls.",
|
|
10632
10644
|
"type": "boolean",
|
|
10633
10645
|
"default": "false"
|
|
10634
10646
|
},
|
|
10635
10647
|
{
|
|
10636
10648
|
"name": "type",
|
|
10637
10649
|
"attribute": "type",
|
|
10638
|
-
"description": "Type of table style to apply",
|
|
10650
|
+
"description": "Type of table style to apply. The \"light\" style has fewer borders and tighter padding.",
|
|
10639
10651
|
"type": "'default'|'light'",
|
|
10640
10652
|
"default": "\"default\""
|
|
10653
|
+
},
|
|
10654
|
+
{
|
|
10655
|
+
"name": "selectionCountOverride",
|
|
10656
|
+
"attribute": "selection-count-override",
|
|
10657
|
+
"description": "ADVANCED: Temporary optional parameter used to override existing count. Will be removed soon, use with caution.",
|
|
10658
|
+
"type": "number"
|
|
10659
|
+
},
|
|
10660
|
+
{
|
|
10661
|
+
"name": "itemCount",
|
|
10662
|
+
"attribute": "item-count",
|
|
10663
|
+
"description": "Total number of items. Required when selecting all pages is allowed.",
|
|
10664
|
+
"type": "number",
|
|
10665
|
+
"default": "0"
|
|
10666
|
+
},
|
|
10667
|
+
{
|
|
10668
|
+
"name": "selectionSingle",
|
|
10669
|
+
"attribute": "selection-single",
|
|
10670
|
+
"description": "Whether to render with single selection behaviour. If `selection-single` is specified, the nested `d2l-selection-input` elements will render radios instead of checkboxes, and the selection component will maintain a single selected item.",
|
|
10671
|
+
"type": "boolean",
|
|
10672
|
+
"default": "false"
|
|
10673
|
+
}
|
|
10674
|
+
],
|
|
10675
|
+
"slots": [
|
|
10676
|
+
{
|
|
10677
|
+
"name": "",
|
|
10678
|
+
"description": "Content to wrap"
|
|
10679
|
+
},
|
|
10680
|
+
{
|
|
10681
|
+
"name": "header",
|
|
10682
|
+
"description": "Slot for `d2l-table-header` to be rendered above the table"
|
|
10641
10683
|
}
|
|
10642
10684
|
]
|
|
10643
10685
|
},
|
|
@@ -10689,7 +10731,7 @@
|
|
|
10689
10731
|
"attributes": [
|
|
10690
10732
|
{
|
|
10691
10733
|
"name": "no-selection",
|
|
10692
|
-
"description": "Whether to render
|
|
10734
|
+
"description": "Whether to render the selection summary",
|
|
10693
10735
|
"type": "boolean",
|
|
10694
10736
|
"default": "false"
|
|
10695
10737
|
},
|
|
@@ -10715,7 +10757,7 @@
|
|
|
10715
10757
|
{
|
|
10716
10758
|
"name": "noSelection",
|
|
10717
10759
|
"attribute": "no-selection",
|
|
10718
|
-
"description": "Whether to render
|
|
10760
|
+
"description": "Whether to render the selection summary",
|
|
10719
10761
|
"type": "boolean",
|
|
10720
10762
|
"default": "false"
|
|
10721
10763
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.75.
|
|
3
|
+
"version": "2.75.5",
|
|
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",
|