@brightspace-ui/core 1.212.0 → 1.213.0

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.
@@ -212,6 +212,25 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
212
212
  `;
213
213
  }
214
214
 
215
+ focus() {
216
+ const opener = this.shadowRoot.querySelector('d2l-dropdown-button-subtle');
217
+ if (opener) opener.focus();
218
+ }
219
+
220
+ requestFilterClearAll() {
221
+ this._handleClearAll();
222
+ }
223
+
224
+ requestFilterValueClear(keyObject) {
225
+ const dimension = this._dimensions.find(dimension => dimension.key === keyObject.dimension);
226
+
227
+ switch (dimension.type) {
228
+ case 'd2l-filter-dimension-set':
229
+ this._performChangeSetDimension(dimension, keyObject.value, false);
230
+ break;
231
+ }
232
+ }
233
+
215
234
  _buildDimension(dimension, singleDimension) {
216
235
  let dimensionHTML;
217
236
  switch (dimension.type) {
@@ -433,20 +452,9 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
433
452
  const dimensionKey = e.target.id.slice(SET_DIMENSION_ID_PREFIX.length);
434
453
  const dimension = this._dimensions.find(dimension => dimension.key === dimensionKey);
435
454
  const valueKey = e.detail.key;
436
- const value = dimension.values.find(value => value.key === valueKey);
437
455
  const selected = e.detail.selected;
438
456
 
439
- value.selected = selected;
440
-
441
- if (selected) {
442
- dimension.appliedCount++;
443
- this._totalAppliedCount++;
444
- } else {
445
- dimension.appliedCount--;
446
- this._totalAppliedCount--;
447
- }
448
-
449
- this._dispatchChangeEvent(dimension, { valueKey: valueKey, selected: selected });
457
+ this._performChangeSetDimension(dimension, valueKey, selected);
450
458
  }
451
459
 
452
460
  _handleClear() {
@@ -621,6 +629,22 @@ class Filter extends LocalizeCoreElement(RtlMixin(LitElement)) {
621
629
  return false;
622
630
  }
623
631
 
632
+ _performChangeSetDimension(dimension, valueKey, selected) {
633
+ const value = dimension.values.find(value => value.key === valueKey);
634
+ if (value.selected === selected) return;
635
+ value.selected = selected;
636
+
637
+ if (selected) {
638
+ dimension.appliedCount++;
639
+ this._totalAppliedCount++;
640
+ } else {
641
+ dimension.appliedCount--;
642
+ this._totalAppliedCount--;
643
+ }
644
+
645
+ this._dispatchChangeEvent(dimension, { valueKey: valueKey, selected: selected });
646
+ }
647
+
624
648
  _performDimensionClear(dimension) {
625
649
  this._totalAppliedCount = this._totalAppliedCount - dimension.appliedCount;
626
650
  dimension.appliedCount = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.212.0",
3
+ "version": "1.213.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",