@brightspace-ui-labs/facet-filter-sort 6.7.5 → 6.8.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.
|
@@ -37,7 +37,8 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
37
37
|
/**
|
|
38
38
|
* The number of selected filter options for that filter category. When options are selected and de-selected, the consumer is responsible for updating this number after updating its own data store.
|
|
39
39
|
*/
|
|
40
|
-
selectedOptionCount: { type: Number, attribute: 'selected-option-count' }
|
|
40
|
+
selectedOptionCount: { type: Number, attribute: 'selected-option-count' },
|
|
41
|
+
_text: { type: String, attribute: '_text', reflect: true }
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -96,14 +97,6 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
firstUpdated(changedProperties) {
|
|
100
|
-
super.firstUpdated(changedProperties);
|
|
101
|
-
this.addEventListener('d2l-menu-item-select', (e) => {
|
|
102
|
-
this.selected = !this.selected;
|
|
103
|
-
this.__onSelect(e);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
100
|
render() {
|
|
108
101
|
return html`
|
|
109
102
|
<div class="d2l-labs-filter-dropdown-page-search" ?hidden="${this.disableSearch}">
|
|
@@ -113,7 +106,7 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
113
106
|
value="${ifDefined(this.searchValue)}">
|
|
114
107
|
</d2l-input-search>
|
|
115
108
|
</div>
|
|
116
|
-
<d2l-menu @d2l-menu-item-change="${this._handleMenuItemChange}" label="${this.
|
|
109
|
+
<d2l-menu @d2l-menu-item-change="${this._handleMenuItemChange}" label="${this._text}">
|
|
117
110
|
<slot @slotchange="${this._onSlotChange}"></slot>
|
|
118
111
|
</d2l-menu>
|
|
119
112
|
`;
|
|
@@ -152,11 +145,10 @@ class LabsFilterDropdownCategory extends FilterLocalizeMixin(TabPanelMixin(LitEl
|
|
|
152
145
|
|
|
153
146
|
_updateTabText(categoryText, selectedOptionCount) {
|
|
154
147
|
if (selectedOptionCount === 0) {
|
|
155
|
-
this.
|
|
148
|
+
this._text = categoryText;
|
|
156
149
|
} else {
|
|
157
|
-
this.
|
|
150
|
+
this._text = this.localize('categoryTitleMultiple', 'title', categoryText, 'numSelected', selectedOptionCount);
|
|
158
151
|
}
|
|
159
|
-
this.requestUpdate();
|
|
160
152
|
}
|
|
161
153
|
|
|
162
154
|
}
|
|
@@ -133,7 +133,7 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
133
133
|
</div>
|
|
134
134
|
<d2l-tabs>
|
|
135
135
|
<template is="dom-repeat" items="[[_tabInfos]]" as="tab">
|
|
136
|
-
<d2l-tab id="[[tab.key]]" text="[[tab.text]]" slot="tabs"
|
|
136
|
+
<d2l-tab id="[[tab.key]]" text="[[tab.text]]" slot="tabs" on-d2l-tab-selected="_dispatchSelected"></d2l-tab>
|
|
137
137
|
</template>
|
|
138
138
|
<slot on-slotchange="_handleCategoriesSlotChange" slot="panels"></slot>
|
|
139
139
|
</d2l-tabs>
|
|
@@ -215,24 +215,22 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
215
215
|
const tabInfos = [];
|
|
216
216
|
categories.forEach((category, index) => {
|
|
217
217
|
const key = category.getAttribute('key') || `category-${index}`;
|
|
218
|
-
const text = category.
|
|
219
|
-
const isSelected = category._selected;
|
|
218
|
+
const text = category._text;
|
|
220
219
|
|
|
221
220
|
category.setAttribute('labelled-by', key);
|
|
222
|
-
tabInfos.push({ key, text
|
|
221
|
+
tabInfos.push({ key, text });
|
|
223
222
|
|
|
224
223
|
if (!category.__tabInfoObserver) {
|
|
225
224
|
category.__tabInfoObserver = new MutationObserver(() => {
|
|
226
|
-
const newText = category.
|
|
227
|
-
const newSelected = category._selected;
|
|
225
|
+
const newText = category._text;
|
|
228
226
|
|
|
229
227
|
this._tabInfos = this._tabInfos.map(info => {
|
|
230
228
|
return info.key === key
|
|
231
|
-
? { ...info, text: newText
|
|
229
|
+
? { ...info, text: newText }
|
|
232
230
|
: info;
|
|
233
231
|
});
|
|
234
232
|
});
|
|
235
|
-
category.__tabInfoObserver.observe(category, { attributes: true, attributeFilter: ['
|
|
233
|
+
category.__tabInfoObserver.observe(category, { attributes: true, attributeFilter: ['_text'] });
|
|
236
234
|
}
|
|
237
235
|
});
|
|
238
236
|
|