{"version":3,"file":"section.min.js","sources":["https:\/\/moodle.tau.ac.il\/2023\/course\/format\/multitopic\/amd\/src\/courseformat\/content\/section.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 section format component.\n *\n * @module format_multitopic\/courseformat\/content\/section\n * @class format_multitopic\/courseformat\/content\/section\n * @copyright 2022 James Calder and Otago Polytechnic\n * @copyright based on work by 2021 Ferran Recio \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport Header from 'format_multitopic\/courseformat\/content\/section\/header';\nimport SectionBase from 'core_courseformat\/local\/content\/section';\n\nexport default class extends SectionBase {\n\n \/**\n * Initial state ready method.\n *\n * @param {Object} state the initial state\n *\/\n stateReady(state) {\n this.configState(state);\n \/\/ Drag and drop is only available for components compatible course formats.\n if (this.reactive.isEditing && this.reactive.supportComponents) {\n \/\/ Section zero and other formats sections may not have a title to drag.\n const sectionItem = this.getElement(this.selectors.SECTION_ITEM);\n if (sectionItem) {\n \/\/ Init the inner dragable element.\n const headerComponent = new Header({ \/\/ CHANGED.\n ...this,\n element: sectionItem,\n fullregion: this.element,\n });\n this.configDragDrop(headerComponent);\n }\n }\n }\n\n \/**\n * Validate if the drop data can be dropped over the component.\n *\n * @param {Object} dropdata the exported drop data.\n * @returns {boolean}\n *\/\n validateDropData(dropdata) {\n if (dropdata?.type === 'section') {\n const origin = this.reactive.get(\"section\", dropdata.id);\n if (origin.id == this.section.id || origin.levelsan < 2\n || this.section.levelsan < 2 && this.section.section < origin.section) {\n return false;\n }\n }\n return super.validateDropData(dropdata);\n }\n\n}"],"names":["SectionBase","stateReady","state","configState","this","reactive","isEditing","supportComponents","sectionItem","getElement","selectors","SECTION_ITEM","headerComponent","Header","element","fullregion","configDragDrop","validateDropData","dropdata","type","origin","get","id","section","levelsan","super"],"mappings":";;;;;;;;;8LA4B6BA,iBAOzBC,WAAWC,eACFC,YAAYD,OAEbE,KAAKC,SAASC,WAAaF,KAAKC,SAASE,kBAAmB,OAEtDC,YAAcJ,KAAKK,WAAWL,KAAKM,UAAUC,iBAC\/CH,YAAa,OAEPI,gBAAkB,IAAIC,gBAAO,IAC5BT,KACHU,QAASN,YACTO,WAAYX,KAAKU,eAEhBE,eAAeJ,mBAWhCK,iBAAiBC,aACU,aAAnBA,MAAAA,gBAAAA,SAAUC,MAAoB,OACxBC,OAAShB,KAAKC,SAASgB,IAAI,UAAWH,SAASI,OACjDF,OAAOE,IAAMlB,KAAKmB,QAAQD,IAAMF,OAAOI,SAAW,GAC3CpB,KAAKmB,QAAQC,SAAW,GAAKpB,KAAKmB,QAAQA,QAAUH,OAAOG,eAC3D,SAGRE,MAAMR,iBAAiBC"}