heroweb/templatesrcpoc/assets/js/plugins/jkanban.min.js

1 line
22 KiB
JavaScript
Raw Normal View History

2024-09-02 06:01:44 +00:00
!function o(a,c,d){function s(t,e){if(!c[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=c[t]={exports:{}};a[t][0].call(r.exports,function(e){return s(a[t][1][e]||e)},r,r.exports,o,a,c,d)}return c[t].exports}for(var u="function"==typeof require&&require,e=0;e<d.length;e++)s(d[e]);return s}({1:[function(e,t,n){var i=e("dragula");!function(){this.jKanban=function(){var b=this,e={enabled:!1};this._disallowedItemProperties=["id","title","click","drag","dragend","drop","order"],this.element="",this.container="",this.boardContainer=[],this.handlers=[],this.dragula=i,this.drake="",this.drakeBoard="",this.addItemButton=!1;var t={element:"",gutter:"15px",widthBoard:"250px",responsive:"700",responsivePercentage:!(this.buttonContent="+"),boards:[],dragBoards:!0,dragItems:!0,addItemButton:!1,buttonContent:"+",itemHandleOptions:this.itemHandleOptions=e,dragEl:function(e,t){},dragendEl:function(e){},dropEl:function(e,t,n,i){},dragBoard:function(e,t){},dragendBoard:function(e){},dropBoard:function(e,t,n,i){},click:function(e){},buttonClick:function(e,t){}};function y(e){e.addEventListener("click",function(e){e.preventDefault(),b.options.click(this),"function"==typeof this.clickfn&&this.clickfn(this)})}function w(e,t){e.addEventListener("click",function(e){e.preventDefault(),b.options.buttonClick(this,t)})}function o(t){var n=[];return b.options.boards.map(function(e){if(e.id===t)return n.push(e)}),n[0]}function E(e,t){for(var n in t)-1<b._disallowedItemProperties.indexOf(n)||e.setAttribute("data-"+n,t[n])}function T(e){var t=e;if(b.options.itemHandleOptions.enabled)if(void 0===(b.options.itemHandleOptions.customHandler||void 0)){var n=b.options.itemHandleOptions.customCssHandler,i=b.options.itemHandleOptions.customCssIconHandler;void 0===(n||void 0)&&(n="drag_handler"),void 0===(i||void 0)&&(i=n+"_icon"),t="<div class='item_handle "+n+"'><i class='item_handle "+i+"'></i></div><div>"+t+"</div>"}else t=b.options.itemHandleOptions.customHandler.replace("%s",t);return t}arguments[0]&&"object"==typeof arguments[0]&&(this.options=function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(t,arguments[0])),this.__getCanMove=function(e){return b.options.itemHandleOptions.enabled?b.options.itemHandleOptions.handleClass?e.classList.contains(b.options.itemHandleOptions.handleClass):e.classList.contains("item_handle"):!!b.options.dragItems},this.init=function(){!function(){b.element=document.querySelector(b.options.element);var e=document.createElement("div");e.classList.add("kanban-container"),b.container=e,b.addBoards(b.options.boards,!0),b.element.appendChild(b.container)}(),window.innerWidth>b.options.responsive&&(b.drakeBoard=b.dragula([b.container],{moves:function(e,t,n,i){return!!b.options.dragBoards&&(n.classList.contains("kanban-board-header")||n.classList.contains("kanban-title-board"))},accepts:function(e,t,n,i){return t.classList.contains("kanban-container")},revertOnSpill:!0,direction:"horizontal"}).on("drag",function(e,t){e.classList.add("is-moving"),b.options.dragBoard(e,t),"function"==typeof e.dragfn&&e.dragfn(e,t)}).on("dragend",function(e){!function(){for(var e=1,t=0;t<b.container.childNodes.length;t++)b.container.childNodes[t].dataset.order=e++}(),e.classList.remove("is-moving"),b.options.dragendBoard(e),"function"==typeof e.dragendfn&&e.dragendfn(e)}).on("drop",function(e,t,n,i){e.classList.remove("is-moving"),b.options.dropBoard(e,t,n,i),"function"==typeof e.dropfn&&e.dropfn(e,t,n,i)}),b.drake=b.dragula(b.boardContainer,{moves:function(e,t,n,i){return b.__getCanMove(n)},revertOnSpill:!0}).on("cancel",function(e,t,n){b.enableAllBoards()}).on("drag",function(e,t){var n=e.getAttribute("class");if(""!==n&&-1<n.indexOf("not-draggable"))b.drake.cancel(!0);else{e.classList.add("is-moving");var i=o(t.parentNode.dataset.id);void 0!==i.dragTo&&b.options.boards.map(function(e){-1===i.dragTo.indexOf(e.id)&&e.id!==t.parentNode.dataset.id&&b.findBoard(e.id).classList.add("disabled-board")})