Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/calendar/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/calendar/amd/build/view_manager.min.js

function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core_calendar/view_manager",["exports","jquery","core/templates","core/notification","core_calendar/repository","core_calendar/events","core_calendar/selectors","core/modal_factory","core/modal_events","core_calendar/summary_modal","core/custom_interaction_events","core/pending"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=a.reloadCurrentUpcoming=a.changeDay=a.reloadCurrentDay=a.refreshDayContent=a.reloadCurrentMonth=a.changeMonth=a.refreshMonthContent=void 0;b=o(b);c=o(c);d=o(d);e=n(e);f=o(f);g=n(g);h=o(h);i=o(i);j=o(j);k=o(k);l=o(l);function m(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;m=function(){return a};return a}function n(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=m();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function o(a){return a&&a.__esModule?a:{default:a}}var p=function(a){a=(0,b.default)(a);a.on("click",g.links.eventLink,function(a){var b=a.target,c=null,d=null,e=new l.default("core_calendar/view_manager:eventLink:click");if(b.matches(g.actions.viewEvent)){c=b}else{c=b.closest(g.actions.viewEvent)}if(c){d=c.dataset.eventId}else{d=b.querySelector(g.actions.viewEvent).dataset.eventId}if(d){a.preventDefault();a.stopPropagation();A(d).then(e.resolve).catch()}else{e.resolve()}});a.on("click",g.links.navLink,function(b){var c=a.find(g.wrapper),d=c.data("view"),e=c.data("courseid"),f=c.data("categoryid"),h=b.currentTarget;if("month"===d){r(a,h.href,h.dataset.year,h.dataset.month,e,f,h.dataset.day);b.preventDefault()}else if("day"===d){v(a,h.href,h.dataset.year,h.dataset.month,h.dataset.day,e,f);b.preventDefault()}});var c=a.find(g.viewSelector);k.default.define(c,[k.default.events.activate]);c.on(k.default.events.activate,function(b){b.preventDefault();var c=b.target;if(c.classList.contains("active")){return}var e=c.dataset.view,f=c.dataset.year,g=c.dataset.month,h=c.dataset.day,i=c.dataset.courseid,j=c.dataset.categoryid;if("month"==e){q(a,f,g,i,j,a,"core_calendar/calendar_month",h).then(function(){return window.history.pushState({},"","?view=month")}).fail(d.default.exception)}else if("day"==e){t(a,f,g,h,i,j,a,"core_calendar/calendar_day").then(function(){return window.history.pushState({},"","?view=day")}).fail(d.default.exception)}else if("upcoming"==e){y(a,i,j,a,"core_calendar/calendar_upcoming").then(function(){return window.history.pushState({},"","?view=upcoming")}).fail(d.default.exception)}})},q=function(a,b,h,i,j){var k=5<arguments.length&&arguments[5]!==void 0?arguments[5]:null,l=6<arguments.length&&arguments[6]!==void 0?arguments[6]:"",m=7<arguments.length&&arguments[7]!==void 0?arguments[7]:1;w(a);k=k||a.find(g.wrapper);l=l||a.attr("data-template");M.util.js_pending([a.get("id"),b,h,i].join("-"));var n=a.data("includenavigation"),o=a.data("mini");return e.getCalendarMonthData(b,h,i,j,n,o,m).then(function(a){a.viewingmonth=!0;return c.default.render(l,a)}).then(function(a,b){return c.default.replaceNode(k,a,b)}).then(function(){document.querySelector("body").dispatchEvent(new CustomEvent(f.default.viewUpdated))}).always(function(){M.util.js_complete([a.get("id"),b,h,i].join("-"));return x(a)}).fail(d.default.exception)};a.refreshMonthContent=q;var r=function(a,c,d,e,g,h){var i=6<arguments.length&&arguments[6]!==void 0?arguments[6]:1;return q(a,d,e,g,h,null,"",i).then(function(){if(c.length&&"#"!==c){window.history.pushState({},"",c)}for(var a=arguments.length,b=Array(a),d=0;d<a;d++){b[d]=arguments[d]}return b}).then(function(){(0,b.default)("body").trigger(f.default.monthChanged,[d,e,g,h]);for(var a=arguments.length,c=Array(a),i=0;i<a;i++){c[i]=arguments[i]}return c})};a.changeMonth=r;var s=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0,d=a.find(g.wrapper).data("year"),e=a.find(g.wrapper).data("month"),f=a.find(g.wrapper).data("day");b=b||a.find(g.wrapper).data("courseid");c=c||a.find(g.wrapper).data("categoryid");return q(a,d,e,b,c,null,"",f)};a.reloadCurrentMonth=s;var t=function(a,b,h,i,j,k){var l=6<arguments.length&&arguments[6]!==void 0?arguments[6]:null,m=7<arguments.length&&arguments[7]!==void 0?arguments[7]:"";w(a);l=l||a.find(g.wrapper);m=m||a.attr("data-template");M.util.js_pending([a.get("id"),b,h,i,j,k].join("-"));var n=a.data("includenavigation");return e.getCalendarDayData(b,h,i,j,k,n).then(function(a){a.viewingday=!0;return c.default.render(m,a)}).then(function(a,b){return c.default.replaceNode(l,a,b)}).then(function(){document.querySelector("body").dispatchEvent(new CustomEvent(f.default.viewUpdated))}).always(function(){M.util.js_complete([a.get("id"),b,h,i,j,k].join("-"));return x(a)}).fail(d.default.exception)};a.refreshDayContent=t;var u=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0,d=a.find(g.wrapper),e=d.data("year"),f=d.data("month"),h=d.data("day");b=b||a.find(g.wrapper).data("courseid");c=c||a.find(g.wrapper).data("categoryid");return t(a,e,f,h,b,c)};a.reloadCurrentDay=u;var v=function(a,c,d,e,g,h,i){return t(a,d,e,g,h,i).then(function(){if(c.length&&"#"!==c){window.history.pushState({},"",c)}for(var a=arguments.length,b=Array(a),d=0;d<a;d++){b[d]=arguments[d]}return b}).then(function(){(0,b.default)("body").trigger(f.default.dayChanged,[d,e,h,i]);for(var a=arguments.length,c=Array(a),g=0;g<a;g++){c[g]=arguments[g]}return c})};a.changeDay=v;var w=function(a){var b=a.find(g.containers.loadingIcon);b.removeClass("hidden")},x=function(a){var b=a.find(g.containers.loadingIcon);b.addClass("hidden")},y=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0,i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null,j=4<arguments.length&&arguments[4]!==void 0?arguments[4]:"";w(a);i=i||a.find(g.wrapper);j=j||a.attr("data-template");b=b||a.find(g.wrapper).data("courseid");h=h||a.find(g.wrapper).data("categoryid");return e.getCalendarUpcomingData(b,h).then(function(a){a.viewingupcoming=!0;return c.default.render(j,a)}).then(function(a,b){return c.default.replaceNode(i,a,b)}).then(function(){document.querySelector("body").dispatchEvent(new CustomEvent(f.default.viewUpdated))}).always(function(){return x(a)}).fail(d.default.exception)};a.reloadCurrentUpcoming=y;var z=function(a){return"calendar_event_"+a},A=function(a){var b=new l.default("core_calendar/view_manager:renderEventSummaryModal");return e.getEventById(a).then(function(b){if(!b.event){throw new Error("Error encountered while trying to fetch calendar event with ID: "+a)}return b.event}).then(function(a){var b={title:a.name,type:j.default.TYPE,body:c.default.render("core_calendar/event_summary_body",a),templateContext:{canedit:a.canedit,candelete:a.candelete,headerclasses:z(a.normalisedeventtype),isactionevent:a.isactionevent,url:a.url,action:a.action}};return h.default.create(b)}).then(function(a){a.getRoot().on(i.default.hidden,function(){a.destroy()});a.show();return a}).then(function(a){b.resolve();return a}).catch(d.default.exception)};a.init=function init(a,b){p(a,b)}});
//# sourceMappingURL=view_manager.min.js.map