diff --git a/components/cascader/demo/search.md b/components/cascader/demo/search.md index d84e879ad..e0f35d0c6 100644 --- a/components/cascader/demo/search.md +++ b/components/cascader/demo/search.md @@ -13,7 +13,7 @@ Search and select options directly. ```html diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index 680ed92e3..526e03362 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -4,7 +4,7 @@ import RangeCalendar from '../vc-calendar/src/RangeCalendar' import VcDatePicker from '../vc-calendar/src/Picker' import classNames from 'classnames' import Icon from '../icon' -import callMoment from '../_util/callMoment' +import interopDefault from '../_util/interopDefault' import { RangePickerProps } from './interface' import { hasProp, getOptionProps, initDefaultProps, mergeProps } from '../_util/props-util' import BaseMixin from '../_util/BaseMixin' @@ -67,8 +67,8 @@ export default { data () { const value = this.value || this.defaultValue || [] if ( - value[0] && !moment.isMoment(value[0]) || - value[1] && !moment.isMoment(value[1]) + value[0] && !interopDefault(moment).isMoment(value[0]) || + value[1] && !interopDefault(moment).isMoment(value[1]) ) { throw new Error( 'The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' + @@ -78,7 +78,7 @@ export default { const pickerValue = !value || isEmptyArray(value) ? this.defaultPickerValue : value return { sValue: value, - sShowDate: pickerValueAdapter(pickerValue || callMoment(moment)), + sShowDate: pickerValueAdapter(pickerValue || interopDefault(moment)()), sOpen: this.open, sHoverValue: [], } diff --git a/components/date-picker/WeekPicker.jsx b/components/date-picker/WeekPicker.jsx index 2718bd364..92e697e27 100644 --- a/components/date-picker/WeekPicker.jsx +++ b/components/date-picker/WeekPicker.jsx @@ -5,7 +5,8 @@ import VcDatePicker from '../vc-calendar/src/Picker' import Icon from '../icon' import { hasProp, getOptionProps, initDefaultProps } from '../_util/props-util' import BaseMixin from '../_util/BaseMixin' -import { WeexPickerProps } from './interface' +import { WeekPickerProps } from './interface' +import interopDefault from '../_util/interopDefault' function formatValue (value, format) { return (value && value.format(format)) || '' @@ -19,15 +20,15 @@ export default { // }; // private input: any; - props: initDefaultProps(WeexPickerProps(), { - format: 'YYYY-wo', + props: initDefaultProps(WeekPickerProps(), { + format: 'gggg-wo', allowClear: true, }), name: 'WeekPicker', mixins: [BaseMixin], data () { const value = this.value || this.defaultValue - if (value && !moment.isMoment(value)) { + if (value && !interopDefault(moment).isMoment(value)) { throw new Error( 'The value/defaultValue of DatePicker or MonthPicker must be ' + 'a moment object', diff --git a/components/date-picker/createPicker.js b/components/date-picker/createPicker.js index aaa348741..7fe349e74 100644 --- a/components/date-picker/createPicker.js +++ b/components/date-picker/createPicker.js @@ -4,7 +4,7 @@ import MonthCalendar from '../vc-calendar/src/MonthCalendar' import VcDatePicker from '../vc-calendar/src/Picker' import classNames from 'classnames' import Icon from '../icon' -import callMoment from '../_util/callMoment' +import interopDefault from '../_util/interopDefault' import BaseMixin from '../_util/BaseMixin' import { hasProp, getOptionProps, initDefaultProps, mergeProps } from '../_util/props-util' @@ -30,7 +30,7 @@ export default function createPicker (TheCalendar, props) { mixins: [BaseMixin], data () { const value = this.value || this.defaultValue - if (value && !moment.isMoment(value)) { + if (value && !interopDefault(moment).isMoment(value)) { throw new Error( 'The value/defaultValue of DatePicker or MonthPicker must be ' + 'a moment object', @@ -127,7 +127,7 @@ export default function createPicker (TheCalendar, props) { disabledTime, locale: locale.lang, timePicker: props.timePicker, - defaultValue: props.defaultPickerValue || callMoment(moment), + defaultValue: props.defaultPickerValue || interopDefault(moment)(), dateInputPlaceholder: placeholder, prefixCls, dateRender, diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index daadcc497..6bfa577b4 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -36,6 +36,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | open | open state of picker | boolean | - | | placeholder | placeholder of date input | string\|RangePicker\[] | - | | popupStyle | to customize the style of the popup calendar | object | {} | +| dropdownClassName | to customize the className of the popup calendar | string | - | | size | determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | string | - | ### Common Events diff --git a/components/date-picker/index.js b/components/date-picker/index.js index f6bbfd5a2..d1193aa38 100755 --- a/components/date-picker/index.js +++ b/components/date-picker/index.js @@ -4,7 +4,7 @@ import createPicker from './createPicker' import wrapPicker from './wrapPicker' import RangePicker from './RangePicker' import WeekPicker from './WeekPicker' -import { DatePickerProps, MonthPickerProps, WeexPickerProps, RangePickerProps } from './interface' +import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './interface' const DatePicker = wrapPicker(createPicker(VcCalendar, DatePickerProps()), DatePickerProps()) @@ -13,7 +13,7 @@ const MonthPicker = wrapPicker(createPicker(MonthCalendar, MonthPickerProps()), Object.assign(DatePicker, { RangePicker: wrapPicker(RangePicker, RangePickerProps()), MonthPicker, - WeekPicker: wrapPicker(WeekPicker, WeexPickerProps(), 'YYYY-wo'), + WeekPicker: wrapPicker(WeekPicker, WeekPickerProps(), 'gggg-wo'), }) export default DatePicker diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index cdc588c4e..2b9da7f98 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -35,7 +35,8 @@ | locale | 国际化配置 | object | [默认配置](https://github.com/vueComponent/ant-design/blob/master/components/date-picker/locale/example.json) | | open | 控制弹层是否展开 | boolean | - | | placeholder | 输入框提示文字 | string\|RangePicker\[] | - | -| popupStyle | 格外的弹出日历样式 | object | {} | +| popupStyle | 额外的弹出日历样式 | object | {} | +| dropdownClassName | 额外的弹出日历 className | string | - | | size | 输入框大小,`large` 高度为 40px,`small` 为 24px,默认是 32px | string | 无 | ### 共有的事件 diff --git a/components/date-picker/interface.js b/components/date-picker/interface.js index 1d1e0afe7..eb82bb2ce 100644 --- a/components/date-picker/interface.js +++ b/components/date-picker/interface.js @@ -17,6 +17,7 @@ export const PickerProps = () => ({ disabled: PropTypes.bool, allowClear: PropTypes.bool, popupStyle: PropTypes.object, + dropdownClassName: PropTypes.string, locale: PropTypes.any, localeCode: PropTypes.string, size: PropTypes.oneOf(['large', 'small', 'default']), @@ -81,7 +82,7 @@ export const RangePickerProps = () => ({ // onPanelChange?: (value?: RangePickerValue, mode?: string | string[]) => void; }) -export const WeexPickerProps = () => ({ +export const WeekPickerProps = () => ({ ...PickerProps(), ...SinglePickerProps(), placeholder: PropTypes.string, }) diff --git a/components/date-picker/locale/sl_SI.js b/components/date-picker/locale/sl_SI.js new file mode 100644 index 000000000..e9b9d50e8 --- /dev/null +++ b/components/date-picker/locale/sl_SI.js @@ -0,0 +1,43 @@ +import TimePickerLocale from '../../time-picker/locale/sl_SI' + +// Merge into a locale object +const locale = { + lang: { + placeholder: 'Izberite datum', + rangePlaceholder: ['Začetni datum', 'Končni datum'], + today: 'Danes', + now: 'Trenutno', + backToToday: 'Nazaj na trenutni datum', + ok: 'Ok', + clear: 'Počisti', + month: 'Mesec', + year: 'Leto', + timeSelect: 'Izberi čas', + dateSelect: 'Izberi datum', + monthSelect: 'Izberite mesec', + yearSelect: 'Izberite leto', + decadeSelect: 'Izberite desetletje', + yearFormat: 'YYYY', + dateFormat: 'D.M.YYYY', + dayFormat: 'D', + dateTimeFormat: 'D.M.YYYY HH:mm:ss', + monthFormat: 'MMMM', + monthBeforeYear: true, + previousMonth: 'Prejšnji mesec (PageUp)', + nextMonth: 'Naslednji mesec (PageDown)', + previousYear: 'Lansko leto (Control + left)', + nextYear: 'Naslednje leto (Control + right)', + previousDecade: 'Prejšnje desetletje', + nextDecade: 'Naslednje desetletje', + previousCentury: 'Zadnje stoletje', + nextCentury: 'Naslednje stoletje', + }, + timePickerLocale: { + ...TimePickerLocale, + }, +} + +// All settings at: +// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json + +export default locale diff --git a/components/divider/demo/index.vue b/components/divider/demo/index.vue index a497f3fc1..7a0d89995 100644 --- a/components/divider/demo/index.vue +++ b/components/divider/demo/index.vue @@ -1,6 +1,7 @@