@prettyy/ui
Version:
vue2 UI
1,952 lines (1,715 loc) • 615 kB
JavaScript
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 = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 41);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./components/utils/date-util/fixedDate.js
var fixedDate = __webpack_require__(3);
// CONCATENATED MODULE: ./components/utils/date-util/date.js
/* Modified from https://github.com/taylorhakes/fecha
*
* the mit license (mit)
*
* copyright (c) 2015 taylor hakes
*
* permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "software"), to deal
* in the software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the software, and to permit persons to whom the software is
* furnished to do so, subject to the following conditions:
*
* the above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the software.
*
* the software is provided "as is", without warranty of any kind, express or
* implied, including but not limited to the warranties of merchantability,
* fitness for a particular purpose and noninfringement. in no event shall the
* authors or copyright holders be liable for any claim, damages or other
* liability, whether in an action of contract, tort or otherwise, arising from,
* out of or in connection with the software or the use or other dealings in the
* software.
*/
/*eslint-disable*/
// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
/**
* Parse or format dates
* @class fecha
*/
var fecha = {}
var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g
var twoDigits = '\\d\\d?'
var threeDigits = '\\d{3}'
var fourDigits = '\\d{4}'
var word = '[^\\s]+'
var literal = /\[([^]*?)\]/gm
var noop = function () {
}
function regexEscape (str) {
return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&')
}
function shorten (arr, sLen) {
var newArr = []
for (var i = 0, len = arr.length; i < len; i++) {
newArr.push(arr[i].substr(0, sLen))
}
return newArr
}
function monthUpdate (arrName) {
return function (d, v, i18n) {
var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase())
if (~index) {
d.month = index
}
}
}
function pad (val, len) {
val = String(val)
len = len || 2
while (val.length < len) {
val = '0' + val
}
return val
}
var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
var monthNamesShort = shorten(monthNames, 3)
var dayNamesShort = shorten(dayNames, 3)
fecha.i18n = {
dayNamesShort: dayNamesShort,
dayNames: dayNames,
monthNamesShort: monthNamesShort,
monthNames: monthNames,
amPm: ['am', 'pm'],
DoFn: function DoFn (D) {
return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10]
}
}
var formatFlags = {
D: function (dateObj) {
return dateObj.getDay()
},
DD: function (dateObj) {
return pad(dateObj.getDay())
},
Do: function (dateObj, i18n) {
return i18n.DoFn(dateObj.getDate())
},
d: function (dateObj) {
return dateObj.getDate()
},
dd: function (dateObj) {
return pad(dateObj.getDate())
},
ddd: function (dateObj, i18n) {
return i18n.dayNamesShort[dateObj.getDay()]
},
dddd: function (dateObj, i18n) {
return i18n.dayNames[dateObj.getDay()]
},
M: function (dateObj) {
return dateObj.getMonth() + 1
},
MM: function (dateObj) {
return pad(dateObj.getMonth() + 1)
},
MMM: function (dateObj, i18n) {
return i18n.monthNamesShort[dateObj.getMonth()]
},
MMMM: function (dateObj, i18n) {
return i18n.monthNames[dateObj.getMonth()]
},
yy: function (dateObj) {
return pad(String(dateObj.getFullYear()), 4).substr(2)
},
yyyy: function (dateObj) {
return pad(dateObj.getFullYear(), 4)
},
h: function (dateObj) {
return dateObj.getHours() % 12 || 12
},
hh: function (dateObj) {
return pad(dateObj.getHours() % 12 || 12)
},
H: function (dateObj) {
return dateObj.getHours()
},
HH: function (dateObj) {
return pad(dateObj.getHours())
},
m: function (dateObj) {
return dateObj.getMinutes()
},
mm: function (dateObj) {
return pad(dateObj.getMinutes())
},
s: function (dateObj) {
return dateObj.getSeconds()
},
ss: function (dateObj) {
return pad(dateObj.getSeconds())
},
S: function (dateObj) {
return Math.round(dateObj.getMilliseconds() / 100)
},
SS: function (dateObj) {
return pad(Math.round(dateObj.getMilliseconds() / 10), 2)
},
SSS: function (dateObj) {
return pad(dateObj.getMilliseconds(), 3)
},
a: function (dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1]
},
A: function (dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase()
},
ZZ: function (dateObj) {
var o = dateObj.getTimezoneOffset()
return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4)
}
}
var parseFlags = {
d: [twoDigits, function (d, v) {
d.day = v
}],
Do: [twoDigits + word, function (d, v) {
d.day = parseInt(v, 10)
}],
M: [twoDigits, function (d, v) {
d.month = v - 1
}],
yy: [twoDigits, function (d, v) {
var da = fixedDate["a" /* default */].getDate(), cent = +('' + da.getFullYear()).substr(0, 2)
d.year = '' + (v > 68 ? cent - 1 : cent) + v
}],
h: [twoDigits, function (d, v) {
d.hour = v
}],
m: [twoDigits, function (d, v) {
d.minute = v
}],
s: [twoDigits, function (d, v) {
d.second = v
}],
yyyy: [fourDigits, function (d, v) {
d.year = v
}],
S: ['\\d', function (d, v) {
d.millisecond = v * 100
}],
SS: ['\\d{2}', function (d, v) {
d.millisecond = v * 10
}],
SSS: [threeDigits, function (d, v) {
d.millisecond = v
}],
D: [twoDigits, noop],
ddd: [word, noop],
MMM: [word, monthUpdate('monthNamesShort')],
MMMM: [word, monthUpdate('monthNames')],
a: [word, function (d, v, i18n) {
var val = v.toLowerCase()
if (val === i18n.amPm[0]) {
d.isPm = false
} else if (val === i18n.amPm[1]) {
d.isPm = true
}
}],
ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
var parts = (v + '').match(/([+-]|\d\d)/gi), minutes
if (parts) {
minutes = +(parts[1] * 60) + parseInt(parts[2], 10)
d.timezoneOffset = parts[0] === '+' ? minutes : -minutes
}
}]
}
parseFlags.dd = parseFlags.d
parseFlags.dddd = parseFlags.ddd
parseFlags.DD = parseFlags.D
parseFlags.mm = parseFlags.m
parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h
parseFlags.MM = parseFlags.M
parseFlags.ss = parseFlags.s
parseFlags.A = parseFlags.a
// Some common format strings
fecha.masks = {
default: 'ddd MMM dd yyyy HH:mm:ss',
shortDate: 'M/D/yy',
mediumDate: 'MMM d, yyyy',
longDate: 'MMMM d, yyyy',
fullDate: 'dddd, MMMM d, yyyy',
shortTime: 'HH:mm',
mediumTime: 'HH:mm:ss',
longTime: 'HH:mm:ss.SSS'
}
/***
* Format a date
* @method format
* @param {Date|number} dateObj
* @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
*/
fecha.format = function (dateObj, mask, i18nSettings) {
var i18n = i18nSettings || fecha.i18n
if (typeof dateObj === 'number') {
dateObj = new Date(dateObj)
}
if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
throw new Error(`Invalid Date "${dateObj} in fecha.format`)
}
mask = fecha.masks[mask] || mask || fecha.masks['default']
var literals = []
// Make literals inactive by replacing them with ??
mask = mask.replace(literal, function ($0, $1) {
literals.push($1)
return '@@@'
})
// Apply formatting rules
mask = mask.replace(token, function ($0) {
return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1)
})
// Inline literal values back into the formatted value
return mask.replace(/@@@/g, function () {
return literals.shift()
})
}
/**
* Parse a date string into an object, changes - into /
* @method parse
* @param {string} dateStr Date string
* @param {string} format Date parse format
* @returns {Date|boolean}
*/
fecha.parse = function (dateStr, format, i18nSettings) {
var i18n = i18nSettings || fecha.i18n
if (typeof format !== 'string') {
throw new Error(`Invalid format "${format}" in fecha.parse`)
}
format = fecha.masks[format] || format
// Avoid regular expression denial of service, fail early for really long strings
// https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
if (dateStr.length > 1000) {
return null
}
var dateInfo = {}
var parseInfo = []
var literals = []
format = format.replace(literal, function ($0, $1) {
literals.push($1)
return '@@@'
})
var newFormat = regexEscape(format).replace(token, function ($0) {
if (parseFlags[$0]) {
var info = parseFlags[$0]
parseInfo.push(info[1])
return '(' + info[0] + ')'
}
return $0
})
newFormat = newFormat.replace(/@@@/g, function () {
return literals.shift()
})
var matches = dateStr.match(new RegExp(newFormat, 'i'))
if (!matches) {
return null
}
for (var i = 1; i < matches.length; i++) {
parseInfo[i - 1](dateInfo, matches[i], i18n)
}
var today = fixedDate["a" /* default */].getDate()
if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
dateInfo.hour = +dateInfo.hour + 12
} else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
dateInfo.hour = 0
}
var date
if (dateInfo.timezoneOffset != null) {
dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset
date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0))
} else {
date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0)
}
return date
}
/* harmony default export */ var date_util_date = (fecha);
// CONCATENATED MODULE: ./components/utils/date-util/index.js
/**
* 获取上个月剩下的天数(距离这个月一周内)
* @param {Date} date
* @param {Number} weekStart 星期开始量
* @return {Array}
*/
function getPrevMonthDays(date, weekStart) {
date = new Date(date.getTime())
date.setDate(1)
// 本月1号是星期几
const weekDay = date.getDay()
// 临界条件: 正好本月的第一天是【设置的一周的起始量】
// 不需要数据
if (weekDay === weekStart) {
return []
}
// 上月需要计入的天数
let lastDays
if (weekStart === 0) {
lastDays = weekDay
} else if (weekDay === 0) {
lastDays = 7 - weekStart
} else if (weekDay < weekStart) {
// 如果当前星期量小于起始量
lastDays = (7 + weekDay - weekStart) % 7
} else {
// 当前的星期量大于起始量
// 使用差值就行了
lastDays = weekDay - weekStart
}
// 将时间跳转到上月的最后一天
date.setDate(0)
// 上月的最后一天是几号
const day = date.getDate()
// 年
const year = date.getFullYear()
// 月
const month = date.getMonth() + 1
// 天数集合
const days = []
// 上月的最后一天不是星期六(星期天是一周第一天)
// 那就要在这月显示
for (let i = 1; i <= lastDays; i++) {
const value = day - lastDays + i
date.setDate(value)
days.push({
overflow: true,
date: value,
value: date,
year,
month,
day: date.getDay()
})
}
return days
}
/**
* 获取当月的天数
* @param {Date} date
* @return {Array}
*/
function getCurrentMonthDays(date) {
date = new Date(date.getTime())
// 设置日期到下个月
// 将时间跳转到本月的最后一天
date.setMonth(date.getMonth() + 1, 0)
// 本月的最后一天是几号
const day = date.getDate()
// 年
const year = date.getFullYear()
// 月
const month = date.getMonth() + 1
// 天数集合
const days = []
for (let i = 1; i <= day; i++) {
date.setDate(i)
days.push({
date: i,
value: date,
year,
month,
day: date.getDay()
})
}
return days
}
/**
* 获取这个月底到下个月的天数(距离这个月最后一天的一周内)
* @param {Date} date
* @param {number} remain 剩下的空余数量
* @return {Array}
*/
function getNextMonthDays(date, remain) {
date = new Date(date.getTime())
// 设置日期到下个月
date.setMonth(date.getMonth() + 1)
// 年
const year = date.getFullYear()
// 月
const month = date.getMonth() + 1
// 天数集合
const days = []
// 多显示7天
for (let i = 1; i <= remain + 7; i++) {
date.setDate(i)
days.push({
overflow: true,
date: i,
value: date,
year,
month,
day: date.getDay()
})
}
return days
}
/**
* 解析日期偏移串
* @param {Object|string} offset
* @return {{year: number, month: number, date: number}}
*/
function resolveDateOffset(offset) {
if (!offset) {
return {
year: 0,
month: 0,
date: 0
}
}
// 值是偏移对象
if (typeof offset === 'object') {
return offset
}
// 不是字符串,数据无效
if (typeof offset !== 'string') {
throw Error(`[datepicker] Invalid offset type: ${typeof offset}`)
}
// 值是偏移串
const matches = /^((?<year>-?(\d+)?)y)?((?<month>-?(\d+)?)m)?((?<date>-?(\d+)?)d)?$/i.exec(offset)
if (!matches) {
throw Error(`[datepicker] Invalid offset value: ${offset}`)
}
return {
year: parseInt(matches.groups.year) || 0,
month: parseInt(matches.groups.month) || 0,
date: parseInt(matches.groups.date) || 0
}
}
const util = {
/**
* 获取当前日期是一年中的第几天
* @param date
* @param includeCurrentMonth
* @return {number}
*/
getDayOfYear(date, includeCurrentMonth) {
date = date ? this.parse(date) : fixedDate["a" /* default */].getDate()
let days = 0
if (includeCurrentMonth !== false) {
days += date.getDate()
}
// 前面的月份
let month = date.getMonth()
for (let i = 0; i < month; i++) {
date.setMonth(i + 1, 0)
days += date.getDate()
}
return days
},
/**
* 获取传入日期处于一年中的第多少周
* @param {Date|Date[]} date
* @param {object} [option]
* @param {number} [option.start=0] 周的偏移值
* @return {{year: Number, week: Number}}
*/
getWeekOfYear(date, option) {
option = {
start: 0,
...option
}
const [start] = Array.isArray(date) ? date.map(d => this.parse(d)) :
this.getWeekRange(date, { start: option.start })
// 当传入的是日期范围时,date + 3 ,表示一周中间的那一天
// 得到周所在的日期
const weekDate = Array.isArray(date) ? this.offsetDate(start, { date: 3 }) : date
// 当年的第一天是星期几
const weekDayOfFirstDay = this.setDate(weekDate, { month: 0, date: 1 }).getDay()
// 周日期所在年的第一天的星期数 + 周日期所在其年的天数 - 起始日期 / 7
// 得到周数
const offset = weekDayOfFirstDay > option.start ? option.start : option.start - 7
const days = weekDayOfFirstDay + this.getDayOfYear(weekDate) - offset
return {
year: weekDate.getFullYear(),
week: Math.ceil(Math.abs(days) / 7)
}
},
/**
* 获取传入日期处于一月中的第多少周
* @param {Date|Date[]} date
* @param {object} [option]
* @param {number} [option.start=0] 周的偏移值
* @return {{year: Number, month: Number, week: Number}}
*/
getWeekOfMonth(date, option) {
option = {
start: 0,
...option
}
const [start] = Array.isArray(date) ? date.map(d => this.parse(d)) :
this.getWeekRange(date, { start: option.start })
// 当传入的是日期范围时,date + 3 ,表示一周中间的那一天
// 得到周所在的日期
const weekDate = Array.isArray(date) ? this.offsetDate(start, { date: 3 }) : date
// 当月的第一天是星期几
const weekDayOfFirstDay = this.setDate(weekDate, { date: 1 }).getDay()
// 周日期所在月的第一天的星期数 + 周日期所在其月的天数 - 起始日期 / 7
// 得到周数
const offset = weekDayOfFirstDay > option.start ? option.start : option.start - 7
const days = weekDayOfFirstDay + weekDate.getDate() - offset
return {
year: weekDate.getFullYear(),
month: weekDate.getMonth(),
week: Math.ceil(Math.abs(days) / 7)
}
},
/**
* 根据传入日期生成日期所在月的日历视图
* @param {Date|String|Number} date
* @param {Number} [weekStart=0]
* @return {*[]}
*/
makeDateView(date, weekStart) {
date = date ? this.parse(date) : fixedDate["a" /* default */].getDate()
// 一共是7列5行
const size = 7 * 5
const prevMonthDays = getPrevMonthDays(date, weekStart || 0)
const currentMonthDays = getCurrentMonthDays(date)
const nextMonthDays = getNextMonthDays(date, size - prevMonthDays.length - currentMonthDays.length)
return [...prevMonthDays, ...currentMonthDays, ...nextMonthDays]
},
/**
* 给指定的起始日期设置时间范围 00:00:00 和 23:59:59
* @param {Date} begin
* @param {Date} end
* @private
*/
appendTime(begin, end) {
begin.setHours(0, 0, 0)
end.setHours(23, 59, 59)
},
/**
* 按指定规则对日期进行偏移
* @param {Date} date
* @param {Object|string} offset 日期的偏移量
* @return {Date} 偏移后的日期对象(新对象)
*/
offsetDate(date, offset) {
offset = resolveDateOffset(offset)
const newValue = {
year: date.getFullYear() + (parseInt(offset.year) || 0),
month: date.getMonth() + (parseInt(offset.month) || 0),
date: 1
}
const newDate = new Date(newValue.year, newValue.month, newValue.date)
const newLastDate = date.getDate() + (parseInt(offset.date) || 0)
if (offset.date) {
newDate.setDate(newLastDate)
return newDate
}
// 当未指定日期偏移时
// 使用原日期的 date
// 此处的逻辑是为了防止日期大于本月的最后一天
const lastDate = this.getLastDayOfMonth(newDate)
if (newLastDate <= lastDate) {
newDate.setDate(newLastDate)
return newDate
}
newDate.setDate(lastDate)
return newDate
},
/**
* 获取指定月份的最后一天是几号
* @param {Date} date
* @param {number} [month] 不指定时,使用当前日期的月份
* @return {number}
*/
getLastDayOfMonth(date, month) {
month = arguments.length > 1 ? month : date.getMonth()
// 获取当月最后一天
const temp = this.setDate(date, {
month: month + 1,
date: 0
})
return temp.getDate()
},
/**
* 根据一个日期以及偏移参数获取日期范围
* @param {Date} date
* @param {Object|string} [beginOffset] 开始日期的偏移量
* @param {Object|string} [endOffset] 结束日期的偏移量
* @param {object} [option]
* @param {string} [option.format] 格式化串,不指定时返回 Date 类型
* @param {boolean} [option.time=false] 是否附带时间串
* @return {Date[]|String[]}
*/
getDateRange(date, beginOffset, endOffset, option) {
const { time, format } = option || {}
const begin = this.offsetDate(date, beginOffset)
const end = this.offsetDate(date, endOffset)
if (time) {
this.appendTime(begin, end)
}
const range = [begin, end]
return format ? range.map(d => this.format(d, format)) : range
},
/**
* 根据一个日期,谋算出其所在周的起止日期
* @param {Date} date
* @param {Object} [option]
* @param {number} [option.start=0] 周起始量,0-6分别表示星期天到星期六
* @param {number} [option.offset=0] 周偏移量,可以是任意整数
* @param {boolean} [option.time=false] 是否附带时间串
* @param {string} [option.format] 格式化串,不指定时返回 Date 类型
* @return {Date[]|String[]}
*/
getWeekRange(date, option) {
const { start, offset, time, format } = {
start: 0,
offset: 0,
...option
}
const weekDay = date.getDay()
const begin = new Date(date.getTime())
// 先找出星期天为第一天的日期
begin.setDate(begin.getDate() - weekDay)
// ----判断 start 的位置 与传入日期的位置差----
// 如果 start 大于 传入日期,则直接使用 start 对应的日期为起始
// 否则,将开始日期 - 7(跳转到上一周)
// 再移动 start 的天数,就是正确的起始日期
if (start > weekDay) {
begin.setDate(begin.getDate() - 7)
}
// ----判断 结束----
if (start) {
// 再移动 start 的天数,就是正确的起始日期
begin.setDate(begin.getDate() + start)
}
const end = new Date(begin.getFullYear(), begin.getMonth(), begin.getDate() + 6)
if (offset) {
begin.setDate(begin.getDate() + Math.round(offset) * 7)
end.setFullYear(begin.getFullYear(), begin.getMonth(), begin.getDate() + 6)
}
if (time) {
this.appendTime(begin, end)
}
const range = [begin, end]
return format ? range.map(d => this.format(d, format)) : range
},
/**
* 根据一个日期,谋算出其所在月的起止日期 (月的第一天和最后一天)
* @param {Date} date
* @param {Object} [option]
* @param {number} [option.offset=0] 月偏移量,可以是任意整数
* @param {boolean} [option.time=false] 是否附带时间串
* @param {string} [option.format] 格式化串,不指定时返回 Date 类型
* @return {Date[]|String[]}
*/
getMonthRange(date, option) {
const { offset, time, format } = {
offset: 0,
...option
}
const begin = new Date(date.getTime())
const end = new Date(date.getTime())
begin.setMonth(begin.getMonth() + Math.round(offset), 1)
end.setMonth(end.getMonth() + Math.round(offset) + 1, 0)
if (time) {
this.appendTime(begin, end)
}
const range = [begin, end]
return format ? range.map(d => this.format(d, format)) : range
},
/**
* 根据一个日期,谋算出其所在季度的起止日期
* @param {Date} date
* @param {Object} [option]
* @param {number} [option.offset=0] 季度偏移量,可以是任意整数
* @param {boolean} [option.time=false] 是否附带时间串
* @param {string} [option.format] 格式化串,不指定时返回 Date 类型
* @return {Date[]|String[]}
*/
getQuarterRange(date, option) {
const { offset, time, format } = {
offset: 0,
...option
}
const month = date.getMonth()
const beginMonth = Math.floor(month / 3) * 3
const begin = new Date(date.getTime())
begin.setMonth(beginMonth, 1)
const end = new Date(date.getTime())
// 设置为月底
end.setMonth(begin.getMonth() + 3, 0)
if (offset) {
begin.setMonth(begin.getMonth() + Math.round(offset) * 3, 1)
end.setFullYear(begin.getFullYear(), end.getMonth() + Math.round(offset) * 3 + 1, 0)
}
if (time) {
this.appendTime(begin, end)
}
const range = [begin, end]
return format ? range.map(d => this.format(d, format)) : range
},
/**
* 按照指定的值设置 Date 对象
* @param {Date|String|Number} date
* @param {Object} [option]
* @param {Number} [option.year]
* @param {Number} [option.month]
* @param {Number} [option.date]
* @param {Number} [option.hour]
* @param {Number} [option.minute]
* @param {Number} [option.second]
* @param {Boolean} [option.copy=true]
* @return {Date}
*/
setDate(date, option) {
const { year, month, date: day, hour, minute, second, copy } = {
copy: true,
...option
}
const temp = copy ? new Date(date.getTime()) : date
if (year !== undefined && year !== null) {
temp.setFullYear(year)
}
if (month !== undefined && month !== null) {
temp.setMonth(month, 1)
}
if (day !== undefined && day !== null) {
temp.setDate(day)
}
if (hour !== undefined && hour !== null) {
temp.setHours(hour, 0, 0)
}
if (minute !== undefined && minute !== null) {
temp.setMinutes(minute, 0)
}
if (second !== undefined && second !== null) {
temp.setSeconds(second)
}
return temp
},
/**
* 将任意类型的日期格式转换成 Date 类型
* @param {Date|String|Number} date
* @param {String} [format] 当 date 是字符串时,通过此参数指定格式
* @return {Date}
*/
parse(date, format) {
if (date instanceof Date) {
return new Date(date.getTime())
}
if (date instanceof Number) {
return new Date(date)
}
if (typeof date === 'string') {
const now = fixedDate["a" /* default */].getDate()
let today = this.format(now, 'yyyy-MM-dd')
if (/^\d{4}$/.test(date)) {
// 2018 -> 2018-01-01
date = `${date}-01-01`
if (!format) {
format = 'yyyy-MM-dd'
}
} else if (/^\d{2}:\d{2}$/.test(date)) {
// 10:10 -> 20xx-01-01 10:10:00
date = `${today} ${date}:00`
if (!format) {
format = 'yyyy-MM-dd HH:mm:ss'
}
} else if (/^\d{4}-\d{2}$/.test(date)) {
// 2018-10 -> 2018-10-01
date = `${date}-01`
if (!format) {
format = 'yyyy-MM-dd'
}
} else if (/^\d{2}:\d{2}:\d{2}$/.test(date)) {
// 10:10:10 -> 20xx-01-01 10:10:10
date = `${today} ${date}`
if (!format) {
format = 'yyyy-MM-dd HH:mm:ss'
}
} else if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(date)) {
// 2018-10-10 10:10 -> 2018-10-10 10:10:00
date = `${date}:00`
if (!format) {
format = 'yyyy-MM-dd HH:mm:ss'
}
} else if (!format) {
format = 'yyyy-MM-dd'
}
}
return date_util_date.parse(date, format) || new Date(date)
},
/**
* 将任意格式的日期格式化成指定的格式
* @param {Date|String|Number} date
* @param {String} format 输出格式
* @param {String} [inputFormat] 当 date 是字符串时,通过此参数指定格式,不指定时使用 format 的值
* @return {string}
*/
format(date, format, inputFormat) {
if (!date) {
return ''
}
const value = this.parse(date, inputFormat || format)
return date_util_date.format(value, format)
},
/**
*
* @param {Date|String|Number} date1
* @param {Date|String|Number} date2
* @param {String} format 日期格式
* @return {boolean}
*/
equals(date1, date2, format) {
if (!date1 && !date2) {
return true
}
if (!date1 || !date2) {
return false
}
return this.format(date1, format) === this.format(date2, format)
},
pad(val, len, fill) {
val = String(val)
len = len || 2
fill = fill || '0'
while (val.length < len) {
val = fill + val
}
return val
},
/**
*
* @param {HTMLElement} element
* @param {HTMLElement} test
*/
isParent(element, test) {
if (!element || !test) {
return false
}
if (element === test) {
return true
}
if (element === document.body) {
return false
}
const parentElement = element.parentElement
if (parentElement === test) {
return true
}
if (parentElement === document.body) {
return false
}
return this.isParent(parentElement, test)
}
}
/* harmony default export */ var date_util = __webpack_exports__["a"] = (util);
/***/ }),
/* 1 */
/***/ (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, 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 functioal 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
}
}
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
* Vue.js v2.6.14
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/
/* */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
function isUndef (v) {
return v === undefined || v === null
}
function isDef (v) {
return v !== undefined && v !== null
}
function isTrue (v) {
return v === true
}
function isFalse (v) {
return v === false
}
/**
* Check if value is primitive.
*/
function isPrimitive (value) {
return (
typeof value === 'string' ||
typeof value === 'number' ||
// $flow-disable-line
typeof value === 'symbol' ||
typeof value === 'boolean'
)
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
/**
* Get the raw type string of a value, e.g., [object Object].
*/
var _toString = Object.prototype.toString;
function toRawType (value) {
return _toString.call(value).slice(8, -1)
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
function isRegExp (v) {
return _toString.call(v) === '[object RegExp]'
}
/**
* Check if val is a valid array index.
*/
function isValidArrayIndex (val) {
var n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val)
}
function isPromise (val) {
return (
isDef(val) &&
typeof val.then === 'function' &&
typeof val.catch === 'function'
)
}
/**
* Convert a value to a string that is actually rendered.
*/
function toString (val) {
return val == null
? ''
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
? JSON.stringify(val, null, 2)
: String(val)
}
/**
* Convert an input value to a number for persistence.
* If the conversion fails, return original string.
*/
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
}
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
}
/**
* Check if a tag is a built-in tag.
*/
var isBuiltInTag = makeMap('slot,component', true);
/**
* Check if an attribute is a reserved attribute.
*/
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
/**
* Remove an item from an array.
*/
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
}
/**
* Check whether an object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
/**
* Create a cached version of a pure function.
*/
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
}
/**
* Camelize a hyphen-delimited string.
*/
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cached(function (str) {
return str.replace(hyphenateRE, '-$1').toLowerCase()
});
/**
* Simple bind polyfill for environments that do not support it,
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
* since native bind is now performant enough in most browsers.
* But removing it would mean breaking code that was able to run in
* PhantomJS 1.x, so this must be kept for backward compatibility.
*/
/* istanbul ignore next */
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
}
function nativeBind (fn, ctx) {
return fn.bind(ctx)
}
var bind = Function.prototype.bind
? nativeBind
: polyfillBind;
/**
* Convert an Array-like object to a real Array.
*/
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
}
/**
* Mix properties into target object.
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
}
/**
* Merge an Array of Objects into a single Object.
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
}
/* eslint-disable no-unused-vars */
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
*/
function noop (a, b, c) {}
/**
* Always return false.
*/
var no = function (a, b, c) { return false; };
/* eslint-enable no-unused-vars */
/**
* Return the same value.
*/
var identity = function (_) { return _; };
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
if (a === b) { return true }
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
var isArrayA = Array.isArray(a);
var isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i])
})
} else if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime()
} else if (!isArrayA && !isArrayB) {
var keysA = Object.keys(a);
var keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key])
})
} else {
/* istanbul ignore next */
return false
}
} catch (e) {
/* istanbul ignore next */
return false
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
} else {
return false
}
}
/**
* Return the first index at which a loosely equal value can be
* found in the array (if value is a plain object, the array must
* contain an object of the same shape), or -1 if it is not present.
*/
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
}
/**
* Ensure a function is called only once.
*/
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
}
var SSR_ATTR = 'data-server-rendered';
var ASSET_TYPES = [
'component',
'directive',
'filter'
];
var LIFECYCLE_HOOKS = [
'beforeCreate',
'created',
'beforeMount',
'mounted',
'beforeUpdate',
'updated',
'beforeDestroy',
'destroyed',
'activated',
'deactivated',
'errorCaptured',
'serverPrefetch'
];
/* */
var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
// $flow-disable-line
optionMergeStrategies: Object.create(null),
/**
* Whether to suppress warnings.
*/
silent: false,
/**
* Show production mode tip message on boot?
*/
productionTip: "production" !== 'production',
/**
* Whether to enable devtools
*/
devtools: "production" !== 'production',
/**
* Whether to record perf
*/
performance: false,
/**
* Error handler for watcher errors
*/
errorHandler: null,
/**
* Warn handler for watcher warns
*/
warnHandler: null,
/**
* Ignore certain custom elements
*/
ignoredElements: [],
/**
* Custom user key aliases for v-on
*/
// $flow-disable-line
keyCodes: Object.create(null),
/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
*/
isReservedTag: no,
/**
* Check if an attribute is reserved so that it cannot be used as a component
* prop. This is platform-dependent and may be overwritten.
*/
isReservedAttr: no,
/**
* Check if a tag is an unknown element.
* Platform-dependent.
*/
isUnknownElement: no,
/**
* Get the namespace of an element
*/
getTagNamespace: noop,
/**
* Parse the real tag name for the specific platform.
*/
parsePlatformTagName: identity,
/**
* Check if an attribute must be bound using property, e.g. value
* Platform-dependent.
*/
mustUseProp: no,
/**
* Perform updates asynchronously. Intended to be used by Vue Test Utils
* This will significantly reduce performance if set to false.
*/
async: true,
/**
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
/* */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
*/
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
/**
* Check if a string starts with $ or _
*/
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
}
/**
* Define a property.
*/
function def (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true
});
}
/**
* Parse simple path.
*/
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
var isPhantomJS = UA && /phantomjs/.test(UA);
var isFF = UA && UA.match(/firefox\/(\d+)/);
// Firefox has a "watch" function on Object.prototype...
var nativeWatch = ({}).watch;
var supportsPassive = false;
if (inBrowser) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', ({
get: function get () {
/* istanbul ignore next */
supportsPassive = true;
}
})); // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null, opts);
} catch (e) {}
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
}
return _isServer
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
}
var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
var _Set;
/* istanbul ignore if */ // $flow-disable-line
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = /*@__PURE__*/(function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
/* */
var warn = noop;
var tip = noop;
var generateComponentTrace = (noop); // work around flow check
var formatComponentName = (noop);
if (false) { var repeat, classify, classifyRE, hasConsole; }
/* */
var uid = 0;
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*/
var Dep = function Dep () {
this.id = uid++;
this.subs = [];
};
Dep.prototype.addSub = function addSub (sub) {
this.subs.push(sub);
};
Dep.prototype.removeSub = function removeSub (sub) {
remove(this.subs, sub);
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
}
};
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
if (false) {}
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
};
// The current target watcher being evaluated.
// This is globally unique because only one watcher
// can be evaluated at a time.
Dep.target = null;
var targetStack = [];
function pushTarget (target) {
targetStack.push(target);
Dep.target = target;
}
function popTarget () {
targetStack.pop();
Dep.target = targetStack[targetStack.length - 1];
}
/* */
var VNode = function VNode (
tag,
data,
children,
text,
elm,
context,
componentOptions,
asyncFactory
) {
this.tag = tag;
this.data = data;
this.children = children;
this.text = text;
this.elm = elm;
this.ns = undefined;
this.context = context;
this.fnContext = undefined;
this.fnOptions = undefined;
this.fnScopeId = undefined;
this.key = data && data.key;
this.componentOptions = componentOptions;
this.componentInstance = undefined;
this.parent = undefined;
this.raw = false;
this.isStatic = false;
this.isRootInsert = true;
this.isComment = false;
this.isCloned = false;
this.isOnce = false;
this.asyncFactory = asyncFactory;
this.asyncMeta = undefined;
this.isAsyncPlaceholder = false;
};
var prototypeAccessors = { child: { configurable: true } };
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
return this.componentInstance
};
Object.defineProperties( VNode.prototype, prototypeAccessors );
var createEmptyVNode = function (text) {
if ( text === void 0 ) text = '';
var node = new VNode();
node.text = text;
node.isComment = true;
return node
};
function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
var cloned = new VNode(
vnode.tag,
vnode.data,
// #7975
// clone children array to avoid mutating ori