Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/ |
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/month_view_drag_drop.min.js |
define ("core_calendar/month_view_drag_drop",["jquery","core/notification","core/str","core_calendar/events","core_calendar/drag_drop_data_store"],function(a,b,c,d,f){var g={ROOT:"[data-region='calendar']",DRAGGABLE:"[draggable=\"true\"][data-region=\"event-item\"]",DROP_ZONE:"[data-drop-zone=\"month-view-day\"]",WEEK:"[data-region=\"month-view-week\"]"},h="bg-faded",i="bg-danger text-white",j="bg-primary text-white",k=h+" "+i+" "+j,l=!1,m=function(b){var c=a(b.target).closest(g.DROP_ZONE);return c.length?c:null},n=function(a){var b=a.attr("data-day-timestamp"),c=f.getMinTimestart(),d=f.getMaxTimestart();if(c&&c>b){return!1}if(d&&d<b){return!1}return!0},o=function(a){var b=a.attr("data-day-timestamp"),c=f.getMinTimestart(),d=f.getMaxTimestart();if(c&&c>b){return f.getMinError()}if(d&&d<b){return f.getMaxError()}return null},p=function(){a(g.ROOT).find(g.DROP_ZONE).each(function(b,c){c=a(c);c.removeClass(k)})},q=function(a,b,c){if("undefined"==typeof c){c=f.getDurationDays()}var d=n(a);a.removeClass(k);if(b){if(d){a.addClass(j)}else{a.addClass(i)}}else{a.removeClass(j+" "+i);if(!d){a.addClass(h)}}c--;if(0<c){var e=a.next();if(!e.length){var l=a.closest(g.WEEK).next();if(l.length){e=l.children(g.DROP_ZONE).first()}}if(e.length){q(e,b,c)}}},r=function(){a(g.ROOT).find(g.DROP_ZONE).each(function(b,c){c=a(c);if(!n(c)){q(c,!1)}})},s=function(b){var c=a(b.target),d=c.closest(g.DRAGGABLE);if(!d.length){return}var e=d.find("[data-event-id]"),h=e.attr("data-event-id"),i=d.attr("data-min-day-timestamp"),j=d.attr("data-max-day-timestamp"),k=d.attr("data-min-day-error"),l=d.attr("data-max-day-error"),m=g.ROOT+" [data-event-id=\""+h+"\"]",n=a(m).length;f.setEventId(h);f.setDurationDays(n);if(i){f.setMinTimestart(i)}if(j){f.setMaxTimestart(j)}if(k){f.setMinError(k)}if(l){f.setMaxError(l)}b.dataTransfer.effectAllowed="move";b.dataTransfer.dropEffect="move";b.dataTransfer.setData("text/plain",h);b.dropEffect="move";r()},t=function(a){if(!f.hasEventId()){return}a.preventDefault();var b=m(a);if(!b){return}q(b,!0)},u=function(a){if(!f.hasEventId()){return}var b=m(a);if(!b){return}q(b,!1);a.preventDefault()},v=function(h){if(!f.hasEventId()){return}var e=m(h);if(!e){f.clearAll();p();return}if(n(e)){var i=f.getEventId(),j=g.ROOT+" [data-event-id=\""+i+"\"]",k=a(j),l=null;if(k.length){l=k.closest(g.DROP_ZONE)}a("body").trigger(d.moveEvent,[i,l,e])}else{var q=o(e);c.get_string("errorinvaliddate","calendar").then(function(a){b.exception({name:a,message:q||a})})}f.clearAll();p();h.preventDefault()},w=function(){f.clearAll();p()},x=function(){r()};return{init:function init(){if(!l){document.addEventListener("dragstart",s,!1);document.addEventListener("dragover",t,!1);document.addEventListener("dragleave",u,!1);document.addEventListener("drop",v,!1);document.addEventListener("dragend",w,!1);a("body").on(d.monthChanged,x);l=!0}}}}); //# sourceMappingURL=month_view_drag_drop.min.js.map