From cf2ebdc9230b4b3aaa6becd9472cd60d58095452 Mon Sep 17 00:00:00 2001 From: weifeiyue Date: Tue, 24 Jul 2018 09:53:54 +0800 Subject: [PATCH] enable future dates for start date #57 --- dist/vue-datepicker-local.css | 4 ++-- dist/vue-datepicker-local.js | 4 ++-- example/App.vue | 4 ++-- package.json | 2 +- src/VueDatepickerLocalCalendar.vue | 10 ++++++---- webpack.config.js | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dist/vue-datepicker-local.css b/dist/vue-datepicker-local.css index 850934f..145b14a 100644 --- a/dist/vue-datepicker-local.css +++ b/dist/vue-datepicker-local.css @@ -1,6 +1,6 @@ /*! - * vue-datetime-local.js v1.0.15 + * vue-datetime-local.js v1.0.16 * (c) 2017-2018 weifeiyue * Released under the MIT License. */ -.datepicker{display:inline-block;position:relative}.datepicker:before{content:"";display:block;background:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiPjxwYXRoIGQ9Ik01NjQgMTgwLjJINDQ4Yy04LjMgMC0xNS02LjctMTUtMTVzNi43LTE1IDE1LTE1aDExNmM4LjIgMCAxNSA2LjcgMTUgMTVzLTYuOCAxNS0xNSAxNXoiIGZpbGw9IiM5ODk4OTgiLz48cGF0aCBkPSJNOTQ1IDk1Mi4ySDgxLjJjLTguMiAwLTE1LTYuNy0xNS0xNVYxNjIuOGMwLTguMyA2LjgtMTUgMTUtMTVIMjk0YzguMiAwIDE1IDYuNyAxNSAxNXMtNi44IDE1LTE1IDE1SDk2LjJ2NzQ0LjRIOTMwVjE3Ny44SDcxMy42Yy04LjMgMC0xNS02LjctMTUtMTVzNi43LTE1IDE1LTE1SDk0NWM4LjIgMCAxNSA2LjcgMTUgMTV2Nzc0LjRjMCA4LjMtNi44IDE1LTE1IDE1eiIgZmlsbD0iIzk4OTg5OCIvPjxwYXRoIGQ9Ik0zMzMuMyA1NTFIMjE2Yy04LjIgMC0xNS02LjgtMTUtMTVzNi44LTE1IDE1LTE1aDExNy4zYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1em0yMzAuMyAwSDQ0Ni4zYy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4zYzguMiAwIDE1IDYuNiAxNSAxNXMtNi44IDE1LTE1IDE1em0yMzAuMiAwSDY3Ni42Yy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4yYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1ek0zMzMuMyA3NDBIMjE2Yy04LjIgMC0xNS02LjgtMTUtMTVzNi44LTE1IDE1LTE1aDExNy4zYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1em0yMzAuMyAwSDQ0Ni4zYy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4zYzguMiAwIDE1IDYuNiAxNSAxNXMtNi44IDE1LTE1IDE1em0yMzAuMiAwSDY3Ni42Yy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4yYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1ek0zNzAuOCAyNTguNmMtOC4zIDAtMTUtNi43LTE1LTE1Vjg2LjhjMC04LjIgNi43LTE1IDE1LTE1czE1IDYuOCAxNSAxNXYxNTYuOGMwIDguMy02LjcgMTUtMTUgMTV6bTI3MC4yIDBjLTguMyAwLTE1LTYuNy0xNS0xNVY4Ni44YzAtOC4yIDYuNy0xNSAxNS0xNXMxNSA2LjggMTUgMTV2MTU2LjhjMCA4LjMtNi43IDE1LTE1IDE1ek05NDUgMzcyLjJIODEuMmMtOC4yIDAtMTUtNi43LTE1LTE1czYuOC0xNSAxNS0xNUg5NDVjOC4yIDAgMTUgNi43IDE1IDE1cy02LjggMTUtMTUgMTV6IiBmaWxsPSIjOTg5ODk4Ii8+PC9zdmc+") no-repeat 50% 50%}.datepicker-close,.datepicker:before{position:absolute;width:34px;height:100%;top:0;right:0}.datepicker-close{display:none;cursor:pointer}.datepicker-close:before{display:block;content:"";position:absolute;width:16px;height:16px;left:50%;top:50%;margin-left:-8px;margin-top:-8px;text-align:center;background:#ccc;color:#fff;border-radius:50%;background:#ccc url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3IDciIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik01LjU4LDVsMi44LTIuODFBLjQxLjQxLDAsMSwwLDcuOCwxLjZMNSw0LjQxLDIuMiwxLjZhLjQxLjQxLDAsMCwwLS41OC41OGgwTDQuNDIsNSwxLjYyLDcuOGEuNDEuNDEsMCwwLDAsLjU4LjU4TDUsNS41OCw3LjgsOC4zOWEuNDEuNDEsMCwwLDAsLjU4LS41OGgwWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuNSAtMS40OCkiIHN0eWxlPSJmaWxsOiNmZmYiLz48L3N2Zz4NCg==") no-repeat 50% 50%}.datepicker__clearable:hover:before{display:none}.datepicker__clearable:hover .datepicker-close{display:block}.datepicker-close:hover:before{background-color:#afafaf}.datepicker>input{color:#666;transition:all .2s ease;border:1px solid #e5e5e5;height:34px;box-sizing:border-box;outline:none;padding:0 34px 0 12px;font-size:14px;width:100%;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none}.datepicker>input.focus{border-color:#3bb4f2;-webkit-box-shadow:0 0 5px rgba(59,180,242,.3);box-shadow:0 0 5px rgba(59,180,242,.3)}.datepicker>input:disabled{cursor:not-allowed;background-color:#ebebe4;border-color:#e5e5e5;-webkit-box-shadow:none;box-shadow:none}.datepicker-popup{position:absolute;transition:all .2s ease;opacity:1;transform:scaleY(1);transform-origin:center top;font-size:12px;background:#fff;border:1px solid #d9d9d9;box-shadow:0 1px 6px rgba(99,99,99,.2);margin-top:2px;outline:0;padding:5px;overflow:hidden;z-index:999}.datepicker-inline{position:relative;margin-top:0}.datepicker-range{min-width:325px}.datepicker-range .datepicker-popup{width:403px}.datepicker-bottom{float:left;width:100%;text-align:right}.datepicker-btn{padding:5px 10px;background:#1284e7;color:#fff;border-radius:2px;display:inline-block;cursor:pointer}.datepicker-anim-enter-active{transform-origin:0 0;animation:datepicker-anim-in .2s cubic-bezier(.23,1,.32,1)}.datepicker-anim-leave-active{transform-origin:0 0;animation:datepicker-anim-out .2s cubic-bezier(.755,.05,.855,.06)}.datepicker__buttons{display:block;text-align:right}.datepicker__buttons button{display:inline-block;font-size:13px;border:none;cursor:pointer;margin:10px 0 0 5px;padding:5px 15px;color:#fff}.datepicker__buttons .datepicker__button-select{background:#1284e7}.datepicker__buttons .datepicker__button-cancel{background:#666}@keyframes datepicker-anim-in{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scaleY(1)}}@keyframes datepicker-anim-out{0%{opacity:1;transform:scaleY(1)}to{opacity:0;transform:scaleY(.8)}}.calendar{float:left;display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.calendar+.calendar{border-left:1px solid #eaeaea;margin-left:5px;padding-left:5px}.calendar-head{line-height:34px;height:34px;text-align:center;position:relative}.calendar-head a{color:#666;font-weight:700;cursor:pointer;display:inline-block;text-align:center;position:absolute;padding:0 5px;font-size:16px}.calendar-head a:hover{color:#1284e7}.calendar-head .calendar-month-select,.calendar-head .calendar-year-select{font-size:12px;padding:0 2px;position:relative}.calendar-prev-decade-btn,.calendar-prev-year-btn{left:6px}.calendar-prev-month-btn{left:24px}.calendar-next-decade-btn,.calendar-next-year-btn{right:6px}.calendar-next-month-btn{right:24px}.calendar-body{position:relative;width:196px;height:196px}.calendar-days{width:100%;height:100%}.calendar-date,.calendar-week{font-weight:400;width:14.28%;height:14.28%;text-align:center;box-sizing:border-box;display:inline-block;overflow:hidden;float:left}.calendar-date:before,.calendar-week:before{content:"";display:inline-block;height:100%;vertical-align:middle}.calendar-date{cursor:pointer}.calendar-date-out{color:#ccc}.calendar-date-on,.calendar-date:hover{background:#eaf8fe}.calendar-date-selected,.calendar-date-selected:hover{color:#fff;font-weight:700;background:#1284e7}.calendar-date-disabled{cursor:not-allowed!important;color:#bcbcbc!important;background:#f3f3f3!important}.calendar-foot{margin-top:5px}.calendar-hour{display:inline-block;border:1px solid #e6e5e5;color:#9e9e9e}.calendar-hour a{display:inline-block;padding:2px 4px;cursor:pointer}.calendar-hour a.on,.calendar-hour a:hover{color:#1284e7}.calendar-hours,.calendar-minutes,.calendar-months,.calendar-seconds,.calendar-years{width:100%;height:100%;position:absolute;background:#fff;left:0;top:0}.calendar-months a,.calendar-years a{width:33.33%;height:25%}.calendar-hours a{width:20%;height:20%}.calendar-minutes a,.calendar-seconds a{width:16.66%;height:10%}.calendar-title{margin-top:-30px;height:30px;line-height:30px;background:#fff;text-align:center;font-weight:700} \ No newline at end of file +.datepicker{display:inline-block;position:relative}.datepicker:before{content:"";display:block;background:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiPjxwYXRoIGQ9Ik01NjQgMTgwLjJINDQ4Yy04LjMgMC0xNS02LjctMTUtMTVzNi43LTE1IDE1LTE1aDExNmM4LjIgMCAxNSA2LjcgMTUgMTVzLTYuOCAxNS0xNSAxNXoiIGZpbGw9IiM5ODk4OTgiLz48cGF0aCBkPSJNOTQ1IDk1Mi4ySDgxLjJjLTguMiAwLTE1LTYuNy0xNS0xNVYxNjIuOGMwLTguMyA2LjgtMTUgMTUtMTVIMjk0YzguMiAwIDE1IDYuNyAxNSAxNXMtNi44IDE1LTE1IDE1SDk2LjJ2NzQ0LjRIOTMwVjE3Ny44SDcxMy42Yy04LjMgMC0xNS02LjctMTUtMTVzNi43LTE1IDE1LTE1SDk0NWM4LjIgMCAxNSA2LjcgMTUgMTV2Nzc0LjRjMCA4LjMtNi44IDE1LTE1IDE1eiIgZmlsbD0iIzk4OTg5OCIvPjxwYXRoIGQ9Ik0zMzMuMyA1NTFIMjE2Yy04LjIgMC0xNS02LjgtMTUtMTVzNi44LTE1IDE1LTE1aDExNy4zYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1em0yMzAuMyAwSDQ0Ni4zYy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4zYzguMiAwIDE1IDYuNiAxNSAxNXMtNi44IDE1LTE1IDE1em0yMzAuMiAwSDY3Ni42Yy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4yYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1ek0zMzMuMyA3NDBIMjE2Yy04LjIgMC0xNS02LjgtMTUtMTVzNi44LTE1IDE1LTE1aDExNy4zYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1em0yMzAuMyAwSDQ0Ni4zYy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4zYzguMiAwIDE1IDYuNiAxNSAxNXMtNi44IDE1LTE1IDE1em0yMzAuMiAwSDY3Ni42Yy04LjMgMC0xNS02LjgtMTUtMTVzNi43LTE1IDE1LTE1aDExNy4yYzguMyAwIDE1IDYuNiAxNSAxNXMtNi43IDE1LTE1IDE1ek0zNzAuOCAyNTguNmMtOC4zIDAtMTUtNi43LTE1LTE1Vjg2LjhjMC04LjIgNi43LTE1IDE1LTE1czE1IDYuOCAxNSAxNXYxNTYuOGMwIDguMy02LjcgMTUtMTUgMTV6bTI3MC4yIDBjLTguMyAwLTE1LTYuNy0xNS0xNVY4Ni44YzAtOC4yIDYuNy0xNSAxNS0xNXMxNSA2LjggMTUgMTV2MTU2LjhjMCA4LjMtNi43IDE1LTE1IDE1ek05NDUgMzcyLjJIODEuMmMtOC4yIDAtMTUtNi43LTE1LTE1czYuOC0xNSAxNS0xNUg5NDVjOC4yIDAgMTUgNi43IDE1IDE1cy02LjggMTUtMTUgMTV6IiBmaWxsPSIjOTg5ODk4Ii8+PC9zdmc+") no-repeat 50% 50%}.datepicker-close,.datepicker:before{position:absolute;width:34px;height:100%;top:0;right:0}.datepicker-close{display:none;cursor:pointer}.datepicker-close:before{display:block;content:"";position:absolute;width:16px;height:16px;left:50%;top:50%;margin-left:-8px;margin-top:-8px;text-align:center;background:#ccc;color:#fff;border-radius:50%;background:#ccc url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3IDciIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik01LjU4LDVsMi44LTIuODFBLjQxLjQxLDAsMSwwLDcuOCwxLjZMNSw0LjQxLDIuMiwxLjZhLjQxLjQxLDAsMCwwLS41OC41OGgwTDQuNDIsNSwxLjYyLDcuOGEuNDEuNDEsMCwwLDAsLjU4LjU4TDUsNS41OCw3LjgsOC4zOWEuNDEuNDEsMCwwLDAsLjU4LS41OGgwWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuNSAtMS40OCkiIHN0eWxlPSJmaWxsOiNmZmYiLz48L3N2Zz4NCg==") no-repeat 50% 50%}.datepicker__clearable:hover:before{display:none}.datepicker__clearable:hover .datepicker-close{display:block}.datepicker-close:hover:before{background-color:#afafaf}.datepicker>input{color:#666;transition:all .2s ease;border:1px solid #e5e5e5;height:34px;box-sizing:border-box;outline:none;padding:0 34px 0 12px;font-size:14px;width:100%;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none}.datepicker>input.focus{border-color:#3bb4f2;-webkit-box-shadow:0 0 5px rgba(59,180,242,.3);box-shadow:0 0 5px rgba(59,180,242,.3)}.datepicker>input:disabled{cursor:not-allowed;background-color:#ebebe4;border-color:#e5e5e5;-webkit-box-shadow:none;box-shadow:none}.datepicker-popup{position:absolute;transition:all .2s ease;opacity:1;transform:scaleY(1);transform-origin:center top;font-size:12px;background:#fff;border:1px solid #d9d9d9;box-shadow:0 1px 6px rgba(99,99,99,.2);margin-top:2px;outline:0;padding:5px;overflow:hidden;z-index:999}.datepicker-inline{position:relative;margin-top:0}.datepicker-range{min-width:325px}.datepicker-range .datepicker-popup{width:403px}.datepicker-bottom{float:left;width:100%;text-align:right}.datepicker-btn{padding:5px 10px;background:#1284e7;color:#fff;border-radius:2px;display:inline-block;cursor:pointer}.datepicker-anim-enter-active{transform-origin:0 0;animation:datepicker-anim-in .2s cubic-bezier(.23,1,.32,1)}.datepicker-anim-leave-active{transform-origin:0 0;animation:datepicker-anim-out .2s cubic-bezier(.755,.05,.855,.06)}.datepicker__buttons{display:block;text-align:right}.datepicker__buttons button{display:inline-block;font-size:13px;border:none;cursor:pointer;margin:10px 0 0 5px;padding:5px 15px;color:#fff}.datepicker__buttons .datepicker__button-select{background:#1284e7}.datepicker__buttons .datepicker__button-cancel{background:#666}@keyframes datepicker-anim-in{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scaleY(1)}}@keyframes datepicker-anim-out{0%{opacity:1;transform:scaleY(1)}to{opacity:0;transform:scaleY(.8)}}.calendar{float:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.calendar+.calendar{border-left:1px solid #eaeaea;margin-left:5px;padding-left:5px}.calendar-head{line-height:34px;height:34px;text-align:center;position:relative}.calendar-head a{color:#666;font-weight:700;cursor:pointer;display:inline-block;text-align:center;position:absolute;padding:0 5px;font-size:16px}.calendar-head a:hover{color:#1284e7}.calendar-head .calendar-month-select,.calendar-head .calendar-year-select{font-size:12px;padding:0 2px;position:relative}.calendar-prev-decade-btn,.calendar-prev-year-btn{left:6px}.calendar-prev-month-btn{left:24px}.calendar-next-decade-btn,.calendar-next-year-btn{right:6px}.calendar-next-month-btn{right:24px}.calendar-body{position:relative;width:196px;height:196px}.calendar-days{width:100%;height:100%}.calendar-date,.calendar-week{font-weight:400;width:14.28%;height:14.28%;text-align:center;box-sizing:border-box;overflow:hidden;float:left}.calendar-date:before,.calendar-week:before{content:"";display:inline-block;height:100%;vertical-align:middle}.calendar-date{cursor:pointer}.calendar-date-out{color:#ccc}.calendar-date-on,.calendar-date:hover{background:#eaf8fe}.calendar-date-selected,.calendar-date-selected:hover{color:#fff;font-weight:700;background:#1284e7}.calendar-date-disabled{cursor:not-allowed!important;color:#bcbcbc!important;background:#f3f3f3!important}.calendar-foot{margin-top:5px}.calendar-hour{display:inline-block;border:1px solid #e6e5e5;color:#9e9e9e}.calendar-hour a{display:inline-block;padding:2px 4px;cursor:pointer}.calendar-hour a.on,.calendar-hour a:hover{color:#1284e7}.calendar-hours,.calendar-minutes,.calendar-months,.calendar-seconds,.calendar-years{width:100%;height:100%;position:absolute;background:#fff;left:0;top:0}.calendar-months a,.calendar-years a{width:33.33%;height:25%}.calendar-hours a{width:20%;height:20%}.calendar-minutes a,.calendar-seconds a{width:16.66%;height:10%}.calendar-title{margin-top:-30px;height:30px;line-height:30px;background:#fff;text-align:center;font-weight:700} \ No newline at end of file diff --git a/dist/vue-datepicker-local.js b/dist/vue-datepicker-local.js index cf97b22..eb9154e 100644 --- a/dist/vue-datepicker-local.js +++ b/dist/vue-datepicker-local.js @@ -1,6 +1,6 @@ /*! - * vue-datetime-local.js v1.0.15 + * vue-datetime-local.js v1.0.16 * (c) 2017-2018 weifeiyue * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["vue-datepicker-local"]=t():e["vue-datepicker-local"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(s[n])return s[n].exports;var o=s[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,n){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,s){"use strict";function n(e,t,s,n,o,a,r,i){e=e||{};var c=typeof e.default;"object"!==c&&"function"!==c||(e=e.default);var u="function"==typeof e?e.options:e;t&&(u.render=t,u.staticRenderFns=s,u._compiled=!0),n&&(u.functional=!0),a&&(u._scopeId=a);var l;if(r?(l=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__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},u._ssrRegister=l):o&&(l=i?function(){o.call(this,this.$root.$options.shadowRoot)}:o),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(e,t){return l.call(t),h(e,t)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:u}}function o(e){s(2)}function a(e){s(1)}function r(e){e.component(_.name,_)}Object.defineProperty(t,"__esModule",{value:!0});var i={name:"VueDatepickerLocalCalendar",props:{value:null,left:!1,right:!1},data:function(){var e=this.get(this.value);return{pre:"calendar",m:"D",showYears:!1,showMonths:!1,showHours:!1,showMinutes:!1,showSeconds:!1,year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:e.second}},watch:{value:function(e){var t=this,s=t.get(e);t.year=s.year,t.month=s.month,t.day=s.day,t.hour=s.hour,t.minute=s.minute,t.second=s.second}},computed:{local:function(){return this.$parent.local},format:function(){return this.$parent.format},start:function(){return this.parse(this.$parent.dates[0])},end:function(){return this.parse(this.$parent.dates[1])},ys:function(){return 10*parseInt(this.year/10)},ye:function(){return this.ys+10},years:function(){for(var e=[],t=this.ys-1;e.length<12;)e.push(t++);return e},days:function(){var e=[],t=this,s=t.year,n=t.month,o=new Date(s,n,1),a=t.local.dow||7;o.setDate(0);for(var r=o.getDate(),i=o.getDay()||7,c=a<=i?i-a+1:i+(7-a+1);c>0;)e.push({i:r-c+1,y:n>0?s:s-1,m:n>0?n-1:11,p:!0}),c--;o.setMonth(o.getMonth()+2,0),r=o.getDate();var u=1;for(u=1;u<=r;u++)e.push({i:u,y:s,m:n});for(u=1;e.length<42;u++)e.push({i:u,y:n<11?s:s+1,m:n<11?n+1:0,n:!0});return e}},filters:{dd:function(e){return("0"+e).slice(-2)}},methods:{get:function(e){return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds()}},parse:function(e){return parseInt(e/1e3)},status:function(e,t,s,n,o,a,r){var i=this,c=new Date(e,t+1,0).getDate(),u=new Date(e,t,s>c?c:s,n,o,a),l=i.parse(u),h=i.$parent.tf,d={},p=!1;return p="YYYY"===r?e===i.year:"YYYYMM"===r?t===i.month:h(i.value,r)===h(u,r),d[i.pre+"-date"]=!0,d[i.pre+"-date-disabled"]=i.right&&li.end||i.$parent.disabledDate(u,r),d[i.pre+"-date-on"]=i.left&&l>i.start||i.right&&l0?this.month--:(this.month=11,this.year--)},is:function(e){return-1===e.target.className.indexOf(this.pre+"-date-disabled")},ok:function(e){var t=this,s="",n="";if(e&&e.n&&t.nm(),e&&e.p&&t.pm(),"h"===e){var o=t.get(this.value);s=o.year,n=o.month}t.$emit("input",new Date(s||t.year,n||t.month,t.day,t.hour,t.minute,t.second)),t.$parent.ok("h"===e)}},mounted:function(){var e=this,t=function(t){return-1!==e.format.indexOf(t)};t("s")&&t("m")&&(t("h")||t("H"))?e.m="H":t("D")?e.m="D":t("M")?(e.m="M",e.showMonths=!0):t("Y")&&(e.m="Y",e.showYears=!0)}},c=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{class:""+e.pre},[s("div",{class:e.pre+"-head"},[s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-prev-decade-btn",on:{click:function(t){e.year-=10}}},[e._v("«")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-prev-year-btn",on:{click:function(t){e.year--}}},[e._v("«")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-prev-month-btn",on:{click:e.pm}},[e._v("‹")]),s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-year-select"},[e._v(e._s(e.ys+"-"+e.ye))]),e.local.yearSuffix?[s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-year-select",on:{click:function(t){e.showYears=!e.showYears}}},[e._v(e._s(e.year)+e._s(e.local.yearSuffix))]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-month-select",on:{click:function(t){e.showMonths=!e.showMonths}}},[e._v(e._s(e.local.monthsHead[e.month]))])]:[s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-month-select",on:{click:function(t){e.showMonths=!e.showMonths}}},[e._v(e._s(e.local.monthsHead[e.month]))]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-year-select",on:{click:function(t){e.showYears=!e.showYears}}},[e._v(e._s(e.year))])],s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-next-month-btn",on:{click:e.nm}},[e._v("›")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-next-year-btn",on:{click:function(t){e.year++}}},[e._v("»")]),s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-next-decade-btn",on:{click:function(t){e.year+=10}}},[e._v("»")])],2),s("div",{class:e.pre+"-body"},[s("div",{class:e.pre+"-days"},[e._l(e.local.weeks,function(t){return s("a",{key:t,class:e.pre+"-week"},[e._v(e._s(t))])}),e._l(e.days,function(t,n){return s("a",{key:n,class:[t.p||t.n?e.pre+"-date-out":"",e.status(t.y,t.m,t.i,e.hour,e.minute,e.second,"YYYYMMDD")],on:{click:function(s){e.is(s)&&(e.day=t.i,e.ok(t))}}},[e._v(e._s(t.i))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showMonths,expression:"showMonths"}],class:e.pre+"-months"},e._l(e.local.months,function(t,n){return s("a",{key:n,class:[e.status(e.year,n,e.day,e.hour,e.minute,e.second,"YYYYMM")],on:{click:function(t){e.is(t)&&(e.showMonths="M"===e.m,e.month=n,"M"===e.m&&e.ok())}}},[e._v(e._s(t))])})),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-years"},e._l(e.years,function(t,n){return s("a",{key:n,class:[0===n||11===n?e.pre+"-date-out":"",e.status(t,e.month,e.day,e.hour,e.minute,e.second,"YYYY")],on:{click:function(s){e.is(s)&&(e.showYears="Y"===e.m,e.year=t,"Y"===e.m&&e.ok())}}},[e._v(e._s(t))])})),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showHours,expression:"showHours"}],class:e.pre+"-hours"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.hourTip))]),e._l(24,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,n,e.minute,e.second,"YYYYMMDDHH")],on:{click:function(t){e.is(t)&&(e.showHours=!1,e.hour=n,e.ok("h"))}}},[e._v(e._s(n))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showMinutes,expression:"showMinutes"}],class:e.pre+"-minutes"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.minuteTip))]),e._l(60,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,e.hour,n,e.second,"YYYYMMDDHHmm")],on:{click:function(t){e.is(t)&&(e.showMinutes=!1,e.minute=n,e.ok("h"))}}},[e._v(e._s(n))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showSeconds,expression:"showSeconds"}],class:e.pre+"-seconds"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.secondTip))]),e._l(60,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,e.hour,e.minute,n,"YYYYMMDDHHmmss")],on:{click:function(t){e.is(t)&&(e.showSeconds=!1,e.second=n,e.ok("h"))}}},[e._v(e._s(n))])})],2)]),"H"===e.m?s("div",{class:e.pre+"-foot"},[s("div",{class:e.pre+"-hour"},[s("a",{class:{on:e.showHours},attrs:{title:e.local.hourTip},on:{click:function(t){e.showHours=!e.showHours,e.showMinutes=e.showSeconds=!1}}},[e._v(e._s(e._f("dd")(e.hour)))]),s("span",[e._v(":")]),s("a",{class:{on:e.showMinutes},attrs:{title:e.local.minuteTip},on:{click:function(t){e.showMinutes=!e.showMinutes,e.showHours=e.showSeconds=!1}}},[e._v(e._s(e._f("dd")(e.minute)))]),s("span",[e._v(":")]),s("a",{class:{on:e.showSeconds},attrs:{title:e.local.secondTip},on:{click:function(t){e.showSeconds=!e.showSeconds,e.showHours=e.showMinutes=!1}}},[e._v(e._s(e._f("dd")(e.second)))])])]):e._e()])},u=[],l=o,h=n(i,c,u,!1,l,null,null),d=h.exports,p={name:"VueDatepickerLocal",components:{VueDatepickerLocalCalendar:d},props:{name:[String],inputClass:[String],popupClass:[String],value:[Date,Array,String],disabled:[Boolean],type:{type:String,default:"normal"},rangeSeparator:{type:String,default:"~"},clearable:{type:Boolean,default:!1},placeholder:[String],disabledDate:{type:Function,default:function(){return!1}},format:{type:String,default:"YYYY-MM-DD"},local:{type:Object,default:function(){return{dow:1,hourTip:"选择小时",minuteTip:"选择分钟",secondTip:"选择秒数",yearSuffix:"年",monthsHead:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),weeks:"一_二_三_四_五_六_日".split("_"),cancelTip:"取消",submitTip:"确定"}}},showButtons:{type:Boolean,default:!1},dateRangeSelect:[Function]},data:function(){return{show:!1,dates:this.vi(this.value)}},computed:{range:function(){return 2===this.dates.length},text:function(){var e=this,t=this.value,s=this.dates.map(function(t){return e.tf(t)}).join(" "+this.rangeSeparator+" ");return Array.isArray(t)?t.length>1?s:"":t?s:""}},watch:{value:function(e){this.dates=this.vi(this.value)}},methods:{get:function(){return Array.isArray(this.value)?this.dates:this.dates[0]},cls:function(){this.$emit("clear"),this.$emit("input",this.range?[]:"")},vi:function(e){return Array.isArray(e)?e.length>1?e.map(function(e){return new Date(e)}):[new Date,new Date]:e?new Array(new Date(e)):[new Date]},ok:function(e){var t=this;t.$emit("input",t.get()),!e&&!t.showButtons&&setTimeout(function(){t.show=t.range})},tf:function(e,t){var s=e.getFullYear(),n=e.getMonth(),o=e.getDate(),a=e.getHours(),r=a%12==0?12:a%12,i=e.getMinutes(),c=e.getSeconds(),u=e.getMilliseconds(),l=function(e){return("0"+e).slice(-2)},h={YYYY:s,MM:l(n+1),MMM:this.local.months[n],MMMM:this.local.monthsHead[n],M:n+1,DD:l(o),D:o,HH:l(a),H:a,hh:l(r),h:r,mm:l(i),m:i,ss:l(c),s:c,S:u};return(t||this.format).replace(/Y+|M+|D+|H+|h+|m+|s+|S+/g,function(e){return h[e]})},dc:function(e){this.show=this.$el.contains(e.target)&&!this.disabled},submit:function(){this.$emit("confirm",this.get()),this.show=!1},cancel:function(){this.$emit("cancel"),this.show=!1}},mounted:function(){document.addEventListener("click",this.dc,!0)},beforeDestroy:function(){document.removeEventListener("click",this.dc,!0)}},f=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"datepicker",class:{"datepicker-range":e.range,datepicker__clearable:e.clearable&&e.text&&!e.disabled}},["inline"!==e.type?s("input",{class:[e.show?"focus":"",e.inputClass],attrs:{readonly:"",disabled:e.disabled,placeholder:e.placeholder,name:e.name},domProps:{value:e.text}}):e._e(),s("a",{staticClass:"datepicker-close",on:{click:function(t){return t.stopPropagation(),e.cls(t)}}}),s("transition",{attrs:{name:"datepicker-anim"}},[e.show||"inline"===e.type?s("div",{staticClass:"datepicker-popup",class:[e.popupClass,{"datepicker-inline":"inline"===e.type}],attrs:{tabindex:"-1"}},[e.range?[s("vue-datepicker-local-calendar",{attrs:{left:!0},model:{value:e.dates[0],callback:function(t){e.$set(e.dates,0,t)},expression:"dates[0]"}}),s("vue-datepicker-local-calendar",{attrs:{right:!0},model:{value:e.dates[1],callback:function(t){e.$set(e.dates,1,t)},expression:"dates[1]"}})]:[s("vue-datepicker-local-calendar",{model:{value:e.dates[0],callback:function(t){e.$set(e.dates,0,t)},expression:"dates[0]"}})],e.showButtons?s("div",{staticClass:"datepicker__buttons"},[s("button",{staticClass:"datepicker__button-cancel",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.cancel(t)}}},[e._v(e._s(this.local.cancelTip))]),s("button",{staticClass:"datepicker__button-select",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.submit(t)}}},[e._v(e._s(this.local.submitTip))])]):e._e()],2):e._e()])],1)},m=[],w=a,v=n(p,f,m,!1,w,null,null),_=v.exports;_.install=r,"undefined"!=typeof window&&window.Vue&&r(window.Vue);t.default=_},function(e,t){},function(e,t){}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["vue-datepicker-local"]=t():e["vue-datepicker-local"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(s[n])return s[n].exports;var o=s[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,n){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,s){"use strict";function n(e,t,s,n,o,a,r,i){e=e||{};var c=typeof e.default;"object"!==c&&"function"!==c||(e=e.default);var u="function"==typeof e?e.options:e;t&&(u.render=t,u.staticRenderFns=s,u._compiled=!0),n&&(u.functional=!0),a&&(u._scopeId=a);var l;if(r?(l=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__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},u._ssrRegister=l):o&&(l=i?function(){o.call(this,this.$root.$options.shadowRoot)}:o),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(e,t){return l.call(t),h(e,t)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:u}}function o(e){s(2)}function a(e){s(1)}function r(e){e.component(_.name,_)}Object.defineProperty(t,"__esModule",{value:!0});var i={name:"VueDatepickerLocalCalendar",props:{value:null,left:!1,right:!1},data:function(){var e=this.get(this.value);return{pre:"calendar",m:"D",showYears:!1,showMonths:!1,showHours:!1,showMinutes:!1,showSeconds:!1,year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:e.second}},watch:{value:function(e){var t=this,s=t.get(e);t.year=s.year,t.month=s.month,t.day=s.day,t.hour=s.hour,t.minute=s.minute,t.second=s.second}},computed:{local:function(){return this.$parent.local},format:function(){return this.$parent.format},start:function(){return this.parse(this.$parent.dates[0])},end:function(){return this.parse(this.$parent.dates[1])},ys:function(){return 10*parseInt(this.year/10)},ye:function(){return this.ys+10},years:function(){for(var e=[],t=this.ys-1;e.length<12;)e.push(t++);return e},days:function(){var e=[],t=this,s=t.year,n=t.month,o=new Date(s,n,1),a=t.local.dow||7;o.setDate(0);for(var r=o.getDate(),i=o.getDay()||7,c=a<=i?i-a+1:i+(7-a+1);c>0;)e.push({i:r-c+1,y:n>0?s:s-1,m:n>0?n-1:11,p:!0}),c--;o.setMonth(o.getMonth()+2,0),r=o.getDate();var u=1;for(u=1;u<=r;u++)e.push({i:u,y:s,m:n});for(u=1;e.length<42;u++)e.push({i:u,y:n<11?s:s+1,m:n<11?n+1:0,n:!0});return e}},filters:{dd:function(e){return("0"+e).slice(-2)}},methods:{get:function(e){return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds()}},parse:function(e){return parseInt(e/1e3)},status:function(e,t,s,n,o,a,r){var i=this,c=new Date(e,t+1,0).getDate(),u=new Date(e,t,s>c?c:s,n,o,a),l=i.parse(u),h=i.$parent.tf,d={},p=!1;return p="YYYY"===r?e===i.year:"YYYYMM"===r?t===i.month:h(i.value,r)===h(u,r),d[i.pre+"-date"]=!0,d[i.pre+"-date-disabled"]=i.right&&li.start||i.right&&l0?this.month--:(this.month=11,this.year--)},is:function(e){return-1===e.target.className.indexOf(this.pre+"-date-disabled")},ok:function(e){var t=this,s="",n="";if(e&&e.n&&t.nm(),e&&e.p&&t.pm(),"h"===e){var o=t.get(this.value);s=o.year,n=o.month}var a=new Date(s||t.year,n||t.month,t.day,t.hour,t.minute,t.second);t.left&&a>t.start&&(this.$parent.dates[1]=a),t.$emit("input",a),t.$parent.ok("h"===e)}},mounted:function(){var e=this,t=function(t){return-1!==e.format.indexOf(t)};t("s")&&t("m")&&(t("h")||t("H"))?e.m="H":t("D")?e.m="D":t("M")?(e.m="M",e.showMonths=!0):t("Y")&&(e.m="Y",e.showYears=!0)}},c=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{class:""+e.pre},[s("div",{class:e.pre+"-head"},[s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-prev-decade-btn",on:{click:function(t){e.year-=10}}},[e._v("«")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-prev-year-btn",on:{click:function(t){e.year--}}},[e._v("«")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-prev-month-btn",on:{click:e.pm}},[e._v("‹")]),s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-year-select"},[e._v(e._s(e.ys+"-"+e.ye))]),e.local.yearSuffix?[s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-year-select",on:{click:function(t){e.showYears=!e.showYears}}},[e._v(e._s(e.year)+e._s(e.local.yearSuffix))]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-month-select",on:{click:function(t){e.showMonths=!e.showMonths}}},[e._v(e._s(e.local.monthsHead[e.month]))])]:[s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-month-select",on:{click:function(t){e.showMonths=!e.showMonths}}},[e._v(e._s(e.local.monthsHead[e.month]))]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-year-select",on:{click:function(t){e.showYears=!e.showYears}}},[e._v(e._s(e.year))])],s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears&&!e.showMonths,expression:"!showYears&&!showMonths"}],class:e.pre+"-next-month-btn",on:{click:e.nm}},[e._v("›")]),s("a",{directives:[{name:"show",rawName:"v-show",value:!e.showYears,expression:"!showYears"}],class:e.pre+"-next-year-btn",on:{click:function(t){e.year++}}},[e._v("»")]),s("a",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-next-decade-btn",on:{click:function(t){e.year+=10}}},[e._v("»")])],2),s("div",{class:e.pre+"-body"},[s("div",{class:e.pre+"-days"},[e._l(e.local.weeks,function(t){return s("a",{key:t,class:e.pre+"-week"},[e._v(e._s(t))])}),e._l(e.days,function(t,n){return s("a",{key:n,class:[t.p||t.n?e.pre+"-date-out":"",e.status(t.y,t.m,t.i,e.hour,e.minute,e.second,"YYYYMMDD")],on:{click:function(s){e.is(s)&&(e.day=t.i,e.ok(t))}}},[e._v(e._s(t.i))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showMonths,expression:"showMonths"}],class:e.pre+"-months"},e._l(e.local.months,function(t,n){return s("a",{key:n,class:[e.status(e.year,n,e.day,e.hour,e.minute,e.second,"YYYYMM")],on:{click:function(t){e.is(t)&&(e.showMonths="M"===e.m,e.month=n,"M"===e.m&&e.ok())}}},[e._v(e._s(t))])})),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showYears,expression:"showYears"}],class:e.pre+"-years"},e._l(e.years,function(t,n){return s("a",{key:n,class:[0===n||11===n?e.pre+"-date-out":"",e.status(t,e.month,e.day,e.hour,e.minute,e.second,"YYYY")],on:{click:function(s){e.is(s)&&(e.showYears="Y"===e.m,e.year=t,"Y"===e.m&&e.ok())}}},[e._v(e._s(t))])})),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showHours,expression:"showHours"}],class:e.pre+"-hours"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.hourTip))]),e._l(24,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,n,e.minute,e.second,"YYYYMMDDHH")],on:{click:function(t){e.is(t)&&(e.showHours=!1,e.hour=n,e.ok("h"))}}},[e._v(e._s(n))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showMinutes,expression:"showMinutes"}],class:e.pre+"-minutes"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.minuteTip))]),e._l(60,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,e.hour,n,e.second,"YYYYMMDDHHmm")],on:{click:function(t){e.is(t)&&(e.showMinutes=!1,e.minute=n,e.ok("h"))}}},[e._v(e._s(n))])})],2),s("div",{directives:[{name:"show",rawName:"v-show",value:e.showSeconds,expression:"showSeconds"}],class:e.pre+"-seconds"},[s("div",{class:e.pre+"-title"},[e._v(e._s(e.local.secondTip))]),e._l(60,function(t,n){return s("a",{key:n,class:[e.status(e.year,e.month,e.day,e.hour,e.minute,n,"YYYYMMDDHHmmss")],on:{click:function(t){e.is(t)&&(e.showSeconds=!1,e.second=n,e.ok("h"))}}},[e._v(e._s(n))])})],2)]),"H"===e.m?s("div",{class:e.pre+"-foot"},[s("div",{class:e.pre+"-hour"},[s("a",{class:{on:e.showHours},attrs:{title:e.local.hourTip},on:{click:function(t){e.showHours=!e.showHours,e.showMinutes=e.showSeconds=!1}}},[e._v(e._s(e._f("dd")(e.hour)))]),s("span",[e._v(":")]),s("a",{class:{on:e.showMinutes},attrs:{title:e.local.minuteTip},on:{click:function(t){e.showMinutes=!e.showMinutes,e.showHours=e.showSeconds=!1}}},[e._v(e._s(e._f("dd")(e.minute)))]),s("span",[e._v(":")]),s("a",{class:{on:e.showSeconds},attrs:{title:e.local.secondTip},on:{click:function(t){e.showSeconds=!e.showSeconds,e.showHours=e.showMinutes=!1}}},[e._v(e._s(e._f("dd")(e.second)))])])]):e._e()])},u=[],l=o,h=n(i,c,u,!1,l,null,null),d=h.exports,p={name:"VueDatepickerLocal",components:{VueDatepickerLocalCalendar:d},props:{name:[String],inputClass:[String],popupClass:[String],value:[Date,Array,String],disabled:[Boolean],type:{type:String,default:"normal"},rangeSeparator:{type:String,default:"~"},clearable:{type:Boolean,default:!1},placeholder:[String],disabledDate:{type:Function,default:function(){return!1}},format:{type:String,default:"YYYY-MM-DD"},local:{type:Object,default:function(){return{dow:1,hourTip:"选择小时",minuteTip:"选择分钟",secondTip:"选择秒数",yearSuffix:"年",monthsHead:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),weeks:"一_二_三_四_五_六_日".split("_"),cancelTip:"取消",submitTip:"确定"}}},showButtons:{type:Boolean,default:!1},dateRangeSelect:[Function]},data:function(){return{show:!1,dates:this.vi(this.value)}},computed:{range:function(){return 2===this.dates.length},text:function(){var e=this,t=this.value,s=this.dates.map(function(t){return e.tf(t)}).join(" "+this.rangeSeparator+" ");return Array.isArray(t)?t.length>1?s:"":t?s:""}},watch:{value:function(e){this.dates=this.vi(this.value)}},methods:{get:function(){return Array.isArray(this.value)?this.dates:this.dates[0]},cls:function(){this.$emit("clear"),this.$emit("input",this.range?[]:"")},vi:function(e){return Array.isArray(e)?e.length>1?e.map(function(e){return new Date(e)}):[new Date,new Date]:e?new Array(new Date(e)):[new Date]},ok:function(e){var t=this;t.$emit("input",t.get()),!e&&!t.showButtons&&setTimeout(function(){t.show=t.range})},tf:function(e,t){var s=e.getFullYear(),n=e.getMonth(),o=e.getDate(),a=e.getHours(),r=a%12==0?12:a%12,i=e.getMinutes(),c=e.getSeconds(),u=e.getMilliseconds(),l=function(e){return("0"+e).slice(-2)},h={YYYY:s,MM:l(n+1),MMM:this.local.months[n],MMMM:this.local.monthsHead[n],M:n+1,DD:l(o),D:o,HH:l(a),H:a,hh:l(r),h:r,mm:l(i),m:i,ss:l(c),s:c,S:u};return(t||this.format).replace(/Y+|M+|D+|H+|h+|m+|s+|S+/g,function(e){return h[e]})},dc:function(e){this.show=this.$el.contains(e.target)&&!this.disabled},submit:function(){this.$emit("confirm",this.get()),this.show=!1},cancel:function(){this.$emit("cancel"),this.show=!1}},mounted:function(){document.addEventListener("click",this.dc,!0)},beforeDestroy:function(){document.removeEventListener("click",this.dc,!0)}},f=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"datepicker",class:{"datepicker-range":e.range,datepicker__clearable:e.clearable&&e.text&&!e.disabled}},["inline"!==e.type?s("input",{class:[e.show?"focus":"",e.inputClass],attrs:{readonly:"",disabled:e.disabled,placeholder:e.placeholder,name:e.name},domProps:{value:e.text}}):e._e(),s("a",{staticClass:"datepicker-close",on:{click:function(t){return t.stopPropagation(),e.cls(t)}}}),s("transition",{attrs:{name:"datepicker-anim"}},[e.show||"inline"===e.type?s("div",{staticClass:"datepicker-popup",class:[e.popupClass,{"datepicker-inline":"inline"===e.type}],attrs:{tabindex:"-1"}},[e.range?[s("vue-datepicker-local-calendar",{attrs:{left:!0},model:{value:e.dates[0],callback:function(t){e.$set(e.dates,0,t)},expression:"dates[0]"}}),s("vue-datepicker-local-calendar",{attrs:{right:!0},model:{value:e.dates[1],callback:function(t){e.$set(e.dates,1,t)},expression:"dates[1]"}})]:[s("vue-datepicker-local-calendar",{model:{value:e.dates[0],callback:function(t){e.$set(e.dates,0,t)},expression:"dates[0]"}})],e.showButtons?s("div",{staticClass:"datepicker__buttons"},[s("button",{staticClass:"datepicker__button-cancel",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.cancel(t)}}},[e._v(e._s(this.local.cancelTip))]),s("button",{staticClass:"datepicker__button-select",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.submit(t)}}},[e._v(e._s(this.local.submitTip))])]):e._e()],2):e._e()])],1)},m=[],w=a,v=n(p,f,m,!1,w,null,null),_=v.exports;_.install=r,"undefined"!=typeof window&&window.Vue&&r(window.Vue);t.default=_},function(e,t){},function(e,t){}])}); \ No newline at end of file diff --git a/example/App.vue b/example/App.vue index 89cc604..bb24533 100644 --- a/example/App.vue +++ b/example/App.vue @@ -7,8 +7,8 @@


- - +
+
diff --git a/package.json b/package.json index 0c62ad5..73cd659 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-datepicker-local", - "version": "1.0.15", + "version": "1.0.16", "description": "A datepicker for Vue.js", "main": "src/index.js", "files": [ diff --git a/src/VueDatepickerLocalCalendar.vue b/src/VueDatepickerLocalCalendar.vue index 8b43d08..2273309 100644 --- a/src/VueDatepickerLocalCalendar.vue +++ b/src/VueDatepickerLocalCalendar.vue @@ -192,7 +192,7 @@ export default { flag = f($this.value, format) === f(time, format) } classObj[`${$this.pre}-date`] = true - classObj[`${$this.pre}-date-disabled`] = ($this.right && t < $this.start) || ($this.left && t > $this.end) || $this.$parent.disabledDate(time, format) + classObj[`${$this.pre}-date-disabled`] = ($this.right && t < $this.start) || $this.$parent.disabledDate(time, format) classObj[`${$this.pre}-date-on`] = ($this.left && t > $this.start) || ($this.right && t < $this.end) classObj[`${$this.pre}-date-selected`] = flag return classObj @@ -227,7 +227,11 @@ export default { year = time.year month = time.month } - $this.$emit('input', new Date(year || $this.year, month || $this.month, $this.day, $this.hour, $this.minute, $this.second)) + const _time = new Date(year || $this.year, month || $this.month, $this.day, $this.hour, $this.minute, $this.second) + if ($this.left && _time > $this.start) { + this.$parent.dates[1] = _time + } + $this.$emit('input', _time) $this.$parent.ok(info === 'h') } }, @@ -252,7 +256,6 @@ export default {