@progress/kendo-vue-scheduler 7.0.0-develop.4 → 7.0.0-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Scheduler.js +1 -1
- package/Scheduler.mjs +52 -50
- package/dist/cdn/js/kendo-vue-scheduler.js +1 -1
- package/index.d.mts +63 -30
- package/index.d.ts +63 -30
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +13 -13
package/Scheduler.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),t=require("./utils/main.js"),r=require("@progress/kendo-vue-common"),P=require("./components/header/SchedulerHeader.js"),k=require("@progress/kendo-vue-intl"),x=require("./components/header/navigation/SchedulerNavigation.js"),h=require("@progress/kendo-date-math"),O=require("./components/footer/SchedulerFooter.js"),E=require("@progress/kendo-vue-buttons"),A=require("./components/header/navigation/NavigationDatePicker.js"),T=require("./components/header/view-selector/ViewSelectorList.js"),H=require("./components/footer/bussiness-hours/BusinessHours.js"),g=require("./package-metadata.js"),W=require("./views/agenda/AgendaView.js"),M=require("./views/time/TimelineView.js"),u=require("./views/day/DayView.js"),q=require("./views/week/WeekView.js"),j=require("./views/week/WorkWeekView.js"),z=require("./views/month/MonthView.js"),m=require("./constants/main.js"),L=require("./hooks/useEditable.js"),f="{0:D}",w="{0:d}",B=n.defineComponent({name:"KendoScheduler",emits:["datechange","viewchange","datachange","itemclick","itemdoubleclick","slotclick","slotdoubleclick","taskclick","taskdoubleclick"],props:{dataItems:{type:Array,default:function(){return[]}},views:{type:Array,default:function(){return[]}},view:String,defaultView:String,date:Date,rtl:Boolean,height:{type:[Number,String],default:600},timezone:String,group:Object,resources:[Object,Array],modelFields:Object,tabIndex:{type:Number,default:-1},editable:{type:[Boolean,Object],default:!1},defaultDate:{type:Date,default:function(){return new Date}},validator:{type:Function,default:()=>({})},modifyInitialFormValues:{type:Function,default:e=>e},header:[String,Function,Object],footer:[String,Function,Object],slotRender:[String,Function,Object],viewSlot:[String,Function,Object],item:[String,Function,Object],viewItem:[String,Function,Object],task:[String,Function,Object],form:[String,Function,Object],resizeHint:[String,Function,Object],dialogProps:Object,formProps:Object,dateHeaderCell:[String,Function,Object],timeHeaderCell:[String,Function,Object]},computed:{isRtl(){return this.$props.rtl!==void 0?this.$props.rtl:this.currentRtl},wrapperClassName(){return{"k-rtl":this.isRtl,"k-scheduler":!0}},fields(){return t.getModelFields(this.$props.modelFields).fields}},mounted(){this.currentRtl=r.isRtl(this.$el)},provide(){return{ks:this.ks,setActiveViewName:this.handleActiveViewNameChange,setActiveDate:this.handleDateChange,itemDoubleClick:this.handleItemDoubleClick,itemClick:this.handleItemClick,slotDoubleClick:this.handleSlotDoubleClick,slotClick:this.handleSlotClick,taskDoubleClick:this.handleTaskDoubleClick,taskClick:this.handleTaskClick,ksValidator:this.validator,ksModifyInitialFormValues:this.modifyInitialFormValues}},inject:{kendoLocalizationService:{default:null},kendoIntlService:{default:null}},data(){const e=k.provideIntlService(this),s=this.$props.date||this.$props.defaultDate,a=this.$props.view||this.$props.defaultView||this.views[0]&&this.views[0].name||"day",i=this.views.find(c=>c.name===a)||this.views[0]||n.createVNode(u.DayView,null,null),l=this.getViewPropValue(i,"selectedDateFormat",a)||f,o=this.getViewPropValue(i,"selectedShortDateFormat",a)||w,d=this.getViewComponentByName(a).props.dateRange.default()({intl:e,date:s,timezone:this.$props.timezone,numberOfDays:this.getViewPropValue(i,"numberOfDays",a),workWeekStart:this.getViewPropValue(i,"workWeekStart",a)||e.firstDay(),workWeekEnd:this.getViewPropValue(i,"workWeekEnd",a)||(e.firstDay()+this.getViewPropValue(i,"numberOfDays",a))%6});return{ks:{activeViewName:a,currentDate:s,showWorkHours:i.showWorkHours!==void 0?i.showWorkHours:!0,timezone:this.$props.timezone,props:{...this.$props},views:this.views,view:i,fields:t.getModelFields(this.$props.modelFields).fields,groups:t.toSchedulerGroups(this.$props.group,this.$props.resources),dateRange:d,orientation:this.$props.group&&this.$props.group.orientation?this.$props.group.orientation:"horizontal",dateFormat:l,shortDateFormat:o,scheduler:this,dataItems:this.dataItems}}},watch:{isRtl(e){this.ks.isRtl=e},view(e){this.updatePassedState(e)},date(e){this.ks.currentDate=e,this.updatePassedState()},timezone(e){this.ks.timezone=e,this.updatePassedState()},dataItems(e){this.ks.dataItems=e}},render(){r.validatePackage(g.packageMetadata),this.showLicenseWatermark=r.shouldShowValidationUI(g.packageMetadata);const e=this.views.find(N=>N.name===this.ks.activeViewName)||this.views[0]||n.createVNode(u.DayView,null,null),s=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName),a=r.templateRendering.call(this,e.header||this.$props.header,r.getListeners.call(this)),i=r.templateRendering.call(this,e.footer||this.$props.footer,r.getListeners.call(this)),l=r.templateRendering.call(this,e.slot||this.$props.slotRender,{}),o=r.templateRendering.call(this,e.viewSlot||this.$props.viewSlot,{}),d=r.templateRendering.call(this,e.item||this.$props.item,{}),c=r.templateRendering.call(this,e.viewItem||this.$props.viewItem,{}),p=r.templateRendering.call(this,e.task||this.$props.task,{}),V=r.templateRendering.call(this,e.dateHeaderCell||this.$props.dateHeaderCell,{}),D=r.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),v=r.templateRendering.call(this,e.resizeHint||this.$props.resizeHint,{});this.ks.form=r.templateRendering.call(this,e.form||this.$props.form,{}),this.ks.dialogProps=e.dialogProps||this.$props.dialogProps,this.ks.formProps=e.formProps||this.$props.formProps;const F=L.useEditable(e.editable!==void 0?e.editable:this.$props.editable),C=this.getViewComponentByName(this.ks.activeViewName||e.name),S={...this.$props,...this.ks.view,showWorkHours:this.ks.showWorkHours,dataItems:void 0,views:void 0,defaultDate:void 0,dateRange:this.ks.dateRange,slotRender:l,viewSlot:o,item:d,viewItem:c,task:p,dateHeaderCell:V,timeHeaderCell:D,resizeHint:v,editable:F},b=n.createVNode(P.SchedulerHeader,null,{default:()=>[n.createVNode(x.SchedulerNavigation,{isRtl:this.isRtl,onPrevclick:this.handlePrevClick,onNextclick:this.handleNextClick,onTodayclick:this.handleTodayClick},null),n.createVNode(A.NavigationDatePicker,{value:this.ks.currentDate,onChange:this.handleDatePickerChange},null),n.createVNode(E.ToolbarSpacer,null,null),n.createVNode(T.ViewSelectorList,null,null)]}),I=r.getTemplate.call(this,{h:n.h,template:a,defaultRendering:b,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}}),R=n.createVNode(O.SchedulerFooter,null,{default:()=>[n.createVNode(H.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]}),y=r.getTemplate.call(this,{h:n.h,template:i,defaultRendering:R,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}}),$=this.showLicenseWatermark?n.createVNode(r.WatermarkOverlay,null,null):null;return n.createVNode("div",{id:this.$props.id,style:{height:this.$props.height+"px"},class:this.wrapperClassName,tabindex:this.$props.tabIndex,dir:this.isRtl&&"rtl",role:this.$props.role||"application","aria-label":this.$props.ariaLabel,"aria-labelledby":this.$props.ariaLabelledby,onFocusin:this.handleFocus,onFocusout:this.handleBlur},[I,n.h(C,{key:this.ks.view.name,onDataaction:this.handleDataAction,...S}),y,$])},methods:{getViewComponentByName(e){switch(e.toLowerCase()){case"week":return q.WeekView;case"workweek":return j.WorkWeekView;case"agenda":return W.AgendaView;case"timeline":return M.TimelineView;case"month":return z.MonthView;default:return u.DayView}},getViewPropValue(e,s,a){const i=this.getViewComponentByName(a).props[s];return e[s]||(i?i.default:void 0)},handleDataChange({created:e=[],updated:s=[],deleted:a=[]}){const i={created:e,updated:s,deleted:a};this.$emit("datachange",i)},handleCreate(e){const s=[e.dataItem];this.handleDataChange({created:s})},handleUpdate(e){const s=[],a=[];if(e.series)if(Array.isArray(e.dataItem))e.dataItem.map(i=>{const l=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=r.clone(i);t.setField(o,this.fields.originalStart,t.getField(l,this.fields.originalStart)),t.setField(o,this.fields.recurrenceId,t.getField(l,this.fields.recurrenceId)),t.setField(o,this.fields.recurrenceExceptions,t.getField(l,this.fields.recurrenceExceptions)),a.push(o)});else{const i=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=r.clone(e.dataItem);t.setField(l,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(l,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(l,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(l)}else if(Array.isArray(e.dataItem))e.dataItem.map(i=>{const l=t.getField(i,this.fields.recurrenceRule)!==null&&t.getField(i,this.fields.recurrenceRule)!==void 0;if(t.getField(i,this.fields.recurrenceId)!==null&&t.getField(i,this.fields.recurrenceId)!==void 0&&l){const d=r.clone(t.findMaster(i,this.fields,this.dataItems)),c=t.getField(i,this.fields.originalStart),p=t.getField(d,this.fields.recurrenceExceptions)||[];t.setField(d,this.fields.recurrenceExceptions,[...p,c]),t.setField(i,this.fields.recurrenceRule,null),a.push(d),s.push(i)}else a.push(i)});else{const i=t.getField(e.dataItem,this.fields.recurrenceRule)!==null&&t.getField(e.dataItem,this.fields.recurrenceRule)!==void 0;if(t.getField(e.dataItem,this.fields.recurrenceId)!==null&&t.getField(e.dataItem,this.fields.recurrenceId)!==void 0&&i){const o=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),d=t.getField(e.dataItem,this.fields.originalStart),c=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...c,d]),t.setField(e.dataItem,this.fields.recurrenceRule,null),a.push(o),s.push(e.dataItem)}else a.push(e.dataItem)}this.handleDataChange({updated:a,created:s})},handleRemove(e){const s=[],a=[];if(e.series){const i=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=r.clone(e.dataItem);t.setField(l,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(l,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(l,this.fields.recurrenceRule,t.getField(i,this.fields.recurrenceRule)),t.setField(l,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(l)}else if(!(t.getField(e.dataItem,this.fields.recurrenceRule)!==null&&t.getField(e.dataItem,this.fields.recurrenceRule)!==void 0))a.push(e.dataItem);else{const l=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=t.getField(e.dataItem,this.fields.originalStart),d=t.getField(l,this.fields.recurrenceExceptions)||[];t.setField(l,this.fields.recurrenceExceptions,[...d,o]),t.setField(e.dataItem,this.fields.recurrenceRule,null),s.push(l)}this.handleDataChange({updated:s,deleted:a})},handleDataAction(e){switch(e.type){case m.DATA_ACTION.create:this.handleCreate(e);break;case m.DATA_ACTION.update:this.handleUpdate(e);break;case m.DATA_ACTION.remove:this.handleRemove(e);break}},handleActiveViewNameChange(e,s){this.updatePassedState(e),this.$emit("viewchange",{viewName:e,...s,target:this.ks.scheduler.$el})},handleDateChange(e,s){this.setDate(e,{...s,target:this.ks.scheduler.$el})},handleDatePickerChange(e){e.value&&this.setDate(e.value,{...e,target:this.ks.scheduler.$el,nativeEvent:e.event})},handleNextClick(e){e.preventDefault();const s=this.getViewPropValue(this.ks.view,"step",this.ks.activeViewName)||this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName)||1,i=s>27?h.addMonths(this.ks.currentDate,Math.round(s/27)):h.addDays(this.ks.currentDate,s);this.setDate(i,e)},handlePrevClick(e){e.preventDefault();const s=this.getViewPropValue(this.ks.view,"step",this.ks.activeViewName)||this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName)||1,i=s>27?h.addMonths(this.ks.currentDate,-Math.round(s/27)):h.addDays(this.ks.currentDate,-s);this.setDate(i,e)},handleTodayClick(e){e.preventDefault();const s=t.getToday();this.setDate(s,e)},handleShowWorkHoursClick(){this.ks.showWorkHours=!this.ks.showWorkHours},handleFocus(){this.$el&&(this.$el.style.boxShadow="0 0.5px 0.5px 0.5px rgba(0, 0, 0, .12)")},handleBlur(){this.$el&&(this.$el.style.boxShadow="")},handleItemClick(e){this.$emit("itemclick",e)},handleItemDoubleClick(e){this.$emit("itemdoubleclick",e)},handleSlotClick(e){this.$emit("slotclick",e)},handleSlotDoubleClick(e){this.$emit("slotdoubleclick",e)},handleTaskClick(e){this.$emit("taskclick",e)},handleTaskDoubleClick(e){this.$emit("taskdoubleclick",e)},setDate(e,s){this.ks.currentDate=e,this.updatePassedState(),this.$emit("datechange",{date:e,event:s})},updatePassedState(e){const s=k.provideIntlService(this),a=e||this.ks.activeViewName;this.ks.activeViewName=a,this.ks.view=this.views.find(i=>i.name===a)||this.views[0]||n.createVNode(u.DayView,null,null),this.ks.dateFormat=this.getViewPropValue(this.ks.view,"selectedDateFormat",a)||f,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",a)||w,this.ks.dateRange=this.getViewComponentByName(a).props.dateRange.default()({intl:s,date:this.ks.currentDate,timezone:this.$props.timezone,numberOfDays:this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName),workWeekStart:this.getViewPropValue(this.ks.view,"workWeekStart",this.ks.activeViewName)||s.firstDay(),workWeekEnd:this.getViewPropValue(this.ks.view,"workWeekEnd",this.ks.activeViewName)||(s.firstDay()+this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName))%6})}}});exports.Scheduler=B;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),t=require("./utils/main.js"),r=require("@progress/kendo-vue-common"),P=require("./components/header/SchedulerHeader.js"),g=require("@progress/kendo-vue-intl"),x=require("./components/header/navigation/SchedulerNavigation.js"),h=require("@progress/kendo-date-math"),O=require("./components/footer/SchedulerFooter.js"),E=require("@progress/kendo-vue-buttons"),A=require("./components/header/navigation/NavigationDatePicker.js"),M=require("./components/header/view-selector/ViewSelectorList.js"),T=require("./components/footer/bussiness-hours/BusinessHours.js"),m=require("./package-metadata.js"),H=require("./views/agenda/AgendaView.js"),W=require("./views/time/TimelineView.js"),u=require("./views/day/DayView.js"),q=require("./views/week/WeekView.js"),j=require("./views/week/WorkWeekView.js"),z=require("./views/month/MonthView.js"),k=require("./constants/main.js"),L=require("./hooks/useEditable.js"),f="{0:D}",w="{0:d}",B=n.defineComponent({name:"KendoScheduler",emits:["datechange","viewchange","datachange","itemclick","itemdoubleclick","slotclick","slotdoubleclick","taskclick","taskdoubleclick"],props:{dataItems:{type:Array,default:function(){return[]}},views:{type:Array,default:function(){return[]}},view:String,defaultView:String,date:Date,rtl:Boolean,height:{type:[Number,String],default:600},timezone:String,group:Object,resources:[Object,Array],modelFields:Object,tabIndex:{type:Number,default:-1},editable:{type:[Boolean,Object],default:!1},defaultDate:{type:Date,default:function(){return new Date}},validator:{type:Function,default:()=>({})},modifyInitialFormValues:{type:Function,default:e=>e},header:[String,Function,Object],footer:[String,Function,Object],slotRender:[String,Function,Object],viewSlot:[String,Function,Object],item:[String,Function,Object],viewItem:[String,Function,Object],task:[String,Function,Object],form:[String,Function,Object],resizeHint:[String,Function,Object],dialogProps:Object,formProps:Object,dateHeaderCell:[String,Function,Object],timeHeaderCell:[String,Function,Object]},computed:{isRtl(){return this.$props.rtl!==void 0?this.$props.rtl:this.currentRtl},wrapperClassName(){return{"k-rtl":this.isRtl,"k-scheduler":!0}},fields(){return t.getModelFields(this.$props.modelFields).fields}},mounted(){this.currentRtl=r.isRtl(this.$el)},provide(){return{ks:this.ks,setActiveViewName:this.handleActiveViewNameChange,setActiveDate:this.handleDateChange,itemDoubleClick:this.handleItemDoubleClick,itemClick:this.handleItemClick,slotDoubleClick:this.handleSlotDoubleClick,slotClick:this.handleSlotClick,taskDoubleClick:this.handleTaskDoubleClick,taskClick:this.handleTaskClick,ksValidator:this.validator,ksModifyInitialFormValues:this.modifyInitialFormValues}},inject:{kendoLocalizationService:{default:null},kendoIntlService:{default:null}},data(){const e=g.provideIntlService(this),s=this.$props.date||this.$props.defaultDate,a=this.$props.view||this.$props.defaultView||this.views[0]&&this.views[0].name||"day",i=this.views.find(c=>c.name===a)||this.views[0]||n.createVNode(u.DayView,null,null),l=this.getViewPropValue(i,"selectedDateFormat",a)||f,o=this.getViewPropValue(i,"selectedShortDateFormat",a)||w,d=this.getViewComponentByName(a).props.dateRange.default()({intl:e,date:s,timezone:this.$props.timezone,numberOfDays:this.getViewPropValue(i,"numberOfDays",a),workWeekStart:this.getViewPropValue(i,"workWeekStart",a)||e.firstDay(),workWeekEnd:this.getViewPropValue(i,"workWeekEnd",a)||(e.firstDay()+this.getViewPropValue(i,"numberOfDays",a))%6});return{ks:{activeViewName:a,currentDate:s,showWorkHours:i.showWorkHours!==void 0?i.showWorkHours:!0,timezone:this.$props.timezone,props:{...this.$props},views:this.views,view:i,fields:t.getModelFields(this.$props.modelFields).fields,groups:t.toSchedulerGroups(this.$props.group,this.$props.resources),dateRange:d,orientation:this.$props.group&&this.$props.group.orientation?this.$props.group.orientation:"horizontal",dateFormat:l,shortDateFormat:o,scheduler:this,dataItems:this.dataItems}}},watch:{isRtl(e){this.ks.isRtl=e},view(e){this.updatePassedState(e)},date(e){this.ks.currentDate=e,this.updatePassedState()},timezone(e){this.ks.timezone=e,this.updatePassedState()},dataItems(e){this.ks.dataItems=e}},render(){r.validatePackage(m.packageMetadata),this.showLicenseWatermark=r.shouldShowValidationUI(m.packageMetadata),this.licenseMessage=r.getLicenseMessage(m.packageMetadata);const e=this.views.find(N=>N.name===this.ks.activeViewName)||this.views[0]||n.createVNode(u.DayView,null,null),s=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName),a=r.templateRendering.call(this,e.header||this.$props.header,r.getListeners.call(this)),i=r.templateRendering.call(this,e.footer||this.$props.footer,r.getListeners.call(this)),l=r.templateRendering.call(this,e.slot||this.$props.slotRender,{}),o=r.templateRendering.call(this,e.viewSlot||this.$props.viewSlot,{}),d=r.templateRendering.call(this,e.item||this.$props.item,{}),c=r.templateRendering.call(this,e.viewItem||this.$props.viewItem,{}),p=r.templateRendering.call(this,e.task||this.$props.task,{}),V=r.templateRendering.call(this,e.dateHeaderCell||this.$props.dateHeaderCell,{}),D=r.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),v=r.templateRendering.call(this,e.resizeHint||this.$props.resizeHint,{});this.ks.form=r.templateRendering.call(this,e.form||this.$props.form,{}),this.ks.dialogProps=e.dialogProps||this.$props.dialogProps,this.ks.formProps=e.formProps||this.$props.formProps;const F=L.useEditable(e.editable!==void 0?e.editable:this.$props.editable),C=this.getViewComponentByName(this.ks.activeViewName||e.name),S={...this.$props,...this.ks.view,showWorkHours:this.ks.showWorkHours,dataItems:void 0,views:void 0,defaultDate:void 0,dateRange:this.ks.dateRange,slotRender:l,viewSlot:o,item:d,viewItem:c,task:p,dateHeaderCell:V,timeHeaderCell:D,resizeHint:v,editable:F},b=n.createVNode(P.SchedulerHeader,null,{default:()=>[n.createVNode(x.SchedulerNavigation,{isRtl:this.isRtl,onPrevclick:this.handlePrevClick,onNextclick:this.handleNextClick,onTodayclick:this.handleTodayClick},null),n.createVNode(A.NavigationDatePicker,{value:this.ks.currentDate,onChange:this.handleDatePickerChange},null),n.createVNode(E.ToolbarSpacer,null,null),n.createVNode(M.ViewSelectorList,null,null)]}),I=r.getTemplate.call(this,{h:n.h,template:a,defaultRendering:b,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}}),R=n.createVNode(O.SchedulerFooter,null,{default:()=>[n.createVNode(T.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]}),y=r.getTemplate.call(this,{h:n.h,template:i,defaultRendering:R,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}}),$=this.showLicenseWatermark?n.createVNode(r.WatermarkOverlay,{message:this.licenseMessage},null):null;return n.createVNode("div",{id:this.$props.id,style:{height:this.$props.height+"px"},class:this.wrapperClassName,tabindex:this.$props.tabIndex,dir:this.isRtl&&"rtl",role:this.$props.role||"application","aria-label":this.$props.ariaLabel,"aria-labelledby":this.$props.ariaLabelledby,onFocusin:this.handleFocus,onFocusout:this.handleBlur},[I,n.h(C,{key:this.ks.view.name,onDataaction:this.handleDataAction,...S}),y,$])},methods:{getViewComponentByName(e){switch(e.toLowerCase()){case"week":return q.WeekView;case"workweek":return j.WorkWeekView;case"agenda":return H.AgendaView;case"timeline":return W.TimelineView;case"month":return z.MonthView;default:return u.DayView}},getViewPropValue(e,s,a){const i=this.getViewComponentByName(a).props[s];return e[s]||(i?i.default:void 0)},handleDataChange({created:e=[],updated:s=[],deleted:a=[]}){const i={created:e,updated:s,deleted:a};this.$emit("datachange",i)},handleCreate(e){const s=[e.dataItem];this.handleDataChange({created:s})},handleUpdate(e){const s=[],a=[];if(e.series)if(Array.isArray(e.dataItem))e.dataItem.map(i=>{const l=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=r.clone(i);t.setField(o,this.fields.originalStart,t.getField(l,this.fields.originalStart)),t.setField(o,this.fields.recurrenceId,t.getField(l,this.fields.recurrenceId)),t.setField(o,this.fields.recurrenceExceptions,t.getField(l,this.fields.recurrenceExceptions)),a.push(o)});else{const i=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=r.clone(e.dataItem);t.setField(l,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(l,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(l,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(l)}else if(Array.isArray(e.dataItem))e.dataItem.map(i=>{const l=t.getField(i,this.fields.recurrenceRule)!==null&&t.getField(i,this.fields.recurrenceRule)!==void 0;if(t.getField(i,this.fields.recurrenceId)!==null&&t.getField(i,this.fields.recurrenceId)!==void 0&&l){const d=r.clone(t.findMaster(i,this.fields,this.dataItems)),c=t.getField(i,this.fields.originalStart),p=t.getField(d,this.fields.recurrenceExceptions)||[];t.setField(d,this.fields.recurrenceExceptions,[...p,c]),t.setField(i,this.fields.recurrenceRule,null),a.push(d),s.push(i)}else a.push(i)});else{const i=t.getField(e.dataItem,this.fields.recurrenceRule)!==null&&t.getField(e.dataItem,this.fields.recurrenceRule)!==void 0;if(t.getField(e.dataItem,this.fields.recurrenceId)!==null&&t.getField(e.dataItem,this.fields.recurrenceId)!==void 0&&i){const o=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),d=t.getField(e.dataItem,this.fields.originalStart),c=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...c,d]),t.setField(e.dataItem,this.fields.recurrenceRule,null),a.push(o),s.push(e.dataItem)}else a.push(e.dataItem)}this.handleDataChange({updated:a,created:s})},handleRemove(e){const s=[],a=[];if(e.series){const i=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=r.clone(e.dataItem);t.setField(l,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(l,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(l,this.fields.recurrenceRule,t.getField(i,this.fields.recurrenceRule)),t.setField(l,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(l)}else if(!(t.getField(e.dataItem,this.fields.recurrenceRule)!==null&&t.getField(e.dataItem,this.fields.recurrenceRule)!==void 0))a.push(e.dataItem);else{const l=r.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=t.getField(e.dataItem,this.fields.originalStart),d=t.getField(l,this.fields.recurrenceExceptions)||[];t.setField(l,this.fields.recurrenceExceptions,[...d,o]),t.setField(e.dataItem,this.fields.recurrenceRule,null),s.push(l)}this.handleDataChange({updated:s,deleted:a})},handleDataAction(e){switch(e.type){case k.DATA_ACTION.create:this.handleCreate(e);break;case k.DATA_ACTION.update:this.handleUpdate(e);break;case k.DATA_ACTION.remove:this.handleRemove(e);break}},handleActiveViewNameChange(e,s){this.updatePassedState(e),this.$emit("viewchange",{viewName:e,...s,target:this.ks.scheduler.$el})},handleDateChange(e,s){this.setDate(e,{...s,target:this.ks.scheduler.$el})},handleDatePickerChange(e){e.value&&this.setDate(e.value,{...e,target:this.ks.scheduler.$el,nativeEvent:e.event})},handleNextClick(e){e.preventDefault();const s=this.getViewPropValue(this.ks.view,"step",this.ks.activeViewName)||this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName)||1,i=s>27?h.addMonths(this.ks.currentDate,Math.round(s/27)):h.addDays(this.ks.currentDate,s);this.setDate(i,e)},handlePrevClick(e){e.preventDefault();const s=this.getViewPropValue(this.ks.view,"step",this.ks.activeViewName)||this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName)||1,i=s>27?h.addMonths(this.ks.currentDate,-Math.round(s/27)):h.addDays(this.ks.currentDate,-s);this.setDate(i,e)},handleTodayClick(e){e.preventDefault();const s=t.getToday();this.setDate(s,e)},handleShowWorkHoursClick(){this.ks.showWorkHours=!this.ks.showWorkHours},handleFocus(){this.$el&&(this.$el.style.boxShadow="0 0.5px 0.5px 0.5px rgba(0, 0, 0, .12)")},handleBlur(){this.$el&&(this.$el.style.boxShadow="")},handleItemClick(e){this.$emit("itemclick",e)},handleItemDoubleClick(e){this.$emit("itemdoubleclick",e)},handleSlotClick(e){this.$emit("slotclick",e)},handleSlotDoubleClick(e){this.$emit("slotdoubleclick",e)},handleTaskClick(e){this.$emit("taskclick",e)},handleTaskDoubleClick(e){this.$emit("taskdoubleclick",e)},setDate(e,s){this.ks.currentDate=e,this.updatePassedState(),this.$emit("datechange",{date:e,event:s})},updatePassedState(e){const s=g.provideIntlService(this),a=e||this.ks.activeViewName;this.ks.activeViewName=a,this.ks.view=this.views.find(i=>i.name===a)||this.views[0]||n.createVNode(u.DayView,null,null),this.ks.dateFormat=this.getViewPropValue(this.ks.view,"selectedDateFormat",a)||f,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",a)||w,this.ks.dateRange=this.getViewComponentByName(a).props.dateRange.default()({intl:s,date:this.ks.currentDate,timezone:this.$props.timezone,numberOfDays:this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName),workWeekStart:this.getViewPropValue(this.ks.view,"workWeekStart",this.ks.activeViewName)||s.firstDay(),workWeekEnd:this.getViewPropValue(this.ks.view,"workWeekEnd",this.ks.activeViewName)||(s.firstDay()+this.getViewPropValue(this.ks.view,"numberOfDays",this.ks.activeViewName))%6})}}});exports.Scheduler=B;
|
package/Scheduler.mjs
CHANGED
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as j, createVNode as o, h as f } from "vue";
|
|
9
|
-
import { getToday as
|
|
10
|
-
import { clone as c, validatePackage as L, shouldShowValidationUI as B, templateRendering as d, getListeners as
|
|
11
|
-
import { SchedulerHeader as
|
|
12
|
-
import { provideIntlService as
|
|
13
|
-
import { SchedulerNavigation as
|
|
14
|
-
import { addMonths as
|
|
15
|
-
import { SchedulerFooter as
|
|
16
|
-
import { ToolbarSpacer as
|
|
17
|
-
import { NavigationDatePicker as
|
|
18
|
-
import { ViewSelectorList as
|
|
19
|
-
import { BusinessHours as
|
|
20
|
-
import { packageMetadata as
|
|
21
|
-
import { AgendaView as
|
|
22
|
-
import { TimelineView as
|
|
9
|
+
import { getToday as M, findMaster as p, setField as l, getField as r, toSchedulerGroups as z, getModelFields as v } from "./utils/main.mjs";
|
|
10
|
+
import { clone as c, validatePackage as L, shouldShowValidationUI as B, getLicenseMessage as _, templateRendering as d, getListeners as D, getTemplate as V, WatermarkOverlay as U, isRtl as G } from "@progress/kendo-vue-common";
|
|
11
|
+
import { SchedulerHeader as K } from "./components/header/SchedulerHeader.mjs";
|
|
12
|
+
import { provideIntlService as C } from "@progress/kendo-vue-intl";
|
|
13
|
+
import { SchedulerNavigation as q } from "./components/header/navigation/SchedulerNavigation.mjs";
|
|
14
|
+
import { addMonths as b, addDays as S } from "@progress/kendo-date-math";
|
|
15
|
+
import { SchedulerFooter as J } from "./components/footer/SchedulerFooter.mjs";
|
|
16
|
+
import { ToolbarSpacer as Q } from "@progress/kendo-vue-buttons";
|
|
17
|
+
import { NavigationDatePicker as X } from "./components/header/navigation/NavigationDatePicker.mjs";
|
|
18
|
+
import { ViewSelectorList as Y } from "./components/header/view-selector/ViewSelectorList.mjs";
|
|
19
|
+
import { BusinessHours as Z } from "./components/footer/bussiness-hours/BusinessHours.mjs";
|
|
20
|
+
import { packageMetadata as w } from "./package-metadata.mjs";
|
|
21
|
+
import { AgendaView as ee } from "./views/agenda/AgendaView.mjs";
|
|
22
|
+
import { TimelineView as te } from "./views/time/TimelineView.mjs";
|
|
23
23
|
import { DayView as m } from "./views/day/DayView.mjs";
|
|
24
|
-
import { WeekView as
|
|
25
|
-
import { WorkWeekView as
|
|
26
|
-
import { MonthView as
|
|
27
|
-
import { DATA_ACTION as
|
|
28
|
-
import { useEditable as
|
|
29
|
-
const I = "{0:D}", $ = "{0:d}",
|
|
24
|
+
import { WeekView as ie } from "./views/week/WeekView.mjs";
|
|
25
|
+
import { WorkWeekView as se } from "./views/week/WorkWeekView.mjs";
|
|
26
|
+
import { MonthView as re } from "./views/month/MonthView.mjs";
|
|
27
|
+
import { DATA_ACTION as g } from "./constants/main.mjs";
|
|
28
|
+
import { useEditable as ae } from "./hooks/useEditable.mjs";
|
|
29
|
+
const I = "{0:D}", $ = "{0:d}", ye = /* @__PURE__ */ j({
|
|
30
30
|
name: "KendoScheduler",
|
|
31
31
|
emits: ["datechange", "viewchange", "datachange", "itemclick", "itemdoubleclick", "slotclick", "slotdoubleclick", "taskclick", "taskdoubleclick"],
|
|
32
32
|
props: {
|
|
@@ -101,11 +101,11 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
101
101
|
};
|
|
102
102
|
},
|
|
103
103
|
fields() {
|
|
104
|
-
return
|
|
104
|
+
return v(this.$props.modelFields).fields;
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
mounted() {
|
|
108
|
-
this.currentRtl =
|
|
108
|
+
this.currentRtl = G(this.$el);
|
|
109
109
|
},
|
|
110
110
|
provide() {
|
|
111
111
|
return {
|
|
@@ -131,7 +131,7 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
data() {
|
|
134
|
-
const e =
|
|
134
|
+
const e = C(this), i = this.$props.date || this.$props.defaultDate, s = this.$props.view || this.$props.defaultView || this.views[0] && this.views[0].name || "day", t = this.views.find((u) => u.name === s) || this.views[0] || o(m, null, null), a = this.getViewPropValue(t, "selectedDateFormat", s) || I, n = this.getViewPropValue(t, "selectedShortDateFormat", s) || $, h = this.getViewComponentByName(s).props.dateRange.default()({
|
|
135
135
|
intl: e,
|
|
136
136
|
date: i,
|
|
137
137
|
timezone: this.$props.timezone,
|
|
@@ -150,8 +150,8 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
150
150
|
},
|
|
151
151
|
views: this.views,
|
|
152
152
|
view: t,
|
|
153
|
-
fields:
|
|
154
|
-
groups:
|
|
153
|
+
fields: v(this.$props.modelFields).fields,
|
|
154
|
+
groups: z(this.$props.group, this.$props.resources),
|
|
155
155
|
dateRange: h,
|
|
156
156
|
orientation: this.$props.group && this.$props.group.orientation ? this.$props.group.orientation : "horizontal",
|
|
157
157
|
dateFormat: a,
|
|
@@ -179,10 +179,10 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
render() {
|
|
182
|
-
L(
|
|
183
|
-
const e = this.views.find((T) => T.name === this.ks.activeViewName) || this.views[0] || o(m, null, null), i = this.getViewPropValue(this.ks.view, "slotDuration", this.ks.activeViewName), s = d.call(this, e.header || this.$props.header,
|
|
182
|
+
L(w), this.showLicenseWatermark = B(w), this.licenseMessage = _(w);
|
|
183
|
+
const e = this.views.find((T) => T.name === this.ks.activeViewName) || this.views[0] || o(m, null, null), i = this.getViewPropValue(this.ks.view, "slotDuration", this.ks.activeViewName), s = d.call(this, e.header || this.$props.header, D.call(this)), t = d.call(this, e.footer || this.$props.footer, D.call(this)), a = d.call(this, e.slot || this.$props.slotRender, {}), n = d.call(this, e.viewSlot || this.$props.viewSlot, {}), h = d.call(this, e.item || this.$props.item, {}), u = d.call(this, e.viewItem || this.$props.viewItem, {}), k = d.call(this, e.task || this.$props.task, {}), y = d.call(this, e.dateHeaderCell || this.$props.dateHeaderCell, {}), R = d.call(this, e.timeHeaderCell || this.$props.timeHeaderCell, {}), P = d.call(this, e.resizeHint || this.$props.resizeHint, {});
|
|
184
184
|
this.ks.form = d.call(this, e.form || this.$props.form, {}), this.ks.dialogProps = e.dialogProps || this.$props.dialogProps, this.ks.formProps = e.formProps || this.$props.formProps;
|
|
185
|
-
const F =
|
|
185
|
+
const F = ae(e.editable !== void 0 ? e.editable : this.$props.editable), x = this.getViewComponentByName(this.ks.activeViewName || e.name), N = {
|
|
186
186
|
...this.$props,
|
|
187
187
|
...this.ks.view,
|
|
188
188
|
showWorkHours: this.ks.showWorkHours,
|
|
@@ -199,17 +199,17 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
199
199
|
timeHeaderCell: R,
|
|
200
200
|
resizeHint: P,
|
|
201
201
|
editable: F
|
|
202
|
-
}, E = o(
|
|
203
|
-
default: () => [o(
|
|
202
|
+
}, E = o(K, null, {
|
|
203
|
+
default: () => [o(q, {
|
|
204
204
|
isRtl: this.isRtl,
|
|
205
205
|
onPrevclick: this.handlePrevClick,
|
|
206
206
|
onNextclick: this.handleNextClick,
|
|
207
207
|
onTodayclick: this.handleTodayClick
|
|
208
|
-
}, null), o(
|
|
208
|
+
}, null), o(X, {
|
|
209
209
|
value: this.ks.currentDate,
|
|
210
210
|
onChange: this.handleDatePickerChange
|
|
211
|
-
}, null), o(
|
|
212
|
-
}), O =
|
|
211
|
+
}, null), o(Q, null, null), o(Y, null, null)]
|
|
212
|
+
}), O = V.call(this, {
|
|
213
213
|
h: f,
|
|
214
214
|
template: s,
|
|
215
215
|
defaultRendering: E,
|
|
@@ -222,12 +222,12 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
222
222
|
todayclick: this.handleTodayClick,
|
|
223
223
|
datepickerchange: this.handleDatePickerChange
|
|
224
224
|
}
|
|
225
|
-
}), H = o(
|
|
226
|
-
default: () => [o(
|
|
225
|
+
}), H = o(J, null, {
|
|
226
|
+
default: () => [o(Z, {
|
|
227
227
|
slotDuration: i,
|
|
228
228
|
onClick: this.handleShowWorkHoursClick
|
|
229
229
|
}, null)]
|
|
230
|
-
}), W =
|
|
230
|
+
}), W = V.call(this, {
|
|
231
231
|
h: f,
|
|
232
232
|
template: t,
|
|
233
233
|
defaultRendering: H,
|
|
@@ -237,7 +237,9 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
237
237
|
additionalListeners: {
|
|
238
238
|
showworkhoursclick: this.handleShowWorkHoursClick
|
|
239
239
|
}
|
|
240
|
-
}), A = this.showLicenseWatermark ? o(
|
|
240
|
+
}), A = this.showLicenseWatermark ? o(U, {
|
|
241
|
+
message: this.licenseMessage
|
|
242
|
+
}, null) : null;
|
|
241
243
|
return o("div", {
|
|
242
244
|
id: this.$props.id,
|
|
243
245
|
style: {
|
|
@@ -261,15 +263,15 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
261
263
|
getViewComponentByName(e) {
|
|
262
264
|
switch (e.toLowerCase()) {
|
|
263
265
|
case "week":
|
|
264
|
-
return te;
|
|
265
|
-
case "workweek":
|
|
266
266
|
return ie;
|
|
267
|
+
case "workweek":
|
|
268
|
+
return se;
|
|
267
269
|
case "agenda":
|
|
268
|
-
return Z;
|
|
269
|
-
case "timeline":
|
|
270
270
|
return ee;
|
|
271
|
+
case "timeline":
|
|
272
|
+
return te;
|
|
271
273
|
case "month":
|
|
272
|
-
return
|
|
274
|
+
return re;
|
|
273
275
|
default:
|
|
274
276
|
return m;
|
|
275
277
|
}
|
|
@@ -348,13 +350,13 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
348
350
|
},
|
|
349
351
|
handleDataAction(e) {
|
|
350
352
|
switch (e.type) {
|
|
351
|
-
case
|
|
353
|
+
case g.create:
|
|
352
354
|
this.handleCreate(e);
|
|
353
355
|
break;
|
|
354
|
-
case
|
|
356
|
+
case g.update:
|
|
355
357
|
this.handleUpdate(e);
|
|
356
358
|
break;
|
|
357
|
-
case
|
|
359
|
+
case g.remove:
|
|
358
360
|
this.handleRemove(e);
|
|
359
361
|
break;
|
|
360
362
|
}
|
|
@@ -381,17 +383,17 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
381
383
|
},
|
|
382
384
|
handleNextClick(e) {
|
|
383
385
|
e.preventDefault();
|
|
384
|
-
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ?
|
|
386
|
+
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ? b(this.ks.currentDate, Math.round(i / 27)) : S(this.ks.currentDate, i);
|
|
385
387
|
this.setDate(t, e);
|
|
386
388
|
},
|
|
387
389
|
handlePrevClick(e) {
|
|
388
390
|
e.preventDefault();
|
|
389
|
-
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ?
|
|
391
|
+
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ? b(this.ks.currentDate, -Math.round(i / 27)) : S(this.ks.currentDate, -i);
|
|
390
392
|
this.setDate(t, e);
|
|
391
393
|
},
|
|
392
394
|
handleTodayClick(e) {
|
|
393
395
|
e.preventDefault();
|
|
394
|
-
const i =
|
|
396
|
+
const i = M();
|
|
395
397
|
this.setDate(i, e);
|
|
396
398
|
},
|
|
397
399
|
handleShowWorkHoursClick() {
|
|
@@ -428,7 +430,7 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
428
430
|
});
|
|
429
431
|
},
|
|
430
432
|
updatePassedState(e) {
|
|
431
|
-
const i =
|
|
433
|
+
const i = C(this), s = e || this.ks.activeViewName;
|
|
432
434
|
this.ks.activeViewName = s, this.ks.view = this.views.find((t) => t.name === s) || this.views[0] || o(m, null, null), this.ks.dateFormat = this.getViewPropValue(this.ks.view, "selectedDateFormat", s) || I, this.ks.shortDateFormat = this.getViewPropValue(this.ks.view, "selectedShortDateFormat", s) || $, this.ks.dateRange = this.getViewComponentByName(s).props.dateRange.default()({
|
|
433
435
|
intl: i,
|
|
434
436
|
date: this.ks.currentDate,
|
|
@@ -441,5 +443,5 @@ const I = "{0:D}", $ = "{0:d}", $e = /* @__PURE__ */ j({
|
|
|
441
443
|
}
|
|
442
444
|
});
|
|
443
445
|
export {
|
|
444
|
-
|
|
446
|
+
ye as Scheduler
|
|
445
447
|
};
|