@fluid-topics/ft-filter 1.2.48 → 1.2.50
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/build/ft-filter-level.d.ts +2 -0
- package/build/ft-filter-level.js +23 -2
- package/build/ft-filter.js +18 -7
- package/build/ft-filter.light.js +86 -85
- package/build/ft-filter.min.js +65 -64
- package/package.json +10 -10
|
@@ -21,6 +21,8 @@ export declare class FtFilterLevel extends FtLitElement {
|
|
|
21
21
|
get hasHiddenValues(): boolean;
|
|
22
22
|
private get limit();
|
|
23
23
|
get height(): number;
|
|
24
|
+
focusOnBackButton(): void;
|
|
25
|
+
focusOnExpandButton(value: string): void;
|
|
24
26
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
25
27
|
private goBackOnKeyPress;
|
|
26
28
|
private goBackOnClick;
|
package/build/ft-filter-level.js
CHANGED
|
@@ -41,6 +41,19 @@ class FtFilterLevel extends FtLitElement {
|
|
|
41
41
|
var _a, _b;
|
|
42
42
|
return (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.scrollHeight) !== null && _b !== void 0 ? _b : 0;
|
|
43
43
|
}
|
|
44
|
+
focusOnBackButton() {
|
|
45
|
+
this.elementToFocus = {
|
|
46
|
+
selector: `.ft-filter-level--go-back`,
|
|
47
|
+
isKeyboardNavigation: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
focusOnExpandButton(value) {
|
|
51
|
+
// Find the correct expand button associated with the checkbox value
|
|
52
|
+
this.elementToFocus = {
|
|
53
|
+
selector: `.ft-filter-level--option ft-button[part="controls navigate-hierarchy"][data-value="${value}"]`,
|
|
54
|
+
isKeyboardNavigation: true,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
44
57
|
render() {
|
|
45
58
|
let options = [...this.options];
|
|
46
59
|
if (this.hideSelectedOptions) {
|
|
@@ -84,6 +97,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
84
97
|
<ft-button icon="thin_arrow_right"
|
|
85
98
|
part="controls navigate-hierarchy"
|
|
86
99
|
aria-label="Expand node"
|
|
100
|
+
data-value="${option.value}"
|
|
87
101
|
?disabled=${this.disabled}
|
|
88
102
|
hideTooltip
|
|
89
103
|
@click=${() => this.displayLevel(option)}></ft-button>
|
|
@@ -115,13 +129,20 @@ class FtFilterLevel extends FtLitElement {
|
|
|
115
129
|
this.dispatchEvent(new CustomEvent("go-back", { detail: this.parent }));
|
|
116
130
|
}
|
|
117
131
|
displayMore() {
|
|
132
|
+
var _a;
|
|
133
|
+
const previousLimit = (_a = this.limit) !== null && _a !== void 0 ? _a : 0;
|
|
118
134
|
this.displayedPages++;
|
|
135
|
+
// Wait for the component update before focusing on the first new option
|
|
136
|
+
this.elementToFocus = {
|
|
137
|
+
selector: `.ft-filter-level--option:nth-child(${previousLimit + 2}) [part~="option"]`,
|
|
138
|
+
isKeyboardNavigation: true,
|
|
139
|
+
};
|
|
119
140
|
}
|
|
120
141
|
buildMultiValuedOption(option) {
|
|
121
142
|
var _a;
|
|
122
143
|
return html `
|
|
123
144
|
<ft-checkbox name="${this.filterId}"
|
|
124
|
-
part="multivalued-option"
|
|
145
|
+
part="multivalued-option option"
|
|
125
146
|
data-value="${option.value}"
|
|
126
147
|
.checked=${option.selected}
|
|
127
148
|
.disabled=${this.disabled}
|
|
@@ -134,7 +155,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
134
155
|
buildMonoValuedOption(option) {
|
|
135
156
|
return html `
|
|
136
157
|
<ft-radio name="${this.filterId + Math.round(Math.random() * 1000000)}"
|
|
137
|
-
part="monovalued-option"
|
|
158
|
+
part="monovalued-option option"
|
|
138
159
|
data-value="${option.value}"
|
|
139
160
|
value="${option.value}"
|
|
140
161
|
.checked=${option.selected}
|
package/build/ft-filter.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { property, query, queryAll, state } from "lit/decorators.js";
|
|
9
|
-
import { Debouncer, deepEqual, flatDeep, FtLitElement, jsonProperty } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { Debouncer, deepEqual, flatDeep, FtLitElement, jsonProperty, waitUntil } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
11
11
|
import { FtFilterLevel } from "./ft-filter-level";
|
|
12
12
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
@@ -102,7 +102,7 @@ class FtFilter extends FtLitElement {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
contentAvailableCallback(props) {
|
|
105
|
-
var _a, _b, _c, _d, _e;
|
|
105
|
+
var _a, _b, _c, _d, _e, _f;
|
|
106
106
|
super.contentAvailableCallback(props);
|
|
107
107
|
if (this.valuesContainer) {
|
|
108
108
|
this.scrollResizeObserver.observe(this.valuesContainer);
|
|
@@ -115,20 +115,19 @@ class FtFilter extends FtLitElement {
|
|
|
115
115
|
(_a = this.levelsContainer) === null || _a === void 0 ? void 0 : _a.scrollToIndex(this.displayedLevels.length);
|
|
116
116
|
}
|
|
117
117
|
if (props.has("slideIn") && this.slideIn) {
|
|
118
|
+
(_b = this.levelsContainer) === null || _b === void 0 ? void 0 : _b.next();
|
|
118
119
|
setTimeout(() => {
|
|
119
|
-
var _a;
|
|
120
|
-
(_a = this.levelsContainer) === null || _a === void 0 ? void 0 : _a.next();
|
|
121
120
|
this.slideIn = undefined;
|
|
122
|
-
},
|
|
121
|
+
}, 300);
|
|
123
122
|
}
|
|
124
123
|
if (props.has("slideOut") && this.slideOut) {
|
|
125
|
-
(
|
|
124
|
+
(_c = this.levelsContainer) === null || _c === void 0 ? void 0 : _c.previous();
|
|
126
125
|
setTimeout(() => {
|
|
127
126
|
this.displayedLevels.pop();
|
|
128
127
|
this.slideOut = undefined;
|
|
129
128
|
}, 300);
|
|
130
129
|
}
|
|
131
|
-
this.lastLevelHasHiddenvalues = (
|
|
130
|
+
this.lastLevelHasHiddenvalues = (_f = (_e = (_d = this.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector(".ft-filter--levels ft-filter-level:last-child")) === null || _e === void 0 ? void 0 : _e.hasHiddenValues) !== null && _f !== void 0 ? _f : false;
|
|
132
131
|
}
|
|
133
132
|
renderLevels() {
|
|
134
133
|
const allOptions = this.flatOptions;
|
|
@@ -200,10 +199,22 @@ class FtFilter extends FtLitElement {
|
|
|
200
199
|
}
|
|
201
200
|
goBack(e) {
|
|
202
201
|
this.slideOut = e.detail.value;
|
|
202
|
+
// After the animation completes, move focus to the navigate-hierarchy button
|
|
203
|
+
waitUntil(() => this.slideOut === undefined).then(() => {
|
|
204
|
+
var _a;
|
|
205
|
+
const previousLevel = (_a = this.levelsContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".ft-filter--level-center");
|
|
206
|
+
previousLevel === null || previousLevel === void 0 ? void 0 : previousLevel.focusOnExpandButton(e.detail.value);
|
|
207
|
+
});
|
|
203
208
|
}
|
|
204
209
|
onDisplayLevel(e) {
|
|
205
210
|
this.displayedLevels.push(e.detail.value);
|
|
206
211
|
this.slideIn = e.detail.value;
|
|
212
|
+
// After the animation completes, move focus to the go back button
|
|
213
|
+
waitUntil(() => this.slideIn === undefined).then(() => {
|
|
214
|
+
var _a;
|
|
215
|
+
const newLevel = (_a = this.levelsContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".ft-filter--level-center");
|
|
216
|
+
newLevel === null || newLevel === void 0 ? void 0 : newLevel.focusOnBackButton();
|
|
217
|
+
});
|
|
207
218
|
}
|
|
208
219
|
clear() {
|
|
209
220
|
this.flatOptions.forEach(o => o.selected = false);
|