t Merge branch 'feat-3.10.3' of https://github.com/vueComponent/ant-design-vue into feat-3.10.3

pull/309/head
tangjinzhou 2018-10-31 21:39:43 +08:00
commit 0c788b084c
8 changed files with 23 additions and 12 deletions

View File

@ -12,4 +12,5 @@ export const switchPropTypes = {
checked: PropTypes.bool.def(false), checked: PropTypes.bool.def(false),
defaultChecked: PropTypes.bool.def(false), defaultChecked: PropTypes.bool.def(false),
autoFocus: PropTypes.bool.def(false), autoFocus: PropTypes.bool.def(false),
loadingIcon: PropTypes.any,
} }

View File

@ -62,8 +62,6 @@ export default {
this.setChecked(false) this.setChecked(false)
} else if (e.keyCode === 39) { // Right } else if (e.keyCode === 39) { // Right
this.setChecked(true) this.setChecked(true)
} else if (e.keyCode === 32 || e.keyCode === 13) { // Space, Enter
this.toggle()
} }
}, },
handleMouseUp (e) { handleMouseUp (e) {
@ -80,9 +78,8 @@ export default {
}, },
}, },
render () { render () {
const { prefixCls, disabled, tabIndex, ...restProps } = getOptionProps(this) const { prefixCls, disabled, loadingIcon, ...restProps } = getOptionProps(this)
const checked = this.stateChecked const checked = this.stateChecked
const switchTabIndex = disabled ? -1 : (tabIndex || 0)
const switchClassName = { const switchClassName = {
[prefixCls]: true, [prefixCls]: true,
[`${prefixCls}-checked`]: checked, [`${prefixCls}-checked`]: checked,
@ -97,17 +94,21 @@ export default {
mouseup: this.handleMouseUp, mouseup: this.handleMouseUp,
}, },
attrs: { attrs: {
tabIndex: switchTabIndex, type: 'button',
role: 'switch',
'aria-checked': checked,
disabled,
}, },
class: switchClassName, class: switchClassName,
ref: 'refSwitchNode', ref: 'refSwitchNode',
} }
return ( return (
<span {...spanProps}> <button {...spanProps}>
{loadingIcon}
<span class={`${prefixCls}-inner`}> <span class={`${prefixCls}-inner`}>
{checked ? getComponentFromProp(this, 'checkedChildren') : getComponentFromProp(this, 'unCheckedChildren')} {checked ? getComponentFromProp(this, 'checkedChildren') : getComponentFromProp(this, 'unCheckedChildren')}
</span> </span>
</span> </button>
) )
}, },
} }

View File

@ -9,6 +9,7 @@
width: 44px; width: 44px;
height: 22px; height: 22px;
line-height: 20px; line-height: 20px;
padding: 0;
vertical-align: middle; vertical-align: middle;
border-radius: 20px 20px; border-radius: 20px 20px;
border: 1px solid #ccc; border: 1px solid #ccc;
@ -21,6 +22,7 @@
font-size: 12px; font-size: 12px;
position: absolute; position: absolute;
left: 24px; left: 24px;
top: 0;
} }
&:after { &:after {

View File

@ -1,4 +1,4 @@
// base rc-switch 1.6.0 // base rc-switch 1.8.0
import Switch from './Switch' import Switch from './Switch'
export default Switch export default Switch

View File

@ -10,6 +10,7 @@ export default {
beforeUpload (file) { beforeUpload (file) {
console.log('beforeUpload', file.name) console.log('beforeUpload', file.name)
}, },
openFileDialogOnClick: false,
}, },
on: { on: {
start (file) { start (file) {
@ -24,6 +25,9 @@ export default {
error (err) { error (err) {
console.log('error', err) console.log('error', err)
}, },
click () {
alert('click')
},
}, },
style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' }, style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' },
} }

View File

@ -1,4 +1,4 @@
// rc-upload 2.5.1 // rc-upload 2.6.0
import upload from './src' import upload from './src'
export default upload export default upload

View File

@ -31,6 +31,7 @@ const upLoadPropTypes = {
customRequest: PropTypes.func, customRequest: PropTypes.func,
// onProgress: PropTypes.func, // onProgress: PropTypes.func,
withCredentials: PropTypes.bool, withCredentials: PropTypes.bool,
openFileDialogOnClick: PropTypes.bool,
} }
const AjaxUploader = { const AjaxUploader = {
@ -184,22 +185,22 @@ const AjaxUploader = {
}, },
render () { render () {
const { const {
componentTag: Tag, prefixCls, disabled, multiple, accept, directory, componentTag: Tag, prefixCls, disabled, multiple, accept, directory, openFileDialogOnClick,
} = this.$props } = this.$props
const cls = classNames({ const cls = classNames({
[prefixCls]: true, [prefixCls]: true,
[`${prefixCls}-disabled`]: disabled, [`${prefixCls}-disabled`]: disabled,
}) })
const events = disabled ? {} : { const events = disabled ? {} : {
click: this.onClick, click: openFileDialogOnClick ? this.onClick : () => {},
keydown: this.onKeyDown, keydown: this.onKeyDown,
drop: this.onFileDrop, drop: this.onFileDrop,
dragover: this.onFileDrop, dragover: this.onFileDrop,
} }
const tagProps = { const tagProps = {
on: { on: {
...events,
...this.$listeners, ...this.$listeners,
...events,
}, },
attrs: { attrs: {
role: 'button', role: 'button',

View File

@ -34,6 +34,7 @@ const uploadProps = {
// onReady: PropTypes.func, // onReady: PropTypes.func,
withCredentials: PropTypes.bool, withCredentials: PropTypes.bool,
supportServerRender: PropTypes.bool, supportServerRender: PropTypes.bool,
openFileDialogOnClick: PropTypes.bool,
} }
export default { export default {
name: 'Upload', name: 'Upload',
@ -53,6 +54,7 @@ export default {
multiple: false, multiple: false,
beforeUpload: empty, beforeUpload: empty,
withCredentials: false, withCredentials: false,
openFileDialogOnClick: true,
}), }),
data () { data () {
return { return {