Sha256: f905f9cb98251d27840076d5049f1b13ed4440d80280b1c0faf410b886178517
Contents?: true
Size: 1.19 KB
Versions: 12
Compression:
Stored size: 1.19 KB
Contents
import { Controller } from '@hotwired/stimulus' export default class extends Controller { static get targets () { return ['original', 'operator', 'null'] } connect () { this.operatorTarget.addEventListener('change', () => this.handleOperatorChange()) this.handleOperatorChange() } handleOperatorChange () { if (this.operatorTarget.value === 'is_null' || this.operatorTarget.value === 'is_not_null') { this.toggleNullInput() } else { this.toggleOriginalInput() } } toggleNullInput () { this.hideOriginal() this.showNull() } toggleOriginalInput () { this.showOriginal() this.hideNull() } hideOriginal () { this.originalTarget.style.display = 'none' this.originalTarget.setAttribute('data-filter-target', 'value_original') } showOriginal () { this.originalTarget.style.display = 'block' this.originalTarget.setAttribute('data-filter-target', 'value') } hideNull () { this.nullTarget.style.display = 'none' this.nullTarget.setAttribute('data-filter-target', 'value_null') } showNull () { this.nullTarget.style.display = 'block' this.nullTarget.setAttribute('data-filter-target', 'value') } }
Version data entries
12 entries across 12 versions & 1 rubygems