Sha256: 4ba59e932cae257ff92dfbd74810f1fa2657b7ab04b47b0d5eabddcc4c0dcd94

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

import Combobox from "hw_combobox/models/combobox/base"
import { visible } from "hw_combobox/helpers"

Combobox.Options = Base => class extends Base {
  _resetOptions() {
    this._deselect()
    this.hiddenFieldTarget.name = this.originalNameValue
  }

  get _allowNew() {
    return !!this.nameWhenNewValue
  }

  get _allOptions() {
    return Array.from(this._allOptionElements)
  }

  get _allOptionElements() {
    return this._actingListbox.querySelectorAll(`[${this.filterableAttributeValue}]`)
  }

  get _visibleOptionElements() {
    return [ ...this._allOptionElements ].filter(visible)
  }

  get _selectedOptionElement() {
    return this._actingListbox.querySelector("[role=option][aria-selected=true]")
  }

  get _selectedOptionIndex() {
    return [ ...this._visibleOptionElements ].indexOf(this._selectedOptionElement)
  }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hotwire_combobox-0.1.38 app/assets/javascripts/hw_combobox/models/combobox/options.js
hotwire_combobox-0.1.37 app/assets/javascripts/hw_combobox/models/combobox/options.js
hotwire_combobox-0.1.36 app/assets/javascripts/hw_combobox/models/combobox/options.js
hotwire_combobox-0.1.35 app/assets/javascripts/hw_combobox/models/combobox/options.js
hotwire_combobox-0.1.34 app/assets/javascripts/hw_combobox/models/combobox/options.js
hotwire_combobox-0.1.33 app/assets/javascripts/hw_combobox/models/combobox/options.js