Sha256: 93abb08b30f6a65378818be8e74eb1f34bffebc89cdb45fc4fb9cb4534a55282

Contents?: true

Size: 691 Bytes

Versions: 9

Compression:

Stored size: 691 Bytes

Contents

export default function navNode() {
  return {
    id: null,
    hidden: true,
    children: [],
    init() {
      this.id = this.$el.id;
    },
    open() {
      return this.$store.nav.open[this.id];
    },
    getChildren() {
      return this.$refs.items
        ? Array.from(this.$refs.items.querySelectorAll(":scope > li"))
        : [];
    },
    filter() {
      this.hidden = true;
      this.getChildren().forEach((child) => {
        const data = child._x_dataStack[0];
        data.filter();
        if (!data.hidden) {
          this.hidden = false;
        }
      });
    },
    toggle() {
      this.$store.nav.open[this.id] = !this.$store.nav.open[this.id];
    },
  };
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lookbook-0.3.5 app/assets/lookbook/js/nav/node.js
lookbook-0.3.4 app/assets/lookbook/js/nav/node.js
lookbook-0.3.3 app/assets/lookbook/js/nav/node.js
lookbook-0.3.2 app/assets/lookbook/js/nav/node.js
lookbook-0.3.1 app/assets/lookbook/js/nav/node.js
lookbook-0.3.0 app/assets/lookbook/js/nav/node.js
lookbook-0.3.0.beta.2 app/assets/lookbook/js/nav/node.js
lookbook-0.3.0.beta.1 app/assets/lookbook/js/nav/node.js
lookbook-0.3.0.beta.0 app/assets/lookbook/js/nav/node.js