@livelybone/vue-datepicker
Version:
A vue component of datepicker, includes DatePicker, DateRangePicker, DatetimePicker, DateRangePicker, TimePicker
1,641 lines (1,453 loc) • 84.3 kB
JavaScript
/**
* Bundle of @livelybone/vue-datepicker
* Generated: 2022-07-30
* Version: 4.1.2
* License: MIT
* Author: 2631541504@qq.com
*/
import { fillTo, parseDate, compareDates, parseTime, getMonthByStep, getMonthLen, gntYear, gntMonth, gntCalendar, getDateByStep, getHour, getMinute, getSecond } from '@livelybone/date-generator';
import { objectDeepMerge } from '@livelybone/copy';
import VuePopper from '@livelybone/vue-popper';
import VueScrollbar from 'vue-scrollbar-live';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
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.");
}
var dateReg = /^((\d{4})-?(\d{1,2})?-?(\d{1,2})?)/;
var timeReg = /^((\d{1,2}):?(\d{1,2})?:?(\d{1,2})?)/;
var AllTypes = ['year', 'month', 'date', 'time'];
var AllTimeTypes = ['hour', 'minute', 'second'];
function sliceUtilEqual(arr, val) {
var index = Object.keys(arr).find(function (i) {
return arr[+i] === val;
});
if (!index) return arr;
return arr.slice(0, +index + 1);
} // flag:
// -1 - 如果 d1 小于等于 d2,返回 true
// 1 - 如果 d1 大于等于 d2,返回 true
// 0 - 如果 d1 等于 d2,返回 true
function dateCompare(date, targetDate) {
var flag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'date';
var $date = typeof date === 'string' ? parseDate(date) : date ? _objectSpread2({}, date) : undefined;
var $targetDate = typeof targetDate === 'string' ? parseDate(targetDate) : targetDate ? _objectSpread2({}, targetDate) : undefined;
if (!$date) return false;
if (!$targetDate) return true;
if (type === 'year') {
$date.month = '01';
$date.date = '01';
$targetDate.month = '01';
$targetDate.date = '01';
} else if (type === 'month') {
$date.date = '01';
$targetDate.date = '01';
}
var compare = compareDates($date, $targetDate);
return flag === 0 ? compare === 0 : compare * flag >= 0;
} // flag:
// -1 - 如果 t1 小于等于 t2,返回 true
// 1 - 如果 t1 大于等于 t2,返回 true
// 0 - 如果 t1 等于 t2,返回 true
function timeCompare(time, targetTime) {
var flag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'second';
var $time = typeof time === 'string' ? parseTime(time) : time ? _objectSpread2({}, time) : undefined;
var $targetTime = typeof targetTime === 'string' ? parseTime(targetTime) : targetTime ? _objectSpread2({}, targetTime) : undefined;
if (!$time) return false;
if (!$targetTime) return true;
if (type === 'hour') {
$time.minute = '00';
$time.second = '00';
$targetTime.minute = '00';
$targetTime.second = '00';
} else if (type === 'minute') {
$time.second = '00';
$targetTime.second = '00';
}
var get = function get(t) {
return +"".concat(fillTo(2, t.hour)).concat(fillTo(2, t.minute)).concat(fillTo(2, t.second));
};
var compare = get($time) - get($targetTime);
return flag === 0 ? compare === 0 : compare * flag >= 0;
}
function datetimeCompare(datetime, targetDatetime) {
var flag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'second';
if (!datetime) return false;
if (!targetDatetime) return true;
if (flag === 0) return dateCompare(datetime, targetDatetime, flag) && (datetime.hour === undefined || timeCompare(datetime, targetDatetime, flag));
var compare = dateCompare(datetime, targetDatetime, flag);
if (!compare) return false;
var compareReverse = dateCompare(datetime, targetDatetime, -flag);
if (compareReverse) return datetime.hour === undefined || timeCompare(datetime, targetDatetime, flag, type);
return true;
}
function $fillTo(width, num) {
return num !== undefined ? fillTo(width, num) : '';
}
function getTenYears(val) {
if (!val) return '';
var tenYear = Math.floor(+val.year / 10 - 0.5);
return "".concat(tenYear * 10 + 1, " - ").concat((tenYear + 1) * 10);
}
function createNowTimeObj() {
var now = new Date();
return {
year: now.getFullYear(),
month: now.getMonth() + 1,
date: now.getDate(),
hour: now.getHours(),
minute: now.getMinutes(),
second: now.getSeconds()
};
}
function formatDateObj(val) {
return {
year: val.year && fillTo(4, val.year) || '',
month: val.month && fillTo(2, val.month) || '',
date: val.date && fillTo(2, val.date) || ''
};
}
function formatTimeObj(val) {
return {
hour: val.hour && fillTo(2, val.hour) || '',
minute: val.minute && fillTo(2, val.minute) || '',
second: val.second && fillTo(2, val.second) || ''
};
}
function formatDate(d) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'date';
if (!d) return '';
var arr = [];
var year = d.year && $fillTo(4, d.year);
if (year) {
arr.push(year);
var month = d.month && $fillTo(2, d.month);
if (month) {
arr.push(month);
var date = d.date && $fillTo(2, d.date);
if (date) arr.push(date);
}
}
return arr.slice(0, sliceUtilEqual(AllTypes, type).length).join('-');
}
function formatTime(t) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'second';
if (!t) return '';
var arr = [];
var hour = t.hour && $fillTo(2, t.hour);
if (hour) {
arr.push(hour);
var minute = t.minute && $fillTo(2, t.minute);
if (minute) {
arr.push(minute);
var second = t.second && $fillTo(2, t.second);
if (second) arr.push(second);
}
}
return arr.slice(0, sliceUtilEqual(AllTimeTypes, type).length).join(':');
}
function mergePropExceptEmpty(o1, o2) {
return Object.keys(_objectSpread2(_objectSpread2({}, o1), o2)).reduce(function (pre, k) {
return _objectSpread2(_objectSpread2({}, pre), {}, _defineProperty({}, k, o2 && o2[k] || o1 && o1[k]));
}, o1);
}
function dealDateLimit(min, max) {
var error = [];
var minDate = min && parseDate(min) || undefined;
if (min && !minDate) error.push("Prop min(".concat(min, ") is invalid"));
var maxDate = max && parseDate(max) || undefined;
if (max && !maxDate) error.push("Prop max(".concat(max, ") is invalid"));
return {
minDate: formatDateObj(mergePropExceptEmpty({
year: '0000',
month: '01',
date: '01'
}, minDate)),
maxDate: formatDateObj(mergePropExceptEmpty({
year: '9999',
month: '12',
date: '31'
}, maxDate)),
error: error.join(';')
};
}
function dealTimeLimit(min, max) {
var error = [];
var minTime = min && parseTime(min) || undefined;
if (min && !minTime) error.push("Prop min(".concat(min, ") is invalid"));
var maxTime = max && parseTime(max) || undefined;
if (max && !maxTime) error.push("Prop max(".concat(max, ") is invalid"));
return {
minTime: formatTimeObj(mergePropExceptEmpty({
hour: '00',
minute: '00',
second: '00'
}, minTime)),
maxTime: formatTimeObj(mergePropExceptEmpty({
hour: '23',
minute: '59',
second: '59'
}, maxTime)),
error: error.join(';')
};
}
function dealDatetimeLimit(min, max, selectedDate) {
var minArr = (min || '').trim().split(/\s+/);
var maxArr = (max || '').trim().split(/\s+/);
var _dealDateLimit = dealDateLimit(minArr[0], maxArr[0]),
minDate = _dealDateLimit.minDate,
maxDate = _dealDateLimit.maxDate;
var compare = {
toMin: minDate && selectedDate ? compareDates(selectedDate, minDate) : 1,
toMax: maxDate && selectedDate ? compareDates(selectedDate, maxDate) : -1
};
var _dealTimeLimit = dealTimeLimit(minArr[1], maxArr[1]),
$minTime = _dealTimeLimit.minTime,
$maxTime = _dealTimeLimit.maxTime;
var error = [];
var minDatetime = minDate ? _objectSpread2(_objectSpread2({}, minDate), $minTime) : undefined;
if (min && !minDatetime) error.push("Prop min(".concat(min, ") is invalid"));
var maxDatetime = maxDate ? _objectSpread2(_objectSpread2({}, maxDate), $maxTime) : undefined;
if (max && !maxDatetime) error.push("Prop min(".concat(max, ") is invalid"));
var minTime = function () {
if (compare.toMin === 0) return $minTime;
if (compare.toMin < 0) return {
hour: '23',
minute: '59',
second: '59'
};
return {
hour: '00',
minute: '00',
second: '00'
};
}();
var maxTime = function () {
if (compare.toMax === 0) return $maxTime;
if (compare.toMax > 0) return {
hour: '00',
minute: '00',
second: '00'
};
return {
hour: '23',
minute: '59',
second: '59'
};
}();
return {
minArr: minArr,
maxArr: maxArr,
minDate: minDate,
maxDate: maxDate,
minTime: minTime,
maxTime: maxTime,
minDatetime: minDatetime,
maxDatetime: maxDatetime,
error: error.join(';')
};
}
function getNextMonthFirstDate(dateInfo) {
if (!dateInfo) return undefined;
var month = getMonthByStep(dateInfo, 1);
return _objectSpread2(_objectSpread2({}, month), {}, {
date: fillTo(2, 1)
});
}
function getPrevMonthLastDate(dateInfo) {
if (!dateInfo) return undefined;
var month = getMonthByStep(dateInfo, -1);
return _objectSpread2(_objectSpread2({}, month), {}, {
date: fillTo(2, getMonthLen(month.year, month.month))
});
}
function getPrevYearLastDate(year) {
if (!year) return undefined;
return {
year: fillTo(4, +year - 1),
month: '12',
date: '31'
};
}
function getPrevTenYearLastDate(year) {
if (!year) return undefined;
return {
year: fillTo(4, (Math.ceil(+year / 10) - 1) * 10),
month: '12',
date: '31'
};
}
function getNextYearFirstDate(year) {
if (!year) return undefined;
return {
year: fillTo(4, +year + 1),
month: '01',
date: '01'
};
}
function getNextTenYearFirstDate(year) {
if (!year) return undefined;
return {
year: fillTo(4, Math.ceil(+year / 10) * 10 + 1),
month: '01',
date: '01'
};
}
function getFirstMaxDate(val) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'date';
if (!val) return undefined;
if (type === 'year') return getPrevTenYearLastDate(val.year);
if (type === 'month') return getPrevYearLastDate(val.year);
return getPrevMonthLastDate(val);
}
function getLastMinDate(val) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'date';
if (!val) return undefined;
if (type === 'year') return getNextTenYearFirstDate(val.year);
if (type === 'month') return getNextYearFirstDate(val.year);
return getNextMonthFirstDate(val);
}
function dateValidator(val) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'date';
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var max = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
if (!val) return '';
var date = typeof val === 'string' ? parseDate(val) : val;
var checkProps = sliceUtilEqual(AllTypes, type);
if (!date || !checkProps.every(function (k) {
return date[k];
})) return "Value(".concat(val, ") is invalid");
if (!((!min || dateCompare(date, min, 1, type)) && (!max || dateCompare(date, max, -1, type)))) {
return "Value".concat(val, " is out of range");
}
return '';
}
function timeValidator(val) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'second';
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var max = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
if (!val) return '';
var time = typeof val === 'string' ? parseTime(val) : val;
var checkProps = sliceUtilEqual(AllTimeTypes, type);
if (!time || !checkProps.every(function (k) {
return time[k];
})) return "Value(".concat(val, ") is invalid");
if (!((!min || timeCompare(time, min, 1, type)) && (!max || timeCompare(time, max, -1, type)))) {
return "Value".concat(val, " is out of range");
}
return '';
}
function parseDatetime(val) {
var $val = val || '';
if (!$val.trim()) return null;
var arr = $val.trim().split(/\s+/);
return _objectSpread2(_objectSpread2({}, parseDate(arr[0])), parseTime(arr[1]));
}
function datetimeValidator(val) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'second';
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var max = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
if (!val) return '';
var time = typeof val === 'string' ? parseDatetime(val) : val;
var checkProps = AllTypes.slice(0, 3).concat(sliceUtilEqual(AllTimeTypes, type));
if (!time || !checkProps.every(function (k) {
return time[k];
})) return "Value(".concat(val, ") is invalid");
if (!((!min || datetimeCompare(time, min, 1, type)) && (!max || datetimeCompare(time, max, -1, type)))) {
return "Value".concat(val, " is out of range");
}
return '';
}
function isInSameTenYear(v1, v2) {
return dateCompare(v1, v2, 0, 'year');
}
function isInSameYear(v1, v2) {
return dateCompare(v1, v2, 0, 'year');
}
function isInSameMonth(v1, v2) {
return dateCompare(v1, v2, 0, 'month');
}
function isInSamePage(_ref, type) {
var _ref2 = _slicedToArray(_ref, 2),
v1 = _ref2[0],
v2 = _ref2[1];
if (type === 'year') return isInSameTenYear(v1, v2);
if (type === 'month') return isInSameYear(v1, v2);
return isInSameMonth(v1, v2);
}
function formatDatetime(val, type) {
var str = '';
var d = formatDate(val);
str += d;
if (!str) return '';
var t = formatTime(val, type);
return t ? "".concat(str, " ").concat(t) : '';
}
var script = {
name: 'Date',
props: {
type: String,
minDate: Object,
maxDate: Object,
dayStr: Array,
monthStr: Array,
selectedDates: Array,
isRange: Boolean,
firstDayOfWeek: {
type: Number,
default: 0
}
},
data: function data() {
return {
dateObj: formatDateObj(createNowTimeObj())
};
},
computed: {
$dayStr: function $dayStr() {
var dayStr = !this.dayStr || this.dayStr.length < 7 || this.dayStr.some(function (day) {
return typeof day !== 'string';
}) ? ['日', '一', '二', '三', '四', '五', '六'] : this.dayStr.slice(0, 7);
return dayStr.slice(this.firstDayOfWeek).concat(dayStr.slice(0, this.firstDayOfWeek));
},
$monthStr: function $monthStr() {
var monthStr = !this.monthStr || this.monthStr.length < 12 || this.monthStr.some(function (month) {
return typeof month !== 'string';
}) ? ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] : this.monthStr.slice(0, 12);
return monthStr;
},
years: function years() {
if (!this.dateObj.year) return [];
return gntYear(Math.floor(this.dateObj.year / 10 - 0.5) * 10 + 1, 10, {
splitLen: 3,
min: this.minDate.year,
max: this.maxDate.year
});
},
months: function months() {
return gntMonth(this.dateObj.year, {
splitLen: 3,
min: this.minDate,
max: this.maxDate
});
},
dates: function dates() {
return gntCalendar(this.dateObj, {
min: this.minDate,
max: this.maxDate,
firstDayOfWeek: this.firstDayOfWeek
});
},
pickerItems: function pickerItems() {
if (this.type === 'year') return this.years;
if (this.type === 'month') return this.months;
return this.dates;
}
},
watch: {
pickerItems: function pickerItems(val) {
var showBtn = null;
if (this.type === 'time') {
showBtn = {
prev: dateCompare(getDateByStep(this.dateObj, -1), this.minDate, 1),
next: dateCompare(getDateByStep(this.dateObj, 1), this.maxDate, -1)
};
} else {
var _date$month$year$this = {
date: {
prev: function prev(v) {
return getPrevMonthLastDate(v);
},
next: function next(v) {
return getNextMonthFirstDate(v);
}
},
month: {
prev: function prev(v) {
return getPrevYearLastDate(v.year);
},
next: function next(v) {
return getNextYearFirstDate(v.year);
}
},
year: {
prev: function prev(v) {
return getPrevTenYearLastDate(v.year);
},
next: function next(v) {
return getNextTenYearFirstDate(v.year);
}
}
}[this.type],
prev = _date$month$year$this.prev,
next = _date$month$year$this.next;
showBtn = {
prev: dateCompare(prev(this.dateObj), this.minDate, 1, this.type),
next: dateCompare(next(this.dateObj), this.maxDate, -1, this.type)
};
}
this.$emit('emitData', {
showBtn: showBtn,
items: val
});
},
dateObj: {
immediate: true,
handler: function handler(val) {
// This event is used to trigger the interaction of another comp
this.$emit('pageChange', {
currObj: val
});
}
}
},
methods: {
chose: function chose(item) {
if (item.canBeChose) {
this.dateObj[this.type] = item[this.type];
this.$emit('chose', _objectSpread2({
type: this.type
}, item));
this.$forceUpdate();
}
},
isSelected: function isSelected(item) {
if (!this.selectedDates) return false;
var checkProps = sliceUtilEqual(AllTypes, this.type);
return this.selectedDates.filter(Boolean).some(function (it) {
return checkProps.every(function (k) {
return item[k] === it[k];
});
});
},
isInRange: function isInRange(item) {
if (this.isRange && this.selectedDates && this.selectedDates.filter(Boolean).length > 1) {
var date = _objectSpread2(_objectSpread2({}, item), {}, {
month: this.type !== 'year' && item.month || '01',
date: this.type === 'date' && item.date || '01'
});
return dateCompare(date, this.selectedDates[0], 1, this.type) && dateCompare(date, this.selectedDates[1], -1, this.type);
}
return false;
},
to: function to() {
var step = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
if (this.type === 'year') {
this.dateObj = formatDateObj(_objectSpread2(_objectSpread2({}, this.dateObj), {}, {
year: +this.dateObj.year + 10 * step
}));
this.$emit('to', _objectSpread2({
type: 'ten-year'
}, this.dateObj));
} else if (this.type === 'month') {
this.dateObj = formatDateObj(_objectSpread2(_objectSpread2({}, this.dateObj), {}, {
year: +this.dateObj.year + step
}));
if (this.dateObj.canBeChose) this.$emit('to', _objectSpread2({
type: 'year'
}, this.dateObj));
} else if (this.type === 'date') {
this.dateObj = getMonthByStep(this.dateObj, step);
if (this.dateObj.canBeChose) this.$emit('to', _objectSpread2({
type: 'month'
}, this.dateObj));
} else {
this.dateObj = getDateByStep(this.dateObj, step);
if (this.dateObj.canBeChose) this.$emit('to', _objectSpread2({
type: 'date'
}, this.dateObj));
}
},
renderItem: function renderItem(type, itemValue) {
if (type === 'month') {
return this.$monthStr[+itemValue - 1];
}
return itemValue;
}
}
};
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('div', {
staticClass: "picker-items dates"
}, [_vm.type === 'date' ? _c('div', {
staticClass: "row-item h"
}, _vm._l(_vm.$dayStr, function (item, i) {
return _c('span', {
key: i,
staticClass: "item date"
}, [_vm._v(_vm._s(item))]);
}), 0) : _vm._e(), _vm._v(" "), _vm._l(_vm.pickerItems, function (rowItems, i) {
return _c('div', {
key: i,
staticClass: "row-item"
}, _vm._l(rowItems, function (item, j) {
var _obj;
return _c('span', {
key: i + '' + j,
staticClass: "item",
class: (_obj = {
'not-in-month': _vm.type === 'date' && !item.isInThisMonth,
disabled: !item.canBeChose
}, _obj[_vm.type] = true, _obj.selected = _vm.isSelected(item), _obj['is-now'] = item.isNow, _obj['is-in-range'] = _vm.isInRange(item), _obj),
on: {
"click": function click($event) {
return _vm.chose(item);
},
"mouseover": function mouseover($event) {
item.canBeChose && _vm.$emit('mouseover', item);
}
}
}, [_vm._v(_vm._s(_vm.renderItem(_vm.type, item[_vm.type])))]);
}), 0);
})], 2);
};
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);
/**
* Use timeout to trigger make sure that this callback is triggered after click event
* */
function triggerAfterClickEvent(cb) {
setTimeout(cb);
}
var mixin = {
props: {
id: [String, Number],
value: String,
placeholder: String,
min: String,
max: String,
canEdit: {
default: true,
type: Boolean
},
inputStyle: [String, Object],
popperProps: Object,
scrollbarProps: Object
},
data: function data() {
return {
showPicker: false,
defaultPopperProps: Object.freeze({
arrowPosition: 'start',
arrowOffsetScaling: 1,
popperOptions: {
placement: 'bottom-start',
modifiers: {
preventOverflow: {
boundariesElement: typeof document !== 'undefined' ? document.body : ''
}
}
}
})
};
},
computed: {
$popperProps: function $popperProps() {
return objectDeepMerge({}, this.defaultPopperProps, this.popperProps || {});
},
isMobile: function isMobile() {
return this.scrollbarProps && this.scrollbarProps.isMobile;
}
},
watch: {
showPicker: function showPicker(val) {
if (!val) this.hideEffect();
}
},
methods: {
hide: function hide() {
var _this = this;
var hide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (_typeof(hide) === 'object') {
var target = hide.target;
var clear = this.$refs.inputEl.$refs.clear;
if (target && (!clear || !clear.contains(target))) {
this.showPicker = this.$refs.wrap.contains(target);
}
} else if (!hide) {
this.showPicker = true;
} else {
setTimeout(function () {
_this.showPicker = !hide;
}, 200);
}
},
hideEffect: function hideEffect() {
var _this2 = this;
this.$nextTick(function () {
_this2.blur({
target: _this2.$refs.inputEl.$refs.input0
}, true);
});
},
onClear: function onClear() {
this.blur({
target: {
value: ''
}
});
}
},
components: {
popper: VuePopper
},
beforeMount: function beforeMount() {
window.addEventListener('click', this.hide, true);
},
beforeDestroy: function beforeDestroy() {
window.removeEventListener('click', this.hide, true);
}
};
//
var script$1 = {
name: 'DatePin',
props: {
type: String,
value: String,
minDate: [String, Object],
maxDate: [String, Object],
selectedDates: Array,
isRange: Boolean,
dayStr: Array,
monthStr: Array,
firstDayOfWeek: Number
},
data: function data() {
return {
currType: 'date',
availableTypes: AllTypes,
showBtn: {
prev: true,
next: true
},
currDateObj: {},
tenYears: ''
};
},
computed: {
$monthStr: function $monthStr() {
var monthStr = !this.monthStr || this.monthStr.length < 12 || this.monthStr.some(function (month) {
return typeof month !== 'string';
}) ? ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] : this.monthStr.slice(0, 12);
return monthStr;
}
},
watch: {
type: {
immediate: true,
handler: function handler(val) {
this.availableTypes = sliceUtilEqual(AllTypes, val || 'date');
this.currType = this.availableTypes.length < 3 ? val : 'date';
}
},
currType: {
immediate: true,
handler: function handler(val) {
this.$emit('typeChange', val);
}
}
},
methods: {
choseHeadType: function choseHeadType(val) {
var _this = this;
triggerAfterClickEvent(function () {
_this.currType = val;
});
},
selected: function selected(val) {
var _this2 = this;
if (val.type !== 'ten-year') {
triggerAfterClickEvent(function () {
var index = Object.keys(_this2.availableTypes).find(function (i) {
return _this2.availableTypes[i] === val.type;
});
var nextType = _this2.availableTypes[+index + 1];
_this2.$emit('itemSelected', {
value: val,
currType: _this2.currType,
nextType: nextType
});
_this2.currType = nextType || _this2.currType;
});
}
},
pageChange: function pageChange(item) {
this.currDateObj = item.currObj;
this.tenYears = getTenYears(item.currObj);
this.$emit('pageChange', item);
},
renderMonth: function renderMonth(monthValue) {
return this.$monthStr[+monthValue - 1];
}
},
components: {
Date: __vue_component__
}
};
/* script */
var __vue_script__$1 = script$1;
/* template */
var __vue_render__$1 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
staticClass: "picker-content"
}, [_c('div', {
staticClass: "picker-head"
}, [_c('span', {
staticClass: "prev",
class: {
disabled: !_vm.showBtn.prev
},
on: {
"click": function click($event) {
_vm.showBtn.prev ? _vm.$refs.dateCom.to(-1) : '';
}
}
}, [_vm._v("<")]), _vm._v(" "), _c('span', {
staticClass: "picker-h"
}, [_vm.currType !== 'year' ? _c('span', {
staticClass: "year",
on: {
"click": function click($event) {
return _vm.choseHeadType('year');
}
}
}, [_vm._v(_vm._s(_vm.currDateObj.year))]) : _c('span', [_vm._v(_vm._s(_vm.tenYears))]), _vm._v(" "), _vm.currType === 'date' || _vm.currType === 'time' ? [_vm._v("\n - \n "), _c('span', {
staticClass: "month",
on: {
"click": function click($event) {
return _vm.choseHeadType('month');
}
}
}, [_vm._v(_vm._s(_vm.renderMonth(_vm.currDateObj.month)))])] : _vm._e(), _vm._v(" "), _vm.currType === 'time' ? [_vm._v("\n - \n "), _c('span', {
staticClass: "date",
on: {
"click": function click($event) {
return _vm.choseHeadType('date');
}
}
}, [_vm._v(_vm._s(_vm.currDateObj.date))])] : _vm._e()], 2), _vm._v(" "), _c('span', {
staticClass: "next",
class: {
disabled: !_vm.showBtn.next
},
on: {
"click": function click($event) {
_vm.showBtn.next ? _vm.$refs.dateCom.to(1) : '';
}
}
}, [_vm._v(">")])]), _vm._v(" "), _c('date', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.currType !== 'time',
expression: "currType !== 'time'"
}],
ref: "dateCom",
attrs: {
"value": _vm.value,
"type": _vm.currType,
"minDate": _vm.minDate,
"maxDate": _vm.maxDate,
"dayStr": _vm.dayStr,
"monthStr": _vm.monthStr,
"firstDayOfWeek": _vm.firstDayOfWeek,
"selectedDates": _vm.selectedDates,
"isRange": _vm.isRange
},
on: {
"mouseover": function mouseover($event) {
return _vm.$emit('mouseover', $event);
},
"chose": _vm.selected,
"to": _vm.selected,
"pageChange": _vm.pageChange,
"emitData": function emitData($event) {
_vm.showBtn = $event.showBtn;
},
"error": function error($event) {
return _vm.$emit('error', $event);
}
}
}), _vm._v(" "), _vm._t("time"), _vm._v(" "), _vm._t("btn")], 2);
};
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_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$2 = {
name: 'IconDate'
};
/* script */
var __vue_script__$2 = script$2;
/* template */
var __vue_render__$2 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('svg', {
staticClass: "icon-date",
attrs: {
"viewBox": "0 0 1024 1024",
"xmlns": "http://www.w3.org/2000/svg",
"width": "200",
"height": "200"
}
}, [_c('path', {
attrs: {
"d": "M555.62352313 447.01489666L468.34822999 447.01489666 468.34822999 534.2901898 555.62352313 534.2901898 555.62352313 447.01489666ZM555.62352313 599.73960073L468.34822999 599.73960073 468.34822999 687.01489386 555.62352313 687.01489386 555.62352313 599.73960073ZM904.72469469 97.94195979L817.44940156 97.94195979 817.44940156 32.49254886C817.44940156 20.43607855 807.67999063 10.66666667 795.62352031 10.66666667 783.56704906 10.66666667 773.82587281 20.43607855 773.82587281 32.49254886L773.82587281 97.94195979 250.174115 97.94195979 250.174115 32.49254886C250.174115 20.43607855 240.40470313 10.66666667 228.34823281 10.66666667 216.2917625 10.66666667 206.55058625 20.43607855 206.55058625 32.49254886L206.55058625 97.94195979 119.27529312 97.94195979C71.07764656 97.94195979 32 137.01960636 32 185.21725292L32 316.11607479 32 359.76783917 32 883.39136136C32 931.58900792 71.07764656 970.66665448 119.27529312 970.66665448L904.72469469 970.66665448C952.92234125 970.66665448 991.99998781 931.58900792 991.99998781 883.39136136L991.99998781 359.76783917 991.99998781 316.11607479 991.99998781 185.21725292C991.99998781 137.01960636 952.92234125 97.94195979 904.72469469 97.94195979ZM948.34822345 883.39136136C948.34822345 907.4760673 928.80940063 927.01489012 904.72469469 927.01489012L119.27529312 927.01489012C95.1623525 927.01489012 75.62352875 907.4760673 75.62352875 883.39136136L75.62352875 359.76783917 948.34822345 359.76783917 948.34822345 883.39136136ZM948.34822345 316.11607479L75.62352875 316.11607479 75.62352875 185.21725292C75.62352875 161.10431229 95.1623525 141.56548855 119.27529312 141.56548855L206.55058625 141.56548855 206.55058625 207.01489948C206.55058625 219.0713698 216.2917625 228.84078167 228.34823281 228.84078167 240.40470313 228.84078167 250.174115 219.0713698 250.174115 207.01489948L250.174115 141.56548855 773.82587281 141.56548855 773.82587281 207.01489948C773.82587281 219.0713698 783.56704906 228.84078167 795.62352031 228.84078167 807.67999063 228.84078167 817.44940156 219.0713698 817.44940156 207.01489948L817.44940156 141.56548855 904.72469469 141.56548855C928.80940063 141.56548855 948.34822345 161.10431229 948.34822345 185.21725292L948.34822345 316.11607479ZM773.82587281 599.73960073L686.55057969 599.73960073 686.55057969 687.01489386 773.82587281 687.01489386 773.82587281 599.73960073ZM773.82587281 447.01489666L686.55057969 447.01489666 686.55057969 534.2901898 773.82587281 534.2901898 773.82587281 447.01489666ZM555.62352313 752.49253948L468.34822999 752.49253948 468.34822999 839.76783261 555.62352313 839.76783261 555.62352313 752.49253948ZM337.44940812 752.49253948L250.174115 752.49253948 250.174115 839.76783261 337.44940812 839.76783261 337.44940812 752.49253948ZM337.44940812 447.01489666L250.174115 447.01489666 250.174115 534.2901898 337.44940812 534.2901898 337.44940812 447.01489666ZM337.44940812 599.73960073L250.174115 599.73960073 250.174115 687.01489386 337.44940812 687.01489386 337.44940812 599.73960073Z",
"fill": "currentColor"
}
})]);
};
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_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$3 = {
name: 'DateIcon'
};
/* script */
var __vue_script__$3 = script$3;
/* template */
var __vue_render__$3 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('svg', {
staticClass: "icon-del",
attrs: {
"viewBox": "0 0 1024 1024",
"xmlns": "http://www.w3.org/2000/svg",
"width": "200",
"height": "200"
}
}, [_c('path', {
attrs: {
"d": "M503.90239264 447.03144829L854.67358276 96.28707142a26.81326939 26.81326939 0 0 1 37.91396291 0l18.95698147 18.95698145a26.81326939 26.81326939 0 0 1 0 37.91396294L560.80015029 503.90239264 911.51771386 854.67358276a26.81326939 26.81326939 0 0 1 0 37.91396291l-18.95698147 18.95698147a26.81326939 26.81326939 0 0 1-37.91396291 0L503.90239264 560.80015029 153.15801581 911.51771386a26.81326939 26.81326939 0 0 1-37.91396294 0l-18.95698145-18.95698147a26.81326939 26.81326939 0 0 1 0-37.91396291l350.74437687-350.77119011-350.74437687-350.74437684a26.81326939 26.81326939 0 0 1 0-37.91396291l18.95698145-18.95698145a26.81326939 26.81326939 0 0 1 37.91396294 0l350.74437683 350.74437685z",
"fill": "currentColor"
}
})]);
};
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_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
//
var script$4 = {
name: 'InputEl',
props: {
id: String,
type: String,
value: Array,
placeholder: String,
secondPlaceholder: String,
inputStyle: Object,
dayStr: Array,
firstDayOfWeek: Number,
rangeSeparator: String,
readonly: Boolean,
isFocus: Boolean,
isRange: Boolean
},
components: {
IconDel: __vue_component__$3
}
};
/* script */
var __vue_script__$4 = script$4;
/* template */
var __vue_render__$4 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
staticClass: "input-wrapper",
class: {
focus: _vm.isFocus
}
}, [_c('div', {
staticClass: "prefix"
}, [_vm._t("prefix")], 2), _vm._v(" "), _c('input', {
ref: "input0",
staticClass: "vue-input",
style: _vm.inputStyle,
attrs: {
"id": _vm.id,
"placeholder": _vm.placeholder || '请选择开始',
"readonly": _vm.readonly
},
domProps: {
"value": _vm.value[0]
},
on: {
"keyup": function keyup($event) {
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
return null;
}
return _vm.$emit('inputEnter', $event);
},
"focus": function focus($event) {
return _vm.$emit('focus', 0);
}
}
}), _vm._v(" "), _vm.isRange ? _c('div', {
staticClass: "range-separator"
}, [_vm._v("\n " + _vm._s(_vm.rangeSeparator || '至') + "\n ")]) : _vm._e(), _vm._v(" "), _vm.isRange ? _c('input', {
ref: "input1",
staticClass: "vue-input",
style: _vm.inputStyle,
attrs: {
"placeholder": _vm.secondPlaceholder || '请选择结束',
"readonly": _vm.readonly
},
domProps: {
"value": _vm.value[1]
},
on: {
"keyup": function keyup($event) {
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
return null;
}
return _vm.$emit('inputEnter', $event);
},
"focus": function focus($event) {
return _vm.$emit('focus', 1);
}
}
}) : _vm._e(), _vm._v(" "), _c('div', {
staticClass: "suffix"
}, [_vm._t("suffix"), _vm._v(" "), _c('div', {
ref: "clear",
staticClass: "icon-clear",
on: {
"click": function click($event) {
return _vm.$emit('clear');
}
}
}, [_c('icon-del')], 1)], 2)]);
};
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__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
var _excluded = ["error"];
var script$5 = {
mixins: [mixin],
name: 'Datepicker',
props: {
multiple: Boolean,
type: String,
dayStr: Array,
monthStr: Array,
firstDayOfWeek: Number,
btnStr: String
},
data: function data() {
return {
tempSelectedDates: [],
selectedDates: []
};
},
computed: {
$btnStr: function $btnStr() {
return this.btnStr || '确定';
},
valArr: function valArr() {
return this.value.split(/\s*,\s*/);
},
myValue: function myValue() {
var _this = this;
return this.selectedDates.map(function (it) {
return formatDate(it, _this.type);
}).join(',');
},
limit: function limit() {
var _dealDateLimit = dealDateLimit(this.min, this.max),
error = _dealDateLimit.error,
rest = _objectWithoutProperties(_dealDateLimit, _excluded);
if (error) this.$emit('error', new Error(error));
return rest;
}
},
watch: {
valArr: {
immediate: true,
handler: function handler(val) {
var _this2 = this;
var arr = this.myValue.split(',');
val.forEach(function (v) {
if (!arr.includes(v)) _this2.blur(v, false);
});
}
},
selectedDates: {
immediate: true,
handler: function handler(val, oldVal) {
var _this3 = this;
if (val.length !== oldVal || val.some(function (v, i) {
return !dateCompare(v, oldVal[i], 0, _this3.type);
})) {
this.tempSelectedDates = _toConsumableArray(val);
this.tempSelectedDatesChange();
}
}
}
},
methods: {
inputEnter: function inputEnter(ev) {
var value = ev.target.value;
if (dateReg.test(value) || !value) {
this.hide();
ev.target.blur();
}
},
blur: function blur(ev) {
var _this4 = this;
var isBlur = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var value = isBlur ? ev.target.value : ev;
if (this.myValue === value) this.$forceUpdate();else {
var arr = this.multiple ? value.split(',') : [value];
var dates = [];
var error = '';
arr.forEach(function (val) {
var date = parseDate(val);
var _this4$limit = _this4.limit,
minDate = _this4$limit.minDate,
maxDate = _this4$limit.maxDate;
var err = dateValidator(date, _this4.type, minDate, maxDate);
if (err) error += err;else if (date) dates.push(date);
});
if (error) {
this.$emit('error', new Error(error));
this.selectedDates = dates;
this.$emit('input', this.myValue);
} else {
this.selectedDates = dates;
if (isBlur) this.$emit('input', this.myValue);
}
}
},
tempSelectedDatesChange: function tempSelectedDatesChange() {
var _this5 = this;
this.$nextTick(function () {
var last = _toConsumableArray(_this5.tempSelectedDates).pop();
var datePin0 = _this5.$refs.datePin0;
if (last) datePin0.$refs.dateCom.dateObj = _objectSpread2({}, last);
});
},
chose: function chose(_ref) {
var _this6 = this;
var value = _ref.value,
nextType = _ref.nextType;
if (value.type && !nextType) {
if (!this.multiple) {
this.tempSelectedDates = [value];
this.confirm();
} else {
var index = Object.keys(this.tempSelectedDates).find(function (i) {
return dateCompare(value, _this6.tempSelectedDates[i], 0, _this6.type);
});
if (index) this.tempSelectedDates.splice(+index, 1);else this.tempSelectedDates.push(value);
}
}
},
confirm: function confirm() {
this.selectedDates = _toConsumableArray(this.tempSelectedDates);
this.$emit('input', this.myValue);
this.hide();
}
},
components: {
IconDate: __vue_component__$2,
DatePin: __vue_component__$1,
InputEl: __vue_compone