{"version":3,"file":"src_stimulus_controllers_dynamic_menus_subtree_controller_ts.975cc9a8ee9021d4.js","mappings":"sOAgCc,MAAOA,+BAA+BC,EAAAA,UAC3C,KAAAC,OAAS,CACdC,SAAUC,OACV,CAIKC,OAAAA,GACL,GAA2B,KAAvBC,KAAKC,cAAsB,CAC7B,MAAMJ,EAAWG,KAAKE,QAAQC,cAA2B,UAAUH,KAAKC,mBACpEJ,IACFA,EAASO,UAAUC,IAAI,aACvBR,EAASS,iBAEb,CACF,CAEOC,MAAAA,CAAOC,GAEZ,GAAmB,YAAfA,EAAMC,MAAsC,KAAhBD,EAAME,MACpC,OAGF,MACMC,EADSH,EAAMI,OACKC,QAAQ,2BAClCF,EAAWP,UAAUG,OAAO,uBAC5BI,EAAWP,UAAUG,OAAO,wBAE5BC,EAAMM,gBACR,E","sources":["./src/stimulus/controllers/dynamic/menus/subtree.controller.ts"],"sourcesContent":["/*\n * -- copyright\n * OpenProject is an open source project management software.\n * Copyright (C) the OpenProject GmbH\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License version 3.\n *\n * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:\n * Copyright (C) 2006-2013 Jean-Philippe Lang\n * Copyright (C) 2010-2013 the ChiliProject Team\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; either version 2\n * of the License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * See COPYRIGHT and LICENSE files for more details.\n * ++\n */\n\nimport { Controller } from '@hotwired/stimulus';\n\nexport default class MenusSubtreeController extends Controller {\n static values = {\n selected: String,\n };\n\n declare selectedValue:string;\n\n public connect() {\n if (this.selectedValue !== '') {\n const selected = this.element.querySelector(`[slug=\"${this.selectedValue}\"]`);\n if (selected) {\n selected.classList.add('-selected');\n selected.scrollIntoView();\n }\n }\n }\n\n public toggle(event:MouseEvent|KeyboardEvent):void {\n // ignore the event if a key different from ENTER was pressed.\n if (event.type === 'keydown' && event.which !== 13) {\n return;\n }\n\n const target = event.target as HTMLElement;\n const targetList = target.closest('ul.-with-hierarchy > li') as HTMLElement;\n targetList.classList.toggle('-hierarchy-expanded');\n targetList.classList.toggle('-hierarchy-collapsed');\n\n event.preventDefault();\n }\n}\n"],"names":["MenusSubtreeController","Controller","values","selected","String","connect","this","selectedValue","element","querySelector","classList","add","scrollIntoView","toggle","event","type","which","targetList","target","closest","preventDefault"],"sourceRoot":"webpack:///","x_google_ignoreList":[]}