@brightspace-ui/core 2.110.0 → 2.110.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/selection/demo/demo-selection.js +18 -1
- package/components/selection/demo/selection.html +44 -3
- package/components/selection/selection-controls.js +2 -2
- package/components/selection/selection-select-all.js +1 -1
- package/components/selection/selection-summary.js +5 -2
- package/custom-elements.json +88 -7
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
|
+
import { PageableMixin } from '../../paging/pageable-mixin.js';
|
|
2
3
|
import { SelectionMixin } from '../selection-mixin.js';
|
|
3
4
|
|
|
4
|
-
class
|
|
5
|
+
class DemoBase extends LitElement {
|
|
5
6
|
static get styles() {
|
|
6
7
|
return css`
|
|
7
8
|
:host {
|
|
@@ -15,4 +16,20 @@ class DemoSelection extends SelectionMixin(LitElement) {
|
|
|
15
16
|
`;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
class DemoSelection extends SelectionMixin(DemoBase) {}
|
|
21
|
+
|
|
22
|
+
class DemoPageable extends PageableMixin(DemoBase) {
|
|
23
|
+
_getItemByIndex() {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
_getItemShowingCount() {
|
|
27
|
+
return 3;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class DemoSelectionPageable extends SelectionMixin(DemoPageable) {}
|
|
32
|
+
|
|
18
33
|
customElements.define('d2l-demo-selection', DemoSelection);
|
|
34
|
+
customElements.define('d2l-demo-pageable', DemoPageable);
|
|
35
|
+
customElements.define('d2l-demo-selection-pageable', DemoSelectionPageable);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import '../../demo/demo-page.js';
|
|
9
9
|
import '../../dropdown/dropdown-menu.js';
|
|
10
10
|
import '../../menu/menu.js';
|
|
11
|
+
import '../../paging/pager-load-more.js';
|
|
11
12
|
import '../selection-action.js';
|
|
12
13
|
import '../selection-action-dropdown.js';
|
|
13
14
|
import '../selection-action-menu-item.js';
|
|
@@ -93,6 +94,45 @@
|
|
|
93
94
|
</template>
|
|
94
95
|
</d2l-demo-snippet>
|
|
95
96
|
|
|
97
|
+
<h2>Selection controls with pageable + selection</h2>
|
|
98
|
+
|
|
99
|
+
<d2l-demo-snippet>
|
|
100
|
+
<template>
|
|
101
|
+
<d2l-demo-selection-pageable item-count="5">
|
|
102
|
+
<d2l-selection-controls select-all-pages-allowed>
|
|
103
|
+
<d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
|
|
104
|
+
<d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
|
|
105
|
+
</d2l-selection-controls>
|
|
106
|
+
|
|
107
|
+
<ul>
|
|
108
|
+
<li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>Geography</li>
|
|
109
|
+
<li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>Science</li>
|
|
110
|
+
<li><d2l-selection-input key="mth" label="Math"></d2l-selection-input>Math</li>
|
|
111
|
+
</ul>
|
|
112
|
+
<d2l-pager-load-more has-more page-size="1"></d2l-pager-load-more>
|
|
113
|
+
</d2l-demo-selection-pageable>
|
|
114
|
+
</template>
|
|
115
|
+
</d2l-demo-snippet>
|
|
116
|
+
|
|
117
|
+
<h2>Selection controls with pageable (no selection)</h2>
|
|
118
|
+
|
|
119
|
+
<d2l-demo-snippet>
|
|
120
|
+
<template>
|
|
121
|
+
<d2l-demo-pageable item-count="5">
|
|
122
|
+
<d2l-selection-controls>
|
|
123
|
+
<d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
|
|
124
|
+
<d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
|
|
125
|
+
</d2l-selection-controls>
|
|
126
|
+
|
|
127
|
+
<ul>
|
|
128
|
+
<li><d2l-selection-input key="geo" label="Geography"></d2l-selection-input>Geography</li>
|
|
129
|
+
<li><d2l-selection-input key="sci" label="Science"></d2l-selection-input>Science</li>
|
|
130
|
+
<li><d2l-selection-input key="mth" label="Math"></d2l-selection-input>Math</li>
|
|
131
|
+
</ul>
|
|
132
|
+
<d2l-pager-load-more has-more page-size="1"></d2l-pager-load-more>
|
|
133
|
+
</d2l-demo-pageable>
|
|
134
|
+
</template>
|
|
135
|
+
</d2l-demo-snippet>
|
|
96
136
|
|
|
97
137
|
<h2>No-sticky selection controls</h2>
|
|
98
138
|
|
|
@@ -120,17 +160,18 @@
|
|
|
120
160
|
<div class="d2l-selection-collections">
|
|
121
161
|
<div class="d2l-selection-collection">
|
|
122
162
|
Pick Your Toppings
|
|
123
|
-
<d2l-selection-controls selection-for="collection-1">
|
|
163
|
+
<d2l-selection-controls selection-for="collection-1" pageable-for="collection-1" select-all-pages-allowed>
|
|
124
164
|
<d2l-selection-action selection-for="collection-1" text="Add Note" icon="tier1:add-message"></d2l-selection-action>
|
|
125
165
|
</d2l-selection-controls>
|
|
126
166
|
|
|
127
|
-
<d2l-demo-selection id="collection-1">
|
|
167
|
+
<d2l-demo-selection-pageable id="collection-1" item-count="5">
|
|
128
168
|
<ul>
|
|
129
169
|
<li><d2l-selection-input key="let" label="Lettuce" selected></d2l-selection-input>Lettuce</li>
|
|
130
170
|
<li><d2l-selection-input key="tom" label="Tomato"></d2l-selection-input>Tomato</li>
|
|
131
171
|
<li><d2l-selection-input key="onion" label="Onion"></d2l-selection-input>Onion</li>
|
|
132
172
|
</ul>
|
|
133
|
-
|
|
173
|
+
<d2l-pager-load-more has-more page-size="1"></d2l-pager-load-more>
|
|
174
|
+
</d2l-demo-selection-pageable>
|
|
134
175
|
<d2l-selection-action selection-for="collection-1" text="Save" requires-selection></d2l-selection-action>
|
|
135
176
|
</div>
|
|
136
177
|
|
|
@@ -181,8 +181,8 @@ export class SelectionControls extends PageableSubscriberMixin(SelectionObserver
|
|
|
181
181
|
|
|
182
182
|
_renderSelection() {
|
|
183
183
|
return html`
|
|
184
|
-
${!this._noSelectAll ? html`<d2l-selection-select-all></d2l-selection-select-all>` : nothing}
|
|
185
|
-
<d2l-selection-summary no-selection-text="${this._noSelectionText}"></d2l-selection-summary>
|
|
184
|
+
${this._provider && !this._noSelectAll ? html`<d2l-selection-select-all></d2l-selection-select-all>` : nothing}
|
|
185
|
+
<d2l-selection-summary no-selection-text="${ifDefined(this._noSelectionText)}"></d2l-selection-summary>
|
|
186
186
|
${this.selectAllPagesAllowed ? html`<d2l-selection-select-all-pages></d2l-selection-select-all-pages>` : nothing}
|
|
187
187
|
`;
|
|
188
188
|
}
|
|
@@ -44,7 +44,7 @@ class SelectAll extends FocusMixin(LocalizeCoreElement(SelectionObserverMixin(Li
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
render() {
|
|
47
|
-
if (this._provider
|
|
47
|
+
if (!this._provider || this._provider.selectionSingle) return;
|
|
48
48
|
|
|
49
49
|
const summary = (this.selectionInfo.state === SelectionInfo.states.none ? this.localize('components.selection.select-all')
|
|
50
50
|
: this.localize('components.selection.selected', 'count', this.selectionInfo.keys.length));
|
|
@@ -50,7 +50,10 @@ class Summary extends LocalizeCoreElement(SelectionObserverMixin(LitElement)) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
_updateSelectSummary() {
|
|
53
|
-
if (this._provider
|
|
53
|
+
if (this._provider?.selectionSingle) {
|
|
54
|
+
this._summary = null;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
54
57
|
|
|
55
58
|
let count;
|
|
56
59
|
if (this._provider && this._provider.selectionCountOverride !== undefined) {
|
|
@@ -74,7 +77,7 @@ class Summary extends LocalizeCoreElement(SelectionObserverMixin(LitElement)) {
|
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
count = this.selectionInfo.state === SelectionInfo.states.allPages ?
|
|
80
|
+
count = (this._provider && this.selectionInfo.state === SelectionInfo.states.allPages) ?
|
|
78
81
|
this._provider.itemCount : this.selectionInfo.keys.length;
|
|
79
82
|
|
|
80
83
|
if (this.selectionInfo.state === SelectionInfo.states.none && this.noSelectionText) {
|
package/custom-elements.json
CHANGED
|
@@ -10262,6 +10262,68 @@
|
|
|
10262
10262
|
}
|
|
10263
10263
|
]
|
|
10264
10264
|
},
|
|
10265
|
+
{
|
|
10266
|
+
"name": "d2l-demo-pageable",
|
|
10267
|
+
"path": "./components/selection/demo/demo-selection.js",
|
|
10268
|
+
"attributes": [
|
|
10269
|
+
{
|
|
10270
|
+
"name": "item-count",
|
|
10271
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10272
|
+
"type": "number"
|
|
10273
|
+
}
|
|
10274
|
+
],
|
|
10275
|
+
"properties": [
|
|
10276
|
+
{
|
|
10277
|
+
"name": "itemCount",
|
|
10278
|
+
"attribute": "item-count",
|
|
10279
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10280
|
+
"type": "number"
|
|
10281
|
+
}
|
|
10282
|
+
]
|
|
10283
|
+
},
|
|
10284
|
+
{
|
|
10285
|
+
"name": "d2l-demo-selection-pageable",
|
|
10286
|
+
"path": "./components/selection/demo/demo-selection.js",
|
|
10287
|
+
"attributes": [
|
|
10288
|
+
{
|
|
10289
|
+
"name": "selection-count-override",
|
|
10290
|
+
"description": "ADVANCED: Temporary optional parameter used to override existing count. Will be removed soon, use with caution.",
|
|
10291
|
+
"type": "number"
|
|
10292
|
+
},
|
|
10293
|
+
{
|
|
10294
|
+
"name": "selection-single",
|
|
10295
|
+
"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.",
|
|
10296
|
+
"type": "boolean",
|
|
10297
|
+
"default": "false"
|
|
10298
|
+
},
|
|
10299
|
+
{
|
|
10300
|
+
"name": "item-count",
|
|
10301
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10302
|
+
"type": "number"
|
|
10303
|
+
}
|
|
10304
|
+
],
|
|
10305
|
+
"properties": [
|
|
10306
|
+
{
|
|
10307
|
+
"name": "selectionCountOverride",
|
|
10308
|
+
"attribute": "selection-count-override",
|
|
10309
|
+
"description": "ADVANCED: Temporary optional parameter used to override existing count. Will be removed soon, use with caution.",
|
|
10310
|
+
"type": "number"
|
|
10311
|
+
},
|
|
10312
|
+
{
|
|
10313
|
+
"name": "selectionSingle",
|
|
10314
|
+
"attribute": "selection-single",
|
|
10315
|
+
"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.",
|
|
10316
|
+
"type": "boolean",
|
|
10317
|
+
"default": "false"
|
|
10318
|
+
},
|
|
10319
|
+
{
|
|
10320
|
+
"name": "itemCount",
|
|
10321
|
+
"attribute": "item-count",
|
|
10322
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10323
|
+
"type": "number"
|
|
10324
|
+
}
|
|
10325
|
+
]
|
|
10326
|
+
},
|
|
10265
10327
|
{
|
|
10266
10328
|
"name": "d2l-selection-action-dropdown",
|
|
10267
10329
|
"path": "./components/selection/selection-action-dropdown.js",
|
|
@@ -10971,7 +11033,21 @@
|
|
|
10971
11033
|
"name": "item-count",
|
|
10972
11034
|
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10973
11035
|
"type": "number"
|
|
10974
|
-
}
|
|
11036
|
+
}
|
|
11037
|
+
],
|
|
11038
|
+
"properties": [
|
|
11039
|
+
{
|
|
11040
|
+
"name": "itemCount",
|
|
11041
|
+
"attribute": "item-count",
|
|
11042
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
11043
|
+
"type": "number"
|
|
11044
|
+
}
|
|
11045
|
+
]
|
|
11046
|
+
},
|
|
11047
|
+
{
|
|
11048
|
+
"name": "d2l-test-selection-pageable",
|
|
11049
|
+
"path": "./components/selection/test/selection-component.js",
|
|
11050
|
+
"attributes": [
|
|
10975
11051
|
{
|
|
10976
11052
|
"name": "selection-count-override",
|
|
10977
11053
|
"description": "ADVANCED: Temporary optional parameter used to override existing count. Will be removed soon, use with caution.",
|
|
@@ -10982,15 +11058,14 @@
|
|
|
10982
11058
|
"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.",
|
|
10983
11059
|
"type": "boolean",
|
|
10984
11060
|
"default": "false"
|
|
10985
|
-
}
|
|
10986
|
-
],
|
|
10987
|
-
"properties": [
|
|
11061
|
+
},
|
|
10988
11062
|
{
|
|
10989
|
-
"name": "
|
|
10990
|
-
"attribute": "item-count",
|
|
11063
|
+
"name": "item-count",
|
|
10991
11064
|
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
10992
11065
|
"type": "number"
|
|
10993
|
-
}
|
|
11066
|
+
}
|
|
11067
|
+
],
|
|
11068
|
+
"properties": [
|
|
10994
11069
|
{
|
|
10995
11070
|
"name": "selectionCountOverride",
|
|
10996
11071
|
"attribute": "selection-count-override",
|
|
@@ -11003,6 +11078,12 @@
|
|
|
11003
11078
|
"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.",
|
|
11004
11079
|
"type": "boolean",
|
|
11005
11080
|
"default": "false"
|
|
11081
|
+
},
|
|
11082
|
+
{
|
|
11083
|
+
"name": "itemCount",
|
|
11084
|
+
"attribute": "item-count",
|
|
11085
|
+
"description": "Total number of items. If not specified, features like select-all-pages will be disabled.",
|
|
11086
|
+
"type": "number"
|
|
11006
11087
|
}
|
|
11007
11088
|
]
|
|
11008
11089
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.110.
|
|
3
|
+
"version": "2.110.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",
|