diff --git a/components/vc-calendar/assets/index/DecadePanel.less b/components/vc-calendar/assets/index/DecadePanel.less index f83c591d0..b758eb57c 100644 --- a/components/vc-calendar/assets/index/DecadePanel.less +++ b/components/vc-calendar/assets/index/DecadePanel.less @@ -39,14 +39,15 @@ } } -.@{prefixClass}-decade-panel-prev-century-btn, .@{prefixClass}-decade-panel-next-century-btn { +.@{prefixClass}-decade-panel-prev-century-btn, +.@{prefixClass}-decade-panel-next-century-btn { position: absolute; top: 0; } .@{prefixClass}-decade-panel-next-century-btn { &:after { - content: '»' + content: '»'; } } @@ -54,7 +55,7 @@ user-select: none; left: 0; &:after { - content: '«' + content: '«'; } } @@ -111,10 +112,11 @@ } } -.@{prefixClass}-decade-panel-last-century-cell, .@{prefixClass}-decade-panel-next-century-cell { - .@{prefixClass}-decade-panel-decade{ +.@{prefixClass}-decade-panel-last-century-cell, +.@{prefixClass}-decade-panel-next-century-cell { + .@{prefixClass}-decade-panel-decade { user-select: none; -webkit-user-select: none; color: rgba(0, 0, 0, 0.25); } -} \ No newline at end of file +} diff --git a/components/vc-calendar/assets/index/MonthPanel.less b/components/vc-calendar/assets/index/MonthPanel.less index 1b35f0e6b..5bb3fc7a0 100644 --- a/components/vc-calendar/assets/index/MonthPanel.less +++ b/components/vc-calendar/assets/index/MonthPanel.less @@ -1,6 +1,6 @@ .@{prefixClass}-month-panel { left: 0; - top:0; + top: 0; bottom: 0; right: 0; background: #ffffff; @@ -43,14 +43,15 @@ } } -.@{prefixClass}-month-panel-prev-year-btn, .@{prefixClass}-month-panel-next-year-btn { +.@{prefixClass}-month-panel-prev-year-btn, +.@{prefixClass}-month-panel-next-year-btn { position: absolute; top: 0; } .@{prefixClass}-month-panel-next-year-btn { &:after { - content: '»' + content: '»'; } } @@ -59,7 +60,7 @@ left: 0; &:after { - content: '«' + content: '«'; } } @@ -96,8 +97,6 @@ .@{prefixClass}-month-panel-cell { text-align: center; - - .@{prefixClass}-month-panel-month { display: block; width: 46px; @@ -116,7 +115,7 @@ } } - &-disabled{ + &-disabled { .@{prefixClass}-month-panel-month { color: #bfbfbf; @@ -141,4 +140,4 @@ .@{prefixClass}-month-header-wrap { position: relative; height: 308px; -} \ No newline at end of file +} diff --git a/components/vc-calendar/assets/index/YearPanel.less b/components/vc-calendar/assets/index/YearPanel.less index 6b31dc8ec..77ba5c778 100644 --- a/components/vc-calendar/assets/index/YearPanel.less +++ b/components/vc-calendar/assets/index/YearPanel.less @@ -43,14 +43,15 @@ } } -.@{prefixClass}-year-panel-prev-decade-btn, .@{prefixClass}-year-panel-next-decade-btn { +.@{prefixClass}-year-panel-prev-decade-btn, +.@{prefixClass}-year-panel-next-decade-btn { position: absolute; top: 0; } .@{prefixClass}-year-panel-next-decade-btn { &:after { - content: '»' + content: '»'; } } @@ -59,7 +60,7 @@ left: 0; &:after { - content: '«' + content: '«'; } } @@ -125,10 +126,11 @@ } } -.@{prefixClass}-year-panel-last-decade-cell, .@{prefixClass}-year-panel-next-decade-cell { - .@{prefixClass}-year-panel-year{ +.@{prefixClass}-year-panel-last-decade-cell, +.@{prefixClass}-year-panel-next-decade-cell { + .@{prefixClass}-year-panel-year { user-select: none; -webkit-user-select: none; color: rgba(0, 0, 0, 0.25); } -} \ No newline at end of file +} diff --git a/components/vc-calendar/src/Calendar.jsx b/components/vc-calendar/src/Calendar.jsx index 909d21ad5..d4079f855 100644 --- a/components/vc-calendar/src/Calendar.jsx +++ b/components/vc-calendar/src/Calendar.jsx @@ -7,7 +7,7 @@ import moment from 'moment'; import DateTable from './date/DateTable'; import CalendarHeader from './calendar/CalendarHeader'; import CalendarFooter from './calendar/CalendarFooter'; -import CalendarMixin, {getNowByCurrentStateValue} from './mixin/CalendarMixin'; +import CalendarMixin, { getNowByCurrentStateValue } from './mixin/CalendarMixin'; import CommonMixin from './mixin/CommonMixin'; import DateInput from './date/DateInput'; import enUs from './locale/en_US'; @@ -74,8 +74,8 @@ const Calendar = { }); }, }, - mounted(){ - this.$nextTick(()=>{ + mounted() { + this.$nextTick(() => { this.saveFocusElement(DateInput.getInstance()); }); }, @@ -167,7 +167,7 @@ const Calendar = { source: 'dateInput', }); }, - onDateInputSelect (value) { + onDateInputSelect(value) { this.onSelect(value, { source: 'dateInputSelect', }); @@ -269,11 +269,12 @@ const Calendar = { onSelect={this.onDateInputSelect} /> ) : null; - const children =[]; + const children = []; if (props.renderSidebar) { children.push(props.renderSidebar()); } - children.push(
+ children.push( +
{dateInputElement}
-
); +
, + ); return this.renderRoot({ children, diff --git a/components/vc-calendar/src/FullCalendar.jsx b/components/vc-calendar/src/FullCalendar.jsx index b7c0a4b5c..a846823d5 100644 --- a/components/vc-calendar/src/FullCalendar.jsx +++ b/components/vc-calendar/src/FullCalendar.jsx @@ -4,7 +4,7 @@ import BaseMixin from '../../_util/BaseMixin'; import { getOptionProps, hasProp } from '../../_util/props-util'; import DateTable from './date/DateTable'; import MonthTable from './month/MonthTable'; -import CalendarMixin, {getNowByCurrentStateValue} from './mixin/CalendarMixin'; +import CalendarMixin, { getNowByCurrentStateValue } from './mixin/CalendarMixin'; import CommonMixin from './mixin/CommonMixin'; import CalendarHeader from './full-calendar/CalendarHeader'; import enUs from './locale/en_US'; diff --git a/components/vc-calendar/src/MonthCalendar.jsx b/components/vc-calendar/src/MonthCalendar.jsx index 2570f8d4a..d77c9eca6 100644 --- a/components/vc-calendar/src/MonthCalendar.jsx +++ b/components/vc-calendar/src/MonthCalendar.jsx @@ -28,7 +28,7 @@ const MonthCalendar = { data() { const props = this.$props; - return { + return { mode: 'month', sValue: props.value || props.defaultValue || moment(), sSelectedValue: props.selectedValue || props.defaultSelectedValue, diff --git a/components/vc-calendar/src/date/DateInput.jsx b/components/vc-calendar/src/date/DateInput.jsx index a459467cb..c146097ac 100644 --- a/components/vc-calendar/src/date/DateInput.jsx +++ b/components/vc-calendar/src/date/DateInput.jsx @@ -47,15 +47,12 @@ const DateInput = { updated() { this.$nextTick(() => { if ( - dateInputInstance && + dateInputInstance && this.$data.hasFocus && !this.invalid && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0) ) { - dateInputInstance.setSelectionRange( - cachedSelectionStart, - cachedSelectionEnd, - ); + dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd); } }); }, @@ -96,7 +93,7 @@ const DateInput = { }); return; } - + // 不合法直接退出 const parsed = moment(str, format, true); if (!parsed.isValid()) { @@ -140,9 +137,9 @@ const DateInput = { str: formatDate(prevProps.value, prevProps.format), })); }, - onKeyDown ({ keyCode }) { + onKeyDown({ keyCode }) { const { value } = this.$props; - if (keyCode === KeyCode.ENTER ) { + if (keyCode === KeyCode.ENTER) { this.__emit('select', value.clone()); } }, @@ -167,12 +164,14 @@ const DateInput = {
{decadesEls}
- {footer && ( -
- {footer} -
)} + {footer &&
{footer}
}
); }, diff --git a/components/vc-calendar/src/mixin/CommonMixin.js b/components/vc-calendar/src/mixin/CommonMixin.js index fc80fa34f..14d34c5dc 100644 --- a/components/vc-calendar/src/mixin/CommonMixin.js +++ b/components/vc-calendar/src/mixin/CommonMixin.js @@ -37,7 +37,7 @@ export default { this.$refs.rootInstance.focus(); } }, - saveFocusElement (focusElement) { + saveFocusElement(focusElement) { this.focusElement = focusElement; }, }, diff --git a/components/vc-calendar/src/month/MonthPanel.jsx b/components/vc-calendar/src/month/MonthPanel.jsx index c55cdc3ab..2bc34963e 100644 --- a/components/vc-calendar/src/month/MonthPanel.jsx +++ b/components/vc-calendar/src/month/MonthPanel.jsx @@ -116,10 +116,7 @@ const MonthPanel = { prefixCls={prefixCls} /> - {footer && ( -
- {footer} -
)} + {footer &&
{footer}
} ); diff --git a/components/vc-calendar/src/year/YearPanel.jsx b/components/vc-calendar/src/year/YearPanel.jsx index f22d523a1..f15c83632 100644 --- a/components/vc-calendar/src/year/YearPanel.jsx +++ b/components/vc-calendar/src/year/YearPanel.jsx @@ -137,10 +137,7 @@ export default { {yeasEls} - {footer && ( -
- {footer} -
)} + {footer &&
{footer}
} );