UNPKG

@innovation-system/vuetify-week-scheduler

Version:
3 lines 30.5 kB
var VuetifyWeekScheduler=function(t){"use strict";function e(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function o(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?e(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function n(){ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ n=function(){return t};var t={},e=Object.prototype,o=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function d(t,e,o){return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,o){return t[e]=o}}function c(t,e,o,n){var i=e&&e.prototype instanceof p?e:p,r=Object.create(i.prototype),s=new _(n||[]);return r._invoke=function(t,e,o){var n="suspendedStart";return function(i,r){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw r;return E()}for(o.method=i,o.arg=r;;){var s=o.delegate;if(s){var a=x(s,o);if(a){if(a===u)continue;return a}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===n)throw n="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n="executing";var d=l(t,e,o);if("normal"===d.type){if(n=o.done?"completed":"suspendedYield",d.arg===u)continue;return{value:d.arg,done:o.done}}"throw"===d.type&&(n="completed",o.method="throw",o.arg=d.arg)}}}(t,o,s),r}function l(t,e,o){try{return{type:"normal",arg:t.call(e,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var u={};function p(){}function h(){}function f(){}var v={};d(v,r,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==e&&o.call(y,r)&&(v=y);var m=f.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(i,r,s,a){var d=l(t[i],t,r);if("throw"!==d.type){var c=d.arg,u=c.value;return u&&"object"==typeof u&&o.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(u).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(d.arg)}var i;this._invoke=function(t,o){function r(){return new e((function(e,i){n(t,o,e,i)}))}return i=i?i.then(r,r):r()}}function x(t,e){var o=t.iterator[e.method];if(void 0===o){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=l(o,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,u;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function C(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=f,d(m,"constructor",f),d(f,"constructor",h),h.displayName=d(f,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,d(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(w.prototype),d(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,o,n,i,r){void 0===r&&(r=Promise);var s=new w(c(e,o,n,i),r);return t.isGeneratorFunction(o)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},b(m),d(m,a,"Generator"),d(m,r,(function(){return this})),d(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var o in t)e.push(o);return e.reverse(),function o(){for(;e.length;){var n=e.pop();if(n in t)return o.value=n,o.done=!1,o}return o.done=!0,o}},t.values=C,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(o,n){return s.type="throw",s.arg=t,e.next=o,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],s=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=o.call(r,"catchLoc"),d=o.call(r,"finallyLoc");if(a&&d){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!d)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var s=r?r.completion:{};return s.type=t,s.arg=e,r?(this.method="next",this.next=r.finallyLoc,u):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),P(o),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc===t){var n=o.completion;if("throw"===n.type){var i=n.arg;P(o)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,o){return this.delegate={iterator:C(t),resultName:e,nextLoc:o},"next"===this.method&&(this.arg=void 0),u}},t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,e,o,n,i,r,s){try{var a=t[r](s),d=a.value}catch(t){return void o(t)}a.done?e(d):Promise.resolve(d).then(n,i)}function s(t){return function(){var e=this,o=arguments;return new Promise((function(n,i){var s=t.apply(e,o);function a(t){r(s,n,i,a,d,"next",t)}function d(t){r(s,n,i,a,d,"throw",t)}a(void 0)}))}}function a(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==o)return;var n,i,r=[],s=!0,a=!1;try{for(o=o.call(t);!(s=(n=o.next()).done)&&(r.push(n.value),!e||r.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==o.return||o.return()}finally{if(a)throw i}}return r}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=new Array(e);o<e;o++)n[o]=t[o];return n}function u(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=c(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,a=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return s=t.done,t},e:function(t){a=!0,r=t},f:function(){try{s||null==o.return||o.return()}finally{if(a)throw r}}}}function p(t,e,o,n,i,r,s,a,d,c){"boolean"!=typeof s&&(d=a,a=s,s=!1);const l="function"==typeof o?o.options:o;let u;if(t&&t.render&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),n&&(l._scopeId=n),r?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,d(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},l._ssrRegister=u):e&&(u=s?function(t){e.call(this,c(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),u)if(l.functional){const t=l.render;l.render=function(e,o){return u.call(o),t(e,o)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,u):[u]}return o}var h={name:"vuetify-week-scheduler",components:{SchedulerPeriod:p({render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-hover",{scopedSlots:t._u([{key:"default",fn:function(e){var n=e.hover;return[o("div",{staticClass:"vws-period",style:{backgroundColor:t.options.backgroundColor,outlineColor:t.options.borderColor,textColor:t.options.textColor,color:t.options.textColor,top:t.period.top+"px",height:t.period.height+"px"},on:{mousedown:function(e){return e.stopPropagation(),t.$emit("period-drag",e)},touchstart:function(e){return e.stopPropagation(),t.$emit("period-drag",e)},contextmenu:function(e){return e.stopPropagation(),e.preventDefault(),t.$emit("edit",e)},dblclick:function(e){return e.stopPropagation(),e.preventDefault(),t.$emit("edit",e)}}},[o("div",{staticClass:"vws-period-container"},[o("v-icon",{directives:[{name:"show",rawName:"v-show",value:t.editable&&n,expression:"editable && hover"}],staticClass:"vws-handle",attrs:{small:""},on:{mousedown:function(e){return e.stopPropagation(),t.$emit("period-resize",{$event:e,isUp:!0,$el:t.$el})},touchstart:function(e){return e.stopPropagation(),t.$emit("period-resize",{$event:e,isUp:!0,$el:t.$el})}}},[t._v("\n mdi-chevron-up\n ")]),t._v(" "),o("div",{staticClass:"vws-period-time"},[t._v("\n "+t._s(t.options.start)+" - "+t._s(t.options.end)+"\n "),o("span",{directives:[{name:"show",rawName:"v-show",value:t.shortPeriod,expression:"shortPeriod"}],staticClass:"text--caption ml-2"},[t._v(t._s(t.options.title))])]),t._v(" "),o("div",{directives:[{name:"show",rawName:"v-show",value:!t.shortPeriod,expression:"!shortPeriod"}],staticClass:"vws-period-title text-truncate"},[t._v("\n "+t._s(t.options.title)+"\n ")]),t._v(" "),o("div",{directives:[{name:"show",rawName:"v-show",value:t.editable&&n,expression:"editable && hover"}],staticClass:"vws-period-buttons",attrs:{justify:"end"}},[o("v-btn",{attrs:{icon:"","x-small":"",title:t.settings.periodRemoveButton},on:{click:function(e){return e.stopPropagation(),t.$emit("delete")},mousedown:function(t){t.stopPropagation()},touchstart:function(t){t.stopPropagation()}}},[o("v-icon",{attrs:{"x-small":""}},[t._v("mdi-close")])],1),t._v(" "),o("v-btn",{attrs:{icon:"","x-small":"",title:t.settings.periodDuplicateButton},on:{click:function(e){return e.stopPropagation(),t.$emit("clone")},mousedown:function(t){t.stopPropagation()},touchstart:function(t){t.stopPropagation()}}},[o("v-icon",{attrs:{"x-small":""}},[t._v("mdi-content-copy")])],1)],1),t._v(" "),o("v-icon",{directives:[{name:"show",rawName:"v-show",value:t.editable&&n,expression:"editable && hover"}],staticClass:"vws-handle",staticStyle:{bottom:"0"},attrs:{small:""},on:{mousedown:function(e){return e.stopPropagation(),t.$emit("period-resize",{$event:e,isUp:!1,$el:t.$el})},touchstart:function(e){return e.stopPropagation(),t.$emit("period-resize",{$event:e,isUp:!1,$el:t.$el})}}},[t._v("\n mdi-chevron-down\n ")])],1)])]}}])})},staticRenderFns:[]},undefined,{components:{VIcon:t.VIcon,VBtn:t.VBtn,VHover:t.VHover},name:"vuetify-week-scheduler-period",props:{period:Object,settings:Object,blockHeight:Number,editable:{type:Boolean,default:!1}},computed:{options:function(){return this.period.options},shortPeriod:function(){return this.period.height<=30}}},undefined,false,undefined,!1,void 0,void 0,void 0),VIcon:t.VIcon,VBtn:t.VBtn,VHover:t.VHover,VTextField:t.VTextField,VListItem:t.VListItem,VList:t.VList,VMenu:t.VMenu},props:{config:{type:Object,default:function(){}},value:{type:Array,required:!0},editable:{type:Boolean,default:!1}},data:function(){return{settings:{},counter:0,blocksEachHour:0,maxBlocks:0,blockHeight:0,events:[],newPeriod:null,draggingPeriod:null,resizingPeriod:null,showEditMenu:!1,x:0,y:0,editEvent:null}},mounted:function(){this.settings=o(o({},this.getDefaults()),this.config),this.init(),this.handleEvents()},beforeDestroy:function(){this.events.forEach((function(t){t.element.removeEventListener(t.event,t.callback)}))},computed:{data:{get:function(){var t=this.value;if(this.value.length!==this.settings.days){t=[];for(var e=0;e<this.settings.days;e++)t.push({day:e,periods:[]});this.$emit("input",t)}return t},set:function(t){this.$emit("input",t)}},daysPeriods:function(){for(var t=[],e=0;e<this.settings.days;e++){var o,n={day:e,periods:[]};t.push(n);var i=null===(o=this.data)||void 0===o?void 0:o[e];if(i)for(var r=0;r<i.periods.length;r++){var s=i.periods[r],a=this.positionFormat(s.start),d=this.positionFormat(s.end);n.periods.push({options:this.addDefaults(s),index:r,top:a*this.blockHeight,height:(d-a)*this.blockHeight})}}return t},isMobile:function(){return this.$vuetify.breakpoint.mdAndDown}},methods:{getDefaults:function(){return{hour:24,days:7,periodDuration:15,periodTitle:"",periodBackgroundColor:"#F44336FF",periodBorderColor:"transparent",periodTextColor:"#000",periodRemoveButton:"Remove",periodDuplicateButton:"Duplicate",periodSelectWholeButton:"Select whole day",inputType:"text",daysList:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],colors:["#F44336","#FF9800","#FFEB3B","#8BC34A","#4CAF50","#00BCD4","#2196F3"]}},onDayDown:function(t,e){if(this.editable){var o=e.currentTarget.getBoundingClientRect(),n=this.getY(e,!0)-o.top,i=Math.floor(n/this.blockHeight),r=this.blocksToTime(i),s=this.blocksToTime(i+2),a=2*this.blockHeight;this.newPeriod={dragStart:this.getY(e,!0),startHeight:a,maxHeight:e.currentTarget.clientHeight,day:t,start:r,end:s,top:i*this.blockHeight,height:a}}},addDefaults:function(t){return o({title:this.settings.periodTitle,backgroundColor:this.settings.periodBackgroundColor,borderColor:this.settings.periodBorderColor,textColor:this.settings.periodTextColor},t)},handleEvents:function(){var t=this,e=function(){if(t.newPeriod)t.addPeriod(t.newPeriod.day,{start:t.newPeriod.start,end:t.newPeriod.end}),t.newPeriod=null;else if(t.draggingPeriod){var e=t.draggingPeriod,o=e.el,n=e.day,i=e.index,r=o.offsetTop,s=o.clientHeight;t.onPositionChange(n,i,{top:r,height:s}),t.draggingPeriod=null}else if(t.resizingPeriod){var a=t.resizingPeriod,d=a.el,c=a.day,l=a.index,u=d.offsetTop,p=d.clientHeight;t.onPositionChange(c,l,{top:u,height:p}),t.resizingPeriod=null}},o=function(e){if(t.newPeriod){e.preventDefault();var o=t.roundBlock(t.newPeriod.dragStart-t.getY(e,!0)),n=t.roundBlock(t.newPeriod.startHeight-o);if(n>t.blockHeight&&t.newPeriod.top+n<=t.newPeriod.maxHeight){var i=t.positionToInterval(t.newPeriod),r=i.start,s=i.end,a=t.data[t.newPeriod.day].periods;t.isValid({start:r,end:s},a)&&Object.assign(t.newPeriod,{height:n,start:r,end:s})}}else if(t.draggingPeriod){e.preventDefault();var d=t.draggingPeriod,c=d.startDrag,l=d.startTop,u=d.el,p=d.day,h=d.index,f=c-t.getY(e,!0),v=t.roundBlock(l-f),g=u.clientHeight;v+g<=u.parentElement.clientHeight&&v>=0&&(u.style.top="".concat(v,"px"),t.onPositionChange(p,h,{top:v,height:g}))}else if(t.resizingPeriod){e.preventDefault();var y=t.resizingPeriod,m=y.startDrag,b=y.startTop,w=y.startHeight,x=y.el,k=y.day,P=y.index,_=y.isUp,C=t.roundBlock(m-t.getY(e,!0)),E=_?t.roundBlock(b-C):x.offsetTop,T=t.roundBlock(w+(_?C:-C)),H=document.querySelector(".vws-day").clientHeight;E+(T=Math.max(T,t.blockHeight))<=H&&E>=0&&(x.style.height="".concat(T,"px"),_&&(x.style.top="".concat(E,"px")),t.onPositionChange(k,P,{top:E,height:T}))}};this.addListener(document,"mouseup",e),this.addListener(document,"touchend",e),this.addListener(document,"mousemove",o),this.addListener(document,"touchmove",o)},onPeriodDown:function(t,e,o){if(this.editable){var n=t.currentTarget;this.draggingPeriod={el:n,day:e,index:o,startDrag:this.getY(t,!1),startTop:n.offsetTop}}},onPeriodResize:function(t,e,o){if(this.editable){var n=t.$event,i=t.isUp,r=t.$el;this.resizingPeriod={el:r,day:e,index:o,isUp:i,startDrag:this.getY(n,!1),startTop:r.offsetTop,startHeight:r.clientHeight}}},addPeriod:function(t,e){this.data[t]||(this.data[t]={day:t,periods:[]});var o=this.data[t].periods;e=this.addDefaults(e),this.isValid(e,o)&&o.push(e)},init:function(){var t=this;try{if(![15,30,60].includes(this.settings.periodDuration))throw new Error("Invalide period duration");this.blocksEachHour=60/this.settings.periodDuration,this.maxBlocks=24*this.blocksEachHour,this.blockHeight=40/this.blocksEachHour,this.data.forEach((function(e){null==e||e.periods.forEach((function(o,n){t.isValid(o,e.periods)||(e.periods.splice(n,1),console.error("Invalid period duration",o))}))}))}catch(t){this.$emit("error",t)}},deletePeriod:function(t,e){this.data[t].periods.splice(e,1)},clonePeriod:function(t,e){var n,r="object"===i(e)?e:this.data[t].periods[e],s=u(this.data);try{for(s.s();!(n=s.n()).done;){var a=n.value;a.day!==t&&this.isValid(r,a.periods)&&a.periods.push(o({},r))}}catch(t){s.e(t)}finally{s.f()}},clearDayPeriods:function(t){this.data[t]&&(this.data[t].periods=[])},cloneDayPeriods:function(t){if(this.data[t]){var e,o=this.data[t].periods,n=u(this.data);try{for(n.s();!(e=n.n()).done;){if(e.value.day!==t){var i,r=u(o);try{for(r.s();!(i=r.n()).done;){var s=i.value;this.clonePeriod(t,s)}}catch(t){r.e(t)}finally{r.f()}}}}catch(t){n.e(t)}finally{n.f()}}},onPositionChange:function(t,e,o){var i=this;return s(n().mark((function r(){var s,a,d,c,l,u,p,h;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=null===(s=i.data)||void 0===s?void 0:s[t],!(d=null===(a=t)||void 0===a?void 0:a.periods[e])){n.next=10;break}return c=i.positionToInterval(o),l=c.start,u=c.end,p=d.start,h=d.end,Object.assign(d,{start:l,end:u}),n.next=9,i.$nextTick();case 9:i.isValid(d,t.periods)||Object.assign(d,{start:p,end:h});case 10:case"end":return n.stop()}}),r)})))()},roundBlock:function(t){return Math.round(t/this.blockHeight)*this.blockHeight},positionToInterval:function(t){return{start:this.blocksToTime(t.top/this.blockHeight),end:this.blocksToTime(Math.floor((t.top+t.height)/this.blockHeight))}},blocksToTime:function(t){t>this.maxBlocks&&(t=0),t<0&&(t=0);var e=Math.floor(t/this.blocksEachHour),o=60*(t/this.blocksEachHour-e);if(12===this.settings.hour){var n=e,i="";return e>=12&&(i="p"),e>12&&(n=e-12),0!==e&&24!==e||(i="",n=12),0!==o&&(n+=":".concat(o)),n+i}return e<10&&(e="0".concat(e)),o<10&&(o="0".concat(o)),23===e&&59===o&&(e="24",o="00"),"".concat(e,":").concat(o)},formatHour:function(t){if(12===this.settings.hour)switch(t){case 0:case 24:t="12am";break;case 12:t="12pm";break;default:t>12?t="".concat(t-12,"pm"):t+="am"}else t>24&&(t=0),t<10&&(t="0".concat(t)),t+=":00";return t},positionFormat:function(t){var e=t.split(":"),o=parseInt(e[0],10),n=parseInt(e[1],10);if(12===this.settings.hour){var i=t.match(/([0-1]?[0-9]):?([0-5][0-9])?\s?(am|pm|p)?/),r=i[3];r||(r="am"),o=parseInt(i[1],10),(n=parseInt(i[2],10))||(n=0),12===o&&"am"===r&&(o=0),12!==o||"pm"!==r&&"p"!==r||(r="am"),"pm"!==r&&"p"!==r||(o+=12)}var s=0;return s+=o*this.blocksEachHour,s+=n/60*this.blocksEachHour},isValid:function(t,e){var o,n=this.positionFormat(t.start),i=this.positionFormat(t.end),r=0,s=0,a=!0,d=u(e);try{for(d.s();!(o=d.n()).done;){var c=o.value;if(c!==t&&(r=this.positionFormat(c.start),s=this.positionFormat(c.end),r>n&&r<i&&(a=!1),s>n&&s<i&&(a=!1),r<n&&s>i&&(a=!1),r!==n&&s!==i||(a=!1),!a))break}}catch(t){d.e(t)}finally{d.f()}return a},addListener:function(t,e,o,n){this.events.push({element:t,event:e,callback:o}),t.addEventListener(e,o,n)},editPeriod:function(t,e,o){var i=this;return s(n().mark((function r(){var s;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i.editable){n.next=14;break}if(!i.$listeners.edit){n.next=5;break}i.$emit("edit",{day:t,index:e}),n.next=14;break;case 5:return o.preventDefault(),i.showEditMenu=!1,i.x=o.clientX,i.y=o.clientY,s=i.value[t].periods,i.editEvent=s[e],n.next=13,i.$nextTick();case 13:i.showEditMenu=!0;case 14:case"end":return n.stop()}}),r)})))()},getY:function(t,e){var o=null;"touchstart"===t.type||"touchmove"===t.type||"touchend"===t.type||"touchcancel"===t.type?(e&&t.preventDefault(),o=(t.touches[0]||t.changedTouches[0]).clientY):"mousedown"!==t.type&&"mouseup"!==t.type&&"mousemove"!==t.type&&"mouseover"!==t.type&&"mouseout"!==t.type&&"mouseenter"!==t.type&&"mouseleave"!==t.type||(o=t.clientY);return o},selectWholeDay:function(t){if(this.data[t]){var e=this.data[t].periods;e.length>0?(e[0].start="00:00",e[0].end="24:00",this.data[t].periods=[e[0]]):this.data[t].periods=[{start:"00:00",end:"24:00",title:this.settings.periodTitle,backgroundColor:this.settings.periodBackgroundColor,borderColor:this.settings.periodBorderColor,textColor:this.settings.periodTextColor}]}}}};const f="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function v(t){return(t,e)=>function(t,e){const o=f?e.media||"default":t,n=y[o]||(y[o]={ids:new Set,styles:[]});if(!n.ids.has(t)){n.ids.add(t);let o=e.source;if(e.map&&(o+="\n/*# sourceURL="+e.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",e.media&&n.element.setAttribute("media",e.media),void 0===g&&(g=document.head||document.getElementsByTagName("head")[0]),g.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(o),n.element.styleSheet.cssText=n.styles.filter(Boolean).join("\n");else{const t=n.ids.size-1,e=document.createTextNode(o),i=n.element.childNodes;i[t]&&n.element.removeChild(i[t]),i.length?n.element.insertBefore(e,i[t]):n.element.appendChild(e)}}}(t,e)}let g;const y={};var m=p({render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"vws vws-mode-edit vws-mode-7"},[o("table",{staticClass:"vws-table"},[o("tbody",[o("tr",t._l(t.daysPeriods,(function(e){return o("td",{key:"day-"+e.day},[o("div",{ref:"day",refInFor:!0,staticClass:"vws-day",on:{touchstart:function(o){return t.onDayDown(e.day,o)},mousedown:function(o){return t.onDayDown(e.day,o)}}},[t._l(e.periods,(function(n,i){return o("scheduler-period",{key:i,attrs:{period:n,settings:t.settings,blockHeight:t.blockHeight,editable:t.editable},on:{"period-drag":function(o){return t.onPeriodDown(o,e.day,n.index)},"period-resize":function(o){return t.onPeriodResize(o,e.day,n.index)},"position-change":function(o){return t.onPositionChange(e.day,n.index,o)},delete:function(o){return t.deletePeriod(e.day,n.index)},clone:function(o){return t.clonePeriod(e.day,n.index)},edit:function(o){return t.editPeriod(e.day,n.index,o)}}})})),t._v(" "),t.newPeriod&&t.newPeriod.day===e.day?o("div",{staticClass:"vws-period-helper",style:{top:t.newPeriod.top+"px",height:t.newPeriod.height+"px"}},[o("div",{staticClass:"vws-period-helper-time"},[t._v("\n "+t._s(t.newPeriod.start)+" - "+t._s(t.newPeriod.end)+"\n ")])]):t._e()],2)])})),0)])]),t._v(" "),o("div",{staticClass:"vws-grid"},[o("div",{staticClass:"vws-grid-head"},t._l(t.settings.days,(function(e){return o("div",{key:e,staticClass:"vws-grid-day"},[o("v-hover",{scopedSlots:t._u([{key:"default",fn:function(n){var i=n.hover;return[o("div",[o("strong",[t._v("\n "+t._s(t.isMobile?t.settings.daysList[e-1].slice(0,3):t.settings.daysList[e-1])+"\n ")]),t._v(" "),o("v-btn",{directives:[{name:"show",rawName:"v-show",value:t.editable&&i,expression:"editable && hover"}],attrs:{icon:"","x-small":"",title:t.settings.periodRemoveButton},on:{click:function(o){return t.clearDayPeriods(e-1)}}},[o("v-icon",{attrs:{"x-small":""}},[t._v("mdi-close")])],1),t._v(" "),o("v-btn",{directives:[{name:"show",rawName:"v-show",value:t.editable&&i,expression:"editable && hover"}],attrs:{icon:"","x-small":"",title:t.settings.periodDuplicateButton},on:{click:function(o){return t.cloneDayPeriods(e-1)}}},[o("v-icon",{attrs:{"x-small":""}},[t._v("mdi-content-copy")])],1),t._v(" "),o("v-btn",{directives:[{name:"show",rawName:"v-show",value:t.editable&&i,expression:"editable && hover"}],attrs:{icon:"","x-small":"",title:t.settings.periodSelectWholeButton},on:{click:function(o){return t.selectWholeDay(e-1)}}},[o("v-icon",{attrs:{"x-small":""}},[t._v("mdi-select-all")])],1)],1)]}}],null,!0)})],1)})),0),t._v(" "),t._l(25,(function(e){return o("div",{key:e,staticClass:"vws-grid-line"},[o("div",{staticClass:"vws-grid-hour"},[t._v(t._s(t.formatHour(e-1)))])])}))],2),t._v(" "),t.showEditMenu?o("v-menu",{attrs:{"position-x":t.x,"position-y":t.y,absolute:"","offset-y":"","close-on-content-click":!1},model:{value:t.showEditMenu,callback:function(e){t.showEditMenu=e},expression:"showEditMenu"}},[o("v-list",{attrs:{dense:""}},[o("v-list-item",[o("v-text-field",{attrs:{label:"Title",required:"",type:t.settings.inputType},model:{value:t.editEvent.title,callback:function(e){t.$set(t.editEvent,"title",e)},expression:"editEvent.title"}})],1),t._v(" "),o("v-list-item",{staticClass:"d-flex",staticStyle:{"max-width":"300px"}},t._l(t.settings.colors,(function(e){return o("v-btn",{key:e,attrs:{icon:"",elevation:t.editEvent.backgroundColor===e?10:0}},[o("v-icon",{attrs:{color:e,size:"35px"},on:{click:function(o){t.editEvent.backgroundColor=e}}},[t._v("mdi-circle")])],1)})),1)],1)],1):t._e()],1)},staticRenderFns:[]},(function(t){t&&t("data-v-6e1cde99_0",{source:'.vws{position:relative;padding:40px 20px 20px 60px;font-family:system,-apple-system,Roboto,Helvetica Neue,Arial,Helvetica,Geneva,sans-serif;box-sizing:border-box;z-index:1}.vws-mode-edit{cursor:pointer}.vws-mode-edit .ui-draggable-dragging{cursor:move}.vws-mode-5 .vws-grid-day,.vws-mode-5 .vws-table td{width:20%}.vws-table{position:relative;z-index:8;width:100%;margin-bottom:20px;border-collapse:collapse;border-spacing:0;box-sizing:content-box}.vws-table td,.vws-table th{padding:0}.vws-table td{position:relative;width:14.28571%;border-left:1px solid #ccc;border-right:1px solid #ccc}.vws-grid{position:absolute;top:40px;left:60px;right:20px;box-sizing:content-box}.vws-grid-head{position:absolute;top:-30px;left:0;right:0;display:flex}.vws-grid-day{position:relative;width:14.28571%;padding:8px 0 4px 0;text-align:center;font-size:12px}.vws-grid-day-buttons .vws-day-duplicate,.vws-grid-day-buttons .vws-day-remove,.vws-grid-day:hover .vws-day-duplicate,.vws-grid-day:hover .vws-day-remove{display:block}.vws-grid-line{border-top:1px solid #ccc;border-bottom:1px solid transparent;position:relative;height:38px;box-sizing:content-box}.vws-grid-line:last-child{height:0;border-bottom:none}.vws-grid-line:before{content:"";position:absolute;top:50%;height:1px;width:100%;background:#eee}.vws-grid-hour{position:absolute;top:-7px;left:-50px;display:block;width:42px;font-size:12px;text-align:right}.vws-day{width:100%;height:960px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:none}.vws-day-remove{bottom:20px;right:2px}.vws-day-duplicate{bottom:4px;right:2px}.vws-period-helper{position:absolute;width:100%;min-height:10px}.vws-period-helper:after{content:"";display:block;position:absolute;top:2px;bottom:2px;left:2px;right:2px;background-color:rgba(204,204,204,.2)}.vws-period-helper-time{padding:2px 0 0 5px;font-size:11px;font-weight:700;line-height:16px;letter-spacing:-.5px;color:#666}.vws-handle{position:absolute!important;left:calc(50% - 8px);cursor:ns-resize}.vws-day-duplicate,.vws-day-remove{display:none;position:absolute;height:10px;width:10px;cursor:pointer;background-size:100% 100%}.vws-period{cursor:pointer;border-radius:5px;touch-action:none;outline:1px solid #ccc}.vws-period{position:absolute;width:100%;min-height:10px}.vws-period:hover .vws-period:hover{display:block}.vws-period-time,.vws-period-title{display:block;line-height:20px;letter-spacing:-.5px;word-break:break-all;overflow:hidden}.vws-period-title{font-size:15px}.vws-period-time{font-size:11px;font-weight:700;line-height:16px}.vws-period-container{position:absolute;top:2px;bottom:2px;left:2px;right:2px;padding:0 3px;border-radius:3px;box-sizing:border-box}.vws-period-buttons{position:absolute;bottom:0;right:0}',map:void 0,media:void 0})}),h,undefined,false,undefined,!1,v,void 0,void 0),b=function(){var t=m;return t.install=function(e){e.component("vuetify-week-scheduler",t)},t}(),w=Object.freeze({__proto__:null,default:b});return Object.entries(w).forEach((function(t){var e=d(t,2),o=e[0],n=e[1];"default"!==o&&(b[o]=n)})),b}(lib);