{"version":3,"file":"src_stimulus_controllers_dynamic_table-action-menu_controller_ts.6ae987e523466f03.js","mappings":"6OAiCc,MAAOA,kCAAkCC,EAAAA,GAGrDC,OAAAA,GACEC,KAAKC,sBACP,CAEQA,oBAAAA,GACN,GAAID,KAAKE,iBAAkB,OAE3B,MAAMC,EAAYC,SAASC,eAAe,8BAA8BC,cAAc,cAClFH,IACFH,KAAKE,iBAAmBF,KAAKO,YAAYC,qCAAqCL,EAAW,wBAE7F,CAEAM,QAAAA,CAASC,GAEFV,KAAKE,kBAAoBF,KAAKC,uBAEnC,MAEMU,EAFSD,EAAME,cAEKC,aAAa,oBAEnCb,KAAKE,kBAAoBS,IAC3BX,KAAKE,iBAAiBY,qBACtBd,KAAKE,iBAAiBa,gBAAgBJ,GAE1C,E","sources":["./src/stimulus/controllers/dynamic/table-action-menu.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';\nimport FiltersFormController from './filter/filters-form.controller';\n\nexport default class TableActionMenuController extends Controller {\n declare filterController:FiltersFormController|null;\n\n connect():void {\n this.findFilterController();\n }\n\n private findFilterController() {\n if (this.filterController) return;\n\n const subHeader = document.getElementById('projects-index-sub-header')?.querySelector('sub-header');\n if (subHeader) {\n this.filterController = this.application.getControllerForElementAndIdentifier(subHeader, 'filter--filters-form') as FiltersFormController;\n }\n }\n\n filterBy(event:Event) {\n // Sometimes the filterController was not loaded during `connect`, so we try again here:\n if (!this.filterController) { this.findFilterController(); }\n\n const button = event.currentTarget as HTMLElement;\n\n const filterName = button.getAttribute('data-filter-name');\n\n if (this.filterController && filterName) {\n this.filterController.showDisplayFilters();\n this.filterController.addFilterByName(filterName);\n }\n }\n}\n"],"names":["TableActionMenuController","Controller","connect","this","findFilterController","filterController","subHeader","document","getElementById","querySelector","application","getControllerForElementAndIdentifier","filterBy","event","filterName","currentTarget","getAttribute","showDisplayFilters","addFilterByName"],"sourceRoot":"webpack:///","x_google_ignoreList":[]}