Skip to content

Commit

Permalink
Filter TOC by version
Browse files Browse the repository at this point in the history
  • Loading branch information
karimi committed Jun 4, 2024
1 parent 59b471e commit 82ce204
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion quasar_site/src/ViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const ViewModel = {
header: "secondary",
deprecated: x.deprecated,
obsolete: x.obsolete,
since: x.since,
children:
overloads.length > 1
? overloads.map((o) => {
Expand All @@ -85,6 +86,7 @@ const ViewModel = {
this.memberName(o, childType.toLowerCase())
)[1],
path: `${o.path}#${this.signatureAnchorRef(o.signature)}`,
since: o.since,
};
})
: [],
Expand Down Expand Up @@ -243,7 +245,6 @@ const ViewModel = {
if (!path) {
return;
}
// console.log("finding:", path);
path = path.toLowerCase();
let found = null;

Expand All @@ -265,6 +266,7 @@ const ViewModel = {
_lastFound = found;

if (
found &&
_maxVersion &&
found.since &&
this.sinceIsGreater(found.since, _maxVersion)
Expand Down
9 changes: 7 additions & 2 deletions quasar_site/src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</q-header>
<q-drawer v-model="leftDrawerOpen" behavior="desktop" show-if-above bordered id="myDrawer" :width="drawerWidth"
@mouseover="() => shouldAutoScroll = false" @mouseout="() => shouldAutoScroll = true">
<q-tree no-transition ref=myTree :nodes="api" accordion dense node-key="path" selected-color="accent" :filter="searchText"
<q-tree no-transition ref=myTree :nodes="api" accordion dense node-key="path" selected-color="accent" :filter="filterVersion" :filter-method="filterTocByVersion"
v-model:selected="selectedNode" v-model:expanded="expanded" :duration="200" @lazy-load="onLazyLoad">
<template v-slot:default-header="prop" >
<div class="row items-center">
Expand Down Expand Up @@ -129,6 +129,12 @@ export default {
})
}
},
filterTocByVersion (node, filter) {
if(node.since){
return !ViewModel.sinceIsGreater(node.since, filter)
}
return true
},
resizeDrawer(ev) {
const drawerEl = document.getElementById("myDrawer");
const drawerParent = drawerEl.parentElement;
Expand All @@ -148,7 +154,6 @@ export default {
},
onChangeSelectedItem(item, updateRoute) {
const newSelectedNode = ViewModel.itemPath(item);
console.log("onchangeselecteditem");
if (newSelectedNode !== this.selectedNode) {
this.routePushEnabled = updateRoute;
this.selectedNode = newSelectedNode;
Expand Down

0 comments on commit 82ce204

Please sign in to comment.