diff --git a/amd/build/board.min.js b/amd/build/board.min.js index ee77f593..65350a1f 100644 --- a/amd/build/board.min.js +++ b/amd/build/board.min.js @@ -1,3 +1,3 @@ -define("mod_kanban/board",["exports","core/reactive","mod_kanban/selectors","mod_kanban/capabilities","mod_kanban/exporter","mod_kanban/kanbancomponent","core/log","core/notification","core/str"],(function(_exports,_reactive,_selectors,_capabilities,_exporter,_kanbancomponent,_log,_notification,Str){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_selectors=_interopRequireDefault(_selectors),_capabilities=_interopRequireDefault(_capabilities),_exporter=_interopRequireDefault(_exporter),_kanbancomponent=_interopRequireDefault(_kanbancomponent),_log=_interopRequireDefault(_log),Str=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Str);class _default extends _kanbancomponent.default{constructor(){super(...arguments),_defineProperty(this,"LOCKED_COLUMNS",1),_defineProperty(this,"LOCKED_COMPLETE",2)}static init(target){return new this({element:document.getElementById(target)})}create(){this.cmid=this.element.dataset.cmid,this.id=this.element.dataset.id}getWatchers(){return[{watch:"board:updated",handler:this._boardUpdated},{watch:"columns:created",handler:this._columnCreated},{watch:"board:deleted",handler:this._reload},{watch:"common:updated",handler:this._commonUpdated}]}async stateReady(state){this.addEventListener(this.getElement(_selectors.default.ADDCOLUMNFIRST),"click",this._addColumn),1==state.capabilities.get(_capabilities.default.MANAGEBOARD).value&&(this.addEventListener(this.getElement(_selectors.default.LOCKBOARDCOLUMNS),"click",this._lockColumns),this.addEventListener(this.getElement(_selectors.default.UNLOCKBOARDCOLUMNS),"click",this._unlockColumns),this.addEventListener(this.getElement(_selectors.default.SAVEASTEMPLATE),"click",this._templateConfirm),this.addEventListener(this.getElement(_selectors.default.SHOWTEMPLATE),"click",this._showTemplate),this.addEventListener(this.getElement(_selectors.default.DELETETEMPLATE),"click",this._deleteTemplateConfirm)),this.addEventListener(this.getElement(_selectors.default.DELETEBOARD),"click",this._deleteConfirm),this.addEventListener(this.getElement(_selectors.default.SCROLLLEFT),"click",this._scrollLeft),this.addEventListener(this.getElement(_selectors.default.SCROLLRIGHT),"click",this._scrollRight),this.addEventListener(this.getElement(_selectors.default.MAIN),"scroll",this._updateScrollButtons),this.dragdrop=new _reactive.DragDrop(this),state.common.liveupdate>0&&this._continuousUpdate(state.common.liveupdate),this.toggleClass("ontouchstart"in document.documentElement,"mod_kanban_touch"),this._updateScrollButtons()}_showTemplate(){window.location.href=M.cfg.wwwroot+"/mod/kanban/view.php?id="+this.reactive.state.common.id+"&boardid="+this.reactive.state.common.template}_reload(){window.location.replace(M.cfg.wwwroot+"/mod/kanban/view.php?id="+this.reactive.state.common.id+"&userid="+this.reactive.state.common.userid)}_continuousUpdate(){setInterval((()=>{this.reactive.dispatch("getUpdates")}),1e3*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:10))}_commonUpdated(_ref){let{element:element}=_ref;this.toggleClass(0!=element.template,"mod_kanban_hastemplate")}destroy(){void 0!==this.dragdrop&&this.dragdrop.unregister(),this._reload()}_templateConfirm(){Str.get_strings([{key:"saveastemplate",component:"mod_kanban"},{key:"saveastemplateconfirm",component:"mod_kanban"},{key:"save",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._saveAsTemplate()})))).catch((error=>_log.default.debug(error)))}_saveAsTemplate(){this.reactive.dispatch("saveAsTemplate")}_deleteConfirm(){Str.get_strings([{key:"deleteboard",component:"mod_kanban"},{key:"deleteboardconfirm",component:"mod_kanban"},{key:"delete",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._deleteBoard()})))).catch((error=>_log.default.debug(error)))}_deleteTemplateConfirm(){Str.get_strings([{key:"deletetemplate",component:"mod_kanban"},{key:"deletetemplateconfirm",component:"mod_kanban"},{key:"delete",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._deleteBoard()})))).catch((error=>_log.default.debug(error)))}_deleteBoard(){this.reactive.dispatch("deleteBoard")}_boardUpdated(_ref2){let{element:element}=_ref2;const colcontainer=this.getElement(_selectors.default.COLUMNCONTAINER);if(void 0!==element.sequence){let sequence=element.sequence.split(",");[...colcontainer.children].forEach((node=>{node.classList.contains("mod_kanban_column")&&!sequence.includes(node.dataset.id)&&colcontainer.removeChild(node)})),[...colcontainer.children].sort(((a,b)=>sequence.indexOf(a.dataset.id)>sequence.indexOf(b.dataset.id)?1:-1)).forEach((node=>colcontainer.appendChild(node)))}this.toggleClass(element.locked,"mod_kanban_board_locked_columns"),this.toggleClass(element.hastemplate,"mod_kanban_hastemplate"),this._updateScrollButtons()}async _columnCreated(_ref3){let{element:element}=_ref3,data=Object.assign({id:element.id,title:element.title,options:element.options,sequence:element.sequence},_exporter.default.exportCapabilities(this.reactive.state)),placeholder=document.createElement("li");placeholder.setAttribute("data-id",data.id),this.getElement(_selectors.default.COLUMNCONTAINER).appendChild(placeholder);const newelement=(await this.renderComponent(placeholder,"mod_kanban/column",data)).getElement();this.getElement(_selectors.default.COLUMNCONTAINER).replaceChild(newelement,placeholder),this._updateScrollButtons()}_addColumn(){document.activeElement.blur(),this.reactive.dispatch("addColumn",0)}_lockColumns(){this.reactive.dispatch("lockColumns")}_unlockColumns(){this.reactive.dispatch("unlockColumns")}validateDropData(dropdata){return"column"==(null==dropdata?void 0:dropdata.type)}drop(dropdata){this.reactive.dispatch("moveColumn",dropdata.id,0)}showDropZone(){this.getElement(_selectors.default.ADDCOLUMNCONTAINER).classList.add("mod_kanban_insert")}hideDropZone(){this.getElement(_selectors.default.ADDCOLUMNCONTAINER).classList.remove("mod_kanban_insert")}_scrollLeft(){this.getElement(_selectors.default.MAIN).scrollLeft-=.75*document.querySelector(".mod_kanban_column").clientWidth}_scrollRight(){this.getElement(_selectors.default.MAIN).scrollLeft+=.75*document.querySelector(".mod_kanban_column").clientWidth}_updateScrollButtons(){let main=this.getElement(_selectors.default.MAIN);main.scrollLeft<=1?this.getElement(_selectors.default.SCROLLLEFT).style.setProperty("visibility","hidden"):this.getElement(_selectors.default.SCROLLLEFT).style.setProperty("visibility","visible"),main.clientWidth+main.scrollLeft0&&this._continuousUpdate(state.common.liveupdate),this.toggleClass("ontouchstart"in document.documentElement,"mod_kanban_touch"),this._updateScrollButtons()}_showTemplate(){window.location.href=M.cfg.wwwroot+"/mod/kanban/view.php?id="+this.reactive.state.common.id+"&boardid="+this.reactive.state.common.template}_reload(){window.location.replace(M.cfg.wwwroot+"/mod/kanban/view.php?id="+this.reactive.state.common.id+"&userid="+this.reactive.state.common.userid)}_continuousUpdate(){setInterval((()=>{this.reactive.dispatch("getUpdates")}),1e3*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:10))}_commonUpdated(_ref){let{element:element}=_ref;this.toggleClass(0!=element.template,"mod_kanban_hastemplate")}destroy(){void 0!==this.dragdrop&&this.dragdrop.unregister(),this._reload()}_templateConfirm(){Str.get_strings([{key:"saveastemplate",component:"mod_kanban"},{key:"saveastemplateconfirm",component:"mod_kanban"},{key:"save",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._saveAsTemplate()})))).catch((error=>_log.default.debug(error)))}_saveAsTemplate(){this.reactive.dispatch("saveAsTemplate")}_deleteConfirm(){Str.get_strings([{key:"deleteboard",component:"mod_kanban"},{key:"deleteboardconfirm",component:"mod_kanban"},{key:"delete",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._deleteBoard()})))).catch((error=>_log.default.debug(error)))}_deleteTemplateConfirm(){Str.get_strings([{key:"deletetemplate",component:"mod_kanban"},{key:"deletetemplateconfirm",component:"mod_kanban"},{key:"delete",component:"core"}]).then((strings=>(0,_notification.saveCancel)(strings[0],strings[1],strings[2],(()=>{this._deleteBoard()})))).catch((error=>_log.default.debug(error)))}_deleteBoard(){this.reactive.dispatch("deleteBoard")}_boardUpdated(_ref2){let{element:element}=_ref2;const colcontainer=this.getElement(_selectors.default.COLUMNCONTAINER);if(void 0!==element.sequence){let sequence=element.sequence.split(",");[...colcontainer.children].forEach((node=>{node.classList.contains("mod_kanban_column")&&!sequence.includes(node.dataset.id)&&colcontainer.removeChild(node)})),[...colcontainer.children].sort(((a,b)=>sequence.indexOf(a.dataset.id)>sequence.indexOf(b.dataset.id)?1:-1)).forEach((node=>colcontainer.appendChild(node)))}this.toggleClass(element.locked,"mod_kanban_board_locked_columns"),this.toggleClass(element.hastemplate,"mod_kanban_hastemplate"),this._updateScrollButtons()}async _columnCreated(_ref3){let{element:element}=_ref3,data=Object.assign({id:element.id,title:element.title,options:element.options,sequence:element.sequence},_exporter.default.exportCapabilities(this.reactive.state)),placeholder=document.createElement("li");placeholder.setAttribute("data-id",data.id),this.getElement(_selectors.default.COLUMNCONTAINER).appendChild(placeholder);const newelement=(await this.renderComponent(placeholder,"mod_kanban/column",data)).getElement();this.getElement(_selectors.default.COLUMNCONTAINER).replaceChild(newelement,placeholder),this._updateScrollButtons()}_addColumn(){document.activeElement.blur(),this.reactive.dispatch("addColumn",0)}_lockColumns(){this.reactive.dispatch("lockColumns")}_unlockColumns(){this.reactive.dispatch("unlockColumns")}validateDropData(dropdata){return"column"==(null==dropdata?void 0:dropdata.type)}drop(dropdata){this.reactive.dispatch("moveColumn",dropdata.id,0)}showDropZone(){this.getElement(_selectors.default.ADDCOLUMNCONTAINER).classList.add("mod_kanban_insert")}hideDropZone(){this.getElement(_selectors.default.ADDCOLUMNCONTAINER).classList.remove("mod_kanban_insert")}_scrollLeft(){this.getElement(_selectors.default.MAIN).scrollLeft-=.75*document.querySelector(".mod_kanban_column").clientWidth}_scrollRight(){this.getElement(_selectors.default.MAIN).scrollLeft+=.75*document.querySelector(".mod_kanban_column").clientWidth}_updateScrollButtons(){let main=this.getElement(_selectors.default.MAIN);main.scrollLeft<=1?this.getElement(_selectors.default.SCROLLLEFT).style.setProperty("visibility","hidden"):this.getElement(_selectors.default.SCROLLLEFT).style.setProperty("visibility","visible"),main.clientWidth+main.scrollLeft 0) {\n this._continuousUpdate(state.common.liveupdate);\n }\n this.toggleClass('ontouchstart' in document.documentElement, 'mod_kanban_touch');\n this._updateScrollButtons();\n }\n\n /**\n * Called to show template.\n */\n _showTemplate() {\n window.location.href =\n M.cfg.wwwroot +\n '/mod/kanban/view.php?id=' +\n this.reactive.state.common.id +\n '&boardid=' +\n this.reactive.state.common.template;\n }\n\n /**\n * Reload current page.\n */\n _reload() {\n window.location.replace(\n M.cfg.wwwroot + '/mod/kanban/view.php?id=' + this.reactive.state.common.id +\n '&userid=' + this.reactive.state.common.userid);\n }\n\n /**\n * Start continuous update.\n * @param {number} seconds Seconds between two refresh calls, defaults to 10\n */\n _continuousUpdate(seconds = 10) {\n setInterval(() => {\n this.reactive.dispatch('getUpdates');\n }, seconds * 1000);\n }\n\n /**\n * Called when common data was updated\n * @param {*} param0\n */\n _commonUpdated({element}) {\n this.toggleClass(element.template != 0, 'mod_kanban_hastemplate');\n }\n\n /**\n * Remove all subcomponents dependencies.\n */\n destroy() {\n if (this.dragdrop !== undefined) {\n this.dragdrop.unregister();\n }\n this._reload();\n }\n\n /**\n * Display confirmation modal for saving a board as template.\n */\n _templateConfirm() {\n Str.get_strings([\n {key: 'saveastemplate', component: 'mod_kanban'},\n {key: 'saveastemplateconfirm', component: 'mod_kanban'},\n {key: 'save', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._saveAsTemplate();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Called when current board should be saved as template.\n */\n _saveAsTemplate() {\n this.reactive.dispatch('saveAsTemplate');\n }\n\n /**\n * Display confirmation modal for deleting a board.\n */\n _deleteConfirm() {\n Str.get_strings([\n {key: 'deleteboard', component: 'mod_kanban'},\n {key: 'deleteboardconfirm', component: 'mod_kanban'},\n {key: 'delete', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._deleteBoard();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Display confirmation modal for deleting a template.\n */\n _deleteTemplateConfirm() {\n Str.get_strings([\n {key: 'deletetemplate', component: 'mod_kanban'},\n {key: 'deletetemplateconfirm', component: 'mod_kanban'},\n {key: 'delete', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._deleteBoard();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Called to delete current board.\n */\n _deleteBoard() {\n this.reactive.dispatch('deleteBoard');\n }\n\n /**\n * Called when board was updated.\n * @param {*} param0\n */\n _boardUpdated({element}) {\n const colcontainer = this.getElement(selectors.COLUMNCONTAINER);\n if (element.sequence !== undefined) {\n let sequence = element.sequence.split(',');\n // Remove all columns from frontend that are no longer present in the database.\n [...colcontainer.children]\n .forEach((node) => {\n if (node.classList.contains('mod_kanban_column') && !sequence.includes(node.dataset.id)) {\n colcontainer.removeChild(node);\n }\n });\n // Reorder columns according to sequence from the database.\n [...colcontainer.children]\n .sort((a, b) => sequence.indexOf(a.dataset.id) > sequence.indexOf(b.dataset.id) ? 1 : -1)\n .forEach(node => colcontainer.appendChild(node));\n }\n // Set CSS classes to show/hide action menu items.\n this.toggleClass(element.locked, 'mod_kanban_board_locked_columns');\n this.toggleClass(element.hastemplate, 'mod_kanban_hastemplate');\n this._updateScrollButtons();\n }\n\n /**\n * Called when a new column was added. Creates a new subcomponent.\n * @param {*} param0\n */\n async _columnCreated({element}) {\n let data = Object.assign({\n id: element.id,\n title: element.title,\n options: element.options,\n sequence: element.sequence,\n }, exporter.exportCapabilities(this.reactive.state));\n let placeholder = document.createElement('li');\n placeholder.setAttribute('data-id', data.id);\n this.getElement(selectors.COLUMNCONTAINER).appendChild(placeholder);\n const newcomponent = await this.renderComponent(placeholder, 'mod_kanban/column', data);\n const newelement = newcomponent.getElement();\n this.getElement(selectors.COLUMNCONTAINER).replaceChild(newelement, placeholder);\n // Make sure that the new column is recognized for the scroll buttons.\n this._updateScrollButtons();\n }\n\n /**\n * Called to add a column.\n */\n _addColumn() {\n document.activeElement.blur();\n // Board component only handles adding a column at the leftmost position, hence second parameter is always 0.\n this.reactive.dispatch('addColumn', 0);\n }\n\n /**\n * Called to lock all columns.\n */\n _lockColumns() {\n this.reactive.dispatch('lockColumns');\n }\n\n /**\n * Called to unlock all columns.\n */\n _unlockColumns() {\n this.reactive.dispatch('unlockColumns');\n }\n\n /**\n * Validate draggable data. This component only accepts columns.\n * @param {object} dropdata\n * @returns {boolean} if the data is valid for this drop-zone.\n */\n validateDropData(dropdata) {\n let type = dropdata?.type;\n return type == 'column';\n }\n\n /**\n * Executed when a valid dropdata is dropped over the drop-zone.\n * Moves the dropped column to the leftmost position (other positions are handled by column component).\n * @param {object} dropdata\n */\n drop(dropdata) {\n this.reactive.dispatch('moveColumn', dropdata.id, 0);\n }\n\n /**\n * Show some visual hints to the user.\n */\n showDropZone() {\n this.getElement(selectors.ADDCOLUMNCONTAINER).classList.add('mod_kanban_insert');\n }\n\n /**\n * Remove visual hints to the user.\n */\n hideDropZone() {\n this.getElement(selectors.ADDCOLUMNCONTAINER).classList.remove('mod_kanban_insert');\n }\n\n /**\n * Scroll to the left.\n */\n _scrollLeft() {\n this.getElement(selectors.MAIN).scrollLeft -= document.querySelector('.mod_kanban_column').clientWidth * 0.75;\n }\n\n /**\n * Scroll to the right.\n */\n _scrollRight() {\n this.getElement(selectors.MAIN).scrollLeft += document.querySelector('.mod_kanban_column').clientWidth * 0.75;\n }\n\n /**\n * Only show scroll buttons if it's possible to scroll in this direction.\n */\n _updateScrollButtons() {\n let main = this.getElement(selectors.MAIN);\n if (main.scrollLeft <= 1) {\n this.getElement(selectors.SCROLLLEFT).style.setProperty('visibility', 'hidden');\n } else {\n this.getElement(selectors.SCROLLLEFT).style.setProperty('visibility', 'visible');\n }\n if (main.clientWidth + main.scrollLeft < main.scrollWidth) {\n this.getElement(selectors.SCROLLRIGHT).style.setProperty('visibility', 'visible');\n } else {\n this.getElement(selectors.SCROLLRIGHT).style.setProperty('visibility', 'hidden');\n }\n }\n}\n"],"names":["KanbanComponent","target","this","element","document","getElementById","create","cmid","dataset","id","getWatchers","watch","handler","_boardUpdated","_columnCreated","_reload","_commonUpdated","state","addEventListener","getElement","selectors","ADDCOLUMNFIRST","_addColumn","capabilities","get","MANAGEBOARD","value","LOCKBOARDCOLUMNS","_lockColumns","UNLOCKBOARDCOLUMNS","_unlockColumns","SAVEASTEMPLATE","_templateConfirm","SHOWTEMPLATE","_showTemplate","DELETETEMPLATE","_deleteTemplateConfirm","DELETEBOARD","_deleteConfirm","SCROLLLEFT","_scrollLeft","SCROLLRIGHT","_scrollRight","MAIN","_updateScrollButtons","dragdrop","DragDrop","common","liveupdate","_continuousUpdate","toggleClass","documentElement","window","location","href","M","cfg","wwwroot","reactive","template","replace","userid","setInterval","dispatch","destroy","undefined","unregister","Str","get_strings","key","component","then","strings","_saveAsTemplate","catch","error","Log","debug","_deleteBoard","colcontainer","COLUMNCONTAINER","sequence","split","children","forEach","node","classList","contains","includes","removeChild","sort","a","b","indexOf","appendChild","locked","hastemplate","data","Object","assign","title","options","exporter","exportCapabilities","placeholder","createElement","setAttribute","newelement","renderComponent","replaceChild","activeElement","blur","validateDropData","dropdata","type","drop","showDropZone","ADDCOLUMNCONTAINER","add","hideDropZone","remove","scrollLeft","querySelector","clientWidth","main","style","setProperty","scrollWidth"],"mappings":"6xDAY6BA,iGACR,0CACC,eAONC,eAED,IAAIC,KAAK,CACZC,QAFUC,SAASC,eAAeJ,UAS1CK,cACSC,KAAOL,KAAKC,QAAQK,QAAQD,UAC5BE,GAAKP,KAAKC,QAAQK,QAAQC,GAOnCC,oBACW,CACH,CAACC,sBAAwBC,QAASV,KAAKW,eACvC,CAACF,wBAA0BC,QAASV,KAAKY,gBACzC,CAACH,sBAAwBC,QAASV,KAAKa,SACvC,CAACJ,uBAAyBC,QAASV,KAAKc,kCAS/BC,YACRC,iBACDhB,KAAKiB,WAAWC,mBAAUC,gBAC1B,QACAnB,KAAKoB,YAEqD,GAA1DL,MAAMM,aAAaC,IAAID,sBAAaE,aAAaC,aAC5CR,iBACDhB,KAAKiB,WAAWC,mBAAUO,kBAC1B,QACAzB,KAAK0B,mBAEJV,iBACDhB,KAAKiB,WAAWC,mBAAUS,oBAC1B,QACA3B,KAAK4B,qBAEJZ,iBACDhB,KAAKiB,WAAWC,mBAAUW,gBAC1B,QACA7B,KAAK8B,uBAEJd,iBACDhB,KAAKiB,WAAWC,mBAAUa,cAC1B,QACA/B,KAAKgC,oBAEJhB,iBACDhB,KAAKiB,WAAWC,mBAAUe,gBAC1B,QACAjC,KAAKkC,8BAGRlB,iBACDhB,KAAKiB,WAAWC,mBAAUiB,aAC1B,QACAnC,KAAKoC,qBAEJpB,iBACDhB,KAAKiB,WAAWC,mBAAUmB,YAC1B,QACArC,KAAKsC,kBAEJtB,iBACDhB,KAAKiB,WAAWC,mBAAUqB,aAC1B,QACAvC,KAAKwC,mBAEJx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SAAS,iBAQ3BiD,iBAAiBC,gBAEE,WADJA,MAAAA,gBAAAA,SAAUC,MASzBC,KAAKF,eACIvD,SAASK,SAAS,aAAckD,SAASxG,GAAI,GAMtD2G,oBACSjG,WAAWC,mBAAUiG,oBAAoB/B,UAAUgC,IAAI,qBAMhEC,oBACSpG,WAAWC,mBAAUiG,oBAAoB/B,UAAUkC,OAAO,qBAMnEhF,mBACSrB,WAAWC,mBAAUuB,MAAM8E,YAAyE,IAA3DrH,SAASsH,cAAc,sBAAsBC,YAM/FjF,oBACSvB,WAAWC,mBAAUuB,MAAM8E,YAAyE,IAA3DrH,SAASsH,cAAc,sBAAsBC,YAM/F/E,2BACQgF,KAAO1H,KAAKiB,WAAWC,mBAAUuB,MACjCiF,KAAKH,YAAc,OACdtG,WAAWC,mBAAUmB,YAAYsF,MAAMC,YAAY,aAAc,eAEjE3G,WAAWC,mBAAUmB,YAAYsF,MAAMC,YAAY,aAAc,WAEtEF,KAAKD,YAAcC,KAAKH,WAAaG,KAAKG,iBACrC5G,WAAWC,mBAAUqB,aAAaoF,MAAMC,YAAY,aAAc,gBAElE3G,WAAWC,mBAAUqB,aAAaoF,MAAMC,YAAY,aAAc"} \ No newline at end of file +{"version":3,"file":"board.min.js","sources":["../src/board.js"],"sourcesContent":["import {DragDrop} from 'core/reactive';\nimport selectors from 'mod_kanban/selectors';\nimport capabilities from 'mod_kanban/capabilities';\nimport exporter from 'mod_kanban/exporter';\nimport KanbanComponent from 'mod_kanban/kanbancomponent';\nimport Log from 'core/log';\nimport {saveCancel} from 'core/notification';\nimport * as Str from 'core/str';\n\n/**\n * Component representing a kanban board.\n */\nexport default class extends KanbanComponent {\n LOCKED_COLUMNS = 1;\n LOCKED_COMPLETE = 2;\n\n /**\n * Init component\n * @param {HTMLElement} target Element to attach the component to\n * @returns {KanbanComponent}\n */\n static init(target) {\n let element = document.getElementById(target);\n return new this({\n element: element,\n });\n }\n\n /**\n * Called before registering to reactive instance.\n */\n create() {\n this.cmid = this.element.dataset.cmid;\n this.id = this.element.dataset.id;\n }\n\n /**\n * Watchers defined by this component.\n * @returns {array}\n */\n getWatchers() {\n return [\n {watch: `board:updated`, handler: this._boardUpdated},\n {watch: `columns:created`, handler: this._columnCreated},\n {watch: `board:deleted`, handler: this._reload},\n {watch: `common:updated`, handler: this._commonUpdated},\n ];\n }\n\n /**\n * Called once when state is ready (also if component is registered after initial state was set), attaching event\n * isteners and initializing drag and drop.\n * @param {*} state The initial state\n */\n async stateReady(state) {\n this.addEventListener(\n this.getElement(selectors.ADDCOLUMNFIRST),\n 'click',\n this._addColumn\n );\n if (state.capabilities.get(capabilities.MANAGEBOARD).value == true) {\n this.addEventListener(\n this.getElement(selectors.LOCKBOARDCOLUMNS),\n 'click',\n this._lockColumns\n );\n this.addEventListener(\n this.getElement(selectors.UNLOCKBOARDCOLUMNS),\n 'click',\n this._unlockColumns\n );\n this.addEventListener(\n this.getElement(selectors.SAVEASTEMPLATE),\n 'click',\n this._templateConfirm\n );\n this.addEventListener(\n this.getElement(selectors.SHOWTEMPLATE),\n 'click',\n this._showTemplate\n );\n this.addEventListener(\n this.getElement(selectors.DELETETEMPLATE),\n 'click',\n this._deleteTemplateConfirm\n );\n this.addEventListener(\n this.getElement(selectors.DELETEBOARD),\n 'click',\n this._deleteConfirm\n );\n }\n this.addEventListener(\n this.getElement(selectors.SCROLLLEFT),\n 'click',\n this._scrollLeft\n );\n this.addEventListener(\n this.getElement(selectors.SCROLLRIGHT),\n 'click',\n this._scrollRight\n );\n this.addEventListener(\n this.getElement(selectors.MAIN),\n 'scroll',\n this._updateScrollButtons\n );\n this.dragdrop = new DragDrop(this);\n if (state.common.liveupdate > 0) {\n this._continuousUpdate(state.common.liveupdate);\n }\n this.toggleClass('ontouchstart' in document.documentElement, 'mod_kanban_touch');\n this._updateScrollButtons();\n }\n\n /**\n * Called to show template.\n */\n _showTemplate() {\n window.location.href =\n M.cfg.wwwroot +\n '/mod/kanban/view.php?id=' +\n this.reactive.state.common.id +\n '&boardid=' +\n this.reactive.state.common.template;\n }\n\n /**\n * Reload current page.\n */\n _reload() {\n window.location.replace(\n M.cfg.wwwroot + '/mod/kanban/view.php?id=' + this.reactive.state.common.id +\n '&userid=' + this.reactive.state.common.userid);\n }\n\n /**\n * Start continuous update.\n * @param {number} seconds Seconds between two refresh calls, defaults to 10\n */\n _continuousUpdate(seconds = 10) {\n setInterval(() => {\n this.reactive.dispatch('getUpdates');\n }, seconds * 1000);\n }\n\n /**\n * Called when common data was updated\n * @param {*} param0\n */\n _commonUpdated({element}) {\n this.toggleClass(element.template != 0, 'mod_kanban_hastemplate');\n }\n\n /**\n * Remove all subcomponents dependencies.\n */\n destroy() {\n if (this.dragdrop !== undefined) {\n this.dragdrop.unregister();\n }\n this._reload();\n }\n\n /**\n * Display confirmation modal for saving a board as template.\n */\n _templateConfirm() {\n Str.get_strings([\n {key: 'saveastemplate', component: 'mod_kanban'},\n {key: 'saveastemplateconfirm', component: 'mod_kanban'},\n {key: 'save', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._saveAsTemplate();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Called when current board should be saved as template.\n */\n _saveAsTemplate() {\n this.reactive.dispatch('saveAsTemplate');\n }\n\n /**\n * Display confirmation modal for deleting a board.\n */\n _deleteConfirm() {\n Str.get_strings([\n {key: 'deleteboard', component: 'mod_kanban'},\n {key: 'deleteboardconfirm', component: 'mod_kanban'},\n {key: 'delete', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._deleteBoard();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Display confirmation modal for deleting a template.\n */\n _deleteTemplateConfirm() {\n Str.get_strings([\n {key: 'deletetemplate', component: 'mod_kanban'},\n {key: 'deletetemplateconfirm', component: 'mod_kanban'},\n {key: 'delete', component: 'core'},\n ]).then((strings) => {\n return saveCancel(\n strings[0],\n strings[1],\n strings[2],\n () => {\n this._deleteBoard();\n }\n );\n }).catch((error) => Log.debug(error));\n }\n\n /**\n * Called to delete current board.\n */\n _deleteBoard() {\n this.reactive.dispatch('deleteBoard');\n }\n\n /**\n * Called when board was updated.\n * @param {*} param0\n */\n _boardUpdated({element}) {\n const colcontainer = this.getElement(selectors.COLUMNCONTAINER);\n if (element.sequence !== undefined) {\n let sequence = element.sequence.split(',');\n // Remove all columns from frontend that are no longer present in the database.\n [...colcontainer.children]\n .forEach((node) => {\n if (node.classList.contains('mod_kanban_column') && !sequence.includes(node.dataset.id)) {\n colcontainer.removeChild(node);\n }\n });\n // Reorder columns according to sequence from the database.\n [...colcontainer.children]\n .sort((a, b) => sequence.indexOf(a.dataset.id) > sequence.indexOf(b.dataset.id) ? 1 : -1)\n .forEach(node => colcontainer.appendChild(node));\n }\n // Set CSS classes to show/hide action menu items.\n this.toggleClass(element.locked, 'mod_kanban_board_locked_columns');\n this.toggleClass(element.hastemplate, 'mod_kanban_hastemplate');\n this._updateScrollButtons();\n }\n\n /**\n * Called when a new column was added. Creates a new subcomponent.\n * @param {*} param0\n */\n async _columnCreated({element}) {\n let data = Object.assign({\n id: element.id,\n title: element.title,\n options: element.options,\n sequence: element.sequence,\n }, exporter.exportCapabilities(this.reactive.state));\n let placeholder = document.createElement('li');\n placeholder.setAttribute('data-id', data.id);\n this.getElement(selectors.COLUMNCONTAINER).appendChild(placeholder);\n const newcomponent = await this.renderComponent(placeholder, 'mod_kanban/column', data);\n const newelement = newcomponent.getElement();\n this.getElement(selectors.COLUMNCONTAINER).replaceChild(newelement, placeholder);\n // Make sure that the new column is recognized for the scroll buttons.\n this._updateScrollButtons();\n }\n\n /**\n * Called to add a column.\n */\n _addColumn() {\n document.activeElement.blur();\n // Board component only handles adding a column at the leftmost position, hence second parameter is always 0.\n this.reactive.dispatch('addColumn', 0);\n }\n\n /**\n * Called to lock all columns.\n */\n _lockColumns() {\n this.reactive.dispatch('lockColumns');\n }\n\n /**\n * Called to unlock all columns.\n */\n _unlockColumns() {\n this.reactive.dispatch('unlockColumns');\n }\n\n /**\n * Validate draggable data. This component only accepts columns.\n * @param {object} dropdata\n * @returns {boolean} if the data is valid for this drop-zone.\n */\n validateDropData(dropdata) {\n let type = dropdata?.type;\n return type == 'column';\n }\n\n /**\n * Executed when a valid dropdata is dropped over the drop-zone.\n * Moves the dropped column to the leftmost position (other positions are handled by column component).\n * @param {object} dropdata\n */\n drop(dropdata) {\n this.reactive.dispatch('moveColumn', dropdata.id, 0);\n }\n\n /**\n * Show some visual hints to the user.\n */\n showDropZone() {\n this.getElement(selectors.ADDCOLUMNCONTAINER).classList.add('mod_kanban_insert');\n }\n\n /**\n * Remove visual hints to the user.\n */\n hideDropZone() {\n this.getElement(selectors.ADDCOLUMNCONTAINER).classList.remove('mod_kanban_insert');\n }\n\n /**\n * Scroll to the left.\n */\n _scrollLeft() {\n this.getElement(selectors.MAIN).scrollLeft -= document.querySelector('.mod_kanban_column').clientWidth * 0.75;\n }\n\n /**\n * Scroll to the right.\n */\n _scrollRight() {\n this.getElement(selectors.MAIN).scrollLeft += document.querySelector('.mod_kanban_column').clientWidth * 0.75;\n }\n\n /**\n * Only show scroll buttons if it's possible to scroll in this direction.\n */\n _updateScrollButtons() {\n let main = this.getElement(selectors.MAIN);\n if (main.scrollLeft <= 1) {\n this.getElement(selectors.SCROLLLEFT).style.setProperty('visibility', 'hidden');\n } else {\n this.getElement(selectors.SCROLLLEFT).style.setProperty('visibility', 'visible');\n }\n if (main.clientWidth + main.scrollLeft < main.scrollWidth) {\n this.getElement(selectors.SCROLLRIGHT).style.setProperty('visibility', 'visible');\n } else {\n this.getElement(selectors.SCROLLRIGHT).style.setProperty('visibility', 'hidden');\n }\n }\n}\n"],"names":["KanbanComponent","target","this","element","document","getElementById","create","cmid","dataset","id","getWatchers","watch","handler","_boardUpdated","_columnCreated","_reload","_commonUpdated","state","addEventListener","getElement","selectors","ADDCOLUMNFIRST","_addColumn","capabilities","get","MANAGEBOARD","value","LOCKBOARDCOLUMNS","_lockColumns","UNLOCKBOARDCOLUMNS","_unlockColumns","SAVEASTEMPLATE","_templateConfirm","SHOWTEMPLATE","_showTemplate","DELETETEMPLATE","_deleteTemplateConfirm","DELETEBOARD","_deleteConfirm","SCROLLLEFT","_scrollLeft","SCROLLRIGHT","_scrollRight","MAIN","_updateScrollButtons","dragdrop","DragDrop","common","liveupdate","_continuousUpdate","toggleClass","documentElement","window","location","href","M","cfg","wwwroot","reactive","template","replace","userid","setInterval","dispatch","destroy","undefined","unregister","Str","get_strings","key","component","then","strings","_saveAsTemplate","catch","error","Log","debug","_deleteBoard","colcontainer","COLUMNCONTAINER","sequence","split","children","forEach","node","classList","contains","includes","removeChild","sort","a","b","indexOf","appendChild","locked","hastemplate","data","Object","assign","title","options","exporter","exportCapabilities","placeholder","createElement","setAttribute","newelement","renderComponent","replaceChild","activeElement","blur","validateDropData","dropdata","type","drop","showDropZone","ADDCOLUMNCONTAINER","add","hideDropZone","remove","scrollLeft","querySelector","clientWidth","main","style","setProperty","scrollWidth"],"mappings":"6xDAY6BA,iGACR,0CACC,eAONC,eAED,IAAIC,KAAK,CACZC,QAFUC,SAASC,eAAeJ,UAS1CK,cACSC,KAAOL,KAAKC,QAAQK,QAAQD,UAC5BE,GAAKP,KAAKC,QAAQK,QAAQC,GAOnCC,oBACW,CACH,CAACC,sBAAwBC,QAASV,KAAKW,eACvC,CAACF,wBAA0BC,QAASV,KAAKY,gBACzC,CAACH,sBAAwBC,QAASV,KAAKa,SACvC,CAACJ,uBAAyBC,QAASV,KAAKc,kCAS/BC,YACRC,iBACDhB,KAAKiB,WAAWC,mBAAUC,gBAC1B,QACAnB,KAAKoB,YAEqD,GAA1DL,MAAMM,aAAaC,IAAID,sBAAaE,aAAaC,aAC5CR,iBACDhB,KAAKiB,WAAWC,mBAAUO,kBAC1B,QACAzB,KAAK0B,mBAEJV,iBACDhB,KAAKiB,WAAWC,mBAAUS,oBAC1B,QACA3B,KAAK4B,q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E,QAAQ8E,UACnBqB,kBAASC,mBAAmBrG,KAAKwD,SAASzC,QACzCuF,YAAcpG,SAASqG,cAAc,MACzCD,YAAYE,aAAa,UAAWT,KAAKxF,SACpCU,WAAWC,mBAAU4D,iBAAiBc,YAAYU,mBAEjDG,kBADqBzG,KAAK0G,gBAAgBJ,YAAa,oBAAqBP,OAClD9E,kBAC3BA,WAAWC,mBAAU4D,iBAAiB6B,aAAaF,WAAYH,kBAE/D5D,uBAMTtB,aACIlB,SAAS0G,cAAcC,YAElBrD,SAASK,SAAS,YAAa,GAMxCnC,oBACS8B,SAASK,SAAS,eAM3BjC,sBACS4B,SAASK,SAAS,iBAQ3BiD,iBAAiBC,gBAEE,WADJA,MAAAA,gBAAAA,SAAUC,MASzBC,KAAKF,eACIvD,SAASK,SAAS,aAAckD,SAASxG,GAAI,GAMtD2G,oBACSjG,WAAWC,mBAAUiG,oBAAoB/B,UAAUgC,IAAI,qBAMhEC,oBACSpG,WAAWC,mBAAUiG,oBAAoB/B,UAAUkC,OAAO,qBAMnEhF,mBACSrB,WAAWC,mBAAUuB,MAAM8E,YAAyE,IAA3DrH,SAASsH,cAAc,sBAAsBC,YAM/FjF,oBACSvB,WAAWC,mBAAUuB,MAAM8E,YAAyE,IAA3DrH,SAASsH,cAAc,sBAAsBC,YAM/F/E,2BACQgF,KAAO1H,KAAKiB,WAAWC,mBAAUuB,MACjCiF,KAAKH,YAAc,OACdtG,WAAWC,mBAAUmB,YAAYsF,MAAMC,YAAY,aAAc,eAEjE3G,WAAWC,mBAAUmB,YAAYsF,MAAMC,YAAY,aAAc,WAEtEF,KAAKD,YAAcC,KAAKH,WAAaG,KAAKG,iBACrC5G,WAAWC,mBAAUqB,aAAaoF,MAAMC,YAAY,aAAc,gBAElE3G,WAAWC,mBAAUqB,aAAaoF,MAAMC,YAAY,aAAc"} \ No newline at end of file diff --git a/amd/src/board.js b/amd/src/board.js index daf02890..016459b4 100644 --- a/amd/src/board.js +++ b/amd/src/board.js @@ -84,12 +84,12 @@ export default class extends KanbanComponent { 'click', this._deleteTemplateConfirm ); + this.addEventListener( + this.getElement(selectors.DELETEBOARD), + 'click', + this._deleteConfirm + ); } - this.addEventListener( - this.getElement(selectors.DELETEBOARD), - 'click', - this._deleteConfirm - ); this.addEventListener( this.getElement(selectors.SCROLLLEFT), 'click',