vue2-datepicker-dialog
Version:
A dialog compatible Datepicker Component For Vue2
1,696 lines (1,619 loc) • 111 kB
JavaScript
import { getWeek, format, parse } from 'date-format-parse';
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
function _defineProperty(e, r, t) {
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
_defineProperty(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
function _objectWithoutProperties(e, t) {
if (null == e) return {};
var o,
r,
i = _objectWithoutPropertiesLoose(e, t);
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(e);
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
}
return i;
}
function _objectWithoutPropertiesLoose(r, e) {
if (null == r) return {};
var t = {};
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
if (e.includes(n)) continue;
t[n] = r[n];
}
return t;
}
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _extends$1() {
return _extends$1 = Object.assign ? Object.assign.bind() : function (a) {
for (var b, c = 1; c < arguments.length; c++) for (var d in b = arguments[c], b) Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
return a;
}, _extends$1.apply(this, arguments);
}
var normalMerge = ["attrs", "props", "domProps"],
toArrayMerge = ["class", "style", "directives"],
functionalMerge = ["on", "nativeOn"],
mergeJsxProps = function mergeJsxProps(a) {
return a.reduce(function (c, a) {
for (var b in a) if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends$1({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
var d = c[b] instanceof Array ? c[b] : [c[b]],
e = a[b] instanceof Array ? a[b] : [a[b]];
c[b] = [].concat(d, e);
} else if (-1 !== functionalMerge.indexOf(b)) {
for (var f in a[b]) if (c[b][f]) {
var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
c[b][f] = [].concat(g, h);
} else c[b][f] = a[b][f];
} else if ("hook" === b) for (var i in a[b]) c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];else c[b] = a[b];
return c;
}, {});
},
mergeFn = function mergeFn(a, b) {
return function () {
a && a.apply(this, arguments), b && b.apply(this, arguments);
};
};
var helper = mergeJsxProps;
// new Date(10, 0, 1) The year from 0 to 99 will be incremented by 1900 automatically.
function createDate(y) {
var M = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var d = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var h = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
var m = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
var s = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
var ms = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
var date = new Date(y, M, d, h, m, s, ms);
if (y < 100 && y >= 0) {
date.setFullYear(y);
}
return date;
}
function isValidDate(date) {
return date instanceof Date && !isNaN(date);
}
function isValidRangeDate(date) {
return Array.isArray(date) && date.length === 2 && date.every(isValidDate) && date[0] <= date[1];
}
function isValidDates(dates) {
return Array.isArray(dates) && dates.every(isValidDate);
}
function getValidDate(value) {
var date = new Date(value);
if (isValidDate(date)) {
return date;
}
for (var _len = arguments.length, backup = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
backup[_key - 1] = arguments[_key];
}
if (backup.length) {
return getValidDate.apply(void 0, backup);
}
return new Date();
}
function startOfYear(value) {
var date = new Date(value);
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
return date;
}
function startOfMonth(value) {
var date = new Date(value);
date.setDate(1);
date.setHours(0, 0, 0, 0);
return date;
}
function startOfDay(value) {
var date = new Date(value);
date.setHours(0, 0, 0, 0);
return date;
}
function getCalendar(_ref) {
var firstDayOfWeek = _ref.firstDayOfWeek,
year = _ref.year,
month = _ref.month;
var arr = [];
// change to the last day of the last month
var calendar = createDate(year, month, 0);
var lastDayInLastMonth = calendar.getDate();
// getDay() 0 is Sunday, 1 is Monday
var firstDayInLastMonth = lastDayInLastMonth - (calendar.getDay() + 7 - firstDayOfWeek) % 7;
for (var i = firstDayInLastMonth; i <= lastDayInLastMonth; i++) {
arr.push(createDate(year, month, i - lastDayInLastMonth));
}
// change to the last day of the current month
calendar.setMonth(month + 1, 0);
var lastDayInCurrentMonth = calendar.getDate();
for (var _i = 1; _i <= lastDayInCurrentMonth; _i++) {
arr.push(createDate(year, month, _i));
}
var lastMonthLength = lastDayInLastMonth - firstDayInLastMonth + 1;
var nextMonthLength = 6 * 7 - lastMonthLength - lastDayInCurrentMonth;
for (var _i2 = 1; _i2 <= nextMonthLength; _i2++) {
arr.push(createDate(year, month, lastDayInCurrentMonth + _i2));
}
return arr;
}
function setMonth(dirtyDate, dirtyMonth) {
var date = new Date(dirtyDate);
var month = typeof dirtyMonth === 'function' ? dirtyMonth(date.getMonth()) : Number(dirtyMonth);
var year = date.getFullYear();
var daysInMonth = createDate(year, month + 1, 0).getDate();
var day = date.getDate();
date.setMonth(month, Math.min(day, daysInMonth));
return date;
}
function setYear(dirtyDate, dirtyYear) {
var date = new Date(dirtyDate);
var year = typeof dirtyYear === 'function' ? dirtyYear(date.getFullYear()) : dirtyYear;
date.setFullYear(year);
return date;
}
function assignTime(target, source) {
var date = new Date(target);
var time = new Date(source);
date.setHours(time.getHours(), time.getMinutes(), time.getSeconds());
return date;
}
/**
* chunk the array
* @param {Array} arr
* @param {Number} size
*/
function chunk(arr, size) {
if (!Array.isArray(arr)) {
return [];
}
var result = [];
var len = arr.length;
var i = 0;
size = size || len;
while (i < len) {
result.push(arr.slice(i, i += size));
}
return result;
}
/**
* isObject
* @param {*} obj
* @returns {Boolean}
*/
function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
}
/**
* pick object
* @param {Object} obj
* @param {Array|String} props
*/
function pick(obj, props) {
if (!isObject(obj)) return {};
if (!Array.isArray(props)) {
props = [props];
}
var res = {};
props.forEach(function (prop) {
if (prop in obj) {
res[prop] = obj[prop];
}
});
return res;
}
/**
* deep merge two object without merging array
* @param {object} target
* @param {object} source
*/
function mergeDeep(target, source) {
if (!isObject(target)) {
return {};
}
var result = target;
if (isObject(source)) {
Object.keys(source).forEach(function (key) {
var value = source[key];
if (isObject(value) && isObject(target[key])) {
value = mergeDeep(target[key], value);
}
result = _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, key, value));
});
}
return result;
}
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var en = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var locale = {
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
firstDayOfWeek: 0,
firstWeekContainsDate: 1
};
var _default = locale;
exports["default"] = _default;
module.exports = exports.default;
});
var en$1 = unwrapExports(en);
var lang = {
formatLocale: en$1,
yearFormat: 'YYYY',
monthFormat: 'MMM',
monthBeforeYear: true
};
var defaultLocale = 'en';
var locales = {};
locales[defaultLocale] = lang;
function locale(name, object, isLocal) {
if (typeof name !== 'string') return locales[defaultLocale];
var l = defaultLocale;
if (locales[name]) {
l = name;
}
if (object) {
locales[name] = object;
l = name;
}
if (!isLocal) {
defaultLocale = l;
}
return locales[name] || locales[defaultLocale];
}
/**
* get locale object
* @param {string} name lang
*/
function getLocale(name) {
return locale(name, null, true);
}
/* istanbul ignore file */
function rafThrottle(fn) {
var isRunning = false;
return function fnBinfRaf() {
var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (isRunning) return;
isRunning = true;
requestAnimationFrame(function () {
isRunning = false;
fn.apply(_this, args);
});
};
}
/**
* get the hidden element width, height
* @param {HTMLElement} element dom
*/
function getPopupElementSize(element) {
var originalDisplay = element.style.display;
var originalVisibility = element.style.visibility;
element.style.display = 'block';
element.style.visibility = 'hidden';
var styles = window.getComputedStyle(element);
var width = element.offsetWidth + parseInt(styles.marginLeft, 10) + parseInt(styles.marginRight, 10);
var height = element.offsetHeight + parseInt(styles.marginTop, 10) + parseInt(styles.marginBottom, 10);
element.style.display = originalDisplay;
element.style.visibility = originalVisibility;
return {
width: width,
height: height
};
}
/**
* get the popup position
* @param {HTMLElement} el relative element
* @param {Number} targetWidth target element's width
* @param {Number} targetHeight target element's height
* @param {Boolean} fixed
*/
function getRelativePosition(el, targetWidth, targetHeight, fixed) {
var left = 0;
var top = 0;
var offsetX = 0;
var offsetY = 0;
var relativeRect = el.getBoundingClientRect();
var dw = document.documentElement.clientWidth;
var dh = document.documentElement.clientHeight;
if (fixed) {
offsetX = window.pageXOffset + relativeRect.left;
offsetY = window.pageYOffset + relativeRect.top;
}
if (dw - relativeRect.left < targetWidth && relativeRect.right < targetWidth) {
left = offsetX - relativeRect.left + 1;
} else if (relativeRect.left + relativeRect.width / 2 <= dw / 2) {
left = offsetX;
} else {
left = offsetX + relativeRect.width - targetWidth;
}
if (relativeRect.top <= targetHeight && dh - relativeRect.bottom <= targetHeight) {
top = offsetY + dh - relativeRect.top - targetHeight;
} else if (relativeRect.top + relativeRect.height / 2 <= dh / 2) {
top = offsetY + relativeRect.height;
} else {
top = offsetY - targetHeight;
}
return {
left: "".concat(left, "px"),
top: "".concat(top, "px")
};
}
function getScrollParent(node) {
var until = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
if (!node || node === until) {
return null;
}
var style = function style(value, prop) {
return getComputedStyle(value, null).getPropertyValue(prop);
};
var regex = /(auto|scroll)/;
var scroll = regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
return scroll ? node : getScrollParent(node.parentNode, until);
}
//
var script = {
name: 'Popup',
inject: {
prefixClass: {
default: 'mx'
}
},
props: {
visible: {
type: Boolean,
default: false
},
appendToBody: {
type: Boolean,
default: true
},
appendToElement: {
type: String,
required: false,
default: null
}
},
data: function data() {
return {
top: '',
left: ''
};
},
watch: {
visible: {
immediate: true,
handler: function handler(val) {
var _this = this;
this.$nextTick(function () {
if (val) {
_this.displayPopup();
}
});
}
}
},
mounted: function mounted() {
var _this2 = this;
if (this.appendToElement !== null) {
document.getElementById(this.appendToElement).appendChild(this.$el);
} else if (this.appendToBody) {
document.body.appendChild(this.$el);
}
this._clickoutEvent = 'ontouchend' in document ? 'touchstart' : 'mousedown';
document.addEventListener(this._clickoutEvent, this.handleClickOutside);
// change the popup position when resize or scroll
var relativeElement = this.$parent.$el;
this._displayPopup = rafThrottle(function () {
return _this2.displayPopup();
});
this._scrollParent = getScrollParent(relativeElement) || window;
this._scrollParent.addEventListener('scroll', this._displayPopup);
window.addEventListener('resize', this._displayPopup);
},
beforeDestroy: function beforeDestroy() {
if ((this.appendToBody || this.appendToElement !== null) && this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
document.removeEventListener(this._clickoutEvent, this.handleClickOutside);
this._scrollParent.removeEventListener('scroll', this._displayPopup);
window.removeEventListener('resize', this._displayPopup);
},
methods: {
handleClickOutside: function handleClickOutside(evt) {
if (!this.visible) return;
var target = evt.target;
var el = this.$el;
if (el && !el.contains(target)) {
this.$emit('clickoutside', evt);
}
},
displayPopup: function displayPopup() {
if (!this.visible) return;
var popup = this.$el;
var relativeElement = this.$parent.$el;
var fixed = this.appendToBody || this.appendToElement !== null;
if (!this._popupRect) {
this._popupRect = getPopupElementSize(popup);
}
var _this$_popupRect = this._popupRect,
width = _this$_popupRect.width,
height = _this$_popupRect.height;
var _getRelativePosition = getRelativePosition(relativeElement, width, height, fixed),
left = _getRelativePosition.left,
top = _getRelativePosition.top;
if (this.appendToElement === null) {
this.left = left;
this.top = top;
}
}
}
};
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
// Vue.extend constructor export interop.
var options = typeof script === 'function' ? script.options : script;
// render functions
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true;
// functional template
if (isFunctionalTemplate) {
options.functional = true;
}
}
// scopedId
if (scopeId) {
options._scopeId = scopeId;
}
var hook;
if (moduleIdentifier) {
// server build
hook = function hook(context) {
// 2.3 injection
context = context ||
// cached call
this.$vnode && this.$vnode.ssrContext ||
// stateful
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
}
// inject component styles
if (style) {
style.call(this, createInjectorSSR(context));
}
// register component module identifier for async chunk inference
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook;
} else if (style) {
hook = shadowMode ? function (context) {
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
} : function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
// register for functional component in vue file
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
/* script */
var __vue_script__ = script;
/* template */
var __vue_render__ = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('transition', {
attrs: {
"name": _vm.prefixClass + "-zoom-in-down"
}
}, [_vm.visible ? _c('div', {
class: _vm.prefixClass + "-datepicker-main " + _vm.prefixClass + "-datepicker-popup",
style: {
top: _vm.top,
left: _vm.left,
position: 'absolute'
}
}, [_vm._t("default")], 2) : _vm._e()]);
};
var __vue_staticRenderFns__ = [];
/* style */
var __vue_inject_styles__ = undefined;
/* scoped */
var __vue_scope_id__ = undefined;
/* module identifier */
var __vue_module_identifier__ = undefined;
/* functional template */
var __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__ = /*#__PURE__*/normalizeComponent({
render: __vue_render__,
staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
/* script */
/* template */
var __vue_render__$1 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('svg', {
attrs: {
"xmlns": "http://www.w3.org/2000/svg",
"viewBox": "0 0 1024 1024",
"width": "1em",
"height": "1em"
}
}, [_c('path', {
attrs: {
"d": "M940.218182 107.054545h-209.454546V46.545455h-65.163636v60.50909H363.054545V46.545455H297.890909v60.50909H83.781818c-18.618182 0-32.581818 13.963636-32.581818 32.581819v805.236363c0 18.618182 13.963636 32.581818 32.581818 32.581818h861.090909c18.618182 0 32.581818-13.963636 32.581818-32.581818V139.636364c-4.654545-18.618182-18.618182-32.581818-37.236363-32.581819zM297.890909 172.218182V232.727273h65.163636V172.218182h307.2V232.727273h65.163637V172.218182h176.872727v204.8H116.363636V172.218182h181.527273zM116.363636 912.290909V442.181818h795.927273v470.109091H116.363636z"
}
})]);
};
var __vue_staticRenderFns__$1 = [];
/* style */
var __vue_inject_styles__$1 = undefined;
/* scoped */
var __vue_scope_id__$1 = undefined;
/* module identifier */
var __vue_module_identifier__$1 = undefined;
/* functional template */
var __vue_is_functional_template__$1 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$1 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$1,
staticRenderFns: __vue_staticRenderFns__$1
}, __vue_inject_styles__$1, {}, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
/* script */
/* template */
var __vue_render__$2 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('svg', {
attrs: {
"xmlns": "http://www.w3.org/2000/svg",
"viewBox": "0 0 24 24",
"width": "1em",
"height": "1em"
}
}, [_c('path', {
attrs: {
"d": "M0 0h24v24H0z",
"fill": "none"
}
}), _vm._v(" "), _c('path', {
attrs: {
"d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
}
}), _vm._v(" "), _c('path', {
attrs: {
"d": "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"
}
})]);
};
var __vue_staticRenderFns__$2 = [];
/* style */
var __vue_inject_styles__$2 = undefined;
/* scoped */
var __vue_scope_id__$2 = undefined;
/* module identifier */
var __vue_module_identifier__$2 = undefined;
/* functional template */
var __vue_is_functional_template__$2 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$2 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$2,
staticRenderFns: __vue_staticRenderFns__$2
}, __vue_inject_styles__$2, {}, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
/* script */
/* template */
var __vue_render__$3 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('svg', {
attrs: {
"xmlns": "http://www.w3.org/2000/svg",
"viewBox": "0 0 1024 1024",
"width": "1em",
"height": "1em"
}
}, [_c('path', {
attrs: {
"d": "M810.005333 274.005333l-237.994667 237.994667 237.994667 237.994667-60.010667 60.010667-237.994667-237.994667-237.994667 237.994667-60.010667-60.010667 237.994667-237.994667-237.994667-237.994667 60.010667-60.010667 237.994667 237.994667 237.994667-237.994667z"
}
})]);
};
var __vue_staticRenderFns__$3 = [];
/* style */
var __vue_inject_styles__$3 = undefined;
/* scoped */
var __vue_scope_id__$3 = undefined;
/* module identifier */
var __vue_module_identifier__$3 = undefined;
/* functional template */
var __vue_is_functional_template__$3 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$3 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$3,
staticRenderFns: __vue_staticRenderFns__$3
}, __vue_inject_styles__$3, {}, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$1 = {
props: {
type: String,
disabled: Boolean
},
inject: {
prefixClass: {
default: 'mx'
}
}
};
/* script */
var __vue_script__$1 = script$1;
/* template */
var __vue_render__$4 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('button', _vm._g({
class: [_vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text " + _vm.prefixClass + "-btn-icon-" + _vm.type, {
disabled: _vm.disabled
}],
attrs: {
"type": "button",
"disabled": _vm.disabled
}
}, _vm.$listeners), [_c('i', {
class: _vm.prefixClass + "-icon-" + _vm.type
})]);
};
var __vue_staticRenderFns__$4 = [];
/* style */
var __vue_inject_styles__$4 = undefined;
/* scoped */
var __vue_scope_id__$4 = undefined;
/* module identifier */
var __vue_module_identifier__$4 = undefined;
/* functional template */
var __vue_is_functional_template__$4 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$4 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$4,
staticRenderFns: __vue_staticRenderFns__$4
}, __vue_inject_styles__$4, __vue_script__$1, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
var script$2 = {
name: 'TableDate',
components: {
IconButton: __vue_component__$4
},
inject: {
getLocale: {
default: function _default() {
return getLocale;
}
},
getWeek: {
default: function _default() {
return getWeek;
}
},
prefixClass: {
default: 'mx'
},
onDateMouseEnter: {
default: undefined
},
onDateMouseLeave: {
default: undefined
}
},
props: {
disabledCalendarChanger: {
type: Function,
default: function _default() {
return false;
}
},
calendar: {
type: Date,
default: function _default() {
return new Date();
}
},
showWeekNumber: {
type: Boolean,
default: false
},
titleFormat: {
type: String,
default: 'YYYY-MM-DD'
},
getRowClasses: {
type: Function,
default: function _default() {
return [];
}
},
getCellClasses: {
type: Function,
default: function _default() {
return [];
}
}
},
computed: {
firstDayOfWeek: function firstDayOfWeek() {
return this.getLocale().formatLocale.firstDayOfWeek || 0;
},
yearMonth: function yearMonth() {
var _this$getLocale = this.getLocale(),
yearFormat = _this$getLocale.yearFormat,
monthBeforeYear = _this$getLocale.monthBeforeYear,
_this$getLocale$month = _this$getLocale.monthFormat,
monthFormat = _this$getLocale$month === void 0 ? 'MMM' : _this$getLocale$month;
var yearLabel = {
panel: 'year',
label: this.formatDate(this.calendar, yearFormat)
};
var monthLabel = {
panel: 'month',
label: this.formatDate(this.calendar, monthFormat)
};
return monthBeforeYear ? [monthLabel, yearLabel] : [yearLabel, monthLabel];
},
days: function days() {
var locale = this.getLocale();
var days = locale.days || locale.formatLocale.weekdaysMin;
return days.concat(days).slice(this.firstDayOfWeek, this.firstDayOfWeek + 7);
},
dates: function dates() {
var year = this.calendar.getFullYear();
var month = this.calendar.getMonth();
var arr = getCalendar({
firstDayOfWeek: this.firstDayOfWeek,
year: year,
month: month
});
return chunk(arr, 7);
}
},
methods: {
isDisabledArrows: function isDisabledArrows(type) {
var date = new Date(this.calendar);
switch (type) {
case 'last-year':
date.setFullYear(date.getFullYear() - 1, date.getMonth() + 1, 0);
date.setHours(23, 59, 59, 999);
break;
case 'next-year':
date.setFullYear(date.getFullYear() + 1);
break;
case 'last-month':
date.setMonth(date.getMonth(), 0);
date.setHours(23, 59, 59, 999);
break;
case 'next-month':
date.setMonth(date.getMonth() + 1);
break;
}
return this.disabledCalendarChanger(date, type);
},
handleIconLeftClick: function handleIconLeftClick() {
this.$emit('changecalendar', setMonth(this.calendar, function (v) {
return v - 1;
}), 'last-month');
},
handleIconRightClick: function handleIconRightClick() {
this.$emit('changecalendar', setMonth(this.calendar, function (v) {
return v + 1;
}), 'next-month');
},
handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v - 1;
}), 'last-year');
},
handleIconDoubleRightClick: function handleIconDoubleRightClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v + 1;
}), 'next-year');
},
handlePanelChange: function handlePanelChange(panel) {
this.$emit('changepanel', panel);
},
handleMouseEnter: function handleMouseEnter(cell) {
if (typeof this.onDateMouseEnter === 'function') {
this.onDateMouseEnter(cell);
}
},
handleMouseLeave: function handleMouseLeave(cell) {
if (typeof this.onDateMouseLeave === 'function') {
this.onDateMouseLeave(cell);
}
},
handleCellClick: function handleCellClick(evt) {
var target = evt.target;
if (target.tagName.toUpperCase() === 'DIV') {
target = target.parentNode;
}
var index = target.getAttribute('data-row-col');
if (index) {
var _index$split$map = index.split(',').map(function (v) {
return parseInt(v, 10);
}),
_index$split$map2 = _slicedToArray(_index$split$map, 2),
row = _index$split$map2[0],
col = _index$split$map2[1];
var date = this.dates[row][col];
this.$emit('select', new Date(date));
}
},
formatDate: function formatDate(date, fmt) {
return format(date, fmt, {
locale: this.getLocale().formatLocale
});
},
getCellTitle: function getCellTitle(date) {
var fmt = this.titleFormat;
return this.formatDate(date, fmt);
},
getWeekNumber: function getWeekNumber(date) {
return this.getWeek(date, this.getLocale().formatLocale);
}
}
};
/* script */
var __vue_script__$2 = script$2;
/* template */
var __vue_render__$5 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-date"
}, [_c('div', {
class: _vm.prefixClass + "-calendar-header"
}, [_c('icon-button', {
attrs: {
"type": "double-left",
"disabled": _vm.isDisabledArrows('last-year')
},
on: {
"click": _vm.handleIconDoubleLeftClick
}
}), _vm._v(" "), _c('icon-button', {
attrs: {
"type": "left",
"disabled": _vm.isDisabledArrows('last-month')
},
on: {
"click": _vm.handleIconLeftClick
}
}), _vm._v(" "), _c('icon-button', {
attrs: {
"type": "double-right",
"disabled": _vm.isDisabledArrows('next-year')
},
on: {
"click": _vm.handleIconDoubleRightClick
}
}), _vm._v(" "), _c('icon-button', {
attrs: {
"type": "right",
"disabled": _vm.isDisabledArrows('next-month')
},
on: {
"click": _vm.handleIconRightClick
}
}), _vm._v(" "), _c('span', {
class: _vm.prefixClass + "-calendar-header-label"
}, _vm._l(_vm.yearMonth, function (item) {
return _c('button', {
key: item.panel,
class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text " + _vm.prefixClass + "-btn-current-" + item.panel,
attrs: {
"type": "button"
},
on: {
"click": function click($event) {
return _vm.handlePanelChange(item.panel);
}
}
}, [_vm._v("\n " + _vm._s(item.label) + "\n ")]);
}), 0)], 1), _vm._v(" "), _c('div', {
class: _vm.prefixClass + "-calendar-content"
}, [_c('table', {
class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-date"
}, [_c('thead', [_c('tr', [_vm.showWeekNumber ? _c('th', {
class: _vm.prefixClass + "-week-number-header"
}) : _vm._e(), _vm._v(" "), _vm._l(_vm.days, function (day) {
return _c('th', {
key: day
}, [_vm._v(_vm._s(day))]);
})], 2)]), _vm._v(" "), _c('tbody', {
on: {
"click": _vm.handleCellClick
}
}, _vm._l(_vm.dates, function (row, i) {
return _c('tr', {
key: i,
class: [_vm.prefixClass + "-date-row", _vm.getRowClasses(row)]
}, [_vm.showWeekNumber ? _c('td', {
class: _vm.prefixClass + "-week-number",
attrs: {
"data-row-col": i + ",0"
}
}, [_vm._v("\n " + _vm._s(_vm.getWeekNumber(row[0])) + "\n ")]) : _vm._e(), _vm._v(" "), _vm._l(row, function (cell, j) {
return _c('td', {
key: j,
staticClass: "cell",
class: _vm.getCellClasses(cell),
attrs: {
"data-row-col": i + "," + j,
"title": _vm.getCellTitle(cell)
},
on: {
"mouseenter": function mouseenter($event) {
return _vm.handleMouseEnter(cell);
},
"mouseleave": function mouseleave($event) {
return _vm.handleMouseLeave(cell);
}
}
}, [_c('div', [_vm._v(_vm._s(cell.getDate()))])]);
})], 2);
}), 0)])])]);
};
var __vue_staticRenderFns__$5 = [];
/* style */
var __vue_inject_styles__$5 = undefined;
/* scoped */
var __vue_scope_id__$5 = undefined;
/* module identifier */
var __vue_module_identifier__$5 = undefined;
/* functional template */
var __vue_is_functional_template__$5 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$5 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$5,
staticRenderFns: __vue_staticRenderFns__$5
}, __vue_inject_styles__$5, __vue_script__$2, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
//
var script$3 = {
name: 'TableMonth',
components: {
IconButton: __vue_component__$4
},
inject: {
getLocale: {
default: function _default() {
return getLocale;
}
},
prefixClass: {
default: 'mx'
}
},
props: {
disabledCalendarChanger: {
type: Function,
default: function _default() {
return false;
}
},
calendar: {
type: Date,
default: function _default() {
return new Date();
}
},
getCellClasses: {
type: Function,
default: function _default() {
return [];
}
}
},
computed: {
calendarYear: function calendarYear() {
return this.calendar.getFullYear();
},
months: function months() {
var locale = this.getLocale();
var monthsLocale = locale.months || locale.formatLocale.monthsShort;
var months = monthsLocale.map(function (text, month) {
return {
text: text,
month: month
};
});
return chunk(months, 3);
}
},
methods: {
isDisabledArrows: function isDisabledArrows(type) {
var date = new Date(this.calendar);
switch (type) {
case 'last-year':
date.setFullYear(date.getFullYear() - 1, 11, 31);
date.setHours(23, 59, 59, 999);
break;
case 'next-year':
date.setFullYear(date.getFullYear() + 1, 0, 1);
break;
}
return this.disabledCalendarChanger(date, type);
},
handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v - 1;
}), 'last-year');
},
handleIconDoubleRightClick: function handleIconDoubleRightClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v + 1;
}), 'next-year');
},
handlePanelChange: function handlePanelChange() {
this.$emit('changepanel', 'year');
},
handleClick: function handleClick(evt) {
var target = evt.target;
if (target.tagName.toUpperCase() === 'DIV') {
target = target.parentNode;
}
var month = target.getAttribute('data-month');
if (month && !target.classList.contains('disabled')) {
this.$emit('select', parseInt(month, 10));
}
}
}
};
/* script */
var __vue_script__$3 = script$3;
/* template */
var __vue_render__$6 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-month"
}, [_c('div', {
class: _vm.prefixClass + "-calendar-header"
}, [_c('icon-button', {
attrs: {
"type": "double-left",
"disabled": _vm.isDisabledArrows('last-year')
},
on: {
"click": _vm.handleIconDoubleLeftClick
}
}), _vm._v(" "), _c('icon-button', {
attrs: {
"type": "double-right",
"disabled": _vm.isDisabledArrows('next-year')
},
on: {
"click": _vm.handleIconDoubleRightClick
}
}), _vm._v(" "), _c('span', {
class: _vm.prefixClass + "-calendar-header-label"
}, [_c('button', {
class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text",
attrs: {
"type": "button"
},
on: {
"click": _vm.handlePanelChange
}
}, [_vm._v("\n " + _vm._s(_vm.calendarYear) + "\n ")])])], 1), _vm._v(" "), _c('div', {
class: _vm.prefixClass + "-calendar-content"
}, [_c('table', {
class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-month",
on: {
"click": _vm.handleClick
}
}, _vm._l(_vm.months, function (row, i) {
return _c('tr', {
key: i
}, _vm._l(row, function (cell, j) {
return _c('td', {
key: j,
staticClass: "cell",
class: _vm.getCellClasses(cell.month),
attrs: {
"data-month": cell.month
}
}, [_c('div', [_vm._v(_vm._s(cell.text))])]);
}), 0);
}), 0)])]);
};
var __vue_staticRenderFns__$6 = [];
/* style */
var __vue_inject_styles__$6 = undefined;
/* scoped */
var __vue_scope_id__$6 = undefined;
/* module identifier */
var __vue_module_identifier__$6 = undefined;
/* functional template */
var __vue_is_functional_template__$6 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$6 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$6,
staticRenderFns: __vue_staticRenderFns__$6
}, __vue_inject_styles__$6, __vue_script__$3, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, false, undefined, undefined, undefined);
//
var script$4 = {
name: 'TableYear',
components: {
IconButton: __vue_component__$4
},
inject: {
prefixClass: {
default: 'mx'
}
},
props: {
disabledCalendarChanger: {
type: Function,
default: function _default() {
return false;
}
},
calendar: {
type: Date,
default: function _default() {
return new Date();
}
},
getCellClasses: {
type: Function,
default: function _default() {
return [];
}
},
getYearPanel: {
type: Function
}
},
computed: {
years: function years() {
var calendar = new Date(this.calendar);
if (typeof this.getYearPanel === 'function') {
return this.getYearPanel(calendar);
}
return this.getYears(calendar);
},
firstYear: function firstYear() {
return this.years[0][0];
},
lastYear: function lastYear() {
var last = function last(arr) {
return arr[arr.length - 1];
};
return last(last(this.years));
}
},
methods: {
isDisabledArrows: function isDisabledArrows(type) {
var date = new Date(this.calendar);
switch (type) {
case 'last-decade':
date.setFullYear(this.firstYear - 1, 11, 31);
date.setHours(23, 59, 59, 999);
break;
case 'next-decade':
date.setFullYear(this.lastYear + 1, 0, 1);
break;
}
return this.disabledCalendarChanger(date, type);
},
getYears: function getYears(calendar) {
var firstYear = Math.floor(calendar.getFullYear() / 10) * 10;
var years = [];
for (var i = 0; i < 10; i++) {
years.push(firstYear + i);
}
return chunk(years, 2);
},
handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v - 10;
}), 'last-decade');
},
handleIconDoubleRightClick: function handleIconDoubleRightClick() {
this.$emit('changecalendar', setYear(this.calendar, function (v) {
return v + 10;
}), 'next-decade');
},
handleClick: function handleClick(evt) {
var target = evt.target;
if (target.tagName.toUpperCase() === 'DIV') {
target = target.parentNode;
}
var year = target.getAttribute('data-year');
if (year && !target.classList.contains('disabled')) {
this.$emit('select', parseInt(year, 10));
}
}
}
};
/* script */
var __vue_script__$4 = script$4;
/* template */
var __vue_render__$7 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-year"
}, [_c('div', {
class: _vm.prefixClass + "-calendar-header"
}, [_c('icon-button', {
attrs: {
"type": "double-left",
"disabled": _vm.isDisabledArrows('last-decade')
},
on: {
"click": _vm.handleIconDoubleLeftClick
}
}), _vm._v(" "), _c('icon-button', {
attrs: {
"type": "double-right",
"disabled": _vm.isDisabledArrows('next-decade')
},
on: {
"click": _vm.handleIconDoubleRightClick
}
}), _vm._v(" "), _c('span', {
class: _vm.prefixClass + "-calendar-header-label"
}, [_c('span', [_vm._v(_vm._s(_vm.firstYear))]), _vm._v(" "), _c('span', {
class: _vm.prefixClass + "-calendar-decade-separator"
}), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.lastYear))])])], 1), _vm._v(" "), _c('div', {
class: _vm.prefixClass + "-calendar-content"
}, [_c('table', {
class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-year",
on: {
"click": _vm.handleClick
}
}, _vm._l(_vm.years, function (row, i) {
return _c('tr', {
key: i
}, _vm._l(row, function (cell, j) {
return _c('td', {
key: j,
staticClass: "cell",
class: _vm.getCellClasses(cell),
attrs: {
"data-year": cell
}
}, [_c('div', [_vm._v(_vm._s(cell))])]);
}), 0);
}), 0)])]);
};
var __vue_staticRenderFns__$7 = [];
/* style */
var __vue_inject_styles__$7 = undefined;
/* scoped */
var __vue_scope_id__$7 = undefined;
/* module identifier */
var __vue_module_identifier__$7 = undefined;
/* functional template */
var __vue_is_functional_template__$7 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$7 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$7,
staticRenderFns: __vue_staticRenderFns__$7
}, __vue_inject_styles__$7, __vue_script__$4, __vue_scope_id__$7, __vue_is_functional_template__$7, __vue_module_identifier__$7, false, undefined, undefined, undefined);
var CalendarPanel = {
name: 'CalendarPanel',
inject: {
prefixClass: {
default: 'mx'
},
dispatchDatePicker: {
default: function _default() {
return function () {};
}
}
},
props: {
value: {},
defaultValue: {
default: function _default() {
var date = new Date();
date.setHours(0, 0, 0, 0);
return date;
}
},
defaultPanel: {
type: String
},
disabledCalendarChanger: {
type: Function,
default: function _default() {
return false;
}
},
disabledDate: {
type: Function,
default: function _default() {
return false;
}
},
type: {
type: String,
default: 'date'
},
getClasses: {
type: Function,
default: function _default() {
return [];
}
},
showWeekNumber: {
type: Boolean,
default: undefined
},
getYearPanel: {
type: Function
},
titleFormat: {
type: String,
default: 'YYYY-MM-DD'
},
calendar: Date,
// update date when select year or month
partialUpdate: {
type: Boolean,
default: false
}
},
data: function data() {
var panels = ['date', 'month', 'year'];
var index = Math.max(panels.indexOf(this.type), panels.indexOf(this.defaultPanel));
var panel = index !== -1 ? panels[index] : 'date';
return {
panel: panel,
innerCalendar: new Date()
};
},
computed: {
innerValue: function innerValue() {
var value = Array.isArray(this.value) ? this.value : [this.value];
var map = {
year: startOfYear,
month: startOfMonth,
date: startOfDay
};
var start = map[this.type] || map.date;
return value.filter(isValidDate).map(function (v) {
return start(v);
});
},
calendarYear: function calendarYear() {
return this.innerCalendar.getFullYear();
},
calendarMonth: function calendarMonth() {
return this.innerCalendar.getMonth();
}
},
watch: {
value: {
immediate: true,
handler: 'initCalendar'
},
calendar: {
handler: 'initCalendar'
},
defaultValue: {
handler: 'initCalendar'
}
},
methods: {
initCalendar: function initCalendar() {
var calendarDate = this.calendar;
if (!isValidDate(calendarDate)) {
var length = this.innerValue.length;
calendarDate = getValidDate(length > 0 ? this.innerValue[length - 1] : this.defaultValue);
}
this.innerCalendar = startOfMonth(calendarDate);
},
isDisabled: function isDisabled(date) {
return this.disabledDate(new Date(date), this.innerValue);
},
emitDate: function emitDate(date, type) {
if (!this.isDisabled(date)) {
this.$emit('select', date, type, this.innerValue);
// someone need get the first selected date to set range value. (#429)
this.dispatchDatePicker('pick', date, type);
}
},
handleCalendarChange: function handleCalendarChange(calendar, type) {
var oldCalendar = new Date(this.innerCalendar);
this.innerCalendar = calendar;
this.$emit('update:calendar', calendar);
this.dispatchDatePicker('calendar-change', calendar, oldCalendar, type);
},
handelPanelChange: function handelPanelChange(panel) {
var oldPanel = this.panel;
this.panel = panel;
this.dispatchDatePicker('panel-change', panel, oldPanel);
},
handleSelectYear: function handleSelectYear(year) {
if (this.type === 'year') {
var date = this.getYearCellDate(year);
this.emitDate(date, 'year');
} else {
this.handleCalendarChange(createDate(year, this.calendarMonth), 'year');
this.handelPanelChange('month');