@brightspace-ui-labs/facet-filter-sort 6.4.0 → 6.6.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.
package/README.md
CHANGED
|
@@ -126,10 +126,10 @@ Note that for the header and opener text overrides, if the terms are to reflect
|
|
|
126
126
|
|
|
127
127
|
- `d2l-labs-filter-dropdown-close`: Fired when the filter dropdown is closed.
|
|
128
128
|
- `d2l-labs-filter-dropdown-cleared`: Fired when the clear button or the clear filters button is pressed to clear all filters.
|
|
129
|
+
- `d2l-labs-filter-dropdown-category-selected`: Fired when a filter tab is selected.
|
|
129
130
|
|
|
130
131
|
`d2l-labs-filter-dropdown-category`:
|
|
131
132
|
|
|
132
|
-
- `d2l-labs-filter-dropdown-category-selected`: Fired when a filter tab is selected.
|
|
133
133
|
- `d2l-labs-filter-dropdown-category-searched`: Fired when a filter category is searched.
|
|
134
134
|
- `d2l-labs-filter-dropdown-option-change`: Fired when a filter option is selected.
|
|
135
135
|
|
|
@@ -102,10 +102,6 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
102
102
|
this.selected = !this.selected;
|
|
103
103
|
this.__onSelect(e);
|
|
104
104
|
});
|
|
105
|
-
|
|
106
|
-
this.addEventListener('d2l-tab-panel-selected', () => {
|
|
107
|
-
this._dispatchSelected();
|
|
108
|
-
});
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
render() {
|
|
@@ -123,17 +119,6 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
123
119
|
`;
|
|
124
120
|
}
|
|
125
121
|
|
|
126
|
-
_dispatchSelected() {
|
|
127
|
-
// Event propagation of d2l-tab-panel-selected stopped in d2l-labs-filter-dropdown
|
|
128
|
-
this.dispatchEvent(new CustomEvent('d2l-labs-filter-dropdown-category-selected', {
|
|
129
|
-
detail: {
|
|
130
|
-
categoryKey: this.key
|
|
131
|
-
},
|
|
132
|
-
bubbles: true,
|
|
133
|
-
composed: true
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
122
|
_handleMenuItemChange(e) {
|
|
138
123
|
e.stopPropagation();
|
|
139
124
|
this.dispatchEvent(new CustomEvent('d2l-labs-filter-dropdown-option-change', {
|
|
@@ -5,12 +5,9 @@ import '@brightspace-ui/core/components/dropdown/dropdown-tabs.js';
|
|
|
5
5
|
import '@brightspace-ui/core/components/tabs/tabs.js';
|
|
6
6
|
import '@brightspace-ui/core/components/tabs/tab.js';
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
|
-
import { getFlag } from '@brightspace-ui/core/helpers/flags.js';
|
|
9
8
|
import { LocalizeBehavior } from '../localize-behavior.js';
|
|
10
9
|
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
11
10
|
|
|
12
|
-
const useTabsNewStructure = getFlag('GAUD-7146-tabs-new-structure', true);
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* A component containing filter options and emitting selection events
|
|
16
13
|
* @slot - Contents of the dropdown, including filter categories and options
|
|
@@ -92,10 +89,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
92
89
|
type: Boolean,
|
|
93
90
|
value: false
|
|
94
91
|
},
|
|
95
|
-
_useNewStructure: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
value: useTabsNewStructure
|
|
98
|
-
},
|
|
99
92
|
_tabInfos: {
|
|
100
93
|
type: Array,
|
|
101
94
|
value: () => []
|
|
@@ -139,15 +132,10 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
139
132
|
<d2l-button-subtle text="[[localize('clear')]]" hidden$="[[!totalSelectedOptionCount]]" on-click="clearFilters"></d2l-button-subtle>
|
|
140
133
|
</div>
|
|
141
134
|
<d2l-tabs>
|
|
142
|
-
<template is="dom-
|
|
143
|
-
<slot></
|
|
144
|
-
</template>
|
|
145
|
-
<template is="dom-if" if="[[_useNewStructure]]">
|
|
146
|
-
<template is="dom-repeat" items="[[_tabInfos]]" as="tab">
|
|
147
|
-
<d2l-tab id="[[tab.key]]" text="[[tab.text]]" slot="tabs" selected$="[[tab.selected]]"></d2l-tab>
|
|
148
|
-
</template>
|
|
149
|
-
<slot on-slotchange="_handleCategoriesSlotChange" slot="panels"></slot>
|
|
135
|
+
<template is="dom-repeat" items="[[_tabInfos]]" as="tab">
|
|
136
|
+
<d2l-tab id="[[tab.key]]" text="[[tab.text]]" slot="tabs" selected$="[[tab.selected]]" on-d2l-tab-selected="_dispatchSelected"></d2l-tab>
|
|
150
137
|
</template>
|
|
138
|
+
<slot on-slotchange="_handleCategoriesSlotChange" slot="panels"></slot>
|
|
151
139
|
</d2l-tabs>
|
|
152
140
|
<slot name="footer" slot="[[_getFooterSlotValue(_hasFooter)]]" on-slotchange="_handleFooterSlotChange"></slot>
|
|
153
141
|
</d2l-dropdown-tabs>
|
|
@@ -157,7 +145,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
157
145
|
|
|
158
146
|
attached() {
|
|
159
147
|
this.addEventListener('d2l-dropdown-close', this._handleDropdownClose);
|
|
160
|
-
this.addEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
161
148
|
}
|
|
162
149
|
|
|
163
150
|
clearFilters() {
|
|
@@ -178,23 +165,30 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
178
165
|
|
|
179
166
|
detached() {
|
|
180
167
|
this.removeEventListener('d2l-dropdown-close', this._handleDropdownClose);
|
|
181
|
-
this.removeEventListener('d2l-tab-panel-selected', this._stopTabPanelSelectedEvent);
|
|
182
168
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
}
|
|
169
|
+
const categories = this.querySelectorAll('d2l-labs-filter-dropdown-category');
|
|
170
|
+
categories.forEach(cat => {
|
|
171
|
+
if (cat.__tabInfoObserver) {
|
|
172
|
+
cat.__tabInfoObserver.disconnect();
|
|
173
|
+
delete cat.__tabInfoObserver;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
192
176
|
}
|
|
193
177
|
|
|
194
178
|
focus() {
|
|
195
179
|
this.shadowRoot.querySelector('d2l-dropdown-button-subtle').focus();
|
|
196
180
|
}
|
|
197
181
|
|
|
182
|
+
_dispatchSelected(e) {
|
|
183
|
+
this.dispatchEvent(new CustomEvent('d2l-labs-filter-dropdown-category-selected', {
|
|
184
|
+
detail: {
|
|
185
|
+
categoryKey: e.target.id
|
|
186
|
+
},
|
|
187
|
+
bubbles: true,
|
|
188
|
+
composed: true
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
|
|
198
192
|
_getFooterSlotValue(hasFooter) {
|
|
199
193
|
return hasFooter ? 'footer' : undefined;
|
|
200
194
|
}
|
|
@@ -212,8 +206,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
212
206
|
}
|
|
213
207
|
|
|
214
208
|
async _handleCategoriesSlotChange() {
|
|
215
|
-
if (!this._useNewStructure) return;
|
|
216
|
-
|
|
217
209
|
const tabsContainer = this.shadowRoot.querySelector('d2l-tabs');
|
|
218
210
|
const categories = this.querySelectorAll('d2l-labs-filter-dropdown-category');
|
|
219
211
|
|
|
@@ -267,11 +259,6 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
267
259
|
if (!this.localize || !this.resources) return;
|
|
268
260
|
return altText ? altText : this.localize(...args);
|
|
269
261
|
}
|
|
270
|
-
|
|
271
|
-
// Must be done here (instead of d2l-labs-filter-dropdown-category) as the d2l-dropdown-tabs component needs to receive it
|
|
272
|
-
_stopTabPanelSelectedEvent(e) {
|
|
273
|
-
e.stopPropagation();
|
|
274
|
-
}
|
|
275
262
|
}
|
|
276
263
|
|
|
277
264
|
window.customElements.define(D2LLabsFilterDropdown.is, D2LLabsFilterDropdown);
|
package/custom-elements.json
CHANGED