Merge branch 'master' into feat-3.10.3

pull/309/head
tangjinzhou 2018-11-27 09:27:11 +08:00
commit 2ff52a4e11
21 changed files with 75 additions and 68 deletions

View File

@ -2,6 +2,14 @@
---
## 1.1.9
`2018-11-26`
- 🐞 Fix the `TreeSelect` component getPopupContainer does not work [#265](https://github.com/vueComponent/ant-design-vue/issues/265)
- 🐞 Fix `Carousel` component on-demand loading does not work [#271](https://github.com/vueComponent/ant-design-vue/issues/271)
- 🐞 Fix `Upload` component remove event no return value problem [#259](https://github.com/vueComponent/ant-design-vue/issues/259)
## 1.1.8
`2018-11-11`

View File

@ -2,6 +2,14 @@
---
## 1.1.9
`2018-11-26`
- 🐞 修复`TreeSelect`组件getPopupContainer不生效问题 [#265](https://github.com/vueComponent/ant-design-vue/issues/265)
- 🐞 修复`Carousel`组件按需加载不生效问题 [#271](https://github.com/vueComponent/ant-design-vue/issues/271)
- 🐞 修复`Upload`组件remove事件无返回值问题 [#259](https://github.com/vueComponent/ant-design-vue/issues/259)
## 1.1.8
`2018-11-11`

View File

@ -28,17 +28,21 @@ export default function wrapWithConnect (WrappedComponent) {
props: {
...props,
__propsSymbol__: Symbol(),
componentWillReceiveProps: { ...props },
children: $slots.default || props.children || [],
},
on: $listeners,
attrs: $attrs,
scopedSlots: $scopedSlots,
}
if (Object.keys($scopedSlots).length) {
wrapProps.scopedSlots = $scopedSlots
}
const slotsKey = Object.keys($slots)
return (
<WrappedComponent {...wrapProps} ref='wrappedInstance'>
{Object.keys($slots).map(name => {
{slotsKey.length ? slotsKey.map(name => {
return <template slot={name}>{$slots[name]}</template>
})}
}) : null}
</WrappedComponent>
)
},

View File

@ -1,8 +1,8 @@
import Vue from 'vue'
import Form from './Form'
import antRefDirective from '../_util/antRefDirective'
import ref from 'vue-ref'
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
export { FormProps, FormCreateOption, ValidationRule } from './Form'
export { FormItemProps } from './FormItem'

View File

@ -124,7 +124,8 @@ export default {
})
},
handleRemove (file) {
Promise.resolve(this.$emit('remove', file)).then(ret => {
const { remove } = getOptionProps(this)
Promise.resolve(typeof remove === 'function' ? remove(file) : remove).then(ret => {
// Prevent removing file
if (ret === false) {
return

View File

@ -291,9 +291,9 @@ describe('Upload List', () => {
defaultFileList: fileList,
listType: 'picture-card',
action: '',
remove: handleRemove,
},
listeners: {
remove: handleRemove,
change: handleChange,
},
slots: {

View File

@ -14,7 +14,7 @@ Upload files manually after `beforeUpload` returns `false`.
<a-upload
action="//jsonplaceholder.typicode.com/posts/"
:fileList="fileList"
@remove="handleRemove"
:remove="handleRemove"
:beforeUpload="beforeUpload"
>
<a-button>

View File

@ -20,13 +20,14 @@
| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon` and `showRemoveIcon` individually | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true |
| supportServerRender | Need to be turned on while the server side is rendering. | boolean | false |
| withCredentials | ajax upload with cookie sent | boolean | false |
| remove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is `false` or a Promise which resolve(false) or reject. | Function(file): `boolean | Promise` | - |
### events
| Events Name | Description | Arguments |
| --- | --- | --- |
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | Function | - |
| preview | A callback function, will be executed when file link or preview icon is clicked. | Function(file) | - |
| remove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is `false` or a Promise which resolve(false) or reject. | Function(file): `boolean | Promise` | - |
### change

View File

@ -20,13 +20,13 @@
| showUploadList | 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon 和 showRemoveIcon | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true |
| supportServerRender | 服务端渲染时需要打开这个 | boolean | false |
| withCredentials | 上传请求时是否携带 cookie | boolean | false |
| remove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象Promise 对象 resolve(false) 或 reject 时不移除。               | Function(file): `boolean | Promise` | 无   |
### 事件
| 事件名称 | 说明 | 回调参数 |
| --- | --- | --- |
| change | 上传文件改变时的状态,详见 [change](#change) | Function | 无 |
| preview | 点击文件链接或预览图标时的回调 | Function(file) | 无 |
| remove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象Promise 对象 resolve(false) 或 reject 时不移除。               | Function(file): `boolean | Promise` | 无   |
### change

View File

@ -69,7 +69,7 @@ export const UploadProps = {
listType: PropsTypes.oneOf(['text', 'picture', 'picture-card']),
// className: PropsTypes.string,
// onPreview: PropsTypes.func,
// onRemove: PropsTypes.func,
remove: PropsTypes.func,
supportServerRender: PropsTypes.bool,
// style: PropsTypes.object,
disabled: PropsTypes.bool,

View File

@ -1,7 +1,7 @@
import classnames from 'classnames'
import Vue from 'vue'
import ref from 'vue-ref'
import BaseMixin from '../../_util/BaseMixin'
import antRefDirective from '../../_util/antRefDirective'
import { initDefaultProps, getEvents } from '../../_util/props-util'
import { cloneElement } from '../../_util/vnode'
import ContainerRender from '../../_util/ContainerRender'
@ -25,7 +25,8 @@ const windowIsUndefined = !(
window.document &&
window.document.createElement
)
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
const Drawer = {
mixins: [BaseMixin],
props: initDefaultProps(drawerProps, {

View File

@ -3,7 +3,8 @@ import createForm from './createForm'
import createFormField from './createFormField'
import formShape from './propTypes'
import Vue from 'vue'
import antRefDirective from '../../_util/antRefDirective'
Vue.use(antRefDirective)
import ref from 'vue-ref'
Vue.use(ref, { name: 'ant-ref' })
export { createFormField, formShape, createForm }

View File

@ -12,9 +12,9 @@ import getTransitionProps from '../_util/getTransitionProps'
import { cloneElement } from '../_util/vnode'
import BaseMixin from '../_util/BaseMixin'
import proxyComponent from '../_util/proxyComponent'
import antRefDirective from '../_util/antRefDirective'
import ref from 'vue-ref'
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
import {
getPropValue,

View File

@ -1,7 +1,7 @@
import debounce from 'lodash/debounce'
import classnames from 'classnames'
import Vue from 'vue'
import antRefDirective from '../../_util/antRefDirective'
import ref from 'vue-ref'
import { getStyle } from '../../_util/props-util'
import BaseMixin from '../../_util/BaseMixin'
import defaultProps from './default-props'
@ -28,7 +28,7 @@ import Dots from './dots'
import { PrevArrow, NextArrow } from './arrows'
import ResizeObserver from 'resize-observer-polyfill'
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
function noop () {}

View File

@ -1,6 +1,6 @@
import json2mq from 'json2mq'
import Vue from 'vue'
import antRefDirective from '../../_util/antRefDirective'
import ref from 'vue-ref'
import BaseMixin from '../../_util/BaseMixin'
import { cloneElement } from '../../_util/vnode'
import { getStyle } from '../../_util/props-util'
@ -9,7 +9,8 @@ import defaultProps from './default-props'
import { canUseDOM } from './utils/innerSliderUtils'
const enquire = canUseDOM() && require('enquire.js')
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
export default {
props: {
...defaultProps,

View File

@ -105,4 +105,5 @@ export const SelectPropTypes = {
notFoundContent: PropTypes.any,
children: PropTypes.any,
autoFocus: PropTypes.bool,
getPopupContainer: PropTypes.func,
}

View File

@ -1,6 +1,6 @@
import Vue from 'vue'
import antRefDirective from '../_util/antRefDirective'
import ref from 'vue-ref'
import PropTypes from '../_util/vue-types'
import contains from '../_util/Dom/contains'
import { hasProp, getComponentFromProp, getEvents, filterEmpty } from '../_util/props-util'
@ -13,7 +13,7 @@ import BaseMixin from '../_util/BaseMixin'
import { cloneElement } from '../_util/vnode'
import ContainerRender from '../_util/ContainerRender'
Vue.use(antRefDirective)
Vue.use(ref, { name: 'ant-ref' })
function returnEmptyString () {
return ''

View File

@ -90,27 +90,17 @@ Create a new file `vue.config.js` in the project directory.
```
// vue.config.js
module.exports = {
configureWebpack: {
module: {
rules: [{
test: /\.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader',
}, {
loader: 'less-loader',
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
javascriptEnabled: true,
},
}],
}],
},
css: {
loaderOptions: {
less: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
javascriptEnabled: true
}
}
}
}
```

View File

@ -92,27 +92,17 @@ module.exports = {
```
// vue.config.js
module.exports = {
configureWebpack: {
module: {
rules: [{
test: /\.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader',
}, {
loader: 'less-loader',
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
javascriptEnabled: true,
},
}],
}],
},
css: {
loaderOptions: {
less: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
},
javascriptEnabled: true
}
}
}
}
```

View File

@ -1,6 +1,6 @@
{
"name": "ant-design-vue",
"version": "1.1.8",
"version": "1.1.9",
"title": "Ant Design Vue",
"description": "An enterprise-class UI design language and Vue-based implementation",
"keywords": [
@ -69,7 +69,7 @@
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^22.4.3",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-import": "^1.1.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
@ -180,6 +180,7 @@
"resize-observer-polyfill": "^1.5.0",
"shallow-equal": "^1.0.0",
"shallowequal": "^1.0.2",
"vue-ref": "^1.0.2",
"warning": "^3.0.0"
}
}

View File

@ -55,7 +55,7 @@ import {
Upload,
// version,
Drawer,
} from 'antd'
} from 'ant-design-vue'
Vue.prototype.$message = message
Vue.prototype.$notification = notification