UNPKG

kingdot

Version:

A UI Components Library For Vue

1,048 lines (985 loc) 42.1 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 227); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (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 (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence 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 (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // 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 { exports: scriptExports, options: options } } /***/ }), /***/ 1: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; !function (t, e) { "object" == ( false ? undefined : _typeof(exports)) && "undefined" != typeof module ? module.exports = e() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (e), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined; }(this, function () { "use strict"; var t = "millisecond", e = "second", n = "minute", r = "hour", i = "day", s = "week", u = "month", a = "quarter", o = "year", f = "date", h = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d+)?$/, c = /\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, d = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, $ = function $(t, e, n) { var r = String(t);return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t; }, l = { s: $, z: function z(t) { var e = -t.utcOffset(), n = Math.abs(e), r = Math.floor(n / 60), i = n % 60;return (e <= 0 ? "+" : "-") + $(r, 2, "0") + ":" + $(i, 2, "0"); }, m: function t(e, n) { if (e.date() < n.date()) return -t(n, e);var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), i = e.clone().add(r, u), s = n - i < 0, a = e.clone().add(r + (s ? -1 : 1), u);return +(-(r + (n - i) / (s ? i - a : a - i)) || 0); }, a: function a(t) { return t < 0 ? Math.ceil(t) || 0 : Math.floor(t); }, p: function p(h) { return { M: u, y: o, w: s, d: i, D: f, h: r, m: n, s: e, ms: t, Q: a }[h] || String(h || "").toLowerCase().replace(/s$/, ""); }, u: function u(t) { return void 0 === t; } }, y = "en", M = {};M[y] = d;var m = function m(t) { return t instanceof S; }, D = function D(t, e, n) { var r;if (!t) return y;if ("string" == typeof t) M[t] && (r = t), e && (M[t] = e, r = t);else { var i = t.name;M[i] = t, r = i; }return !n && r && (y = r), r || !n && y; }, v = function v(t, e) { if (m(t)) return t.clone();var n = "object" == (typeof e === "undefined" ? "undefined" : _typeof(e)) ? e : {};return n.date = t, n.args = arguments, new S(n); }, g = l;g.l = D, g.i = m, g.w = function (t, e) { return v(t, { locale: e.$L, utc: e.$u, x: e.$x, $offset: e.$offset }); };var S = function () { function d(t) { this.$L = this.$L || D(t.locale, null, !0), this.parse(t); }var $ = d.prototype;return $.parse = function (t) { this.$d = function (t) { var e = t.date, n = t.utc;if (null === e) return new Date(NaN);if (g.u(e)) return new Date();if (e instanceof Date) return new Date(e);if ("string" == typeof e && !/Z$/i.test(e)) { var r = e.match(h);if (r) { var i = r[2] - 1 || 0, s = (r[7] || "0").substring(0, 3);return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s); } }return new Date(e); }(t), this.$x = t.x || {}, this.init(); }, $.init = function () { var t = this.$d;this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds(); }, $.$utils = function () { return g; }, $.isValid = function () { return !("Invalid Date" === this.$d.toString()); }, $.isSame = function (t, e) { var n = v(t);return this.startOf(e) <= n && n <= this.endOf(e); }, $.isAfter = function (t, e) { return v(t) < this.startOf(e); }, $.isBefore = function (t, e) { return this.endOf(e) < v(t); }, $.$g = function (t, e, n) { return g.u(t) ? this[e] : this.set(n, t); }, $.unix = function () { return Math.floor(this.valueOf() / 1e3); }, $.valueOf = function () { return this.$d.getTime(); }, $.startOf = function (t, a) { var h = this, c = !!g.u(a) || a, d = g.p(t), $ = function $(t, e) { var n = g.w(h.$u ? Date.UTC(h.$y, e, t) : new Date(h.$y, e, t), h);return c ? n : n.endOf(i); }, l = function l(t, e) { return g.w(h.toDate()[t].apply(h.toDate("s"), (c ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), h); }, y = this.$W, M = this.$M, m = this.$D, D = "set" + (this.$u ? "UTC" : "");switch (d) {case o: return c ? $(1, 0) : $(31, 11);case u: return c ? $(1, M) : $(0, M + 1);case s: var v = this.$locale().weekStart || 0, S = (y < v ? y + 7 : y) - v;return $(c ? m - S : m + (6 - S), M);case i:case f: return l(D + "Hours", 0);case r: return l(D + "Minutes", 1);case n: return l(D + "Seconds", 2);case e: return l(D + "Milliseconds", 3);default: return this.clone();} }, $.endOf = function (t) { return this.startOf(t, !1); }, $.$set = function (s, a) { var h, c = g.p(s), d = "set" + (this.$u ? "UTC" : ""), $ = (h = {}, h[i] = d + "Date", h[f] = d + "Date", h[u] = d + "Month", h[o] = d + "FullYear", h[r] = d + "Hours", h[n] = d + "Minutes", h[e] = d + "Seconds", h[t] = d + "Milliseconds", h)[c], l = c === i ? this.$D + (a - this.$W) : a;if (c === u || c === o) { var y = this.clone().set(f, 1);y.$d[$](l), y.init(), this.$d = y.set(f, Math.min(this.$D, y.daysInMonth())).$d; } else $ && this.$d[$](l);return this.init(), this; }, $.set = function (t, e) { return this.clone().$set(t, e); }, $.get = function (t) { return this[g.p(t)](); }, $.add = function (t, a) { var f, h = this;t = Number(t);var c = g.p(a), d = function d(e) { var n = v(h);return g.w(n.date(n.date() + Math.round(e * t)), h); };if (c === u) return this.set(u, this.$M + t);if (c === o) return this.set(o, this.$y + t);if (c === i) return d(1);if (c === s) return d(7);var $ = (f = {}, f[n] = 6e4, f[r] = 36e5, f[e] = 1e3, f)[c] || 1, l = this.$d.getTime() + t * $;return g.w(l, this); }, $.subtract = function (t, e) { return this.add(-1 * t, e); }, $.format = function (t) { var e = this;if (!this.isValid()) return "Invalid Date";var n = t || "YYYY-MM-DDTHH:mm:ssZ", r = g.z(this), i = this.$locale(), s = this.$H, u = this.$m, a = this.$M, o = i.weekdays, f = i.months, h = function h(t, r, i, s) { return t && (t[r] || t(e, n)) || i[r].substr(0, s); }, d = function d(t) { return g.s(s % 12 || 12, t, "0"); }, $ = i.meridiem || function (t, e, n) { var r = t < 12 ? "AM" : "PM";return n ? r.toLowerCase() : r; }, l = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a + 1, MM: g.s(a + 1, 2, "0"), MMM: h(i.monthsShort, a, f, 3), MMMM: h(f, a), D: this.$D, DD: g.s(this.$D, 2, "0"), d: String(this.$W), dd: h(i.weekdaysMin, this.$W, o, 2), ddd: h(i.weekdaysShort, this.$W, o, 3), dddd: o[this.$W], H: String(s), HH: g.s(s, 2, "0"), h: d(1), hh: d(2), a: $(s, u, !0), A: $(s, u, !1), m: String(u), mm: g.s(u, 2, "0"), s: String(this.$s), ss: g.s(this.$s, 2, "0"), SSS: g.s(this.$ms, 3, "0"), Z: r };return n.replace(c, function (t, e) { return e || l[t] || r.replace(":", ""); }); }, $.utcOffset = function () { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, $.diff = function (t, f, h) { var c, d = g.p(f), $ = v(t), l = 6e4 * ($.utcOffset() - this.utcOffset()), y = this - $, M = g.m(this, $);return M = (c = {}, c[o] = M / 12, c[u] = M, c[a] = M / 3, c[s] = (y - l) / 6048e5, c[i] = (y - l) / 864e5, c[r] = y / 36e5, c[n] = y / 6e4, c[e] = y / 1e3, c)[d] || y, h ? M : g.a(M); }, $.daysInMonth = function () { return this.endOf(u).$D; }, $.$locale = function () { return M[this.$L]; }, $.locale = function (t, e) { if (!t) return this.$L;var n = this.clone(), r = D(t, e, !0);return r && (n.$L = r), n; }, $.clone = function () { return g.w(this.$d, this); }, $.toDate = function () { return new Date(this.valueOf()); }, $.toJSON = function () { return this.isValid() ? this.toISOString() : null; }, $.toISOString = function () { return this.$d.toISOString(); }, $.toString = function () { return this.$d.toUTCString(); }, d; }(), p = S.prototype;return v.prototype = p, [["$ms", t], ["$s", e], ["$m", n], ["$H", r], ["$W", i], ["$M", u], ["$y", o], ["$D", f]].forEach(function (t) { p[t[1]] = function (e) { return this.$g(e, t[0], t[1]); }; }), v.extend = function (t, e) { return t(e, S, v), v; }, v.locale = D, v.isDayjs = m, v.unix = function (t) { return v(1e3 * t); }, v.en = M[y], v.Ls = M, v; }); /***/ }), /***/ 199: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; !function (e, t) { "object" == ( false ? undefined : _typeof(exports)) && "undefined" != typeof module ? module.exports = t() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (t), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined; }(this, function () { "use strict"; return function (e, t, i) { t.prototype.isBetween = function (e, t, s, f) { var n = i(e), o = i(t), r = "(" === (f = f || "()")[0], u = ")" === f[1];return (r ? this.isAfter(n, s) : !this.isBefore(n, s)) && (u ? this.isBefore(o, s) : !this.isAfter(o, s)) || (r ? this.isBefore(n, s) : !this.isAfter(n, s)) && (u ? this.isAfter(o, s) : !this.isBefore(o, s)); }; }; }); /***/ }), /***/ 227: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/Calendar/calendar.vue?vue&type=template&id=5aa79e86& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"kd-calendar-wrapper",on:{"click":function($event){$event.stopPropagation();}}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-year' || _vm.mode==='select-month'),expression:"mode==='select-year' || mode==='select-month'"}],staticClass:"kd-calendar-header"},[_c('i',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-year'),expression:"mode==='select-year'"}],staticClass:"kd-icon-date-forward page-left-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year', -10)}}}),_c('i',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-month'),expression:"mode==='select-month'"}],staticClass:"kd-icon-date-forward page-left-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year', -1)}}}),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-year'),expression:"mode==='select-year'"}]},[_vm._v("\n "+_vm._s(Math.floor(_vm.moment.year() / 10) * 10)+"年 ~ "+_vm._s(Math.floor(_vm.moment.year() / 10) * 10 + 9)+"年\n ")]),_c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-month'),expression:"mode==='select-month'"}],class:{ 'kd-calendar-text-btn': !_vm.isRange, },on:{"click":function($event){$event.stopPropagation();return _vm.setMode('select-year')}}},[_vm._v(_vm._s(_vm.year)+" 年\n ")]),_c('i',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-year'),expression:"mode==='select-year'"}],staticClass:"kd-icon-date-forward page-right-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year',10)}}}),_c('i',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-month'),expression:"mode==='select-month'"}],staticClass:"kd-icon-date-forward page-right-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year',1)}}})]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-day'),expression:"mode==='select-day'"}],staticClass:"kd-calendar-header"},[(!_vm.isRange || _vm.isRange && !_vm.isEndCalendar)?_c('i',{staticClass:"kd-icon-skip-forward page-left-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year', -1)}}}):_vm._e(),(!_vm.isRange || _vm.isRange && !_vm.isEndCalendar)?_c('i',{staticClass:"kd-icon-date-forward page-left-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Month', -1)}}}):_vm._e(),_c('span',{class:{ 'kd-calendar-text-btn': !_vm.isRange, },on:{"click":function($event){$event.stopPropagation();return _vm.setMode('select-year')}}},[_vm._v(_vm._s(_vm.year)+" 年 ")]),_c('span',{class:{ 'kd-calendar-text-btn': !_vm.isRange, },on:{"click":function($event){$event.stopPropagation();return _vm.setMode('select-month')}}},[_vm._v(_vm._s(_vm.month)+" 月")]),(!_vm.isRange || _vm.isRange && _vm.isEndCalendar)?_c('i',{staticClass:"kd-icon-skip-forward page-right-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Year',1)}}}):_vm._e(),(!_vm.isRange || _vm.isRange && _vm.isEndCalendar)?_c('i',{staticClass:"kd-icon-date-forward page-right-icon",on:{"click":function($event){$event.stopPropagation();return _vm.setMonthOrYear('Month',1)}}}):_vm._e()]),_c('div',{staticClass:"kd-calendar-default"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-day'),expression:"mode==='select-day'"}],staticClass:"kd-week"},_vm._l((['日', '一', '二', '三', '四', '五', '六']),function(v){return _c('span',{key:v},[_vm._v(_vm._s(v)+"\n ")])}),0),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-year'),expression:"mode==='select-year'"}],staticClass:"kd-calendar-table year"},_vm._l((_vm.yearLists),function(row,index){return _c('div',{key:index,staticClass:"kd-calendar-row wide"},_vm._l((row),function(item,k){return _c('span',{key:k,class:{ 'kd-year': true, 'kd-blue':item.year === _vm.now.year, 'kd-disabled': item.isDisabled, 'kd-in-range': item.isInRange, 'kd-selected': _vm.selectedDate[0] && _vm.selectedDate[0].indexOf(item.dateStr) > -1, },on:{"click":function($event){$event.stopPropagation();return _vm.selectYear(item)}}},[_vm._v("\n "+_vm._s(item.year)+"\n ")])}),0)}),0),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-month'),expression:"mode==='select-month'"}],staticClass:"kd-calendar-table month"},_vm._l((_vm.monthLists),function(row,index){return _c('div',{key:index,staticClass:"kd-calendar-row wide"},_vm._l((row),function(item,k){return _c('span',{key:k,class:{ 'kd-month': true, 'kd-blue': item.isCurrentMonth, 'kd-disabled': item.isDisabled, 'kd-in-range': item.isInRange, 'kd-selected': _vm.selectedDate[0] && _vm.selectedDate[0].indexOf(item.dateStr) > -1, },on:{"click":function($event){$event.stopPropagation();return _vm.selectMonth(item)}}},[_vm._v("\n "+_vm._s(item.month)+" 月\n ")])}),0)}),0),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.mode==='select-day'),expression:"mode==='select-day'"}],staticClass:"kd-calendar-table day"},_vm._l((_vm.dayLists),function(row,index){return _c('div',{key:index,staticClass:"kd-calendar-row"},_vm._l((row),function(item,k){return _c('div',{key:k,class:{ 'kd-day-container': true, 'kd-in-range': item.isInRange, 'kd-disMonth': item.disMonth, 'kd-disabled': item.isDisabled, }},[_c('div',{class:{ 'kd-day': true, 'kd-today':item.isTodayFlag, 'kd-disMonth': item.disMonth, 'kd-disabled': item.isDisabled, 'kd-in-range': item.isInRange, 'kd-selected': _vm.selectedDate.indexOf(item.dateStr) > -1 },on:{"click":function($event){$event.stopPropagation();return _vm.selectDate(item)},"mouseenter":function($event){return _vm.onDayMouseenter(item)}}},[_vm._v("\n "+_vm._s(item.day)+"\n ")])])}),0)}),0)])])} var staticRenderFns = [] // CONCATENATED MODULE: ./components/Calendar/calendar.vue?vue&type=template&id=5aa79e86& // EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js var dayjs_min = __webpack_require__(1); var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Calendar/calendar.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var isBetween = __webpack_require__(199); dayjs_min_default.a.extend(isBetween); /* harmony default export */ var calendarvue_type_script_lang_js_ = ({ name: 'Calendar', props: { // 选中的日期列表 value: { type: [String, Array], default: function _default() { return []; } }, formatString: { type: String, default: function _default() { return 'YYYY-MM-DD'; } }, isEndCalendar: { type: Boolean, default: function _default() { return false; } }, rangeEndDate: { type: String, default: function _default() { return ''; } }, // 条件禁用, 可以接受日期字符串, 以及筛选条件 disabledDate: { type: [Array, Function], default: function _default() { return []; } }, isRange: { // 范围选择模式 type: Boolean, default: function _default() { return false; } }, isMultiple: { // 多选模式 type: Boolean, default: function _default() { return false; } }, readOnly: { type: Boolean, default: function _default() { return false; } }, minDate: { type: String }, maxDate: { type: String }, pickType: { type: String } }, data: function data() { return { now: { year: dayjs_min_default()().year(), month: dayjs_min_default()().month() + 1, date: dayjs_min_default()().date() }, moment: this.value[0] ? this.isEndCalendar ? dayjs_min_default()(this.value[0]).add(1, 'month') : dayjs_min_default()(this.value[0]) // 第二日历 默认渲染下个月的日期 : this.isEndCalendar ? dayjs_min_default()().add(1, 'month') : dayjs_min_default()(), // 没有初始值时, 默认展示当前月份 selectedDate: this.value, maxDateValue: this.maxDate, minDateValue: this.minDate, mode: ['year', 'month'].indexOf(this.pickType) > -1 ? 'select-' + this.pickType : 'select-day' }; }, computed: { // selectedDate() { // return this.value; // }, hoverDate: function hoverDate() { return this.rangeEndDate; }, year: function year() { return this.moment.year(); }, month: function month() { return this.moment.month() + 1; }, yearLists: function yearLists() { var rows = []; var tmpArr = []; var tmpYear = dayjs_min_default()(String(Math.floor(this.moment.year() / 10) * 10)); for (var j = 0; j < 10; j++) { tmpArr.push({ year: tmpYear.year(), dateStr: tmpYear.format('YYYY'), isDisabled: this.checkDisabled(tmpYear.format('YYYY'), this.selectedDate[0]) || this.maxDateValue && tmpYear.isAfter(dayjs_min_default()(this.maxDateValue), 'year') || this.minDateValue && tmpYear.isBefore(dayjs_min_default()(this.minDateValue), 'year') // isInRange: this.selectedDate.length > 0 && !!rangeEndDate && tmpYear.isBetween(this.selectedDate[0], rangeEndDate, 'year', '()') || false }); tmpYear = tmpYear.add(1, 'year'); } for (var i = 0; i < 3; i++) { rows.push(tmpArr.slice(i * 4, (i + 1) * 4)); } return rows; }, monthLists: function monthLists() { var rows = []; var tmpArr = []; var tmpTime = this.moment.set('month', 0); var rangeEndDate = void 0; if (this.isRange) { rangeEndDate = this.selectedDate[1] || !!this.hoverDate && this.hoverDate || this.selectedDate[0]; } // console.log('min, max', this.minDateValue, this.maxDateValue, this.selectedDate[0]) for (var j = 1; j <= 12; j++) { tmpArr.push({ dateStr: tmpTime.format('YYYY-MM'), // 日期字符串 month: tmpTime.month() + 1, // 当前第几月. 渲染用 isCurrentMonth: tmpTime.month() === dayjs_min_default()().month() && tmpTime.year() === dayjs_min_default()().year(), isDisabled: this.checkDisabled(tmpTime.format('YYYY-MM'), this.selectedDate[0]) || this.maxDateValue && tmpTime.isAfter(dayjs_min_default()(this.maxDateValue), 'month') || this.minDateValue && tmpTime.isBefore(dayjs_min_default()(this.minDateValue), 'month'), isInRange: this.selectedDate.length > 0 && !!rangeEndDate && tmpTime.isBetween(this.selectedDate[0], rangeEndDate, 'day', '()') || false }); tmpTime = tmpTime.add(1, 'month'); // tmpArr.push(j); } for (var i = 0; i < 3; i++) { rows.push(tmpArr.slice(i * 4, (i + 1) * 4)); } return rows; }, // 渲染日历 dayLists: function dayLists() { var row = []; var calendatArr = []; var tmpTime = this.moment.set('date', 1); tmpTime = tmpTime.subtract(tmpTime.day(), 'day'); var rangeEndDate = void 0; if (this.isRange) { rangeEndDate = this.selectedDate[1] || !!this.hoverDate && this.hoverDate || this.selectedDate[0]; } // 6行 * 7列 = 42 for (var j = 0; j < 42; j++) { calendatArr.push({ dateStr: tmpTime.format(this.formatString), // 日期字符串 day: tmpTime.date(), // 当前日期. 渲染用 disMonth: tmpTime.month() !== this.moment.month(), // 非本月日期置灰 isTodayFlag: tmpTime.date() === dayjs_min_default()().date() && // 试试用 equal代替 tmpTime.month() === dayjs_min_default()().month() && tmpTime.year() === dayjs_min_default()().year(), // isDisabled: this.disabledDate && this.disabledDate(tmpTime.format(this.formatString), this.selectedDate[0]) || isDisabled: this.checkDisabled(tmpTime.format(this.formatString), this.selectedDate[0]) || this.maxDateValue && tmpTime.isAfter(dayjs_min_default()(this.maxDateValue), 'day') || this.minDateValue && tmpTime.isBefore(dayjs_min_default()(this.minDateValue), 'day'), isInRange: this.selectedDate.length > 0 && !!rangeEndDate && tmpTime.isBetween(this.selectedDate[0], rangeEndDate, 'day', '()') || false }); tmpTime = tmpTime.add(1, 'day'); } for (var i = 0; i < 6; i++) { row.push(calendatArr.slice(i * 7, (i + 1) * 7)); } return row; } }, watch: { value: { immediate: true, handler: function handler(v) { if (Array.isArray(v)) { this.selectedDate = v; // fix: 当日历用来回显接口返回的日期时, 应当重新渲染日历页面 if (!this.isRange) { this.refreshCalendar(); } else if (this.isRange && v.length === 2) { this.refreshCalendar(); } } else if (typeof v === 'string') { this.selectedDate = [v]; } } }, rangeEndDate: { immediate: true, handler: function handler(v) { // this.maxDateValue = v; } }, maxDate: { immediate: true, handler: function handler(v) { this.maxDateValue = v; } }, minDate: { immediate: true, handler: function handler(v) { this.minDateValue = v; } } }, methods: { refreshCalendar: function refreshCalendar() { var lastDate = this.value[this.value.length - 1]; this.moment = lastDate ? this.isEndCalendar ? dayjs_min_default()(lastDate).add(1, 'month') : dayjs_min_default()(lastDate) // 第二日历 默认渲染下个月的日期 : this.isEndCalendar ? dayjs_min_default()().add(1, 'month') : dayjs_min_default()(); }, setMode: function setMode(mode) { if (this.isRange) return; this.mode = mode; }, onDayMouseenter: function onDayMouseenter(dayItem) { // this.hoverDate = dayItem.dateStr; this.$emit('onDayMouseenter', dayItem.dateStr); }, // 日历翻页 setMonthOrYear: function setMonthOrYear(unit, v) { // 如果是 isRange 状态, 应该由外层判断效果 if (this.isRange) { this.$emit('pageChange', v, unit); // 由外层统一执行 } else { this.changePage(v, unit); } }, changePage: function changePage(v, unit) { this.moment = this.moment.add(v, unit); }, selectYear: function selectYear(yearItem) { if (yearItem.isDisabled) return; if (this.pickType === 'year') { this.selectedDate.splice(0, this.selectedDate.length, yearItem.dateStr); // 清空, 然后第一位赋值 this.$emit('select', this.selectedDate, 'calendar'); return; } this.moment = dayjs_min_default()(yearItem.dateStr); this.mode = 'select-month'; }, selectMonth: function selectMonth(monthItem) { if (monthItem.isDisabled) return; if (this.pickType === 'month') { this.selectedDate.splice(0, this.selectedDate.length, monthItem.dateStr); // 清空, 然后第一位赋值 this.$emit('select', this.selectedDate, 'calendar'); return; } this.moment = dayjs_min_default()(monthItem.dateStr); this.mode = 'select-day'; }, checkDisabled: function checkDisabled(dateStr, firstDate) { var disable = false; if (this.disabledDate) { if (Array.isArray(this.disabledDate)) { disable = disable || this.disabledDate.includes(dateStr); } if (typeof this.disabledDate === 'function') { disable = disable || this.disabledDate(dateStr, firstDate); } } return disable; }, // 点击选中日期 selectDate: function selectDate(date) { if (this.readOnly) return; if (date.isDisabled) return; if (date.disMonth) return; // 不能点击另外月份的日期进行翻页 if (this.isRange && date.disMonth) return; // 多选 // if (this.isMultiple) { // const pos = this.value.indexOf(date.dateStr); // if (pos < 0) { // this.value.push(date.dateStr); // } else { // this.value.splice(pos, 1); // } // // this.selectedDate.push(date.dateStr); // this.$emit('select', this.value); // } if (this.isRange) { // 范围选择模式, 第三次点击意味着重选 if (this.selectedDate.length >= 2) { this.value.splice(0, this.value.length); } // 点击已选中的日期, 取消选中 (仅多选模式需要该功能) // const pos = this.selectedDate.indexOf(date.dateStr); // if (pos < 0) { // this.selectedDate.push(date.dateStr); // } else { // this.selectedDate.splice(pos, 1); // } // 范围日期模式 允许 选择一天: 2021-01-01 ~ 2021-01-01 this.selectedDate.push(date.dateStr); // 使时间字符串数组保持 左值早于右值 if (dayjs_min_default()(this.selectedDate[0]).isAfter(dayjs_min_default()(this.selectedDate[1]))) { // 左时间晚于右时间 var tmp = this.selectedDate.pop(); this.selectedDate.unshift(tmp); } this.$emit('select', this.selectedDate, 'calendar'); } else if (this.isMultiple) { // 单点 多选 var pos = this.value.indexOf(date.dateStr); if (pos < 0) { this.value.push(date.dateStr); } else { this.value.splice(pos, 1); } // this.selectedDate.push(date.dateStr); this.$emit('select', this.value); } else { // 非时间范围(单点时间) if (date.disMonth) { this.moment = dayjs_min_default()(date.dateStr); // 点击其他月份日期, 需要刷新日历的页面 } this.selectedDate.splice(0, this.value.length, date.dateStr); // 清空, 然后第一位赋值 this.$emit('select', this.selectedDate, 'calendar'); } }, jumpToDate: function jumpToDate(dateValue, source) { // 接受 dateArr this.selectedDate 可以是array if (Array.isArray(dateValue)) { this.selectedDate = dateValue; this.$emit('select', this.selectedDate, source); this.moment = this.isEndCalendar ? dayjs_min_default()(dateValue[0]).add(1, 'month') : dayjs_min_default()(dateValue[0]); } else if (typeof dateValue === 'string') { var formattedStr = dayjs_min_default()(dateValue).format(this.formatString); this.selectedDate = [formattedStr]; // if (this.disabledDate && this.disabledDate(formattedStr, this.selectedDate[0])) { if (this.checkDisabled(formattedStr, this.selectedDate[0])) { this.$emit('select', 'Invalid Date'); return; } this.moment = dayjs_min_default()(dateValue); // 刷新日历的页面 // this.$emit('input', this.selectedDate); this.$emit('select', this.selectedDate, source); } } } }); // CONCATENATED MODULE: ./components/Calendar/calendar.vue?vue&type=script&lang=js& /* harmony default export */ var Calendar_calendarvue_type_script_lang_js_ = (calendarvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/Calendar/calendar.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( Calendar_calendarvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var calendar = (component.exports); // CONCATENATED MODULE: ./components/Calendar/index.js calendar.install = function (Vue) { Vue.component(calendar.name, calendar); }; /* harmony default export */ var Calendar = __webpack_exports__["default"] = (calendar); /***/ }) /******/ })["default"];