Merge branch 'master' into antd-3.0

This commit is contained in:
afc163 2017-10-10 14:09:03 +08:00
commit d3b98d311a
13 changed files with 21 additions and 14 deletions

1
.gitignore vendored
View File

@ -32,6 +32,7 @@ config/base.yaml
/.vscode/
/coverage
yarn.lock
package-lock.json
components/**/*.js
components/**/*.jsx
!components/**/__tests__/*.js

View File

@ -40,7 +40,7 @@ Cascade selection box.
| showSearch | Whether show search input in single mode. | boolean\|object | false |
| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' |
| loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - |
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
Fields in `showSearch`:

View File

@ -41,7 +41,7 @@ subtitle: 级联选择
| showSearch | 在选择框中显示搜索框 | boolean | false |
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' |
| loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
`showSearch` 为对象时,其中的字段:

View File

@ -18,7 +18,7 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
|--------------|----------------|----------|--------------|
| trigger | the trigger mode which executes the drop-down action | Array<`click`\|`hover`> | [`hover`] |
| overlay | the dropdown menu | [Menu](/components/menu) | - |
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
| visible | whether the dropdown menu is visible | boolean | - |
| disabled| whether the dropdown menu is disabled| boolean | - |
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function(visible) | - |

View File

@ -19,7 +19,7 @@ title: Dropdown
|-------------|------------------|--------------------|--------------|
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
| overlay | 菜单 | [Menu](/components/menu) | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
| visible | 菜单是否显示 | boolean | - |
| disabled | 菜单是否禁用 | boolean | - |
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |

View File

@ -33,7 +33,7 @@ The properties of config are as follows:
| message | The title of notification box (required) | string\|ReactNode | - |
| description | The content of notification box (required) | string\|ReactNode | - |
| className | Customized CSS class | string | - |
| style | Customized inline style | Object | - |
| style | Customized inline style | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| btn | Customized close button | ReactNode | - |
| icon | Customized icon | ReactNode | - |
| key | The unique identifier of the Notification | string | - |

View File

@ -101,7 +101,7 @@ export interface ArgsProps {
duration?: number;
icon?: React.ReactNode;
placement?: NotificationPlacement;
style?: string;
style?: React.CSSProperties;
prefixCls?: string;
className?: string;
readonly type?: string;

View File

@ -33,7 +33,7 @@ config 参数如下:
| message | 通知提醒标题,必选 | string\|ReactNode | - |
| description | 通知提醒内容,必选 | string\|ReactNode | - |
| className | 自定义 CSS class | string | - |
| style | 自定义内联样式 | Object | - |
| style | 自定义内联样式 | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| btn | 自定义关闭按钮 | ReactNode | - |
| icon | 自定义图标 | ReactNode | - |
| key | 当前通知唯一标志 | string | - |

View File

@ -49,7 +49,7 @@ title: Select
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true
| dropdownStyle | 下拉菜单的 style 属性 | object | - |
| dropdownClassName | 下拉菜单的 className 属性 | string | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 `string` 变为 `{key: string, label: ReactNode}` 的格式 | boolean | false |
| tokenSeparators | 在 tags 和 multiple 模式下自动分词的分隔符 | string[] | |
| firstActiveValue | 默认高亮的选项 | string\|string[] | - |

View File

@ -78,7 +78,7 @@ describe('Table.pagination', () => {
});
// https://github.com/ant-design/ant-design/issues/4532
// http://codepen.io/anon/pen/NdGgga?editors=001
// https://codepen.io/afc163/pen/dVeNoP?editors=001
it('should have pager when change pagination from false to undefined', () => {
const wrapper = mount(createTable({ pagination: false }));
expect(wrapper.find('.ant-pagination')).toHaveLength(0);
@ -88,8 +88,8 @@ describe('Table.pagination', () => {
});
// https://github.com/ant-design/ant-design/issues/4532
// http://codepen.io/anon/pen/ZLbyjV?editors=001
it.only('should display pagination as prop pagination change between true and false', () => {
// https://codepen.io/afc163/pen/pWVRJV?editors=001
it('should display pagination as prop pagination change between true and false', () => {
const wrapper = mount(createTable());
expect(wrapper.find('.ant-pagination')).toHaveLength(1);
expect(wrapper.find('.ant-pagination-item')).toHaveLength(2);

View File

@ -44,7 +44,7 @@ treeNodeLabelProp | Will render as content of select | string | 'title'
treeData | Data of the treeNodes, manual construction work is no longer needed if this property has been set(ensure the Uniqueness of each value) | array<{ value, label, children, [disabled, disableCheckbox, selectable] }> | []
treeDataSimpleMode | Enable simple mode of treeData.(treeData should like this: [{id:1, pId:0, value:'1', label:"test1",...},...], pId is parent node's id) | false\|Array<{ id: string, pId: string, rootPId: null }> | false
loadData | Load data asynchronously. | function(node) | -
getPopupContainer | To set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body
getPopupContainer | To set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body
### TreeNode props

View File

@ -43,7 +43,7 @@ title: TreeSelect
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点value 在整个树范围内唯一)| array<{value, label, children, [disabled, disableCheckbox, selectable]}> | [] |
|treeDataSimpleMode | 使用简单格式的 treeData具体设置参考可设置的类型 (此时 treeData 应变为这样的数据结构: [{id:1, pId:0, value:'1', label:"test1",...},...], `pId` 是父节点的 id) | false\|Array<{ id: string, pId: string, rootPId: null }> | false |
| loadData | 异步加载数据 | function(node) | - |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body |
### TreeNode props

View File

@ -213,12 +213,18 @@ export default class Upload extends React.Component<UploadProps, any> {
}
beforeUpload = (file, fileList) => {
if (this.props.beforeUpload && !this.props.beforeUpload(file, fileList)) {
if (!this.props.beforeUpload) {
return true;
}
const result = this.props.beforeUpload(file, fileList);
if (!result) {
this.onChange({
file,
fileList,
});
return false;
} else if ((result as PromiseLike<any>).then) {
return result;
}
return true;
}