-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
08
@@ -12576,7 +12576,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
@@ -12598,43 +12598,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
02
@@ -12642,43 +12642,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
09
@@ -12686,43 +12686,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
16
@@ -12730,43 +12730,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
23
@@ -12774,43 +12774,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
30
@@ -12818,43 +12818,43 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
07
diff --git a/components/vc-calendar/assets/index/DecadePanel.less b/components/vc-calendar/assets/index/DecadePanel.less
index b55d12f23..f83c591d0 100644
--- a/components/vc-calendar/assets/index/DecadePanel.less
+++ b/components/vc-calendar/assets/index/DecadePanel.less
@@ -7,6 +7,8 @@
z-index: 10;
position: absolute;
outline: none;
+ display: flex;
+ flex-direction: column;
}
.@{prefixClass}-decade-panel-hidden {
@@ -37,15 +39,14 @@
}
}
-.@{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: '»'
}
}
@@ -53,7 +54,7 @@
user-select: none;
left: 0;
&:after {
- content: '«';
+ content: '«'
}
}
@@ -63,10 +64,13 @@
}
.@{prefixClass}-decade-panel-body {
+ flex: 1;
padding: 9px 10px 10px;
- position: absolute;
- bottom: 0;
- top: 34px;
+}
+
+.@{prefixClass}-decade-panel-footer {
+ border-top: 1px solid #ccc;
+ line-height: 38px;
}
.@{prefixClass}-decade-panel-table {
@@ -107,11 +111,10 @@
}
}
-.@{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 f5310ab92..1b35f0e6b 100644
--- a/components/vc-calendar/assets/index/MonthPanel.less
+++ b/components/vc-calendar/assets/index/MonthPanel.less
@@ -1,12 +1,18 @@
.@{prefixClass}-month-panel {
left: 0;
- top: 0;
+ top:0;
bottom: 0;
right: 0;
background: #ffffff;
z-index: 10;
position: absolute;
outline: none;
+
+ > div {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ }
}
.@{prefixClass}-month-panel-hidden {
@@ -37,15 +43,14 @@
}
}
-.@{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: '»'
}
}
@@ -54,7 +59,7 @@
left: 0;
&:after {
- content: '«';
+ content: '«'
}
}
@@ -72,10 +77,13 @@
}
.@{prefixClass}-month-panel-body {
+ flex: 1;
padding: 9px 10px 10px;
- position: absolute;
- top: 34px;
- bottom: 0;
+}
+
+.@{prefixClass}-month-panel-footer {
+ border-top: 1px solid #ccc;
+ line-height: 38px;
}
.@{prefixClass}-month-panel-table {
@@ -88,6 +96,8 @@
.@{prefixClass}-month-panel-cell {
text-align: center;
+
+
.@{prefixClass}-month-panel-month {
display: block;
width: 46px;
@@ -106,7 +116,7 @@
}
}
- &-disabled {
+ &-disabled{
.@{prefixClass}-month-panel-month {
color: #bfbfbf;
@@ -131,4 +141,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 32b45fd0f..6b31dc8ec 100644
--- a/components/vc-calendar/assets/index/YearPanel.less
+++ b/components/vc-calendar/assets/index/YearPanel.less
@@ -7,6 +7,12 @@
z-index: 10;
position: absolute;
outline: none;
+
+ > div {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ }
}
.@{prefixClass}-year-panel-hidden {
@@ -37,15 +43,14 @@
}
}
-.@{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: '»'
}
}
@@ -54,7 +59,7 @@
left: 0;
&:after {
- content: '«';
+ content: '«'
}
}
@@ -72,10 +77,13 @@
}
.@{prefixClass}-year-panel-body {
+ flex: 1;
padding: 9px 10px 10px;
- position: absolute;
- bottom: 0;
- top: 34px;
+}
+
+.@{prefixClass}-year-panel-footer {
+ border-top: 1px solid #ccc;
+ line-height: 38px;
}
.@{prefixClass}-year-panel-table {
@@ -117,11 +125,10 @@
}
}
-.@{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/demo/antd-calendar.vue b/components/vc-calendar/demo/antd-calendar.vue
index 45138dda4..6cfa7ac4d 100644
--- a/components/vc-calendar/demo/antd-calendar.vue
+++ b/components/vc-calendar/demo/antd-calendar.vue
@@ -211,6 +211,7 @@ const DemoMultiFormat = {
format={multiFormats}
value={state.value}
onChange={this.onChange}
+ focusablePanel={false}
/>
);
},
@@ -251,7 +252,7 @@ export default {
onChange={onStandaloneChange}
disabledDate={disabledDate}
onSelect={onStandaloneSelect}
- renderFooter={() => 'extra footer'}
+ renderFooter={(mode) => ({mode} extra footer)}
/>
diff --git a/components/vc-calendar/index.js b/components/vc-calendar/index.js
index 17cd8cdf3..3091680aa 100644
--- a/components/vc-calendar/index.js
+++ b/components/vc-calendar/index.js
@@ -1,3 +1,8 @@
// based on rc-calendar 9.8.2
+import Vue from 'vue';
+import ref from 'vue-ref';
import Calendar from './src/';
+
+Vue.use(ref, { name: 'ant-ref' });
+
export default Calendar;
diff --git a/components/vc-calendar/src/Calendar.jsx b/components/vc-calendar/src/Calendar.jsx
index 8d47ef69f..909d21ad5 100644
--- a/components/vc-calendar/src/Calendar.jsx
+++ b/components/vc-calendar/src/Calendar.jsx
@@ -3,27 +3,17 @@ import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, hasProp, getComponentFromProp } from '../../_util/props-util';
import { cloneElement } from '../../_util/vnode';
import KeyCode from '../../_util/KeyCode';
-import * as moment from 'moment';
+import moment from 'moment';
import DateTable from './date/DateTable';
import CalendarHeader from './calendar/CalendarHeader';
import CalendarFooter from './calendar/CalendarFooter';
-import CalendarMixin 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';
import { getTimeConfig, getTodayTime, syncTime } from './util';
import { goStartMonth, goEndMonth, goTime } from './util/toTime';
-function isMoment(value) {
- if (Array.isArray(value)) {
- return (
- value.length === 0 || value.findIndex(val => val === undefined || moment.isMoment(val)) !== -1
- );
- } else {
- return value === undefined || moment.isMoment(value);
- }
-}
-const MomentType = PropTypes.custom(isMoment);
const Calendar = {
props: {
locale: PropTypes.object.def(enUs),
@@ -31,9 +21,10 @@ const Calendar = {
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
// prefixCls: PropTypes.string,
- defaultValue: MomentType,
- value: MomentType,
- selectedValue: MomentType,
+ defaultValue: PropTypes.object,
+ value: PropTypes.object,
+ selectedValue: PropTypes.object,
+ defaultSelectedValue: PropTypes.object,
mode: PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade']),
// locale: PropTypes.object,
showDateInput: PropTypes.bool.def(true),
@@ -54,21 +45,48 @@ const Calendar = {
renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null),
clearIcon: PropTypes.any,
+ focusablePanel: PropTypes.bool.def(true),
},
mixins: [BaseMixin, CommonMixin, CalendarMixin],
data() {
+ const props = this.$props;
return {
sMode: this.mode || 'date',
+ sValue: props.value || props.defaultValue || moment(),
+ sSelectedValue: props.selectedValue || props.defaultSelectedValue,
};
},
watch: {
mode(val) {
this.setState({ sMode: val });
},
+ value(val) {
+ const sValue = val || this.defaultValue || getNowByCurrentStateValue(this.sValue);
+ this.setState({
+ sValue,
+ });
+ },
+ selectedValue(val) {
+ this.setState({
+ sSelectedValue: val,
+ });
+ },
+ },
+ mounted(){
+ this.$nextTick(()=>{
+ this.saveFocusElement(DateInput.getInstance());
+ });
},
methods: {
+ onPanelChange(value, mode) {
+ const { sValue } = this;
+ if (!hasProp(this, 'mode')) {
+ this.setState({ sMode: mode });
+ }
+ this.__emit('panelChange', value || sValue, mode);
+ },
onKeyDown(event) {
if (event.target.nodeName.toLowerCase() === 'input') {
return undefined;
@@ -149,6 +167,11 @@ const Calendar = {
source: 'dateInput',
});
},
+ onDateInputSelect (value) {
+ this.onSelect(value, {
+ source: 'dateInputSelect',
+ });
+ },
onDateTableSelect(value) {
const { timePicker, sSelectedValue } = this;
if (!sSelectedValue && timePicker) {
@@ -167,13 +190,6 @@ const Calendar = {
source: 'todayButton',
});
},
- onPanelChange(value, mode) {
- const { sValue } = this;
- if (!hasProp(this, 'mode')) {
- this.setState({ sMode: mode });
- }
- this.__emit('panelChange', value || sValue, mode);
- },
getRootDOMNode() {
return this.$el;
},
@@ -197,10 +213,10 @@ const Calendar = {
timePicker,
disabledTime,
showDateInput,
- renderSidebar,
sValue,
sSelectedValue,
sMode,
+ renderFooter,
$props: props,
} = this;
const clearIcon = getComponentFromProp(this, 'clearIcon');
@@ -250,19 +266,23 @@ const Calendar = {
selectedValue={sSelectedValue}
onChange={this.onDateInputChange}
clearIcon={clearIcon}
+ onSelect={this.onDateInputSelect}
/>
) : null;
- const children = [
- renderSidebar(),
-
+ const children =[];
+ if (props.renderSidebar) {
+ children.push(props.renderSidebar());
+ }
+ children.push(
{dateInputElement}
-
+
@@ -286,6 +306,7 @@ const Calendar = {
- ,
- ];
+ );
return this.renderRoot({
children,
diff --git a/components/vc-calendar/src/FullCalendar.jsx b/components/vc-calendar/src/FullCalendar.jsx
index 2a0a7a387..b7c0a4b5c 100644
--- a/components/vc-calendar/src/FullCalendar.jsx
+++ b/components/vc-calendar/src/FullCalendar.jsx
@@ -1,9 +1,10 @@
+import moment from 'moment';
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, hasProp } from '../../_util/props-util';
import DateTable from './date/DateTable';
import MonthTable from './month/MonthTable';
-import CalendarMixin 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';
@@ -15,8 +16,6 @@ const FullCalendar = {
prefixCls: PropTypes.string.def('rc-calendar'),
defaultType: PropTypes.string.def('date'),
type: PropTypes.string,
- // locale: PropTypes.object,
- // onTypeChange: PropTypes.func,
fullscreen: PropTypes.bool.def(false),
monthCellRender: PropTypes.func,
dateCellRender: PropTypes.func,
@@ -27,6 +26,10 @@ const FullCalendar = {
headerRender: PropTypes.func,
showHeader: PropTypes.bool.def(true),
disabledDate: PropTypes.func,
+ value: PropTypes.object,
+ defaultValue: PropTypes.object,
+ selectedValue: PropTypes.object,
+ defaultSelectedValue: PropTypes.object,
renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null),
},
@@ -38,8 +41,11 @@ const FullCalendar = {
} else {
type = this.defaultType;
}
+ const props = this.$props;
return {
sType: type,
+ sValue: props.value || props.defaultValue || moment(),
+ sSelectedValue: props.selectedValue || props.defaultSelectedValue,
};
},
watch: {
@@ -48,6 +54,17 @@ const FullCalendar = {
sType: val,
});
},
+ value(val) {
+ const sValue = val || this.defaultValue || getNowByCurrentStateValue(this.sValue);
+ this.setState({
+ sValue,
+ });
+ },
+ selectedValue(val) {
+ this.setState({
+ sSelectedValue: val,
+ });
+ },
},
methods: {
onMonthSelect(value) {
diff --git a/components/vc-calendar/src/MonthCalendar.jsx b/components/vc-calendar/src/MonthCalendar.jsx
index 87aa6ef91..2570f8d4a 100644
--- a/components/vc-calendar/src/MonthCalendar.jsx
+++ b/components/vc-calendar/src/MonthCalendar.jsx
@@ -1,3 +1,4 @@
+import moment from 'moment';
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
import KeyCode from '../../_util/KeyCode';
@@ -14,6 +15,10 @@ const MonthCalendar = {
prefixCls: PropTypes.string.def('rc-calendar'),
monthCellRender: PropTypes.func,
dateCellRender: PropTypes.func,
+ value: PropTypes.object,
+ defaultValue: PropTypes.object,
+ selectedValue: PropTypes.object,
+ defaultSelectedValue: PropTypes.object,
disabledDate: PropTypes.func,
monthCellContentRender: PropTypes.func,
renderFooter: PropTypes.func.def(() => null),
@@ -22,7 +27,12 @@ const MonthCalendar = {
mixins: [BaseMixin, CommonMixin, CalendarMixin],
data() {
- return { mode: 'month' };
+ const props = this.$props;
+ return {
+ mode: 'month',
+ sValue: props.value || props.defaultValue || moment(),
+ sSelectedValue: props.selectedValue || props.defaultSelectedValue,
+ };
},
methods: {
onKeyDown(event) {
diff --git a/components/vc-calendar/src/Picker.jsx b/components/vc-calendar/src/Picker.jsx
index 0a8800c52..14246a9c3 100644
--- a/components/vc-calendar/src/Picker.jsx
+++ b/components/vc-calendar/src/Picker.jsx
@@ -98,6 +98,7 @@ const Picker = {
const calendarProps = getOptionProps(props.calendar);
if (
cause.source === 'keyboard' ||
+ cause.source === 'dateInputSelect' ||
(!calendarProps.timePicker && cause.source !== 'dateInput') ||
cause.source === 'todayButton'
) {
@@ -107,7 +108,7 @@ const Picker = {
},
onKeyDown(event) {
- if (event.keyCode === KeyCode.DOWN && !this.sOpen) {
+ if (!this.sOpen && (event.keyCode === KeyCode.DOWN || event.keyCode === KeyCode.ENTER)) {
this.openCalendar();
event.preventDefault();
}
diff --git a/components/vc-calendar/src/RangeCalendar.jsx b/components/vc-calendar/src/RangeCalendar.jsx
index 4f7793bef..4bbb4dff4 100644
--- a/components/vc-calendar/src/RangeCalendar.jsx
+++ b/components/vc-calendar/src/RangeCalendar.jsx
@@ -79,6 +79,7 @@ const RangeCalendar = {
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
dateInputPlaceholder: PropTypes.any,
+ seperator: PropTypes.string.def('~'),
defaultValue: PropTypes.any,
value: PropTypes.any,
hoverValue: PropTypes.any,
@@ -599,6 +600,8 @@ const RangeCalendar = {
showClear,
showToday,
type,
+ seperator,
+ mode,
} = props;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const { sHoverValue, sSelectedValue, sMode, showTimePicker, sValue, $listeners } = this;
@@ -748,7 +751,7 @@ const RangeCalendar = {
});
OkButtonNode = ;
}
- const extraFooter = this.renderFooter();
+ const extraFooter = this.renderFooter(sMode);
return (
{props.renderSidebar()}
@@ -764,7 +767,7 @@ const RangeCalendar = {
onMouseenter={type !== 'both' ? this.onDatePanelEnter : noop}
>
- ~
+ {seperator}
diff --git a/components/vc-calendar/src/calendar/CalendarFooter.jsx b/components/vc-calendar/src/calendar/CalendarFooter.jsx
index 883a3bd01..ee084aa8c 100644
--- a/components/vc-calendar/src/calendar/CalendarFooter.jsx
+++ b/components/vc-calendar/src/calendar/CalendarFooter.jsx
@@ -23,6 +23,7 @@ const CalendarFooter = {
disabledDate: PropTypes.func,
showTimePicker: PropTypes.bool,
okDisabled: PropTypes.bool,
+ mode: PropTypes.string,
},
methods: {
onSelect(value) {
@@ -37,9 +38,9 @@ const CalendarFooter = {
render() {
const props = getOptionProps(this);
const { $listeners } = this;
- const { value, prefixCls, showOk, timePicker, renderFooter, showToday } = props;
+ const { value, prefixCls, showOk, timePicker, renderFooter, showToday, mode } = props;
let footerEl = null;
- const extraFooter = renderFooter();
+ const extraFooter = renderFooter && renderFooter(mode);
if (showToday || timePicker || extraFooter) {
const btnProps = {
props: {
diff --git a/components/vc-calendar/src/calendar/CalendarHeader.jsx b/components/vc-calendar/src/calendar/CalendarHeader.jsx
index c0e41349f..d7e5bf94d 100644
--- a/components/vc-calendar/src/calendar/CalendarHeader.jsx
+++ b/components/vc-calendar/src/calendar/CalendarHeader.jsx
@@ -36,6 +36,7 @@ const CalendarHeader = {
mode: PropTypes.any,
monthCellRender: PropTypes.func,
monthCellContentRender: PropTypes.func,
+ renderFooter: PropTypes.func,
},
data() {
this.nextMonth = goMonth.bind(this, 1);
@@ -140,6 +141,7 @@ const CalendarHeader = {
enableNext,
enablePrev,
disabledMonth,
+ renderFooter,
} = props;
let panel = null;
@@ -154,6 +156,7 @@ const CalendarHeader = {
disabledDate={disabledMonth}
cellRender={props.monthCellRender}
contentRender={props.monthCellContentRender}
+ renderFooter={renderFooter}
/>
);
}
@@ -165,6 +168,7 @@ const CalendarHeader = {
rootPrefixCls={prefixCls}
onSelect={this.onYearSelect}
onDecadePanelShow={this.showDecadePanel}
+ renderFooter={renderFooter}
/>
);
}
@@ -175,6 +179,7 @@ const CalendarHeader = {
defaultValue={value}
rootPrefixCls={prefixCls}
onSelect={this.onDecadeSelect}
+ renderFooter={renderFooter}
/>
);
}
diff --git a/components/vc-calendar/src/date/DateInput.jsx b/components/vc-calendar/src/date/DateInput.jsx
index 0c353face..a459467cb 100644
--- a/components/vc-calendar/src/date/DateInput.jsx
+++ b/components/vc-calendar/src/date/DateInput.jsx
@@ -3,6 +3,11 @@ import BaseMixin from '../../../_util/BaseMixin';
import { getComponentFromProp } from '../../../_util/props-util';
import moment from 'moment';
import { formatDate } from '../util';
+import KeyCode from '../../../_util/KeyCode';
+
+let cachedSelectionStart;
+let cachedSelectionEnd;
+let dateInputInstance;
const DateInput = {
mixins: [BaseMixin],
@@ -42,21 +47,27 @@ const DateInput = {
updated() {
this.$nextTick(() => {
if (
+ dateInputInstance &&
this.$data.hasFocus &&
!this.invalid &&
- !(this.cachedSelectionStart === 0 && this.cachedSelectionEnd === 0)
+ !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)
) {
- this.$refs.dateInputInstance.setSelectionRange(
- this.cachedSelectionStart,
- this.cachedSelectionEnd,
+ dateInputInstance.setSelectionRange(
+ cachedSelectionStart,
+ cachedSelectionEnd,
);
}
});
},
+ getInstance() {
+ return dateInputInstance;
+ },
methods: {
updateState() {
- this.cachedSelectionStart = this.$refs.dateInputInstance.selectionStart;
- this.cachedSelectionEnd = this.$refs.dateInputInstance.selectionEnd;
+ if (dateInputInstance) {
+ cachedSelectionStart = dateInputInstance.selectionStart;
+ cachedSelectionEnd = dateInputInstance.selectionEnd;
+ }
// when popup show, click body will call this, bug!
const selectedValue = this.selectedValue;
if (!this.$data.hasFocus) {
@@ -66,6 +77,12 @@ const DateInput = {
});
}
},
+ onClear() {
+ this.setState({
+ str: '',
+ });
+ this.__emit('clear', null);
+ },
onInputChange(event) {
const str = event.target.value;
const { disabledDate, format, selectedValue } = this.$props;
@@ -79,7 +96,8 @@ const DateInput = {
});
return;
}
-
+
+ // 不合法直接退出
const parsed = moment(str, format, true);
if (!parsed.isValid()) {
this.setState({
@@ -107,38 +125,38 @@ const DateInput = {
if (selectedValue !== value || (selectedValue && value && !selectedValue.isSame(value))) {
this.setState({
+ invalid: false,
str,
});
this.__emit('change', value);
}
},
-
- onClear() {
- this.setState({
- str: '',
- });
- this.__emit('clear', null);
- },
-
- getRootDOMNode() {
- return this.$el;
- },
-
- focus() {
- if (this.$refs.dateInputInstance) {
- this.$refs.dateInputInstance.focus();
- }
- },
onFocus() {
this.setState({ hasFocus: true });
},
-
onBlur() {
this.setState((prevState, prevProps) => ({
hasFocus: false,
str: formatDate(prevProps.value, prevProps.format),
}));
},
+ onKeyDown ({ keyCode }) {
+ const { value } = this.$props;
+ if (keyCode === KeyCode.ENTER ) {
+ this.__emit('select', value.clone());
+ }
+ },
+ getRootDOMNode() {
+ return this.$el;
+ },
+ focus() {
+ if (dateInputInstance) {
+ dateInputInstance.focus();
+ }
+ },
+ saveDateInput(dateInput) {
+ dateInputInstance = dateInput;
+ },
},
render() {
@@ -149,12 +167,18 @@ const DateInput = {
);
},
diff --git a/components/vc-calendar/src/locale/hi_IN.js b/components/vc-calendar/src/locale/hi_IN.js
new file mode 100644
index 000000000..a0b6b4e63
--- /dev/null
+++ b/components/vc-calendar/src/locale/hi_IN.js
@@ -0,0 +1,28 @@
+export default {
+ today: 'आज',
+ now: 'अभी',
+ backToToday: 'आज तक',
+ ok: 'ठीक',
+ clear: 'स्पष्ट',
+ month: 'महीना',
+ year: 'साल',
+ timeSelect: 'समय का चयन करें',
+ dateSelect: 'तारीख़ चुनें',
+ weekSelect: 'एक सप्ताह चुनें',
+ monthSelect: 'एक महीना चुनें',
+ yearSelect: 'एक वर्ष चुनें',
+ decadeSelect: 'एक दशक चुनें',
+ yearFormat: 'YYYY',
+ dateFormat: 'M/D/YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'M/D/YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'पिछला महीना (पेजअप)',
+ nextMonth: 'अगले महीने (पेजडाउन)',
+ previousYear: 'पिछले साल (Ctrl + बाएं)',
+ nextYear: 'अगले साल (Ctrl + दाहिना)',
+ previousDecade: 'पिछला दशक',
+ nextDecade: 'अगले दशक',
+ previousCentury: 'पीछ्ली शताब्दी',
+ nextCentury: 'अगली सदी',
+};
diff --git a/components/vc-calendar/src/locale/kn_IN.js b/components/vc-calendar/src/locale/kn_IN.js
new file mode 100644
index 000000000..5acf5d698
--- /dev/null
+++ b/components/vc-calendar/src/locale/kn_IN.js
@@ -0,0 +1,28 @@
+export default {
+ today: 'ಇಂದು',
+ now: 'ಈಗ',
+ backToToday: 'ಇಂದು ಹಿಂದಿರುಗಿ',
+ ok: 'ಸರಿ',
+ clear: 'ಸ್ಪಷ್ಟ',
+ month: 'ತಿಂಗಳು',
+ year: 'ವರ್ಷ',
+ timeSelect: 'ಸಮಯ ಆಯ್ಕೆಮಾಡಿ',
+ dateSelect: 'ದಿನಾಂಕವನ್ನು ಆಯ್ಕೆ ಮಾಡಿ',
+ weekSelect: 'ಒಂದು ವಾರದ ಆರಿಸಿ',
+ monthSelect: 'ಒಂದು ತಿಂಗಳು ಆಯ್ಕೆಮಾಡಿ',
+ yearSelect: 'ಒಂದು ವರ್ಷ ಆರಿಸಿ',
+ decadeSelect: 'ಒಂದು ದಶಕದ ಆಯ್ಕೆಮಾಡಿ',
+ yearFormat: 'YYYY',
+ dateFormat: 'M/D/YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'M/D/YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'ಹಿಂದಿನ ತಿಂಗಳು (ಪೇಜ್ಅಪ್)',
+ nextMonth: 'ಮುಂದಿನ ತಿಂಗಳು (ಪೇಜ್ಡೌನ್)',
+ previousYear: 'ಕಳೆದ ವರ್ಷ (Ctrl + ಎಡ)',
+ nextYear: 'ಮುಂದಿನ ವರ್ಷ (Ctrl + ಬಲ)',
+ previousDecade: 'ಕಳೆದ ದಶಕ',
+ nextDecade: 'ಮುಂದಿನ ದಶಕ',
+ previousCentury: 'ಕಳೆದ ಶತಮಾನ',
+ nextCentury: 'ಮುಂದಿನ ಶತಮಾನ',
+};
diff --git a/components/vc-calendar/src/mixin/CalendarMixin.js b/components/vc-calendar/src/mixin/CalendarMixin.js
index a0b8e43e6..cb6a388c9 100644
--- a/components/vc-calendar/src/mixin/CalendarMixin.js
+++ b/components/vc-calendar/src/mixin/CalendarMixin.js
@@ -4,16 +4,13 @@ import { hasProp } from '../../../_util/props-util';
import moment from 'moment';
import { isAllowedDate, getTodayTime } from '../util/index';
function noop() {}
-function getNow() {
- return moment();
-}
-function getNowByCurrentStateValue(value) {
+export function getNowByCurrentStateValue(value) {
let ret;
if (value) {
ret = getTodayTime(value);
} else {
- ret = getNow();
+ ret = moment();
}
return ret;
}
@@ -29,6 +26,7 @@ function isMoment(value) {
const MomentType = PropTypes.custom(isMoment);
const CalendarMixin = {
mixins: [BaseMixin],
+ name: 'CalendarMixinWrapper',
props: {
value: MomentType,
defaultValue: MomentType,
@@ -36,7 +34,7 @@ const CalendarMixin = {
data() {
const props = this.$props;
- const sValue = props.value || props.defaultValue || getNow();
+ const sValue = props.value || props.defaultValue || getNowByCurrentStateValue();
return {
sValue,
sSelectedValue: props.selectedValue || props.defaultSelectedValue,
diff --git a/components/vc-calendar/src/mixin/CommonMixin.js b/components/vc-calendar/src/mixin/CommonMixin.js
index e2f1000cf..fc80fa34f 100644
--- a/components/vc-calendar/src/mixin/CommonMixin.js
+++ b/components/vc-calendar/src/mixin/CommonMixin.js
@@ -30,11 +30,15 @@ export default {
}
return format;
},
-
focus() {
- if (this.$refs.rootInstance) {
+ if (this.focusElement) {
+ this.focusElement.focus();
+ } else if (this.$refs.rootInstance) {
this.$refs.rootInstance.focus();
}
},
+ saveFocusElement (focusElement) {
+ this.focusElement = focusElement;
+ },
},
};
diff --git a/components/vc-calendar/src/month/MonthPanel.jsx b/components/vc-calendar/src/month/MonthPanel.jsx
index 2726de40c..c55cdc3ab 100644
--- a/components/vc-calendar/src/month/MonthPanel.jsx
+++ b/components/vc-calendar/src/month/MonthPanel.jsx
@@ -23,6 +23,7 @@ const MonthPanel = {
// onChange: PropTypes.func,
disabledDate: PropTypes.func,
// onSelect: PropTypes.func,
+ renderFooter: PropTypes.func,
},
data() {
@@ -69,10 +70,13 @@ const MonthPanel = {
locale,
rootPrefixCls,
disabledDate,
+ renderFooter,
$listeners = {},
} = this;
const year = sValue.year();
const prefixCls = `${rootPrefixCls}-month-panel`;
+
+ const footer = renderFooter && renderFooter('month');
return (
@@ -112,6 +116,10 @@ const MonthPanel = {
prefixCls={prefixCls}
/>
+ {footer && (
+ )}
);
diff --git a/components/vc-calendar/src/year/YearPanel.jsx b/components/vc-calendar/src/year/YearPanel.jsx
index 9662092ae..f22d523a1 100644
--- a/components/vc-calendar/src/year/YearPanel.jsx
+++ b/components/vc-calendar/src/year/YearPanel.jsx
@@ -25,6 +25,7 @@ export default {
value: PropTypes.object,
defaultValue: PropTypes.object,
locale: PropTypes.object,
+ renderFooter: PropTypes.func,
},
data() {
this.nextDecade = goYear.bind(this, 10);
@@ -59,7 +60,7 @@ export default {
},
render() {
- const { sValue: value, locale, $listeners = {} } = this;
+ const { sValue: value, locale, renderFooter, $listeners = {} } = this;
const decadePanelShow = $listeners.decadePanelShow || noop;
const years = this.years();
const currentYear = value.year();
@@ -101,7 +102,7 @@ export default {
|
);
});
-
+ const footer = renderFooter && renderFooter('year');
return (
@@ -136,6 +137,10 @@ export default {
{yeasEls}
+ {footer && (
+ )}
);
From 78c102378543081f8ea297fca24f71f3b444cfbf Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Fri, 25 Jan 2019 18:00:36 +0800
Subject: [PATCH 002/132] test: update test
---
components/date-picker/__tests__/DatePicker.test.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js
index 23dbafc93..a111b8417 100644
--- a/components/date-picker/__tests__/DatePicker.test.js
+++ b/components/date-picker/__tests__/DatePicker.test.js
@@ -117,6 +117,10 @@ describe('DatePicker', () => {
await asyncExpect(() => {
openPanel(wrapper);
});
+ await asyncExpect(() => {
+ // selectDateFromBody时(点击其它元素)没有触发input blur事件,强制执行blur
+ $$('.ant-calendar-input')[0].blur();
+ }, 0);
await asyncExpect(() => {
selectDateFromBody(moment('2016-11-13'));
}, 0);
@@ -129,7 +133,6 @@ describe('DatePicker', () => {
await asyncExpect(() => {
expect($$('.ant-calendar-input')[0].value).toBe('2016-11-14 12:12:12');
});
- await asyncExpect(() => {});
});
it('triggers onChange only when date was selected', async () => {
From 4df4424570b6c67fd90de72f98f17232d596f130 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Wed, 13 Feb 2019 22:11:27 +0800
Subject: [PATCH 003/132] perf: update to vue 2.6.x
---
components/_util/props-util.js | 10 +++++++++-
components/vc-align/Align.jsx | 5 +++--
package.json | 12 ++++++------
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/components/_util/props-util.js b/components/_util/props-util.js
index 8e94a5474..e1141e6e7 100644
--- a/components/_util/props-util.js
+++ b/components/_util/props-util.js
@@ -60,6 +60,13 @@ const getSlots = ele => {
});
return slots;
};
+const getSlot = (self, name = 'default', options = {}) => {
+ return (
+ (self.$scopedSlots && self.$scopedSlots[name] && self.$scopedSlots[name](options)) ||
+ self.$slots[name] ||
+ []
+ );
+};
const getAllChildren = ele => {
let componentOptions = ele.componentOptions || {};
if (ele.$vnode) {
@@ -105,9 +112,9 @@ const getComponentFromProp = (instance, prop, options = instance, execute = true
return typeof temp === 'function' && execute ? temp(h, options) : temp;
}
return (
- instance.$slots[prop] ||
(instance.$scopedSlots[prop] && execute && instance.$scopedSlots[prop](options)) ||
instance.$scopedSlots[prop] ||
+ instance.$slots[prop] ||
undefined
);
} else {
@@ -289,6 +296,7 @@ export {
isValidElement,
camelize,
getSlots,
+ getSlot,
getAllProps,
getAllChildren,
};
diff --git a/components/vc-align/Align.jsx b/components/vc-align/Align.jsx
index 4fecea4f1..a7922ac68 100644
--- a/components/vc-align/Align.jsx
+++ b/components/vc-align/Align.jsx
@@ -4,6 +4,7 @@ import addEventListener from '../_util/Dom/addEventListener';
import { isWindow, buffer, isSamePoint } from './util';
import { cloneElement } from '../_util/vnode.js';
import clonedeep from 'lodash/cloneDeep';
+import { getSlot } from '../_util/props-util';
function getElement(func) {
if (typeof func !== 'function' || !func) return null;
@@ -133,8 +134,8 @@ export default {
render() {
const { childrenProps } = this.$props;
- const child = this.$slots.default[0];
- if (childrenProps) {
+ const child = getSlot(this)[0];
+ if (child && childrenProps) {
return cloneElement(child, { props: childrenProps });
}
return child;
diff --git a/package.json b/package.json
index b0b803f96..ca0dc8a67 100644
--- a/package.json
+++ b/package.json
@@ -56,8 +56,8 @@
"prettier"
],
"peerDependencies": {
- "vue": ">=2.5.0",
- "vue-template-compiler": ">=2.5.0"
+ "vue": ">=2.6.6",
+ "vue-template-compiler": ">=2.6.6"
},
"devDependencies": {
"@commitlint/cli": "^6.2.0",
@@ -153,17 +153,17 @@
"through2": "^2.0.3",
"uglifyjs-webpack-plugin": "^2.1.1",
"url-loader": "^1.1.2",
- "vue": "^2.5.16",
+ "vue": "^2.6.6",
"vue-antd-md-loader": "^1.1.0",
"vue-clipboard2": "0.0.8",
"vue-eslint-parser": "^5.0.0",
"vue-i18n": "^8.3.2",
"vue-infinite-scroll": "^2.0.2",
"vue-jest": "^2.5.0",
- "vue-loader": "^15.5.1",
+ "vue-loader": "^15.6.2",
"vue-router": "^3.0.1",
- "vue-server-renderer": "^2.5.16",
- "vue-template-compiler": "^2.5.16",
+ "vue-server-renderer": "^2.6.6",
+ "vue-template-compiler": "^2.6.6",
"vue-virtual-scroller": "^0.12.0",
"vuex": "^3.1.0",
"webpack": "^4.28.4",
From 1d80cec3d758020497e1a085acf1554c86fa3a04 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Wed, 13 Feb 2019 22:12:00 +0800
Subject: [PATCH 004/132] style: format vc-calendar
---
.../vc-calendar/assets/index/DecadePanel.less | 14 +++++-----
.../vc-calendar/assets/index/MonthPanel.less | 15 +++++------
.../vc-calendar/assets/index/YearPanel.less | 14 +++++-----
components/vc-calendar/src/Calendar.jsx | 16 ++++++-----
components/vc-calendar/src/FullCalendar.jsx | 2 +-
components/vc-calendar/src/MonthCalendar.jsx | 2 +-
components/vc-calendar/src/date/DateInput.jsx | 27 +++++++++----------
.../vc-calendar/src/decade/DecadePanel.jsx | 5 +---
.../vc-calendar/src/mixin/CommonMixin.js | 2 +-
.../vc-calendar/src/month/MonthPanel.jsx | 5 +---
components/vc-calendar/src/year/YearPanel.jsx | 5 +---
11 files changed, 51 insertions(+), 56 deletions(-)
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(,
+ );
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 = {
- {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 && }
);
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 {
|