vue-datetime3
Advanced tools
Comparing version
@@ -283,3 +283,3 @@ import type { PropType as __PropType } from 'vue'; | ||
fixedTime: boolean | undefined; | ||
}>; | ||
}, {}>; | ||
export default _sfc_main; |
@@ -79,3 +79,3 @@ import type { PropType as __PropType } from 'vue'; | ||
maxDate: DateTime | undefined; | ||
}>; | ||
}, {}>; | ||
export default _sfc_main; |
@@ -39,3 +39,3 @@ import type { PropType as __PropType } from 'vue'; | ||
onChange?: ((...args: any[]) => any) | undefined; | ||
}, {}>; | ||
}, {}, {}>; | ||
export default _sfc_main; |
@@ -146,3 +146,3 @@ import type { PropType as __PropType } from 'vue'; | ||
title: string | undefined; | ||
}>; | ||
}, {}>; | ||
export default _sfc_main; |
@@ -78,3 +78,3 @@ import type { PropType as __PropType } from 'vue'; | ||
maxTime: string | undefined; | ||
}>; | ||
}, {}>; | ||
export default _sfc_main; |
@@ -31,3 +31,3 @@ import type { PropType as __PropType } from 'vue'; | ||
onChange?: ((...args: any[]) => any) | undefined; | ||
}, {}>; | ||
}, {}, {}>; | ||
export default _sfc_main; |
@@ -8,3 +8,3 @@ export interface TimeElement { | ||
} | ||
export interface ListElement extends Element { | ||
export interface ListElement extends HTMLElement { | ||
offsetTop: number; | ||
@@ -21,1 +21,9 @@ } | ||
} | ||
export interface ChangeEvent { | ||
year?: number; | ||
month?: number; | ||
day?: number; | ||
hour?: number; | ||
minute?: number; | ||
suffixTouched?: boolean; | ||
} |
import { DateTime, WeekdayNumbers } from 'luxon'; | ||
import { DateElement } from '../namespace'; | ||
export declare function datetimeFromISO(string: string): DateTime | null; | ||
export declare function datetimeFromISO(string: string): DateTime | undefined; | ||
export declare const startOfDay: (datetime: DateTime | undefined) => DateTime | undefined; | ||
@@ -5,0 +5,0 @@ export declare function validDatetimeRange(minDate: DateTime | undefined, maxDate: DateTime | undefined): boolean; |
@@ -1,2 +0,3 @@ | ||
export declare function weekdaysGenerator(weekStart: number): string[]; | ||
import { WeekdayNumbers } from 'luxon'; | ||
export declare function weekdaysGenerator(weekStart: WeekdayNumbers): string[]; | ||
export declare function monthsGenerator(): string[]; | ||
@@ -3,0 +4,0 @@ export declare function hoursGenerator(step: number): number[]; |
@@ -1,1 +0,1 @@ | ||
(function(p,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("luxon"),require("weekstart")):typeof define=="function"&&define.amd?define(["exports","vue","luxon","weekstart"],e):(p=typeof globalThis!="undefined"?globalThis:p||self,e((p["vue-datetime"]=p["vue-datetime"]||{},p["vue-datetime"]["[name]"]={}),p.vue,p.luxon,p.weekstart))})(this,function(p,e,u,R){"use strict";var Fe=Object.defineProperty,ze=Object.defineProperties;var He=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable;var M=(p,e,u)=>e in p?Fe(p,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):p[e]=u,Y=(p,e)=>{for(var u in e||(e={}))Pe.call(e,u)&&M(p,u,e[u]);if(U)for(var u of U(e))Ze.call(e,u)&&M(p,u,e[u]);return p},G=(p,e)=>ze(p,He(e));var N=(p,e,u)=>(M(p,typeof e!="symbol"?e+"":e,u),u);function q(n){e.onMounted(()=>{document.addEventListener("keydown",n)}),e.onUnmounted(()=>{document.removeEventListener("keydown",n)})}function V(n){const a=u.DateTime.fromISO(n).toUTC();return a.isValid?a:null}const j=n=>n==null?void 0:n.startOf("day");function W(n,a){return!n||!a||n<=a}function x(n,a,t){const s=n==null?void 0:n.year,l=a==null?void 0:a.year;return!W(n,a)||!!s&&t<s||!!l&&t>l}function $(n,a,t,s){const l=n==null?void 0:n.month,c=a==null?void 0:a.month;return x(n,a,t)||!!l&&s<l||!!c&&s>c}function K(n,a,t,s,l){const c=n==null?void 0:n.day,o=a==null?void 0:a.day;return $(n,a,t,s)||!!c&&l<c||!!o&&l>o}function I(n,a,t){return!!n&&t<n||!!a&&t>a}function J(n,a,t){const s=u.DateTime.local(n,a,1);if(!s.isValid)return[];const c=7*(6-1),o=(7-s.weekday+t)%7,d=(7-o)%7,m=s.daysInMonth,k=c-(m-o-(o?0:7)),w=s.minus({month:1}).daysInMonth,C=s.minus({month:1}),B=s.plus({month:1});return[...Array(m+d+k)].map((f,_)=>_+1<=d?{year:C.year,month:C.month,day:w+(_+1-d)}:_>=d+m?{year:B.year,month:B.month,day:_+1-(d+m)}:{year:n,month:a,day:_+1-d})}function Q(){return R.getWeekStartByLocale(u.Settings.defaultLocale)||7}function L(n){return n.charAt(0).toUpperCase()+n.slice(1)}function O(n){return String(n).padStart(2,"0")}function X(n){let a=n;--a<0&&(a=6);let t=u.Info.weekdays("short").map(s=>L(s));return t=t.concat(t.splice(0,a)),t}function F(){return[...u.Info.months().map(n=>L(n))]}function ee(n){return[...Array(Math.ceil(24/n))].map((a,t)=>t*n)}function te(n){return[...Array(Math.ceil(60/n))].map((a,t)=>t*n)}function ne(n){return[...Array(201)].map((a,t)=>n-100+t)}const ae={class:"vdatetime-calendar"},oe={class:"vdatetime-calendar__navigation"},ie=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 61.3 102.8"},[e.createElementVNode("path",{fill:"none",stroke:"#444","stroke-width":"14","stroke-miterlimit":"10",d:"M56.3 97.8L9.9 51.4 56.3 5"})],-1)],le={class:"vdatetime-calendar__current--month"},re=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 61.3 102.8"},[e.createElementVNode("path",{fill:"none",stroke:"#444","stroke-width":"14","stroke-miterlimit":"10",d:"M56.3 97.8L9.9 51.4 56.3 5"})],-1)],se={class:"vdatetime-calendar__month"},ce=["onClick"],me=e.defineComponent({__name:"DatetimeCalendar",props:{year:null,month:null,day:{default:void 0},disabled:{default:()=>[]},minDate:{default:void 0},maxDate:{default:void 0},weekStart:{default:1}},emits:["change"],setup(n,{emit:a}){const t=n,s=e.ref(u.DateTime.fromObject({year:t.year.valueOf(),month:t.month.valueOf()},{zone:"UTC"})),l=X(t.weekStart),c=F(),o=e.computed(()=>s.value.year),d=e.computed(()=>s.value.month),m=e.computed(()=>c[d.value-1]),k=e.computed(()=>J(o.value,d.value,t.weekStart).map((f,_)=>({key:_,number:f.day,selected:t.year===f.year&&t.month===f.month&&t.day===f.day,disabled:f.month!==d.value||K(t.minDate,t.maxDate,o.value,d.value,f.day)}))),w=f=>{f.disabled||a("change",o.value,d.value,f.number)},C=()=>{s.value=s.value.minus({month:1})},B=()=>{s.value=s.value.plus({month:1})};return(f,_)=>(e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",oe,[e.createElementVNode("div",{class:"vdatetime-calendar__navigation--previous",onClick:C},ie),e.createElementVNode("div",le,e.toDisplayString(e.unref(m))+" "+e.toDisplayString(e.unref(o)),1),e.createElementVNode("div",{class:"vdatetime-calendar__navigation--next",onClick:B},re)]),e.createElementVNode("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),r=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"vdatetime-calendar__month__weekday"},e.toDisplayString(r),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),r=>(e.openBlock(),e.createElementBlock("div",{key:r.key,class:e.normalizeClass(["vdatetime-calendar__month__day",{"vdatetime-calendar__month__day--selected":r.selected,"vdatetime-calendar__month__day--disabled":r.disabled}]),onClick:D=>w(r)},[e.createElementVNode("span",null,[e.createElementVNode("span",null,e.toDisplayString(r.number),1)])],10,ce))),128))])]))}}),Ye="";function T(n,a){const t=()=>{var s;if(n.value){const l=(s=n.value)==null?void 0:s.querySelector(a);n.value.scrollTo({top:l?l.offsetTop-250:0,behavior:"auto"})}};return e.onMounted(t),e.onUpdated(t),t}const de={class:"vdatetime-month-picker"},ue=["onClick"],pe=e.defineComponent({__name:"DatetimeMonthPicker",props:{year:null,month:null,minDate:null,maxDate:null},emits:["change"],setup(n,{emit:a}){const t=n,s=e.computed(()=>F().map((o,d)=>({key:d,number:++d,label:o,selected:d===t.month,disabled:!(d+1)||$(t.minDate,t.maxDate,t.year,d)}))),l=e.ref(null);T(l,".vdatetime-month-picker__item--selected");const c=o=>{o.disabled||a("change",o.number,10)};return(o,d)=>(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",{ref_key:"monthList",ref:l,class:"vdatetime-month-picker__list vdatetime-month-picker__list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:e.normalizeClass(["vdatetime-month-picker__item",{"vdatetime-month-picker__item--selected":m.selected,"vdatetime-month-picker__item--disabled":m.disabled}]),onClick:k=>c(m)},e.toDisplayString(m.label),11,ue))),128))],512)]))}}),Ge="",fe=["onClick"],ke=["onClick"],he={key:0,ref:"suffixList",class:"vdatetime-time-picker__list vdatetime-time-picker__list--suffix"},_e=e.defineComponent({__name:"DatetimeTimePicker",props:{hour:null,minute:null,use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minTime:{default:void 0},maxTime:{default:void 0}},emits:["change"],setup(n,{emit:a}){const t=n,s=e.computed(()=>t.minTime?parseInt(t.minTime.split(":")[0],10):null),l=e.computed(()=>t.maxTime?parseInt(t.maxTime.split(":")[0],10):null),c=e.computed(()=>ee(t.hourStep).filter(r=>t.use12Hour?t.hour<12?r<12:r>=12:!0).map(r=>({key:r,number:r,label:O(r),selected:r===t.hour.valueOf(),disabled:I(s.value,l.value,r)}))),o=e.computed(()=>t.minTime&&s.value===t.hour.valueOf()?parseInt(t.minTime.split(":")[1],10):null),d=e.computed(()=>t.maxTime&&l.value===t.hour.valueOf()?parseInt(t.maxTime.split(":")[1],10):null),m=e.computed(()=>te(t.minuteStep).map(r=>({key:r,number:r,label:O(r),selected:r===t.minute.valueOf(),disabled:I(o.value,d.value,r)}))),k=e.ref(null),w=e.ref(null);T(k,".vdatetime-time-picker__item--selected"),T(w,".vdatetime-time-picker__item--selected");const C=r=>{r.disabled||a("change",{hour:r.number})},B=r=>{r.disabled||a("change",{minute:r.number})},f=r=>{r==="am"&&t.hour>=12&&a("change",{hour:t.hour-12,suffixTouched:!0}),r==="pm"&&t.hour<12&&a("change",{hour:t.hour+12,suffixTouched:!0})},_=r=>t.use12Hour?r%12?r%12:12:r;return(r,D)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"vdatetime-time-picker":!0,"vdatetime-time-picker__with-suffix":n.use12Hour})},[e.createElementVNode("div",{ref_key:"hourList",ref:k,class:"vdatetime-time-picker__list vdatetime-time-picker__list--hours"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),h=>{var i;return e.openBlock(),e.createElementBlock("div",{key:h.key,class:e.normalizeClass(["vdatetime-time-picker__item",{"vdatetime-time-picker__item--selected":h.selected,"vdatetime-time-picker__item--disabled":h.disabled}]),onClick:S=>C(h)},e.toDisplayString(_((i=h.number)!=null?i:0)),11,fe)}),128))],512),e.createElementVNode("div",{ref_key:"minuteList",ref:w,class:"vdatetime-time-picker__list vdatetime-time-picker__list--minutes"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),h=>(e.openBlock(),e.createElementBlock("div",{key:h.key,class:e.normalizeClass(["vdatetime-time-picker__item",{"vdatetime-time-picker__item--selected":h.selected,"vdatetime-time-picker__item--disabled":h.disabled}]),onClick:i=>B(h)},e.toDisplayString(h.number),11,ke))),128))],512),n.use12Hour?(e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("div",{class:e.normalizeClass(["vdatetime-time-picker__item",{"vdatetime-time-picker__item--selected":n.hour<12}]),onClick:D[0]||(D[0]=h=>f("am"))}," am ",2),e.createElementVNode("div",{class:e.normalizeClass(["vdatetime-time-picker__item",{"vdatetime-time-picker__item--selected":n.hour>=12}]),onClick:D[1]||(D[1]=h=>f("pm"))}," pm ",2)],512)):e.createCommentVNode("",!0)],2))}}),Re="",ye={class:"vdatetime-year-picker"},we=["onClick"],Be=e.defineComponent({__name:"DatetimeYearPicker",props:{year:null,minDate:null,maxDate:null},emits:["change"],setup(n,{emit:a}){const t=n,s=e.computed(()=>ne(t.year.valueOf()).map(o=>({key:o,number:o,selected:o===t.year.valueOf(),disabled:!o||x(t.minDate,t.maxDate,o)}))),l=e.ref(null);T(l,".vdatetime-year-picker__item--selected");const c=o=>{o.disabled||a("change",o.number,10)};return(o,d)=>(e.openBlock(),e.createElementBlock("div",ye,[e.createElementVNode("div",{ref_key:"yearList",ref:l,class:"vdatetime-year-picker__list vdatetime-year-picker__list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:e.normalizeClass(["vdatetime-year-picker__item",{"vdatetime-year-picker__item--selected":m.selected,"vdatetime-year-picker__item--disabled":m.disabled}]),onClick:k=>c(m)},e.toDisplayString(m.number),11,we))),128))],512)]))}}),qe="",Ce=["time"],De=["date"],ge=["date","time"],z="end";class v{constructor(a=[]){N(this,"flow");N(this,"endStatus",z);N(this,"diversionNext");this.flow=a,this.diversionNext=null}step(a){return a>=0&&this.flow.length>a?this.flow[a]:this.endStatus}first(){return this.step(0)}next(a){if(this.diversionNext){const t=this.diversionNext;return this.diversionNext=null,t}return this.step(this.flow.indexOf(a)+1)}diversion(a){this.diversionNext=a}}const Se=n=>new v(n),be=n=>{switch(n){case"datetime":return new v(ge);case"date":return new v(De);case"time":return new v(Ce);default:throw new TypeError(`Cannot create flow type of ${n}`)}},Te={class:"vdatetime-popup"},ve={class:"vdatetime-popup__header"},Ne={key:0,class:"vdatetime-popup__title"},Ve={class:"vdatetime-popup__body"},Ee={class:"vdatetime-popup__actions"},E=e.defineComponent({__name:"DatetimePopup",props:{datetime:null,phrases:{default:()=>({cancel:"Cancel",ok:"Ok"})},type:{default:"date"},use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minDatetime:{default:void 0},maxDatetime:{default:void 0},auto:{type:Boolean,default:!1},weekStart:{default:1},flow:{default:void 0},title:{default:""}},emits:["cancel","confirm"],setup(n,{emit:a}){var A;const t=n,s=t.flow?Se(t.flow):be(t.type),l=e.ref((A=t.datetime)!=null?A:u.DateTime.now()),c=e.ref(s.first());let o={};const d=()=>{c.value=s.next(c.value),o={},c.value===z&&a("confirm",l.value)};q(y=>{switch(y.key){case"Escape":case"Tab":a("cancel");break;case"Enter":d();break}});const m=e.computed(()=>l.value.year),k=e.computed(()=>l.value.month),w=e.computed(()=>l.value.day),C=e.computed(()=>l.value.hour),B=e.computed(()=>l.value.minute),f=e.computed(()=>l.value.toLocaleString({month:"long",day:"numeric"})),_=e.computed(()=>t.minDatetime&&t.minDatetime.year===m.value&&t.minDatetime.month===k.value&&t.minDatetime.day===w.value?t.minDatetime.toFormat("HH:mm"):void 0),r=e.computed(()=>t.maxDatetime&&t.maxDatetime.year===m.value&&t.maxDatetime.month===k.value&&t.maxDatetime.day===w.value?t.maxDatetime.toFormat("HH:mm"):void 0),D=()=>{c.value="year",s.diversion("date")},h=()=>{c.value="month",s.diversion("date")},i=y=>{l.value=l.value.set({year:y}),t.auto&&d()},S=y=>{l.value=l.value.set({month:y}),t.auto&&d()},Le=(y,g,b)=>{l.value=l.value.set({year:y,month:g,day:b}),t.auto&&d()},Oe=({hour:y,minute:g,suffixTouched:b})=>{b&&(o.suffix=!0),Number.isInteger(y)&&(l.value=l.value.set({hour:y}),o.hour=!0),Number.isInteger(g)&&(l.value=l.value.set({minute:g}),o.minutes=!0)};return(y,g)=>(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",ve,[n.title?(e.openBlock(),e.createElementBlock("div",Ne,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),n.type!=="time"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vdatetime-popup__year",onClick:D},e.toDisplayString(e.unref(m)),1)):e.createCommentVNode("",!0),n.type!=="time"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"vdatetime-popup__date",onClick:h},e.toDisplayString(e.unref(f)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ve,[c.value==="year"?(e.openBlock(),e.createBlock(Be,{key:0,"min-date":n.minDatetime,"max-date":n.maxDatetime,year:e.unref(m),onChange:i},null,8,["min-date","max-date","year"])):e.createCommentVNode("",!0),c.value==="month"?(e.openBlock(),e.createBlock(pe,{key:1,"min-date":n.minDatetime,"max-date":n.maxDatetime,year:e.unref(m),month:e.unref(k),onChange:S},null,8,["min-date","max-date","year","month"])):e.createCommentVNode("",!0),c.value==="date"?(e.openBlock(),e.createBlock(me,{key:2,year:e.unref(m),month:e.unref(k),day:e.unref(w),"min-date":n.minDatetime,"max-date":n.maxDatetime,"week-start":n.weekStart,onChange:Le},null,8,["year","month","day","min-date","max-date","week-start"])):e.createCommentVNode("",!0),c.value==="time"?(e.openBlock(),e.createBlock(_e,{key:3,hour:e.unref(C),minute:e.unref(B),"use12-hour":n.use12Hour,"hour-step":n.hourStep,"minute-step":n.minuteStep,"min-time":e.unref(_),"max-time":e.unref(r),onChange:Oe},null,8,["hour","minute","use12-hour","hour-step","minute-step","min-time","max-time"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ee,[e.createElementVNode("div",{class:"vdatetime-popup__actions__button vdatetime-popup__actions__button--cancel",onClick:g[0]||(g[0]=b=>a("cancel"))},[e.renderSlot(y.$slots,"button-cancel__internal",{step:c.value},()=>[e.createTextVNode(e.toDisplayString(n.phrases.cancel),1)])]),e.createElementVNode("div",{class:"vdatetime-popup__actions__button vdatetime-popup__actions__button--confirm",onClick:g[1]||(g[1]=b=>d())},[e.renderSlot(y.$slots,"button-confirm__internal",{step:c.value},()=>[e.createTextVNode(e.toDisplayString(n.phrases.ok),1)])])])]))}}),je="",Me=["id","value"],xe=["name","value"],$e=["onClick"],Ie={inheritAttrs:!1},H=e.defineComponent(G(Y({},Ie),{__name:"DateTime",props:{modelValue:{default:""},valueZone:{default:"UTC"},inputId:{default:void 0},inputClass:{default:""},inputStyle:{default:""},hiddenName:{default:""},zone:{default:"local"},format:{default:void 0},type:{default:"date"},color:{default:"#3f51b5"},phrases:{default:()=>({cancel:"Cancel",ok:"Ok"})},use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minDatetime:{default:void 0},maxDatetime:{default:void 0},auto:{type:Boolean,default:!1},weekStart:{default:Q},flow:{default:void 0},title:{default:""},hideBackdrop:{type:Boolean,default:!1},backdropClick:{type:Boolean,default:!0},fixedDate:{type:Boolean,default:!1},fixedTime:{type:Boolean,default:!1}},emits:["input","close","update:modelValue"],setup(n,{emit:a}){const t=n,s=e.computed(()=>({"--primary-color":t.color})),l=e.computed(()=>{if(t.type==="datetime"){if(t.fixedDate)return"time";if(t.fixedTime)return"date"}return t.type}),c=e.ref(!1),o=e.computed({get(){return V(t.modelValue)},set(i){i&&a("update:modelValue",i.toISO())}}),d=e.computed(()=>{let i=t.format;if(!i)switch(t.type){case"date":i=u.DateTime.DATE_MED;break;case"time":i=u.DateTime.TIME_24_SIMPLE;break;case"datetime":i=u.DateTime.DATETIME_MED;break}return typeof i=="string"?o.value?u.DateTime.fromISO(t.modelValue).setZone(t.zone).toFormat(i):"":o.value?o.value.setZone(t.zone).toLocaleString(i):""}),m=e.computed(()=>t.minDatetime?u.DateTime.fromISO(t.minDatetime).setZone(t.zone):void 0),k=e.computed(()=>t.maxDatetime?u.DateTime.fromISO(t.maxDatetime).setZone(t.zone):void 0),w=()=>{let i=u.DateTime.utc().setZone(t.zone).set({second:0,millisecond:0});if(m.value&&i<m.value&&(i=m.value.set({second:0,millisecond:0})),k.value&&i>k.value&&(i=k.value.set({second:0,millisecond:0})),t.minuteStep===1)return i;const S=Math.round(i.minute/t.minuteStep)*t.minuteStep;return S===60?i.plus({hours:1}).set({minute:0}):i.set({minute:S})},C=e.computed(()=>o.value?o.value.setZone(t.zone):w()),B=()=>{let i=o.value?o.value.setZone(t.valueZone):void 0;i&&t.type==="date"&&(i=j(i)),a("input",i?i.toISO():"")};e.onMounted(()=>{B()});const f=i=>{i.target.blur(),c.value=!0},_=()=>{c.value=!1,a("close")},r=i=>{o.value=i.toUTC(),B(),_()},D=()=>{t.backdropClick&&_()},h=i=>{o.value=V(i.target.value),B()};return e.watch(()=>t.modelValue,i=>{o.value=V(i)}),(i,S)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vdatetime",i.$attrs.class]),style:e.normalizeStyle(e.unref(s))},[e.renderSlot(i.$slots,"before"),e.createElementVNode("input",e.mergeProps({id:n.inputId,class:["vdatetime-input",n.inputClass],style:n.inputStyle,type:"text",value:e.unref(d)},i.$attrs,{onClick:f,onFocus:f}),null,16,Me),n.hiddenName?(e.openBlock(),e.createElementBlock("input",{key:0,type:"hidden",name:n.hiddenName,value:n.modelValue,onInput:h},null,40,xe)):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"after"),e.createVNode(e.TransitionGroup,{name:"vdatetime-fade",tag:"div"},{default:e.withCtx(()=>[c.value&&!n.hideBackdrop?(e.openBlock(),e.createElementBlock("div",{key:"overlay",class:"vdatetime-overlay",onClick:e.withModifiers(D,["self"])},null,8,$e)):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createBlock(E,{key:"popup",type:e.unref(l),datetime:e.unref(C),phrases:n.phrases,"use12-hour":n.use12Hour,"hour-step":n.hourStep,"minute-step":n.minuteStep,"min-datetime":e.unref(m),"max-datetime":e.unref(k),auto:n.auto,"week-start":n.weekStart,flow:n.flow,title:n.title,onConfirm:r,onCancel:_},null,8,["type","datetime","phrases","use12-hour","hour-step","minute-step","min-datetime","max-datetime","auto","week-start","flow","title"])):e.createCommentVNode("",!0)]),_:1})],6))}})),We="";function P(){return{install:a=>{a.component("DateTime",H),a.component("DateTimePopup",E)}}}const Z="__VERSION__";P.version=Z,p.Datetime=H,p.DatetimePopup=E,p.default=P,p.version=Z,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(f,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("luxon"),require("weekstart")):typeof define=="function"&&define.amd?define(["exports","vue","luxon","weekstart"],e):(f=typeof globalThis!="undefined"?globalThis:f||self,e((f["vue-datetime"]=f["vue-datetime"]||{},f["vue-datetime"]["[name]"]={}),f.vue,f.luxon,f.weekstart))})(this,function(f,e,p,R){"use strict";var Ge=Object.defineProperty,Ue=Object.defineProperties;var xe=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var I=(f,e,p)=>e in f?Ge(f,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):f[e]=p,U=(f,e)=>{for(var p in e||(e={}))Re.call(e,p)&&I(f,p,e[p]);if(G)for(var p of G(e))qe.call(e,p)&&I(f,p,e[p]);return f},x=(f,e)=>Ue(f,xe(e));var g=(f,e,p)=>(I(f,typeof e!="symbol"?e+"":e,p),p);function q(o){e.onMounted(()=>{document.addEventListener("keydown",o)}),e.onUnmounted(()=>{document.removeEventListener("keydown",o)})}function $(o){const a=p.DateTime.fromISO(o);return a.isValid?a:void 0}function j(o,a){return!o||!a||o<=a}function L(o,a,t){const l=o==null?void 0:o.year,r=a==null?void 0:a.year;return!j(o,a)||!!l&&t<l||!!r&&t>r}function F(o,a,t,l){const r=o==null?void 0:o.month,d=a==null?void 0:a.month;return L(o,a,t)||!!r&&o.year===t&&l<o.month||!!d&&a.year===t&&l>a.month}function W(o,a,t,l,r){const d=o==null?void 0:o.day,s=a==null?void 0:a.day;return F(o,a,t,l)||!!d&&o.month===l&&o.year===t&&r<o.day||!!s&&a.month===l&&a.year===t&&r>a.day}function v(o,a,t){return!!o&&t<o||!!a&&t>a}function K(o,a,t){const l=p.DateTime.local(o,a,1);if(!l.isValid)return[];const d=7*(6-1),s=(7-l.weekday+t)%7,u=(7-s)%7,m=l.daysInMonth,k=d-(m-s-(s?0:7)),_=l.minus({month:1}).daysInMonth,C=l.minus({month:1}),w=l.plus({month:1});return[...Array(m+u+k)].map((y,h)=>h+1<=u?{year:C.year,month:C.month,day:_+(h+1-u)}:h>=u+m?{year:w.year,month:w.month,day:h+1-(u+m)}:{year:o,month:a,day:h+1-u})}function J(){return R.getWeekStartByLocale(p.Settings.defaultLocale)||7}function P(o){return o.charAt(0).toUpperCase()+o.slice(1)}function V(o){return String(o).padStart(2,"0")}function Q(o){const a=o-1;let t=p.Info.weekdays("short").map(l=>P(l));return t=t.concat(t.splice(0,a)),t}function z(){return[...p.Info.months().map(o=>P(o))]}function X(o){return[...Array(Math.ceil(24/o))].map((a,t)=>t*o)}function ee(o){return[...Array(Math.ceil(60/o))].map((a,t)=>t*o)}function te(o){return[...Array(201)].map((a,t)=>o-100+t)}const O=o=>(e.pushScopeId("data-v-ce779249"),o=o(),e.popScopeId(),o),oe={class:"calendar"},ae={class:"navigation"},ne=[O(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 61.3 102.8"},[e.createElementVNode("path",{fill:"none",stroke:"#444","stroke-width":"14","stroke-miterlimit":"10",d:"M56.3 97.8L9.9 51.4 56.3 5"})],-1))],se={class:"current--month"},ie=[O(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 61.3 102.8"},[e.createElementVNode("path",{fill:"none",stroke:"#444","stroke-width":"14","stroke-miterlimit":"10",d:"M56.3 97.8L9.9 51.4 56.3 5"})],-1))],le={class:"month"},re=["onClick"],ce=e.defineComponent({__name:"DatetimeCalendar",props:{year:{},month:{},day:{default:void 0},disabled:{default:()=>[]},minDate:{default:void 0},maxDate:{default:void 0},weekStart:{default:1}},emits:["change"],setup(o,{emit:a}){const t=o,l=e.ref(p.DateTime.fromObject({year:t.year.valueOf(),month:t.month.valueOf()},{zone:"UTC"})),r=Q(t.weekStart),d=z(),s=e.computed(()=>l.value.year),u=e.computed(()=>l.value.month),m=e.computed(()=>d[u.value-1]),k=e.computed(()=>K(s.value,u.value,t.weekStart).map((y,h)=>({key:h,number:y.day,selected:t.year===y.year&&t.month===y.month&&t.day===y.day,disabled:y.month!==u.value||t.disabled.includes(y.day)||W(t.minDate,t.maxDate,s.value,u.value,y.day)}))),_=y=>{y.disabled||a("change",{year:s.value,month:u.value,day:y.number})},C=()=>{l.value=l.value.minus({month:1})},w=()=>{l.value=l.value.plus({month:1})};return(y,h)=>(e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("div",ae,[e.createElementVNode("div",{class:"navigation--previous",onClick:C},ne),e.createElementVNode("div",se,e.toDisplayString(m.value)+" "+e.toDisplayString(s.value),1),e.createElementVNode("div",{class:"navigation--next",onClick:w},ie)]),e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),i=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"month__weekday"},e.toDisplayString(i),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,i=>(e.openBlock(),e.createElementBlock("div",{key:i.key,class:e.normalizeClass(["month__day",{selected:i.selected,disabled:i.disabled}]),onClick:B=>_(i)},[e.createElementVNode("span",null,[e.createElementVNode("span",null,e.toDisplayString(i.number),1)])],10,re))),128))])]))}}),Ke="",b=(o,a)=>{const t=o.__vccOpts||o;for(const[l,r]of a)t[l]=r;return t},de=b(ce,[["__scopeId","data-v-ce779249"]]);function D(o,a){const t=()=>{var l,r,d;if(o.value){const s=(l=o.value)==null?void 0:l.querySelector(a);(d=(r=o.value).scrollTo)==null||d.call(r,{top:s?s.offsetTop-152:0,behavior:"auto"})}};return e.onMounted(t),e.onUpdated(t),t}const me={class:"container"},ue=["onClick"],pe=e.defineComponent({__name:"DatetimeMonthPicker",props:{year:{},month:{},minDate:{},maxDate:{}},emits:["change"],setup(o,{emit:a}){const t=o,l=e.computed(()=>z().map((s,u)=>({key:u,number:++u,label:s,selected:u===t.month,disabled:!(u+1)||F(t.minDate,t.maxDate,t.year,u)}))),r=e.ref(null);D(r,".selected");const d=s=>{s.disabled||a("change",s.number,10)};return(s,u)=>(e.openBlock(),e.createElementBlock("div",me,[e.createElementVNode("div",{ref_key:"monthList",ref:r,class:"list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:e.normalizeClass(["item",{selected:m.selected,disabled:m.disabled}]),onClick:k=>d(m)},e.toDisplayString(m.label),11,ue))),128))],512)]))}}),Je="",fe=b(pe,[["__scopeId","data-v-49c60518"]]),ye=["onClick"],ke=["onClick"],he={key:0,ref:"suffixList",class:"list list--suffix"},_e=e.defineComponent({__name:"DatetimeTimePicker",props:{hour:{},minute:{},use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minTime:{default:void 0},maxTime:{default:void 0}},emits:["change"],setup(o,{emit:a}){const t=o,l=e.computed(()=>t.minTime?parseInt(t.minTime.split(":")[0],10):null),r=e.computed(()=>t.maxTime?parseInt(t.maxTime.split(":")[0],10):null),d=e.computed(()=>X(t.hourStep).filter(i=>t.use12Hour?t.hour<12?i<12:i>=12:!0).map(i=>({key:i,number:i,label:V(i),selected:i===t.hour,disabled:v(l.value,r.value,i)}))),s=e.computed(()=>t.minTime&&l.value===t.hour?parseInt(t.minTime.split(":")[1],10):null),u=e.computed(()=>t.maxTime&&r.value===t.hour?parseInt(t.maxTime.split(":")[1],10):null),m=e.computed(()=>ee(t.minuteStep).map(i=>({key:i,number:i,label:V(i),selected:i===t.minute,disabled:v(s.value,u.value,i)}))),k=e.ref(null),_=e.ref(null);D(k,".selected"),D(_,".selected");const C=i=>{i.disabled||a("change",{hour:i.number})},w=i=>{i.disabled||a("change",{minute:i.number})},y=i=>{i==="am"&&t.hour>=12&&a("change",{hour:t.hour-12,suffixTouched:!0}),i==="pm"&&t.hour<12&&a("change",{hour:t.hour+12,suffixTouched:!0})},h=i=>t.use12Hour?i%12?i%12:12:i;return(i,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{"with-suffix":i.use12Hour}])},[e.createElementVNode("div",{ref_key:"hourList",ref:k,class:"list list--hour"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:e.normalizeClass(["item",{selected:n.selected,disabled:n.disabled}]),onClick:S=>C(n)},e.toDisplayString(e.unref(V)(h(n.number))),11,ye))),128))],512),e.createElementVNode("div",{ref_key:"minuteList",ref:_,class:"list list--minute"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:e.normalizeClass(["item",{selected:n.selected,disabled:n.disabled}]),onClick:S=>w(n)},e.toDisplayString(n.label),11,ke))),128))],512),i.use12Hour?(e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("div",{class:e.normalizeClass(["item",{selected:i.hour<12}]),onClick:B[0]||(B[0]=n=>y("am"))}," am ",2),e.createElementVNode("div",{class:e.normalizeClass(["item",{selected:i.hour>=12}]),onClick:B[1]||(B[1]=n=>y("pm"))}," pm ",2)],512)):e.createCommentVNode("",!0)],2))}}),Qe="",we=b(_e,[["__scopeId","data-v-3b2f97c5"]]),Ce={class:"container"},Se=["onClick"],Be=e.defineComponent({__name:"DatetimeYearPicker",props:{year:{},minDate:{},maxDate:{}},emits:["change"],setup(o,{emit:a}){const t=o,l=e.computed(()=>te(t.year).map(s=>({key:s,number:s,selected:s===t.year,disabled:!s||L(t.minDate,t.maxDate,s)}))),r=e.ref(null);D(r,".selected");const d=s=>{s.disabled||a("change",s.number,10)};return(s,u)=>(e.openBlock(),e.createElementBlock("div",Ce,[e.createElementVNode("div",{ref_key:"yearList",ref:r,class:"list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:e.normalizeClass(["item",{selected:m.selected,disabled:m.disabled}]),onClick:k=>d(m)},e.toDisplayString(m.number),11,Se))),128))],512)]))}}),Xe="",be=b(Be,[["__scopeId","data-v-050926bb"]]),De=["time"],Te=["date"],Ne=["date","time"],H="end";class T{constructor(a=[]){g(this,"flow");g(this,"endStatus",H);g(this,"diversionNext");this.flow=a,this.diversionNext=null}step(a){return a>=0&&this.flow.length>a?this.flow[a]:this.endStatus}first(){return this.step(0)}next(a){if(this.diversionNext){const t=this.diversionNext;return this.diversionNext=null,t}return this.step(this.flow.indexOf(a)+1)}diversion(a){this.diversionNext=a}}const ge=o=>new T(o),Ve=o=>{switch(o){case"datetime":return new T(Ne);case"date":return new T(Te);case"time":return new T(De);default:throw new TypeError(`Cannot create flow type of ${o}`)}},Me={class:"popup"},Ie={class:"header"},$e={key:0,class:"title"},Le={class:"popup__body"},Fe={class:"actions"},ve=e.defineComponent({__name:"DatetimePopup",props:{datetime:{},phrases:{default:()=>({cancel:"Cancel",ok:"Ok"})},type:{default:"date"},use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minDatetime:{default:void 0},maxDatetime:{default:void 0},auto:{type:Boolean,default:!1},weekStart:{default:1},flow:{default:void 0},title:{default:""}},emits:["cancel","confirm"],setup(o,{emit:a}){var Z;const t=o,l=t.flow?ge(t.flow):Ve(t.type),r=e.ref((Z=t.datetime)!=null?Z:p.DateTime.now()),d=e.ref(l.first());let s={};const u=()=>{d.value=l.next(d.value),s={},d.value===H&&a("confirm",r.value)};q(c=>{switch(c.key){case"Escape":case"Tab":a("cancel");break;case"Enter":u();break}});const m=e.computed(()=>r.value.year),k=e.computed(()=>r.value.month),_=e.computed(()=>r.value.day),C=e.computed(()=>r.value.hour),w=e.computed(()=>r.value.minute),y=e.computed(()=>r.value.toLocaleString({month:"long",day:"numeric"})),h=e.computed(()=>t.minDatetime&&t.minDatetime.year===m.value&&t.minDatetime.month===k.value&&t.minDatetime.day===_.value?t.minDatetime.toFormat("HH:mm"):void 0),i=e.computed(()=>t.maxDatetime&&t.maxDatetime.year===m.value&&t.maxDatetime.month===k.value&&t.maxDatetime.day===_.value?t.maxDatetime.toFormat("HH:mm"):void 0),B=()=>{d.value="year",l.diversion("date")},n=()=>{d.value="month",l.diversion("date")},S=c=>{r.value=r.value.set({year:c}),t.auto&&u()},Ee=c=>{r.value=r.value.set({month:c}),t.auto&&u()},Ae=c=>{r.value=r.value.set({year:c==null?void 0:c.year,month:c==null?void 0:c.month,day:c==null?void 0:c.day}),t.auto&&u()},Ye=c=>{c.suffixTouched&&(s.suffix=!0),Number.isInteger(c.hour)&&(r.value=r.value.set({hour:c==null?void 0:c.hour}),s.hour=!0),Number.isInteger(c.minute)&&(r.value=r.value.set({minute:c==null?void 0:c.minute}),s.minutes=!0)};return(c,N)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",Ie,[c.title?(e.openBlock(),e.createElementBlock("div",$e,e.toDisplayString(c.title),1)):e.createCommentVNode("",!0),c.type!=="time"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"year",onClick:B},e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),c.type!=="time"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"month",onClick:n},e.toDisplayString(y.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Le,[d.value==="year"?(e.openBlock(),e.createBlock(be,{key:0,"min-date":c.minDatetime,"max-date":c.maxDatetime,year:m.value,onChange:S},null,8,["min-date","max-date","year"])):e.createCommentVNode("",!0),d.value==="month"?(e.openBlock(),e.createBlock(fe,{key:1,"min-date":c.minDatetime,"max-date":c.maxDatetime,year:m.value,month:k.value,onChange:Ee},null,8,["min-date","max-date","year","month"])):e.createCommentVNode("",!0),d.value==="date"?(e.openBlock(),e.createBlock(de,{key:2,year:m.value,month:k.value,day:_.value,"min-date":c.minDatetime,"max-date":c.maxDatetime,"week-start":c.weekStart,onChange:Ae},null,8,["year","month","day","min-date","max-date","week-start"])):e.createCommentVNode("",!0),d.value==="time"?(e.openBlock(),e.createBlock(we,{key:3,hour:C.value,minute:w.value,"use12-hour":c.use12Hour,"hour-step":c.hourStep,"minute-step":c.minuteStep,"min-time":h.value,"max-time":i.value,onChange:Ye},null,8,["hour","minute","use12-hour","hour-step","minute-step","min-time","max-time"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Fe,[e.createElementVNode("div",{class:"actions__button cancel",onClick:N[0]||(N[0]=Ze=>a("cancel"))},[e.renderSlot(c.$slots,"button-cancel__internal",{step:d.value},()=>[e.createTextVNode(e.toDisplayString(c.phrases.cancel),1)],!0)]),e.createElementVNode("div",{class:"actions__button confirm",onClick:N[1]||(N[1]=Ze=>u())},[e.renderSlot(c.$slots,"button-confirm__internal",{step:d.value},()=>[e.createTextVNode(e.toDisplayString(c.phrases.ok),1)],!0)])])]))}}),et="",M=b(ve,[["__scopeId","data-v-084d9cec"]]),Pe=["id","value"],ze=["onClick"],Oe={inheritAttrs:!1},He=e.defineComponent(x(U({},Oe),{__name:"DateTime",props:{modelValue:{default:""},valueZone:{default:"UTC"},inputId:{default:void 0},inputClass:{default:""},inputStyle:{default:""},hiddenName:{default:""},zone:{default:"local"},format:{default:void 0},type:{default:"date"},color:{default:"#3f51b5"},phrases:{default:()=>({cancel:"Cancel",ok:"Ok"})},use12Hour:{type:Boolean,default:!1},hourStep:{default:1},minuteStep:{default:1},minDatetime:{default:void 0},maxDatetime:{default:void 0},auto:{type:Boolean,default:!1},weekStart:{default:J},flow:{default:void 0},title:{default:""},hideBackdrop:{type:Boolean,default:!1},backdropClick:{type:Boolean,default:!0},fixedDate:{type:Boolean,default:!1},fixedTime:{type:Boolean,default:!1}},emits:["input","close","update:modelValue"],setup(o,{emit:a}){const t=o,l=e.computed(()=>({"--primary-color":t.color})),r=e.computed(()=>{if(t.type==="datetime"){if(t.fixedDate)return"time";if(t.fixedTime)return"date"}return t.type}),d=e.ref(!1),s=e.computed({get(){return $(t.modelValue)},set(n){n&&a("update:modelValue",n.toISO())}}),u=e.computed(()=>{let n=t.format;if(!n)switch(t.type){case"date":n=p.DateTime.DATE_MED;break;case"time":n=p.DateTime.TIME_24_SIMPLE;break;case"datetime":n=p.DateTime.DATETIME_MED;break;default:return""}return typeof n=="string"?s.value?p.DateTime.fromISO(t.modelValue).setZone(t.zone).toFormat(n):"":s.value?s.value.setZone(t.zone).toLocaleString(n):""}),m=e.computed(()=>t.minDatetime?p.DateTime.fromISO(t.minDatetime).setZone(t.zone):void 0),k=e.computed(()=>t.maxDatetime?p.DateTime.fromISO(t.maxDatetime).setZone(t.zone):void 0),_=()=>{let n=p.DateTime.utc().setZone(t.zone).set({second:0,millisecond:0});if(m.value&&n<m.value&&(n=m.value.set({second:0,millisecond:0})),k.value&&n>k.value&&(n=k.value.set({second:0,millisecond:0})),t.minuteStep===1)return n;const S=Math.round(n.minute/t.minuteStep)*t.minuteStep;return S===60?n.plus({hours:1}).set({minute:0}):n.set({minute:S})},C=e.computed(()=>s.value?s.value.setZone(t.zone):_()),w=()=>{var S;let n=s.value;n&&t.type==="date"&&(n=n.startOf("day")),a("input",(S=n==null?void 0:n.toISO())!=null?S:"")};e.onMounted(()=>{w()});const y=n=>{n.target.blur(),d.value=!0},h=()=>{d.value=!1,a("close")},i=n=>{s.value=n.toUTC(),w(),h()},B=()=>{t.backdropClick&&h()};return e.watch(()=>t.modelValue,n=>{s.value=$(n)}),(n,S)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vdatetime",n.$attrs.class]),style:e.normalizeStyle(l.value)},[e.renderSlot(n.$slots,"before",{},void 0,!0),e.createElementVNode("input",e.mergeProps({id:n.inputId,class:["vdatetime-input",n.inputClass],style:n.inputStyle,type:"text",value:u.value},n.$attrs,{onClick:y,onFocus:y}),null,16,Pe),e.renderSlot(n.$slots,"after",{},void 0,!0),e.createVNode(e.TransitionGroup,{name:"vdatetime-fade",tag:"div"},{default:e.withCtx(()=>[d.value&&!n.hideBackdrop?(e.openBlock(),e.createElementBlock("div",{key:"overlay",class:"vdatetime-overlay",onClick:e.withModifiers(B,["self"])},null,8,ze)):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createBlock(M,{key:"popup",type:r.value,datetime:C.value,phrases:n.phrases,"use12-hour":n.use12Hour,"hour-step":n.hourStep,"minute-step":n.minuteStep,"min-datetime":m.value,"max-datetime":k.value,auto:n.auto,"week-start":n.weekStart,flow:n.flow,title:n.title,onConfirm:i,onCancel:h},null,8,["type","datetime","phrases","use12-hour","hour-step","minute-step","min-datetime","max-datetime","auto","week-start","flow","title"])):e.createCommentVNode("",!0)]),_:1})],6))}})),tt="",E=b(He,[["__scopeId","data-v-09cfd25a"]]);function A(){return{install:a=>{a.component("DateTime",E),a.component("DateTimePopup",M)}}}const Y="__VERSION__";A.version=Y,f.Datetime=E,f.DatetimePopup=M,f.default=A,f.version=Y,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "vue-datetime3", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Mobile friendly datetime picker for Vue. Supports date, datetime and time modes, i18n and disabling dates.", | ||
@@ -62,8 +62,8 @@ "keywords": [ | ||
"type": "git", | ||
"url": "git+https://github.com/mariomka/vue-datetime.git" | ||
"url": "git+https://github.com/velis74/vue-datetime.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mariomka/vue-datetime/issues" | ||
"url": "https://github.com/velis74/vue-datetime/issues" | ||
}, | ||
"homepage": "https://github.com/mariomka/vue-datetime#readme", | ||
"homepage": "https://github.com/velis74/vue-datetime#readme", | ||
"license": "MIT", | ||
@@ -70,0 +70,0 @@ "eslintConfig": { |
@@ -1,2 +0,2 @@ | ||
# Vue3-datetime | ||
# Vue-datetime3 | ||
@@ -69,25 +69,28 @@ --- | ||
Parameter | Type | Default | Description | ||
--------- | ---- | ------- | ----------- | ||
v-model (*required*) | ISO 8601 `String` | - | Datetime. | ||
type | `String` | `date` | Picker type: date, datetime or time. | ||
input-id | `String` | `''` | Id for the input. | ||
input-class | `String`, `Array` or `Object` | `''` | Class for the input. | ||
input-style | `String`, `Array` or `Object` | `''` | Style for the input. | ||
hidden-name | `String` | `null` | Name for hidden input with raw value. See #51. | ||
value-zone | `String` | `UTC` | Time zone for the value. | ||
zone | `String` | `local` | Time zone for the picker. | ||
format | `Object` or `String` | `DateTime.DATE_MED`, `DateTime.DATETIME_MED` or `DateTime.TIME_24_SIMPLE` | Input date format. Luxon [presets](https://moment.github.io/luxon/docs/manual/formatting.html#tolocalestring--strings-for-humans-) or [tokens](https://moment.github.io/luxon/docs/manual/formatting.html#formatting-with-tokens--strings-for-cthulhu-). | ||
phrases | `Object` | `{ok: 'Ok', cancel: 'Cancel'}` | Phrases. | ||
use12-hour | `Boolean` | `false` | Display 12 hour (AM/PM) mode | ||
hour-step | `Number` | `1` | Hour step. | ||
minute-step | `Number` | `1` | Minute step. | ||
min-datetime | ISO 8601 `String` | `null` | Minimum datetime. | ||
max-datetime | ISO 8601 `String` | `null` | Maximum datetime. | ||
auto | `Boolean` | `false` | Auto continue/close on select. | ||
week-start | `Number` | auto from locale if _weekstart_ is available or `1` | First day of the week. 1 is Monday and 7 is Sunday. | ||
flow | `Array` | Depends of *type* | Customize steps flow, steps available: time, date, month, year. Example: ['year', 'date', 'time'] | ||
title | `String` | `''` | Popup title. | ||
hide-backdrop | `Boolean` | `false` | Show/Hide backdrop. | ||
backdrop-click | `Boolean` | `true` | Enable/Disable backdrop click to cancel (outside click). | ||
| Parameter | Type | Default | Description | | ||
|----------------------|-------------------------------|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| v-model (*required*) | ISO 8601 `String` | - | Datetime. | | ||
| type | `String` | `date` | Picker type: date, datetime or time. | | ||
| input-id | `String` | `''` | Id for the input. | | ||
| input-class | `String`, `Array` or `Object` | `''` | Class for the input. | | ||
| input-style | `String`, `Array` or `Object` | `''` | Style for the input. | | ||
| hidden-name | `String` | `null` | Name for hidden input with raw value. See #51. | | ||
| value-zone | `String` | `UTC` | Time zone for the value. | | ||
| zone | `String` | `local` | Time zone for the picker. | | ||
| format | `Object` or `String` | `DateTime.DATE_MED`, `DateTime.DATETIME_MED` or `DateTime.TIME_24_SIMPLE` | Input date format. Luxon [presets](https://moment.github.io/luxon/docs/manual/formatting.html#tolocalestring--strings-for-humans-) or [tokens](https://moment.github.io/luxon/docs/manual/formatting.html#formatting-with-tokens--strings-for-cthulhu-). | | ||
| phrases | `Object` | `{ok: 'Ok', cancel: 'Cancel'}` | Phrases. | | ||
| use12-hour | `Boolean` | `false` | Display 12 hour (AM/PM) mode | | ||
| hour-step | `Number` | `1` | Hour step. | | ||
| minute-step | `Number` | `1` | Minute step. | | ||
| min-datetime | ISO 8601 `String` | `null` | Minimum datetime. | | ||
| max-datetime | ISO 8601 `String` | `null` | Maximum datetime. | | ||
| auto | `Boolean` | `false` | Auto continue/close on select. | | ||
| week-start | `Number` | auto from locale if _weekstart_ is available or `1` | First day of the week. 1 is Monday and 7 is Sunday. | | ||
| flow | `Array` | Depends of *type* | Customize steps flow, steps available: time, date, month, year. Example: ['year', 'date', 'time'] | | ||
| title | `String` | `''` | Popup title. | | ||
| hide-backdrop | `Boolean` | `false` | Show/Hide backdrop. | | ||
| backdrop-click | `Boolean` | `true` | Enable/Disable backdrop click to cancel (outside click). | | ||
| color | `String` | `#3f51b5` | Color theme of the component | | ||
| fixed-date | `Boolean` | `false` | Enables 'datetime' to have fixed date, input acts like a time picker, returns datetime value | | ||
| fixed-time | `Boolean` | `false` | Enables 'datetime' to have fixed time, input acts like a date picker, returns datetime value | | ||
@@ -150,3 +153,4 @@ Input inherits all props not defined above but `style` and `class` will be inherited by root element. [See inheritAttrs option](https://vuejs.org/v2/api/#inheritAttrs) | ||
Theming is supported by overwriting CSS classes. | ||
Theming is supported by defining a `color` in props. `color` should be a valid css | ||
color option, it's default value is `#3f51b5`. | ||
@@ -153,0 +157,0 @@ ## Development |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
85443
8.43%1522
0.26%182
2.25%