Skip to content

Commit ead2ffc

Browse files
add no result page to members filters
1 parent 0bdd1d7 commit ead2ffc

File tree

4 files changed

+360
-276
lines changed

4 files changed

+360
-276
lines changed

scaladoc/resources/dotty_res/scripts/components/DocumentableList.js

Lines changed: 79 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,85 @@
55
*/
66

77
class DocumentableList extends Component {
8-
constructor(props) {
9-
super(props);
10-
11-
this.refs = {
12-
tabs: findRefs(".names .tab[data-togglable]", findRef(".membersList")).concat(
13-
findRefs(".contents h2[data-togglable]", findRef(".membersList"))
14-
),
15-
sections: findRefs(".contents .tab[data-togglable]", findRef(".membersList")),
16-
};
17-
18-
this.state = {
19-
list: new List(this.refs.tabs, this.refs.sections),
20-
};
21-
22-
this.render(this.props);
23-
}
24-
25-
toggleElementDatasetVisibility(isVisible, ref) {
26-
ref.dataset.visibility = isVisible
27-
}
28-
29-
toggleDisplayStyles(condition, ref) {
30-
console.log(ref);
31-
ref.style.display = condition ? null : 'none'
32-
}
33-
34-
render({ filter }) {
35-
this.state.list.sectionsRefs.map(sectionRef => {
36-
const isTabVisible = this.state.list
37-
.getSectionListRefs(sectionRef)
38-
.filter((listRef) => {
39-
const isListVisible = this.state.list
40-
.getSectionListElementsRefs(listRef)
41-
.map(elementRef => this.state.list.toListElement(elementRef))
42-
.filter(elementData => {
43-
const isElementVisible = this.state.list.isElementVisible(elementData, filter);
44-
45-
this.toggleDisplayStyles(isElementVisible, elementData.ref);
46-
this.toggleElementDatasetVisibility(isElementVisible, elementData.ref);
47-
48-
return isElementVisible;
49-
}).length;
50-
51-
findRefs("span.groupHeader", listRef).forEach(h => {
52-
const headerSiblings = this.state.list.getSectionListElementsRefs(h.parentNode).map(ref => this.state.list.toListElement(ref))
53-
const isHeaderVisible = headerSiblings.filter(s => this.state.list.isElementVisible(s, filter)) != 0
54-
55-
this.toggleDisplayStyles(isHeaderVisible, h)
56-
})
57-
58-
this.toggleDisplayStyles(isListVisible, listRef);
59-
console.log(isListVisible);
60-
return isListVisible;
61-
}).length;
62-
63-
const outerThis = this
64-
this.state.list.getTabRefFromSectionRef(sectionRef).forEach(function(tabRef){
65-
outerThis.toggleDisplayStyles(isTabVisible, tabRef);
66-
})
67-
});
68-
}
69-
}
8+
constructor(props) {
9+
super(props);
10+
11+
this.refs = {
12+
tabs: findRefs(
13+
".names .tab[data-togglable]",
14+
findRef(".membersList"),
15+
).concat(
16+
findRefs(".contents h2[data-togglable]", findRef(".membersList")),
17+
),
18+
sections: findRefs(
19+
".contents .tab[data-togglable]",
20+
findRef(".membersList"),
21+
),
22+
};
23+
24+
this.state = {
25+
list: new List(this.refs.tabs, this.refs.sections),
26+
};
27+
28+
this.render(this.props);
29+
}
30+
31+
toggleElementDatasetVisibility(isVisible, ref) {
32+
ref.dataset.visibility = isVisible;
33+
}
34+
35+
toggleDisplayStyles(condition, ref) {
36+
ref.style.display = condition ? null : "none";
37+
}
38+
39+
render({ filter }) {
40+
this.state.list.sectionsRefs.map((sectionRef) => {
41+
const isTabVisible = this.state.list
42+
.getSectionListRefs(sectionRef)
43+
.filter((listRef) => {
44+
const isListVisible = this.state.list
45+
.getSectionListElementsRefs(listRef)
46+
.map((elementRef) => this.state.list.toListElement(elementRef))
47+
.filter((elementData) => {
48+
const isElementVisible = this.state.list.isElementVisible(
49+
elementData,
50+
filter,
51+
);
52+
53+
this.toggleDisplayStyles(isElementVisible, elementData.ref);
54+
this.toggleElementDatasetVisibility(
55+
isElementVisible,
56+
elementData.ref,
57+
);
58+
59+
return isElementVisible;
60+
}).length;
61+
62+
findRefs("span.groupHeader", listRef).forEach((h) => {
63+
const headerSiblings = this.state.list
64+
.getSectionListElementsRefs(h.parentNode)
65+
.map((ref) => this.state.list.toListElement(ref));
66+
const isHeaderVisible =
67+
headerSiblings.filter((s) =>
68+
this.state.list.isElementVisible(s, filter),
69+
) != 0;
70+
71+
this.toggleDisplayStyles(isHeaderVisible, h);
72+
});
73+
74+
this.toggleDisplayStyles(isListVisible, listRef);
75+
return isListVisible;
76+
}).length;
77+
78+
const outerThis = this;
79+
this.state.list
80+
.getTabRefFromSectionRef(sectionRef)
81+
.forEach(function (tabRef) {
82+
outerThis.toggleDisplayStyles(isTabVisible, tabRef);
83+
});
84+
});
85+
}
86+
}
7087

7188
class List {
7289
/**

0 commit comments

Comments
 (0)