{"version":3,"file":"cmitem.min.js","sources":["https:\/\/www.alsg.org\/home\/course\/format\/amd\/src\/local\/content\/section\/cmitem.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle 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 Moodle. If not, see .\n\n\/**\n * Course course module item component.\n *\n * This component is used to control specific course modules interactions like drag and drop.\n *\n * @module core_courseformat\/local\/content\/section\/cmitem\n * @class core_courseformat\/local\/content\/section\/cmitem\n * @copyright 2021 Ferran Recio \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport DndCmItem from 'core_courseformat\/local\/courseeditor\/dndcmitem';\n\nexport default class extends DndCmItem {\n\n \/**\n * Constructor hook.\n *\/\n create() {\n \/\/ Optional component name for debugging.\n this.name = 'content_section_cmitem';\n \/\/ Default query selectors.\n this.selectors = {\n DRAGICON: `.editing_move`,\n };\n \/\/ Most classes will be loaded later by DndCmItem.\n this.classes = {\n LOCKED: 'editinprogress',\n };\n \/\/ We need our id to watch specific events.\n this.id = this.element.dataset.id;\n }\n\n \/**\n * Initial state ready method.\n *\/\n stateReady() {\n this.configDragDrop(this.id);\n this.getElement(this.selectors.DRAGICON)?.classList.add(this.classes.DRAGICON);\n }\n\n \/**\n * Component watchers.\n *\n * @returns {Array} of watchers\n *\/\n getWatchers() {\n return [\n {watch: `cm[${this.id}]:deleted`, handler: this.unregister},\n {watch: `cm[${this.id}]:updated`, handler: this._refreshCm},\n ];\n }\n\n \/**\n * Update a course index cm using the state information.\n *\n * @param {object} param\n * @param {Object} param.element details the update details.\n *\/\n _refreshCm({element}) {\n \/\/ Update classes.\n this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);\n this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);\n this.locked = element.locked;\n }\n}\n"],"names":["DndCmItem","create","name","selectors","DRAGICON","classes","LOCKED","id","this","element","dataset","stateReady","configDragDrop","getElement","classList","add","getWatchers","watch","handler","unregister","_refreshCm","toggle","DRAGGING","dragging","locked"],"mappings":";;;;;;;;;;0KA4B6BA,mBAKzBC,cAESC,KAAO,8BAEPC,UAAY,CACbC,+BAGCC,QAAU,CACXC,OAAQ,uBAGPC,GAAKC,KAAKC,QAAQC,QAAQH,GAMnCI,uCACSC,eAAeJ,KAAKD,kCACpBM,WAAWL,KAAKL,UAAUC,wDAAWU,UAAUC,IAAIP,KAAKH,QAAQD,UAQzEY,oBACW,CACH,CAACC,mBAAaT,KAAKD,gBAAeW,QAASV,KAAKW,YAChD,CAACF,mBAAaT,KAAKD,gBAAeW,QAASV,KAAKY,aAUxDA,2DAAWX,QAACA,mBAEHA,QAAQK,UAAUO,OAAOb,KAAKH,QAAQiB,mCAAUb,QAAQc,+DACxDd,QAAQK,UAAUO,OAAOb,KAAKH,QAAQC,+BAAQG,QAAQe,yDACtDA,OAASf,QAAQe"}