public/lookbook-assets/app.js in lookbook-0.3.5 vs public/lookbook-assets/app.js in lookbook-0.4.0.beta.1
- old
+ new
@@ -8521,10 +8521,21 @@
return this.$store.nav.open[this.id];
},
getChildren() {
return this.$refs.items ? Array.from(this.$refs.items.querySelectorAll(":scope > li")) : [];
},
+ navigateToFirstChild() {
+ if (this.open()) {
+ const child = this.firstVisibleChild();
+ if (child) {
+ const link = child.querySelector(":scope > a.nav-link");
+ if (link) {
+ this.navigate(link.getAttribute("href"));
+ }
+ }
+ }
+ },
filter() {
this.hidden = true;
this.getChildren().forEach((child) => {
const data2 = child._x_dataStack[0];
data2.filter();
@@ -8533,9 +8544,14 @@
}
});
},
toggle() {
this.$store.nav.open[this.id] = !this.$store.nav.open[this.id];
+ },
+ firstVisibleChild() {
+ return this.getChildren().find((child) => {
+ return child._x_dataStack ? child._x_dataStack[0].hidden === false : false;
+ });
}
};
}
// app/assets/lookbook/js/nav/leaf.js