date-of-birth
Version:
2 lines • 9.97 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("date",[],e):"object"==typeof exports?exports.date=e():t.date=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=1)}([function(t,e,n){"use strict";e.a={name:"DateOfBirth",props:{width:{type:String,default:"100%"},filterable:{type:Boolean,default:!0},title:{required:!0,type:Object,default:function(){return{year:"Year",month:"Month",day:"Day"}}},clear:{required:!1,type:Boolean,default:!1},values:{required:!1,type:String,default:""}},created:function(){this.monthList=[],this.dayList=[],this.yearList=[];var t=(new Date).getFullYear();this.monthList=this.getArray(1,12,10),this.dayList=this.getArray(1,31,10),this.yearList=this.getArray(t-120,t+1,999).reverse()},watch:{values:{handler:function(t){if(t){var e=t.split(" ")[0].split("-");this.year=e[0],this.month=e[1],this.day=e[2],this.showMonth=!0,this.showDay=!0,this.showYear=!0}},immediate:!0,deep:!0}},data:function(){return{dayList:[],monthList:[],yearList:[],day:"",month:"",year:"",showDay:!1,showMonth:!1,showYear:!1}},methods:{reset:function(){this.day="",this.month="",this.year="",this.showMonth=!1,this.showDay=!1,this.showYear=!1},selectDay:function(){if(this.showDay=!0,this.year&&this.month&&this.day){var t=this.year+"-"+this.month+"-"+this.day;this.$emit("change",t)}else this.$emit("change",null)},selectMonth:function(t){if(this.showMonth=!!t,this.dayList=[],"02"===t&&""===this.year?(this.dayList=this.getArray(1,28,10),this.day>28&&(this.day="",this.showDay=!1)):"02"===t&&""!==this.year&&!0===this.isRN(this.year)?(this.dayList=this.getArray(1,29,10),this.day>29&&(this.day="",this.showDay=!1)):"02"===t&&""!==this.year&&!0!==this.isRN(this.year)?(this.dayList=this.getArray(1,28,10),this.day>28&&(this.day="",this.showDay=!1)):"02"!==t&&t%2!=0?this.dayList=this.getArray(1,31,10):"02"!==t&&t%2==0&&(this.dayList=this.getArray(1,30,10),this.day>30&&(this.day="",this.showDay=!1)),"08"!==t&&"10"!==t&&"12"!==t||(this.dayList=this.getArray(1,31,10)),"09"!==t&&"11"!==t||(this.dayList=this.getArray(1,30,10),this.day>30&&(this.day="",this.showDay=!1)),this.year&&this.month&&this.day){var e=this.year+"-"+this.month+"-"+this.day;this.$emit("change",e)}else this.$emit("change",null)},selectYear:function(){this.showYear=!0,this.selectMonth(this.month)},isRN:function(t){return t%4==0&&(t%100!=0||t%400==0)},getArray:function(t,e,n){for(var i=[],s=t;s<=e;s++)s<n?i.push({name:"0"+s,value:"0"+s}):i.push({name:""+s,value:""+s});return i}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),s=[i.a],a=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.map(function(e){t.component(e.name,e)})};"undefined"!=typeof window&&window.Vue&&a(window.Vue),e.default={install:a,DateOfBirth:i.a}},function(t,e,n){"use strict";var i=n(3);i.a.install=function(t){return t.component(i.a.name,i.a)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(i.a),e.a=i.a},function(t,e,n){"use strict";function i(t){n(4)}var s=n(0),a=n(10),r=n(9),o=i,l=r(s.a,a.a,!1,o,null,null);e.a=l.exports},function(t,e,n){var i=n(5);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);n(7)("da87b5e4",i,!0,{})},function(t,e,n){e=t.exports=n(6)(!1),e.push([t.i,".date-of-birth{display:flex;align-items:center;justify-content:space-between}.date-of-birth .relative{position:relative}.date-of-birth .relative .title{position:absolute;top:7px;left:16px;color:#888;font-family:Montserrat-Italic;line-height:24px;font-size:16px}.date-of-birth .mgl{margin:0 8px}.date-of-birth .select .el-input--suffix .el-input__inner{padding-top:16px;height:58px;background:transparent;transition:all .2s}",""])},function(t,e){function n(t,e){var n=t[1]||"",s=t[3];if(!s)return n;if(e&&"function"==typeof btoa){var a=i(s);return[n].concat(s.sources.map(function(t){return"/*# sourceURL="+s.sourceRoot+t+" */"})).concat([a]).join("\n")}return[n].join("\n")}function i(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i=n(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},s=0;s<this.length;s++){var a=this[s][0];"number"==typeof a&&(i[a]=!0)}for(s=0;s<t.length;s++){var r=t[s];"number"==typeof r[0]&&i[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}},function(t,e,n){function i(t){for(var e=0;e<t.length;e++){var n=t[e],i=u[n.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](n.parts[s]);for(;s<n.parts.length;s++)i.parts.push(a(n.parts[s]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{for(var r=[],s=0;s<n.parts.length;s++)r.push(a(n.parts[s]));u[n.id]={id:n.id,refs:1,parts:r}}}}function s(){var t=document.createElement("style");return t.type="text/css",c.appendChild(t),t}function a(t){var e,n,i=document.querySelector("style["+m+'~="'+t.id+'"]');if(i){if(p)return y;i.parentNode.removeChild(i)}if(g){var a=f++;i=d||(d=s()),e=r.bind(null,i,a,!1),n=r.bind(null,i,a,!0)}else i=s(),e=o.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}function r(t,e,n,i){var s=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=b(e,s);else{var a=document.createTextNode(s),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(a,r[e]):t.appendChild(a)}}function o(t,e){var n=e.css,i=e.media,s=e.sourceMap;if(i&&t.setAttribute("media",i),v.ssrId&&t.setAttribute(m,e.id),s&&(n+="\n/*# sourceURL="+s.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var h=n(8),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,f=0,p=!1,y=function(){},v=null,m="data-vue-ssr-id",g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,s){p=n,v=s||{};var a=h(t,e);return i(a),function(e){for(var n=[],s=0;s<a.length;s++){var r=a[s],o=u[r.id];o.refs--,n.push(o)}e?(a=h(t,e),i(a)):a=[];for(var s=0;s<n.length;s++){var o=n[s];if(0===o.refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete u[o.id]}}}};var b=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t,e){for(var n=[],i={},s=0;s<e.length;s++){var a=e[s],r=a[0],o=a[1],l=a[2],h=a[3],u={id:t+":"+s,css:o,media:l,sourceMap:h};i[r]?i[r].parts.push(u):n.push(i[r]={id:r,parts:[u]})}return n}},function(t,e){t.exports=function(t,e,n,i,s,a){var r,o=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(r=t,o=t.default);var h="function"==typeof o?o.options:o;e&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns,h._compiled=!0),n&&(h.functional=!0),s&&(h._scopeId=s);var u;if(a?(u=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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},h._ssrRegister=u):i&&(u=i),u){var c=h.functional,d=c?h.render:h.beforeCreate;c?(h._injectStyles=u,h.render=function(t,e){return u.call(e),d(t,e)}):h.beforeCreate=d?[].concat(d,u):[u]}return{esModule:r,exports:o,options:h}}},function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"date-of-birth",style:{width:t.width}},[n("div",{staticClass:"relative"},[t.showYear?n("span",{staticClass:"title"},[t._v(t._s(t.title.year))]):t._e(),t._v(" "),n("el-select",{class:t.showYear?"select":"",staticStyle:{width:"100%"},attrs:{placeholder:t.title.year,filterable:t.filterable},on:{change:t.selectYear},model:{value:t.year,callback:function(e){t.year=e},expression:"year"}},t._l(t.yearList,function(t,e){return n("el-option",{key:e,attrs:{value:t.value,label:t.name}})}),1)],1),t._v(" "),n("div",{staticClass:"relative mgl"},[t.showMonth?n("span",{staticClass:"title"},[t._v(t._s(t.title.month))]):t._e(),t._v(" "),n("el-select",{class:t.showMonth?"select":"",staticStyle:{width:"100%"},attrs:{placeholder:t.title.month,filterable:t.filterable},on:{change:t.selectMonth},model:{value:t.month,callback:function(e){t.month=e},expression:"month"}},t._l(t.monthList,function(t,e){return n("el-option",{key:e,attrs:{value:t.value,label:t.name}})}),1)],1),t._v(" "),n("div",{staticClass:"relative"},[t.showDay?n("span",{staticClass:"title"},[t._v(t._s(t.title.day))]):t._e(),t._v(" "),n("el-select",{class:t.showDay?"select":"",staticStyle:{width:"100%"},attrs:{placeholder:t.title.day,filterable:t.filterable},on:{change:t.selectDay},model:{value:t.day,callback:function(e){t.day=e},expression:"day"}},t._l(t.dayList,function(t,e){return n("el-option",{key:e,attrs:{value:t.value,label:t.name}})}),1)],1)])},s=[],a={render:i,staticRenderFns:s};e.a=a}])});
//# sourceMappingURL=date.js.map