From 738d2f442a9d05fc7ce54af66822728f7b68bab2 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Tue, 3 Mar 2020 10:53:12 +0800
Subject: [PATCH] feat: calendar update locale
---
build/config.js | 2 +-
components/calendar/index.jsx | 10 +-
components/vc-calendar/index.js | 2 +-
components/vc-calendar/src/Calendar.jsx | 44 ++++++-
components/vc-calendar/src/MonthCalendar.jsx | 1 -
components/vc-calendar/src/Picker.jsx | 6 +
components/vc-calendar/src/RangeCalendar.jsx | 116 ++++++++++++------
components/vc-calendar/src/date/DateInput.jsx | 9 +-
components/vc-calendar/src/date/DateTBody.jsx | 12 +-
components/vc-calendar/src/locale/hr_HR.js | 28 +++++
components/vc-calendar/src/locale/id_ID.js | 8 +-
components/vc-calendar/src/locale/lv_LV.js | 27 ++++
components/vc-calendar/src/locale/mk_MK.js | 27 ++++
components/vc-calendar/src/locale/ms_MY.js | 27 ++++
components/vc-calendar/src/locale/ro_RO.js | 28 +++++
components/vc-calendar/src/locale/sk_SK.js | 1 +
components/vc-calendar/src/locale/ta_IN.js | 28 +++++
.../vc-calendar/src/mixin/CalendarMixin.js | 8 +-
.../vc-calendar/src/mixin/CommonMixin.js | 18 ---
.../src/range-calendar/CalendarPart.jsx | 8 +-
components/vc-calendar/src/util/index.js | 1 +
21 files changed, 333 insertions(+), 78 deletions(-)
create mode 100644 components/vc-calendar/src/locale/hr_HR.js
create mode 100644 components/vc-calendar/src/locale/lv_LV.js
create mode 100644 components/vc-calendar/src/locale/mk_MK.js
create mode 100644 components/vc-calendar/src/locale/ms_MY.js
create mode 100644 components/vc-calendar/src/locale/ro_RO.js
create mode 100644 components/vc-calendar/src/locale/ta_IN.js
diff --git a/build/config.js b/build/config.js
index 97069eaca..63e919618 100644
--- a/build/config.js
+++ b/build/config.js
@@ -1,5 +1,5 @@
module.exports = {
dev: {
- componentName: 'table', // dev components
+ componentName: 'calendar', // dev components
},
};
diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx
index 4200980fc..f3e0b58a5 100644
--- a/components/calendar/index.jsx
+++ b/components/calendar/index.jsx
@@ -1,15 +1,9 @@
import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
-import {
- getOptionProps,
- hasProp,
- initDefaultProps,
- getListeners,
- getComponentFromProp,
-} from '../_util/props-util';
+import { getOptionProps, hasProp, initDefaultProps, getListeners } from '../_util/props-util';
import * as moment from 'moment';
import FullCalendar from '../vc-calendar/src/FullCalendar';
-import Header, { HeaderRender } from './Header';
+import Header from './Header';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import interopDefault from '../_util/interopDefault';
import { ConfigConsumerProps } from '../config-provider';
diff --git a/components/vc-calendar/index.js b/components/vc-calendar/index.js
index a81bab944..685b89bba 100644
--- a/components/vc-calendar/index.js
+++ b/components/vc-calendar/index.js
@@ -1,4 +1,4 @@
-// based on rc-calendar 9.10.10
+// based on rc-calendar 9.15.8
import Vue from 'vue';
import ref from 'vue-ref';
import Calendar from './src/';
diff --git a/components/vc-calendar/src/Calendar.jsx b/components/vc-calendar/src/Calendar.jsx
index d4079f855..9d1b16d3f 100644
--- a/components/vc-calendar/src/Calendar.jsx
+++ b/components/vc-calendar/src/Calendar.jsx
@@ -14,6 +14,13 @@ import enUs from './locale/en_US';
import { getTimeConfig, getTodayTime, syncTime } from './util';
import { goStartMonth, goEndMonth, goTime } from './util/toTime';
+const getMomentObjectIfValid = date => {
+ if (moment.isMoment(date) && date.isValid()) {
+ return date;
+ }
+ return false;
+};
+
const Calendar = {
props: {
locale: PropTypes.object.def(enUs),
@@ -46,6 +53,7 @@ const Calendar = {
renderSidebar: PropTypes.func.def(() => null),
clearIcon: PropTypes.any,
focusablePanel: PropTypes.bool.def(true),
+ inputMode: PropTypes.string,
},
mixins: [BaseMixin, CommonMixin, CalendarMixin],
@@ -54,7 +62,10 @@ const Calendar = {
const props = this.$props;
return {
sMode: this.mode || 'date',
- sValue: props.value || props.defaultValue || moment(),
+ sValue:
+ getMomentObjectIfValid(props.value) ||
+ getMomentObjectIfValid(props.defaultValue) ||
+ moment(),
sSelectedValue: props.selectedValue || props.defaultSelectedValue,
};
},
@@ -63,9 +74,11 @@ const Calendar = {
this.setState({ sMode: val });
},
value(val) {
- const sValue = val || this.defaultValue || getNowByCurrentStateValue(this.sValue);
this.setState({
- sValue,
+ sValue:
+ getMomentObjectIfValid(val) ||
+ getMomentObjectIfValid(this.defaultValue) ||
+ getNowByCurrentStateValue(this.sValue),
});
},
selectedValue(val) {
@@ -190,6 +203,25 @@ const Calendar = {
source: 'todayButton',
});
},
+
+ onBlur(event) {
+ setTimeout(() => {
+ const dateInput = DateInput.getInstance();
+ const rootInstance = this.rootInstance;
+
+ if (
+ !rootInstance ||
+ rootInstance.contains(document.activeElement) ||
+ (dateInput && dateInput.contains(document.activeElement))
+ ) {
+ // focused element is still part of Calendar
+ return;
+ }
+
+ this.$emit('blur', event);
+ }, 0);
+ },
+
getRootDOMNode() {
return this.$el;
},
@@ -217,6 +249,9 @@ const Calendar = {
sSelectedValue,
sMode,
renderFooter,
+ inputMode,
+ monthCellRender,
+ monthCellContentRender,
$props: props,
} = this;
const clearIcon = getComponentFromProp(this, 'clearIcon');
@@ -267,6 +302,7 @@ const Calendar = {
onChange={this.onDateInputChange}
clearIcon={clearIcon}
onSelect={this.onDateInputSelect}
+ inputMode={inputMode}
/>
) : null;
const children = [];
@@ -286,6 +322,8 @@ const Calendar = {
renderFooter={renderFooter}
showTimePicker={showTimePicker}
prefixCls={prefixCls}
+ monthCellRender={monthCellRender}
+ monthCellContentRender={monthCellContentRender}
/>
{timePicker && showTimePicker ? (
diff --git a/components/vc-calendar/src/MonthCalendar.jsx b/components/vc-calendar/src/MonthCalendar.jsx
index d77c9eca6..f0a219614 100644
--- a/components/vc-calendar/src/MonthCalendar.jsx
+++ b/components/vc-calendar/src/MonthCalendar.jsx
@@ -14,7 +14,6 @@ const MonthCalendar = {
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
monthCellRender: PropTypes.func,
- dateCellRender: PropTypes.func,
value: PropTypes.object,
defaultValue: PropTypes.object,
selectedValue: PropTypes.object,
diff --git a/components/vc-calendar/src/Picker.jsx b/components/vc-calendar/src/Picker.jsx
index 41046a719..d5c3dd17e 100644
--- a/components/vc-calendar/src/Picker.jsx
+++ b/components/vc-calendar/src/Picker.jsx
@@ -38,6 +38,7 @@ const Picker = {
defaultValue: PropTypes.oneOfType([MomentType, PropTypes.arrayOf(MomentType)]),
align: PropTypes.object.def({}),
dropdownClassName: PropTypes.string,
+ dateRender: PropTypes.func,
},
mixins: [BaseMixin],
@@ -123,6 +124,10 @@ const Picker = {
this.closeCalendar(this.focus);
},
+ onCalendarBlur() {
+ this.setOpen(false);
+ },
+
onVisibleChange(open) {
this.setOpen(open);
},
@@ -144,6 +149,7 @@ const Picker = {
ok: createChainedFunction(calendarEvents.ok, this.onCalendarOk),
select: createChainedFunction(calendarEvents.select, this.onCalendarSelect),
clear: createChainedFunction(calendarEvents.clear, this.onCalendarClear),
+ blur: createChainedFunction(calendarEvents.blur, this.onCalendarBlur),
},
};
diff --git a/components/vc-calendar/src/RangeCalendar.jsx b/components/vc-calendar/src/RangeCalendar.jsx
index 6aedccc8c..4551a1e04 100644
--- a/components/vc-calendar/src/RangeCalendar.jsx
+++ b/components/vc-calendar/src/RangeCalendar.jsx
@@ -38,9 +38,15 @@ function isArraysEqual(a, b) {
}
function getValueFromSelectedValue(selectedValue) {
- const [start, end] = selectedValue;
- const newEnd = end && end.isSame(start, 'month') ? end.clone().add(1, 'month') : end;
- return [start, newEnd];
+ let [start, end] = selectedValue;
+ if (end && (start === undefined || start === null)) {
+ start = end.clone().subtract(1, 'month');
+ }
+
+ if (start && (end === undefined || end === null)) {
+ end = start.clone().add(1, 'month');
+ }
+ return [start, end];
}
function normalizeAnchor(props, init) {
@@ -73,7 +79,7 @@ function onInputSelect(direction, value, cause) {
const index = direction === 'left' ? 0 : 1;
selectedValue[index] = value;
if (selectedValue[0] && this.compare(selectedValue[0], selectedValue[1]) > 0) {
- selectedValue[1 - index] = this.showTimePicker ? selectedValue[index] : undefined;
+ selectedValue[1 - index] = this.sShowTimePicker ? selectedValue[index] : undefined;
}
this.__emit('inputSelect', selectedValue);
this.fireSelectValueChange(selectedValue, null, cause || { source: 'dateInput' });
@@ -89,7 +95,7 @@ const RangeCalendar = {
defaultValue: PropTypes.any,
value: PropTypes.any,
hoverValue: PropTypes.any,
- mode: PropTypes.arrayOf(PropTypes.oneOf(['date', 'month', 'year', 'decade'])),
+ mode: PropTypes.arrayOf(PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade'])),
showDateInput: PropTypes.bool.def(true),
timePicker: PropTypes.any,
showOk: PropTypes.bool,
@@ -104,7 +110,7 @@ const RangeCalendar = {
// onValueChange: PropTypes.func,
// onHoverChange: PropTypes.func,
// onPanelChange: PropTypes.func,
- format: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
+ format: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
// onClear: PropTypes.func,
type: PropTypes.any.def('both'),
disabledDate: PropTypes.func,
@@ -127,8 +133,9 @@ const RangeCalendar = {
firstSelectedValue: null,
sHoverValue: props.hoverValue || [],
sValue: value,
- showTimePicker: false,
+ sShowTimePicker: false,
sMode: props.mode || ['date', 'date'],
+ sPanelTriggerSource: '', // Trigger by which picker panel: 'start' & 'end'
};
},
watch: {
@@ -359,12 +366,12 @@ const RangeCalendar = {
onOpenTimePicker() {
this.setState({
- showTimePicker: true,
+ sShowTimePicker: true,
});
},
onCloseTimePicker() {
this.setState({
- showTimePicker: false,
+ sShowTimePicker: false,
});
},
@@ -412,11 +419,13 @@ const RangeCalendar = {
const newMode = [mode, sMode[1]];
const newValue = [value || sValue[0], sValue[1]];
this.__emit('panelChange', newValue, newMode);
+ const newState = {
+ sPanelTriggerSource: 'start',
+ };
if (!hasProp(this, 'mode')) {
- this.setState({
- sMode: newMode,
- });
+ newState.sMode = newMode;
}
+ this.setState(newState);
},
onEndPanelChange(value, mode) {
@@ -424,37 +433,74 @@ const RangeCalendar = {
const newMode = [sMode[0], mode];
const newValue = [sValue[0], value || sValue[1]];
this.__emit('panelChange', newValue, newMode);
+ const newState = {
+ sPanelTriggerSource: 'start',
+ };
if (!hasProp(this, 'mode')) {
- this.setState({
- sMode: newMode,
- });
+ newState.sMode = newMode;
}
+ this.setState(newState);
},
getStartValue() {
- let value = this.sValue[0];
- const selectedValue = this.sSelectedValue;
+ const {
+ sSelectedValue: selectedValue,
+ sShowTimePicker: showTimePicker,
+ sValue: value,
+ sMode: mode,
+ sPanelTriggerSource: panelTriggerSource,
+ } = this.$data;
+ let startValue = value[0];
// keep selectedTime when select date
- if (selectedValue[0] && this.timePicker) {
- value = value.clone();
- syncTime(selectedValue[0], value);
+ if (selectedValue[0] && this.props.timePicker) {
+ startValue = startValue.clone();
+ syncTime(selectedValue[0], startValue);
}
- if (this.showTimePicker && selectedValue[0]) {
- return selectedValue[0];
+ if (showTimePicker && selectedValue[0]) {
+ startValue = selectedValue[0];
}
- return value;
+
+ // Adjust month if date not align
+ if (
+ panelTriggerSource === 'end' &&
+ mode[0] === 'date' &&
+ mode[1] === 'date' &&
+ startValue.isSame(value[1], 'month')
+ ) {
+ startValue = startValue.clone().subtract(1, 'month');
+ }
+
+ return startValue;
},
getEndValue() {
- const { sValue, sSelectedValue, showTimePicker } = this;
- const endValue = sValue[1] ? sValue[1].clone() : sValue[0].clone().add(1, 'month');
+ const {
+ sSelectedValue: selectedValue,
+ sShowTimePicker: showTimePicker,
+ sValue: value,
+ sMode: mode,
+ sPanelTriggerSource: panelTriggerSource,
+ } = this.$data;
+ let endValue = value[1] ? value[1].clone() : value[0].clone().add(1, 'month');
// keep selectedTime when select date
- if (sSelectedValue[1] && this.timePicker) {
- syncTime(sSelectedValue[1], endValue);
+ if (selectedValue[1] && this.props.timePicker) {
+ syncTime(selectedValue[1], endValue);
}
if (showTimePicker) {
- return sSelectedValue[1] ? sSelectedValue[1] : this.getStartValue();
+ endValue = selectedValue[1] ? selectedValue[1] : this.getStartValue();
}
+
+ // Adjust month if date not align
+ if (
+ !showTimePicker &&
+ panelTriggerSource !== 'end' &&
+ mode[0] === 'date' &&
+ mode[1] === 'date' &&
+ endValue.isSame(value[0], 'month')
+ ) {
+ endValue = endValue.clone().add(1, 'month');
+ }
+
return endValue;
},
// get disabled hours for second picker
@@ -596,12 +642,12 @@ const RangeCalendar = {
disabledStartMonth(month) {
const { sValue } = this;
- return month.isSameOrAfter(sValue[1], 'month');
+ return month.isAfter(sValue[1], 'month');
},
disabledEndMonth(month) {
const { sValue } = this;
- return month.isSameOrBefore(sValue[0], 'month');
+ return month.isBefore(sValue[0], 'month');
},
},
@@ -619,12 +665,12 @@ const RangeCalendar = {
seperator,
} = props;
const clearIcon = getComponentFromProp(this, 'clearIcon');
- const { sHoverValue, sSelectedValue, sMode, showTimePicker, sValue } = this;
+ const { sHoverValue, sSelectedValue, sMode, sShowTimePicker, sValue } = this;
const className = {
[prefixCls]: 1,
[`${prefixCls}-hidden`]: !props.visible,
[`${prefixCls}-range`]: 1,
- [`${prefixCls}-show-time-picker`]: showTimePicker,
+ [`${prefixCls}-show-time-picker`]: sShowTimePicker,
[`${prefixCls}-week-number`]: props.showWeekNumber,
};
const baseProps = {
@@ -686,7 +732,7 @@ const RangeCalendar = {
placeholder: placeholder1,
showDateInput: this.showDateInput,
timePicker: timePicker,
- showTimePicker: showTimePicker,
+ showTimePicker: sShowTimePicker || mode[0] === 'time',
enablePrev: true,
enableNext: !isClosestMonths || this.isMonthYearPanelShow(sMode[1]),
clearIcon,
@@ -709,7 +755,7 @@ const RangeCalendar = {
mode: sMode[1],
showDateInput: this.showDateInput,
timePicker: timePicker,
- showTimePicker: showTimePicker,
+ showTimePicker: sShowTimePicker || mode[1] === 'time',
disabledTime: this.disabledEndTime,
disabledMonth: this.disabledEndMonth,
enablePrev: !isClosestMonths || this.isMonthYearPanelShow(sMode[0]),
@@ -742,7 +788,7 @@ const RangeCalendar = {
if (props.timePicker) {
const timePickerButtonProps = mergeProps(baseProps, {
props: {
- showTimePicker: showTimePicker,
+ showTimePicker: sShowTimePicker || (mode[0] === 'time' && mode[1] === 'time'),
timePickerDisabled: !this.hasSelectedValue() || sHoverValue.length,
},
on: {
diff --git a/components/vc-calendar/src/date/DateInput.jsx b/components/vc-calendar/src/date/DateInput.jsx
index 0183fc97c..d96275411 100644
--- a/components/vc-calendar/src/date/DateInput.jsx
+++ b/components/vc-calendar/src/date/DateInput.jsx
@@ -8,7 +8,6 @@ import KeyCode from '../../../_util/KeyCode';
let cachedSelectionStart;
let cachedSelectionEnd;
let dateInputInstance;
-import { isIE, isIE9 } from '../../../_util/env';
const DateInput = {
mixins: [BaseMixin],
@@ -26,6 +25,7 @@ const DateInput = {
// onSelect: PropTypes.func,
selectedValue: PropTypes.object,
clearIcon: PropTypes.any,
+ inputMode: PropTypes.string,
},
data() {
@@ -141,13 +141,15 @@ const DateInput = {
str: formatDate(prevProps.value, prevProps.format),
}));
},
- onKeyDown({ keyCode }) {
+ onKeyDown(event) {
+ const { keyCode } = event;
const { value, disabledDate } = this.$props;
if (keyCode === KeyCode.ENTER) {
const validateDate = !disabledDate || !disabledDate(value);
if (validateDate) {
this.__emit('select', value.clone());
}
+ event.preventDefault();
}
},
getRootDOMNode() {
@@ -164,7 +166,7 @@ const DateInput = {
},
render() {
- const { invalid, str, locale, prefixCls, placeholder, disabled, showClear } = this;
+ const { invalid, str, locale, prefixCls, placeholder, disabled, showClear, inputMode } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
return (
@@ -190,6 +192,7 @@ const DateInput = {
onKeydown={this.onKeyDown}
onFocus={this.onFocus}
onBlur={this.onBlur}
+ inputMode={inputMode}
/>
{showClear ? (
diff --git a/components/vc-calendar/src/date/DateTBody.jsx b/components/vc-calendar/src/date/DateTBody.jsx
index bf3c04da1..4db6ada64 100644
--- a/components/vc-calendar/src/date/DateTBody.jsx
+++ b/components/vc-calendar/src/date/DateTBody.jsx
@@ -139,11 +139,21 @@ const DateTBody = {
cls += ` ${selectedStartDateClass}`;
}
}
- if (startValue && endValue) {
+ if (startValue || endValue) {
if (isSameDay(current, endValue)) {
selected = true;
isActiveWeek = true;
cls += ` ${selectedEndDateClass}`;
+ } else if (
+ (startValue === null || startValue === undefined) &&
+ current.isBefore(endValue, 'day')
+ ) {
+ cls += ` ${inRangeClass}`;
+ } else if (
+ (endValue === null || endValue === undefined) &&
+ current.isAfter(startValue, 'day')
+ ) {
+ cls += ` ${inRangeClass}`;
} else if (current.isAfter(startValue, 'day') && current.isBefore(endValue, 'day')) {
cls += ` ${inRangeClass}`;
}
diff --git a/components/vc-calendar/src/locale/hr_HR.js b/components/vc-calendar/src/locale/hr_HR.js
new file mode 100644
index 000000000..670c6cb02
--- /dev/null
+++ b/components/vc-calendar/src/locale/hr_HR.js
@@ -0,0 +1,28 @@
+export default {
+ today: 'Danas',
+ now: 'Sad',
+ backToToday: 'Natrag na danas',
+ ok: 'Ok',
+ clear: 'Očisti',
+ month: 'Mjesec',
+ year: 'Godina',
+ timeSelect: 'odaberite vrijeme',
+ dateSelect: 'odaberite datum',
+ weekSelect: 'Odaberite tjedan',
+ monthSelect: 'Odaberite mjesec',
+ yearSelect: 'Odaberite godinu',
+ decadeSelect: 'Odaberite desetljeće',
+ yearFormat: 'YYYY',
+ dateFormat: 'D.M.YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'D.M.YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'Prošli mjesec (PageUp)',
+ nextMonth: 'Sljedeći mjesec (PageDown)',
+ previousYear: 'Prošla godina (Control + left)',
+ nextYear: 'Sljedeća godina (Control + right)',
+ previousDecade: 'Prošlo desetljeće',
+ nextDecade: 'Sljedeće desetljeće',
+ previousCentury: 'Prošlo stoljeće',
+ nextCentury: 'Sljedeće stoljeće',
+};
diff --git a/components/vc-calendar/src/locale/id_ID.js b/components/vc-calendar/src/locale/id_ID.js
index 2004bfcdd..1c9df774f 100644
--- a/components/vc-calendar/src/locale/id_ID.js
+++ b/components/vc-calendar/src/locale/id_ID.js
@@ -13,14 +13,14 @@ export default {
yearSelect: 'Pilih satu tahun',
decadeSelect: 'Pilih satu dekade',
yearFormat: 'YYYY',
- dateFormat: 'M/D/YYYY',
+ dateFormat: 'D/M/YYYY',
dayFormat: 'D',
- dateTimeFormat: 'M/D/YYYY HH:mm:ss',
+ dateTimeFormat: 'D/M/YYYY HH:mm:ss',
monthBeforeYear: true,
previousMonth: 'Bulan sebelumnya (PageUp)',
- nextMonth: 'Bulan depan (PageDown)',
+ nextMonth: 'Bulan selanjutnya (PageDown)',
previousYear: 'Tahun lalu (Control + kiri)',
- nextYear: 'Tahun depan (Kontrol + kanan)',
+ nextYear: 'Tahun selanjutnya (Kontrol + kanan)',
previousDecade: 'Dekade terakhir',
nextDecade: 'Dekade berikutnya',
previousCentury: 'Abad terakhir',
diff --git a/components/vc-calendar/src/locale/lv_LV.js b/components/vc-calendar/src/locale/lv_LV.js
new file mode 100644
index 000000000..f06ffcd4f
--- /dev/null
+++ b/components/vc-calendar/src/locale/lv_LV.js
@@ -0,0 +1,27 @@
+export default {
+ today: 'Šodien',
+ now: 'Tagad',
+ backToToday: 'Atpakaļ pie šodienas',
+ ok: 'Ok',
+ clear: 'Skaidrs',
+ month: 'Mēnesis',
+ year: 'Gads',
+ timeSelect: 'Izvēlieties laiku',
+ dateSelect: 'Izvēlieties datumu',
+ monthSelect: 'Izvēlieties mēnesi',
+ yearSelect: 'Izvēlieties gadu',
+ decadeSelect: 'Izvēlieties desmit gadus',
+ yearFormat: 'YYYY',
+ dateFormat: 'D.M.YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'D.M.YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'Iepriekšējais mēnesis (PageUp)',
+ nextMonth: 'Nākammēnes (PageDown)',
+ previousYear: 'Pagājušais gads (Control + left)',
+ nextYear: 'Nākamgad (Control + right)',
+ previousDecade: 'Pēdējā desmitgadē',
+ nextDecade: 'Nākamā desmitgade',
+ previousCentury: 'Pagājušajā gadsimtā',
+ nextCentury: 'Nākamajā gadsimtā',
+};
diff --git a/components/vc-calendar/src/locale/mk_MK.js b/components/vc-calendar/src/locale/mk_MK.js
new file mode 100644
index 000000000..91d9188a8
--- /dev/null
+++ b/components/vc-calendar/src/locale/mk_MK.js
@@ -0,0 +1,27 @@
+export default {
+ today: 'Денес',
+ now: 'Сега',
+ backToToday: 'Назад до денес',
+ ok: 'ОК',
+ clear: 'Избриши',
+ month: 'Месец',
+ year: 'Година',
+ timeSelect: 'Избери време',
+ dateSelect: 'Избери датум',
+ monthSelect: 'Избери месец',
+ yearSelect: 'Избери година',
+ decadeSelect: 'Избери деценија',
+ yearFormat: 'YYYY',
+ dateFormat: 'D.M.YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'D.M.YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'Претходен месец (PageUp)',
+ nextMonth: 'Нареден месец (PageDown)',
+ previousYear: 'Претходна година (Control + left)',
+ nextYear: 'Наредна година (Control + right)',
+ previousDecade: 'Претходна деценија',
+ nextDecade: 'Наредна деценија',
+ previousCentury: 'Претходен век',
+ nextCentury: 'Нареден век',
+};
diff --git a/components/vc-calendar/src/locale/ms_MY.js b/components/vc-calendar/src/locale/ms_MY.js
new file mode 100644
index 000000000..a721e3e4c
--- /dev/null
+++ b/components/vc-calendar/src/locale/ms_MY.js
@@ -0,0 +1,27 @@
+export default {
+ today: 'Hari ini',
+ now: 'Sekarang',
+ backToToday: 'Kembali ke hari ini',
+ ok: 'Ok',
+ timeSelect: 'Pilih masa',
+ dateSelect: 'Pilih tarikh',
+ weekSelect: 'Pilih minggu',
+ clear: 'Padam',
+ month: 'Bulan',
+ year: 'Tahun',
+ previousMonth: 'Bulan lepas',
+ nextMonth: 'Bulan depan',
+ monthSelect: 'Pilih bulan',
+ yearSelect: 'Pilih tahun',
+ decadeSelect: 'Pilih dekad',
+ yearFormat: 'YYYY',
+ dayFormat: 'D',
+ dateFormat: 'M/D/YYYY',
+ dateTimeFormat: 'M/D/YYYY HH:mm:ss',
+ previousYear: 'Tahun lepas (Ctrl+left)',
+ nextYear: 'Tahun depan (Ctrl+right)',
+ previousDecade: 'Dekad lepas',
+ nextDecade: 'Dekad depan',
+ previousCentury: 'Abad lepas',
+ nextCentury: 'Abad depan',
+};
diff --git a/components/vc-calendar/src/locale/ro_RO.js b/components/vc-calendar/src/locale/ro_RO.js
new file mode 100644
index 000000000..d69416804
--- /dev/null
+++ b/components/vc-calendar/src/locale/ro_RO.js
@@ -0,0 +1,28 @@
+export default {
+ today: 'Azi',
+ now: 'Acum',
+ backToToday: 'Înapoi la azi',
+ ok: 'Ok',
+ clear: 'Șterge',
+ month: 'Lună',
+ year: 'An',
+ timeSelect: 'selectează timpul',
+ dateSelect: 'selectează data',
+ weekSelect: 'Alege o săptămână',
+ monthSelect: 'Alege o lună',
+ yearSelect: 'Alege un an',
+ decadeSelect: 'Alege un deceniu',
+ yearFormat: 'YYYY',
+ dateFormat: 'D/M/YYYY',
+ dayFormat: 'D',
+ dateTimeFormat: 'D/M/YYYY HH:mm:ss',
+ monthBeforeYear: true,
+ previousMonth: 'Luna anterioară (PageUp)',
+ nextMonth: 'Luna următoare (PageDown)',
+ previousYear: 'Anul anterior (Control + stânga)',
+ nextYear: 'Anul următor (Control + dreapta)',
+ previousDecade: 'Deceniul anterior',
+ nextDecade: 'Deceniul următor',
+ previousCentury: 'Secolul anterior',
+ nextCentury: 'Secolul următor',
+};
diff --git a/components/vc-calendar/src/locale/sk_SK.js b/components/vc-calendar/src/locale/sk_SK.js
index fadd50b49..a543172ce 100644
--- a/components/vc-calendar/src/locale/sk_SK.js
+++ b/components/vc-calendar/src/locale/sk_SK.js
@@ -8,6 +8,7 @@ export default {
year: 'Rok',
timeSelect: 'Vybrať čas',
dateSelect: 'Vybrať dátum',
+ weekSelect: 'Vybrať týždeň',
monthSelect: 'Vybrať mesiac',
yearSelect: 'Vybrať rok',
decadeSelect: 'Vybrať dekádu',
diff --git a/components/vc-calendar/src/locale/ta_IN.js b/components/vc-calendar/src/locale/ta_IN.js
new file mode 100644
index 000000000..20ac8316b
--- /dev/null
+++ b/components/vc-calendar/src/locale/ta_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: 'முந்தைய மாதம் (PageUp)',
+ nextMonth: 'அடுத்த மாதம் (PageDown)',
+ previousYear: 'முந்தைய வருடம் (Control + left)',
+ nextYear: 'அடுத்த வருடம் (Control + right)',
+ previousDecade: 'முந்தைய தசாப்தம்',
+ nextDecade: 'அடுத்த தசாப்தம்',
+ previousCentury: 'முந்தைய நூற்றாண்டு',
+ nextCentury: 'அடுத்த நூற்றாண்டு',
+};
diff --git a/components/vc-calendar/src/mixin/CalendarMixin.js b/components/vc-calendar/src/mixin/CalendarMixin.js
index cb6a388c9..d1f53640f 100644
--- a/components/vc-calendar/src/mixin/CalendarMixin.js
+++ b/components/vc-calendar/src/mixin/CalendarMixin.js
@@ -72,7 +72,13 @@ const CalendarMixin = {
[newProps.class]: !!newProps.class,
};
return (
-
+
{newProps.children}
);
diff --git a/components/vc-calendar/src/mixin/CommonMixin.js b/components/vc-calendar/src/mixin/CommonMixin.js
index 14d34c5dc..5216c3a81 100644
--- a/components/vc-calendar/src/mixin/CommonMixin.js
+++ b/components/vc-calendar/src/mixin/CommonMixin.js
@@ -1,22 +1,4 @@
export default {
- // getDefaultProps () {
- // return {
- // locale: enUs,
- // visible: true,
- // prefixCls: 'rc-calendar',
-
- // renderFooter () {
- // return null
- // },
- // renderSidebar () {
- // return null
- // },
- // }
- // },
-
- // shouldComponentUpdate (nextProps) {
- // return this.props.visible || nextProps.visible
- // },
methods: {
getFormat() {
let { format } = this;
diff --git a/components/vc-calendar/src/range-calendar/CalendarPart.jsx b/components/vc-calendar/src/range-calendar/CalendarPart.jsx
index 7ff0d8b3a..7ca6349cc 100644
--- a/components/vc-calendar/src/range-calendar/CalendarPart.jsx
+++ b/components/vc-calendar/src/range-calendar/CalendarPart.jsx
@@ -30,8 +30,9 @@ const CalendarPart = {
timePickerDisabledTime: PropTypes.object,
enableNext: PropTypes.any,
enablePrev: PropTypes.any,
- dateRender: PropTypes.func,
clearIcon: PropTypes.any,
+ dateRender: PropTypes.func,
+ inputMode: PropTypes.string,
},
render() {
const { $props: props } = this;
@@ -56,6 +57,8 @@ const CalendarPart = {
showDateInput,
dateRender,
showWeekNumber,
+ showClear,
+ inputMode,
} = props;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const {
@@ -107,12 +110,13 @@ const CalendarPart = {
placeholder={placeholder}
disabledTime={disabledTime}
value={value}
- showClear={false}
+ showClear={showClear || false}
selectedValue={selectedValue[index]}
onChange={inputSelect}
onChange={inputChange}
onSelect={inputSelect}
clearIcon={clearIcon}
+ inputMode={inputMode}
/>
);
const headerProps = {
diff --git a/components/vc-calendar/src/util/index.js b/components/vc-calendar/src/util/index.js
index 260f3ba86..59665f68f 100644
--- a/components/vc-calendar/src/util/index.js
+++ b/components/vc-calendar/src/util/index.js
@@ -38,6 +38,7 @@ export function syncTime(from, to) {
to.hour(from.hour());
to.minute(from.minute());
to.second(from.second());
+ to.millisecond(from.millisecond());
}
export function getTimeConfig(value, disabledTime) {