diff --git a/components/_util/BaseMixin.js b/components/_util/BaseMixin.js index 01a701e44..52d853735 100644 --- a/components/_util/BaseMixin.js +++ b/components/_util/BaseMixin.js @@ -16,9 +16,7 @@ export default { } else { this.$listeners[eventName](...args.slice(1)) } - return true } - return false }, }, } diff --git a/components/_util/props-util.js b/components/_util/props-util.js index a453b943d..956dea91a 100644 --- a/components/_util/props-util.js +++ b/components/_util/props-util.js @@ -52,7 +52,7 @@ const getOptionProps = (instance) => { const res = {} for (const [k, v] of Object.entries(props)) { if (v.default !== undefined) { - res[k] = v + res[k] = typeof v.default === 'function' ? v.default() : v.default } } return { ...res, ...propsData } @@ -179,6 +179,18 @@ const initDefaultProps = (propTypes, defaultProps) => { Object.keys(defaultProps).forEach(k => { propTypes[k] = propTypes[k].def(defaultProps[k]) }) return propTypes } + +export function mergeProps () { + const args = [].slice.call(arguments, 0) + const props = {} + args.forEach((p, i) => { + for (const [k, v] of Object.entries(p)) { + props[k] = props[k] || {} + Object.assign(props[k], v) + } + }) + return props +} export { hasProp, filterProps, diff --git a/components/_util/vnode.js b/components/_util/vnode.js index 59eb2b221..4f7e91e0c 100644 --- a/components/_util/vnode.js +++ b/components/_util/vnode.js @@ -70,6 +70,7 @@ export function cloneElement (n, nodeProps, deep) { domProps = {}, style: tempStyle = {}, class: tempCls = {}, + scopedSlots = {}, } = nodeProps if (typeof data.style === 'string') { @@ -99,6 +100,7 @@ export function cloneElement (n, nodeProps, deep) { attrs: { ...data.attrs, ...attrs }, class: cls, domProps: { ...data.domProps, ...domProps }, + scopedSlots: { ...data.scopedSlots, ...scopedSlots }, }) if (node.componentOptions) { diff --git a/components/pagination/index.en-US.md b/components/pagination/index.en-US.md index fba0a3e38..948bffec5 100644 --- a/components/pagination/index.en-US.md +++ b/components/pagination/index.en-US.md @@ -1,7 +1,7 @@ ## API ```html - + ``` | Property | Description | Type | Default | @@ -11,7 +11,7 @@ | defaultPageSize | default number of data items per page | number | 10 | | hideOnSinglePage | Whether to hide pager on single page | boolean | false | | itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => vNode | - | -| pageSize | number of data items per page | number | - | +| pageSize(.sync) | number of data items per page | number | - | | pageSizeOptions | specify the sizeChanger options | string\[] | ['10', '20', '30', '40'] | | showQuickJumper | determine whether you can jump to pages directly | boolean | false | | showSizeChanger | determine whether `pageSize` can be changed | boolean | false | diff --git a/components/pagination/index.zh-CN.md b/components/pagination/index.zh-CN.md index fa0dbf77a..b24d34b04 100644 --- a/components/pagination/index.zh-CN.md +++ b/components/pagination/index.zh-CN.md @@ -1,7 +1,7 @@ ## API ```html - + ``` | 参数 | 说明 | 类型 | 默认值 | @@ -11,7 +11,7 @@ | defaultPageSize | 默认的每页条数 | number | 10 | | hideOnSinglePage | 只有一页时是否隐藏分页器 | boolean | false | | itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => vNode | - | -| pageSize | 每页条数 | number | - | +| pageSize(.sync) | 每页条数 | number | - | | pageSizeOptions | 指定每页可以显示多少条 | string\[] | ['10', '20', '30', '40'] | | showQuickJumper | 是否可以快速跳转至某页 | boolean | false | | showSizeChanger | 是否可以改变 pageSize | boolean | false | diff --git a/components/steps/demo/customized-progress-dot.md b/components/steps/demo/customized-progress-dot.md index 57466d2a1..ee535b3c0 100644 --- a/components/steps/demo/customized-progress-dot.md +++ b/components/steps/demo/customized-progress-dot.md @@ -10,30 +10,19 @@ You can customize the display for Steps with progress dot style. ```html - ``` diff --git a/components/steps/index.en-US.md b/components/steps/index.en-US.md index 0448b8afe..2209b5f3c 100644 --- a/components/steps/index.en-US.md +++ b/components/steps/index.en-US.md @@ -6,7 +6,7 @@ The whole of the step bar. | -------- | ----------- | ---- | ------- | | current | to set the current step, counting from 0. You can overwrite this state by using `status` of `Step` | number | 0 | | direction | to specify the direction of the step bar, `horizontal` and `vertical` are currently supported | string | `horizontal` | -| progressDot | Steps with progress dot style, customize the progress dot by setting it to a function | Boolean or (iconDot, {index, status, title, description}) => vNode | false | +| progressDot | Steps with progress dot style, customize the progress dot by setting a scoped slot | Boolean or slot="progressDot" slot-scope="{index, status, title, description, prefixCls})" | false | | size | to specify the size of the step bar, `default` and `small` are currently supported | string | `default` | | status | to specify the status of current step, can be set to one of the following values: `wait` `process` `finish` `error` | string | `process` | diff --git a/components/steps/index.vue b/components/steps/index.vue index 34a9ea2ce..acf8a2d15 100644 --- a/components/steps/index.vue +++ b/components/steps/index.vue @@ -32,6 +32,7 @@ export default { const stepsProps = { props, on: this.$listeners, + scopedSlots: this.$scopedSlots, } return ( vNode | false | +| progressDot | 点状步骤条,可以设置为一个 作用域插槽 | Boolean or slot="progressDot" slot-scope="{index, status, title, description, prefixCls})" | false | | size | 指定大小,目前支持普通(`default`)和迷你(`small`) | string | default | | status | 指定当前步骤的状态,可选 `wait` `process` `finish` `error` | string | process | diff --git a/components/tabs/src/Tabs.vue b/components/tabs/src/Tabs.vue index 93605e62b..b7a30e7e3 100644 --- a/components/tabs/src/Tabs.vue +++ b/components/tabs/src/Tabs.vue @@ -1,4 +1,5 @@ diff --git a/components/vc-calendar/demo/antd-month-calendar.vue b/components/vc-calendar/demo/antd-month-calendar.vue new file mode 100644 index 000000000..9a3f3f6d6 --- /dev/null +++ b/components/vc-calendar/demo/antd-month-calendar.vue @@ -0,0 +1,160 @@ + diff --git a/components/vc-calendar/demo/antd-range-calendar.vue b/components/vc-calendar/demo/antd-range-calendar.vue new file mode 100644 index 000000000..1f120fd19 --- /dev/null +++ b/components/vc-calendar/demo/antd-range-calendar.vue @@ -0,0 +1,204 @@ + diff --git a/components/vc-calendar/demo/full-calendar.vue b/components/vc-calendar/demo/full-calendar.vue new file mode 100644 index 000000000..a1aca551f --- /dev/null +++ b/components/vc-calendar/demo/full-calendar.vue @@ -0,0 +1,76 @@ + \ No newline at end of file diff --git a/components/vc-calendar/src/Calendar.vue b/components/vc-calendar/src/Calendar.vue index 78a32eaba..7490282da 100644 --- a/components/vc-calendar/src/Calendar.vue +++ b/components/vc-calendar/src/Calendar.vue @@ -10,8 +10,8 @@ import CalendarFooter from './calendar/CalendarFooter' import CalendarMixin 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' - function goStartMonth () { const next = this.sValue.clone() next.startOf('month') @@ -48,12 +48,15 @@ function goDay (direction) { const Calendar = { props: { - prefixCls: PropTypes.string, + locale: PropTypes.object.def(enUs), + visible: PropTypes.bool.def(true), + prefixCls: PropTypes.string.def('rc-calendar'), + // prefixCls: PropTypes.string, defaultValue: PropTypes.object, value: PropTypes.object, selectedValue: PropTypes.object, mode: PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade']), - locale: PropTypes.object, + // locale: PropTypes.object, showDateInput: PropTypes.bool.def(true), showWeekNumber: PropTypes.bool, showToday: PropTypes.bool.def(true), @@ -68,8 +71,8 @@ const Calendar = { // onPanelChange: PropTypes.func, disabledDate: PropTypes.func, disabledTime: PropTypes.any, - renderFooter: PropTypes.func, - renderSidebar: PropTypes.func, + renderFooter: PropTypes.func.def(() => null), + renderSidebar: PropTypes.func.def(() => null), }, mixins: [BaseMixin, CommonMixin, CalendarMixin], @@ -168,7 +171,8 @@ const Calendar = { onDateTableSelect (value) { const { timePicker, sSelectedValue } = this if (!sSelectedValue && timePicker) { - const timePickerDefaultValue = timePicker.props.defaultValue + const timePickerProps = getOptionProps(timePicker) + const timePickerDefaultValue = timePickerProps.defaultValue if (timePickerDefaultValue) { syncTime(timePickerDefaultValue, value) } @@ -215,6 +219,7 @@ const Calendar = { let timePickerEle = null if (timePicker && showTimePicker) { + console.log(timePicker) const timePickerOriginProps = getOptionProps(timePicker) const timePickerProps = { props: { @@ -234,7 +239,7 @@ const Calendar = { if (timePickerOriginProps.defaultValue !== undefined) { timePickerProps.props.defaultOpenValue = timePickerOriginProps.defaultValue } - + console.log(timePickerProps) timePickerEle = cloneElement(timePicker, timePickerProps) } @@ -320,4 +325,4 @@ const Calendar = { } export default Calendar - \ No newline at end of file + diff --git a/components/vc-calendar/src/FullCalendar.vue b/components/vc-calendar/src/FullCalendar.vue index 5fea18842..8215cf28e 100644 --- a/components/vc-calendar/src/FullCalendar.vue +++ b/components/vc-calendar/src/FullCalendar.vue @@ -7,24 +7,28 @@ import MonthTable from './month/MonthTable' import CalendarMixin from './mixin/CalendarMixin' import CommonMixin from './mixin/CommonMixin' import CalendarHeader from './full-calendar/CalendarHeader' - +import enUs from './locale/en_US' const FullCalendar = { props: { + locale: PropTypes.object.def(enUs), + visible: PropTypes.bool.def(true), + prefixCls: PropTypes.string.def('rc-calendar'), defaultType: PropTypes.string.def('date'), type: PropTypes.string, - prefixCls: PropTypes.string, - locale: PropTypes.object, + // locale: PropTypes.object, // onTypeChange: PropTypes.func, fullscreen: PropTypes.bool.def(false), monthCellRender: PropTypes.func, dateCellRender: PropTypes.func, showTypeSwitch: PropTypes.bool.def(true), - Select: PropTypes.func.isRequired, + Select: PropTypes.object.isRequired, headerComponents: PropTypes.array, headerComponent: PropTypes.object, // The whole header component headerRender: PropTypes.func, showHeader: PropTypes.bool.def(true), disabledDate: PropTypes.func, + renderFooter: PropTypes.func.def(() => null), + renderSidebar: PropTypes.func.def(() => null), }, mixins: [BaseMixin, CommonMixin, CalendarMixin], data () { @@ -72,7 +76,7 @@ const FullCalendar = { headerRender, disabledDate, } = props - const { sValue: value, sType: type } = this + const { sValue: value, sType: type, $listeners } = this let header = null if (showHeader) { @@ -88,6 +92,7 @@ const FullCalendar = { value, }, on: { + ...$listeners, typeChange: this.setType, valueChange: this.setValue, }, diff --git a/components/vc-calendar/src/MonthCalendar.vue b/components/vc-calendar/src/MonthCalendar.vue index 59fea5c6a..6d6c12894 100644 --- a/components/vc-calendar/src/MonthCalendar.vue +++ b/components/vc-calendar/src/MonthCalendar.vue @@ -6,11 +6,18 @@ import CalendarHeader from './calendar/CalendarHeader' import CalendarFooter from './calendar/CalendarFooter' import CalendarMixin from './mixin/CalendarMixin' import CommonMixin from './mixin/CommonMixin' - +import enUs from './locale/en_US' const MonthCalendar = { props: { + locale: PropTypes.object.def(enUs), + visible: PropTypes.bool.def(true), + prefixCls: PropTypes.string.def('rc-calendar'), monthCellRender: PropTypes.func, dateCellRender: PropTypes.func, + disabledDate: PropTypes.func, + monthCellContentRender: PropTypes.func, + renderFooter: PropTypes.func.def(() => null), + renderSidebar: PropTypes.func.def(() => null), }, mixins: [BaseMixin, CommonMixin, CalendarMixin], @@ -74,25 +81,26 @@ const MonthCalendar = { render () { const { mode, sValue: value, $props: props } = this + const { prefixCls, locale, disabledDate, monthCellRender, monthCellContentRender, renderFooter } = props const children = ( -
-
+
+
) diff --git a/components/vc-calendar/src/Picker.vue b/components/vc-calendar/src/Picker.vue index d9be4eca4..afa4bd1da 100644 --- a/components/vc-calendar/src/Picker.vue +++ b/components/vc-calendar/src/Picker.vue @@ -78,7 +78,7 @@ const Picker = { onCalendarKeyDown (event) { if (event.keyCode === KeyCode.ESC) { event.stopPropagation() - this.close(this.focus) + this.closeCalendar(this.focus) } }, @@ -94,7 +94,7 @@ const Picker = { cause.source === 'keyboard' || (!calendarProps.timePicker && cause.source !== 'dateInput') || cause.source === 'todayButton') { - this.close(this.focus) + this.closeCalendar(this.focus) } this.__emit('change', value) }, @@ -107,11 +107,11 @@ const Picker = { }, onCalendarOk () { - this.close(this.focus) + this.closeCalendar(this.focus) }, onCalendarClear () { - this.close(this.focus) + this.closeCalendar(this.focus) }, onVisibleChange (open) { @@ -153,11 +153,11 @@ const Picker = { } }, - open (callback) { + openCalendar (callback) { this.setOpen(true, callback) }, - close (callback) { + closeCalendar (callback) { this.setOpen(false, callback) }, @@ -183,20 +183,25 @@ const Picker = { align, animation, disabled, dropdownClassName, - transitionName, children, + transitionName, } = props - const state = this.$data + const { sValue, sOpen } = this + const children = this.$scopedSlots.default + const childrenState = { + value: sValue, + open: sOpen, + } return ( {this.getCalendarElement()} - {cloneElement(children(state, props), { on: { keydown: this.onKeyDown }})} + {cloneElement(children(childrenState, props), { on: { keydown: this.onKeyDown }})} ) }, } diff --git a/components/vc-calendar/src/RangeCalendar.vue b/components/vc-calendar/src/RangeCalendar.vue index b2112a3de..979dd683b 100644 --- a/components/vc-calendar/src/RangeCalendar.vue +++ b/components/vc-calendar/src/RangeCalendar.vue @@ -1,15 +1,14 @@ diff --git a/components/vc-calendar/src/calendar/CalendarFooter.vue b/components/vc-calendar/src/calendar/CalendarFooter.vue index 27ca42d8a..dcf7cdb81 100644 --- a/components/vc-calendar/src/calendar/CalendarFooter.vue +++ b/components/vc-calendar/src/calendar/CalendarFooter.vue @@ -2,9 +2,9 @@ import PropTypes from '@/components/_util/vue-types' import BaseMixin from '@/components/_util/BaseMixin' import { getOptionProps } from '@/components/_util/props-util' -import TodayButton from '../calendar/TodayButton' -import OkButton from '../calendar/OkButton' -import TimePickerButton from '../calendar/TimePickerButton' +import TodayButton from './TodayButton' +import OkButton from './OkButton' +import TimePickerButton from './TimePickerButton' const CalendarFooter = { mixins: [BaseMixin], @@ -19,6 +19,11 @@ const CalendarFooter = { value: PropTypes.object, renderFooter: PropTypes.func, defaultValue: PropTypes.object, + locale: PropTypes.object, + showToday: PropTypes.bool, + disabledDate: PropTypes.func, + showTimePicker: PropTypes.bool, + okDisabled: PropTypes.bool, }, methods: { onSelect (value) { @@ -44,16 +49,16 @@ const CalendarFooter = { }, on: $listeners, } - let nowEl + let nowEl = null if (showToday) { nowEl = } delete btnProps.props.value - let okBtn + let okBtn = null if (showOk === true || showOk !== false && !!timePicker) { okBtn = } - let timePickerBtn + let timePickerBtn = null if (timePicker) { timePickerBtn = } @@ -61,12 +66,12 @@ const CalendarFooter = { let footerBtn if (nowEl || timePickerBtn || okBtn) { footerBtn = ( - {[nowEl, timePickerBtn, okBtn]} + {nowEl}{timePickerBtn}{okBtn} ) } const cls = { [`${prefixCls}-footer`]: true, - [`${prefixCls}-footer-show-ok`]: okBtn, + [`${prefixCls}-footer-show-ok`]: !!okBtn, } footerEl = (
diff --git a/components/vc-calendar/src/calendar/CalendarHeader.vue b/components/vc-calendar/src/calendar/CalendarHeader.vue index d7915b08f..23fb1e863 100644 --- a/components/vc-calendar/src/calendar/CalendarHeader.vue +++ b/components/vc-calendar/src/calendar/CalendarHeader.vue @@ -5,7 +5,7 @@ import { getOptionProps } from '@/components/_util/props-util' import MonthPanel from '../month/MonthPanel' import YearPanel from '../year/YearPanel' import DecadePanel from '../decade/DecadePanel' - +function noop () {} function goMonth (direction) { const next = this.value.clone() next.add(direction, 'months') @@ -34,6 +34,7 @@ const CalendarHeader = { enablePrev: PropTypes.any.def(1), enableNext: PropTypes.any.def(1), disabledMonth: PropTypes.func, + mode: PropTypes.any, }, data () { this.nextMonth = goMonth.bind(this, 1) @@ -47,7 +48,9 @@ const CalendarHeader = { methods: { onMonthSelect (value) { this.__emit('panelChange', value, 'date') - if (this.__emit('monthSelect', value)) { + if (this.$listeners.monthSelect) { + this.__emit('monthSelect', value) + } else { this.__emit('valueChange', value) } }, @@ -75,7 +78,7 @@ const CalendarHeader = { const year = ( this.showYearPanel('date')} + onClick={showTimePicker ? noop : () => this.showYearPanel('date')} title={locale.yearSelect} > {value.format(locale.yearFormat)} @@ -83,7 +86,7 @@ const CalendarHeader = { const month = ( {locale.monthFormat ? value.format(locale.monthFormat) : localeData.monthsShort(value)} diff --git a/components/vc-calendar/src/calendar/OkButton.vue b/components/vc-calendar/src/calendar/OkButton.vue index 33be3efc1..887787db8 100644 --- a/components/vc-calendar/src/calendar/OkButton.vue +++ b/components/vc-calendar/src/calendar/OkButton.vue @@ -2,21 +2,19 @@ function noop () {} export default { functional: true, - render: function (createElement, context) { - const { data, listeners = {}} = context - const { prefixCls, locale, okDisabled } = data + render (createElement, context) { + const { props, listeners = {}} = context + const { prefixCls, locale, okDisabled } = props const { ok = noop } = listeners let className = `${prefixCls}-ok-btn` if (okDisabled) { className += ` ${prefixCls}-ok-btn-disabled` } - return ( - {locale.ok} - ) + return ( + + {locale.ok} + + ) }, } diff --git a/components/vc-calendar/src/calendar/TimePickerButton.vue b/components/vc-calendar/src/calendar/TimePickerButton.vue index 911446ed6..ab49eff7a 100644 --- a/components/vc-calendar/src/calendar/TimePickerButton.vue +++ b/components/vc-calendar/src/calendar/TimePickerButton.vue @@ -2,11 +2,11 @@ function noop () {} export default { functional: true, - render: function (createElement, context) { - const { data, listeners = {}} = context + render (h, context) { + const { props, listeners = {}} = context const { prefixCls, locale, showTimePicker, - timePickerDisabled } = data + timePickerDisabled } = props const { closeTimePicker = noop, openTimePicker = noop } = listeners const className = { [`${prefixCls}-time-picker-btn`]: true, @@ -16,13 +16,11 @@ export default { if (!timePickerDisabled) { onClick = showTimePicker ? closeTimePicker : openTimePicker } - return ( - {showTimePicker ? locale.dateSelect : locale.timeSelect} - ) + return ( + + {showTimePicker ? locale.dateSelect : locale.timeSelect} + + ) }, } diff --git a/components/vc-calendar/src/calendar/TodayButton.vue b/components/vc-calendar/src/calendar/TodayButton.vue index 1be37ce5d..b1be9704b 100644 --- a/components/vc-calendar/src/calendar/TodayButton.vue +++ b/components/vc-calendar/src/calendar/TodayButton.vue @@ -4,7 +4,7 @@ function noop () {} export default { functional: true, render (createElement, context) { - const { data, listeners = {}} = context + const { props, listeners = {}} = context const { prefixCls, locale, @@ -14,7 +14,7 @@ export default { disabledDate, // onToday, text, - } = data + } = props const { today = noop } = listeners const localeNow = (!text && timePicker ? locale.now : text) || locale.today const disabledToday = diff --git a/components/vc-calendar/src/date/DateInput.vue b/components/vc-calendar/src/date/DateInput.vue index 3bf316822..efdc26989 100644 --- a/components/vc-calendar/src/date/DateInput.vue +++ b/components/vc-calendar/src/date/DateInput.vue @@ -23,7 +23,7 @@ const DateInput = { data () { const selectedValue = this.selectedValue return { - str: selectedValue && selectedValue.format(this.props.format) || '', + str: selectedValue && selectedValue.format(this.format) || '', invalid: false, } }, @@ -45,7 +45,6 @@ const DateInput = { }, methods: { updateState () { - console.log('关注下') this.cachedSelectionStart = this.$refs.dateInputInstance.selectionStart this.cachedSelectionEnd = this.$refs.dateInputInstance.selectionEnd // when popup show, click body will call this, bug! @@ -131,7 +130,7 @@ const DateInput = { value={str} disabled={disabled} placeholder={placeholder} - onChange={this.onInputChange} + onInput={this.onInputChange} />
{showClear ? @@ -208,9 +210,8 @@ const DateTBody = { dateCells.push( diff --git a/components/vc-calendar/src/date/DateTHead.vue b/components/vc-calendar/src/date/DateTHead.vue index 2a897cb89..db8b82064 100644 --- a/components/vc-calendar/src/date/DateTHead.vue +++ b/components/vc-calendar/src/date/DateTHead.vue @@ -5,7 +5,7 @@ import moment from 'moment' export default { functional: true, render (createElement, context) { - const { data: props } = context + const { props } = context const value = props.value const localeData = value.localeData() const prefixCls = props.prefixCls @@ -51,4 +51,4 @@ export default { ) }, } - \ No newline at end of file + diff --git a/components/vc-calendar/src/date/DateTable.vue b/components/vc-calendar/src/date/DateTable.vue index 566efbb82..5fcc05363 100644 --- a/components/vc-calendar/src/date/DateTable.vue +++ b/components/vc-calendar/src/date/DateTable.vue @@ -5,15 +5,15 @@ import DateTBody from './DateTBody' export default { functional: true, render (createElement, context) { - const { data, listeners = {}} = context - const prefixCls = data.prefixCls - const props = { - props: data, + const { props, listeners = {}} = context + const prefixCls = props.prefixCls + const bodyProps = { + props, on: listeners, } - return ( - - + return (
+ +
) }, } diff --git a/components/vc-calendar/src/decade/DecadePanel.vue b/components/vc-calendar/src/decade/DecadePanel.vue index c6ebf5ae3..f1ec31b8f 100644 --- a/components/vc-calendar/src/decade/DecadePanel.vue +++ b/components/vc-calendar/src/decade/DecadePanel.vue @@ -29,10 +29,9 @@ export default { rootPrefixCls: PropTypes.string, }, data () { - this.prefixCls = `${this.rootPrefixCls}-decade-panel` this.nextCentury = goYear.bind(this, 100) this.previousCentury = goYear.bind(this, -100) - this.state = { + return { sValue: this.value || this.defaultValue, } }, @@ -46,7 +45,7 @@ export default { const endYear = startYear + 99 const decades = [] let index = 0 - const prefixCls = this.prefixCls + const prefixCls = `${this.rootPrefixCls}-decade-panel` for (let rowIndex = 0; rowIndex < ROW; rowIndex++) { decades[rowIndex] = [] @@ -99,7 +98,7 @@ export default { }) return ( -
+
diff --git a/components/vc-calendar/src/mixin/CommonMixin.js b/components/vc-calendar/src/mixin/CommonMixin.js index f1a1177c1..db973a5af 100644 --- a/components/vc-calendar/src/mixin/CommonMixin.js +++ b/components/vc-calendar/src/mixin/CommonMixin.js @@ -1,16 +1,4 @@ -import PropTypes from '@/components/_util/vue-types' -import enUs from '../locale/en_US' - export default { - props: { - locale: PropTypes.object.def(enUs), - visible: PropTypes.bool.def(true), - // onSelect: PropTypes.func, - prefixCls: PropTypes.string.def('rc-calendat'), - // onChange: PropTypes.func, - // onOk: PropTypes.func, - }, - // getDefaultProps () { // return { // locale: enUs, diff --git a/components/vc-calendar/src/month/MonthPanel.vue b/components/vc-calendar/src/month/MonthPanel.vue index d4fa67875..6d4979d52 100644 --- a/components/vc-calendar/src/month/MonthPanel.vue +++ b/components/vc-calendar/src/month/MonthPanel.vue @@ -17,6 +17,12 @@ function noop () { const MonthPanel = { mixins: [BaseMixin], props: { + value: PropTypes.any, + defaultValue: PropTypes.any, + cellRender: PropTypes.any, + contentRender: PropTypes.any, + locale: PropTypes.any, + rootPrefixCls: PropTypes.string, // onChange: PropTypes.func, disabledDate: PropTypes.func, // onSelect: PropTypes.func, diff --git a/components/vc-calendar/src/month/MonthTable.vue b/components/vc-calendar/src/month/MonthTable.vue index 2b37cf165..2abfb3262 100644 --- a/components/vc-calendar/src/month/MonthTable.vue +++ b/components/vc-calendar/src/month/MonthTable.vue @@ -22,6 +22,9 @@ const MonthTable = { cellRender: PropTypes.func, prefixCls: PropTypes.string, value: PropTypes.object, + locale: PropTypes.any, + contentRender: PropTypes.any, + disabledDate: PropTypes.func, }, data () { return { @@ -71,14 +74,14 @@ const MonthTable = { const today = getTodayTime(value) const months = this.months() const currentMonth = value.month() - const { prefixCls, locale, contentRender, cellRender } = props + const { prefixCls, locale, contentRender, cellRender, disabledDate } = props const monthsEls = months.map((month, index) => { const tds = month.map(monthData => { let disabled = false - if (props.disabledDate) { + if (disabledDate) { const testValue = value.clone() testValue.month(monthData.value) - disabled = props.disabledDate(testValue) + disabled = disabledDate(testValue) } const classNameMap = { [`${prefixCls}-cell`]: 1, diff --git a/components/vc-calendar/src/range-calendar/CalendarPart.vue b/components/vc-calendar/src/range-calendar/CalendarPart.vue index d49190742..8fc906211 100644 --- a/components/vc-calendar/src/range-calendar/CalendarPart.vue +++ b/components/vc-calendar/src/range-calendar/CalendarPart.vue @@ -19,6 +19,7 @@ const CalendarPart = { locale: PropTypes.any, showDateInput: PropTypes.bool, showTimePicker: PropTypes.bool, + showWeekNumber: PropTypes.bool, format: PropTypes.any, placeholder: PropTypes.any, disabledDate: PropTypes.any, @@ -62,7 +63,6 @@ const CalendarPart = { } const index = direction === 'left' ? 0 : 1 const timePickerProps = getOptionProps(timePicker) - console.log('timePickerProps', timePickerProps) const timePickerEle = shouldShowTimePicker && cloneElement(timePicker, { props: { @@ -141,4 +141,4 @@ const CalendarPart = { } export default CalendarPart - \ No newline at end of file + diff --git a/components/vc-calendar/src/year/YearPanel.vue b/components/vc-calendar/src/year/YearPanel.vue index 4ef713c49..eeb3dd8cc 100644 --- a/components/vc-calendar/src/year/YearPanel.vue +++ b/components/vc-calendar/src/year/YearPanel.vue @@ -25,6 +25,7 @@ export default { rootPrefixCls: PropTypes.string, value: PropTypes.object, defaultValue: PropTypes.object, + locale: PropTypes.object, }, data () { this.nextDecade = goYear.bind(this, 10) @@ -59,9 +60,8 @@ export default { }, render () { - const props = this.$props - const value = this.sValue - const locale = props.locale + const { sValue: value, locale, $listeners = {}} = this + const decadePanelShow = $listeners.decadePanelShow || noop const years = this.years() const currentYear = value.year() const startYear = parseInt(currentYear / 10, 10) * 10 @@ -103,7 +103,7 @@ export default { }) return ( -
+
diff --git a/components/vc-pagination/Options.vue b/components/vc-pagination/Options.vue index 11cbb2484..ce404d3aa 100644 --- a/components/vc-pagination/Options.vue +++ b/components/vc-pagination/Options.vue @@ -112,7 +112,7 @@ export default { {locale.page} diff --git a/components/vc-pagination/Pagination.vue b/components/vc-pagination/Pagination.vue index d76d8d6a4..4dd3961cf 100644 --- a/components/vc-pagination/Pagination.vue +++ b/components/vc-pagination/Pagination.vue @@ -301,7 +301,7 @@ export default { value={this.stateCurrentInputValue} onKeydown={this.handleKeyDown} onKeyup={this.handleKeyUp} - onChange={this.handleKeyUp} + onInput={this.handleKeyUp} size='3' /> diff --git a/components/vc-steps/Step.vue b/components/vc-steps/Step.vue index e150f4126..a107d76d3 100644 --- a/components/vc-steps/Step.vue +++ b/components/vc-steps/Step.vue @@ -28,9 +28,13 @@ export default { methods: { renderIconNode () { const { - prefixCls, progressDot, stepNumber, status, + prefixCls, stepNumber, status, iconPrefix, } = getOptionProps(this) + let progressDot = this.progressDot + if (progressDot === undefined) { + progressDot = this.$scopedSlots.progressDot + } const icon = getComponentFromProp(this, 'icon') const title = getComponentFromProp(this, 'title') const description = getComponentFromProp(this, 'description') @@ -48,7 +52,7 @@ export default { if (typeof progressDot === 'function') { iconNode = ( - {progressDot(iconDot, { index: stepNumber - 1, status, title, description })} + {progressDot({ index: stepNumber - 1, status, title, description, prefixCls })} ) } else { diff --git a/components/vc-steps/Steps.vue b/components/vc-steps/Steps.vue index 05c606754..28c448c1a 100644 --- a/components/vc-steps/Steps.vue +++ b/components/vc-steps/Steps.vue @@ -24,7 +24,7 @@ export default { progressDot: PropTypes.oneOfType([ PropTypes.bool, PropTypes.func, - ]).def(false), + ]), current: PropTypes.number.def(0), }, data () { @@ -84,8 +84,12 @@ export default { render () { const { prefixCls, direction, - labelPlacement, iconPrefix, status, size, current, progressDot, - } = getOptionProps(this) + labelPlacement, iconPrefix, status, size, current, $scopedSlots, + } = this + let progressDot = this.progressDot + if (progressDot === undefined) { + progressDot = $scopedSlots.progressDot + } const { lastStepOffsetWidth, flexSupported } = this const filteredChildren = filterEmpty(this.$slots.default) const lastIndex = filteredChildren.length - 1 @@ -112,10 +116,11 @@ export default { stepNumber: `${index + 1}`, prefixCls, iconPrefix, - progressDot, + progressDot: this.progressDot, ...childProps, }, on: getEvents(child), + scopedSlots: $scopedSlots, } if (!flexSupported && direction !== 'vertical' && index !== lastIndex) { stepProps.props.itemWidth = `${100 / lastIndex}%` diff --git a/components/vc-time-picker/Panel.vue b/components/vc-time-picker/Panel.vue index 27bd549cb..6f800839c 100644 --- a/components/vc-time-picker/Panel.vue +++ b/components/vc-time-picker/Panel.vue @@ -29,6 +29,7 @@ const Panel = { }, }, value: PropTypes.object, + defaultValue: PropTypes.object, placeholder: PropTypes.string, format: PropTypes.string, inputReadOnly: PropTypes.bool.def(false), diff --git a/components/vc-time-picker/TimePicker.vue b/components/vc-time-picker/TimePicker.vue index a6ce9222e..05bb1dc64 100644 --- a/components/vc-time-picker/TimePicker.vue +++ b/components/vc-time-picker/TimePicker.vue @@ -56,6 +56,7 @@ export default { focusOnOpen: PropTypes.bool, // onKeyDown: PropTypes.func, autoFocus: PropTypes.bool, + id: PropTypes.string, }, { clearText: 'clear', prefixCls: 'rc-time-picker', @@ -63,6 +64,7 @@ export default { inputReadOnly: false, popupClassName: '', align: {}, + id: '', allowEmpty: true, showHour: true, showMinute: true, @@ -252,7 +254,7 @@ export default { render () { const { - prefixCls, placeholder, placement, align, + prefixCls, placeholder, placement, align, id, disabled, transitionName, getPopupContainer, name, autoComplete, autoFocus, inputReadOnly, sOpen, sValue, onFocus, onBlur, } = this @@ -288,8 +290,8 @@ export default { onFocus={onFocus} onBlur={onBlur} autoFocus={autoFocus} - onChange={noop} readOnly={!!inputReadOnly} + id={id} /> diff --git a/components/vc-time-picker/index.js b/components/vc-time-picker/index.js index d9cf5f8c0..d1c7e6427 100644 --- a/components/vc-time-picker/index.js +++ b/components/vc-time-picker/index.js @@ -1 +1,2 @@ +// based on rc-time-picker 3.3.1 export { default } from './TimePicker'