From fb9d0d7372fbdd78de965cc06dc790a1a62fcf28 Mon Sep 17 00:00:00 2001 From: kenve Date: Tue, 24 Apr 2018 23:35:36 +0800 Subject: [PATCH 01/10] fix:add the type declaration of the "key" field (#1367) * fix:add the type declaration of the "key" field * change to a optional property and prettier code --- src/components/GlobalFooter/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/GlobalFooter/index.d.ts b/src/components/GlobalFooter/index.d.ts index 85a9ca65..3fa5c423 100644 --- a/src/components/GlobalFooter/index.d.ts +++ b/src/components/GlobalFooter/index.d.ts @@ -1,6 +1,7 @@ import * as React from 'react'; export interface IGlobalFooterProps { links?: Array<{ + key?: string; title: React.ReactNode; href: string; blankTarget?: boolean; From cac714528b30dc13f405d53b014f10314a234343 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 10:44:35 +0800 Subject: [PATCH 02/10] up version --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b2c4e9ec..573d2dce 100755 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ "dependencies": { "@antv/data-set": "^0.8.0", "@babel/polyfill": "^7.0.0-beta.36", - "antd": "^3.3.0", + "antd": "^3.4.3", "babel-runtime": "^6.9.2", - "bizcharts": "^3.1.3-beta.1", + "bizcharts": "^3.1.5", "bizcharts-plugin-slider": "^2.0.1", "classnames": "^2.2.5", - "dva": "^2.1.0", + "dva": "^2.2.3", "dva-loading": "^1.0.4", "enquire-js": "^0.2.1", "lodash": "^4.17.4", @@ -58,13 +58,13 @@ "enzyme": "^3.1.0", "eslint": "^4.14.0", "eslint-config-airbnb": "^16.0.0", + "eslint-config-prettier": "^2.9.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-compat": "^2.1.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-markdown": "^1.0.0-beta.6", "eslint-plugin-react": "^7.0.1", - "eslint-config-prettier": "^2.9.0", "gh-pages": "^1.0.0", "husky": "^0.14.3", "lint-staged": "^6.0.0", From 4b085757ad49de46ea7ffd1d43845edb08f45bc8 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 18:34:09 +0800 Subject: [PATCH 03/10] fix #1315 ie style error --- src/layouts/UserLayout.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/layouts/UserLayout.less b/src/layouts/UserLayout.less index a6d8df06..c637d098 100644 --- a/src/layouts/UserLayout.less +++ b/src/layouts/UserLayout.less @@ -3,7 +3,8 @@ .container { display: flex; flex-direction: column; - min-height: 100%; + height: 100vh; + overflow: auto; background: #f0f2f5; } From 24333d5c6dbf622653d76d53fcf41f1df1bf8457 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 20:58:28 +0800 Subject: [PATCH 04/10] fix #1287 advanced details page is not displayed in IE11 --- src/components/DescriptionList/index.less | 3 ++- src/components/PageHeader/index.less | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/DescriptionList/index.less b/src/components/DescriptionList/index.less index ebffa55f..bcb6fd1d 100644 --- a/src/components/DescriptionList/index.less +++ b/src/components/DescriptionList/index.less @@ -17,7 +17,8 @@ } .term { - line-height: 22px; + // Line-height is 22px IE dom height will calculate error + line-height: 20px; padding-bottom: 16px; margin-right: 8px; color: @heading-color; diff --git a/src/components/PageHeader/index.less b/src/components/PageHeader/index.less index ae0fddc3..2a8c9a6a 100644 --- a/src/components/PageHeader/index.less +++ b/src/components/PageHeader/index.less @@ -66,7 +66,8 @@ .content, .extraContent, .main { - flex: auto; + // IE auto is no have height + flex: 1; } .title, From 744f5288e47e1955d94cee4397e979dfad77ccf5 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 21:22:35 +0800 Subject: [PATCH 05/10] roadhog-api-doc need transform-decorators-legacy --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 573d2dce..1681813b 100755 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@antv/data-set": "^0.8.0", "@babel/polyfill": "^7.0.0-beta.36", "antd": "^3.4.3", + "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-runtime": "^6.9.2", "bizcharts": "^3.1.5", "bizcharts-plugin-slider": "^2.0.1", @@ -74,7 +75,7 @@ "redbox-react": "^1.5.0", "regenerator-runtime": "^0.11.1", "roadhog": "^2.3.0", - "roadhog-api-doc": "^0.3.4", + "roadhog-api-doc": "^1.0.2", "stylelint": "^8.4.0", "stylelint-config-prettier": "^3.0.4", "stylelint-config-standard": "^18.0.0" From 99715b01154d720ed9a964dcc6d9a09b1b027cd3 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 23:18:16 +0800 Subject: [PATCH 06/10] cover .eslintrc to .eslintrc.js --- .eslintrc | 71 ---------------------------------------------------- .eslintrc.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100755 .eslintrc create mode 100755 .eslintrc.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100755 index c5dda4d7..00000000 --- a/.eslintrc +++ /dev/null @@ -1,71 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": ["airbnb", "prettier"], - "env": { - "browser": true, - "node": true, - "es6": true, - "mocha": true, - "jest": true, - "jasmine": true - }, - "rules": { - "generator-star-spacing": [0], - "consistent-return": [0], - "react/forbid-prop-types": [0], - "react/jsx-filename-extension": [1, { "extensions": [".js"] }], - "global-require": [1], - "import/prefer-default-export": [0], - "react/jsx-no-bind": [0], - "react/prop-types": [0], - "react/prefer-stateless-function": [0], - "react/jsx-wrap-multilines": [ - "error", - { - "declaration": "parens-new-line", - "assignment": "parens-new-line", - "return": "parens-new-line", - "arrow": "parens-new-line", - "condition": "parens-new-line", - "logical": "parens-new-line", - "prop": "ignore" - } - ], - "no-else-return": [0], - "no-restricted-syntax": [0], - "import/no-extraneous-dependencies": [0], - "no-use-before-define": [0], - "jsx-a11y/no-static-element-interactions": [0], - "jsx-a11y/no-noninteractive-element-interactions": [0], - "jsx-a11y/click-events-have-key-events": [0], - "jsx-a11y/anchor-is-valid": [0], - "no-nested-ternary": [0], - "arrow-body-style": [0], - "import/extensions": [0], - "no-bitwise": [0], - "no-cond-assign": [0], - "import/no-unresolved": [0], - "comma-dangle": [ - "error", - { - "arrays": "always-multiline", - "objects": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - "functions": "ignore" - } - ], - "object-curly-newline": [0], - "function-paren-newline": [0], - "no-restricted-globals": [0], - "require-yield": [1] - }, - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "settings": { - "polyfills": ["fetch", "promises"] - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100755 index 00000000..e29c1a8a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,71 @@ +module.exports = { + parser: 'babel-eslint', + extends: ['airbnb', 'prettier'], + env: { + browser: true, + node: true, + es6: true, + mocha: true, + jest: true, + jasmine: true, + }, + rules: { + 'generator-star-spacing': [0], + 'consistent-return': [0], + 'react/forbid-prop-types': [0], + 'react/jsx-filename-extension': [1, { extensions: ['.js'] }], + 'global-require': [1], + 'import/prefer-default-export': [0], + 'react/jsx-no-bind': [0], + 'react/prop-types': [0], + 'react/prefer-stateless-function': [0], + 'react/jsx-wrap-multilines': [ + 'error', + { + declaration: 'parens-new-line', + assignment: 'parens-new-line', + return: 'parens-new-line', + arrow: 'parens-new-line', + condition: 'parens-new-line', + logical: 'parens-new-line', + prop: 'ignore', + }, + ], + 'no-else-return': [0], + 'no-restricted-syntax': [0], + 'import/no-extraneous-dependencies': [0], + 'no-use-before-define': [0], + 'jsx-a11y/no-static-element-interactions': [0], + 'jsx-a11y/no-noninteractive-element-interactions': [0], + 'jsx-a11y/click-events-have-key-events': [0], + 'jsx-a11y/anchor-is-valid': [0], + 'no-nested-ternary': [0], + 'arrow-body-style': [0], + 'import/extensions': [0], + 'no-bitwise': [0], + 'no-cond-assign': [0], + 'import/no-unresolved': [0], + 'comma-dangle': [ + 'error', + { + arrays: 'always-multiline', + objects: 'always-multiline', + imports: 'always-multiline', + exports: 'always-multiline', + functions: 'ignore', + }, + ], + 'object-curly-newline': [0], + 'function-paren-newline': [0], + 'no-restricted-globals': [0], + 'require-yield': [1], + }, + parserOptions: { + ecmaFeatures: { + experimentalObjectRestSpread: true, + }, + }, + settings: { + polyfills: ['fetch', 'promises'], + }, +}; From 7176b4ac74fae1ace1b93f52e018a48813d50b0b Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 25 Apr 2018 23:32:32 +0800 Subject: [PATCH 07/10] fix #1324 Step-Form breadcrumbs path problem --- src/components/PageHeader/index.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index a36fa7f1..993bd57e 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -26,6 +26,18 @@ export default class PageHeader extends PureComponent { location: PropTypes.object, breadcrumbNameMap: PropTypes.object, }; + + state = { + breadcrumb: null, + }; + + componentDidMount() { + this.getBreadcrumbDom(); + } + componentWillReceiveProps() { + this.getBreadcrumbDom(); + } + onChange = key => { if (this.props.onTabChange) { this.props.onTabChange(key); @@ -39,6 +51,12 @@ export default class PageHeader extends PureComponent { breadcrumbNameMap: this.props.breadcrumbNameMap || this.context.breadcrumbNameMap, }; }; + getBreadcrumbDom = () => { + const breadcrumb = this.conversionBreadcrumbList(); + this.setState({ + breadcrumb, + }); + }; // Generated according to props conversionFromProps = () => { const { breadcrumbList, breadcrumbSeparator, linkElement = 'a' } = this.props; @@ -158,8 +176,8 @@ export default class PageHeader extends PureComponent { tabDefaultActiveKey, tabBarExtraContent, } = this.props; + const clsString = classNames(styles.pageHeader, className); - const breadcrumb = this.conversionBreadcrumbList(); const activeKeyProps = {}; if (tabDefaultActiveKey !== undefined) { activeKeyProps.defaultActiveKey = tabDefaultActiveKey; @@ -170,7 +188,7 @@ export default class PageHeader extends PureComponent { return (
- {breadcrumb} + {this.state.breadcrumb}
{logo &&
{logo}
}
From 48ad98c3f12fc8aab83adbfde59dee6efabd061b Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 28 Apr 2018 11:21:06 +0800 Subject: [PATCH 08/10] allow render without currentUser --- src/components/GlobalHeader/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js index 559b876d..10aea499 100644 --- a/src/components/GlobalHeader/index.js +++ b/src/components/GlobalHeader/index.js @@ -57,7 +57,7 @@ export default class GlobalHeader extends PureComponent { } render() { const { - currentUser, + currentUser = {}, collapsed, fetchingNotices, isMobile, From 3df1c08fa02832b9ad1636daadc6db48451813fb Mon Sep 17 00:00:00 2001 From: ZHAO Jinxiang Date: Fri, 27 Apr 2018 21:40:47 +0800 Subject: [PATCH 09/10] add component's name --- src/components/DescriptionList/DescriptionList.js | 4 +++- src/components/Exception/index.js | 4 +++- src/components/GlobalFooter/index.js | 4 +++- src/components/Login/LoginSubmit.js | 4 +++- src/components/NumberInfo/index.js | 4 +++- src/components/SiderMenu/index.js | 4 +++- src/components/StandardFormRow/index.js | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/DescriptionList/DescriptionList.js b/src/components/DescriptionList/DescriptionList.js index 128b0d31..73ba989c 100644 --- a/src/components/DescriptionList/DescriptionList.js +++ b/src/components/DescriptionList/DescriptionList.js @@ -3,7 +3,7 @@ import classNames from 'classnames'; import { Row } from 'antd'; import styles from './index.less'; -export default ({ +const DescriptionList = ({ className, title, col = 3, @@ -27,3 +27,5 @@ export default ({
); }; + +export default DescriptionList; diff --git a/src/components/Exception/index.js b/src/components/Exception/index.js index 4fc813fb..14703e34 100644 --- a/src/components/Exception/index.js +++ b/src/components/Exception/index.js @@ -4,7 +4,7 @@ import { Button } from 'antd'; import config from './typeConfig'; import styles from './index.less'; -export default ({ className, linkElement = 'a', type, title, desc, img, actions, ...rest }) => { +const Exception = ({ className, linkElement = 'a', type, title, desc, img, actions, ...rest }) => { const pageType = type in config ? type : '404'; const clsString = classNames(styles.exception, className); return ( @@ -33,3 +33,5 @@ export default ({ className, linkElement = 'a', type, title, desc, img, actions,
); }; + +export default Exception; diff --git a/src/components/GlobalFooter/index.js b/src/components/GlobalFooter/index.js index 837fe6f9..f5572131 100644 --- a/src/components/GlobalFooter/index.js +++ b/src/components/GlobalFooter/index.js @@ -2,7 +2,7 @@ import React from 'react'; import classNames from 'classnames'; import styles from './index.less'; -export default ({ className, links, copyright }) => { +const GlobalFooter = ({ className, links, copyright }) => { const clsString = classNames(styles.globalFooter, className); return (
@@ -19,3 +19,5 @@ export default ({ className, links, copyright }) => {
); }; + +export default GlobalFooter; diff --git a/src/components/Login/LoginSubmit.js b/src/components/Login/LoginSubmit.js index 8770a973..4aebabf8 100644 --- a/src/components/Login/LoginSubmit.js +++ b/src/components/Login/LoginSubmit.js @@ -5,7 +5,7 @@ import styles from './index.less'; const FormItem = Form.Item; -export default ({ className, ...rest }) => { +const LoginSubmit = ({ className, ...rest }) => { const clsString = classNames(styles.submit, className); return ( @@ -13,3 +13,5 @@ export default ({ className, ...rest }) => { ); }; + +export default LoginSubmit; diff --git a/src/components/NumberInfo/index.js b/src/components/NumberInfo/index.js index afe914a1..cf25d6a0 100644 --- a/src/components/NumberInfo/index.js +++ b/src/components/NumberInfo/index.js @@ -3,7 +3,7 @@ import { Icon } from 'antd'; import classNames from 'classnames'; import styles from './index.less'; -export default ({ theme, title, subTitle, total, subTotal, status, suffix, gap, ...rest }) => ( +const NumberInfo = ({ theme, title, subTitle, total, subTotal, status, suffix, gap, ...rest }) => (
); + +export default NumberInfo; diff --git a/src/components/SiderMenu/index.js b/src/components/SiderMenu/index.js index 640d6ba5..a0dca978 100644 --- a/src/components/SiderMenu/index.js +++ b/src/components/SiderMenu/index.js @@ -3,7 +3,7 @@ import React from 'react'; import DrawerMenu from 'rc-drawer-menu'; import SiderMenu from './SiderMenu'; -export default props => +const SiderMenuWrapper = props => props.isMobile ? ( ) : ( ); + +export default SiderMenuWrapper; diff --git a/src/components/StandardFormRow/index.js b/src/components/StandardFormRow/index.js index ec8ae1dc..8cb0e444 100644 --- a/src/components/StandardFormRow/index.js +++ b/src/components/StandardFormRow/index.js @@ -2,7 +2,7 @@ import React from 'react'; import classNames from 'classnames'; import styles from './index.less'; -export default ({ title, children, last, block, grid, ...rest }) => { +const StandardFormRow = ({ title, children, last, block, grid, ...rest }) => { const cls = classNames(styles.standardFormRow, { [styles.standardFormRowBlock]: block, [styles.standardFormRowLast]: last, @@ -20,3 +20,5 @@ export default ({ title, children, last, block, grid, ...rest }) => {
); }; + +export default StandardFormRow; From df0ffd6d7af3c200567479bfc37bdf23bdf37c2d Mon Sep 17 00:00:00 2001 From: Nikhil Bhargava Date: Fri, 27 Apr 2018 22:43:43 -0400 Subject: [PATCH 10/10] Clean up typescript definitions --- src/components/Charts/ChartCard/index.d.ts | 2 +- src/components/Charts/Pie/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Charts/ChartCard/index.d.ts b/src/components/Charts/ChartCard/index.d.ts index 80fd3762..d174593f 100644 --- a/src/components/Charts/ChartCard/index.d.ts +++ b/src/components/Charts/ChartCard/index.d.ts @@ -2,7 +2,7 @@ import * as React from 'react'; export interface IChartCardProps { title: React.ReactNode; action?: React.ReactNode; - total?: React.ReactNode | function | number; + total?: React.ReactNode | number | (() => React.ReactNode | number); footer?: React.ReactNode; contentHeight?: number; avatar?: React.ReactNode; diff --git a/src/components/Charts/Pie/index.d.ts b/src/components/Charts/Pie/index.d.ts index 5b19208d..46e4600d 100644 --- a/src/components/Charts/Pie/index.d.ts +++ b/src/components/Charts/Pie/index.d.ts @@ -10,7 +10,7 @@ export interface IPieProps { x: string | string; y: number; }>; - total?: string | function; + total?: React.ReactNode | number | (() => React.ReactNode | number); title?: React.ReactNode; tooltip?: boolean; valueFormat?: (value: string) => string | React.ReactNode;