From 7d32f992838d486ae29ba4db2c4d9ed62afce53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 16 Oct 2019 22:12:52 +0800 Subject: [PATCH 01/68] fix: Add missing typescript define (#19251) * fix: Add missing typescript define * remove withStore * fix lint --- components/table/Table.tsx | 77 ++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index f0cd5e1d98..b03d238dbe 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -1361,45 +1361,42 @@ class Table extends React.Component, TableState> { } } -function withStore( - WrappedComponent: typeof Table, -): React.ComponentClass, keyof WithStore>> { - class Component extends React.Component> { - static Column = Column; - - static ColumnGroup = ColumnGroup; - - store: Store; - - CheckboxPropsCache: CheckboxPropsCache; - - constructor(props: TableProps) { - super(props); - - this.CheckboxPropsCache = {}; - - this.store = createStore({ - selectedRowKeys: getRowSelection(props).selectedRowKeys || [], - selectionDirty: false, - }); - } - - setCheckboxPropsCache = (cache: CheckboxPropsCache) => (this.CheckboxPropsCache = cache); - - render() { - return ( - - {...this.props} - store={this.store} - checkboxPropsCache={this.CheckboxPropsCache} - setCheckboxPropsCache={this.setCheckboxPropsCache} - /> - ); - } - } - return Component; -} - polyfill(Table); -export default withStore(Table); +class StoreTable extends React.Component, keyof WithStore>> { + static displayName = 'withStore(Table)'; + + static Column = Column; + + static ColumnGroup = ColumnGroup; + + store: Store; + + CheckboxPropsCache: CheckboxPropsCache; + + constructor(props: TableProps) { + super(props); + + this.CheckboxPropsCache = {}; + + this.store = createStore({ + selectedRowKeys: getRowSelection(props).selectedRowKeys || [], + selectionDirty: false, + }); + } + + setCheckboxPropsCache = (cache: CheckboxPropsCache) => (this.CheckboxPropsCache = cache); + + render() { + return ( + + {...this.props} + store={this.store} + checkboxPropsCache={this.CheckboxPropsCache} + setCheckboxPropsCache={this.setCheckboxPropsCache} + /> + ); + } +} + +export default StoreTable; From f2e541ade5ad62e74842202c3473165363a24e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=97=E4=BD=A0=E6=98=AF=E5=B0=8F=E7=8C=AB=E5=92=AA?= Date: Thu, 17 Oct 2019 10:24:34 +0800 Subject: [PATCH 02/68] refactor: improve typescript module declare (#19254) * refactor: improve typescript declare * remove rc-progress declare * remove rc-drawer declare * improve site antd module resolve path --- package.json | 1 + tsconfig.json | 5 +++++ tslint.json | 3 --- typings/custom-typings.d.ts | 8 -------- 4 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 tslint.json diff --git a/package.json b/package.json index ae234a6823..3120e4607e 100644 --- a/package.json +++ b/package.json @@ -153,6 +153,7 @@ "@types/raf": "^3.4.0", "@types/react": "^16.9.0", "@types/react-dom": "^16.8.4", + "@types/react-lifecycles-compat": "^3.0.1", "@types/shallowequal": "^1.1.1", "@types/warning": "^3.0.0", "@typescript-eslint/eslint-plugin": "^2.0.0", diff --git a/tsconfig.json b/tsconfig.json index 40f34f5992..850ce0de17 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,10 @@ { "compilerOptions": { + "baseUrl": "./", + "paths": { + "antd": ["components/index.tsx"], + "antd/es/*": ["components/*"] + }, "strictNullChecks": true, "moduleResolution": "node", "esModuleInterop": true, diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 1b61109a69..0000000000 --- a/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./node_modules/@ant-design/tools/lib/tslint.json"] -} diff --git a/typings/custom-typings.d.ts b/typings/custom-typings.d.ts index fc2e3f0ee1..8dc168a5fb 100644 --- a/typings/custom-typings.d.ts +++ b/typings/custom-typings.d.ts @@ -20,16 +20,10 @@ declare module 'rc-cascader'; declare module 'rc-checkbox'; -declare module 'rc-radio'; - declare module 'rc-dropdown'; declare module 'rc-editor-mention'; -declare module 'rc-progress'; - -declare module 'rc-drawer'; - declare module 'rc-tabs*'; declare module 'rc-tree'; @@ -81,6 +75,4 @@ declare module '*.json' { export default value; } -declare module 'react-lifecycles-compat'; - declare module 'react-copy-to-clipboard'; From d6c5e5358e4114a4ce0099fbedbb76f1bdde6fb9 Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Thu, 17 Oct 2019 11:34:16 +0800 Subject: [PATCH 03/68] docs: fix page header API (#19257) --- components/config-provider/index.zh-CN.md | 2 +- components/page-header/index.en-US.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/config-provider/index.zh-CN.md b/components/config-provider/index.zh-CN.md index d607213ba3..fe4560c5d6 100644 --- a/components/config-provider/index.zh-CN.md +++ b/components/config-provider/index.zh-CN.md @@ -44,4 +44,4 @@ return ( | getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | Function(triggerNode) | () => document.body | 3.11.0 | | locale | 语言包配置,语言包可到 [antd/es/locale](http://unpkg.com/antd/es/locale/) 目录下寻找 | object | - | 3.21.0 | | prefixCls | 设置统一样式前缀 | string | ant | 3.12.0 | -| pageHeader | 统一设置 pageHeader 的 type,参考 [pageHeader](<(/components/page-header)>) | { ghost: boolean } | 'true' | 3.24.0 | +| pageHeader | 统一设置 pageHeader 的 ghost,参考 [pageHeader](<(/components/page-header)>) | { ghost: boolean } | 'true' | 3.24.0 | diff --git a/components/page-header/index.en-US.md b/components/page-header/index.en-US.md index 62338f194a..91bca5585d 100644 --- a/components/page-header/index.en-US.md +++ b/components/page-header/index.en-US.md @@ -18,7 +18,7 @@ It can also be used as inter-page navigation when it is needed to make the user | --- | --- | --- | --- | --- | | title | custom title text | ReactNode | - | 3.14.0 | | subTitle | custom subTitle text | ReactNode | - | 3.14.0 | -| type | pageHeader type, will change background color | boolean | true | 3.24.0 | +| ghost | pageHeader type, will change background color | boolean | true | 3.24.0 | | avatar | Avatar next to the title bar | [avatar props](/components/avatar/) | - | 3.22.0 | | backIcon | custom back icon, if false the back icon will not be displayed | ReactNode | `` | 3.14.0 | | tags | Tag list next to title | [Tag](https://ant.design/components/tag-cn/)[] \| [Tag](https://ant.design/components/tag-cn/) | - | 3.14.0 | From 0f83e0a4eeb72ecd34618d6ae0729a4a65329b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Thu, 17 Oct 2019 16:01:46 +0800 Subject: [PATCH 04/68] fix: should work in old version react (#19262) * fix: should work in old version react * update ci config * add version log --- .circleci/config.yml | 13 +++++++++++-- components/table/Table.tsx | 13 ++++++++----- tests/setup.js | 4 ++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a280fde28d..b3a0b805bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,6 +184,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: dist + REACT: 15 test_lib_15: <<: *container_config @@ -196,6 +197,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: lib + REACT: 15 test_es_15: <<: *container_config @@ -208,6 +210,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: es + REACT: 15 test_dom_15: <<: *container_config @@ -216,7 +219,10 @@ jobs: - checkout - *attach_workspace - *install_react - - run: npm test -- -w 1 -u + - run: + command: npm test -- -w 1 -u + environment: + REACT: 15 test_node_15: <<: *container_config @@ -225,7 +231,10 @@ jobs: - checkout - *attach_workspace - *install_react - - run: npm run test-node -- -w 1 -u + - run: + command: npm run test-node -- -w 1 -u + environment: + REACT: 15 check_metadata: <<: *container_config diff --git a/components/table/Table.tsx b/components/table/Table.tsx index b03d238dbe..5a15e011cb 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -239,11 +239,10 @@ class Table extends React.Component, TableState> { row: React.ComponentType; - rcTable: React.RefObject; + rcTable: any; constructor(props: TableProps) { super(props); - this.rcTable = React.createRef(); const { expandedRowRender, columns: columnsProp = [] } = props; @@ -286,6 +285,10 @@ class Table extends React.Component, TableState> { } } + setTableRef = (table: any) => { + this.rcTable = table; + }; + getCheckboxPropsByItem = (item: T, index: number) => { const rowSelection = getRowSelection(this.props); if (!rowSelection.getCheckboxProps) { @@ -535,7 +538,7 @@ class Table extends React.Component, TableState> { generatePopupContainerFunc = (getPopupContainer: TableProps['getPopupContainer']) => { const { scroll } = this.props; - const table = this.rcTable.current; + const table = this.rcTable; if (getPopupContainer) { return getPopupContainer; } @@ -547,7 +550,7 @@ class Table extends React.Component, TableState> { const { scroll } = this.props; if (scroll && scroll.scrollToFirstRowOnChange !== false) { scrollTo(0, { - getContainer: () => this.rcTable.current.bodyTable, + getContainer: () => this.rcTable.bodyTable, }); } }; @@ -1285,7 +1288,7 @@ class Table extends React.Component, TableState> { return ( { From 5bd3d4a33bc1bdb60d8fcc03be2e6bf92505f882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Thu, 17 Oct 2019 20:11:59 +0800 Subject: [PATCH 05/68] docs: Update 3.24.1 changelog (#19270) --- CHANGELOG.en-US.md | 7 +++++++ CHANGELOG.zh-CN.md | 7 +++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 011c4a5f54..f3f9f1a636 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,13 @@ timeline: true --- +## 3.24.1 + +`2019-10-17` + +- 🐞 Fix Table throw `React.createRef is not a function error` in old version of React . [#19262](https://github.com/ant-design/ant-design/pull/19262) +- 🐞 Fix Table TypeScript definition missing Column and ColumnGroup. [#19251](https://github.com/ant-design/ant-design/pull/19251) + ## 3.24.0 `2019-10-16` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index cb7858f2f9..4b6028d3d5 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,13 @@ timeline: true --- +## 3.24.1 + +`2019-10-17` + +- 🐞 修复 Table 在旧版 React 会报 `React.createRef is not a function` 的错误信息。[#19262](https://github.com/ant-design/ant-design/pull/19262) +- 🐞 修复 Table TypeScript 定义丢失 Column 和 ColumnGroup 的问题。[#19251](https://github.com/ant-design/ant-design/pull/19251) + ## 3.24.0 `2019-10-16` diff --git a/package.json b/package.json index 3120e4607e..909da417f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "3.24.0", + "version": "3.24.1", "description": "An enterprise-class UI design language and React components implementation", "keywords": [ "ant", From 07ca5e458b8cd79e05c2e30667201f2ca0d52092 Mon Sep 17 00:00:00 2001 From: Rayron Victor Date: Thu, 17 Oct 2019 13:00:09 -0300 Subject: [PATCH 06/68] Fix: long author name breaks on small screen (#19272) * Fix: long author name breaks on small screen * Update index.less --- components/comment/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/comment/style/index.less b/components/comment/style/index.less index b83a734477..6af4c81b18 100644 --- a/components/comment/style/index.less +++ b/components/comment/style/index.less @@ -32,12 +32,12 @@ &-author { display: flex; + flex-wrap: wrap; justify-content: flex-start; margin-bottom: 4px; font-size: @comment-font-size-base; & > a, & > span { - height: 18px; padding-right: 8px; font-size: @comment-font-size-sm; line-height: 18px; From a31deb7f5d21bb5b96caf234606857b3a21ebb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= Date: Fri, 18 Oct 2019 00:02:04 +0800 Subject: [PATCH 07/68] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=B8=8B=E8=BD=BD=E6=8C=89=E9=92=AE=E4=BC=9A=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E9=A2=84=E8=A7=88=E6=96=B9=E6=B3=95=20(#19268)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复点击下载按钮会执行预览方法 * chore: test * chore: test --- .../__snapshots__/components.test.js.snap | 282 +++++++++--------- components/upload/UploadList.tsx | 53 ++-- .../__snapshots__/uploadlist.test.js.snap | 194 ++++++------ 3 files changed, 265 insertions(+), 264 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 42395b9cc6..6189db3b4c 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -17396,60 +17396,60 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` title="xxx.png" > xxx.png - + + - - - - + + + + + - - - + + + + @@ -17499,60 +17499,60 @@ exports[`ConfigProvider components Upload normal 1`] = ` title="xxx.png" > xxx.png - + + - - - - + + + + + - - - + + + + @@ -17602,60 +17602,60 @@ exports[`ConfigProvider components Upload prefixCls 1`] = ` title="xxx.png" > xxx.png - + + - - - - + + + + + - - - + + + + diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 3b6a77b861..261c890325 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -169,32 +169,33 @@ export default class UploadList extends React.Component { [downloadIcon, removeIcon].filter(x => x).length }`]: true, }); - const preview = file.url ? ( - [ - this.handlePreview(file, e)} - > - {file.name} - , - downloadOrDelete, - ] - ) : ( - this.handlePreview(file, e)} - title={file.name} - > - {file.name} - {downloadOrDelete} - - ); + const preview = file.url + ? [ + this.handlePreview(file, e)} + > + {file.name} + , + downloadOrDelete, + ] + : [ + this.handlePreview(file, e)} + title={file.name} + > + {file.name} + , + downloadOrDelete, + ]; const style: React.CSSProperties = { pointerEvents: 'none', opacity: 0.5, diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index 5f192179fc..b696d2c08e 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -58,35 +58,35 @@ exports[`Upload List handle error 1`] = ` title="foo.png" > foo.png - + + - - - - + + + + @@ -175,35 +175,35 @@ exports[`Upload List should be uploading when upload a file 1`] = ` title="foo.png" > foo.png - + + - - - - + + + + @@ -292,60 +292,60 @@ exports[`Upload List should be uploading when upload a file 2`] = ` title="foo.png" > foo.png - + + - - - - + + + + + - - - + + + + From 3eead25bead761f868a39ea66d28168984bb5a0b Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Fri, 18 Oct 2019 00:09:21 +0100 Subject: [PATCH 08/68] Fix typos in en-US contributing guide (#19277) --- docs/react/contributing.en-US.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/react/contributing.en-US.md b/docs/react/contributing.en-US.md index 14713f7df2..7ead3952f2 100644 --- a/docs/react/contributing.en-US.md +++ b/docs/react/contributing.en-US.md @@ -4,7 +4,7 @@ title: Contributing toc: false --- -The following is a set of guidelines for contributing to Ant Design. Please spend several minutes in reading these guidelines before you create an issue or pull request. +The following is a set of guidelines for contributing to Ant Design. Please spend several minutes reading these guidelines before you create an issue or pull request. ## Code of Conduct @@ -20,15 +20,15 @@ According to our [release schedule](changelog#Release-Schedule), we maintain two ## Bugs -We are using [GitHub Issues](https://github.com/ant-design/ant-design/issues) for bug tracing. The best way to get your bug fixed is using our [issue helper](http://new-issue.ant.design) and provide a reproduction with this [template](https://u.ant.design/codesandbox-repro). +We are using [GitHub Issues](https://github.com/ant-design/ant-design/issues) for bug tracking. The best way to get your bug fixed is using our [issue helper](http://new-issue.ant.design) and provide reproduction steps with this [template](https://u.ant.design/codesandbox-repro). -Before you reporting a bug, please make sure you've searched exists issues, and read our [FAQ](/docs/react/faq). +Before you report a bug, please make sure you've searched exists issues, and read our [FAQ](/docs/react/faq). ## Proposing a Change -If you intend to change the public API or introduce new feature, we also recommend use our [issue helper](http://new-issue.ant.design) to create a feature request issue. +If you intend to change the public API or introduce new feature, we also recommend you use our [issue helper](http://new-issue.ant.design) to create a feature request issue. -If you want to help on new API, please ref [API Naming Rules](https://github.com/ant-design/ant-design/wiki/API-Naming-rules) to name it. +If you want to help on new API, please reference [API Naming Rules](https://github.com/ant-design/ant-design/wiki/API-Naming-rules) to name it. ## Your First Pull Request @@ -48,16 +48,16 @@ The core team is monitoring for pull requests. We will review your pull request **Before submitting a pull request**, please make sure the following is done: -1. Fork the repository and create your branch from [proper branch](#Branch-Organization). +1. Fork the repository and create your branch from the [correct branch](#Branch-Organization). 1. Run `npm install` in the repository root. 1. If you've fixed a bug or added code that should be tested, add tests! 1. Ensure the test suite passes (npm run test). Tip: `npm test -- --watch TestName` is helpful in development. -1. Run `npm test -- -u` to update [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if has). +1. Run `npm test -- -u` to update the [jest snapshots](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if there are any updates). 1. Make sure your code lints (npm run lint). Tip: Lint runs automatically when you `git commit`. Sending a Pull Request to [react-component](https://github.com/react-component/): -Since antd's components are based on react-component, sometimes you may need to send pull request to the corresponding react-component repository. If it's a bugfix pull request, after it's merged, the core team will release a patch release for that component as soon as possible, then you only need to do is reinstalling antd in your project to get the latest patch release. If it's a feature pull request, after it's merged, the core team will release a minor release, then you need raise another pull request to [Ant Design](https://github.com/ant-design/ant-design/) to update dependencies, document and TypeScript interfaces (if needed). +Since antd's components are based on react-component, sometimes you may need to send pull request to the corresponding react-component repository. If it's a bugfix pull request, after it's merged, the core team will release a patch release for that component as soon as possible, then you only need to reinstall antd in your project to get the latest patch release. If it's a feature pull request, after it's merged, the core team will release a minor release, then you need raise another pull request to [Ant Design](https://github.com/ant-design/ant-design/) to update dependencies, document and TypeScript interfaces (if needed). ## Development Workflow From 3f037b6d71e58fccc82b63a10234aa687c96f5ec Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Thu, 17 Oct 2019 19:52:27 +0100 Subject: [PATCH 09/68] Improve types for customRequest prop on Upload component --- components/upload/interface.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index d9b454234d..e1f4c37c08 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -12,6 +12,18 @@ export interface RcFile extends File { readonly webkitRelativePath: string; } +export interface RcCustomRequestOptions { + onProgress: (event: { percent: number }, file: File) => void; + onError: (error: Error) => void; + onSuccess: (response: object, file: File) => void; + data: object; + filename: string; + file: File; + withCredentials: boolean; + action: string; + headers: object; +} + export interface UploadFile { uid: string; size: number; @@ -82,7 +94,7 @@ export interface UploadProps { style?: React.CSSProperties; disabled?: boolean; prefixCls?: string; - customRequest?: (option: object) => void; + customRequest?: (options: RcCustomRequestOptions) => void; withCredentials?: boolean; openFileDialogOnClick?: boolean; locale?: UploadLocale; From 40aca57453aa292f50b8b73efc64de9caa865193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 18 Oct 2019 11:29:34 +0800 Subject: [PATCH 10/68] chore: Remove React function polyfill (#19279) * chore: Remove polyfill * add more skip --- components/table/__tests__/demo.test.js | 2 +- tests/__mocks__/react.js | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 tests/__mocks__/react.js diff --git a/components/table/__tests__/demo.test.js b/components/table/__tests__/demo.test.js index 0366ab5d49..91bc4c403e 100644 --- a/components/table/__tests__/demo.test.js +++ b/components/table/__tests__/demo.test.js @@ -1,5 +1,5 @@ import demoTest from '../../../tests/shared/demoTest'; demoTest('table', { - skip: process.env.REACT === '15' ? ['edit-row', 'drag-sorting'] : [], + skip: process.env.REACT === '15' ? ['edit-row', 'edit-cell', 'drag-sorting'] : [], }); diff --git a/tests/__mocks__/react.js b/tests/__mocks__/react.js deleted file mode 100644 index e68a1a7413..0000000000 --- a/tests/__mocks__/react.js +++ /dev/null @@ -1,18 +0,0 @@ -import createReactContext from '@ant-design/create-react-context/lib/implementation'; - -const React = require.requireActual('react'); - -if (!React.createContext) { - React.createContext = createReactContext; -} - -if (!React.createRef) { - React.createRef = () => { - const ref = function setRef(node) { - ref.current = node; - }; - return ref; - }; -} - -Object.assign(module.exports, React); From b280b633aaa6aebc46847fcf06e984d574922a90 Mon Sep 17 00:00:00 2001 From: shao Date: Fri, 18 Oct 2019 12:57:40 +0800 Subject: [PATCH 11/68] chore: fix compile fail when use cnpm installed --- package.json | 1 - typings/custom-typings.d.ts | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 909da417f5..cbe6080780 100644 --- a/package.json +++ b/package.json @@ -153,7 +153,6 @@ "@types/raf": "^3.4.0", "@types/react": "^16.9.0", "@types/react-dom": "^16.8.4", - "@types/react-lifecycles-compat": "^3.0.1", "@types/shallowequal": "^1.1.1", "@types/warning": "^3.0.0", "@typescript-eslint/eslint-plugin": "^2.0.0", diff --git a/typings/custom-typings.d.ts b/typings/custom-typings.d.ts index 8dc168a5fb..a25c923f7f 100644 --- a/typings/custom-typings.d.ts +++ b/typings/custom-typings.d.ts @@ -76,3 +76,6 @@ declare module '*.json' { } declare module 'react-copy-to-clipboard'; + +// https://github.com/ant-design/ant-design/pull/19254 +declare module 'react-lifecycles-compat'; From 59ec7f3b8f7f912d639d5d0dd64804f18b58e126 Mon Sep 17 00:00:00 2001 From: Olaniyi Philip Ojeyinka Date: Fri, 18 Oct 2019 09:26:07 +0100 Subject: [PATCH 12/68] corrected the typographical error of word 'case' to 'care' (#19290) fix typo --- docs/react/use-with-create-react-app.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/react/use-with-create-react-app.en-US.md b/docs/react/use-with-create-react-app.en-US.md index 6076104fd8..8495940daf 100644 --- a/docs/react/use-with-create-react-app.en-US.md +++ b/docs/react/use-with-create-react-app.en-US.md @@ -88,7 +88,7 @@ Ok, you should now see a blue primary button displayed on the page. Next you can ## Advanced Guides -We are successfully running antd components now but in the real world, there are still lots of problems about antd-demo. For instance, we actually import styles of all components in the project which may be a css bundle size issue (It is OK then if you don't case the gzipped 60kb css file size). +We are successfully running antd components now but in the real world, there are still lots of problems about antd-demo. For instance, we actually import styles of all components in the project which may be a css bundle size issue (It is OK then if you don't care the gzipped 60kb css file size). Now we need to customize the default webpack config. We can achieve that by using [react-app-rewired](https://github.com/timarney/react-app-rewired) which is one of create-react-app's custom config solutions. From 53c55ceaadb78add76b553183f3de28a24e36d96 Mon Sep 17 00:00:00 2001 From: wleven <408493323@qq.com> Date: Fri, 18 Oct 2019 15:27:54 +0800 Subject: [PATCH 13/68] Fix Select Mode Type --- components/select/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index 40b2c98670..648ef332e1 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -54,7 +54,7 @@ export type SelectValue = string | string[] | number | number[] | LabeledValue | export interface SelectProps extends AbstractSelectProps { value?: T; defaultValue?: T; - mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string; + mode?: 'default' | 'multiple' | 'tags' | 'combobox' | undefined; optionLabelProp?: string; firstActiveValue?: string | string[]; onChange?: (value: T, option: React.ReactElement | React.ReactElement[]) => void; From 9cfc151813dacb32170cf70a309ceed9c99c004e Mon Sep 17 00:00:00 2001 From: wleven <408493323@qq.com> Date: Fri, 18 Oct 2019 16:03:02 +0800 Subject: [PATCH 14/68] Fix Select Mode Type --- components/select/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index 648ef332e1..38dea526b0 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -51,10 +51,17 @@ export interface LabeledValue { export type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[]; +export type ModeOptions = + | 'SECRET_COMBOBOX_MODE_DO_NOT_USE' + | 'default' + | 'multiple' + | 'tags' + | 'combobox' + | undefined; export interface SelectProps extends AbstractSelectProps { value?: T; defaultValue?: T; - mode?: 'default' | 'multiple' | 'tags' | 'combobox' | undefined; + mode?: ModeOptions; optionLabelProp?: string; firstActiveValue?: string | string[]; onChange?: (value: T, option: React.ReactElement | React.ReactElement[]) => void; @@ -114,7 +121,7 @@ export default class Select extends React.Component; - static SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; + static SECRET_COMBOBOX_MODE_DO_NOT_USE: ModeOptions = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; static defaultProps = { showSearch: false, From 63feb6860a7c1ca59357b5bead2267371436e9f7 Mon Sep 17 00:00:00 2001 From: wleven <408493323@qq.com> Date: Fri, 18 Oct 2019 16:12:41 +0800 Subject: [PATCH 15/68] Fix Select Mode Type --- components/select/index.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index 38dea526b0..7d7b68fa9b 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -51,17 +51,18 @@ export interface LabeledValue { export type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[]; -export type ModeOptions = - | 'SECRET_COMBOBOX_MODE_DO_NOT_USE' - | 'default' - | 'multiple' - | 'tags' - | 'combobox' - | undefined; +const ModeOptions = tuple( + 'default', + 'multiple', + 'tags', + 'combobox', + 'SECRET_COMBOBOX_MODE_DO_NOT_USE', +); +export type ModeOption = (typeof ModeOptions)[number]; export interface SelectProps extends AbstractSelectProps { value?: T; defaultValue?: T; - mode?: ModeOptions; + mode?: ModeOption; optionLabelProp?: string; firstActiveValue?: string | string[]; onChange?: (value: T, option: React.ReactElement | React.ReactElement[]) => void; @@ -121,7 +122,7 @@ export default class Select extends React.Component; - static SECRET_COMBOBOX_MODE_DO_NOT_USE: ModeOptions = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; + static SECRET_COMBOBOX_MODE_DO_NOT_USE: ModeOption = 'SECRET_COMBOBOX_MODE_DO_NOT_USE'; static defaultProps = { showSearch: false, From 13d219c439b4cb43fb04fdb1ef34827f0130cd18 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Oct 2019 13:46:02 +0800 Subject: [PATCH 16/68] :bug: Fix Table scroll.x max-content not working --- .../__snapshots__/Table.rowSelection.test.js.snap | 4 ++-- .../table/__tests__/__snapshots__/demo.test.js.snap | 12 ++++++------ .../table/__tests__/__snapshots__/empty.test.js.snap | 2 +- components/table/demo/grouping-columns.md | 6 +++--- package.json | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap index 3dcac5d563..99f8d3b433 100644 --- a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap @@ -11,7 +11,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = ` class="ant-spin-container" >
a.age - b.age, }, { @@ -52,7 +52,7 @@ const columns = [ title: 'Street', dataIndex: 'street', key: 'street', - width: 200, + width: 150, }, { title: 'Block', @@ -121,7 +121,7 @@ ReactDOM.render( dataSource={data} bordered size="middle" - scroll={{ x: '130%', y: 240 }} + scroll={{ x: 'calc(700px + 50%)', y: 240 }} />, mountNode, ); diff --git a/package.json b/package.json index cbe6080780..eb04672508 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "rc-slider": "~8.7.1", "rc-steps": "~3.5.0", "rc-switch": "~1.9.0", - "rc-table": "~6.8.6", + "rc-table": "~6.9.3", "rc-tabs": "~9.6.4", "rc-time-picker": "~3.7.1", "rc-tooltip": "~3.7.3", From 8a715d09918eae41d52e84748bed037c2d0b6e42 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Oct 2019 18:50:33 +0800 Subject: [PATCH 17/68] :memo: :clapper: improve grid demo and documentaion --- components/grid/demo/gutter.md | 4 ++++ components/grid/demo/responsive-more.md | 2 +- components/grid/index.en-US.md | 4 ++-- components/grid/index.zh-CN.md | 10 +++++----- site/theme/static/markdown.less | 8 ++++++++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/components/grid/demo/gutter.md b/components/grid/demo/gutter.md index a21fd20128..304c189034 100644 --- a/components/grid/demo/gutter.md +++ b/components/grid/demo/gutter.md @@ -13,6 +13,8 @@ title: 如果需要垂直间距,可以写成数组形式 `[水平间距, 垂直间距]` `[16, { xs: 8, sm: 16, md: 24, lg: 32 }]`。 +> 数组形式垂直间距在 `3.24.0` 之后支持。 + ## en-US You can use the `gutter` property of `Row` as grid spacing, we recommend set it to `(16 + 8n) px`. (`n` stands for natural number.) @@ -21,6 +23,8 @@ You can set it to a object like `{ xs: 8, sm: 16, md: 24, lg: 32 }` for responsi You can use a array to set vertical spacing, `[horizontal, vertical]` `[16, { xs: 8, sm: 16, md: 24, lg: 32 }]`. +> vertical gutter was supported after `3.24.0`. + ```jsx import { Row, Col } from 'antd'; diff --git a/components/grid/demo/responsive-more.md b/components/grid/demo/responsive-more.md index 0274ab1c71..9d2769fe66 100644 --- a/components/grid/demo/responsive-more.md +++ b/components/grid/demo/responsive-more.md @@ -13,7 +13,7 @@ title: ## en-US -`span` `pull` `push` `offset` `order` property can be embedded into `xs` `sm` `md` `lg` `xl` properties to use, where `xs = {6}` is equivalent to `xs = {{span: 6}}`. +`span` `pull` `push` `offset` `order` property can be embedded into `xs` `sm` `md` `lg` `xl` properties to use, where `xs={6}` is equivalent to `xs={{span: 6}}`. ```jsx import { Row, Col } from 'antd'; diff --git a/components/grid/index.en-US.md b/components/grid/index.en-US.md index e50d73bd59..cf36039ac8 100644 --- a/components/grid/index.en-US.md +++ b/components/grid/index.en-US.md @@ -70,7 +70,7 @@ Following is a brief look at how it works: - Establish a set of `column` in the horizontal space defined by `row` (abbreviated col) - Your content elements should be placed directly in the `col`, and only `col` should be placed directly in `row` -- The column grid system is a value of 1-24 to represent its range spans. For example, three columns of equal width can be created by `.col-8` (`span=8`). +- The column grid system is a value of 1-24 to represent its range spans. For example, three columns of equal width can be created by `
`. - If the sum of `col` spans in a `row` are more than 24, then the overflowing `col` as a whole will start a new line arrangement. ## Flex layout @@ -91,7 +91,7 @@ If the Ant Design grid layout component does not meet your needs, you can use th | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | | align | the vertical alignment of the flex layout: `top` `middle` `bottom` | string | `top` | | -| gutter | spacing between grids, could be a number or a object like `{ xs: 8, sm: 16, md: 24}`, or you can use array to make horizontal and vertical spacing work at the same time `[horizontal, vertical]` | number/object/array | 0 | | +| gutter | spacing between grids, could be a number or a object like `{ xs: 8, sm: 16, md: 24}`. or you can use array to make horizontal and vertical spacing work at the same time `[horizontal, vertical]` (supported after `3.24.0`) | number/object/array | 0 | | | justify | horizontal arrangement of the flex layout: `start` `end` `center` `space-around` `space-between` | string | `start` | | | type | layout mode, optional `flex`, [browser support](http://caniuse.com/#search=flex) | string | | | diff --git a/components/grid/index.zh-CN.md b/components/grid/index.zh-CN.md index 2ddb787143..77f67dafd5 100644 --- a/components/grid/index.zh-CN.md +++ b/components/grid/index.zh-CN.md @@ -67,10 +67,10 @@ title: Grid 布局的栅格化系统,我们是基于行(row)和列(col)来定义信息区块的外部框架,以保证页面的每个区域能够稳健地排布起来。下面简单介绍一下它的工作原理: -- 通过`row`在水平方向建立一组`column`(简写 col) -- 你的内容应当放置于`col`内,并且,只有`col`可以作为`row`的直接元素 -- 栅格系统中的列是指 1 到 24 的值来表示其跨越的范围。例如,三个等宽的列可以使用`.col-8`来创建 -- 如果一个`row`中的`col`总和超过 24,那么多余的`col`会作为一个整体另起一行排列 +- 通过 `row` 在水平方向建立一组 `column`(简写 col) +- 你的内容应当放置于 `col` 内,并且,只有 `col` 可以作为 `row` 的直接元素 +- 栅格系统中的列是指 1 到 24 的值来表示其跨越的范围。例如,三个等宽的列可以使用 `` 来创建 +- 如果一个 `row` 中的 `col` 总和超过 24,那么多余的 `col` 会作为一个整体另起一行排列 ## Flex 布局 @@ -90,7 +90,7 @@ Ant Design 的布局组件若不能满足你的需求,你也可以直接使用 | 成员 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | string | `top` | | -| gutter | 栅格间隔,可以写成像素值或支持响应式的对象写法来设置水平间隔 `{ xs: 8, sm: 16, md: 24}`,或者使用数组形式同时设置`[水平间距, 垂直间距]` | number/object/array | 0 | | +| gutter | 栅格间隔,可以写成像素值或支持响应式的对象写法来设置水平间隔 `{ xs: 8, sm: 16, md: 24}`。或者使用数组形式同时设置 `[水平间距, 垂直间距]`(`3.24.0 后支持`)。 | number/object/array | 0 | | | justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | string | `start` | | | type | 布局模式,可选 `flex`,[现代浏览器](http://caniuse.com/#search=flex) 下有效 | string | | | diff --git a/site/theme/static/markdown.less b/site/theme/static/markdown.less index 529f546a75..e80d47ee60 100644 --- a/site/theme/static/markdown.less +++ b/site/theme/static/markdown.less @@ -392,6 +392,14 @@ } } +[id='components-grid-demo-playground'], +[id='components-grid-demo-gutter'] { + > .code-box-demo .ant-row > div { + margin-top: 0; + margin-bottom: 0; + } +} + // For Changelog .markdown ul.ant-timeline { line-height: 2; From cd6ff75ab2848d515b05c33b21e395c896d98242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=A1=E9=91=AB-King?= <45808948@qq.com> Date: Fri, 18 Oct 2019 21:27:36 +0800 Subject: [PATCH 18/68] test: official site checker before publish (#19247) * tweak: official site checker before publish * feat: check site files * fix: diff logic * fix: replace * feat: add site jest test * fix: test case * fix: test * feat: static server test * Update check-site.js * feat: en-US index * fix: lint --- .jest.site.js | 22 +++++++++++ package.json | 7 +++- scripts/check-site.js | 92 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 .jest.site.js create mode 100755 scripts/check-site.js diff --git a/.jest.site.js b/.jest.site.js new file mode 100644 index 0000000000..b58a456e03 --- /dev/null +++ b/.jest.site.js @@ -0,0 +1,22 @@ +const { moduleNameMapper, transformIgnorePatterns } = require('./.jest'); + +// jest config for server render environment +module.exports = { + moduleFileExtensions: ['ts', 'tsx', 'js', 'md'], + moduleNameMapper, + transform: { + '\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', + '\\.js$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor', + '\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor', + '\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor', + }, + testRegex: 'check-site\\.js$', + testEnvironment: 'node', + transformIgnorePatterns, + snapshotSerializers: ['enzyme-to-json/serializer'], + globals: { + 'ts-jest': { + tsConfigFile: './tsconfig.test.json', + }, + }, +}; diff --git a/package.json b/package.json index eb04672508..7ed761a217 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "bundlesize": "bundlesize", "check-commit": "node ./scripts/check-commit.js", "compile": "antd-tools run compile", - "predeploy": "antd-tools run clean && npm run site && cp netlify.toml CNAME _site && cp .circleci/config.yml _site", + "predeploy": "antd-tools run clean && npm run site && cp netlify.toml CNAME _site && cp .circleci/config.yml _site && npm run site:test", "deploy": "bisheng gh-pages --push-only", "deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages", "dist": "antd-tools run dist", @@ -73,7 +73,8 @@ "test": "jest --config .jest.js --no-cache", "test-all": "./scripts/test-all.sh", "test-node": "jest --config .jest.node.js --no-cache", - "tsc": "tsc" + "tsc": "tsc", + "site:test": "jest --config .jest.site.js --cache=false" }, "husky": { "hooks": { @@ -168,6 +169,7 @@ "bisheng-plugin-toc": "^0.4.4", "bundlesize": "^0.18.0", "chalk": "^2.4.2", + "cheerio": "^1.0.0-rc.3", "cross-env": "^6.0.0", "css-split-webpack-plugin": "^0.2.6", "dekko": "^0.2.1", @@ -189,6 +191,7 @@ "fetch-jsonp": "^1.1.3", "full-icu": "^1.3.0", "glob": "^7.1.4", + "http-server": "^0.11.1", "husky": "^3.0.2", "immutability-helper": "^3.0.0", "intersection-observer": "^0.7.0", diff --git a/scripts/check-site.js b/scripts/check-site.js new file mode 100755 index 0000000000..85f66a3cfb --- /dev/null +++ b/scripts/check-site.js @@ -0,0 +1,92 @@ +/* eslint-disable no-await-in-loop */ +/* eslint-disable no-restricted-syntax */ +const fetch = require('node-fetch'); +const { join } = require('path'); +const cheerio = require('cheerio'); +const glob = require('glob'); +const uniq = require('lodash/uniq'); +const { createServer } = require('http-server'); +const zhCN = require('../site/theme/zh-CN'); +const enUS = require('../site/theme/en-US'); + +const components = uniq( + glob + .sync('components/*/*.md', { + ignore: '**/{__tests__,_util,version,index.tsx}', + cwd: join(process.cwd()), + dot: false, + }) + .map(path => path.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, '')), +); + +describe('site test', () => { + let server; + const host = 3000; + const render = async path => { + const resp = await fetch(`http://localhost:${host}${path}`).then(async res => { + const html = await res.text(); + const $ = cheerio.load(html, { decodeEntities: false, recognizeSelfClosing: true }); + return { + html, + status: res.status, + $, + }; + }); + return resp; + }; + const handleComponentName = name => { + const componentMap = { + descriptions: 'description list', + }; + // eslint-disable-next-line no-unused-vars + const [_, componentName] = name.split('/'); + const compName = componentName.toLowerCase().replace('-', ''); + return componentMap[compName] || compName; + }; + + const expectComponent = async component => { + const { status, $ } = await render(`/${component}/`); + expect(status).toBe(200); + expect( + $('.markdown > h1') + .text() + .toLowerCase(), + ).toMatch(handleComponentName(component)); + }; + + beforeAll(() => { + server = createServer({ + root: join(process.cwd(), '_site'), + }); + server.listen(host); + console.log('site static server run: http://localhost:3000'); + }); + + afterAll(() => { + if (server) { + server.close(); + } + }); + + it('Basic Pages en', async () => { + const { status, $ } = await render('/'); + expect($('title').text()).toEqual(`Ant Design - ${enUS.messages['app.home.slogan']}`); + expect(status).toBe(200); + }); + + it('Basic Pages zh', async () => { + const { status, $ } = await render('/index-cn'); + expect($('title').text()).toEqual(`Ant Design - ${zhCN.messages['app.home.slogan']}`); + expect(status).toBe(200); + }); + + for (const component of components) { + it(`Component ${component} zh Page`, async () => { + await expectComponent(component); + }); + + it(`Component ${component} en Page`, async () => { + await expectComponent(component); + }); + } +}); From e7ebf857bd000020dacb367ccd92c153efa11f87 Mon Sep 17 00:00:00 2001 From: Pornpavee Seri-umnuoy <32285805+neung123@users.noreply.github.com> Date: Sat, 19 Oct 2019 13:48:41 +0700 Subject: [PATCH 19/68] fix(#18280): add type [Moment.moment, undefined] to RangePickerValue (#19300) --- components/date-picker/interface.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/date-picker/interface.tsx b/components/date-picker/interface.tsx index 55845ba868..9545baad96 100644 --- a/components/date-picker/interface.tsx +++ b/components/date-picker/interface.tsx @@ -63,6 +63,7 @@ export type RangePickerValue = | undefined[] | [moment.Moment] | [undefined, moment.Moment] + | [moment.Moment, undefined] | [moment.Moment, moment.Moment]; export type RangePickerPresetRange = RangePickerValue | (() => RangePickerValue); From b9b239ec08565879c2a85140ea6caa409e4d86cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Sat, 19 Oct 2019 22:48:13 +0800 Subject: [PATCH 20/68] test: add test case for ref test (#19302) * add test case for ref test * update test case --- .../table/__tests__/Table.filter.test.js | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js index c174a21f43..c0884c167a 100644 --- a/components/table/__tests__/Table.filter.test.js +++ b/components/table/__tests__/Table.filter.test.js @@ -43,7 +43,7 @@ describe('Table.filter', () => { ]; const longData = []; - for(let i = 0; i < 100; i += 1) { + for (let i = 0; i < 100; i += 1) { longData.push({ key: i.toString(), name: 'name', @@ -854,11 +854,13 @@ describe('Table.filter', () => { it('should reset pagination after filter', () => { const handleChange = jest.fn(); - const wrapper = mount(createTable({ - onChange: handleChange, - dataSource: longData, - pagination: true, - })); + const wrapper = mount( + createTable({ + onChange: handleChange, + dataSource: longData, + pagination: true, + }), + ); const dropdownWrapper = getDropdownWrapper(wrapper); dropdownWrapper @@ -883,13 +885,15 @@ describe('Table.filter', () => { it('should keep pagination current after filter', () => { const handleChange = jest.fn(); - const wrapper = mount(createTable({ - onChange: handleChange, - dataSource: longData, - pagination: { - current: 3, - }, - })); + const wrapper = mount( + createTable({ + onChange: handleChange, + dataSource: longData, + pagination: { + current: 3, + }, + }), + ); expect(wrapper.find('.ant-pagination-item-active').text()).toBe('3'); const dropdownWrapper = getDropdownWrapper(wrapper); @@ -912,4 +916,32 @@ describe('Table.filter', () => { ); expect(wrapper.find('.ant-pagination-item-active').text()).toBe('3'); }); + + // https://github.com/ant-design/ant-design/issues/19274 + it('should not crash', () => { + class TestTable extends React.Component { + state = { + cols: [], + }; + + componentDidMount = () => { + this.setState({ + cols: [ + { + title: 'test', + itemKey: 'test', + filterDropdown: 123, + }, + ], + }); + }; + + render = () => { + const { cols } = this.state; + return
; + }; + } + + mount(); + }); }); From ee6f2d34dd569eb057d54bbb3439c214d3bdb9d5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Oct 2019 18:53:21 +0800 Subject: [PATCH 21/68] :sparkles: release 3.24.2 --- CHANGELOG.en-US.md | 13 +++++++++++++ CHANGELOG.zh-CN.md | 13 +++++++++++++ package.json | 4 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index f3f9f1a636..8fa2469a91 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,19 @@ timeline: true --- +## 3.24.2 + +`2019-10-19` + +- 🐞 修复 Table `scroll.x` 设置 `max-content` 无效导致横向滚动消失的问题。[#19284](https://github.com/ant-design/ant-design/pull/19284) +- 🐞 修复 Table 将 `column.filterDropdown` 作为新属性设置时报错的问题。[#19302](https://github.com/ant-design/ant-design/pull/19302) +- 🐞 Fix Upload 点击下载按钮会触发预览的问题。[#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) +- 🐞 修复 Comment 长作者名在小屏幕上破坏布局的问题。[#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) +- Typescript + - 🐞 优化 RangePicker `value` 属性定义。[#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) + - 🐞 优化 Select `mode` 属性定义。[#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) + - 🐞 优化 Upload `customRequest` 属性定义。[#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) + ## 3.24.1 `2019-10-17` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 4b6028d3d5..b0927d6662 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,19 @@ timeline: true --- +## 3.24.2 + +`2019-10-19` + +- 🐞 Fix Table scroll={{ x: 'max-content' }} rendered without scrollbar problem in Chrome. [#19284](https://github.com/ant-design/ant-design/pull/19284) +- 🐞 Fix Table crash when passing `column.filterDropdown` as new prop. [#19302](https://github.com/ant-design/ant-design/pull/19302) +- 🐞 Fix Upload `download` button trigger preview unexpectedly. [#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) +- 🐞 Fix Comment long author name breaks on small screen. [#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) +- Typescript + - 🐞 Improve RangePicker `value` types. [#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) + - 🐞 Improve Select `mode` types. [#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) + - 🐞 Improve Upload `customRequest` types. [#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) + ## 3.24.1 `2019-10-17` diff --git a/package.json b/package.json index 7ed761a217..9fde729e27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "3.24.1", + "version": "3.24.2", "description": "An enterprise-class UI design language and React components implementation", "keywords": [ "ant", @@ -126,7 +126,7 @@ "rc-slider": "~8.7.1", "rc-steps": "~3.5.0", "rc-switch": "~1.9.0", - "rc-table": "~6.9.3", + "rc-table": "~6.9.4", "rc-tabs": "~9.6.4", "rc-time-picker": "~3.7.1", "rc-tooltip": "~3.7.3", From a92c1476e38ad1d0f7fd4f0aae452788bc5ad511 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 19 Oct 2019 23:38:26 +0800 Subject: [PATCH 22/68] :memo: fix wrong changelog --- CHANGELOG.en-US.md | 14 +++++++------- CHANGELOG.zh-CN.md | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 8fa2469a91..6ec3fed40f 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -19,14 +19,14 @@ timeline: true `2019-10-19` -- 🐞 修复 Table `scroll.x` 设置 `max-content` 无效导致横向滚动消失的问题。[#19284](https://github.com/ant-design/ant-design/pull/19284) -- 🐞 修复 Table 将 `column.filterDropdown` 作为新属性设置时报错的问题。[#19302](https://github.com/ant-design/ant-design/pull/19302) -- 🐞 Fix Upload 点击下载按钮会触发预览的问题。[#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) -- 🐞 修复 Comment 长作者名在小屏幕上破坏布局的问题。[#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) +- 🐞 Fix Table scroll={{ x: 'max-content' }} rendered without scrollbar problem in Chrome. [#19284](https://github.com/ant-design/ant-design/pull/19284) +- 🐞 Fix Table crash when passing `column.filterDropdown` as new prop. [#19302](https://github.com/ant-design/ant-design/pull/19302) +- 🐞 Fix Upload `download` button trigger preview unexpectedly. [#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) +- 🐞 Fix Comment long author name breaks on small screen. [#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) - Typescript - - 🐞 优化 RangePicker `value` 属性定义。[#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) - - 🐞 优化 Select `mode` 属性定义。[#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) - - 🐞 优化 Upload `customRequest` 属性定义。[#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) + - 🐞 Improve RangePicker `value` types. [#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) + - 🐞 Improve Select `mode` types. [#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) + - 🐞 Improve Upload `customRequest` types. [#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) ## 3.24.1 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index b0927d6662..c8f63b776a 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -19,14 +19,14 @@ timeline: true `2019-10-19` -- 🐞 Fix Table scroll={{ x: 'max-content' }} rendered without scrollbar problem in Chrome. [#19284](https://github.com/ant-design/ant-design/pull/19284) -- 🐞 Fix Table crash when passing `column.filterDropdown` as new prop. [#19302](https://github.com/ant-design/ant-design/pull/19302) -- 🐞 Fix Upload `download` button trigger preview unexpectedly. [#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) -- 🐞 Fix Comment long author name breaks on small screen. [#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) +- 🐞 修复 Table `scroll.x` 设置 `max-content` 无效导致横向滚动消失的问题。[#19284](https://github.com/ant-design/ant-design/pull/19284) +- 🐞 修复 Table 将 `column.filterDropdown` 作为新属性设置时报错的问题。[#19302](https://github.com/ant-design/ant-design/pull/19302) +- 🐞 Fix Upload 点击下载按钮会触发预览的问题。[#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) +- 🐞 修复 Comment 长作者名在小屏幕上破坏布局的问题。[#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) - Typescript - - 🐞 Improve RangePicker `value` types. [#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) - - 🐞 Improve Select `mode` types. [#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) - - 🐞 Improve Upload `customRequest` types. [#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) + - 🐞 优化 RangePicker `value` 属性定义。[#19300](https://github.com/ant-design/ant-design/pull/19300) [@neung123](https://github.com/neung123) + - 🐞 优化 Select `mode` 属性定义。[#19286](https://github.com/ant-design/ant-design/pull/19286) [@wleven](https://github.com/wleven) + - 🐞 优化 Upload `customRequest` 属性定义。[#19278](https://github.com/ant-design/ant-design/pull/19278) [@broder](https://github.com/broder) ## 3.24.1 From c13b475947f9b72356764a0b96db2afa20037043 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 19 Oct 2019 23:39:10 +0800 Subject: [PATCH 23/68] :memo: update changelog --- CHANGELOG.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 6ec3fed40f..742cddffd7 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -19,7 +19,7 @@ timeline: true `2019-10-19` -- 🐞 Fix Table scroll={{ x: 'max-content' }} rendered without scrollbar problem in Chrome. [#19284](https://github.com/ant-design/ant-design/pull/19284) +- 🐞 Fix Table `scroll={{ x: 'max-content' }}` rendered without scrollbar problem in Chrome. [#19284](https://github.com/ant-design/ant-design/pull/19284) - 🐞 Fix Table crash when passing `column.filterDropdown` as new prop. [#19302](https://github.com/ant-design/ant-design/pull/19302) - 🐞 Fix Upload `download` button trigger preview unexpectedly. [#19268](https://github.com/ant-design/ant-design/pull/19268) [@qq645381995](https://github.com/qq645381995) - 🐞 Fix Comment long author name breaks on small screen. [#19272](https://github.com/ant-design/ant-design/pull/19272) [@rayronvictor](https://github.com/rayronvictor) From 78a1427ec0dae311831ebf932e91fd47c18c0d1f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 20 Oct 2019 15:00:50 +0800 Subject: [PATCH 24/68] :memo: fix home page animation --- site/theme/static/home.less | 4 ++-- site/theme/template/Home/Banner.jsx | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/site/theme/static/home.less b/site/theme/static/home.less index cc34de2efb..f8a3d00c42 100644 --- a/site/theme/static/home.less +++ b/site/theme/static/home.less @@ -66,8 +66,8 @@ width: 54%; min-width: 420px; max-width: 560px; - min-height: 336px; - color: #0d1a26; + min-height: 400px; + color: @home-text-color; > * { will-change: transform; } diff --git a/site/theme/template/Home/Banner.jsx b/site/theme/template/Home/Banner.jsx index 3b06a7d7b6..4a24240039 100644 --- a/site/theme/template/Home/Banner.jsx +++ b/site/theme/template/Home/Banner.jsx @@ -67,7 +67,6 @@ const Banner = ({ isMobile }) => { {!isMobile && ( Date: Sun, 20 Oct 2019 12:48:03 +0800 Subject: [PATCH 25/68] :lipstick: format getGutter code style --- components/grid/row.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/grid/row.tsx b/components/grid/row.tsx index 7565c3343d..a87df7d02f 100644 --- a/components/grid/row.tsx +++ b/components/grid/row.tsx @@ -64,23 +64,23 @@ export default class Row extends React.Component { } getGutter(): [number, number] { - const gutter: [number, number] = [0, 0]; - const { gutter: gutter_setting } = this.props; - - (Array.isArray(gutter_setting) ? gutter_setting : [gutter_setting, 0]).forEach((g, index) => { + const results: [number, number] = [0, 0]; + const { gutter } = this.props; + const { screens } = this.state; + const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, 0]; + normalizedGutter.forEach((g, index) => { if (typeof g === 'object') { for (let i = 0; i < responsiveArray.length; i++) { const breakpoint: Breakpoint = responsiveArray[i]; - if (this.state.screens[breakpoint] && g[breakpoint] !== undefined) { - gutter[index] = g[breakpoint] as number; + if (screens[breakpoint] && g[breakpoint] !== undefined) { + results[index] = g[breakpoint] as number; } } } else { - gutter[index] = g as number; + results[index] = g || 0; } }); - - return gutter; + return results; } renderRow = ({ getPrefixCls }: ConfigConsumerProps) => { From 0d7d837c3f5b75ff8aed1172cb1eb28ec990a33c Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 20 Oct 2019 12:48:39 +0800 Subject: [PATCH 26/68] :bug: fix wrong responsive gutter close #19307 --- components/grid/row.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/grid/row.tsx b/components/grid/row.tsx index a87df7d02f..2d32a3d9f6 100644 --- a/components/grid/row.tsx +++ b/components/grid/row.tsx @@ -74,6 +74,7 @@ export default class Row extends React.Component { const breakpoint: Breakpoint = responsiveArray[i]; if (screens[breakpoint] && g[breakpoint] !== undefined) { results[index] = g[breakpoint] as number; + break; } } } else { From c6efe8c229dd231ab50429f890763e5f9e58c63e Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 20 Oct 2019 14:38:35 +0800 Subject: [PATCH 27/68] :white_check_mark: add test cases --- components/grid/__tests__/index.test.js | 30 +++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/components/grid/__tests__/index.test.js b/components/grid/__tests__/index.test.js index b4da13161a..8945088e00 100644 --- a/components/grid/__tests__/index.test.js +++ b/components/grid/__tests__/index.test.js @@ -35,10 +35,36 @@ describe('Grid', () => { expect(wrapper).toMatchSnapshot(); }); - it('when typeof getGutter is object', () => { + it('when typeof gutter is object', () => { const wrapper = mount(); expect(wrapper.instance().getGutter()).toEqual([8, 0]); - wrapper.unmount(); + }); + + it('when typeof gutter is object array', () => { + const wrapper = mount( + , + ); + expect(wrapper.instance().getGutter()).toEqual([8, 8]); + }); + + it('when typeof gutter is object array in large screen', () => { + const wrapper = mount( + , + ); + wrapper.setState({ + screens: { md: true, lg: true, xl: true }, + }); + expect(wrapper.instance().getGutter()).toEqual([40, 400]); }); it('renders wrapped Col correctly', () => { From a5d2b8542cb373a9fbdf3e771a6e9bc483d78feb Mon Sep 17 00:00:00 2001 From: Rustin-Liu Date: Sun, 20 Oct 2019 16:25:08 +0800 Subject: [PATCH 28/68] add commit lint action description --- docs/react/contributing.en-US.md | 3 ++- docs/react/contributing.zh-CN.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/react/contributing.en-US.md b/docs/react/contributing.en-US.md index 7ead3952f2..d3a96d69a2 100644 --- a/docs/react/contributing.en-US.md +++ b/docs/react/contributing.en-US.md @@ -53,7 +53,8 @@ The core team is monitoring for pull requests. We will review your pull request 1. If you've fixed a bug or added code that should be tested, add tests! 1. Ensure the test suite passes (npm run test). Tip: `npm test -- --watch TestName` is helpful in development. 1. Run `npm test -- -u` to update the [jest snapshots](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and commit these changes as well (if there are any updates). -1. Make sure your code lints (npm run lint). Tip: Lint runs automatically when you `git commit`. +1. Make sure your code lints (npm run lint). Tip: Lint runs automatically when you `git commit` (Use [Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)). + Sending a Pull Request to [react-component](https://github.com/react-component/): diff --git a/docs/react/contributing.zh-CN.md b/docs/react/contributing.zh-CN.md index f5fcd934d4..7ed665b945 100644 --- a/docs/react/contributing.zh-CN.md +++ b/docs/react/contributing.zh-CN.md @@ -53,7 +53,7 @@ Ant Design 团队会关注所有的 pull request,我们会 review 以及合并 3. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试,这很重要。 4. 确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。 5. 运行 `npm test -- -u` 来更新 [jest snapshot](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。 -6. 确保你的代码通过了 lint 检查 `npm run lint`. 小贴士: Lint 会在你 `git commit` 的时候自动运行。 +6. 确保你的代码通过了 lint 检查 `npm run lint`. 小贴士: Lint 会在你 `git commit` 的时候自动运行(通过[Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks))。 给 [react-component](https://github.com/react-component/) 发送 pull request: From 185d2c41e840c26bd581549e9a30fa8ee2ea4f3d Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 20 Oct 2019 19:10:02 +0800 Subject: [PATCH 29/68] :bug: fix small table border radius issue close #19287 --- components/table/style/size.less | 1 + 1 file changed, 1 insertion(+) diff --git a/components/table/style/size.less b/components/table/style/size.less index d554944f2a..12ad76b50e 100644 --- a/components/table/style/size.less +++ b/components/table/style/size.less @@ -102,6 +102,7 @@ .@{table-prefix-cls}-header { background-color: @component-background; + border-radius: @border-radius-base @border-radius-base 0 0; } .@{table-prefix-cls}-placeholder, From 9af3888395ac8624fa62404ef44e3bfe515104e4 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 20 Oct 2019 19:23:38 +0800 Subject: [PATCH 30/68] :bug: fix Menu in Dropdown submenu selected style close #19264 --- components/dropdown/style/index.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/dropdown/style/index.less b/components/dropdown/style/index.less index ff9adc2ead..0ca2918829 100644 --- a/components/dropdown/style/index.less +++ b/components/dropdown/style/index.less @@ -175,6 +175,11 @@ cursor: not-allowed; } } + + // https://github.com/ant-design/ant-design/issues/19264 + &-submenu-selected &-submenu-title { + color: @primary-color; + } } &.slide-down-enter.slide-down-enter-active&-placement-bottomLeft, From 559e56c7f8811acc3deaa6e3519e58a368ef7f15 Mon Sep 17 00:00:00 2001 From: zombiej Date: Mon, 21 Oct 2019 12:01:33 +0800 Subject: [PATCH 31/68] fix: Tree shaking should works on withContext --- components/config-provider/context.ts | 33 ----------- components/config-provider/context.tsx | 78 ++++++++++++++++++++++++++ components/config-provider/index.tsx | 45 --------------- components/drawer/index.tsx | 3 +- components/statistic/Statistic.tsx | 3 +- components/typography/Base.tsx | 3 +- 6 files changed, 84 insertions(+), 81 deletions(-) delete mode 100644 components/config-provider/context.ts create mode 100644 components/config-provider/context.tsx diff --git a/components/config-provider/context.ts b/components/config-provider/context.ts deleted file mode 100644 index da5c29dfbd..0000000000 --- a/components/config-provider/context.ts +++ /dev/null @@ -1,33 +0,0 @@ -import createReactContext from '@ant-design/create-react-context'; -import defaultRenderEmpty, { RenderEmptyHandler } from './renderEmpty'; -import { Locale } from '../locale-provider'; - -export interface CSPConfig { - nonce?: string; -} - -export interface ConfigConsumerProps { - getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; - rootPrefixCls?: string; - getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string; - renderEmpty: RenderEmptyHandler; - csp?: CSPConfig; - autoInsertSpaceInButton?: boolean; - locale?: Locale; - pageHeader?: { - ghost: boolean; - }; -} - -export const ConfigContext = createReactContext({ - // We provide a default function for Context without provider - getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => { - if (customizePrefixCls) return customizePrefixCls; - - return `ant-${suffixCls}`; - }, - - renderEmpty: defaultRenderEmpty, -}); - -export const ConfigConsumer = ConfigContext.Consumer; diff --git a/components/config-provider/context.tsx b/components/config-provider/context.tsx new file mode 100644 index 0000000000..3504a47fae --- /dev/null +++ b/components/config-provider/context.tsx @@ -0,0 +1,78 @@ +import * as React from 'react'; +import createReactContext from '@ant-design/create-react-context'; +import defaultRenderEmpty, { RenderEmptyHandler } from './renderEmpty'; +import { Locale } from '../locale-provider'; + +export interface CSPConfig { + nonce?: string; +} + +export interface ConfigConsumerProps { + getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; + rootPrefixCls?: string; + getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string; + renderEmpty: RenderEmptyHandler; + csp?: CSPConfig; + autoInsertSpaceInButton?: boolean; + locale?: Locale; + pageHeader?: { + ghost: boolean; + }; +} + +export const ConfigContext = createReactContext({ + // We provide a default function for Context without provider + getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => { + if (customizePrefixCls) return customizePrefixCls; + + return `ant-${suffixCls}`; + }, + + renderEmpty: defaultRenderEmpty, +}); + +export const ConfigConsumer = ConfigContext.Consumer; + +// =========================== withConfigConsumer =========================== +// We need define many types here. So let's put in the block region +type IReactComponent

= + | React.StatelessComponent

+ | React.ComponentClass

+ | React.ClassicComponentClass

; + +interface BasicExportProps { + prefixCls?: string; +} + +interface ConsumerConfig { + prefixCls: string; +} + +interface ConstructorProps { + displayName?: string; +} +export function withConfigConsumer(config: ConsumerConfig) { + return function withConfigConsumerFunc( + Component: IReactComponent, + ): React.SFC & ComponentDef { + // Wrap with ConfigConsumer. Since we need compatible with react 15, be care when using ref methods + const SFC = ((props: ExportProps) => ( + + {(configProps: ConfigConsumerProps) => { + const { prefixCls: basicPrefixCls } = config; + const { getPrefixCls } = configProps; + const { prefixCls: customizePrefixCls } = props; + const prefixCls = getPrefixCls(basicPrefixCls, customizePrefixCls); + return ; + }} + + )) as React.SFC & ComponentDef; + + const cons: ConstructorProps = Component.constructor as ConstructorProps; + const name = (cons && cons.displayName) || Component.name || 'Component'; + + SFC.displayName = `withConfigConsumer(${name})`; + + return SFC; + }; +} diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 617b683463..9b35e1b0f5 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -95,49 +95,4 @@ class ConfigProvider extends React.Component { } } -// =========================== withConfigConsumer =========================== -// We need define many types here. So let's put in the block region -type IReactComponent

= - | React.StatelessComponent

- | React.ComponentClass

- | React.ClassicComponentClass

; - -interface BasicExportProps { - prefixCls?: string; -} - -interface ConsumerConfig { - prefixCls: string; -} - -interface ConstructorProps { - displayName?: string; -} - -export function withConfigConsumer(config: ConsumerConfig) { - return function withConfigConsumerFunc( - Component: IReactComponent, - ): React.SFC & ComponentDef { - // Wrap with ConfigConsumer. Since we need compatible with react 15, be care when using ref methods - const SFC = ((props: ExportProps) => ( - - {(configProps: ConfigConsumerProps) => { - const { prefixCls: basicPrefixCls } = config; - const { getPrefixCls } = configProps; - const { prefixCls: customizePrefixCls } = props; - const prefixCls = getPrefixCls(basicPrefixCls, customizePrefixCls); - return ; - }} - - )) as React.SFC & ComponentDef; - - const cons: ConstructorProps = Component.constructor as ConstructorProps; - const name = (cons && cons.displayName) || Component.name || 'Component'; - - SFC.displayName = `withConfigConsumer(${name})`; - - return SFC; - }; -} - export default ConfigProvider; diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 0d178cb191..82b42020e0 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -5,7 +5,8 @@ import classNames from 'classnames'; import omit from 'omit.js'; import warning from '../_util/warning'; import Icon from '../icon'; -import { withConfigConsumer, ConfigConsumerProps } from '../config-provider'; +import { ConfigConsumerProps } from '../config-provider'; +import { withConfigConsumer } from '../config-provider/context'; import { tuple } from '../_util/type'; const DrawerContext = createReactContext(null); diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx index 0ed227ff43..3fcb09bdd5 100644 --- a/components/statistic/Statistic.tsx +++ b/components/statistic/Statistic.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; import classNames from 'classnames'; -import { withConfigConsumer, ConfigConsumerProps } from '../config-provider'; +import { ConfigConsumerProps } from '../config-provider'; +import { withConfigConsumer } from '../config-provider/context'; import StatisticNumber from './Number'; import Countdown from './Countdown'; import { valueType, FormatConfig } from './utils'; diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index df5715d8f6..2f4734f497 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -6,7 +6,8 @@ import findDOMNode from 'rc-util/lib/Dom/findDOMNode'; import copy from 'copy-to-clipboard'; import omit from 'omit.js'; import ResizeObserver from 'rc-resize-observer'; -import { withConfigConsumer, ConfigConsumerProps, configConsumerProps } from '../config-provider'; +import { ConfigConsumerProps, configConsumerProps } from '../config-provider'; +import { withConfigConsumer } from '../config-provider/context'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import warning from '../_util/warning'; import TransButton from '../_util/transButton'; From 6b74a1e9448afecd1424a0031b6f45568dad40f4 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 21 Oct 2019 14:27:24 +0800 Subject: [PATCH 32/68] :white_check_mark: update table snapshot --- .../__tests__/__snapshots__/demo.test.js.snap | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index c28f050f48..b753d18afa 100755 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -4629,21 +4629,25 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = `

@@ -4666,21 +4670,25 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` @@ -4703,21 +4711,25 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` @@ -11703,6 +11715,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` > @@ -11713,6 +11726,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` @@ -11723,6 +11737,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` > @@ -11733,6 +11748,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` @@ -11743,6 +11759,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` > @@ -11753,6 +11770,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` @@ -11763,6 +11781,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` > @@ -11773,6 +11792,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` From 25927c6a414511d80428940decf82853c0ef6fce Mon Sep 17 00:00:00 2001 From: Sagar Jain Date: Mon, 21 Oct 2019 16:37:02 +0530 Subject: [PATCH 33/68] Improve typing of `UploadFile` interface UploadFile interface made generic type so that a user can define a strongly typed response object if needed --- components/upload/interface.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index e1f4c37c08..c80380a6d9 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -24,7 +24,7 @@ export interface RcCustomRequestOptions { headers: object; } -export interface UploadFile { +export interface UploadFile { uid: string; size: number; name: string; @@ -36,7 +36,7 @@ export interface UploadFile { percent?: number; thumbUrl?: string; originFileObj?: File | Blob; - response?: any; + response?: T; error?: any; linkProps?: any; type: string; From bb7eab65446d57ef2daca0865ed560deece05671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 21 Oct 2019 20:23:59 +0800 Subject: [PATCH 34/68] Update CHANGELOG.zh-CN.md --- CHANGELOG.zh-CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index c8f63b776a..e860846503 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1862,7 +1862,7 @@ timeline: true `2018-05-13` - 🐞 修复 `Table` 过滤器和 `Transfer` 复选框无法点击的问题。[#10452](https://github.com/ant-design/ant-design/issues/10452) -- 🐞 修复 `Cascader` 的  `displayRender` 里的链接无法点击的问题。[#10433](https://github.com/ant-design/ant-design/issues/10433) +- 🐞 修复 `Cascader` 的 `displayRender` 里的链接无法点击的问题。[#10433](https://github.com/ant-design/ant-design/issues/10433) - 🐞 修复 `Button` ref 不兼容问题。[#10405](https://github.com/ant-design/ant-design/issues/10405) - 🐞 修复 `Form` 表单项校验位置高度时出现抖动问题。[#10445](https://github.com/ant-design/ant-design/issues/10445) - 🌟 设置 `Layout` 宽度时,允许使用任何的 CSS 单位。[#10479](https://github.com/ant-design/ant-design/pull/10479) @@ -1984,7 +1984,7 @@ timeline: true - 🌟 新增 `defaultExpandParent` 用于在第一次渲染时自动展开父节点。 - 🌟 新增 `disabled` 用于禁用整棵树。 - 🌟 TreeNode 新增 `icon` 用于设置自定义图标。 - - 🌟 优化了 TreeNode 设置 `disabled` 时的  勾选逻辑。 + - 🌟 优化了 TreeNode 设置 `disabled` 时的勾选逻辑。 - 🌟 Anchor 新增 `getContainer` 用于指定内容滚动的容器。 - 🌟 Table 新增 less 变量 `@table-expanded-row-bg`。[#9789](https://github.com/ant-design/ant-design/pull/9789) - 🐞 修复一处 less 语法错误。[#9832](https://github.com/ant-design/ant-design/pull/9832) [@jojoLockLock](https://github.com/jojoLockLock) From b770db4330f1e101274a6cdd2bbd5d15308c25e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 21 Oct 2019 20:27:41 +0800 Subject: [PATCH 35/68] Update CHANGELOG.zh-CN.md --- CHANGELOG.zh-CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index e860846503..bcb32430f1 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1720,7 +1720,7 @@ timeline: true - Upload 组件升级 `rc-upload` 到 `2.5.0` - 🌟 新增 `directory` 属性,支持上传一个文件夹。[#7315](https://github.com/ant-design/ant-design/issues/7315) - 🌟 `action` 属性支持作为一个返回 `Promise` 对象的函数,使用更加灵活。[fd96967](https://github.com/ant-design/ant-design/commit/fd96967c872600b79bb608e9ddf9f8c38814a704) -- Dropdown 增加新特性, 可以做为右键菜单来使用。 +- Dropdown 增加新特性,可以做为右键菜单来使用。 - 🌟 给菜单项的 icon 提供默认的外间距样式。[8e60a59](https://github.com/ant-design/ant-design/commit/8e60a591fd24f644de4f67d69c2210e9270be9cc) - 🌟 触发方式为 `contextMenu` 时自动调整菜单的位置。[16e4260](https://github.com/ant-design/ant-design/commit/16e42601d6772fc0830ee237a1e751a38a118676) - Table 组件升级 `rc-table` 到 `6.2.2`。[f2fddff](https://github.com/ant-design/ant-design/commit/f2fddff3fd0d6b36e8e6d8ee06bfcbcc85ead4f0) @@ -1851,7 +1851,7 @@ timeline: true - 💄 统一 less 的变量命名 [12d3046](https://github.com/ant-design/ant-design/commit/12d3046687a0dcdb51fece08dd2bea64f185cc40) - 💄 微调了 `Dropdown` 的样式 [8e2f72f](https://github.com/ant-design/ant-design/commit/8e2f72ffe0eb300f5997296726b02246bf990c8f) - 💄 现在中文文档的组件会用中文语言包进行演示。[9b17a94](https://github.com/ant-design/ant-design/commit/9b17a943f5d57d40d65041b7b0c247add09d2851) -- 💄 主站主题切换 修改为 `antd-theme-generato` ,感谢 [@mzohaibqc](https://github.com/mzohaibqc) 的工作. +- 💄 主站主题切换 修改为 `antd-theme-generator` ,感谢 [@mzohaibqc](https://github.com/mzohaibqc) 的工作. - TypeScript - 🐞 修复了 `Row` 中 gutter 属性的类型问题 [b7d508e](https://github.com/ant-design/ant-design/commit/b7d508e1662bf20a0cacbe6440a2ce31a65a8a59) - 💄 改进了 `Form` 组件类型 [#10564](https://github.com/ant-design/ant-design/pull/10564) From b919c23d0886800570b0813c052701e81908daae Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 22 Oct 2019 11:13:40 +0800 Subject: [PATCH 36/68] :bug: Fix small table bottom border radius issue https://github.com/ant-design/ant-design/issues/19287#issuecomment-544368967 --- components/table/style/size.less | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/table/style/size.less b/components/table/style/size.less index 12ad76b50e..8aaff11b39 100644 --- a/components/table/style/size.less +++ b/components/table/style/size.less @@ -102,7 +102,7 @@ .@{table-prefix-cls}-header { background-color: @component-background; - border-radius: @border-radius-base @border-radius-base 0 0; + border-radius: @table-border-radius-base @table-border-radius-base 0 0; } .@{table-prefix-cls}-placeholder, @@ -161,4 +161,12 @@ margin: -@table-padding-vertical-sm -@table-padding-horizontal / 2 -@table-padding-vertical-sm - 1px; } + + // https://github.com/ant-design/ant-design/issues/19287#issuecomment-544368967 + &.@{table-prefix-cls}-fixed-header + > .@{table-prefix-cls}-content + > .@{table-prefix-cls}-scroll + > .@{table-prefix-cls}-body { + border-radius: 0 0 @table-border-radius-base @table-border-radius-base; + } } From 884031afcc1e4cf4b6dea7ba25499021bbe5293a Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 22 Oct 2019 11:47:09 +0800 Subject: [PATCH 37/68] :white_check_mark: fix eslint console warning --- scripts/check-site.js | 1 + tests/setup.js | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/check-site.js b/scripts/check-site.js index 85f66a3cfb..493eff142a 100755 --- a/scripts/check-site.js +++ b/scripts/check-site.js @@ -59,6 +59,7 @@ describe('site test', () => { root: join(process.cwd(), '_site'), }); server.listen(host); + // eslint-disable-next-line no-console console.log('site static server run: http://localhost:3000'); }); diff --git a/tests/setup.js b/tests/setup.js index 681162e725..ff229e6365 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,5 +1,6 @@ const React = require('react'); +// eslint-disable-next-line no-console console.log('Current React Version:', React.version); /* eslint-disable global-require */ From 25788e69a8e8cad8cf9c239493293cf24e1b2176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 22 Oct 2019 11:54:03 +0800 Subject: [PATCH 38/68] omit withstore (#19343) --- components/table/Table.tsx | 10 +++++----- components/table/interface.tsx | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 5a15e011cb..fb49eb849e 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -17,6 +17,7 @@ import { flatArray, treeMap, flatFilter, normalizeColumns } from './util'; import scrollTo from '../_util/scrollTo'; import { TableProps, + InternalTableProps, TableSize, TableState, TableComponents, @@ -34,7 +35,6 @@ import { PaginationConfig, PrepareParamsArgumentsReturn, ExpandIconProps, - WithStore, CheckboxPropsCache, } from './interface'; import Pagination from '../pagination'; @@ -133,7 +133,7 @@ function isFiltersChanged(state: TableState, filters: TableStateFilters): return Object.keys(filters).some(columnKey => filters[columnKey] !== state.filters[columnKey]); } -class Table extends React.Component, TableState> { +class Table extends React.Component, TableState> { static propTypes = { dataSource: PropTypes.array, columns: PropTypes.array, @@ -166,7 +166,7 @@ class Table extends React.Component, TableState> { childrenColumnName: 'children', }; - static getDerivedStateFromProps(nextProps: TableProps, prevState: TableState) { + static getDerivedStateFromProps(nextProps: InternalTableProps, prevState: TableState) { const { prevProps } = prevState; const columns = nextProps.columns || normalizeColumns(nextProps.children as React.ReactChildren); @@ -241,7 +241,7 @@ class Table extends React.Component, TableState> { rcTable: any; - constructor(props: TableProps) { + constructor(props: InternalTableProps) { super(props); const { expandedRowRender, columns: columnsProp = [] } = props; @@ -1366,7 +1366,7 @@ class Table extends React.Component, TableState> { polyfill(Table); -class StoreTable extends React.Component, keyof WithStore>> { +class StoreTable extends React.Component> { static displayName = 'withStore(Table)'; static Column = Column; diff --git a/components/table/interface.tsx b/components/table/interface.tsx index 02cb94424f..48fcc91ef4 100644 --- a/components/table/interface.tsx +++ b/components/table/interface.tsx @@ -161,7 +161,7 @@ export interface WithStore { setCheckboxPropsCache: (cache: CheckboxPropsCache) => void; } -export interface TableProps extends WithStore { +export interface TableProps { prefixCls?: string; dropdownPrefixCls?: string; rowSelection?: TableRowSelection; @@ -219,6 +219,8 @@ export interface TableProps extends WithStore { getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; } +export type InternalTableProps = TableProps & WithStore; + export interface TableStateFilters { [key: string]: string[]; } From 6236537d1ddf440301163a1dea235e39b31d19dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 22 Oct 2019 14:15:26 +0800 Subject: [PATCH 39/68] chore: Temporary lock eslint parser version (#19347) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9fde729e27..f7f7bfbf77 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "@types/shallowequal": "^1.1.1", "@types/warning": "^3.0.0", "@typescript-eslint/eslint-plugin": "^2.0.0", - "@typescript-eslint/parser": "^2.0.0", + "@typescript-eslint/parser": "~2.4.0", "@yesmeck/offline-plugin": "^5.0.5", "antd-theme-generator": "^1.1.6", "babel-eslint": "^10.0.1", From b882b8dd2fbdb07fcbbfc6a94829b283955ff8d5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 22 Oct 2019 21:29:17 +0800 Subject: [PATCH 40/68] :bug: Fix `non-boolean attribute` and `unique key` warning close #19303 close #19354 --- components/input/Search.tsx | 31 ++++++++++++------- components/input/demo/align.md | 2 +- components/input/demo/search-input-loading.md | 3 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/components/input/Search.tsx b/components/input/Search.tsx index b2e0603436..1dd00532a6 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -68,7 +68,7 @@ export default class Search extends React.Component { ); } - return ; + return ; }; renderSuffix = (prefixCls: string) => { @@ -80,7 +80,7 @@ export default class Search extends React.Component { if (enterButton) return suffix; - const node = ( + const icon = ( { ); if (suffix) { - let cloneSuffix = suffix; - if (React.isValidElement(cloneSuffix) && !cloneSuffix.key) { - cloneSuffix = React.cloneElement(cloneSuffix, { - key: 'originSuffix', - }); - } - return [cloneSuffix, node]; + return [ + React.isValidElement(suffix) + ? React.cloneElement(suffix, { + key: 'suffix', + }) + : null, + icon, + ]; } - return node; + return icon; }; renderAddonAfter = (prefixCls: string) => { @@ -144,7 +145,14 @@ export default class Search extends React.Component { } if (addonAfter) { - return [button, addonAfter]; + return [ + button, + React.isValidElement(addonAfter) + ? React.cloneElement(addonAfter, { + key: 'addonAfter', + }) + : null, + ]; } return button; @@ -161,6 +169,7 @@ export default class Search extends React.Component { } = this.props; delete (restProps as any).onSearch; + delete (restProps as any).loading; const prefixCls = getPrefixCls('input-search', customizePrefixCls); const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls); diff --git a/components/input/demo/align.md b/components/input/demo/align.md index e0df965ae9..796186c39a 100644 --- a/components/input/demo/align.md +++ b/components/input/demo/align.md @@ -69,7 +69,7 @@ ReactDOM.render( - Ant Design + Ant Design diff --git a/components/input/demo/search-input-loading.md b/components/input/demo/search-input-loading.md index b89989e163..c2c1861e80 100644 --- a/components/input/demo/search-input-loading.md +++ b/components/input/demo/search-input-loading.md @@ -23,7 +23,7 @@ ReactDOM.render(

- +

@@ -33,7 +33,6 @@ ReactDOM.render( placeholder="input search loading with enterButton and addonAfter" loading enterButton - addonAfter="addonAfter" /> , mountNode, From 0604a0959018a2c2339aa9ce6a53b2cf380413a5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 22 Oct 2019 21:33:19 +0800 Subject: [PATCH 41/68] :white_check_mark: update demo and test case --- components/input/__tests__/Search.test.js | 12 + .../__snapshots__/Search.test.js.snap | 247 ++++++++++++++++++ .../__tests__/__snapshots__/demo.test.js.snap | 109 ++------ .../__snapshots__/index.test.js.snap | 3 +- components/input/demo/search-input-loading.md | 10 - 5 files changed, 288 insertions(+), 93 deletions(-) diff --git a/components/input/__tests__/Search.test.js b/components/input/__tests__/Search.test.js index 705506cbf1..14aff06123 100644 --- a/components/input/__tests__/Search.test.js +++ b/components/input/__tests__/Search.test.js @@ -166,4 +166,16 @@ describe('Input.Search', () => { expect(wrapper.render()).toMatchSnapshot(); expect(wrapperWithEnterButton.render()).toMatchSnapshot(); }); + + it('should support addonAfter and suffix for loading', () => { + const wrapper = mount(); + const wrapperWithEnterButton = mount(); + expect(wrapper.render()).toMatchSnapshot(); + expect(wrapperWithEnterButton.render()).toMatchSnapshot(); + }) + + it('should support invalid addonAfter and suffix', () => { + const wrapper = mount(); + expect(wrapper.render()).toMatchSnapshot(); + }) }); diff --git a/components/input/__tests__/__snapshots__/Search.test.js.snap b/components/input/__tests__/__snapshots__/Search.test.js.snap index a5ec6ef6d0..0d0114f6f6 100644 --- a/components/input/__tests__/__snapshots__/Search.test.js.snap +++ b/components/input/__tests__/__snapshots__/Search.test.js.snap @@ -98,6 +98,109 @@ exports[`Input.Search should support addonAfter 2`] = ` `; +exports[`Input.Search should support addonAfter and suffix for loading 1`] = ` + + + + + + suffix + + + + + + + addonAfter + + + +`; + +exports[`Input.Search should support addonAfter and suffix for loading 2`] = ` + + + + + + suffix + + + + + addonAfter + + + +`; + exports[`Input.Search should support custom Button 1`] = ` `; +exports[`Input.Search should support invalid addonAfter and suffix 1`] = ` + + + + + + + + + + + + + +`; + +exports[`Input.Search should support invalid addonAfter and suffix for loading 1`] = ` + + + + + + + + + + + + + +`; + +exports[`Input.Search should support invalid addonAfter and suffix for loading 2`] = ` + + + + + + + + + + + +`; + exports[`Input.Search should support loading 1`] = ` Ant Design +
+ + + +


- - - - suffix - - - - - -
-
@@ -1926,51 +1918,6 @@ exports[`renders ./components/input/demo/search-input-loading.md correctly 1`] =
-
-
- - - - - - addonAfter - - - `; diff --git a/components/input/__tests__/__snapshots__/index.test.js.snap b/components/input/__tests__/__snapshots__/index.test.js.snap index c9bfa9f3dc..81618423cd 100644 --- a/components/input/__tests__/__snapshots__/index.test.js.snap +++ b/components/input/__tests__/__snapshots__/index.test.js.snap @@ -258,7 +258,7 @@ exports[`Input.Search should support suffix 1`] = ` prefixCls="ant-input" suffix={ Array [ - "suffix", + null, - suffix

- -
-
-
-
- , mountNode, ); From f1cd910b4e6ca6f2f6753128f660963b871b7629 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 23 Oct 2019 11:07:22 +0800 Subject: [PATCH 42/68] :white_check_mark: update snapshots --- .../__snapshots__/Search.test.js.snap | 97 ------------------- 1 file changed, 97 deletions(-) diff --git a/components/input/__tests__/__snapshots__/Search.test.js.snap b/components/input/__tests__/__snapshots__/Search.test.js.snap index 0d0114f6f6..501a7f4c96 100644 --- a/components/input/__tests__/__snapshots__/Search.test.js.snap +++ b/components/input/__tests__/__snapshots__/Search.test.js.snap @@ -301,103 +301,6 @@ exports[`Input.Search should support invalid addonAfter and suffix 1`] = `
`; -exports[`Input.Search should support invalid addonAfter and suffix for loading 1`] = ` - - - - - - - - - - - - - -`; - -exports[`Input.Search should support invalid addonAfter and suffix for loading 2`] = ` - - - - - - - - - - - -`; - exports[`Input.Search should support loading 1`] = ` Date: Wed, 23 Oct 2019 11:40:09 +0800 Subject: [PATCH 43/68] :white_check_mark: increase code cov --- components/input/__tests__/Search.test.js | 13 ++-- .../__snapshots__/Search.test.js.snap | 65 ++++++++++++++----- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/components/input/__tests__/Search.test.js b/components/input/__tests__/Search.test.js index 14aff06123..c1fb99ffda 100644 --- a/components/input/__tests__/Search.test.js +++ b/components/input/__tests__/Search.test.js @@ -172,10 +172,15 @@ describe('Input.Search', () => { const wrapperWithEnterButton = mount(); expect(wrapper.render()).toMatchSnapshot(); expect(wrapperWithEnterButton.render()).toMatchSnapshot(); - }) + }); - it('should support invalid addonAfter and suffix', () => { - const wrapper = mount(); + it('should support invalid suffix', () => { + const wrapper = mount(); expect(wrapper.render()).toMatchSnapshot(); - }) + }); + + it('should support invalid addonAfter', () => { + const wrapper = mount(); + expect(wrapper.render()).toMatchSnapshot(); + }); }); diff --git a/components/input/__tests__/__snapshots__/Search.test.js.snap b/components/input/__tests__/__snapshots__/Search.test.js.snap index 501a7f4c96..db5ceff787 100644 --- a/components/input/__tests__/__snapshots__/Search.test.js.snap +++ b/components/input/__tests__/__snapshots__/Search.test.js.snap @@ -254,28 +254,28 @@ exports[`Input.Search should support custom button 1`] = ` `; -exports[`Input.Search should support invalid addonAfter and suffix 1`] = ` +exports[`Input.Search should support invalid addonAfter 1`] = ` + - - - + - + + +`; + +exports[`Input.Search should support invalid suffix 1`] = ` + + + + + + `; From d06b1fa15e9de217f1f6644f3045702ffbd71c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=A1=E9=91=AB-King?= <45808948@qq.com> Date: Wed, 23 Oct 2019 18:00:15 +0800 Subject: [PATCH 44/68] docs: practical projects using Umi UI (#19240) * :memo: practical projects using Umi UI * :memo: docs * :memo: docs * :memo: projects doc --- docs/react/practical-projects.en-US.md | 143 ++++++---------------- docs/react/practical-projects.zh-CN.md | 163 +++++++------------------ 2 files changed, 81 insertions(+), 225 deletions(-) diff --git a/docs/react/practical-projects.en-US.md b/docs/react/practical-projects.en-US.md index 78dc79dd9b..54e1624cbb 100644 --- a/docs/react/practical-projects.en-US.md +++ b/docs/react/practical-projects.en-US.md @@ -7,120 +7,66 @@ In real project development, you might need a data flow solution like Redux or M Dva is a lightweight data flow solution based on Redux. The concept comes from elm. It supports side effects, hot module replacement, dynamic loading, react-native, SSR, etc. It has been widely used in production. -And [umi](http://umijs.org/) is a routing-based framework that supports [next.js-like conventional routing](https://umijs.org/guide/router.html) and various advanced routing functions, such as [routing-level on-demand loading](https://umijs.org/en/plugin/umi-plugin-react.html#dynamicimport). With a complete [plugin system](https://umijs.org/plugin/) that covers every life cycle from source code to build product, umi is able to support various functional extensions and business needs. +And [umi](http://umijs.org/) is a routing-based framework that supports [next.js-like conventional routing](https://umijs.org/guide/router.html) and various advanced routing functions, such as [routing-level on-demand loading](https://umijs.org/en/plugin/umi-plugin-react.html#dynamicimport). With a complete [plugin system](https://umijs.org/plugin/) that covers every life cycle from source code to build product, umi is able to support various functional extensions and business needs; meanwhile [Umi UI](https://umijs.org/guide/umi-ui.html) is provided to enhance the development experience and development efficiency through Visual Aided Programming (VAP). > You may also be interested in [Ant Design Pro](https://pro.ant.design/), an Out-of-box UI solution for enterprise applications based on umi, dva and ant design. -This article will guide you to create a simple application from zero using umi, dva and antd. +This article will guide you to create a simple application from zero using Umi UI, dva and antd. -## Create New App - -First create an empty directory, - -```bash -$ mkdir myapp -$ cd myapp -``` +## Install Umi UI It is recommended to use yarn to create an application and execute the following command. -> If you are using npm, execute `npm create umi` and the effect will be the same. +> If you are using npm, execute `npm install umi -g` and the effect will be the same. ```bash -$ yarn create umi - -yarn create v1.12.0 -[1/4] 🔍 Resolving packages... -[2/4] 🚚 Fetching packages... -[3/4] 🔗 Linking dependencies... -[4/4] 📃 Building fresh packages... - -success Installed "create-umi@0.9.5" with binaries: - - create-umi +$ yarn global add umi +$ umi -v +2.10.4 ``` -Yarn will install the latest version of [create-umi](https://github.com/umijs/create-umi) and then create the app with interactive ui. +Make sure the umi version is above 2.10.0. -Select `app` and press Enter to confirm. +## Create New App -``` -? Select the boilerplate type - ant-design-pro - Create project with an layout-only ant-design-pro boilerplate, use together with umi block. -❯ app - Create project with a simple boilerplate, support typescript. - block - Create a umi block. - library - Create a library with umi. - plugin - Create a umi plugin. -``` - -Select `antd` and `dva` and press Enter to confirm. +Start the app, ```bash - create package.json - create mock/.gitkeep - create src/assets/yay.jpg - create src/layouts/index.css - create src/layouts/index.js - create src/pages/index.css - create src/pages/index.js - create src/global.css - create .gitignore - create .editorconfig - create .env - create .umirc.js - create .eslintrc - create .prettierrc - create .prettierignore - create src/models/.gitkeep - create src/dva.js -✨ File Generate Done -✨ Done in 966.73s. +$ umi ui + +🚀 Starting Umi UI using umi@2.10.4... +🧨 Ready on http://localhost:3000/ ``` -Then install dependencies, +After starting, Umi UI will automatically open the browser, then click `Create Project`, select the path and enter `App name`, as shown below. -```bash -$ yarn -``` + -Then start the app, +Click `Next`, select `Basic Template`, select `antd` and `dva` on the technology stack, then click `Finish`. -```bash -$ yarn start -``` + -After a few seconds, you will see the following output, +In the project creation process, wait a few minutes. -```bash - DONE Compiled successfully in 212ms + - App running at: - - Local: http://localhost:8000/ - - Network: http://{{ YourIP }}:8000/ -``` +After creating, go to `Overview` and click on the shortcut entry `Run Dev`. -Open [http://localhost:8000](http://localhost:8000) in your browser, you will see the welcome page of umi. + - +In the task page, click `Start`, + + + +When prompted, open [http://localhost:8000](http://localhost:8000) in your browser, you will see the welcome page of umi. + + ## Integrate antd -After selecting `antd` earlier, antd's dependencies are automatically handled and loaded on demand. You can check the configuration in `.umirc.js` to make sure antd is turned on. +After selecting `antd` earlier, antd's dependencies are automatically handled and loaded on demand. You can check the `Configuration` to make sure antd is turned on. -```js -// ref: https://umijs.org/config/ -export default { - plugins: [ - // ref: https://umijs.org/plugin/umi-plugin-react.html - [ - 'umi-plugin-react', - { - antd: true, - dva: true, - }, - ], - ], -}; -``` + > And if you want to use a fixed version of antd, you can install additional antd dependency in your project, and the antd dependencies declared in package.json will be used first. @@ -152,6 +98,10 @@ As your application grows and you notice you are sharing UI elements between mul Let's create a `ProductList` component that we can use in multiple places to show a list of products. +Click `Open in editor`, + + + Create `src/components/ProductList.js` by typing: ```js @@ -262,28 +212,9 @@ Refresh your browser, you should see the following result: ## Build -Now that we've written our application and verified that it works in development, it's time to get it ready for deployment to our users. To do so, run the following command, +Now that we've written our application and verified that it works in development, it's time to get it ready for deployment to our users. To do so, click `build` in Task page. -```bash -$ npm run build -``` - -After a few seconds, the output should be as follows, - -```bash -> @ build /private/tmp/sorrycc-V0lLrF -> umi build - -[5:01:58 PM] webpack compiled in 11s 615ms - - - DONE Compiled successfully in 11622ms 5:01:58 PM - -File sizes after gzip: - - 340.44 KB dist/umi.js - 17.82 KB dist/umi.css -``` + The `build` command packages up all of the assets that make up your application —— JavaScript, templates, CSS, web fonts, images, and more. Then you can find these files in the `dist/` directory. diff --git a/docs/react/practical-projects.zh-CN.md b/docs/react/practical-projects.zh-CN.md index 006129b45b..375f476b46 100644 --- a/docs/react/practical-projects.zh-CN.md +++ b/docs/react/practical-projects.zh-CN.md @@ -7,120 +7,66 @@ title: 项目实战 [dva](http://dvajs.com/) 是一个基于 Redux 的 轻量级数据流方案,概念来自 elm,支持 side effects、热替换、动态加载、react-native、SSR 等,已在生产环境广泛应用。 -[umi](http://umijs.org/) 则是一个可插拔的企业级 react 应用框架。umi 以路由为基础的,支持[类 next.js 的约定式路由](https://umijs.org/zh/guide/router.html),以及各种进阶的路由功能,并以此进行功能扩展,比如[支持路由级的按需加载](https://umijs.org/zh/plugin/umi-plugin-react.html#dynamicimport)。然后配以完善的[插件体系](https://umijs.org/zh/plugin/),覆盖从源码到构建产物的每个生命周期,支持各种功能扩展和业务需求。 +[umi](http://umijs.org/) 则是一个可插拔的企业级 react 应用框架。umi 以路由为基础的,支持[类 next.js 的约定式路由](https://umijs.org/zh/guide/router.html),以及各种进阶的路由功能,并以此进行功能扩展,比如[支持路由级的按需加载](https://umijs.org/zh/plugin/umi-plugin-react.html#dynamicimport)。然后配以完善的[插件体系](https://umijs.org/zh/plugin/),覆盖从源码到构建产物的每个生命周期,支持各种功能扩展和业务需求,同时提供 [Umi UI](https://umijs.org/zh/guide/umi-ui.html) 通过可视化辅助编程(VAP)提高开发体验和研发效率。 > 你可能也会对 [Ant Design Pro](https://pro.ant.design/) 感兴趣,这是一个基于 umi、dva 和 ant design 的开箱即用的中台前端/设计解决方案。 -本文会引导你使用 umi、dva 和 antd 从 0 开始创建一个简单应用。 +本文会引导你使用 Umi UI、dva 和 antd 从 0 开始创建一个简单应用。 + +## 安装 Umi UI + +推荐使用 yarn 安装 Umi UI,执行以下命令。 + +> 如果你使用 npm,可执行 `npm install umi -g`,效果一致。 + +```bash +$ yarn global add umi +$ umi -v +2.10.4 +``` + +确保 umi 版本在 2.10.0 以上。 ## 创建新应用 -先创建一个空目录, +启动 Umi UI, ```bash -$ mkdir myapp -$ cd myapp +$ umi ui + +🚀 Starting Umi UI using umi@2.10.4... +🧨 Ready on http://localhost:3000/ ``` -推荐使用 yarn 创建应用,执行以下命令, +启动后, Umi UI 会自动打开浏览器,点击 `创建项目`,选择路径并输入 `应用名`,如下图: -> 如果你使用 npm,可执行 `npm create umi`,效果一致。 + -```bash -$ yarn create umi +点击 `下一步`,选择 `基础模板`,技术栈选上 `antd` 和 `dva`,然后点击 `完成`。 -yarn create v1.12.0 -[1/4] 🔍 Resolving packages... -[2/4] 🚚 Fetching packages... -[3/4] 🔗 Linking dependencies... -[4/4] 📃 Building fresh packages... + -success Installed "create-umi@0.9.5" with binaries: - - create-umi -``` +进入到项目创建流程,等待几分钟, -yarn 会先安装最新版的 [create-umi](https://github.com/umijs/create-umi),然后提供交互式的提示来创建应用。 + -选择 `app`, 然后回车确认。 +创建完成后,进入到 `总览`,点击快捷入口 `本地启动`, -``` -? Select the boilerplate type - ant-design-pro - Create project with an layout-only ant-design-pro boilerplate, use together with umi block. -❯ app - Create project with a simple boilerplate, support typescript. - block - Create a umi block. - library - Create a library with umi. - plugin - Create a umi plugin. -``` + -选上 `antd` 和 `dva`,然后回车确认。 +在任务页中,点击 `启动`, -``` - create package.json - create mock/.gitkeep - create src/assets/yay.jpg - create src/layouts/index.css - create src/layouts/index.js - create src/pages/index.css - create src/pages/index.js - create src/global.css - create .gitignore - create .editorconfig - create .env - create .umirc.js - create .eslintrc - create .prettierrc - create .prettierignore - create src/models/.gitkeep - create src/dva.js -✨ File Generate Done -✨ Done in 966.73s. -``` + -然后安装依赖, +按提示,点击 [http://localhost:8000](http://localhost:8000),你会看到 umi 的欢迎界面。 -```bash -$ yarn -``` - -然后启动应用, - -```bash -$ yarn start -``` - -几秒钟后,你会看到以下输出, - -```bash - DONE Compiled successfully in 212ms - - App running at: - - Local: http://localhost:8000/ - - Network: http://{{ YourIP }}:8000/ -``` - -在浏览器里打开 [http://localhost:8000](http://localhost:8000),你会看到 umi 的欢迎界面。 - - + ## 使用 antd -前面选择 antd 之后,会自动处理 antd 的依赖以及按需加载。你可以检查 `.umirc.js` 里的配置,确保 antd 已开启。 +前面选择 antd 之后,会自动处理 antd 的依赖以及按需加载。你可以检查 `配置`,确保 antd 已开启。 -```js -// ref: https://umijs.org/config/ -export default { - plugins: [ - // ref: https://umijs.org/plugin/umi-plugin-react.html - [ - 'umi-plugin-react', - { - antd: true, - dva: true, - }, - ], - ], -}; -``` + > 而如果要使用固定版本的 antd,你可以在项目里安装额外的 antd 依赖,package.json 里声明的 antd 依赖会被优先使用。 @@ -128,16 +74,10 @@ export default { 我们要写个应用来先显示产品列表。首先第一步是创建路由,路由可以想象成是组成应用的不同页面。 -如果你没有 npx,需要先安装他,用于执行 node_modules 下的命令, - -```bash -$ yarn global add npx -``` - 然后通过命令创建 `/products` 路由, ```bash -$ npx umi g page products +$ umi g page products create src/pages/products.js create src/pages/products.css @@ -152,7 +92,11 @@ $ npx umi g page products 我们来编写一个 `ProductList` component,这样就能在不同的地方显示产品列表了。 -新建 `src/components/ProductList.js` 文件: +点击 `在编辑器中打开`, + + + +然后新建 `src/components/ProductList.js` 文件: ```js import { Table, Popconfirm, Button } from 'antd'; @@ -262,30 +206,11 @@ export const dva = { ## 构建应用 -完成开发并且在开发环境验证之后,就需要部署给我们的用户了。先执行下面的命令, +完成开发并且在开发环境验证之后,就需要部署给我们的用户了。点击 `构建`, -```bash -$ npm run build -``` + -几秒后,输出应该如下: - -```bash -> @ build /private/tmp/sorrycc-V0lLrF -> umi build - -[5:01:58 PM] webpack compiled in 11s 615ms - - - DONE Compiled successfully in 11622ms 5:01:58 PM - -File sizes after gzip: - - 340.44 KB dist/umi.js - 17.82 KB dist/umi.css -``` - -build 命令会打包所有的资源,包含 JavaScript, CSS, web fonts, images, html 等。你可以在 `dist/` 目录下找到这些文件。 +构建会打包所有的资源,包含 JavaScript, CSS, web fonts, images, html 等。你可以在 `dist/` 目录下找到这些文件。 ## 下一步 From 2761460c8638270d825e0b60f17eddda12916c22 Mon Sep 17 00:00:00 2001 From: He Linming Date: Thu, 24 Oct 2019 10:36:59 +0800 Subject: [PATCH 45/68] style: add @modal-header-color variable (#19385) * :lipstick: add @modal-header-color variable close #19358 * :ok_hand: change variable name --- components/modal/style/modal.less | 2 +- components/style/themes/default.less | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/modal/style/modal.less b/components/modal/style/modal.less index 47e51e63f5..7159c3ae0b 100644 --- a/components/modal/style/modal.less +++ b/components/modal/style/modal.less @@ -27,7 +27,7 @@ &-title { margin: 0; - color: @heading-color; + color: @modal-heading-color; font-weight: 500; font-size: @font-size-lg; line-height: 22px; diff --git a/components/style/themes/default.less b/components/style/themes/default.less index c480865209..cdba99c527 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -380,6 +380,7 @@ // -- @modal-body-padding: 24px; @modal-header-bg: @component-background; +@modal-heading-color: @heading-color; @modal-footer-bg: transparent; @modal-footer-border-color-split: @border-color-split; @modal-mask-bg: fade(@black, 45%); From d5ad7d7c2fdbb64bffc306c6e8ef1e40ea640181 Mon Sep 17 00:00:00 2001 From: Aidin Date: Thu, 24 Oct 2019 08:55:48 +0200 Subject: [PATCH 46/68] update Types --- components/tree-select/interface.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tree-select/interface.tsx b/components/tree-select/interface.tsx index 34cf3aa01b..57f41edf7b 100644 --- a/components/tree-select/interface.tsx +++ b/components/tree-select/interface.tsx @@ -44,7 +44,7 @@ export interface TreeSelectProps extends AbstractSelect notFoundContent?: React.ReactNode; onChange?: (value: T, label: any, extra: any) => void; onSearch?: (value: any) => void; - onSelect?: (value: any) => void; + onSelect?: (value: any, node: any, extra: any) => void; onTreeExpand?: (keys: Array) => void; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; From d2a8a10667b3e47f81716e0d752d54ac1e323a4f Mon Sep 17 00:00:00 2001 From: Amumu Date: Thu, 24 Oct 2019 20:56:56 +0800 Subject: [PATCH 47/68] chore: :memo: add CODEOWNERS file (#19410) --- CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..a7c62dec7e --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,4 @@ +# CODEOWNERS syntax +# A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files. +# The pattern is followed by one or more GitHub usernames or team names using the standard @username or @org/team-name format. +# You can also refer to a user by an email address that has been added to their GitHub account, for example user@example.com. From 693d5a143490db9616afa689f5984947a9964bd6 Mon Sep 17 00:00:00 2001 From: Aaron Cawte <6383947+aaroncawte@users.noreply.github.com> Date: Fri, 25 Oct 2019 02:56:30 +0100 Subject: [PATCH 48/68] General components doc tweaks (#19416) * Documentation - Button Component * Documentation - Icon Component * Documentation - Typography component --- components/button/index.en-US.md | 8 ++--- components/icon/index.en-US.md | 28 ++++++++-------- components/typography/index.en-US.md | 48 ++++++++++++++-------------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/components/button/index.en-US.md b/components/button/index.en-US.md index 625cf18466..1ec98a1d7c 100644 --- a/components/button/index.en-US.md +++ b/components/button/index.en-US.md @@ -29,15 +29,15 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`. | onClick | set the handler to handle `click` event | (event) => void | - | | | block | option to fit button width to its parent width | boolean | `false` | 3.8.0 | -It accepts all props which native button support. +It accepts all props which native buttons support. ## FAQ -### How to remove space between 2 chinese characters? +### How to remove space between 2 chinese characters -Following Ant Design specification, we will add one space between if Button contains two chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#API) to set `autoInsertSpaceInButton` as `false`. +Following the Ant Design specification, we will add one space between if Button contains two Chinese characters only. If you don't need that, you can use [ConfigProvider](/components/config-provider/#API) to set `autoInsertSpaceInButton` as `false`. -![](https://gw.alipayobjects.com/zos/antfincdn/Hz5HL9gsT4/f29f170d-b78d-4d2b-aa71-0da6a9ead4d9.png) +![Button with two Chinese characters](https://gw.alipayobjects.com/zos/antfincdn/Hz5HL9gsT4/f29f170d-b78d-4d2b-aa71-0da6a9ead4d9.png) diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index 84733d02b8..adc0bbdef4 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -74,10 +74,4 @@ interface Option { | blur() | 移除焦点 | | | focus() | 获取焦点 | | - - > 注意,如果需要获得中国省市区数据,可以参考 [china-division](https://gist.github.com/afc163/7582f35654fd03d5be7009444345ea17)。 diff --git a/components/slider/__tests__/__snapshots__/demo.test.js.snap b/components/slider/__tests__/__snapshots__/demo.test.js.snap index 5050e82983..642fce56b6 100644 --- a/components/slider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/slider/__tests__/__snapshots__/demo.test.js.snap @@ -1032,11 +1032,9 @@ exports[`renders ./components/slider/demo/tip-formatter.md correctly 1`] = ` `; exports[`renders ./components/slider/demo/vertical.md correctly 1`] = ` -
+
+
diff --git a/components/tree-select/__tests__/__snapshots__/demo.test.js.snap b/components/tree-select/__tests__/__snapshots__/demo.test.js.snap index 01b9863e09..ad79807158 100644 --- a/components/tree-select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tree-select/__tests__/__snapshots__/demo.test.js.snap @@ -5,7 +5,7 @@ exports[`renders ./components/tree-select/demo/async.md correctly 1`] = ` aria-haspopup="listbox" class="ant-select ant-select-enabled" role="combobox" - style="width:300px" + style="width:100%" tabindex="0" > ; diff --git a/components/tree-select/demo/multiple.md b/components/tree-select/demo/multiple.md index 44d8674ed3..a94090a095 100644 --- a/components/tree-select/demo/multiple.md +++ b/components/tree-select/demo/multiple.md @@ -32,7 +32,7 @@ class Demo extends React.Component { return ( Date: Tue, 29 Oct 2019 04:26:20 +0100 Subject: [PATCH 66/68] Fix defaultPickerValue in WeekPicker (#19141) --- components/date-picker/WeekPicker.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/date-picker/WeekPicker.tsx b/components/date-picker/WeekPicker.tsx index 92c20dd2d8..4d45a22b9a 100644 --- a/components/date-picker/WeekPicker.tsx +++ b/components/date-picker/WeekPicker.tsx @@ -143,6 +143,7 @@ class WeekPicker extends React.Component { onBlur, id, suffixIcon, + defaultPickerValue, } = this.props; const prefixCls = getPrefixCls('calendar', customizePrefixCls); @@ -170,6 +171,7 @@ class WeekPicker extends React.Component { showToday={false} disabledDate={disabledDate} renderFooter={this.renderFooter} + defaultValue={defaultPickerValue} /> ); const clearIcon = From 2ee2cc33033b4f17d839bd77917f96664ff3ea43 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 29 Oct 2019 11:40:50 +0800 Subject: [PATCH 67/68] :bug: Fix DatePicker throw onEsc error close #19461 --- components/date-picker/wrapPicker.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/date-picker/wrapPicker.tsx b/components/date-picker/wrapPicker.tsx index 0b82e6f86d..a81d9b4f87 100644 --- a/components/date-picker/wrapPicker.tsx +++ b/components/date-picker/wrapPicker.tsx @@ -192,6 +192,7 @@ export default function wrapPicker(Picker: React.ComponentClass, pickerType className={timePickerCls} placeholder={locale.timePickerLocale.placeholder} transitionName="slide-up" + onEsc={() => {}} /> ) : null; From d99d90b1fa7b41ad879a4ede8ec1f840678b505a Mon Sep 17 00:00:00 2001 From: wangweijun0418 <40419952+wangweijun0418@users.noreply.github.com> Date: Wed, 30 Oct 2019 13:15:50 +0800 Subject: [PATCH 68/68] Fix Menu menu collapsed in Chrome (#19476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update index.less 修复margin重合样式问题,(次问题造成menu组件下拉不顺畅) * Update index.less 解决margin重合问题,overflow方式会有副作用,采用padding解决margin重合现象。 --- components/menu/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/menu/style/index.less b/components/menu/style/index.less index b54490842e..b3a43c1fe9 100644 --- a/components/menu/style/index.less +++ b/components/menu/style/index.less @@ -364,7 +364,7 @@ // disable margin collapsed .@{menu-prefix-cls}-submenu { - padding-bottom: 0.01px; + padding-bottom: 0.02px; } .@{menu-prefix-cls}-item:not(:last-child) {
New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park John Brown New York No. 1 Lake Park Jim Green London No. 1 Lake Park Joe Black Sidney No. 1 Lake Park Jim Red London No. 2 Lake Park