Sha256: f89a540d17bb8c6c21ec069e3646667644760b7caa4a8343989c4fbcc47280c0

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
  static targets = [ "list" ]
  connect() {
    this.element.classList.add("twiddle")

    // If a child facet-value is selected, then expand the node
    if (this.element.querySelector(':scope > span.selected')) {
      this.element.classList.add('twiddle-open')
      this.element.querySelectorAll(':scope > .collapse')
        .forEach((collapsable) => collapsable.classList.add('show'))
    }
  }

  toggle() {
    this.element.classList.toggle("twiddle-open")
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-hierarchy-6.2.1 app/assets/javascripts/blacklight/hierarchy/blacklight_hierarchy_controller.js