@progress/kendo-vue-scheduler 10.0.1-develop.2 → 10.0.1-develop.4
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.d.ts +20 -21
- package/Scheduler.js +1 -1
- package/Scheduler.mjs +109 -114
- package/dist/cdn/js/kendo-vue-scheduler.js +1 -1
- package/items/SchedulerEditItem.js +1 -1
- package/items/SchedulerEditItem.mjs +2 -2
- package/items/SchedulerItem.d.ts +3 -0
- package/items/SchedulerItem.js +1 -1
- package/items/SchedulerItem.mjs +29 -15
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/views/common/SchedulerDrag.d.ts +6 -0
- package/views/common/SchedulerResize.d.ts +6 -0
- package/components/header/SchedulerAdaptiveHeader.d.ts +0 -44
- package/components/header/SchedulerAdaptiveHeader.js +0 -8
- package/components/header/SchedulerAdaptiveHeader.mjs +0 -110
package/Scheduler.d.ts
CHANGED
|
@@ -690,7 +690,9 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
690
690
|
default: string;
|
|
691
691
|
};
|
|
692
692
|
slotDuration: {
|
|
693
|
-
type: PropType<number>;
|
|
693
|
+
type: PropType<number>; /**
|
|
694
|
+
* Specifies the `className` attribute of the wrapping element of the Scheduler.
|
|
695
|
+
*/
|
|
694
696
|
default: number;
|
|
695
697
|
};
|
|
696
698
|
slotDivisions: {
|
|
@@ -698,13 +700,7 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
698
700
|
default: number;
|
|
699
701
|
};
|
|
700
702
|
step: {
|
|
701
|
-
type: PropType<number>;
|
|
702
|
-
* Overrides the default item. Specifying the `item` property of a specific view will override this property.
|
|
703
|
-
*
|
|
704
|
-
* The default component is: [SchedulerItem]({% slug api_scheduler_scheduleritemprops %})
|
|
705
|
-
*
|
|
706
|
-
* For more information on customizing the scheduler items, refer to the [Item Customization]({% slug scheduler_custom_event %}) article.
|
|
707
|
-
*/
|
|
703
|
+
type: PropType<number>;
|
|
708
704
|
default: number;
|
|
709
705
|
};
|
|
710
706
|
numberOfDays: {
|
|
@@ -741,7 +737,9 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
741
737
|
default: string;
|
|
742
738
|
};
|
|
743
739
|
slotDuration: {
|
|
744
|
-
type: PropType<number>;
|
|
740
|
+
type: PropType<number>; /**
|
|
741
|
+
* Specifies the `className` attribute of the wrapping element of the Scheduler.
|
|
742
|
+
*/
|
|
745
743
|
default: number;
|
|
746
744
|
};
|
|
747
745
|
slotDivisions: {
|
|
@@ -749,13 +747,7 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
749
747
|
default: number;
|
|
750
748
|
};
|
|
751
749
|
step: {
|
|
752
|
-
type: PropType<number>;
|
|
753
|
-
* Overrides the default item. Specifying the `item` property of a specific view will override this property.
|
|
754
|
-
*
|
|
755
|
-
* The default component is: [SchedulerItem]({% slug api_scheduler_scheduleritemprops %})
|
|
756
|
-
*
|
|
757
|
-
* For more information on customizing the scheduler items, refer to the [Item Customization]({% slug scheduler_custom_event %}) article.
|
|
758
|
-
*/
|
|
750
|
+
type: PropType<number>;
|
|
759
751
|
default: number;
|
|
760
752
|
};
|
|
761
753
|
numberOfDays: {
|
|
@@ -863,10 +855,10 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
863
855
|
default: () => any;
|
|
864
856
|
};
|
|
865
857
|
dateHeaderCell: PropType<any>;
|
|
866
|
-
timeHeaderCell: PropType<any>;
|
|
867
|
-
slotRender: PropType<any>; /**
|
|
858
|
+
timeHeaderCell: PropType<any>; /**
|
|
868
859
|
* Specifies the `tabIndex` attribute of the wrapping element of the Scheduler.
|
|
869
860
|
*/
|
|
861
|
+
slotRender: PropType<any>;
|
|
870
862
|
viewSlot: PropType<any>;
|
|
871
863
|
resizeHint: PropType<any>;
|
|
872
864
|
item: PropType<any>;
|
|
@@ -962,10 +954,10 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
962
954
|
default: () => any;
|
|
963
955
|
};
|
|
964
956
|
dateHeaderCell: PropType<any>;
|
|
965
|
-
timeHeaderCell: PropType<any>;
|
|
966
|
-
slotRender: PropType<any>; /**
|
|
957
|
+
timeHeaderCell: PropType<any>; /**
|
|
967
958
|
* Specifies the `tabIndex` attribute of the wrapping element of the Scheduler.
|
|
968
959
|
*/
|
|
960
|
+
slotRender: PropType<any>;
|
|
969
961
|
viewSlot: PropType<any>;
|
|
970
962
|
resizeHint: PropType<any>;
|
|
971
963
|
item: PropType<any>;
|
|
@@ -1371,7 +1363,14 @@ declare const Scheduler: import('vue').DefineComponent<import('vue').ExtractProp
|
|
|
1371
1363
|
ranges(): import('./models/Range').Range[];
|
|
1372
1364
|
monthSlots(): import('./models/Slot').Slot[];
|
|
1373
1365
|
occurrences(): import('./models/Occurrence').Occurrence[];
|
|
1374
|
-
items(): import('./models/Item').Item[];
|
|
1366
|
+
items(): import('./models/Item').Item[]; /**
|
|
1367
|
+
* Overrides the default editTask. Specifying the `editTask` property of a specific view will override this property.
|
|
1368
|
+
* Currently, the `viewTask` is being used in the [AgendaView]({% slug agenda_view_scheduler %}) only.
|
|
1369
|
+
*
|
|
1370
|
+
* The default component is: [SchedulerEditTask]({% slug api_scheduler_scheduleredittaskprops %})
|
|
1371
|
+
*
|
|
1372
|
+
* For more information on customizing the scheduler tasks, refer to the [Task Customization]({% slug overview_agenda_view_scheduler %}) article.
|
|
1373
|
+
*/
|
|
1375
1374
|
compDragItem(): any;
|
|
1376
1375
|
compResizeItem(): any;
|
|
1377
1376
|
}, {
|
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 h=require("vue"),t=require("./utils/main.js"),l=require("@progress/kendo-vue-common"),_=require("./components/header/SchedulerHeader.js"),K=require("./components/header/SchedulerAdaptiveHeader.js"),y=require("@progress/kendo-vue-intl"),S=require("@progress/kendo-date-math"),G=require("./components/footer/SchedulerFooter.js"),b=require("@progress/kendo-vue-buttons"),Y=require("./components/header/navigation/NavigationDatePicker.js"),Z=require("./components/header/view-selector/ViewSelectorList.js"),J=require("./components/footer/bussiness-hours/BusinessHours.js"),p=require("./messages/main.js"),E=require("./package-metadata.js"),Q=require("./views/agenda/AgendaView.js"),X=require("./views/time/TimelineView.js"),C=require("./views/day/DayView.js"),ee=require("./views/week/WeekView.js"),te=require("./views/week/WorkWeekView.js"),ie=require("./views/month/MonthView.js"),R=require("./constants/main.js"),V=require("@progress/kendo-svg-icons"),se=require("./components/SchedulerForm.js"),O=require("@progress/kendo-recurrence"),ae=require("./hooks/useEditable.js");function x(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!h.isVNode(e)}const M="{0:D}",P="{0:d}",W=(e,s)=>{const a=Math.round(s/864e5),i=O.parseRule({recurrenceRule:e});if(a%7===0||(i==null?void 0:i.freq)!=="weekly"||!i.byWeekDay)return e;const r=O.serializeRule({...i,byWeekDay:i.byWeekDay.map(o=>({...o,day:(o.day+a+7)%7}))});return e.toUpperCase().includes("WKST=")?r:r.replace(";WKST=SU","")},re=h.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],editItem:[String,Function,Object],viewTask:[String,Function,Object],editTask:[String,Function,Object],editSlot:[String,Function,Object],className:String,dialogProps:Object,formProps:Object,dateHeaderCell:[String,Function,Object],timeHeaderCell:[String,Function,Object],adaptive:{type:Boolean,default:!1}},computed:{isRtl(){return this.$props.rtl!==void 0?this.$props.rtl:this.currentRtl},isMobile(){return this.$props.adaptive&&this.media==="mobile"},canAdd(){return typeof this.$props.editable=="object"?this.$props.editable.add:!!this.$props.editable},wrapperClassName(){return{"k-rtl":this.isRtl,"k-scheduler":!0,"k-scheduler-mobile":this.isMobile,[this.$props.className]:!!this.$props.className}},fields(){return t.getModelFields(this.$props.modelFields).fields}},mounted(){this.currentRtl=l.isRtl(this.$el),this.calculateMedia(),this.$props.adaptive&&l.canUseDOM&&window.ResizeObserver&&(this.resizeObserver=new window.ResizeObserver(this.calculateMedia),this.resizeObserver.observe(this.$el)),l.canUseDOM&&window.ResizeObserver&&(this.toolbarObserver=new window.ResizeObserver(this.measureToolbar),this.toolbarElement&&this.toolbarObserver.observe(this.toolbarElement))},unmounted(){this.resizeObserver&&this.resizeObserver.disconnect(),this.toolbarObserver&&this.toolbarObserver.disconnect()},provide(){return{ks:this.ks,ksMobile:()=>this.isMobile,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=y.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(d=>d.name===a)||this.views[0]||h.createVNode(C.DayView,null,null),r=this.getViewPropValue(i,"selectedDateFormat",a)||M,o=this.getViewPropValue(i,"selectedShortDateFormat",a)||P,n=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{media:"desktop",toolbarLevel:0,toolbarBreakpoints:[1/0,1/0,1/0],newEventDialogItem:null,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:n,orientation:this.$props.group&&this.$props.group.orientation?this.$props.group.orientation:"horizontal",dateFormat:r,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(){l.validatePackage(E.packageMetadata),this.showLicenseWatermark=l.shouldShowValidationUI(E.packageMetadata),this.licenseMessage=l.getLicenseMessage(E.packageMetadata);const e=this.views.find(U=>U.name===this.ks.activeViewName)||this.views[0]||h.createVNode(C.DayView,null,null),s=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName),a=l.templateRendering.call(this,e.header||this.$props.header,l.getListeners.call(this)),i=l.templateRendering.call(this,e.footer||this.$props.footer,l.getListeners.call(this)),r=l.templateRendering.call(this,e.slot||this.$props.slotRender,{}),o=l.templateRendering.call(this,e.viewSlot||this.$props.viewSlot,{}),n=l.templateRendering.call(this,e.item||this.$props.item,{}),d=l.templateRendering.call(this,e.viewItem||this.$props.viewItem,{}),c=l.templateRendering.call(this,e.task||this.$props.task,{}),f=e.form||this.$props.form||se.SchedulerForm,g=l.templateRendering.call(this,e.dateHeaderCell||this.$props.dateHeaderCell,{}),u=l.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),m=l.templateRendering.call(this,e.resizeHint||this.$props.resizeHint,{});this.ks.form=l.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 w=ae.useEditable(e.editable!==void 0?e.editable:this.$props.editable),D=this.getViewComponentByName(this.ks.activeViewName||e.name),I={...this.$props,...this.ks.view,showWorkHours:this.ks.showWorkHours,dataItems:void 0,views:void 0,defaultDate:void 0,dateRange:this.ks.dateRange,slotRender:r,viewSlot:o,item:n,viewItem:d,task:c,dateHeaderCell:g,timeHeaderCell:u,resizeHint:m,editable:w},k=y.provideLocalizationService(this),v=k.toLanguageString(p.today,p.messages[p.today]),N=k.toLanguageString(p.previousTitle,p.messages[p.previousTitle]),$=k.toLanguageString(p.nextTitle,p.messages[p.nextTitle]),A=k.toLanguageString(p.newEvent,p.messages[p.newEvent]),L=k.toLanguageString(p.newEventLabel,p.messages[p.newEventLabel]),T=k.toLanguageString(p.toolbarLabel,p.messages[p.toolbarLabel]),F=this.toolbarLevel,H=this.isMobile?h.createVNode(K.SchedulerAdaptiveHeader,{isRtl:this.isRtl,onPrevclick:this.handlePrevClick,onNextclick:this.handleNextClick},null):h.createVNode(_.SchedulerHeader,{ref:this.setToolbarRef,ariaLabel:T},{default:()=>[this.canAdd&&h.createVNode(b.Button,{class:"k-toolbar-button",themeColor:"primary",svgIcon:V.plusIcon,"aria-label":L,tabIndex:-1,onClick:this.handleNewEventClick},{default:()=>[F<2&&A]}),F<2&&h.createVNode(b.Button,{class:"k-toolbar-button",fillMode:"flat",tabIndex:-1,title:v,onClick:this.handleTodayClick},x(v)?v:{default:()=>[v]}),F<3&&h.createVNode(b.ButtonGroup,{class:"k-button-group-flat k-toolbar-button-group"},{default:()=>[h.createVNode(b.Button,{fillMode:"flat",tabIndex:-1,svgIcon:this.isRtl?V.chevronRightIcon:V.chevronLeftIcon,"aria-label":N,title:N,onClick:this.handlePrevClick},null),h.createVNode(b.Button,{fillMode:"flat",tabIndex:-1,svgIcon:this.isRtl?V.chevronLeftIcon:V.chevronRightIcon,"aria-label":$,title:$,onClick:this.handleNextClick},null)]}),h.createVNode(Y.NavigationDatePicker,{value:this.ks.currentDate,onChange:this.handleDatePickerChange,level:F},null),h.createVNode(b.ToolbarSpacer,null,null),F===1&&h.createVNode("span",{class:"k-separator"},null),h.createVNode(Z.ViewSelectorList,{level:F},null)]}),j=l.getTemplate.call(this,{h:h.h,template:a,defaultRendering:H,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}}),z=h.createVNode(G.SchedulerFooter,{"aria-label":T},{default:()=>[this.isMobile&&h.createVNode(b.Button,{class:"k-scheduler-today",tabIndex:-1,onClick:this.handleTodayClick},x(v)?v:{default:()=>[v]}),this.isMobile&&h.createVNode(b.ToolbarSpacer,null,null),h.createVNode(J.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]}),q=l.getTemplate.call(this,{h:h.h,template:i,defaultRendering:z,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}}),B=this.showLicenseWatermark?h.createVNode(l.WatermarkOverlay,{message:this.licenseMessage},null):null;return h.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},[j,h.h(D,{key:`${this.ks.view.name}-${this.ks.showWorkHours}`,onDataaction:this.handleDataAction,...I}),!["agenda","month"].includes(this.ks.activeViewName)&&q,B,this.newEventDialogItem&&h.createVNode(f,{dataItem:this.newEventDialogItem,onSubmit:this.handleNewEventFormSubmit,onCancel:this.handleNewEventFormCancel,onClose:this.handleNewEventFormCancel},null)])},methods:{getViewComponentByName(e){switch(e.toLowerCase()){case"week":return ee.WeekView;case"workweek":return te.WorkWeekView;case"agenda":return Q.AgendaView;case"timeline":return X.TimelineView;case"month":return ie.MonthView;default:return C.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)},handleNewEventClick(e){e.preventDefault();const s=new Date,a=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName)||30,i=a*60*1e3,r=s.getMinutes(),o=Math.ceil(r/a)*a;let n=new Date(s);n.setHours(s.getHours()+Math.floor(o/60),o%60,0,0);const d=this.$props.dataItems||[],c=this.fields,f=(m,w)=>d.some(D=>{const I=t.getField(D,c.start),k=t.getField(D,c.end);return!I||!k?!1:I.getTime()<w.getTime()&&k.getTime()>m.getTime()});let g=new Date(n.getTime()+i);for(let m=0;m<48&&f(n,g);m++)n=new Date(n.getTime()+i),g=new Date(n.getTime()+i);const u={};t.setField(u,c.start,n),t.setField(u,c.end,g),t.setField(u,c.isAllDay,!1),t.setField(u,c.title,""),t.setField(u,c.description,""),this.newEventDialogItem=u},handleNewEventFormSubmit(e){this.handleDataChange({created:[e.value]}),this.newEventDialogItem=null},handleNewEventFormCancel(){this.newEventDialogItem=null},handleCreate(e){const s=[e.dataItem];this.handleDataChange({created:s})},handleUpdate(e){const s=[],a=[];if(e.series)if(Array.isArray(e.dataItem)){const i=e.dataItem[0];if(t.getField(i,this.fields.recurrenceId)!==null&&t.getField(i,this.fields.recurrenceId)!==void 0){const o=l.clone(t.findMaster(i,this.fields,this.dataItems)),n=new Date(t.getField(i,this.fields.originalStart)).getTime(),d=new Date(t.getField(i,this.fields.start)).getTime(),c=new Date(t.getField(i,this.fields.end)).getTime(),f=d-n,g=c-d,u=new Date(t.getField(o,this.fields.start)).getTime();t.setField(o,this.fields.start,new Date(u+f)),t.setField(o,this.fields.end,new Date(u+f+g));const m=t.getField(o,this.fields.recurrenceExceptions)||[];if(m.length>0&&f!==0){const w=m.map(D=>new Date(new Date(D).getTime()+f));t.setField(o,this.fields.recurrenceExceptions,w)}t.setField(o,this.fields.recurrenceRule,W(t.getField(o,this.fields.recurrenceRule),f)),a.push(o)}else e.dataItem.forEach(o=>{const n=l.clone(t.findMaster(o,this.fields,this.dataItems)),d=l.clone(o);t.setField(d,this.fields.originalStart,t.getField(n,this.fields.originalStart)),t.setField(d,this.fields.recurrenceId,t.getField(n,this.fields.recurrenceId));const c=t.getField(n,this.fields.recurrenceExceptions)||[],f=new Date(t.getField(n,this.fields.start)).getTime(),u=new Date(t.getField(d,this.fields.start)).getTime()-f;if(c.length>0&&u!==0){const m=c.map(w=>new Date(new Date(w).getTime()+u));t.setField(d,this.fields.recurrenceExceptions,m)}else t.setField(d,this.fields.recurrenceExceptions,c);a.push(d)})}else if(t.getField(e.dataItem,this.fields.recurrenceId)!==null&&t.getField(e.dataItem,this.fields.recurrenceId)!==void 0){const r=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=new Date(t.getField(e.dataItem,this.fields.originalStart)).getTime(),n=new Date(t.getField(e.dataItem,this.fields.start)).getTime(),d=new Date(t.getField(e.dataItem,this.fields.end)).getTime(),c=n-o,f=d-n,g=new Date(t.getField(r,this.fields.start)).getTime();t.setField(r,this.fields.start,new Date(g+c)),t.setField(r,this.fields.end,new Date(g+c+f));const u=t.getField(r,this.fields.recurrenceExceptions)||[];if(u.length>0&&c!==0){const m=u.map(w=>new Date(new Date(w).getTime()+c));t.setField(r,this.fields.recurrenceExceptions,m)}t.setField(r,this.fields.recurrenceRule,W(t.getField(r,this.fields.recurrenceRule),c)),a.push(r)}else{const r=l.clone(e.dataItem);if(t.getField(r,this.fields.recurrenceRule)){const n=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems));t.setField(r,this.fields.originalStart,t.getField(n,this.fields.originalStart)),t.setField(r,this.fields.recurrenceId,t.getField(n,this.fields.recurrenceId));const d=t.getField(n,this.fields.recurrenceExceptions)||[],c=new Date(t.getField(n,this.fields.start)).getTime(),g=new Date(t.getField(r,this.fields.start)).getTime()-c;if(d.length>0&&g!==0){const u=d.map(m=>new Date(new Date(m).getTime()+g));t.setField(r,this.fields.recurrenceExceptions,u)}else t.setField(r,this.fields.recurrenceExceptions,d)}else t.setField(r,this.fields.recurrenceExceptions,null);a.push(r)}else if(Array.isArray(e.dataItem))e.dataItem.forEach(i=>{const r=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&&r){const n=l.clone(t.findMaster(i,this.fields,this.dataItems)),d=t.getField(i,this.fields.originalStart),c=t.getField(n,this.fields.recurrenceExceptions)||[];t.setField(n,this.fields.recurrenceExceptions,[...c,d]),t.setField(i,this.fields.recurrenceRule,null),a.push(n),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=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),n=t.getField(e.dataItem,this.fields.originalStart),d=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...d,n]),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=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),r=l.clone(e.dataItem);t.setField(r,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(r,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(r,this.fields.recurrenceRule,t.getField(i,this.fields.recurrenceRule)),t.setField(r,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(r)}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 r=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=t.getField(e.dataItem,this.fields.originalStart),n=t.getField(r,this.fields.recurrenceExceptions)||[];t.setField(r,this.fields.recurrenceExceptions,[...n,o]),t.setField(e.dataItem,this.fields.recurrenceRule,null),s.push(r)}this.handleDataChange({updated:s,deleted:a})},handleDataAction(e){switch(e.type){case R.DATA_ACTION.create:this.handleCreate(e);break;case R.DATA_ACTION.update:this.handleUpdate(e);break;case R.DATA_ACTION.remove:this.handleRemove(e);break}},handleActiveViewNameChange(e,s){this.$props.view===void 0&&this.updatePassedState(e),this.$emit("viewchange",{viewName:e,...s,target:this.ks.scheduler.$el})},setToolbarRef(e){const s=(e==null?void 0:e.$el)||null;s!==this.toolbarElement&&(this.toolbarObserver&&this.toolbarElement&&this.toolbarObserver.unobserve(this.toolbarElement),this.toolbarElement=s,this.toolbarObserver&&s&&this.toolbarObserver.observe(s))},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?S.addMonths(this.ks.currentDate,Math.round(s/27)):S.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?S.addMonths(this.ks.currentDate,-Math.round(s/27)):S.addDays(this.ks.currentDate,-s);this.setDate(i,e)},handleTodayClick(e){e.preventDefault();const s=S.ZonedDate.fromLocalDate(new Date,this.ks.timezone);this.setDate(new Date(s.getTime()),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.$props.date===void 0&&(this.ks.currentDate=e,this.updatePassedState()),this.$emit("datechange",{date:e,event:s})},updatePassedState(e){const s=y.provideIntlService(this),a=e||this.ks.activeViewName;this.ks.activeViewName=a,this.ks.view=this.views.find(i=>i.name===a)||this.views[0]||h.createVNode(C.DayView,null,null),this.ks.dateFormat=this.getViewPropValue(this.ks.view,"selectedDateFormat",a)||M,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",a)||P,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})},calculateMedia(){l.canUseDOM&&window.matchMedia&&(this.media=window.matchMedia("(min-width: 1024px)").matches?"desktop":"mobile")},measureToolbar(){const s=this.toolbarElement;if(!s)return;const a=s.clientWidth;if(!a)return;const i=parseInt(window.getComputedStyle(s).gap||"0",10),r=Array.from(s.children),o=r.reduce((d,c)=>d+c.offsetWidth,0)+(r.length-1)*i,n=this.toolbarLevel;if(o>a&&n<3){this.toolbarBreakpoints[n]=a,this.toolbarLevel=n+1;return}n>0&&a>this.toolbarBreakpoints[n-1]+20&&(this.toolbarLevel=n-1)}}});exports.Scheduler=re;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),t=require("./utils/main.js"),l=require("@progress/kendo-vue-common"),_=require("./components/header/SchedulerHeader.js"),y=require("@progress/kendo-vue-intl"),S=require("@progress/kendo-date-math"),K=require("./components/footer/SchedulerFooter.js"),b=require("@progress/kendo-vue-buttons"),G=require("./components/header/navigation/NavigationDatePicker.js"),Y=require("./components/header/view-selector/ViewSelectorList.js"),Z=require("./components/footer/bussiness-hours/BusinessHours.js"),p=require("./messages/main.js"),E=require("./package-metadata.js"),J=require("./views/agenda/AgendaView.js"),Q=require("./views/time/TimelineView.js"),C=require("./views/day/DayView.js"),X=require("./views/week/WeekView.js"),ee=require("./views/week/WorkWeekView.js"),te=require("./views/month/MonthView.js"),R=require("./constants/main.js"),V=require("@progress/kendo-svg-icons"),ie=require("./components/SchedulerForm.js"),O=require("@progress/kendo-recurrence"),se=require("./hooks/useEditable.js");function x(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!h.isVNode(e)}const M="{0:D}",P="{0:d}",W=(e,s)=>{const a=Math.round(s/864e5),i=O.parseRule({recurrenceRule:e});if(a%7===0||(i==null?void 0:i.freq)!=="weekly"||!i.byWeekDay)return e;const r=O.serializeRule({...i,byWeekDay:i.byWeekDay.map(o=>({...o,day:(o.day+a+7)%7}))});return e.toUpperCase().includes("WKST=")?r:r.replace(";WKST=SU","")},ae=h.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],editItem:[String,Function,Object],viewTask:[String,Function,Object],editTask:[String,Function,Object],editSlot:[String,Function,Object],className:String,dialogProps:Object,formProps:Object,dateHeaderCell:[String,Function,Object],timeHeaderCell:[String,Function,Object],adaptive:{type:Boolean,default:!0}},computed:{isRtl(){return this.$props.rtl!==void 0?this.$props.rtl:this.currentRtl},isMobile(){return this.$props.adaptive&&this.media==="mobile"},canAdd(){return typeof this.$props.editable=="object"?this.$props.editable.add:!!this.$props.editable},wrapperClassName(){return{"k-rtl":this.isRtl,"k-scheduler":!0,"k-scheduler-mobile":this.isMobile,[this.$props.className]:!!this.$props.className}},fields(){return t.getModelFields(this.$props.modelFields).fields}},mounted(){this.currentRtl=l.isRtl(this.$el),this.calculateMedia(),this.$props.adaptive&&l.canUseDOM&&window.ResizeObserver&&(this.resizeObserver=new window.ResizeObserver(this.calculateMedia),this.resizeObserver.observe(this.$el)),l.canUseDOM&&window.ResizeObserver&&(this.toolbarObserver=new window.ResizeObserver(this.measureToolbar),this.toolbarElement&&(this.toolbarObserver.observe(this.toolbarElement),this.measureToolbar()))},unmounted(){this.resizeObserver&&this.resizeObserver.disconnect(),this.toolbarObserver&&this.toolbarObserver.disconnect()},provide(){return{ks:this.ks,ksMobile:()=>this.isMobile,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=y.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(d=>d.name===a)||this.views[0]||h.createVNode(C.DayView,null,null),r=this.getViewPropValue(i,"selectedDateFormat",a)||M,o=this.getViewPropValue(i,"selectedShortDateFormat",a)||P,n=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{media:"desktop",toolbarLevel:0,toolbarBreakpoints:[1/0,1/0,1/0],newEventDialogItem:null,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:n,orientation:this.$props.group&&this.$props.group.orientation?this.$props.group.orientation:"horizontal",dateFormat:r,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(){l.validatePackage(E.packageMetadata),this.showLicenseWatermark=l.shouldShowValidationUI(E.packageMetadata),this.licenseMessage=l.getLicenseMessage(E.packageMetadata);const e=this.views.find(U=>U.name===this.ks.activeViewName)||this.views[0]||h.createVNode(C.DayView,null,null),s=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName),a=l.templateRendering.call(this,e.header||this.$props.header,l.getListeners.call(this)),i=l.templateRendering.call(this,e.footer||this.$props.footer,l.getListeners.call(this)),r=l.templateRendering.call(this,e.slot||this.$props.slotRender,{}),o=l.templateRendering.call(this,e.viewSlot||this.$props.viewSlot,{}),n=l.templateRendering.call(this,e.item||this.$props.item,{}),d=l.templateRendering.call(this,e.viewItem||this.$props.viewItem,{}),c=l.templateRendering.call(this,e.task||this.$props.task,{}),f=e.form||this.$props.form||ie.SchedulerForm,g=l.templateRendering.call(this,e.dateHeaderCell||this.$props.dateHeaderCell,{}),u=l.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),m=l.templateRendering.call(this,e.resizeHint||this.$props.resizeHint,{});this.ks.form=l.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 w=se.useEditable(e.editable!==void 0?e.editable:this.$props.editable),D=this.getViewComponentByName(this.ks.activeViewName||e.name),I={...this.$props,...this.ks.view,showWorkHours:this.ks.showWorkHours,dataItems:void 0,views:void 0,defaultDate:void 0,dateRange:this.ks.dateRange,slotRender:r,viewSlot:o,item:n,viewItem:d,task:c,dateHeaderCell:g,timeHeaderCell:u,resizeHint:m,editable:w},k=y.provideLocalizationService(this),v=k.toLanguageString(p.today,p.messages[p.today]),N=k.toLanguageString(p.previousTitle,p.messages[p.previousTitle]),T=k.toLanguageString(p.nextTitle,p.messages[p.nextTitle]),L=k.toLanguageString(p.newEvent,p.messages[p.newEvent]),A=k.toLanguageString(p.newEventLabel,p.messages[p.newEventLabel]),$=k.toLanguageString(p.toolbarLabel,p.messages[p.toolbarLabel]),F=this.toolbarLevel,H=h.createVNode(_.SchedulerHeader,{ref:this.setToolbarRef,ariaLabel:$},{default:()=>[this.canAdd&&h.createVNode(b.Button,{class:"k-toolbar-button",themeColor:"primary",svgIcon:V.plusIcon,"aria-label":A,tabIndex:-1,onClick:this.handleNewEventClick},{default:()=>[F<2&&L]}),F<2&&h.createVNode(b.Button,{class:"k-toolbar-button",fillMode:"flat",tabIndex:-1,title:v,onClick:this.handleTodayClick},x(v)?v:{default:()=>[v]}),F<3&&h.createVNode(b.ButtonGroup,{class:"k-button-group-flat k-toolbar-button-group"},{default:()=>[h.createVNode(b.Button,{fillMode:"flat",tabIndex:-1,svgIcon:this.isRtl?V.chevronRightIcon:V.chevronLeftIcon,"aria-label":N,title:N,onClick:this.handlePrevClick},null),h.createVNode(b.Button,{fillMode:"flat",tabIndex:-1,svgIcon:this.isRtl?V.chevronLeftIcon:V.chevronRightIcon,"aria-label":T,title:T,onClick:this.handleNextClick},null)]}),h.createVNode(G.NavigationDatePicker,{value:this.ks.currentDate,onChange:this.handleDatePickerChange,level:F},null),h.createVNode(b.ToolbarSpacer,null,null),F===1&&h.createVNode("span",{class:"k-separator"},null),h.createVNode(Y.ViewSelectorList,{level:F},null)]}),j=l.getTemplate.call(this,{h:h.h,template:a,defaultRendering:H,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}}),z=h.createVNode(K.SchedulerFooter,{"aria-label":$},{default:()=>[this.isMobile&&h.createVNode(b.Button,{class:"k-scheduler-today",tabIndex:-1,onClick:this.handleTodayClick},x(v)?v:{default:()=>[v]}),this.isMobile&&h.createVNode(b.ToolbarSpacer,null,null),h.createVNode(Z.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]}),q=l.getTemplate.call(this,{h:h.h,template:i,defaultRendering:z,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}}),B=this.showLicenseWatermark?h.createVNode(l.WatermarkOverlay,{message:this.licenseMessage},null):null;return h.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},[j,h.h(D,{key:`${this.ks.view.name}-${this.ks.showWorkHours}`,onDataaction:this.handleDataAction,...I}),!["agenda","month"].includes(this.ks.activeViewName)&&q,B,this.newEventDialogItem&&h.createVNode(f,{dataItem:this.newEventDialogItem,onSubmit:this.handleNewEventFormSubmit,onCancel:this.handleNewEventFormCancel,onClose:this.handleNewEventFormCancel},null)])},methods:{getViewComponentByName(e){switch(e.toLowerCase()){case"week":return X.WeekView;case"workweek":return ee.WorkWeekView;case"agenda":return J.AgendaView;case"timeline":return Q.TimelineView;case"month":return te.MonthView;default:return C.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)},handleNewEventClick(e){e.preventDefault();const s=new Date,a=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName)||30,i=a*60*1e3,r=s.getMinutes(),o=Math.ceil(r/a)*a;let n=new Date(s);n.setHours(s.getHours()+Math.floor(o/60),o%60,0,0);const d=this.$props.dataItems||[],c=this.fields,f=(m,w)=>d.some(D=>{const I=t.getField(D,c.start),k=t.getField(D,c.end);return!I||!k?!1:I.getTime()<w.getTime()&&k.getTime()>m.getTime()});let g=new Date(n.getTime()+i);for(let m=0;m<48&&f(n,g);m++)n=new Date(n.getTime()+i),g=new Date(n.getTime()+i);const u={};t.setField(u,c.start,n),t.setField(u,c.end,g),t.setField(u,c.isAllDay,!1),t.setField(u,c.title,""),t.setField(u,c.description,""),this.newEventDialogItem=u},handleNewEventFormSubmit(e){this.handleDataChange({created:[e.value]}),this.newEventDialogItem=null},handleNewEventFormCancel(){this.newEventDialogItem=null},handleCreate(e){const s=[e.dataItem];this.handleDataChange({created:s})},handleUpdate(e){const s=[],a=[];if(e.series)if(Array.isArray(e.dataItem)){const i=e.dataItem[0];if(t.getField(i,this.fields.recurrenceId)!==null&&t.getField(i,this.fields.recurrenceId)!==void 0){const o=l.clone(t.findMaster(i,this.fields,this.dataItems)),n=new Date(t.getField(i,this.fields.originalStart)).getTime(),d=new Date(t.getField(i,this.fields.start)).getTime(),c=new Date(t.getField(i,this.fields.end)).getTime(),f=d-n,g=c-d,u=new Date(t.getField(o,this.fields.start)).getTime();t.setField(o,this.fields.start,new Date(u+f)),t.setField(o,this.fields.end,new Date(u+f+g));const m=t.getField(o,this.fields.recurrenceExceptions)||[];if(m.length>0&&f!==0){const w=m.map(D=>new Date(new Date(D).getTime()+f));t.setField(o,this.fields.recurrenceExceptions,w)}t.setField(o,this.fields.recurrenceRule,W(t.getField(o,this.fields.recurrenceRule),f)),a.push(o)}else e.dataItem.forEach(o=>{const n=l.clone(t.findMaster(o,this.fields,this.dataItems)),d=l.clone(o);t.setField(d,this.fields.originalStart,t.getField(n,this.fields.originalStart)),t.setField(d,this.fields.recurrenceId,t.getField(n,this.fields.recurrenceId));const c=t.getField(n,this.fields.recurrenceExceptions)||[],f=new Date(t.getField(n,this.fields.start)).getTime(),u=new Date(t.getField(d,this.fields.start)).getTime()-f;if(c.length>0&&u!==0){const m=c.map(w=>new Date(new Date(w).getTime()+u));t.setField(d,this.fields.recurrenceExceptions,m)}else t.setField(d,this.fields.recurrenceExceptions,c);a.push(d)})}else if(t.getField(e.dataItem,this.fields.recurrenceId)!==null&&t.getField(e.dataItem,this.fields.recurrenceId)!==void 0){const r=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=new Date(t.getField(e.dataItem,this.fields.originalStart)).getTime(),n=new Date(t.getField(e.dataItem,this.fields.start)).getTime(),d=new Date(t.getField(e.dataItem,this.fields.end)).getTime(),c=n-o,f=d-n,g=new Date(t.getField(r,this.fields.start)).getTime();t.setField(r,this.fields.start,new Date(g+c)),t.setField(r,this.fields.end,new Date(g+c+f));const u=t.getField(r,this.fields.recurrenceExceptions)||[];if(u.length>0&&c!==0){const m=u.map(w=>new Date(new Date(w).getTime()+c));t.setField(r,this.fields.recurrenceExceptions,m)}t.setField(r,this.fields.recurrenceRule,W(t.getField(r,this.fields.recurrenceRule),c)),a.push(r)}else{const r=l.clone(e.dataItem);if(t.getField(r,this.fields.recurrenceRule)){const n=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems));t.setField(r,this.fields.originalStart,t.getField(n,this.fields.originalStart)),t.setField(r,this.fields.recurrenceId,t.getField(n,this.fields.recurrenceId));const d=t.getField(n,this.fields.recurrenceExceptions)||[],c=new Date(t.getField(n,this.fields.start)).getTime(),g=new Date(t.getField(r,this.fields.start)).getTime()-c;if(d.length>0&&g!==0){const u=d.map(m=>new Date(new Date(m).getTime()+g));t.setField(r,this.fields.recurrenceExceptions,u)}else t.setField(r,this.fields.recurrenceExceptions,d)}else t.setField(r,this.fields.recurrenceExceptions,null);a.push(r)}else if(Array.isArray(e.dataItem))e.dataItem.forEach(i=>{const r=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&&r){const n=l.clone(t.findMaster(i,this.fields,this.dataItems)),d=t.getField(i,this.fields.originalStart),c=t.getField(n,this.fields.recurrenceExceptions)||[];t.setField(n,this.fields.recurrenceExceptions,[...c,d]),t.setField(i,this.fields.recurrenceRule,null),a.push(n),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=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),n=t.getField(e.dataItem,this.fields.originalStart),d=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...d,n]),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=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),r=l.clone(e.dataItem);t.setField(r,this.fields.originalStart,t.getField(i,this.fields.originalStart)),t.setField(r,this.fields.recurrenceId,t.getField(i,this.fields.recurrenceId)),t.setField(r,this.fields.recurrenceRule,t.getField(i,this.fields.recurrenceRule)),t.setField(r,this.fields.recurrenceExceptions,t.getField(i,this.fields.recurrenceExceptions)),a.push(r)}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 r=l.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=t.getField(e.dataItem,this.fields.originalStart),n=t.getField(r,this.fields.recurrenceExceptions)||[];t.setField(r,this.fields.recurrenceExceptions,[...n,o]),t.setField(e.dataItem,this.fields.recurrenceRule,null),s.push(r)}this.handleDataChange({updated:s,deleted:a})},handleDataAction(e){switch(e.type){case R.DATA_ACTION.create:this.handleCreate(e);break;case R.DATA_ACTION.update:this.handleUpdate(e);break;case R.DATA_ACTION.remove:this.handleRemove(e);break}},handleActiveViewNameChange(e,s){this.$props.view===void 0&&this.updatePassedState(e),this.$emit("viewchange",{viewName:e,...s,target:this.ks.scheduler.$el})},setToolbarRef(e){const s=(e==null?void 0:e.$el)||null;s!==this.toolbarElement&&(this.toolbarObserver&&this.toolbarElement&&this.toolbarObserver.unobserve(this.toolbarElement),this.toolbarElement=s,this.toolbarObserver&&s&&this.toolbarObserver.observe(s))},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?S.addMonths(this.ks.currentDate,Math.round(s/27)):S.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?S.addMonths(this.ks.currentDate,-Math.round(s/27)):S.addDays(this.ks.currentDate,-s);this.setDate(i,e)},handleTodayClick(e){e.preventDefault();const s=S.ZonedDate.fromLocalDate(new Date,this.ks.timezone);this.setDate(new Date(s.getTime()),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.$props.date===void 0&&(this.ks.currentDate=e,this.updatePassedState()),this.$emit("datechange",{date:e,event:s})},updatePassedState(e){const s=y.provideIntlService(this),a=e||this.ks.activeViewName;this.ks.activeViewName=a,this.ks.view=this.views.find(i=>i.name===a)||this.views[0]||h.createVNode(C.DayView,null,null),this.ks.dateFormat=this.getViewPropValue(this.ks.view,"selectedDateFormat",a)||M,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",a)||P,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})},calculateMedia(){l.canUseDOM&&window.matchMedia&&(this.media=window.matchMedia("(min-width: 1024px)").matches?"desktop":"mobile")},measureToolbar(){const s=this.toolbarElement;if(!s)return;const a=s.clientWidth;if(!a)return;const i=parseInt(window.getComputedStyle(s).gap||"0",10),r=Array.from(s.children),o=r.reduce((d,c)=>d+c.offsetWidth,0)+(r.length-1)*i,n=this.toolbarLevel;if(o>a&&n<3){this.toolbarBreakpoints[n]=a,this.toolbarLevel=n+1;return}n>0&&a>this.toolbarBreakpoints[n-1]+20&&(this.toolbarLevel=n-1)}}});exports.Scheduler=ae;
|