diff --git a/docker/nginx.conf b/docker/nginx.conf index a8e283a641877903fd3e8a31f89b60db65adb28d..5f86992c8fbb8accbb878e6c9c93366d1ab8eb26 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -4,7 +4,7 @@ server { gzip on; gzip_min_length 1k; gzip_comp_level 9; - gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; + gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml; gzip_vary on; gzip_disable "MSIE [1-6]\."; diff --git a/package.json b/package.json index f3b1655bea2c889b4607164617299cf730b7c3e2..2be1673046a66bbdd397d2053a00c4c6f7243737 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "2.1.0", + "version": "2.1.1", "description": "An out-of-box UI solution for enterprise applications", "private": true, "scripts": { @@ -27,10 +27,10 @@ "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build" }, "dependencies": { - "@antv/data-set": "^0.9.6", - "@babel/runtime": "^7.1.2", - "antd": "^3.10.0", - "bizcharts": "^3.2.2", + "@antv/data-set": "^0.10.0", + "@babel/runtime": "^7.1.5", + "antd": "^3.10.7", + "bizcharts": "^3.2.5-beta.4", "bizcharts-plugin-slider": "^2.0.3", "classnames": "^2.2.6", "dva": "^2.4.0", @@ -58,7 +58,7 @@ "devDependencies": { "@types/react": "^16.4.16", "@types/react-dom": "^16.0.9", - "antd-pro-merge-less": "^0.0.9", + "antd-pro-merge-less": "^0.2.0", "antd-theme-webpack-plugin": "^1.1.8", "babel-eslint": "^10.0.1", "cross-env": "^5.1.1", @@ -73,25 +73,25 @@ "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-markdown": "^1.0.0-beta.6", "eslint-plugin-react": "^7.11.1", - "tslint": "^5.10.0", - "tslint-config-prettier": "^1.10.0", - "tslint-react": "^3.6.0", "gh-pages": "^2.0.1", "husky": "^1.1.2", - "lint-staged": "^7.2.0", + "lint-staged": "^8.0.4", "merge-umi-mock-data": "^0.0.3", "mockjs": "^1.0.1-beta3", - "prettier": "1.14.3", + "prettier": "1.15.2", "pro-download": "^1.0.1", "stylelint": "^9.4.0", "stylelint-config-prettier": "^4.0.0", "stylelint-config-standard": "^18.0.0", + "tslint": "^5.10.0", + "tslint-config-prettier": "^1.10.0", + "tslint-react": "^3.6.0", "umi": "^2.2.1", "umi-plugin-ga": "^1.1.3", "umi-plugin-react": "^1.2.0" }, "optionalDependencies": { - "puppeteer": "^1.9.0" + "puppeteer": "^1.10.0" }, "lint-staged": { "**/*.{js,jsx,less}": [ diff --git a/public/favicon.png b/public/favicon.png index cc277683068cf1c96474a0a49f045e147b3a0c84..ece59ce54690c0e1c1e6984ec9dd815645ab4cb8 100644 Binary files a/public/favicon.png and b/public/favicon.png differ diff --git a/src/components/Charts/Field/index.js b/src/components/Charts/Field/index.js index 0f9ace22e466b51926d4e7b369aea0b7edbbc2ff..22dca86c0dd6ede80de52ca7c124afa12fda4a13 100644 --- a/src/components/Charts/Field/index.js +++ b/src/components/Charts/Field/index.js @@ -4,8 +4,8 @@ import styles from './index.less'; const Field = ({ label, value, ...rest }) => (
- {label} - {value} + {label} + {value}
); diff --git a/src/components/Charts/Field/index.less b/src/components/Charts/Field/index.less index aeafbcb886afa0e1c1a7f5d81aba1ce5c065ffe4..170ddc1d85fd4f1e6dd9f909e481341408269c94 100644 --- a/src/components/Charts/Field/index.less +++ b/src/components/Charts/Field/index.less @@ -5,12 +5,13 @@ overflow: hidden; text-overflow: ellipsis; margin: 0; - span { + .label, + .number { font-size: @font-size-base; line-height: 22px; } - span:last-child { - margin-left: 8px; + .number { color: @heading-color; + margin-left: 8px; } } diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index 165869bafb1f4f19e54ffc65056f32ba246975c0..2249211aeaad53652d578c8dc050a60795129b68 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -72,7 +72,7 @@ class Gauge extends React.Component { nice: true, }, }; - const data = [{ value: percent }]; + const data = [{ value: percent / 10 }]; return ( @@ -134,7 +134,7 @@ class Gauge extends React.Component {

${title}

- ${data[0].value}% + ${data[0].value * 10}%

`} /> diff --git a/src/components/Ellipsis/index.d.ts b/src/components/Ellipsis/index.d.ts index 03264aa913346ca00321e922d8a0373047cc8d94..6c95bc0ac35ae92263dcf2262362fa7c389268e7 100644 --- a/src/components/Ellipsis/index.d.ts +++ b/src/components/Ellipsis/index.d.ts @@ -1,6 +1,13 @@ import * as React from 'react'; +import { TooltipProps } from 'antd/lib/tooltip'; + +export interface IEllipsisTooltipProps extends TooltipProps { + title?: undefined; + overlayStyle?: undefined; +} + export interface IEllipsisProps { - tooltip?: boolean; + tooltip?: boolean | IEllipsisTooltipProps; length?: number; lines?: number; style?: React.CSSProperties; diff --git a/src/components/Ellipsis/index.js b/src/components/Ellipsis/index.js index 72fae0528a560cd9f9ab38d1bff54baf55f6786a..de700b74b192b5c634ee88a0fc5533f59a504ab5 100644 --- a/src/components/Ellipsis/index.js +++ b/src/components/Ellipsis/index.js @@ -38,6 +38,14 @@ export const cutStrByFullLength = (str = '', maxLength) => { }, ''); }; +const getTooltip = ({ tooltip, overlayStyle, title, children }) => { + if (tooltip) { + const props = tooltip === true ? { overlayStyle, title } : { ...tooltip, overlayStyle, title }; + return {children}; + } + return children; +}; + const EllipsisText = ({ text, length, tooltip, fullWidthRecognition, ...other }) => { if (typeof text !== 'string') { throw new Error('Ellipsis children must be string.'); @@ -54,23 +62,18 @@ const EllipsisText = ({ text, length, tooltip, fullWidthRecognition, ...other }) displayText = fullWidthRecognition ? cutStrByFullLength(text, length) : text.slice(0, length); } - if (tooltip) { - return ( - - - {displayText} - {tail} - - - ); - } - - return ( - - {displayText} - {tail} - - ); + const spanAttrs = tooltip ? {} : { ...other }; + return getTooltip({ + tooltip, + overlayStyle: TooltipOverlayStyle, + title: text, + children: ( + + {displayText} + {tail} + + ), + }); }; export default class Ellipsis extends Component { @@ -230,13 +233,12 @@ export default class Ellipsis extends Component { ); - return tooltip ? ( - - {node} - - ) : ( - node - ); + return getTooltip({ + tooltip, + overlayStyle: TooltipOverlayStyle, + title: children, + children: node, + }); } const childNode = ( @@ -249,13 +251,12 @@ export default class Ellipsis extends Component { return (
- {tooltip ? ( - - {childNode} - - ) : ( - childNode - )} + {getTooltip({ + tooltip, + overlayStyle: TooltipOverlayStyle, + title: text, + children: childNode, + })}
{children}
diff --git a/src/components/Exception/index.d.ts b/src/components/Exception/index.d.ts index d62c177193d067f19484b3b40b591de7a3ccb86b..a74abb1fa6334cb2b8ef987aab5a1b5dc1f0d531 100644 --- a/src/components/Exception/index.d.ts +++ b/src/components/Exception/index.d.ts @@ -5,7 +5,7 @@ export interface IExceptionProps { desc?: React.ReactNode; img?: string; actions?: React.ReactNode; - linkElement?: React.ReactNode; + linkElement?: string | React.ComponentType; style?: React.CSSProperties; className?: string; backText?: React.ReactNode; diff --git a/src/components/Login/LoginItem.js b/src/components/Login/LoginItem.js index cc32ec1d547a200f3aa32cd671f6305b05b46e47..0f45a7fddee20463eec7014b74928e445cae58f6 100644 --- a/src/components/Login/LoginItem.js +++ b/src/components/Login/LoginItem.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { Form, Input, Button, Row, Col } from 'antd'; +import { formatMessage } from 'umi/locale'; import omit from 'omit.js'; import styles from './index.less'; import ItemMap from './map'; @@ -9,7 +10,8 @@ const FormItem = Form.Item; class WrapFormItem extends Component { static defaultProps = { - buttonText: '获取验证码', + getCaptchaButtonText: formatMessage({ id: 'form.captcha' }), + getCaptchaSecondText: formatMessage({ id: 'form.captcha.second' }), }; constructor(props) { @@ -83,7 +85,8 @@ class WrapFormItem extends Component { defaultValue, rules, name, - buttonText, + getCaptchaButtonText, + getCaptchaSecondText, updateActive, type, ...restProps @@ -108,7 +111,7 @@ class WrapFormItem extends Component { size="large" onClick={this.onGetCaptcha} > - {count ? `${count} s` : buttonText} + {count ? `${count} ${getCaptchaSecondText}` : getCaptchaButtonText} diff --git a/src/components/Login/index.less b/src/components/Login/index.less index 995b68d27a2795e2371a963228e32023fd6d38b2..646b6631d2b771e6f09332e62f310230715e462b 100644 --- a/src/components/Login/index.less +++ b/src/components/Login/index.less @@ -13,6 +13,11 @@ } } + .getCaptcha { + display: block; + width: 100%; + } + .icon { font-size: 24px; color: rgba(0, 0, 0, 0.2); diff --git a/src/components/NoticeIcon/index.zh-CN.md b/src/components/NoticeIcon/index.zh-CN.md index 056e376898b24443331dd70852d66d5cdcc55cf5..3c78dba1132c76ca398cf35572d386c930729630 100644 --- a/src/components/NoticeIcon/index.zh-CN.md +++ b/src/components/NoticeIcon/index.zh-CN.md @@ -21,6 +21,7 @@ popupAlign | 弹出卡片的位置配置 | Object [alignConfig](https://github.c onPopupVisibleChange | 弹出卡片显隐的回调 | function(visible) | - popupVisible | 控制弹层显隐 | boolean | - locale | 默认文案 | Object | `{ emptyText: '暂无数据', clear: '清空' }` +clearClose | 点击清空按钮后关闭通知菜单 | boolean | false ### NoticeIcon.Tab @@ -43,3 +44,4 @@ title | 标题 | ReactNode | - description | 描述信息 | ReactNode | - datetime | 时间戳 | ReactNode | - extra | 额外信息,在列表项右上角 | ReactNode | - +clickClose | 点击列表项关闭通知菜单 | boolean | false diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 2d366b9ba04b3a4bbbae3d014cf5af4aa7e2dd85..e457f2f5b6f12524b26c112302e2e6c0cbe91f67 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -118,7 +118,7 @@ export default class SiderMenu extends PureComponent { mode="inline" handleOpenChange={this.handleOpenChange} onOpenChange={this.handleOpenChange} - style={{ padding: '16px 0', width: '100%', overflowX: 'hidden' }} + style={{ padding: '16px 0', width: '100%' }} {...defaultProps} /> diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index 06d5f6abcea2bffeda660d1a07cb8bb522da52df..7ffba1b1f6479cf29f6f2b4c9312c2a0950c4109 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -21,7 +21,7 @@ vertical-align: middle; font-size: 20px; margin: 0 0 0 12px; - font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif; + font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; font-weight: 600; } } diff --git a/src/components/Trend/index.js b/src/components/Trend/index.js index 1cdceb2eeb67283c8b69cc10dbb8a90592a92393..c476ef62c722f10ca6dcf05c121111f9f91d89db 100644 --- a/src/components/Trend/index.js +++ b/src/components/Trend/index.js @@ -14,7 +14,7 @@ const Trend = ({ colorful = true, reverseColor = false, flag, children, classNam ); return (
- {children} + {children} {flag && ( diff --git a/src/e2e/home.e2e.js b/src/e2e/home.e2e.js index 914ed7c1934eaf4fb2f89d6aee76a5f81470482e..cadac245b6ff2e7fd721b1de5961f6034ad41ef7 100644 --- a/src/e2e/home.e2e.js +++ b/src/e2e/home.e2e.js @@ -3,13 +3,16 @@ import puppeteer from 'puppeteer'; const BASE_URL = `http://localhost:${process.env.PORT || 8000}`; describe('Homepage', () => { + beforeAll(async () => { + jest.setTimeout(1000000); + }); it('it should have logo text', async () => { const browser = await puppeteer.launch({ args: ['--no-sandbox'] }); const page = await browser.newPage(); await page.goto(BASE_URL, { waitUntil: 'networkidle2' }); - await page.waitForSelector('#logo h1'); - const text = await page.evaluate(() => document.body.innerHTML); - expect(text).toContain('

Ant Design Pro

'); + const text = await page.evaluate(() => document.getElementsByTagName('h1')[0].innerText); + expect(text).toContain('Ant Design Pro'); + await page.close(); browser.close(); }); diff --git a/src/e2e/layout.e2e.js b/src/e2e/layout.e2e.js index 58525bc98bfbb8da3079074bf1f870b626caa6c8..3d95dc1d06db6acdcb4237ffc548b327de21d916 100644 --- a/src/e2e/layout.e2e.js +++ b/src/e2e/layout.e2e.js @@ -28,6 +28,7 @@ describe('Homepage', () => { }; beforeAll(async () => { + jest.setTimeout(1000000); browser = await puppeteer.launch({ args: ['--no-sandbox'] }); page = await browser.newPage(); }); diff --git a/src/layouts/UserLayout.less b/src/layouts/UserLayout.less index d4ac3861f83cd5a6176a232ae14546a4bce34c01..5eb257a442db44cc5abfbecdb8db76f94d8d08d6 100644 --- a/src/layouts/UserLayout.less +++ b/src/layouts/UserLayout.less @@ -32,7 +32,7 @@ } .content { - padding: 72px 0 24px 0; + padding: 32px 0 24px 0; } } @@ -57,7 +57,7 @@ .title { font-size: 33px; color: @heading-color; - font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif; + font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; font-weight: 600; position: relative; top: 2px; diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 9e4eb346841c7ea3f852fb093b1196e9acbf201d..692c0939e59c79d4a13f686d477e533f75185ef7 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -20,6 +20,8 @@ export default { 'validation.date.required': 'Please select the start and end date', 'validation.goal.required': 'Please enter a description of the goal', 'validation.standard.required': 'Please enter a metric', + 'form.captcha': 'Get Captcha', + 'form.captcha.second': 'sec', 'form.optional': ' (optional) ', 'form.submit': 'Submit', 'form.save': 'Save', diff --git a/src/locales/pt-BR.js b/src/locales/pt-BR.js index 8e6627ca67ebad651c3d91afae7d369e567f7a06..5ac17a884e9e2fe9da4235b8e341b98bd7e09383 100644 --- a/src/locales/pt-BR.js +++ b/src/locales/pt-BR.js @@ -16,6 +16,8 @@ export default { 'validation.phone-number.required': 'Por favor insira seu telefone!', 'validation.phone-number.wrong-format': 'Formato de telefone errado!', 'validation.verification-code.required': 'Por favor insira seu código de verificação!', + 'form.captcha': 'Get Captcha', + 'form.captcha.second': 'sec', 'form.email.placeholder': 'Email', 'form.password.placeholder': 'Senha', 'form.confirm-password.placeholder': 'Confirme a senha', diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index 1b16e5ffbb714681338195bf166a7e72464772c3..ecf546589c04e1da6894faff4c801076029a076d 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -19,6 +19,8 @@ export default { 'validation.date.required': '请选择起止日期', 'validation.goal.required': '请输入目标描述', 'validation.standard.required': '请输入衡量标准', + 'form.captcha': '获取验证码', + 'form.captcha.second': '秒', 'form.optional': '(选填)', 'form.submit': '提交', 'form.save': '保存', diff --git a/src/locales/zh-TW.js b/src/locales/zh-TW.js index b919c44c540c2c35a1bb4cfc644b96397aeaef65..7017aa5e9f10aed1612b9b889d4bdbed94e874b6 100644 --- a/src/locales/zh-TW.js +++ b/src/locales/zh-TW.js @@ -19,6 +19,8 @@ export default { 'validation.date.required': '請選擇起止日期', 'validation.goal.required': '請輸入目標描述', 'validation.standard.required': '請輸入衡量標淮', + 'form.captcha': '獲取驗證碼', + 'form.captcha.second': '秒', 'form.optional': '(選填)', 'form.submit': '提交', 'form.save': '保存', diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index a6d68905b6397a67d38fbb34a7fa0bca059919fb..629091747c22a65cc6e62d7d4e87af362c2fc7fb 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -145,7 +145,7 @@ class Monitor extends PureComponent { - + - + - + - +