1/* stimulusFetch: 'lazy' */ 2import { Controller } from '@hotwired/stimulus'; 3 4// noinspection JSUnusedGlobalSymbols loaded via stimulus 5/** 6 * @property {string} pathValue 7 */ 8export default class extends Controller { 9 10 static values = { 11 path: String, 12 } 13 14 connect() { 15 /** @type {HTMLElement} */ 16 const element = this.element; 17 if (!this.pathValue) { 18 return; 19 } 20 const path = this.pathValue.split('.'); 21 let fieldName = path[0]; 22 path.slice(1).forEach(key => { 23 fieldName += '[' + key + ']'; 24 if (key.match(/[0-9]+/)) { 25 const toggle = element.querySelector('[name="' + fieldName + '[position]"] ~ input[type="checkbox"]') 26 if (toggle) { 27 toggle.checked = true; 28 } 29 } 30 }); 31 // const fieldName = path[0] + '[' + path.slice(1).join[']['] + ']'; 32 const target = element.querySelector('[name^="' + fieldName + '"],[data-from^="' + fieldName + '"]'); 33 if (target) { 34 target.select ? target.select() : target.focus(); 35 target.scrollIntoView(); 36 } 37 } 38}
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.