add vc-calendar demo

pull/165/head
tjz 2018-03-12 22:13:59 +08:00
parent 82715188aa
commit f0918f2b76
31 changed files with 690 additions and 190 deletions

View File

@ -16,9 +16,7 @@ export default {
} else { } else {
this.$listeners[eventName](...args.slice(1)) this.$listeners[eventName](...args.slice(1))
} }
return true
} }
return false
}, },
}, },
} }

View File

@ -179,6 +179,18 @@ const initDefaultProps = (propTypes, defaultProps) => {
Object.keys(defaultProps).forEach(k => { propTypes[k] = propTypes[k].def(defaultProps[k]) }) Object.keys(defaultProps).forEach(k => { propTypes[k] = propTypes[k].def(defaultProps[k]) })
return propTypes 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 { export {
hasProp, hasProp,
filterProps, filterProps,

View File

@ -98,7 +98,7 @@ const Demo = {
toggleDisabled () { toggleDisabled () {
this.setState({ this.setState({
disabled: !this.state.disabled, disabled: !this.disabled,
}) })
}, },
}, },
@ -162,7 +162,7 @@ const Demo = {
scopedSlots={{ scopedSlots={{
default: ({ value }) => { default: ({ value }) => {
return ( return (
<span tabIndex='0' scope={{ value }}> <span tabIndex='0'>
<input <input
placeholder='please select' placeholder='please select'
style={{ width: '250px' }} style={{ width: '250px' }}

View File

@ -0,0 +1,160 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0 */
import '../assets/index.less'
import PropTypes from '@/components/_util/vue-types'
import DatePicker from '../src/Picker'
import zhCN from '../src/locale/zh_CN'
import enUS from '../src/locale/en_US'
import '../../vc-time-picker/assets/index.less'
import BaseMixin from '@/components/_util/BaseMixin'
import MonthCalendar from '../src/MonthCalendar'
import moment from 'moment'
import 'moment/locale/zh-cn'
import 'moment/locale/en-gb'
const format = 'YYYY-MM'
const cn = window.location.search.indexOf('cn') !== -1
const now = moment()
if (cn) {
now.locale('zh-cn').utcOffset(8)
} else {
now.locale('en-gb').utcOffset(0)
}
const defaultCalendarValue = now.clone()
defaultCalendarValue.add(-1, 'month')
const Demo = {
mixins: [BaseMixin],
props: {
defaultValue: PropTypes.object,
},
data () {
return {
showTime: true,
disabled: false,
value: this.defaultValue,
}
},
methods: {
onChange (value) {
console.log(`DatePicker change: ${value && value.format(format)}`)
this.setState({
value,
})
},
onShowTimeChange (e) {
this.setState({
showTime: e.target.checked,
})
},
toggleDisabled () {
this.setState({
disabled: !this.disabled,
})
},
},
render () {
const state = this.$data
const calendar = (<MonthCalendar
locale={cn ? zhCN : enUS}
style={{ zIndex: 1000 }}
/>)
return (<div style={{ width: '240px', margin: '20px' }}>
<div style={{ marginBottom: '10px' }}>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>
<input
checked={state.disabled}
onChange={this.toggleDisabled}
type='checkbox'
/> disabled
</label>
</div>
<div style={{
boxSizing: 'border-box',
position: 'relative',
display: 'block',
lineHeight: 1.5,
marginBottom: '22px',
}}
>
<DatePicker
animation='slide-up'
disabled={state.disabled}
calendar={calendar}
value={state.value}
onChange={this.onChange}
scopedSlots={{
default: ({ value }) => {
return (
<input
style={{ width: '200px' }}
readOnly
disabled={state.disabled}
value={value && value.format(format)}
placeholder='请选择日期'
/>
)
},
}}
>
</DatePicker>
</div>
</div>)
},
}
function onStandaloneSelect (value) {
console.log('month-calendar select', (value && value.format(format)))
}
function onStandaloneChange (value) {
console.log('month-calendar change', (value && value.format(format)))
}
function disabledDate (value) {
return value.year() > now.year() ||
value.year() === now.year() && value.month() > now.month()
}
function onMonthCellContentRender (value) {
// console.log('month-calendar onMonthCellContentRender', (value && value.format(format)));
return `${value.month() + 1}`
}
export default {
render () {
return (
<div
style={{
zIndex: 1000,
position: 'relative',
width: '600px',
margin: '0 auto',
}}
>
<MonthCalendar
locale={cn ? zhCN : enUS}
style={{ zIndex: 1000 }}
disabledDate={disabledDate}
onSelect={onStandaloneSelect}
onChange={onStandaloneChange}
monthCellContentRender={onMonthCellContentRender}
defaultValue={defaultCalendarValue}
/>
<div style={{ marginTop: '200px' }}>
<Demo defaultValue={now} />
</div>
</div>
)
},
}
</script>

View File

@ -0,0 +1,204 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0 */
import '../assets/index.less'
import '@/components/vc-time-picker/assets/index.less'
import Picker from '../src/Picker'
import zhCN from '../src/locale/zh_CN'
import enUS from '../src/locale/en_US'
import '../../vc-time-picker/assets/index.less'
import TimePickerPanel from '../../vc-time-picker/Panel'
import BaseMixin from '@/components/_util/BaseMixin'
import RangeCalendar from '../src/RangeCalendar'
import moment from 'moment'
import 'moment/locale/zh-cn'
import 'moment/locale/en-gb'
const cn = window.location.search.indexOf('cn') !== -1
if (cn) {
moment.locale('zh-cn')
} else {
moment.locale('en-gb')
}
const now = moment()
if (cn) {
now.utcOffset(8)
} else {
now.utcOffset(0)
}
const defaultCalendarValue = now.clone()
defaultCalendarValue.add(-1, 'month')
const timePickerElement = (h) => <TimePickerPanel defaultValue={[moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]}/>
function newArray (start, end) {
const result = []
for (let i = start; i < end; i++) {
result.push(i)
}
return result
}
function disabledDate (current) {
const date = moment()
date.hour(0)
date.minute(0)
date.second(0)
return current.isBefore(date) // can not select days before today
}
function disabledTime (time, type) {
console.log('disabledTime', time, type)
if (type === 'start') {
return {
disabledHours () {
const hours = newArray(0, 60)
hours.splice(20, 4)
return hours
},
disabledMinutes (h) {
if (h === 20) {
return newArray(0, 31)
} else if (h === 23) {
return newArray(30, 60)
}
return []
},
disabledSeconds () {
return [55, 56]
},
}
}
return {
disabledHours () {
const hours = newArray(0, 60)
hours.splice(2, 6)
return hours
},
disabledMinutes (h) {
if (h === 20) {
return newArray(0, 31)
} else if (h === 23) {
return newArray(30, 60)
}
return []
},
disabledSeconds () {
return [55, 56]
},
}
}
const formatStr = 'YYYY-MM-DD HH:mm:ss'
function format (v) {
return v ? v.format(formatStr) : ''
}
function isValidRange (v) {
return v && v[0] && v[1]
}
function onStandaloneChange (value) {
console.log('onChange')
console.log(value[0] && format(value[0]), value[1] && format(value[1]))
}
function onStandaloneSelect (value) {
console.log('onSelect')
console.log(format(value[0]), format(value[1]))
}
const Demo = {
mixins: [BaseMixin],
data () {
return {
value: [],
hoverValue: [],
}
},
methods: {
onChange (value) {
console.log('onChange', value)
this.setState({ value })
},
onHoverChange (hoverValue) {
this.setState({ hoverValue })
},
},
render (h) {
const state = this.$data
const calendar = (
<RangeCalendar
hoverValue={state.hoverValue}
onHoverChange={this.onHoverChange}
showWeekNumber={false}
dateInputPlaceholder={['start', 'end']}
defaultValue={[now, now.clone().add(1, 'months')]}
locale={cn ? zhCN : enUS}
disabledTime={disabledTime}
timePicker={timePickerElement(h)}
/>
)
return (
<Picker
value={state.value}
onChange={this.onChange}
animation='slide-up'
calendar={calendar}
>
{
({ value }) => {
return (<span>
<input
placeholder='please select'
style={{ width: '350px' }}
disabled={state.disabled}
readOnly
className='ant-calendar-picker-input ant-input'
value={isValidRange(value) && `${format(value[0])} - ${format(value[1])}` || ''}
/>
</span>)
}
}
</Picker>)
},
}
export default {
render (h) {
return (
<div>
<h2>calendar</h2>
<div style={{ margin: '10px' }}>
<RangeCalendar
showToday={false}
showWeekNumber
dateInputPlaceholder={['start', 'end']}
locale={cn ? zhCN : enUS}
showOk={false}
showClear
format={formatStr}
onChange={onStandaloneChange}
onSelect={onStandaloneSelect}
disabledDate={disabledDate}
timePicker={timePickerElement(h)}
disabledTime={disabledTime}
/>
</div>
<br />
<div style={{ margin: '20px' }}>
<Demo />
</div>
</div>
)
},
}
</script>

View File

@ -0,0 +1,76 @@
<script>
/* eslint react/no-multi-comp:0, no-console:0 */
import '../assets/index.less'
import zhCN from '../src/locale/zh_CN'
import enUS from '../src/locale/en_US'
import '../../vc-time-picker/assets/index.less'
import BaseMixin from '@/components/_util/BaseMixin'
import FullCalendar from '@/components/vc-calendar/src/FullCalendar'
import '@/components/vc-select/assets/index.less'
import Select from '@/components/vc-select'
import moment from 'moment'
import 'moment/locale/zh-cn'
import 'moment/locale/en-gb'
const format = 'YYYY-MM-DD'
const cn = window.location.search.indexOf('cn') !== -1
const now = moment()
if (cn) {
now.locale('zh-cn').utcOffset(8)
} else {
now.locale('en-gb').utcOffset(0)
}
const defaultCalendarValue = now.clone()
defaultCalendarValue.add(-1, 'month')
function onSelect (value) {
console.log('select', value.format(format))
}
export default {
mixins: [BaseMixin],
data () {
return {
type: 'month',
}
},
methods: {
onTypeChange (type) {
this.setState({
type,
})
},
},
render () {
return (
<div style={{ zIndex: 1000, position: 'relative' }}>
<FullCalendar
style={{ margin: '10px' }}
Select={Select}
fullscreen={false}
onSelect={onSelect}
defaultValue={now}
locale={cn ? zhCN : enUS}
/>
<FullCalendar
style={{ margin: '10px' }}
Select={Select}
fullscreen
defaultValue={now}
onSelect={onSelect}
type={this.type}
onTypeChange={this.onTypeChange}
locale={cn ? zhCN : enUS}
/>
</div>
)
},
}
</script>

View File

@ -10,8 +10,8 @@ import CalendarFooter from './calendar/CalendarFooter'
import CalendarMixin from './mixin/CalendarMixin' import CalendarMixin from './mixin/CalendarMixin'
import CommonMixin from './mixin/CommonMixin' import CommonMixin from './mixin/CommonMixin'
import DateInput from './date/DateInput' import DateInput from './date/DateInput'
import enUs from './locale/en_US'
import { getTimeConfig, getTodayTime, syncTime } from './util' import { getTimeConfig, getTodayTime, syncTime } from './util'
function noop () {}
function goStartMonth () { function goStartMonth () {
const next = this.sValue.clone() const next = this.sValue.clone()
next.startOf('month') next.startOf('month')
@ -48,6 +48,9 @@ function goDay (direction) {
const Calendar = { const Calendar = {
props: { props: {
locale: PropTypes.object.def(enUs),
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
// prefixCls: PropTypes.string, // prefixCls: PropTypes.string,
defaultValue: PropTypes.object, defaultValue: PropTypes.object,
value: PropTypes.object, value: PropTypes.object,
@ -68,8 +71,8 @@ const Calendar = {
// onPanelChange: PropTypes.func, // onPanelChange: PropTypes.func,
disabledDate: PropTypes.func, disabledDate: PropTypes.func,
disabledTime: PropTypes.any, disabledTime: PropTypes.any,
renderFooter: PropTypes.func.def(noop), renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(noop), renderSidebar: PropTypes.func.def(() => null),
}, },
mixins: [BaseMixin, CommonMixin, CalendarMixin], mixins: [BaseMixin, CommonMixin, CalendarMixin],
@ -168,7 +171,8 @@ const Calendar = {
onDateTableSelect (value) { onDateTableSelect (value) {
const { timePicker, sSelectedValue } = this const { timePicker, sSelectedValue } = this
if (!sSelectedValue && timePicker) { if (!sSelectedValue && timePicker) {
const timePickerDefaultValue = timePicker.props.defaultValue const timePickerProps = getOptionProps(timePicker)
const timePickerDefaultValue = timePickerProps.defaultValue
if (timePickerDefaultValue) { if (timePickerDefaultValue) {
syncTime(timePickerDefaultValue, value) syncTime(timePickerDefaultValue, value)
} }
@ -321,4 +325,4 @@ const Calendar = {
} }
export default Calendar export default Calendar
</script> </script>

View File

@ -7,24 +7,28 @@ import MonthTable from './month/MonthTable'
import CalendarMixin from './mixin/CalendarMixin' import CalendarMixin from './mixin/CalendarMixin'
import CommonMixin from './mixin/CommonMixin' import CommonMixin from './mixin/CommonMixin'
import CalendarHeader from './full-calendar/CalendarHeader' import CalendarHeader from './full-calendar/CalendarHeader'
import enUs from './locale/en_US'
const FullCalendar = { const FullCalendar = {
props: { props: {
locale: PropTypes.object.def(enUs),
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
defaultType: PropTypes.string.def('date'), defaultType: PropTypes.string.def('date'),
type: PropTypes.string, type: PropTypes.string,
prefixCls: PropTypes.string, // locale: PropTypes.object,
locale: PropTypes.object,
// onTypeChange: PropTypes.func, // onTypeChange: PropTypes.func,
fullscreen: PropTypes.bool.def(false), fullscreen: PropTypes.bool.def(false),
monthCellRender: PropTypes.func, monthCellRender: PropTypes.func,
dateCellRender: PropTypes.func, dateCellRender: PropTypes.func,
showTypeSwitch: PropTypes.bool.def(true), showTypeSwitch: PropTypes.bool.def(true),
Select: PropTypes.func.isRequired, Select: PropTypes.object.isRequired,
headerComponents: PropTypes.array, headerComponents: PropTypes.array,
headerComponent: PropTypes.object, // The whole header component headerComponent: PropTypes.object, // The whole header component
headerRender: PropTypes.func, headerRender: PropTypes.func,
showHeader: PropTypes.bool.def(true), showHeader: PropTypes.bool.def(true),
disabledDate: PropTypes.func, disabledDate: PropTypes.func,
renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null),
}, },
mixins: [BaseMixin, CommonMixin, CalendarMixin], mixins: [BaseMixin, CommonMixin, CalendarMixin],
data () { data () {
@ -72,7 +76,7 @@ const FullCalendar = {
headerRender, headerRender,
disabledDate, disabledDate,
} = props } = props
const { sValue: value, sType: type } = this const { sValue: value, sType: type, $listeners } = this
let header = null let header = null
if (showHeader) { if (showHeader) {
@ -88,6 +92,7 @@ const FullCalendar = {
value, value,
}, },
on: { on: {
...$listeners,
typeChange: this.setType, typeChange: this.setType,
valueChange: this.setValue, valueChange: this.setValue,
}, },

View File

@ -6,11 +6,18 @@ import CalendarHeader from './calendar/CalendarHeader'
import CalendarFooter from './calendar/CalendarFooter' import CalendarFooter from './calendar/CalendarFooter'
import CalendarMixin from './mixin/CalendarMixin' import CalendarMixin from './mixin/CalendarMixin'
import CommonMixin from './mixin/CommonMixin' import CommonMixin from './mixin/CommonMixin'
import enUs from './locale/en_US'
const MonthCalendar = { const MonthCalendar = {
props: { props: {
locale: PropTypes.object.def(enUs),
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
monthCellRender: PropTypes.func, monthCellRender: PropTypes.func,
dateCellRender: 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], mixins: [BaseMixin, CommonMixin, CalendarMixin],
@ -74,25 +81,26 @@ const MonthCalendar = {
render () { render () {
const { mode, sValue: value, $props: props } = this const { mode, sValue: value, $props: props } = this
const { prefixCls, locale, disabledDate, monthCellRender, monthCellContentRender, renderFooter } = props
const children = ( const children = (
<div class={`${props.prefixCls}-month-calendar-content`}> <div class={`${prefixCls}-month-calendar-content`}>
<div class={`${props.prefixCls}-month-header-wrap`}> <div class={`${prefixCls}-month-header-wrap`}>
<CalendarHeader <CalendarHeader
prefixCls={props.prefixCls} prefixCls={prefixCls}
mode={mode} mode={mode}
value={value} value={value}
locale={props.locale} locale={locale}
disabledMonth={props.disabledDate} disabledMonth={disabledDate}
monthCellRender={props.monthCellRender} monthCellRender={monthCellRender}
monthCellContentRender={props.monthCellContentRender} monthCellContentRender={monthCellContentRender}
onMonthSelect={this.onSelect} onMonthSelect={this.onSelect}
onValueChange={this.setValue} onValueChange={this.setValue}
onPanelChange={this.handlePanelChange} onPanelChange={this.handlePanelChange}
/> />
</div> </div>
<CalendarFooter <CalendarFooter
prefixCls={props.prefixCls} prefixCls={prefixCls}
renderFooter={props.renderFooter} renderFooter={renderFooter}
/> />
</div> </div>
) )

View File

@ -185,19 +185,23 @@ const Picker = {
dropdownClassName, dropdownClassName,
transitionName, transitionName,
} = props } = props
const state = this.$data const { sValue, sOpen } = this
const children = this.$scopedSlots.default const children = this.$scopedSlots.default
const childrenState = {
value: sValue,
open: sOpen,
}
return (<Trigger return (<Trigger
popupAlign={align} popupAlign={align}
builtinPlacements={placements} builtinPlacements={placements}
popupPlacement={placement} popupPlacement={placement}
action={(disabled && !state.sOpen) ? [] : ['click']} action={(disabled && !sOpen) ? [] : ['click']}
destroyPopupOnHide destroyPopupOnHide
getPopupContainer={getCalendarContainer} getPopupContainer={getCalendarContainer}
popupStyle={style} popupStyle={style}
popupAnimation={animation} popupAnimation={animation}
popupTransitionName={transitionName} popupTransitionName={transitionName}
popupVisible={state.sOpen} popupVisible={sOpen}
onPopupVisibleChange={this.onVisibleChange} onPopupVisibleChange={this.onVisibleChange}
prefixCls={prefixCls} prefixCls={prefixCls}
popupClassName={dropdownClassName} popupClassName={dropdownClassName}
@ -205,7 +209,7 @@ const Picker = {
<template slot='popup'> <template slot='popup'>
{this.getCalendarElement()} {this.getCalendarElement()}
</template> </template>
{cloneElement(children(state, props), { on: { keydown: this.onKeyDown }})} {cloneElement(children(childrenState, props), { on: { keydown: this.onKeyDown }})}
</Trigger>) </Trigger>)
}, },
} }

View File

@ -1,13 +1,14 @@
<script> <script>
import PropTypes from '@/components/_util/vue-types' import PropTypes from '@/components/_util/vue-types'
import BaseMixin from '@/components/_util/BaseMixin' import BaseMixin from '@/components/_util/BaseMixin'
import { getOptionProps, hasProp } from '@/components/_util/props-util' import { getOptionProps, hasProp, mergeProps } from '@/components/_util/props-util'
import moment from 'moment' import moment from 'moment'
import CalendarPart from './range-calendar/CalendarPart' import CalendarPart from './range-calendar/CalendarPart'
import TodayButton from './calendar/TodayButton' import TodayButton from './calendar/TodayButton'
import OkButton from './calendar/OkButton' import OkButton from './calendar/OkButton'
import TimePickerButton from './calendar/TimePickerButton' import TimePickerButton from './calendar/TimePickerButton'
import CommonMixin from './mixin/CommonMixin' import CommonMixin from './mixin/CommonMixin'
import enUs from './locale/en_US'
import { syncTime, getTodayTime, isAllowedDate } from './util/' import { syncTime, getTodayTime, isAllowedDate } from './util/'
function noop () {} function noop () {}
@ -72,7 +73,9 @@ function onInputSelect (direction, value) {
const RangeCalendar = { const RangeCalendar = {
props: { props: {
prefixCls: PropTypes.string, locale: PropTypes.object.def(enUs),
visible: PropTypes.bool.def(true),
prefixCls: PropTypes.string.def('rc-calendar'),
dateInputPlaceholder: PropTypes.any, dateInputPlaceholder: PropTypes.any,
defaultValue: PropTypes.any, defaultValue: PropTypes.any,
value: PropTypes.any, value: PropTypes.any,
@ -84,9 +87,9 @@ const RangeCalendar = {
showToday: PropTypes.bool.def(true), showToday: PropTypes.bool.def(true),
defaultSelectedValue: PropTypes.array.def([]), defaultSelectedValue: PropTypes.array.def([]),
selectedValue: PropTypes.array, selectedValue: PropTypes.array,
onOk: PropTypes.func,
showClear: PropTypes.bool, showClear: PropTypes.bool,
locale: PropTypes.object, showWeekNumber: PropTypes.bool,
// locale: PropTypes.object,
// onChange: PropTypes.func, // onChange: PropTypes.func,
// onSelect: PropTypes.func, // onSelect: PropTypes.func,
// onValueChange: PropTypes.func, // onValueChange: PropTypes.func,
@ -97,6 +100,8 @@ const RangeCalendar = {
type: PropTypes.any.def('both'), type: PropTypes.any.def('both'),
disabledDate: PropTypes.func, disabledDate: PropTypes.func,
disabledTime: PropTypes.func.def(noop), disabledTime: PropTypes.func.def(noop),
renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null),
}, },
mixins: [BaseMixin, CommonMixin], mixins: [BaseMixin, CommonMixin],
@ -115,26 +120,30 @@ const RangeCalendar = {
sMode: props.mode || ['date', 'date'], sMode: props.mode || ['date', 'date'],
} }
}, },
watch: {
componentWillReceiveProps (nextProps) { value (val) {
const { state } = this const newState = {}
const newState = {} newState.sValue = normalizeAnchor(val, 0)
if ('value' in nextProps) {
newState.value = normalizeAnchor(nextProps, 0)
this.setState(newState) this.setState(newState)
} },
if ('hoverValue' in nextProps && !isArraysEqual(state.hoverValue, nextProps.hoverValue)) { hoverValue (val) {
this.setState({ hoverValue: nextProps.hoverValue }) if (!isArraysEqual(this.sHoverValue, val)) {
} this.setState({ sHoverValue: val })
if ('selectedValue' in nextProps) { }
newState.selectedValue = nextProps.selectedValue },
newState.prevSelectedValue = nextProps.selectedValue selectedValue (val) {
const newState = {}
newState.sSelectedValue = val
newState.prevSelectedValue = val
this.setState(newState) this.setState(newState)
} },
if ('mode' in nextProps && !isArraysEqual(state.mode, nextProps.mode)) { mode (val) {
this.setState({ mode: nextProps.mode }) if (!isArraysEqual(this.sMode, val)) {
} this.setState({ sMode: val })
}
},
}, },
methods: { methods: {
onDatePanelEnter () { onDatePanelEnter () {
if (this.hasSelectedValue()) { if (this.hasSelectedValue()) {
@ -166,8 +175,7 @@ const RangeCalendar = {
} else if (type === 'start') { } else if (type === 'start') {
syncTime(prevSelectedValue[0], value) syncTime(prevSelectedValue[0], value)
const endValue = sSelectedValue[1] const endValue = sSelectedValue[1]
nextSelectedValue = endValue && this.compare(endValue, value) > 0 nextSelectedValue = endValue && this.compare(endValue, value) > 0 ? [value, endValue] : [value]
? [value, endValue] : [value]
} else { // type === 'end' } else { // type === 'end'
const startValue = sSelectedValue[0] const startValue = sSelectedValue[0]
if (startValue && this.compare(startValue, value) <= 0) { if (startValue && this.compare(startValue, value) <= 0) {
@ -275,11 +283,11 @@ const RangeCalendar = {
let value = this.sValue[0] let value = this.sValue[0]
const selectedValue = this.sSelectedValue const selectedValue = this.sSelectedValue
// keep selectedTime when select date // keep selectedTime when select date
if (selectedValue[0] && this.props.timePicker) { if (selectedValue[0] && this.timePicker) {
value = value.clone() value = value.clone()
syncTime(selectedValue[0], value) syncTime(selectedValue[0], value)
} }
if (this.state.showTimePicker && selectedValue[0]) { if (this.showTimePicker && selectedValue[0]) {
return selectedValue[0] return selectedValue[0]
} }
return value return value
@ -358,14 +366,16 @@ const RangeCalendar = {
fireSelectValueChange (selectedValue, direct) { fireSelectValueChange (selectedValue, direct) {
const { timePicker, prevSelectedValue } = this const { timePicker, prevSelectedValue } = this
console.log('timePicker', timePicker) if (timePicker) {
if (timePicker && timePicker.props.defaultValue) { const timePickerProps = getOptionProps(timePicker)
const timePickerDefaultValue = timePicker.props.defaultValue if (timePickerProps.defaultValue) {
if (!prevSelectedValue[0] && selectedValue[0]) { const timePickerDefaultValue = timePickerProps.defaultValue
syncTime(timePickerDefaultValue[0], selectedValue[0]) if (!prevSelectedValue[0] && selectedValue[0]) {
} syncTime(timePickerDefaultValue[0], selectedValue[0])
if (!prevSelectedValue[1] && selectedValue[1]) { }
syncTime(timePickerDefaultValue[1], selectedValue[1]) if (!prevSelectedValue[1] && selectedValue[1]) {
syncTime(timePickerDefaultValue[1], selectedValue[1])
}
} }
} }
@ -474,7 +484,7 @@ const RangeCalendar = {
select: this.onSelect, select: this.onSelect,
dayHover: type === 'start' && sSelectedValue[1] || dayHover: type === 'start' && sSelectedValue[1] ||
type === 'end' && sSelectedValue[0] || !!sHoverValue.length type === 'end' && sSelectedValue[0] || !!sHoverValue.length
? this.onDayHover : undefined, ? this.onDayHover : noop,
}, },
} }
@ -506,6 +516,94 @@ const RangeCalendar = {
const nextMonthOfStart = startValue.clone().add(1, 'months') const nextMonthOfStart = startValue.clone().add(1, 'months')
const isClosestMonths = nextMonthOfStart.year() === endValue.year() && const isClosestMonths = nextMonthOfStart.year() === endValue.year() &&
nextMonthOfStart.month() === endValue.month() nextMonthOfStart.month() === endValue.month()
const leftPartProps = mergeProps(baseProps, newProps, {
props: {
hoverValue: sHoverValue,
direction: 'left',
disabledTime: this.disabledStartTime,
disabledMonth: this.disabledStartMonth,
format: this.getFormat(),
value: startValue,
mode: sMode[0],
placeholder: placeholder1,
showDateInput: this.showDateInput,
timePicker: timePicker,
showTimePicker: showTimePicker,
enablePrev: true,
enableNext: !isClosestMonths || this.isMonthYearPanelShow(sMode[1]),
},
on: {
inputSelect: this.onStartInputSelect,
valueChange: this.onStartValueChange,
panelChange: this.onStartPanelChange,
},
})
const rightPartProps = mergeProps(baseProps, newProps, {
props: {
hoverValue: sHoverValue,
direction: 'right',
format: this.getFormat(),
timePickerDisabledTime: this.getEndDisableTime(),
placeholder: placeholder2,
value: endValue,
mode: sMode[1],
showDateInput: this.showDateInput,
timePicker: timePicker,
showTimePicker: showTimePicker,
disabledTime: this.disabledEndTime,
disabledMonth: this.disabledEndMonth,
enablePrev: !isClosestMonths || this.isMonthYearPanelShow(sMode[0]),
enableNext: true,
},
on: {
inputSelect: this.onEndInputSelect,
valueChange: this.onEndValueChange,
panelChange: this.onEndPanelChange,
},
})
let TodayButtonNode = null
if (showToday) {
const todayButtonProps = mergeProps(baseProps, {
props: {
disabled: isTodayInView,
value: sValue[0],
text: locale.backToToday,
},
on: {
today: this.onToday,
},
})
TodayButtonNode = <TodayButton {...todayButtonProps}/>
}
let TimePickerButtonNode = null
if (props.timePicker) {
const timePickerButtonProps = mergeProps(baseProps, {
props: {
showTimePicker: showTimePicker,
timePickerDisabled: !this.hasSelectedValue() || sHoverValue.length,
},
on: {
openTimePicker: this.onOpenTimePicker,
closeTimePicker: this.onCloseTimePicker,
},
})
TimePickerButtonNode = <TimePickerButton {...timePickerButtonProps} />
}
let OkButtonNode = null
if (showOkButton) {
const okButtonProps = mergeProps(baseProps, {
props: {
okDisabled: !this.isAllowedDateAndTime(sSelectedValue) || !this.hasSelectedValue() || sHoverValue.length,
},
on: {
ok: this.onOk,
},
})
OkButtonNode = <OkButton {...okButtonProps}/>
}
return ( return (
<div <div
ref={this.saveRoot} ref={this.saveRoot}
@ -526,78 +624,17 @@ const RangeCalendar = {
onMouseleave={type !== 'both' ? this.onDatePanelLeave : noop} onMouseleave={type !== 'both' ? this.onDatePanelLeave : noop}
onMouseenter={type !== 'both' ? this.onDatePanelEnter : noop} onMouseenter={type !== 'both' ? this.onDatePanelEnter : noop}
> >
<CalendarPart <CalendarPart {...leftPartProps}/>
{...baseProps}
{...newProps}
hoverValue={sHoverValue}
direction='left'
disabledTime={this.disabledStartTime}
disabledMonth={this.disabledStartMonth}
format={this.getFormat()}
value={startValue}
mode={sMode[0]}
placeholder={placeholder1}
onInputSelect={this.onStartInputSelect}
onValueChange={this.onStartValueChange}
onPanelChange={this.onStartPanelChange}
showDateInput={this.props.showDateInput}
timePicker={timePicker}
showTimePicker={showTimePicker}
enablePrev
enableNext={!isClosestMonths || this.isMonthYearPanelShow(sMode[1])}
/>
<span class={`${prefixCls}-range-middle`}>~</span> <span class={`${prefixCls}-range-middle`}>~</span>
<CalendarPart <CalendarPart {...rightPartProps}/>
{...baseProps}
{...newProps}
hoverValue={sHoverValue}
direction='right'
format={this.getFormat()}
timePickerDisabledTime={this.getEndDisableTime()}
placeholder={placeholder2}
value={endValue}
mode={sMode[1]}
onInputSelect={this.onEndInputSelect}
onValueChange={this.onEndValueChange}
onPanelChange={this.onEndPanelChange}
showDateInput={this.props.showDateInput}
timePicker={timePicker}
showTimePicker={showTimePicker}
disabledTime={this.disabledEndTime}
disabledMonth={this.disabledEndMonth}
enablePrev={!isClosestMonths || this.isMonthYearPanelShow(sMode[0])}
enableNext
/>
</div> </div>
<div class={cls}> <div class={cls}>
{props.renderFooter()} {props.renderFooter()}
{showToday || props.timePicker || showOkButton ? ( {showToday || props.timePicker || showOkButton ? (
<div class={`${prefixCls}-footer-btn`}> <div class={`${prefixCls}-footer-btn`}>
{showToday ? ( {TodayButtonNode}
<TodayButton {TimePickerButtonNode}
{...baseProps} {OkButtonNode}
disabled={isTodayInView}
value={sValue[0]}
onToday={this.onToday}
text={locale.backToToday}
/>
) : null}
{props.timePicker
? <TimePickerButton
{...baseProps}
showTimePicker={showTimePicker}
onOpenTimePicker={this.onOpenTimePicker}
onCloseTimePicker={this.onCloseTimePicker}
timePickerDisabled={!this.hasSelectedValue() || sHoverValue.length}
/> : null}
{showOkButton
? <OkButton
{...baseProps}
onOk={this.onOk}
okDisabled={!this.isAllowedDateAndTime(sSelectedValue) ||
!this.hasSelectedValue() || sHoverValue.length
}
/> : null}
</div> </div>
) : null} ) : null}
</div> </div>

View File

@ -2,9 +2,9 @@
import PropTypes from '@/components/_util/vue-types' import PropTypes from '@/components/_util/vue-types'
import BaseMixin from '@/components/_util/BaseMixin' import BaseMixin from '@/components/_util/BaseMixin'
import { getOptionProps } from '@/components/_util/props-util' import { getOptionProps } from '@/components/_util/props-util'
import TodayButton from '../calendar/TodayButton' import TodayButton from './TodayButton'
import OkButton from '../calendar/OkButton' import OkButton from './OkButton'
import TimePickerButton from '../calendar/TimePickerButton' import TimePickerButton from './TimePickerButton'
const CalendarFooter = { const CalendarFooter = {
mixins: [BaseMixin], mixins: [BaseMixin],
@ -20,7 +20,7 @@ const CalendarFooter = {
renderFooter: PropTypes.func, renderFooter: PropTypes.func,
defaultValue: PropTypes.object, defaultValue: PropTypes.object,
locale: PropTypes.object, locale: PropTypes.object,
showToday: PropTypes.bool.def(true), showToday: PropTypes.bool,
disabledDate: PropTypes.func, disabledDate: PropTypes.func,
showTimePicker: PropTypes.bool, showTimePicker: PropTypes.bool,
okDisabled: PropTypes.bool, okDisabled: PropTypes.bool,
@ -49,7 +49,6 @@ const CalendarFooter = {
}, },
on: $listeners, on: $listeners,
} }
console.log(props)
let nowEl = null let nowEl = null
if (showToday) { if (showToday) {
nowEl = <TodayButton {...btnProps} /> nowEl = <TodayButton {...btnProps} />
@ -72,7 +71,7 @@ const CalendarFooter = {
} }
const cls = { const cls = {
[`${prefixCls}-footer`]: true, [`${prefixCls}-footer`]: true,
[`${prefixCls}-footer-show-ok`]: okBtn, [`${prefixCls}-footer-show-ok`]: !!okBtn,
} }
footerEl = ( footerEl = (
<div class={cls}> <div class={cls}>

View File

@ -34,6 +34,7 @@ const CalendarHeader = {
enablePrev: PropTypes.any.def(1), enablePrev: PropTypes.any.def(1),
enableNext: PropTypes.any.def(1), enableNext: PropTypes.any.def(1),
disabledMonth: PropTypes.func, disabledMonth: PropTypes.func,
mode: PropTypes.any,
}, },
data () { data () {
this.nextMonth = goMonth.bind(this, 1) this.nextMonth = goMonth.bind(this, 1)
@ -47,7 +48,9 @@ const CalendarHeader = {
methods: { methods: {
onMonthSelect (value) { onMonthSelect (value) {
this.__emit('panelChange', value, 'date') this.__emit('panelChange', value, 'date')
if (this.__emit('monthSelect', value)) { if (this.$listeners.monthSelect) {
this.__emit('monthSelect', value)
} else {
this.__emit('valueChange', value) this.__emit('valueChange', value)
} }
}, },

View File

@ -2,21 +2,19 @@
function noop () {} function noop () {}
export default { export default {
functional: true, functional: true,
render: function (createElement, context) { render (createElement, context) {
const { data, listeners = {}} = context const { props, listeners = {}} = context
const { prefixCls, locale, okDisabled } = data const { prefixCls, locale, okDisabled } = props
const { ok = noop } = listeners const { ok = noop } = listeners
let className = `${prefixCls}-ok-btn` let className = `${prefixCls}-ok-btn`
if (okDisabled) { if (okDisabled) {
className += ` ${prefixCls}-ok-btn-disabled` className += ` ${prefixCls}-ok-btn-disabled`
} }
return (<a return (
class={className} <a class={className} role='button' onClick={okDisabled ? noop : ok}>
role='button' {locale.ok}
onClick={okDisabled ? noop : ok} </a>
> )
{locale.ok}
</a>)
}, },
} }

View File

@ -2,9 +2,8 @@
function noop () {} function noop () {}
export default { export default {
functional: true, functional: true,
render: function (h, context) { render (h, context) {
const { props, listeners = {}} = context const { props, listeners = {}} = context
console.log(context)
const { const {
prefixCls, locale, showTimePicker, prefixCls, locale, showTimePicker,
timePickerDisabled } = props timePickerDisabled } = props

View File

@ -23,7 +23,7 @@ const DateInput = {
data () { data () {
const selectedValue = this.selectedValue const selectedValue = this.selectedValue
return { return {
str: selectedValue && selectedValue.format(this.props.format) || '', str: selectedValue && selectedValue.format(this.format) || '',
invalid: false, invalid: false,
} }
}, },
@ -45,7 +45,6 @@ const DateInput = {
}, },
methods: { methods: {
updateState () { updateState () {
console.log('关注下')
this.cachedSelectionStart = this.$refs.dateInputInstance.selectionStart this.cachedSelectionStart = this.$refs.dateInputInstance.selectionStart
this.cachedSelectionEnd = this.$refs.dateInputInstance.selectionEnd this.cachedSelectionEnd = this.$refs.dateInputInstance.selectionEnd
// when popup show, click body will call this, bug! // when popup show, click body will call this, bug!
@ -131,7 +130,7 @@ const DateInput = {
value={str} value={str}
disabled={disabled} disabled={disabled}
placeholder={placeholder} placeholder={placeholder}
onChange={this.onInputChange} onInput={this.onInputChange}
/> />
</div> </div>
{showClear ? <a {showClear ? <a

View File

@ -48,7 +48,6 @@ const DateTBody = {
showWeekNumber, dateRender, disabledDate, showWeekNumber, dateRender, disabledDate,
hoverValue, hoverValue,
} = props } = props
console.log('selectedValue', selectedValue)
const { $listeners = {}} = this const { $listeners = {}} = this
const { select = noop, dayHover = noop } = $listeners const { select = noop, dayHover = noop } = $listeners
let iIndex let iIndex
@ -100,7 +99,7 @@ const DateTBody = {
if (showWeekNumber) { if (showWeekNumber) {
weekNumberCell = ( weekNumberCell = (
<td <td
key={dateTable[passed].week()} key={`week-${dateTable[passed].week()}`}
role='gridcell' role='gridcell'
class={weekNumberCellClass} class={weekNumberCellClass}
> >
@ -212,8 +211,7 @@ const DateTBody = {
<td <td
key={passed} key={passed}
onClick={disabled ? noop : select.bind(null, current)} onClick={disabled ? noop : select.bind(null, current)}
onMouseenter={disabled onMouseenter={disabled ? noop : dayHover.bind(null, current)}
? noop : dayHover.bind(null, current)}
role='gridcell' role='gridcell'
title={getTitleString(current)} class={cls} title={getTitleString(current)} class={cls}
> >

View File

@ -5,7 +5,7 @@ import moment from 'moment'
export default { export default {
functional: true, functional: true,
render (createElement, context) { render (createElement, context) {
const { data: props } = context const { props } = context
const value = props.value const value = props.value
const localeData = value.localeData() const localeData = value.localeData()
const prefixCls = props.prefixCls const prefixCls = props.prefixCls
@ -51,4 +51,4 @@ export default {
</thead>) </thead>)
}, },
} }
</script> </script>

View File

@ -11,8 +11,8 @@ export default {
props, props,
on: listeners, on: listeners,
} }
return (<table class = {`${prefixCls}-table`} cellSpacing='0' role='grid'> return (<table class={`${prefixCls}-table`} cellSpacing='0' role='grid'>
<DateTHead {...props}/> <DateTHead {...bodyProps}/>
<DateTBody {...bodyProps}/> <DateTBody {...bodyProps}/>
</table>) </table>)
}, },

View File

@ -29,10 +29,9 @@ export default {
rootPrefixCls: PropTypes.string, rootPrefixCls: PropTypes.string,
}, },
data () { data () {
this.prefixCls = `${this.rootPrefixCls}-decade-panel`
this.nextCentury = goYear.bind(this, 100) this.nextCentury = goYear.bind(this, 100)
this.previousCentury = goYear.bind(this, -100) this.previousCentury = goYear.bind(this, -100)
this.state = { return {
sValue: this.value || this.defaultValue, sValue: this.value || this.defaultValue,
} }
}, },
@ -46,7 +45,7 @@ export default {
const endYear = startYear + 99 const endYear = startYear + 99
const decades = [] const decades = []
let index = 0 let index = 0
const prefixCls = this.prefixCls const prefixCls = `${this.rootPrefixCls}-decade-panel`
for (let rowIndex = 0; rowIndex < ROW; rowIndex++) { for (let rowIndex = 0; rowIndex < ROW; rowIndex++) {
decades[rowIndex] = [] decades[rowIndex] = []
@ -99,7 +98,7 @@ export default {
}) })
return ( return (
<div class={this.prefixCls}> <div class={prefixCls}>
<div class={`${prefixCls}-header`}> <div class={`${prefixCls}-header`}>
<a <a
class={`${prefixCls}-prev-century-btn`} class={`${prefixCls}-prev-century-btn`}

View File

@ -12,7 +12,7 @@ const CalendarHeader = {
yearSelectTotal: PropTypes.number.def(20), yearSelectTotal: PropTypes.number.def(20),
// onValueChange: PropTypes.func, // onValueChange: PropTypes.func,
// onTypeChange: PropTypes.func, // onTypeChange: PropTypes.func,
Select: PropTypes.func, Select: PropTypes.object,
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
type: PropTypes.string, type: PropTypes.string,
showTypeSwitch: PropTypes.bool, showTypeSwitch: PropTypes.bool,

View File

@ -3,7 +3,7 @@ import BaseMixin from '@/components/_util/BaseMixin'
import { hasProp } from '@/components/_util/props-util' import { hasProp } from '@/components/_util/props-util'
import moment from 'moment' import moment from 'moment'
import { isAllowedDate, getTodayTime } from '../util/index' import { isAllowedDate, getTodayTime } from '../util/index'
function noop () {}
function getNow () { function getNow () {
return moment() return moment()
} }
@ -71,7 +71,7 @@ const CalendarMixin = {
ref='rootInstance' ref='rootInstance'
class={className} class={className}
tabIndex='0' tabIndex='0'
onKeydown={this.onKeyDown} onKeydown={this.onKeyDown || noop}
> >
{newProps.children} {newProps.children}
</div> </div>

View File

@ -1,16 +1,4 @@
import PropTypes from '@/components/_util/vue-types'
import enUs from '../locale/en_US'
export default { export default {
props: {
locale: PropTypes.object.def(enUs),
visible: PropTypes.bool.def(true),
// onSelect: PropTypes.func,
prefixCls: PropTypes.string.def('rc-calendar'),
// onChange: PropTypes.func,
// onOk: PropTypes.func,
},
// getDefaultProps () { // getDefaultProps () {
// return { // return {
// locale: enUs, // locale: enUs,

View File

@ -17,6 +17,12 @@ function noop () {
const MonthPanel = { const MonthPanel = {
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
value: PropTypes.any,
defaultValue: PropTypes.any,
cellRender: PropTypes.any,
contentRender: PropTypes.any,
locale: PropTypes.any,
rootPrefixCls: PropTypes.string,
// onChange: PropTypes.func, // onChange: PropTypes.func,
disabledDate: PropTypes.func, disabledDate: PropTypes.func,
// onSelect: PropTypes.func, // onSelect: PropTypes.func,

View File

@ -22,6 +22,9 @@ const MonthTable = {
cellRender: PropTypes.func, cellRender: PropTypes.func,
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
value: PropTypes.object, value: PropTypes.object,
locale: PropTypes.any,
contentRender: PropTypes.any,
disabledDate: PropTypes.func,
}, },
data () { data () {
return { return {
@ -71,14 +74,14 @@ const MonthTable = {
const today = getTodayTime(value) const today = getTodayTime(value)
const months = this.months() const months = this.months()
const currentMonth = value.month() const currentMonth = value.month()
const { prefixCls, locale, contentRender, cellRender } = props const { prefixCls, locale, contentRender, cellRender, disabledDate } = props
const monthsEls = months.map((month, index) => { const monthsEls = months.map((month, index) => {
const tds = month.map(monthData => { const tds = month.map(monthData => {
let disabled = false let disabled = false
if (props.disabledDate) { if (disabledDate) {
const testValue = value.clone() const testValue = value.clone()
testValue.month(monthData.value) testValue.month(monthData.value)
disabled = props.disabledDate(testValue) disabled = disabledDate(testValue)
} }
const classNameMap = { const classNameMap = {
[`${prefixCls}-cell`]: 1, [`${prefixCls}-cell`]: 1,

View File

@ -19,6 +19,7 @@ const CalendarPart = {
locale: PropTypes.any, locale: PropTypes.any,
showDateInput: PropTypes.bool, showDateInput: PropTypes.bool,
showTimePicker: PropTypes.bool, showTimePicker: PropTypes.bool,
showWeekNumber: PropTypes.bool,
format: PropTypes.any, format: PropTypes.any,
placeholder: PropTypes.any, placeholder: PropTypes.any,
disabledDate: PropTypes.any, disabledDate: PropTypes.any,
@ -62,7 +63,6 @@ const CalendarPart = {
} }
const index = direction === 'left' ? 0 : 1 const index = direction === 'left' ? 0 : 1
const timePickerProps = getOptionProps(timePicker) const timePickerProps = getOptionProps(timePicker)
console.log('timePickerProps', timePickerProps)
const timePickerEle = shouldShowTimePicker && const timePickerEle = shouldShowTimePicker &&
cloneElement(timePicker, { cloneElement(timePicker, {
props: { props: {
@ -141,4 +141,4 @@ const CalendarPart = {
} }
export default CalendarPart export default CalendarPart
</script> </script>

View File

@ -25,6 +25,7 @@ export default {
rootPrefixCls: PropTypes.string, rootPrefixCls: PropTypes.string,
value: PropTypes.object, value: PropTypes.object,
defaultValue: PropTypes.object, defaultValue: PropTypes.object,
locale: PropTypes.object,
}, },
data () { data () {
this.nextDecade = goYear.bind(this, 10) this.nextDecade = goYear.bind(this, 10)
@ -59,9 +60,8 @@ export default {
}, },
render () { render () {
const props = this.$props const { sValue: value, locale, $listeners = {}} = this
const value = this.sValue const decadePanelShow = $listeners.decadePanelShow || noop
const locale = props.locale
const years = this.years() const years = this.years()
const currentYear = value.year() const currentYear = value.year()
const startYear = parseInt(currentYear / 10, 10) * 10 const startYear = parseInt(currentYear / 10, 10) * 10
@ -103,7 +103,7 @@ export default {
}) })
return ( return (
<div class={this.prefixCls}> <div class={prefixCls}>
<div> <div>
<div class={`${prefixCls}-header`}> <div class={`${prefixCls}-header`}>
<a <a
@ -115,7 +115,7 @@ export default {
<a <a
class={`${prefixCls}-decade-select`} class={`${prefixCls}-decade-select`}
role='button' role='button'
onClick={props.onDecadePanelShow} onClick={decadePanelShow}
title={locale.decadeSelect} title={locale.decadeSelect}
> >
<span class={`${prefixCls}-decade-select-content`}> <span class={`${prefixCls}-decade-select-content`}>

View File

@ -112,7 +112,7 @@ export default {
<input <input
type='text' type='text'
value={this.goInputText} value={this.goInputText}
onChange={this.handleChange} onInput={this.handleChange}
onKeyup={this.go} onKeyup={this.go}
/> />
{locale.page} {locale.page}

View File

@ -301,7 +301,7 @@ export default {
value={this.stateCurrentInputValue} value={this.stateCurrentInputValue}
onKeydown={this.handleKeyDown} onKeydown={this.handleKeyDown}
onKeyup={this.handleKeyUp} onKeyup={this.handleKeyUp}
onChange={this.handleKeyUp} onInput={this.handleKeyUp}
size='3' size='3'
/> />
<span class={`${prefixCls}-slash`}></span> <span class={`${prefixCls}-slash`}></span>

View File

@ -29,6 +29,7 @@ const Panel = {
}, },
}, },
value: PropTypes.object, value: PropTypes.object,
defaultValue: PropTypes.object,
placeholder: PropTypes.string, placeholder: PropTypes.string,
format: PropTypes.string, format: PropTypes.string,
inputReadOnly: PropTypes.bool.def(false), inputReadOnly: PropTypes.bool.def(false),

View File

@ -288,7 +288,6 @@ export default {
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur} onBlur={onBlur}
autoFocus={autoFocus} autoFocus={autoFocus}
onChange={noop}
readOnly={!!inputReadOnly} readOnly={!!inputReadOnly}
/> />
<span class={`${prefixCls}-icon`}/> <span class={`${prefixCls}-icon`}/>