@alibaba-aero/vue-calendar
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/alibaba-aero/vue-calendar/compare/v0.1.1...v0.2.0) (2018-10-02) | ||
### Features | ||
* support days customization using slot ([2c9f085](https://github.com/alibaba-aero/vue-calendar/commit/2c9f085)) | ||
<a name="0.1.1"></a> | ||
@@ -7,0 +17,0 @@ ## [0.1.1](https://github.com/alibaba-aero/vue-calendar/compare/v0.1.0...v0.1.1) (2018-09-05) |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var dayjs=_interopDefault(require("dayjs")),isBetween=_interopDefault(require("dayjs/plugin/isBetween")),jalaliday=_interopDefault(require("jalaliday"));dayjs.extend(isBetween),dayjs.extend(jalaliday),dayjs.calendar("jalali");var DayView={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-day",class:[e.data.class,{disabled:e.disabled,selected:e.selected,selectable:e.selectable}],on:{mouseover:function(t){e.$emit("hover",e.date)},mouseout:function(t){e.$emit("blur",e.date)},click:e.toggleSelection}},[a(e.dayView,{tag:"div",staticClass:"vuec-day-content",attrs:{data:e.data,date:e.date}}),e._v(" "),a("div",{staticClass:"vuec-square-placeholder"})])},staticRenderFns:[],props:{index:{type:Number,required:!0},date:{type:Object,default:null},data:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},dayView:{type:Object,default:null}},methods:{toggleSelection(){this.selectable&&this.$emit("click",this.index)}}},DefaultDayView={render:function(){var e=this.$createElement,t=this._self._c||e;return this.date?t("div",[t("div",{staticClass:"vuec-default-day"},[this._v(" "+this._s(this.formattedDate)+" ")])]):this._e()},staticRenderFns:[],props:{date:{type:Object,default:null},data:{type:Object,default:null}},computed:{formattedDate(){return this.date.format("D")}}},PERSIAN_DIGITS=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],ARABIC_DIGITS=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],PERSIAN_ZERO_CHAR_CODE=PERSIAN_DIGITS[0].charCodeAt(0),ARABIC_ZERO_CHAR_CODE=ARABIC_DIGITS[0].charCodeAt(0);function weekDays(){return["شنبه","۱ شنبه","۲ شنبه","۳ شنبه","۴ شنبه","۵ شنبه","جمعه"]}var VuecMonth={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-month"},[a("div",{staticClass:"vuec-month-name",attrs:{show:e.showTitle}},[a("h2",[e._v(e._s(e.title||e.date.format("MMMM")))])]),e._v(" "),a("div",{staticClass:"vuec-week-nav vuec-7col"},e._l(e.weekDays,function(t,s){return a("div",{key:s,staticClass:"col"},[a("div",{staticClass:"vuec-week-content"},[e._v(" "+e._s(t)+" ")]),e._v(" "),a("div",{staticClass:"vuec-week-placeholder"})])})),e._v(" "),a("div",{staticClass:"vuec-month-content"},[a("div",{staticClass:"vuec-month-days vuec-7col"},e._l(e.days,function(t,s){return a("day-view",{key:t.dayKey,staticClass:"col",attrs:{index:s,data:t.data,date:t.date,title:t.title,"aria-hidden":t.hide,disabled:t.disabled,selectable:!t.disabled&&e.selectable,selected:t.selected,"day-view":e.dayView},on:{click:e.toggleDay,hover:function(t){e.$emit("hover",t)},blur:function(t){e.$emit("blur",t)}}})})),e._v(" "),a("div",{staticClass:"vuec-month-placeholder"})])])},staticRenderFns:[],components:{DayView:DayView},props:{date:{type:Object,required:!0},adapter:{type:Function,default:()=>({})},selectable:{type:Boolean,default:!1},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selection:{type:Array,default:()=>[]},showTitle:{type:Boolean,default:!0},title:{type:String,default:""},dayView:{type:Object,default:()=>DefaultDayView}},data:()=>({weekDays:weekDays()}),computed:{days(){const e=this.date.month(),t=this.date.format("YYYY/MM");let a=dayjs(this.date).startOf("Month").startOf("week");const s=dayjs(this.date).endOf("Month"),i=[];for(;a.isBefore(s);){const s=a.format("YYYY/MM/DD");this.minDate&&a.isBefore(this.minDate,"day")||this.maxDate&&a.isAfter(this.maxDate,"day")||a.month()!==e?i.push({disabled:!0,hide:a.month()!==e,date:dayjs(a),data:this.adapter({date:a,dayKey:s,monthKey:t})||{}}):i.push({key:s,data:this.adapter({date:a,dayKey:s,monthKey:t})||{},date:dayjs(a),selected:-1!==this.selection.indexOf(s)}),a=a.add(1,"days")}return i}},methods:{toggleDay(e){const t=this.days[e];this.$emit("selectionChange",{key:t.key,date:t.date,selected:!t.selected})}}},IconArrowLeft={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[t("path",{attrs:{d:"M15.41,16.59L10.83,12l4.58-4.59L14,6l-6,6l6,6L15.41,16.59z"}}),this._v(" "),t("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},IconArrowRight={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[t("path",{attrs:{d:"M8.59,16.59L13.17,12L8.59,7.41L10,6l6,6l-6,6L8.59,16.59z"}}),this._v(" "),t("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},VuecCalendar={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-calendar",class:["vuec-theme-"+e.theme]},[e.showNavigation?a("div",{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[a("span",{staticClass:"vuec-btn-prev",on:{click:e.previousPage}},[e._t("prev-page",[a("icon-arrow-right")])],2),e._v(" "),a("span",{staticClass:"vuec-btn-next",on:{click:e.nextPage}},[e._t("next-page",[a("icon-arrow-left")])],2)]):e._e(),e._v(" "),a("div",{staticClass:"vuec-month-wrapper"},e._l(e.months,function(t,s){return a("vuec-month",{key:s,attrs:{adapter:e.getDayData,title:t.title,date:t.date,"min-date":e.minDate,"max-date":e.maxDate,selectable:e.selectable,inventory:t.inventory,selection:t.selections,"day-view":e.dayView},on:{selectionChange:e.selectionChange,hover:e.onHover,blur:e.onBlur}})}))])},staticRenderFns:[],components:{VuecMonth:VuecMonth,IconArrowLeft:IconArrowLeft,IconArrowRight:IconArrowRight},props:{theme:{type:String,default:"default"},showPreviousWeeks:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},date:{type:Object,default:()=>dayjs()},visibleMonths:{type:Number,default:1},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},dayView:{type:Object,default:()=>DefaultDayView},selections:{type:Array,default:()=>[]}},data(){return{Xdate:this.date,dateUnderCursor:null}},computed:{year(){return this.date.format("YYYY")},monthSelections(){const e={};return this.selections.forEach(t=>{const a=dayjs(t,"YYYY/MM/DD").format("YYYY/MM");return e[a]=e[a]||[],e[a].push(t),e}),e},months(){const e=[];let t=dayjs(this.Xdate);this.showPreviousWeeks&&t.startOf("Month");const a=dayjs(this.Xdate).add(this.visibleMonths-1,"Month").endOf("Month");for(;t.isBefore(a);){const a=t.format("YYYY/MM");e.push({title:t.format("MMMM"),date:dayjs(t),selections:this.monthSelections[a]}),t=t.add(1,"Month").startOf("Month")}return e.length=this.visibleMonths,e}},methods:{onHover(e){e.isSame(this.dateUnderCursor)||(this.dateUnderCursor=e)},onBlur(e){null===e&&(this.dateUnderCursor=null)},getDayData({dayKey:e,monthKey:t}){return(this.data[t]||{})[e]||{}},selectionChange({date:e,selected:t}){this.$emit("selectionChange",{date:e,selected:t})},previousPage(){this.Xdate=this.Xdate.subtract(this.visibleMonths,"Month").startOf("Month"),this.$emit("previous-page",this.Xdate)},nextPage(){this.Xdate=this.Xdate.add(this.visibleMonths,"Month").startOf("Month"),this.$emit("next-page",this.Xdate)}}},VuecSelectRange={extends:VuecCalendar,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const e={};return this.localSelection.forEach(t=>{const a=t.format("YYYY/MM");e[a]=e[a]||[],e[a].push(t)}),e}},watch:{value(e){this.localSelection=e}},methods:{getDayData({dayKey:e,monthKey:t,date:a}){const s=(this.data[t]||{})[e]||{},i=this.localSelection[0]||this.dateUnderCursor,l=this.localSelection[1]||this.dateUnderCursor;return Object.assign({},s,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:this.localSelection.length>0&&a.isSame(i,"day"),end:this.localSelection.length>1&&a.isSame(l,"day"),selected:this.localSelection.length>1&&a.isBetween(i,l,"days","[]"),highlight:this.dateUnderCursor&&1===this.localSelection.length&&a.isBetween(i,this.dateUnderCursor,"days","[]")}})},onHover(e){this.dateUnderCursor!==e&&(this.dateUnderCursor=e)},selectionChange({date:e}){0===this.localSelection.length||void 0===this.localSelection[0]?this.$set(this.localSelection,0,e):1!==this.localSelection.length&&(this.localSelection.length=0,this.localSelection.push(e)),e.isAfter(this.localSelection[0],"day")?this.localSelection.push(e):this.$set(this.localSelection,0,e),this.$emit("input",this.localSelection)}}},IconClose={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"}},[t("path",{attrs:{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}}),this._v(" "),t("path",{attrs:{d:"M0 0h24v24H0z",fill:"none"}})])},staticRenderFns:[]},rangeInput={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:e.showPicker}},[a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[0]))]),e._v(" "),a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[1]))])]),e._v(" "),a("transition",{attrs:{name:"popup-animation"}},[e.visible?a("div",{staticClass:"vuec-popup",class:{mobile:e.mobile},on:{click:e.onClickDelegate}},[e.mobile?a("div",{staticClass:"vuec-popup-header"},[e._t("title",[e._v(" تاریخ ورود و خروج ")]),e._v(" "),a("div",{staticClass:"vuec-popup-close",on:{click:function(t){e.showPicker(!1)}}},[a("icon-close")],1)],2):e._e(),e._v(" "),a("vuec-select-range",{attrs:{theme:e.theme,value:e.dates,"min-date":e.minDate,"max-date":e.maxDate,"visible-months":2,selectable:!0}})],1):e._e()])],1)},staticRenderFns:[],components:{VuecSelectRange:VuecSelectRange,IconClose:IconClose},props:{theme:{type:String,default:"default"},mobile:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Array,default:()=>[]},open:{type:Boolean,default:!1},format:{type:String,default:"YYYY/MM/DD"}},data(){const[e=dayjs(),t=dayjs()]=this.value;return{visible:this.open,temporaryDisableClickListen:!1,fromDate:e,toDate:t,dates:[dayjs(e),dayjs(t)]}},computed:{formattedDates(){return this.dates.map(e=>e.format(this.format))}},watch:{open(e){this.showPicker(e)}},mounted(){this.showPicker(this.open),document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(e=!0){this.temporaryDisableClickListen=e,this.visible=e},onClickDelegate(e){e.stopPropagation()},onSelectionChange(e){this.fromDate=dayjs(e[0]),this.toDate=dayjs(e[e.length-1]),this.$emit("input",[this.fromDate,this.toDate])}}},VuecSingleSelect={extends:VuecCalendar,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const e={};return this.localSelection.forEach(t=>{const a=t.format("YYYY/MM");e[a]=e[a]||[],e[a].push(t)}),e}},watch:{value(e){this.localSelection=e}},methods:{getDayData({dayKey:e,monthKey:t,date:a}){const s=(this.data[t]||{})[e]||{},i=this.localSelection.length>0&&a.isSame(this.localSelection[0],"day");return Object.assign({},s,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:i,end:i}})},onHover(e){this.dateUnderCursor!==e&&(this.dateUnderCursor=e)},selectionChange({date:e}){this.localSelection.length=0,this.localSelection.push(e),this.$emit("input",this.localSelection)}}},singleInput={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:e.showPicker}},[a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[0]))]),e._v(" "),a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[1]))])]),e._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],staticClass:"vuec-popup",on:{click:e.onClickDelegate}},[a("vuec-single-select",{attrs:{theme:e.theme,value:e.dates,"visible-months":1,selectable:!0}})],1)])},staticRenderFns:[],components:{VuecSingleSelect:VuecSingleSelect},props:{theme:{type:String,default:"default"},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Object,default:()=>({})},open:{type:Boolean,default:!1}},data(){return{visible:this.open,temporaryDisableClickListen:!1,fromDate:dayjs(),toDate:dayjs(),dates:[]}},computed:{formattedDates(){return this.dates.map(e=>e.format("YYYY/MM/DD"))}},watch:{open(e){this.visible=e,this.temporaryDisableClickListen=!0}},mounted(){document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(){this.temporaryDisableClickListen=!0,this.visible=!0},onClickDelegate(e){e.stopPropagation()},onSelectionChange(e){this.fromDate=dayjs(e[0],"YYYY/MM/DD"),this.toDate=dayjs(e[e.length-1],"YYYY/MM/DD"),this.$emit("input",[this.fromDate,this.toDate])}}};exports.dayjs=dayjs,exports.VuecCalendar=VuecCalendar,exports.VuecDay=DayView,exports.VuecDefaultDay=DefaultDayView,exports.VuecMonth=VuecMonth,exports.VuecRangeInput=rangeInput,exports.VuecSelectRange=VuecSelectRange,exports.VuecSingleInput=singleInput,exports.VuecSelectSingle=VuecSingleSelect; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var dayjs=_interopDefault(require("dayjs")),isBetween=_interopDefault(require("dayjs/plugin/isBetween")),jalaliday=_interopDefault(require("jalaliday"));dayjs.extend(isBetween),dayjs.extend(jalaliday),dayjs.calendar("jalali");var DayView={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-day",class:[e.data.class,{disabled:e.disabled,selected:e.selected,selectable:e.selectable}],on:{mouseover:function(t){e.$emit("hover",e.date)},mouseout:function(t){e.$emit("blur",e.date)},click:e.toggleSelection}},[a("div",{staticClass:"vuec-day-content"},[e._t("day",[a("div",{staticClass:"vuec-default-day"},[e._v(" "+e._s(e.date.format("D"))+" ")])],{data:e.data,date:e.date})],2),e._v(" "),a("div",{staticClass:"vuec-square-placeholder"})])},staticRenderFns:[],props:{index:{type:Number,required:!0},date:{type:Object,default:null},data:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1}},methods:{toggleSelection(){this.selectable&&this.$emit("click",this.index)}}},PERSIAN_DIGITS=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],ARABIC_DIGITS=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],PERSIAN_ZERO_CHAR_CODE=PERSIAN_DIGITS[0].charCodeAt(0),ARABIC_ZERO_CHAR_CODE=ARABIC_DIGITS[0].charCodeAt(0);function weekDays(){return["شنبه","۱ شنبه","۲ شنبه","۳ شنبه","۴ شنبه","۵ شنبه","جمعه"]}var VuecMonth={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-month"},[a("div",{staticClass:"vuec-month-name",attrs:{show:e.showTitle}},[a("h2",[e._v(e._s(e.title||e.date.format("MMMM")))])]),e._v(" "),a("div",{staticClass:"vuec-week-nav vuec-7col"},e._l(e.weekDays,function(t,s){return a("div",{key:s,staticClass:"col"},[a("div",{staticClass:"vuec-week-content"},[e._v(" "+e._s(t)+" ")]),e._v(" "),a("div",{staticClass:"vuec-week-placeholder"})])})),e._v(" "),a("div",{staticClass:"vuec-month-content"},[a("div",{staticClass:"vuec-month-days vuec-7col"},e._l(e.days,function(t,s){return a("day-view",{key:t.dayKey,staticClass:"col",attrs:{index:s,data:t.data,date:t.date,title:t.title,"aria-hidden":t.hide,disabled:t.disabled,selectable:!t.disabled&&e.selectable,selected:t.selected},on:{click:e.toggleDay,hover:function(t){e.$emit("hover",t)},blur:function(t){e.$emit("blur",t)}},scopedSlots:e._u([{key:"day",fn:function(t){return e.$slots.day?[e._t("day",null,null,t)]:void 0}}])})})),e._v(" "),a("div",{staticClass:"vuec-month-placeholder"})])])},staticRenderFns:[],components:{DayView:DayView},props:{date:{type:Object,required:!0},adapter:{type:Function,default:()=>({})},selectable:{type:Boolean,default:!1},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selection:{type:Array,default:()=>[]},showTitle:{type:Boolean,default:!0},title:{type:String,default:""}},data:()=>({weekDays:weekDays()}),computed:{days(){const e=this.date.month(),t=this.date.format("YYYY/MM");let a=dayjs(this.date).startOf("Month").startOf("week");const s=dayjs(this.date).endOf("Month"),i=[];for(;a.isBefore(s);){const s=a.format("YYYY/MM/DD");this.minDate&&a.isBefore(this.minDate,"day")||this.maxDate&&a.isAfter(this.maxDate,"day")||a.month()!==e?i.push({disabled:!0,hide:a.month()!==e,date:dayjs(a),data:this.adapter({date:a,dayKey:s,monthKey:t})||{}}):i.push({key:s,data:this.adapter({date:a,dayKey:s,monthKey:t})||{},date:dayjs(a),selected:-1!==this.selection.indexOf(s)}),a=a.add(1,"days")}return i}},methods:{toggleDay(e){const t=this.days[e];this.$emit("selectionChange",{key:t.key,date:t.date,selected:!t.selected})}}},IconArrowLeft={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[t("path",{attrs:{d:"M15.41,16.59L10.83,12l4.58-4.59L14,6l-6,6l6,6L15.41,16.59z"}}),this._v(" "),t("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},IconArrowRight={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[t("path",{attrs:{d:"M8.59,16.59L13.17,12L8.59,7.41L10,6l6,6l-6,6L8.59,16.59z"}}),this._v(" "),t("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},VuecCalendar={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-calendar",class:["vuec-theme-"+e.theme]},[e.showNavigation?a("div",{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[a("span",{staticClass:"vuec-btn-prev",on:{click:e.previousPage}},[e._t("prev-page",[a("icon-arrow-right")])],2),e._v(" "),a("span",{staticClass:"vuec-btn-next",on:{click:e.nextPage}},[e._t("next-page",[a("icon-arrow-left")])],2)]):e._e(),e._v(" "),a("div",{staticClass:"vuec-month-wrapper"},e._l(e.months,function(t,s){return a("vuec-month",{key:s,attrs:{adapter:e.getDayData,title:t.title,date:t.date,"min-date":e.minDate,"max-date":e.maxDate,selectable:e.selectable,inventory:t.inventory,selection:t.selections},on:{selectionChange:e.selectionChange,hover:e.onHover,blur:e.onBlur},scopedSlots:e._u([{key:"day",fn:function(t){return[e._t("day",null,null,t)]}}])})}))])},staticRenderFns:[],components:{VuecMonth:VuecMonth,IconArrowLeft:IconArrowLeft,IconArrowRight:IconArrowRight},props:{theme:{type:String,default:"default"},showPreviousWeeks:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},date:{type:Object,default:()=>dayjs()},visibleMonths:{type:Number,default:1},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selections:{type:Array,default:()=>[]}},data(){return{Xdate:this.date,dateUnderCursor:null}},computed:{year(){return this.date.format("YYYY")},monthSelections(){const e={};return this.selections.forEach(t=>{const a=dayjs(t,"YYYY/MM/DD").format("YYYY/MM");return e[a]=e[a]||[],e[a].push(t),e}),e},months(){const e=[];let t=dayjs(this.Xdate);this.showPreviousWeeks&&t.startOf("Month");const a=dayjs(this.Xdate).add(this.visibleMonths-1,"Month").endOf("Month");for(;t.isBefore(a);){const a=t.format("YYYY/MM");e.push({title:t.format("MMMM"),date:dayjs(t),selections:this.monthSelections[a]}),t=t.add(1,"Month").startOf("Month")}return e.length=this.visibleMonths,e}},methods:{onHover(e){e.isSame(this.dateUnderCursor)||(this.dateUnderCursor=e)},onBlur(e){null===e&&(this.dateUnderCursor=null)},getDayData({dayKey:e,monthKey:t}){return(this.data[t]||{})[e]||{}},selectionChange({date:e,selected:t}){this.$emit("selectionChange",{date:e,selected:t})},previousPage(){this.Xdate=this.Xdate.subtract(this.visibleMonths,"Month").startOf("Month"),this.$emit("previous-page",this.Xdate)},nextPage(){this.Xdate=this.Xdate.add(this.visibleMonths,"Month").startOf("Month"),this.$emit("next-page",this.Xdate)}}},VuecSelectRange={extends:VuecCalendar,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const e={};return this.localSelection.forEach(t=>{const a=t.format("YYYY/MM");e[a]=e[a]||[],e[a].push(t)}),e}},watch:{value(e){this.localSelection=e}},methods:{getDayData({dayKey:e,monthKey:t,date:a}){const s=(this.data[t]||{})[e]||{},i=this.localSelection[0]||this.dateUnderCursor,n=this.localSelection[1]||this.dateUnderCursor;return Object.assign({},s,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:this.localSelection.length>0&&a.isSame(i,"day"),end:this.localSelection.length>1&&a.isSame(n,"day"),selected:this.localSelection.length>1&&a.isBetween(i,n,"days","[]"),highlight:this.dateUnderCursor&&1===this.localSelection.length&&a.isBetween(i,this.dateUnderCursor,"days","[]")}})},onHover(e){this.dateUnderCursor!==e&&(this.dateUnderCursor=e)},selectionChange({date:e}){0===this.localSelection.length||void 0===this.localSelection[0]?this.$set(this.localSelection,0,e):1!==this.localSelection.length&&(this.localSelection.length=0,this.localSelection.push(e)),e.isAfter(this.localSelection[0],"day")?this.localSelection.push(e):this.$set(this.localSelection,0,e),this.$emit("input",this.localSelection)}}},IconClose={render:function(){var e=this.$createElement,t=this._self._c||e;return t("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"}},[t("path",{attrs:{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}}),this._v(" "),t("path",{attrs:{d:"M0 0h24v24H0z",fill:"none"}})])},staticRenderFns:[]},rangeInput={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:e.showPicker}},[a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[0]))]),e._v(" "),a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[1]))])]),e._v(" "),a("transition",{attrs:{name:"popup-animation"}},[e.visible?a("div",{staticClass:"vuec-popup",class:{mobile:e.mobile},on:{click:e.onClickDelegate}},[e.mobile?a("div",{staticClass:"vuec-popup-header"},[e._t("title",[e._v(" تاریخ ورود و خروج ")]),e._v(" "),a("div",{staticClass:"vuec-popup-close",on:{click:function(t){e.showPicker(!1)}}},[a("icon-close")],1)],2):e._e(),e._v(" "),a("vuec-select-range",{attrs:{theme:e.theme,value:e.dates,"min-date":e.minDate,"max-date":e.maxDate,"visible-months":2,selectable:!0}})],1):e._e()])],1)},staticRenderFns:[],components:{VuecSelectRange:VuecSelectRange,IconClose:IconClose},props:{theme:{type:String,default:"default"},mobile:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Array,default:()=>[]},open:{type:Boolean,default:!1},format:{type:String,default:"YYYY/MM/DD"}},data(){const[e=dayjs(),t=dayjs()]=this.value;return{visible:this.open,temporaryDisableClickListen:!1,fromDate:e,toDate:t,dates:[dayjs(e),dayjs(t)]}},computed:{formattedDates(){return this.dates.map(e=>e.format(this.format))}},watch:{open(e){this.showPicker(e)}},mounted(){this.showPicker(this.open),document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(e=!0){this.temporaryDisableClickListen=e,this.visible=e},onClickDelegate(e){e.stopPropagation()},onSelectionChange(e){this.fromDate=dayjs(e[0]),this.toDate=dayjs(e[e.length-1]),this.$emit("input",[this.fromDate,this.toDate])}}},VuecSingleSelect={extends:VuecCalendar,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const e={};return this.localSelection.forEach(t=>{const a=t.format("YYYY/MM");e[a]=e[a]||[],e[a].push(t)}),e}},watch:{value(e){this.localSelection=e}},methods:{getDayData({dayKey:e,monthKey:t,date:a}){const s=(this.data[t]||{})[e]||{},i=this.localSelection.length>0&&a.isSame(this.localSelection[0],"day");return Object.assign({},s,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:i,end:i}})},onHover(e){this.dateUnderCursor!==e&&(this.dateUnderCursor=e)},selectionChange({date:e}){this.localSelection.length=0,this.localSelection.push(e),this.$emit("input",this.localSelection)}}},singleInput={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:e.showPicker}},[a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[0]))]),e._v(" "),a("div",{staticClass:"input"},[e._v(e._s(e.formattedDates[1]))])]),e._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],staticClass:"vuec-popup",on:{click:e.onClickDelegate}},[a("vuec-single-select",{attrs:{theme:e.theme,value:e.dates,"visible-months":1,selectable:!0}})],1)])},staticRenderFns:[],components:{VuecSingleSelect:VuecSingleSelect},props:{theme:{type:String,default:"default"},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Object,default:()=>({})},open:{type:Boolean,default:!1}},data(){return{visible:this.open,temporaryDisableClickListen:!1,fromDate:dayjs(),toDate:dayjs(),dates:[]}},computed:{formattedDates(){return this.dates.map(e=>e.format("YYYY/MM/DD"))}},watch:{open(e){this.visible=e,this.temporaryDisableClickListen=!0}},mounted(){document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(){this.temporaryDisableClickListen=!0,this.visible=!0},onClickDelegate(e){e.stopPropagation()},onSelectionChange(e){this.fromDate=dayjs(e[0],"YYYY/MM/DD"),this.toDate=dayjs(e[e.length-1],"YYYY/MM/DD"),this.$emit("input",[this.fromDate,this.toDate])}}};exports.dayjs=dayjs,exports.VuecCalendar=VuecCalendar,exports.VuecDay=DayView,exports.VuecMonth=VuecMonth,exports.VuecRangeInput=rangeInput,exports.VuecSelectRange=VuecSelectRange,exports.VuecSingleInput=singleInput,exports.VuecSelectSingle=VuecSingleSelect; | ||
//# sourceMappingURL=vue-calendar.cjs.min.js.map |
@@ -10,3 +10,3 @@ import dayjs from 'dayjs'; | ||
var DayView = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-day",class:[_vm.data.class, { disabled: _vm.disabled, selected: _vm.selected, selectable: _vm.selectable }],on:{"mouseover":function($event){_vm.$emit('hover', _vm.date);},"mouseout":function($event){_vm.$emit('blur', _vm.date);},"click":_vm.toggleSelection}},[_c(_vm.dayView,{tag:"div",staticClass:"vuec-day-content",attrs:{"data":_vm.data,"date":_vm.date}}),_vm._v(" "),_c('div',{staticClass:"vuec-square-placeholder"})])},staticRenderFns: [], | ||
var DayView = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-day",class:[_vm.data.class, { disabled: _vm.disabled, selected: _vm.selected, selectable: _vm.selectable }],on:{"mouseover":function($event){_vm.$emit('hover', _vm.date);},"mouseout":function($event){_vm.$emit('blur', _vm.date);},"click":_vm.toggleSelection}},[_c('div',{staticClass:"vuec-day-content"},[_vm._t("day",[_c('div',{staticClass:"vuec-default-day"},[_vm._v(" "+_vm._s(_vm.date.format('D'))+" ")])],{data:_vm.data,date:_vm.date})],2),_vm._v(" "),_c('div',{staticClass:"vuec-square-placeholder"})])},staticRenderFns: [], | ||
props: { | ||
@@ -37,6 +37,2 @@ index: { | ||
}, | ||
dayView: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}, | ||
@@ -52,20 +48,2 @@ methods: { | ||
var DefaultDayView = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.date)?_c('div',[_c('div',{staticClass:"vuec-default-day"},[_vm._v(" "+_vm._s(_vm.formattedDate)+" ")])]):_vm._e()},staticRenderFns: [], | ||
props: { | ||
date: { | ||
type: Object, | ||
default: null, | ||
}, | ||
data: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
formattedDate() { | ||
return this.date.format('D'); | ||
}, | ||
}, | ||
}; | ||
/** | ||
@@ -94,3 +72,3 @@ * Persian numeric characters | ||
var VuecMonth = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-month"},[_c('div',{staticClass:"vuec-month-name",attrs:{"show":_vm.showTitle}},[_c('h2',[_vm._v(_vm._s(_vm.title || _vm.date.format('MMMM')))])]),_vm._v(" "),_c('div',{staticClass:"vuec-week-nav vuec-7col"},_vm._l((_vm.weekDays),function(wd,index){return _c('div',{key:index,staticClass:"col"},[_c('div',{staticClass:"vuec-week-content"},[_vm._v(" "+_vm._s(wd)+" ")]),_vm._v(" "),_c('div',{staticClass:"vuec-week-placeholder"})])})),_vm._v(" "),_c('div',{staticClass:"vuec-month-content"},[_c('div',{staticClass:"vuec-month-days vuec-7col"},_vm._l((_vm.days),function(day,i){return _c('day-view',{key:day.dayKey,staticClass:"col",attrs:{"index":i,"data":day.data,"date":day.date,"title":day.title,"aria-hidden":day.hide,"disabled":day.disabled,"selectable":!day.disabled && _vm.selectable,"selected":day.selected,"day-view":_vm.dayView},on:{"click":_vm.toggleDay,"hover":function($event){_vm.$emit('hover', $event);},"blur":function($event){_vm.$emit('blur', $event);}}})})),_vm._v(" "),_c('div',{staticClass:"vuec-month-placeholder"})])])},staticRenderFns: [], | ||
var VuecMonth = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-month"},[_c('div',{staticClass:"vuec-month-name",attrs:{"show":_vm.showTitle}},[_c('h2',[_vm._v(_vm._s(_vm.title || _vm.date.format('MMMM')))])]),_vm._v(" "),_c('div',{staticClass:"vuec-week-nav vuec-7col"},_vm._l((_vm.weekDays),function(wd,index){return _c('div',{key:index,staticClass:"col"},[_c('div',{staticClass:"vuec-week-content"},[_vm._v(" "+_vm._s(wd)+" ")]),_vm._v(" "),_c('div',{staticClass:"vuec-week-placeholder"})])})),_vm._v(" "),_c('div',{staticClass:"vuec-month-content"},[_c('div',{staticClass:"vuec-month-days vuec-7col"},_vm._l((_vm.days),function(day,i){return _c('day-view',{key:day.dayKey,staticClass:"col",attrs:{"index":i,"data":day.data,"date":day.date,"title":day.title,"aria-hidden":day.hide,"disabled":day.disabled,"selectable":!day.disabled && _vm.selectable,"selected":day.selected},on:{"click":_vm.toggleDay,"hover":function($event){_vm.$emit('hover', $event);},"blur":function($event){_vm.$emit('blur', $event);}},scopedSlots:_vm._u([{key:"day",fn:function(props){return _vm.$slots.day?[_vm._t("day",null,null,props)]:undefined}}])})})),_vm._v(" "),_c('div',{staticClass:"vuec-month-placeholder"})])])},staticRenderFns: [], | ||
components: { | ||
@@ -132,6 +110,2 @@ DayView, | ||
}, | ||
dayView: { | ||
type: Object, | ||
default: () => DefaultDayView, | ||
}, | ||
}, | ||
@@ -205,3 +179,3 @@ data() { | ||
var VuecCalendar = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-calendar",class:['vuec-theme-' + _vm.theme]},[(_vm.showNavigation)?_c('div',{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[_c('span',{staticClass:"vuec-btn-prev",on:{"click":_vm.previousPage}},[_vm._t("prev-page",[_c('icon-arrow-right')])],2),_vm._v(" "),_c('span',{staticClass:"vuec-btn-next",on:{"click":_vm.nextPage}},[_vm._t("next-page",[_c('icon-arrow-left')])],2)]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"vuec-month-wrapper"},_vm._l((_vm.months),function(month,index){return _c('vuec-month',{key:index,attrs:{"adapter":_vm.getDayData,"title":month.title,"date":month.date,"min-date":_vm.minDate,"max-date":_vm.maxDate,"selectable":_vm.selectable,"inventory":month.inventory,"selection":month.selections,"day-view":_vm.dayView},on:{"selectionChange":_vm.selectionChange,"hover":_vm.onHover,"blur":_vm.onBlur}})}))])},staticRenderFns: [], | ||
var VuecCalendar = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vuec-calendar",class:['vuec-theme-' + _vm.theme]},[(_vm.showNavigation)?_c('div',{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[_c('span',{staticClass:"vuec-btn-prev",on:{"click":_vm.previousPage}},[_vm._t("prev-page",[_c('icon-arrow-right')])],2),_vm._v(" "),_c('span',{staticClass:"vuec-btn-next",on:{"click":_vm.nextPage}},[_vm._t("next-page",[_c('icon-arrow-left')])],2)]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"vuec-month-wrapper"},_vm._l((_vm.months),function(month,index){return _c('vuec-month',{key:index,attrs:{"adapter":_vm.getDayData,"title":month.title,"date":month.date,"min-date":_vm.minDate,"max-date":_vm.maxDate,"selectable":_vm.selectable,"inventory":month.inventory,"selection":month.selections},on:{"selectionChange":_vm.selectionChange,"hover":_vm.onHover,"blur":_vm.onBlur},scopedSlots:_vm._u([{key:"day",fn:function(props){return [_vm._t("day",null,null,props)]}}])})}))])},staticRenderFns: [], | ||
components: { | ||
@@ -249,6 +223,2 @@ VuecMonth, | ||
}, | ||
dayView: { | ||
type: Object, | ||
default: () => DefaultDayView, | ||
}, | ||
selections: { | ||
@@ -663,2 +633,2 @@ type: Array, | ||
export { VuecCalendar, DayView as VuecDay, DefaultDayView as VuecDefaultDay, VuecMonth, rangeInput as VuecRangeInput, VuecSelectRange, singleInput as VuecSingleInput, VuecSingleSelect as VuecSelectSingle }; | ||
export { VuecCalendar, DayView as VuecDay, VuecMonth, rangeInput as VuecRangeInput, VuecSelectRange, singleInput as VuecSingleInput, VuecSingleSelect as VuecSelectSingle }; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vueCalendar={})}(this,function(t){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(t,e){return t(e={exports:{}},e.exports),e.exports}var a=e(function(t,e){t.exports=function(){var t="millisecond",e="second",a="minute",n="hour",i="day",s="week",r="month",o="year",l=/^(\d{4})-?(\d{1,2})-?(\d{0,2})(.*?(\d{1,2}):(\d{1,2}):(\d{1,2}))?.?(\d{1,3})?$/,c=/\[.*?\]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},h=function(t,e,a){var n=String(t);return!n||n.length>=e?t:""+Array(e+1-n.length).join(a)+t},u={padStart:h,padZoneStr:function(t){var e=Math.abs(t),a=Math.floor(e/60),n=e%60;return(t<=0?"+":"-")+h(a,2,"0")+":"+h(n,2,"0")},monthDiff:function(t,e){var a=12*(e.year()-t.year())+(e.month()-t.month()),n=t.clone().add(a,"months"),i=e-n<0,s=t.clone().add(a+(i?-1:1),"months");return Number(-(a+(e-n)/(i?n-s:s-n)))},absFloor:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},prettyUnit:function(l){return{M:r,y:o,w:s,d:i,h:n,m:a,s:e,ms:t}[l]||String(l||"").toLowerCase().replace(/s$/,"")},isUndefined:function(t){return void 0===t}},f="en",p={};p[f]=d;var v=function(t){return t instanceof b},m=function(t,e,a){var n;if(!t)return null;if("string"==typeof t)p[t]&&(n=t),e&&(p[t]=e,n=t);else{var i=t.name;p[i]=t,n=i}return a||(f=n),n},y=function(t,e){if(v(t))return t.clone();var a=e||{};return a.date=t,new b(a)},$=function(t,e){return y(t,{locale:e.$L})},M=u;M.parseLocale=m,M.isDayjs=v,M.wrapper=$;var b=function(){function d(t){this.parse(t)}var h=d.prototype;return h.parse=function(t){var e,a;this.$d=null===(e=t.date)?new Date(NaN):M.isUndefined(e)?new Date:e instanceof Date?e:"string"==typeof e&&/.*[^Z]$/i.test(e)&&(a=e.match(l))?new Date(a[1],a[2]-1,a[3]||1,a[5]||0,a[6]||0,a[7]||0,a[8]||0):new Date(e),this.init(t)},h.init=function(t){this.$y=this.$d.getFullYear(),this.$M=this.$d.getMonth(),this.$D=this.$d.getDate(),this.$W=this.$d.getDay(),this.$H=this.$d.getHours(),this.$m=this.$d.getMinutes(),this.$s=this.$d.getSeconds(),this.$ms=this.$d.getMilliseconds(),this.$L=this.$L||m(t.locale,null,!0)||f},h.$utils=function(){return M},h.isValid=function(){return!("Invalid Date"===this.$d.toString())},h.$compare=function(t){return this.valueOf()-y(t).valueOf()},h.isSame=function(t){return 0===this.$compare(t)},h.isBefore=function(t){return this.$compare(t)<0},h.isAfter=function(t){return this.$compare(t)>0},h.year=function(){return this.$y},h.month=function(){return this.$M},h.day=function(){return this.$W},h.date=function(){return this.$D},h.hour=function(){return this.$H},h.minute=function(){return this.$m},h.second=function(){return this.$s},h.millisecond=function(){return this.$ms},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(t,l){var c=this,d=!!M.isUndefined(l)||l,h=function(t,e){var a=$(new Date(c.$y,e,t),c);return d?a:a.endOf(i)},u=function(t,e){return $(c.toDate()[t].apply(c.toDate(),d?[0,0,0,0].slice(e):[23,59,59,999].slice(e)),c)};switch(M.prettyUnit(t)){case o:return d?h(1,0):h(31,11);case r:return d?h(1,this.$M):h(0,this.$M+1);case s:return h(d?this.$D-this.$W:this.$D+(6-this.$W),this.$M);case i:case"date":return u("setHours",0);case n:return u("setMinutes",1);case a:return u("setSeconds",2);case e:return u("setMilliseconds",3);default:return this.clone()}},h.endOf=function(t){return this.startOf(t,!1)},h.$set=function(s,l){switch(M.prettyUnit(s)){case i:this.$d.setDate(this.$D+(l-this.$W));break;case"date":this.$d.setDate(l);break;case r:this.$d.setMonth(l);break;case o:this.$d.setFullYear(l);break;case n:this.$d.setHours(l);break;case a:this.$d.setMinutes(l);break;case e:this.$d.setSeconds(l);break;case t:this.$d.setMilliseconds(l)}return this.init(),this},h.set=function(t,e){return this.clone().$set(t,e)},h.add=function(t,l){var c=this;t=Number(t);var d,h=M.prettyUnit(l),u=function(e,a){var n=c.set("date",1).set(e,a+t);return n.set("date",Math.min(c.$D,n.daysInMonth()))};if(h===r)return u(r,this.$M);if(h===o)return u(o,this.$y);switch(h){case a:d=6e4;break;case n:d=36e5;break;case i:d=864e5;break;case s:d=6048e5;break;case e:d=1e3;break;default:d=1}var f=this.valueOf()+t*d;return $(f,this)},h.subtract=function(t,e){return this.add(-1*t,e)},h.format=function(t){var e=this,a=t||"YYYY-MM-DDTHH:mm:ssZ",n=M.padZoneStr(this.$d.getTimezoneOffset()),i=this.$locale(),s=i.weekdays,r=i.months,o=function(t,e,a,n){return t&&t[e]||a[e].substr(0,n)};return a.replace(c,function(t){if(t.indexOf("[")>-1)return t.replace(/\[|\]/g,"");switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return String(e.$y);case"M":return String(e.$M+1);case"MM":return M.padStart(e.$M+1,2,"0");case"MMM":return o(i.monthsShort,e.$M,r,3);case"MMMM":return r[e.$M];case"D":return String(e.$D);case"DD":return M.padStart(e.$D,2,"0");case"d":return String(e.$W);case"dd":return o(i.weekdaysMin,e.$W,s,2);case"ddd":return o(i.weekdaysShort,e.$W,s,3);case"dddd":return s[e.$W];case"H":return String(e.$H);case"HH":return M.padStart(e.$H,2,"0");case"h":case"hh":return 0===e.$H?12:M.padStart(e.$H<13?e.$H:e.$H-12,"hh"===t?2:1,"0");case"a":return e.$H<12?"am":"pm";case"A":return e.$H<12?"AM":"PM";case"m":return String(e.$m);case"mm":return M.padStart(e.$m,2,"0");case"s":return String(e.$s);case"ss":return M.padStart(e.$s,2,"0");case"SSS":return M.padStart(e.$ms,3,"0");case"Z":return n;default:return n.replace(":","")}})},h.diff=function(t,l,c){var d=M.prettyUnit(l),h=y(t),u=this-h,f=M.monthDiff(this,h);switch(d){case o:f/=12;break;case r:break;case"quarter":f/=3;break;case s:f=u/6048e5;break;case i:f=u/864e5;break;case n:f=u/36e5;break;case a:f=u/6e4;break;case e:f=u/1e3;break;default:f=u}return c?f:M.absFloor(f)},h.daysInMonth=function(){return this.endOf(r).$D},h.$locale=function(){return p[this.$L]},h.locale=function(t,e){var a=this.clone();return a.$L=m(t,e,!0),a},h.clone=function(){return $(this.toDate(),this)},h.toDate=function(){return new Date(this.$d)},h.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]},h.toJSON=function(){return this.toISOString()},h.toISOString=function(){return this.toDate().toISOString()},h.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}},h.toString=function(){return this.$d.toUTCString()},d}();return y.extend=function(t,e){return t(e,b,y),y},y.locale=m,y.isDayjs=v,y.en=p[f],y}()}),n=e(function(t,e){t.exports=function(t,e,a){e.prototype.isBetween=function(t,e){var n=a(t),i=a(e);return this.isAfter(n)&&this.isBefore(i)||this.isBefore(n)&&this.isAfter(i)}}});function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=[],n=!0,i=!1,s=void 0;try{for(var r,o=t[Symbol.iterator]();!(n=(r=o.next()).done)&&(a.push(r.value),!e||a.length!==e);n=!0);}catch(t){i=!0,s=t}finally{try{n||null==o.return||o.return()}finally{if(i)throw s}}return a}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(t,e){return t-e*Math.floor(t/e)}function r(t){return t%4==0&&!(t%100==0&&t%400!=0)}var o=1721425.5;function l(t,e,a){return o-1+365*(t-1)+Math.floor((t-1)/4)+-Math.floor((t-1)/100)+Math.floor((t-1)/400)+Math.floor((367*e-362)/12+(e<=2?0:r(t)?-1:-2)+a)}var c=1948320.5;function d(t,e,a){var n,i;return i=474+s(n=t-(t>=0?474:473),2820),a+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*i-110)/2816)+365*(i-1)+1029983*Math.floor(n/2820)+(c-1)}var h={toJalaali:function(t,e,a){return n=l(t,e,a),o=(n=Math.floor(n)+.5)-d(475,1,1),c=Math.floor(o/1029983),1029982==(h=s(o,1029983))?u=2820:(f=Math.floor(h/366),p=s(h,366),u=Math.floor((2134*f+2816*p+2815)/1028522)+f+1),(i=u+2820*c+474)<=0&&i--,[i,r=(v=n-d(i,1,1)+1)<=186?Math.ceil(v/31):Math.ceil((v-6)/30),n-d(i,r,1)+1];var n,i,r,o,c,h,u,f,p,v},toGregorian:function(t,e,a){return function(t){var e,a,n,i,c,d,h,u,f,p,v,m;a=(e=Math.floor(t-.5)+.5)-o,n=Math.floor(a/146097),i=s(a,146097),c=Math.floor(i/36524),d=s(i,36524),h=Math.floor(d/1461),u=s(d,1461),p=400*n+100*c+4*h+(f=Math.floor(u/365)),4!=c&&4!=f&&p++,v=e-l(p,1,1),m=e<l(p,3,1)?0:r(p)?1:2;var y=Math.floor((12*(v+m)+373)/367);return[p,y,e-l(p,y,1)+1]}(d(t,e,a))}},u=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,f=/\[.*?\]|jY{2,4}|jM{1,4}|jD{1,2}|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p="day",v="month",m="year",y={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),jmonths:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),ordinal:function(t){return t}},$=function(t,e,a){var n=String(t);return!n||n.length>=e?t:"".concat(Array(e+1-n.length).join(a)).concat(t)},M=function(t,e){var a=12*(e.Year()-t.Year())+(e.Month()-t.Month()),n=t.clone().add(a,"months"),i=e-n<0,s=t.clone().add(a+(i?-1:1),"months");return Number(-(a+(e-n)/(i?n-s:s-n)))},b=function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},g=function(t){return t&&String(t).toLowerCase().replace(/s$/,"")},D=function(t){return void 0===t};a.extend(n),a.extend(function(t,e,a){var n=e.prototype,s=n.parse,r=n.init,o=n.startOf,l=n.$set,c=n.add,d=n.format,_=n.diff,S=n.year,w=n.month,k=n.dat,C=n.daysInMonth;a.$C="gregory",a.$fdow=6,a.calendar=function(t){return a.$C=t,a},n.calendar=function(t){var e=this.clone();return e.$C=t,e.isJalali()&&e.InitJalali(),e},n.isJalali=function(){return"jalali"===this.$C},a.en.jmonths="Farvardin_Ordibehesht_Khordaad_Tir_Mordaad_Shahrivar_Mehr_Aabaan_Aazar_Dey_Bahman_Esfand".split("_"),a.locale(y);var Y=function(t,e){return a(t,{locale:e.$L,calendar:e.$C})};n.init=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.bind(this)(t),this.$C=t.calendar||a.$C,this.isJalali()&&this.InitJalali()},n.parse=function(t){var e;if(t.jalali&&"string"==typeof t.date&&/.*[^Z]$/i.test(t.date)&&(e=t.date.match(u))){var a=i(h.toGregorian(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||1,10)),3),n=a[0],r=a[1],o=a[2];t.date="".concat(n,"-").concat(r,"-").concat(o).concat(e[4]||"")}return s.bind(this)(t)},n.InitJalali=function(){var t=i(h.toJalaali(this.$y,this.$M+1,this.$D),3),e=t[0],a=t[1],n=t[2];this.$jy=e,this.$jM=a-1,this.$jD=n},n.startOf=function(t,e){var n=this;if(!this.isJalali())return o.bind(this)(t,e);var s=!!D(e)||e,r=g(t),l=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.$jy,r=i(h.toGregorian(a,e+1,t),3),o=r[0],l=r[1],c=r[2],d=Y(new Date(o,l-1,c),n);return s?d:d.endOf(p)},c=(this.$W+(7-a.$fdow))%7;switch(r){case m:return s?l(1,0):l(0,0,this.$jy+1);case v:return s?l(1,this.$jM):l(0,this.$jM+1);case"week":return l(s?this.$jD-c:this.$jD+(6-c),this.$jM);default:return o.bind(this)(t,e)}},n.$set=function(t,e){var a=this;if(!this.isJalali())return l.bind(this)(t,e);var n=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.$jy,s=i(h.toGregorian(n,e+1,t),3),r=s[0],o=s[1],l=s[2];return a.$d.setDate(l),a.$d.setMonth(o-1),a.$d.setFullYear(r),a};switch(g(t)){case"date":n(e,this.$jM);break;case v:n(this.$jD,e);break;case m:n(this.$jD,this.$jM,e);break;default:return l.bind(this)(t,e)}return this.init(),this},n.add=function(t,e){var a=this;if(!this.isJalali())return c.bind(this)(t,e);t=Number(t);var n=!e||1!==e.length&&"ms"!==e?g(e):e,i=function(e,n){var i=a.set("date",1).set(e,n+t);return i.set("date",Math.min(a.$jD,i.daysInMonth()))};if(["M",v].indexOf(n)>-1)return i(v,this.$jM);if(["y",m].indexOf(n)>-1)return i(m,this.$jy);if(["d",p].indexOf(n)>-1){var s=new Date(this.$d);return s.setDate(s.getDate()+t),Y(s,this)}return c.bind(this)(t,e)},n.format=function(t,e){var a=this;if(!this.isJalali())return d.bind(this)(t,e);var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=(e||this.$locale()).jmonths;return n.replace(f,function(t){if(t.indexOf("[")>-1)return t.replace(/\[|\]/g,"");switch(t){case"YY":return String(a.$jy).slice(-2);case"YYYY":return String(a.$jy);case"M":return String(a.$jM+1);case"MM":return $(a.$jM+1,2,"0");case"MMM":return i[a.$jM].slice(0,3);case"MMMM":return i[a.$jM];case"D":return String(a.$jD);case"DD":return $(a.$jD,2,"0");default:return d.bind(a)(t,e)}})},n.diff=function(t,e,n){if(!this.isJalali())return _.bind(this)(t,e,n);var i=g(e),s=a(t),r=M(this,s);switch(i){case m:r/=12;break;case v:break;default:return _.bind(this)(t,e,n)}return n?r:b(r)},n.year=function(){return this.isJalali()?this.$jy:S.bind(this)()},n.month=function(){return this.isJalali()?this.$jM:w.bind(this)()},n.day=function(){return this.isJalali()?this.$jD:k.bind(this)()},n.daysInMonth=function(){return this.isJalali()?this.endOf(v).$jD:C.bind(this)()},n.clone=function(){return Y(this.toDate(),this)}}),a.calendar("jalali");var _={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"vuec-day",class:[t.data.class,{disabled:t.disabled,selected:t.selected,selectable:t.selectable}],on:{mouseover:function(e){t.$emit("hover",t.date)},mouseout:function(e){t.$emit("blur",t.date)},click:t.toggleSelection}},[a(t.dayView,{tag:"div",staticClass:"vuec-day-content",attrs:{data:t.data,date:t.date}}),t._v(" "),a("div",{staticClass:"vuec-square-placeholder"})])},staticRenderFns:[],props:{index:{type:Number,required:!0},date:{type:Object,default:null},data:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},dayView:{type:Object,default:null}},methods:{toggleSelection(){this.selectable&&this.$emit("click",this.index)}}},S={render:function(){var t=this.$createElement,e=this._self._c||t;return this.date?e("div",[e("div",{staticClass:"vuec-default-day"},[this._v(" "+this._s(this.formattedDate)+" ")])]):this._e()},staticRenderFns:[],props:{date:{type:Object,default:null},data:{type:Object,default:null}},computed:{formattedDate(){return this.date.format("D")}}};"۰".charCodeAt(0),"٠".charCodeAt(0);var w={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"vuec-month"},[a("div",{staticClass:"vuec-month-name",attrs:{show:t.showTitle}},[a("h2",[t._v(t._s(t.title||t.date.format("MMMM")))])]),t._v(" "),a("div",{staticClass:"vuec-week-nav vuec-7col"},t._l(t.weekDays,function(e,n){return a("div",{key:n,staticClass:"col"},[a("div",{staticClass:"vuec-week-content"},[t._v(" "+t._s(e)+" ")]),t._v(" "),a("div",{staticClass:"vuec-week-placeholder"})])})),t._v(" "),a("div",{staticClass:"vuec-month-content"},[a("div",{staticClass:"vuec-month-days vuec-7col"},t._l(t.days,function(e,n){return a("day-view",{key:e.dayKey,staticClass:"col",attrs:{index:n,data:e.data,date:e.date,title:e.title,"aria-hidden":e.hide,disabled:e.disabled,selectable:!e.disabled&&t.selectable,selected:e.selected,"day-view":t.dayView},on:{click:t.toggleDay,hover:function(e){t.$emit("hover",e)},blur:function(e){t.$emit("blur",e)}}})})),t._v(" "),a("div",{staticClass:"vuec-month-placeholder"})])])},staticRenderFns:[],components:{DayView:_},props:{date:{type:Object,required:!0},adapter:{type:Function,default:()=>({})},selectable:{type:Boolean,default:!1},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selection:{type:Array,default:()=>[]},showTitle:{type:Boolean,default:!0},title:{type:String,default:""},dayView:{type:Object,default:()=>S}},data:()=>({weekDays:["شنبه","۱ شنبه","۲ شنبه","۳ شنبه","۴ شنبه","۵ شنبه","جمعه"]}),computed:{days(){const t=this.date.month(),e=this.date.format("YYYY/MM");let n=a(this.date).startOf("Month").startOf("week");const i=a(this.date).endOf("Month"),s=[];for(;n.isBefore(i);){const i=n.format("YYYY/MM/DD");this.minDate&&n.isBefore(this.minDate,"day")||this.maxDate&&n.isAfter(this.maxDate,"day")||n.month()!==t?s.push({disabled:!0,hide:n.month()!==t,date:a(n),data:this.adapter({date:n,dayKey:i,monthKey:e})||{}}):s.push({key:i,data:this.adapter({date:n,dayKey:i,monthKey:e})||{},date:a(n),selected:-1!==this.selection.indexOf(i)}),n=n.add(1,"days")}return s}},methods:{toggleDay(t){const e=this.days[t];this.$emit("selectionChange",{key:e.key,date:e.date,selected:!e.selected})}}},k={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"vuec-calendar",class:["vuec-theme-"+t.theme]},[t.showNavigation?a("div",{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[a("span",{staticClass:"vuec-btn-prev",on:{click:t.previousPage}},[t._t("prev-page",[a("icon-arrow-right")])],2),t._v(" "),a("span",{staticClass:"vuec-btn-next",on:{click:t.nextPage}},[t._t("next-page",[a("icon-arrow-left")])],2)]):t._e(),t._v(" "),a("div",{staticClass:"vuec-month-wrapper"},t._l(t.months,function(e,n){return a("vuec-month",{key:n,attrs:{adapter:t.getDayData,title:e.title,date:e.date,"min-date":t.minDate,"max-date":t.maxDate,selectable:t.selectable,inventory:e.inventory,selection:e.selections,"day-view":t.dayView},on:{selectionChange:t.selectionChange,hover:t.onHover,blur:t.onBlur}})}))])},staticRenderFns:[],components:{VuecMonth:w,IconArrowLeft:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[e("path",{attrs:{d:"M15.41,16.59L10.83,12l4.58-4.59L14,6l-6,6l6,6L15.41,16.59z"}}),this._v(" "),e("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},IconArrowRight:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[e("path",{attrs:{d:"M8.59,16.59L13.17,12L8.59,7.41L10,6l6,6l-6,6L8.59,16.59z"}}),this._v(" "),e("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]}},props:{theme:{type:String,default:"default"},showPreviousWeeks:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},date:{type:Object,default:()=>a()},visibleMonths:{type:Number,default:1},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},dayView:{type:Object,default:()=>S},selections:{type:Array,default:()=>[]}},data(){return{Xdate:this.date,dateUnderCursor:null}},computed:{year(){return this.date.format("YYYY")},monthSelections(){const t={};return this.selections.forEach(e=>{const n=a(e,"YYYY/MM/DD").format("YYYY/MM");return t[n]=t[n]||[],t[n].push(e),t}),t},months(){const t=[];let e=a(this.Xdate);this.showPreviousWeeks&&e.startOf("Month");const n=a(this.Xdate).add(this.visibleMonths-1,"Month").endOf("Month");for(;e.isBefore(n);){const n=e.format("YYYY/MM");t.push({title:e.format("MMMM"),date:a(e),selections:this.monthSelections[n]}),e=e.add(1,"Month").startOf("Month")}return t.length=this.visibleMonths,t}},methods:{onHover(t){t.isSame(this.dateUnderCursor)||(this.dateUnderCursor=t)},onBlur(t){null===t&&(this.dateUnderCursor=null)},getDayData({dayKey:t,monthKey:e}){return(this.data[e]||{})[t]||{}},selectionChange({date:t,selected:e}){this.$emit("selectionChange",{date:t,selected:e})},previousPage(){this.Xdate=this.Xdate.subtract(this.visibleMonths,"Month").startOf("Month"),this.$emit("previous-page",this.Xdate)},nextPage(){this.Xdate=this.Xdate.add(this.visibleMonths,"Month").startOf("Month"),this.$emit("next-page",this.Xdate)}}},C={extends:k,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const t={};return this.localSelection.forEach(e=>{const a=e.format("YYYY/MM");t[a]=t[a]||[],t[a].push(e)}),t}},watch:{value(t){this.localSelection=t}},methods:{getDayData({dayKey:t,monthKey:e,date:a}){const n=(this.data[e]||{})[t]||{},i=this.localSelection[0]||this.dateUnderCursor,s=this.localSelection[1]||this.dateUnderCursor;return Object.assign({},n,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:this.localSelection.length>0&&a.isSame(i,"day"),end:this.localSelection.length>1&&a.isSame(s,"day"),selected:this.localSelection.length>1&&a.isBetween(i,s,"days","[]"),highlight:this.dateUnderCursor&&1===this.localSelection.length&&a.isBetween(i,this.dateUnderCursor,"days","[]")}})},onHover(t){this.dateUnderCursor!==t&&(this.dateUnderCursor=t)},selectionChange({date:t}){0===this.localSelection.length||void 0===this.localSelection[0]?this.$set(this.localSelection,0,t):1!==this.localSelection.length&&(this.localSelection.length=0,this.localSelection.push(t)),t.isAfter(this.localSelection[0],"day")?this.localSelection.push(t):this.$set(this.localSelection,0,t),this.$emit("input",this.localSelection)}}},Y={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:t.showPicker}},[a("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[0]))]),t._v(" "),a("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[1]))])]),t._v(" "),a("transition",{attrs:{name:"popup-animation"}},[t.visible?a("div",{staticClass:"vuec-popup",class:{mobile:t.mobile},on:{click:t.onClickDelegate}},[t.mobile?a("div",{staticClass:"vuec-popup-header"},[t._t("title",[t._v(" تاریخ ورود و خروج ")]),t._v(" "),a("div",{staticClass:"vuec-popup-close",on:{click:function(e){t.showPicker(!1)}}},[a("icon-close")],1)],2):t._e(),t._v(" "),a("vuec-select-range",{attrs:{theme:t.theme,value:t.dates,"min-date":t.minDate,"max-date":t.maxDate,"visible-months":2,selectable:!0}})],1):t._e()])],1)},staticRenderFns:[],components:{VuecSelectRange:C,IconClose:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}}),this._v(" "),e("path",{attrs:{d:"M0 0h24v24H0z",fill:"none"}})])},staticRenderFns:[]}},props:{theme:{type:String,default:"default"},mobile:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Array,default:()=>[]},open:{type:Boolean,default:!1},format:{type:String,default:"YYYY/MM/DD"}},data(){const[t=a(),e=a()]=this.value;return{visible:this.open,temporaryDisableClickListen:!1,fromDate:t,toDate:e,dates:[a(t),a(e)]}},computed:{formattedDates(){return this.dates.map(t=>t.format(this.format))}},watch:{open(t){this.showPicker(t)}},mounted(){this.showPicker(this.open),document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(t=!0){this.temporaryDisableClickListen=t,this.visible=t},onClickDelegate(t){t.stopPropagation()},onSelectionChange(t){this.fromDate=a(t[0]),this.toDate=a(t[t.length-1]),this.$emit("input",[this.fromDate,this.toDate])}}},j={extends:k,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const t={};return this.localSelection.forEach(e=>{const a=e.format("YYYY/MM");t[a]=t[a]||[],t[a].push(e)}),t}},watch:{value(t){this.localSelection=t}},methods:{getDayData({dayKey:t,monthKey:e,date:a}){const n=(this.data[e]||{})[t]||{},i=this.localSelection.length>0&&a.isSame(this.localSelection[0],"day");return Object.assign({},n,{class:{hover:this.dateUnderCursor&&a.isSame(this.dateUnderCursor),start:i,end:i}})},onHover(t){this.dateUnderCursor!==t&&(this.dateUnderCursor=t)},selectionChange({date:t}){this.localSelection.length=0,this.localSelection.push(t),this.$emit("input",this.localSelection)}}},x={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"vuec-range-input"},[a("div",{staticClass:"vuec-date-inputs",on:{click:t.showPicker}},[a("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[0]))]),t._v(" "),a("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[1]))])]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"vuec-popup",on:{click:t.onClickDelegate}},[a("vuec-single-select",{attrs:{theme:t.theme,value:t.dates,"visible-months":1,selectable:!0}})],1)])},staticRenderFns:[],components:{VuecSingleSelect:j},props:{theme:{type:String,default:"default"},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Object,default:()=>({})},open:{type:Boolean,default:!1}},data(){return{visible:this.open,temporaryDisableClickListen:!1,fromDate:a(),toDate:a(),dates:[]}},computed:{formattedDates(){return this.dates.map(t=>t.format("YYYY/MM/DD"))}},watch:{open(t){this.visible=t,this.temporaryDisableClickListen=!0}},mounted(){document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(){this.temporaryDisableClickListen=!0,this.visible=!0},onClickDelegate(t){t.stopPropagation()},onSelectionChange(t){this.fromDate=a(t[0],"YYYY/MM/DD"),this.toDate=a(t[t.length-1],"YYYY/MM/DD"),this.$emit("input",[this.fromDate,this.toDate])}}};t.dayjs=a,t.VuecCalendar=k,t.VuecDay=_,t.VuecDefaultDay=S,t.VuecMonth=w,t.VuecRangeInput=Y,t.VuecSelectRange=C,t.VuecSingleInput=x,t.VuecSelectSingle=j,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vueCalendar={})}(this,function(t){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e(function(t,e){t.exports=function(){var t="millisecond",e="second",n="minute",a="hour",i="day",s="week",r="month",o="year",l=/^(\d{4})-?(\d{1,2})-?(\d{0,2})(.*?(\d{1,2}):(\d{1,2}):(\d{1,2}))?.?(\d{1,3})?$/,c=/\[.*?\]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},h=function(t,e,n){var a=String(t);return!a||a.length>=e?t:""+Array(e+1-a.length).join(n)+t},u={padStart:h,padZoneStr:function(t){var e=Math.abs(t),n=Math.floor(e/60),a=e%60;return(t<=0?"+":"-")+h(n,2,"0")+":"+h(a,2,"0")},monthDiff:function(t,e){var n=12*(e.year()-t.year())+(e.month()-t.month()),a=t.clone().add(n,"months"),i=e-a<0,s=t.clone().add(n+(i?-1:1),"months");return Number(-(n+(e-a)/(i?a-s:s-a)))},absFloor:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},prettyUnit:function(l){return{M:r,y:o,w:s,d:i,h:a,m:n,s:e,ms:t}[l]||String(l||"").toLowerCase().replace(/s$/,"")},isUndefined:function(t){return void 0===t}},f="en",v={};v[f]=d;var p=function(t){return t instanceof b},m=function(t,e,n){var a;if(!t)return null;if("string"==typeof t)v[t]&&(a=t),e&&(v[t]=e,a=t);else{var i=t.name;v[i]=t,a=i}return n||(f=a),a},y=function(t,e){if(p(t))return t.clone();var n=e||{};return n.date=t,new b(n)},$=function(t,e){return y(t,{locale:e.$L})},M=u;M.parseLocale=m,M.isDayjs=p,M.wrapper=$;var b=function(){function d(t){this.parse(t)}var h=d.prototype;return h.parse=function(t){var e,n;this.$d=null===(e=t.date)?new Date(NaN):M.isUndefined(e)?new Date:e instanceof Date?e:"string"==typeof e&&/.*[^Z]$/i.test(e)&&(n=e.match(l))?new Date(n[1],n[2]-1,n[3]||1,n[5]||0,n[6]||0,n[7]||0,n[8]||0):new Date(e),this.init(t)},h.init=function(t){this.$y=this.$d.getFullYear(),this.$M=this.$d.getMonth(),this.$D=this.$d.getDate(),this.$W=this.$d.getDay(),this.$H=this.$d.getHours(),this.$m=this.$d.getMinutes(),this.$s=this.$d.getSeconds(),this.$ms=this.$d.getMilliseconds(),this.$L=this.$L||m(t.locale,null,!0)||f},h.$utils=function(){return M},h.isValid=function(){return!("Invalid Date"===this.$d.toString())},h.$compare=function(t){return this.valueOf()-y(t).valueOf()},h.isSame=function(t){return 0===this.$compare(t)},h.isBefore=function(t){return this.$compare(t)<0},h.isAfter=function(t){return this.$compare(t)>0},h.year=function(){return this.$y},h.month=function(){return this.$M},h.day=function(){return this.$W},h.date=function(){return this.$D},h.hour=function(){return this.$H},h.minute=function(){return this.$m},h.second=function(){return this.$s},h.millisecond=function(){return this.$ms},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(t,l){var c=this,d=!!M.isUndefined(l)||l,h=function(t,e){var n=$(new Date(c.$y,e,t),c);return d?n:n.endOf(i)},u=function(t,e){return $(c.toDate()[t].apply(c.toDate(),d?[0,0,0,0].slice(e):[23,59,59,999].slice(e)),c)};switch(M.prettyUnit(t)){case o:return d?h(1,0):h(31,11);case r:return d?h(1,this.$M):h(0,this.$M+1);case s:return h(d?this.$D-this.$W:this.$D+(6-this.$W),this.$M);case i:case"date":return u("setHours",0);case a:return u("setMinutes",1);case n:return u("setSeconds",2);case e:return u("setMilliseconds",3);default:return this.clone()}},h.endOf=function(t){return this.startOf(t,!1)},h.$set=function(s,l){switch(M.prettyUnit(s)){case i:this.$d.setDate(this.$D+(l-this.$W));break;case"date":this.$d.setDate(l);break;case r:this.$d.setMonth(l);break;case o:this.$d.setFullYear(l);break;case a:this.$d.setHours(l);break;case n:this.$d.setMinutes(l);break;case e:this.$d.setSeconds(l);break;case t:this.$d.setMilliseconds(l)}return this.init(),this},h.set=function(t,e){return this.clone().$set(t,e)},h.add=function(t,l){var c=this;t=Number(t);var d,h=M.prettyUnit(l),u=function(e,n){var a=c.set("date",1).set(e,n+t);return a.set("date",Math.min(c.$D,a.daysInMonth()))};if(h===r)return u(r,this.$M);if(h===o)return u(o,this.$y);switch(h){case n:d=6e4;break;case a:d=36e5;break;case i:d=864e5;break;case s:d=6048e5;break;case e:d=1e3;break;default:d=1}var f=this.valueOf()+t*d;return $(f,this)},h.subtract=function(t,e){return this.add(-1*t,e)},h.format=function(t){var e=this,n=t||"YYYY-MM-DDTHH:mm:ssZ",a=M.padZoneStr(this.$d.getTimezoneOffset()),i=this.$locale(),s=i.weekdays,r=i.months,o=function(t,e,n,a){return t&&t[e]||n[e].substr(0,a)};return n.replace(c,function(t){if(t.indexOf("[")>-1)return t.replace(/\[|\]/g,"");switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return String(e.$y);case"M":return String(e.$M+1);case"MM":return M.padStart(e.$M+1,2,"0");case"MMM":return o(i.monthsShort,e.$M,r,3);case"MMMM":return r[e.$M];case"D":return String(e.$D);case"DD":return M.padStart(e.$D,2,"0");case"d":return String(e.$W);case"dd":return o(i.weekdaysMin,e.$W,s,2);case"ddd":return o(i.weekdaysShort,e.$W,s,3);case"dddd":return s[e.$W];case"H":return String(e.$H);case"HH":return M.padStart(e.$H,2,"0");case"h":case"hh":return 0===e.$H?12:M.padStart(e.$H<13?e.$H:e.$H-12,"hh"===t?2:1,"0");case"a":return e.$H<12?"am":"pm";case"A":return e.$H<12?"AM":"PM";case"m":return String(e.$m);case"mm":return M.padStart(e.$m,2,"0");case"s":return String(e.$s);case"ss":return M.padStart(e.$s,2,"0");case"SSS":return M.padStart(e.$ms,3,"0");case"Z":return a;default:return a.replace(":","")}})},h.diff=function(t,l,c){var d=M.prettyUnit(l),h=y(t),u=this-h,f=M.monthDiff(this,h);switch(d){case o:f/=12;break;case r:break;case"quarter":f/=3;break;case s:f=u/6048e5;break;case i:f=u/864e5;break;case a:f=u/36e5;break;case n:f=u/6e4;break;case e:f=u/1e3;break;default:f=u}return c?f:M.absFloor(f)},h.daysInMonth=function(){return this.endOf(r).$D},h.$locale=function(){return v[this.$L]},h.locale=function(t,e){var n=this.clone();return n.$L=m(t,e,!0),n},h.clone=function(){return $(this.toDate(),this)},h.toDate=function(){return new Date(this.$d)},h.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]},h.toJSON=function(){return this.toISOString()},h.toISOString=function(){return this.toDate().toISOString()},h.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}},h.toString=function(){return this.$d.toUTCString()},d}();return y.extend=function(t,e){return t(e,b,y),y},y.locale=m,y.isDayjs=p,y.en=v[f],y}()}),a=e(function(t,e){t.exports=function(t,e,n){e.prototype.isBetween=function(t,e){var a=n(t),i=n(e);return this.isAfter(a)&&this.isBefore(i)||this.isBefore(a)&&this.isAfter(i)}}});function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],a=!0,i=!1,s=void 0;try{for(var r,o=t[Symbol.iterator]();!(a=(r=o.next()).done)&&(n.push(r.value),!e||n.length!==e);a=!0);}catch(t){i=!0,s=t}finally{try{a||null==o.return||o.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(t,e){return t-e*Math.floor(t/e)}function r(t){return t%4==0&&!(t%100==0&&t%400!=0)}var o=1721425.5;function l(t,e,n){return o-1+365*(t-1)+Math.floor((t-1)/4)+-Math.floor((t-1)/100)+Math.floor((t-1)/400)+Math.floor((367*e-362)/12+(e<=2?0:r(t)?-1:-2)+n)}var c=1948320.5;function d(t,e,n){var a,i;return i=474+s(a=t-(t>=0?474:473),2820),n+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*i-110)/2816)+365*(i-1)+1029983*Math.floor(a/2820)+(c-1)}var h={toJalaali:function(t,e,n){return a=l(t,e,n),o=(a=Math.floor(a)+.5)-d(475,1,1),c=Math.floor(o/1029983),1029982==(h=s(o,1029983))?u=2820:(f=Math.floor(h/366),v=s(h,366),u=Math.floor((2134*f+2816*v+2815)/1028522)+f+1),(i=u+2820*c+474)<=0&&i--,[i,r=(p=a-d(i,1,1)+1)<=186?Math.ceil(p/31):Math.ceil((p-6)/30),a-d(i,r,1)+1];var a,i,r,o,c,h,u,f,v,p},toGregorian:function(t,e,n){return function(t){var e,n,a,i,c,d,h,u,f,v,p,m;n=(e=Math.floor(t-.5)+.5)-o,a=Math.floor(n/146097),i=s(n,146097),c=Math.floor(i/36524),d=s(i,36524),h=Math.floor(d/1461),u=s(d,1461),v=400*a+100*c+4*h+(f=Math.floor(u/365)),4!=c&&4!=f&&v++,p=e-l(v,1,1),m=e<l(v,3,1)?0:r(v)?1:2;var y=Math.floor((12*(p+m)+373)/367);return[v,y,e-l(v,y,1)+1]}(d(t,e,n))}},u=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,f=/\[.*?\]|jY{2,4}|jM{1,4}|jD{1,2}|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v="day",p="month",m="year",y={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),jmonths:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),ordinal:function(t){return t}},$=function(t,e,n){var a=String(t);return!a||a.length>=e?t:"".concat(Array(e+1-a.length).join(n)).concat(t)},M=function(t,e){var n=12*(e.Year()-t.Year())+(e.Month()-t.Month()),a=t.clone().add(n,"months"),i=e-a<0,s=t.clone().add(n+(i?-1:1),"months");return Number(-(n+(e-a)/(i?a-s:s-a)))},b=function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},g=function(t){return t&&String(t).toLowerCase().replace(/s$/,"")},D=function(t){return void 0===t};n.extend(a),n.extend(function(t,e,n){var a=e.prototype,s=a.parse,r=a.init,o=a.startOf,l=a.$set,c=a.add,d=a.format,_=a.diff,S=a.year,w=a.month,k=a.dat,C=a.daysInMonth;n.$C="gregory",n.$fdow=6,n.calendar=function(t){return n.$C=t,n},a.calendar=function(t){var e=this.clone();return e.$C=t,e.isJalali()&&e.InitJalali(),e},a.isJalali=function(){return"jalali"===this.$C},n.en.jmonths="Farvardin_Ordibehesht_Khordaad_Tir_Mordaad_Shahrivar_Mehr_Aabaan_Aazar_Dey_Bahman_Esfand".split("_"),n.locale(y);var Y=function(t,e){return n(t,{locale:e.$L,calendar:e.$C})};a.init=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.bind(this)(t),this.$C=t.calendar||n.$C,this.isJalali()&&this.InitJalali()},a.parse=function(t){var e;if(t.jalali&&"string"==typeof t.date&&/.*[^Z]$/i.test(t.date)&&(e=t.date.match(u))){var n=i(h.toGregorian(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||1,10)),3),a=n[0],r=n[1],o=n[2];t.date="".concat(a,"-").concat(r,"-").concat(o).concat(e[4]||"")}return s.bind(this)(t)},a.InitJalali=function(){var t=i(h.toJalaali(this.$y,this.$M+1,this.$D),3),e=t[0],n=t[1],a=t[2];this.$jy=e,this.$jM=n-1,this.$jD=a},a.startOf=function(t,e){var a=this;if(!this.isJalali())return o.bind(this)(t,e);var s=!!D(e)||e,r=g(t),l=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.$jy,r=i(h.toGregorian(n,e+1,t),3),o=r[0],l=r[1],c=r[2],d=Y(new Date(o,l-1,c),a);return s?d:d.endOf(v)},c=(this.$W+(7-n.$fdow))%7;switch(r){case m:return s?l(1,0):l(0,0,this.$jy+1);case p:return s?l(1,this.$jM):l(0,this.$jM+1);case"week":return l(s?this.$jD-c:this.$jD+(6-c),this.$jM);default:return o.bind(this)(t,e)}},a.$set=function(t,e){var n=this;if(!this.isJalali())return l.bind(this)(t,e);var a=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.$jy,s=i(h.toGregorian(a,e+1,t),3),r=s[0],o=s[1],l=s[2];return n.$d.setDate(l),n.$d.setMonth(o-1),n.$d.setFullYear(r),n};switch(g(t)){case"date":a(e,this.$jM);break;case p:a(this.$jD,e);break;case m:a(this.$jD,this.$jM,e);break;default:return l.bind(this)(t,e)}return this.init(),this},a.add=function(t,e){var n=this;if(!this.isJalali())return c.bind(this)(t,e);t=Number(t);var a=!e||1!==e.length&&"ms"!==e?g(e):e,i=function(e,a){var i=n.set("date",1).set(e,a+t);return i.set("date",Math.min(n.$jD,i.daysInMonth()))};if(["M",p].indexOf(a)>-1)return i(p,this.$jM);if(["y",m].indexOf(a)>-1)return i(m,this.$jy);if(["d",v].indexOf(a)>-1){var s=new Date(this.$d);return s.setDate(s.getDate()+t),Y(s,this)}return c.bind(this)(t,e)},a.format=function(t,e){var n=this;if(!this.isJalali())return d.bind(this)(t,e);var a=t||"YYYY-MM-DDTHH:mm:ssZ",i=(e||this.$locale()).jmonths;return a.replace(f,function(t){if(t.indexOf("[")>-1)return t.replace(/\[|\]/g,"");switch(t){case"YY":return String(n.$jy).slice(-2);case"YYYY":return String(n.$jy);case"M":return String(n.$jM+1);case"MM":return $(n.$jM+1,2,"0");case"MMM":return i[n.$jM].slice(0,3);case"MMMM":return i[n.$jM];case"D":return String(n.$jD);case"DD":return $(n.$jD,2,"0");default:return d.bind(n)(t,e)}})},a.diff=function(t,e,a){if(!this.isJalali())return _.bind(this)(t,e,a);var i=g(e),s=n(t),r=M(this,s);switch(i){case m:r/=12;break;case p:break;default:return _.bind(this)(t,e,a)}return a?r:b(r)},a.year=function(){return this.isJalali()?this.$jy:S.bind(this)()},a.month=function(){return this.isJalali()?this.$jM:w.bind(this)()},a.day=function(){return this.isJalali()?this.$jD:k.bind(this)()},a.daysInMonth=function(){return this.isJalali()?this.endOf(p).$jD:C.bind(this)()},a.clone=function(){return Y(this.toDate(),this)}}),n.calendar("jalali");var _={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vuec-day",class:[t.data.class,{disabled:t.disabled,selected:t.selected,selectable:t.selectable}],on:{mouseover:function(e){t.$emit("hover",t.date)},mouseout:function(e){t.$emit("blur",t.date)},click:t.toggleSelection}},[n("div",{staticClass:"vuec-day-content"},[t._t("day",[n("div",{staticClass:"vuec-default-day"},[t._v(" "+t._s(t.date.format("D"))+" ")])],{data:t.data,date:t.date})],2),t._v(" "),n("div",{staticClass:"vuec-square-placeholder"})])},staticRenderFns:[],props:{index:{type:Number,required:!0},date:{type:Object,default:null},data:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1}},methods:{toggleSelection(){this.selectable&&this.$emit("click",this.index)}}};"۰".charCodeAt(0),"٠".charCodeAt(0);var S={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vuec-month"},[n("div",{staticClass:"vuec-month-name",attrs:{show:t.showTitle}},[n("h2",[t._v(t._s(t.title||t.date.format("MMMM")))])]),t._v(" "),n("div",{staticClass:"vuec-week-nav vuec-7col"},t._l(t.weekDays,function(e,a){return n("div",{key:a,staticClass:"col"},[n("div",{staticClass:"vuec-week-content"},[t._v(" "+t._s(e)+" ")]),t._v(" "),n("div",{staticClass:"vuec-week-placeholder"})])})),t._v(" "),n("div",{staticClass:"vuec-month-content"},[n("div",{staticClass:"vuec-month-days vuec-7col"},t._l(t.days,function(e,a){return n("day-view",{key:e.dayKey,staticClass:"col",attrs:{index:a,data:e.data,date:e.date,title:e.title,"aria-hidden":e.hide,disabled:e.disabled,selectable:!e.disabled&&t.selectable,selected:e.selected},on:{click:t.toggleDay,hover:function(e){t.$emit("hover",e)},blur:function(e){t.$emit("blur",e)}},scopedSlots:t._u([{key:"day",fn:function(e){return t.$slots.day?[t._t("day",null,null,e)]:void 0}}])})})),t._v(" "),n("div",{staticClass:"vuec-month-placeholder"})])])},staticRenderFns:[],components:{DayView:_},props:{date:{type:Object,required:!0},adapter:{type:Function,default:()=>({})},selectable:{type:Boolean,default:!1},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selection:{type:Array,default:()=>[]},showTitle:{type:Boolean,default:!0},title:{type:String,default:""}},data:()=>({weekDays:["شنبه","۱ شنبه","۲ شنبه","۳ شنبه","۴ شنبه","۵ شنبه","جمعه"]}),computed:{days(){const t=this.date.month(),e=this.date.format("YYYY/MM");let a=n(this.date).startOf("Month").startOf("week");const i=n(this.date).endOf("Month"),s=[];for(;a.isBefore(i);){const i=a.format("YYYY/MM/DD");this.minDate&&a.isBefore(this.minDate,"day")||this.maxDate&&a.isAfter(this.maxDate,"day")||a.month()!==t?s.push({disabled:!0,hide:a.month()!==t,date:n(a),data:this.adapter({date:a,dayKey:i,monthKey:e})||{}}):s.push({key:i,data:this.adapter({date:a,dayKey:i,monthKey:e})||{},date:n(a),selected:-1!==this.selection.indexOf(i)}),a=a.add(1,"days")}return s}},methods:{toggleDay(t){const e=this.days[t];this.$emit("selectionChange",{key:e.key,date:e.date,selected:!e.selected})}}},w={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vuec-calendar",class:["vuec-theme-"+t.theme]},[t.showNavigation?n("div",{staticClass:"vuec-nav",attrs:{"align-v":"center"}},[n("span",{staticClass:"vuec-btn-prev",on:{click:t.previousPage}},[t._t("prev-page",[n("icon-arrow-right")])],2),t._v(" "),n("span",{staticClass:"vuec-btn-next",on:{click:t.nextPage}},[t._t("next-page",[n("icon-arrow-left")])],2)]):t._e(),t._v(" "),n("div",{staticClass:"vuec-month-wrapper"},t._l(t.months,function(e,a){return n("vuec-month",{key:a,attrs:{adapter:t.getDayData,title:e.title,date:e.date,"min-date":t.minDate,"max-date":t.maxDate,selectable:t.selectable,inventory:e.inventory,selection:e.selections},on:{selectionChange:t.selectionChange,hover:t.onHover,blur:t.onBlur},scopedSlots:t._u([{key:"day",fn:function(e){return[t._t("day",null,null,e)]}}])})}))])},staticRenderFns:[],components:{VuecMonth:S,IconArrowLeft:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[e("path",{attrs:{d:"M15.41,16.59L10.83,12l4.58-4.59L14,6l-6,6l6,6L15.41,16.59z"}}),this._v(" "),e("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]},IconArrowRight:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{id:"Layer_1",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24","enable-background":"new 0 0 24 24","xml:space":"preserve"}},[e("path",{attrs:{d:"M8.59,16.59L13.17,12L8.59,7.41L10,6l6,6l-6,6L8.59,16.59z"}}),this._v(" "),e("path",{attrs:{fill:"none",d:"M0,0h24v24H0V0z"}})])},staticRenderFns:[]}},props:{theme:{type:String,default:"default"},showPreviousWeeks:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},date:{type:Object,default:()=>n()},visibleMonths:{type:Number,default:1},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},selections:{type:Array,default:()=>[]}},data(){return{Xdate:this.date,dateUnderCursor:null}},computed:{year(){return this.date.format("YYYY")},monthSelections(){const t={};return this.selections.forEach(e=>{const a=n(e,"YYYY/MM/DD").format("YYYY/MM");return t[a]=t[a]||[],t[a].push(e),t}),t},months(){const t=[];let e=n(this.Xdate);this.showPreviousWeeks&&e.startOf("Month");const a=n(this.Xdate).add(this.visibleMonths-1,"Month").endOf("Month");for(;e.isBefore(a);){const a=e.format("YYYY/MM");t.push({title:e.format("MMMM"),date:n(e),selections:this.monthSelections[a]}),e=e.add(1,"Month").startOf("Month")}return t.length=this.visibleMonths,t}},methods:{onHover(t){t.isSame(this.dateUnderCursor)||(this.dateUnderCursor=t)},onBlur(t){null===t&&(this.dateUnderCursor=null)},getDayData({dayKey:t,monthKey:e}){return(this.data[e]||{})[t]||{}},selectionChange({date:t,selected:e}){this.$emit("selectionChange",{date:t,selected:e})},previousPage(){this.Xdate=this.Xdate.subtract(this.visibleMonths,"Month").startOf("Month"),this.$emit("previous-page",this.Xdate)},nextPage(){this.Xdate=this.Xdate.add(this.visibleMonths,"Month").startOf("Month"),this.$emit("next-page",this.Xdate)}}},k={extends:w,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const t={};return this.localSelection.forEach(e=>{const n=e.format("YYYY/MM");t[n]=t[n]||[],t[n].push(e)}),t}},watch:{value(t){this.localSelection=t}},methods:{getDayData({dayKey:t,monthKey:e,date:n}){const a=(this.data[e]||{})[t]||{},i=this.localSelection[0]||this.dateUnderCursor,s=this.localSelection[1]||this.dateUnderCursor;return Object.assign({},a,{class:{hover:this.dateUnderCursor&&n.isSame(this.dateUnderCursor),start:this.localSelection.length>0&&n.isSame(i,"day"),end:this.localSelection.length>1&&n.isSame(s,"day"),selected:this.localSelection.length>1&&n.isBetween(i,s,"days","[]"),highlight:this.dateUnderCursor&&1===this.localSelection.length&&n.isBetween(i,this.dateUnderCursor,"days","[]")}})},onHover(t){this.dateUnderCursor!==t&&(this.dateUnderCursor=t)},selectionChange({date:t}){0===this.localSelection.length||void 0===this.localSelection[0]?this.$set(this.localSelection,0,t):1!==this.localSelection.length&&(this.localSelection.length=0,this.localSelection.push(t)),t.isAfter(this.localSelection[0],"day")?this.localSelection.push(t):this.$set(this.localSelection,0,t),this.$emit("input",this.localSelection)}}},C={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vuec-range-input"},[n("div",{staticClass:"vuec-date-inputs",on:{click:t.showPicker}},[n("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[0]))]),t._v(" "),n("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[1]))])]),t._v(" "),n("transition",{attrs:{name:"popup-animation"}},[t.visible?n("div",{staticClass:"vuec-popup",class:{mobile:t.mobile},on:{click:t.onClickDelegate}},[t.mobile?n("div",{staticClass:"vuec-popup-header"},[t._t("title",[t._v(" تاریخ ورود و خروج ")]),t._v(" "),n("div",{staticClass:"vuec-popup-close",on:{click:function(e){t.showPicker(!1)}}},[n("icon-close")],1)],2):t._e(),t._v(" "),n("vuec-select-range",{attrs:{theme:t.theme,value:t.dates,"min-date":t.minDate,"max-date":t.maxDate,"visible-months":2,selectable:!0}})],1):t._e()])],1)},staticRenderFns:[],components:{VuecSelectRange:k,IconClose:{render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}}),this._v(" "),e("path",{attrs:{d:"M0 0h24v24H0z",fill:"none"}})])},staticRenderFns:[]}},props:{theme:{type:String,default:"default"},mobile:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},maxDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Array,default:()=>[]},open:{type:Boolean,default:!1},format:{type:String,default:"YYYY/MM/DD"}},data(){const[t=n(),e=n()]=this.value;return{visible:this.open,temporaryDisableClickListen:!1,fromDate:t,toDate:e,dates:[n(t),n(e)]}},computed:{formattedDates(){return this.dates.map(t=>t.format(this.format))}},watch:{open(t){this.showPicker(t)}},mounted(){this.showPicker(this.open),document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(t=!0){this.temporaryDisableClickListen=t,this.visible=t},onClickDelegate(t){t.stopPropagation()},onSelectionChange(t){this.fromDate=n(t[0]),this.toDate=n(t[t.length-1]),this.$emit("input",[this.fromDate,this.toDate])}}},Y={extends:w,props:{value:{type:Array,default:()=>[]}},data(){return{localSelection:this.value}},computed:{monthSelections(){const t={};return this.localSelection.forEach(e=>{const n=e.format("YYYY/MM");t[n]=t[n]||[],t[n].push(e)}),t}},watch:{value(t){this.localSelection=t}},methods:{getDayData({dayKey:t,monthKey:e,date:n}){const a=(this.data[e]||{})[t]||{},i=this.localSelection.length>0&&n.isSame(this.localSelection[0],"day");return Object.assign({},a,{class:{hover:this.dateUnderCursor&&n.isSame(this.dateUnderCursor),start:i,end:i}})},onHover(t){this.dateUnderCursor!==t&&(this.dateUnderCursor=t)},selectionChange({date:t}){this.localSelection.length=0,this.localSelection.push(t),this.$emit("input",this.localSelection)}}},j={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vuec-range-input"},[n("div",{staticClass:"vuec-date-inputs",on:{click:t.showPicker}},[n("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[0]))]),t._v(" "),n("div",{staticClass:"input"},[t._v(t._s(t.formattedDates[1]))])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"vuec-popup",on:{click:t.onClickDelegate}},[n("vuec-single-select",{attrs:{theme:t.theme,value:t.dates,"visible-months":1,selectable:!0}})],1)])},staticRenderFns:[],components:{VuecSingleSelect:Y},props:{theme:{type:String,default:"default"},selectable:{type:Boolean,default:!1},selectionMode:{type:String,default:"single"},data:{type:Object,default:()=>({})},minDate:{type:[Object,String],default:null},visibleMonths:{type:Number,default:1},value:{type:Object,default:()=>({})},open:{type:Boolean,default:!1}},data(){return{visible:this.open,temporaryDisableClickListen:!1,fromDate:n(),toDate:n(),dates:[]}},computed:{formattedDates(){return this.dates.map(t=>t.format("YYYY/MM/DD"))}},watch:{open(t){this.visible=t,this.temporaryDisableClickListen=!0}},mounted(){document.body.addEventListener("click",this.handleBodyClick)},beforeDestroy(){document.body.removeEventListener("click",this.handleBodyClick)},methods:{handleBodyClick(){this.visible&&!this.temporaryDisableClickListen&&(this.visible=!1,this.$emit("hide")),this.temporaryDisableClickListen=!1},showPicker(){this.temporaryDisableClickListen=!0,this.visible=!0},onClickDelegate(t){t.stopPropagation()},onSelectionChange(t){this.fromDate=n(t[0],"YYYY/MM/DD"),this.toDate=n(t[t.length-1],"YYYY/MM/DD"),this.$emit("input",[this.fromDate,this.toDate])}}};t.dayjs=n,t.VuecCalendar=w,t.VuecDay=_,t.VuecMonth=S,t.VuecRangeInput=C,t.VuecSelectRange=k,t.VuecSingleInput=j,t.VuecSelectSingle=Y,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vue-calendar.min.js.map |
{ | ||
"name": "@alibaba-aero/vue-calendar", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Vue Calendar", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-calendar.cjs.min.js", |
@@ -6,3 +6,2 @@ export { default as dayjs } from '../date'; | ||
export { default as VuecDay } from './core/day.vue'; | ||
export { default as VuecDefaultDay } from './core/default-day.vue'; | ||
export { default as VuecMonth } from './core/month.vue'; | ||
@@ -9,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
218439
26
1022