{"version":3,"file":"content.min.js","sources":["https:\/\/dl1.cuni.cz\/course\/format\/topcoll\/amd\/src\/local\/content.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 * Collapsed Topics Course index main component.\n *\n * @module format_topcoll\/local\/content\n * @class format_topcoll\/local\/content\n * @copyright 2022 G J Barnard based upon work done by:\n * @copyright 2020 Ferran Recio \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport Component from 'core_courseformat\/local\/content';\nimport Config from 'core\/config';\nimport Fragment from 'core\/fragment';\nimport { getCurrentCourseEditor } from 'core_courseformat\/courseeditor';\nimport inplaceeditable from 'core\/inplace_editable';\nimport Log from 'core\/log';\nimport Pending from 'core\/pending';\nimport Templates from 'core\/templates';\nimport TopcollDispatchActions from 'format_topcoll\/local\/content\/actions';\nimport {setUserTopcollToggle, userSetUserToggleAll} from 'format_topcoll\/util';\nimport * as CourseEvents from 'core_course\/events';\n\nexport default class TopcollComponent extends Component {\n\n \/**\n * The class constructor.\n *\n * The only param this method gets is a constructor with all the mandatory\n * and optional component data. Component will receive the same descriptor\n * as create method param.\n *\n * This method will call the \"create\" method before registering the component into\n * the reactive module. This way any component can add default selectors and events.\n *\n * @param {descriptor} descriptor data to create the object.\n *\/\n constructor(descriptor) {\n super(descriptor);\n const tcdata = this.getElement(this.selectors.TC_DATA);\n if (tcdata) {\n this.oneTopic = (tcdata.dataset.onetopic === 'true');\n if (tcdata.dataset.onetopictoggle === 'false') {\n this.currentTopicNum = false;\n } else {\n this.currentTopicNum = tcdata.dataset.onetopictoggle;\n }\n this.defaulttogglepersistence = (tcdata.dataset.defaulttogglepersistence === 'true');\n }\n }\n\n \/**\n * Static method to create a component instance form the mustahce template.\n *\n * @param {string} target the DOM main element or its ID\n * @param {object} selectors optional css selector overrides\n * @param {number} sectionReturn the content section return\n * @return {Component}\n *\/\n static init(target, selectors, sectionReturn) {\n return new TopcollComponent({\n element: document.getElementById(target),\n reactive: getCurrentCourseEditor(),\n selectors,\n sectionReturn\n });\n }\n\n \/**\n * Initial state ready method.\n *\/\n stateReady() {\n this._indexContents();\n\n \/\/ Toggle.\n const toogleAllClosed = this.getElement(this.selectors.TOGGLE_ALL_ClOSED);\n if (toogleAllClosed) {\n this.addEventListener(toogleAllClosed, 'click', this._toogleAllClosedToggler);\n this.addEventListener(toogleAllClosed, 'keydown', e => {\n \/\/ Close all sections when Space key is pressed on the toggle button.\n if (e.key === ' ') {\n this._toogleAllClosedToggler(e);\n }\n });\n }\n\n const toogleAllOpen = this.getElement(this.selectors.TOGGLE_ALL_OPEN);\n if (toogleAllOpen) {\n this.addEventListener(toogleAllOpen, 'click', this._toogleAllOpenToggler);\n this.addEventListener(toogleAllOpen, 'keydown', e => {\n \/\/ Open all sections when Space key is pressed on the toggle button.\n if (e.key === ' ') {\n this._toogleAllOpenToggler(e);\n }\n });\n }\n\n const toggles = this.getElements(this.selectors.TOGGLE);\n for (const toggle of toggles) {\n this.addEventListener(toggle, 'click', this._toogleToggler);\n this.addEventListener(toggle, 'keydown', e => {\n if (e.key === ' ') {\n this._toogleToggler(e);\n }\n });\n }\n\n if (this.reactive.supportComponents) {\n \/\/ Actions are only available in edit mode.\n if (this.reactive.isEditing) {\n new TopcollDispatchActions(this);\n }\n\n \/\/ Mark content as state ready.\n this.element.classList.add(this.classes.STATEDREADY);\n }\n\n \/\/ Capture completion events.\n this.addEventListener(\n this.element,\n CourseEvents.manualCompletionToggled,\n this._completionHandler\n );\n\n \/\/ Capture page scroll to update page item.\n this.addEventListener(\n document,\n \"scroll\",\n this._scrollHandler\n );\n }\n\n \/**\n * Return the component watchers.\n *\n * @returns {Array} of watchers\n *\/\n getWatchers() {\n \/\/ Section return is a global page variable but most formats define it just before start printing\n \/\/ the course content. This is the reason why we define this page setting here.\n this.reactive.sectionReturn = this.sectionReturn;\n\n \/\/ Check if the course format is compatible with reactive components.\n if (!this.reactive.supportComponents) {\n return [];\n }\n return [\n \/\/ State changes that require to reload some course modules.\n {watch: `cm.visible:updated`, handler: this._reloadCm},\n {watch: `cm.stealth:updated`, handler: this._reloadCm},\n {watch: `cm.sectionid:updated`, handler: this._reloadCm},\n {watch: `cm.indent:updated`, handler: this._reloadCm},\n {watch: `cm.groupmode:updated`, handler: this._reloadCm},\n {watch: `cm.name:updated`, handler: this._refreshCmName},\n \/\/ Update section number and title.\n {watch: `section.number:updated`, handler: this._refreshSectionNumber},\n {watch: `section.title:updated`, handler: this._refreshSectionTitle},\n \/\/{watch: `section:updated`, handler: this._refreshTCSection},\n \/\/ Sections and cm sorting.\n {watch: `transaction:start`, handler: this._startProcessing},\n {watch: `course.sectionlist:updated`, handler: this._refreshCourseSectionlist},\n {watch: `section.cmlist:updated`, handler: this._refreshSectionCmlist},\n \/\/ Section visibility.\n {watch: `section.visible:updated`, handler: this._reloadSection},\n \/\/ Reindex sections and cms.\n {watch: `state:updated`, handler: this._indexContents},\n ];\n }\n\n _refreshTCSection({element}) {\n Log.debug(element.id);\n }\n\n \/**\n * Update a course section when the section number changes.\n *\n * The courseActions module used for most course section tools still depends on css classes and\n * section numbers (not id). To prevent inconsistencies when a section is moved, we need to refresh\n * the\n *\n * Course formats can override the section title rendering so the frontend depends heavily on backend\n * rendering. Luckily in edit mode we can trigger a title update using the inplace_editable module.\n *\n * @param {Object} param\n * @param {Object} param.element details the update details.\n *\/\n _refreshSectionNumber({element}) {\n Log.debug('_refreshSectionNumber ' + element.id);\n\n \/\/ Find the element.\n const target = this.getElement(this.selectors.SECTION, element.id);\n if (!target) {\n \/\/ Job done. Nothing to refresh.\n return;\n }\n\n if (target.classList.contains('delegated-section')) {\n \/\/ Update section numbers in all data, css and YUI attributes.\n target.id = `section-${element.number}`;\n \/\/ YUI uses section number as section id in data-sectionid, in principle if a format use components\n \/\/ don't need this sectionid attribute anymore, but we keep the compatibility in case some plugin\n \/\/ use it for legacy purposes.\n target.dataset.sectionid = element.number;\n \/\/ The data-number is the attribute used by components to store the section number.\n target.dataset.number = element.number;\n\n \/\/ Update title and title inplace editable, if any.\n const inplace = inplaceeditable.getInplaceEditable(target.querySelector(this.selectors.SECTION_ITEM));\n if (inplace) {\n \/\/ The course content HTML can be modified at any moment, so the function need to do some checkings\n \/\/ to make sure the inplace editable still represents the same itemid.\n const currentvalue = inplace.getValue();\n const currentitemid = inplace.getItemId();\n \/\/ Unnamed sections must be recalculated.\n if (inplace.getValue() === '') {\n \/\/ The value to send can be an empty value if it is a default name.\n if (currentitemid == element.id && (currentvalue != element.rawtitle || element.rawtitle == '')) {\n inplace.setValue(element.rawtitle);\n }\n }\n }\n } else {\n \/\/ Normal section.\n \/\/ As the number has changed then we need to regenerate the whole section.\n this._reloadSection({\n element: element,\n });\n }\n }\n\n \/**\n * Reload a course section contents.\n *\n * Section HTML is still strongly backend dependant.\n * Some changes require to get a new version of the section.\n *\n * @param {details} param0 the watcher details\n * @param {object} param0.element the state object\n *\/\n _reloadSection({element}) {\n Log.debug('_reloadSection ' + element.id);\n const pendingReload = new Pending(`courseformat\/content:reloadSection_${element.id}`);\n const sectionitem = this.getElement(this.selectors.SECTION, element.id);\n if (sectionitem) {\n \/\/ Cancel any pending reload because the section will reload cms too.\n for (const cmId of element.cmlist) {\n this._cancelDebouncedReloadCm(cmId);\n }\n const promise = Fragment.loadFragment(\n 'core_courseformat',\n 'section',\n Config.courseContextId,\n {\n id: element.id,\n courseid: Config.courseId,\n sr: this.reactive.sectionReturn ?? null,\n }\n );\n promise.then((html, js) => {\n Log.debug('_reloadSection promise reply eid: ' + element.id);\n Templates.replaceNode(sectionitem, html, js);\n this._indexContents();\n\n const container = this.getElement(this.selectors.COURSE_SECTIONLIST);\n const toggle = container.querySelector('[data-id=\"' + element.id + '\"] ' + this.selectors.TOGGLE);\n Log.debug('toggle id ' + toggle.id + ' parent li ' + toggle.parentElement.parentElement.id +\n ' ' + toggle.parentElement.parentElement.dataset.id);\n if (toggle !== null) {\n Log.debug('toggle exists ' + toggle.id);\n this.addEventListener(toggle, 'click', this._toogleToggler);\n this.addEventListener(toggle, 'keydown', e => {\n \/\/ Open all sections when Space key is pressed on the toggle button.\n if (e.key === ' ') {\n this._toogleToggler(e);\n }\n });\n }\n\n pendingReload.resolve();\n }).catch(() => {\n Log.debug('_reloadSection promise fail ' + element.id);\n pendingReload.resolve();\n });\n } else {\n Log.debug('_reloadSection no section item ' + element.id);\n }\n }\n\n \/**\n * Handle the close all toggles button.\n *\n * @param {Event} event the triggered event\n *\/\n _toogleAllClosedToggler(event) {\n event.preventDefault();\n\n const toggles = this.getElements(this.selectors.TOGGLE + ' .the_toggle');\n for (const toggle of toggles) {\n toggle.classList.add('toggle_closed');\n toggle.classList.remove('toggle_open');\n }\n const toggledsections = this.getElements(this.selectors.TOGGLED_SECTION);\n for (const toggledsection of toggledsections) {\n toggledsection.classList.remove('sectionopen');\n }\n\n if (this.defaulttogglepersistence === true) {\n userSetUserToggleAll(Config.courseId, false);\n }\n }\n\n \/**\n * Handle the open all toggles button.\n *\n * @param {Event} event the triggered event\n *\/\n _toogleAllOpenToggler(event) {\n event.preventDefault();\n\n const toggles = this.getElements(this.selectors.TOGGLE + ' .the_toggle');\n for (const toggle of toggles) {\n toggle.classList.add('toggle_open');\n toggle.classList.remove('toggle_closed');\n }\n const toggledsections = this.getElements(this.selectors.TOGGLED_SECTION);\n for (const toggledsection of toggledsections) {\n toggledsection.classList.add('sectionopen');\n }\n\n if (this.defaulttogglepersistence === true) {\n userSetUserToggleAll(Config.courseId, true);\n }\n }\n\n \/**\n * Handle the toggler.\n *\n * @param {Event} event the triggered event\n *\/\n _toogleToggler(event) {\n Log.debug('_toogleToggler');\n if (this.reactive.isEditing) {\n const parentClasses = event.target.parentElement.classList;\n if ((parentClasses.contains('quickediticon')) || (parentClasses.contains('inplaceeditable'))) {\n return;\n }\n }\n\n event.preventDefault();\n const toggle = event.target.closest(this.selectors.TOGGLE);\n const toggleNum = parseInt(toggle.getAttribute('id').replace(\"toggle-\", \"\"));\n Log.debug('_toogleToggler: ' + toggleNum);\n\n if (this.oneTopic === true) {\n if ((this.currentTopicNum !== false) && (this.currentTopicNum != toggleNum)) {\n const currentTargetParent = this.getElement('#toggle-' + this.currentTopicNum).parentElement;\n const currentToggle = currentTargetParent.querySelector('.the_toggle');\n currentToggle.classList.add('toggle_closed');\n currentToggle.classList.remove('toggle_open');\n currentToggle.setAttribute('aria-expanded', 'false');\n\n const currentSection = currentTargetParent.querySelector(this.selectors.TOGGLED_SECTION);\n currentSection.classList.remove('sectionopen');\n\n if (this.defaulttogglepersistence === true) {\n setUserTopcollToggle(Config.courseId, this.currentTopicNum, false);\n }\n this.currentTopicNum = false;\n }\n }\n\n const target = toggle.querySelector('.the_toggle');\n const targetSection = toggle.parentElement.querySelector(this.selectors.TOGGLED_SECTION);\n var state;\n if (target.classList.contains('toggle_closed')) {\n target.classList.add('toggle_open');\n target.classList.remove('toggle_closed');\n target.setAttribute('aria-expanded', 'true');\n targetSection.classList.add('sectionopen');\n if (this.oneTopic === true) {\n this.currentTopicNum = toggleNum;\n }\n state = true;\n } else {\n target.classList.add('toggle_closed');\n target.classList.remove('toggle_open');\n target.setAttribute('aria-expanded', 'false');\n targetSection.classList.remove('sectionopen');\n if (this.oneTopic === true) {\n this.currentTopicNum = false;\n }\n state = false;\n }\n if (this.defaulttogglepersistence === true) {\n setUserTopcollToggle(Config.courseId, toggleNum, state);\n }\n }\n\n \/**\n * Refresh the section list.\n *\n * @param {Object} param\n * @param {Object} param.state the full state object.\n *\/\n _refreshCourseSectionlist({state}) {\n \/\/ If we have a section return means we only show a single section so no need to fix order.\n if (this.reactive.sectionReturn !== null) {\n return;\n }\n const sectionlist = this.reactive.getExporter().listedSectionIds(state);\n const listparent = this.getElement(this.selectors.COURSE_SECTIONLIST);\n \/\/ For now section cannot be created at a frontend level.\n const createSection = this._createSectionItem.bind(this);\n if (listparent) {\n this._fixTopcollSectionOrder(listparent, sectionlist, this.selectors.SECTION, this.dettachedSections, createSection);\n }\n }\n\n \/**\n * Fix\/reorder the section or cms order.\n *\n * @param {Element} container the HTML element to reorder.\n * @param {Array} neworder an array with the ids order\n * @param {string} selector the element selector\n * @param {Object} dettachedelements a list of dettached elements\n * @param {function} createMethod method to create missing elements\n *\/\n async _fixTopcollSectionOrder(container, neworder, selector, dettachedelements, createMethod) {\n if (container === undefined) {\n return;\n }\n\n \/\/ Empty lists should not be visible.\n if (!neworder.length) {\n container.classList.add('hidden');\n container.innerHTML = '';\n return;\n }\n\n \/\/ Grant the list is visible (in case it was empty).\n container.classList.remove('hidden');\n\n \/\/ Move the elements in order at the beginning of the list.\n neworder.forEach((itemid, index) => {\n let item = this.getElement(selector, itemid) ?? dettachedelements[itemid] ?? createMethod(container, itemid);\n if (!item) {\n \/\/ Missing elements cannot be sorted.\n return;\n }\n let itemno = this.getElement('#tcnoid-'+itemid);\n if (itemno) {\n itemno.textContent = index + 1; \/\/ Update the section number in the 'left' part.\n }\n \/\/ Get the current elemnt at that position.\n const currentitem = container.children[index];\n if (!currentitem) {\n container.append(item);\n return;\n }\n if (currentitem !== item) {\n container.insertBefore(item, currentitem);\n }\n });\n\n \/\/ Dndupload add a fake element we need to keep.\n let dndFakeActivity;\n\n \/\/ Remove the remaining elements.\n while (container.children.length > neworder.length) {\n const lastchild = container.lastChild;\n if (lastchild?.classList?.contains('dndupload-preview')) {\n dndFakeActivity = lastchild;\n } else {\n dettachedelements[lastchild?.dataset?.id ?? 0] = lastchild;\n }\n container.removeChild(lastchild);\n }\n \/\/ Restore dndupload fake element.\n if (dndFakeActivity) {\n container.append(dndFakeActivity);\n }\n }\n}\n"],"names":["_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireDefault","__esModule","default","_content","_config","_fragment","_inplace_editable","_log","_pending","_templates","_actions","CourseEvents","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_interopRequireWildcard","TopcollComponent","Component","constructor","descriptor","super","tcdata","this","getElement","selectors","TC_DATA","oneTopic","dataset","onetopic","onetopictoggle","currentTopicNum","defaulttogglepersistence","init","target","sectionReturn","element","document","getElementById","reactive","getCurrentCourseEditor","stateReady","_indexContents","toogleAllClosed","TOGGLE_ALL_ClOSED","addEventListener","_toogleAllClosedToggler","key","toogleAllOpen","TOGGLE_ALL_OPEN","_toogleAllOpenToggler","toggles","getElements","TOGGLE","toggle","_toogleToggler","supportComponents","isEditing","TopcollDispatchActions","classList","add","classes","STATEDREADY","manualCompletionToggled","_completionHandler","_scrollHandler","getWatchers","watch","handler","_reloadCm","_refreshCmName","_refreshSectionNumber","_refreshSectionTitle","_startProcessing","_refreshCourseSectionlist","_refreshSectionCmlist","_reloadSection","_refreshTCSection","_ref","Log","debug","id","_ref2","SECTION","contains","number","sectionid","inplace","inplaceeditable","getInplaceEditable","querySelector","SECTION_ITEM","currentvalue","getValue","currentitemid","getItemId","rawtitle","setValue","_ref3","pendingReload","Pending","sectionitem","cmId","cmlist","_cancelDebouncedReloadCm","Fragment","loadFragment","Config","courseContextId","courseid","courseId","sr","then","html","js","Templates","replaceNode","COURSE_SECTIONLIST","parentElement","resolve","catch","event","preventDefault","remove","toggledsections","TOGGLED_SECTION","toggledsection","userSetUserToggleAll","parentClasses","closest","toggleNum","parseInt","getAttribute","replace","currentTargetParent","currentToggle","setAttribute","setUserTopcollToggle","targetSection","state","_ref4","sectionlist","getExporter","listedSectionIds","listparent","createSection","_createSectionItem","bind","_fixTopcollSectionOrder","dettachedSections","container","neworder","selector","dettachedelements","createMethod","undefined","length","innerHTML","dndFakeActivity","forEach","itemid","index","item","itemno","textContent","currentitem","children","insertBefore","append","_lastchild$classList","lastchild","lastChild","_lastchild$dataset","removeChild","_exports"],"mappings":"4aAmCmD,SAAAA,yBAAAC,GAAA,GAAA,mBAAAC,QAAA,OAAA,KAAA,IAAAC,EAAAD,IAAAA,QAAAE,EAAAF,IAAAA,eAAAF,yBAAA,SAAAC,GAAAA,OAAAA,EAAAG,EAAAD,IAAAF,EAAA,CAAA,SAAAI,uBAAAJ,GAAAA,OAAAA,GAAAA,EAAAK,WAAAL,EAAAM,CAAAA,QAAAN,EAAA;;;;;;;;;qFAVnDO,SAAAH,uBAAAG,UACAC,QAAAJ,uBAAAI,SACAC,UAAAL,uBAAAK,WAEAC,kBAAAN,uBAAAM,mBACAC,KAAAP,uBAAAO,MACAC,SAAAR,uBAAAQ,UACAC,WAAAT,uBAAAS,YACAC,SAAAV,uBAAAU,UAEAC,aAAmD,SAAAf,EAAAE,GAAAA,IAAAA,GAAAF,GAAAA,EAAAK,WAAAL,OAAAA,EAAAA,GAAAA,OAAAA,GAAAA,iBAAAA,GAAAA,mBAAAA,EAAAM,MAAAA,CAAAA,QAAAN,GAAAG,IAAAA,EAAAJ,yBAAAG,GAAA,GAAAC,GAAAA,EAAAa,IAAAhB,GAAA,OAAAG,EAAAc,IAAAjB,GAAA,IAAAkB,EAAA,CAAAC,UAAA,MAAAC,EAAAC,OAAAC,gBAAAD,OAAAE,yBAAA,IAAA,IAAAC,KAAAxB,EAAAwB,GAAAA,YAAAA,GAAAC,CAAAA,EAAAA,eAAAC,KAAA1B,EAAAwB,GAAAG,CAAAA,IAAAA,EAAAP,EAAAC,OAAAE,yBAAAvB,EAAAwB,GAAAG,KAAAA,IAAAA,EAAAV,KAAAU,EAAAC,KAAAP,OAAAC,eAAAJ,EAAAM,EAAAG,GAAAT,EAAAM,GAAAxB,EAAAwB,GAAAN,OAAAA,EAAAZ,QAAAN,EAAAG,GAAAA,EAAAyB,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