From 4d639359b4b25fc8735fc22e22bff616c1d00747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 10 Apr 2019 20:13:01 +0800 Subject: [PATCH 01/24] use netlify functions (#3961) * use netlify functions * fix: change url --- lambda/mock/matchMock.js | 2 +- netlify.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lambda/mock/matchMock.js b/lambda/mock/matchMock.js index 94027802..d7423612 100644 --- a/lambda/mock/matchMock.js +++ b/lambda/mock/matchMock.js @@ -14,7 +14,7 @@ function parseKey(key) { method = spliced[0].toLowerCase(); path = spliced[1]; // eslint-disable-line } - const routerBasePath = process.env.NODE_ENV === 'dev' ? `${path}` : `/.netlify/functions${path}`; + const routerBasePath = `${path}`; return { method, path: routerBasePath, diff --git a/netlify.toml b/netlify.toml index 5ecaa964..9d3438c4 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ [[redirects]] from = "/api/*" - to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat" + to = "/.netlify/functions/api/:splat" status = 200 force = true [redirects.headers] From f1c495d3f13fbbe1977b2bec891807cb418e7f91 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Fri, 12 Apr 2019 09:20:48 +0000 Subject: [PATCH 02/24] Update stylelint-config-rational-order to version 0.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac25710a..c4bf3e32 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", "stylelint-config-prettier": "^5.0.0", - "stylelint-config-rational-order": "^0.0.4", + "stylelint-config-rational-order": "^0.1.0", "stylelint-config-standard": "^18.2.0", "stylelint-declaration-block-no-ignored-properties": "^1.1.0", "stylelint-order": "^2.0.0", From 23d00abbc8ef20e3b5f6f0bfe07d7d6d974c5aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=90=E5=B0=8F=E5=BF=83?= Date: Fri, 12 Apr 2019 22:23:15 +0800 Subject: [PATCH 03/24] =?UTF-8?q?Fix=E5=BD=93hideInBreadcrumb=3D=3Dtrue,?= =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#3984)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix hideInBreadcrumb==true error * update for ci --- .../PageHeaderWrapper/breadcrumb.js | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/PageHeaderWrapper/breadcrumb.js b/src/components/PageHeaderWrapper/breadcrumb.js index 66ca8b9c..0f25e8f7 100644 --- a/src/components/PageHeaderWrapper/breadcrumb.js +++ b/src/components/PageHeaderWrapper/breadcrumb.js @@ -61,20 +61,22 @@ const conversionFromLocation = (routerLocation, breadcrumbNameMap, props) => { // Convert the url to an array const pathSnippets = urlToList(routerLocation.pathname); // Loop data mosaic routing - const extraBreadcrumbItems = pathSnippets.map(url => { - const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url); - if (currentBreadcrumb.inherited) { - return null; - } - const name = renderItemLocal(currentBreadcrumb); - const { hideInBreadcrumb } = currentBreadcrumb; - return name && !hideInBreadcrumb - ? { - path: url, - breadcrumbName: name, - } - : null; - }); + const extraBreadcrumbItems = pathSnippets + .map(url => { + const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url); + if (currentBreadcrumb.inherited) { + return null; + } + const name = renderItemLocal(currentBreadcrumb); + const { hideInBreadcrumb } = currentBreadcrumb; + return name && !hideInBreadcrumb + ? { + path: url, + breadcrumbName: name, + } + : null; + }) + .filter(item => item !== null); // Add home breadcrumbs to your head if defined if (home) { extraBreadcrumbItems.unshift({ From e245efe0cbd72eda96849e8f0f4868aa8fdd2097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 12 Apr 2019 22:26:28 +0800 Subject: [PATCH 04/24] change environment variables pro only (#3951) * change environment variables pro only * change notes --- .eslintrc.js | 2 +- config/config.js | 10 ++++++---- config/plugin.config.js | 7 +++++-- jest.config.js | 2 +- package.json | 2 +- src/layouts/BasicLayout.js | 6 +++++- src/models/setting.js | 3 ++- src/utils/authority.js | 3 ++- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index aeeca68f..dbe7d4d3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,7 @@ module.exports = { jasmine: true, }, globals: { - APP_TYPE: true, + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 page: true, }, rules: { diff --git a/config/config.js b/config/config.js index c68107bd..d939eac9 100644 --- a/config/config.js +++ b/config/config.js @@ -6,7 +6,8 @@ import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; const { pwa, primaryColor } = defaultSettings; -const { APP_TYPE, TEST } = process.env; +// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 +const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST } = process.env; const plugins = [ [ @@ -48,8 +49,8 @@ const plugins = [ ]; // 针对 preview.pro.ant.design 的 GA 统计代码 -// 业务上不需要这个 -if (APP_TYPE === 'site') { +// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 +if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { plugins.push([ 'umi-plugin-ga', { @@ -62,7 +63,8 @@ export default { // add for transfer to umi plugins, define: { - APP_TYPE: APP_TYPE || '', + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 }, treeShaking: true, targets: { diff --git a/config/plugin.config.js b/config/plugin.config.js index 2273586e..59ce550f 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -24,8 +24,11 @@ function getModulePackageName(module) { } export default config => { - // pro 和 开发环境再添加这个插件 - if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if ( + process.env.ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' || + process.env.NODE_ENV !== 'production' + ) { // 将所有 less 合并为一个供 themePlugin使用 const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); const stylesDir = path.join(__dirname, '../src/'); diff --git a/jest.config.js b/jest.config.js index a1d8c22c..ba22e52a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,6 +2,6 @@ module.exports = { testURL: 'http://localhost:8000', preset: 'jest-puppeteer', globals: { - APP_TYPE: false, + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 }, }; diff --git a/package.json b/package.json index c4bf3e32..3678c8ca 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "lint:prettier": "check-prettier lint", "lint:style": "stylelint 'src/**/*.less' --syntax less", "prettier": "node ./scripts/prettier.js", - "start": "cross-env APP_TYPE=site umi dev", + "start": "cross-env ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "test": "umi test", "test:all": "node ./tests/run-tests.js", diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 249ff31f..686742dd 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -90,7 +90,11 @@ class BasicLayout extends React.Component { renderSettingDrawer = () => { // Do not render SettingDrawer in production // unless it is deployed in preview.pro.ant.design as demo - if (process.env.NODE_ENV === 'production' && APP_TYPE !== 'site') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if ( + process.env.NODE_ENV === 'production' && + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site' + ) { return null; } return ; diff --git a/src/models/setting.js b/src/models/setting.js index 171da48d..3956ed3d 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -4,7 +4,8 @@ import defaultSettings from '../defaultSettings'; let lessNodesAppended; const updateTheme = primaryColor => { // Don't compile less in production! - if (APP_TYPE !== 'site') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site') { return; } // Determine if the component is remounted diff --git a/src/utils/authority.js b/src/utils/authority.js index 396a9fbd..bb1aa23b 100644 --- a/src/utils/authority.js +++ b/src/utils/authority.js @@ -13,7 +13,8 @@ export function getAuthority(str) { if (typeof authority === 'string') { return [authority]; } - if (!authority && APP_TYPE === 'site') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { return ['admin']; } return authority; From 9a7e7ca7989719c09fea95c7b6880368d70af722 Mon Sep 17 00:00:00 2001 From: TnWah <327001249@qq.com> Date: Mon, 15 Apr 2019 10:20:07 +0800 Subject: [PATCH 05/24] =?UTF-8?q?PageHeaderWrapper=E7=BB=84=E4=BB=B6bug=20?= =?UTF-8?q?(#3938)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PageHeaderWrapper组件内PageHeader部分显示判断修改为title存在即可 * 删除title/content判断 --- src/components/PageHeaderWrapper/index.js | 76 +++++++++++------------ 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/src/components/PageHeaderWrapper/index.js b/src/components/PageHeaderWrapper/index.js index 7cf822df..a78da3d8 100644 --- a/src/components/PageHeaderWrapper/index.js +++ b/src/components/PageHeaderWrapper/index.js @@ -49,47 +49,45 @@ const PageHeaderWrapper = ({ return (
{top} - {title && content && ( - - {value => { - return ( - - {title} - - } - key="pageheader" - {...restProps} - breadcrumb={conversionBreadcrumbList({ - ...value, - ...restProps, - home: , - })} - className={styles.pageHeader} - linkElement={Link} - footer={renderFooter(restProps)} - > -
- {logo &&
{logo}
} -
-
- {content &&
{content}
} - {extraContent &&
{extraContent}
} -
+ + {value => { + return ( + + {title} + + } + key="pageheader" + {...restProps} + breadcrumb={conversionBreadcrumbList({ + ...value, + ...restProps, + home: , + })} + className={styles.pageHeader} + linkElement={Link} + footer={renderFooter(restProps)} + > +
+ {logo &&
{logo}
} +
+
+ {content &&
{content}
} + {extraContent &&
{extraContent}
}
- - ); - }} - - )} +
+
+ ); + }} +
{children ? (
{children} From 123f46d79dcfaa9bf0500eb2d814deacbaf321c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 15 Apr 2019 11:32:33 +0800 Subject: [PATCH 06/24] feat: add site script --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3678c8ca..8b71bcb1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "An out-of-box UI solution for enterprise applications", "scripts": { "analyze": "cross-env ANALYZE=1 umi build", - "build": "umi build && npm run functions:build", + "build": "umi build", "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./", "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", @@ -23,6 +23,7 @@ "lint:prettier": "check-prettier lint", "lint:style": "stylelint 'src/**/*.less' --syntax less", "prettier": "node ./scripts/prettier.js", + "site": "umi build && npm run functions:build", "start": "cross-env ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "test": "umi test", @@ -111,6 +112,7 @@ "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", "prettier": "^1.16.4", + "serverless-http": "^1.9.1", "slash2": "^2.0.0", "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", @@ -122,8 +124,7 @@ "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", - "umi-plugin-ga": "^1.1.3", - "serverless-http": "^1.9.1" + "umi-plugin-ga": "^1.1.3" }, "optionalDependencies": { "puppeteer": "^1.12.1" From 81e86060543ca06356b65768585131f990f373d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 18 Apr 2019 16:42:48 +0800 Subject: [PATCH 07/24] feat: support extra --- src/components/PageHeaderWrapper/index.d.ts | 1 - src/pages/Profile/AdvancedProfile.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/PageHeaderWrapper/index.d.ts b/src/components/PageHeaderWrapper/index.d.ts index 21c8759b..3ed6d0f9 100644 --- a/src/components/PageHeaderWrapper/index.d.ts +++ b/src/components/PageHeaderWrapper/index.d.ts @@ -1,6 +1,5 @@ import React from 'react'; export interface ResultProps { - actions?: React.ReactNode; className?: string; description?: React.ReactNode; extra?: React.ReactNode; diff --git a/src/pages/Profile/AdvancedProfile.js b/src/pages/Profile/AdvancedProfile.js index 0006f993..142bc999 100644 --- a/src/pages/Profile/AdvancedProfile.js +++ b/src/pages/Profile/AdvancedProfile.js @@ -262,7 +262,7 @@ class AdvancedProfile extends Component { logo={ } - action={action} + extra={action} content={description} extraContent={extra} tabList={tabList} From 79cc60ac320ac48d4e9f548fd782f76ab56d4a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 18 Apr 2019 17:08:04 +0800 Subject: [PATCH 08/24] fix #4025 ,feat: home will be able to click --- src/components/PageHeaderWrapper/breadcrumb.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/PageHeaderWrapper/breadcrumb.js b/src/components/PageHeaderWrapper/breadcrumb.js index 0f25e8f7..c20eaf63 100644 --- a/src/components/PageHeaderWrapper/breadcrumb.js +++ b/src/components/PageHeaderWrapper/breadcrumb.js @@ -8,6 +8,10 @@ import { urlToList } from '../_utils/pathTools'; // Render the Breadcrumb child node const itemRender = (route, params, routes, paths) => { const last = routes.indexOf(route) === routes.length - 1; + // if path is home, use Link。 + if (route.path === '/') { + return {route.breadcrumbName}; + } return last || !route.component ? ( {route.breadcrumbName} ) : ( From edd2962ea3d52444c5ee09bd825a163866b385a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 18 Apr 2019 17:38:16 +0800 Subject: [PATCH 09/24] fix lint style --- .eslintrc.js | 1 + src/components/Exception/index.less | 2 +- src/components/SettingDrawer/index.less | 2 +- src/utils/utils.less | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dbe7d4d3..30e47107 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -27,6 +27,7 @@ module.exports = { devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'], }, ], + 'import/no-cycle': 0, 'jsx-a11y/no-noninteractive-element-interactions': 0, 'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/no-static-element-interactions': 0, diff --git a/src/components/Exception/index.less b/src/components/Exception/index.less index 45a2844b..5393bb71 100644 --- a/src/components/Exception/index.less +++ b/src/components/Exception/index.less @@ -13,8 +13,8 @@ zoom: 1; &::before, &::after { - content: ' '; display: table; + content: ' '; } &::after { clear: both; diff --git a/src/components/SettingDrawer/index.less b/src/components/SettingDrawer/index.less index bb64b079..06548788 100644 --- a/src/components/SettingDrawer/index.less +++ b/src/components/SettingDrawer/index.less @@ -63,8 +63,8 @@ right: 300px; z-index: 0; display: flex; - justify-content: center; align-items: center; + justify-content: center; width: 48px; height: 48px; font-size: 16px; diff --git a/src/utils/utils.less b/src/utils/utils.less index 7be54ba5..de1aa642 100644 --- a/src/utils/utils.less +++ b/src/utils/utils.less @@ -38,8 +38,8 @@ zoom: 1; &::before, &::after { - content: ' '; display: table; + content: ' '; } &::after { clear: both; From cc5c81555ea31f3e149bbc82796366619c3b47b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=B7=E9=92=89?= <41830859@qq.com> Date: Fri, 19 Apr 2019 16:13:45 +0800 Subject: [PATCH 10/24] hiddenBreadcrumb && menu.disableLocal (#4009) * menu.disableLocal * hiddenBreadcrumb * lint * lint --- src/components/Authorized/CheckPermissions.js | 1 + src/components/Authorized/PromiseRender.js | 1 + src/components/Authorized/Secured.js | 1 + src/components/PageHeaderWrapper/breadcrumb.js | 6 +++++- src/components/PageHeaderWrapper/index.js | 14 +++++++++----- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index 4b49d1f8..a1da2618 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -1,4 +1,5 @@ import React from 'react'; +// eslint-disable-next-line import/no-cycle import PromiseRender from './PromiseRender'; import { CURRENT } from './renderAuthorize'; diff --git a/src/components/Authorized/PromiseRender.js b/src/components/Authorized/PromiseRender.js index 58de6593..c03a41d4 100644 --- a/src/components/Authorized/PromiseRender.js +++ b/src/components/Authorized/PromiseRender.js @@ -1,6 +1,7 @@ import { Spin } from 'antd'; import isEqual from 'lodash/isEqual'; import React from 'react'; +// eslint-disable-next-line import/no-cycle import { isComponentClass } from './Secured'; export default class PromiseRender extends React.Component { diff --git a/src/components/Authorized/Secured.js b/src/components/Authorized/Secured.js index 25b961f0..bd53b2f5 100644 --- a/src/components/Authorized/Secured.js +++ b/src/components/Authorized/Secured.js @@ -1,5 +1,6 @@ import React from 'react'; import Exception from '../Exception'; +// eslint-disable-next-line import/no-cycle import CheckPermissions from './CheckPermissions'; /** diff --git a/src/components/PageHeaderWrapper/breadcrumb.js b/src/components/PageHeaderWrapper/breadcrumb.js index c20eaf63..4264fef3 100644 --- a/src/components/PageHeaderWrapper/breadcrumb.js +++ b/src/components/PageHeaderWrapper/breadcrumb.js @@ -3,6 +3,7 @@ import pathToRegexp from 'path-to-regexp'; import Link from 'umi/link'; import { formatMessage } from 'umi-plugin-react/locale'; import { urlToList } from '../_utils/pathTools'; +import { menu } from '../../defaultSettings'; // 渲染Breadcrumb 子节点 // Render the Breadcrumb child node @@ -21,7 +22,10 @@ const itemRender = (route, params, routes, paths) => { const renderItemLocal = item => { if (item.locale) { - return formatMessage({ id: item.locale, defaultMessage: item.name }); + const name = menu.disableLocal + ? item.name + : formatMessage({ id: item.locale, defaultMessage: item.name }); + return name; } return item.name; }; diff --git a/src/components/PageHeaderWrapper/index.js b/src/components/PageHeaderWrapper/index.js index a78da3d8..1e5318ff 100644 --- a/src/components/PageHeaderWrapper/index.js +++ b/src/components/PageHeaderWrapper/index.js @@ -44,6 +44,7 @@ const PageHeaderWrapper = ({ content, logo, extraContent, + hiddenBreadcrumb, ...restProps }) => { return ( @@ -66,11 +67,14 @@ const PageHeaderWrapper = ({ } key="pageheader" {...restProps} - breadcrumb={conversionBreadcrumbList({ - ...value, - ...restProps, - home: , - })} + breadcrumb={ + !hiddenBreadcrumb && + conversionBreadcrumbList({ + ...value, + ...restProps, + home: , + }) + } className={styles.pageHeader} linkElement={Link} footer={renderFooter(restProps)} From ab35aa0066642e7f33fee41159e14044168200e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 22 Apr 2019 15:58:53 +0800 Subject: [PATCH 11/24] prettier md --- .prettierignore | 1 - .prettierrc | 1 + package.json | 2 +- scripts/getPrettierFiles.js | 2 + .../Authorized/demo/AuthorizedArray.md | 4 +- .../Authorized/demo/AuthorizedFunction.md | 10 +- src/components/Authorized/demo/basic.md | 4 +- src/components/Authorized/demo/secured.md | 8 +- src/components/Authorized/index.md | 40 ++-- src/components/AvatarList/demo/maxLength.md | 52 +++-- src/components/AvatarList/demo/simple.md | 28 ++- src/components/AvatarList/index.en-US.md | 8 +- src/components/AvatarList/index.zh-CN.md | 18 +- src/components/Charts/demo/bar.md | 12 +- src/components/Charts/demo/chart-card.md | 29 +-- src/components/Charts/demo/gauge.md | 14 +- src/components/Charts/demo/mini-area.md | 15 +- src/components/Charts/demo/mini-bar.md | 13 +- src/components/Charts/demo/mini-pie.md | 8 +- src/components/Charts/demo/mini-progress.md | 8 +- src/components/Charts/demo/mix.md | 48 ++--- src/components/Charts/demo/pie.md | 4 +- src/components/Charts/demo/radar.md | 19 +- src/components/Charts/demo/tag-cloud.md | 13 +- src/components/Charts/demo/timeline-chart.md | 15 +- src/components/Charts/demo/waterwave.md | 17 +- src/components/Charts/index.md | 107 ++++++----- src/components/CountDown/demo/simple.md | 8 +- src/components/CountDown/index.en-US.md | 10 +- src/components/CountDown/index.zh-CN.md | 12 +- src/components/DescriptionList/demo/basic.md | 27 ++- .../DescriptionList/demo/vertical.md | 27 ++- src/components/DescriptionList/index.en-US.md | 30 +-- src/components/DescriptionList/index.zh-CN.md | 33 ++-- src/components/Ellipsis/demo/line.md | 24 ++- src/components/Ellipsis/demo/number.md | 18 +- src/components/Ellipsis/index.en-US.md | 14 +- src/components/Ellipsis/index.zh-CN.md | 12 +- src/components/Exception/demo/403.md | 8 +- src/components/Exception/demo/404.md | 8 +- src/components/Exception/demo/500.md | 8 +- src/components/Exception/index.en-US.md | 18 +- src/components/Exception/index.zh-CN.md | 18 +- src/components/FooterToolbar/demo/basic.md | 9 +- src/components/FooterToolbar/index.en-US.md | 8 +- src/components/FooterToolbar/index.zh-CN.md | 8 +- src/components/GlobalFooter/demo/basic.md | 49 +++-- src/components/GlobalFooter/index.md | 8 +- src/components/HeaderSearch/demo/basic.md | 13 +- src/components/HeaderSearch/index.en-US.md | 22 +-- src/components/HeaderSearch/index.zh-CN.md | 22 +-- src/components/Login/demo/basic.md | 28 +-- src/components/Login/index.en-US.md | 38 ++-- src/components/Login/index.zh-CN.md | 37 ++-- src/components/NoticeIcon/demo/basic.md | 4 +- src/components/NoticeIcon/demo/popover.md | 181 ++++++++++-------- src/components/NoticeIcon/index.en-US.md | 62 +++--- src/components/NoticeIcon/index.zh-CN.md | 60 +++--- src/components/NumberInfo/demo/basic.md | 11 +- src/components/NumberInfo/index.en-US.md | 18 +- src/components/NumberInfo/index.zh-CN.md | 18 +- src/components/Result/demo/classic.md | 13 +- src/components/Result/demo/error.md | 23 ++- src/components/Result/demo/structure.md | 9 +- src/components/Result/index.md | 14 +- src/components/TagSelect/demo/expandable.md | 9 +- src/components/TagSelect/demo/simple.md | 9 +- src/components/TagSelect/index.md | 22 +-- src/components/Trend/demo/basic.md | 11 +- src/components/Trend/demo/reverse.md | 13 +- src/components/Trend/index.md | 10 +- 71 files changed, 752 insertions(+), 752 deletions(-) diff --git a/.prettierignore b/.prettierignore index 6ce5e018..d33a8696 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,3 @@ -**/*.md **/*.svg package.json .umi diff --git a/.prettierrc b/.prettierrc index 0cc0de65..fdcf70e9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,6 +2,7 @@ "singleQuote": true, "trailingComma": "es5", "printWidth": 100, + "proseWrap": "never", "overrides": [ { "files": ".prettierrc", diff --git a/package.json b/package.json index 8b71bcb1..00e82ac0 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", - "prettier": "^1.16.4", + "prettier": "^1.17.0", "serverless-http": "^1.9.1", "slash2": "^2.0.0", "stylelint": "^9.10.1", diff --git a/scripts/getPrettierFiles.js b/scripts/getPrettierFiles.js index 2b01a8ef..500ab092 100644 --- a/scripts/getPrettierFiles.js +++ b/scripts/getPrettierFiles.js @@ -7,11 +7,13 @@ const getPrettierFiles = () => { const configFiles = glob.sync('config/**/*.js*', { ignore: ['**/node_modules/**', 'build/**'] }); const scriptFiles = glob.sync('scripts/**/*.js'); const lessFiles = glob.sync('src/**/*.less*', { ignore: ['**/node_modules/**', 'build/**'] }); + const mdFiles = glob.sync('src/**/*.md*', { ignore: ['**/node_modules/**', 'build/**'] }); files = files.concat(jsFiles); files = files.concat(tsFiles); files = files.concat(configFiles); files = files.concat(scriptFiles); files = files.concat(lessFiles); + files = files.concat(mdFiles); if (!files.length) { return; } diff --git a/src/components/Authorized/demo/AuthorizedArray.md b/src/components/Authorized/demo/AuthorizedArray.md index 46eaf761..1bef5c92 100644 --- a/src/components/Authorized/demo/AuthorizedArray.md +++ b/src/components/Authorized/demo/AuthorizedArray.md @@ -1,6 +1,6 @@ --- order: 1 -title: +title: zh-CN: 使用数组作为参数 en-US: Use Array as a parameter --- @@ -18,6 +18,6 @@ ReactDOM.render( , - mountNode, + mountNode ); ``` diff --git a/src/components/Authorized/demo/AuthorizedFunction.md b/src/components/Authorized/demo/AuthorizedFunction.md index 8ad8b91e..cd3cdd4a 100644 --- a/src/components/Authorized/demo/AuthorizedFunction.md +++ b/src/components/Authorized/demo/AuthorizedFunction.md @@ -1,6 +1,6 @@ --- order: 2 -title: +title: zh-CN: 使用方法作为参数 en-US: Use function as a parameter --- @@ -20,12 +20,8 @@ const havePermission = () => { ReactDOM.render( - + , - mountNode, + mountNode ); ``` diff --git a/src/components/Authorized/demo/basic.md b/src/components/Authorized/demo/basic.md index a5f12f29..f40272f4 100644 --- a/src/components/Authorized/demo/basic.md +++ b/src/components/Authorized/demo/basic.md @@ -1,6 +1,6 @@ --- order: 0 -title: +title: zh-CN: 基本使用 en-US: Basic use --- @@ -20,6 +20,6 @@ ReactDOM.render(
, - mountNode, + mountNode ); ``` diff --git a/src/components/Authorized/demo/secured.md b/src/components/Authorized/demo/secured.md index 1999852f..55d5cd9b 100644 --- a/src/components/Authorized/demo/secured.md +++ b/src/components/Authorized/demo/secured.md @@ -1,6 +1,6 @@ --- order: 3 -title: +title: zh-CN: 注解基本使用 en-US: Basic use secured --- @@ -16,15 +16,13 @@ const { Secured } = RenderAuthorized('user'); @Secured('admin') class TestSecuredString extends React.Component { render() { - return ( - - ) + return ; } } ReactDOM.render(
, - mountNode, + mountNode ); ``` diff --git a/src/components/Authorized/index.md b/src/components/Authorized/index.md index 48c93f8f..ac09ccab 100644 --- a/src/components/Authorized/index.md +++ b/src/components/Authorized/index.md @@ -15,23 +15,22 @@ order: 15 权限组件默认 export RenderAuthorized 函数,它接收当前权限作为参数,返回一个权限对象,该对象提供以下几种使用方式。 - ### Authorized 最基础的权限控制。 -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| children | 正常渲染的元素,权限判断通过时展示 | ReactNode | - | -| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | -| noMatch | 权限异常渲染元素,权限判断不通过时展示 | ReactNode | - | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| children | 正常渲染的元素,权限判断通过时展示 | ReactNode | - | +| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | +| noMatch | 权限异常渲染元素,权限判断不通过时展示 | ReactNode | - | ### Authorized.AuthorizedRoute -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | -| redirectPath | 权限异常时重定向的页面路由 | string | - | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | +| redirectPath | 权限异常时重定向的页面路由 | string | - | 其余参数与 `Route` 相同。 @@ -39,18 +38,17 @@ order: 15 注解方式,`@Authorized.Secured(authority, error)` -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | -| error | 权限异常时渲染元素 | ReactNode | | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | +| error | 权限异常时渲染元素 | ReactNode | | ### Authorized.check -函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。 `Authorized.check(authority, target, Exception)` -注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。 +函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。 `Authorized.check(authority, target, Exception)` 注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。 -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | -| target | 权限判断通过时渲染的元素 | ReactNode | - | -| Exception | 权限异常时渲染元素 | ReactNode | - | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | +| target | 权限判断通过时渲染的元素 | ReactNode | - | +| Exception | 权限异常时渲染元素 | ReactNode | - | diff --git a/src/components/AvatarList/demo/maxLength.md b/src/components/AvatarList/demo/maxLength.md index 76c6b421..52f0930e 100644 --- a/src/components/AvatarList/demo/maxLength.md +++ b/src/components/AvatarList/demo/maxLength.md @@ -1,24 +1,46 @@ --- order: 0 -title: - zh-CN: 要显示的最大项目 +title: + zh-CN: 要显示的最大项目 en-US: Max Items to Show --- -`maxLength` attribute specifies the maximum number of items to show while `excessItemsStyle` style the excess -item component. +`maxLength` attribute specifies the maximum number of items to show while `excessItemsStyle` style the excess item component. -````jsx +```jsx import AvatarList from 'ant-design-pro/lib/AvatarList'; ReactDOM.render( - - - - - - - - -, mountNode); -```` + + + + + + + + , + mountNode +); +``` diff --git a/src/components/AvatarList/demo/simple.md b/src/components/AvatarList/demo/simple.md index e941aea9..d4438b33 100644 --- a/src/components/AvatarList/demo/simple.md +++ b/src/components/AvatarList/demo/simple.md @@ -1,20 +1,30 @@ --- order: 0 -title: - zh-CN: 基础样例 +title: + zh-CN: 基础样例 en-US: Basic Usage --- Simplest of usage. -````jsx +```jsx import AvatarList from 'ant-design-pro/lib/AvatarList'; ReactDOM.render( - - - - -, mountNode); -```` + + + + , + mountNode +); +``` diff --git a/src/components/AvatarList/index.en-US.md b/src/components/AvatarList/index.en-US.md index 7fc39cc2..ee996c31 100644 --- a/src/components/AvatarList/index.en-US.md +++ b/src/components/AvatarList/index.en-US.md @@ -10,11 +10,11 @@ A list of user's avatar for project or group member list frequently. If a large ### AvatarList -| Property | Description | Type | Default | -| ---------------- | --------------------- | ---------------------------------- | --------- | +| Property | Description | Type | Default | +| ---------------- | --------------------- | ------------------------------------ | --------- | | size | size of list | `large`、`small` 、`mini`, `default` | `default` | -| maxLength | max items to show | number | - | -| excessItemsStyle | the excess item style | CSSProperties | - | +| maxLength | max items to show | number | - | +| excessItemsStyle | the excess item style | CSSProperties | - | ### AvatarList.Item diff --git a/src/components/AvatarList/index.zh-CN.md b/src/components/AvatarList/index.zh-CN.md index bdab181c..5c04acaf 100644 --- a/src/components/AvatarList/index.zh-CN.md +++ b/src/components/AvatarList/index.zh-CN.md @@ -11,15 +11,15 @@ cols: 1 ### AvatarList -| 参数 | 说明 | 类型 | 默认值 | -| ---------------- | -------- | ---------------------------------- | --------- | -| size | 头像大小 | `large`、`small` 、`mini`, `default` | `default` | -| maxLength | 要显示的最大项目 | number | - | -| excessItemsStyle | 多余的项目风格 | CSSProperties | - | +| 参数 | 说明 | 类型 | 默认值 | +| ---------------- | ---------------- | ------------------------------------ | --------- | +| size | 头像大小 | `large`、`small` 、`mini`, `default` | `default` | +| maxLength | 要显示的最大项目 | number | - | +| excessItemsStyle | 多余的项目风格 | CSSProperties | - | ### AvatarList.Item -| 参数 | 说明 | 类型 | 默认值 | -| ---- | ------ | --------- | --- | -| tips | 头像展示文案 | ReactNode | - | -| src | 头像图片连接 | string | - | +| 参数 | 说明 | 类型 | 默认值 | +| ---- | ------------ | --------- | ------ | +| tips | 头像展示文案 | ReactNode | - | +| src | 头像图片连接 | string | - | diff --git a/src/components/Charts/demo/bar.md b/src/components/Charts/demo/bar.md index 955f44e0..496ed670 100644 --- a/src/components/Charts/demo/bar.md +++ b/src/components/Charts/demo/bar.md @@ -5,7 +5,7 @@ title: 柱状图 通过设置 `x`,`y` 属性,可以快速的构建出一个漂亮的柱状图,各种纬度的关系则是通过自定义的数据展现。 -````jsx +```jsx import { Bar } from 'ant-design-pro/lib/Charts'; const salesData = []; @@ -16,11 +16,5 @@ for (let i = 0; i < 12; i += 1) { }); } -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/chart-card.md b/src/components/Charts/demo/chart-card.md index 4da852b7..9ba68643 100644 --- a/src/components/Charts/demo/chart-card.md +++ b/src/components/Charts/demo/chart-card.md @@ -21,26 +21,19 @@ ReactDOM.render( } - total={() => ( - - )} - footer={ - - } + total={() => } + footer={} contentHeight={46} > 周同比 - + 12% 日环比 - + 11% @@ -61,12 +54,8 @@ ReactDOM.render( } - total={() => ( - - )} - footer={ - - } + total={() => } + footer={} /> @@ -84,12 +73,10 @@ ReactDOM.render( } - total={() => ( - - )} + total={() => } /> , - mountNode, + mountNode ); ``` diff --git a/src/components/Charts/demo/gauge.md b/src/components/Charts/demo/gauge.md index f53465d8..3671102b 100644 --- a/src/components/Charts/demo/gauge.md +++ b/src/components/Charts/demo/gauge.md @@ -1,18 +1,12 @@ --- order: 7 -title: 仪表盘 +title: 仪表盘 --- 仪表盘是一种进度展示方式,可以更直观的展示当前的进展情况,通常也可表示占比。 -````jsx +```jsx import { Gauge } from 'ant-design-pro/lib/Charts'; -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/mini-area.md b/src/components/Charts/demo/mini-area.md index 2b9bfb47..4c148439 100644 --- a/src/components/Charts/demo/mini-area.md +++ b/src/components/Charts/demo/mini-area.md @@ -4,7 +4,7 @@ col: 2 title: 迷你区域图 --- -````jsx +```jsx import { MiniArea } from 'ant-design-pro/lib/Charts'; import moment from 'moment'; @@ -12,17 +12,10 @@ const visitData = []; const beginDay = new Date().getTime(); for (let i = 0; i < 20; i += 1) { visitData.push({ - x: moment(new Date(beginDay + (1000 * 60 * 60 * 24 * i))).format('YYYY-MM-DD'), + x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'), y: Math.floor(Math.random() * 100) + 10, }); } -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/mini-bar.md b/src/components/Charts/demo/mini-bar.md index fef301bc..2cfaf0fe 100644 --- a/src/components/Charts/demo/mini-bar.md +++ b/src/components/Charts/demo/mini-bar.md @@ -6,7 +6,7 @@ title: 迷你柱状图 迷你柱状图更适合展示简单的区间数据,简洁的表现方式可以很好的减少大数据量的视觉展现压力。 -````jsx +```jsx import { MiniBar } from 'ant-design-pro/lib/Charts'; import moment from 'moment'; @@ -14,15 +14,10 @@ const visitData = []; const beginDay = new Date().getTime(); for (let i = 0; i < 20; i += 1) { visitData.push({ - x: moment(new Date(beginDay + (1000 * 60 * 60 * 24 * i))).format('YYYY-MM-DD'), + x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'), y: Math.floor(Math.random() * 100) + 10, }); } -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/mini-pie.md b/src/components/Charts/demo/mini-pie.md index 9b1abf05..76cac9f3 100644 --- a/src/components/Charts/demo/mini-pie.md +++ b/src/components/Charts/demo/mini-pie.md @@ -3,14 +3,10 @@ order: 6 title: 迷你饼状图 --- -通过简化 `Pie` 属性的设置,可以快速的实现极简的饼状图,可配合 `ChartCard` 组合展 -现更多业务场景。 +通过简化 `Pie` 属性的设置,可以快速的实现极简的饼状图,可配合 `ChartCard` 组合展现更多业务场景。 ```jsx import { Pie } from 'ant-design-pro/lib/Charts'; -ReactDOM.render( - , - mountNode -); +ReactDOM.render(, mountNode); ``` diff --git a/src/components/Charts/demo/mini-progress.md b/src/components/Charts/demo/mini-progress.md index 6308a8fa..e4368bee 100644 --- a/src/components/Charts/demo/mini-progress.md +++ b/src/components/Charts/demo/mini-progress.md @@ -3,10 +3,8 @@ order: 3 title: 迷你进度条 --- -````jsx +```jsx import { MiniProgress } from 'ant-design-pro/lib/Charts'; -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/mix.md b/src/components/Charts/demo/mix.md index fc64110a..92251f9d 100644 --- a/src/components/Charts/demo/mix.md +++ b/src/components/Charts/demo/mix.md @@ -5,7 +5,7 @@ title: 图表套件组合展示 利用 Ant Design Pro 提供的图表套件,可以灵活组合符合设计规范的图表来满足复杂的业务需求。 -````jsx +```jsx import { ChartCard, Field, MiniArea, MiniBar, MiniProgress } from 'ant-design-pro/lib/Charts'; import Trend from 'ant-design-pro/lib/Trend'; import NumberInfo from 'ant-design-pro/lib/NumberInfo'; @@ -17,7 +17,7 @@ const visitData = []; const beginDay = new Date().getTime(); for (let i = 0; i < 20; i += 1) { visitData.push({ - x: moment(new Date(beginDay + (1000 * 60 * 60 * 24 * i))).format('YYYY-MM-DD'), + x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format('YYYY-MM-DD'), y: Math.floor(Math.random() * 100) + 10, }); } @@ -25,52 +25,53 @@ for (let i = 0; i < 20; i += 1) { ReactDOM.render( - + 本周访问} total={numeral(12321).format('0,0')} status="up" subTotal={17.1} /> - + } + action={ + + + + } total={numeral(8846).format('0,0')} footer={} contentHeight={46} > - + } + action={ + + + + } total="78%" footer={
周同比 - 12% + + 12% + 日环比 - 11% + + 11% +
} @@ -79,6 +80,7 @@ ReactDOM.render(
- -, mountNode); -```` + , + mountNode +); +``` diff --git a/src/components/Charts/demo/pie.md b/src/components/Charts/demo/pie.md index 9c87161a..392a7c2c 100644 --- a/src/components/Charts/demo/pie.md +++ b/src/components/Charts/demo/pie.md @@ -41,7 +41,7 @@ ReactDOM.render( total={() => ( now.y + pre, 0)) + __html: yuan(salesPieData.reduce((pre, now) => now.y + pre, 0)), }} /> )} @@ -49,6 +49,6 @@ ReactDOM.render( valueFormat={val => } height={294} />, - mountNode, + mountNode ); ``` diff --git a/src/components/Charts/demo/radar.md b/src/components/Charts/demo/radar.md index 584344aa..fd14c037 100644 --- a/src/components/Charts/demo/radar.md +++ b/src/components/Charts/demo/radar.md @@ -3,7 +3,7 @@ order: 7 title: 雷达图 --- -````jsx +```jsx import { Radar, ChartCard } from 'ant-design-pro/lib/Charts'; const radarOriginData = [ @@ -40,8 +40,8 @@ const radarTitleMap = { contribute: '贡献', hot: '热度', }; -radarOriginData.forEach((item) => { - Object.keys(item).forEach((key) => { +radarOriginData.forEach(item => { + Object.keys(item).forEach(key => { if (key !== 'name') { radarData.push({ name: item.name, @@ -54,11 +54,8 @@ radarOriginData.forEach((item) => { ReactDOM.render( - - -, mountNode); -```` + + , + mountNode +); +``` diff --git a/src/components/Charts/demo/tag-cloud.md b/src/components/Charts/demo/tag-cloud.md index c66f6fe6..2f0e0e63 100644 --- a/src/components/Charts/demo/tag-cloud.md +++ b/src/components/Charts/demo/tag-cloud.md @@ -5,21 +5,16 @@ title: 标签云 标签云是一套相关的标签以及与此相应的权重展示方式,一般典型的标签云有 30 至 150 个标签,而权重影响使用的字体大小或其他视觉效果。 -````jsx +```jsx import { TagCloud } from 'ant-design-pro/lib/Charts'; const tags = []; for (let i = 0; i < 50; i += 1) { tags.push({ name: `TagClout-Title-${i}`, - value: Math.floor((Math.random() * 50)) + 20, + value: Math.floor(Math.random() * 50) + 20, }); } -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Charts/demo/timeline-chart.md b/src/components/Charts/demo/timeline-chart.md index 60773b57..6146989e 100644 --- a/src/components/Charts/demo/timeline-chart.md +++ b/src/components/Charts/demo/timeline-chart.md @@ -5,23 +5,20 @@ title: 带有时间轴的图表 使用 `TimelineChart` 组件可以实现带有时间轴的柱状图展现,而其中的 `x` 属性,则是时间值的指向,默认最多支持同时展现两个指标,分别是 `y1` 和 `y2`。 -````jsx +```jsx import { TimelineChart } from 'ant-design-pro/lib/Charts'; const chartData = []; for (let i = 0; i < 20; i += 1) { chartData.push({ - x: (new Date().getTime()) + (1000 * 60 * 30 * i), + x: new Date().getTime() + 1000 * 60 * 30 * i, y1: Math.floor(Math.random() * 100) + 1000, y2: Math.floor(Math.random() * 100) + 10, }); } ReactDOM.render( - -, mountNode); -```` + , + mountNode +); +``` diff --git a/src/components/Charts/demo/waterwave.md b/src/components/Charts/demo/waterwave.md index 74d290f5..718cd2a0 100644 --- a/src/components/Charts/demo/waterwave.md +++ b/src/components/Charts/demo/waterwave.md @@ -1,20 +1,17 @@ --- order: 8 -title: 水波图 +title: 水波图 --- 水波图是一种比例的展示方式,可以更直观的展示关键值的占比。 -````jsx +```jsx import { WaterWave } from 'ant-design-pro/lib/Charts'; ReactDOM.render(
- -
-, mountNode); -```` + +
, + mountNode +); +``` diff --git a/src/components/Charts/index.md b/src/components/Charts/index.md index e5f41c87..3456bc19 100644 --- a/src/components/Charts/index.md +++ b/src/components/Charts/index.md @@ -13,26 +13,27 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https ### ChartCard -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| title | 卡片标题 | ReactNode\|string | - | -| action | 卡片操作 | ReactNode | - | -| total | 数据总量 | ReactNode \| number \| function | - | -| footer | 卡片底部 | ReactNode | - | -| contentHeight | 内容区域高度 | number | - | -| avatar | 右侧图标 | React.ReactNode | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------------- | ------------ | ------------------------------- | ------ | +| title | 卡片标题 | ReactNode\|string | - | +| action | 卡片操作 | ReactNode | - | +| total | 数据总量 | ReactNode \| number \| function | - | +| footer | 卡片底部 | ReactNode | - | +| contentHeight | 内容区域高度 | number | - | +| avatar | 右侧图标 | React.ReactNode | - | + ### MiniBar -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| color | 图表颜色 | string | `#1890FF` | -| height | 图表高度 | number | - | -| data | 数据 | array<{x, y}> | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------ | -------- | ------------- | --------- | +| color | 图表颜色 | string | `#1890FF` | +| height | 图表高度 | number | - | +| data | 数据 | array<{x, y}> | - | ### MiniArea -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | | color | 图表颜色 | string | `rgba(24, 144, 255, 0.2)` | | borderColor | 图表边颜色 | string | `#1890FF` | | height | 图表高度 | number | - | @@ -44,17 +45,17 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https ### MiniProgress -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| target | 目标比例 | number | - | -| color | 进度条颜色 | string | - | -| strokeWidth | 进度条高度 | number | - | -| percent | 进度比例 | number | - | +| 参数 | 说明 | 类型 | 默认值 | +| ----------- | ---------- | ------ | ------ | +| target | 目标比例 | number | - | +| color | 进度条颜色 | string | - | +| strokeWidth | 进度条高度 | number | - | +| percent | 进度比例 | number | - | ### Bar -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | | title | 图表标题 | ReactNode\|string | - | | color | 图表颜色 | string | `rgba(24, 144, 255, 0.85)` | | padding | 图表内部间距 | [array](https://github.com/alibaba/BizCharts/blob/master/doc/api/chart.md#7padding-object--number--array-) | `'auto'` | @@ -64,8 +65,8 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https ### Pie -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | | animate | 是否显示动画 | boolean | true | | color | 图表颜色 | string | `rgba(24, 144, 255, 0.85)` | | height | 图表高度 | number | - | @@ -80,8 +81,8 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https ### Radar -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | | title | 图表标题 | ReactNode\|string | - | | height | 图表高度 | number | - | | hasLegend | 是否显示 legend | boolean | `false` | @@ -90,41 +91,41 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https ### Gauge -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| title | 图表标题 | ReactNode\|string | - | -| height | 图表高度 | number | - | -| color | 图表颜色 | string | `#2F9CFF` | -| bgColor | 图表背景颜色 | string | `#F0F2F5` | -| percent | 进度比例 | number | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------- | ------------ | ----------------- | --------- | +| title | 图表标题 | ReactNode\|string | - | +| height | 图表高度 | number | - | +| color | 图表颜色 | string | `#2F9CFF` | +| bgColor | 图表背景颜色 | string | `#F0F2F5` | +| percent | 进度比例 | number | - | ### WaterWave -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| title | 图表标题 | ReactNode\|string | - | -| height | 图表高度 | number | - | -| color | 图表颜色 | string | `#1890FF` | -| percent | 进度比例 | number | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------- | -------- | ----------------- | --------- | +| title | 图表标题 | ReactNode\|string | - | +| height | 图表高度 | number | - | +| color | 图表颜色 | string | `#1890FF` | +| percent | 进度比例 | number | - | ### TagCloud -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| data | 标题 | Array | - | -| height | 高度值 | number | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------ | ------ | ------------------- | ------ | +| data | 标题 | Array | - | +| height | 高度值 | number | - | ### TimelineChart -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| data | 标题 | Array | - | -| titleMap | 指标别名 | Object{y1: '客流量', y2: '支付笔数'} | - | -| height | 高度值 | number | 400 | +| 参数 | 说明 | 类型 | 默认值 | +| -------- | -------- | ------------------------------------ | ------ | +| data | 标题 | Array | - | +| titleMap | 指标别名 | Object{y1: '客流量', y2: '支付笔数'} | - | +| height | 高度值 | number | 400 | ### Field -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| label | 标题 | ReactNode\|string | - | -| value | 值 | ReactNode\|string | - | +| 参数 | 说明 | 类型 | 默认值 | +| ----- | ---- | ----------------- | ------ | +| label | 标题 | ReactNode\|string | - | +| value | 值 | ReactNode\|string | - | diff --git a/src/components/CountDown/demo/simple.md b/src/components/CountDown/demo/simple.md index e42cbf1d..c0e23be2 100644 --- a/src/components/CountDown/demo/simple.md +++ b/src/components/CountDown/demo/simple.md @@ -13,12 +13,10 @@ title: The simplest usage. -````jsx +```jsx import CountDown from 'ant-design-pro/lib/CountDown'; const targetTime = new Date().getTime() + 3900000; -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/CountDown/index.en-US.md b/src/components/CountDown/index.en-US.md index 7b452406..19bbe275 100644 --- a/src/components/CountDown/index.en-US.md +++ b/src/components/CountDown/index.en-US.md @@ -8,8 +8,8 @@ Simple CountDown Component. ## API -| Property | Description | Type | Default | -|----------|------------------------------------------|-------------|-------| -| format | Formatter of time | Function(time) | | -| target | Target time | Date | - | -| onEnd | Countdown to the end callback | funtion | -| +| Property | Description | Type | Default | +| -------- | ----------------------------- | -------------- | ------- | +| format | Formatter of time | Function(time) | | +| target | Target time | Date | - | +| onEnd | Countdown to the end callback | funtion | - | diff --git a/src/components/CountDown/index.zh-CN.md b/src/components/CountDown/index.zh-CN.md index 7e00ba1d..87539289 100644 --- a/src/components/CountDown/index.zh-CN.md +++ b/src/components/CountDown/index.zh-CN.md @@ -1,5 +1,5 @@ --- -title: CountDown +title: CountDown subtitle: 倒计时 cols: 1 order: 3 @@ -9,8 +9,8 @@ order: 3 ## API -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| format | 时间格式化显示 | Function(time) | | -| target | 目标时间 | Date | - | -| onEnd | 倒计时结束回调 | funtion | -| +| 参数 | 说明 | 类型 | 默认值 | +| ------ | -------------- | -------------- | ------ | +| format | 时间格式化显示 | Function(time) | | +| target | 目标时间 | Date | - | +| onEnd | 倒计时结束回调 | funtion | - | diff --git a/src/components/DescriptionList/demo/basic.md b/src/components/DescriptionList/demo/basic.md index 87954551..e45c1103 100644 --- a/src/components/DescriptionList/demo/basic.md +++ b/src/components/DescriptionList/demo/basic.md @@ -13,7 +13,7 @@ title: Basic DescriptionList. -````jsx +```jsx import DescriptionList from 'ant-design-pro/lib/DescriptionList'; const { Description } = DescriptionList; @@ -21,23 +21,18 @@ const { Description } = DescriptionList; ReactDOM.render( - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - -, mountNode); -```` + , + mountNode +); +``` diff --git a/src/components/DescriptionList/demo/vertical.md b/src/components/DescriptionList/demo/vertical.md index 2742f7c9..8bdd3dc0 100644 --- a/src/components/DescriptionList/demo/vertical.md +++ b/src/components/DescriptionList/demo/vertical.md @@ -13,7 +13,7 @@ title: Vertical layout. -````jsx +```jsx import DescriptionList from 'ant-design-pro/lib/DescriptionList'; const { Description } = DescriptionList; @@ -21,23 +21,18 @@ const { Description } = DescriptionList; ReactDOM.render( - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - A free, open source, cross-platform, - graphical web browser developed by the - Mozilla Corporation and hundreds of - volunteers. + A free, open source, cross-platform, graphical web browser developed by the Mozilla + Corporation and hundreds of volunteers. - -, mountNode); -```` + , + mountNode +); +``` diff --git a/src/components/DescriptionList/index.en-US.md b/src/components/DescriptionList/index.en-US.md index 089f30b1..9b956a0f 100644 --- a/src/components/DescriptionList/index.en-US.md +++ b/src/components/DescriptionList/index.en-US.md @@ -10,24 +10,24 @@ Groups display multiple read-only fields, which are common to informational disp ### DescriptionList -| Property | Description | Type | Default | -|----------|------------------------------------------|-------------|---------| -| layout | type of layout | Enum{'horizontal', 'vertical'} | 'horizontal' | -| col | specify the maximum number of columns to display, the final columns number is determined by col setting combined with [Responsive Rules](/components/DescriptionList#Responsive-Rules) | number(0 < col <= 4) | 3 | -| title | title | ReactNode | - | -| gutter | specify the distance between two items, unit is `px` | number | 32 | -| size | size of list | Enum{'large', 'small'} | - | +| Property | Description | Type | Default | +| --- | --- | --- | --- | +| layout | type of layout | Enum{'horizontal', 'vertical'} | 'horizontal' | +| col | specify the maximum number of columns to display, the final columns number is determined by col setting combined with [Responsive Rules](/components/DescriptionList#Responsive-Rules) | number(0 < col <= 4) | 3 | +| title | title | ReactNode | - | +| gutter | specify the distance between two items, unit is `px` | number | 32 | +| size | size of list | Enum{'large', 'small'} | - | #### Responsive Rules -| Window Width | Columns Number | -|---------------------|---------------------------------------------| -| `≥768px` | `col` | -| `≥576px` | `col < 2 ? col : 2` | -| `<576px` | `1` | +| Window Width | Columns Number | +| ------------ | ------------------- | +| `≥768px` | `col` | +| `≥576px` | `col < 2 ? col : 2` | +| `<576px` | `1` | ### DescriptionList.Description -| Property | Description | Type | Default | -|----------|------------------------------------------|-------------|-------| -| term | item title | ReactNode | - | +| Property | Description | Type | Default | +| -------- | ----------- | --------- | ------- | +| term | item title | ReactNode | - | diff --git a/src/components/DescriptionList/index.zh-CN.md b/src/components/DescriptionList/index.zh-CN.md index b16a7fe7..bc7028a6 100644 --- a/src/components/DescriptionList/index.zh-CN.md +++ b/src/components/DescriptionList/index.zh-CN.md @@ -11,27 +11,24 @@ order: 4 ### DescriptionList -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| layout | 布局方式 | Enum{'horizontal', 'vertical'} | 'horizontal' | -| col | 指定信息最多分几列展示,最终一行几列由 col 配置结合[响应式规则](/components/DescriptionList#响应式规则)决定 | number(0 < col <= 4) | 3 | -| title | 列表标题 | ReactNode | - | -| gutter | 列表项间距,单位为 `px` | number | 32 | -| size | 列表型号 | Enum{'large', 'small'} | - | +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| layout | 布局方式 | Enum{'horizontal', 'vertical'} | 'horizontal' | +| col | 指定信息最多分几列展示,最终一行几列由 col 配置结合[响应式规则](/components/DescriptionList#响应式规则)决定 | number(0 < col <= 4) | 3 | +| title | 列表标题 | ReactNode | - | +| gutter | 列表项间距,单位为 `px` | number | 32 | +| size | 列表型号 | Enum{'large', 'small'} | - | #### 响应式规则 -| 窗口宽度 | 展示列数 | -|---------------------|---------------------------------------------| -| `≥768px` | `col` | -| `≥576px` | `col < 2 ? col : 2` | -| `<576px` | `1` | +| 窗口宽度 | 展示列数 | +| -------- | ------------------- | +| `≥768px` | `col` | +| `≥576px` | `col < 2 ? col : 2` | +| `<576px` | `1` | ### DescriptionList.Description -| 参数 | 说明 | 类型 | 默认值 | -|----------|------------------------------------------|-------------|-------| -| term | 列表项标题 | ReactNode | - | - - - +| 参数 | 说明 | 类型 | 默认值 | +| ---- | ---------- | --------- | ------ | +| term | 列表项标题 | ReactNode | - | diff --git a/src/components/Ellipsis/demo/line.md b/src/components/Ellipsis/demo/line.md index bc31170d..a9be7c2c 100644 --- a/src/components/Ellipsis/demo/line.md +++ b/src/components/Ellipsis/demo/line.md @@ -1,6 +1,6 @@ --- order: 1 -title: +title: zh-CN: 按照行数省略 en-US: Truncate according to the number of rows --- @@ -17,15 +17,23 @@ title: Also note that, in this mode, the outer container needs to have a specified width (or set its own width). - -````jsx +```jsx import Ellipsis from 'ant-design-pro/lib/Ellipsis'; -const article =

There were injuries alleged in three cases in 2015, and a fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.

; +const article = ( +

+ There were injuries alleged in three cases in 2015, and a fourth incident + in September, according to the safety recall report. After meeting with US regulators in + October, the firm decided to issue a voluntary recall. +

+); ReactDOM.render(
- {article} -
-, mountNode); -```` + + {article} + +
, + mountNode +); +``` diff --git a/src/components/Ellipsis/demo/number.md b/src/components/Ellipsis/demo/number.md index 0bc1a0ff..cc7aa3e7 100644 --- a/src/components/Ellipsis/demo/number.md +++ b/src/components/Ellipsis/demo/number.md @@ -1,6 +1,6 @@ --- order: 0 -title: +title: zh-CN: 按照字符数省略 en-US: Truncate according to the number of character --- @@ -13,16 +13,20 @@ title: `length` attribute specifies the maximum length where the text will automatically be truncated when exceeded. -````jsx +```jsx import Ellipsis from 'ant-design-pro/lib/Ellipsis'; -const article = 'There were injuries alleged in three cases in 2015, and a fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.'; +const article = + 'There were injuries alleged in three cases in 2015, and a fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.'; ReactDOM.render(
{article}

Show Tooltip

- {article} -
-, mountNode); -```` + + {article} + +
, + mountNode +); +``` diff --git a/src/components/Ellipsis/index.en-US.md b/src/components/Ellipsis/index.en-US.md index 15139cc9..80988730 100644 --- a/src/components/Ellipsis/index.en-US.md +++ b/src/components/Ellipsis/index.en-US.md @@ -1,5 +1,5 @@ --- -title: Ellipsis +title: Ellipsis cols: 1 order: 10 --- @@ -8,9 +8,9 @@ When the text is too long, the Ellipsis automatically shortens it according to i ## API -Property | Description | Type | Default -----|------|-----|------ -tooltip | tooltip for showing the full text content when hovering over | boolean | - -length | maximum number of characters in the text before being truncated | number | - -lines | maximum number of rows in the text before being truncated | number | `1` -fullWidthRecognition | whether consider full-width character length as 2 when calculate string length | boolean | - +| Property | Description | Type | Default | +| --- | --- | --- | --- | +| tooltip | tooltip for showing the full text content when hovering over | boolean | - | +| length | maximum number of characters in the text before being truncated | number | - | +| lines | maximum number of rows in the text before being truncated | number | `1` | +| fullWidthRecognition | whether consider full-width character length as 2 when calculate string length | boolean | - | diff --git a/src/components/Ellipsis/index.zh-CN.md b/src/components/Ellipsis/index.zh-CN.md index f7a70ead..1875b17c 100644 --- a/src/components/Ellipsis/index.zh-CN.md +++ b/src/components/Ellipsis/index.zh-CN.md @@ -9,9 +9,9 @@ order: 10 ## API -参数 | 说明 | 类型 | 默认值 -----|------|-----|------ -tooltip | 移动到文本展示完整内容的提示 | boolean | - -length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | - -lines | 在按照行数截取下最大的行数,超过则截取省略 | number | `1` -fullWidthRecognition | 是否将全角字符的长度视为2来计算字符串长度 | boolean | - +| 参数 | 说明 | 类型 | 默认值 | +| -------------------- | ------------------------------------------------ | ------- | ------ | +| tooltip | 移动到文本展示完整内容的提示 | boolean | - | +| length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | - | +| lines | 在按照行数截取下最大的行数,超过则截取省略 | number | `1` | +| fullWidthRecognition | 是否将全角字符的长度视为 2 来计算字符串长度 | boolean | - | diff --git a/src/components/Exception/demo/403.md b/src/components/Exception/demo/403.md index c0244ab1..aa65a713 100644 --- a/src/components/Exception/demo/403.md +++ b/src/components/Exception/demo/403.md @@ -13,7 +13,7 @@ title: 403 page with custom operations. -````jsx +```jsx import Exception from 'ant-design-pro/lib/Exception'; import { Button } from 'antd'; @@ -23,7 +23,5 @@ const actions = ( ); -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Exception/demo/404.md b/src/components/Exception/demo/404.md index c54e99d4..6510923c 100644 --- a/src/components/Exception/demo/404.md +++ b/src/components/Exception/demo/404.md @@ -13,10 +13,8 @@ title: 404 page. -````jsx +```jsx import Exception from 'ant-design-pro/lib/Exception'; -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Exception/demo/500.md b/src/components/Exception/demo/500.md index 2336e41e..b017e771 100644 --- a/src/components/Exception/demo/500.md +++ b/src/components/Exception/demo/500.md @@ -13,10 +13,8 @@ title: 500 page. -````jsx +```jsx import Exception from 'ant-design-pro/lib/Exception'; -ReactDOM.render( - -, mountNode); -```` +ReactDOM.render(, mountNode); +``` diff --git a/src/components/Exception/index.en-US.md b/src/components/Exception/index.en-US.md index 37e7e807..9e8f5166 100644 --- a/src/components/Exception/index.en-US.md +++ b/src/components/Exception/index.en-US.md @@ -8,13 +8,13 @@ Exceptions page is used to provide feedback on specific abnormal state. Usually, ## API -Property | Description | Type | Default ----------|-------------|------|-------- +| Property | Description | Type | Default | +| --- | --- | --- | --- | | backText | default return button text | ReactNode | back to home | -type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | - -title | title | ReactNode | - -desc | supplementary description | ReactNode | - -img | the url of background image | string | - -actions | suggested operations, a default 'Home' link will show if not set | ReactNode | - -linkElement | to specify the element of link | string\|ReactElement | 'a' -redirect | redirect path | string | '/' \ No newline at end of file +| type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | - | +| title | title | ReactNode | - | +| desc | supplementary description | ReactNode | - | +| img | the url of background image | string | - | +| actions | suggested operations, a default 'Home' link will show if not set | ReactNode | - | +| linkElement | to specify the element of link | string\|ReactElement | 'a' | +| redirect | redirect path | string | '/' | diff --git a/src/components/Exception/index.zh-CN.md b/src/components/Exception/index.zh-CN.md index 2e64399f..0769e6d7 100644 --- a/src/components/Exception/index.zh-CN.md +++ b/src/components/Exception/index.zh-CN.md @@ -9,13 +9,13 @@ order: 5 ## API -| 参数 | 说明| 类型 | 默认值 | -|-------------|------------------------------------------|-------------|-------| -| backText| 默认的返回按钮文本 | ReactNode| back to home | -| type| 页面类型,若配置,则自带对应类型默认的 `title`,`desc`,`img`,此默认设置可以被 `title`,`desc`,`img` 覆盖 | Enum {'403', '404', '500'} | - | -| title | 标题 | ReactNode| -| -| desc| 补充描述| ReactNode| -| -| img | 背景图片地址 | string| -| -| actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效| ReactNode| -| +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| backText | 默认的返回按钮文本 | ReactNode | back to home | +| type | 页面类型,若配置,则自带对应类型默认的 `title`,`desc`,`img`,此默认设置可以被 `title`,`desc`,`img` 覆盖 | Enum {'403', '404', '500'} | - | +| title | 标题 | ReactNode | - | +| desc | 补充描述 | ReactNode | - | +| img | 背景图片地址 | string | - | +| actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效 | ReactNode | - | | linkElement | 定义链接的元素 | string\|ReactElement | 'a' | -| redirect | 返回按钮的跳转地址 | string | '/' +| redirect | 返回按钮的跳转地址 | string | '/' | diff --git a/src/components/FooterToolbar/demo/basic.md b/src/components/FooterToolbar/demo/basic.md index 3043dbf7..196f250e 100644 --- a/src/components/FooterToolbar/demo/basic.md +++ b/src/components/FooterToolbar/demo/basic.md @@ -14,7 +14,7 @@ iframe: 400 Fixed to the footer. -````jsx +```jsx import FooterToolbar from 'ant-design-pro/lib/FooterToolbar'; import { Button } from 'antd'; @@ -39,6 +39,7 @@ ReactDOM.render( - -, mountNode); -```` \ No newline at end of file + , + mountNode +); +``` diff --git a/src/components/FooterToolbar/index.en-US.md b/src/components/FooterToolbar/index.en-US.md index 69fd80bd..9816189f 100644 --- a/src/components/FooterToolbar/index.en-US.md +++ b/src/components/FooterToolbar/index.en-US.md @@ -12,7 +12,7 @@ It is fixed at the bottom of the content area and does not move along with the s ## API -Property | Description | Type | Default ----------|-------------|------|-------- -children | toolbar content, align to the right | ReactNode | - -extra | extra information, align to the left | ReactNode | - \ No newline at end of file +| Property | Description | Type | Default | +| -------- | ------------------------------------ | --------- | ------- | +| children | toolbar content, align to the right | ReactNode | - | +| extra | extra information, align to the left | ReactNode | - | diff --git a/src/components/FooterToolbar/index.zh-CN.md b/src/components/FooterToolbar/index.zh-CN.md index 421ac08e..ff52e155 100644 --- a/src/components/FooterToolbar/index.zh-CN.md +++ b/src/components/FooterToolbar/index.zh-CN.md @@ -13,7 +13,7 @@ order: 6 ## API -参数 | 说明 | 类型 | 默认值 -----|------|-----|------ -children | 工具栏内容,向右对齐 | ReactNode | - -extra | 额外信息,向左对齐 | ReactNode | - +| 参数 | 说明 | 类型 | 默认值 | +| -------- | -------------------- | --------- | ------ | +| children | 工具栏内容,向右对齐 | ReactNode | - | +| extra | 额外信息,向左对齐 | ReactNode | - | diff --git a/src/components/GlobalFooter/demo/basic.md b/src/components/GlobalFooter/demo/basic.md index 9a06bade..798846ec 100644 --- a/src/components/GlobalFooter/demo/basic.md +++ b/src/components/GlobalFooter/demo/basic.md @@ -6,32 +6,41 @@ iframe: 400 基本页脚。 -````jsx +```jsx import GlobalFooter from 'ant-design-pro/lib/GlobalFooter'; import { Icon } from 'antd'; -const links = [{ - key: '帮助', - title: '帮助', - href: '', -}, { - key: 'github', - title: , - href: 'https://github.com/ant-design/ant-design-pro', - blankTarget: true, -}, { - key: '条款', - title: '条款', - href: '', - blankTarget: true, -}]; +const links = [ + { + key: '帮助', + title: '帮助', + href: '', + }, + { + key: 'github', + title: , + href: 'https://github.com/ant-design/ant-design-pro', + blankTarget: true, + }, + { + key: '条款', + title: '条款', + href: '', + blankTarget: true, + }, +]; -const copyright =
Copyright 2017 蚂蚁金服体验技术部出品
; +const copyright = ( +
+ Copyright 2017 蚂蚁金服体验技术部出品 +
+); ReactDOM.render(
-
-, mountNode); -```` +
, + mountNode +); +``` diff --git a/src/components/GlobalFooter/index.md b/src/components/GlobalFooter/index.md index 96e04fee..5d6058f6 100644 --- a/src/components/GlobalFooter/index.md +++ b/src/components/GlobalFooter/index.md @@ -9,7 +9,7 @@ order: 7 ## API -参数 | 说明 | 类型 | 默认值 -----|------|-----|------ -links | 链接数据 | array<{ title: ReactNode, href: string, blankTarget?: boolean }> | - -copyright | 版权信息 | ReactNode | - +| 参数 | 说明 | 类型 | 默认值 | +| --------- | -------- | ---------------------------------------------------------------- | ------ | +| links | 链接数据 | array<{ title: ReactNode, href: string, blankTarget?: boolean }> | - | +| copyright | 版权信息 | ReactNode | - | diff --git a/src/components/HeaderSearch/demo/basic.md b/src/components/HeaderSearch/demo/basic.md index 2139207c..ec969988 100644 --- a/src/components/HeaderSearch/demo/basic.md +++ b/src/components/HeaderSearch/demo/basic.md @@ -5,7 +5,7 @@ title: 全局搜索 通常放置在导航工具条右侧。(点击搜索图标预览效果) -````jsx +```jsx import HeaderSearch from 'ant-design-pro/lib/HeaderSearch'; ReactDOM.render( @@ -22,13 +22,14 @@ ReactDOM.render( { + onSearch={value => { console.log('input', value); // eslint-disable-line }} - onPressEnter={(value) => { + onPressEnter={value => { console.log('enter', value); // eslint-disable-line }} /> - -, mountNode); -```` + , + mountNode +); +``` diff --git a/src/components/HeaderSearch/index.en-US.md b/src/components/HeaderSearch/index.en-US.md index 9f2b5e8a..c9906e76 100644 --- a/src/components/HeaderSearch/index.en-US.md +++ b/src/components/HeaderSearch/index.en-US.md @@ -9,14 +9,14 @@ Usually placed as an entry to the global search, placed on the right side of the ## API -参数 | 说明 | 类型 | 默认值 -----|------|-----|------ -placeholder | placeholder text | string | - -dataSource | current list of prompts | string[] | - -onSearch | Called when searching items. | function(value) | - -onChange | Called when select an option or input value change, or value of input is changed | function(value) | - -onSelect | Called when a option is selected. param is option's value and option instance. | function(value) | - -onPressEnter | Callback when pressing Enter | function(value) | - -onVisibleChange | Show or hide the callback of the text box | function(value) |- -defaultOpen | The input box is displayed for the first time. | boolean | false -open | The input box is displayed | boolean |false \ No newline at end of file +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| placeholder | placeholder text | string | - | +| dataSource | current list of prompts | string[] | - | +| onSearch | Called when searching items. | function(value) | - | +| onChange | Called when select an option or input value change, or value of input is changed | function(value) | - | +| onSelect | Called when a option is selected. param is option's value and option instance. | function(value) | - | +| onPressEnter | Callback when pressing Enter | function(value) | - | +| onVisibleChange | Show or hide the callback of the text box | function(value) | - | +| defaultOpen | The input box is displayed for the first time. | boolean | false | +| open | The input box is displayed | boolean | false | diff --git a/src/components/HeaderSearch/index.zh-CN.md b/src/components/HeaderSearch/index.zh-CN.md index 83e74887..8561eee8 100644 --- a/src/components/HeaderSearch/index.zh-CN.md +++ b/src/components/HeaderSearch/index.zh-CN.md @@ -9,14 +9,14 @@ order: 8 ## API -参数 | 说明 | 类型 | 默认值 -----|------|-----|------ -placeholder | 占位文字 | string | - -dataSource | 当前提示内容列表 | string[] | - -onSearch | 搜索补全项的时候调用 | function(value) | - -onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | - -onSelect | 被选中时调用,参数为选中项的 value 值 | function(value) | - -onPressEnter | 按下回车时的回调 | function(value) | - -onVisibleChange | 显示或隐藏文本框的回调 | function(value) |- -defaultOpen | 输入框首次显示是否显示 | boolean | false -open | 控制输入框是否显示 | boolean |false \ No newline at end of file +| 参数 | 说明 | 类型 | 默认值 | +| --------------- | ------------------------------------------------- | --------------- | ------ | +| placeholder | 占位文字 | string | - | +| dataSource | 当前提示内容列表 | string[] | - | +| onSearch | 搜索补全项的时候调用 | function(value) | - | +| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | - | +| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value) | - | +| onPressEnter | 按下回车时的回调 | function(value) | - | +| onVisibleChange | 显示或隐藏文本框的回调 | function(value) | - | +| defaultOpen | 输入框首次显示是否显示 | boolean | false | +| open | 控制输入框是否显示 | boolean | false | diff --git a/src/components/Login/demo/basic.md b/src/components/Login/demo/basic.md index 05475384..28cce5d5 100644 --- a/src/components/Login/demo/basic.md +++ b/src/components/Login/demo/basic.md @@ -7,7 +7,7 @@ title: Support login with account and mobile number. -````jsx +```jsx import Login from 'ant-design-pro/lib/Login'; import { Alert, Checkbox } from 'antd'; @@ -30,27 +30,23 @@ class LoginDemo extends React.Component { notice: '', }, () => { - if ( - !err && - (values.username !== 'admin' || values.password !== '888888') - ) { + if (!err && (values.username !== 'admin' || values.password !== '888888')) { setTimeout(() => { this.setState({ - notice: - 'The combination of username and password is incorrect!', + notice: 'The combination of username and password is incorrect!', }); }, 500); } - }, + } ); } }; - onTabChange = (key) => { + onTabChange = key => { this.setState({ type: key, }); }; - changeAutoLogin = (e) => { + changeAutoLogin = e => { this.setState({ autoLogin: e.target.checked, }); @@ -78,16 +74,10 @@ class LoginDemo extends React.Component { - console.log('Get captcha!')} - name="captcha" - /> + console.log('Get captcha!')} name="captcha" />
- + Keep me logged in @@ -111,7 +101,7 @@ class LoginDemo extends React.Component { } ReactDOM.render(, mountNode); -```` +```