@brightspace-ui-labs/facet-filter-sort 6.2.1 → 6.3.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.
|
@@ -3,12 +3,9 @@ import '@brightspace-ui/core/components/inputs/input-search.js';
|
|
|
3
3
|
import '@brightspace-ui/core/components/menu/menu.js';
|
|
4
4
|
import { css, html, LitElement } from 'lit';
|
|
5
5
|
import { FilterLocalizeMixin } from '../localize-mixin.js';
|
|
6
|
-
import { getFlag } from '@brightspace-ui/core/helpers/flags.js';
|
|
7
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
7
|
import { TabPanelMixin } from '@brightspace-ui/core/components/tabs/tab-panel-mixin.js';
|
|
9
8
|
|
|
10
|
-
const useTabsNewStructure = getFlag('GAUD-7146-tabs-new-structure', false);
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* A component wrapping grouped filters
|
|
14
11
|
* @slot - Contains the filters (e.g., d2l-labs-filter-dropdown-option) that are in the category
|
|
@@ -106,11 +103,9 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
106
103
|
this.__onSelect(e);
|
|
107
104
|
});
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
}
|
|
106
|
+
this.addEventListener('d2l-tab-panel-selected', () => {
|
|
107
|
+
this._dispatchSelected();
|
|
108
|
+
});
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
render() {
|
|
@@ -9,7 +9,7 @@ import { getFlag } from '@brightspace-ui/core/helpers/flags.js';
|
|
|
9
9
|
import { LocalizeBehavior } from '../localize-behavior.js';
|
|
10
10
|
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
11
11
|
|
|
12
|
-
const useTabsNewStructure = getFlag('GAUD-7146-tabs-new-structure',
|
|
12
|
+
const useTabsNewStructure = getFlag('GAUD-7146-tabs-new-structure', true);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A component containing filter options and emitting selection events
|
|
@@ -157,12 +157,7 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
157
157
|
|
|
158
158
|
attached() {
|
|
159
159
|
this.addEventListener('d2l-dropdown-close', this._handleDropdownClose);
|
|
160
|
-
|
|
161
|
-
if (this._useNewStructure) {
|
|
162
|
-
this.addEventListener('d2l-tab-selected', this._handleTabSelected);
|
|
163
|
-
} else {
|
|
164
|
-
this.addEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
165
|
-
}
|
|
160
|
+
this.addEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
166
161
|
}
|
|
167
162
|
|
|
168
163
|
clearFilters() {
|
|
@@ -183,9 +178,9 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
183
178
|
|
|
184
179
|
detached() {
|
|
185
180
|
this.removeEventListener('d2l-dropdown-close', this._handleDropdownClose);
|
|
181
|
+
this.removeEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
186
182
|
|
|
187
183
|
if (this._useNewStructure) {
|
|
188
|
-
this.removeEventListener('d2l-tab-selected', this._handleTabSelected);
|
|
189
184
|
const categories = this.querySelectorAll('d2l-labs-filter-dropdown-category');
|
|
190
185
|
categories.forEach(cat => {
|
|
191
186
|
if (cat.__tabInfoObserver) {
|
|
@@ -193,8 +188,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
193
188
|
delete cat.__tabInfoObserver;
|
|
194
189
|
}
|
|
195
190
|
});
|
|
196
|
-
} else {
|
|
197
|
-
this.removeEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
198
191
|
}
|
|
199
192
|
}
|
|
200
193
|
|
|
@@ -270,19 +263,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
270
263
|
this._hasFooter = e.target.assignedNodes().length !== 0;
|
|
271
264
|
}
|
|
272
265
|
|
|
273
|
-
_handleTabSelected(e) {
|
|
274
|
-
e.stopPropagation();
|
|
275
|
-
if (!this._useNewStructure) return;
|
|
276
|
-
|
|
277
|
-
// Find the corresponding category and dispatch the selection event
|
|
278
|
-
const tabId = e.target.id;
|
|
279
|
-
const category = this.querySelector(`d2l-labs-filter-dropdown-category[key="${tabId}"]`);
|
|
280
|
-
|
|
281
|
-
if (category) {
|
|
282
|
-
category._dispatchSelected();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
266
|
_localizeOrAlt(altText, ...args) {
|
|
287
267
|
if (!this.localize || !this.resources) return;
|
|
288
268
|
return altText ? altText : this.localize(...args);
|