diff --git a/.gitignore b/.gitignore index 805d47bf31..32d99b1d80 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ config/base.yaml /.vscode/ /coverage yarn.lock +package-lock.json components/**/*.js components/**/*.jsx !components/**/__tests__/*.js diff --git a/components/cascader/index.en-US.md b/components/cascader/index.en-US.md index 44128ce488..e71e2ef326 100644 --- a/components/cascader/index.en-US.md +++ b/components/cascader/index.en-US.md @@ -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`: diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index c9350cca90..e6d01ac08f 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -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` 为对象时,其中的字段: diff --git a/components/dropdown/index.en-US.md b/components/dropdown/index.en-US.md index 0de075de35..dcebc4ec7f 100644 --- a/components/dropdown/index.en-US.md +++ b/components/dropdown/index.en-US.md @@ -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) | - | diff --git a/components/dropdown/index.zh-CN.md b/components/dropdown/index.zh-CN.md index dbd2930a5e..867e1a12eb 100644 --- a/components/dropdown/index.zh-CN.md +++ b/components/dropdown/index.zh-CN.md @@ -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) | - | diff --git a/components/notification/index.en-US.md b/components/notification/index.en-US.md index d29799d020..3e76986395 100644 --- a/components/notification/index.en-US.md +++ b/components/notification/index.en-US.md @@ -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 | - | diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 52863e2dc9..0ea5462d43 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -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; diff --git a/components/notification/index.zh-CN.md b/components/notification/index.zh-CN.md index b53bf14897..af471f46fe 100644 --- a/components/notification/index.zh-CN.md +++ b/components/notification/index.zh-CN.md @@ -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 | - | diff --git a/components/select/index.zh-CN.md b/components/select/index.zh-CN.md index 1048200682..e3b7e8662a 100644 --- a/components/select/index.zh-CN.md +++ b/components/select/index.zh-CN.md @@ -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[] | - | diff --git a/components/table/__tests__/Table.pagination.test.js b/components/table/__tests__/Table.pagination.test.js index 97ca2a27b5..6a3ed21437 100644 --- a/components/table/__tests__/Table.pagination.test.js +++ b/components/table/__tests__/Table.pagination.test.js @@ -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); diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md index 4380860152..b08cf26559 100644 --- a/components/tree-select/index.en-US.md +++ b/components/tree-select/index.en-US.md @@ -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 diff --git a/components/tree-select/index.zh-CN.md b/components/tree-select/index.zh-CN.md index fb2da29dd9..40fcf5f944 100644 --- a/components/tree-select/index.zh-CN.md +++ b/components/tree-select/index.zh-CN.md @@ -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 diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 793df6cb4f..b494ae0cff 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -213,12 +213,18 @@ export default class Upload extends React.Component { } 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).then) { + return result; } return true; }