@pencilpix/vue2-clock-picker
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue2-clock-picker",[],t):"object"==typeof exports?exports["vue2-clock-picker"]=t():e["vue2-clock-picker"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){e.exports=function(e,t,i,n,s,o){var r,a=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(r=e,a=e.default);var u="function"==typeof a?a.options:a;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),i&&(u.functional=!0),s&&(u._scopeId=s);var c;if(o?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):n&&(c=n),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),p(e,t)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:r,exports:a,options:u}}},function(e,t,i){"use strict";function n(e){p||i(4)}function s(e){g||i(5)}function o(e){M||i(3)}function r(e){X||i(2)}Object.defineProperty(t,"__esModule",{value:!0});var a={name:"ClockPickerHours",props:{value:{type:String,default:"00"},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{pm:function(){return this.makeArray(13,24)},am:function(){return this.makeArray(1,12)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return e===t?[]:e&&t?this.makeArray(Number(e)+1,Number(t)-1):e?this.makeArray(Number(e)+1,23):t&&t>0?this.makeArray(0,Number(t)-1):[]}},methods:{makeArray:function(e,t){for(var i=[],n=e;n<=t;n++){var s="00"+(n>23?0:n);i.push(s.slice(s.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},itemClass:function(e){var t=Number(e);return 12===t?0:t>12?t-12:t},setValue:function(e){this.$emit("set",e)}}},l=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__hours"},[i("div",{staticClass:"pm"},e._l(e.pm,function(t){return i("div",{key:t,staticClass:"pm__item",class:["pm__item--"+e.itemClass(t),t===e.value?"pm__item--selected":""]},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])})),e._v(" "),i("div",{staticClass:"am"},e._l(e.am,function(t){return i("div",{key:t,staticClass:"am__item",class:"am__item--"+e.itemClass(t)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])}))])},u=[];l._withStripped=!0;var c={render:l,staticRenderFns:u},d=c,p=!1,f=i(0),_=n,m=f(a,d,!1,_,null,null);m.options.__file="src/components/ClockPickerHours.vue";var h=m.exports,v={name:"ClockPickerMinutes",props:{buttonClass:{type:String},value:{type:String},shouldDisableAll:{type:Boolean,default:!1},shouldDisableFrom:{type:Boolean,default:!1},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{minutes:function(){return this.makeArray(0,59)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return this.shouldDisableFrom&&e?this.makeArray(e,59):t?this.makeArray(0,t):[]}},methods:{makeArray:function(e,t){for(var i=[],n=e;n<=t;n++){var s="00"+n;i.push(s.slice(s.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},isSmall:function(e){return Number(e)%5!=0},setValue:function(e){this.$emit("set",e)}}},k=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__minutes"},[i("div",{staticClass:"minutes"},e._l(e.minutes,function(t){return i("div",{key:t,staticClass:"minutes__item",class:(n={"minutes__item--small":e.isSmall(t),"minutes__item--selected":t===e.value},n["minutes__item--"+Number(t)]=!0,n)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)||e.shouldDisableAll},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])]);var n}))])},b=[];k._withStripped=!0;var C={render:k,staticRenderFns:b},y=C,g=!1,S=i(0),V=s,F=S(v,y,!1,V,null,null);F.options.__file="src/components/ClockPickerMinutes.vue";var T=F.exports,E={name:"ClockPickerDialog",props:{disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerHours:h,ClockPickerMinutes:T},data:function(){return{opened:!1,hours:"00",minutes:"00",isHoursSet:!1,isMinutesSet:!1}},computed:{disabledHoursFrom:function(){var e=this.disabledFrom;return e?e.slice(0,2):null},disabledMinutesFrom:function(){var e=this.disabledFrom;return e?e.slice(3):null},disabledHoursTo:function(){var e=this.disabledTo;return e?e.slice(0,2):null},disabledMinutesTo:function(){var e=this.disabledTo;return e?e.slice(3):null}},methods:{open:function(){this.opened=!0},close:function(){this.opened=!1,this.isHoursSet=!1,this.isMinutesSet=!1},cancel:function(){this.$emit("cancel",this.hours+":"+this.minutes)},setHours:function(e){this.hours=e,this.isHoursSet=!0},setMinutes:function(e){this.minutes=e,this.isMinutesSet=!0},done:function(){this.$emit("done",this.hours+":"+this.minutes)}}},x=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__dialog",class:{"clock-picker__dialog--active":e.opened}},[i("transition",{attrs:{name:"fade",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-drop",on:{click:e.close}}):e._e()]),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-body"},[i("div",{staticClass:"clock-picker__dialog-header"},[i("span",{on:{click:function(t){e.isHoursSet=!1}}},[e._v(e._s(e.hours))]),e._v(":"),i("span",[e._v(e._s(e.minutes))])]),e._v(" "),i("div",{staticClass:"clock-picker__dialog-content"},[i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?e._e():i("clock-picker-hours",{attrs:{"disabled-from":e.disabledHoursFrom,"disabled-to":e.disabledHoursTo,value:e.hours},on:{set:function(t){e.setHours(t)}}})],1),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?i("clock-picker-minutes",{attrs:{"should-disable-all":e.isHoursSet&&e.hours<e.disabledHoursTo&&e.hours>e.disabledHoursFrom,"should-disable-from":e.isHoursSet&&e.hours===e.disabledHoursFrom,"disabled-from":e.disabledMinutesFrom,"disabled-to":e.disabledMinutesTo,value:e.minutes},on:{set:function(t){e.setMinutes(t)}}}):e._e()],1)],1),e._v(" "),i("div",{staticClass:"clock-picker__dialog-actions"},[i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:e.cancel}},[e._v("CANCEL")]),e._v(" "),i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:e.done}},[e._v("DONE")])])]):e._e()])],1)},H=[];x._withStripped=!0;var $={render:x,staticRenderFns:H},D=$,M=!1,P=i(0),A=o,R=P(E,D,!1,A,null,null);R.options.__file="src/components/ClockPickerDialog.vue";var N=R.exports,w={container:"clock-picker__input-container",focus:"clock-picker__input--focused",error:"clock-picker__input--error",value:"clock-picker__input--has-value",input:"clock-picker__input"},O={name:"VueClockPicker",props:{inputContainerClass:{type:String,default:w.container},inputClass:{type:String,default:w.input},inputFocusClass:{type:String,default:w.focus},inputErrorClass:{type:String,default:w.error},inputValueClass:{type:String,default:w.value},placeholder:{type:String,default:""},name:{type:String,default:"time_input"},label:{type:String,default:""},required:{type:Boolean,default:!1},value:{type:String,default:""},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerDialog:N},data:function(){return{isFocused:!1,hasValue:!!this.value,dialogOpen:!1,inputValue:this.value,showError:this.inputValue&&!this.isValid()||this.required&&!this.inputValue,isTouched:!1}},computed:{hasError:function(){return this.showError}},methods:{open:function(){var e=this;this.emitEvent("beforeOpen"),this.$refs.dialog.open(),this.$nextTick(function(){e.emitEvent("open")})},close:function(){var e=this;this.emitEvent("beforeClose"),this.$refs.dialog.close(),this.$nextTick(function(){e.emitEvent("close"),e.isTouched=!0})},cancel:function(e){this.emitEvent("cancel",e),this.close()},handleDone:function(e){this.inputValue=e,this.hasValue=!0,this.validate(),this.$emit("timeset",e),this.close()},emitEvent:function(e,t){this.$emit(e,t)},getValue:function(){return this.inputValue},setValue:function(e){this.handleDone(e)},isValid:function(){return/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(this.inputValue)},validate:function(){this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.isTouched=!0}}},j=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker"},[i("div",{class:(n={},n[e.inputContainerClass]=!0,n[e.inputValueClass]=e.hasValue,n[e.inputErrorClass]=e.hasError&&e.isTouched,n[e.inputFocusClass]=e.isFocused,n)},[e.label?i("label",{attrs:{for:"clock_picker_input"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:e.inputValue,expression:"inputValue"}],ref:"input",class:e.inputClass,attrs:{type:"text",id:"clock_picker_input",name:e.name,placeholder:e.placeholder,readonly:""},domProps:{value:e.inputValue},on:{click:e.open,input:function(t){t.target.composing||(e.inputValue=t.target.value)}}}),e._v(" "),e._t("error")],2),e._v(" "),i("clock-picker-dialog",{ref:"dialog",attrs:{"disabled-from":e.disabledFrom,"disabled-to":e.disabledTo},on:{cancel:function(t){e.cancel(t)},done:function(t){e.handleDone(t)}}})],1);var n},q=[];j._withStripped=!0;var B={render:j,staticRenderFns:q},U=B,X=!1,I=i(0),L=r,z=I(O,U,!1,L,null,null);z.options.__file="src/components/ClockPicker.vue";t.default=z.exports},function(e,t){},function(e,t){},function(e,t){},function(e,t){}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue2-clock-picker",[],t):"object"==typeof exports?exports["vue2-clock-picker"]=t():e["vue2-clock-picker"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(s){if(i[s])return i[s].exports;var n=i[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,s){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){e.exports=function(e,t,i,s,n,o){var r,l=e=e||{},a=typeof e.default;"object"!==a&&"function"!==a||(r=e,l=e.default);var u="function"==typeof l?l.options:l;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),i&&(u.functional=!0),n&&(u._scopeId=n);var c;if(o?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):s&&(c=s),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),p(e,t)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:r,exports:l,options:u}}},function(e,t,i){"use strict";function s(e){p||i(4)}function n(e){g||i(5)}function o(e){M||i(3)}function r(e){X||i(2)}Object.defineProperty(t,"__esModule",{value:!0});var l={name:"ClockPickerHours",props:{value:{type:String,default:"00"},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{pm:function(){return this.makeArray(13,24)},am:function(){return this.makeArray(1,12)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return e===t?[]:e&&t?this.makeArray(Number(e)+1,Number(t)-1):e?this.makeArray(Number(e)+1,23):t&&t>0?this.makeArray(0,Number(t)-1):[]}},methods:{makeArray:function(e,t){for(var i=[],s=e;s<=t;s++){var n="00"+(s>23?0:s);i.push(n.slice(n.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},itemClass:function(e){var t=Number(e);return 12===t?0:t>12?t-12:t},setValue:function(e){this.$emit("set",e)}}},a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__hours"},[i("div",{staticClass:"pm"},e._l(e.pm,function(t){return i("div",{key:t,staticClass:"pm__item",class:["pm__item--"+e.itemClass(t),t===e.value?"pm__item--selected":""]},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])})),e._v(" "),i("div",{staticClass:"am"},e._l(e.am,function(t){return i("div",{key:t,staticClass:"am__item",class:"am__item--"+e.itemClass(t)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])}))])},u=[];a._withStripped=!0;var c={render:a,staticRenderFns:u},d=c,p=!1,f=i(0),h=s,m=f(l,d,!1,h,null,null);m.options.__file="src/components/ClockPickerHours.vue";var _=m.exports,v={name:"ClockPickerMinutes",props:{buttonClass:{type:String},value:{type:String},shouldDisableAll:{type:Boolean,default:!1},shouldDisableFrom:{type:Boolean,default:!1},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{minutes:function(){return this.makeArray(0,59)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return this.shouldDisableFrom&&e?this.makeArray(e,59):t?this.makeArray(0,t):[]}},methods:{makeArray:function(e,t){for(var i=[],s=e;s<=t;s++){var n="00"+s;i.push(n.slice(n.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},isSmall:function(e){return Number(e)%5!=0},setValue:function(e){this.$emit("set",e)}}},k=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__minutes"},[i("div",{staticClass:"minutes"},e._l(e.minutes,function(t){return i("div",{key:t,staticClass:"minutes__item",class:(s={"minutes__item--small":e.isSmall(t),"minutes__item--selected":t===e.value},s["minutes__item--"+Number(t)]=!0,s)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)||e.shouldDisableAll},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])]);var s}))])},b=[];k._withStripped=!0;var y={render:k,staticRenderFns:b},C=y,g=!1,S=i(0),V=n,F=S(v,C,!1,V,null,null);F.options.__file="src/components/ClockPickerMinutes.vue";var T=F.exports,E={name:"ClockPickerDialog",props:{disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null},initialValue:{type:String,default:"00:00"}},components:{ClockPickerHours:_,ClockPickerMinutes:T},data:function(){return{opened:!1,hours:this.initialValue.slice(0,2),minutes:this.initialValue.slice(3),isHoursSet:!1,isMinutesSet:!1}},computed:{disabledHoursFrom:function(){var e=this.disabledFrom;return e?e.slice(0,2):null},disabledMinutesFrom:function(){var e=this.disabledFrom;return e?e.slice(3):null},disabledHoursTo:function(){var e=this.disabledTo;return e?e.slice(0,2):null},disabledMinutesTo:function(){var e=this.disabledTo,t=this.isHoursSet,i=this.disabledHoursTo,s=this.hours;return!e||t&&s!==i?null:e.slice(3)},shouldDisableAllMinutes:function(){var e=this.isHoursSet,t=this.hours,i=this.disabledHoursTo,s=this.disabledHoursFrom;return e&&t<i&&t>s},shouldDisableFrom:function(){var e=this.isHoursSet,t=this.hours,i=this.disabledHoursFrom;return e&&t===i}},methods:{open:function(){this.opened=!0},close:function(){this.opened=!1,this.isHoursSet=!1,this.isMinutesSet=!1},cancel:function(){this.$emit("cancel",this.hours+":"+this.minutes),this.hours=this.initialValue.slice(0,2),this.minutes=this.initialValue.slice(3)},setHours:function(e){this.hours=e,this.isHoursSet=!0},setMinutes:function(e){this.minutes=e,this.isMinutesSet=!0},done:function(){this.$emit("done",this.hours+":"+this.minutes)}}},H=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__dialog",class:{"clock-picker__dialog--active":e.opened}},[i("transition",{attrs:{name:"fade",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-drop",on:{click:e.close}}):e._e()]),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-body"},[i("div",{staticClass:"clock-picker__dialog-header"},[i("span",{on:{click:function(t){e.isHoursSet=!1}}},[e._v(e._s(e.hours))]),e._v(":"),i("span",[e._v(e._s(e.minutes))])]),e._v(" "),i("div",{staticClass:"clock-picker__dialog-content"},[i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?e._e():i("clock-picker-hours",{attrs:{"disabled-from":e.disabledHoursFrom,"disabled-to":e.disabledHoursTo,value:e.hours},on:{set:function(t){e.setHours(t)}}})],1),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?i("clock-picker-minutes",{attrs:{"should-disable-all":e.shouldDisableAllMinutes,"should-disable-from":e.shouldDisableFrom,"disabled-from":e.disabledMinutesFrom,"disabled-to":e.disabledMinutesTo,value:e.minutes},on:{set:function(t){e.setMinutes(t)}}}):e._e()],1)],1),e._v(" "),i("div",{staticClass:"clock-picker__dialog-actions"},[i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:e.cancel}},[e._v("CANCEL")]),e._v(" "),i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button",disabled:!e.isHoursSet||!e.isMinutesSet},on:{click:e.done}},[e._v("DONE")])])]):e._e()])],1)},x=[];H._withStripped=!0;var D={render:H,staticRenderFns:x},$=D,M=!1,A=i(0),P=o,R=A(E,$,!1,P,null,null);R.options.__file="src/components/ClockPickerDialog.vue";var N=R.exports,w={container:"clock-picker__input-container",focus:"clock-picker__input--focused",error:"clock-picker__input--error",value:"clock-picker__input--has-value",input:"clock-picker__input"},O={name:"VueClockPicker",props:{inputContainerClass:{type:String,default:w.container},inputClass:{type:String,default:w.input},inputFocusClass:{type:String,default:w.focus},inputErrorClass:{type:String,default:w.error},inputValueClass:{type:String,default:w.value},placeholder:{type:String,default:""},name:{type:String,default:"time_input"},label:{type:String,default:""},required:{type:Boolean,default:!1},value:{type:String,default:""},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerDialog:N},data:function(){return{isFocused:!1,hasValue:!!this.value,dialogOpen:!1,inputValue:this.value,showError:this.inputValue&&!this.isValid()||this.required&&!this.inputValue,isTouched:!1}},computed:{hasError:function(){return this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.showError}},methods:{open:function(){var e=this;this.emitEvent("beforeOpen"),this.$refs.dialog.open(),this.$nextTick(function(){e.emitEvent("open")})},close:function(){var e=this;this.emitEvent("beforeClose"),this.$refs.dialog.close(),this.$nextTick(function(){e.emitEvent("close"),e.isTouched=!0})},cancel:function(e){this.emitEvent("cancel",e),this.close()},handleDone:function(e){this.inputValue=e,this.hasValue=!0,this.validate(),this.$emit("timeset",e),this.close()},emitEvent:function(e,t){this.$emit(e,t)},getValue:function(){return this.inputValue},setValue:function(e){this.handleDone(e)},isValid:function(){return/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(this.inputValue)},validate:function(){this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.isTouched=!0}}},j=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker"},[i("div",{class:(s={},s[e.inputContainerClass]=!0,s[e.inputValueClass]=e.hasValue,s[e.inputErrorClass]=e.hasError&&e.isTouched,s[e.inputFocusClass]=e.isFocused,s)},[e.label?i("label",{attrs:{for:"clock_picker_input"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:e.inputValue,expression:"inputValue"}],ref:"input",class:e.inputClass,attrs:{type:"text",id:"clock_picker_input",name:e.name,placeholder:e.placeholder,readonly:""},domProps:{value:e.inputValue},on:{click:e.open,input:function(t){t.target.composing||(e.inputValue=t.target.value)}}}),e._v(" "),e._t("error")],2),e._v(" "),i("clock-picker-dialog",{ref:"dialog",attrs:{"initial-value":e.inputValue||"00:00","disabled-from":e.disabledFrom,"disabled-to":e.disabledTo},on:{cancel:function(t){e.cancel(t)},done:function(t){e.handleDone(t)}}})],1);var s},q=[];j._withStripped=!0;var B={render:j,staticRenderFns:q},U=B,X=!1,I=i(0),L=r,z=I(O,U,!1,L,null,null);z.options.__file="src/components/ClockPicker.vue";t.default=z.exports},function(e,t){},function(e,t){},function(e,t){},function(e,t){}])}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueClockPicker=t():e.VueClockPicker=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){e.exports=function(e,t,i,n,s,o){var r,a=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(r=e,a=e.default);var u="function"==typeof a?a.options:a;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),i&&(u.functional=!0),s&&(u._scopeId=s);var c;if(o?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):n&&(c=n),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),p(e,t)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:r,exports:a,options:u}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){var n=i(3),s=null,o={install:function(e){e.component("VueClockPicker",n.a)}};"undefined"!=typeof window?s=window.Vue:void 0!==e&&(s=e.Vue),s&&s.use(o),t.default=o}.call(t,i(2))},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";function n(e){p||i(6)}function s(e){g||i(7)}function o(e){w||i(5)}function r(e){X||i(4)}var a={name:"ClockPickerHours",props:{value:{type:String,default:"00"},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{pm:function(){return this.makeArray(13,24)},am:function(){return this.makeArray(1,12)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return e===t?[]:e&&t?this.makeArray(Number(e)+1,Number(t)-1):e?this.makeArray(Number(e)+1,23):t&&t>0?this.makeArray(0,Number(t)-1):[]}},methods:{makeArray:function(e,t){for(var i=[],n=e;n<=t;n++){var s="00"+(n>23?0:n);i.push(s.slice(s.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},itemClass:function(e){var t=Number(e);return 12===t?0:t>12?t-12:t},setValue:function(e){this.$emit("set",e)}}},l=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__hours"},[i("div",{staticClass:"pm"},e._l(e.pm,function(t){return i("div",{key:t,staticClass:"pm__item",class:["pm__item--"+e.itemClass(t),t===e.value?"pm__item--selected":""]},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])})),e._v(" "),i("div",{staticClass:"am"},e._l(e.am,function(t){return i("div",{key:t,staticClass:"am__item",class:"am__item--"+e.itemClass(t)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])])}))])},u=[];l._withStripped=!0;var c={render:l,staticRenderFns:u},d=c,p=!1,f=i(0),_=n,m=f(a,d,!1,_,null,null);m.options.__file="src/components/ClockPickerHours.vue";var h=m.exports,v={name:"ClockPickerMinutes",props:{buttonClass:{type:String},value:{type:String},shouldDisableAll:{type:Boolean,default:!1},shouldDisableFrom:{type:Boolean,default:!1},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{minutes:function(){return this.makeArray(0,59)},disabledRange:function(){var e=this.disabledFrom,t=this.disabledTo;return this.shouldDisableFrom&&e?this.makeArray(e,59):t?this.makeArray(0,t):[]}},methods:{makeArray:function(e,t){for(var i=[],n=e;n<=t;n++){var s="00"+n;i.push(s.slice(s.length-2))}return i},isDisabled:function(e){return this.disabledRange.includes(e)},isSmall:function(e){return Number(e)%5!=0},setValue:function(e){this.$emit("set",e)}}},k=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__minutes"},[i("div",{staticClass:"minutes"},e._l(e.minutes,function(t){return i("div",{key:t,staticClass:"minutes__item",class:(n={"minutes__item--small":e.isSmall(t),"minutes__item--selected":t===e.value},n["minutes__item--"+Number(t)]=!0,n)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":t===e.value},attrs:{type:"button",disabled:e.isDisabled(t)||e.shouldDisableAll},on:{click:function(i){e.setValue(t)}}},[e._v("\n "+e._s(t)+"\n ")])]);var n}))])},b=[];k._withStripped=!0;var C={render:k,staticRenderFns:b},y=C,g=!1,S=i(0),V=s,F=S(v,y,!1,V,null,null);F.options.__file="src/components/ClockPickerMinutes.vue";var T=F.exports,E={name:"ClockPickerDialog",props:{disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerHours:h,ClockPickerMinutes:T},data:function(){return{opened:!1,hours:"00",minutes:"00",isHoursSet:!1,isMinutesSet:!1}},computed:{disabledHoursFrom:function(){var e=this.disabledFrom;return e?e.slice(0,2):null},disabledMinutesFrom:function(){var e=this.disabledFrom;return e?e.slice(3):null},disabledHoursTo:function(){var e=this.disabledTo;return e?e.slice(0,2):null},disabledMinutesTo:function(){var e=this.disabledTo;return e?e.slice(3):null}},methods:{open:function(){this.opened=!0},close:function(){this.opened=!1,this.isHoursSet=!1,this.isMinutesSet=!1},cancel:function(){this.$emit("cancel",this.hours+":"+this.minutes)},setHours:function(e){this.hours=e,this.isHoursSet=!0},setMinutes:function(e){this.minutes=e,this.isMinutesSet=!0},done:function(){this.$emit("done",this.hours+":"+this.minutes)}}},x=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker__dialog",class:{"clock-picker__dialog--active":e.opened}},[i("transition",{attrs:{name:"fade",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-drop",on:{click:e.close}}):e._e()]),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.opened?i("div",{staticClass:"clock-picker__dialog-body"},[i("div",{staticClass:"clock-picker__dialog-header"},[i("span",{on:{click:function(t){e.isHoursSet=!1}}},[e._v(e._s(e.hours))]),e._v(":"),i("span",[e._v(e._s(e.minutes))])]),e._v(" "),i("div",{staticClass:"clock-picker__dialog-content"},[i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?e._e():i("clock-picker-hours",{attrs:{"disabled-from":e.disabledHoursFrom,"disabled-to":e.disabledHoursTo,value:e.hours},on:{set:function(t){e.setHours(t)}}})],1),e._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[e.isHoursSet?i("clock-picker-minutes",{attrs:{"should-disable-all":e.isHoursSet&&e.hours<e.disabledHoursTo&&e.hours>e.disabledHoursFrom,"should-disable-from":e.isHoursSet&&e.hours===e.disabledHoursFrom,"disabled-from":e.disabledMinutesFrom,"disabled-to":e.disabledMinutesTo,value:e.minutes},on:{set:function(t){e.setMinutes(t)}}}):e._e()],1)],1),e._v(" "),i("div",{staticClass:"clock-picker__dialog-actions"},[i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:e.cancel}},[e._v("CANCEL")]),e._v(" "),i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:e.done}},[e._v("DONE")])])]):e._e()])],1)},H=[];x._withStripped=!0;var $={render:x,staticRenderFns:H},P=$,w=!1,D=i(0),M=o,A=D(E,P,!1,M,null,null);A.options.__file="src/components/ClockPickerDialog.vue";var R=A.exports,N={container:"clock-picker__input-container",focus:"clock-picker__input--focused",error:"clock-picker__input--error",value:"clock-picker__input--has-value",input:"clock-picker__input"},j={name:"VueClockPicker",props:{inputContainerClass:{type:String,default:N.container},inputClass:{type:String,default:N.input},inputFocusClass:{type:String,default:N.focus},inputErrorClass:{type:String,default:N.error},inputValueClass:{type:String,default:N.value},placeholder:{type:String,default:""},name:{type:String,default:"time_input"},label:{type:String,default:""},required:{type:Boolean,default:!1},value:{type:String,default:""},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerDialog:R},data:function(){return{isFocused:!1,hasValue:!!this.value,dialogOpen:!1,inputValue:this.value,showError:this.inputValue&&!this.isValid()||this.required&&!this.inputValue,isTouched:!1}},computed:{hasError:function(){return this.showError}},methods:{open:function(){var e=this;this.emitEvent("beforeOpen"),this.$refs.dialog.open(),this.$nextTick(function(){e.emitEvent("open")})},close:function(){var e=this;this.emitEvent("beforeClose"),this.$refs.dialog.close(),this.$nextTick(function(){e.emitEvent("close"),e.isTouched=!0})},cancel:function(e){this.emitEvent("cancel",e),this.close()},handleDone:function(e){this.inputValue=e,this.hasValue=!0,this.validate(),this.$emit("timeset",e),this.close()},emitEvent:function(e,t){this.$emit(e,t)},getValue:function(){return this.inputValue},setValue:function(e){this.handleDone(e)},isValid:function(){return/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(this.inputValue)},validate:function(){this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.isTouched=!0}}},O=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"clock-picker"},[i("div",{class:(n={},n[e.inputContainerClass]=!0,n[e.inputValueClass]=e.hasValue,n[e.inputErrorClass]=e.hasError&&e.isTouched,n[e.inputFocusClass]=e.isFocused,n)},[e.label?i("label",{attrs:{for:"clock_picker_input"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:e.inputValue,expression:"inputValue"}],ref:"input",class:e.inputClass,attrs:{type:"text",id:"clock_picker_input",name:e.name,placeholder:e.placeholder,readonly:""},domProps:{value:e.inputValue},on:{click:e.open,input:function(t){t.target.composing||(e.inputValue=t.target.value)}}}),e._v(" "),e._t("error")],2),e._v(" "),i("clock-picker-dialog",{ref:"dialog",attrs:{"disabled-from":e.disabledFrom,"disabled-to":e.disabledTo},on:{cancel:function(t){e.cancel(t)},done:function(t){e.handleDone(t)}}})],1);var n},q=[];O._withStripped=!0;var B={render:O,staticRenderFns:q},U=B,X=!1,I=i(0),L=r,z=I(j,U,!1,L,null,null);z.options.__file="src/components/ClockPicker.vue";t.a=z.exports},function(e,t){},function(e,t){},function(e,t){},function(e,t){}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueClockPicker=e():t.VueClockPicker=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var n=i[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,s){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:s})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e){t.exports=function(t,e,i,s,n,o){var r,l=t=t||{},a=typeof t.default;"object"!==a&&"function"!==a||(r=t,l=t.default);var u="function"==typeof l?l.options:l;e&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0),i&&(u.functional=!0),n&&(u._scopeId=n);var c;if(o?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},u._ssrRegister=c):s&&(c=s),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(t,e){return c.call(e),p(t,e)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:r,exports:l,options:u}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var s=i(3),n=null,o={install:function(t){t.component("VueClockPicker",s.a)}};"undefined"!=typeof window?n=window.Vue:void 0!==t&&(n=t.Vue),n&&n.use(o),e.default=o}.call(e,i(2))},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";function s(t){p||i(6)}function n(t){g||i(7)}function o(t){w||i(5)}function r(t){X||i(4)}var l={name:"ClockPickerHours",props:{value:{type:String,default:"00"},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{pm:function(){return this.makeArray(13,24)},am:function(){return this.makeArray(1,12)},disabledRange:function(){var t=this.disabledFrom,e=this.disabledTo;return t===e?[]:t&&e?this.makeArray(Number(t)+1,Number(e)-1):t?this.makeArray(Number(t)+1,23):e&&e>0?this.makeArray(0,Number(e)-1):[]}},methods:{makeArray:function(t,e){for(var i=[],s=t;s<=e;s++){var n="00"+(s>23?0:s);i.push(n.slice(n.length-2))}return i},isDisabled:function(t){return this.disabledRange.includes(t)},itemClass:function(t){var e=Number(t);return 12===e?0:e>12?e-12:e},setValue:function(t){this.$emit("set",t)}}},a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"clock-picker__hours"},[i("div",{staticClass:"pm"},t._l(t.pm,function(e){return i("div",{key:e,staticClass:"pm__item",class:["pm__item--"+t.itemClass(e),e===t.value?"pm__item--selected":""]},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":e===t.value},attrs:{type:"button",disabled:t.isDisabled(e)},on:{click:function(i){t.setValue(e)}}},[t._v("\n "+t._s(e)+"\n ")])])})),t._v(" "),i("div",{staticClass:"am"},t._l(t.am,function(e){return i("div",{key:e,staticClass:"am__item",class:"am__item--"+t.itemClass(e)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":e===t.value},attrs:{type:"button",disabled:t.isDisabled(e)},on:{click:function(i){t.setValue(e)}}},[t._v("\n "+t._s(e)+"\n ")])])}))])},u=[];a._withStripped=!0;var c={render:a,staticRenderFns:u},d=c,p=!1,f=i(0),h=s,m=f(l,d,!1,h,null,null);m.options.__file="src/components/ClockPickerHours.vue";var _=m.exports,v={name:"ClockPickerMinutes",props:{buttonClass:{type:String},value:{type:String},shouldDisableAll:{type:Boolean,default:!1},shouldDisableFrom:{type:Boolean,default:!1},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},data:function(){return{}},computed:{minutes:function(){return this.makeArray(0,59)},disabledRange:function(){var t=this.disabledFrom,e=this.disabledTo;return this.shouldDisableFrom&&t?this.makeArray(t,59):e?this.makeArray(0,e):[]}},methods:{makeArray:function(t,e){for(var i=[],s=t;s<=e;s++){var n="00"+s;i.push(n.slice(n.length-2))}return i},isDisabled:function(t){return this.disabledRange.includes(t)},isSmall:function(t){return Number(t)%5!=0},setValue:function(t){this.$emit("set",t)}}},k=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"clock-picker__minutes"},[i("div",{staticClass:"minutes"},t._l(t.minutes,function(e){return i("div",{key:e,staticClass:"minutes__item",class:(s={"minutes__item--small":t.isSmall(e),"minutes__item--selected":e===t.value},s["minutes__item--"+Number(e)]=!0,s)},[i("button",{staticClass:"clock-picker__button",class:{"clock-picker__button--active":e===t.value},attrs:{type:"button",disabled:t.isDisabled(e)||t.shouldDisableAll},on:{click:function(i){t.setValue(e)}}},[t._v("\n "+t._s(e)+"\n ")])]);var s}))])},b=[];k._withStripped=!0;var y={render:k,staticRenderFns:b},C=y,g=!1,S=i(0),V=n,F=S(v,C,!1,V,null,null);F.options.__file="src/components/ClockPickerMinutes.vue";var T=F.exports,E={name:"ClockPickerDialog",props:{disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null},initialValue:{type:String,default:"00:00"}},components:{ClockPickerHours:_,ClockPickerMinutes:T},data:function(){return{opened:!1,hours:this.initialValue.slice(0,2),minutes:this.initialValue.slice(3),isHoursSet:!1,isMinutesSet:!1}},computed:{disabledHoursFrom:function(){var t=this.disabledFrom;return t?t.slice(0,2):null},disabledMinutesFrom:function(){var t=this.disabledFrom;return t?t.slice(3):null},disabledHoursTo:function(){var t=this.disabledTo;return t?t.slice(0,2):null},disabledMinutesTo:function(){var t=this.disabledTo,e=this.isHoursSet,i=this.disabledHoursTo,s=this.hours;return!t||e&&s!==i?null:t.slice(3)},shouldDisableAllMinutes:function(){var t=this.isHoursSet,e=this.hours,i=this.disabledHoursTo,s=this.disabledHoursFrom;return t&&e<i&&e>s},shouldDisableFrom:function(){var t=this.isHoursSet,e=this.hours,i=this.disabledHoursFrom;return t&&e===i}},methods:{open:function(){this.opened=!0},close:function(){this.opened=!1,this.isHoursSet=!1,this.isMinutesSet=!1},cancel:function(){this.$emit("cancel",this.hours+":"+this.minutes),this.hours=this.initialValue.slice(0,2),this.minutes=this.initialValue.slice(3)},setHours:function(t){this.hours=t,this.isHoursSet=!0},setMinutes:function(t){this.minutes=t,this.isMinutesSet=!0},done:function(){this.$emit("done",this.hours+":"+this.minutes)}}},H=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"clock-picker__dialog",class:{"clock-picker__dialog--active":t.opened}},[i("transition",{attrs:{name:"fade",mode:"out-in"}},[t.opened?i("div",{staticClass:"clock-picker__dialog-drop",on:{click:t.close}}):t._e()]),t._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[t.opened?i("div",{staticClass:"clock-picker__dialog-body"},[i("div",{staticClass:"clock-picker__dialog-header"},[i("span",{on:{click:function(e){t.isHoursSet=!1}}},[t._v(t._s(t.hours))]),t._v(":"),i("span",[t._v(t._s(t.minutes))])]),t._v(" "),i("div",{staticClass:"clock-picker__dialog-content"},[i("transition",{attrs:{name:"scale",mode:"out-in"}},[t.isHoursSet?t._e():i("clock-picker-hours",{attrs:{"disabled-from":t.disabledHoursFrom,"disabled-to":t.disabledHoursTo,value:t.hours},on:{set:function(e){t.setHours(e)}}})],1),t._v(" "),i("transition",{attrs:{name:"scale",mode:"out-in"}},[t.isHoursSet?i("clock-picker-minutes",{attrs:{"should-disable-all":t.shouldDisableAllMinutes,"should-disable-from":t.shouldDisableFrom,"disabled-from":t.disabledMinutesFrom,"disabled-to":t.disabledMinutesTo,value:t.minutes},on:{set:function(e){t.setMinutes(e)}}}):t._e()],1)],1),t._v(" "),i("div",{staticClass:"clock-picker__dialog-actions"},[i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button"},on:{click:t.cancel}},[t._v("CANCEL")]),t._v(" "),i("button",{staticClass:"clock-picker__dialog-action",attrs:{type:"button",disabled:!t.isHoursSet||!t.isMinutesSet},on:{click:t.done}},[t._v("DONE")])])]):t._e()])],1)},x=[];H._withStripped=!0;var D={render:H,staticRenderFns:x},$=D,w=!1,M=i(0),P=o,A=M(E,$,!1,P,null,null);A.options.__file="src/components/ClockPickerDialog.vue";var R=A.exports,N={container:"clock-picker__input-container",focus:"clock-picker__input--focused",error:"clock-picker__input--error",value:"clock-picker__input--has-value",input:"clock-picker__input"},j={name:"VueClockPicker",props:{inputContainerClass:{type:String,default:N.container},inputClass:{type:String,default:N.input},inputFocusClass:{type:String,default:N.focus},inputErrorClass:{type:String,default:N.error},inputValueClass:{type:String,default:N.value},placeholder:{type:String,default:""},name:{type:String,default:"time_input"},label:{type:String,default:""},required:{type:Boolean,default:!1},value:{type:String,default:""},disabledFrom:{type:String,default:null},disabledTo:{type:String,default:null}},components:{ClockPickerDialog:R},data:function(){return{isFocused:!1,hasValue:!!this.value,dialogOpen:!1,inputValue:this.value,showError:this.inputValue&&!this.isValid()||this.required&&!this.inputValue,isTouched:!1}},computed:{hasError:function(){return this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.showError}},methods:{open:function(){var t=this;this.emitEvent("beforeOpen"),this.$refs.dialog.open(),this.$nextTick(function(){t.emitEvent("open")})},close:function(){var t=this;this.emitEvent("beforeClose"),this.$refs.dialog.close(),this.$nextTick(function(){t.emitEvent("close"),t.isTouched=!0})},cancel:function(t){this.emitEvent("cancel",t),this.close()},handleDone:function(t){this.inputValue=t,this.hasValue=!0,this.validate(),this.$emit("timeset",t),this.close()},emitEvent:function(t,e){this.$emit(t,e)},getValue:function(){return this.inputValue},setValue:function(t){this.handleDone(t)},isValid:function(){return/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(this.inputValue)},validate:function(){this.showError=this.inputValue&&!this.isValid()||this.required&&!this.inputValue,this.isTouched=!0}}},O=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"clock-picker"},[i("div",{class:(s={},s[t.inputContainerClass]=!0,s[t.inputValueClass]=t.hasValue,s[t.inputErrorClass]=t.hasError&&t.isTouched,s[t.inputFocusClass]=t.isFocused,s)},[t.label?i("label",{attrs:{for:"clock_picker_input"}},[t._v(t._s(t.label))]):t._e(),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.inputValue,expression:"inputValue"}],ref:"input",class:t.inputClass,attrs:{type:"text",id:"clock_picker_input",name:t.name,placeholder:t.placeholder,readonly:""},domProps:{value:t.inputValue},on:{click:t.open,input:function(e){e.target.composing||(t.inputValue=e.target.value)}}}),t._v(" "),t._t("error")],2),t._v(" "),i("clock-picker-dialog",{ref:"dialog",attrs:{"initial-value":t.inputValue||"00:00","disabled-from":t.disabledFrom,"disabled-to":t.disabledTo},on:{cancel:function(e){t.cancel(e)},done:function(e){t.handleDone(e)}}})],1);var s},q=[];O._withStripped=!0;var B={render:O,staticRenderFns:q},U=B,X=!1,I=i(0),L=r,z=I(j,U,!1,L,null,null);z.options.__file="src/components/ClockPicker.vue";e.a=z.exports},function(t,e){},function(t,e){},function(t,e){},function(t,e){}])}); |
{ | ||
"name": "@pencilpix/vue2-clock-picker", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "vuejs clock picker component", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue2-clock-picker.js", |
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
383871
25