1import { Controller } from "@hotwired/stimulus" 2 3// Os campos de data do filtro de periodo, que so valem quando a opcao "Escolher data/hora" 4// esta marcada. Duas telas, dois gestos que as ligam: 5// 6// - `alternar` â mostra os campos quando "Escolher" e marcada, esconde nas demais; 7// - `escolher` â marca "Escolher" sozinho quando o usuario mexe num dos campos, porque 8// tocar a data ja expressa a mesma intencao que clicar no radio. 9// 10// O fade e do jQuery de proposito: e o que a tela sempre fez, e trocar por `display` seco 11// mudaria a aparencia da transicao. 12export default class extends Controller { 13 static targets = ["campos", "escolher"] 14 15 alternar(evento) { 16 if (!this.hasCamposTarget) return 17 18 if (evento.target.value === "choose") { 19 $(this.camposTarget).fadeIn().css("display", "flex") 20 } else { 21 $(this.camposTarget).fadeOut() 22 } 23 } 24 25 escolher() { 26 if (!this.hasEscolherTarget || this.escolherTarget.checked) return 27 28 this.escolherTarget.checked = true 29 $(this.escolherTarget).trigger("change") 30 } 31}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.