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 ## 1.1.8
`2018-11-11` `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 ## 1.1.8
`2018-11-11` `2018-11-11`

View File

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

View File

@ -1,8 +1,8 @@
import Vue from 'vue' import Vue from 'vue'
import Form from './Form' 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 { FormProps, FormCreateOption, ValidationRule } from './Form'
export { FormItemProps } from './FormItem' export { FormItemProps } from './FormItem'

View File

@ -124,7 +124,8 @@ export default {
}) })
}, },
handleRemove (file) { 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 // Prevent removing file
if (ret === false) { if (ret === false) {
return return

View File

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

View File

@ -14,7 +14,7 @@ Upload files manually after `beforeUpload` returns `false`.
<a-upload <a-upload
action="//jsonplaceholder.typicode.com/posts/" action="//jsonplaceholder.typicode.com/posts/"
:fileList="fileList" :fileList="fileList"
@remove="handleRemove" :remove="handleRemove"
:beforeUpload="beforeUpload" :beforeUpload="beforeUpload"
> >
<a-button> <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 | | 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 | | supportServerRender | Need to be turned on while the server side is rendering. | boolean | false |
| withCredentials | ajax upload with cookie sent | 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
| Events Name | Description | Arguments | | Events Name | Description | Arguments |
| --- | --- | --- | | --- | --- | --- |
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | Function | - | | 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) | - | | 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 ### change

View File

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

View File

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

View File

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

View File

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

View File

@ -12,9 +12,9 @@ import getTransitionProps from '../_util/getTransitionProps'
import { cloneElement } from '../_util/vnode' import { cloneElement } from '../_util/vnode'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
import proxyComponent from '../_util/proxyComponent' 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 { import {
getPropValue, getPropValue,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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