From 4794c7248735475f6f8b689c8d385b6029b60f29 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Dec 2019 19:14:13 +0800 Subject: [PATCH 001/115] feat: data-picker --- components/date-picker/Calender.js | 128 +++++- components/date-picker/DatePanel.js | 8 +- components/date-picker/DatePicker.js | 1 + components/date-picker/DateRangePanel.js | 4 +- components/date-picker/dateUtil.js | 10 +- components/date-picker/holidaylist.js | 554 +++++++++++++++++++++++ components/date-picker/style/index.scss | 32 ++ components/date-picker/toLunar.js | 226 +++++++++ docs/demo/date-picker/section-normal.jsx | 1 + docs/zh-CN/components/date-picker.mdx | 1 + 10 files changed, 954 insertions(+), 11 deletions(-) create mode 100644 components/date-picker/holidaylist.js create mode 100644 components/date-picker/toLunar.js diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index f0b56339f..4e5743bd6 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -1,7 +1,9 @@ import React, {Component} from 'react' import {deconstructDate, getYearWeek} from './util' import Provider from '../context' - +import Lunar from './toLunar' +import holidaylist from './holidaylist' +import {DAY_MILLISECONDS} from './constants' import { getDaysInMonth, subMonths, @@ -13,10 +15,12 @@ import { addMonths, isToday, getYear, + getMonth, toDate, - isValid + isValid, + lunarCalendarisShow } from './dateUtil' -import {DAY_MILLISECONDS} from './constants' + class Calender extends Component { constructor (props) { super(props) @@ -24,6 +28,7 @@ class Calender extends Component { rows: [[], [], [], [], [], []] } this.weekNum = 0 + console.log(this.props) } _getTime (week, y, m) { const r = new Date(y, m - 1, 1) @@ -160,6 +165,7 @@ class Calender extends Component { if (cls.indexOf('next') !== -1) { newDate = addMonths(newDate, 1) } + console.log('newDate', newDate) if (type === 'daterange' || type === 'weekrange') { if (range.selecting) { if (range.startDate > newDate) { @@ -194,9 +200,113 @@ class Calender extends Component { } mouseMove(newDate) } - getTDClass (td) { + /** + * 是否是节假日 + * @param {string} date yyyy-MM-dd + * @param {string} year yyyy + */ + isHoliday (year, date) { + const holidayBase = holidaylist[year] + const holidayInfo = {} + if (holidayBase) { + holidayBase.holidaylist.forEach(item => { + item.startday === date && Object.assign(holidayInfo, item) + }) + if (holidayInfo.name) { + holidayBase.holiday.forEach(item => { + item.name === holidayInfo.name && Object.assign(holidayInfo, item) + }) + } + } + + return holidayInfo + } + /** + * 获取完整时间 + * @param {*} value 日 + * @param {*} cls className + */ + getFullTime (value, cls) { + const { date, type } = this.props + + let { year, month, day, hours, minutes, seconds } = deconstructDate(date) + + if (cls.indexOf('disabled') !== -1) return false + const clickVal = parseInt(value) + let newDate = new Date(year, month - 1, day, hours, minutes, seconds) + if (type === 'year') { + year = parseInt(value) + newDate.setFullYear(year) + } else if (type === 'month') { + month = parseInt(value) + newDate.setMonth(month - 1) + } else { + newDate.setDate(clickVal) + } + if (cls.indexOf('prev') !== -1) { + newDate = addMonths(newDate, -1) + } + if (cls.indexOf('next') !== -1) { + newDate = addMonths(newDate, 1) + } + // console.log('newsdfasd',new Date(newDate).toLocaleDateString(),getMonth(newDate)) + // console.log(Lunar.toLunar(getYear(newDate),getMonth(newDate)+1,value)) + const _year = getYear(newDate) + const _month = getMonth(newDate) + 1 + const LunarInfo = Lunar.toLunar(_year, _month, value) + const lunarcellinfo = this.isHoliday(_year, _year + '-' + _month + '-' + value) + lunarcellinfo.Lunar = LunarInfo[6] + return lunarcellinfo + } + ToLunar (td) { + const { type: layerType, date } = this.props + const nDate = getYear(new Date()) + const propDate = getYear(date) + const isAddToday = nDate === propDate + let _class = [] + + switch (td.type) { + case 'normal': + _class.push('normal') + break + case 'today': + layerType !== 'week' && _class.push('today') + layerType === 'month' && !isAddToday && _class.pop() + break + case 'current': + _class.push('current') + break + default: + _class.push(td.type) + break + } + const fullTimeInfo = this.getFullTime(td.value, _class) + if (fullTimeInfo.name) { + return ( + + + + {fullTimeInfo.name} + + + ) + } else { + return ( + + + {fullTimeInfo.Lunar} + + + ) + } + } + getTDClass (td, _index) { const { type: layerType, date } = this.props let _class = ['hi-datepicker__cell'] + if (lunarCalendarisShow(this.props)) { + _class.push('hi-datepicker__cell--large') + _index === 6 && _class.push('hi-datepicker__cell--large--laster') + } if (td.disabled) { _class.push('disabled') return _class.join(' ') @@ -275,13 +385,21 @@ class Calender extends Component {
{cell.text || cell.value}
+ { + lunarCalendarisShow(this.props) &&
+ { + this.ToLunar(cell) + } +
+ } + ) }) diff --git a/components/date-picker/DatePanel.js b/components/date-picker/DatePanel.js index 44b9e93bf..95eff71bc 100644 --- a/components/date-picker/DatePanel.js +++ b/components/date-picker/DatePanel.js @@ -5,7 +5,7 @@ import TimePanel from './TimePanel' import Icon from '../icon' import classNames from 'classnames' import TimePeriodPanel from './TimePeriodPanel' -import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek } from './dateUtil' +import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek, lunarCalendarisShow } from './dateUtil' class DatePanel extends Component { constructor (props) { @@ -206,7 +206,7 @@ class DatePanel extends Component { } _getNormalComponent () { const { currentView } = this.state - const { min, max, weekOffset, date } = this.props + const { min, max, weekOffset, date, lunarCalendar } = this.props const validDate = getStartDate(date) const { year, month } = deconstructDate(validDate) let component = null @@ -216,6 +216,7 @@ class DatePanel extends Component { case 'week': component = ( diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index 20692f943..39d43f98c 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -9,6 +9,7 @@ import Provider from '../context' class DatePicker extends BasePicker { initPanel (state, props) { let component = null + console.log('++', props) let d = state.date switch (props.type) { case 'month': diff --git a/components/date-picker/DateRangePanel.js b/components/date-picker/DateRangePanel.js index d7bf52159..3264fb5ba 100644 --- a/components/date-picker/DateRangePanel.js +++ b/components/date-picker/DateRangePanel.js @@ -5,7 +5,7 @@ import {DAY_MILLISECONDS} from './constants' import Icon from '../icon' import classNames from 'classnames' import Provider from '../context' -import { dateFormat, isValid, getStartDate, toDate, changeYear, changeMonth } from './dateUtil' +import { dateFormat, isValid, getStartDate, toDate, changeYear, changeMonth, endOfDay } from './dateUtil' import TimeRangePanel from './TimeRangePanel' class DateRangePanel extends Component { @@ -189,7 +189,7 @@ class DateRangePanel extends Component { days = 365 break } - const nDate = new Date(_date.getTime() - days * DAY_MILLISECONDS) + const nDate = new Date((endOfDay(_date).getTime() + 1) - days * DAY_MILLISECONDS) range.startDate = nDate range.endDate = _date this.props.onPick(range) diff --git a/components/date-picker/dateUtil.js b/components/date-picker/dateUtil.js index 4795b04de..bce11cc86 100644 --- a/components/date-picker/dateUtil.js +++ b/components/date-picker/dateUtil.js @@ -87,6 +87,13 @@ const changeMonth = (date, flag) => { } return nDate } +/** + * 是否展示农历 + * @param {Object} props + */ +const lunarCalendarisShow = (props) => { + return (props.type === 'date' || props.type === 'daterange') && props.lunarCalendar +} export { getDaysInMonth, // 获取当月的天数 subMonths, // 月份减法 @@ -124,5 +131,6 @@ export { compatibleToDate, compatibleFormatString, changeYear, - changeMonth + changeMonth, + lunarCalendarisShow // 是否展示农历 } diff --git a/components/date-picker/holidaylist.js b/components/date-picker/holidaylist.js new file mode 100644 index 000000000..d4807fee5 --- /dev/null +++ b/components/date-picker/holidaylist.js @@ -0,0 +1,554 @@ +export default { + '2019': { + 'holiday': [ + { + 'desc': '2018年12月30日至2019年1月1日放假调休,共3天。2018年12月29日(星期六)上班。', + 'festival': '2019-1-1', + 'list': [ + { + 'date': '2018-12-29', + 'status': '2' + }, + { + 'date': '2018-12-31', + 'status': '1' + }, + { + 'date': '2019-1-1', + 'status': '1' + }, + { + 'date': '2018-12-30', + 'status': '1' + } + ], + 'list#num#baidu': 4, + 'name': '元旦', + 'rest': '拼假建议:2019年1月2日(周三)~2019年1月4日(周五)请假3天,可拼8天元旦小长假。' + }, + { + 'desc': '除夕', + 'festival': '2019-2-4', + 'list': [ + { + 'date': '2019-2-4', + 'status': '1' + } + ], + 'list#num#baidu': 1, + 'name': '除夕', + 'rest': '农历腊月最后一天为除夕,即大年初一前夜,又称为年三十。' + }, + { + 'desc': '2月4日至10日放假调休,共7天。2月2日(星期六)、2月3日(星期日)上班', + 'festival': '2019-2-5', + 'list': [ + { + 'date': '2019-2-4', + 'status': '1' + }, + { + 'date': '2019-2-2', + 'status': '2' + }, + { + 'date': '2019-2-3', + 'status': '2' + }, + { + 'date': '2019-2-5', + 'status': '1' + }, + { + 'date': '2019-2-6', + 'status': '1' + }, + { + 'date': '2019-2-7', + 'status': '1' + }, + { + 'date': '2019-2-8', + 'status': '1' + }, + { + 'date': '2019-2-9', + 'status': '1' + }, + { + 'date': '2019-2-10', + 'status': '1' + } + ], + 'list#num#baidu': 9, + 'name': '春节', + 'rest': '拼假建议:2019年2月11日(周一)-2019年2月15日(周五)请假5天,可拼14天春节小长假。' + }, + { + 'desc': '4月5日放假,与周末连休。', + 'festival': '2019-4-5', + 'list': [ + { + 'date': '2019-4-5', + 'status': '1' + }, + { + 'date': '2019-4-6', + 'status': '1' + }, + { + 'date': '2019-4-7', + 'status': '1' + } + ], + 'list#num#baidu': 3, + 'name': '清明节', + 'rest': '拼假建议:2019年4月1日(周一)~2019年4月4日(周四)请假4天,可拼9天清明节小长假。' + }, + { + 'desc': '5月1日放假', + 'festival': '2019-5-1', + 'list': [ + { + 'date': '2019-5-1', + 'status': '1' + }, + { + 'date': '2019-5-2', + 'status': '1' + }, + { + 'date': '2019-5-3', + 'status': '1' + }, + { + 'date': '2019-5-4', + 'status': '1' + }, + { + 'date': '2019-4-28', + 'status': '2' + }, + { + 'date': '2019-5-5', + 'status': '2' + } + ], + 'list#num#baidu': 6, + 'name': '劳动节', + 'rest': '拼假建议:4月28日(周日)~4月30日(周二)请假3天,可拼8天劳动节小长假。' + }, + { + 'desc': '6月7日放假,与周末连休。', + 'festival': '2019-6-7', + 'list': [ + { + 'date': '2019-6-7', + 'status': '1' + }, + { + 'date': '2019-6-8', + 'status': '1' + }, + { + 'date': '2019-6-9', + 'status': '1' + } + ], + 'list#num#baidu': 3, + 'name': '端午节', + 'rest': '拼假建议:2019年6月3日(周一)~2019年6月6日(周四)请假4天,可拼9天端午节小长假。' + }, + { + 'desc': '9月13日放假,与周末连休。', + 'festival': '2019-9-13', + 'list': [ + { + 'date': '2019-9-13', + 'status': '1' + }, + { + 'date': '2019-9-14', + 'status': '1' + }, + { + 'date': '2019-9-15', + 'status': '1' + } + ], + 'list#num#baidu': 3, + 'name': '中秋节', + 'rest': '拼假建议:2019年9月9日(周一)~2019年9月12日(周四)请假4天,可拼9天中秋节小长假。' + }, + { + 'desc': '10月1日至10月7日放假,9月29日(星期日)、10月12日(星期六)上班。', + 'festival': '2019-10-1', + 'list': [ + { + 'date': '2019-10-1', + 'status': '1' + }, + { + 'date': '2019-9-29', + 'status': '2' + }, + { + 'date': '2019-10-2', + 'status': '1' + }, + { + 'date': '2019-10-3', + 'status': '1' + }, + { + 'date': '2019-10-4', + 'status': '1' + }, + { + 'date': '2019-10-7', + 'status': '1' + }, + { + 'date': '2019-10-12', + 'status': '2' + }, + { + 'date': '2019-10-5', + 'status': '1' + }, + { + 'date': '2019-10-6', + 'status': '1' + } + ], + 'list#num#baidu': 9, + 'name': '国庆节', + 'rest': '拼假建议:9月29日(周日)~9月30日(周一)请2天假,可拼10天国庆节小长假。' + } + ], + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2019-1-1' + }, + { + 'name': '除夕', + 'startday': '2019-2-4' + }, + { + 'name': '春节', + 'startday': '2019-2-4' + }, + { + 'name': '清明节', + 'startday': '2019-4-5' + }, + { + 'name': '劳动节', + 'startday': '2019-5-1' + }, + { + 'name': '端午节', + 'startday': '2019-6-7' + }, + { + 'name': '中秋节', + 'startday': '2019-9-13' + }, + { + 'name': '国庆节', + 'startday': '2019-10-1' + } + ] + }, + '2020': { + 'holiday': [ + { + 'desc': '1月1日放假一天', + 'festival': '2020-1-1', + 'list': [ + { + 'date': '2020-1-1', + 'status': '1' + } + ], + 'list#num#baidu': 1, + 'name': '元旦', + 'rest': '2019年12月30日和2019年12月31日请假两天,与周末连休可拼5天小长假。' + }, + { + 'desc': '1月24日放假一天', + 'festival': '2020-1-24', + 'list': [ + { + 'date': '2020-1-24', + 'status': '1' + } + ], + 'list#num#baidu': 1, + 'name': '除夕', + 'rest': '农历腊月最后一天为除夕,即大年初一前夜,又称为年三十。' + }, + { + 'desc': '1月24日(除夕)至1月30日放假7天,1月19日,2月1日上班', + 'festival': '2020-1-25', + 'list': [ + { + 'date': '2020-1-24', + 'status': '1' + }, + { + 'date': '2020-1-25', + 'status': '1' + }, + { + 'date': '2020-1-26', + 'status': '1' + }, + { + 'date': '2020-1-27', + 'status': '1' + }, + { + 'date': '2020-1-28', + 'status': '1' + }, + { + 'date': '2020-1-29', + 'status': '1' + }, + { + 'date': '2020-1-30', + 'status': '1' + }, + { + 'date': '2020-1-19', + 'status': '2' + }, + { + 'date': '2020-2-1', + 'status': '2' + } + ], + 'list#num#baidu': 9, + 'name': '春节', + 'rest': '2020年1月19日至2020年1月23日请假5天,与周末连休可拼13天长假。' + }, + { + 'desc': '4月4日至4月6日放假3天', + 'festival': '2020-4-4', + 'list': [ + { + 'date': '2020-4-4', + 'status': '1' + }, + { + 'date': '2020-4-5', + 'status': '1' + }, + { + 'date': '2020-4-6', + 'status': '1' + } + ], + 'list#num#baidu': 3, + 'name': '清明节', + 'rest': '2020年4月7日至2020年4月10日请假4天,与周末连休可拼9天长假。' + }, + { + 'desc': '5月1日至5月5日放假5天,4月26日,5月9日上班', + 'festival': '2020-5-1', + 'list': [ + { + 'date': '2020-5-1', + 'status': '1' + }, + { + 'date': '2020-5-2', + 'status': '1' + }, + { + 'date': '2020-5-3', + 'status': '1' + }, + { + 'date': '2020-5-4', + 'status': '1' + }, + { + 'date': '2020-5-5', + 'status': '1' + }, + { + 'date': '2020-4-26', + 'status': '2' + }, + { + 'date': '2020-5-9', + 'status': '2' + } + ], + 'list#num#baidu': 7, + 'name': '劳动节', + 'rest': '2020年4月26日至2020年4月30日请假5天,与周末连休可拼11天长假。' + }, + { + 'desc': '6月25日至6月27日放假3天,6月28日上班', + 'festival': '2020-6-25', + 'list': [ + { + 'date': '2020-6-25', + 'status': '1' + }, + { + 'date': '2020-6-26', + 'status': '1' + }, + { + 'date': '2020-6-27', + 'status': '1' + }, + { + 'date': '2020-6-28', + 'status': '2' + } + ], + 'list#num#baidu': 4, + 'name': '端午节', + 'rest': '2020年6月22日至2020年6月24日请假3天,与周末连休可拼8天长假。' + }, + { + 'desc': '10月1日至10月8日放假8天,9月27日,10月10日上班', + 'festival': '2020-10-1', + 'list': [ + { + 'date': '2020-10-1', + 'status': '1' + }, + { + 'date': '2020-10-2', + 'status': '1' + }, + { + 'date': '2020-10-3', + 'status': '1' + }, + { + 'date': '2020-10-4', + 'status': '1' + }, + { + 'date': '2020-10-5', + 'status': '1' + }, + { + 'date': '2020-10-6', + 'status': '1' + }, + { + 'date': '2020-10-7', + 'status': '1' + }, + { + 'date': '2020-10-8', + 'status': '1' + }, + { + 'date': '2020-9-27', + 'status': '2' + }, + { + 'date': '2020-10-10', + 'status': '2' + } + ], + 'list#num#baidu': 10, + 'name': '中秋节', + 'rest': '10月9日至10月10日请假2天,与周末连休可拼11天长假。' + }, + { + 'desc': '10月1日至10月8日放假8天,9月27日,10月10日上班', + 'festival': '2020-10-1', + 'list': [ + { + 'date': '2020-10-1', + 'status': '1' + }, + { + 'date': '2020-10-2', + 'status': '1' + }, + { + 'date': '2020-10-3', + 'status': '1' + }, + { + 'date': '2020-10-4', + 'status': '1' + }, + { + 'date': '2020-10-5', + 'status': '1' + }, + { + 'date': '2020-10-6', + 'status': '1' + }, + { + 'date': '2020-10-7', + 'status': '1' + }, + { + 'date': '2020-10-8', + 'status': '1' + }, + { + 'date': '2020-9-27', + 'status': '2' + }, + { + 'date': '2020-10-10', + 'status': '2' + } + ], + 'list#num#baidu': 10, + 'name': '国庆节', + 'rest': '10月9日至10月10日请假2天,与周末连休可拼11天长假。' + } + ], + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2020-1-1' + }, + { + 'name': '除夕', + 'startday': '2020-1-24' + }, + { + 'name': '春节', + 'startday': '2020-1-25' + }, + { + 'name': '清明节', + 'startday': '2020-4-4' + }, + { + 'name': '劳动节', + 'startday': '2020-5-1' + }, + { + 'name': '端午节', + 'startday': '2020-6-25' + }, + { + 'name': '中秋节', + 'startday': '2020-10-1' + }, + { + 'name': '国庆节', + 'startday': '2020-10-1' + } + ] + } +} diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index 907d5b0b2..3a0115b48 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -117,6 +117,10 @@ $basic-color: #4284f5 !default; box-sizing: border-box; width: 288px; + &--large { + width: 488px; + } + &--hastime { width: 468px; display: flex; @@ -299,6 +303,15 @@ $basic-color: #4284f5 !default; width: 36px; height: 24px; + &--large { + width: 56px; + padding-right: 8px; + + &--laster { + padding-right: 4px; + } + } + &.disabled { .hi-datepicker__content { cursor: not-allowed; @@ -316,6 +329,25 @@ $basic-color: #4284f5 !default; } } + .hi-datepicker__text--lunarCalendar { + font-size: 12px; + color: rgba(44, 48, 78, 0.2); + + &--festival { + color: #4284f5; + } + } + + .hi-datepicker__text——holiday { + display: inline-block; + width: 0; + font-size: 12px; + position: relative; + top: -28px; + right: -28px; + color: #1da653; + } + &.prev, &.next { .hi-datepicker__text { diff --git a/components/date-picker/toLunar.js b/components/date-picker/toLunar.js new file mode 100644 index 000000000..7d489ef70 --- /dev/null +++ b/components/date-picker/toLunar.js @@ -0,0 +1,226 @@ +/* eslint-disable */ +const Lunar = { + MIN_YEAR: 1891, + MAX_YEAR: 2100, + lunarInfo: [ + [0, 2, 9, 21936], [6, 1, 30, 9656], [0, 2, 17, 9584], [0, 2, 6, 21168], [5, 1, 26, 43344], [0, 2, 13, 59728], + [0, 2, 2, 27296], [3, 1, 22, 44368], [0, 2, 10, 43856], [8, 1, 30, 19304], [0, 2, 19, 19168], [0, 2, 8, 42352], + [5, 1, 29, 21096], [0, 2, 16, 53856], [0, 2, 4, 55632], [4, 1, 25, 27304], [0, 2, 13, 22176], [0, 2, 2, 39632], + [2, 1, 22, 19176], [0, 2, 10, 19168], [6, 1, 30, 42200], [0, 2, 18, 42192], [0, 2, 6, 53840], [5, 1, 26, 54568], + [0, 2, 14, 46400], [0, 2, 3, 54944], [2, 1, 23, 38608], [0, 2, 11, 38320], [7, 2, 1, 18872], [0, 2, 20, 18800], + [0, 2, 8, 42160], [5, 1, 28, 45656], [0, 2, 16, 27216], [0, 2, 5, 27968], [4, 1, 24, 44456], [0, 2, 13, 11104], + [0, 2, 2, 38256], [2, 1, 23, 18808], [0, 2, 10, 18800], [6, 1, 30, 25776], [0, 2, 17, 54432], [0, 2, 6, 59984], + [5, 1, 26, 27976], [0, 2, 14, 23248], [0, 2, 4, 11104], [3, 1, 24, 37744], [0, 2, 11, 37600], [7, 1, 31, 51560], + [0, 2, 19, 51536], [0, 2, 8, 54432], [6, 1, 27, 55888], [0, 2, 15, 46416], [0, 2, 5, 22176], [4, 1, 25, 43736], + [0, 2, 13, 9680], [0, 2, 2, 37584], [2, 1, 22, 51544], [0, 2, 10, 43344], [7, 1, 29, 46248], [0, 2, 17, 27808], + [0, 2, 6, 46416], [5, 1, 27, 21928], [0, 2, 14, 19872], [0, 2, 3, 42416], [3, 1, 24, 21176], [0, 2, 12, 21168], + [8, 1, 31, 43344], [0, 2, 18, 59728], [0, 2, 8, 27296], [6, 1, 28, 44368], [0, 2, 15, 43856], [0, 2, 5, 19296], + [4, 1, 25, 42352], [0, 2, 13, 42352], [0, 2, 2, 21088], [3, 1, 21, 59696], [0, 2, 9, 55632], [7, 1, 30, 23208], + [0, 2, 17, 22176], [0, 2, 6, 38608], [5, 1, 27, 19176], [0, 2, 15, 19152], [0, 2, 3, 42192], [4, 1, 23, 53864], + [0, 2, 11, 53840], [8, 1, 31, 54568], [0, 2, 18, 46400], [0, 2, 7, 46752], [6, 1, 28, 38608], [0, 2, 16, 38320], + [0, 2, 5, 18864], [4, 1, 25, 42168], [0, 2, 13, 42160], [10, 2, 2, 45656], [0, 2, 20, 27216], [0, 2, 9, 27968], + [6, 1, 29, 44448], [0, 2, 17, 43872], [0, 2, 6, 38256], [5, 1, 27, 18808], [0, 2, 15, 18800], [0, 2, 4, 25776], + [3, 1, 23, 27216], [0, 2, 10, 59984], [8, 1, 31, 27432], [0, 2, 19, 23232], [0, 2, 7, 43872], [5, 1, 28, 37736], + [0, 2, 16, 37600], [0, 2, 5, 51552], [4, 1, 24, 54440], [0, 2, 12, 54432], [0, 2, 1, 55888], [2, 1, 22, 23208], + [0, 2, 9, 22176], [7, 1, 29, 43736], [0, 2, 18, 9680], [0, 2, 7, 37584], [5, 1, 26, 51544], [0, 2, 14, 43344], + [0, 2, 3, 46240], [4, 1, 23, 46416], [0, 2, 10, 44368], [9, 1, 31, 21928], [0, 2, 19, 19360], [0, 2, 8, 42416], + [6, 1, 28, 21176], [0, 2, 16, 21168], [0, 2, 5, 43312], [4, 1, 25, 29864], [0, 2, 12, 27296], [0, 2, 1, 44368], + [2, 1, 22, 19880], [0, 2, 10, 19296], [6, 1, 29, 42352], [0, 2, 17, 42208], [0, 2, 6, 53856], [5, 1, 26, 59696], + [0, 2, 13, 54576], [0, 2, 3, 23200], [3, 1, 23, 27472], [0, 2, 11, 38608], [11, 1, 31, 19176], [0, 2, 19, 19152], + [0, 2, 8, 42192], [6, 1, 28, 53848], [0, 2, 15, 53840], [0, 2, 4, 54560], [5, 1, 24, 55968], [0, 2, 12, 46496], + [0, 2, 1, 22224], [2, 1, 22, 19160], [0, 2, 10, 18864], [7, 1, 30, 42168], [0, 2, 17, 42160], [0, 2, 6, 43600], + [5, 1, 26, 46376], [0, 2, 14, 27936], [0, 2, 2, 44448], [3, 1, 23, 21936], [0, 2, 11, 37744], [8, 2, 1, 18808], + [0, 2, 19, 18800], [0, 2, 8, 25776], [6, 1, 28, 27216], [0, 2, 15, 59984], [0, 2, 4, 27424], [4, 1, 24, 43872], + [0, 2, 12, 43744], [0, 2, 2, 37600], [3, 1, 21, 51568], [0, 2, 9, 51552], [7, 1, 29, 54440], [0, 2, 17, 54432], + [0, 2, 5, 55888], [5, 1, 26, 23208], [0, 2, 14, 22176], [0, 2, 3, 42704], [4, 1, 23, 21224], [0, 2, 11, 21200], + [8, 1, 31, 43352], [0, 2, 19, 43344], [0, 2, 7, 46240], [6, 1, 27, 46416], [0, 2, 15, 44368], [0, 2, 5, 21920], + [4, 1, 24, 42448], [0, 2, 12, 42416], [0, 2, 2, 21168], [3, 1, 22, 43320], [0, 2, 9, 26928], [7, 1, 29, 29336], + [0, 2, 17, 27296], [0, 2, 6, 44368], [5, 1, 26, 19880], [0, 2, 14, 19296], [0, 2, 3, 42352], [4, 1, 24, 21104], + [0, 2, 10, 53856], [8, 1, 30, 59696], [0, 2, 18, 54560], [0, 2, 7, 55968], [6, 1, 27, 27472], [0, 2, 15, 22224], + [0, 2, 5, 19168], [4, 1, 25, 42216], [0, 2, 12, 42192], [0, 2, 1, 53584], [2, 1, 21, 55592], [0, 2, 9, 54560] + ], + // 是否闰年 + isLeapYear: function (year) { + return ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) + }, + // 天干地支年 + lunarYear: function (year) { + let gan = ['庚', '辛', '壬', '癸', '甲', '乙', '丙', '丁', '戊', '己'], + zhi = ['申', '酉', '戌', '亥', '子', '丑', '寅', '卯', '辰', '巳', '午', '未'], + str = year.toString().split('') + return gan[str[3]] + zhi[year % 12] + }, + // 生肖年 + zodiacYear: function (year) { + let zodiac = ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊'] + return zodiac[year % 12] + }, + // 公历月份天数 + // @param year 阳历-年 + // @param month 阳历-月 + solarMonthDays: function (year, month) { + let FebDays = this.isLeapYear(year) ? 29 : 28 + let monthHash = ['', 31, FebDays, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + return monthHash[month] + }, + // 农历月份天数 + lunarMonthDays: function (year, month) { + let monthData = this.lunarMonths(year) + return monthData[month - 1] + }, + // 农历月份天数数组 + lunarMonths: function (year) { + let yearData = this.lunarInfo[year - this.MIN_YEAR] + let leapMonth = yearData[0] + let bit = (+yearData[3]).toString(2) + let months = [] + for (let i = 0; i < bit.length; i++) { + months[i] = bit.substr(i, 1) + } + + for (let k = 0, len = 16 - months.length; k < len; k++) { + months.unshift('0') + } + + months = months.slice(0, (leapMonth === 0 ? 12 : 13)) + for (let i = 0; i < months.length; i++) { + months[i] = +months[i] + 29 + } + return months + }, + // 农历每年的天数 + // @param year 农历年份 + lunarYearDays: function (year) { + let monthArray = this.lunarYearMonths(year) + let len = monthArray.length + return (monthArray[len - 1] === 0 ? monthArray[len - 2] : monthArray[len - 1]) + }, + // + lunarYearMonths: function (year) { + let monthData = this.lunarMonths(year) + let res = [] + let temp = 0 + let yearData = this.lunarInfo[year - this.MIN_YEAR] + let len = (yearData[0] === 0 ? 12 : 13) + for (let i = 0; i < len; i++) { + temp = 0 + for (let j = 0; j <= i; j++) { + temp += monthData[j] + } + res.push(temp) + } + return res + }, + // 获取闰月 + // @param year 农历年份 + leapMonth: function (year) { + let yearData = this.lunarInfo[year - this.MIN_YEAR] + return yearData[0] + }, + // 计算农历日期与正月初一相隔的天数 + betweenLunarDays: function (year, month, day) { + let yearMonth = this.lunarMonths(year) + let res = 0 + for (let i = 1; i < month; i++) { + res += yearMonth[i - 1] + } + res += day - 1 + return res + }, + // 计算2个阳历日期之间的天数 + // @param year 阳历年 + // @param month + // @param day + // @param l_month 阴历正月对应的阳历月份 + // @param l_day 阴历初一对应的阳历天 + betweenSolarDays: function (year, month, day, l_month, l_day) { + let time1 = new Date(year + '-' + month + '-' + day).getTime(), + time2 = new Date(year + '-' + l_month + '-' + l_day).getTime() + return Math.ceil((time1 - time2) / 24 / 3600 / 1000) + }, + // 根据距离正月初一的天数计算阴历日期 + // @param year 阳历年 + // @param between 天数 + lunarByBetween: function (year, between) { + let lunarArray = [], yearMonth = [], t = 0, e = 0, leapMonth = 0, m = '' + if (between === 0) { + t = 1 + e = 1 + m = '正月' + } else { + year = between > 0 ? year : (year - 1) + yearMonth = this.lunarYearMonths(year) + leapMonth = this.leapMonth(year) + between = between > 0 ? between : (this.lunarYearDays(year) + between) + for (let i = 0; i < 13; i++) { + if (between === yearMonth[i]) { + t = i + 2 + e = 1 + break + } else if (between < yearMonth[i]) { + t = i + 1 + e = between - ((yearMonth[i - 1]) ? yearMonth[i - 1] : 0) + 1 + break + } + } + + m = (leapMonth !== 0 && t === leapMonth + 1) + ? ('闰'.this.chineseMonth(t - 1)) + : this.chineseMonth(((leapMonth !== 0 && leapMonth + 1 < t) ? (t - 1) : t)) + } + lunarArray.push(year, t, e) // 年 月 日 + lunarArray.push(this.lunarYear(year), + this.zodiacYear(year), + m, + this.chineseNumber(e)) // 天干地支年 生肖年 月份 日 + lunarArray.push(leapMonth) // 闰几月 + return lunarArray + }, + // 中文月份 + chineseMonth: function (month) { + let monthHash = ['', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'] + return monthHash[month] + }, + // 中文日期 + chineseNumber: function (num) { + let dateHash = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] + let res + if (num <= 10) { + res = '初' + dateHash[num] + } else if (num > 10 && num < 20) { + res = '十' + dateHash[num - 10] + } else if (num === 20) { + res = '二十' + } else if (num > 20 && num < 30) { + res = '廿' + dateHash[num - 20] + } else if (num === 30) { + res = '三十' + } + return res + }, + // 转换农历 + toLunar: function (year, month, day) { + let yearData = this.lunarInfo[year - this.MIN_YEAR] + if (year === this.MIN_YEAR && month <= 2 && day <= 9) { + return [1891, 1, 1, '辛卯', '兔', '正月', '初一'] + } + return this.lunarByBetween(year, this.betweenSolarDays(year, month, day, yearData[1], yearData[2])) + }, + // 转换公历 + // @param year 阴历-年 + // @param month 阴历-月,闰月处理:例如如果当年闰五月,那么第二个五月就传六月,相当于阴历有13个月 + // @param date 阴历-日 + toSolar: function (year, month, day) { + let yearData = this.lunarInfo[year - this.MIN_YEAR] + let between = this.betweenLunarDays(year, month, day) + let ms = new Date(year + '-' + yearData[1] + '-' + yearData[2]).getTime() + let s = ms + between * 24 * 60 * 60 * 1000 + let d = new Date() + d.setTime(s) + year = d.getFullYear() + month = d.getMonth() + 1 + day = d.getDate() + return [year, month, day] + } +} +export default Lunar diff --git a/docs/demo/date-picker/section-normal.jsx b/docs/demo/date-picker/section-normal.jsx index b9a27dfc0..d201cfe84 100644 --- a/docs/demo/date-picker/section-normal.jsx +++ b/docs/demo/date-picker/section-normal.jsx @@ -15,6 +15,7 @@ class Demo extends React.Component { return (
{console.log('onChange', date, dateStr)}} /> diff --git a/docs/zh-CN/components/date-picker.mdx b/docs/zh-CN/components/date-picker.mdx index 51bfd4446..a3c8e097d 100755 --- a/docs/zh-CN/components/date-picker.mdx +++ b/docs/zh-CN/components/date-picker.mdx @@ -97,6 +97,7 @@ import DemoModal from '../../demo/date-picker/section-modal.jsx' | disabled | 是否禁用输入框 | boolean | true \| false | false | | clearable | 是否可以清空 | boolean | true \| false | true | | showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | +| lunarCalendar | 是否在日期选择器中显示农历 | boolean | true \| false | false | | shortcuts | 快捷面板 | string[] | 近一周, 近一月, 近三月, 近一年 | null | | weekOffset | 周起始
默认周日做为第一列 | number | 0 \| 1 | 0 | | placeholder | 自定义占位符
数组用于范围日期 | string \| string[] | - | - | From 3ceaaf373f0fde4c38ac9bd0ed94b4d425ae59f6 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Sun, 29 Dec 2019 09:44:55 +0800 Subject: [PATCH 002/115] feat: solarTerms --- components/date-picker/Calender.js | 26 +- components/date-picker/holidaylist.js | 924 ++++++++++++------------ components/date-picker/style/index.scss | 10 + components/date-picker/toLunar.js | 2 +- 4 files changed, 473 insertions(+), 489 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 4e5743bd6..a922f0451 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -208,15 +208,18 @@ class Calender extends Component { isHoliday (year, date) { const holidayBase = holidaylist[year] const holidayInfo = {} + const reg = /[\u4E00-\u9FA5]+/ if (holidayBase) { holidayBase.holidaylist.forEach(item => { - item.startday === date && Object.assign(holidayInfo, item) + const status = {status: 1} + item.startday === date && Object.assign(holidayInfo, item, status) + }) + if (holidayBase.holiday[date]) holidayInfo.status = Number(holidayBase.holiday[date]) + + reg.test(holidayInfo.name) || holidayBase.solarTerms.forEach(item => { + const status = {status: holidayInfo.status ? holidayInfo.status : 3} + item.date === date && Object.assign(holidayInfo, item, status) }) - if (holidayInfo.name) { - holidayBase.holiday.forEach(item => { - item.name === holidayInfo.name && Object.assign(holidayInfo, item) - }) - } } return holidayInfo @@ -281,12 +284,17 @@ class Calender extends Component { break } const fullTimeInfo = this.getFullTime(td.value, _class) - if (fullTimeInfo.name) { + if (fullTimeInfo.status) { return ( - + { + fullTimeInfo.status === 1 ? : null + } + { + fullTimeInfo.status === 2 ? : null + } - {fullTimeInfo.name} + {fullTimeInfo.name || fullTimeInfo.Lunar} ) diff --git a/components/date-picker/holidaylist.js b/components/date-picker/holidaylist.js index d4807fee5..b1c4a45d8 100644 --- a/components/date-picker/holidaylist.js +++ b/components/date-picker/holidaylist.js @@ -1,231 +1,214 @@ export default { - '2019': { - 'holiday': [ - { - 'desc': '2018年12月30日至2019年1月1日放假调休,共3天。2018年12月29日(星期六)上班。', - 'festival': '2019-1-1', - 'list': [ - { - 'date': '2018-12-29', - 'status': '2' - }, - { - 'date': '2018-12-31', - 'status': '1' - }, - { - 'date': '2019-1-1', - 'status': '1' - }, - { - 'date': '2018-12-30', - 'status': '1' - } - ], - 'list#num#baidu': 4, + '2020': { + 'holiday': { + '2020-1-1': '1', + '2020-1-24': '1', + '2020-1-25': '1', + '2020-1-26': '1', + '2020-1-27': '1', + '2020-1-28': '1', + '2020-1-29': '1', + '2020-1-30': '1', + '2020-1-19': '2', + '2020-2-1': '2', + '2020-4-4': '1', + '2020-4-5': '1', + '2020-4-6': '1', + '2020-5-1': '1', + '2020-5-2': '1', + '2020-5-3': '1', + '2020-5-4': '1', + '2020-5-5': '1', + '2020-4-26': '2', + '2020-5-9': '2', + '2020-6-25': '1', + '2020-6-26': '1', + '2020-6-27': '1', + '2020-6-28': '2', + '2020-10-1': '1', + '2020-10-2': '1', + '2020-10-3': '1', + '2020-10-4': '1', + '2020-10-5': '1', + '2020-10-6': '1', + '2020-10-7': '1', + '2020-10-8': '1', + '2020-9-27': '2', + '2020-10-10': '2' + }, + 'holidaylist': [ + { 'name': '元旦', - 'rest': '拼假建议:2019年1月2日(周三)~2019年1月4日(周五)请假3天,可拼8天元旦小长假。' - }, - { - 'desc': '除夕', - 'festival': '2019-2-4', - 'list': [ - { - 'date': '2019-2-4', - 'status': '1' - } - ], - 'list#num#baidu': 1, + 'startday': '2020-1-1' + }, + { 'name': '除夕', - 'rest': '农历腊月最后一天为除夕,即大年初一前夜,又称为年三十。' - }, - { - 'desc': '2月4日至10日放假调休,共7天。2月2日(星期六)、2月3日(星期日)上班', - 'festival': '2019-2-5', - 'list': [ - { - 'date': '2019-2-4', - 'status': '1' - }, - { - 'date': '2019-2-2', - 'status': '2' - }, - { - 'date': '2019-2-3', - 'status': '2' - }, - { - 'date': '2019-2-5', - 'status': '1' - }, - { - 'date': '2019-2-6', - 'status': '1' - }, - { - 'date': '2019-2-7', - 'status': '1' - }, - { - 'date': '2019-2-8', - 'status': '1' - }, - { - 'date': '2019-2-9', - 'status': '1' - }, - { - 'date': '2019-2-10', - 'status': '1' - } - ], - 'list#num#baidu': 9, + 'startday': '2020-1-24' + }, + { 'name': '春节', - 'rest': '拼假建议:2019年2月11日(周一)-2019年2月15日(周五)请假5天,可拼14天春节小长假。' - }, - { - 'desc': '4月5日放假,与周末连休。', - 'festival': '2019-4-5', - 'list': [ - { - 'date': '2019-4-5', - 'status': '1' - }, - { - 'date': '2019-4-6', - 'status': '1' - }, - { - 'date': '2019-4-7', - 'status': '1' - } - ], - 'list#num#baidu': 3, + 'startday': '2020-1-25' + }, + { 'name': '清明节', - 'rest': '拼假建议:2019年4月1日(周一)~2019年4月4日(周四)请假4天,可拼9天清明节小长假。' - }, - { - 'desc': '5月1日放假', - 'festival': '2019-5-1', - 'list': [ - { - 'date': '2019-5-1', - 'status': '1' - }, - { - 'date': '2019-5-2', - 'status': '1' - }, - { - 'date': '2019-5-3', - 'status': '1' - }, - { - 'date': '2019-5-4', - 'status': '1' - }, - { - 'date': '2019-4-28', - 'status': '2' - }, - { - 'date': '2019-5-5', - 'status': '2' - } - ], - 'list#num#baidu': 6, + 'startday': '2020-4-4' + }, + { 'name': '劳动节', - 'rest': '拼假建议:4月28日(周日)~4月30日(周二)请假3天,可拼8天劳动节小长假。' - }, - { - 'desc': '6月7日放假,与周末连休。', - 'festival': '2019-6-7', - 'list': [ - { - 'date': '2019-6-7', - 'status': '1' - }, - { - 'date': '2019-6-8', - 'status': '1' - }, - { - 'date': '2019-6-9', - 'status': '1' - } - ], - 'list#num#baidu': 3, + 'startday': '2020-5-1' + }, + { 'name': '端午节', - 'rest': '拼假建议:2019年6月3日(周一)~2019年6月6日(周四)请假4天,可拼9天端午节小长假。' - }, - { - 'desc': '9月13日放假,与周末连休。', - 'festival': '2019-9-13', - 'list': [ - { - 'date': '2019-9-13', - 'status': '1' - }, - { - 'date': '2019-9-14', - 'status': '1' - }, - { - 'date': '2019-9-15', - 'status': '1' - } - ], - 'list#num#baidu': 3, + 'startday': '2020-6-25' + }, + { 'name': '中秋节', - 'rest': '拼假建议:2019年9月9日(周一)~2019年9月12日(周四)请假4天,可拼9天中秋节小长假。' - }, - { - 'desc': '10月1日至10月7日放假,9月29日(星期日)、10月12日(星期六)上班。', - 'festival': '2019-10-1', - 'list': [ - { - 'date': '2019-10-1', - 'status': '1' - }, - { - 'date': '2019-9-29', - 'status': '2' - }, - { - 'date': '2019-10-2', - 'status': '1' - }, - { - 'date': '2019-10-3', - 'status': '1' - }, - { - 'date': '2019-10-4', - 'status': '1' - }, - { - 'date': '2019-10-7', - 'status': '1' - }, - { - 'date': '2019-10-12', - 'status': '2' - }, - { - 'date': '2019-10-5', - 'status': '1' - }, - { - 'date': '2019-10-6', - 'status': '1' - } - ], - 'list#num#baidu': 9, + 'startday': '2020-10-1' + }, + { 'name': '国庆节', - 'rest': '拼假建议:9月29日(周日)~9月30日(周一)请2天假,可拼10天国庆节小长假。' + 'startday': '2020-10-1' } ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2020-2-4' + }, + { + 'name': '雨水', + 'date': '2020-2-19' + }, + { + 'name': '惊蛰', + 'date': '2020-3-5' + }, + { + 'name': '春分', + 'date': '2020-3-20' + }, + { + 'name': '清明', + 'date': '2020-4-4' + }, + { + 'name': '谷雨', + 'date': '2020-4-19' + }, + { + 'name': '立夏', + 'date': '2020-5-5' + }, + { + 'name': '小满', + 'date': '2020-5-20' + }, + { + 'name': '芒种', + 'date': '2020-6-5' + }, + { + 'name': '夏至', + 'date': '2020-6-21' + }, + { + 'name': '小暑', + 'date': '2020-7-6' + }, + { + 'name': '大暑', + 'date': '2020-7-22' + }, + { + 'name': '立秋', + 'date': '2020-8-7' + }, + { + 'name': '处暑', + 'date': '2020-8-22' + }, + { + 'name': '白露', + 'date': '2020-9-7' + }, + { + 'name': '秋分', + 'date': '2020-9-22' + }, + { + 'name': '寒露', + 'date': '2020-10-8' + }, + { + 'name': '霜降', + 'date': '2020-10-23' + }, + { + 'name': '立冬', + 'date': '2020-11-7' + }, + { + 'name': '小雪', + 'date': '2020-11-22' + }, + { + 'name': '大雪', + 'date': '2020-12-7' + }, + { + 'name': '冬至', + 'date': '2020-12-21' + }, + { + 'name': '小寒', + 'date': '2020-1-6' + }, + { + 'name': '大寒', + 'date': '2020-1-20' + } + ] + }, + '2019': { + 'holiday': { + '2018-12-29': '2', + '2018-12-31': '1', + '2019-1-1': '1', + '2018-12-30': '1', + '2019-2-4': '1', + '2019-2-2': '2', + '2019-2-3': '2', + '2019-2-5': '1', + '2019-2-6': '1', + '2019-2-7': '1', + '2019-2-8': '1', + '2019-2-9': '1', + '2019-2-10': '1', + '2019-4-5': '1', + '2019-4-6': '1', + '2019-4-7': '1', + '2019-5-1': '1', + '2019-5-2': '1', + '2019-5-3': '1', + '2019-5-4': '1', + '2019-4-28': '2', + '2019-5-5': '2', + '2019-6-7': '1', + '2019-6-8': '1', + '2019-6-9': '1', + '2019-9-13': '1', + '2019-9-14': '1', + '2019-9-15': '1', + '2019-10-1': '1', + '2019-9-29': '2', + '2019-10-2': '1', + '2019-10-3': '1', + '2019-10-4': '1', + '2019-10-7': '1', + '2019-10-12': '2', + '2019-10-5': '1', + '2019-10-6': '1' + }, 'holidaylist': [ { 'name': '元旦', @@ -259,295 +242,278 @@ export default { 'name': '国庆节', 'startday': '2019-10-1' } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2019-2-4' + }, + { + 'name': '雨水', + 'date': '2019-2-19' + }, + { + 'name': '惊蛰', + 'date': '2019-3-6' + }, + { + 'name': '春分', + 'date': '2019-3-21' + }, + { + 'name': '清明', + 'date': '2019-4-5' + }, + { + 'name': '谷雨', + 'date': '2019-4-20' + }, + { + 'name': '立夏', + 'date': '2019-5-6' + }, + { + 'name': '小满', + 'date': '2019-5-21' + }, + { + 'name': '芒种', + 'date': '2019-6-6' + }, + { + 'name': '夏至', + 'date': '2019-6-21' + }, + { + 'name': '小暑', + 'date': '2019-7-7' + }, + { + 'name': '大暑', + 'date': '2019-7-23' + }, + { + 'name': '立秋', + 'date': '2019-8-8' + }, + { + 'name': '处暑', + 'date': '2019-8-23' + }, + { + 'name': '白露', + 'date': '2019-9-8' + }, + { + 'name': '秋分', + 'date': '2019-9-23' + }, + { + 'name': '寒露', + 'date': '2019-10-8' + }, + { + 'name': '霜降', + 'date': '2019-10-24' + }, + { + 'name': '立冬', + 'date': '2019-11-8' + }, + { + 'name': '小雪', + 'date': '2019-11-22' + }, + { + 'name': '大雪', + 'date': '2019-12-7' + }, + { + 'name': '冬至', + 'date': '2019-12-22' + }, + { + 'name': '小寒', + 'date': '2019-1-5' + }, + { + 'name': '大寒', + 'date': '2019-1-20' + } ] }, - '2020': { - 'holiday': [ - { - 'desc': '1月1日放假一天', - 'festival': '2020-1-1', - 'list': [ - { - 'date': '2020-1-1', - 'status': '1' - } - ], - 'list#num#baidu': 1, + '2018': { + 'holiday': { + '2017-12-30': '1', + '2017-12-31': '1', + '2018-1-1': '1', + '2018-2-15': '1', + '2018-2-11': '2', + '2018-2-16': '1', + '2018-2-17': '1', + '2018-2-18': '1', + '2018-2-19': '1', + '2018-2-20': '1', + '2018-2-21': '1', + '2018-2-24': '2', + '2018-4-5': '1', + '2018-4-6': '1', + '2018-4-7': '1', + '2018-4-8': '2', + '2018-4-28': '2', + '2018-4-29': '1', + '2018-4-30': '1', + '2018-5-1': '1', + '2018-6-16': '1', + '2018-6-17': '1', + '2018-6-18': '1', + '2018-9-22': '1', + '2018-9-23': '1', + '2018-9-24': '1', + '2018-10-1': '1', + '2018-10-2': '1', + '2018-10-3': '1', + '2018-10-4': '1', + '2018-10-5': '1', + '2018-10-6': '1', + '2018-10-7': '1', + '2018-9-29': '2', + '2018-9-30': '2', + '2018-12-29': '2', + '2018-12-31': '1', + '2019-1-1': '1', + '2018-12-30': '1' + }, + 'holidaylist': [ + { 'name': '元旦', - 'rest': '2019年12月30日和2019年12月31日请假两天,与周末连休可拼5天小长假。' - }, - { - 'desc': '1月24日放假一天', - 'festival': '2020-1-24', - 'list': [ - { - 'date': '2020-1-24', - 'status': '1' - } - ], - 'list#num#baidu': 1, + 'startday': '2018-1-1' + }, + { 'name': '除夕', - 'rest': '农历腊月最后一天为除夕,即大年初一前夜,又称为年三十。' - }, - { - 'desc': '1月24日(除夕)至1月30日放假7天,1月19日,2月1日上班', - 'festival': '2020-1-25', - 'list': [ - { - 'date': '2020-1-24', - 'status': '1' - }, - { - 'date': '2020-1-25', - 'status': '1' - }, - { - 'date': '2020-1-26', - 'status': '1' - }, - { - 'date': '2020-1-27', - 'status': '1' - }, - { - 'date': '2020-1-28', - 'status': '1' - }, - { - 'date': '2020-1-29', - 'status': '1' - }, - { - 'date': '2020-1-30', - 'status': '1' - }, - { - 'date': '2020-1-19', - 'status': '2' - }, - { - 'date': '2020-2-1', - 'status': '2' - } - ], - 'list#num#baidu': 9, + 'startday': '2018-2-15' + }, + { 'name': '春节', - 'rest': '2020年1月19日至2020年1月23日请假5天,与周末连休可拼13天长假。' - }, - { - 'desc': '4月4日至4月6日放假3天', - 'festival': '2020-4-4', - 'list': [ - { - 'date': '2020-4-4', - 'status': '1' - }, - { - 'date': '2020-4-5', - 'status': '1' - }, - { - 'date': '2020-4-6', - 'status': '1' - } - ], - 'list#num#baidu': 3, + 'startday': '2018-2-16' + }, + { 'name': '清明节', - 'rest': '2020年4月7日至2020年4月10日请假4天,与周末连休可拼9天长假。' - }, - { - 'desc': '5月1日至5月5日放假5天,4月26日,5月9日上班', - 'festival': '2020-5-1', - 'list': [ - { - 'date': '2020-5-1', - 'status': '1' - }, - { - 'date': '2020-5-2', - 'status': '1' - }, - { - 'date': '2020-5-3', - 'status': '1' - }, - { - 'date': '2020-5-4', - 'status': '1' - }, - { - 'date': '2020-5-5', - 'status': '1' - }, - { - 'date': '2020-4-26', - 'status': '2' - }, - { - 'date': '2020-5-9', - 'status': '2' - } - ], - 'list#num#baidu': 7, + 'startday': '2018-4-5' + }, + { 'name': '劳动节', - 'rest': '2020年4月26日至2020年4月30日请假5天,与周末连休可拼11天长假。' - }, - { - 'desc': '6月25日至6月27日放假3天,6月28日上班', - 'festival': '2020-6-25', - 'list': [ - { - 'date': '2020-6-25', - 'status': '1' - }, - { - 'date': '2020-6-26', - 'status': '1' - }, - { - 'date': '2020-6-27', - 'status': '1' - }, - { - 'date': '2020-6-28', - 'status': '2' - } - ], - 'list#num#baidu': 4, + 'startday': '2018-5-1' + }, + { 'name': '端午节', - 'rest': '2020年6月22日至2020年6月24日请假3天,与周末连休可拼8天长假。' - }, - { - 'desc': '10月1日至10月8日放假8天,9月27日,10月10日上班', - 'festival': '2020-10-1', - 'list': [ - { - 'date': '2020-10-1', - 'status': '1' - }, - { - 'date': '2020-10-2', - 'status': '1' - }, - { - 'date': '2020-10-3', - 'status': '1' - }, - { - 'date': '2020-10-4', - 'status': '1' - }, - { - 'date': '2020-10-5', - 'status': '1' - }, - { - 'date': '2020-10-6', - 'status': '1' - }, - { - 'date': '2020-10-7', - 'status': '1' - }, - { - 'date': '2020-10-8', - 'status': '1' - }, - { - 'date': '2020-9-27', - 'status': '2' - }, - { - 'date': '2020-10-10', - 'status': '2' - } - ], - 'list#num#baidu': 10, + 'startday': '2018-6-18' + }, + { 'name': '中秋节', - 'rest': '10月9日至10月10日请假2天,与周末连休可拼11天长假。' - }, - { - 'desc': '10月1日至10月8日放假8天,9月27日,10月10日上班', - 'festival': '2020-10-1', - 'list': [ - { - 'date': '2020-10-1', - 'status': '1' - }, - { - 'date': '2020-10-2', - 'status': '1' - }, - { - 'date': '2020-10-3', - 'status': '1' - }, - { - 'date': '2020-10-4', - 'status': '1' - }, - { - 'date': '2020-10-5', - 'status': '1' - }, - { - 'date': '2020-10-6', - 'status': '1' - }, - { - 'date': '2020-10-7', - 'status': '1' - }, - { - 'date': '2020-10-8', - 'status': '1' - }, - { - 'date': '2020-9-27', - 'status': '2' - }, - { - 'date': '2020-10-10', - 'status': '2' - } - ], - 'list#num#baidu': 10, + 'startday': '2018-9-24' + }, + { 'name': '国庆节', - 'rest': '10月9日至10月10日请假2天,与周末连休可拼11天长假。' + 'startday': '2018-10-1' } ], - 'holidaylist': [ + 'solarTerms': [ { - 'name': '元旦', - 'startday': '2020-1-1' + 'name': '立春', + 'date': '2018-2-4' }, { - 'name': '除夕', - 'startday': '2020-1-24' + 'name': '雨水', + 'date': '2018-2-19' }, { - 'name': '春节', - 'startday': '2020-1-25' + 'name': '惊蛰', + 'date': '2018-3-5' }, { - 'name': '清明节', - 'startday': '2020-4-4' + 'name': '春分', + 'date': '2018-3-21' }, { - 'name': '劳动节', - 'startday': '2020-5-1' + 'name': '清明', + 'date': '2018-4-5' }, { - 'name': '端午节', - 'startday': '2020-6-25' + 'name': '谷雨', + 'date': '2018-4-20' }, { - 'name': '中秋节', - 'startday': '2020-10-1' + 'name': '立夏', + 'date': '2018-5-5' }, { - 'name': '国庆节', - 'startday': '2020-10-1' + 'name': '小满', + 'date': '2018-5-21' + }, + { + 'name': '芒种', + 'date': '2018-6-6' + }, + { + 'name': '夏至', + 'date': '2018-6-21' + }, + { + 'name': '小暑', + 'date': '2018-7-7' + }, + { + 'name': '大暑', + 'date': '2018-7-23' + }, + { + 'name': '立秋', + 'date': '2018-8-7' + }, + { + 'name': '处暑', + 'date': '2018-8-23' + }, + { + 'name': '白露', + 'date': '2018-9-8' + }, + { + 'name': '秋分', + 'date': '2018-9-23' + }, + { + 'name': '寒露', + 'date': '2018-10-8' + }, + { + 'name': '霜降', + 'date': '2018-10-23' + }, + { + 'name': '立冬', + 'date': '2018-11-7' + }, + { + 'name': '小雪', + 'date': '2018-11-22' + }, + { + 'name': '大雪', + 'date': '2018-12-7' + }, + { + 'name': '冬至', + 'date': '2018-12-22' + }, + { + 'name': '小寒', + 'date': '2018-1-5' + }, + { + 'name': '大寒', + 'date': '2018-1-20' } ] } diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index 3a0115b48..5e86b4456 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -346,6 +346,16 @@ $basic-color: #4284f5 !default; top: -28px; right: -28px; color: #1da653; + + &--work { + display: inline-block; + width: 0; + font-size: 12px; + position: relative; + top: -28px; + right: -28px; + color: #f63; + } } &.prev, diff --git a/components/date-picker/toLunar.js b/components/date-picker/toLunar.js index 7d489ef70..47a7aecd4 100644 --- a/components/date-picker/toLunar.js +++ b/components/date-picker/toLunar.js @@ -165,7 +165,7 @@ const Lunar = { } m = (leapMonth !== 0 && t === leapMonth + 1) - ? ('闰'.this.chineseMonth(t - 1)) + ? this.chineseMonth(t - 1) : this.chineseMonth(((leapMonth !== 0 && leapMonth + 1 < t) ? (t - 1) : t)) } lunarArray.push(year, t, e) // 年 月 日 From dff2ef12b238546623c9ba59b4a2c622b17e053c Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Mon, 30 Dec 2019 09:43:22 +0800 Subject: [PATCH 003/115] feat: get 20 year holiday --- components/date-picker/Calender.js | 1 - components/date-picker/holidaylist.js | 2635 +++++++++++++++++++++++-- 2 files changed, 2496 insertions(+), 140 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index a922f0451..9883e08ee 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -165,7 +165,6 @@ class Calender extends Component { if (cls.indexOf('next') !== -1) { newDate = addMonths(newDate, 1) } - console.log('newDate', newDate) if (type === 'daterange' || type === 'weekrange') { if (range.selecting) { if (range.startDate > newDate) { diff --git a/components/date-picker/holidaylist.js b/components/date-picker/holidaylist.js index b1c4a45d8..7a5349040 100644 --- a/components/date-picker/holidaylist.js +++ b/components/date-picker/holidaylist.js @@ -1,171 +1,2533 @@ export default { - '2020': { + '2000': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2000-2-4' + }, + { + 'name': '雨水', + 'date': '2000-2-19' + }, + { + 'name': '惊蛰', + 'date': '2000-3-5' + }, + { + 'name': '春分', + 'date': '2000-3-20' + }, + { + 'name': '清明', + 'date': '2000-4-4' + }, + { + 'name': '谷雨', + 'date': '2000-4-20' + }, + { + 'name': '立夏', + 'date': '2000-5-5' + }, + { + 'name': '小满', + 'date': '2000-5-21' + }, + { + 'name': '芒种', + 'date': '2000-6-5' + }, + { + 'name': '夏至', + 'date': '2000-6-21' + }, + { + 'name': '小暑', + 'date': '2000-7-7' + }, + { + 'name': '大暑', + 'date': '2000-7-22' + }, + { + 'name': '立秋', + 'date': '2000-8-7' + }, + { + 'name': '处暑', + 'date': '2000-8-23' + }, + { + 'name': '白露', + 'date': '2000-9-7' + }, + { + 'name': '秋分', + 'date': '2000-9-23' + }, + { + 'name': '寒露', + 'date': '2000-10-8' + }, + { + 'name': '霜降', + 'date': '2000-10-23' + }, + { + 'name': '立冬', + 'date': '2000-11-7' + }, + { + 'name': '小雪', + 'date': '2000-11-22' + }, + { + 'name': '大雪', + 'date': '2000-12-7' + }, + { + 'name': '冬至', + 'date': '2000-12-21' + }, + { + 'name': '小寒', + 'date': '2000-1-6' + }, + { + 'name': '大寒', + 'date': '2000-1-21' + } + ] + }, + '2001': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2001-2-4' + }, + { + 'name': '雨水', + 'date': '2001-2-18' + }, + { + 'name': '惊蛰', + 'date': '2001-3-5' + }, + { + 'name': '春分', + 'date': '2001-3-20' + }, + { + 'name': '清明', + 'date': '2001-4-5' + }, + { + 'name': '谷雨', + 'date': '2001-4-20' + }, + { + 'name': '立夏', + 'date': '2001-5-5' + }, + { + 'name': '小满', + 'date': '2001-5-21' + }, + { + 'name': '芒种', + 'date': '2001-6-5' + }, + { + 'name': '夏至', + 'date': '2001-6-21' + }, + { + 'name': '小暑', + 'date': '2001-7-7' + }, + { + 'name': '大暑', + 'date': '2001-7-23' + }, + { + 'name': '立秋', + 'date': '2001-8-7' + }, + { + 'name': '处暑', + 'date': '2001-8-23' + }, + { + 'name': '白露', + 'date': '2001-9-7' + }, + { + 'name': '秋分', + 'date': '2001-9-23' + }, + { + 'name': '寒露', + 'date': '2001-10-8' + }, + { + 'name': '霜降', + 'date': '2001-10-23' + }, + { + 'name': '立冬', + 'date': '2001-11-7' + }, + { + 'name': '小雪', + 'date': '2001-11-22' + }, + { + 'name': '大雪', + 'date': '2001-12-7' + }, + { + 'name': '冬至', + 'date': '2001-12-22' + }, + { + 'name': '小寒', + 'date': '2001-1-5' + }, + { + 'name': '大寒', + 'date': '2001-1-20' + } + ] + }, + '2002': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2002-2-4' + }, + { + 'name': '雨水', + 'date': '2002-2-19' + }, + { + 'name': '惊蛰', + 'date': '2002-3-6' + }, + { + 'name': '春分', + 'date': '2002-3-21' + }, + { + 'name': '清明', + 'date': '2002-4-5' + }, + { + 'name': '谷雨', + 'date': '2002-4-20' + }, + { + 'name': '立夏', + 'date': '2002-5-6' + }, + { + 'name': '小满', + 'date': '2002-5-21' + }, + { + 'name': '芒种', + 'date': '2002-6-6' + }, + { + 'name': '夏至', + 'date': '2002-6-21' + }, + { + 'name': '小暑', + 'date': '2002-7-7' + }, + { + 'name': '大暑', + 'date': '2002-7-23' + }, + { + 'name': '立秋', + 'date': '2002-8-8' + }, + { + 'name': '处暑', + 'date': '2002-8-23' + }, + { + 'name': '白露', + 'date': '2002-9-8' + }, + { + 'name': '秋分', + 'date': '2002-9-23' + }, + { + 'name': '寒露', + 'date': '2002-10-8' + }, + { + 'name': '霜降', + 'date': '2002-10-23' + }, + { + 'name': '立冬', + 'date': '2002-11-7' + }, + { + 'name': '小雪', + 'date': '2002-11-22' + }, + { + 'name': '大雪', + 'date': '2002-12-7' + }, + { + 'name': '冬至', + 'date': '2002-12-22' + }, + { + 'name': '小寒', + 'date': '2002-1-5' + }, + { + 'name': '大寒', + 'date': '2002-1-20' + } + ] + }, + '2003': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2003-2-4' + }, + { + 'name': '雨水', + 'date': '2003-2-19' + }, + { + 'name': '惊蛰', + 'date': '2003-3-6' + }, + { + 'name': '春分', + 'date': '2003-3-21' + }, + { + 'name': '清明', + 'date': '2003-4-5' + }, + { + 'name': '谷雨', + 'date': '2003-4-20' + }, + { + 'name': '立夏', + 'date': '2003-5-6' + }, + { + 'name': '小满', + 'date': '2003-5-21' + }, + { + 'name': '芒种', + 'date': '2003-6-6' + }, + { + 'name': '夏至', + 'date': '2003-6-22' + }, + { + 'name': '小暑', + 'date': '2003-7-7' + }, + { + 'name': '大暑', + 'date': '2003-7-23' + }, + { + 'name': '立秋', + 'date': '2003-8-8' + }, + { + 'name': '处暑', + 'date': '2003-8-23' + }, + { + 'name': '白露', + 'date': '2003-9-8' + }, + { + 'name': '秋分', + 'date': '2003-9-23' + }, + { + 'name': '寒露', + 'date': '2003-10-9' + }, + { + 'name': '霜降', + 'date': '2003-10-24' + }, + { + 'name': '立冬', + 'date': '2003-11-8' + }, + { + 'name': '小雪', + 'date': '2003-11-23' + }, + { + 'name': '大雪', + 'date': '2003-12-7' + }, + { + 'name': '冬至', + 'date': '2003-12-22' + }, + { + 'name': '小寒', + 'date': '2003-1-6' + }, + { + 'name': '大寒', + 'date': '2003-1-20' + } + ] + }, + '2004': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2004-2-4' + }, + { + 'name': '雨水', + 'date': '2004-2-19' + }, + { + 'name': '惊蛰', + 'date': '2004-3-5' + }, + { + 'name': '春分', + 'date': '2004-3-20' + }, + { + 'name': '清明', + 'date': '2004-4-4' + }, + { + 'name': '谷雨', + 'date': '2004-4-20' + }, + { + 'name': '立夏', + 'date': '2004-5-5' + }, + { + 'name': '小满', + 'date': '2004-5-21' + }, + { + 'name': '芒种', + 'date': '2004-6-5' + }, + { + 'name': '夏至', + 'date': '2004-6-21' + }, + { + 'name': '小暑', + 'date': '2004-7-7' + }, + { + 'name': '大暑', + 'date': '2004-7-22' + }, + { + 'name': '立秋', + 'date': '2004-8-7' + }, + { + 'name': '处暑', + 'date': '2004-8-23' + }, + { + 'name': '白露', + 'date': '2004-9-7' + }, + { + 'name': '秋分', + 'date': '2004-9-23' + }, + { + 'name': '寒露', + 'date': '2004-10-8' + }, + { + 'name': '霜降', + 'date': '2004-10-23' + }, + { + 'name': '立冬', + 'date': '2004-11-7' + }, + { + 'name': '小雪', + 'date': '2004-11-22' + }, + { + 'name': '大雪', + 'date': '2004-12-7' + }, + { + 'name': '冬至', + 'date': '2004-12-21' + }, + { + 'name': '小寒', + 'date': '2004-1-6' + }, + { + 'name': '大寒', + 'date': '2004-1-21' + } + ] + }, + '2005': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2005-2-4' + }, + { + 'name': '雨水', + 'date': '2005-2-18' + }, + { + 'name': '惊蛰', + 'date': '2005-3-5' + }, + { + 'name': '春分', + 'date': '2005-3-20' + }, + { + 'name': '清明', + 'date': '2005-4-5' + }, + { + 'name': '谷雨', + 'date': '2005-4-20' + }, + { + 'name': '立夏', + 'date': '2005-5-5' + }, + { + 'name': '小满', + 'date': '2005-5-21' + }, + { + 'name': '芒种', + 'date': '2005-6-5' + }, + { + 'name': '夏至', + 'date': '2005-6-21' + }, + { + 'name': '小暑', + 'date': '2005-7-7' + }, + { + 'name': '大暑', + 'date': '2005-7-23' + }, + { + 'name': '立秋', + 'date': '2005-8-7' + }, + { + 'name': '处暑', + 'date': '2005-8-23' + }, + { + 'name': '白露', + 'date': '2005-9-7' + }, + { + 'name': '秋分', + 'date': '2005-9-23' + }, + { + 'name': '寒露', + 'date': '2005-10-8' + }, + { + 'name': '霜降', + 'date': '2005-10-23' + }, + { + 'name': '立冬', + 'date': '2005-11-7' + }, + { + 'name': '小雪', + 'date': '2005-11-22' + }, + { + 'name': '大雪', + 'date': '2005-12-7' + }, + { + 'name': '冬至', + 'date': '2005-12-22' + }, + { + 'name': '小寒', + 'date': '2005-1-5' + }, + { + 'name': '大寒', + 'date': '2005-1-20' + } + ] + }, + '2006': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2006-2-4' + }, + { + 'name': '雨水', + 'date': '2006-2-19' + }, + { + 'name': '惊蛰', + 'date': '2006-3-6' + }, + { + 'name': '春分', + 'date': '2006-3-21' + }, + { + 'name': '清明', + 'date': '2006-4-5' + }, + { + 'name': '谷雨', + 'date': '2006-4-20' + }, + { + 'name': '立夏', + 'date': '2006-5-5' + }, + { + 'name': '小满', + 'date': '2006-5-21' + }, + { + 'name': '芒种', + 'date': '2006-6-6' + }, + { + 'name': '夏至', + 'date': '2006-6-21' + }, + { + 'name': '小暑', + 'date': '2006-7-7' + }, + { + 'name': '大暑', + 'date': '2006-7-23' + }, + { + 'name': '立秋', + 'date': '2006-8-7' + }, + { + 'name': '处暑', + 'date': '2006-8-23' + }, + { + 'name': '白露', + 'date': '2006-9-8' + }, + { + 'name': '秋分', + 'date': '2006-9-23' + }, + { + 'name': '寒露', + 'date': '2006-10-8' + }, + { + 'name': '霜降', + 'date': '2006-10-23' + }, + { + 'name': '立冬', + 'date': '2006-11-7' + }, + { + 'name': '小雪', + 'date': '2006-11-22' + }, + { + 'name': '大雪', + 'date': '2006-12-7' + }, + { + 'name': '冬至', + 'date': '2006-12-22' + }, + { + 'name': '小寒', + 'date': '2006-1-5' + }, + { + 'name': '大寒', + 'date': '2006-1-20' + } + ] + }, + '2007': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2007-2-4' + }, + { + 'name': '雨水', + 'date': '2007-2-19' + }, + { + 'name': '惊蛰', + 'date': '2007-3-6' + }, + { + 'name': '春分', + 'date': '2007-3-21' + }, + { + 'name': '清明', + 'date': '2007-4-5' + }, + { + 'name': '谷雨', + 'date': '2007-4-20' + }, + { + 'name': '立夏', + 'date': '2007-5-6' + }, + { + 'name': '小满', + 'date': '2007-5-21' + }, + { + 'name': '芒种', + 'date': '2007-6-6' + }, + { + 'name': '夏至', + 'date': '2007-6-22' + }, + { + 'name': '小暑', + 'date': '2007-7-7' + }, + { + 'name': '大暑', + 'date': '2007-7-23' + }, + { + 'name': '立秋', + 'date': '2007-8-8' + }, + { + 'name': '处暑', + 'date': '2007-8-23' + }, + { + 'name': '白露', + 'date': '2007-9-8' + }, + { + 'name': '秋分', + 'date': '2007-9-23' + }, + { + 'name': '寒露', + 'date': '2007-10-9' + }, + { + 'name': '霜降', + 'date': '2007-10-24' + }, + { + 'name': '立冬', + 'date': '2007-11-8' + }, + { + 'name': '小雪', + 'date': '2007-11-23' + }, + { + 'name': '大雪', + 'date': '2007-12-7' + }, + { + 'name': '冬至', + 'date': '2007-12-22' + }, + { + 'name': '小寒', + 'date': '2007-1-6' + }, + { + 'name': '大寒', + 'date': '2007-1-20' + } + ] + }, + '2008': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2008-2-4' + }, + { + 'name': '雨水', + 'date': '2008-2-19' + }, + { + 'name': '惊蛰', + 'date': '2008-3-5' + }, + { + 'name': '春分', + 'date': '2008-3-20' + }, + { + 'name': '清明', + 'date': '2008-4-4' + }, + { + 'name': '谷雨', + 'date': '2008-4-20' + }, + { + 'name': '立夏', + 'date': '2008-5-5' + }, + { + 'name': '小满', + 'date': '2008-5-21' + }, + { + 'name': '芒种', + 'date': '2008-6-5' + }, + { + 'name': '夏至', + 'date': '2008-6-21' + }, + { + 'name': '小暑', + 'date': '2008-7-7' + }, + { + 'name': '大暑', + 'date': '2008-7-22' + }, + { + 'name': '立秋', + 'date': '2008-8-7' + }, + { + 'name': '处暑', + 'date': '2008-8-23' + }, + { + 'name': '白露', + 'date': '2008-9-7' + }, + { + 'name': '秋分', + 'date': '2008-9-22' + }, + { + 'name': '寒露', + 'date': '2008-10-8' + }, + { + 'name': '霜降', + 'date': '2008-10-23' + }, + { + 'name': '立冬', + 'date': '2008-11-7' + }, + { + 'name': '小雪', + 'date': '2008-11-22' + }, + { + 'name': '大雪', + 'date': '2008-12-7' + }, + { + 'name': '冬至', + 'date': '2008-12-21' + }, + { + 'name': '小寒', + 'date': '2008-1-6' + }, + { + 'name': '大寒', + 'date': '2008-1-21' + } + ] + }, + '2009': { + 'holiday': {}, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2009-2-4' + }, + { + 'name': '雨水', + 'date': '2009-2-18' + }, + { + 'name': '惊蛰', + 'date': '2009-3-5' + }, + { + 'name': '春分', + 'date': '2009-3-20' + }, + { + 'name': '清明', + 'date': '2009-4-4' + }, + { + 'name': '谷雨', + 'date': '2009-4-20' + }, + { + 'name': '立夏', + 'date': '2009-5-5' + }, + { + 'name': '小满', + 'date': '2009-5-21' + }, + { + 'name': '芒种', + 'date': '2009-6-5' + }, + { + 'name': '夏至', + 'date': '2009-6-21' + }, + { + 'name': '小暑', + 'date': '2009-7-7' + }, + { + 'name': '大暑', + 'date': '2009-7-23' + }, + { + 'name': '立秋', + 'date': '2009-8-7' + }, + { + 'name': '处暑', + 'date': '2009-8-23' + }, + { + 'name': '白露', + 'date': '2009-9-7' + }, + { + 'name': '秋分', + 'date': '2009-9-23' + }, + { + 'name': '寒露', + 'date': '2009-10-8' + }, + { + 'name': '霜降', + 'date': '2009-10-23' + }, + { + 'name': '立冬', + 'date': '2009-11-7' + }, + { + 'name': '小雪', + 'date': '2009-11-22' + }, + { + 'name': '大雪', + 'date': '2009-12-7' + }, + { + 'name': '冬至', + 'date': '2009-12-22' + }, + { + 'name': '小寒', + 'date': '2009-1-5' + }, + { + 'name': '大寒', + 'date': '2009-1-20' + } + ] + }, + '2010': { + 'holiday': { + '2011-1-1': '1', + '2011-1-2': '1', + '2011-1-3': '1' + }, + 'solarTerms': [ + { + 'name': '立春', + 'date': '2010-2-4' + }, + { + 'name': '雨水', + 'date': '2010-2-19' + }, + { + 'name': '惊蛰', + 'date': '2010-3-6' + }, + { + 'name': '春分', + 'date': '2010-3-21' + }, + { + 'name': '清明', + 'date': '2010-4-5' + }, + { + 'name': '谷雨', + 'date': '2010-4-20' + }, + { + 'name': '立夏', + 'date': '2010-5-5' + }, + { + 'name': '小满', + 'date': '2010-5-21' + }, + { + 'name': '芒种', + 'date': '2010-6-6' + }, + { + 'name': '夏至', + 'date': '2010-6-21' + }, + { + 'name': '小暑', + 'date': '2010-7-7' + }, + { + 'name': '大暑', + 'date': '2010-7-23' + }, + { + 'name': '立秋', + 'date': '2010-8-7' + }, + { + 'name': '处暑', + 'date': '2010-8-23' + }, + { + 'name': '白露', + 'date': '2010-9-8' + }, + { + 'name': '秋分', + 'date': '2010-9-23' + }, + { + 'name': '寒露', + 'date': '2010-10-8' + }, + { + 'name': '霜降', + 'date': '2010-10-23' + }, + { + 'name': '立冬', + 'date': '2010-11-7' + }, + { + 'name': '小雪', + 'date': '2010-11-22' + }, + { + 'name': '大雪', + 'date': '2010-12-7' + }, + { + 'name': '冬至', + 'date': '2010-12-22' + }, + { + 'name': '小寒', + 'date': '2010-1-5' + }, + { + 'name': '大寒', + 'date': '2010-1-20' + } + ] + }, + '2011': { + 'holiday': { + '2011-1-1': '1', + '2011-1-2': '1', + '2011-1-3': '1', + '2011-1-30': '2', + '2011-2-2': '1', + '2011-2-3': '1', + '2011-2-4': '1', + '2011-2-5': '1', + '2011-2-6': '1', + '2011-2-7': '1', + '2011-2-8': '1', + '2011-2-12': '2', + '2011-4-2': '2', + '2011-4-3': '1', + '2011-4-4': '1', + '2011-4-5': '1', + '2011-4-30': '1', + '2011-5-1': '1', + '2011-5-2': '1', + '2011-6-4': '1', + '2011-6-5': '1', + '2011-6-6': '1', + '2011-9-10': '1', + '2011-9-11': '1', + '2011-9-12': '1', + '2011-10-1': '1', + '2011-10-2': '1', + '2011-10-3': '1', + '2011-10-4': '1', + '2011-10-5': '1', + '2011-10-6': '1', + '2011-10-7': '1', + '2011-10-8': '2', + '2011-10-9': '2', + '2012-1-1': '1', + '2012-1-2': '1', + '2012-1-3': '1', + '2011-12-31': '2', + '2012-1-21': '2', + '2012-1-22': '1', + '2012-1-23': '1', + '2012-1-24': '1', + '2012-1-25': '1', + '2012-1-26': '1', + '2012-1-27': '1', + '2012-1-28': '1', + '2012-1-29': '2' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2011-1-1' + }, + { + 'name': '春节', + 'startday': '2011-1-30' + }, + { + 'name': '清明节', + 'startday': '2011-4-2' + }, + { + 'name': '劳动节', + 'startday': '2011-4-30' + }, + { + 'name': '端午节', + 'startday': '2011-6-4' + }, + { + 'name': '中秋节', + 'startday': '2011-9-10' + }, + { + 'name': '国庆节', + 'startday': '2011-10-1' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2011-2-4' + }, + { + 'name': '雨水', + 'date': '2011-2-19' + }, + { + 'name': '惊蛰', + 'date': '2011-3-6' + }, + { + 'name': '春分', + 'date': '2011-3-21' + }, + { + 'name': '清明', + 'date': '2011-4-5' + }, + { + 'name': '谷雨', + 'date': '2011-4-20' + }, + { + 'name': '立夏', + 'date': '2011-5-6' + }, + { + 'name': '小满', + 'date': '2011-5-21' + }, + { + 'name': '芒种', + 'date': '2011-6-6' + }, + { + 'name': '夏至', + 'date': '2011-6-22' + }, + { + 'name': '小暑', + 'date': '2011-7-7' + }, + { + 'name': '大暑', + 'date': '2011-7-23' + }, + { + 'name': '立秋', + 'date': '2011-8-8' + }, + { + 'name': '处暑', + 'date': '2011-8-23' + }, + { + 'name': '白露', + 'date': '2011-9-8' + }, + { + 'name': '秋分', + 'date': '2011-9-23' + }, + { + 'name': '寒露', + 'date': '2011-10-8' + }, + { + 'name': '霜降', + 'date': '2011-10-24' + }, + { + 'name': '立冬', + 'date': '2011-11-8' + }, + { + 'name': '小雪', + 'date': '2011-11-23' + }, + { + 'name': '大雪', + 'date': '2011-12-7' + }, + { + 'name': '冬至', + 'date': '2011-12-22' + }, + { + 'name': '小寒', + 'date': '2011-1-6' + }, + { + 'name': '大寒', + 'date': '2011-1-20' + } + ] + }, + '2012': { + 'holiday': { + '2012-1-1': '1', + '2012-1-2': '1', + '2012-1-3': '1', + '2011-12-31': '2', + '2012-1-21': '2', + '2012-1-22': '1', + '2012-1-23': '1', + '2012-1-24': '1', + '2012-1-25': '1', + '2012-1-26': '1', + '2012-1-27': '1', + '2012-1-28': '1', + '2012-1-29': '2', + '2012-3-31': '2', + '2012-4-1': '2', + '2012-4-2': '1', + '2012-4-3': '1', + '2012-4-4': '1', + '2012-4-28': '2', + '2012-4-29': '1', + '2012-4-30': '1', + '2012-5-1': '1', + '2012-5-2': '2', + '2012-6-22': '1', + '2012-6-23': '1', + '2012-6-24': '1', + '2012-9-29': '2', + '2012-9-30': '1', + '2012-10-1': '1', + '2012-10-2': '1', + '2012-10-3': '1', + '2012-10-4': '1', + '2012-10-5': '1', + '2012-10-6': '1', + '2012-10-7': '1', + '2012-10-8': '2', + '2013-1-1': '1', + '2013-1-2': '1', + '2013-1-3': '1', + '2013-1-5': '2', + '2013-1-6': '2' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2012-1-1' + }, + { + 'name': '春节', + 'startday': '2012-1-21' + }, + { + 'name': '清明节', + 'startday': '2012-3-31' + }, + { + 'name': '劳动节', + 'startday': '2012-4-28' + }, + { + 'name': '端午节', + 'startday': '2012-6-22' + }, + { + 'name': '中秋节', + 'startday': '2012-9-29' + }, + { + 'name': '国庆节', + 'startday': '2012-9-29' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2012-2-4' + }, + { + 'name': '雨水', + 'date': '2012-2-19' + }, + { + 'name': '惊蛰', + 'date': '2012-3-5' + }, + { + 'name': '春分', + 'date': '2012-3-20' + }, + { + 'name': '清明', + 'date': '2012-4-4' + }, + { + 'name': '谷雨', + 'date': '2012-4-20' + }, + { + 'name': '立夏', + 'date': '2012-5-5' + }, + { + 'name': '小满', + 'date': '2012-5-20' + }, + { + 'name': '芒种', + 'date': '2012-6-5' + }, + { + 'name': '夏至', + 'date': '2012-6-21' + }, + { + 'name': '小暑', + 'date': '2012-7-7' + }, + { + 'name': '大暑', + 'date': '2012-7-22' + }, + { + 'name': '立秋', + 'date': '2012-8-7' + }, + { + 'name': '处暑', + 'date': '2012-8-23' + }, + { + 'name': '白露', + 'date': '2012-9-7' + }, + { + 'name': '秋分', + 'date': '2012-9-22' + }, + { + 'name': '寒露', + 'date': '2012-10-8' + }, + { + 'name': '霜降', + 'date': '2012-10-23' + }, + { + 'name': '立冬', + 'date': '2012-11-7' + }, + { + 'name': '小雪', + 'date': '2012-11-22' + }, + { + 'name': '大雪', + 'date': '2012-12-7' + }, + { + 'name': '冬至', + 'date': '2012-12-21' + }, + { + 'name': '小寒', + 'date': '2012-1-6' + }, + { + 'name': '大寒', + 'date': '2012-1-21' + } + ] + }, + '2013': { + 'holiday': { + '2013-1-1': '1', + '2013-1-2': '1', + '2013-1-3': '1', + '2013-1-5': '2', + '2013-1-6': '2', + '2013-2-9': '1', + '2013-2-10': '1', + '2013-2-11': '1', + '2013-2-12': '1', + '2013-2-13': '1', + '2013-2-14': '1', + '2013-2-15': '1', + '2013-2-16': '2', + '2013-2-17': '2', + '2013-4-4': '1', + '2013-4-5': '1', + '2013-4-6': '1', + '2013-4-7': '2', + '2013-4-29': '1', + '2013-4-30': '1', + '2013-5-1': '1', + '2013-4-27': '2', + '2013-4-28': '2', + '2013-6-8': '2', + '2013-6-9': '2', + '2013-6-10': '1', + '2013-6-11': '1', + '2013-6-12': '1', + '2013-9-19': '1', + '2013-9-20': '1', + '2013-9-21': '1', + '2013-9-22': '2', + '2013-9-29': '2', + '2013-10-1': '1', + '2013-10-2': '1', + '2013-10-3': '1', + '2013-10-4': '1', + '2013-10-5': '1', + '2013-10-6': '1', + '2013-10-7': '1', + '2013-10-12': '2', + '2014-1-1': '1', + '2014-01-30': '0', + '2014-1-26': '2', + '2014-1-31': '1', + '2014-2-1': '1', + '2014-2-2': '1', + '2014-2-3': '1', + '2014-2-4': '1', + '2014-2-5': '1', + '2014-2-6': '1', + '2014-2-8': '2' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2013-1-1' + }, + { + 'name': '春节', + 'startday': '2013-2-10' + }, + { + 'name': '清明节', + 'startday': '2013-4-4' + }, + { + 'name': '劳动节', + 'startday': '2013-4-29' + }, + { + 'name': '端午节', + 'startday': '2013-6-8' + }, + { + 'name': '中秋节', + 'startday': '2013-9-19' + }, + { + 'name': '国庆节', + 'startday': '2013-9-29' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2013-2-4' + }, + { + 'name': '雨水', + 'date': '2013-2-18' + }, + { + 'name': '惊蛰', + 'date': '2013-3-5' + }, + { + 'name': '春分', + 'date': '2013-3-20' + }, + { + 'name': '清明', + 'date': '2013-4-4' + }, + { + 'name': '谷雨', + 'date': '2013-4-20' + }, + { + 'name': '立夏', + 'date': '2013-5-5' + }, + { + 'name': '小满', + 'date': '2013-5-21' + }, + { + 'name': '芒种', + 'date': '2013-6-5' + }, + { + 'name': '夏至', + 'date': '2013-6-21' + }, + { + 'name': '小暑', + 'date': '2013-7-7' + }, + { + 'name': '大暑', + 'date': '2013-7-22' + }, + { + 'name': '立秋', + 'date': '2013-8-7' + }, + { + 'name': '处暑', + 'date': '2013-8-23' + }, + { + 'name': '白露', + 'date': '2013-9-7' + }, + { + 'name': '秋分', + 'date': '2013-9-23' + }, + { + 'name': '寒露', + 'date': '2013-10-8' + }, + { + 'name': '霜降', + 'date': '2013-10-23' + }, + { + 'name': '立冬', + 'date': '2013-11-7' + }, + { + 'name': '小雪', + 'date': '2013-11-22' + }, + { + 'name': '大雪', + 'date': '2013-12-7' + }, + { + 'name': '冬至', + 'date': '2013-12-22' + }, + { + 'name': '小寒', + 'date': '2013-1-5' + }, + { + 'name': '大寒', + 'date': '2013-1-20' + } + ] + }, + '2014': { + 'holiday': { + '2014-1-1': '1', + '2014-01-30': '0', + '2014-1-26': '2', + '2014-1-31': '1', + '2014-2-1': '1', + '2014-2-2': '1', + '2014-2-3': '1', + '2014-2-4': '1', + '2014-2-5': '1', + '2014-2-6': '1', + '2014-2-8': '2', + '2014-4-5': '1', + '2014-4-6': '1', + '2014-4-7': '1', + '2014-5-1': '1', + '2014-5-2': '1', + '2014-5-3': '1', + '2014-5-4': '2', + '2014-5-31': '1', + '2014-6-1': '1', + '2014-6-2': '1', + '2014-9-6': '1', + '2014-9-7': '1', + '2014-9-8': '1', + '2014-10-1': '1', + '2014-10-2': '1', + '2014-10-3': '1', + '2014-10-4': '1', + '2014-10-5': '1', + '2014-10-6': '1', + '2014-10-7': '1', + '2014-9-28': '2', + '2014-10-11': '2', + '2015-1-1': '1', + '2015-1-2': '1', + '2015-1-3': '1', + '2015-1-4': '2' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2014-1-1' + }, + { + 'name': '除夕', + 'startday': '2014-01-30' + }, + { + 'name': '春节', + 'startday': '2014-1-31' + }, + { + 'name': '清明节', + 'startday': '2014-4-5' + }, + { + 'name': '劳动节', + 'startday': '2014-5-1' + }, + { + 'name': '端午节', + 'startday': '2014-6-2' + }, + { + 'name': '中秋节', + 'startday': '2014-9-8' + }, + { + 'name': '国庆节', + 'startday': '2014-10-7' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2014-2-4' + }, + { + 'name': '雨水', + 'date': '2014-2-19' + }, + { + 'name': '惊蛰', + 'date': '2014-3-6' + }, + { + 'name': '春分', + 'date': '2014-3-21' + }, + { + 'name': '清明', + 'date': '2014-4-5' + }, + { + 'name': '谷雨', + 'date': '2014-4-20' + }, + { + 'name': '立夏', + 'date': '2014-5-5' + }, + { + 'name': '小满', + 'date': '2014-5-21' + }, + { + 'name': '芒种', + 'date': '2014-6-6' + }, + { + 'name': '夏至', + 'date': '2014-6-21' + }, + { + 'name': '小暑', + 'date': '2014-7-7' + }, + { + 'name': '大暑', + 'date': '2014-7-23' + }, + { + 'name': '立秋', + 'date': '2014-8-7' + }, + { + 'name': '处暑', + 'date': '2014-8-23' + }, + { + 'name': '白露', + 'date': '2014-9-8' + }, + { + 'name': '秋分', + 'date': '2014-9-23' + }, + { + 'name': '寒露', + 'date': '2014-10-8' + }, + { + 'name': '霜降', + 'date': '2014-10-23' + }, + { + 'name': '立冬', + 'date': '2014-11-7' + }, + { + 'name': '小雪', + 'date': '2014-11-22' + }, + { + 'name': '大雪', + 'date': '2014-12-7' + }, + { + 'name': '冬至', + 'date': '2014-12-22' + }, + { + 'name': '小寒', + 'date': '2014-1-5' + }, + { + 'name': '大寒', + 'date': '2014-1-20' + } + ] + }, + '2015': { + 'holiday': { + '2015-1-1': '1', + '2015-1-2': '1', + '2015-1-3': '1', + '2015-1-4': '2', + '2015-2-18': '1', + '2015-2-15': '2', + '2015-2-19': '1', + '2015-2-20': '1', + '2015-2-21': '1', + '2015-2-22': '1', + '2015-2-23': '1', + '2015-2-24': '1', + '2015-2-28': '2', + '2015-4-4': '1', + '2015-4-5': '1', + '2015-4-6': '1', + '2015-5-1': '1', + '2015-5-2': '1', + '2015-5-3': '1', + '2015-6-20': '1', + '2015-6-21': '1', + '2015-6-22': '1', + '2015-9-3': '1', + '2015-9-4': '1', + '2015-9-5': '1', + '2015-9-6': '2', + '2015-9-26': '1', + '2015-9-27': '1', + '2015-10-1': '1', + '2015-10-2': '1', + '2015-10-3': '1', + '2015-10-4': '1', + '2015-10-5': '1', + '2015-10-6': '1', + '2015-10-7': '1', + '2015-10-10': '2', + '2016-1-1': '1', + '2016-1-2': '1', + '2016-1-3': '1' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2015-1-1' + }, + { + 'name': '除夕', + 'startday': '2015-2-18' + }, + { + 'name': '春节', + 'startday': '2015-2-19' + }, + { + 'name': '清明节', + 'startday': '2015-4-5' + }, + { + 'name': '劳动节', + 'startday': '2015-5-1' + }, + { + 'name': '端午节', + 'startday': '2015-6-20' + }, + { + 'name': '胜利日', + 'startday': '2015-9-3' + }, + { + 'name': '中秋节', + 'startday': '2015-9-27' + }, + { + 'name': '国庆节', + 'startday': '2015-10-1' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2015-2-4' + }, + { + 'name': '雨水', + 'date': '2015-2-19' + }, + { + 'name': '惊蛰', + 'date': '2015-3-6' + }, + { + 'name': '春分', + 'date': '2015-3-21' + }, + { + 'name': '清明', + 'date': '2015-4-5' + }, + { + 'name': '谷雨', + 'date': '2015-4-20' + }, + { + 'name': '立夏', + 'date': '2015-5-6' + }, + { + 'name': '小满', + 'date': '2015-5-21' + }, + { + 'name': '芒种', + 'date': '2015-6-6' + }, + { + 'name': '夏至', + 'date': '2015-6-22' + }, + { + 'name': '小暑', + 'date': '2015-7-7' + }, + { + 'name': '大暑', + 'date': '2015-7-23' + }, + { + 'name': '立秋', + 'date': '2015-8-8' + }, + { + 'name': '处暑', + 'date': '2015-8-23' + }, + { + 'name': '白露', + 'date': '2015-9-8' + }, + { + 'name': '秋分', + 'date': '2015-9-23' + }, + { + 'name': '寒露', + 'date': '2015-10-8' + }, + { + 'name': '霜降', + 'date': '2015-10-24' + }, + { + 'name': '立冬', + 'date': '2015-11-8' + }, + { + 'name': '小雪', + 'date': '2015-11-22' + }, + { + 'name': '大雪', + 'date': '2015-12-7' + }, + { + 'name': '冬至', + 'date': '2015-12-22' + }, + { + 'name': '小寒', + 'date': '2015-1-6' + }, + { + 'name': '大寒', + 'date': '2015-1-20' + } + ] + }, + '2016': { 'holiday': { - '2020-1-1': '1', - '2020-1-24': '1', - '2020-1-25': '1', - '2020-1-26': '1', - '2020-1-27': '1', - '2020-1-28': '1', - '2020-1-29': '1', - '2020-1-30': '1', - '2020-1-19': '2', - '2020-2-1': '2', - '2020-4-4': '1', - '2020-4-5': '1', - '2020-4-6': '1', - '2020-5-1': '1', - '2020-5-2': '1', - '2020-5-3': '1', - '2020-5-4': '1', - '2020-5-5': '1', - '2020-4-26': '2', - '2020-5-9': '2', - '2020-6-25': '1', - '2020-6-26': '1', - '2020-6-27': '1', - '2020-6-28': '2', - '2020-10-1': '1', - '2020-10-2': '1', - '2020-10-3': '1', - '2020-10-4': '1', - '2020-10-5': '1', - '2020-10-6': '1', - '2020-10-7': '1', - '2020-10-8': '1', - '2020-9-27': '2', - '2020-10-10': '2' + '2016-1-1': '1', + '2016-1-2': '1', + '2016-1-3': '1', + '2016-2-7': '1', + '2016-2-6': '2', + '2016-2-8': '1', + '2016-2-9': '1', + '2016-2-10': '1', + '2016-2-11': '1', + '2016-2-12': '1', + '2016-2-13': '1', + '2016-2-14': '2', + '2016-4-2': '1', + '2016-4-3': '1', + '2016-4-4': '1', + '2016-4-30': '1', + '2016-5-1': '1', + '2016-5-2': '1', + '2016-6-9': '1', + '2016-6-10': '1', + '2016-6-11': '1', + '2016-6-12': '2', + '2016-9-15': '1', + '2016-9-16': '1', + '2016-9-17': '1', + '2016-9-18': '2', + '2016-10-1': '1', + '2016-10-2': '1', + '2016-10-3': '1', + '2016-10-4': '1', + '2016-10-5': '1', + '2016-10-6': '1', + '2016-10-7': '1', + '2016-10-8': '2', + '2016-10-9': '2', + '2016-12-31': '1', + '2017-1-1': '1', + '2017-1-2': '1', + '2017-1-27': '1', + '2017-1-22': '2', + '2017-1-28': '1', + '2017-1-29': '1', + '2017-1-30': '1', + '2017-1-31': '1', + '2017-2-1': '1', + '2017-2-2': '1', + '2017-2-4': '2' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2016-1-1' + }, + { + 'name': '除夕', + 'startday': '2016-2-7' + }, + { + 'name': '春节', + 'startday': '2016-2-7' + }, + { + 'name': '清明节', + 'startday': '2016-4-4' + }, + { + 'name': '劳动节', + 'startday': '2016-5-1' + }, + { + 'name': '端午节', + 'startday': '2016-6-9' + }, + { + 'name': '中秋节', + 'startday': '2016-9-15' + }, + { + 'name': '国庆节', + 'startday': '2016-10-1' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2016-2-4' + }, + { + 'name': '雨水', + 'date': '2016-2-19' + }, + { + 'name': '惊蛰', + 'date': '2016-3-5' + }, + { + 'name': '春分', + 'date': '2016-3-20' + }, + { + 'name': '清明', + 'date': '2016-4-4' + }, + { + 'name': '谷雨', + 'date': '2016-4-19' + }, + { + 'name': '立夏', + 'date': '2016-5-5' + }, + { + 'name': '小满', + 'date': '2016-5-20' + }, + { + 'name': '芒种', + 'date': '2016-6-5' + }, + { + 'name': '夏至', + 'date': '2016-6-21' + }, + { + 'name': '小暑', + 'date': '2016-7-7' + }, + { + 'name': '大暑', + 'date': '2016-7-22' + }, + { + 'name': '立秋', + 'date': '2016-8-7' + }, + { + 'name': '处暑', + 'date': '2016-8-23' + }, + { + 'name': '白露', + 'date': '2016-9-7' + }, + { + 'name': '秋分', + 'date': '2016-9-22' + }, + { + 'name': '寒露', + 'date': '2016-10-8' + }, + { + 'name': '霜降', + 'date': '2016-10-23' + }, + { + 'name': '立冬', + 'date': '2016-11-7' + }, + { + 'name': '小雪', + 'date': '2016-11-22' + }, + { + 'name': '大雪', + 'date': '2016-12-7' + }, + { + 'name': '冬至', + 'date': '2016-12-21' + }, + { + 'name': '小寒', + 'date': '2016-1-6' + }, + { + 'name': '大寒', + 'date': '2016-1-20' + } + ] + }, + '2017': { + 'holiday': { + '2016-12-31': '1', + '2017-1-1': '1', + '2017-1-2': '1', + '2017-1-27': '1', + '2017-1-22': '2', + '2017-1-28': '1', + '2017-1-29': '1', + '2017-1-30': '1', + '2017-1-31': '1', + '2017-2-1': '1', + '2017-2-2': '1', + '2017-2-4': '2', + '2017-4-1': '2', + '2017-4-2': '1', + '2017-4-3': '1', + '2017-4-4': '1', + '2017-4-29': '1', + '2017-4-30': '1', + '2017-5-1': '1', + '2017-5-27': '2', + '2017-5-28': '1', + '2017-5-29': '1', + '2017-5-30': '1', + '2017-9-30': '2', + '2017-10-1': '1', + '2017-10-2': '1', + '2017-10-3': '1', + '2017-10-4': '1', + '2017-10-5': '1', + '2017-10-6': '1', + '2017-10-7': '1', + '2017-10-8': '1', + '2017-12-30': '1', + '2017-12-31': '1', + '2018-1-1': '1' + }, + 'holidaylist': [ + { + 'name': '元旦', + 'startday': '2017-1-1' + }, + { + 'name': '除夕', + 'startday': '2017-1-27' + }, + { + 'name': '春节', + 'startday': '2017-1-28' + }, + { + 'name': '清明节', + 'startday': '2017-4-4' + }, + { + 'name': '劳动节', + 'startday': '2017-5-1' + }, + { + 'name': '端午节', + 'startday': '2017-5-30' + }, + { + 'name': '国庆节', + 'startday': '2017-10-1' + }, + { + 'name': '中秋节', + 'startday': '2017-10-4' + } + ], + 'solarTerms': [ + { + 'name': '立春', + 'date': '2017-2-3' + }, + { + 'name': '雨水', + 'date': '2017-2-18' + }, + { + 'name': '惊蛰', + 'date': '2017-3-5' + }, + { + 'name': '春分', + 'date': '2017-3-20' + }, + { + 'name': '清明', + 'date': '2017-4-4' + }, + { + 'name': '谷雨', + 'date': '2017-4-20' + }, + { + 'name': '立夏', + 'date': '2017-5-5' + }, + { + 'name': '小满', + 'date': '2017-5-21' + }, + { + 'name': '芒种', + 'date': '2017-6-5' + }, + { + 'name': '夏至', + 'date': '2017-6-21' + }, + { + 'name': '小暑', + 'date': '2017-7-7' + }, + { + 'name': '大暑', + 'date': '2017-7-22' + }, + { + 'name': '立秋', + 'date': '2017-8-7' + }, + { + 'name': '处暑', + 'date': '2017-8-23' + }, + { + 'name': '白露', + 'date': '2017-9-7' + }, + { + 'name': '秋分', + 'date': '2017-9-23' + }, + { + 'name': '寒露', + 'date': '2017-10-8' + }, + { + 'name': '霜降', + 'date': '2017-10-23' + }, + { + 'name': '立冬', + 'date': '2017-11-7' + }, + { + 'name': '小雪', + 'date': '2017-11-22' + }, + { + 'name': '大雪', + 'date': '2017-12-7' + }, + { + 'name': '冬至', + 'date': '2017-12-22' + }, + { + 'name': '小寒', + 'date': '2017-1-5' + }, + { + 'name': '大寒', + 'date': '2017-1-20' + } + ] + }, + '2018': { + 'holiday': { + '2017-12-30': '1', + '2017-12-31': '1', + '2018-1-1': '1', + '2018-2-15': '1', + '2018-2-11': '2', + '2018-2-16': '1', + '2018-2-17': '1', + '2018-2-18': '1', + '2018-2-19': '1', + '2018-2-20': '1', + '2018-2-21': '1', + '2018-2-24': '2', + '2018-4-5': '1', + '2018-4-6': '1', + '2018-4-7': '1', + '2018-4-8': '2', + '2018-4-28': '2', + '2018-4-29': '1', + '2018-4-30': '1', + '2018-5-1': '1', + '2018-6-16': '1', + '2018-6-17': '1', + '2018-6-18': '1', + '2018-9-22': '1', + '2018-9-23': '1', + '2018-9-24': '1', + '2018-10-1': '1', + '2018-10-2': '1', + '2018-10-3': '1', + '2018-10-4': '1', + '2018-10-5': '1', + '2018-10-6': '1', + '2018-10-7': '1', + '2018-9-29': '2', + '2018-9-30': '2', + '2018-12-29': '2', + '2018-12-31': '1', + '2019-1-1': '1', + '2018-12-30': '1' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2020-1-1' + 'startday': '2018-1-1' }, { 'name': '除夕', - 'startday': '2020-1-24' + 'startday': '2018-2-15' }, { 'name': '春节', - 'startday': '2020-1-25' + 'startday': '2018-2-16' }, { 'name': '清明节', - 'startday': '2020-4-4' + 'startday': '2018-4-5' }, { 'name': '劳动节', - 'startday': '2020-5-1' + 'startday': '2018-5-1' }, { 'name': '端午节', - 'startday': '2020-6-25' + 'startday': '2018-6-18' }, { 'name': '中秋节', - 'startday': '2020-10-1' + 'startday': '2018-9-24' }, { 'name': '国庆节', - 'startday': '2020-10-1' + 'startday': '2018-10-1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2020-2-4' + 'date': '2018-2-4' }, { 'name': '雨水', - 'date': '2020-2-19' + 'date': '2018-2-19' }, { 'name': '惊蛰', - 'date': '2020-3-5' + 'date': '2018-3-5' }, { 'name': '春分', - 'date': '2020-3-20' + 'date': '2018-3-21' }, { 'name': '清明', - 'date': '2020-4-4' + 'date': '2018-4-5' }, { 'name': '谷雨', - 'date': '2020-4-19' + 'date': '2018-4-20' }, { 'name': '立夏', - 'date': '2020-5-5' + 'date': '2018-5-5' }, { 'name': '小满', - 'date': '2020-5-20' + 'date': '2018-5-21' }, { 'name': '芒种', - 'date': '2020-6-5' + 'date': '2018-6-6' }, { 'name': '夏至', - 'date': '2020-6-21' + 'date': '2018-6-21' }, { 'name': '小暑', - 'date': '2020-7-6' + 'date': '2018-7-7' }, { 'name': '大暑', - 'date': '2020-7-22' + 'date': '2018-7-23' }, { 'name': '立秋', - 'date': '2020-8-7' + 'date': '2018-8-7' }, { 'name': '处暑', - 'date': '2020-8-22' + 'date': '2018-8-23' }, { 'name': '白露', - 'date': '2020-9-7' + 'date': '2018-9-8' }, { 'name': '秋分', - 'date': '2020-9-22' + 'date': '2018-9-23' }, { 'name': '寒露', - 'date': '2020-10-8' + 'date': '2018-10-8' }, { 'name': '霜降', - 'date': '2020-10-23' + 'date': '2018-10-23' }, { 'name': '立冬', - 'date': '2020-11-7' + 'date': '2018-11-7' }, { 'name': '小雪', - 'date': '2020-11-22' + 'date': '2018-11-22' }, { 'name': '大雪', - 'date': '2020-12-7' + 'date': '2018-12-7' }, { 'name': '冬至', - 'date': '2020-12-21' + 'date': '2018-12-22' }, { 'name': '小寒', - 'date': '2020-1-6' + 'date': '2018-1-5' }, { 'name': '大寒', - 'date': '2020-1-20' + 'date': '2018-1-20' } ] }, @@ -342,178 +2704,173 @@ export default { } ] }, - '2018': { + '2020': { 'holiday': { - '2017-12-30': '1', - '2017-12-31': '1', - '2018-1-1': '1', - '2018-2-15': '1', - '2018-2-11': '2', - '2018-2-16': '1', - '2018-2-17': '1', - '2018-2-18': '1', - '2018-2-19': '1', - '2018-2-20': '1', - '2018-2-21': '1', - '2018-2-24': '2', - '2018-4-5': '1', - '2018-4-6': '1', - '2018-4-7': '1', - '2018-4-8': '2', - '2018-4-28': '2', - '2018-4-29': '1', - '2018-4-30': '1', - '2018-5-1': '1', - '2018-6-16': '1', - '2018-6-17': '1', - '2018-6-18': '1', - '2018-9-22': '1', - '2018-9-23': '1', - '2018-9-24': '1', - '2018-10-1': '1', - '2018-10-2': '1', - '2018-10-3': '1', - '2018-10-4': '1', - '2018-10-5': '1', - '2018-10-6': '1', - '2018-10-7': '1', - '2018-9-29': '2', - '2018-9-30': '2', - '2018-12-29': '2', - '2018-12-31': '1', - '2019-1-1': '1', - '2018-12-30': '1' + '2020-1-1': '1', + '2020-1-24': '1', + '2020-1-25': '1', + '2020-1-26': '1', + '2020-1-27': '1', + '2020-1-28': '1', + '2020-1-29': '1', + '2020-1-30': '1', + '2020-1-19': '2', + '2020-2-1': '2', + '2020-4-4': '1', + '2020-4-5': '1', + '2020-4-6': '1', + '2020-5-1': '1', + '2020-5-2': '1', + '2020-5-3': '1', + '2020-5-4': '1', + '2020-5-5': '1', + '2020-4-26': '2', + '2020-5-9': '2', + '2020-6-25': '1', + '2020-6-26': '1', + '2020-6-27': '1', + '2020-6-28': '2', + '2020-10-1': '1', + '2020-10-2': '1', + '2020-10-3': '1', + '2020-10-4': '1', + '2020-10-5': '1', + '2020-10-6': '1', + '2020-10-7': '1', + '2020-10-8': '1', + '2020-9-27': '2', + '2020-10-10': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2018-1-1' + 'startday': '2020-1-1' }, { 'name': '除夕', - 'startday': '2018-2-15' + 'startday': '2020-1-24' }, { 'name': '春节', - 'startday': '2018-2-16' + 'startday': '2020-1-25' }, { 'name': '清明节', - 'startday': '2018-4-5' + 'startday': '2020-4-4' }, { 'name': '劳动节', - 'startday': '2018-5-1' + 'startday': '2020-5-1' }, { 'name': '端午节', - 'startday': '2018-6-18' + 'startday': '2020-6-25' }, { 'name': '中秋节', - 'startday': '2018-9-24' + 'startday': '2020-10-1' }, { 'name': '国庆节', - 'startday': '2018-10-1' + 'startday': '2020-10-1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2018-2-4' + 'date': '2020-2-4' }, { 'name': '雨水', - 'date': '2018-2-19' + 'date': '2020-2-19' }, { 'name': '惊蛰', - 'date': '2018-3-5' + 'date': '2020-3-5' }, { 'name': '春分', - 'date': '2018-3-21' + 'date': '2020-3-20' }, { 'name': '清明', - 'date': '2018-4-5' + 'date': '2020-4-4' }, { 'name': '谷雨', - 'date': '2018-4-20' + 'date': '2020-4-19' }, { 'name': '立夏', - 'date': '2018-5-5' + 'date': '2020-5-5' }, { 'name': '小满', - 'date': '2018-5-21' + 'date': '2020-5-20' }, { 'name': '芒种', - 'date': '2018-6-6' + 'date': '2020-6-5' }, { 'name': '夏至', - 'date': '2018-6-21' + 'date': '2020-6-21' }, { 'name': '小暑', - 'date': '2018-7-7' + 'date': '2020-7-6' }, { 'name': '大暑', - 'date': '2018-7-23' + 'date': '2020-7-22' }, { 'name': '立秋', - 'date': '2018-8-7' + 'date': '2020-8-7' }, { 'name': '处暑', - 'date': '2018-8-23' + 'date': '2020-8-22' }, { 'name': '白露', - 'date': '2018-9-8' + 'date': '2020-9-7' }, { 'name': '秋分', - 'date': '2018-9-23' + 'date': '2020-9-22' }, { 'name': '寒露', - 'date': '2018-10-8' + 'date': '2020-10-8' }, { 'name': '霜降', - 'date': '2018-10-23' + 'date': '2020-10-23' }, { 'name': '立冬', - 'date': '2018-11-7' + 'date': '2020-11-7' }, { 'name': '小雪', - 'date': '2018-11-22' + 'date': '2020-11-22' }, { 'name': '大雪', - 'date': '2018-12-7' + 'date': '2020-12-7' }, { 'name': '冬至', - 'date': '2018-12-22' + 'date': '2020-12-21' }, { 'name': '小寒', - 'date': '2018-1-5' + 'date': '2020-1-6' }, { 'name': '大寒', - 'date': '2018-1-20' + 'date': '2020-1-20' } ] } From b7e890e0018af0475716967e868d42fee772207f Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Mon, 30 Dec 2019 16:43:32 +0800 Subject: [PATCH 004/115] fix: other type --- components/date-picker/Calender.js | 44 +- components/date-picker/DatePanel.js | 10 +- components/date-picker/DatePicker.js | 1 - components/date-picker/DateRangePanel.js | 31 +- components/date-picker/dateUtil.js | 6 +- components/date-picker/holidaylist.js | 1986 +++++++++++----------- components/date-picker/style/index.scss | 62 +- docs/demo/date-picker/section-normal.jsx | 2 +- docs/zh-CN/components/date-picker.mdx | 2 +- 9 files changed, 1098 insertions(+), 1046 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 9883e08ee..f447c2943 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -18,7 +18,7 @@ import { getMonth, toDate, isValid, - lunarCalendarisShow + showLunarStatus } from './dateUtil' class Calender extends Component { @@ -28,7 +28,6 @@ class Calender extends Component { rows: [[], [], [], [], [], []] } this.weekNum = 0 - console.log(this.props) } _getTime (week, y, m) { const r = new Date(y, m - 1, 1) @@ -209,18 +208,18 @@ class Calender extends Component { const holidayInfo = {} const reg = /[\u4E00-\u9FA5]+/ if (holidayBase) { - holidayBase.holidaylist.forEach(item => { + holidayBase.holidaylist && holidayBase.holidaylist.forEach(item => { const status = {status: 1} item.startday === date && Object.assign(holidayInfo, item, status) }) - if (holidayBase.holiday[date]) holidayInfo.status = Number(holidayBase.holiday[date]) - - reg.test(holidayInfo.name) || holidayBase.solarTerms.forEach(item => { - const status = {status: holidayInfo.status ? holidayInfo.status : 3} - item.date === date && Object.assign(holidayInfo, item, status) - }) + holidayInfo.status = holidayBase.holiday[date] ? Number(holidayBase.holiday[date]) : null + if (!reg.test(holidayInfo.name)) { + holidayBase.solarTerms && holidayBase.solarTerms.forEach(item => { + const status = {status: holidayInfo.status ? holidayInfo.status : 3} + item.date === date && Object.assign(holidayInfo, item, status) + }) + } } - return holidayInfo } /** @@ -251,13 +250,20 @@ class Calender extends Component { if (cls.indexOf('next') !== -1) { newDate = addMonths(newDate, 1) } - // console.log('newsdfasd',new Date(newDate).toLocaleDateString(),getMonth(newDate)) - // console.log(Lunar.toLunar(getYear(newDate),getMonth(newDate)+1,value)) const _year = getYear(newDate) const _month = getMonth(newDate) + 1 - const LunarInfo = Lunar.toLunar(_year, _month, value) - const lunarcellinfo = this.isHoliday(_year, _year + '-' + _month + '-' + value) - lunarcellinfo.Lunar = LunarInfo[6] + const _value = type === 'year' ? 1 : value + + const LunarInfo = Lunar.toLunar(_year, _month, _value) + const lunarcellinfo = type === 'month' ? {} : this.isHoliday(_year, _year + '/' + _month + '/' + _value) + + if (type === 'year') { + delete lunarcellinfo.status + lunarcellinfo.Lunar = LunarInfo[3] + '-' + LunarInfo[4] + } else { + lunarcellinfo.Lunar = LunarInfo[6] + } + return lunarcellinfo } ToLunar (td) { @@ -292,7 +298,7 @@ class Calender extends Component { { fullTimeInfo.status === 2 ? : null } - + {fullTimeInfo.name || fullTimeInfo.Lunar} @@ -300,7 +306,7 @@ class Calender extends Component { } else { return ( - + {fullTimeInfo.Lunar} @@ -310,7 +316,7 @@ class Calender extends Component { getTDClass (td, _index) { const { type: layerType, date } = this.props let _class = ['hi-datepicker__cell'] - if (lunarCalendarisShow(this.props)) { + if (showLunarStatus(this.props)) { _class.push('hi-datepicker__cell--large') _index === 6 && _class.push('hi-datepicker__cell--large--laster') } @@ -400,7 +406,7 @@ class Calender extends Component {
{ - lunarCalendarisShow(this.props) &&
+ showLunarStatus(this.props) &&
{ this.ToLunar(cell) } diff --git a/components/date-picker/DatePanel.js b/components/date-picker/DatePanel.js index 95eff71bc..23809bdce 100644 --- a/components/date-picker/DatePanel.js +++ b/components/date-picker/DatePanel.js @@ -5,7 +5,7 @@ import TimePanel from './TimePanel' import Icon from '../icon' import classNames from 'classnames' import TimePeriodPanel from './TimePeriodPanel' -import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek, lunarCalendarisShow } from './dateUtil' +import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek, showLunarStatus } from './dateUtil' class DatePanel extends Component { constructor (props) { @@ -206,7 +206,7 @@ class DatePanel extends Component { } _getNormalComponent () { const { currentView } = this.state - const { min, max, weekOffset, date, lunarCalendar } = this.props + const { min, max, weekOffset, date, showLunar } = this.props const validDate = getStartDate(date) const { year, month } = deconstructDate(validDate) let component = null @@ -216,7 +216,7 @@ class DatePanel extends Component { case 'week': component = ( diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index 39d43f98c..20692f943 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -9,7 +9,6 @@ import Provider from '../context' class DatePicker extends BasePicker { initPanel (state, props) { let component = null - console.log('++', props) let d = state.date switch (props.type) { case 'month': diff --git a/components/date-picker/DateRangePanel.js b/components/date-picker/DateRangePanel.js index 3264fb5ba..e9427ff23 100644 --- a/components/date-picker/DateRangePanel.js +++ b/components/date-picker/DateRangePanel.js @@ -5,7 +5,7 @@ import {DAY_MILLISECONDS} from './constants' import Icon from '../icon' import classNames from 'classnames' import Provider from '../context' -import { dateFormat, isValid, getStartDate, toDate, changeYear, changeMonth, endOfDay } from './dateUtil' +import { dateFormat, isValid, getStartDate, toDate, changeYear, changeMonth, endOfDay, showLunarStatus } from './dateUtil' import TimeRangePanel from './TimeRangePanel' class DateRangePanel extends Component { @@ -272,7 +272,7 @@ class DateRangePanel extends Component { layout }) } - _getNormalComponent (date, flag) { + _getNormalComponent (date, flag, showLunar) { let { minDate, maxDate, range, layout } = this.state let component = null const { year, month } = deconstructDate(date) @@ -281,6 +281,7 @@ class DateRangePanel extends Component { const yearData = this.getYearOrMonthData(year, 'year') component = ( +
{ this.renderHeader(currentView, leftDate, 'left') }
- {this._getNormalComponent(leftDate, 'left')} + {this._getNormalComponent(leftDate, 'left', showLunar)}
-
+
{ this.renderHeader(currentView, rightDate, 'right') }
- {this._getNormalComponent(rightDate, 'right')} + {this._getNormalComponent(rightDate, 'right', showLunar)}
diff --git a/components/date-picker/dateUtil.js b/components/date-picker/dateUtil.js index bce11cc86..a17f72a62 100644 --- a/components/date-picker/dateUtil.js +++ b/components/date-picker/dateUtil.js @@ -91,8 +91,8 @@ const changeMonth = (date, flag) => { * 是否展示农历 * @param {Object} props */ -const lunarCalendarisShow = (props) => { - return (props.type === 'date' || props.type === 'daterange') && props.lunarCalendar +const showLunarStatus = (props) => { + return props.showLunar } export { getDaysInMonth, // 获取当月的天数 @@ -132,5 +132,5 @@ export { compatibleFormatString, changeYear, changeMonth, - lunarCalendarisShow // 是否展示农历 + showLunarStatus // 是否展示农历 } diff --git a/components/date-picker/holidaylist.js b/components/date-picker/holidaylist.js index 7a5349040..7a5114451 100644 --- a/components/date-picker/holidaylist.js +++ b/components/date-picker/holidaylist.js @@ -4,99 +4,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2000-2-4' + 'date': '2000/2/4' }, { 'name': '雨水', - 'date': '2000-2-19' + 'date': '2000/2/19' }, { 'name': '惊蛰', - 'date': '2000-3-5' + 'date': '2000/3/5' }, { 'name': '春分', - 'date': '2000-3-20' + 'date': '2000/3/20' }, { 'name': '清明', - 'date': '2000-4-4' + 'date': '2000/4/4' }, { 'name': '谷雨', - 'date': '2000-4-20' + 'date': '2000/4/20' }, { 'name': '立夏', - 'date': '2000-5-5' + 'date': '2000/5/5' }, { 'name': '小满', - 'date': '2000-5-21' + 'date': '2000/5/21' }, { 'name': '芒种', - 'date': '2000-6-5' + 'date': '2000/6/5' }, { 'name': '夏至', - 'date': '2000-6-21' + 'date': '2000/6/21' }, { 'name': '小暑', - 'date': '2000-7-7' + 'date': '2000/7/7' }, { 'name': '大暑', - 'date': '2000-7-22' + 'date': '2000/7/22' }, { 'name': '立秋', - 'date': '2000-8-7' + 'date': '2000/8/7' }, { 'name': '处暑', - 'date': '2000-8-23' + 'date': '2000/8/23' }, { 'name': '白露', - 'date': '2000-9-7' + 'date': '2000/9/7' }, { 'name': '秋分', - 'date': '2000-9-23' + 'date': '2000/9/23' }, { 'name': '寒露', - 'date': '2000-10-8' + 'date': '2000/10/8' }, { 'name': '霜降', - 'date': '2000-10-23' + 'date': '2000/10/23' }, { 'name': '立冬', - 'date': '2000-11-7' + 'date': '2000/11/7' }, { 'name': '小雪', - 'date': '2000-11-22' + 'date': '2000/11/22' }, { 'name': '大雪', - 'date': '2000-12-7' + 'date': '2000/12/7' }, { 'name': '冬至', - 'date': '2000-12-21' + 'date': '2000/12/21' }, { 'name': '小寒', - 'date': '2000-1-6' + 'date': '2000/1/6' }, { 'name': '大寒', - 'date': '2000-1-21' + 'date': '2000/1/21' } ] }, @@ -105,99 +105,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2001-2-4' + 'date': '2001/2/4' }, { 'name': '雨水', - 'date': '2001-2-18' + 'date': '2001/2/18' }, { 'name': '惊蛰', - 'date': '2001-3-5' + 'date': '2001/3/5' }, { 'name': '春分', - 'date': '2001-3-20' + 'date': '2001/3/20' }, { 'name': '清明', - 'date': '2001-4-5' + 'date': '2001/4/5' }, { 'name': '谷雨', - 'date': '2001-4-20' + 'date': '2001/4/20' }, { 'name': '立夏', - 'date': '2001-5-5' + 'date': '2001/5/5' }, { 'name': '小满', - 'date': '2001-5-21' + 'date': '2001/5/21' }, { 'name': '芒种', - 'date': '2001-6-5' + 'date': '2001/6/5' }, { 'name': '夏至', - 'date': '2001-6-21' + 'date': '2001/6/21' }, { 'name': '小暑', - 'date': '2001-7-7' + 'date': '2001/7/7' }, { 'name': '大暑', - 'date': '2001-7-23' + 'date': '2001/7/23' }, { 'name': '立秋', - 'date': '2001-8-7' + 'date': '2001/8/7' }, { 'name': '处暑', - 'date': '2001-8-23' + 'date': '2001/8/23' }, { 'name': '白露', - 'date': '2001-9-7' + 'date': '2001/9/7' }, { 'name': '秋分', - 'date': '2001-9-23' + 'date': '2001/9/23' }, { 'name': '寒露', - 'date': '2001-10-8' + 'date': '2001/10/8' }, { 'name': '霜降', - 'date': '2001-10-23' + 'date': '2001/10/23' }, { 'name': '立冬', - 'date': '2001-11-7' + 'date': '2001/11/7' }, { 'name': '小雪', - 'date': '2001-11-22' + 'date': '2001/11/22' }, { 'name': '大雪', - 'date': '2001-12-7' + 'date': '2001/12/7' }, { 'name': '冬至', - 'date': '2001-12-22' + 'date': '2001/12/22' }, { 'name': '小寒', - 'date': '2001-1-5' + 'date': '2001/1/5' }, { 'name': '大寒', - 'date': '2001-1-20' + 'date': '2001/1/20' } ] }, @@ -206,99 +206,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2002-2-4' + 'date': '2002/2/4' }, { 'name': '雨水', - 'date': '2002-2-19' + 'date': '2002/2/19' }, { 'name': '惊蛰', - 'date': '2002-3-6' + 'date': '2002/3/6' }, { 'name': '春分', - 'date': '2002-3-21' + 'date': '2002/3/21' }, { 'name': '清明', - 'date': '2002-4-5' + 'date': '2002/4/5' }, { 'name': '谷雨', - 'date': '2002-4-20' + 'date': '2002/4/20' }, { 'name': '立夏', - 'date': '2002-5-6' + 'date': '2002/5/6' }, { 'name': '小满', - 'date': '2002-5-21' + 'date': '2002/5/21' }, { 'name': '芒种', - 'date': '2002-6-6' + 'date': '2002/6/6' }, { 'name': '夏至', - 'date': '2002-6-21' + 'date': '2002/6/21' }, { 'name': '小暑', - 'date': '2002-7-7' + 'date': '2002/7/7' }, { 'name': '大暑', - 'date': '2002-7-23' + 'date': '2002/7/23' }, { 'name': '立秋', - 'date': '2002-8-8' + 'date': '2002/8/8' }, { 'name': '处暑', - 'date': '2002-8-23' + 'date': '2002/8/23' }, { 'name': '白露', - 'date': '2002-9-8' + 'date': '2002/9/8' }, { 'name': '秋分', - 'date': '2002-9-23' + 'date': '2002/9/23' }, { 'name': '寒露', - 'date': '2002-10-8' + 'date': '2002/10/8' }, { 'name': '霜降', - 'date': '2002-10-23' + 'date': '2002/10/23' }, { 'name': '立冬', - 'date': '2002-11-7' + 'date': '2002/11/7' }, { 'name': '小雪', - 'date': '2002-11-22' + 'date': '2002/11/22' }, { 'name': '大雪', - 'date': '2002-12-7' + 'date': '2002/12/7' }, { 'name': '冬至', - 'date': '2002-12-22' + 'date': '2002/12/22' }, { 'name': '小寒', - 'date': '2002-1-5' + 'date': '2002/1/5' }, { 'name': '大寒', - 'date': '2002-1-20' + 'date': '2002/1/20' } ] }, @@ -307,99 +307,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2003-2-4' + 'date': '2003/2/4' }, { 'name': '雨水', - 'date': '2003-2-19' + 'date': '2003/2/19' }, { 'name': '惊蛰', - 'date': '2003-3-6' + 'date': '2003/3/6' }, { 'name': '春分', - 'date': '2003-3-21' + 'date': '2003/3/21' }, { 'name': '清明', - 'date': '2003-4-5' + 'date': '2003/4/5' }, { 'name': '谷雨', - 'date': '2003-4-20' + 'date': '2003/4/20' }, { 'name': '立夏', - 'date': '2003-5-6' + 'date': '2003/5/6' }, { 'name': '小满', - 'date': '2003-5-21' + 'date': '2003/5/21' }, { 'name': '芒种', - 'date': '2003-6-6' + 'date': '2003/6/6' }, { 'name': '夏至', - 'date': '2003-6-22' + 'date': '2003/6/22' }, { 'name': '小暑', - 'date': '2003-7-7' + 'date': '2003/7/7' }, { 'name': '大暑', - 'date': '2003-7-23' + 'date': '2003/7/23' }, { 'name': '立秋', - 'date': '2003-8-8' + 'date': '2003/8/8' }, { 'name': '处暑', - 'date': '2003-8-23' + 'date': '2003/8/23' }, { 'name': '白露', - 'date': '2003-9-8' + 'date': '2003/9/8' }, { 'name': '秋分', - 'date': '2003-9-23' + 'date': '2003/9/23' }, { 'name': '寒露', - 'date': '2003-10-9' + 'date': '2003/10/9' }, { 'name': '霜降', - 'date': '2003-10-24' + 'date': '2003/10/24' }, { 'name': '立冬', - 'date': '2003-11-8' + 'date': '2003/11/8' }, { 'name': '小雪', - 'date': '2003-11-23' + 'date': '2003/11/23' }, { 'name': '大雪', - 'date': '2003-12-7' + 'date': '2003/12/7' }, { 'name': '冬至', - 'date': '2003-12-22' + 'date': '2003/12/22' }, { 'name': '小寒', - 'date': '2003-1-6' + 'date': '2003/1/6' }, { 'name': '大寒', - 'date': '2003-1-20' + 'date': '2003/1/20' } ] }, @@ -408,99 +408,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2004-2-4' + 'date': '2004/2/4' }, { 'name': '雨水', - 'date': '2004-2-19' + 'date': '2004/2/19' }, { 'name': '惊蛰', - 'date': '2004-3-5' + 'date': '2004/3/5' }, { 'name': '春分', - 'date': '2004-3-20' + 'date': '2004/3/20' }, { 'name': '清明', - 'date': '2004-4-4' + 'date': '2004/4/4' }, { 'name': '谷雨', - 'date': '2004-4-20' + 'date': '2004/4/20' }, { 'name': '立夏', - 'date': '2004-5-5' + 'date': '2004/5/5' }, { 'name': '小满', - 'date': '2004-5-21' + 'date': '2004/5/21' }, { 'name': '芒种', - 'date': '2004-6-5' + 'date': '2004/6/5' }, { 'name': '夏至', - 'date': '2004-6-21' + 'date': '2004/6/21' }, { 'name': '小暑', - 'date': '2004-7-7' + 'date': '2004/7/7' }, { 'name': '大暑', - 'date': '2004-7-22' + 'date': '2004/7/22' }, { 'name': '立秋', - 'date': '2004-8-7' + 'date': '2004/8/7' }, { 'name': '处暑', - 'date': '2004-8-23' + 'date': '2004/8/23' }, { 'name': '白露', - 'date': '2004-9-7' + 'date': '2004/9/7' }, { 'name': '秋分', - 'date': '2004-9-23' + 'date': '2004/9/23' }, { 'name': '寒露', - 'date': '2004-10-8' + 'date': '2004/10/8' }, { 'name': '霜降', - 'date': '2004-10-23' + 'date': '2004/10/23' }, { 'name': '立冬', - 'date': '2004-11-7' + 'date': '2004/11/7' }, { 'name': '小雪', - 'date': '2004-11-22' + 'date': '2004/11/22' }, { 'name': '大雪', - 'date': '2004-12-7' + 'date': '2004/12/7' }, { 'name': '冬至', - 'date': '2004-12-21' + 'date': '2004/12/21' }, { 'name': '小寒', - 'date': '2004-1-6' + 'date': '2004/1/6' }, { 'name': '大寒', - 'date': '2004-1-21' + 'date': '2004/1/21' } ] }, @@ -509,99 +509,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2005-2-4' + 'date': '2005/2/4' }, { 'name': '雨水', - 'date': '2005-2-18' + 'date': '2005/2/18' }, { 'name': '惊蛰', - 'date': '2005-3-5' + 'date': '2005/3/5' }, { 'name': '春分', - 'date': '2005-3-20' + 'date': '2005/3/20' }, { 'name': '清明', - 'date': '2005-4-5' + 'date': '2005/4/5' }, { 'name': '谷雨', - 'date': '2005-4-20' + 'date': '2005/4/20' }, { 'name': '立夏', - 'date': '2005-5-5' + 'date': '2005/5/5' }, { 'name': '小满', - 'date': '2005-5-21' + 'date': '2005/5/21' }, { 'name': '芒种', - 'date': '2005-6-5' + 'date': '2005/6/5' }, { 'name': '夏至', - 'date': '2005-6-21' + 'date': '2005/6/21' }, { 'name': '小暑', - 'date': '2005-7-7' + 'date': '2005/7/7' }, { 'name': '大暑', - 'date': '2005-7-23' + 'date': '2005/7/23' }, { 'name': '立秋', - 'date': '2005-8-7' + 'date': '2005/8/7' }, { 'name': '处暑', - 'date': '2005-8-23' + 'date': '2005/8/23' }, { 'name': '白露', - 'date': '2005-9-7' + 'date': '2005/9/7' }, { 'name': '秋分', - 'date': '2005-9-23' + 'date': '2005/9/23' }, { 'name': '寒露', - 'date': '2005-10-8' + 'date': '2005/10/8' }, { 'name': '霜降', - 'date': '2005-10-23' + 'date': '2005/10/23' }, { 'name': '立冬', - 'date': '2005-11-7' + 'date': '2005/11/7' }, { 'name': '小雪', - 'date': '2005-11-22' + 'date': '2005/11/22' }, { 'name': '大雪', - 'date': '2005-12-7' + 'date': '2005/12/7' }, { 'name': '冬至', - 'date': '2005-12-22' + 'date': '2005/12/22' }, { 'name': '小寒', - 'date': '2005-1-5' + 'date': '2005/1/5' }, { 'name': '大寒', - 'date': '2005-1-20' + 'date': '2005/1/20' } ] }, @@ -610,99 +610,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2006-2-4' + 'date': '2006/2/4' }, { 'name': '雨水', - 'date': '2006-2-19' + 'date': '2006/2/19' }, { 'name': '惊蛰', - 'date': '2006-3-6' + 'date': '2006/3/6' }, { 'name': '春分', - 'date': '2006-3-21' + 'date': '2006/3/21' }, { 'name': '清明', - 'date': '2006-4-5' + 'date': '2006/4/5' }, { 'name': '谷雨', - 'date': '2006-4-20' + 'date': '2006/4/20' }, { 'name': '立夏', - 'date': '2006-5-5' + 'date': '2006/5/5' }, { 'name': '小满', - 'date': '2006-5-21' + 'date': '2006/5/21' }, { 'name': '芒种', - 'date': '2006-6-6' + 'date': '2006/6/6' }, { 'name': '夏至', - 'date': '2006-6-21' + 'date': '2006/6/21' }, { 'name': '小暑', - 'date': '2006-7-7' + 'date': '2006/7/7' }, { 'name': '大暑', - 'date': '2006-7-23' + 'date': '2006/7/23' }, { 'name': '立秋', - 'date': '2006-8-7' + 'date': '2006/8/7' }, { 'name': '处暑', - 'date': '2006-8-23' + 'date': '2006/8/23' }, { 'name': '白露', - 'date': '2006-9-8' + 'date': '2006/9/8' }, { 'name': '秋分', - 'date': '2006-9-23' + 'date': '2006/9/23' }, { 'name': '寒露', - 'date': '2006-10-8' + 'date': '2006/10/8' }, { 'name': '霜降', - 'date': '2006-10-23' + 'date': '2006/10/23' }, { 'name': '立冬', - 'date': '2006-11-7' + 'date': '2006/11/7' }, { 'name': '小雪', - 'date': '2006-11-22' + 'date': '2006/11/22' }, { 'name': '大雪', - 'date': '2006-12-7' + 'date': '2006/12/7' }, { 'name': '冬至', - 'date': '2006-12-22' + 'date': '2006/12/22' }, { 'name': '小寒', - 'date': '2006-1-5' + 'date': '2006/1/5' }, { 'name': '大寒', - 'date': '2006-1-20' + 'date': '2006/1/20' } ] }, @@ -711,99 +711,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2007-2-4' + 'date': '2007/2/4' }, { 'name': '雨水', - 'date': '2007-2-19' + 'date': '2007/2/19' }, { 'name': '惊蛰', - 'date': '2007-3-6' + 'date': '2007/3/6' }, { 'name': '春分', - 'date': '2007-3-21' + 'date': '2007/3/21' }, { 'name': '清明', - 'date': '2007-4-5' + 'date': '2007/4/5' }, { 'name': '谷雨', - 'date': '2007-4-20' + 'date': '2007/4/20' }, { 'name': '立夏', - 'date': '2007-5-6' + 'date': '2007/5/6' }, { 'name': '小满', - 'date': '2007-5-21' + 'date': '2007/5/21' }, { 'name': '芒种', - 'date': '2007-6-6' + 'date': '2007/6/6' }, { 'name': '夏至', - 'date': '2007-6-22' + 'date': '2007/6/22' }, { 'name': '小暑', - 'date': '2007-7-7' + 'date': '2007/7/7' }, { 'name': '大暑', - 'date': '2007-7-23' + 'date': '2007/7/23' }, { 'name': '立秋', - 'date': '2007-8-8' + 'date': '2007/8/8' }, { 'name': '处暑', - 'date': '2007-8-23' + 'date': '2007/8/23' }, { 'name': '白露', - 'date': '2007-9-8' + 'date': '2007/9/8' }, { 'name': '秋分', - 'date': '2007-9-23' + 'date': '2007/9/23' }, { 'name': '寒露', - 'date': '2007-10-9' + 'date': '2007/10/9' }, { 'name': '霜降', - 'date': '2007-10-24' + 'date': '2007/10/24' }, { 'name': '立冬', - 'date': '2007-11-8' + 'date': '2007/11/8' }, { 'name': '小雪', - 'date': '2007-11-23' + 'date': '2007/11/23' }, { 'name': '大雪', - 'date': '2007-12-7' + 'date': '2007/12/7' }, { 'name': '冬至', - 'date': '2007-12-22' + 'date': '2007/12/22' }, { 'name': '小寒', - 'date': '2007-1-6' + 'date': '2007/1/6' }, { 'name': '大寒', - 'date': '2007-1-20' + 'date': '2007/1/20' } ] }, @@ -812,99 +812,99 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2008-2-4' + 'date': '2008/2/4' }, { 'name': '雨水', - 'date': '2008-2-19' + 'date': '2008/2/19' }, { 'name': '惊蛰', - 'date': '2008-3-5' + 'date': '2008/3/5' }, { 'name': '春分', - 'date': '2008-3-20' + 'date': '2008/3/20' }, { 'name': '清明', - 'date': '2008-4-4' + 'date': '2008/4/4' }, { 'name': '谷雨', - 'date': '2008-4-20' + 'date': '2008/4/20' }, { 'name': '立夏', - 'date': '2008-5-5' + 'date': '2008/5/5' }, { 'name': '小满', - 'date': '2008-5-21' + 'date': '2008/5/21' }, { 'name': '芒种', - 'date': '2008-6-5' + 'date': '2008/6/5' }, { 'name': '夏至', - 'date': '2008-6-21' + 'date': '2008/6/21' }, { 'name': '小暑', - 'date': '2008-7-7' + 'date': '2008/7/7' }, { 'name': '大暑', - 'date': '2008-7-22' + 'date': '2008/7/22' }, { 'name': '立秋', - 'date': '2008-8-7' + 'date': '2008/8/7' }, { 'name': '处暑', - 'date': '2008-8-23' + 'date': '2008/8/23' }, { 'name': '白露', - 'date': '2008-9-7' + 'date': '2008/9/7' }, { 'name': '秋分', - 'date': '2008-9-22' + 'date': '2008/9/22' }, { 'name': '寒露', - 'date': '2008-10-8' + 'date': '2008/10/8' }, { 'name': '霜降', - 'date': '2008-10-23' + 'date': '2008/10/23' }, { 'name': '立冬', - 'date': '2008-11-7' + 'date': '2008/11/7' }, { 'name': '小雪', - 'date': '2008-11-22' + 'date': '2008/11/22' }, { 'name': '大雪', - 'date': '2008-12-7' + 'date': '2008/12/7' }, { 'name': '冬至', - 'date': '2008-12-21' + 'date': '2008/12/21' }, { 'name': '小寒', - 'date': '2008-1-6' + 'date': '2008/1/6' }, { 'name': '大寒', - 'date': '2008-1-21' + 'date': '2008/1/21' } ] }, @@ -913,1964 +913,1964 @@ export default { 'solarTerms': [ { 'name': '立春', - 'date': '2009-2-4' + 'date': '2009/2/4' }, { 'name': '雨水', - 'date': '2009-2-18' + 'date': '2009/2/18' }, { 'name': '惊蛰', - 'date': '2009-3-5' + 'date': '2009/3/5' }, { 'name': '春分', - 'date': '2009-3-20' + 'date': '2009/3/20' }, { 'name': '清明', - 'date': '2009-4-4' + 'date': '2009/4/4' }, { 'name': '谷雨', - 'date': '2009-4-20' + 'date': '2009/4/20' }, { 'name': '立夏', - 'date': '2009-5-5' + 'date': '2009/5/5' }, { 'name': '小满', - 'date': '2009-5-21' + 'date': '2009/5/21' }, { 'name': '芒种', - 'date': '2009-6-5' + 'date': '2009/6/5' }, { 'name': '夏至', - 'date': '2009-6-21' + 'date': '2009/6/21' }, { 'name': '小暑', - 'date': '2009-7-7' + 'date': '2009/7/7' }, { 'name': '大暑', - 'date': '2009-7-23' + 'date': '2009/7/23' }, { 'name': '立秋', - 'date': '2009-8-7' + 'date': '2009/8/7' }, { 'name': '处暑', - 'date': '2009-8-23' + 'date': '2009/8/23' }, { 'name': '白露', - 'date': '2009-9-7' + 'date': '2009/9/7' }, { 'name': '秋分', - 'date': '2009-9-23' + 'date': '2009/9/23' }, { 'name': '寒露', - 'date': '2009-10-8' + 'date': '2009/10/8' }, { 'name': '霜降', - 'date': '2009-10-23' + 'date': '2009/10/23' }, { 'name': '立冬', - 'date': '2009-11-7' + 'date': '2009/11/7' }, { 'name': '小雪', - 'date': '2009-11-22' + 'date': '2009/11/22' }, { 'name': '大雪', - 'date': '2009-12-7' + 'date': '2009/12/7' }, { 'name': '冬至', - 'date': '2009-12-22' + 'date': '2009/12/22' }, { 'name': '小寒', - 'date': '2009-1-5' + 'date': '2009/1/5' }, { 'name': '大寒', - 'date': '2009-1-20' + 'date': '2009/1/20' } ] }, '2010': { 'holiday': { - '2011-1-1': '1', - '2011-1-2': '1', - '2011-1-3': '1' + '2011/1/1': '1', + '2011/1/2': '1', + '2011/1/3': '1' }, 'solarTerms': [ { 'name': '立春', - 'date': '2010-2-4' + 'date': '2010/2/4' }, { 'name': '雨水', - 'date': '2010-2-19' + 'date': '2010/2/19' }, { 'name': '惊蛰', - 'date': '2010-3-6' + 'date': '2010/3/6' }, { 'name': '春分', - 'date': '2010-3-21' + 'date': '2010/3/21' }, { 'name': '清明', - 'date': '2010-4-5' + 'date': '2010/4/5' }, { 'name': '谷雨', - 'date': '2010-4-20' + 'date': '2010/4/20' }, { 'name': '立夏', - 'date': '2010-5-5' + 'date': '2010/5/5' }, { 'name': '小满', - 'date': '2010-5-21' + 'date': '2010/5/21' }, { 'name': '芒种', - 'date': '2010-6-6' + 'date': '2010/6/6' }, { 'name': '夏至', - 'date': '2010-6-21' + 'date': '2010/6/21' }, { 'name': '小暑', - 'date': '2010-7-7' + 'date': '2010/7/7' }, { 'name': '大暑', - 'date': '2010-7-23' + 'date': '2010/7/23' }, { 'name': '立秋', - 'date': '2010-8-7' + 'date': '2010/8/7' }, { 'name': '处暑', - 'date': '2010-8-23' + 'date': '2010/8/23' }, { 'name': '白露', - 'date': '2010-9-8' + 'date': '2010/9/8' }, { 'name': '秋分', - 'date': '2010-9-23' + 'date': '2010/9/23' }, { 'name': '寒露', - 'date': '2010-10-8' + 'date': '2010/10/8' }, { 'name': '霜降', - 'date': '2010-10-23' + 'date': '2010/10/23' }, { 'name': '立冬', - 'date': '2010-11-7' + 'date': '2010/11/7' }, { 'name': '小雪', - 'date': '2010-11-22' + 'date': '2010/11/22' }, { 'name': '大雪', - 'date': '2010-12-7' + 'date': '2010/12/7' }, { 'name': '冬至', - 'date': '2010-12-22' + 'date': '2010/12/22' }, { 'name': '小寒', - 'date': '2010-1-5' + 'date': '2010/1/5' }, { 'name': '大寒', - 'date': '2010-1-20' + 'date': '2010/1/20' } ] }, '2011': { 'holiday': { - '2011-1-1': '1', - '2011-1-2': '1', - '2011-1-3': '1', - '2011-1-30': '2', - '2011-2-2': '1', - '2011-2-3': '1', - '2011-2-4': '1', - '2011-2-5': '1', - '2011-2-6': '1', - '2011-2-7': '1', - '2011-2-8': '1', - '2011-2-12': '2', - '2011-4-2': '2', - '2011-4-3': '1', - '2011-4-4': '1', - '2011-4-5': '1', - '2011-4-30': '1', - '2011-5-1': '1', - '2011-5-2': '1', - '2011-6-4': '1', - '2011-6-5': '1', - '2011-6-6': '1', - '2011-9-10': '1', - '2011-9-11': '1', - '2011-9-12': '1', - '2011-10-1': '1', - '2011-10-2': '1', - '2011-10-3': '1', - '2011-10-4': '1', - '2011-10-5': '1', - '2011-10-6': '1', - '2011-10-7': '1', - '2011-10-8': '2', - '2011-10-9': '2', - '2012-1-1': '1', - '2012-1-2': '1', - '2012-1-3': '1', - '2011-12-31': '2', - '2012-1-21': '2', - '2012-1-22': '1', - '2012-1-23': '1', - '2012-1-24': '1', - '2012-1-25': '1', - '2012-1-26': '1', - '2012-1-27': '1', - '2012-1-28': '1', - '2012-1-29': '2' + '2011/1/1': '1', + '2011/1/2': '1', + '2011/1/3': '1', + '2011/1/30': '2', + '2011/2/2': '1', + '2011/2/3': '1', + '2011/2/4': '1', + '2011/2/5': '1', + '2011/2/6': '1', + '2011/2/7': '1', + '2011/2/8': '1', + '2011/2/12': '2', + '2011/4/2': '2', + '2011/4/3': '1', + '2011/4/4': '1', + '2011/4/5': '1', + '2011/4/30': '1', + '2011/5/1': '1', + '2011/5/2': '1', + '2011/6/4': '1', + '2011/6/5': '1', + '2011/6/6': '1', + '2011/9/10': '1', + '2011/9/11': '1', + '2011/9/12': '1', + '2011/10/1': '1', + '2011/10/2': '1', + '2011/10/3': '1', + '2011/10/4': '1', + '2011/10/5': '1', + '2011/10/6': '1', + '2011/10/7': '1', + '2011/10/8': '2', + '2011/10/9': '2', + '2012/1/1': '1', + '2012/1/2': '1', + '2012/1/3': '1', + '2011/12/31': '2', + '2012/1/21': '2', + '2012/1/22': '1', + '2012/1/23': '1', + '2012/1/24': '1', + '2012/1/25': '1', + '2012/1/26': '1', + '2012/1/27': '1', + '2012/1/28': '1', + '2012/1/29': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2011-1-1' + 'startday': '2011/1/1' }, { 'name': '春节', - 'startday': '2011-1-30' + 'startday': '2011/1/30' }, { 'name': '清明节', - 'startday': '2011-4-2' + 'startday': '2011/4/2' }, { 'name': '劳动节', - 'startday': '2011-4-30' + 'startday': '2011/4/30' }, { 'name': '端午节', - 'startday': '2011-6-4' + 'startday': '2011/6/4' }, { 'name': '中秋节', - 'startday': '2011-9-10' + 'startday': '2011/9/10' }, { 'name': '国庆节', - 'startday': '2011-10-1' + 'startday': '2011/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2011-2-4' + 'date': '2011/2/4' }, { 'name': '雨水', - 'date': '2011-2-19' + 'date': '2011/2/19' }, { 'name': '惊蛰', - 'date': '2011-3-6' + 'date': '2011/3/6' }, { 'name': '春分', - 'date': '2011-3-21' + 'date': '2011/3/21' }, { 'name': '清明', - 'date': '2011-4-5' + 'date': '2011/4/5' }, { 'name': '谷雨', - 'date': '2011-4-20' + 'date': '2011/4/20' }, { 'name': '立夏', - 'date': '2011-5-6' + 'date': '2011/5/6' }, { 'name': '小满', - 'date': '2011-5-21' + 'date': '2011/5/21' }, { 'name': '芒种', - 'date': '2011-6-6' + 'date': '2011/6/6' }, { 'name': '夏至', - 'date': '2011-6-22' + 'date': '2011/6/22' }, { 'name': '小暑', - 'date': '2011-7-7' + 'date': '2011/7/7' }, { 'name': '大暑', - 'date': '2011-7-23' + 'date': '2011/7/23' }, { 'name': '立秋', - 'date': '2011-8-8' + 'date': '2011/8/8' }, { 'name': '处暑', - 'date': '2011-8-23' + 'date': '2011/8/23' }, { 'name': '白露', - 'date': '2011-9-8' + 'date': '2011/9/8' }, { 'name': '秋分', - 'date': '2011-9-23' + 'date': '2011/9/23' }, { 'name': '寒露', - 'date': '2011-10-8' + 'date': '2011/10/8' }, { 'name': '霜降', - 'date': '2011-10-24' + 'date': '2011/10/24' }, { 'name': '立冬', - 'date': '2011-11-8' + 'date': '2011/11/8' }, { 'name': '小雪', - 'date': '2011-11-23' + 'date': '2011/11/23' }, { 'name': '大雪', - 'date': '2011-12-7' + 'date': '2011/12/7' }, { 'name': '冬至', - 'date': '2011-12-22' + 'date': '2011/12/22' }, { 'name': '小寒', - 'date': '2011-1-6' + 'date': '2011/1/6' }, { 'name': '大寒', - 'date': '2011-1-20' + 'date': '2011/1/20' } ] }, '2012': { 'holiday': { - '2012-1-1': '1', - '2012-1-2': '1', - '2012-1-3': '1', - '2011-12-31': '2', - '2012-1-21': '2', - '2012-1-22': '1', - '2012-1-23': '1', - '2012-1-24': '1', - '2012-1-25': '1', - '2012-1-26': '1', - '2012-1-27': '1', - '2012-1-28': '1', - '2012-1-29': '2', - '2012-3-31': '2', - '2012-4-1': '2', - '2012-4-2': '1', - '2012-4-3': '1', - '2012-4-4': '1', - '2012-4-28': '2', - '2012-4-29': '1', - '2012-4-30': '1', - '2012-5-1': '1', - '2012-5-2': '2', - '2012-6-22': '1', - '2012-6-23': '1', - '2012-6-24': '1', - '2012-9-29': '2', - '2012-9-30': '1', - '2012-10-1': '1', - '2012-10-2': '1', - '2012-10-3': '1', - '2012-10-4': '1', - '2012-10-5': '1', - '2012-10-6': '1', - '2012-10-7': '1', - '2012-10-8': '2', - '2013-1-1': '1', - '2013-1-2': '1', - '2013-1-3': '1', - '2013-1-5': '2', - '2013-1-6': '2' + '2012/1/1': '1', + '2012/1/2': '1', + '2012/1/3': '1', + '2011/12/31': '2', + '2012/1/21': '2', + '2012/1/22': '1', + '2012/1/23': '1', + '2012/1/24': '1', + '2012/1/25': '1', + '2012/1/26': '1', + '2012/1/27': '1', + '2012/1/28': '1', + '2012/1/29': '2', + '2012/3/31': '2', + '2012/4/1': '2', + '2012/4/2': '1', + '2012/4/3': '1', + '2012/4/4': '1', + '2012/4/28': '2', + '2012/4/29': '1', + '2012/4/30': '1', + '2012/5/1': '1', + '2012/5/2': '2', + '2012/6/22': '1', + '2012/6/23': '1', + '2012/6/24': '1', + '2012/9/29': '2', + '2012/9/30': '1', + '2012/10/1': '1', + '2012/10/2': '1', + '2012/10/3': '1', + '2012/10/4': '1', + '2012/10/5': '1', + '2012/10/6': '1', + '2012/10/7': '1', + '2012/10/8': '2', + '2013/1/1': '1', + '2013/1/2': '1', + '2013/1/3': '1', + '2013/1/5': '2', + '2013/1/6': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2012-1-1' + 'startday': '2012/1/1' }, { 'name': '春节', - 'startday': '2012-1-21' + 'startday': '2012/1/21' }, { 'name': '清明节', - 'startday': '2012-3-31' + 'startday': '2012/3/31' }, { 'name': '劳动节', - 'startday': '2012-4-28' + 'startday': '2012/4/28' }, { 'name': '端午节', - 'startday': '2012-6-22' + 'startday': '2012/6/22' }, { 'name': '中秋节', - 'startday': '2012-9-29' + 'startday': '2012/9/29' }, { 'name': '国庆节', - 'startday': '2012-9-29' + 'startday': '2012/9/29' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2012-2-4' + 'date': '2012/2/4' }, { 'name': '雨水', - 'date': '2012-2-19' + 'date': '2012/2/19' }, { 'name': '惊蛰', - 'date': '2012-3-5' + 'date': '2012/3/5' }, { 'name': '春分', - 'date': '2012-3-20' + 'date': '2012/3/20' }, { 'name': '清明', - 'date': '2012-4-4' + 'date': '2012/4/4' }, { 'name': '谷雨', - 'date': '2012-4-20' + 'date': '2012/4/20' }, { 'name': '立夏', - 'date': '2012-5-5' + 'date': '2012/5/5' }, { 'name': '小满', - 'date': '2012-5-20' + 'date': '2012/5/20' }, { 'name': '芒种', - 'date': '2012-6-5' + 'date': '2012/6/5' }, { 'name': '夏至', - 'date': '2012-6-21' + 'date': '2012/6/21' }, { 'name': '小暑', - 'date': '2012-7-7' + 'date': '2012/7/7' }, { 'name': '大暑', - 'date': '2012-7-22' + 'date': '2012/7/22' }, { 'name': '立秋', - 'date': '2012-8-7' + 'date': '2012/8/7' }, { 'name': '处暑', - 'date': '2012-8-23' + 'date': '2012/8/23' }, { 'name': '白露', - 'date': '2012-9-7' + 'date': '2012/9/7' }, { 'name': '秋分', - 'date': '2012-9-22' + 'date': '2012/9/22' }, { 'name': '寒露', - 'date': '2012-10-8' + 'date': '2012/10/8' }, { 'name': '霜降', - 'date': '2012-10-23' + 'date': '2012/10/23' }, { 'name': '立冬', - 'date': '2012-11-7' + 'date': '2012/11/7' }, { 'name': '小雪', - 'date': '2012-11-22' + 'date': '2012/11/22' }, { 'name': '大雪', - 'date': '2012-12-7' + 'date': '2012/12/7' }, { 'name': '冬至', - 'date': '2012-12-21' + 'date': '2012/12/21' }, { 'name': '小寒', - 'date': '2012-1-6' + 'date': '2012/1/6' }, { 'name': '大寒', - 'date': '2012-1-21' + 'date': '2012/1/21' } ] }, '2013': { 'holiday': { - '2013-1-1': '1', - '2013-1-2': '1', - '2013-1-3': '1', - '2013-1-5': '2', - '2013-1-6': '2', - '2013-2-9': '1', - '2013-2-10': '1', - '2013-2-11': '1', - '2013-2-12': '1', - '2013-2-13': '1', - '2013-2-14': '1', - '2013-2-15': '1', - '2013-2-16': '2', - '2013-2-17': '2', - '2013-4-4': '1', - '2013-4-5': '1', - '2013-4-6': '1', - '2013-4-7': '2', - '2013-4-29': '1', - '2013-4-30': '1', - '2013-5-1': '1', - '2013-4-27': '2', - '2013-4-28': '2', - '2013-6-8': '2', - '2013-6-9': '2', - '2013-6-10': '1', - '2013-6-11': '1', - '2013-6-12': '1', - '2013-9-19': '1', - '2013-9-20': '1', - '2013-9-21': '1', - '2013-9-22': '2', - '2013-9-29': '2', - '2013-10-1': '1', - '2013-10-2': '1', - '2013-10-3': '1', - '2013-10-4': '1', - '2013-10-5': '1', - '2013-10-6': '1', - '2013-10-7': '1', - '2013-10-12': '2', - '2014-1-1': '1', - '2014-01-30': '0', - '2014-1-26': '2', - '2014-1-31': '1', - '2014-2-1': '1', - '2014-2-2': '1', - '2014-2-3': '1', - '2014-2-4': '1', - '2014-2-5': '1', - '2014-2-6': '1', - '2014-2-8': '2' + '2013/1/1': '1', + '2013/1/2': '1', + '2013/1/3': '1', + '2013/1/5': '2', + '2013/1/6': '2', + '2013/2/9': '1', + '2013/2/10': '1', + '2013/2/11': '1', + '2013/2/12': '1', + '2013/2/13': '1', + '2013/2/14': '1', + '2013/2/15': '1', + '2013/2/16': '2', + '2013/2/17': '2', + '2013/4/4': '1', + '2013/4/5': '1', + '2013/4/6': '1', + '2013/4/7': '2', + '2013/4/29': '1', + '2013/4/30': '1', + '2013/5/1': '1', + '2013/4/27': '2', + '2013/4/28': '2', + '2013/6/8': '2', + '2013/6/9': '2', + '2013/6/10': '1', + '2013/6/11': '1', + '2013/6/12': '1', + '2013/9/19': '1', + '2013/9/20': '1', + '2013/9/21': '1', + '2013/9/22': '2', + '2013/9/29': '2', + '2013/10/1': '1', + '2013/10/2': '1', + '2013/10/3': '1', + '2013/10/4': '1', + '2013/10/5': '1', + '2013/10/6': '1', + '2013/10/7': '1', + '2013/10/12': '2', + '2014/1/1': '1', + '2014/01/30': '0', + '2014/1/26': '2', + '2014/1/31': '1', + '2014/2/1': '1', + '2014/2/2': '1', + '2014/2/3': '1', + '2014/2/4': '1', + '2014/2/5': '1', + '2014/2/6': '1', + '2014/2/8': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2013-1-1' + 'startday': '2013/1/1' }, { 'name': '春节', - 'startday': '2013-2-10' + 'startday': '2013/2/10' }, { 'name': '清明节', - 'startday': '2013-4-4' + 'startday': '2013/4/4' }, { 'name': '劳动节', - 'startday': '2013-4-29' + 'startday': '2013/4/29' }, { 'name': '端午节', - 'startday': '2013-6-8' + 'startday': '2013/6/8' }, { 'name': '中秋节', - 'startday': '2013-9-19' + 'startday': '2013/9/19' }, { 'name': '国庆节', - 'startday': '2013-9-29' + 'startday': '2013/9/29' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2013-2-4' + 'date': '2013/2/4' }, { 'name': '雨水', - 'date': '2013-2-18' + 'date': '2013/2/18' }, { 'name': '惊蛰', - 'date': '2013-3-5' + 'date': '2013/3/5' }, { 'name': '春分', - 'date': '2013-3-20' + 'date': '2013/3/20' }, { 'name': '清明', - 'date': '2013-4-4' + 'date': '2013/4/4' }, { 'name': '谷雨', - 'date': '2013-4-20' + 'date': '2013/4/20' }, { 'name': '立夏', - 'date': '2013-5-5' + 'date': '2013/5/5' }, { 'name': '小满', - 'date': '2013-5-21' + 'date': '2013/5/21' }, { 'name': '芒种', - 'date': '2013-6-5' + 'date': '2013/6/5' }, { 'name': '夏至', - 'date': '2013-6-21' + 'date': '2013/6/21' }, { 'name': '小暑', - 'date': '2013-7-7' + 'date': '2013/7/7' }, { 'name': '大暑', - 'date': '2013-7-22' + 'date': '2013/7/22' }, { 'name': '立秋', - 'date': '2013-8-7' + 'date': '2013/8/7' }, { 'name': '处暑', - 'date': '2013-8-23' + 'date': '2013/8/23' }, { 'name': '白露', - 'date': '2013-9-7' + 'date': '2013/9/7' }, { 'name': '秋分', - 'date': '2013-9-23' + 'date': '2013/9/23' }, { 'name': '寒露', - 'date': '2013-10-8' + 'date': '2013/10/8' }, { 'name': '霜降', - 'date': '2013-10-23' + 'date': '2013/10/23' }, { 'name': '立冬', - 'date': '2013-11-7' + 'date': '2013/11/7' }, { 'name': '小雪', - 'date': '2013-11-22' + 'date': '2013/11/22' }, { 'name': '大雪', - 'date': '2013-12-7' + 'date': '2013/12/7' }, { 'name': '冬至', - 'date': '2013-12-22' + 'date': '2013/12/22' }, { 'name': '小寒', - 'date': '2013-1-5' + 'date': '2013/1/5' }, { 'name': '大寒', - 'date': '2013-1-20' + 'date': '2013/1/20' } ] }, '2014': { 'holiday': { - '2014-1-1': '1', - '2014-01-30': '0', - '2014-1-26': '2', - '2014-1-31': '1', - '2014-2-1': '1', - '2014-2-2': '1', - '2014-2-3': '1', - '2014-2-4': '1', - '2014-2-5': '1', - '2014-2-6': '1', - '2014-2-8': '2', - '2014-4-5': '1', - '2014-4-6': '1', - '2014-4-7': '1', - '2014-5-1': '1', - '2014-5-2': '1', - '2014-5-3': '1', - '2014-5-4': '2', - '2014-5-31': '1', - '2014-6-1': '1', - '2014-6-2': '1', - '2014-9-6': '1', - '2014-9-7': '1', - '2014-9-8': '1', - '2014-10-1': '1', - '2014-10-2': '1', - '2014-10-3': '1', - '2014-10-4': '1', - '2014-10-5': '1', - '2014-10-6': '1', - '2014-10-7': '1', - '2014-9-28': '2', - '2014-10-11': '2', - '2015-1-1': '1', - '2015-1-2': '1', - '2015-1-3': '1', - '2015-1-4': '2' + '2014/1/1': '1', + '2014/01/30': '0', + '2014/1/26': '2', + '2014/1/31': '1', + '2014/2/1': '1', + '2014/2/2': '1', + '2014/2/3': '1', + '2014/2/4': '1', + '2014/2/5': '1', + '2014/2/6': '1', + '2014/2/8': '2', + '2014/4/5': '1', + '2014/4/6': '1', + '2014/4/7': '1', + '2014/5/1': '1', + '2014/5/2': '1', + '2014/5/3': '1', + '2014/5/4': '2', + '2014/5/31': '1', + '2014/6/1': '1', + '2014/6/2': '1', + '2014/9/6': '1', + '2014/9/7': '1', + '2014/9/8': '1', + '2014/10/1': '1', + '2014/10/2': '1', + '2014/10/3': '1', + '2014/10/4': '1', + '2014/10/5': '1', + '2014/10/6': '1', + '2014/10/7': '1', + '2014/9/28': '2', + '2014/10/11': '2', + '2015/1/1': '1', + '2015/1/2': '1', + '2015/1/3': '1', + '2015/1/4': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2014-1-1' + 'startday': '2014/1/1' }, { 'name': '除夕', - 'startday': '2014-01-30' + 'startday': '2014/01/30' }, { 'name': '春节', - 'startday': '2014-1-31' + 'startday': '2014/1/31' }, { 'name': '清明节', - 'startday': '2014-4-5' + 'startday': '2014/4/5' }, { 'name': '劳动节', - 'startday': '2014-5-1' + 'startday': '2014/5/1' }, { 'name': '端午节', - 'startday': '2014-6-2' + 'startday': '2014/6/2' }, { 'name': '中秋节', - 'startday': '2014-9-8' + 'startday': '2014/9/8' }, { 'name': '国庆节', - 'startday': '2014-10-7' + 'startday': '2014/10/7' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2014-2-4' + 'date': '2014/2/4' }, { 'name': '雨水', - 'date': '2014-2-19' + 'date': '2014/2/19' }, { 'name': '惊蛰', - 'date': '2014-3-6' + 'date': '2014/3/6' }, { 'name': '春分', - 'date': '2014-3-21' + 'date': '2014/3/21' }, { 'name': '清明', - 'date': '2014-4-5' + 'date': '2014/4/5' }, { 'name': '谷雨', - 'date': '2014-4-20' + 'date': '2014/4/20' }, { 'name': '立夏', - 'date': '2014-5-5' + 'date': '2014/5/5' }, { 'name': '小满', - 'date': '2014-5-21' + 'date': '2014/5/21' }, { 'name': '芒种', - 'date': '2014-6-6' + 'date': '2014/6/6' }, { 'name': '夏至', - 'date': '2014-6-21' + 'date': '2014/6/21' }, { 'name': '小暑', - 'date': '2014-7-7' + 'date': '2014/7/7' }, { 'name': '大暑', - 'date': '2014-7-23' + 'date': '2014/7/23' }, { 'name': '立秋', - 'date': '2014-8-7' + 'date': '2014/8/7' }, { 'name': '处暑', - 'date': '2014-8-23' + 'date': '2014/8/23' }, { 'name': '白露', - 'date': '2014-9-8' + 'date': '2014/9/8' }, { 'name': '秋分', - 'date': '2014-9-23' + 'date': '2014/9/23' }, { 'name': '寒露', - 'date': '2014-10-8' + 'date': '2014/10/8' }, { 'name': '霜降', - 'date': '2014-10-23' + 'date': '2014/10/23' }, { 'name': '立冬', - 'date': '2014-11-7' + 'date': '2014/11/7' }, { 'name': '小雪', - 'date': '2014-11-22' + 'date': '2014/11/22' }, { 'name': '大雪', - 'date': '2014-12-7' + 'date': '2014/12/7' }, { 'name': '冬至', - 'date': '2014-12-22' + 'date': '2014/12/22' }, { 'name': '小寒', - 'date': '2014-1-5' + 'date': '2014/1/5' }, { 'name': '大寒', - 'date': '2014-1-20' + 'date': '2014/1/20' } ] }, '2015': { 'holiday': { - '2015-1-1': '1', - '2015-1-2': '1', - '2015-1-3': '1', - '2015-1-4': '2', - '2015-2-18': '1', - '2015-2-15': '2', - '2015-2-19': '1', - '2015-2-20': '1', - '2015-2-21': '1', - '2015-2-22': '1', - '2015-2-23': '1', - '2015-2-24': '1', - '2015-2-28': '2', - '2015-4-4': '1', - '2015-4-5': '1', - '2015-4-6': '1', - '2015-5-1': '1', - '2015-5-2': '1', - '2015-5-3': '1', - '2015-6-20': '1', - '2015-6-21': '1', - '2015-6-22': '1', - '2015-9-3': '1', - '2015-9-4': '1', - '2015-9-5': '1', - '2015-9-6': '2', - '2015-9-26': '1', - '2015-9-27': '1', - '2015-10-1': '1', - '2015-10-2': '1', - '2015-10-3': '1', - '2015-10-4': '1', - '2015-10-5': '1', - '2015-10-6': '1', - '2015-10-7': '1', - '2015-10-10': '2', - '2016-1-1': '1', - '2016-1-2': '1', - '2016-1-3': '1' + '2015/1/1': '1', + '2015/1/2': '1', + '2015/1/3': '1', + '2015/1/4': '2', + '2015/2/18': '1', + '2015/2/15': '2', + '2015/2/19': '1', + '2015/2/20': '1', + '2015/2/21': '1', + '2015/2/22': '1', + '2015/2/23': '1', + '2015/2/24': '1', + '2015/2/28': '2', + '2015/4/4': '1', + '2015/4/5': '1', + '2015/4/6': '1', + '2015/5/1': '1', + '2015/5/2': '1', + '2015/5/3': '1', + '2015/6/20': '1', + '2015/6/21': '1', + '2015/6/22': '1', + '2015/9/3': '1', + '2015/9/4': '1', + '2015/9/5': '1', + '2015/9/6': '2', + '2015/9/26': '1', + '2015/9/27': '1', + '2015/10/1': '1', + '2015/10/2': '1', + '2015/10/3': '1', + '2015/10/4': '1', + '2015/10/5': '1', + '2015/10/6': '1', + '2015/10/7': '1', + '2015/10/10': '2', + '2016/1/1': '1', + '2016/1/2': '1', + '2016/1/3': '1' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2015-1-1' + 'startday': '2015/1/1' }, { 'name': '除夕', - 'startday': '2015-2-18' + 'startday': '2015/2/18' }, { 'name': '春节', - 'startday': '2015-2-19' + 'startday': '2015/2/19' }, { 'name': '清明节', - 'startday': '2015-4-5' + 'startday': '2015/4/5' }, { 'name': '劳动节', - 'startday': '2015-5-1' + 'startday': '2015/5/1' }, { 'name': '端午节', - 'startday': '2015-6-20' + 'startday': '2015/6/20' }, { 'name': '胜利日', - 'startday': '2015-9-3' + 'startday': '2015/9/3' }, { 'name': '中秋节', - 'startday': '2015-9-27' + 'startday': '2015/9/27' }, { 'name': '国庆节', - 'startday': '2015-10-1' + 'startday': '2015/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2015-2-4' + 'date': '2015/2/4' }, { 'name': '雨水', - 'date': '2015-2-19' + 'date': '2015/2/19' }, { 'name': '惊蛰', - 'date': '2015-3-6' + 'date': '2015/3/6' }, { 'name': '春分', - 'date': '2015-3-21' + 'date': '2015/3/21' }, { 'name': '清明', - 'date': '2015-4-5' + 'date': '2015/4/5' }, { 'name': '谷雨', - 'date': '2015-4-20' + 'date': '2015/4/20' }, { 'name': '立夏', - 'date': '2015-5-6' + 'date': '2015/5/6' }, { 'name': '小满', - 'date': '2015-5-21' + 'date': '2015/5/21' }, { 'name': '芒种', - 'date': '2015-6-6' + 'date': '2015/6/6' }, { 'name': '夏至', - 'date': '2015-6-22' + 'date': '2015/6/22' }, { 'name': '小暑', - 'date': '2015-7-7' + 'date': '2015/7/7' }, { 'name': '大暑', - 'date': '2015-7-23' + 'date': '2015/7/23' }, { 'name': '立秋', - 'date': '2015-8-8' + 'date': '2015/8/8' }, { 'name': '处暑', - 'date': '2015-8-23' + 'date': '2015/8/23' }, { 'name': '白露', - 'date': '2015-9-8' + 'date': '2015/9/8' }, { 'name': '秋分', - 'date': '2015-9-23' + 'date': '2015/9/23' }, { 'name': '寒露', - 'date': '2015-10-8' + 'date': '2015/10/8' }, { 'name': '霜降', - 'date': '2015-10-24' + 'date': '2015/10/24' }, { 'name': '立冬', - 'date': '2015-11-8' + 'date': '2015/11/8' }, { 'name': '小雪', - 'date': '2015-11-22' + 'date': '2015/11/22' }, { 'name': '大雪', - 'date': '2015-12-7' + 'date': '2015/12/7' }, { 'name': '冬至', - 'date': '2015-12-22' + 'date': '2015/12/22' }, { 'name': '小寒', - 'date': '2015-1-6' + 'date': '2015/1/6' }, { 'name': '大寒', - 'date': '2015-1-20' + 'date': '2015/1/20' } ] }, '2016': { 'holiday': { - '2016-1-1': '1', - '2016-1-2': '1', - '2016-1-3': '1', - '2016-2-7': '1', - '2016-2-6': '2', - '2016-2-8': '1', - '2016-2-9': '1', - '2016-2-10': '1', - '2016-2-11': '1', - '2016-2-12': '1', - '2016-2-13': '1', - '2016-2-14': '2', - '2016-4-2': '1', - '2016-4-3': '1', - '2016-4-4': '1', - '2016-4-30': '1', - '2016-5-1': '1', - '2016-5-2': '1', - '2016-6-9': '1', - '2016-6-10': '1', - '2016-6-11': '1', - '2016-6-12': '2', - '2016-9-15': '1', - '2016-9-16': '1', - '2016-9-17': '1', - '2016-9-18': '2', - '2016-10-1': '1', - '2016-10-2': '1', - '2016-10-3': '1', - '2016-10-4': '1', - '2016-10-5': '1', - '2016-10-6': '1', - '2016-10-7': '1', - '2016-10-8': '2', - '2016-10-9': '2', - '2016-12-31': '1', - '2017-1-1': '1', - '2017-1-2': '1', - '2017-1-27': '1', - '2017-1-22': '2', - '2017-1-28': '1', - '2017-1-29': '1', - '2017-1-30': '1', - '2017-1-31': '1', - '2017-2-1': '1', - '2017-2-2': '1', - '2017-2-4': '2' + '2016/1/1': '1', + '2016/1/2': '1', + '2016/1/3': '1', + '2016/2/7': '1', + '2016/2/6': '2', + '2016/2/8': '1', + '2016/2/9': '1', + '2016/2/10': '1', + '2016/2/11': '1', + '2016/2/12': '1', + '2016/2/13': '1', + '2016/2/14': '2', + '2016/4/2': '1', + '2016/4/3': '1', + '2016/4/4': '1', + '2016/4/30': '1', + '2016/5/1': '1', + '2016/5/2': '1', + '2016/6/9': '1', + '2016/6/10': '1', + '2016/6/11': '1', + '2016/6/12': '2', + '2016/9/15': '1', + '2016/9/16': '1', + '2016/9/17': '1', + '2016/9/18': '2', + '2016/10/1': '1', + '2016/10/2': '1', + '2016/10/3': '1', + '2016/10/4': '1', + '2016/10/5': '1', + '2016/10/6': '1', + '2016/10/7': '1', + '2016/10/8': '2', + '2016/10/9': '2', + '2016/12/31': '1', + '2017/1/1': '1', + '2017/1/2': '1', + '2017/1/27': '1', + '2017/1/22': '2', + '2017/1/28': '1', + '2017/1/29': '1', + '2017/1/30': '1', + '2017/1/31': '1', + '2017/2/1': '1', + '2017/2/2': '1', + '2017/2/4': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2016-1-1' + 'startday': '2016/1/1' }, { 'name': '除夕', - 'startday': '2016-2-7' + 'startday': '2016/2/7' }, { 'name': '春节', - 'startday': '2016-2-7' + 'startday': '2016/2/7' }, { 'name': '清明节', - 'startday': '2016-4-4' + 'startday': '2016/4/4' }, { 'name': '劳动节', - 'startday': '2016-5-1' + 'startday': '2016/5/1' }, { 'name': '端午节', - 'startday': '2016-6-9' + 'startday': '2016/6/9' }, { 'name': '中秋节', - 'startday': '2016-9-15' + 'startday': '2016/9/15' }, { 'name': '国庆节', - 'startday': '2016-10-1' + 'startday': '2016/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2016-2-4' + 'date': '2016/2/4' }, { 'name': '雨水', - 'date': '2016-2-19' + 'date': '2016/2/19' }, { 'name': '惊蛰', - 'date': '2016-3-5' + 'date': '2016/3/5' }, { 'name': '春分', - 'date': '2016-3-20' + 'date': '2016/3/20' }, { 'name': '清明', - 'date': '2016-4-4' + 'date': '2016/4/4' }, { 'name': '谷雨', - 'date': '2016-4-19' + 'date': '2016/4/19' }, { 'name': '立夏', - 'date': '2016-5-5' + 'date': '2016/5/5' }, { 'name': '小满', - 'date': '2016-5-20' + 'date': '2016/5/20' }, { 'name': '芒种', - 'date': '2016-6-5' + 'date': '2016/6/5' }, { 'name': '夏至', - 'date': '2016-6-21' + 'date': '2016/6/21' }, { 'name': '小暑', - 'date': '2016-7-7' + 'date': '2016/7/7' }, { 'name': '大暑', - 'date': '2016-7-22' + 'date': '2016/7/22' }, { 'name': '立秋', - 'date': '2016-8-7' + 'date': '2016/8/7' }, { 'name': '处暑', - 'date': '2016-8-23' + 'date': '2016/8/23' }, { 'name': '白露', - 'date': '2016-9-7' + 'date': '2016/9/7' }, { 'name': '秋分', - 'date': '2016-9-22' + 'date': '2016/9/22' }, { 'name': '寒露', - 'date': '2016-10-8' + 'date': '2016/10/8' }, { 'name': '霜降', - 'date': '2016-10-23' + 'date': '2016/10/23' }, { 'name': '立冬', - 'date': '2016-11-7' + 'date': '2016/11/7' }, { 'name': '小雪', - 'date': '2016-11-22' + 'date': '2016/11/22' }, { 'name': '大雪', - 'date': '2016-12-7' + 'date': '2016/12/7' }, { 'name': '冬至', - 'date': '2016-12-21' + 'date': '2016/12/21' }, { 'name': '小寒', - 'date': '2016-1-6' + 'date': '2016/1/6' }, { 'name': '大寒', - 'date': '2016-1-20' + 'date': '2016/1/20' } ] }, '2017': { 'holiday': { - '2016-12-31': '1', - '2017-1-1': '1', - '2017-1-2': '1', - '2017-1-27': '1', - '2017-1-22': '2', - '2017-1-28': '1', - '2017-1-29': '1', - '2017-1-30': '1', - '2017-1-31': '1', - '2017-2-1': '1', - '2017-2-2': '1', - '2017-2-4': '2', - '2017-4-1': '2', - '2017-4-2': '1', - '2017-4-3': '1', - '2017-4-4': '1', - '2017-4-29': '1', - '2017-4-30': '1', - '2017-5-1': '1', - '2017-5-27': '2', - '2017-5-28': '1', - '2017-5-29': '1', - '2017-5-30': '1', - '2017-9-30': '2', - '2017-10-1': '1', - '2017-10-2': '1', - '2017-10-3': '1', - '2017-10-4': '1', - '2017-10-5': '1', - '2017-10-6': '1', - '2017-10-7': '1', - '2017-10-8': '1', - '2017-12-30': '1', - '2017-12-31': '1', - '2018-1-1': '1' + '2016/12/31': '1', + '2017/1/1': '1', + '2017/1/2': '1', + '2017/1/27': '1', + '2017/1/22': '2', + '2017/1/28': '1', + '2017/1/29': '1', + '2017/1/30': '1', + '2017/1/31': '1', + '2017/2/1': '1', + '2017/2/2': '1', + '2017/2/4': '2', + '2017/4/1': '2', + '2017/4/2': '1', + '2017/4/3': '1', + '2017/4/4': '1', + '2017/4/29': '1', + '2017/4/30': '1', + '2017/5/1': '1', + '2017/5/27': '2', + '2017/5/28': '1', + '2017/5/29': '1', + '2017/5/30': '1', + '2017/9/30': '2', + '2017/10/1': '1', + '2017/10/2': '1', + '2017/10/3': '1', + '2017/10/4': '1', + '2017/10/5': '1', + '2017/10/6': '1', + '2017/10/7': '1', + '2017/10/8': '1', + '2017/12/30': '1', + '2017/12/31': '1', + '2018/1/1': '1' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2017-1-1' + 'startday': '2017/1/1' }, { 'name': '除夕', - 'startday': '2017-1-27' + 'startday': '2017/1/27' }, { 'name': '春节', - 'startday': '2017-1-28' + 'startday': '2017/1/28' }, { 'name': '清明节', - 'startday': '2017-4-4' + 'startday': '2017/4/4' }, { 'name': '劳动节', - 'startday': '2017-5-1' + 'startday': '2017/5/1' }, { 'name': '端午节', - 'startday': '2017-5-30' + 'startday': '2017/5/30' }, { 'name': '国庆节', - 'startday': '2017-10-1' + 'startday': '2017/10/1' }, { 'name': '中秋节', - 'startday': '2017-10-4' + 'startday': '2017/10/4' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2017-2-3' + 'date': '2017/2/3' }, { 'name': '雨水', - 'date': '2017-2-18' + 'date': '2017/2/18' }, { 'name': '惊蛰', - 'date': '2017-3-5' + 'date': '2017/3/5' }, { 'name': '春分', - 'date': '2017-3-20' + 'date': '2017/3/20' }, { 'name': '清明', - 'date': '2017-4-4' + 'date': '2017/4/4' }, { 'name': '谷雨', - 'date': '2017-4-20' + 'date': '2017/4/20' }, { 'name': '立夏', - 'date': '2017-5-5' + 'date': '2017/5/5' }, { 'name': '小满', - 'date': '2017-5-21' + 'date': '2017/5/21' }, { 'name': '芒种', - 'date': '2017-6-5' + 'date': '2017/6/5' }, { 'name': '夏至', - 'date': '2017-6-21' + 'date': '2017/6/21' }, { 'name': '小暑', - 'date': '2017-7-7' + 'date': '2017/7/7' }, { 'name': '大暑', - 'date': '2017-7-22' + 'date': '2017/7/22' }, { 'name': '立秋', - 'date': '2017-8-7' + 'date': '2017/8/7' }, { 'name': '处暑', - 'date': '2017-8-23' + 'date': '2017/8/23' }, { 'name': '白露', - 'date': '2017-9-7' + 'date': '2017/9/7' }, { 'name': '秋分', - 'date': '2017-9-23' + 'date': '2017/9/23' }, { 'name': '寒露', - 'date': '2017-10-8' + 'date': '2017/10/8' }, { 'name': '霜降', - 'date': '2017-10-23' + 'date': '2017/10/23' }, { 'name': '立冬', - 'date': '2017-11-7' + 'date': '2017/11/7' }, { 'name': '小雪', - 'date': '2017-11-22' + 'date': '2017/11/22' }, { 'name': '大雪', - 'date': '2017-12-7' + 'date': '2017/12/7' }, { 'name': '冬至', - 'date': '2017-12-22' + 'date': '2017/12/22' }, { 'name': '小寒', - 'date': '2017-1-5' + 'date': '2017/1/5' }, { 'name': '大寒', - 'date': '2017-1-20' + 'date': '2017/1/20' } ] }, '2018': { 'holiday': { - '2017-12-30': '1', - '2017-12-31': '1', - '2018-1-1': '1', - '2018-2-15': '1', - '2018-2-11': '2', - '2018-2-16': '1', - '2018-2-17': '1', - '2018-2-18': '1', - '2018-2-19': '1', - '2018-2-20': '1', - '2018-2-21': '1', - '2018-2-24': '2', - '2018-4-5': '1', - '2018-4-6': '1', - '2018-4-7': '1', - '2018-4-8': '2', - '2018-4-28': '2', - '2018-4-29': '1', - '2018-4-30': '1', - '2018-5-1': '1', - '2018-6-16': '1', - '2018-6-17': '1', - '2018-6-18': '1', - '2018-9-22': '1', - '2018-9-23': '1', - '2018-9-24': '1', - '2018-10-1': '1', - '2018-10-2': '1', - '2018-10-3': '1', - '2018-10-4': '1', - '2018-10-5': '1', - '2018-10-6': '1', - '2018-10-7': '1', - '2018-9-29': '2', - '2018-9-30': '2', - '2018-12-29': '2', - '2018-12-31': '1', - '2019-1-1': '1', - '2018-12-30': '1' + '2017/12/30': '1', + '2017/12/31': '1', + '2018/1/1': '1', + '2018/2/15': '1', + '2018/2/11': '2', + '2018/2/16': '1', + '2018/2/17': '1', + '2018/2/18': '1', + '2018/2/19': '1', + '2018/2/20': '1', + '2018/2/21': '1', + '2018/2/24': '2', + '2018/4/5': '1', + '2018/4/6': '1', + '2018/4/7': '1', + '2018/4/8': '2', + '2018/4/28': '2', + '2018/4/29': '1', + '2018/4/30': '1', + '2018/5/1': '1', + '2018/6/16': '1', + '2018/6/17': '1', + '2018/6/18': '1', + '2018/9/22': '1', + '2018/9/23': '1', + '2018/9/24': '1', + '2018/10/1': '1', + '2018/10/2': '1', + '2018/10/3': '1', + '2018/10/4': '1', + '2018/10/5': '1', + '2018/10/6': '1', + '2018/10/7': '1', + '2018/9/29': '2', + '2018/9/30': '2', + '2018/12/29': '2', + '2018/12/31': '1', + '2019/1/1': '1', + '2018/12/30': '1' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2018-1-1' + 'startday': '2018/1/1' }, { 'name': '除夕', - 'startday': '2018-2-15' + 'startday': '2018/2/15' }, { 'name': '春节', - 'startday': '2018-2-16' + 'startday': '2018/2/16' }, { 'name': '清明节', - 'startday': '2018-4-5' + 'startday': '2018/4/5' }, { 'name': '劳动节', - 'startday': '2018-5-1' + 'startday': '2018/5/1' }, { 'name': '端午节', - 'startday': '2018-6-18' + 'startday': '2018/6/18' }, { 'name': '中秋节', - 'startday': '2018-9-24' + 'startday': '2018/9/24' }, { 'name': '国庆节', - 'startday': '2018-10-1' + 'startday': '2018/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2018-2-4' + 'date': '2018/2/4' }, { 'name': '雨水', - 'date': '2018-2-19' + 'date': '2018/2/19' }, { 'name': '惊蛰', - 'date': '2018-3-5' + 'date': '2018/3/5' }, { 'name': '春分', - 'date': '2018-3-21' + 'date': '2018/3/21' }, { 'name': '清明', - 'date': '2018-4-5' + 'date': '2018/4/5' }, { 'name': '谷雨', - 'date': '2018-4-20' + 'date': '2018/4/20' }, { 'name': '立夏', - 'date': '2018-5-5' + 'date': '2018/5/5' }, { 'name': '小满', - 'date': '2018-5-21' + 'date': '2018/5/21' }, { 'name': '芒种', - 'date': '2018-6-6' + 'date': '2018/6/6' }, { 'name': '夏至', - 'date': '2018-6-21' + 'date': '2018/6/21' }, { 'name': '小暑', - 'date': '2018-7-7' + 'date': '2018/7/7' }, { 'name': '大暑', - 'date': '2018-7-23' + 'date': '2018/7/23' }, { 'name': '立秋', - 'date': '2018-8-7' + 'date': '2018/8/7' }, { 'name': '处暑', - 'date': '2018-8-23' + 'date': '2018/8/23' }, { 'name': '白露', - 'date': '2018-9-8' + 'date': '2018/9/8' }, { 'name': '秋分', - 'date': '2018-9-23' + 'date': '2018/9/23' }, { 'name': '寒露', - 'date': '2018-10-8' + 'date': '2018/10/8' }, { 'name': '霜降', - 'date': '2018-10-23' + 'date': '2018/10/23' }, { 'name': '立冬', - 'date': '2018-11-7' + 'date': '2018/11/7' }, { 'name': '小雪', - 'date': '2018-11-22' + 'date': '2018/11/22' }, { 'name': '大雪', - 'date': '2018-12-7' + 'date': '2018/12/7' }, { 'name': '冬至', - 'date': '2018-12-22' + 'date': '2018/12/22' }, { 'name': '小寒', - 'date': '2018-1-5' + 'date': '2018/1/5' }, { 'name': '大寒', - 'date': '2018-1-20' + 'date': '2018/1/20' } ] }, '2019': { 'holiday': { - '2018-12-29': '2', - '2018-12-31': '1', - '2019-1-1': '1', - '2018-12-30': '1', - '2019-2-4': '1', - '2019-2-2': '2', - '2019-2-3': '2', - '2019-2-5': '1', - '2019-2-6': '1', - '2019-2-7': '1', - '2019-2-8': '1', - '2019-2-9': '1', - '2019-2-10': '1', - '2019-4-5': '1', - '2019-4-6': '1', - '2019-4-7': '1', - '2019-5-1': '1', - '2019-5-2': '1', - '2019-5-3': '1', - '2019-5-4': '1', - '2019-4-28': '2', - '2019-5-5': '2', - '2019-6-7': '1', - '2019-6-8': '1', - '2019-6-9': '1', - '2019-9-13': '1', - '2019-9-14': '1', - '2019-9-15': '1', - '2019-10-1': '1', - '2019-9-29': '2', - '2019-10-2': '1', - '2019-10-3': '1', - '2019-10-4': '1', - '2019-10-7': '1', - '2019-10-12': '2', - '2019-10-5': '1', - '2019-10-6': '1' + '2018/12/29': '2', + '2018/12/31': '1', + '2019/1/1': '1', + '2018/12/30': '1', + '2019/2/4': '1', + '2019/2/2': '2', + '2019/2/3': '2', + '2019/2/5': '1', + '2019/2/6': '1', + '2019/2/7': '1', + '2019/2/8': '1', + '2019/2/9': '1', + '2019/2/10': '1', + '2019/4/5': '1', + '2019/4/6': '1', + '2019/4/7': '1', + '2019/5/1': '1', + '2019/5/2': '1', + '2019/5/3': '1', + '2019/5/4': '1', + '2019/4/28': '2', + '2019/5/5': '2', + '2019/6/7': '1', + '2019/6/8': '1', + '2019/6/9': '1', + '2019/9/13': '1', + '2019/9/14': '1', + '2019/9/15': '1', + '2019/10/1': '1', + '2019/9/29': '2', + '2019/10/2': '1', + '2019/10/3': '1', + '2019/10/4': '1', + '2019/10/7': '1', + '2019/10/12': '2', + '2019/10/5': '1', + '2019/10/6': '1' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2019-1-1' + 'startday': '2019/1/1' }, { 'name': '除夕', - 'startday': '2019-2-4' + 'startday': '2019/2/4' }, { 'name': '春节', - 'startday': '2019-2-4' + 'startday': '2019/2/4' }, { 'name': '清明节', - 'startday': '2019-4-5' + 'startday': '2019/4/5' }, { 'name': '劳动节', - 'startday': '2019-5-1' + 'startday': '2019/5/1' }, { 'name': '端午节', - 'startday': '2019-6-7' + 'startday': '2019/6/7' }, { 'name': '中秋节', - 'startday': '2019-9-13' + 'startday': '2019/9/13' }, { 'name': '国庆节', - 'startday': '2019-10-1' + 'startday': '2019/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2019-2-4' + 'date': '2019/2/4' }, { 'name': '雨水', - 'date': '2019-2-19' + 'date': '2019/2/19' }, { 'name': '惊蛰', - 'date': '2019-3-6' + 'date': '2019/3/6' }, { 'name': '春分', - 'date': '2019-3-21' + 'date': '2019/3/21' }, { 'name': '清明', - 'date': '2019-4-5' + 'date': '2019/4/5' }, { 'name': '谷雨', - 'date': '2019-4-20' + 'date': '2019/4/20' }, { 'name': '立夏', - 'date': '2019-5-6' + 'date': '2019/5/6' }, { 'name': '小满', - 'date': '2019-5-21' + 'date': '2019/5/21' }, { 'name': '芒种', - 'date': '2019-6-6' + 'date': '2019/6/6' }, { 'name': '夏至', - 'date': '2019-6-21' + 'date': '2019/6/21' }, { 'name': '小暑', - 'date': '2019-7-7' + 'date': '2019/7/7' }, { 'name': '大暑', - 'date': '2019-7-23' + 'date': '2019/7/23' }, { 'name': '立秋', - 'date': '2019-8-8' + 'date': '2019/8/8' }, { 'name': '处暑', - 'date': '2019-8-23' + 'date': '2019/8/23' }, { 'name': '白露', - 'date': '2019-9-8' + 'date': '2019/9/8' }, { 'name': '秋分', - 'date': '2019-9-23' + 'date': '2019/9/23' }, { 'name': '寒露', - 'date': '2019-10-8' + 'date': '2019/10/8' }, { 'name': '霜降', - 'date': '2019-10-24' + 'date': '2019/10/24' }, { 'name': '立冬', - 'date': '2019-11-8' + 'date': '2019/11/8' }, { 'name': '小雪', - 'date': '2019-11-22' + 'date': '2019/11/22' }, { 'name': '大雪', - 'date': '2019-12-7' + 'date': '2019/12/7' }, { 'name': '冬至', - 'date': '2019-12-22' + 'date': '2019/12/22' }, { 'name': '小寒', - 'date': '2019-1-5' + 'date': '2019/1/5' }, { 'name': '大寒', - 'date': '2019-1-20' + 'date': '2019/1/20' } ] }, '2020': { 'holiday': { - '2020-1-1': '1', - '2020-1-24': '1', - '2020-1-25': '1', - '2020-1-26': '1', - '2020-1-27': '1', - '2020-1-28': '1', - '2020-1-29': '1', - '2020-1-30': '1', - '2020-1-19': '2', - '2020-2-1': '2', - '2020-4-4': '1', - '2020-4-5': '1', - '2020-4-6': '1', - '2020-5-1': '1', - '2020-5-2': '1', - '2020-5-3': '1', - '2020-5-4': '1', - '2020-5-5': '1', - '2020-4-26': '2', - '2020-5-9': '2', - '2020-6-25': '1', - '2020-6-26': '1', - '2020-6-27': '1', - '2020-6-28': '2', - '2020-10-1': '1', - '2020-10-2': '1', - '2020-10-3': '1', - '2020-10-4': '1', - '2020-10-5': '1', - '2020-10-6': '1', - '2020-10-7': '1', - '2020-10-8': '1', - '2020-9-27': '2', - '2020-10-10': '2' + '2020/1/1': '1', + '2020/1/24': '1', + '2020/1/25': '1', + '2020/1/26': '1', + '2020/1/27': '1', + '2020/1/28': '1', + '2020/1/29': '1', + '2020/1/30': '1', + '2020/1/19': '2', + '2020/2/1': '2', + '2020/4/4': '1', + '2020/4/5': '1', + '2020/4/6': '1', + '2020/5/1': '1', + '2020/5/2': '1', + '2020/5/3': '1', + '2020/5/4': '1', + '2020/5/5': '1', + '2020/4/26': '2', + '2020/5/9': '2', + '2020/6/25': '1', + '2020/6/26': '1', + '2020/6/27': '1', + '2020/6/28': '2', + '2020/10/1': '1', + '2020/10/2': '1', + '2020/10/3': '1', + '2020/10/4': '1', + '2020/10/5': '1', + '2020/10/6': '1', + '2020/10/7': '1', + '2020/10/8': '1', + '2020/9/27': '2', + '2020/10/10': '2' }, 'holidaylist': [ { 'name': '元旦', - 'startday': '2020-1-1' + 'startday': '2020/1/1' }, { 'name': '除夕', - 'startday': '2020-1-24' + 'startday': '2020/1/24' }, { 'name': '春节', - 'startday': '2020-1-25' + 'startday': '2020/1/25' }, { 'name': '清明节', - 'startday': '2020-4-4' + 'startday': '2020/4/4' }, { 'name': '劳动节', - 'startday': '2020-5-1' + 'startday': '2020/5/1' }, { 'name': '端午节', - 'startday': '2020-6-25' + 'startday': '2020/6/25' }, { 'name': '中秋节', - 'startday': '2020-10-1' + 'startday': '2020/10/1' }, { 'name': '国庆节', - 'startday': '2020-10-1' + 'startday': '2020/10/1' } ], 'solarTerms': [ { 'name': '立春', - 'date': '2020-2-4' + 'date': '2020/2/4' }, { 'name': '雨水', - 'date': '2020-2-19' + 'date': '2020/2/19' }, { 'name': '惊蛰', - 'date': '2020-3-5' + 'date': '2020/3/5' }, { 'name': '春分', - 'date': '2020-3-20' + 'date': '2020/3/20' }, { 'name': '清明', - 'date': '2020-4-4' + 'date': '2020/4/4' }, { 'name': '谷雨', - 'date': '2020-4-19' + 'date': '2020/4/19' }, { 'name': '立夏', - 'date': '2020-5-5' + 'date': '2020/5/5' }, { 'name': '小满', - 'date': '2020-5-20' + 'date': '2020/5/20' }, { 'name': '芒种', - 'date': '2020-6-5' + 'date': '2020/6/5' }, { 'name': '夏至', - 'date': '2020-6-21' + 'date': '2020/6/21' }, { 'name': '小暑', - 'date': '2020-7-6' + 'date': '2020/7/6' }, { 'name': '大暑', - 'date': '2020-7-22' + 'date': '2020/7/22' }, { 'name': '立秋', - 'date': '2020-8-7' + 'date': '2020/8/7' }, { 'name': '处暑', - 'date': '2020-8-22' + 'date': '2020/8/22' }, { 'name': '白露', - 'date': '2020-9-7' + 'date': '2020/9/7' }, { 'name': '秋分', - 'date': '2020-9-22' + 'date': '2020/9/22' }, { 'name': '寒露', - 'date': '2020-10-8' + 'date': '2020/10/8' }, { 'name': '霜降', - 'date': '2020-10-23' + 'date': '2020/10/23' }, { 'name': '立冬', - 'date': '2020-11-7' + 'date': '2020/11/7' }, { 'name': '小雪', - 'date': '2020-11-22' + 'date': '2020/11/22' }, { 'name': '大雪', - 'date': '2020-12-7' + 'date': '2020/12/7' }, { 'name': '冬至', - 'date': '2020-12-21' + 'date': '2020/12/21' }, { 'name': '小寒', - 'date': '2020-1-6' + 'date': '2020/1/6' }, { 'name': '大寒', - 'date': '2020-1-20' + 'date': '2020/1/20' } ] } diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index 5e86b4456..e1a4e654e 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -141,6 +141,10 @@ $basic-color: #4284f5 !default; display: flex; border: none; + &--large { + width: 1000px; + } + .hi-datepicker__panel { flex: 1; } @@ -148,6 +152,10 @@ $basic-color: #4284f5 !default; &--shortcuts { width: 683px; + + &--large { + width: 1060px; + } } } @@ -237,6 +245,10 @@ $basic-color: #4284f5 !default; .hi-datepicker__cell { width: 92px; + &--large { + width: 160px; + } + &.today { .hi-datepicker__text { background: $basic-color; @@ -303,15 +315,6 @@ $basic-color: #4284f5 !default; width: 36px; height: 24px; - &--large { - width: 56px; - padding-right: 8px; - - &--laster { - padding-right: 4px; - } - } - &.disabled { .hi-datepicker__content { cursor: not-allowed; @@ -320,7 +323,7 @@ $basic-color: #4284f5 !default; } } - &.range-se:not(.prev):not(.next) { + &.range-se:not(.prev):not(.next):not(.hi-datepicker__cell--large) { .hi-datepicker__content { margin: 0 3px; background: $basic-color; @@ -329,7 +332,20 @@ $basic-color: #4284f5 !default; } } - .hi-datepicker__text--lunarCalendar { + &--large { + width: 56px; + padding: 4px 8px; + + &--laster { + padding: 4px; + } + + &:hover { + background-color: rgba(66, 142, 245, 0.1); + } + } + + .hi-datepicker__text--showLunar { font-size: 12px; color: rgba(44, 48, 78, 0.2); @@ -343,8 +359,8 @@ $basic-color: #4284f5 !default; width: 0; font-size: 12px; position: relative; - top: -28px; - right: -28px; + top: -32px; + right: -30px; color: #1da653; &--work { @@ -352,8 +368,8 @@ $basic-color: #4284f5 !default; width: 0; font-size: 12px; position: relative; - top: -28px; - right: -28px; + top: -32px; + right: -30px; color: #f63; } } @@ -625,6 +641,20 @@ $basic-color: #4284f5 !default; color: #fff; } } + + .hi-datepicker__cell--large.range-se { + border-radius: 2px; + background: map-get(get-palette($value), '50'); + + .hi-datepicker__content { + color: #fff; + margin: 0 3px; + } + + .hi-datepicker__text { + color: #fff; + } + } } } @@ -650,7 +680,7 @@ $basic-color: #4284f5 !default; } } - &:hover:not(.today):not(.current):not(.in-range):not(.range-se):not(.disabled) { + &:hover:not(.today):not(.current):not(.in-range):not(.range-se):not(.disabled):not(.hi-datepicker__cell--large) { .hi-datepicker__text { // TODO: 色板值 background: rgba(66, 142, 245, 0.1); diff --git a/docs/demo/date-picker/section-normal.jsx b/docs/demo/date-picker/section-normal.jsx index d201cfe84..9c3250200 100644 --- a/docs/demo/date-picker/section-normal.jsx +++ b/docs/demo/date-picker/section-normal.jsx @@ -15,7 +15,7 @@ class Demo extends React.Component { return (
{console.log('onChange', date, dateStr)}} /> diff --git a/docs/zh-CN/components/date-picker.mdx b/docs/zh-CN/components/date-picker.mdx index a3c8e097d..55600fa5a 100755 --- a/docs/zh-CN/components/date-picker.mdx +++ b/docs/zh-CN/components/date-picker.mdx @@ -97,7 +97,7 @@ import DemoModal from '../../demo/date-picker/section-modal.jsx' | disabled | 是否禁用输入框 | boolean | true \| false | false | | clearable | 是否可以清空 | boolean | true \| false | true | | showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | -| lunarCalendar | 是否在日期选择器中显示农历 | boolean | true \| false | false | +| showLunar | 是否在日期选择器中显示农历 | boolean | true \| false | false | | shortcuts | 快捷面板 | string[] | 近一周, 近一月, 近三月, 近一年 | null | | weekOffset | 周起始
默认周日做为第一列 | number | 0 \| 1 | 0 | | placeholder | 自定义占位符
数组用于范围日期 | string \| string[] | - | - | From 45bb3975ca00d046bba34137fdc10d49fb2717fe Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Tue, 7 Jan 2020 17:58:33 +0800 Subject: [PATCH 005/115] feat: datapicker --- components/date-picker/Calender.js | 38 +-- components/date-picker/DatePanel.js | 5 + components/date-picker/style/index.scss | 360 +++++++++++++++++++++--- 3 files changed, 341 insertions(+), 62 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index f447c2943..1198435af 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -138,7 +138,6 @@ class Calender extends Component { } handlerClick (e) { const {onPick, date, type, range} = this.props - let { year, month, day, hours, minutes, seconds } = deconstructDate(date) const td = e.target @@ -255,11 +254,13 @@ class Calender extends Component { const _value = type === 'year' ? 1 : value const LunarInfo = Lunar.toLunar(_year, _month, _value) - const lunarcellinfo = type === 'month' ? {} : this.isHoliday(_year, _year + '/' + _month + '/' + _value) + const lunarcellinfo = this.isHoliday(_year, _year + '/' + _month + '/' + _value) if (type === 'year') { delete lunarcellinfo.status lunarcellinfo.Lunar = LunarInfo[3] + '-' + LunarInfo[4] + } else if (type === 'month') { + delete lunarcellinfo.status } else { lunarcellinfo.Lunar = LunarInfo[6] } @@ -291,17 +292,17 @@ class Calender extends Component { const fullTimeInfo = this.getFullTime(td.value, _class) if (fullTimeInfo.status) { return ( - + { - fullTimeInfo.status === 1 ? : null + fullTimeInfo.status === 1 ? : null } { - fullTimeInfo.status === 2 ? : null + fullTimeInfo.status === 2 ? : null } {fullTimeInfo.name || fullTimeInfo.Lunar} - + ) } else { return ( @@ -400,19 +401,20 @@ class Calender extends Component { value={cell.value} className={this.getTDClass(cell, _index)} > -
- - {cell.text || cell.value} - -
- { - showLunarStatus(this.props) &&
- { - this.ToLunar(cell) - } +
+
+ + {cell.text || cell.value} +
- } - + { + showLunarStatus(this.props) &&
+ { + this.ToLunar(cell) + } +
+ } +
) }) diff --git a/components/date-picker/DatePanel.js b/components/date-picker/DatePanel.js index 23809bdce..a514e302a 100644 --- a/components/date-picker/DatePanel.js +++ b/components/date-picker/DatePanel.js @@ -157,6 +157,11 @@ class DatePanel extends Component { const { type, onPick } = this.props if (type === 'month') { onPick(_date) + } else if (type === 'week') { + this.setState({ + currentView: 'week' + }) + onPick(_date, true) } else { this.setState({ currentView: 'date' diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index e1a4e654e..5e3510aa8 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -118,7 +118,7 @@ $basic-color: #4284f5 !default; width: 288px; &--large { - width: 488px; + width: 432px; } &--hastime { @@ -142,7 +142,42 @@ $basic-color: #4284f5 !default; border: none; &--large { - width: 1000px; + width: 866px; + + .hi-datepicker__cell.range-se.hi-datepicker__cell--large { + background-color: #fff; + + .hi-datepicker__content__wrap { + background-color: #4285f4; + + .hi-datepicker__text——holiday { + color: #fff; + + &--work { + color: #fff; + } + } + + .hi-datepicker__text--showLunar { + color: #fff; + } + + .hi-datepicker__content { + background: none; + color: #fff; + } + } + + &.today { + background: none; + + .hi-datepicker__content__wrap { + background-color: #4285f4; + opacity: 1; + border: none; + } + } + } } .hi-datepicker__panel { @@ -234,6 +269,42 @@ $basic-color: #4284f5 !default; &__calender-container { padding: 17px 18px 15px; + &--date { + .hi-datepicker__cell { + &.today:not(.in-range) { + &:not(.hi-datepicker__cell--large) .hi-datepicker__content__wrap { + .hi-datepicker__content { + width: 24px; + height: 24px; + box-sizing: border-box; + } + } + } + + &.current:not(.in-range) { + &:not(.hi-datepicker__cell--large) .hi-datepicker__content__wrap { + .hi-datepicker__content { + width: 24px; + height: 24px; + } + } + } + } + + .hi-datepicker__cell.in-range:not(.range-se) { + padding: 4px 0; + + .hi-datepicker__content__wrap { + width: 100%; + background: rgba(66, 142, 245, 0.1); + + .hi-datepicker__content { + background: none; + } + } + } + } + &--year, &--month { padding: 10px 5px; @@ -244,30 +315,120 @@ $basic-color: #4284f5 !default; .hi-datepicker__cell { width: 92px; + padding-left: 24px; + + &.today { + .hi-datepicker__content__wrap { + .hi-datepicker__content { + background: $basic-color; + opacity: 1; + color: #fff; + } + } + } + + &:not(.hi-datepicker__cell--large) .hi-datepicker__content__wrap { + width: 48px; + + .hi-datepicker__content { + width: 48px; + } + } + } + } + + &--year { + .hi-datepicker__cell { + width: 92px; + padding-left: 24px; &--large { width: 160px; - } + padding-left: 38px; - &.today { - .hi-datepicker__text { - background: $basic-color; - opacity: 1; - color: #fff; + .hi-datepicker__content__wrap { + width: 56px; } } } + } - .hi-datepicker__text { - width: 48px; + &--month { + .hi-datepicker__cell { + &--large { + padding-left: 48px; + + .hi-datepicker__content__wrap { + width: 52px; + } + + .hi-datepicker__content--showLunar { + padding-bottom: 0; + } + } } } &--week { .hi-datepicker__row { - &:hover { + .hi-datepicker__cell:not(.range-se) .hi-datepicker__content__wrap { .hi-datepicker__content { - background: rgba(66, 132, 245, 0.1); + width: 100%; + } + + // &:hover { + // .hi-datepicker__content { + // background: rgba(66, 132, 245, 0.1); + // } + // } + } + + &:not(.hi-datepicker__row--current-week):hover { + // .hi-datepicker__cell:not(.range-se) { + // padding: 4px 0; + + // .hi-datepicker__content__wrap { + // width: 100%; + // } + // } + background: rgba(66, 132, 245, 0.1); + + .hi-datepicker__content__wrap:hover { + background: none; + + .hi-datepicker__content:hover { + background: none; + } + } + } + + &--current-week { + .hi-datepicker__cell.range-se.hi-datepicker__cell--large { + background-color: #fff; + + .hi-datepicker__content__wrap { + background-color: #4285f4; + + .hi-datepicker__text——holiday { + color: #fff; + + &--work { + color: #fff; + } + } + + .hi-datepicker__text--showLunar { + color: #fff; + } + } + } + + .hi-datepicker__cell.in-range.hi-datepicker__cell--large:not(.range-se) { + padding: 4px 0; + + .hi-datepicker__content__wrap { + width: 100%; + } } } } @@ -310,10 +471,8 @@ $basic-color: #4284f5 !default; &__cell { cursor: pointer; text-align: center; - line-height: 24px; padding: 4px 0; width: 36px; - height: 24px; &.disabled { .hi-datepicker__content { @@ -323,9 +482,37 @@ $basic-color: #4284f5 !default; } } + &.hi-datepicker__cell--large { + .hi-datepicker__content__wrap { + border-radius: 2px; + + &:hover { + background-color: rgba(66, 142, 245, 0.1); + } + } + } + + &:not(.hi-datepicker__cell--large):not(.disabled) { + .hi-datepicker__content { + margin: auto; + width: 24px; + + &:hover { + border-radius: 2px; + background-color: rgba(66, 142, 245, 0.1); + } + } + } + &.range-se:not(.prev):not(.next):not(.hi-datepicker__cell--large) { + .hi-datepicker__content__wrap { + &:hover { + background-color: rgba(66, 142, 245, 0.1); + } + } + .hi-datepicker__content { - margin: 0 3px; + // margin: 0 3px; background: $basic-color; color: #fff; border-radius: 2px; @@ -333,18 +520,33 @@ $basic-color: #4284f5 !default; } &--large { - width: 56px; - padding: 4px 8px; + width: 48px; + height: 48px; + padding: 4px; + + &.disabled { + padding: 4px 0; + + .hi-datepicker__content__wrap { + width: 56px; + color: #a8aaaf; + background: #f6f6f6; + } + } &--laster { - padding: 4px; + padding: 0 4px; } - &:hover { - background-color: rgba(66, 142, 245, 0.1); + .hi-datepicker__content__wrap { + width: 48px; } } + .hi-datepicker__content--showLunar { + padding-bottom: 3px; + } + .hi-datepicker__text--showLunar { font-size: 12px; color: rgba(44, 48, 78, 0.2); @@ -355,25 +557,30 @@ $basic-color: #4284f5 !default; } .hi-datepicker__text——holiday { - display: inline-block; + display: block; width: 0; + height: 0; font-size: 12px; position: relative; - top: -32px; - right: -30px; - color: #1da653; + top: -26px; + right: -36px; + + &--rest { + color: #1da653; + } &--work { - display: inline-block; - width: 0; - font-size: 12px; - position: relative; - top: -32px; - right: -30px; color: #f63; } } + // .hi-datepicker__cell--large--laster { + // .hi-datepicker__text——holiday { + // top: -28px; + // right: -26px; + // } + // } + &.prev, &.next { .hi-datepicker__text { @@ -388,26 +595,68 @@ $basic-color: #4284f5 !default; // } &.today:not(.in-range) { - .hi-datepicker__text { + .hi-datepicker__content__wrap { + .hi-datepicker__content { + border-radius: 2px; + margin: auto; + border: 1px solid $basic-color; + opacity: 0.8; + } + } + } + + &.today:not(.in-range).hi-datepicker__cell--large { + .hi-datepicker__content__wrap { + border-radius: 2px; + margin: auto; border: 1px solid $basic-color; opacity: 0.8; + box-sizing: border-box; + + .hi-datepicker__content { + border: none; + } } } &.current:not(.in-range) { + &:not(.hi-datepicker__cell--large) .hi-datepicker__content__wrap { + .hi-datepicker__content { + border-radius: 2px; + margin: auto; + background-color: $basic-color; + } + } + + &.hi-datepicker__cell--large { + .hi-datepicker__content__wrap { + background-color: $basic-color; + } + } + .hi-datepicker__text { - background: $basic-color; color: #fff; } + + .hi-datepicker__text--showLunar { + color: #fff; + } + + .hi-datepicker__text——holiday { + color: #fff; + + &--work { + color: #fff; + } + } } } &__text { display: inline-block; - width: 24px; height: 24px; - box-sizing: border-box; - border-radius: 2px; + // box-sizing: border-box; + // border-radius: 2px; } &__shortcuts { @@ -612,10 +861,33 @@ $basic-color: #4284f5 !default; &__calender-container--month { .hi-datepicker__cell { &.today { - .hi-datepicker__text { - border: 1px solid map-get(get-palette($value), '50') !important; - color: map-get(get-palette($value), '50') !important; - background: #fff !important; + .hi-datepicker__content__wrap { + color: map-get(get-palette($value), '50'); + background: #fff; + margin: inherit; + + .hi-datepicker__content { + box-sizing: border-box; + border: 1px solid map-get(get-palette($value), '50'); + background-color: #fff; + color: #333; + } + } + + &.hi-datepicker__cell--large { + .hi-datepicker__content__wrap { + box-sizing: border-box; + border: 1px solid map-get(get-palette($value), '50'); + color: map-get(get-palette($value), '50'); + background: #fff; + margin: inherit; + + .hi-datepicker__content { + border: none; + background-color: #fff; + color: #333; + } + } } } } @@ -633,7 +905,7 @@ $basic-color: #4284f5 !default; .hi-datepicker__content { background: map-get(get-palette($value), '50'); color: #fff; - margin: 0 3px; + // margin: 0 3px; border-radius: 2px; } @@ -648,7 +920,7 @@ $basic-color: #4284f5 !default; .hi-datepicker__content { color: #fff; - margin: 0 3px; + // margin: 0 3px; } .hi-datepicker__text { @@ -666,7 +938,7 @@ $basic-color: #4284f5 !default; // } // } - &.in-range:not(.next):not(.prev) { + &.in-range { .hi-datepicker__content { // TODO: 色板值 // background: map-get(get-palette($value), '10'); @@ -674,7 +946,7 @@ $basic-color: #4284f5 !default; } } - &.range-se:not(.next):not(.prev) { + &.range-se:not(.next):not(.prev):not(.hi-datepicker__cell--large) { .hi-datepicker__content { background: map-get(get-palette($value), '50'); } @@ -683,7 +955,7 @@ $basic-color: #4284f5 !default; &:hover:not(.today):not(.current):not(.in-range):not(.range-se):not(.disabled):not(.hi-datepicker__cell--large) { .hi-datepicker__text { // TODO: 色板值 - background: rgba(66, 142, 245, 0.1); + // background: rgba(66, 142, 245, 0.1); // background: map-get(get-palette($value), '10'); } } From 7c977e2410ec5350bf778eaf9d126477523db96b Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Thu, 9 Jan 2020 11:52:39 +0800 Subject: [PATCH 006/115] fix: add preset --- components/date-picker/Calender.js | 42 +- components/date-picker/DatePanel.js | 18 +- components/date-picker/DateRangePanel.js | 22 +- components/date-picker/WeekRangePanel.js | 10 + components/date-picker/dateUtil.js | 11 +- components/date-picker/holidaylist.js | 2877 ---------------------- components/date-picker/style/index.scss | 69 +- components/date-picker/toLunar.js | 6 +- components/date-picker/util.js | 21 + components/table/index.js | 6 + docs/demo/date-picker/section-normal.jsx | 4 +- docs/zh-CN/components/date-picker.mdx | 16 +- 12 files changed, 181 insertions(+), 2921 deletions(-) delete mode 100644 components/date-picker/holidaylist.js diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 1198435af..709bc86a2 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -1,8 +1,7 @@ import React, {Component} from 'react' -import {deconstructDate, getYearWeek} from './util' +import { deconstructDate, getYearWeek, showLunarStatus, getPRCDate } from './util' import Provider from '../context' import Lunar from './toLunar' -import holidaylist from './holidaylist' import {DAY_MILLISECONDS} from './constants' import { getDaysInMonth, @@ -17,18 +16,37 @@ import { getYear, getMonth, toDate, - isValid, - showLunarStatus + isValid } from './dateUtil' class Calender extends Component { constructor (props) { super(props) this.state = { - rows: [[], [], [], [], [], []] + rows: [[], [], [], [], [], []], + altCalendarPresetData: {} } this.weekNum = 0 + this._getPresetData() } + _getPresetData () { + this.props.altCalendarPreset && getPRCDate(this.props.altCalendarPreset).then(res => { + const _allPRCDate = {} + Object.keys(res.data).forEach(key => { + let oneYear + res.data[key].PRCLunar.forEach(item => { + Object.assign(oneYear, { + [item.date.replace('/-/g', '/')]: item.text + }) + }) + Object.assign(_allPRCDate, oneYear) + }) + this.setState({ + altCalendarPresetData: res.data + }) + }) + } + _getTime (week, y, m) { const r = new Date(y, m - 1, 1) const t = r.getTime() - week * DAY_MILLISECONDS @@ -199,10 +217,12 @@ class Calender extends Component { } /** * 是否是节假日 - * @param {string} date yyyy-MM-dd + * @param {string} date yyyy/MM/dd * @param {string} year yyyy */ isHoliday (year, date) { + const holidaylist = {} + const holidayBase = holidaylist[year] const holidayInfo = {} const reg = /[\u4E00-\u9FA5]+/ @@ -252,10 +272,8 @@ class Calender extends Component { const _year = getYear(newDate) const _month = getMonth(newDate) + 1 const _value = type === 'year' ? 1 : value - const LunarInfo = Lunar.toLunar(_year, _month, _value) const lunarcellinfo = this.isHoliday(_year, _year + '/' + _month + '/' + _value) - if (type === 'year') { delete lunarcellinfo.status lunarcellinfo.Lunar = LunarInfo[3] + '-' + LunarInfo[4] @@ -306,10 +324,8 @@ class Calender extends Component { ) } else { return ( - - - {fullTimeInfo.Lunar} - + + {fullTimeInfo.Lunar} ) } @@ -401,7 +417,7 @@ class Calender extends Component { value={cell.value} className={this.getTDClass(cell, _index)} > -
+
{cell.text || cell.value} diff --git a/components/date-picker/DatePanel.js b/components/date-picker/DatePanel.js index a514e302a..dda77461a 100644 --- a/components/date-picker/DatePanel.js +++ b/components/date-picker/DatePanel.js @@ -1,11 +1,11 @@ import React, { Component } from 'react' import Calender from './Calender' -import { deconstructDate } from './util' +import { deconstructDate, showLunarStatus } from './util' import TimePanel from './TimePanel' import Icon from '../icon' import classNames from 'classnames' import TimePeriodPanel from './TimePeriodPanel' -import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek, showLunarStatus } from './dateUtil' +import { dateFormat, parseISO, getStartDate, addMonths, subMonths, startOfWeek, endOfWeek } from './dateUtil' class DatePanel extends Component { constructor (props) { @@ -211,7 +211,7 @@ class DatePanel extends Component { } _getNormalComponent () { const { currentView } = this.state - const { min, max, weekOffset, date, showLunar } = this.props + const { min, max, weekOffset, date, showLunar, altCalendar, altCalendarPreset, dateMarkRender, dateMarkPreset } = this.props const validDate = getStartDate(date) const { year, month } = deconstructDate(validDate) let component = null @@ -221,6 +221,10 @@ class DatePanel extends Component { case 'week': component = ( { } return nDate } -/** - * 是否展示农历 - * @param {Object} props - */ -const showLunarStatus = (props) => { - return props.showLunar -} + export { getDaysInMonth, // 获取当月的天数 subMonths, // 月份减法 @@ -131,6 +125,5 @@ export { compatibleToDate, compatibleFormatString, changeYear, - changeMonth, - showLunarStatus // 是否展示农历 + changeMonth } diff --git a/components/date-picker/holidaylist.js b/components/date-picker/holidaylist.js deleted file mode 100644 index 7a5114451..000000000 --- a/components/date-picker/holidaylist.js +++ /dev/null @@ -1,2877 +0,0 @@ -export default { - '2000': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2000/2/4' - }, - { - 'name': '雨水', - 'date': '2000/2/19' - }, - { - 'name': '惊蛰', - 'date': '2000/3/5' - }, - { - 'name': '春分', - 'date': '2000/3/20' - }, - { - 'name': '清明', - 'date': '2000/4/4' - }, - { - 'name': '谷雨', - 'date': '2000/4/20' - }, - { - 'name': '立夏', - 'date': '2000/5/5' - }, - { - 'name': '小满', - 'date': '2000/5/21' - }, - { - 'name': '芒种', - 'date': '2000/6/5' - }, - { - 'name': '夏至', - 'date': '2000/6/21' - }, - { - 'name': '小暑', - 'date': '2000/7/7' - }, - { - 'name': '大暑', - 'date': '2000/7/22' - }, - { - 'name': '立秋', - 'date': '2000/8/7' - }, - { - 'name': '处暑', - 'date': '2000/8/23' - }, - { - 'name': '白露', - 'date': '2000/9/7' - }, - { - 'name': '秋分', - 'date': '2000/9/23' - }, - { - 'name': '寒露', - 'date': '2000/10/8' - }, - { - 'name': '霜降', - 'date': '2000/10/23' - }, - { - 'name': '立冬', - 'date': '2000/11/7' - }, - { - 'name': '小雪', - 'date': '2000/11/22' - }, - { - 'name': '大雪', - 'date': '2000/12/7' - }, - { - 'name': '冬至', - 'date': '2000/12/21' - }, - { - 'name': '小寒', - 'date': '2000/1/6' - }, - { - 'name': '大寒', - 'date': '2000/1/21' - } - ] - }, - '2001': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2001/2/4' - }, - { - 'name': '雨水', - 'date': '2001/2/18' - }, - { - 'name': '惊蛰', - 'date': '2001/3/5' - }, - { - 'name': '春分', - 'date': '2001/3/20' - }, - { - 'name': '清明', - 'date': '2001/4/5' - }, - { - 'name': '谷雨', - 'date': '2001/4/20' - }, - { - 'name': '立夏', - 'date': '2001/5/5' - }, - { - 'name': '小满', - 'date': '2001/5/21' - }, - { - 'name': '芒种', - 'date': '2001/6/5' - }, - { - 'name': '夏至', - 'date': '2001/6/21' - }, - { - 'name': '小暑', - 'date': '2001/7/7' - }, - { - 'name': '大暑', - 'date': '2001/7/23' - }, - { - 'name': '立秋', - 'date': '2001/8/7' - }, - { - 'name': '处暑', - 'date': '2001/8/23' - }, - { - 'name': '白露', - 'date': '2001/9/7' - }, - { - 'name': '秋分', - 'date': '2001/9/23' - }, - { - 'name': '寒露', - 'date': '2001/10/8' - }, - { - 'name': '霜降', - 'date': '2001/10/23' - }, - { - 'name': '立冬', - 'date': '2001/11/7' - }, - { - 'name': '小雪', - 'date': '2001/11/22' - }, - { - 'name': '大雪', - 'date': '2001/12/7' - }, - { - 'name': '冬至', - 'date': '2001/12/22' - }, - { - 'name': '小寒', - 'date': '2001/1/5' - }, - { - 'name': '大寒', - 'date': '2001/1/20' - } - ] - }, - '2002': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2002/2/4' - }, - { - 'name': '雨水', - 'date': '2002/2/19' - }, - { - 'name': '惊蛰', - 'date': '2002/3/6' - }, - { - 'name': '春分', - 'date': '2002/3/21' - }, - { - 'name': '清明', - 'date': '2002/4/5' - }, - { - 'name': '谷雨', - 'date': '2002/4/20' - }, - { - 'name': '立夏', - 'date': '2002/5/6' - }, - { - 'name': '小满', - 'date': '2002/5/21' - }, - { - 'name': '芒种', - 'date': '2002/6/6' - }, - { - 'name': '夏至', - 'date': '2002/6/21' - }, - { - 'name': '小暑', - 'date': '2002/7/7' - }, - { - 'name': '大暑', - 'date': '2002/7/23' - }, - { - 'name': '立秋', - 'date': '2002/8/8' - }, - { - 'name': '处暑', - 'date': '2002/8/23' - }, - { - 'name': '白露', - 'date': '2002/9/8' - }, - { - 'name': '秋分', - 'date': '2002/9/23' - }, - { - 'name': '寒露', - 'date': '2002/10/8' - }, - { - 'name': '霜降', - 'date': '2002/10/23' - }, - { - 'name': '立冬', - 'date': '2002/11/7' - }, - { - 'name': '小雪', - 'date': '2002/11/22' - }, - { - 'name': '大雪', - 'date': '2002/12/7' - }, - { - 'name': '冬至', - 'date': '2002/12/22' - }, - { - 'name': '小寒', - 'date': '2002/1/5' - }, - { - 'name': '大寒', - 'date': '2002/1/20' - } - ] - }, - '2003': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2003/2/4' - }, - { - 'name': '雨水', - 'date': '2003/2/19' - }, - { - 'name': '惊蛰', - 'date': '2003/3/6' - }, - { - 'name': '春分', - 'date': '2003/3/21' - }, - { - 'name': '清明', - 'date': '2003/4/5' - }, - { - 'name': '谷雨', - 'date': '2003/4/20' - }, - { - 'name': '立夏', - 'date': '2003/5/6' - }, - { - 'name': '小满', - 'date': '2003/5/21' - }, - { - 'name': '芒种', - 'date': '2003/6/6' - }, - { - 'name': '夏至', - 'date': '2003/6/22' - }, - { - 'name': '小暑', - 'date': '2003/7/7' - }, - { - 'name': '大暑', - 'date': '2003/7/23' - }, - { - 'name': '立秋', - 'date': '2003/8/8' - }, - { - 'name': '处暑', - 'date': '2003/8/23' - }, - { - 'name': '白露', - 'date': '2003/9/8' - }, - { - 'name': '秋分', - 'date': '2003/9/23' - }, - { - 'name': '寒露', - 'date': '2003/10/9' - }, - { - 'name': '霜降', - 'date': '2003/10/24' - }, - { - 'name': '立冬', - 'date': '2003/11/8' - }, - { - 'name': '小雪', - 'date': '2003/11/23' - }, - { - 'name': '大雪', - 'date': '2003/12/7' - }, - { - 'name': '冬至', - 'date': '2003/12/22' - }, - { - 'name': '小寒', - 'date': '2003/1/6' - }, - { - 'name': '大寒', - 'date': '2003/1/20' - } - ] - }, - '2004': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2004/2/4' - }, - { - 'name': '雨水', - 'date': '2004/2/19' - }, - { - 'name': '惊蛰', - 'date': '2004/3/5' - }, - { - 'name': '春分', - 'date': '2004/3/20' - }, - { - 'name': '清明', - 'date': '2004/4/4' - }, - { - 'name': '谷雨', - 'date': '2004/4/20' - }, - { - 'name': '立夏', - 'date': '2004/5/5' - }, - { - 'name': '小满', - 'date': '2004/5/21' - }, - { - 'name': '芒种', - 'date': '2004/6/5' - }, - { - 'name': '夏至', - 'date': '2004/6/21' - }, - { - 'name': '小暑', - 'date': '2004/7/7' - }, - { - 'name': '大暑', - 'date': '2004/7/22' - }, - { - 'name': '立秋', - 'date': '2004/8/7' - }, - { - 'name': '处暑', - 'date': '2004/8/23' - }, - { - 'name': '白露', - 'date': '2004/9/7' - }, - { - 'name': '秋分', - 'date': '2004/9/23' - }, - { - 'name': '寒露', - 'date': '2004/10/8' - }, - { - 'name': '霜降', - 'date': '2004/10/23' - }, - { - 'name': '立冬', - 'date': '2004/11/7' - }, - { - 'name': '小雪', - 'date': '2004/11/22' - }, - { - 'name': '大雪', - 'date': '2004/12/7' - }, - { - 'name': '冬至', - 'date': '2004/12/21' - }, - { - 'name': '小寒', - 'date': '2004/1/6' - }, - { - 'name': '大寒', - 'date': '2004/1/21' - } - ] - }, - '2005': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2005/2/4' - }, - { - 'name': '雨水', - 'date': '2005/2/18' - }, - { - 'name': '惊蛰', - 'date': '2005/3/5' - }, - { - 'name': '春分', - 'date': '2005/3/20' - }, - { - 'name': '清明', - 'date': '2005/4/5' - }, - { - 'name': '谷雨', - 'date': '2005/4/20' - }, - { - 'name': '立夏', - 'date': '2005/5/5' - }, - { - 'name': '小满', - 'date': '2005/5/21' - }, - { - 'name': '芒种', - 'date': '2005/6/5' - }, - { - 'name': '夏至', - 'date': '2005/6/21' - }, - { - 'name': '小暑', - 'date': '2005/7/7' - }, - { - 'name': '大暑', - 'date': '2005/7/23' - }, - { - 'name': '立秋', - 'date': '2005/8/7' - }, - { - 'name': '处暑', - 'date': '2005/8/23' - }, - { - 'name': '白露', - 'date': '2005/9/7' - }, - { - 'name': '秋分', - 'date': '2005/9/23' - }, - { - 'name': '寒露', - 'date': '2005/10/8' - }, - { - 'name': '霜降', - 'date': '2005/10/23' - }, - { - 'name': '立冬', - 'date': '2005/11/7' - }, - { - 'name': '小雪', - 'date': '2005/11/22' - }, - { - 'name': '大雪', - 'date': '2005/12/7' - }, - { - 'name': '冬至', - 'date': '2005/12/22' - }, - { - 'name': '小寒', - 'date': '2005/1/5' - }, - { - 'name': '大寒', - 'date': '2005/1/20' - } - ] - }, - '2006': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2006/2/4' - }, - { - 'name': '雨水', - 'date': '2006/2/19' - }, - { - 'name': '惊蛰', - 'date': '2006/3/6' - }, - { - 'name': '春分', - 'date': '2006/3/21' - }, - { - 'name': '清明', - 'date': '2006/4/5' - }, - { - 'name': '谷雨', - 'date': '2006/4/20' - }, - { - 'name': '立夏', - 'date': '2006/5/5' - }, - { - 'name': '小满', - 'date': '2006/5/21' - }, - { - 'name': '芒种', - 'date': '2006/6/6' - }, - { - 'name': '夏至', - 'date': '2006/6/21' - }, - { - 'name': '小暑', - 'date': '2006/7/7' - }, - { - 'name': '大暑', - 'date': '2006/7/23' - }, - { - 'name': '立秋', - 'date': '2006/8/7' - }, - { - 'name': '处暑', - 'date': '2006/8/23' - }, - { - 'name': '白露', - 'date': '2006/9/8' - }, - { - 'name': '秋分', - 'date': '2006/9/23' - }, - { - 'name': '寒露', - 'date': '2006/10/8' - }, - { - 'name': '霜降', - 'date': '2006/10/23' - }, - { - 'name': '立冬', - 'date': '2006/11/7' - }, - { - 'name': '小雪', - 'date': '2006/11/22' - }, - { - 'name': '大雪', - 'date': '2006/12/7' - }, - { - 'name': '冬至', - 'date': '2006/12/22' - }, - { - 'name': '小寒', - 'date': '2006/1/5' - }, - { - 'name': '大寒', - 'date': '2006/1/20' - } - ] - }, - '2007': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2007/2/4' - }, - { - 'name': '雨水', - 'date': '2007/2/19' - }, - { - 'name': '惊蛰', - 'date': '2007/3/6' - }, - { - 'name': '春分', - 'date': '2007/3/21' - }, - { - 'name': '清明', - 'date': '2007/4/5' - }, - { - 'name': '谷雨', - 'date': '2007/4/20' - }, - { - 'name': '立夏', - 'date': '2007/5/6' - }, - { - 'name': '小满', - 'date': '2007/5/21' - }, - { - 'name': '芒种', - 'date': '2007/6/6' - }, - { - 'name': '夏至', - 'date': '2007/6/22' - }, - { - 'name': '小暑', - 'date': '2007/7/7' - }, - { - 'name': '大暑', - 'date': '2007/7/23' - }, - { - 'name': '立秋', - 'date': '2007/8/8' - }, - { - 'name': '处暑', - 'date': '2007/8/23' - }, - { - 'name': '白露', - 'date': '2007/9/8' - }, - { - 'name': '秋分', - 'date': '2007/9/23' - }, - { - 'name': '寒露', - 'date': '2007/10/9' - }, - { - 'name': '霜降', - 'date': '2007/10/24' - }, - { - 'name': '立冬', - 'date': '2007/11/8' - }, - { - 'name': '小雪', - 'date': '2007/11/23' - }, - { - 'name': '大雪', - 'date': '2007/12/7' - }, - { - 'name': '冬至', - 'date': '2007/12/22' - }, - { - 'name': '小寒', - 'date': '2007/1/6' - }, - { - 'name': '大寒', - 'date': '2007/1/20' - } - ] - }, - '2008': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2008/2/4' - }, - { - 'name': '雨水', - 'date': '2008/2/19' - }, - { - 'name': '惊蛰', - 'date': '2008/3/5' - }, - { - 'name': '春分', - 'date': '2008/3/20' - }, - { - 'name': '清明', - 'date': '2008/4/4' - }, - { - 'name': '谷雨', - 'date': '2008/4/20' - }, - { - 'name': '立夏', - 'date': '2008/5/5' - }, - { - 'name': '小满', - 'date': '2008/5/21' - }, - { - 'name': '芒种', - 'date': '2008/6/5' - }, - { - 'name': '夏至', - 'date': '2008/6/21' - }, - { - 'name': '小暑', - 'date': '2008/7/7' - }, - { - 'name': '大暑', - 'date': '2008/7/22' - }, - { - 'name': '立秋', - 'date': '2008/8/7' - }, - { - 'name': '处暑', - 'date': '2008/8/23' - }, - { - 'name': '白露', - 'date': '2008/9/7' - }, - { - 'name': '秋分', - 'date': '2008/9/22' - }, - { - 'name': '寒露', - 'date': '2008/10/8' - }, - { - 'name': '霜降', - 'date': '2008/10/23' - }, - { - 'name': '立冬', - 'date': '2008/11/7' - }, - { - 'name': '小雪', - 'date': '2008/11/22' - }, - { - 'name': '大雪', - 'date': '2008/12/7' - }, - { - 'name': '冬至', - 'date': '2008/12/21' - }, - { - 'name': '小寒', - 'date': '2008/1/6' - }, - { - 'name': '大寒', - 'date': '2008/1/21' - } - ] - }, - '2009': { - 'holiday': {}, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2009/2/4' - }, - { - 'name': '雨水', - 'date': '2009/2/18' - }, - { - 'name': '惊蛰', - 'date': '2009/3/5' - }, - { - 'name': '春分', - 'date': '2009/3/20' - }, - { - 'name': '清明', - 'date': '2009/4/4' - }, - { - 'name': '谷雨', - 'date': '2009/4/20' - }, - { - 'name': '立夏', - 'date': '2009/5/5' - }, - { - 'name': '小满', - 'date': '2009/5/21' - }, - { - 'name': '芒种', - 'date': '2009/6/5' - }, - { - 'name': '夏至', - 'date': '2009/6/21' - }, - { - 'name': '小暑', - 'date': '2009/7/7' - }, - { - 'name': '大暑', - 'date': '2009/7/23' - }, - { - 'name': '立秋', - 'date': '2009/8/7' - }, - { - 'name': '处暑', - 'date': '2009/8/23' - }, - { - 'name': '白露', - 'date': '2009/9/7' - }, - { - 'name': '秋分', - 'date': '2009/9/23' - }, - { - 'name': '寒露', - 'date': '2009/10/8' - }, - { - 'name': '霜降', - 'date': '2009/10/23' - }, - { - 'name': '立冬', - 'date': '2009/11/7' - }, - { - 'name': '小雪', - 'date': '2009/11/22' - }, - { - 'name': '大雪', - 'date': '2009/12/7' - }, - { - 'name': '冬至', - 'date': '2009/12/22' - }, - { - 'name': '小寒', - 'date': '2009/1/5' - }, - { - 'name': '大寒', - 'date': '2009/1/20' - } - ] - }, - '2010': { - 'holiday': { - '2011/1/1': '1', - '2011/1/2': '1', - '2011/1/3': '1' - }, - 'solarTerms': [ - { - 'name': '立春', - 'date': '2010/2/4' - }, - { - 'name': '雨水', - 'date': '2010/2/19' - }, - { - 'name': '惊蛰', - 'date': '2010/3/6' - }, - { - 'name': '春分', - 'date': '2010/3/21' - }, - { - 'name': '清明', - 'date': '2010/4/5' - }, - { - 'name': '谷雨', - 'date': '2010/4/20' - }, - { - 'name': '立夏', - 'date': '2010/5/5' - }, - { - 'name': '小满', - 'date': '2010/5/21' - }, - { - 'name': '芒种', - 'date': '2010/6/6' - }, - { - 'name': '夏至', - 'date': '2010/6/21' - }, - { - 'name': '小暑', - 'date': '2010/7/7' - }, - { - 'name': '大暑', - 'date': '2010/7/23' - }, - { - 'name': '立秋', - 'date': '2010/8/7' - }, - { - 'name': '处暑', - 'date': '2010/8/23' - }, - { - 'name': '白露', - 'date': '2010/9/8' - }, - { - 'name': '秋分', - 'date': '2010/9/23' - }, - { - 'name': '寒露', - 'date': '2010/10/8' - }, - { - 'name': '霜降', - 'date': '2010/10/23' - }, - { - 'name': '立冬', - 'date': '2010/11/7' - }, - { - 'name': '小雪', - 'date': '2010/11/22' - }, - { - 'name': '大雪', - 'date': '2010/12/7' - }, - { - 'name': '冬至', - 'date': '2010/12/22' - }, - { - 'name': '小寒', - 'date': '2010/1/5' - }, - { - 'name': '大寒', - 'date': '2010/1/20' - } - ] - }, - '2011': { - 'holiday': { - '2011/1/1': '1', - '2011/1/2': '1', - '2011/1/3': '1', - '2011/1/30': '2', - '2011/2/2': '1', - '2011/2/3': '1', - '2011/2/4': '1', - '2011/2/5': '1', - '2011/2/6': '1', - '2011/2/7': '1', - '2011/2/8': '1', - '2011/2/12': '2', - '2011/4/2': '2', - '2011/4/3': '1', - '2011/4/4': '1', - '2011/4/5': '1', - '2011/4/30': '1', - '2011/5/1': '1', - '2011/5/2': '1', - '2011/6/4': '1', - '2011/6/5': '1', - '2011/6/6': '1', - '2011/9/10': '1', - '2011/9/11': '1', - '2011/9/12': '1', - '2011/10/1': '1', - '2011/10/2': '1', - '2011/10/3': '1', - '2011/10/4': '1', - '2011/10/5': '1', - '2011/10/6': '1', - '2011/10/7': '1', - '2011/10/8': '2', - '2011/10/9': '2', - '2012/1/1': '1', - '2012/1/2': '1', - '2012/1/3': '1', - '2011/12/31': '2', - '2012/1/21': '2', - '2012/1/22': '1', - '2012/1/23': '1', - '2012/1/24': '1', - '2012/1/25': '1', - '2012/1/26': '1', - '2012/1/27': '1', - '2012/1/28': '1', - '2012/1/29': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2011/1/1' - }, - { - 'name': '春节', - 'startday': '2011/1/30' - }, - { - 'name': '清明节', - 'startday': '2011/4/2' - }, - { - 'name': '劳动节', - 'startday': '2011/4/30' - }, - { - 'name': '端午节', - 'startday': '2011/6/4' - }, - { - 'name': '中秋节', - 'startday': '2011/9/10' - }, - { - 'name': '国庆节', - 'startday': '2011/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2011/2/4' - }, - { - 'name': '雨水', - 'date': '2011/2/19' - }, - { - 'name': '惊蛰', - 'date': '2011/3/6' - }, - { - 'name': '春分', - 'date': '2011/3/21' - }, - { - 'name': '清明', - 'date': '2011/4/5' - }, - { - 'name': '谷雨', - 'date': '2011/4/20' - }, - { - 'name': '立夏', - 'date': '2011/5/6' - }, - { - 'name': '小满', - 'date': '2011/5/21' - }, - { - 'name': '芒种', - 'date': '2011/6/6' - }, - { - 'name': '夏至', - 'date': '2011/6/22' - }, - { - 'name': '小暑', - 'date': '2011/7/7' - }, - { - 'name': '大暑', - 'date': '2011/7/23' - }, - { - 'name': '立秋', - 'date': '2011/8/8' - }, - { - 'name': '处暑', - 'date': '2011/8/23' - }, - { - 'name': '白露', - 'date': '2011/9/8' - }, - { - 'name': '秋分', - 'date': '2011/9/23' - }, - { - 'name': '寒露', - 'date': '2011/10/8' - }, - { - 'name': '霜降', - 'date': '2011/10/24' - }, - { - 'name': '立冬', - 'date': '2011/11/8' - }, - { - 'name': '小雪', - 'date': '2011/11/23' - }, - { - 'name': '大雪', - 'date': '2011/12/7' - }, - { - 'name': '冬至', - 'date': '2011/12/22' - }, - { - 'name': '小寒', - 'date': '2011/1/6' - }, - { - 'name': '大寒', - 'date': '2011/1/20' - } - ] - }, - '2012': { - 'holiday': { - '2012/1/1': '1', - '2012/1/2': '1', - '2012/1/3': '1', - '2011/12/31': '2', - '2012/1/21': '2', - '2012/1/22': '1', - '2012/1/23': '1', - '2012/1/24': '1', - '2012/1/25': '1', - '2012/1/26': '1', - '2012/1/27': '1', - '2012/1/28': '1', - '2012/1/29': '2', - '2012/3/31': '2', - '2012/4/1': '2', - '2012/4/2': '1', - '2012/4/3': '1', - '2012/4/4': '1', - '2012/4/28': '2', - '2012/4/29': '1', - '2012/4/30': '1', - '2012/5/1': '1', - '2012/5/2': '2', - '2012/6/22': '1', - '2012/6/23': '1', - '2012/6/24': '1', - '2012/9/29': '2', - '2012/9/30': '1', - '2012/10/1': '1', - '2012/10/2': '1', - '2012/10/3': '1', - '2012/10/4': '1', - '2012/10/5': '1', - '2012/10/6': '1', - '2012/10/7': '1', - '2012/10/8': '2', - '2013/1/1': '1', - '2013/1/2': '1', - '2013/1/3': '1', - '2013/1/5': '2', - '2013/1/6': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2012/1/1' - }, - { - 'name': '春节', - 'startday': '2012/1/21' - }, - { - 'name': '清明节', - 'startday': '2012/3/31' - }, - { - 'name': '劳动节', - 'startday': '2012/4/28' - }, - { - 'name': '端午节', - 'startday': '2012/6/22' - }, - { - 'name': '中秋节', - 'startday': '2012/9/29' - }, - { - 'name': '国庆节', - 'startday': '2012/9/29' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2012/2/4' - }, - { - 'name': '雨水', - 'date': '2012/2/19' - }, - { - 'name': '惊蛰', - 'date': '2012/3/5' - }, - { - 'name': '春分', - 'date': '2012/3/20' - }, - { - 'name': '清明', - 'date': '2012/4/4' - }, - { - 'name': '谷雨', - 'date': '2012/4/20' - }, - { - 'name': '立夏', - 'date': '2012/5/5' - }, - { - 'name': '小满', - 'date': '2012/5/20' - }, - { - 'name': '芒种', - 'date': '2012/6/5' - }, - { - 'name': '夏至', - 'date': '2012/6/21' - }, - { - 'name': '小暑', - 'date': '2012/7/7' - }, - { - 'name': '大暑', - 'date': '2012/7/22' - }, - { - 'name': '立秋', - 'date': '2012/8/7' - }, - { - 'name': '处暑', - 'date': '2012/8/23' - }, - { - 'name': '白露', - 'date': '2012/9/7' - }, - { - 'name': '秋分', - 'date': '2012/9/22' - }, - { - 'name': '寒露', - 'date': '2012/10/8' - }, - { - 'name': '霜降', - 'date': '2012/10/23' - }, - { - 'name': '立冬', - 'date': '2012/11/7' - }, - { - 'name': '小雪', - 'date': '2012/11/22' - }, - { - 'name': '大雪', - 'date': '2012/12/7' - }, - { - 'name': '冬至', - 'date': '2012/12/21' - }, - { - 'name': '小寒', - 'date': '2012/1/6' - }, - { - 'name': '大寒', - 'date': '2012/1/21' - } - ] - }, - '2013': { - 'holiday': { - '2013/1/1': '1', - '2013/1/2': '1', - '2013/1/3': '1', - '2013/1/5': '2', - '2013/1/6': '2', - '2013/2/9': '1', - '2013/2/10': '1', - '2013/2/11': '1', - '2013/2/12': '1', - '2013/2/13': '1', - '2013/2/14': '1', - '2013/2/15': '1', - '2013/2/16': '2', - '2013/2/17': '2', - '2013/4/4': '1', - '2013/4/5': '1', - '2013/4/6': '1', - '2013/4/7': '2', - '2013/4/29': '1', - '2013/4/30': '1', - '2013/5/1': '1', - '2013/4/27': '2', - '2013/4/28': '2', - '2013/6/8': '2', - '2013/6/9': '2', - '2013/6/10': '1', - '2013/6/11': '1', - '2013/6/12': '1', - '2013/9/19': '1', - '2013/9/20': '1', - '2013/9/21': '1', - '2013/9/22': '2', - '2013/9/29': '2', - '2013/10/1': '1', - '2013/10/2': '1', - '2013/10/3': '1', - '2013/10/4': '1', - '2013/10/5': '1', - '2013/10/6': '1', - '2013/10/7': '1', - '2013/10/12': '2', - '2014/1/1': '1', - '2014/01/30': '0', - '2014/1/26': '2', - '2014/1/31': '1', - '2014/2/1': '1', - '2014/2/2': '1', - '2014/2/3': '1', - '2014/2/4': '1', - '2014/2/5': '1', - '2014/2/6': '1', - '2014/2/8': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2013/1/1' - }, - { - 'name': '春节', - 'startday': '2013/2/10' - }, - { - 'name': '清明节', - 'startday': '2013/4/4' - }, - { - 'name': '劳动节', - 'startday': '2013/4/29' - }, - { - 'name': '端午节', - 'startday': '2013/6/8' - }, - { - 'name': '中秋节', - 'startday': '2013/9/19' - }, - { - 'name': '国庆节', - 'startday': '2013/9/29' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2013/2/4' - }, - { - 'name': '雨水', - 'date': '2013/2/18' - }, - { - 'name': '惊蛰', - 'date': '2013/3/5' - }, - { - 'name': '春分', - 'date': '2013/3/20' - }, - { - 'name': '清明', - 'date': '2013/4/4' - }, - { - 'name': '谷雨', - 'date': '2013/4/20' - }, - { - 'name': '立夏', - 'date': '2013/5/5' - }, - { - 'name': '小满', - 'date': '2013/5/21' - }, - { - 'name': '芒种', - 'date': '2013/6/5' - }, - { - 'name': '夏至', - 'date': '2013/6/21' - }, - { - 'name': '小暑', - 'date': '2013/7/7' - }, - { - 'name': '大暑', - 'date': '2013/7/22' - }, - { - 'name': '立秋', - 'date': '2013/8/7' - }, - { - 'name': '处暑', - 'date': '2013/8/23' - }, - { - 'name': '白露', - 'date': '2013/9/7' - }, - { - 'name': '秋分', - 'date': '2013/9/23' - }, - { - 'name': '寒露', - 'date': '2013/10/8' - }, - { - 'name': '霜降', - 'date': '2013/10/23' - }, - { - 'name': '立冬', - 'date': '2013/11/7' - }, - { - 'name': '小雪', - 'date': '2013/11/22' - }, - { - 'name': '大雪', - 'date': '2013/12/7' - }, - { - 'name': '冬至', - 'date': '2013/12/22' - }, - { - 'name': '小寒', - 'date': '2013/1/5' - }, - { - 'name': '大寒', - 'date': '2013/1/20' - } - ] - }, - '2014': { - 'holiday': { - '2014/1/1': '1', - '2014/01/30': '0', - '2014/1/26': '2', - '2014/1/31': '1', - '2014/2/1': '1', - '2014/2/2': '1', - '2014/2/3': '1', - '2014/2/4': '1', - '2014/2/5': '1', - '2014/2/6': '1', - '2014/2/8': '2', - '2014/4/5': '1', - '2014/4/6': '1', - '2014/4/7': '1', - '2014/5/1': '1', - '2014/5/2': '1', - '2014/5/3': '1', - '2014/5/4': '2', - '2014/5/31': '1', - '2014/6/1': '1', - '2014/6/2': '1', - '2014/9/6': '1', - '2014/9/7': '1', - '2014/9/8': '1', - '2014/10/1': '1', - '2014/10/2': '1', - '2014/10/3': '1', - '2014/10/4': '1', - '2014/10/5': '1', - '2014/10/6': '1', - '2014/10/7': '1', - '2014/9/28': '2', - '2014/10/11': '2', - '2015/1/1': '1', - '2015/1/2': '1', - '2015/1/3': '1', - '2015/1/4': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2014/1/1' - }, - { - 'name': '除夕', - 'startday': '2014/01/30' - }, - { - 'name': '春节', - 'startday': '2014/1/31' - }, - { - 'name': '清明节', - 'startday': '2014/4/5' - }, - { - 'name': '劳动节', - 'startday': '2014/5/1' - }, - { - 'name': '端午节', - 'startday': '2014/6/2' - }, - { - 'name': '中秋节', - 'startday': '2014/9/8' - }, - { - 'name': '国庆节', - 'startday': '2014/10/7' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2014/2/4' - }, - { - 'name': '雨水', - 'date': '2014/2/19' - }, - { - 'name': '惊蛰', - 'date': '2014/3/6' - }, - { - 'name': '春分', - 'date': '2014/3/21' - }, - { - 'name': '清明', - 'date': '2014/4/5' - }, - { - 'name': '谷雨', - 'date': '2014/4/20' - }, - { - 'name': '立夏', - 'date': '2014/5/5' - }, - { - 'name': '小满', - 'date': '2014/5/21' - }, - { - 'name': '芒种', - 'date': '2014/6/6' - }, - { - 'name': '夏至', - 'date': '2014/6/21' - }, - { - 'name': '小暑', - 'date': '2014/7/7' - }, - { - 'name': '大暑', - 'date': '2014/7/23' - }, - { - 'name': '立秋', - 'date': '2014/8/7' - }, - { - 'name': '处暑', - 'date': '2014/8/23' - }, - { - 'name': '白露', - 'date': '2014/9/8' - }, - { - 'name': '秋分', - 'date': '2014/9/23' - }, - { - 'name': '寒露', - 'date': '2014/10/8' - }, - { - 'name': '霜降', - 'date': '2014/10/23' - }, - { - 'name': '立冬', - 'date': '2014/11/7' - }, - { - 'name': '小雪', - 'date': '2014/11/22' - }, - { - 'name': '大雪', - 'date': '2014/12/7' - }, - { - 'name': '冬至', - 'date': '2014/12/22' - }, - { - 'name': '小寒', - 'date': '2014/1/5' - }, - { - 'name': '大寒', - 'date': '2014/1/20' - } - ] - }, - '2015': { - 'holiday': { - '2015/1/1': '1', - '2015/1/2': '1', - '2015/1/3': '1', - '2015/1/4': '2', - '2015/2/18': '1', - '2015/2/15': '2', - '2015/2/19': '1', - '2015/2/20': '1', - '2015/2/21': '1', - '2015/2/22': '1', - '2015/2/23': '1', - '2015/2/24': '1', - '2015/2/28': '2', - '2015/4/4': '1', - '2015/4/5': '1', - '2015/4/6': '1', - '2015/5/1': '1', - '2015/5/2': '1', - '2015/5/3': '1', - '2015/6/20': '1', - '2015/6/21': '1', - '2015/6/22': '1', - '2015/9/3': '1', - '2015/9/4': '1', - '2015/9/5': '1', - '2015/9/6': '2', - '2015/9/26': '1', - '2015/9/27': '1', - '2015/10/1': '1', - '2015/10/2': '1', - '2015/10/3': '1', - '2015/10/4': '1', - '2015/10/5': '1', - '2015/10/6': '1', - '2015/10/7': '1', - '2015/10/10': '2', - '2016/1/1': '1', - '2016/1/2': '1', - '2016/1/3': '1' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2015/1/1' - }, - { - 'name': '除夕', - 'startday': '2015/2/18' - }, - { - 'name': '春节', - 'startday': '2015/2/19' - }, - { - 'name': '清明节', - 'startday': '2015/4/5' - }, - { - 'name': '劳动节', - 'startday': '2015/5/1' - }, - { - 'name': '端午节', - 'startday': '2015/6/20' - }, - { - 'name': '胜利日', - 'startday': '2015/9/3' - }, - { - 'name': '中秋节', - 'startday': '2015/9/27' - }, - { - 'name': '国庆节', - 'startday': '2015/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2015/2/4' - }, - { - 'name': '雨水', - 'date': '2015/2/19' - }, - { - 'name': '惊蛰', - 'date': '2015/3/6' - }, - { - 'name': '春分', - 'date': '2015/3/21' - }, - { - 'name': '清明', - 'date': '2015/4/5' - }, - { - 'name': '谷雨', - 'date': '2015/4/20' - }, - { - 'name': '立夏', - 'date': '2015/5/6' - }, - { - 'name': '小满', - 'date': '2015/5/21' - }, - { - 'name': '芒种', - 'date': '2015/6/6' - }, - { - 'name': '夏至', - 'date': '2015/6/22' - }, - { - 'name': '小暑', - 'date': '2015/7/7' - }, - { - 'name': '大暑', - 'date': '2015/7/23' - }, - { - 'name': '立秋', - 'date': '2015/8/8' - }, - { - 'name': '处暑', - 'date': '2015/8/23' - }, - { - 'name': '白露', - 'date': '2015/9/8' - }, - { - 'name': '秋分', - 'date': '2015/9/23' - }, - { - 'name': '寒露', - 'date': '2015/10/8' - }, - { - 'name': '霜降', - 'date': '2015/10/24' - }, - { - 'name': '立冬', - 'date': '2015/11/8' - }, - { - 'name': '小雪', - 'date': '2015/11/22' - }, - { - 'name': '大雪', - 'date': '2015/12/7' - }, - { - 'name': '冬至', - 'date': '2015/12/22' - }, - { - 'name': '小寒', - 'date': '2015/1/6' - }, - { - 'name': '大寒', - 'date': '2015/1/20' - } - ] - }, - '2016': { - 'holiday': { - '2016/1/1': '1', - '2016/1/2': '1', - '2016/1/3': '1', - '2016/2/7': '1', - '2016/2/6': '2', - '2016/2/8': '1', - '2016/2/9': '1', - '2016/2/10': '1', - '2016/2/11': '1', - '2016/2/12': '1', - '2016/2/13': '1', - '2016/2/14': '2', - '2016/4/2': '1', - '2016/4/3': '1', - '2016/4/4': '1', - '2016/4/30': '1', - '2016/5/1': '1', - '2016/5/2': '1', - '2016/6/9': '1', - '2016/6/10': '1', - '2016/6/11': '1', - '2016/6/12': '2', - '2016/9/15': '1', - '2016/9/16': '1', - '2016/9/17': '1', - '2016/9/18': '2', - '2016/10/1': '1', - '2016/10/2': '1', - '2016/10/3': '1', - '2016/10/4': '1', - '2016/10/5': '1', - '2016/10/6': '1', - '2016/10/7': '1', - '2016/10/8': '2', - '2016/10/9': '2', - '2016/12/31': '1', - '2017/1/1': '1', - '2017/1/2': '1', - '2017/1/27': '1', - '2017/1/22': '2', - '2017/1/28': '1', - '2017/1/29': '1', - '2017/1/30': '1', - '2017/1/31': '1', - '2017/2/1': '1', - '2017/2/2': '1', - '2017/2/4': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2016/1/1' - }, - { - 'name': '除夕', - 'startday': '2016/2/7' - }, - { - 'name': '春节', - 'startday': '2016/2/7' - }, - { - 'name': '清明节', - 'startday': '2016/4/4' - }, - { - 'name': '劳动节', - 'startday': '2016/5/1' - }, - { - 'name': '端午节', - 'startday': '2016/6/9' - }, - { - 'name': '中秋节', - 'startday': '2016/9/15' - }, - { - 'name': '国庆节', - 'startday': '2016/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2016/2/4' - }, - { - 'name': '雨水', - 'date': '2016/2/19' - }, - { - 'name': '惊蛰', - 'date': '2016/3/5' - }, - { - 'name': '春分', - 'date': '2016/3/20' - }, - { - 'name': '清明', - 'date': '2016/4/4' - }, - { - 'name': '谷雨', - 'date': '2016/4/19' - }, - { - 'name': '立夏', - 'date': '2016/5/5' - }, - { - 'name': '小满', - 'date': '2016/5/20' - }, - { - 'name': '芒种', - 'date': '2016/6/5' - }, - { - 'name': '夏至', - 'date': '2016/6/21' - }, - { - 'name': '小暑', - 'date': '2016/7/7' - }, - { - 'name': '大暑', - 'date': '2016/7/22' - }, - { - 'name': '立秋', - 'date': '2016/8/7' - }, - { - 'name': '处暑', - 'date': '2016/8/23' - }, - { - 'name': '白露', - 'date': '2016/9/7' - }, - { - 'name': '秋分', - 'date': '2016/9/22' - }, - { - 'name': '寒露', - 'date': '2016/10/8' - }, - { - 'name': '霜降', - 'date': '2016/10/23' - }, - { - 'name': '立冬', - 'date': '2016/11/7' - }, - { - 'name': '小雪', - 'date': '2016/11/22' - }, - { - 'name': '大雪', - 'date': '2016/12/7' - }, - { - 'name': '冬至', - 'date': '2016/12/21' - }, - { - 'name': '小寒', - 'date': '2016/1/6' - }, - { - 'name': '大寒', - 'date': '2016/1/20' - } - ] - }, - '2017': { - 'holiday': { - '2016/12/31': '1', - '2017/1/1': '1', - '2017/1/2': '1', - '2017/1/27': '1', - '2017/1/22': '2', - '2017/1/28': '1', - '2017/1/29': '1', - '2017/1/30': '1', - '2017/1/31': '1', - '2017/2/1': '1', - '2017/2/2': '1', - '2017/2/4': '2', - '2017/4/1': '2', - '2017/4/2': '1', - '2017/4/3': '1', - '2017/4/4': '1', - '2017/4/29': '1', - '2017/4/30': '1', - '2017/5/1': '1', - '2017/5/27': '2', - '2017/5/28': '1', - '2017/5/29': '1', - '2017/5/30': '1', - '2017/9/30': '2', - '2017/10/1': '1', - '2017/10/2': '1', - '2017/10/3': '1', - '2017/10/4': '1', - '2017/10/5': '1', - '2017/10/6': '1', - '2017/10/7': '1', - '2017/10/8': '1', - '2017/12/30': '1', - '2017/12/31': '1', - '2018/1/1': '1' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2017/1/1' - }, - { - 'name': '除夕', - 'startday': '2017/1/27' - }, - { - 'name': '春节', - 'startday': '2017/1/28' - }, - { - 'name': '清明节', - 'startday': '2017/4/4' - }, - { - 'name': '劳动节', - 'startday': '2017/5/1' - }, - { - 'name': '端午节', - 'startday': '2017/5/30' - }, - { - 'name': '国庆节', - 'startday': '2017/10/1' - }, - { - 'name': '中秋节', - 'startday': '2017/10/4' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2017/2/3' - }, - { - 'name': '雨水', - 'date': '2017/2/18' - }, - { - 'name': '惊蛰', - 'date': '2017/3/5' - }, - { - 'name': '春分', - 'date': '2017/3/20' - }, - { - 'name': '清明', - 'date': '2017/4/4' - }, - { - 'name': '谷雨', - 'date': '2017/4/20' - }, - { - 'name': '立夏', - 'date': '2017/5/5' - }, - { - 'name': '小满', - 'date': '2017/5/21' - }, - { - 'name': '芒种', - 'date': '2017/6/5' - }, - { - 'name': '夏至', - 'date': '2017/6/21' - }, - { - 'name': '小暑', - 'date': '2017/7/7' - }, - { - 'name': '大暑', - 'date': '2017/7/22' - }, - { - 'name': '立秋', - 'date': '2017/8/7' - }, - { - 'name': '处暑', - 'date': '2017/8/23' - }, - { - 'name': '白露', - 'date': '2017/9/7' - }, - { - 'name': '秋分', - 'date': '2017/9/23' - }, - { - 'name': '寒露', - 'date': '2017/10/8' - }, - { - 'name': '霜降', - 'date': '2017/10/23' - }, - { - 'name': '立冬', - 'date': '2017/11/7' - }, - { - 'name': '小雪', - 'date': '2017/11/22' - }, - { - 'name': '大雪', - 'date': '2017/12/7' - }, - { - 'name': '冬至', - 'date': '2017/12/22' - }, - { - 'name': '小寒', - 'date': '2017/1/5' - }, - { - 'name': '大寒', - 'date': '2017/1/20' - } - ] - }, - '2018': { - 'holiday': { - '2017/12/30': '1', - '2017/12/31': '1', - '2018/1/1': '1', - '2018/2/15': '1', - '2018/2/11': '2', - '2018/2/16': '1', - '2018/2/17': '1', - '2018/2/18': '1', - '2018/2/19': '1', - '2018/2/20': '1', - '2018/2/21': '1', - '2018/2/24': '2', - '2018/4/5': '1', - '2018/4/6': '1', - '2018/4/7': '1', - '2018/4/8': '2', - '2018/4/28': '2', - '2018/4/29': '1', - '2018/4/30': '1', - '2018/5/1': '1', - '2018/6/16': '1', - '2018/6/17': '1', - '2018/6/18': '1', - '2018/9/22': '1', - '2018/9/23': '1', - '2018/9/24': '1', - '2018/10/1': '1', - '2018/10/2': '1', - '2018/10/3': '1', - '2018/10/4': '1', - '2018/10/5': '1', - '2018/10/6': '1', - '2018/10/7': '1', - '2018/9/29': '2', - '2018/9/30': '2', - '2018/12/29': '2', - '2018/12/31': '1', - '2019/1/1': '1', - '2018/12/30': '1' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2018/1/1' - }, - { - 'name': '除夕', - 'startday': '2018/2/15' - }, - { - 'name': '春节', - 'startday': '2018/2/16' - }, - { - 'name': '清明节', - 'startday': '2018/4/5' - }, - { - 'name': '劳动节', - 'startday': '2018/5/1' - }, - { - 'name': '端午节', - 'startday': '2018/6/18' - }, - { - 'name': '中秋节', - 'startday': '2018/9/24' - }, - { - 'name': '国庆节', - 'startday': '2018/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2018/2/4' - }, - { - 'name': '雨水', - 'date': '2018/2/19' - }, - { - 'name': '惊蛰', - 'date': '2018/3/5' - }, - { - 'name': '春分', - 'date': '2018/3/21' - }, - { - 'name': '清明', - 'date': '2018/4/5' - }, - { - 'name': '谷雨', - 'date': '2018/4/20' - }, - { - 'name': '立夏', - 'date': '2018/5/5' - }, - { - 'name': '小满', - 'date': '2018/5/21' - }, - { - 'name': '芒种', - 'date': '2018/6/6' - }, - { - 'name': '夏至', - 'date': '2018/6/21' - }, - { - 'name': '小暑', - 'date': '2018/7/7' - }, - { - 'name': '大暑', - 'date': '2018/7/23' - }, - { - 'name': '立秋', - 'date': '2018/8/7' - }, - { - 'name': '处暑', - 'date': '2018/8/23' - }, - { - 'name': '白露', - 'date': '2018/9/8' - }, - { - 'name': '秋分', - 'date': '2018/9/23' - }, - { - 'name': '寒露', - 'date': '2018/10/8' - }, - { - 'name': '霜降', - 'date': '2018/10/23' - }, - { - 'name': '立冬', - 'date': '2018/11/7' - }, - { - 'name': '小雪', - 'date': '2018/11/22' - }, - { - 'name': '大雪', - 'date': '2018/12/7' - }, - { - 'name': '冬至', - 'date': '2018/12/22' - }, - { - 'name': '小寒', - 'date': '2018/1/5' - }, - { - 'name': '大寒', - 'date': '2018/1/20' - } - ] - }, - '2019': { - 'holiday': { - '2018/12/29': '2', - '2018/12/31': '1', - '2019/1/1': '1', - '2018/12/30': '1', - '2019/2/4': '1', - '2019/2/2': '2', - '2019/2/3': '2', - '2019/2/5': '1', - '2019/2/6': '1', - '2019/2/7': '1', - '2019/2/8': '1', - '2019/2/9': '1', - '2019/2/10': '1', - '2019/4/5': '1', - '2019/4/6': '1', - '2019/4/7': '1', - '2019/5/1': '1', - '2019/5/2': '1', - '2019/5/3': '1', - '2019/5/4': '1', - '2019/4/28': '2', - '2019/5/5': '2', - '2019/6/7': '1', - '2019/6/8': '1', - '2019/6/9': '1', - '2019/9/13': '1', - '2019/9/14': '1', - '2019/9/15': '1', - '2019/10/1': '1', - '2019/9/29': '2', - '2019/10/2': '1', - '2019/10/3': '1', - '2019/10/4': '1', - '2019/10/7': '1', - '2019/10/12': '2', - '2019/10/5': '1', - '2019/10/6': '1' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2019/1/1' - }, - { - 'name': '除夕', - 'startday': '2019/2/4' - }, - { - 'name': '春节', - 'startday': '2019/2/4' - }, - { - 'name': '清明节', - 'startday': '2019/4/5' - }, - { - 'name': '劳动节', - 'startday': '2019/5/1' - }, - { - 'name': '端午节', - 'startday': '2019/6/7' - }, - { - 'name': '中秋节', - 'startday': '2019/9/13' - }, - { - 'name': '国庆节', - 'startday': '2019/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2019/2/4' - }, - { - 'name': '雨水', - 'date': '2019/2/19' - }, - { - 'name': '惊蛰', - 'date': '2019/3/6' - }, - { - 'name': '春分', - 'date': '2019/3/21' - }, - { - 'name': '清明', - 'date': '2019/4/5' - }, - { - 'name': '谷雨', - 'date': '2019/4/20' - }, - { - 'name': '立夏', - 'date': '2019/5/6' - }, - { - 'name': '小满', - 'date': '2019/5/21' - }, - { - 'name': '芒种', - 'date': '2019/6/6' - }, - { - 'name': '夏至', - 'date': '2019/6/21' - }, - { - 'name': '小暑', - 'date': '2019/7/7' - }, - { - 'name': '大暑', - 'date': '2019/7/23' - }, - { - 'name': '立秋', - 'date': '2019/8/8' - }, - { - 'name': '处暑', - 'date': '2019/8/23' - }, - { - 'name': '白露', - 'date': '2019/9/8' - }, - { - 'name': '秋分', - 'date': '2019/9/23' - }, - { - 'name': '寒露', - 'date': '2019/10/8' - }, - { - 'name': '霜降', - 'date': '2019/10/24' - }, - { - 'name': '立冬', - 'date': '2019/11/8' - }, - { - 'name': '小雪', - 'date': '2019/11/22' - }, - { - 'name': '大雪', - 'date': '2019/12/7' - }, - { - 'name': '冬至', - 'date': '2019/12/22' - }, - { - 'name': '小寒', - 'date': '2019/1/5' - }, - { - 'name': '大寒', - 'date': '2019/1/20' - } - ] - }, - '2020': { - 'holiday': { - '2020/1/1': '1', - '2020/1/24': '1', - '2020/1/25': '1', - '2020/1/26': '1', - '2020/1/27': '1', - '2020/1/28': '1', - '2020/1/29': '1', - '2020/1/30': '1', - '2020/1/19': '2', - '2020/2/1': '2', - '2020/4/4': '1', - '2020/4/5': '1', - '2020/4/6': '1', - '2020/5/1': '1', - '2020/5/2': '1', - '2020/5/3': '1', - '2020/5/4': '1', - '2020/5/5': '1', - '2020/4/26': '2', - '2020/5/9': '2', - '2020/6/25': '1', - '2020/6/26': '1', - '2020/6/27': '1', - '2020/6/28': '2', - '2020/10/1': '1', - '2020/10/2': '1', - '2020/10/3': '1', - '2020/10/4': '1', - '2020/10/5': '1', - '2020/10/6': '1', - '2020/10/7': '1', - '2020/10/8': '1', - '2020/9/27': '2', - '2020/10/10': '2' - }, - 'holidaylist': [ - { - 'name': '元旦', - 'startday': '2020/1/1' - }, - { - 'name': '除夕', - 'startday': '2020/1/24' - }, - { - 'name': '春节', - 'startday': '2020/1/25' - }, - { - 'name': '清明节', - 'startday': '2020/4/4' - }, - { - 'name': '劳动节', - 'startday': '2020/5/1' - }, - { - 'name': '端午节', - 'startday': '2020/6/25' - }, - { - 'name': '中秋节', - 'startday': '2020/10/1' - }, - { - 'name': '国庆节', - 'startday': '2020/10/1' - } - ], - 'solarTerms': [ - { - 'name': '立春', - 'date': '2020/2/4' - }, - { - 'name': '雨水', - 'date': '2020/2/19' - }, - { - 'name': '惊蛰', - 'date': '2020/3/5' - }, - { - 'name': '春分', - 'date': '2020/3/20' - }, - { - 'name': '清明', - 'date': '2020/4/4' - }, - { - 'name': '谷雨', - 'date': '2020/4/19' - }, - { - 'name': '立夏', - 'date': '2020/5/5' - }, - { - 'name': '小满', - 'date': '2020/5/20' - }, - { - 'name': '芒种', - 'date': '2020/6/5' - }, - { - 'name': '夏至', - 'date': '2020/6/21' - }, - { - 'name': '小暑', - 'date': '2020/7/6' - }, - { - 'name': '大暑', - 'date': '2020/7/22' - }, - { - 'name': '立秋', - 'date': '2020/8/7' - }, - { - 'name': '处暑', - 'date': '2020/8/22' - }, - { - 'name': '白露', - 'date': '2020/9/7' - }, - { - 'name': '秋分', - 'date': '2020/9/22' - }, - { - 'name': '寒露', - 'date': '2020/10/8' - }, - { - 'name': '霜降', - 'date': '2020/10/23' - }, - { - 'name': '立冬', - 'date': '2020/11/7' - }, - { - 'name': '小雪', - 'date': '2020/11/22' - }, - { - 'name': '大雪', - 'date': '2020/12/7' - }, - { - 'name': '冬至', - 'date': '2020/12/21' - }, - { - 'name': '小寒', - 'date': '2020/1/6' - }, - { - 'name': '大寒', - 'date': '2020/1/20' - } - ] - } -} diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index 5e3510aa8..1818c4874 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -26,7 +26,7 @@ $basic-color: #4284f5 !default; box-sizing: border-box; &:hover:not(.hi-datepicker__input--disabled) { - border: 1px solid #4284f5; + border: 1px solid $basic-color; } &--range { @@ -125,6 +125,10 @@ $basic-color: #4284f5 !default; width: 468px; display: flex; + .hi-datepicker__body--large { + width: 611px; + } + .hi-timepicker { box-shadow: none; border-left: 1px solid #f2f2f2; @@ -189,7 +193,46 @@ $basic-color: #4284f5 !default; width: 683px; &--large { - width: 1060px; + width: 970px; + + .hi-datepicker__panel { + width: 432px; + } + + .hi-datepicker__cell.range-se.hi-datepicker__cell--large { + background-color: #fff; + + .hi-datepicker__content__wrap { + background-color: #4285f4; + + .hi-datepicker__text——holiday { + color: #fff; + + &--work { + color: #fff; + } + } + + .hi-datepicker__text--showLunar { + color: #fff; + } + + .hi-datepicker__content { + background: none; + color: #fff; + } + } + + &.today { + background: none; + + .hi-datepicker__content__wrap { + background-color: #4285f4; + opacity: 1; + border: none; + } + } + } } } } @@ -226,7 +269,7 @@ $basic-color: #4284f5 !default; } &--active { - color: #4284f5; + color: $basic-color; } } @@ -240,7 +283,7 @@ $basic-color: #4284f5 !default; position: relative; &:hover { - color: #4284f5; + color: $basic-color; } } @@ -286,6 +329,7 @@ $basic-color: #4284f5 !default; .hi-datepicker__content { width: 24px; height: 24px; + border-radius: 2px; } } } @@ -360,6 +404,7 @@ $basic-color: #4284f5 !default; .hi-datepicker__content__wrap { width: 52px; + height: 24px; } .hi-datepicker__content--showLunar { @@ -540,6 +585,11 @@ $basic-color: #4284f5 !default; .hi-datepicker__content__wrap { width: 48px; + height: 48px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; } } @@ -552,7 +602,7 @@ $basic-color: #4284f5 !default; color: rgba(44, 48, 78, 0.2); &--festival { - color: #4284f5; + color: $basic-color; } } @@ -597,17 +647,19 @@ $basic-color: #4284f5 !default; &.today:not(.in-range) { .hi-datepicker__content__wrap { .hi-datepicker__content { - border-radius: 2px; margin: auto; border: 1px solid $basic-color; - opacity: 0.8; + color: $basic-color; + } + + .hi-datepicker__text--showLunar { + color: $basic-color; } } } &.today:not(.in-range).hi-datepicker__cell--large { .hi-datepicker__content__wrap { - border-radius: 2px; margin: auto; border: 1px solid $basic-color; opacity: 0.8; @@ -622,7 +674,6 @@ $basic-color: #4284f5 !default; &.current:not(.in-range) { &:not(.hi-datepicker__cell--large) .hi-datepicker__content__wrap { .hi-datepicker__content { - border-radius: 2px; margin: auto; background-color: $basic-color; } diff --git a/components/date-picker/toLunar.js b/components/date-picker/toLunar.js index 47a7aecd4..cb6ca542e 100644 --- a/components/date-picker/toLunar.js +++ b/components/date-picker/toLunar.js @@ -134,8 +134,8 @@ const Lunar = { // @param l_month 阴历正月对应的阳历月份 // @param l_day 阴历初一对应的阳历天 betweenSolarDays: function (year, month, day, l_month, l_day) { - let time1 = new Date(year + '-' + month + '-' + day).getTime(), - time2 = new Date(year + '-' + l_month + '-' + l_day).getTime() + let time1 = new Date(year + '/' + month + '/' + day).getTime(), + time2 = new Date(year + '/' + l_month + '/' + l_day).getTime() return Math.ceil((time1 - time2) / 24 / 3600 / 1000) }, // 根据距离正月初一的天数计算阴历日期 @@ -213,7 +213,7 @@ const Lunar = { toSolar: function (year, month, day) { let yearData = this.lunarInfo[year - this.MIN_YEAR] let between = this.betweenLunarDays(year, month, day) - let ms = new Date(year + '-' + yearData[1] + '-' + yearData[2]).getTime() + let ms = new Date(year + '/' + yearData[1] + '/' + yearData[2]).getTime() let s = ms + between * 24 * 60 * 60 * 1000 let d = new Date() d.setTime(s) diff --git a/components/date-picker/util.js b/components/date-picker/util.js index 099ab773d..3f4963331 100644 --- a/components/date-picker/util.js +++ b/components/date-picker/util.js @@ -1,4 +1,9 @@ +import request from 'axios' import { addMonths, getDay, subDays, differenceInDays, startOfWeek, endOfWeek } from './dateUtil' +const PRC = { + PRCHoliday: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCHoliday.json?', + PRCLunar: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCLunar.json?' +} export const deconstructDate = (date, weekOffset = 0) => { !(date instanceof Date) && (date = new Date(date)) @@ -31,3 +36,19 @@ export const nextMonth = function (date) { !(date instanceof Date) && (date = new Date(date)) return addMonths(date, 1) } +/** + * 是否展示历法次要信息 + * @param {Object} props + */ +export const showLunarStatus = (props) => { + return props.showLunar +} + +export const getPRCDate = (api) => { + const url = PRC[api] + let options = { + url, + method: 'GET' + } + return request.create().request(options) +} diff --git a/components/table/index.js b/components/table/index.js index 99f8e5944..d3ee4d9d7 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -809,7 +809,13 @@ class Table extends Component { if (headers) { options.headers = headers } + console.log(options) + // options = { + // url:'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCHoliday.json', + // method: 'GET', + // } request.create().request(options).then(res => { + console.log('++++', res) let {data, columns, page} = success(res) let columnsDetail = this.setColumnsDetail(null, null, columns) this.setState({ diff --git a/docs/demo/date-picker/section-normal.jsx b/docs/demo/date-picker/section-normal.jsx index 9c3250200..e34bd59fd 100644 --- a/docs/demo/date-picker/section-normal.jsx +++ b/docs/demo/date-picker/section-normal.jsx @@ -15,7 +15,9 @@ class Demo extends React.Component { return (
{console.log('onChange', date, dateStr)}} /> diff --git a/docs/zh-CN/components/date-picker.mdx b/docs/zh-CN/components/date-picker.mdx index 55600fa5a..daab477b8 100755 --- a/docs/zh-CN/components/date-picker.mdx +++ b/docs/zh-CN/components/date-picker.mdx @@ -96,8 +96,12 @@ import DemoModal from '../../demo/date-picker/section-modal.jsx' | maxDate | 最大日期 | Date | null | null | | disabled | 是否禁用输入框 | boolean | true \| false | false | | clearable | 是否可以清空 | boolean | true \| false | true | -| showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | -| showLunar | 是否在日期选择器中显示农历 | boolean | true \| false | false | +| showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | +| showLunar | 是否在日期选择器中显示农历 | boolean | true \| false | false | +| altCalendar | 日期中历法信息 | calendarItem | - | 农历 & 假日 | +| altCalendarPreset | 预置农历信息 | string | PRCLunar | PRCLunar | +| dateMarkRender | 日期的右上角标记 | function(currentDate: timestamp, today: timestamp) => React.ReactNode | - | 休 \| 班 | +| dateMarkPreset | 预置中国大陆节假日 | string | PRCHoliday | PRCHoliday | | shortcuts | 快捷面板 | string[] | 近一周, 近一月, 近三月, 近一年 | null | | weekOffset | 周起始
默认周日做为第一列 | number | 0 \| 1 | 0 | | placeholder | 自定义占位符
数组用于范围日期 | string \| string[] | - | - | @@ -105,6 +109,14 @@ import DemoModal from '../../demo/date-picker/section-modal.jsx' ## Type +### calendarItem +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| -------- | ------- | ------- | ------ | ------ | +| date | 日期 | Date \| string \| timestamp(ms) | - | - | +| text | 描述信息 | string | - | - | + + + ### DateRange | 参数 | 说明 | 类型 | 可选值 | 默认值 | | -------- | --------------- | ---------------- | ------ | ------ | From 4d21ba633a1575d0ef651278048b05682a560958 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Thu, 9 Jan 2020 15:08:37 +0800 Subject: [PATCH 007/115] fix: change color is variable --- CHANGELOG.md | 9 +++++++++ components/date-picker/Calender.js | 5 +++-- components/date-picker/style/index.scss | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2b13025..3b0a77cdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # 更新日志 ## 2.6.3 +- 修复 `` 修改展开内容背景颜色 [#876](https://github.com/XiaoMi/hiui/issues/876) +- 修复 `` 模态对话框 确定 按钮字重 由500改为400 [#898](https://github.com/XiaoMi/hiui/issues/898) +- 修复 `` 数字与/ 的间距调整、省略符的间距调整、 [#862](https://github.com/XiaoMi/hiui/issues/862) +- 修复 `` 视觉还原修改 元素间距调整 [#869](https://github.com/XiaoMi/hiui/issues/868) +- 修复 `` 间距调整、可编辑高度修改、修改hover时颜色 [#875](https://github.com/XiaoMi/hiui/issues/875) +- 修复 ``复选框选中边框样式调整、文案字号调整 [#896](https://github.com/XiaoMi/hiui/issues/896) +- 修复 `` 节点间间距修改 icon和文字间距修改、去除选中时checkbox灰边框 [#895](https://github.com/XiaoMi/hiui/issues/895) +- 修复 ``上传列表Icon颜色修改、上传列表与其他元素间距修改、照片墙上传区添加圆角、上传中显示灰色背景、修改上传失败图标大小 [#897](https://github.com/XiaoMi/hiui/issues/897) + - 修复 `
) } } diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index d11334bfe..bbbcac441 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -7,12 +7,12 @@ import DateRangePanel from './DateRangePanel' import WeekRangePanel from './WeekRangePanel' import Provider from '../context' import { getPRCDate, deconstructDate } from './util' - +import IndiaHoliday from './IndiaHoliday' class DatePicker extends BasePicker { static propTypes = { altCalendar: PropTypes.array, dateMarkRender: PropTypes.func, - altCalendarPreset: PropTypes.oneOf(['zh-CN']), + altCalendarPreset: PropTypes.oneOf(['zh-CN', 'id-ID']), dateMarkPreset: PropTypes.oneOf(['zh-CN']) } constructor (props) { @@ -24,24 +24,46 @@ class DatePicker extends BasePicker { } // 获取预置数据 _getLunarPresetData () { + const {altCalendarPreset, altCalendar} = this.props const allPRCDate = {} - this.props.altCalendarPreset === 'zh-CN' ? getPRCDate('PRCLunar').then(res => { - Object.keys(res.data).forEach(key => { + if (altCalendarPreset === 'zh-CN') { + getPRCDate('PRCLunar').then(res => { + Object.keys(res.data).forEach(key => { + let oneYear = {} + res.data[key].PRCLunar.forEach(item => { + Object.assign(oneYear, { + [item.date.replace(/-/g, '/')]: item.text + }) + }) + Object.assign(allPRCDate, oneYear) + }) + this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : allPRCDate + }) + } else if (altCalendarPreset === 'id-ID') { + Object.keys(IndiaHoliday).forEach(key => { let oneYear = {} - res.data[key].PRCLunar.forEach(item => { + IndiaHoliday[key].IndiaHoliday.forEach(item => { Object.assign(oneYear, { - [item.date.replace(/-/g, '/')]: item.text + [item.date.replace(/-/g, '/')]: { + ...item, + hightlight: true + } }) }) Object.assign(allPRCDate, oneYear) }) - this.altCalendarPresetData = this.props.altCalendar ? this._altCalendarData(allPRCDate) : allPRCDate - }) - : this.altCalendarPresetData = this.props.altCalendar ? this._altCalendarData(allPRCDate) : {} + this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : allPRCDate + } else { + this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : {} + } } // 获取预置数据 _getMarkPresetData () { - this.props.dateMarkPreset === 'zh-CN' && getPRCDate('PRCHoliday').then(res => { + const {altCalendarPreset, dateMarkPreset} = this.props + if (altCalendarPreset && altCalendarPreset !== 'zh-CN') { + return + } + dateMarkPreset === 'zh-CN' && getPRCDate('PRCHoliday').then(res => { const allPRCDate = {} Object.keys(res.data).forEach(key => { Object.keys(res.data[key].PRCHoliday).forEach(elkey => { @@ -53,6 +75,7 @@ class DatePicker extends BasePicker { this.dateMarkPresetData = allPRCDate }) } + // 合并用户自定义的日期信息作为presetData _altCalendarData = (allPRCDate) => { const allData = {} this.props.altCalendar.length > 0 && this.props.altCalendar.forEach(item => { diff --git a/components/date-picker/IndiaHoliday.json b/components/date-picker/IndiaHoliday.json index a59c83daa..c1a5c04cd 100644 --- a/components/date-picker/IndiaHoliday.json +++ b/components/date-picker/IndiaHoliday.json @@ -2,44 +2,44 @@ { "2020":{ "IndiaHoliday":[ - {"date":"2020-1-1","text":"New Years Day"}, - {"date":"2020-1-15","text":"Makar Sankranti,Pongal"}, - {"date":"2020-1-26","text":"Republic Day"}, - {"date":"2020-1-29","text":"Vasant Panchami"}, - {"date":"2020-2-9","text":"Guru Ravidas Jayanti"}, - {"date":"2020-2-18","text":"Maharishi Dayanand Saraswati Jayanti"}, - {"date":"2020-2-21","text":"Maha Shivaratri - Shivaratri"}, - {"date":"2020-3-8","text":"Hazarat Ali's Birthday"}, - {"date":"2020-3-9","text":"Holika Dahana"}, - {"date":"2020-3-10","text":"Dolyatra"}, - {"date":"2020-3-12","text":"Shivaji Jayanti"}, - {"date":"2020-3-20","text":"Parsi New Year"}, - {"date":"2020-3-25","text":"Chaitra Sukhladi"}, - {"date":"2020-4-6","text":"Mahavir Jayanti"}, - {"date":"2020-4-10","text":"Good Friday"}, - {"date":"2020-4-12","text":"Easter"}, - {"date":"2020-4-13","text":"Vaisakhi,Mesadi - Vaisakhadi"}, - {"date":"2020-5-7","text":"Buddha Purnima - Vesak,Birthday of Rabindranath"}, - {"date":"2020-5-22","text":"Jamat Ul-Vida"}, - {"date":"2020-6-23","text":"Rath Yatra"}, - {"date":"2020-8-3 ","text":"Raksha Bandhan"}, - {"date":"2020-8-11","text":"Janmashtami"}, - {"date":"2020-8-15","text":"Independence Day"}, - {"date":"2020-8-21","text":"Onam"}, - {"date":"2020-8-22","text":"Ganesh Chaturthi - Vinayaka Chaturthi"}, - {"date":"2020-8-29","text":"Muharram - Ashura"}, - {"date":"2020-10-2","text":"Mahatma Gandhi Jayanti"}, - {"date":"2020-10-25","text":"Dussehra"}, - {"date":"2020-10-29","text":"Milad un-Nabi - Id-e-Milad"}, - {"date":"2020-10-31","text":"aharishi Valmiki Jayanti"}, - {"date":"2020-11-4","text":"Karaka Chaturthi"}, - {"date":"2020-11-14","text":"Naraka Chaturdasi,Diwali - Deepavali"}, - {"date":"2020-11-15","text":"Govardhan Puja"}, - {"date":"2020-11-16","text":"Bhai Duj"}, - {"date":"2020-11-20","text":"Chhat Puja"}, - {"date":"2020-11-24","text":"Guru Tegh Bahadur's Martyrdom Day"}, - {"date":"2020-12-24","text":"Christmas Eve"}, - {"date":"2020-12-25","text":"Christmas Day"} + {"date":"2020-1-1","text":"New Years","FullText":"New Years Day"}, + {"date":"2020-1-15","text":"MS,Pongal","FullText":"Makar Sankranti,Pongal"}, + {"date":"2020-1-26","text":"Republic","FullText":"Republic Day"}, + {"date":"2020-1-29","text":"VP","FullText":"Vasant Panchami"}, + {"date":"2020-2-9","text":"GRJ","FullText":"Guru Ravidas Jayanti"}, + {"date":"2020-2-18","text":"MDSJ","FullText":"Maharishi Dayanand Saraswati Jayanti"}, + {"date":"2020-2-21","text":"MS-S","FullText":"Maha Shivaratri - Shivaratri"}, + {"date":"2020-3-8","text":"H Ali's","FullText":"Hazarat Ali's Birthday"}, + {"date":"2020-3-9","text":"HD","FullText":"Holika Dahana"}, + {"date":"2020-3-10","text":"Dolyatra","FullText":"Dolyatra"}, + {"date":"2020-3-12","text":"SJ","FullText":"Shivaji Jayanti"}, + {"date":"2020-3-20","text":"Parsi","FullText":"Parsi New Year"}, + {"date":"2020-3-25","text":"CS","FullText":"Chaitra Sukhladi"}, + {"date":"2020-4-6","text":"MJ","FullText":"Mahavir Jayanti"}, + {"date":"2020-4-10","text":"GF","FullText":"Good Friday"}, + {"date":"2020-4-12","text":"Easter","FullText":"Easter"}, + {"date":"2020-4-13","text":"V,M-V","FullText":"Vaisakhi,Mesadi - Vaisakhadi"}, + {"date":"2020-5-7","text":"BP,Ra","FullText":"Buddha Purnima - Vesak,Birthday of Rabindranath"}, + {"date":"2020-5-22","text":"JUlV","FullText":"Jamat Ul-Vida"}, + {"date":"2020-6-23","text":"RY","FullText":"Rath Yatra"}, + {"date":"2020-8-3 ","text":"RB","FullText":"Raksha Bandhan"}, + {"date":"2020-8-11","text":"Janma","FullText":"Janmashtami"}, + {"date":"2020-8-15","text":"Indep","FullText":"Independence Day"}, + {"date":"2020-8-21","text":"Onam","FullText":"Onam"}, + {"date":"2020-8-22","text":"GCVC","FullText":"Ganesh Chaturthi - Vinayaka Chaturthi"}, + {"date":"2020-8-29","text":"M-A","FullText":"Muharram - Ashura"}, + {"date":"2020-10-2","text":"MGJ","FullText":"Mahatma Gandhi Jayanti"}, + {"date":"2020-10-25","text":"Dusse","FullText":"Dussehra"}, + {"date":"2020-10-29","text":"MuNIeM","FullText":"Milad un-Nabi - Id-e-Milad"}, + {"date":"2020-10-31","text":"aVJ","FullText":"aharishi Valmiki Jayanti"}, + {"date":"2020-11-4","text":"KC","FullText":"Karaka Chaturthi"}, + {"date":"2020-11-14","text":"NC,DD","FullText":"Naraka Chaturdasi,Diwali - Deepavali"}, + {"date":"2020-11-15","text":"GP","FullText":"Govardhan Puja"}, + {"date":"2020-11-16","text":"B-Duj","FullText":"Bhai Duj"}, + {"date":"2020-11-20","text":"C-Puja","FullText":"Chhat Puja"}, + {"date":"2020-11-24","text":"Guru","FullText":"Guru Tegh Bahadur's Martyrdom Day"}, + {"date":"2020-12-24","text":"C-Eve","FullText":"Christmas Eve"}, + {"date":"2020-12-25","text":"C-Day","FullText":"Christmas Day"} ] } } diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index 734e812f2..ebbaea66d 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -10,6 +10,48 @@ $basic-color: #4284f5 !default; font-size: 14px; box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.12); + .hi-datepicker__indiaHoli { + display: none; + position: absolute; + top: 36px; + left: 66px; + width: 300px; + text-align: center; + + &-text { + display: inline-block; + max-width: 300px; + word-break: break-all; + background: #edf2fc; + border: 1px solid #d8e5ff; + padding: 7px 12px; + border-radius: 2px; + } + + &-enter { + display: none; + opacity: 0; + transition: all 0.3s ease-in; + } + + &-enter-done { + display: block; + opacity: 1; + transition: all 0.3s ease-in; + } + + &-exit { + display: block; + opacity: 1; + } + + &-exit-done { + display: none; + opacity: 0; + transition: all 0.3s ease-in; + } + } + &__input-root { display: inline-block; } @@ -440,11 +482,11 @@ $basic-color: #4284f5 !default; // width: 100%; // } // } - background: rgba(66, 132, 245, 0.1); + td .hi-datepicker__content__wrap { + background: rgba(66, 132, 245, 0.1); + } .hi-datepicker__content__wrap:hover { - background: none; - .hi-datepicker__content:hover { background: none; } diff --git a/docs/zh-CN/components/date-picker.mdx b/docs/zh-CN/components/date-picker.mdx index 8b48f4e47..0cba1c292 100755 --- a/docs/zh-CN/components/date-picker.mdx +++ b/docs/zh-CN/components/date-picker.mdx @@ -102,7 +102,7 @@ import DemoModal from '../../demo/date-picker/section-modal.jsx' | placeholder | 自定义占位符
数组用于范围日期 | string \| string[] | - | - | | onChange | 值变化时的回调函数 | (date: Date \| DateRange, dateStr: string \| DateRange ) => void | - | - | | altCalendar | 日期中历法信息 | CalendarItem | - | 农历 & 假日 | -| altCalendarPreset | 暂预置农历信息 | string | 'zh-CN' | 'zh-CN' | +| altCalendarPreset | 暂预置历法信息
<阴历\|印度> | string | 'zh-CN' \| 'id-ID' | 'zh-CN' | | dateMarkRender | 日期的右上角标记 | (currentDate: Date, today: Date) => React.ReactNode | - | 休 \| 班 | | dateMarkPreset | 暂预置中国大陆节假日 | string | 'zh-CN' | 'zh-CN' | From bda6c3ddfde803688829c467d4f29e1b30630395 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 13 Mar 2020 19:05:02 +0800 Subject: [PATCH 059/115] fix: #992 --- components/date-picker/style/index.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index ebbaea66d..38af0d714 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -14,13 +14,13 @@ $basic-color: #4284f5 !default; display: none; position: absolute; top: 36px; - left: 66px; - width: 300px; + left: 0; + width: 430px; text-align: center; &-text { display: inline-block; - max-width: 300px; + max-width: 410px; word-break: break-all; background: #edf2fc; border: 1px solid #d8e5ff; From 69a2f9a992f62e669f442edb885fa45b1f7c95b4 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Mon, 16 Mar 2020 16:03:01 +0800 Subject: [PATCH 060/115] fix: #993 --- components/menu/SubMenu.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/menu/SubMenu.js b/components/menu/SubMenu.js index cd0b643e7..cc74c236a 100644 --- a/components/menu/SubMenu.js +++ b/components/menu/SubMenu.js @@ -10,12 +10,16 @@ class SubMenu extends Component { } checkActive (activeIndex, index) { - return activeIndex.indexOf(index) === 0 + const indexArr = index.split('-') + const activeIndexArr = activeIndex.split('-') + return activeIndexArr.slice(0, indexArr.length).join('-') === index } checkExpand (activeIndex, expandIndex, index) { return expandIndex.some(item => { - return item.indexOf(index) === 0 + const indexArr = index.split('-') + const expandIndexArr = item.split('-') + return expandIndexArr.slice(0, indexArr.length).join('-') === index }) } From 4e4ab818224214b8016126499ccd9e9a1f771be7 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Tue, 17 Mar 2020 08:31:41 +0800 Subject: [PATCH 061/115] fix: #992 --- components/date-picker/style/index.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/date-picker/style/index.scss b/components/date-picker/style/index.scss index dc5bb10e3..3a1969a61 100644 --- a/components/date-picker/style/index.scss +++ b/components/date-picker/style/index.scss @@ -614,7 +614,6 @@ $basic-color: #4284f5 !default; .hi-datepicker__content { margin: auto; width: 24px; - border-radius: 2px; &:hover { background-color: rgba(66, 142, 245, 0.1); @@ -622,6 +621,12 @@ $basic-color: #4284f5 !default; } } + &:not(.in-range) { + .hi-datepicker__content { + border-radius: 2px; + } + } + &.range-se:not(.prev):not(.next):not(.hi-datepicker__cell--large) { .hi-datepicker__content__wrap { &:hover { @@ -780,6 +785,7 @@ $basic-color: #4284f5 !default; &__text { display: inline-block; height: 24px; + line-height: 24px; // box-sizing: border-box; // border-radius: 2px; } From 4b2ff09e7ad7d75a3fe5e9ce10cc6b1f7414deac Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Tue, 17 Mar 2020 15:27:58 +0800 Subject: [PATCH 062/115] fix: #992 --- components/date-picker/Calender.js | 2 +- components/date-picker/DateRangePanel.js | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 81e42358b..6623239e8 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -1,9 +1,9 @@ import React, {Component} from 'react' +import { CSSTransition } from 'react-transition-group' import { deconstructDate, getYearWeek, showLargeCalendar } from './util' import Provider from '../context' import Lunar from './toLunar' import {DAY_MILLISECONDS} from './constants' -import { CSSTransition } from 'react-transition-group' import { getDaysInMonth, diff --git a/components/date-picker/DateRangePanel.js b/components/date-picker/DateRangePanel.js index 2513ca11b..194032c4b 100644 --- a/components/date-picker/DateRangePanel.js +++ b/components/date-picker/DateRangePanel.js @@ -348,14 +348,6 @@ class DateRangePanel extends Component { (!shortcuts) && showLargeCalendar(this.props) && 'hi-datepicker__body--range--large' ) - const panelClsleft = classNames( - 'hi-datepicker__panel', - 'hi-datepicker__panel--left' - ) - const panelClsright = classNames( - 'hi-datepicker__panel', - 'hi-datepicker__panel--right' - ) return (
+
{ this.renderHeader(currentView, leftDate, 'left') } @@ -373,7 +365,7 @@ class DateRangePanel extends Component { {this._getNormalComponent(leftDate, 'left')}
-
+
{ this.renderHeader(currentView, rightDate, 'right') } From 2177a499db664013c076864cba56e991a07a4070 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:15:42 +0800 Subject: [PATCH 063/115] fix: dropdown ui bug --- components/dropdown/DropdownMenu.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dropdown/DropdownMenu.jsx b/components/dropdown/DropdownMenu.jsx index 79f9396f5..c8b14947f 100644 --- a/components/dropdown/DropdownMenu.jsx +++ b/components/dropdown/DropdownMenu.jsx @@ -30,7 +30,7 @@ class DropdownMenu extends React.Component { placement={placement} width={width} onMouseEnter={onMouseEnter} - leftGap={1} + leftGap={0} onMouseLeave={onMouseLeave} >
    From 3deea401b381994c09d1f15720fad14bd114d829 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:21:43 +0800 Subject: [PATCH 064/115] fix: carousel color to #fff --- components/carousel/style/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/carousel/style/index.scss b/components/carousel/style/index.scss index 34d58f669..ed186b288 100644 --- a/components/carousel/style/index.scss +++ b/components/carousel/style/index.scss @@ -1,6 +1,6 @@ .hi-carousel { width: 100%; - color: rgba(153, 153, 153, 1); + color: #fff; overflow: hidden; position: relative; From e1498ed928d15f221073725073ad7bcb31f22c3b Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:31:26 +0800 Subject: [PATCH 065/115] fix: alert padding --- components/alert/style/index.scss | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/components/alert/style/index.scss b/components/alert/style/index.scss index 4022cef0b..2aa75598c 100755 --- a/components/alert/style/index.scss +++ b/components/alert/style/index.scss @@ -2,7 +2,7 @@ .hi-alert { position: relative; - padding: 9px 12px; + padding: 9px 11px; background: #ebf2fd; border: 1px solid #b3cdfb; border-radius: 2px; @@ -89,8 +89,15 @@ .hi-alert.theme__#{$key} { &.info { color: $value; - background-color: rgba(map-get(get-palette(get-color($palette-primary, $key)), '50'), 0.1); - border: 1px solid map-get(get-palette(get-color($palette-primary, $key)), '20'); + background-color: + rgba( + map-get(get-palette(get-color($palette-primary, $key)), '50'), + 0.1 + ); + border: + 1px + solid + map-get(get-palette(get-color($palette-primary, $key)), '20'); } } } From 9c5ce7eea3274bfa99e4116b4f7e50948006fb1c Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:32:23 +0800 Subject: [PATCH 066/115] docs: adjust alert chinese name --- docs/zh-CN/components/alert.mdx | 8 ++++---- site/locales/zh-CN.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/zh-CN/components/alert.mdx b/docs/zh-CN/components/alert.mdx index 72f84f0a2..cc1bd8e56 100755 --- a/docs/zh-CN/components/alert.mdx +++ b/docs/zh-CN/components/alert.mdx @@ -1,4 +1,4 @@ -# Alert 警告 +# Alert 警告提示 作用于页面的内容区域的提示,非触发类信息 @@ -38,9 +38,9 @@ import DemoAutoClose from '../../demo/alert/section-autoClose.jsx' | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | -| type | 警告框类型 | string | 'info' \| 'success' \| 'error' \| 'warning' | 'info' | -| title | 警告框标题 | string | - | - | -| content | 警告框内容 | string | - | - | +| type | 警告提示类型 | string | 'info' \| 'success' \| 'error' \| 'warning' | 'info' | +| title | 警告提示标题 | string | - | - | +| content | 警告提示内容 | string | - | - | | closeable | 是否可关闭 | boolean | true \| false | false | | onClose | 关闭事件触发时的回调 | (e: MouseEvent) => void | - | - | | duration | 自动关闭时间,单位为毫秒 | number \| null | - | null | diff --git a/site/locales/zh-CN.js b/site/locales/zh-CN.js index 93aa5eb95..c8a7b8cf2 100755 --- a/site/locales/zh-CN.js +++ b/site/locales/zh-CN.js @@ -26,7 +26,7 @@ module.exports = { modal: 'Modal 模态对话框', confirm: 'confirm 方法组件', form: 'Form 表单', - alert: 'Alert 警告框', + alert: 'Alert 警告提示', message: 'Message 消息', panel: 'Panel 面板', collapse: 'Collapse 折叠面板', From 8e9766c41fbdfedaadad17a1a8ba3ace403c592f Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:36:38 +0800 Subject: [PATCH 067/115] docs: fix demo color --- docs/demo/grid/section-block.jsx | 10 ++++++---- docs/demo/grid/section-nest.jsx | 6 ++++-- docs/demo/grid/section-offset.jsx | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/demo/grid/section-block.jsx b/docs/demo/grid/section-block.jsx index 8274762de..a8dafb138 100644 --- a/docs/demo/grid/section-block.jsx +++ b/docs/demo/grid/section-block.jsx @@ -16,17 +16,19 @@ class Demo extends React.Component {
    col-6
    25%
    -
    col-6
    25%
    +
    col-6
    25%
    -
    col-6
    25%
    +
    col-6
    25%
    -
    col-6
    25%
    +
    col-6
    25%
    ) } }` -const DemoBlock = () => +const DemoBlock = () => ( + +) export default DemoBlock diff --git a/docs/demo/grid/section-nest.jsx b/docs/demo/grid/section-nest.jsx index c5a39c8af..299090263 100644 --- a/docs/demo/grid/section-nest.jsx +++ b/docs/demo/grid/section-nest.jsx @@ -13,7 +13,7 @@ class Demo extends React.Component { return ( -
    +
    col-16 @@ -32,5 +32,7 @@ class Demo extends React.Component { ) } }` -const DemoNest = () => +const DemoNest = () => ( + +) export default DemoNest diff --git a/docs/demo/grid/section-offset.jsx b/docs/demo/grid/section-offset.jsx index 827c0e083..8df179c39 100644 --- a/docs/demo/grid/section-offset.jsx +++ b/docs/demo/grid/section-offset.jsx @@ -17,7 +17,7 @@ class Demo extends React.Component {
    col-8
    -
    col-6-offset-6
    +
    col-6-offset-6
    col-4
    @@ -28,7 +28,7 @@ class Demo extends React.Component {
    col-4
    -
    col-6-offset-4
    +
    col-6-offset-4
    col-4
    @@ -41,5 +41,7 @@ class Demo extends React.Component { ) } }` -const DemoOffset = () => +const DemoOffset = () => ( + +) export default DemoOffset From 28d2fdbc3b74c13d29babffc71878e04873d58a8 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:46:48 +0800 Subject: [PATCH 068/115] fix: select dropdown not justify --- components/select/Select.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components/select/Select.js b/components/select/Select.js index 726707850..78528ae90 100644 --- a/components/select/Select.js +++ b/components/select/Select.js @@ -612,6 +612,7 @@ class Select extends Component { attachEle={this.selectInputContainer} zIndex={1050} topGap={5} + leftGap={0} className="hi-select__popper" placement="top-bottom-start" > From 64e50cb8b902ad2920fdafb13c3f0791895a5c21 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 15:56:00 +0800 Subject: [PATCH 069/115] fix: adjust #d9d9d9 to #d8d8d8 --- components/cascader/style/cascader.scss | 2 +- components/collapse/style/index.scss | 2 +- components/select/style/select-input.scss | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cascader/style/cascader.scss b/components/cascader/style/cascader.scss index 26695e6e2..8dcb72950 100644 --- a/components/cascader/style/cascader.scss +++ b/components/cascader/style/cascader.scss @@ -36,7 +36,7 @@ $cascader: 'hi-cascader' !default; display: flex; align-items: center; padding: 5px 12px; - border: 1px solid #d9d9d9; + border: 1px solid #d8d8d8; } &__input-keyword { diff --git a/components/collapse/style/index.scss b/components/collapse/style/index.scss index 7dbc163c1..0b052f9f3 100755 --- a/components/collapse/style/index.scss +++ b/components/collapse/style/index.scss @@ -6,7 +6,7 @@ font-size: 14px; .collapse-item { - border-bottom: 1px solid #d9d9d9; + border-bottom: 1px solid #d8d8d8; &__head { display: flex; diff --git a/components/select/style/select-input.scss b/components/select/style/select-input.scss index a9004f4d3..ce4d4f34d 100644 --- a/components/select/style/select-input.scss +++ b/components/select/style/select-input.scss @@ -14,7 +14,7 @@ color: #333; line-height: 1; border-radius: 2px; - border: 1px solid #d9d9d9; + border: 1px solid #d8d8d8; cursor: pointer; outline: none; user-select: none; From 547f8abca298b205b32768f38c836e4ddaac1aba Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 16:02:48 +0800 Subject: [PATCH 070/115] fix: pagination border color --- components/pagination/style/index.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/pagination/style/index.scss b/components/pagination/style/index.scss index 512ac43d9..705dfa8bb 100644 --- a/components/pagination/style/index.scss +++ b/components/pagination/style/index.scss @@ -57,6 +57,10 @@ &__span { display: inline-block; margin: 0 $spacer-1; + + .hi-select__input { + border: 1px solid $gray-light; + } } &__jumper-input { @@ -67,6 +71,10 @@ .hi-input { width: 64px; + &__inner { + border: 1px solid $gray-light; + } + &__text { text-align: center; } From 683269b2877e173a94c6775b8608d6784398f2ff Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 16:35:56 +0800 Subject: [PATCH 071/115] fix: modal default footer --- components/modal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/modal/index.js b/components/modal/index.js index 309d55922..e3f65195f 100755 --- a/components/modal/index.js +++ b/components/modal/index.js @@ -87,7 +87,7 @@ class Modal extends Component { return footers || footer } else { return [ - , - ]} > 一些消息 一些消息 From a5ae21de809ee66e0589831664f965920b321247 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 16:36:46 +0800 Subject: [PATCH 073/115] fix: counter border color --- components/counter/style/index.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/counter/style/index.scss b/components/counter/style/index.scss index 9885177f0..6cf331eaf 100644 --- a/components/counter/style/index.scss +++ b/components/counter/style/index.scss @@ -32,7 +32,7 @@ $counter: 'hi-counter' !default; width: $m-width-ceil; height: $m-width-ceil; line-height: $m-width-ceil; - border: 1px solid $border-color-normal; + border: 1px solid $gray-light; border-radius: 2px; font-weight: bold; color: $active-color; @@ -64,7 +64,7 @@ $counter: 'hi-counter' !default; flex: 1 1 auto; width: 2 * $m-width-ceil; padding: 0 6px; - border: 1px solid $border-color-normal; + border: 1px solid $gray-light; color: $normal-color; outline: none; box-sizing: border-box; From 053c999a7302472a2d6ecc664ee4c51c909dfa7d Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 17:09:08 +0800 Subject: [PATCH 074/115] fix: update button tab style --- components/tabs/style/index.scss | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/components/tabs/style/index.scss b/components/tabs/style/index.scss index af5072a64..f85f2fc84 100644 --- a/components/tabs/style/index.scss +++ b/components/tabs/style/index.scss @@ -54,8 +54,8 @@ $prefix: 'hi-tabs' !default; } .#{$prefix}__item { - height: 40px; - line-height: 40px; + height: 48px; + line-height: 46px; padding: 0 16px; box-sizing: border-box; @@ -217,18 +217,22 @@ $prefix: 'hi-tabs' !default; .#{$prefix}__item { flex: none; height: 36px; - line-height: 36px; - padding: 0 24px; + line-height: 34px; + padding: 0 23px; box-sizing: border-box; + margin-right: 24px; + border: 1px solid #d8d8d8; + border-radius: 18px; - &:hover { + &:hover:not(.hi-tabs__item--active) { color: #4284f5; + border: 1px solid #4284f5; } &--active { - color: #4284f5; + color: #fff; + background-color: #4284f5; border: 1px solid #4284f5; - border-radius: 18px; } } } @@ -315,12 +319,13 @@ $prefix: 'hi-tabs' !default; &--button { .#{$prefix}__item { - &:hover { + &:hover:not(.hi-tabs__item--active) { color: $value; + border: 1px solid $value; } &--active { - color: $value; + background-color: $value; border: 1px solid $value; } } From 06297f4ec7afd8dce7ac2fde62f1dc3304e42dee Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 17:47:08 +0800 Subject: [PATCH 075/115] fix: carousel arrow add hover style --- components/carousel/style/index.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/carousel/style/index.scss b/components/carousel/style/index.scss index ed186b288..b8653ad91 100644 --- a/components/carousel/style/index.scss +++ b/components/carousel/style/index.scss @@ -69,6 +69,10 @@ margin-left: 24px; cursor: pointer; + &:hover { + background: rgba(0, 0, 0, 0.45); + } + &:last-child { margin-right: 24px; } From e002602da0232cdd1a608b59c613ddbe3ded7cfe Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 17:59:07 +0800 Subject: [PATCH 076/115] fix: update badage style --- components/badge/style/index.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/badge/style/index.scss b/components/badge/style/index.scss index 977e08ef9..a19facc4f 100755 --- a/components/badge/style/index.scss +++ b/components/badge/style/index.scss @@ -11,6 +11,7 @@ transform: translateX(50%); height: 16px; padding: 0 4px; + min-width: 8px; border: 2px solid #fff; border-radius: 10px; line-height: 16px; @@ -29,7 +30,7 @@ position: absolute; width: 8px; height: 8px; - top: -7px; + top: -5px; right: -5px; background: #f44141; border: 1px solid #fff; From 2be32bf9ae808d9d7162e151d4c05b51fbe05e7f Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 18:09:27 +0800 Subject: [PATCH 077/115] fix: tree checkbox margin --- components/tree/style/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tree/style/index.scss b/components/tree/style/index.scss index 8252c7d95..92e99ef6e 100644 --- a/components/tree/style/index.scss +++ b/components/tree/style/index.scss @@ -21,7 +21,7 @@ $tree: 'hi-tree' !default; /* =========== */ .hi-checkbox-legacy { - margin-left: 8px; + margin-left: 6px; } .hi-checkbox-legacy--part .hi-checkbox-legacy__input { From 3fdd7fe9303fdacf1870a21f1fc7c6a641c0a7c9 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Wed, 18 Mar 2020 19:24:11 +0800 Subject: [PATCH 078/115] fix: #992 --- components/select/SelectDropdown.js | 3 +++ docs/demo/date-picker/section-calendar.jsx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/select/SelectDropdown.js b/components/select/SelectDropdown.js index 82c95b790..c4b505bc6 100644 --- a/components/select/SelectDropdown.js +++ b/components/select/SelectDropdown.js @@ -12,12 +12,15 @@ class SelectDropdown extends Component { searchbarValue: '', cachedropdownItems: this.props.dropdownItems } + console.log('filterItems', this.state.filterItems) } static getDerivedStateFromProps (nextProps, prevState) { const {selectedItems, mode, isOnSearch, dropdownItems, show} = nextProps const {searchbarValue, cachedropdownItems} = prevState const _filterItems = selectedItems.length > 0 && searchbarValue.length === 0 && mode === 'single' && isOnSearch ? cachedropdownItems : dropdownItems const _searchbarValue = show ? searchbarValue : '' + console.log('_filterItems', _filterItems) + return {filterItems: _filterItems, searchbarValue: _searchbarValue} } componentDidMount () { diff --git a/docs/demo/date-picker/section-calendar.jsx b/docs/demo/date-picker/section-calendar.jsx index db5668a4e..8ab27bac5 100644 --- a/docs/demo/date-picker/section-calendar.jsx +++ b/docs/demo/date-picker/section-calendar.jsx @@ -1,7 +1,7 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' import DatePicker from '../../../components/date-picker' -const prefix = 'date-picker-normal' +const prefix = 'date-picker-calendar' const rightOptions = ['预置农历', '自定义日期信息'] const code = [ { From 3c2ac92bc8965a4e0c1ec20a7f29c1a5fb0d94cc Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Wed, 18 Mar 2020 19:28:00 +0800 Subject: [PATCH 079/115] fix: #992 --- components/select/SelectDropdown.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/select/SelectDropdown.js b/components/select/SelectDropdown.js index c4b505bc6..82c95b790 100644 --- a/components/select/SelectDropdown.js +++ b/components/select/SelectDropdown.js @@ -12,15 +12,12 @@ class SelectDropdown extends Component { searchbarValue: '', cachedropdownItems: this.props.dropdownItems } - console.log('filterItems', this.state.filterItems) } static getDerivedStateFromProps (nextProps, prevState) { const {selectedItems, mode, isOnSearch, dropdownItems, show} = nextProps const {searchbarValue, cachedropdownItems} = prevState const _filterItems = selectedItems.length > 0 && searchbarValue.length === 0 && mode === 'single' && isOnSearch ? cachedropdownItems : dropdownItems const _searchbarValue = show ? searchbarValue : '' - console.log('_filterItems', _filterItems) - return {filterItems: _filterItems, searchbarValue: _searchbarValue} } componentDidMount () { From cc0541024e55997bc566929b5e5e0469d54d420c Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Wed, 18 Mar 2020 20:33:42 +0800 Subject: [PATCH 080/115] fix: #992 --- components/date-picker/BasePicker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/date-picker/BasePicker.js b/components/date-picker/BasePicker.js index 8aa1dd62b..0c0b516cd 100644 --- a/components/date-picker/BasePicker.js +++ b/components/date-picker/BasePicker.js @@ -2,7 +2,7 @@ import React, {Component} from 'react' import Modal from './Modal' import classNames from 'classnames' import {formatterDate, FORMATS} from './constants' - +import {showLargeCalendar} from './util' import PropTypes from 'prop-types' import DatePickerType from './Type' @@ -70,6 +70,9 @@ class BasePicker extends Component { if (type === 'daterange' && showTime) { _h = 344 } + if (showLargeCalendar(this.props)) { + _h = 440 + } const _cw = document.documentElement.clientWidth || document.body.clientWidth const _ch = document.documentElement.clientHeight || document.body.clientHeight const _st = document.documentElement.scrollTop || document.body.scrollTop From 46d0bb6f3e9deee483817689420a9f04614a7160 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 21:00:00 +0800 Subject: [PATCH 081/115] chore: update version and changelog --- CHANGELOG.md | 6 ++++++ docs/zh-CN/components/changelog.mdx | 6 ++++++ package.json | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4adf39ef5..6c54e3894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +## 2.11.0 + +- 新增 `` 支持农历、节假日(中国和印度)显示 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) +- 修复 `` 高亮、展开对应菜单项不正确的问题 [#993](https://github.com/XiaoMi/hiui/issues/993) +- 优化若干视觉还原问题:[#990](https://github.com/XiaoMi/hiui/issues/990) [#991](https://github.com/XiaoMi/hiui/issues/991) [#998](https://github.com/XiaoMi/hiui/issues/998) [#1000](https://github.com/XiaoMi/hiui/issues/1000) [#954](https://github.com/XiaoMi/hiui/issues/954) [#1001](https://github.com/XiaoMi/hiui/issues/1001) [#1002](https://github.com/XiaoMi/hiui/issues/1002) [#1003](https://github.com/XiaoMi/hiui/issues/1003) [#1004](https://github.com/XiaoMi/hiui/issues/1004) [#1005](https://github.com/XiaoMi/hiui/issues/1005) + ## 2.10.0 - 新增 `` onDownload 点击上传成功文件的回调 [#613](https://github.com/XiaoMi/hiui/issues/613) diff --git a/docs/zh-CN/components/changelog.mdx b/docs/zh-CN/components/changelog.mdx index 4adf39ef5..6c54e3894 100644 --- a/docs/zh-CN/components/changelog.mdx +++ b/docs/zh-CN/components/changelog.mdx @@ -1,5 +1,11 @@ # 更新日志 +## 2.11.0 + +- 新增 `` 支持农历、节假日(中国和印度)显示 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) +- 修复 `` 高亮、展开对应菜单项不正确的问题 [#993](https://github.com/XiaoMi/hiui/issues/993) +- 优化若干视觉还原问题:[#990](https://github.com/XiaoMi/hiui/issues/990) [#991](https://github.com/XiaoMi/hiui/issues/991) [#998](https://github.com/XiaoMi/hiui/issues/998) [#1000](https://github.com/XiaoMi/hiui/issues/1000) [#954](https://github.com/XiaoMi/hiui/issues/954) [#1001](https://github.com/XiaoMi/hiui/issues/1001) [#1002](https://github.com/XiaoMi/hiui/issues/1002) [#1003](https://github.com/XiaoMi/hiui/issues/1003) [#1004](https://github.com/XiaoMi/hiui/issues/1004) [#1005](https://github.com/XiaoMi/hiui/issues/1005) + ## 2.10.0 - 新增 `` onDownload 点击上传成功文件的回调 [#613](https://github.com/XiaoMi/hiui/issues/613) diff --git a/package.json b/package.json index c2413920e..1d756984c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hi-ui/hiui", - "version": "2.10.0", + "version": "2.11.0", "description": "HIUI for React", "scripts": { "test": "node_modules/.bin/standard && node_modules/.bin/stylelint --config .stylelintrc 'components/**/*.scss'", From cdb5c794d61dad27c2cd77c6f6459cfcd5063f8c Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 21:24:59 +0800 Subject: [PATCH 082/115] fix: spell mistake --- components/date-picker/Calender.js | 8 ++++---- components/date-picker/DatePicker.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 6623239e8..77c06d61c 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -249,19 +249,19 @@ class Calender extends Component { const LunarInfo = Lunar.toLunar(_year, _month, _value) let lunarcellinfo = { text: altCalendarPreset === 'zh-CN' ? LunarInfo[6] : null, // 默认预置信息 - hightlight: false + highlight: false } if (altCalendar || dateMarkRender) { lunarcellinfo = { text: this.altCalendarText(datainfo, lunarcellinfo), - hightlight: altCalendarPresetData && altCalendarPresetData[datainfo] && altCalendarPresetData[datainfo].hightlight, + highlight: altCalendarPresetData && altCalendarPresetData[datainfo] && altCalendarPresetData[datainfo].highlight, nodeMark: this.markRender(datainfo) } } if ((dateMarkPresetData && dateMarkPresetData[datainfo]) || (altCalendarPresetData && altCalendarPresetData[datainfo])) { lunarcellinfo = { text: this.altCalendarText(datainfo, lunarcellinfo), - hightlight: altCalendarPresetData && altCalendarPresetData[datainfo] && altCalendarPresetData[datainfo].hightlight, + highlight: altCalendarPresetData && altCalendarPresetData[datainfo] && altCalendarPresetData[datainfo].highlight, nodeMark: this.markRender(datainfo) } } @@ -338,7 +338,7 @@ class Calender extends Component { }} > { - fullTimeInfo.hightlight + fullTimeInfo.highlight ? {fullTimeInfo.text} diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index bbbcac441..cc18e8248 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -46,7 +46,7 @@ class DatePicker extends BasePicker { Object.assign(oneYear, { [item.date.replace(/-/g, '/')]: { ...item, - hightlight: true + highlight: true } }) }) From 4fa228fbfb6fa3f4546037acdfc44afa01118051 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 21:25:34 +0800 Subject: [PATCH 083/115] docs: update datepicker --- docs/demo/date-picker/section-calendar.jsx | 2 +- docs/zh-CN/components/date-picker.mdx | 48 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/demo/date-picker/section-calendar.jsx b/docs/demo/date-picker/section-calendar.jsx index 8ab27bac5..7bc0f1cd0 100644 --- a/docs/demo/date-picker/section-calendar.jsx +++ b/docs/demo/date-picker/section-calendar.jsx @@ -55,7 +55,7 @@ class Demo extends React.Component { { date:'2020/4/8', text:'十周年', - hightlight: true + highlight: true }, ]} dateMarkRender = { diff --git a/docs/zh-CN/components/date-picker.mdx b/docs/zh-CN/components/date-picker.mdx index 8c443bd6e..6089c13a9 100755 --- a/docs/zh-CN/components/date-picker.mdx +++ b/docs/zh-CN/components/date-picker.mdx @@ -46,34 +46,34 @@ import DemoCalendar from '../../demo/date-picker/section-calendar.jsx' ## Props -| 参数 | 说明 | 类型 | 可选值 | 默认值 | -| ----------- | --------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -| type | 选择器类型 | string | date 普通日期
    daterange 日期范围
    year 年份
    month 月份
    week 周
    weekrange 周范围
    timeperiod 时间段(1.5 新增) | date | -| value | 默认显示的日期 | Date \| string \| number\| DateRange \| undefined \| null | - | null | -| minDate | 最小日期 | Date | null | null | -| maxDate | 最大日期 | Date | null | null | -| disabled | 是否禁用输入框 | boolean | true \| false | false | -| disabledDate | 不可选择的日期 | (currentDate: Date) => boolean | true \| false | false | -| clearable | 是否可以清空 | boolean | true \| false | true | -| showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | -| shortcuts | 快捷面板 | string[] | 近一周, 近一月, 近三月, 近一年 | null | -| weekOffset | 周起始
    默认周日做为第一列 | number | 0 \| 1 | 0 | -| placeholder | 自定义占位符
    数组用于范围日期 | string \| string[] | - | - | -| onChange | 值变化时的回调函数 | (date: Date \| DateRange, dateStr: string \| DateRange ) => void | - | - | -| altCalendar | 日期中历法信息 | CalendarItem | - | 农历 & 假日 | -| altCalendarPreset | 暂预置历法信息
    <阴历\|印度> | string | 'zh-CN' \| 'id-ID' | 'zh-CN' | -| dateMarkRender | 日期的右上角标记 | (currentDate: Date, today: Date) => React.ReactNode | - | 休 \| 班 | -| dateMarkPreset | 暂预置中国大陆节假日 | string | 'zh-CN' | 'zh-CN' | - +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ----------------- | ---------------------------------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| type | 选择器类型 | string | date 普通日期
    daterange 日期范围
    year 年份
    month 月份
    week 周
    weekrange 周范围
    timeperiod 时间段(1.5 新增) | date | +| value | 默认显示的日期 | Date \| string \| number\| DateRange \| undefined \| null | - | null | +| minDate | 最小日期 | Date | null | null | +| maxDate | 最大日期 | Date | null | null | +| disabled | 是否禁用输入框 | boolean | true \| false | false | +| disabledDate | 不可选择的日期 | (currentDate: Date) => boolean | true \| false | false | +| clearable | 是否可以清空 | boolean | true \| false | true | +| showTime | 是否在日期选择器中显示时间选择器 | boolean | true \| false | false | +| shortcuts | 快捷面板 | string[] | 近一周, 近一月, 近三月, 近一年 | null | +| weekOffset | 周起始,默认周日做为第一列 | number | 0 \| 1 | 0 | +| placeholder | 自定义占位符(数组用于范围日期) | string \| string[] | - | - | +| onChange | 值变化时的回调函数 | (date: Date \| DateRange, dateStr: string \| DateRange ) => void | - | - | +| altCalendar | 自定义日期中历法展示信息 | CalendarItem | - | 农历 & 假日 | +| altCalendarPreset | 预置历法信息(支持中国农历和印度节假日) | string | 'zh-CN' \| 'id-ID' | 'zh-CN' | +| dateMarkRender | 自定义日期的右上角标记 | (currentDate: Date, today: Date) => React.ReactNode | - | - | +| dateMarkPreset | 预置日期的右上角标记(休 \| 班) | string | 'zh-CN' | 'zh-CN' | ## Type + ### CalendarItem -| 参数 | 说明 | 类型 | 可选值 | 默认值 | -| -------- | ------- | ------- | ------ | ------ | -| date | 日期 | Date \| string | - | - | -| text | 描述信息 | string | - | - | -| hightlight | 高亮显示 | boolean | true \| false | false | +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| --------- | -------- | -------------- | ------------- | ------ | +| date | 日期 | Date \| string | - | - | +| text | 描述信息 | string | - | - | +| highlight | 高亮显示 | boolean | true \| false | false | ### DateRange From 80517697dcf7d436fb0d9c04b75a41bc2e0e6cbb Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 21:26:47 +0800 Subject: [PATCH 084/115] chore: update changelog --- CHANGELOG.md | 2 +- docs/zh-CN/components/changelog.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c54e3894..f393719da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.11.0 -- 新增 `` 支持农历、节假日(中国和印度)显示 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) +- 新增 `` altCalendarPreset 预设历法信息(支持中国农历和印度节假日),altCalendar 自定义日期显示,dateMarkRender 自定义日期右上角显示标志,dateMarkPreset 预设右上角显示标志「班」和「休」 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) - 修复 `` 高亮、展开对应菜单项不正确的问题 [#993](https://github.com/XiaoMi/hiui/issues/993) - 优化若干视觉还原问题:[#990](https://github.com/XiaoMi/hiui/issues/990) [#991](https://github.com/XiaoMi/hiui/issues/991) [#998](https://github.com/XiaoMi/hiui/issues/998) [#1000](https://github.com/XiaoMi/hiui/issues/1000) [#954](https://github.com/XiaoMi/hiui/issues/954) [#1001](https://github.com/XiaoMi/hiui/issues/1001) [#1002](https://github.com/XiaoMi/hiui/issues/1002) [#1003](https://github.com/XiaoMi/hiui/issues/1003) [#1004](https://github.com/XiaoMi/hiui/issues/1004) [#1005](https://github.com/XiaoMi/hiui/issues/1005) diff --git a/docs/zh-CN/components/changelog.mdx b/docs/zh-CN/components/changelog.mdx index 6c54e3894..f393719da 100644 --- a/docs/zh-CN/components/changelog.mdx +++ b/docs/zh-CN/components/changelog.mdx @@ -2,7 +2,7 @@ ## 2.11.0 -- 新增 `` 支持农历、节假日(中国和印度)显示 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) +- 新增 `` altCalendarPreset 预设历法信息(支持中国农历和印度节假日),altCalendar 自定义日期显示,dateMarkRender 自定义日期右上角显示标志,dateMarkPreset 预设右上角显示标志「班」和「休」 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) - 修复 `` 高亮、展开对应菜单项不正确的问题 [#993](https://github.com/XiaoMi/hiui/issues/993) - 优化若干视觉还原问题:[#990](https://github.com/XiaoMi/hiui/issues/990) [#991](https://github.com/XiaoMi/hiui/issues/991) [#998](https://github.com/XiaoMi/hiui/issues/998) [#1000](https://github.com/XiaoMi/hiui/issues/1000) [#954](https://github.com/XiaoMi/hiui/issues/954) [#1001](https://github.com/XiaoMi/hiui/issues/1001) [#1002](https://github.com/XiaoMi/hiui/issues/1002) [#1003](https://github.com/XiaoMi/hiui/issues/1003) [#1004](https://github.com/XiaoMi/hiui/issues/1004) [#1005](https://github.com/XiaoMi/hiui/issues/1005) From ac08a66f3c1742f57854bffd2a01831c62ada08d Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Wed, 18 Mar 2020 22:03:07 +0800 Subject: [PATCH 085/115] fix: #992 --- components/date-picker/DatePicker.js | 2 +- components/date-picker/IndiaHoliday.js | 45 +++++++++++++++++++++++ components/date-picker/IndiaHoliday.json | 46 ------------------------ 3 files changed, 46 insertions(+), 47 deletions(-) create mode 100644 components/date-picker/IndiaHoliday.js delete mode 100644 components/date-picker/IndiaHoliday.json diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index cc18e8248..2a49e6a64 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -7,7 +7,7 @@ import DateRangePanel from './DateRangePanel' import WeekRangePanel from './WeekRangePanel' import Provider from '../context' import { getPRCDate, deconstructDate } from './util' -import IndiaHoliday from './IndiaHoliday' +import IndiaHoliday from './IndiaHoliday.js' class DatePicker extends BasePicker { static propTypes = { altCalendar: PropTypes.array, diff --git a/components/date-picker/IndiaHoliday.js b/components/date-picker/IndiaHoliday.js new file mode 100644 index 000000000..dd80315b1 --- /dev/null +++ b/components/date-picker/IndiaHoliday.js @@ -0,0 +1,45 @@ + +export default { + '2020': { + 'IndiaHoliday': [ + {'date': '2020-1-1', 'text': 'New Years', 'FullText': 'New Years Day'}, + {'date': '2020-1-15', 'text': 'MS,Pongal', 'FullText': 'Makar Sankranti,Pongal'}, + {'date': '2020-1-26', 'text': 'Republic', 'FullText': 'Republic Day'}, + {'date': '2020-1-29', 'text': 'VP', 'FullText': 'Vasant Panchami'}, + {'date': '2020-2-9', 'text': 'GRJ', 'FullText': 'Guru Ravidas Jayanti'}, + {'date': '2020-2-18', 'text': 'MDSJ', 'FullText': 'Maharishi Dayanand Saraswati Jayanti'}, + {'date': '2020-2-21', 'text': 'MS-S', 'FullText': 'Maha Shivaratri - Shivaratri'}, + {'date': '2020-3-8', 'text': "H Ali's", 'FullText': "Hazarat Ali's Birthday"}, + {'date': '2020-3-9', 'text': 'HD', 'FullText': 'Holika Dahana'}, + {'date': '2020-3-10', 'text': 'Dolyatra', 'FullText': 'Dolyatra'}, + {'date': '2020-3-12', 'text': 'SJ', 'FullText': 'Shivaji Jayanti'}, + {'date': '2020-3-20', 'text': 'Parsi', 'FullText': 'Parsi New Year'}, + {'date': '2020-3-25', 'text': 'CS', 'FullText': 'Chaitra Sukhladi'}, + {'date': '2020-4-6', 'text': 'MJ', 'FullText': 'Mahavir Jayanti'}, + {'date': '2020-4-10', 'text': 'GF', 'FullText': 'Good Friday'}, + {'date': '2020-4-12', 'text': 'Easter', 'FullText': 'Easter'}, + {'date': '2020-4-13', 'text': 'V,M-V', 'FullText': 'Vaisakhi,Mesadi - Vaisakhadi'}, + {'date': '2020-5-7', 'text': 'BP,Ra', 'FullText': 'Buddha Purnima - Vesak,Birthday of Rabindranath'}, + {'date': '2020-5-22', 'text': 'JUlV', 'FullText': 'Jamat Ul-Vida'}, + {'date': '2020-6-23', 'text': 'RY', 'FullText': 'Rath Yatra'}, + {'date': '2020-8-3 ', 'text': 'RB', 'FullText': 'Raksha Bandhan'}, + {'date': '2020-8-11', 'text': 'Janma', 'FullText': 'Janmashtami'}, + {'date': '2020-8-15', 'text': 'Indep', 'FullText': 'Independence Day'}, + {'date': '2020-8-21', 'text': 'Onam', 'FullText': 'Onam'}, + {'date': '2020-8-22', 'text': 'GCVC', 'FullText': 'Ganesh Chaturthi - Vinayaka Chaturthi'}, + {'date': '2020-8-29', 'text': 'M-A', 'FullText': 'Muharram - Ashura'}, + {'date': '2020-10-2', 'text': 'MGJ', 'FullText': 'Mahatma Gandhi Jayanti'}, + {'date': '2020-10-25', 'text': 'Dusse', 'FullText': 'Dussehra'}, + {'date': '2020-10-29', 'text': 'MuNIeM', 'FullText': 'Milad un-Nabi - Id-e-Milad'}, + {'date': '2020-10-31', 'text': 'aVJ', 'FullText': 'aharishi Valmiki Jayanti'}, + {'date': '2020-11-4', 'text': 'KC', 'FullText': 'Karaka Chaturthi'}, + {'date': '2020-11-14', 'text': 'NC,DD', 'FullText': 'Naraka Chaturdasi,Diwali - Deepavali'}, + {'date': '2020-11-15', 'text': 'GP', 'FullText': 'Govardhan Puja'}, + {'date': '2020-11-16', 'text': 'B-Duj', 'FullText': 'Bhai Duj'}, + {'date': '2020-11-20', 'text': 'C-Puja', 'FullText': 'Chhat Puja'}, + {'date': '2020-11-24', 'text': 'Guru', 'FullText': "Guru Tegh Bahadur's Martyrdom Day"}, + {'date': '2020-12-24', 'text': 'C-Eve', 'FullText': 'Christmas Eve'}, + {'date': '2020-12-25', 'text': 'C-Day', 'FullText': 'Christmas Day'} + ] + } +} diff --git a/components/date-picker/IndiaHoliday.json b/components/date-picker/IndiaHoliday.json deleted file mode 100644 index c1a5c04cd..000000000 --- a/components/date-picker/IndiaHoliday.json +++ /dev/null @@ -1,46 +0,0 @@ - -{ - "2020":{ - "IndiaHoliday":[ - {"date":"2020-1-1","text":"New Years","FullText":"New Years Day"}, - {"date":"2020-1-15","text":"MS,Pongal","FullText":"Makar Sankranti,Pongal"}, - {"date":"2020-1-26","text":"Republic","FullText":"Republic Day"}, - {"date":"2020-1-29","text":"VP","FullText":"Vasant Panchami"}, - {"date":"2020-2-9","text":"GRJ","FullText":"Guru Ravidas Jayanti"}, - {"date":"2020-2-18","text":"MDSJ","FullText":"Maharishi Dayanand Saraswati Jayanti"}, - {"date":"2020-2-21","text":"MS-S","FullText":"Maha Shivaratri - Shivaratri"}, - {"date":"2020-3-8","text":"H Ali's","FullText":"Hazarat Ali's Birthday"}, - {"date":"2020-3-9","text":"HD","FullText":"Holika Dahana"}, - {"date":"2020-3-10","text":"Dolyatra","FullText":"Dolyatra"}, - {"date":"2020-3-12","text":"SJ","FullText":"Shivaji Jayanti"}, - {"date":"2020-3-20","text":"Parsi","FullText":"Parsi New Year"}, - {"date":"2020-3-25","text":"CS","FullText":"Chaitra Sukhladi"}, - {"date":"2020-4-6","text":"MJ","FullText":"Mahavir Jayanti"}, - {"date":"2020-4-10","text":"GF","FullText":"Good Friday"}, - {"date":"2020-4-12","text":"Easter","FullText":"Easter"}, - {"date":"2020-4-13","text":"V,M-V","FullText":"Vaisakhi,Mesadi - Vaisakhadi"}, - {"date":"2020-5-7","text":"BP,Ra","FullText":"Buddha Purnima - Vesak,Birthday of Rabindranath"}, - {"date":"2020-5-22","text":"JUlV","FullText":"Jamat Ul-Vida"}, - {"date":"2020-6-23","text":"RY","FullText":"Rath Yatra"}, - {"date":"2020-8-3 ","text":"RB","FullText":"Raksha Bandhan"}, - {"date":"2020-8-11","text":"Janma","FullText":"Janmashtami"}, - {"date":"2020-8-15","text":"Indep","FullText":"Independence Day"}, - {"date":"2020-8-21","text":"Onam","FullText":"Onam"}, - {"date":"2020-8-22","text":"GCVC","FullText":"Ganesh Chaturthi - Vinayaka Chaturthi"}, - {"date":"2020-8-29","text":"M-A","FullText":"Muharram - Ashura"}, - {"date":"2020-10-2","text":"MGJ","FullText":"Mahatma Gandhi Jayanti"}, - {"date":"2020-10-25","text":"Dusse","FullText":"Dussehra"}, - {"date":"2020-10-29","text":"MuNIeM","FullText":"Milad un-Nabi - Id-e-Milad"}, - {"date":"2020-10-31","text":"aVJ","FullText":"aharishi Valmiki Jayanti"}, - {"date":"2020-11-4","text":"KC","FullText":"Karaka Chaturthi"}, - {"date":"2020-11-14","text":"NC,DD","FullText":"Naraka Chaturdasi,Diwali - Deepavali"}, - {"date":"2020-11-15","text":"GP","FullText":"Govardhan Puja"}, - {"date":"2020-11-16","text":"B-Duj","FullText":"Bhai Duj"}, - {"date":"2020-11-20","text":"C-Puja","FullText":"Chhat Puja"}, - {"date":"2020-11-24","text":"Guru","FullText":"Guru Tegh Bahadur's Martyrdom Day"}, - {"date":"2020-12-24","text":"C-Eve","FullText":"Christmas Eve"}, - {"date":"2020-12-25","text":"C-Day","FullText":"Christmas Day"} - ] - } -} - From da38d3b6a1f8d681c095de332db7318632e45b70 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 22:23:33 +0800 Subject: [PATCH 086/115] chore: update verison --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d756984c..85432a4fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hi-ui/hiui", - "version": "2.11.0", + "version": "2.11.1", "description": "HIUI for React", "scripts": { "test": "node_modules/.bin/standard && node_modules/.bin/stylelint --config .stylelintrc 'components/**/*.scss'", From 277633c1c516c193e9a883b9e41f7230f1ca9fd4 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 18 Mar 2020 22:32:26 +0800 Subject: [PATCH 087/115] chore: update changelog --- CHANGELOG.md | 4 ++++ docs/zh-CN/components/changelog.mdx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f393719da..cf098804a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 更新日志 +## 2.11.1 + +- 修复打包印度节假日数据问题 + ## 2.11.0 - 新增 `` altCalendarPreset 预设历法信息(支持中国农历和印度节假日),altCalendar 自定义日期显示,dateMarkRender 自定义日期右上角显示标志,dateMarkPreset 预设右上角显示标志「班」和「休」 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) diff --git a/docs/zh-CN/components/changelog.mdx b/docs/zh-CN/components/changelog.mdx index f393719da..cf098804a 100644 --- a/docs/zh-CN/components/changelog.mdx +++ b/docs/zh-CN/components/changelog.mdx @@ -1,5 +1,9 @@ # 更新日志 +## 2.11.1 + +- 修复打包印度节假日数据问题 + ## 2.11.0 - 新增 `` altCalendarPreset 预设历法信息(支持中国农历和印度节假日),altCalendar 自定义日期显示,dateMarkRender 自定义日期右上角显示标志,dateMarkPreset 预设右上角显示标志「班」和「休」 [#902](https://github.com/XiaoMi/hiui/issues/902)[#992](https://github.com/XiaoMi/hiui/issues/992) From e78b307348b0b84d9f4c17a29120022b19009c39 Mon Sep 17 00:00:00 2001 From: ZhangJunjie Date: Thu, 19 Mar 2020 16:37:20 +0800 Subject: [PATCH 088/115] =?UTF-8?q?feat:=E6=B0=B4=E5=8D=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/index.js | 1 + components/watermark/index.js | 21 +++ components/watermark/watermark.js | 187 +++++++++++++++++++++++++++ docs/demo/watermark/section-base.jsx | 26 ++++ docs/zh-CN/components/watermark.mdx | 44 +++++++ site/locales/zh-CN.js | 3 +- site/pages/components/index.js | 3 +- 7 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 components/watermark/index.js create mode 100644 components/watermark/watermark.js create mode 100755 docs/demo/watermark/section-base.jsx create mode 100755 docs/zh-CN/components/watermark.mdx diff --git a/components/index.js b/components/index.js index a34e1aa17..c870cc54e 100755 --- a/components/index.js +++ b/components/index.js @@ -44,4 +44,5 @@ export { default as Message } from './message' export { default as Tag } from './tag' export { default as Breadcrumb } from './breadcrumb' export { default as Carousel } from './carousel' +export { default as Watermark } from './watermark' export { ThemeContext, LocaleContext } from './context' diff --git a/components/watermark/index.js b/components/watermark/index.js new file mode 100644 index 000000000..c4014d0a8 --- /dev/null +++ b/components/watermark/index.js @@ -0,0 +1,21 @@ +import React from 'react' +import Watermark from './watermark' +class WatermarkComponent extends React.Component { + constructor (props) { + super(props) + this.rootRef = React.createRef() + } + componentDidMount () { + Watermark(this.rootRef) + } + render () { + return ( +
    + {this.props.children} +
    + ) + } +} + +export default WatermarkComponent +export {Watermark} diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js new file mode 100644 index 000000000..d463c87c5 --- /dev/null +++ b/components/watermark/watermark.js @@ -0,0 +1,187 @@ +const defaultOptions = { + id: null, + width: 240, + height: 240, + textAlign: 'left', + font: '14px microsoft yahei', + fillStyle: 'rgba(128, 128, 128, 0.2)', + contents: '请勿外传', + rotate: '0', + zIndex: 1000, + logo: null, + grayLogo: true, // 是否对图标进行灰度处理 + isAutoWrap: true, // 文字是否自动换行 + textOverflowEffect: 'zoom' // 当isAutoWrap 为 false 时,文本长度超出画布长度时的处理方式: zoom - 缩小文字 cut - 截断文字 +} +const parseTextData = (ctx, texts, width, isWrap) => { + let contents = [] + let lines = [] + if (texts instanceof Array) { + contents = texts + } else if (typeof texts === 'string') { + contents.push(texts) + } else { + console.warn('Only support String Or Array') + } + if (isWrap) { + contents.forEach((text) => { + let curLine = '' + for (let char of text) { + let nextLine = curLine + char + if (char === '\n' || ctx.measureText(nextLine).width > width) { + lines.push(curLine) + curLine = char === '\n' ? '' : char + } else { + curLine = nextLine + } + } + lines.push(curLine) + }) + return lines + } else { + return contents + } +} +const drawText = (ctx, options) => { + let { + width, + textOverflowEffect, + contents: text, + isAutoWrap, + logo + } = options + let oldBaseLine = ctx.textBaseline + let x = 24 + let y = 0 + ctx.textBaseline = 'hanging' + /** + * LOGO 固定宽高: 32 * 32 + * 内容区域为 画布宽度 - 48 (预留左右各24的 padding) + * 如含 LOGO ,文字的起始 X 坐标为: 24(padding-left) + 32(logo size) + 4(logo 与 text 间距) + */ + let lineHeight = parseInt(ctx.font) // ctx.font必须以'XXpx'开头 + width -= (48 + 32) + const lines = parseTextData(ctx, text, width, isAutoWrap) + if (logo) { + x += 32 + } + // 计算 Y 的起始位置 + let lineY = y + (ctx.canvas.height) / 2 - (lineHeight * lines.length) / 2 + const initLineY = lineY + for (let line of lines) { + let lineX + if (ctx.textAlign === 'center') { + lineX = x + width / 2 + 4 + } else if (ctx.textAlign === 'right') { + lineX = x + width + 4 + } else { + lineX = x + 4 + } + if (textOverflowEffect === 'zoom') { + ctx.fillText(line, lineX, lineY, width) + } else { + ctx.fillText(line, lineX, lineY) + } + lineY += lineHeight + } + ctx.textBaseline = oldBaseLine + return initLineY - lineHeight / 2 +} +const drawLogo = (ctx, logo, cb) => { + const img = new window.Image() + img.src = logo + img.onload = () => { + ctx.globalAlpha = 0.2 + ctx.drawImage(img, 24, ctx.canvas.height / 2 - 16, 32, 32) + cb() + } +} + +const toImage = (canvas, key, container, options) => { + var base64Url = canvas.toDataURL() + const __wm = document.querySelector(`.${key}`) + const watermarkDiv = __wm || document.createElement('div') + const styleStr = ` + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + z-index:${options.zIndex}; + pointer-events:none; + background-repeat:repeat; + visibility:visible !important; + display: block !important; + opacity: 1 !important; + background-image:url('${base64Url}'); + ${options.grayLogo ? '-webkit-filter: grayscale(100%);-moz-filter: grayscale(100%);-ms-filter: grayscale(100%);-o-filter: grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none;' : ''} + ` + watermarkDiv.setAttribute('style', styleStr) + if (window.getComputedStyle(container).getPropertyValue('position') === 'static') { + container.style.position = 'relative' + } + watermarkDiv.classList.add(key) + console.log(watermarkDiv) + container.insertBefore(watermarkDiv, container.firstChild) + const MutationObserver = window.MutationObserver || window.WebKitMutationObserver + if (MutationObserver) { + let mo = new MutationObserver(function () { + console.log(11) + const __wm = document.querySelector(`.${key}`) + const cs = __wm ? window.getComputedStyle(__wm) : {} + if ((__wm && (__wm.getAttribute('style') !== styleStr || cs.visibility === 'hidden' || cs.display === 'none' || cs.opacity === 0)) || !__wm) { + mo.disconnect() + mo = null + WaterMarker(container, JSON.parse(JSON.stringify(options))) + } + }) + mo.observe(container, { + attributes: true, + subtree: true, + childList: true + }) + } +} +const WaterMarker = (container, args) => { + const _container = container || document.body + const options = Object.assign({}, defaultOptions, args) + const { + id, + width, + height, + textAlign, + textBaseline, + font, + fillStyle, + logo, + rotate + } = options + let key = '__wm' + if (id && id.trim().length > 0 && !document.querySelector(id + '__wm')) { + key = id + '__wm' + } + const canvas = document.createElement('canvas') + canvas.setAttribute('width', width + 'px') + canvas.setAttribute('height', height + 'px') + var ctx = canvas.getContext('2d') + // ctx.scale(dpr, dpr) + + ctx.textAlign = textAlign + ctx.textBaseline = textBaseline + ctx.font = font + ctx.fillStyle = fillStyle + ctx.translate(width / 2, height / 2) + ctx.rotate(Math.PI / 180 * rotate) + ctx.translate(-width / 2, -height / 2) + + drawText(ctx, options) + if (logo) { + drawLogo(ctx, logo, () => { + toImage(canvas, key, _container, options) + }) + } else { + toImage(canvas, key, _container, options) + } +} + +export default WaterMarker diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx new file mode 100755 index 000000000..bbff7dbe1 --- /dev/null +++ b/docs/demo/watermark/section-base.jsx @@ -0,0 +1,26 @@ +import React from 'react' +import DocViewer from '../../../libs/doc-viewer' +import Watermark from '../../../components/watermark' +import logo from '../../../site/static/img/logo.png' +const prefix = 'watermark-base' +const desc = '' +const code = `import React from 'react' +import Alert from '@hi-ui/hiui/es/alert'\n +class Demo extends React.Component { + constructor(props) { + super(props) + this.boxRef1 = React.createRef() + this.boxRef2 = React.createRef() + } + componentDidMount() { + Watermark(this.boxRef1.current, {id: 'first', logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']}) + } + render () { + return ( +
    + ) + } +}` + +const DemoBase = () => +export default DemoBase diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx new file mode 100755 index 000000000..46aa9011b --- /dev/null +++ b/docs/zh-CN/components/watermark.mdx @@ -0,0 +1,44 @@ +# 水印工具 + +用于向元素添加水印 + +## 何时使用 + +页面内容涉及到保密或其它情况时 + +## 基础用法 + +import DemoBase from '../../demo/watermark/section-base.jsx' + + + +## 不可关闭 + +import DemoCloseable from '../../demo/alert/section-closeable.jsx' + + + +## 带内容 + +import DemoTitle from '../../demo/alert/section-title.jsx' + + + +## 倒计时自动关闭 + +设置 `duration` 来指定自动关闭时间。 + +import DemoAutoClose from '../../demo/alert/section-autoClose.jsx' + + + +## Props + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | +| type | 警告框类型 | string | 'info' \| 'success' \| 'error' \| 'warning' | 'info' | +| title | 警告框标题 | string | - | - | +| content | 警告框内容 | string | - | - | +| closeable | 是否可关闭 | boolean | true \| false | false | +| onClose | 关闭事件触发时的回调 | (e: MouseEvent) => void | - | - | +| duration | 自动关闭时间,单位为毫秒 | number \| null | - | null | diff --git a/site/locales/zh-CN.js b/site/locales/zh-CN.js index 93aa5eb95..256d8affc 100755 --- a/site/locales/zh-CN.js +++ b/site/locales/zh-CN.js @@ -52,7 +52,8 @@ module.exports = { switch: 'Switch 开关', rate: 'Rate 评分', breadcrumb: 'Breadcrumb 面包屑', - carousel: 'Carousel 走马灯' + carousel: 'Carousel 走马灯', + watermark: '水印' }, designs: { summarize: '概述', diff --git a/site/pages/components/index.js b/site/pages/components/index.js index cbcaf03a3..be5179768 100755 --- a/site/pages/components/index.js +++ b/site/pages/components/index.js @@ -18,7 +18,8 @@ export default { grid: components['grid'], typography: components['typography'], button: components['button'], - icon: components['icon'] + icon: components['icon'], + watermark: components['watermark'] }, 'group-navgation': { dropdown: components['dropdown'], From f3a4d2dffd5312643f1726a464543361145959d4 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Thu, 19 Mar 2020 21:41:03 +0800 Subject: [PATCH 089/115] feat: watermark --- components/watermark/index.js | 8 ++++++-- docs/demo/watermark/section-base.jsx | 17 +++++++++++------ docs/zh-CN/components/watermark.mdx | 19 ------------------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/components/watermark/index.js b/components/watermark/index.js index c4014d0a8..a1a624b06 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -3,10 +3,14 @@ import Watermark from './watermark' class WatermarkComponent extends React.Component { constructor (props) { super(props) + console.log('props', props) this.rootRef = React.createRef() } componentDidMount () { - Watermark(this.rootRef) + const { contents, rotate, logo } = this.props + const options = {contents, rotate, logo} + const container = this.rootRef.current + Watermark(container, options) } render () { return ( @@ -18,4 +22,4 @@ class WatermarkComponent extends React.Component { } export default WatermarkComponent -export {Watermark} +// export {Watermark} diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index bbff7dbe1..ac4d80b17 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -1,26 +1,31 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' -import Watermark from '../../../components/watermark' +import WatermarkComponent from '../../../components/watermark' import logo from '../../../site/static/img/logo.png' const prefix = 'watermark-base' const desc = '' const code = `import React from 'react' -import Alert from '@hi-ui/hiui/es/alert'\n +import WatermarkComponent from '@hi-ui/hiui/es/WatermarkComponent'\n class Demo extends React.Component { constructor(props) { super(props) this.boxRef1 = React.createRef() - this.boxRef2 = React.createRef() + this.options = {logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} + } componentDidMount() { - Watermark(this.boxRef1.current, {id: 'first', logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']}) + // Watermark(this.boxRef1.current, {id: 'first', logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']}) } render () { return ( -
    + +
    + ) } }` -const DemoBase = () => +const DemoBase = () => export default DemoBase diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 46aa9011b..0fda9338a 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -12,25 +12,6 @@ import DemoBase from '../../demo/watermark/section-base.jsx' -## 不可关闭 - -import DemoCloseable from '../../demo/alert/section-closeable.jsx' - - - -## 带内容 - -import DemoTitle from '../../demo/alert/section-title.jsx' - - - -## 倒计时自动关闭 - -设置 `duration` 来指定自动关闭时间。 - -import DemoAutoClose from '../../demo/alert/section-autoClose.jsx' - - ## Props From 9e7af441931d97cd5f6b25bbc4f4abaf65ba432c Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 20 Mar 2020 10:39:22 +0800 Subject: [PATCH 090/115] feat: watermakk --- components/select/Select.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components/select/Select.js b/components/select/Select.js index a9fc0f0d4..2bcd21d01 100644 --- a/components/select/Select.js +++ b/components/select/Select.js @@ -361,6 +361,7 @@ class Select extends Component { jsonpCallback = 'callback', ...options } = _dataSource + keyword = !keyword && this.autoloadFlag && autoload ? _dataSource.keyword From 1439992ad7bb318080aadf0026dab141d30e340e Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 20 Mar 2020 11:23:18 +0800 Subject: [PATCH 091/115] fix: #1011 --- components/select/Select.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/select/Select.js b/components/select/Select.js index 78528ae90..12605ac86 100644 --- a/components/select/Select.js +++ b/components/select/Select.js @@ -372,9 +372,12 @@ class Select extends Component { url = url.includes('?') ? `${url}&${queryParams}` : `${url}?${queryParams}` } + options.headers = headers + if (type.toUpperCase() === 'POST') { options.body = JSON.stringify(data) } + this.setState({ fetching: true }) From fb6ae97a6a0fd8f10b4d701642208066b984ad5f Mon Sep 17 00:00:00 2001 From: Sivan Date: Fri, 20 Mar 2020 11:31:33 +0800 Subject: [PATCH 092/115] chore: add github action --- .github/workflow/deploy.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflow/test.yml | 22 ++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflow/deploy.yml create mode 100644 .github/workflow/test.yml diff --git a/.github/workflow/deploy.yml b/.github/workflow/deploy.yml new file mode 100644 index 000000000..229071059 --- /dev/null +++ b/.github/workflow/deploy.yml @@ -0,0 +1,35 @@ +name: deploy + +on: + push: + branches: + - master + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 10 + - name: NPM Install and Test + run: | + npm install + npm run test + npm run compile + npm run build:gh-pages + - name: Publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + - name: Deploy to gh-pages + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: dist diff --git a/.github/workflow/test.yml b/.github/workflow/test.yml new file mode 100644 index 000000000..266e6433b --- /dev/null +++ b/.github/workflow/test.yml @@ -0,0 +1,22 @@ +name: test + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: NPM Install and Test + run: | + npm install + npm run test From b64aa79f82b330de91a7796719e2066bc83ab9b0 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 20 Mar 2020 11:52:40 +0800 Subject: [PATCH 093/115] feat: watermark --- components/select/Select.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/select/Select.js b/components/select/Select.js index 2bcd21d01..35f3bb6dd 100644 --- a/components/select/Select.js +++ b/components/select/Select.js @@ -373,7 +373,6 @@ class Select extends Component { if (!_.isEmpty(queryParams)) { url = url.includes('?') ? `${url}&${queryParams}` : `${url}?${queryParams}` } - if (type.toUpperCase() === 'POST') { options.body = JSON.stringify(data) } From 4fdb156ca3123a1389249426721ea5d1bd4a9d33 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 20 Mar 2020 14:06:46 +0800 Subject: [PATCH 094/115] fix: #1011 --- components/select/Select.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/select/Select.js b/components/select/Select.js index 12605ac86..214a5439a 100644 --- a/components/select/Select.js +++ b/components/select/Select.js @@ -365,15 +365,14 @@ class Select extends Component { ? _dataSource.keyword : keyword this.autoloadFlag = false // 第一次自动加载数据后,输入的关键词即使为空也不再使用默认关键词 + Object.assign(options, {mode}, {headers}) + const queryParams = qs.stringify( Object.assign({}, params, key && { [key]: keyword }) ) if (!_.isEmpty(queryParams)) { url = url.includes('?') ? `${url}&${queryParams}` : `${url}?${queryParams}` } - - options.headers = headers - if (type.toUpperCase() === 'POST') { options.body = JSON.stringify(data) } From 2c70b0f147a52226042ad5b85eee95099a79601c Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 20 Mar 2020 19:17:37 +0800 Subject: [PATCH 095/115] feat: watermark --- components/table/Header.js | 2 +- components/table/TableContent.js | 2 +- components/table/index.js | 6 +++++- components/watermark/index.js | 8 +++++--- components/watermark/watermark.js | 6 ++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/components/table/Header.js b/components/table/Header.js index b3e45b204..dd8fa6fd4 100644 --- a/components/table/Header.js +++ b/components/table/Header.js @@ -118,7 +118,7 @@ export default class Header extends Component { } return ( - + {nodes} ) diff --git a/components/table/TableContent.js b/components/table/TableContent.js index 48b3e9498..9d893e569 100644 --- a/components/table/TableContent.js +++ b/components/table/TableContent.js @@ -34,7 +34,7 @@ export default class TableContent extends Component { })} {head - ?
    : null + ?
    : null } {body ? : null diff --git a/components/table/index.js b/components/table/index.js index 0e93d0457..7eda6d63f 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -1,5 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' +import WatermarkComponent from '../watermark' import ClickOutside from './ClickOuterside' import TableContent from './TableContent' import prifix from './prefix' @@ -478,11 +479,14 @@ class Table extends Component { } } let serverPaginationConfig = serverPagination + const options = {rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} return (
    {header &&
    {header()}
    }
    -
    {content}
    + +
    {content}
    +
    { name &&
    { diff --git a/components/watermark/index.js b/components/watermark/index.js index a1a624b06..36b169b48 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -7,14 +7,16 @@ class WatermarkComponent extends React.Component { this.rootRef = React.createRef() } componentDidMount () { + const options2 = {logo: '', rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} const { contents, rotate, logo } = this.props const options = {contents, rotate, logo} const container = this.rootRef.current - Watermark(container, options) + console.log('options', options, '+++++++++++') + Watermark(container, options2) } render () { return ( -
    +
    {this.props.children}
    ) @@ -22,4 +24,4 @@ class WatermarkComponent extends React.Component { } export default WatermarkComponent -// export {Watermark} +export {Watermark} diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index d463c87c5..307cc4045 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -1,7 +1,7 @@ const defaultOptions = { id: null, width: 240, - height: 240, + height: 20, textAlign: 'left', font: '14px microsoft yahei', fillStyle: 'rgba(128, 128, 128, 0.2)', @@ -99,11 +99,12 @@ const drawLogo = (ctx, logo, cb) => { const toImage = (canvas, key, container, options) => { var base64Url = canvas.toDataURL() + const _top = 0 const __wm = document.querySelector(`.${key}`) const watermarkDiv = __wm || document.createElement('div') const styleStr = ` position:absolute; - top:0; + top:${_top}; left:0; width:100%; height:100%; @@ -143,6 +144,7 @@ const toImage = (canvas, key, container, options) => { } } const WaterMarker = (container, args) => { + console.log('container', container) const _container = container || document.body const options = Object.assign({}, defaultOptions, args) const { From 337ae8a647579b3a49de46f3257d2bc9b4beaac3 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Sat, 21 Mar 2020 13:08:31 +0800 Subject: [PATCH 096/115] feat: watermark-table --- components/table/Header.js | 2 +- components/table/TableContent.js | 2 +- components/table/index.js | 31 +++++++++++--- components/table/tool.js | 11 ++++- components/watermark/index.js | 32 +++++++++++---- components/watermark/watermark.js | 10 ++--- docs/demo/table/section-waterMark.jsx | 59 +++++++++++++++++++++++++++ docs/zh-CN/components/table.mdx | 7 ++++ docs/zh-CN/components/watermark.mdx | 20 +++++---- 9 files changed, 143 insertions(+), 31 deletions(-) create mode 100644 docs/demo/table/section-waterMark.jsx diff --git a/components/table/Header.js b/components/table/Header.js index dd8fa6fd4..b3e45b204 100644 --- a/components/table/Header.js +++ b/components/table/Header.js @@ -118,7 +118,7 @@ export default class Header extends Component { } return ( - + {nodes} ) diff --git a/components/table/TableContent.js b/components/table/TableContent.js index 9d893e569..48b3e9498 100644 --- a/components/table/TableContent.js +++ b/components/table/TableContent.js @@ -34,7 +34,7 @@ export default class TableContent extends Component { })} {head - ?
    : null + ?
    : null } {body ? : null diff --git a/components/table/index.js b/components/table/index.js index 7eda6d63f..8c199c2b0 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import WatermarkComponent from '../watermark' +import {Watermark} from '../watermark' import ClickOutside from './ClickOuterside' import TableContent from './TableContent' import prifix from './prefix' @@ -12,7 +12,7 @@ import loading from '../loading' import '../pagination/style' import '../icon/style' import Provider from '../context' -import {setKey, scrollTop, getStyle, getPosition, offset} from './tool' +import {setKey, scrollTop, getStyle, getPosition, offset, randomString} from './tool' import request from 'axios' import qs from 'qs' @@ -65,7 +65,10 @@ class Table extends Component { this.fixRight = React.createRef() this.fixRight = React.createRef() this.setting = React.createRef() + this.contentRef = React.createRef() this.state = { + theadHeight: 52, + tableContentId: 'hi-table' + randomString(4), dataSource: data, highlightCols: [], highlightRows: [], @@ -479,14 +482,11 @@ class Table extends Component { } } let serverPaginationConfig = serverPagination - const options = {rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} return (
    {header &&
    {header()}
    }
    - -
    {content}
    -
    +
    {content}
    { name &&
    { @@ -900,6 +900,7 @@ class Table extends Component { componentDidMount () { let {fixTop, scroll, name, origin} = this.props let dom = this.dom.current + if (fixTop) { // 吸顶逻辑 document.addEventListener('scroll', () => { @@ -940,6 +941,24 @@ class Table extends Component { } }, this.fetch) } + this.setState({ + theadHeight: dom.querySelector('.hi-table-thead').offsetHeight, + tbodyHeight: dom.offsetHeight + }, () => { + if (this.props.addWaterMark) { + const {theadHeight, tbodyHeight} = this.state + const options = { + id: this.state.tableContentId, + rotate: -30, + contents: ['HIUI', '做中台,就用 HIUI'], + _top: theadHeight, + _height: tbodyHeight - theadHeight, + ...this.props.WaterMarkOptions + } + const container = this.contentRef.current + Watermark(container, options) + } + }) }, 0) } diff --git a/components/table/tool.js b/components/table/tool.js index 70cfb69dd..b347ec5df 100644 --- a/components/table/tool.js +++ b/components/table/tool.js @@ -6,7 +6,16 @@ export function insertAfter (newElement, targetElement) { parent.insertBefore(newElement, targetElement.nextSibling) } } - +export function randomString (len) { + const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' + const maxPos = $chars.length + let pwd = '' + len = len || 32 + for (let i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) + } + return pwd +} export function setKey (data, name) { name = name || 'id' return data.map(item => { diff --git a/components/watermark/index.js b/components/watermark/index.js index 36b169b48..eb990bff4 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -1,27 +1,41 @@ import React from 'react' import Watermark from './watermark' +function randomString (len) { + const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' + const maxPos = $chars.length + let pwd = '' + len = len || 32 + for (let i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) + } + return pwd +} class WatermarkComponent extends React.Component { constructor (props) { super(props) - console.log('props', props) + this.rootRef = React.createRef() } componentDidMount () { - const options2 = {logo: '', rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} - const { contents, rotate, logo } = this.props - const options = {contents, rotate, logo} + // 生成随机ID;如果不传入ID的话; const container = this.rootRef.current - console.log('options', options, '+++++++++++') - Watermark(container, options2) + const {props} = this + const options = { + id: props.id || 'hi-' + randomString(4), + contents: this.props.contents || ['HIUI', '做中台,就用 HIUI'], + rotate: props.rorate || -30, + logo: props.logo, + ...props + } + Watermark(container, options) } render () { return ( -
    +
    {this.props.children}
    ) } } - export default WatermarkComponent -export {Watermark} +export { Watermark } diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index 307cc4045..626aaa629 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -1,7 +1,7 @@ const defaultOptions = { id: null, width: 240, - height: 20, + height: 240, textAlign: 'left', font: '14px microsoft yahei', fillStyle: 'rgba(128, 128, 128, 0.2)', @@ -99,7 +99,8 @@ const drawLogo = (ctx, logo, cb) => { const toImage = (canvas, key, container, options) => { var base64Url = canvas.toDataURL() - const _top = 0 + const _top = (options._top || 0) + 'px' + const _height = options._height ? options._height + 'px' : '100%' const __wm = document.querySelector(`.${key}`) const watermarkDiv = __wm || document.createElement('div') const styleStr = ` @@ -107,7 +108,7 @@ const toImage = (canvas, key, container, options) => { top:${_top}; left:0; width:100%; - height:100%; + height:${_height}; z-index:${options.zIndex}; pointer-events:none; background-repeat:repeat; @@ -122,12 +123,10 @@ const toImage = (canvas, key, container, options) => { container.style.position = 'relative' } watermarkDiv.classList.add(key) - console.log(watermarkDiv) container.insertBefore(watermarkDiv, container.firstChild) const MutationObserver = window.MutationObserver || window.WebKitMutationObserver if (MutationObserver) { let mo = new MutationObserver(function () { - console.log(11) const __wm = document.querySelector(`.${key}`) const cs = __wm ? window.getComputedStyle(__wm) : {} if ((__wm && (__wm.getAttribute('style') !== styleStr || cs.visibility === 'hidden' || cs.display === 'none' || cs.opacity === 0)) || !__wm) { @@ -144,7 +143,6 @@ const toImage = (canvas, key, container, options) => { } } const WaterMarker = (container, args) => { - console.log('container', container) const _container = container || document.body const options = Object.assign({}, defaultOptions, args) const { diff --git a/docs/demo/table/section-waterMark.jsx b/docs/demo/table/section-waterMark.jsx new file mode 100644 index 000000000..7d0e8fde3 --- /dev/null +++ b/docs/demo/table/section-waterMark.jsx @@ -0,0 +1,59 @@ +import React from 'react' +import DocViewer from '../../../libs/doc-viewer' +import Table from '../../../components/table' +const prefix = 'table-waterMark' +const desc = '基础:展示二维数据' +const code = `import React from 'react' +import Table from '@hi-ui/hiui/es/table'\n +class Demo extends React.Component { + constructor(props){ + super(props) + + this.columns = [ + + { title: 'Column 1', dataIndex: 'name', key: '1'}, + { title: 'Column 1', dataIndex: 'age', key: '2'}, + { title: 'Column 1', dataIndex: 'address', key: '3'}, + { + title: ()=>
    自定义标题
    , + dataIndex: 'address', key: '4', + width: '500px', + render(text,record,index){ + return ( +
    + {text} --- {index} --- 自定义渲染 +
    + ) + }}, + { + title: 'Action', + key: 'operation', + width: 100, + render: () => action, + }, + ] + + this.data = [] + for (let i = 0; i < 10; i++) { + this.data.push({ + // key: i, + name: \`Don Diablo \${i}\`, + age: \`\${i}\${i}\`, + address: \`EDC Las Vegas no. \${i}\`, + }); + } + } + render() { + return + } +}` + +const DemoBase = () => ( + +) +export default DemoBase diff --git a/docs/zh-CN/components/table.mdx b/docs/zh-CN/components/table.mdx index a6b2b1c00..64462af21 100755 --- a/docs/zh-CN/components/table.mdx +++ b/docs/zh-CN/components/table.mdx @@ -133,6 +133,12 @@ import DemoAdvance from '../../demo/table/section-advance.jsx' +## 添加水印 + +import DemoWaterMark from '../../demo/table/section-waterMark.jsx' + + + ## Props | 参数 | 说明 | 类型 | 可选值 | 默认值 | @@ -140,6 +146,7 @@ import DemoAdvance from '../../demo/table/section-advance.jsx' | size | 表格尺寸 | string | 'small' \| 'large' \| 'default' | 'default' | | bordered | 是否显示边框 | boolean | true \| false | false | | striped | 斑马纹 | boolean | true \| false | false | +| addWaterMaker | 添加水印,属性设置参考水印组件 | boolean | true \| false | false | | columns | 表格数据列对应信息 | ColumnItem[] | - | - | | data | 表格数据 | object[] | - | - | | emptyText | 数据为空时展示的文案 | string | - | 'No Data' | diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 0fda9338a..74d3fac1a 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -12,14 +12,20 @@ import DemoBase from '../../demo/watermark/section-base.jsx' - ## Props | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | -| type | 警告框类型 | string | 'info' \| 'success' \| 'error' \| 'warning' | 'info' | -| title | 警告框标题 | string | - | - | -| content | 警告框内容 | string | - | - | -| closeable | 是否可关闭 | boolean | true \| false | false | -| onClose | 关闭事件触发时的回调 | (e: MouseEvent) => void | - | - | -| duration | 自动关闭时间,单位为毫秒 | number \| null | - | null | +| id | 元素ID,不传入默认随机生成 | string | - | - | +| width | 水印宽度 | number | - | 240 | +| height | 水印宽度 | number | - | 240 | +| textAlign | 文字对齐方式 | string | - | 'left' | +| font | 文字样式设置 | string | - | '14px microsoft yahei' | +| fillStyle | 设置或返回用于填充绘画的颜色、渐变或模式 | string | - | 'rgba(128, 128, 128, 0.2)' | +| contents | 水印文案 | string \| Array[string] | - | 请勿外传| +| rotate | 旋转角度 | number | -180 ~ +180 | 0 | +| zIndex | 层级 | number | - | 1000 | +| logo | 图片 | imgSrc | - | - | +| grayLogo | 是否对图标进行灰度处理 | boolean |true \| false | true | +| isAutoWrap | 文字是否自动换行 | boolean |true \| false | true | +| textOverflowEffect | 文字是否自动缩放 | string |zoom \| cut | zoom | From 8d3d3e8f6ecbfc7299f23e1958211d7aa3c81e7e Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Sun, 22 Mar 2020 07:54:23 +0800 Subject: [PATCH 097/115] feat: watermark --- components/watermark/index.js | 43 ++++++++++++++++---- docs/demo/watermark/section-base.jsx | 17 ++++---- docs/demo/watermark/section-watermark-js.jsx | 36 ++++++++++++++++ docs/zh-CN/components/watermark.mdx | 10 ++++- 4 files changed, 90 insertions(+), 16 deletions(-) create mode 100755 docs/demo/watermark/section-watermark-js.jsx diff --git a/components/watermark/index.js b/components/watermark/index.js index eb990bff4..ba13e76ea 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import Watermark from './watermark' function randomString (len) { const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' @@ -17,15 +18,11 @@ class WatermarkComponent extends React.Component { this.rootRef = React.createRef() } componentDidMount () { - // 生成随机ID;如果不传入ID的话; const container = this.rootRef.current - const {props} = this + const { props } = this const options = { - id: props.id || 'hi-' + randomString(4), - contents: this.props.contents || ['HIUI', '做中台,就用 HIUI'], - rotate: props.rorate || -30, - logo: props.logo, - ...props + ...props, + id: props.id || 'hi-' + randomString(4) } Watermark(container, options) } @@ -37,5 +34,37 @@ class WatermarkComponent extends React.Component { ) } } + +WatermarkComponent.propTypes = { + id: PropTypes.string, + width: PropTypes.number, + height: PropTypes.number, + textAlign: PropTypes.string, + font: PropTypes.string, + fillStyle: PropTypes.string, + contents: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), + rotate: PropTypes.number, + zIndex: PropTypes.number, + logo: PropTypes.string, + grayLogo: PropTypes.bool, + isAutoWrap: PropTypes.bool, + textOverflowEffect: PropTypes.oneOfType(['zoom', 'cut']) +} + +WatermarkComponent.defaultProps = { + id: null, + width: 240, + height: 240, + textAlign: 'left', + font: '14px microsoft yahei', + fillStyle: 'rgba(128, 128, 128, 0.2)', + contents: '请勿外传', + rotate: '0', + zIndex: 1000, + logo: null, + grayLogo: true, + isAutoWrap: true, + textOverflowEffect: 'zoom' +} export default WatermarkComponent export { Watermark } diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index ac4d80b17..f6f802d79 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -9,23 +9,26 @@ import WatermarkComponent from '@hi-ui/hiui/es/WatermarkComponent'\n class Demo extends React.Component { constructor(props) { super(props) - this.boxRef1 = React.createRef() this.options = {logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} - - } - componentDidMount() { - // Watermark(this.boxRef1.current, {id: 'first', logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']}) } render () { return ( -
    +
    ) } }` -const DemoBase = () => +const DemoBase = () => ( + ) export default DemoBase diff --git a/docs/demo/watermark/section-watermark-js.jsx b/docs/demo/watermark/section-watermark-js.jsx new file mode 100755 index 000000000..8ebb5898c --- /dev/null +++ b/docs/demo/watermark/section-watermark-js.jsx @@ -0,0 +1,36 @@ +import React from 'react' +import DocViewer from '../../../libs/doc-viewer' +import { Watermark } from '../../../components/watermark' +import logo from '../../../site/static/img/logo.png' +const prefix = 'watermark-js' +const desc = '' +const code = `import React from 'react' +import {watermark} from '@hi-ui/hiui/es/WatermarkComponent'\n +class Demo extends React.Component { + constructor(props) { + super(props) + this.boxRef = React.createRef() + this.options = {logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} + } + componentDidMount() { + Watermark(this.boxRef.current, this.options) + } + render () { + return ( +
    + ) + } +}` + +const DemoBase = () => ( + +) +export default DemoBase diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 74d3fac1a..3638a7f94 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -12,6 +12,12 @@ import DemoBase from '../../demo/watermark/section-base.jsx' +## 工具类使用 + +import WatermarkJS from '../../demo/watermark/section-watermark-js.jsx' + + + ## Props | 参数 | 说明 | 类型 | 可选值 | 默认值 | @@ -23,9 +29,9 @@ import DemoBase from '../../demo/watermark/section-base.jsx' | font | 文字样式设置 | string | - | '14px microsoft yahei' | | fillStyle | 设置或返回用于填充绘画的颜色、渐变或模式 | string | - | 'rgba(128, 128, 128, 0.2)' | | contents | 水印文案 | string \| Array[string] | - | 请勿外传| -| rotate | 旋转角度 | number | -180 ~ +180 | 0 | +| rotate | 旋转角度 | number | - | 0 | | zIndex | 层级 | number | - | 1000 | -| logo | 图片 | imgSrc | - | - | +| logo | 图片类的资源地址 | string | - | - | | grayLogo | 是否对图标进行灰度处理 | boolean |true \| false | true | | isAutoWrap | 文字是否自动换行 | boolean |true \| false | true | | textOverflowEffect | 文字是否自动缩放 | string |zoom \| cut | zoom | From 878ce4c1ae928cbd33cef229066655081ac00957 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Mon, 23 Mar 2020 10:53:55 +0800 Subject: [PATCH 098/115] feat: watermark --- components/table/index.js | 9 ++++----- components/watermark/index.js | 16 +--------------- components/watermark/watermark.js | 16 +++++++++++++--- docs/demo/table/section-waterMark.jsx | 2 +- docs/zh-CN/components/table.mdx | 2 +- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 8c199c2b0..0aafcc690 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -942,17 +942,16 @@ class Table extends Component { }, this.fetch) } this.setState({ - theadHeight: dom.querySelector('.hi-table-thead').offsetHeight, - tbodyHeight: dom.offsetHeight + theadHeight: dom.querySelector('.hi-table-thead').offsetHeight }, () => { - if (this.props.addWaterMark) { - const {theadHeight, tbodyHeight} = this.state + if (this.props.waterMark) { + const {theadHeight} = this.state const options = { id: this.state.tableContentId, rotate: -30, + // height:20, contents: ['HIUI', '做中台,就用 HIUI'], _top: theadHeight, - _height: tbodyHeight - theadHeight, ...this.props.WaterMarkOptions } const container = this.contentRef.current diff --git a/components/watermark/index.js b/components/watermark/index.js index ba13e76ea..bcd60277d 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -1,16 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' import Watermark from './watermark' -function randomString (len) { - const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' - const maxPos = $chars.length - let pwd = '' - len = len || 32 - for (let i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) - } - return pwd -} class WatermarkComponent extends React.Component { constructor (props) { super(props) @@ -20,11 +10,7 @@ class WatermarkComponent extends React.Component { componentDidMount () { const container = this.rootRef.current const { props } = this - const options = { - ...props, - id: props.id || 'hi-' + randomString(4) - } - Watermark(container, options) + Watermark(container, props) } render () { return ( diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index 626aaa629..bc5039252 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -13,6 +13,16 @@ const defaultOptions = { isAutoWrap: true, // 文字是否自动换行 textOverflowEffect: 'zoom' // 当isAutoWrap 为 false 时,文本长度超出画布长度时的处理方式: zoom - 缩小文字 cut - 截断文字 } +const randomString = (len) => { + const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' + const maxPos = $chars.length + let pwd = '' + len = len || 32 + for (let i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) + } + return pwd +} const parseTextData = (ctx, texts, width, isWrap) => { let contents = [] let lines = [] @@ -100,15 +110,15 @@ const drawLogo = (ctx, logo, cb) => { const toImage = (canvas, key, container, options) => { var base64Url = canvas.toDataURL() const _top = (options._top || 0) + 'px' - const _height = options._height ? options._height + 'px' : '100%' const __wm = document.querySelector(`.${key}`) const watermarkDiv = __wm || document.createElement('div') const styleStr = ` position:absolute; top:${_top}; left:0; + bottom:0; width:100%; - height:${_height}; + height:100%; z-index:${options.zIndex}; pointer-events:none; background-repeat:repeat; @@ -156,7 +166,7 @@ const WaterMarker = (container, args) => { logo, rotate } = options - let key = '__wm' + let key = 'hi-' + randomString(4) + '__wm' if (id && id.trim().length > 0 && !document.querySelector(id + '__wm')) { key = id + '__wm' } diff --git a/docs/demo/table/section-waterMark.jsx b/docs/demo/table/section-waterMark.jsx index 7d0e8fde3..79c6b6328 100644 --- a/docs/demo/table/section-waterMark.jsx +++ b/docs/demo/table/section-waterMark.jsx @@ -44,7 +44,7 @@ class Demo extends React.Component { } } render() { - return
    + return
    } }` diff --git a/docs/zh-CN/components/table.mdx b/docs/zh-CN/components/table.mdx index 64462af21..ae9c0f4c4 100755 --- a/docs/zh-CN/components/table.mdx +++ b/docs/zh-CN/components/table.mdx @@ -146,7 +146,7 @@ import DemoWaterMark from '../../demo/table/section-waterMark.jsx' | size | 表格尺寸 | string | 'small' \| 'large' \| 'default' | 'default' | | bordered | 是否显示边框 | boolean | true \| false | false | | striped | 斑马纹 | boolean | true \| false | false | -| addWaterMaker | 添加水印,属性设置参考水印组件 | boolean | true \| false | false | +| waterMark | 添加水印,属性设置参考水印组件 | boolean | true \| false | false | | columns | 表格数据列对应信息 | ColumnItem[] | - | - | | data | 表格数据 | object[] | - | - | | emptyText | 数据为空时展示的文案 | string | - | 'No Data' | From d6cd5df7e2095c9a422cedc886de51ddb8bb3471 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Tue, 24 Mar 2020 18:57:47 +0800 Subject: [PATCH 099/115] fix: #1014 --- components/tree/style/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tree/style/index.scss b/components/tree/style/index.scss index 92e99ef6e..65419cb45 100644 --- a/components/tree/style/index.scss +++ b/components/tree/style/index.scss @@ -28,7 +28,7 @@ $tree: 'hi-tree' !default; border: 1px solid #4284f5; } - .hi-checkbox-legacy--checked .hi-checkbox-legacy__input { + .hi-checkbox-legacy--checked:not(.hi-checkbox-legacy--disabled) .hi-checkbox-legacy__input { border: 1px solid #4284f5; } From 538bf57f525054f8c566bfc38eb68ad5b6cbed5c Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 14:19:25 +0800 Subject: [PATCH 100/115] feat: watermark --- components/table/index.js | 9 ++--- components/watermark/index.js | 23 +++++------ components/watermark/watermark.js | 42 +++++++++++++------- docs/demo/watermark/section-base.jsx | 4 +- docs/demo/watermark/section-watermark-js.jsx | 8 ++-- docs/zh-CN/components/table.mdx | 3 +- docs/zh-CN/components/watermark.mdx | 16 ++------ 7 files changed, 53 insertions(+), 52 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 0aafcc690..84a9d014e 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import {Watermark} from '../watermark' +import Watermark from '../watermark' import ClickOutside from './ClickOuterside' import TableContent from './TableContent' import prifix from './prefix' @@ -948,14 +948,13 @@ class Table extends Component { const {theadHeight} = this.state const options = { id: this.state.tableContentId, - rotate: -30, - // height:20, + rotate: -45, contents: ['HIUI', '做中台,就用 HIUI'], _top: theadHeight, - ...this.props.WaterMarkOptions + ...this.props.waterMarkOptions } const container = this.contentRef.current - Watermark(container, options) + Watermark.generate(container, options) } }) }, 0) diff --git a/components/watermark/index.js b/components/watermark/index.js index bcd60277d..7020eaf65 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' -import Watermark from './watermark' -class WatermarkComponent extends React.Component { +import WaterMarker from './watermark' +class Watermark extends React.Component { constructor (props) { super(props) @@ -10,7 +10,7 @@ class WatermarkComponent extends React.Component { componentDidMount () { const container = this.rootRef.current const { props } = this - Watermark(container, props) + WaterMarker(container, props) } render () { return ( @@ -21,13 +21,13 @@ class WatermarkComponent extends React.Component { } } -WatermarkComponent.propTypes = { +Watermark.propTypes = { id: PropTypes.string, width: PropTypes.number, height: PropTypes.number, textAlign: PropTypes.string, font: PropTypes.string, - fillStyle: PropTypes.string, + color: PropTypes.string, contents: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), rotate: PropTypes.number, zIndex: PropTypes.number, @@ -37,20 +37,19 @@ WatermarkComponent.propTypes = { textOverflowEffect: PropTypes.oneOfType(['zoom', 'cut']) } -WatermarkComponent.defaultProps = { +Watermark.defaultProps = { id: null, - width: 240, - height: 240, + markDensity: 'default', textAlign: 'left', font: '14px microsoft yahei', - fillStyle: 'rgba(128, 128, 128, 0.2)', + color: 'rgba(128, 128, 128, 0.2)', contents: '请勿外传', - rotate: '0', + rotate: '-45', zIndex: 1000, logo: null, grayLogo: true, isAutoWrap: true, textOverflowEffect: 'zoom' } -export default WatermarkComponent -export { Watermark } +Watermark.generate = WaterMarker +export default Watermark diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index bc5039252..32129eeb7 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -1,16 +1,14 @@ const defaultOptions = { id: null, - width: 240, - height: 240, textAlign: 'left', font: '14px microsoft yahei', - fillStyle: 'rgba(128, 128, 128, 0.2)', + color: 'rgba(128, 128, 128, 0.2)', contents: '请勿外传', - rotate: '0', + rotate: '-45', zIndex: 1000, logo: null, grayLogo: true, // 是否对图标进行灰度处理 - isAutoWrap: true, // 文字是否自动换行 + isAutoWrap: false, // 文字是否自动换行 textOverflowEffect: 'zoom' // 当isAutoWrap 为 false 时,文本长度超出画布长度时的处理方式: zoom - 缩小文字 cut - 截断文字 } const randomString = (len) => { @@ -55,13 +53,15 @@ const parseTextData = (ctx, texts, width, isWrap) => { const drawText = (ctx, options) => { let { width, + _w = width, + height, textOverflowEffect, contents: text, isAutoWrap, logo } = options let oldBaseLine = ctx.textBaseline - let x = 24 + let x = 0 let y = 0 ctx.textBaseline = 'hanging' /** @@ -70,11 +70,12 @@ const drawText = (ctx, options) => { * 如含 LOGO ,文字的起始 X 坐标为: 24(padding-left) + 32(logo size) + 4(logo 与 text 间距) */ let lineHeight = parseInt(ctx.font) // ctx.font必须以'XXpx'开头 - width -= (48 + 32) - const lines = parseTextData(ctx, text, width, isAutoWrap) if (logo) { x += 32 + _w -= 32 } + const lines = parseTextData(ctx, text, width, isAutoWrap) + // 计算 Y 的起始位置 let lineY = y + (ctx.canvas.height) / 2 - (lineHeight * lines.length) / 2 const initLineY = lineY @@ -88,7 +89,8 @@ const drawText = (ctx, options) => { lineX = x + 4 } if (textOverflowEffect === 'zoom') { - ctx.fillText(line, lineX, lineY, width) + const size = parseInt(Math.sqrt((_w * _w + height * height) / 2)) + ctx.fillText(line, lineX, lineY, size) } else { ctx.fillText(line, lineX, lineY) } @@ -102,7 +104,7 @@ const drawLogo = (ctx, logo, cb) => { img.src = logo img.onload = () => { ctx.globalAlpha = 0.2 - ctx.drawImage(img, 24, ctx.canvas.height / 2 - 16, 32, 32) + ctx.drawImage(img, 0, ctx.canvas.height / 2 - 16, 32, 32) cb() } } @@ -154,7 +156,18 @@ const toImage = (canvas, key, container, options) => { } const WaterMarker = (container, args) => { const _container = container || document.body - const options = Object.assign({}, defaultOptions, args) + const {markDensity} = args + let _markSize = { + width: 190, + height: 160 + } + if (['low', 'high'].includes(markDensity)) { + _markSize = { + width: markDensity === 'low' ? 140 : 240, + height: markDensity === 'low' ? 110 : 210 + } + } + const options = Object.assign({}, defaultOptions, _markSize, args) const { id, width, @@ -162,7 +175,7 @@ const WaterMarker = (container, args) => { textAlign, textBaseline, font, - fillStyle, + color, logo, rotate } = options @@ -171,15 +184,14 @@ const WaterMarker = (container, args) => { key = id + '__wm' } const canvas = document.createElement('canvas') + var ctx = canvas.getContext('2d') canvas.setAttribute('width', width + 'px') canvas.setAttribute('height', height + 'px') - var ctx = canvas.getContext('2d') - // ctx.scale(dpr, dpr) ctx.textAlign = textAlign ctx.textBaseline = textBaseline ctx.font = font - ctx.fillStyle = fillStyle + ctx.fillStyle = color ctx.translate(width / 2, height / 2) ctx.rotate(Math.PI / 180 * rotate) ctx.translate(-width / 2, -height / 2) diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index f6f802d79..4d7b0b280 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -5,11 +5,11 @@ import logo from '../../../site/static/img/logo.png' const prefix = 'watermark-base' const desc = '' const code = `import React from 'react' -import WatermarkComponent from '@hi-ui/hiui/es/WatermarkComponent'\n +import Watermark from '@hi-ui/hiui/es/Watermark'\n class Demo extends React.Component { constructor(props) { super(props) - this.options = {logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} + this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI']} } render () { return ( diff --git a/docs/demo/watermark/section-watermark-js.jsx b/docs/demo/watermark/section-watermark-js.jsx index 8ebb5898c..9ce34a571 100755 --- a/docs/demo/watermark/section-watermark-js.jsx +++ b/docs/demo/watermark/section-watermark-js.jsx @@ -1,19 +1,19 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' -import { Watermark } from '../../../components/watermark' +import Watermark from '../../../components/watermark' import logo from '../../../site/static/img/logo.png' const prefix = 'watermark-js' const desc = '' const code = `import React from 'react' -import {watermark} from '@hi-ui/hiui/es/WatermarkComponent'\n +import Watermark from '@hi-ui/hiui/es/watermark'\n class Demo extends React.Component { constructor(props) { super(props) this.boxRef = React.createRef() - this.options = {logo: logo, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI']} + this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI']} } componentDidMount() { - Watermark(this.boxRef.current, this.options) + Watermark.generate(this.boxRef.current, this.options) } render () { return ( diff --git a/docs/zh-CN/components/table.mdx b/docs/zh-CN/components/table.mdx index ae9c0f4c4..40725c5e1 100755 --- a/docs/zh-CN/components/table.mdx +++ b/docs/zh-CN/components/table.mdx @@ -146,7 +146,8 @@ import DemoWaterMark from '../../demo/table/section-waterMark.jsx' | size | 表格尺寸 | string | 'small' \| 'large' \| 'default' | 'default' | | bordered | 是否显示边框 | boolean | true \| false | false | | striped | 斑马纹 | boolean | true \| false | false | -| waterMark | 添加水印,属性设置参考水印组件 | boolean | true \| false | false | +| waterMark | 添加水印 | boolean | true \| false | false | +| waterMarkOptions | 水印属性设置,参考水印组件 | object | - | - | | columns | 表格数据列对应信息 | ColumnItem[] | - | - | | data | 表格数据 | object[] | - | - | | emptyText | 数据为空时展示的文案 | string | - | 'No Data' | diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 3638a7f94..8f523eb7f 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -22,16 +22,6 @@ import WatermarkJS from '../../demo/watermark/section-watermark-js.jsx' | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | -| id | 元素ID,不传入默认随机生成 | string | - | - | -| width | 水印宽度 | number | - | 240 | -| height | 水印宽度 | number | - | 240 | -| textAlign | 文字对齐方式 | string | - | 'left' | -| font | 文字样式设置 | string | - | '14px microsoft yahei' | -| fillStyle | 设置或返回用于填充绘画的颜色、渐变或模式 | string | - | 'rgba(128, 128, 128, 0.2)' | -| contents | 水印文案 | string \| Array[string] | - | 请勿外传| -| rotate | 旋转角度 | number | - | 0 | -| zIndex | 层级 | number | - | 1000 | -| logo | 图片类的资源地址 | string | - | - | -| grayLogo | 是否对图标进行灰度处理 | boolean |true \| false | true | -| isAutoWrap | 文字是否自动换行 | boolean |true \| false | true | -| textOverflowEffect | 文字是否自动缩放 | string |zoom \| cut | zoom | +| density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | +| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| +| logo | 本地图片类的资源 | File | - | - | From 53da3e6fa2e80a326eaef42a53070b847fa51fc5 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 16:37:22 +0800 Subject: [PATCH 101/115] feat: watermark --- components/table/index.js | 4 ++-- components/watermark/index.js | 6 +++--- components/watermark/watermark.js | 16 ++++++++-------- docs/demo/watermark/section-base.jsx | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 84a9d014e..21a101d3f 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -945,10 +945,10 @@ class Table extends Component { theadHeight: dom.querySelector('.hi-table-thead').offsetHeight }, () => { if (this.props.waterMark) { - const {theadHeight} = this.state + const { theadHeight } = this.state const options = { id: this.state.tableContentId, - rotate: -45, + rotate: -30, contents: ['HIUI', '做中台,就用 HIUI'], _top: theadHeight, ...this.props.waterMarkOptions diff --git a/components/watermark/index.js b/components/watermark/index.js index 7020eaf65..39f78a5d7 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -39,12 +39,12 @@ Watermark.propTypes = { Watermark.defaultProps = { id: null, - markDensity: 'default', + density: 'default', textAlign: 'left', - font: '14px microsoft yahei', + font: '16px microsoft yahei', color: 'rgba(128, 128, 128, 0.2)', contents: '请勿外传', - rotate: '-45', + rotate: -30, zIndex: 1000, logo: null, grayLogo: true, diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index 32129eeb7..9f5d74847 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -1,10 +1,10 @@ const defaultOptions = { id: null, textAlign: 'left', - font: '14px microsoft yahei', + font: '16px microsoft yahei', color: 'rgba(128, 128, 128, 0.2)', contents: '请勿外传', - rotate: '-45', + rotate: -30, zIndex: 1000, logo: null, grayLogo: true, // 是否对图标进行灰度处理 @@ -156,15 +156,15 @@ const toImage = (canvas, key, container, options) => { } const WaterMarker = (container, args) => { const _container = container || document.body - const {markDensity} = args + const {density} = args let _markSize = { - width: 190, - height: 160 + width: 210, + height: 180 } - if (['low', 'high'].includes(markDensity)) { + if (['low', 'high'].includes(density)) { _markSize = { - width: markDensity === 'low' ? 140 : 240, - height: markDensity === 'low' ? 110 : 210 + width: density === 'low' ? 240 : 180, + height: density === 'low' ? 210 : 150 } } const options = Object.assign({}, defaultOptions, _markSize, args) diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index 4d7b0b280..86baa848d 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -9,7 +9,7 @@ import Watermark from '@hi-ui/hiui/es/Watermark'\n class Demo extends React.Component { constructor(props) { super(props) - this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI']} + this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI'],density:'high'} } render () { return ( From 12c5da1483da2249268f0e1cb2240394aa3fd15a Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 16:41:36 +0800 Subject: [PATCH 102/115] feat: watermark --- components/table/index.js | 4 +--- components/table/tool.js | 10 ---------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 21a101d3f..a878ca134 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -12,7 +12,7 @@ import loading from '../loading' import '../pagination/style' import '../icon/style' import Provider from '../context' -import {setKey, scrollTop, getStyle, getPosition, offset, randomString} from './tool' +import { setKey, scrollTop, getStyle, getPosition, offset } from './tool' import request from 'axios' import qs from 'qs' @@ -68,7 +68,6 @@ class Table extends Component { this.contentRef = React.createRef() this.state = { theadHeight: 52, - tableContentId: 'hi-table' + randomString(4), dataSource: data, highlightCols: [], highlightRows: [], @@ -947,7 +946,6 @@ class Table extends Component { if (this.props.waterMark) { const { theadHeight } = this.state const options = { - id: this.state.tableContentId, rotate: -30, contents: ['HIUI', '做中台,就用 HIUI'], _top: theadHeight, diff --git a/components/table/tool.js b/components/table/tool.js index b347ec5df..bbe4295fd 100644 --- a/components/table/tool.js +++ b/components/table/tool.js @@ -6,16 +6,6 @@ export function insertAfter (newElement, targetElement) { parent.insertBefore(newElement, targetElement.nextSibling) } } -export function randomString (len) { - const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' - const maxPos = $chars.length - let pwd = '' - len = len || 32 - for (let i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) - } - return pwd -} export function setKey (data, name) { name = name || 'id' return data.map(item => { From 574a15a76d139f7792a89ee97cc3631798561683 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 16:54:48 +0800 Subject: [PATCH 103/115] feat: watermark --- components/watermark/index.js | 2 +- docs/demo/table/section-waterMark.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/watermark/index.js b/components/watermark/index.js index 39f78a5d7..452d9cea6 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -48,7 +48,7 @@ Watermark.defaultProps = { zIndex: 1000, logo: null, grayLogo: true, - isAutoWrap: true, + isAutoWrap: false, textOverflowEffect: 'zoom' } Watermark.generate = WaterMarker diff --git a/docs/demo/table/section-waterMark.jsx b/docs/demo/table/section-waterMark.jsx index 79c6b6328..4a07424af 100644 --- a/docs/demo/table/section-waterMark.jsx +++ b/docs/demo/table/section-waterMark.jsx @@ -2,7 +2,7 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' import Table from '../../../components/table' const prefix = 'table-waterMark' -const desc = '基础:展示二维数据' +const desc = '向表格添加水印' const code = `import React from 'react' import Table from '@hi-ui/hiui/es/table'\n class Demo extends React.Component { From a45ff6b9bbb16ba1ab51a01f63b1b44667273fd7 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 16:59:13 +0800 Subject: [PATCH 104/115] feat: watermark --- components/table/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index a878ca134..1fd9eadfb 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -943,13 +943,14 @@ class Table extends Component { this.setState({ theadHeight: dom.querySelector('.hi-table-thead').offsetHeight }, () => { - if (this.props.waterMark) { + const {waterMark, waterMarkOptions} = this.props + if (waterMark) { const { theadHeight } = this.state const options = { rotate: -30, contents: ['HIUI', '做中台,就用 HIUI'], _top: theadHeight, - ...this.props.waterMarkOptions + ...waterMarkOptions } const container = this.contentRef.current Watermark.generate(container, options) From 170a08916a9b20194c27f637df8da1dbf168d8ab Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 17:42:22 +0800 Subject: [PATCH 105/115] fix: #1017 #1009 --- components/date-picker/Calender.js | 2 +- components/date-picker/DatePicker.js | 27 +++++----------- components/date-picker/IndiaHoliday.js | 45 -------------------------- components/date-picker/util.js | 10 +++--- 4 files changed, 14 insertions(+), 70 deletions(-) delete mode 100644 components/date-picker/IndiaHoliday.js diff --git a/components/date-picker/Calender.js b/components/date-picker/Calender.js index 77c06d61c..1a5c0f005 100644 --- a/components/date-picker/Calender.js +++ b/components/date-picker/Calender.js @@ -278,7 +278,7 @@ class Calender extends Component { this.setState({ show: false }) - }, 3000) + }, 2000) } altCalendarText = (datainfo, lunarcellinfo) => { const {altCalendarPresetData} = this.props diff --git a/components/date-picker/DatePicker.js b/components/date-picker/DatePicker.js index 2a49e6a64..02697b2fc 100644 --- a/components/date-picker/DatePicker.js +++ b/components/date-picker/DatePicker.js @@ -7,7 +7,6 @@ import DateRangePanel from './DateRangePanel' import WeekRangePanel from './WeekRangePanel' import Provider from '../context' import { getPRCDate, deconstructDate } from './util' -import IndiaHoliday from './IndiaHoliday.js' class DatePicker extends BasePicker { static propTypes = { altCalendar: PropTypes.array, @@ -26,33 +25,23 @@ class DatePicker extends BasePicker { _getLunarPresetData () { const {altCalendarPreset, altCalendar} = this.props const allPRCDate = {} - if (altCalendarPreset === 'zh-CN') { - getPRCDate('PRCLunar').then(res => { + if (['zh-CN', 'id-ID'].includes(altCalendarPreset)) { + const _urlKey = altCalendarPreset === 'zh-CN' ? 'PRCLunar' : 'IndiaHoliday' + getPRCDate(_urlKey).then(res => { Object.keys(res.data).forEach(key => { let oneYear = {} - res.data[key].PRCLunar.forEach(item => { + res.data[key][_urlKey].forEach(item => { Object.assign(oneYear, { - [item.date.replace(/-/g, '/')]: item.text + [item.date.replace(/-/g, '/')]: { + ...item, + highlight: altCalendarPreset === 'id-ID' + } }) }) Object.assign(allPRCDate, oneYear) }) this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : allPRCDate }) - } else if (altCalendarPreset === 'id-ID') { - Object.keys(IndiaHoliday).forEach(key => { - let oneYear = {} - IndiaHoliday[key].IndiaHoliday.forEach(item => { - Object.assign(oneYear, { - [item.date.replace(/-/g, '/')]: { - ...item, - highlight: true - } - }) - }) - Object.assign(allPRCDate, oneYear) - }) - this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : allPRCDate } else { this.altCalendarPresetData = altCalendar ? this._altCalendarData(allPRCDate) : {} } diff --git a/components/date-picker/IndiaHoliday.js b/components/date-picker/IndiaHoliday.js deleted file mode 100644 index dd80315b1..000000000 --- a/components/date-picker/IndiaHoliday.js +++ /dev/null @@ -1,45 +0,0 @@ - -export default { - '2020': { - 'IndiaHoliday': [ - {'date': '2020-1-1', 'text': 'New Years', 'FullText': 'New Years Day'}, - {'date': '2020-1-15', 'text': 'MS,Pongal', 'FullText': 'Makar Sankranti,Pongal'}, - {'date': '2020-1-26', 'text': 'Republic', 'FullText': 'Republic Day'}, - {'date': '2020-1-29', 'text': 'VP', 'FullText': 'Vasant Panchami'}, - {'date': '2020-2-9', 'text': 'GRJ', 'FullText': 'Guru Ravidas Jayanti'}, - {'date': '2020-2-18', 'text': 'MDSJ', 'FullText': 'Maharishi Dayanand Saraswati Jayanti'}, - {'date': '2020-2-21', 'text': 'MS-S', 'FullText': 'Maha Shivaratri - Shivaratri'}, - {'date': '2020-3-8', 'text': "H Ali's", 'FullText': "Hazarat Ali's Birthday"}, - {'date': '2020-3-9', 'text': 'HD', 'FullText': 'Holika Dahana'}, - {'date': '2020-3-10', 'text': 'Dolyatra', 'FullText': 'Dolyatra'}, - {'date': '2020-3-12', 'text': 'SJ', 'FullText': 'Shivaji Jayanti'}, - {'date': '2020-3-20', 'text': 'Parsi', 'FullText': 'Parsi New Year'}, - {'date': '2020-3-25', 'text': 'CS', 'FullText': 'Chaitra Sukhladi'}, - {'date': '2020-4-6', 'text': 'MJ', 'FullText': 'Mahavir Jayanti'}, - {'date': '2020-4-10', 'text': 'GF', 'FullText': 'Good Friday'}, - {'date': '2020-4-12', 'text': 'Easter', 'FullText': 'Easter'}, - {'date': '2020-4-13', 'text': 'V,M-V', 'FullText': 'Vaisakhi,Mesadi - Vaisakhadi'}, - {'date': '2020-5-7', 'text': 'BP,Ra', 'FullText': 'Buddha Purnima - Vesak,Birthday of Rabindranath'}, - {'date': '2020-5-22', 'text': 'JUlV', 'FullText': 'Jamat Ul-Vida'}, - {'date': '2020-6-23', 'text': 'RY', 'FullText': 'Rath Yatra'}, - {'date': '2020-8-3 ', 'text': 'RB', 'FullText': 'Raksha Bandhan'}, - {'date': '2020-8-11', 'text': 'Janma', 'FullText': 'Janmashtami'}, - {'date': '2020-8-15', 'text': 'Indep', 'FullText': 'Independence Day'}, - {'date': '2020-8-21', 'text': 'Onam', 'FullText': 'Onam'}, - {'date': '2020-8-22', 'text': 'GCVC', 'FullText': 'Ganesh Chaturthi - Vinayaka Chaturthi'}, - {'date': '2020-8-29', 'text': 'M-A', 'FullText': 'Muharram - Ashura'}, - {'date': '2020-10-2', 'text': 'MGJ', 'FullText': 'Mahatma Gandhi Jayanti'}, - {'date': '2020-10-25', 'text': 'Dusse', 'FullText': 'Dussehra'}, - {'date': '2020-10-29', 'text': 'MuNIeM', 'FullText': 'Milad un-Nabi - Id-e-Milad'}, - {'date': '2020-10-31', 'text': 'aVJ', 'FullText': 'aharishi Valmiki Jayanti'}, - {'date': '2020-11-4', 'text': 'KC', 'FullText': 'Karaka Chaturthi'}, - {'date': '2020-11-14', 'text': 'NC,DD', 'FullText': 'Naraka Chaturdasi,Diwali - Deepavali'}, - {'date': '2020-11-15', 'text': 'GP', 'FullText': 'Govardhan Puja'}, - {'date': '2020-11-16', 'text': 'B-Duj', 'FullText': 'Bhai Duj'}, - {'date': '2020-11-20', 'text': 'C-Puja', 'FullText': 'Chhat Puja'}, - {'date': '2020-11-24', 'text': 'Guru', 'FullText': "Guru Tegh Bahadur's Martyrdom Day"}, - {'date': '2020-12-24', 'text': 'C-Eve', 'FullText': 'Christmas Eve'}, - {'date': '2020-12-25', 'text': 'C-Day', 'FullText': 'Christmas Day'} - ] - } -} diff --git a/components/date-picker/util.js b/components/date-picker/util.js index 77326ad2c..3f926744b 100644 --- a/components/date-picker/util.js +++ b/components/date-picker/util.js @@ -1,8 +1,9 @@ import request from 'axios' import { addMonths, getDay, subDays, differenceInDays, startOfWeek, endOfWeek } from './dateUtil' -const PRC = { +const holiday = { PRCHoliday: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCHoliday.json?', - PRCLunar: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCLunar.json?' + PRCLunar: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/PRCLunar.json?', + IndiaHoliday: 'https://cdn.cnbj1.fds.api.mi-img.com/hiui/IndiaHoliday.json?' } export const deconstructDate = (date, weekOffset = 0) => { @@ -45,11 +46,10 @@ export const showLargeCalendar = (props) => { } export const getPRCDate = (api) => { - const url = PRC[api] + const url = holiday[api] let options = { url, - method: 'GET', - withCredentials: true + method: 'GET' } return url ? request.create().request(options) : null } From 914767a4af3e4f201c2cf72f6d6319ace3693798 Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Fri, 27 Mar 2020 18:31:26 +0800 Subject: [PATCH 106/115] fix: #1017 #1009 --- .../date-picker/__tests__/index.test.js | 16 ++++++------- components/select/__tests__/index.test.js | 2 +- jest.config.js | 24 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/components/date-picker/__tests__/index.test.js b/components/date-picker/__tests__/index.test.js index 769128cdd..da56d3471 100644 --- a/components/date-picker/__tests__/index.test.js +++ b/components/date-picker/__tests__/index.test.js @@ -222,9 +222,9 @@ describe('Datepicker', () => { ) expect(wrapper.find('input').at(0).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') + expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('开始日期') expect(wrapper.find('input').at(1).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') + expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('结束日期') wrapper.find('input').first().simulate('focus') expect(wrapper.find(`.hi-datepicker__panel--left td[value=${realCurrentDay}]:not(.prev):not(.next)`).hasClass('today')).toBeTruthy() wrapper.find('.hi-datepicker__header-text').first().simulate('click') @@ -314,9 +314,9 @@ describe('Datepicker', () => { ) expect(wrapper.find('input').at(0).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('请选择周') + expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('开始周') expect(wrapper.find('input').at(1).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('请选择周') + expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('结束周') wrapper.find('input').first().simulate('focus') expect(wrapper.find(`.hi-datepicker__panel--left td[value=${realCurrentDay}]:not(.prev):not(.next)`).hasClass('today')).toBeTruthy() wrapper.find('.hi-datepicker__header-text').first().simulate('click') @@ -395,9 +395,9 @@ describe('Datepicker', () => { ) expect(wrapper.find('input').at(0).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') + expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('开始日期时间') expect(wrapper.find('input').at(1).getDOMNode().getAttribute('value')).toEqual('') - expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') + expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('结束日期时间') wrapper.find('input').first().simulate('focus') expect(wrapper.find(`.hi-datepicker__panel--left td[value=${realCurrentDay}]:not(.prev):not(.next)`).hasClass('current')).toBeTruthy() // value 为 Date 实例的情况 @@ -501,8 +501,8 @@ describe('Datepicker', () => { ) - expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') - expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('请选择日期') + expect(wrapper.find('input').at(0).getDOMNode().getAttribute('placeholder')).toEqual('开始日期') + expect(wrapper.find('input').at(1).getDOMNode().getAttribute('placeholder')).toEqual('结束日期') expect(wrapper.find('input').at(2).getDOMNode().getAttribute('placeholder')).toEqual('请选择') expect(wrapper.find('input').at(3).getDOMNode().getAttribute('placeholder')).toEqual('请选择') expect(wrapper.find('input').at(4).getDOMNode().getAttribute('placeholder')).toEqual('请选择') diff --git a/components/select/__tests__/index.test.js b/components/select/__tests__/index.test.js index 58dca31b4..8164c2098 100644 --- a/components/select/__tests__/index.test.js +++ b/components/select/__tests__/index.test.js @@ -477,7 +477,7 @@ describe('Select', () => { process.nextTick(() => { // 首次加载数据 wrapper.find('.hi-select__input').simulate('click') // 展开 - expect(_document.querySelectorAll('.hi-select__dropdown--item')).toHaveLength(4) + expect(_document.querySelectorAll('.hi-select__dropdown--item')).toHaveLength(1) global.fetch.mockClear() done() }) diff --git a/jest.config.js b/jest.config.js index 552b18f3f..d0d408402 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,25 +15,25 @@ module.exports = { coverageReporters: ['json-summary', 'text', 'lcov'], // An array of glob patterns indicating a set of files for which coverage information should be collected - collectCoverageFrom: [ - '/components/**/*', - '!/components/table/**/*', - '!/components/nav-menu/**/*', - '!/components/**/style/**/*', - '!/components/**/__test__/**/*', - '!/components/**/(*-legacy)/**/*' - ], - // 本地单测使用 - // 1. 修改范围 /components/[组件名称]/**/* - // 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率 // collectCoverageFrom: [ - // '/components/alert/**/*', + // '/components/**/*', // '!/components/table/**/*', // '!/components/nav-menu/**/*', // '!/components/**/style/**/*', // '!/components/**/__test__/**/*', // '!/components/**/(*-legacy)/**/*' // ], + // 本地单测使用 + // 1. 修改范围 /components/[组件名称]/**/* + // 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率 + collectCoverageFrom: [ + '/components/date-picker/**/*', + '!/components/table/**/*', + '!/components/nav-menu/**/*', + '!/components/**/style/**/*', + '!/components/**/__test__/**/*', + '!/components/**/(*-legacy)/**/*' + ], // The test environment that will be used for testing testEnvironment: 'jest-environment-jsdom-global', From 3ab1fefc9d8ed5d73d98f82b7468d2e67297c00d Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Fri, 27 Mar 2020 20:17:35 +0800 Subject: [PATCH 107/115] fix: #1017 #1009 --- jest.config.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jest.config.js b/jest.config.js index d0d408402..510c9fbca 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,25 +15,25 @@ module.exports = { coverageReporters: ['json-summary', 'text', 'lcov'], // An array of glob patterns indicating a set of files for which coverage information should be collected - // collectCoverageFrom: [ - // '/components/**/*', - // '!/components/table/**/*', - // '!/components/nav-menu/**/*', - // '!/components/**/style/**/*', - // '!/components/**/__test__/**/*', - // '!/components/**/(*-legacy)/**/*' - // ], - // 本地单测使用 - // 1. 修改范围 /components/[组件名称]/**/* - // 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率 collectCoverageFrom: [ - '/components/date-picker/**/*', + '/components/**/*', '!/components/table/**/*', '!/components/nav-menu/**/*', '!/components/**/style/**/*', '!/components/**/__test__/**/*', '!/components/**/(*-legacy)/**/*' ], + // 本地单测使用 + // 1. 修改范围 /components/[组件名称]/**/* + // 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率 + // collectCoverageFrom: [ + // '/components/date-picker/**/*', + // '!/components/table/**/*', + // '!/components/nav-menu/**/*', + // '!/components/**/style/**/*', + // '!/components/**/__test__/**/*', + // '!/components/**/(*-legacy)/**/*' + // ], // The test environment that will be used for testing testEnvironment: 'jest-environment-jsdom-global', From 208a6f29084b60325e47d6c7b38e450fe8b15fc9 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Fri, 27 Mar 2020 21:51:30 +0800 Subject: [PATCH 108/115] feat: watermark --- components/table/index.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 1fd9eadfb..9604e7257 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -1,6 +1,5 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import Watermark from '../watermark' import ClickOutside from './ClickOuterside' import TableContent from './TableContent' import prifix from './prefix' @@ -940,22 +939,6 @@ class Table extends Component { } }, this.fetch) } - this.setState({ - theadHeight: dom.querySelector('.hi-table-thead').offsetHeight - }, () => { - const {waterMark, waterMarkOptions} = this.props - if (waterMark) { - const { theadHeight } = this.state - const options = { - rotate: -30, - contents: ['HIUI', '做中台,就用 HIUI'], - _top: theadHeight, - ...waterMarkOptions - } - const container = this.contentRef.current - Watermark.generate(container, options) - } - }) }, 0) } From e8699bbfd131c0889da9bdaba3cf274e9426e9d9 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Fri, 27 Mar 2020 21:59:34 +0800 Subject: [PATCH 109/115] feat: watermark --- components/watermark/index.js | 4 +- components/watermark/watermark.js | 27 +++------ docs/demo/table/section-waterMark.jsx | 59 -------------------- docs/demo/watermark/section-base.jsx | 2 +- docs/demo/watermark/section-watermark-js.jsx | 36 ------------ docs/zh-CN/components/table.mdx | 8 --- docs/zh-CN/components/watermark.mdx | 6 -- site/locales/zh-CN.js | 2 +- 8 files changed, 13 insertions(+), 131 deletions(-) delete mode 100644 docs/demo/table/section-waterMark.jsx delete mode 100755 docs/demo/watermark/section-watermark-js.jsx diff --git a/components/watermark/index.js b/components/watermark/index.js index 452d9cea6..868e7086c 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -28,7 +28,7 @@ Watermark.propTypes = { textAlign: PropTypes.string, font: PropTypes.string, color: PropTypes.string, - contents: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), + content: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), rotate: PropTypes.number, zIndex: PropTypes.number, logo: PropTypes.string, @@ -43,7 +43,7 @@ Watermark.defaultProps = { textAlign: 'left', font: '16px microsoft yahei', color: 'rgba(128, 128, 128, 0.2)', - contents: '请勿外传', + content: '请勿外传', rotate: -30, zIndex: 1000, logo: null, diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index 9f5d74847..2fbc78adc 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -3,7 +3,7 @@ const defaultOptions = { textAlign: 'left', font: '16px microsoft yahei', color: 'rgba(128, 128, 128, 0.2)', - contents: '请勿外传', + content: '请勿外传', rotate: -30, zIndex: 1000, logo: null, @@ -11,28 +11,19 @@ const defaultOptions = { isAutoWrap: false, // 文字是否自动换行 textOverflowEffect: 'zoom' // 当isAutoWrap 为 false 时,文本长度超出画布长度时的处理方式: zoom - 缩小文字 cut - 截断文字 } -const randomString = (len) => { - const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' - const maxPos = $chars.length - let pwd = '' - len = len || 32 - for (let i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)) - } - return pwd -} + const parseTextData = (ctx, texts, width, isWrap) => { - let contents = [] + let content = [] let lines = [] if (texts instanceof Array) { - contents = texts + content = texts } else if (typeof texts === 'string') { - contents.push(texts) + content.push(texts) } else { console.warn('Only support String Or Array') } if (isWrap) { - contents.forEach((text) => { + content.forEach((text) => { let curLine = '' for (let char of text) { let nextLine = curLine + char @@ -47,7 +38,7 @@ const parseTextData = (ctx, texts, width, isWrap) => { }) return lines } else { - return contents + return content } } const drawText = (ctx, options) => { @@ -56,7 +47,7 @@ const drawText = (ctx, options) => { _w = width, height, textOverflowEffect, - contents: text, + content: text, isAutoWrap, logo } = options @@ -179,7 +170,7 @@ const WaterMarker = (container, args) => { logo, rotate } = options - let key = 'hi-' + randomString(4) + '__wm' + let key = 'hi-' + Math.floor(Math.random() * (9999 - 1000)) + 1000 + '__wm' if (id && id.trim().length > 0 && !document.querySelector(id + '__wm')) { key = id + '__wm' } diff --git a/docs/demo/table/section-waterMark.jsx b/docs/demo/table/section-waterMark.jsx deleted file mode 100644 index 4a07424af..000000000 --- a/docs/demo/table/section-waterMark.jsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react' -import DocViewer from '../../../libs/doc-viewer' -import Table from '../../../components/table' -const prefix = 'table-waterMark' -const desc = '向表格添加水印' -const code = `import React from 'react' -import Table from '@hi-ui/hiui/es/table'\n -class Demo extends React.Component { - constructor(props){ - super(props) - - this.columns = [ - - { title: 'Column 1', dataIndex: 'name', key: '1'}, - { title: 'Column 1', dataIndex: 'age', key: '2'}, - { title: 'Column 1', dataIndex: 'address', key: '3'}, - { - title: ()=>
    自定义标题
    , - dataIndex: 'address', key: '4', - width: '500px', - render(text,record,index){ - return ( -
    - {text} --- {index} --- 自定义渲染 -
    - ) - }}, - { - title: 'Action', - key: 'operation', - width: 100, - render: () => action, - }, - ] - - this.data = [] - for (let i = 0; i < 10; i++) { - this.data.push({ - // key: i, - name: \`Don Diablo \${i}\`, - age: \`\${i}\${i}\`, - address: \`EDC Las Vegas no. \${i}\`, - }); - } - } - render() { - return
    - } -}` - -const DemoBase = () => ( - -) -export default DemoBase diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index 86baa848d..8f77d35c8 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -9,7 +9,7 @@ import Watermark from '@hi-ui/hiui/es/Watermark'\n class Demo extends React.Component { constructor(props) { super(props) - this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI'],density:'high'} + this.options = {logo: logo, content: ['HIUI', '做中台,就用 HIUI'],density:'high'} } render () { return ( diff --git a/docs/demo/watermark/section-watermark-js.jsx b/docs/demo/watermark/section-watermark-js.jsx deleted file mode 100755 index 9ce34a571..000000000 --- a/docs/demo/watermark/section-watermark-js.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react' -import DocViewer from '../../../libs/doc-viewer' -import Watermark from '../../../components/watermark' -import logo from '../../../site/static/img/logo.png' -const prefix = 'watermark-js' -const desc = '' -const code = `import React from 'react' -import Watermark from '@hi-ui/hiui/es/watermark'\n -class Demo extends React.Component { - constructor(props) { - super(props) - this.boxRef = React.createRef() - this.options = {logo: logo, contents: ['HIUI', '做中台,就用 HIUI']} - } - componentDidMount() { - Watermark.generate(this.boxRef.current, this.options) - } - render () { - return ( -
    - ) - } -}` - -const DemoBase = () => ( - -) -export default DemoBase diff --git a/docs/zh-CN/components/table.mdx b/docs/zh-CN/components/table.mdx index 40725c5e1..a6b2b1c00 100755 --- a/docs/zh-CN/components/table.mdx +++ b/docs/zh-CN/components/table.mdx @@ -133,12 +133,6 @@ import DemoAdvance from '../../demo/table/section-advance.jsx' -## 添加水印 - -import DemoWaterMark from '../../demo/table/section-waterMark.jsx' - - - ## Props | 参数 | 说明 | 类型 | 可选值 | 默认值 | @@ -146,8 +140,6 @@ import DemoWaterMark from '../../demo/table/section-waterMark.jsx' | size | 表格尺寸 | string | 'small' \| 'large' \| 'default' | 'default' | | bordered | 是否显示边框 | boolean | true \| false | false | | striped | 斑马纹 | boolean | true \| false | false | -| waterMark | 添加水印 | boolean | true \| false | false | -| waterMarkOptions | 水印属性设置,参考水印组件 | object | - | - | | columns | 表格数据列对应信息 | ColumnItem[] | - | - | | data | 表格数据 | object[] | - | - | | emptyText | 数据为空时展示的文案 | string | - | 'No Data' | diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 8f523eb7f..781e73c39 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -12,12 +12,6 @@ import DemoBase from '../../demo/watermark/section-base.jsx' -## 工具类使用 - -import WatermarkJS from '../../demo/watermark/section-watermark-js.jsx' - - - ## Props | 参数 | 说明 | 类型 | 可选值 | 默认值 | diff --git a/site/locales/zh-CN.js b/site/locales/zh-CN.js index 256d8affc..c12b6f6c2 100755 --- a/site/locales/zh-CN.js +++ b/site/locales/zh-CN.js @@ -53,7 +53,7 @@ module.exports = { rate: 'Rate 评分', breadcrumb: 'Breadcrumb 面包屑', carousel: 'Carousel 走马灯', - watermark: '水印' + watermark: 'Watermark 水印' }, designs: { summarize: '概述', From f33197577ae2d798952c4129cff8d53e91235383 Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Fri, 27 Mar 2020 22:03:58 +0800 Subject: [PATCH 110/115] feat: watermark --- components/table/index.js | 4 +--- docs/zh-CN/components/watermark.mdx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/components/table/index.js b/components/table/index.js index 9604e7257..093452c1d 100644 --- a/components/table/index.js +++ b/components/table/index.js @@ -64,9 +64,7 @@ class Table extends Component { this.fixRight = React.createRef() this.fixRight = React.createRef() this.setting = React.createRef() - this.contentRef = React.createRef() this.state = { - theadHeight: 52, dataSource: data, highlightCols: [], highlightRows: [], @@ -484,7 +482,7 @@ class Table extends Component {
    {header &&
    {header()}
    }
    -
    {content}
    +
    {content}
    { name &&
    { diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 781e73c39..85343dd0c 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -17,5 +17,5 @@ import DemoBase from '../../demo/watermark/section-base.jsx' | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | | density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | -| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| +| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| | logo | 本地图片类的资源 | File | - | - | From 961daf33073d7ba794f12f60ab73bac6bbad5e8a Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Fri, 27 Mar 2020 22:20:17 +0800 Subject: [PATCH 111/115] feat: watermark --- docs/demo/watermark/section-base.jsx | 8 ++++---- docs/zh-CN/components/watermark.mdx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index 8f77d35c8..72ad8a86d 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -1,6 +1,6 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' -import WatermarkComponent from '../../../components/watermark' +import Watermark from '../../../components/watermark' import logo from '../../../site/static/img/logo.png' const prefix = 'watermark-base' const desc = '' @@ -13,13 +13,13 @@ class Demo extends React.Component { } render () { return ( -
    - + ) } }` @@ -28,7 +28,7 @@ const DemoBase = () => ( ) export default DemoBase diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 85343dd0c..29e0364c6 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -16,6 +16,6 @@ import DemoBase from '../../demo/watermark/section-base.jsx' | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | -| density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | -| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| -| logo | 本地图片类的资源 | File | - | - | +| density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | +| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| +| logo | 图片资源地址(暂只支持本地资源) | string | - | - | From 9567743d14869371a716b0b3c0f175eabc3e33cc Mon Sep 17 00:00:00 2001 From: solarjoker Date: Sat, 28 Mar 2020 03:19:54 +0800 Subject: [PATCH 112/115] docs: update watermark --- docs/zh-CN/components/watermark.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zh-CN/components/watermark.mdx b/docs/zh-CN/components/watermark.mdx index 29e0364c6..6297efe14 100755 --- a/docs/zh-CN/components/watermark.mdx +++ b/docs/zh-CN/components/watermark.mdx @@ -1,4 +1,4 @@ -# 水印工具 +# Watermark 水印 用于向元素添加水印 @@ -14,8 +14,8 @@ import DemoBase from '../../demo/watermark/section-base.jsx' ## Props -| 参数 | 说明 | 类型 | 可选值 | 默认值 | -| --------- | ------------------------ | ----------------------- | ------------------------------------------- | ------ | -| density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | -| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | 请勿外传| -| logo | 图片资源地址(暂只支持本地资源) | string | - | - | +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ------- | ------------------------------------------ | ----------------------- | ---------------------------- | ---------- | +| density | 水印间距,调节疏密程度 | string | 'low' \| 'default' \| 'high' | 'default' | +| content | 水印文案,传入数组代表多行,不建议超过三行 | string \| Array[string] | - | '请勿外传' | +| logo | 图片资源地址(暂只支持本地资源) | string | - | - | From ee09eb7f50615f8aa5ca5d837e850071e6573d15 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Sat, 28 Mar 2020 03:28:47 +0800 Subject: [PATCH 113/115] chore: update version and changelog --- CHANGELOG.md | 6 ++++++ docs/zh-CN/components/changelog.mdx | 6 ++++++ package.json | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf098804a..f450a1c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +## 2.12.0 + +- 新增 `` 水印组件 [#121](https://github.com/XiaoMi/hiui/issues/121) +- 修复 `` 多选模式下在禁用状态复选框样式异常的问题 [#1014](https://github.com/XiaoMi/hiui/issues/1014) +- 修复 `` DataSource 配置 headers 参数无效的问题 [#1011](https://github.com/XiaoMi/hiui/issues/1011) + ## 2.11.1 - 修复打包印度节假日数据问题 diff --git a/package.json b/package.json index 85432a4fe..830501c0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hi-ui/hiui", - "version": "2.11.1", + "version": "2.12.0", "description": "HIUI for React", "scripts": { "test": "node_modules/.bin/standard && node_modules/.bin/stylelint --config .stylelintrc 'components/**/*.scss'", From 272da2218557e88fadb0807edd98285c812aeecf Mon Sep 17 00:00:00 2001 From: wugaoliang Date: Sat, 28 Mar 2020 06:55:36 +0800 Subject: [PATCH 114/115] feat: watermark --- components/watermark/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/watermark/index.js b/components/watermark/index.js index 868e7086c..27630142c 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import WaterMarker from './watermark' +import _ from 'lodash' class Watermark extends React.Component { constructor (props) { super(props) @@ -9,8 +10,10 @@ class Watermark extends React.Component { } componentDidMount () { const container = this.rootRef.current - const { props } = this - WaterMarker(container, props) + const options = _.cloneDeep(this.props) + delete options.children + + WaterMarker(container, options) } render () { return ( From a4a18c7c4683a74a3f9065d22bcaf137c4dd1e1d Mon Sep 17 00:00:00 2001 From: Wugaoliang Date: Mon, 30 Mar 2020 16:38:05 +0800 Subject: [PATCH 115/115] fix: upload console --- components/upload/UploadDrag.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/upload/UploadDrag.js b/components/upload/UploadDrag.js index be178deb4..69997f7bf 100644 --- a/components/upload/UploadDrag.js +++ b/components/upload/UploadDrag.js @@ -12,7 +12,6 @@ class UploadDrag extends Upload { }, this.state ) - console.log('props', props) this.dragBoxRef = React.createRef() }