@progress/kendo-vue-scheduler 6.0.0-develop.1 → 6.0.0-develop.3
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 +66 -53
- package/components/SchedulerForm.js +1 -1
- package/components/SchedulerForm.mjs +1 -1
- package/dist/cdn/js/kendo-vue-scheduler.js +1 -1
- package/index.d.mts +121 -66
- package/index.d.ts +121 -66
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/tasks/SchedulerEditTask.js +1 -1
- package/tasks/SchedulerEditTask.mjs +3 -2
- package/tasks/SchedulerViewTask.js +1 -1
- package/tasks/SchedulerViewTask.mjs +1 -0
- package/views/agenda/AgendaViewBody.js +1 -1
- package/views/agenda/AgendaViewBody.mjs +1 -0
- package/views/common/HorizontalResourceIterator.js +1 -1
- package/views/common/HorizontalResourceIterator.mjs +2 -2
- package/views/common/VerticalResourceIterator.js +1 -1
- package/views/common/VerticalResourceIterator.mjs +1 -0
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"),a=require("@progress/kendo-vue-common"),N=require("./components/header/SchedulerHeader.js"),f=require("@progress/kendo-vue-intl"),P=require("./components/header/navigation/SchedulerNavigation.js"),c=require("@progress/kendo-date-math"),x=require("./components/footer/SchedulerFooter.js"),O=require("@progress/kendo-vue-buttons"),E=require("./components/header/navigation/NavigationDatePicker.js"),A=require("./components/header/view-selector/ViewSelectorList.js"),T=require("./components/footer/bussiness-hours/BusinessHours.js"),w=require("./package-metadata.js"),H=require("./views/agenda/AgendaView.js"),W=require("./views/time/TimelineView.js"),u=require("./views/day/DayView.js"),M=require("./views/week/WeekView.js"),q=require("./views/week/WorkWeekView.js"),j=require("./views/month/MonthView.js"),m=require("./constants/main.js"),z=require("./hooks/useEditable.js"),V="{0:D}",D="{0:d}",L=n.defineComponent({name:"KendoScheduler",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=a.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=f.provideIntlService(this),s=this.$props.date||this.$props.defaultDate,r=this.$props.view||this.$props.defaultView||this.views[0]&&this.views[0].name||"day",i=this.views.find(h=>h.name===r)||this.views[0]||n.createVNode(u.DayView,null,null),l=this.getViewPropValue(i,"selectedDateFormat",r)||V,o=this.getViewPropValue(i,"selectedShortDateFormat",r)||D,d=this.getViewComponentByName(r).props.dateRange.default()({intl:e,date:s,timezone:this.$props.timezone,numberOfDays:this.getViewPropValue(i,"numberOfDays",r),workWeekStart:this.getViewPropValue(i,"workWeekStart",r)||e.firstDay(),workWeekEnd:this.getViewPropValue(i,"workWeekEnd",r)||(e.firstDay()+this.getViewPropValue(i,"numberOfDays",r))%6});return{ks:{activeViewName:r,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(){a.validatePackage(w.packageMetadata),this.showLicenseWatermark=a.shouldShowValidationUI(w.packageMetadata),this.$props;const e=this.views.find($=>$.name===this.ks.activeViewName)||this.views[0]||n.createVNode(u.DayView,null,null),s=this.getViewPropValue(this.ks.view,"slotDuration",this.ks.activeViewName),r=a.templateRendering.call(this,e.header||this.$props.header,a.getListeners.call(this)),i=a.templateRendering.call(this,e.footer||this.$props.footer,a.getListeners.call(this)),l=a.templateRendering.call(this,e.slot||this.$props.slotRender,{}),o=a.templateRendering.call(this,e.viewSlot||this.$props.viewSlot,{}),d=a.templateRendering.call(this,e.item||this.$props.item,{}),h=a.templateRendering.call(this,e.viewItem||this.$props.viewItem,{}),p=a.templateRendering.call(this,e.task||this.$props.task,{}),v=a.templateRendering.call(this,e.dateHeaderCell||this.$props.dateHeaderCell,{}),F=a.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),C=a.templateRendering.call(this,e.resizeHint||this.$props.resizeHint,{});this.ks.form=a.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 S=z.useEditable(e.editable!==void 0?e.editable:this.$props.editable),b=this.getViewComponentByName(this.ks.activeViewName||e.name);({...this.$props,...this.ks.view,showWorkHours:this.ks.showWorkHours,dateRange:this.ks.dateRange});let k;const I=n.createVNode(N.SchedulerHeader,null,{default:()=>[n.createVNode(P.SchedulerNavigation,{isRtl:this.isRtl,onPrevclick:this.handlePrevClick,onNextclick:this.handleNextClick,onTodayclick:this.handleTodayClick},null),n.createVNode(E.NavigationDatePicker,{value:this.ks.currentDate,onChange:this.handleDatePickerChange},null),n.createVNode(O.ToolbarSpacer,null,null),n.createVNode(A.ViewSelectorList,null,null)]});k=a.getTemplate.call(this,{h:n.h,template:r,defaultRendering:I,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}});let g;const R=n.createVNode(x.SchedulerFooter,null,{default:()=>[n.createVNode(T.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]});g=a.getTemplate.call(this,{h:n.h,template:i,defaultRendering:R,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}});const y=this.showLicenseWatermark?n.createVNode(a.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},[k,n.h(b,{key:this.ks.view.name,onDataaction:this.handleDataAction}),g,y])},methods:{getViewComponentByName(e){switch(e.toLowerCase()){case"week":return M.WeekView;case"workweek":return q.WorkWeekView;case"agenda":return H.AgendaView;case"timeline":return W.TimelineView;case"month":return j.MonthView;default:return u.DayView}},getViewPropValue(e,s,r){const i=this.getViewComponentByName(r).props[s];return e[s]||(i?i.default:void 0)},handleDataChange({created:e=[],updated:s=[],deleted:r=[]}){const i={created:e,updated:s,deleted:r};this.$emit("datachange",i)},handleCreate(e){const s=[e.dataItem];this.handleDataChange({created:s})},handleUpdate(e){const s=[],r=[];if(e.series)if(Array.isArray(e.dataItem))e.dataItem.map(i=>{const l=a.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),o=a.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)),r.push(o)});else{const i=a.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=a.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)),r.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=a.clone(t.findMaster(i,this.fields,this.dataItems)),h=t.getField(i,this.fields.originalStart),p=t.getField(d,this.fields.recurrenceExceptions)||[];t.setField(d,this.fields.recurrenceExceptions,[...p,h]),t.setField(i,this.fields.recurrenceRule,null),r.push(d),s.push(i)}else r.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=a.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),d=t.getField(e.dataItem,this.fields.originalStart),h=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...h,d]),t.setField(e.dataItem,this.fields.recurrenceRule,null),r.push(o),s.push(e.dataItem)}else r.push(e.dataItem)}this.handleDataChange({updated:r,created:s})},handleRemove(e){const s=[],r=[];if(e.series){const i=a.clone(t.findMaster(e.dataItem,this.fields,this.dataItems)),l=a.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)),r.push(l)}else if(!(t.getField(e.dataItem,this.fields.recurrenceRule)!==null&&t.getField(e.dataItem,this.fields.recurrenceRule)!==void 0))r.push(e.dataItem);else{const l=a.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:r})},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?c.addMonths(this.ks.currentDate,Math.round(s/27)):c.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?c.addMonths(this.ks.currentDate,-Math.round(s/27)):c.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=f.provideIntlService(this),r=e||this.ks.activeViewName;this.ks.activeViewName=r,this.ks.view=this.views.find(i=>i.name===r)||this.views[0]||n.createVNode(u.DayView,null,null),this.ks.dateFormat=this.getViewPropValue(this.ks.view,"selectedDateFormat",r)||V,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",r)||D,this.ks.dateRange=this.getViewComponentByName(r).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=L;
|
|
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"),f=require("@progress/kendo-vue-intl"),x=require("./components/header/navigation/SchedulerNavigation.js"),c=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"),w=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"),V="{0:D}",D="{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=f.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(h=>h.name===a)||this.views[0]||n.createVNode(u.DayView,null,null),l=this.getViewPropValue(i,"selectedDateFormat",a)||V,o=this.getViewPropValue(i,"selectedShortDateFormat",a)||D,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(w.packageMetadata),this.showLicenseWatermark=r.shouldShowValidationUI(w.packageMetadata),this.$props;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,{}),h=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,{}),F=r.templateRendering.call(this,e.timeHeaderCell||this.$props.timeHeaderCell,{}),C=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 S=L.useEditable(e.editable!==void 0?e.editable:this.$props.editable),b=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:l,viewSlot:o,item:d,viewItem:h,task:p,dateHeaderCell:v,timeHeaderCell:F,resizeHint:C,editable:S};let k;const R=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)]});k=r.getTemplate.call(this,{h:n.h,template:a,defaultRendering:R,additionalProps:{currentDate:this.ks.currentDate},additionalListeners:{prevclick:this.handlePrevClick,nextclick:this.handleNextClick,todayclick:this.handleTodayClick,datepickerchange:this.handleDatePickerChange}});let g;const y=n.createVNode(O.SchedulerFooter,null,{default:()=>[n.createVNode(H.BusinessHours,{slotDuration:s,onClick:this.handleShowWorkHoursClick},null)]});g=r.getTemplate.call(this,{h:n.h,template:i,defaultRendering:y,additionalProps:{slotDuration:s},additionalListeners:{showworkhoursclick:this.handleShowWorkHoursClick}});const $=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},[k,n.h(b,{key:this.ks.view.name,onDataaction:this.handleDataAction,...I}),g,$])},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)),h=t.getField(i,this.fields.originalStart),p=t.getField(d,this.fields.recurrenceExceptions)||[];t.setField(d,this.fields.recurrenceExceptions,[...p,h]),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),h=t.getField(o,this.fields.recurrenceExceptions)||[];t.setField(o,this.fields.recurrenceExceptions,[...h,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?c.addMonths(this.ks.currentDate,Math.round(s/27)):c.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?c.addMonths(this.ks.currentDate,-Math.round(s/27)):c.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=f.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)||V,this.ks.shortDateFormat=this.getViewPropValue(this.ks.view,"selectedShortDateFormat",a)||D,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
|
@@ -5,29 +5,30 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { getModelFields as
|
|
10
|
-
import { isRtl 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
|
|
8
|
+
import { defineComponent as j, createVNode as o, h as f } from "vue";
|
|
9
|
+
import { getModelFields as D, toSchedulerGroups as z, findMaster as p, setField as l, getField as r, getToday as M } from "./utils/main.mjs";
|
|
10
|
+
import { isRtl as L, validatePackage as B, shouldShowValidationUI as _, templateRendering as d, getListeners as V, getTemplate as C, WatermarkOverlay as U, clone as c } from "@progress/kendo-vue-common";
|
|
11
|
+
import { SchedulerHeader as G } from "./components/header/SchedulerHeader.mjs";
|
|
12
|
+
import { provideIntlService as b } from "@progress/kendo-vue-intl";
|
|
13
|
+
import { SchedulerNavigation as K } from "./components/header/navigation/SchedulerNavigation.mjs";
|
|
14
|
+
import { addMonths as S, addDays as I } from "@progress/kendo-date-math";
|
|
15
|
+
import { SchedulerFooter as q } from "./components/footer/SchedulerFooter.mjs";
|
|
16
|
+
import { ToolbarSpacer as J } from "@progress/kendo-vue-buttons";
|
|
17
|
+
import { NavigationDatePicker as Q } from "./components/header/navigation/NavigationDatePicker.mjs";
|
|
18
|
+
import { ViewSelectorList as X } from "./components/header/view-selector/ViewSelectorList.mjs";
|
|
19
|
+
import { BusinessHours as Y } from "./components/footer/bussiness-hours/BusinessHours.mjs";
|
|
20
20
|
import { packageMetadata as $ } from "./package-metadata.mjs";
|
|
21
|
-
import { AgendaView as
|
|
22
|
-
import { TimelineView as
|
|
21
|
+
import { AgendaView as Z } from "./views/agenda/AgendaView.mjs";
|
|
22
|
+
import { TimelineView as ee } 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
|
|
24
|
+
import { WeekView as te } from "./views/week/WeekView.mjs";
|
|
25
|
+
import { WorkWeekView as ie } from "./views/week/WorkWeekView.mjs";
|
|
26
|
+
import { MonthView as se } from "./views/month/MonthView.mjs";
|
|
27
27
|
import { DATA_ACTION as w } from "./constants/main.mjs";
|
|
28
|
-
import { useEditable as
|
|
29
|
-
const y = "{0:D}", R = "{0:d}",
|
|
28
|
+
import { useEditable as re } from "./hooks/useEditable.mjs";
|
|
29
|
+
const y = "{0:D}", R = "{0:d}", $e = /* @__PURE__ */ j({
|
|
30
30
|
name: "KendoScheduler",
|
|
31
|
+
emits: ["datechange", "viewchange", "datachange", "itemclick", "itemdoubleclick", "slotclick", "slotdoubleclick", "taskclick", "taskdoubleclick"],
|
|
31
32
|
props: {
|
|
32
33
|
dataItems: {
|
|
33
34
|
type: Array,
|
|
@@ -100,11 +101,11 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
100
101
|
};
|
|
101
102
|
},
|
|
102
103
|
fields() {
|
|
103
|
-
return
|
|
104
|
+
return D(this.$props.modelFields).fields;
|
|
104
105
|
}
|
|
105
106
|
},
|
|
106
107
|
mounted() {
|
|
107
|
-
this.currentRtl =
|
|
108
|
+
this.currentRtl = L(this.$el);
|
|
108
109
|
},
|
|
109
110
|
provide() {
|
|
110
111
|
return {
|
|
@@ -130,7 +131,7 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
130
131
|
}
|
|
131
132
|
},
|
|
132
133
|
data() {
|
|
133
|
-
const e =
|
|
134
|
+
const e = b(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) || y, n = this.getViewPropValue(t, "selectedShortDateFormat", s) || R, h = this.getViewComponentByName(s).props.dateRange.default()({
|
|
134
135
|
intl: e,
|
|
135
136
|
date: i,
|
|
136
137
|
timezone: this.$props.timezone,
|
|
@@ -149,8 +150,8 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
149
150
|
},
|
|
150
151
|
views: this.views,
|
|
151
152
|
view: t,
|
|
152
|
-
fields:
|
|
153
|
-
groups:
|
|
153
|
+
fields: D(this.$props.modelFields).fields,
|
|
154
|
+
groups: z(this.$props.group, this.$props.resources),
|
|
154
155
|
dateRange: h,
|
|
155
156
|
orientation: this.$props.group && this.$props.group.orientation ? this.$props.group.orientation : "horizontal",
|
|
156
157
|
dateFormat: a,
|
|
@@ -178,32 +179,43 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
178
179
|
}
|
|
179
180
|
},
|
|
180
181
|
render() {
|
|
181
|
-
|
|
182
|
-
const e = this.views.find((
|
|
182
|
+
B($), this.showLicenseWatermark = _($), this.$props;
|
|
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, V.call(this)), t = d.call(this, e.footer || this.$props.footer, V.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, {}), P = d.call(this, e.dateHeaderCell || this.$props.dateHeaderCell, {}), F = d.call(this, e.timeHeaderCell || this.$props.timeHeaderCell, {}), x = d.call(this, e.resizeHint || this.$props.resizeHint, {});
|
|
183
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;
|
|
184
|
-
const N =
|
|
185
|
-
({
|
|
185
|
+
const N = re(e.editable !== void 0 ? e.editable : this.$props.editable), E = this.getViewComponentByName(this.ks.activeViewName || e.name), O = {
|
|
186
186
|
...this.$props,
|
|
187
187
|
...this.ks.view,
|
|
188
188
|
showWorkHours: this.ks.showWorkHours,
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
dataItems: void 0,
|
|
190
|
+
views: void 0,
|
|
191
|
+
defaultDate: void 0,
|
|
192
|
+
dateRange: this.ks.dateRange,
|
|
193
|
+
slotRender: a,
|
|
194
|
+
viewSlot: n,
|
|
195
|
+
item: h,
|
|
196
|
+
viewItem: u,
|
|
197
|
+
task: k,
|
|
198
|
+
dateHeaderCell: P,
|
|
199
|
+
timeHeaderCell: F,
|
|
200
|
+
resizeHint: x,
|
|
201
|
+
editable: N
|
|
202
|
+
};
|
|
191
203
|
let g;
|
|
192
|
-
const
|
|
193
|
-
default: () => [o(
|
|
204
|
+
const H = o(G, null, {
|
|
205
|
+
default: () => [o(K, {
|
|
194
206
|
isRtl: this.isRtl,
|
|
195
207
|
onPrevclick: this.handlePrevClick,
|
|
196
208
|
onNextclick: this.handleNextClick,
|
|
197
209
|
onTodayclick: this.handleTodayClick
|
|
198
|
-
}, null), o(
|
|
210
|
+
}, null), o(Q, {
|
|
199
211
|
value: this.ks.currentDate,
|
|
200
212
|
onChange: this.handleDatePickerChange
|
|
201
|
-
}, null), o(
|
|
213
|
+
}, null), o(J, null, null), o(X, null, null)]
|
|
202
214
|
});
|
|
203
215
|
g = C.call(this, {
|
|
204
216
|
h: f,
|
|
205
217
|
template: s,
|
|
206
|
-
defaultRendering:
|
|
218
|
+
defaultRendering: H,
|
|
207
219
|
additionalProps: {
|
|
208
220
|
currentDate: this.ks.currentDate
|
|
209
221
|
},
|
|
@@ -214,17 +226,17 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
214
226
|
datepickerchange: this.handleDatePickerChange
|
|
215
227
|
}
|
|
216
228
|
});
|
|
217
|
-
let
|
|
218
|
-
const
|
|
219
|
-
default: () => [o(
|
|
229
|
+
let v;
|
|
230
|
+
const W = o(q, null, {
|
|
231
|
+
default: () => [o(Y, {
|
|
220
232
|
slotDuration: i,
|
|
221
233
|
onClick: this.handleShowWorkHoursClick
|
|
222
234
|
}, null)]
|
|
223
235
|
});
|
|
224
|
-
|
|
236
|
+
v = C.call(this, {
|
|
225
237
|
h: f,
|
|
226
238
|
template: t,
|
|
227
|
-
defaultRendering:
|
|
239
|
+
defaultRendering: W,
|
|
228
240
|
additionalProps: {
|
|
229
241
|
slotDuration: i
|
|
230
242
|
},
|
|
@@ -232,7 +244,7 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
232
244
|
showworkhoursclick: this.handleShowWorkHoursClick
|
|
233
245
|
}
|
|
234
246
|
});
|
|
235
|
-
const
|
|
247
|
+
const A = this.showLicenseWatermark ? o(U, null, null) : null;
|
|
236
248
|
return o("div", {
|
|
237
249
|
id: this.$props.id,
|
|
238
250
|
style: {
|
|
@@ -248,22 +260,23 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
248
260
|
onFocusout: this.handleBlur
|
|
249
261
|
}, [g, f(E, {
|
|
250
262
|
key: this.ks.view.name,
|
|
251
|
-
onDataaction: this.handleDataAction
|
|
252
|
-
|
|
263
|
+
onDataaction: this.handleDataAction,
|
|
264
|
+
...O
|
|
265
|
+
}), v, A]);
|
|
253
266
|
},
|
|
254
267
|
methods: {
|
|
255
268
|
getViewComponentByName(e) {
|
|
256
269
|
switch (e.toLowerCase()) {
|
|
257
270
|
case "week":
|
|
258
|
-
return ee;
|
|
259
|
-
case "workweek":
|
|
260
271
|
return te;
|
|
272
|
+
case "workweek":
|
|
273
|
+
return ie;
|
|
261
274
|
case "agenda":
|
|
262
|
-
return Y;
|
|
263
|
-
case "timeline":
|
|
264
275
|
return Z;
|
|
276
|
+
case "timeline":
|
|
277
|
+
return ee;
|
|
265
278
|
case "month":
|
|
266
|
-
return
|
|
279
|
+
return se;
|
|
267
280
|
default:
|
|
268
281
|
return m;
|
|
269
282
|
}
|
|
@@ -375,17 +388,17 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
375
388
|
},
|
|
376
389
|
handleNextClick(e) {
|
|
377
390
|
e.preventDefault();
|
|
378
|
-
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 ? S(this.ks.currentDate, Math.round(i / 27)) : I(this.ks.currentDate, i);
|
|
379
392
|
this.setDate(t, e);
|
|
380
393
|
},
|
|
381
394
|
handlePrevClick(e) {
|
|
382
395
|
e.preventDefault();
|
|
383
|
-
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ?
|
|
396
|
+
const i = this.getViewPropValue(this.ks.view, "step", this.ks.activeViewName) || this.getViewPropValue(this.ks.view, "numberOfDays", this.ks.activeViewName) || 1, t = i > 27 ? S(this.ks.currentDate, -Math.round(i / 27)) : I(this.ks.currentDate, -i);
|
|
384
397
|
this.setDate(t, e);
|
|
385
398
|
},
|
|
386
399
|
handleTodayClick(e) {
|
|
387
400
|
e.preventDefault();
|
|
388
|
-
const i =
|
|
401
|
+
const i = M();
|
|
389
402
|
this.setDate(i, e);
|
|
390
403
|
},
|
|
391
404
|
handleShowWorkHoursClick() {
|
|
@@ -422,7 +435,7 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
422
435
|
});
|
|
423
436
|
},
|
|
424
437
|
updatePassedState(e) {
|
|
425
|
-
const i =
|
|
438
|
+
const i = b(this), s = e || this.ks.activeViewName;
|
|
426
439
|
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) || y, this.ks.shortDateFormat = this.getViewPropValue(this.ks.view, "selectedShortDateFormat", s) || R, this.ks.dateRange = this.getViewComponentByName(s).props.dateRange.default()({
|
|
427
440
|
intl: i,
|
|
428
441
|
date: this.ks.currentDate,
|
|
@@ -435,5 +448,5 @@ const y = "{0:D}", R = "{0:d}", Ie = /* @__PURE__ */ T({
|
|
|
435
448
|
}
|
|
436
449
|
});
|
|
437
450
|
export {
|
|
438
|
-
|
|
451
|
+
$e as Scheduler
|
|
439
452
|
};
|
|
@@ -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 a=require("vue"),h=require("./SchedulerActionButtons.js"),g=require("@progress/kendo-vue-form"),m=require("@progress/kendo-vue-dialogs"),f=require("@progress/kendo-vue-intl"),S=require("../editors/SchedulerFormEditor.js"),i=require("../messages/main.js"),r=require("@progress/kendo-vue-common"),k=a.defineComponent({name:"KendoSchedulerForm",emits:{cancel:null,close:null,submit:null},props:{dataItem:Object},inject:{ks:{default:null},kendoLocalizationService:{default:null},ksValidator:{default:null},ksModifyInitialFormValues:{default:null}},created(){this.dialogId=r.guid()},data(){return{media:"desktop"}},mounted(){this.calculateMedia(),setTimeout(()=>{const e=document.getElementById(this.dialogId);e&&e.focus()},10)},
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),h=require("./SchedulerActionButtons.js"),g=require("@progress/kendo-vue-form"),m=require("@progress/kendo-vue-dialogs"),f=require("@progress/kendo-vue-intl"),S=require("../editors/SchedulerFormEditor.js"),i=require("../messages/main.js"),r=require("@progress/kendo-vue-common"),k=a.defineComponent({name:"KendoSchedulerForm",emits:{cancel:null,close:null,submit:null},props:{dataItem:Object},inject:{ks:{default:null},kendoLocalizationService:{default:null},ksValidator:{default:null},ksModifyInitialFormValues:{default:null}},created(){this.dialogId=r.guid()},data(){return{media:"desktop"}},mounted(){this.calculateMedia(),setTimeout(()=>{const e=document.getElementById(this.dialogId);e&&e.focus()},10)},setup(){return{kendoLocalizationService:a.inject("kendoLocalizationService",{})}},render(){const e=this,t=f.provideLocalizationService(this);this.requiredValidationMessage=t.toLanguageString(i.editorValidationRequired,i.messages[i.editorValidationRequired]),this.endValidationMessage=t.toLanguageString(i.editorValidationEnd,i.messages[i.editorValidationEnd]);const s=t.toLanguageString(i.editorSave,i.messages[i.editorSave]),o=t.toLanguageString(i.editorCancel,i.messages[i.editorCancel]),d=t.toLanguageString(i.editorTitle,i.messages[i.editorTitle]);this.startValidationMessage=t.toLanguageString(i.editorValidationStart,i.messages[i.editorValidationStart]);const n=a.createVNode(S.SchedulerFormEditor,null,{default:()=>[a.createVNode(h.SchedulerActionButtons,{editSaveMessage:s,editCancelMessage:o,onCancel:this.handleCancel},null)]}),l=r.getTemplate.call(this,{h:a.h,template:this.ks.form,defaultRendering:n,additionalProps:{dataItem:this.dataItem,editSaveMessage:s,editCancelMessage:o},additionalListeners:{cancel:this.handleCancel}}),c={title:d,appendTo:"body",minWidth:this.media==="desktop"?400:"85%",wrapperId:this.dialogId,...this.ks.dialogProps},u={initialValues:e.ksModifyInitialFormValues(e.$props.dataItem),validator:e.formValidator,...this.ks.formProps};return a.h(m.Dialog,{onClose:this.handleClose,class:"k-scheduler-edit-dialog",...c},function(){return[a.h(g.Form,{onSubmit:e.handleSubmit,...u},function(){return[l]})]})},methods:{calculateMedia(){r.canUseDOM&&window.matchMedia&&(this.media=window.matchMedia("(min-width: 600px)").matches?"desktop":"mobile")},handleCancel(e){this.$emit("cancel",{value:null,event:e,target:this.form})},handleClose({event:e}){this.$emit("close",{value:null,event:e,target:this.form})},handleSubmit(e,t){this.$emit("submit",{value:e,event:t,target:this.form})},startAfterEndValidator(e,t){return e&&t(this.ks.fields.end)&&e.getTime()>t(this.ks.fields.end).getTime()?this.startValidationMessage:void 0},endAfterStartValidator(e,t){return e&&t(this.ks.fields.start)&&e.getTime()<t(this.ks.fields.start).getTime()?this.endValidationMessage:void 0},requiredValidator(e){return e?void 0:this.requiredValidationMessage},formValidator(e,t){const s={};s[this.ks.fields.start]=[this.requiredValidator(t(this.ks.fields.start)),this.startAfterEndValidator(t(this.ks.fields.start),t)].filter(Boolean).reduce((d,n)=>d||n,""),s[this.ks.fields.end]=[this.requiredValidator(t(this.ks.fields.start)),this.endAfterStartValidator(t(this.ks.fields.start),t)].filter(Boolean).reduce((d,n)=>d||n,"");const o=this.ksValidator(t);return{...s,...o}}}});exports.SchedulerForm=k;
|