From 5a9d3c079c183357757111e807ffa5b11087250e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Thu, 17 Jan 2019 14:40:41 +0800 Subject: [PATCH 001/109] fix: error-processing-request (#3402) * Close: #3398 * error authority is undefined --- src/app.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index 7de5a69e..0f35ff9a 100644 --- a/src/app.js +++ b/src/app.js @@ -8,11 +8,12 @@ export const dva = { }, }; -let authRoutes = null; +let authRoutes = {}; function ergodicRoutes(routes, authKey, authority) { routes.forEach(element => { if (element.path === authKey) { + if (!element.authority) element.authority = []; // eslint-disable-line Object.assign(element.authority, authority || []); } else if (element.routes) { ergodicRoutes(element.routes, authKey, authority); @@ -31,8 +32,13 @@ export function patchRoutes(routes) { export function render(oldRender) { fetch('/api/auth_routes') .then(res => res.json()) - .then(ret => { - authRoutes = ret; - oldRender(); - }); + .then( + ret => { + authRoutes = ret; + oldRender(); + }, + () => { + oldRender(); + } + ); } From 8ce6a73cf07795f942bbce104c94823638292564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 17 Jan 2019 20:17:16 +0800 Subject: [PATCH 002/109] feat: add new config "menu.enableLocale" (#3310) * feat: add new config "layoutLocal" * Use enableLayoutLocale instead of layoutLocale * Use enableMenuLocale instead of enableMenuLocale * use menu.disableLocal --- package.json | 2 +- src/defaultSettings.js | 3 +++ src/layouts/BasicLayout.js | 19 +++++++++++-------- src/models/menu.js | 9 +++++++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index f2b4fe0e..52f298c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "2.2.0", + "version": "2.2.1", "description": "An out-of-box UI solution for enterprise applications", "private": true, "scripts": { diff --git a/src/defaultSettings.js b/src/defaultSettings.js index 0c611097..ad025cae 100644 --- a/src/defaultSettings.js +++ b/src/defaultSettings.js @@ -6,5 +6,8 @@ module.exports = { fixedHeader: false, // sticky header autoHideHeader: false, // auto hide header fixSiderbar: false, // sticky siderbar + menu: { + disableLocal: false, + }, title: 'Ant Design Pro', }; diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 914f47f8..bd7e6eb9 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -17,7 +17,8 @@ import Context from './MenuContext'; import Exception403 from '../pages/Exception/403'; import PageLoading from '@/components/PageLoading'; import SiderMenu from '@/components/SiderMenu'; -import { title } from '../defaultSettings'; +import { menu, title } from '../defaultSettings'; + import styles from './BasicLayout.less'; // lazy load SettingDrawer @@ -118,10 +119,12 @@ class BasicLayout extends React.PureComponent { if (!currRouterData) { return title; } - const pageName = formatMessage({ - id: currRouterData.locale || currRouterData.name, - defaultMessage: currRouterData.name, - }); + const pageName = menu.disableLocal + ? currRouterData.name + : formatMessage({ + id: currRouterData.locale || currRouterData.name, + defaultMessage: currRouterData.name, + }); return `${pageName} - ${title}`; }; @@ -220,11 +223,11 @@ class BasicLayout extends React.PureComponent { } } -export default connect(({ global, setting, menu }) => ({ +export default connect(({ global, setting, menu: menuModel }) => ({ collapsed: global.collapsed, layout: setting.layout, - menuData: menu.menuData, - breadcrumbNameMap: menu.breadcrumbNameMap, + menuData: menuModel.menuData, + breadcrumbNameMap: menuModel.breadcrumbNameMap, ...setting, }))(props => ( diff --git a/src/models/menu.js b/src/models/menu.js index 9cc54fb5..218c7065 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -2,6 +2,7 @@ import memoizeOne from 'memoize-one'; import isEqual from 'lodash/isEqual'; import { formatMessage } from 'umi/locale'; import Authorized from '@/utils/Authorized'; +import { menu } from '../defaultSettings'; const { check } = Authorized; @@ -19,10 +20,14 @@ function formatter(data, parentAuthority, parentName) { } else { locale = `menu.${item.name}`; } - + // if enableMenuLocale use item.name, + // close menu international + const name = menu.disableLocal + ? item.name + : formatMessage({ id: locale, defaultMessage: item.name }); const result = { ...item, - name: formatMessage({ id: locale, defaultMessage: item.name }), + name, locale, authority: item.authority || parentAuthority, }; From 19eac9416cf2dcddef1730893059a9ee355ddecc Mon Sep 17 00:00:00 2001 From: Zhongjie Wu Date: Fri, 18 Jan 2019 14:34:01 +0800 Subject: [PATCH 003/109] Fix an issue in list item Add (#3423) --- src/pages/List/BasicList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/List/BasicList.js b/src/pages/List/BasicList.js index b52a2999..1e33cbce 100644 --- a/src/pages/List/BasicList.js +++ b/src/pages/List/BasicList.js @@ -322,7 +322,7 @@ class BasicList extends PureComponent { Date: Fri, 18 Jan 2019 16:16:15 +0800 Subject: [PATCH 004/109] try fix test error (#3424) * try fix test error * try fix ci error in windows --- jest-puppeteer.config.js | 1 - tests/run-tests.js | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index d720fc2b..58c2b54d 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -9,7 +9,6 @@ module.exports = { '--no-first-run', '--no-sandbox', '--no-zygote', - '--single-process', ], }, }; diff --git a/tests/run-tests.js b/tests/run-tests.js index 02c42b08..5735ada4 100644 --- a/tests/run-tests.js +++ b/tests/run-tests.js @@ -24,7 +24,11 @@ startServer.on('exit', () => { console.log('Starting development server for e2e tests...'); startServer.stdout.on('data', data => { console.log(data.toString()); - if (!once && data.toString().indexOf('Compiled successfully') >= 0) { + // hack code , wait umi + if ( + (!once && data.toString().indexOf('Compiled successfully') >= 0) || + data.toString().indexOf('Theme generated successfully') >= 0 + ) { // eslint-disable-next-line once = true; console.log('Development server is started, ready to run tests.'); From 3ee45d4c86cfdadcd96a32a5c93efc8e4f52eda1 Mon Sep 17 00:00:00 2001 From: In Date: Mon, 21 Jan 2019 11:11:16 +0800 Subject: [PATCH 005/109] feat: Routing is in the root directory can also matchs. (#3364) --- src/components/SiderMenu/SiderMenuUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SiderMenu/SiderMenuUtils.js b/src/components/SiderMenu/SiderMenuUtils.js index 6722ed7a..6e04ec13 100644 --- a/src/components/SiderMenu/SiderMenuUtils.js +++ b/src/components/SiderMenu/SiderMenuUtils.js @@ -35,5 +35,6 @@ export const getDefaultCollapsedSubMenus = props => { } = props; return urlToList(pathname) .map(item => getMenuMatches(flatMenuKeys, item)[0]) - .filter(item => item); + .filter(item => item) + .reduce((acc, curr) => [...acc, curr], ['/']); }; From 2d716f0fd50f2741f6482a55b0c8544ba8c2db48 Mon Sep 17 00:00:00 2001 From: Xudong Cai Date: Tue, 22 Jan 2019 14:03:12 +0800 Subject: [PATCH 006/109] fix viewport content Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead. --- src/pages/document.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/document.ejs b/src/pages/document.ejs index eca451ca..fcdbaca1 100644 --- a/src/pages/document.ejs +++ b/src/pages/document.ejs @@ -3,7 +3,7 @@ - + Ant Design Pro From 4583a4c7754a51e5dd56f25fc7406be042385b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 22 Jan 2019 14:08:13 +0800 Subject: [PATCH 007/109] Set up CI with Azure Pipelines (#3268) * Set up CI with Azure Pipelines --- .circleci/config.yml | 25 --------------- README.md | 3 +- README.ru-RU.md | 3 +- README.zh-CN.md | 3 +- appveyor.yml | 26 --------------- azure-pipelines.yml | 69 ++++++++++++++++++++++++++++++++++++++++ jest-puppeteer.config.js | 1 - 7 files changed, 72 insertions(+), 58 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 appveyor.yml create mode 100644 azure-pipelines.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e6c87e9a..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/node:latest - steps: - - checkout - - run: npm install - - run: npm run lint - - run: npm run build - test: - docker: - - image: circleci/node:latest-browsers - steps: - - checkout - - run: npm install - - run: - command: npm run test:all - no_output_timeout: 30m -workflows: - version: 2 - build_and_test: - jobs: - - build - - test diff --git a/README.md b/README.md index 21268cc6..d1c2c947 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md An out-of-box UI solution for enterprise applications as a React boilerplate. -[![CircleCI Status](https://circleci.com/gh/ant-design/ant-design-pro.svg?style=svg)](https://circleci.com/gh/ant-design/ant-design-pro/) -[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇺🇸) diff --git a/README.ru-RU.md b/README.ru-RU.md index c20880ee..655438e2 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -6,8 +6,7 @@ UI-решение "из коробки" для корпоративных приложений как React boilerplate -[![CircleCI Status](https://circleci.com/gh/ant-design/ant-design-pro.svg?style=svg)](https://circleci.com/gh/ant-design/ant-design-pro/) -[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) diff --git a/README.zh-CN.md b/README.zh-CN.md index e1682437..9b456985 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,8 +6,7 @@ 开箱即用的中台前端/设计解决方案。 -[![CircleCI Status](https://circleci.com/gh/ant-design/ant-design-pro.svg?style=svg)](https://circleci.com/gh/ant-design/ant-design-pro/) -[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index f2ffbbd4..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Test against the latest version of this Node.js version -environment: - nodejs_version: '10' - -# this is how to allow failing jobs in the matrix -matrix: - fast_finish: true # set this flag to immediately finish build once one of the jobs fails. - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node.js or io.js - - ps: Install-Product node $env:nodejs_version - # install modules - - npm install - # Output useful info for debugging. - - node --version - - npm --version - -# Post-install test scripts. -test_script: - - npm run lint - - npm run test:all - - npm run build - -# Don't actually build. -build: off diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..51f38ac9 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,69 @@ +# Node.js +# Build a general Node.js project with npm. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript +name: ant design pro + +trigger: + - master + +resources: + repositories: + - repository: self + fetchDepth: 1 + +jobs: + - job: lintAndBuild + + pool: + vmImage: 'Ubuntu-16.04' + + steps: + - script: yarn install + displayName: install + - script: npm run lint + displayName: lint + - script: npm run build + displayName: build + + - job: test + pool: + vmImage: 'Ubuntu-16.04' + + container: + image: circleci/node:latest-browsers + options: '-u root' + + steps: + - script: yarn install + displayName: install + - script: npm run test:all + displayName: test + + - job: Windows + pool: + vmImage: 'vs2017-win2016' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '11.x' + - script: yarn install + displayName: install + - script: npm run lint + displayName: lint + - script: npm run build + displayName: build + + - job: MacOS + pool: + vmImage: 'macOS-10.13' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '11.x' + - script: yarn install + displayName: install + - script: npm run lint + displayName: lint + - script: npm run build + displayName: build diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 58c2b54d..1a88f6bb 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -1,7 +1,6 @@ // ps https://github.com/GoogleChrome/puppeteer/issues/3120 module.exports = { launch: { - headless: true, args: [ '--disable-gpu', '--disable-dev-shm-usage', From a849ab0c396ce166f9d4f4c02ac672f42319c355 Mon Sep 17 00:00:00 2001 From: Zhongjie Wu Date: Wed, 23 Jan 2019 11:06:49 +0800 Subject: [PATCH 008/109] change some js filemod to 644 (#3447) --- src/pages/Dashboard/IntroduceRow.js | 0 src/pages/Dashboard/OfflineData.js | 0 src/pages/Dashboard/ProportionSales.js | 0 src/pages/Dashboard/SalesCard.js | 0 src/pages/Dashboard/TopSearch.js | 0 5 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/pages/Dashboard/IntroduceRow.js mode change 100755 => 100644 src/pages/Dashboard/OfflineData.js mode change 100755 => 100644 src/pages/Dashboard/ProportionSales.js mode change 100755 => 100644 src/pages/Dashboard/SalesCard.js mode change 100755 => 100644 src/pages/Dashboard/TopSearch.js diff --git a/src/pages/Dashboard/IntroduceRow.js b/src/pages/Dashboard/IntroduceRow.js old mode 100755 new mode 100644 diff --git a/src/pages/Dashboard/OfflineData.js b/src/pages/Dashboard/OfflineData.js old mode 100755 new mode 100644 diff --git a/src/pages/Dashboard/ProportionSales.js b/src/pages/Dashboard/ProportionSales.js old mode 100755 new mode 100644 diff --git a/src/pages/Dashboard/SalesCard.js b/src/pages/Dashboard/SalesCard.js old mode 100755 new mode 100644 diff --git a/src/pages/Dashboard/TopSearch.js b/src/pages/Dashboard/TopSearch.js old mode 100755 new mode 100644 From cca3b70d47f2b319e05e9db2d5fba8821ed3a939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E4=B9=90?= Date: Wed, 23 Jan 2019 11:07:45 +0800 Subject: [PATCH 009/109] fix #2851 (#3440) --- src/components/NoticeIcon/demo/popover.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/NoticeIcon/demo/popover.md b/src/components/NoticeIcon/demo/popover.md index e49e2a2f..be6bb861 100644 --- a/src/components/NoticeIcon/demo/popover.md +++ b/src/components/NoticeIcon/demo/popover.md @@ -152,18 +152,21 @@ ReactDOM.render( > Date: Fri, 25 Jan 2019 17:13:49 +0800 Subject: [PATCH 010/109] add responsive-table (#3472) --- src/global.less | 19 +++++++++++++++++++ src/pages/List/TableList.js | 3 +-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/global.less b/src/global.less index fccd7e83..1450ba46 100644 --- a/src/global.less +++ b/src/global.less @@ -1,3 +1,5 @@ +@import '~antd/lib/style/themes/default.less'; + html, body, #root { @@ -31,3 +33,20 @@ ul, ol { list-style: none; } + +@media (max-width: @screen-xs) { + .ant-table { + width: 100%; + overflow-x: auto; + &-thead > tr, + &-tbody > tr { + > th, + > td { + white-space: pre; + > span { + display: block; + } + } + } + } +} diff --git a/src/pages/List/TableList.js b/src/pages/List/TableList.js index 13f5fb60..131d61aa 100644 --- a/src/pages/List/TableList.js +++ b/src/pages/List/TableList.js @@ -301,7 +301,6 @@ class TableList extends PureComponent { title: '服务调用次数', dataIndex: 'callNo', sorter: true, - align: 'right', render: val => `${val} 万`, // mark to display a total number needTotal: true, @@ -598,7 +597,7 @@ class TableList extends PureComponent {
-
+
From 189c5882c30dd8388f3a581dc010c3e3cd18eecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 25 Jan 2019 17:21:16 +0800 Subject: [PATCH 011/109] remove PureComponent (#3470) * remove PureComponent * fix typo --- src/components/SiderMenu/SiderMenu.js | 2 +- src/components/SiderMenu/index.less | 4 +- src/layouts/BasicLayout.js | 2 +- src/layouts/Header.js | 4 +- src/layouts/UserLayout.js | 54 ++++++++++----------------- 5 files changed, 25 insertions(+), 41 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index e1b49d00..2522b4f0 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -51,7 +51,7 @@ export default class SiderMenu extends PureComponent { const defaultProps = collapsed ? {} : { openKeys }; const siderClassName = classNames(styles.sider, { - [styles.fixSiderbar]: fixSiderbar, + [styles.fixSiderBar]: fixSiderbar, [styles.light]: theme === 'light', }); return ( diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index 9ae37db1..d801b4bd 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -25,13 +25,13 @@ font-weight: 600; } } - .sider { min-height: 100vh; box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); position: relative; z-index: 10; - &.fixSiderbar { + &.fixSiderBar { + box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); position: fixed; top: 0; left: 0; diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index bd7e6eb9..4e9c2e52 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -51,7 +51,7 @@ const query = { }, }; -class BasicLayout extends React.PureComponent { +class BasicLayout extends React.Component { constructor(props) { super(props); this.getPageTitle = memoizeOne(this.getPageTitle); diff --git a/src/layouts/Header.js b/src/layouts/Header.js index 3c22510d..0059ee7e 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; import { formatMessage } from 'umi/locale'; import { Layout, message } from 'antd'; import Animate from 'rc-animate'; @@ -10,7 +10,7 @@ import styles from './Header.less'; const { Header } = Layout; -class HeaderView extends PureComponent { +class HeaderView extends Component { state = { visible: true, }; diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js index 16b70ac7..112c61c0 100644 --- a/src/layouts/UserLayout.js +++ b/src/layouts/UserLayout.js @@ -31,42 +31,26 @@ const copyright = ( ); -class UserLayout extends React.PureComponent { - // @TODO title - // getPageTitle() { - // const { routerData, location } = this.props; - // const { pathname } = location; - // let title = 'Ant Design Pro'; - // if (routerData[pathname] && routerData[pathname].name) { - // title = `${routerData[pathname].name} - Ant Design Pro`; - // } - // return title; - // } - - render() { - const { children } = this.props; - return ( - // @TODO -
-
- -
-
-
-
- - logo - Ant Design - -
-
Ant Design 是西湖区最具影响力的 Web 设计规范
-
- {children} +const UserLayout = ({ children }) => ( + // @TODO +
+
+ +
+
+
+
+ + logo + Ant Design +
- +
Ant Design 是西湖区最具影响力的 Web 设计规范
- ); - } -} + {children} +
+ +
+); export default UserLayout; From fe94317e41a1fefe0a1ff8e60f587e4d9bfb65ca Mon Sep 17 00:00:00 2001 From: xiaoyuhen Date: Sun, 27 Jan 2019 15:44:46 +0800 Subject: [PATCH 012/109] chore: upgrade jest-puppeteer and remove some puppeteer config --- jest-puppeteer.config.js | 2 -- package.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 1a88f6bb..090687a3 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -4,9 +4,7 @@ module.exports = { args: [ '--disable-gpu', '--disable-dev-shm-usage', - '--disable-setuid-sandbox', '--no-first-run', - '--no-sandbox', '--no-zygote', ], }, diff --git a/package.json b/package.json index 52f298c9..cc68c65c 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "eslint-plugin-react": "^7.11.1", "gh-pages": "^2.0.1", "husky": "^1.2.0", - "jest-puppeteer": "^3.5.1", + "jest-puppeteer": "^3.9.0", "less": "^3.9.0", "lint-staged": "^8.1.0", "merge-umi-mock-data": "^1.0.4", From 464912e7d0b610f35f1b5c7190843ab26ae8e64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 28 Jan 2019 18:25:06 +0800 Subject: [PATCH 013/109] html prettier (#3473) * prettier html * update dependencies * centering icon * set icon size * edit text --- .prettierignore | 2 -- functions/package.json | 2 +- package.json | 51 ++++++++++++++-------------- src/components/NoticeIcon/index.less | 7 +++- src/components/SelectLang/index.less | 2 +- src/pages/List/CardList.js | 2 +- src/pages/document.ejs | 27 ++++++++------- 7 files changed, 49 insertions(+), 44 deletions(-) diff --git a/.prettierignore b/.prettierignore index 2098c78c..6ce5e018 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,5 @@ **/*.md **/*.svg -**/*.ejs -**/*.html package.json .umi .umi-production diff --git a/functions/package.json b/functions/package.json index dd728197..fe77db2a 100644 --- a/functions/package.json +++ b/functions/package.json @@ -17,7 +17,7 @@ "firebase-functions": "^2.1.0", "mockjs": "^1.0.1-beta3", "moment": "^2.22.2", - "path-to-regexp": "^2.2.1" + "path-to-regexp": "^3.0.0" }, "private": true } diff --git a/package.json b/package.json index cc68c65c..9d57bffe 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "antd": "^3.11.6", "bizcharts": "^3.4.2", "bizcharts-plugin-slider": "^2.1.1-beta.1", - "chalk": "^2.4.2", "classnames": "^2.2.6", "dva": "^2.4.0", "enquire-js": "^0.2.1", @@ -46,62 +45,62 @@ "memoize-one": "^5.0.0", "moment": "^2.22.2", "numeral": "^2.0.6", - "nzh": "^1.0.3", + "nzh": "^1.0.4", "omit.js": "^1.0.0", - "path-to-regexp": "^2.4.0", - "prop-types": "^15.5.10", + "path-to-regexp": "^3.0.0", + "prop-types": "^15.6.2", "qs": "^6.6.0", - "rc-animate": "^2.4.4", - "react": "^16.6.3", + "rc-animate": "^2.6.0", + "react": "^16.7.0", "react-container-query": "^0.11.0", "react-copy-to-clipboard": "^5.0.1", "react-document-title": "^2.0.3", - "react-dom": "^16.6.3", + "react-dom": "^16.7.0", "react-fittext": "^1.0.0", - "react-media": "^1.8.0", + "react-media": "^1.9.2", "react-router-dom": "^4.3.1" }, "devDependencies": { "@types/react": "^16.7.7", "@types/react-dom": "^16.0.10", "antd-pro-merge-less": "^1.0.0", - "antd-theme-webpack-plugin": "^1.1.8", + "antd-theme-webpack-plugin": "^1.2.0", "babel-eslint": "^10.0.1", + "chalk": "^2.4.2", "check-prettier": "^1.0.1", "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", - "enzyme": "3.7.0", - "eslint": "^5.4.0", - "eslint-config-airbnb": "^17.0.0", - "eslint-config-prettier": "^3.0.1", + "enzyme": "3.8.0", + "eslint": "^5.12.1", + "eslint-config-airbnb": "^17.1.0", + "eslint-config-prettier": "^3.6.0", "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-compat": "^2.6.2", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-jsx-a11y": "^6.1.2", - "eslint-plugin-markdown": "^1.0.0-beta.6", - "eslint-plugin-react": "^7.11.1", + "eslint-plugin-compat": "^2.6.3", + "eslint-plugin-import": "^2.15.0", + "eslint-plugin-jsx-a11y": "^6.2.0", + "eslint-plugin-markdown": "^1.0.0", + "eslint-plugin-react": "^7.12.4", "gh-pages": "^2.0.1", - "husky": "^1.2.0", + "husky": "^1.3.1", "jest-puppeteer": "^3.9.0", "less": "^3.9.0", "lint-staged": "^8.1.0", "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", - "prettier": "1.15.2", - "pro-download": "^1.0.1", + "prettier": "1.16.1", "slash2": "^2.0.0", "stylelint": "^9.8.0", "stylelint-config-prettier": "^4.0.0", "stylelint-config-standard": "^18.0.0", - "tslint": "^5.10.0", - "tslint-config-prettier": "^1.10.0", + "tslint": "^5.12.1", + "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", - "umi": "^2.4.2", + "umi": "^2.4.4", "umi-plugin-ga": "^1.1.3", - "umi-plugin-react": "^1.3.4" + "umi-plugin-react": "^1.4.2" }, "optionalDependencies": { - "puppeteer": "^1.10.0" + "puppeteer": "^1.11.0" }, "lint-staged": { "**/*.{js,ts,tsx,json,jsx,less}": [ diff --git a/src/components/NoticeIcon/index.less b/src/components/NoticeIcon/index.less index 3ca7c5d1..529a8f80 100644 --- a/src/components/NoticeIcon/index.less +++ b/src/components/NoticeIcon/index.less @@ -2,6 +2,7 @@ .popover { width: 336px; + position: relative; } .noticeButton { @@ -9,9 +10,13 @@ display: inline-block; transition: all 0.3s; } - .icon { padding: 4px; + vertical-align: middle; +} + +.badge { + font-size: 16px; } .tabs { diff --git a/src/components/SelectLang/index.less b/src/components/SelectLang/index.less index 971ef2aa..91d9df07 100644 --- a/src/components/SelectLang/index.less +++ b/src/components/SelectLang/index.less @@ -14,7 +14,7 @@ vertical-align: top; line-height: @layout-header-height; > i { - font-size: 14px !important; + font-size: 16px !important; transform: none !important; svg { position: relative; diff --git a/src/pages/List/CardList.js b/src/pages/List/CardList.js index 03f799a1..a40f74b7 100644 --- a/src/pages/List/CardList.js +++ b/src/pages/List/CardList.js @@ -86,7 +86,7 @@ class CardList extends PureComponent { ) : ( ) diff --git a/src/pages/document.ejs b/src/pages/document.ejs index fcdbaca1..36be3f61 100644 --- a/src/pages/document.ejs +++ b/src/pages/document.ejs @@ -1,15 +1,18 @@ - - - - - Ant Design Pro - - - - - -
- + + + + + Ant Design Pro + + + + + +
+ From d8a026f293989c22ad6bd4cb3ec19725a1357e82 Mon Sep 17 00:00:00 2001 From: Jing Ma Date: Tue, 29 Jan 2019 09:29:27 +0800 Subject: [PATCH 014/109] Removed redundant colon - zh-CN (#3480) * Removed redundant colon - zh-CN * Removed redundant colon - zh-TW * Removed redundant colon - en-US --- src/locales/en-US/settings.js | 6 +++--- src/locales/zh-CN/settings.js | 6 +++--- src/locales/zh-TW/settings.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/locales/en-US/settings.js b/src/locales/en-US/settings.js index e0de686d..822dd003 100644 --- a/src/locales/en-US/settings.js +++ b/src/locales/en-US/settings.js @@ -25,14 +25,14 @@ export default { 'app.settings.security.medium': 'Medium', 'app.settings.security.weak': 'Weak', 'app.settings.security.password': 'Account Password', - 'app.settings.security.password-description': 'Current password strength:', + 'app.settings.security.password-description': 'Current password strength', 'app.settings.security.phone': 'Security Phone', - 'app.settings.security.phone-description': 'Bound phone:', + 'app.settings.security.phone-description': 'Bound phone', 'app.settings.security.question': 'Security Question', 'app.settings.security.question-description': 'The security question is not set, and the security policy can effectively protect the account security', 'app.settings.security.email': 'Backup Email', - 'app.settings.security.email-description': 'Bound Email:', + 'app.settings.security.email-description': 'Bound Email', 'app.settings.security.mfa': 'MFA Device', 'app.settings.security.mfa-description': 'Unbound MFA device, after binding, can be confirmed twice', diff --git a/src/locales/zh-CN/settings.js b/src/locales/zh-CN/settings.js index f664d37b..df8af434 100644 --- a/src/locales/zh-CN/settings.js +++ b/src/locales/zh-CN/settings.js @@ -25,13 +25,13 @@ export default { 'app.settings.security.medium': '中', 'app.settings.security.weak': '弱', 'app.settings.security.password': '账户密码', - 'app.settings.security.password-description': '当前密码强度:', + 'app.settings.security.password-description': '当前密码强度', 'app.settings.security.phone': '密保手机', - 'app.settings.security.phone-description': '已绑定手机:', + 'app.settings.security.phone-description': '已绑定手机', 'app.settings.security.question': '密保问题', 'app.settings.security.question-description': '未设置密保问题,密保问题可有效保护账户安全', 'app.settings.security.email': '备用邮箱', - 'app.settings.security.email-description': '已绑定邮箱:', + 'app.settings.security.email-description': '已绑定邮箱', 'app.settings.security.mfa': 'MFA 设备', 'app.settings.security.mfa-description': '未绑定 MFA 设备,绑定后,可以进行二次确认', 'app.settings.security.modify': '修改', diff --git a/src/locales/zh-TW/settings.js b/src/locales/zh-TW/settings.js index 8a94de5c..dd45151a 100644 --- a/src/locales/zh-TW/settings.js +++ b/src/locales/zh-TW/settings.js @@ -25,13 +25,13 @@ export default { 'app.settings.security.medium': '中', 'app.settings.security.weak': '弱', 'app.settings.security.password': '賬戶密碼', - 'app.settings.security.password-description': '當前密碼強度:', + 'app.settings.security.password-description': '當前密碼強度', 'app.settings.security.phone': '密保手機', - 'app.settings.security.phone-description': '已綁定手機:', + 'app.settings.security.phone-description': '已綁定手機', 'app.settings.security.question': '密保問題', 'app.settings.security.question-description': '未設置密保問題,密保問題可有效保護賬戶安全', 'app.settings.security.email': '備用郵箱', - 'app.settings.security.email-description': '已綁定郵箱:', + 'app.settings.security.email-description': '已綁定郵箱', 'app.settings.security.mfa': 'MFA 設備', 'app.settings.security.mfa-description': '未綁定 MFA 設備,綁定後,可以進行二次確認', 'app.settings.security.modify': '修改', From a772401309c4552a1c3a3f2c76087db2ff48a61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E4=B9=90?= Date: Tue, 29 Jan 2019 16:24:59 +0800 Subject: [PATCH 015/109] fix: horizontal scroll bar appears on SiderMenu with light navTheme (#3381) * fix: horizontal scroll bar appears on SiderMenu with light navTheme * a better solution --- src/components/SiderMenu/index.less | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index d801b4bd..c08248d1 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -35,9 +35,18 @@ position: fixed; top: 0; left: 0; - :global(.ant-menu-root) { - overflow-y: auto; - height: ~'calc(100vh - @{nav-header-height})'; + :global { + .ant-menu-root { + overflow-y: auto; + height: ~'calc(100vh - @{nav-header-height})'; + } + .ant-menu-inline { + border-right: 0; + .ant-menu-item, + .ant-menu-submenu-title { + width: 100%; + } + } } } &.light { From 007c5c2c4f3db81ca73bab21331b035046172899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 30 Jan 2019 12:10:39 +0800 Subject: [PATCH 016/109] fix Badge error (#3488) * fix tag error * Move flags to badges in README --- README.md | 7 +++---- README.ru-RU.md | 5 +++-- README.zh-CN.md | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d1c2c947..dffbec67 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,11 @@ English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md An out-of-box UI solution for enterprise applications as a React boilerplate. -[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) +[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇺🇸) -[![Gitter](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇨🇳) - +[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/README.ru-RU.md b/README.ru-RU.md index 655438e2..dcd24611 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -6,10 +6,11 @@ UI-решение "из коробки" для корпоративных приложений как React boilerplate -[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) +[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/README.zh-CN.md b/README.zh-CN.md index 9b456985..bbecc625 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,10 +6,10 @@ 开箱即用的中台前端/设计解决方案。 -[![Build Status](https://dev.azure.com/qixiancs/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/qixiancs/ant-design-pro/_build/latest?definitionId=1?branchName=master) +[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) -[![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) From 4b92d80b8fa8c138af3916d5d75547e95ea8c767 Mon Sep 17 00:00:00 2001 From: Zhongjie Wu Date: Wed, 30 Jan 2019 19:33:21 +0800 Subject: [PATCH 017/109] Make "home" optional in breadcrumb (#3416) --- src/components/PageHeader/breadcrumb.js | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/PageHeader/breadcrumb.js b/src/components/PageHeader/breadcrumb.js index 28c71b06..e6afcb54 100644 --- a/src/components/PageHeader/breadcrumb.js +++ b/src/components/PageHeader/breadcrumb.js @@ -100,18 +100,20 @@ export default class BreadcrumbView extends PureComponent { ) : null; }); - // Add home breadcrumbs to your head - extraBreadcrumbItems.unshift( - - {createElement( - linkElement, - { - [linkElement === 'a' ? 'href' : 'to']: '/', - }, - home || 'Home' - )} - - ); + // Add home breadcrumbs to your head if defined + if (home) { + extraBreadcrumbItems.unshift( + + {createElement( + linkElement, + { + [linkElement === 'a' ? 'href' : 'to']: '/', + }, + home + )} + + ); + } return ( {extraBreadcrumbItems} From 54678ba63ee1ce1540448414f342badfecec9b2d Mon Sep 17 00:00:00 2001 From: doudou <809539794@qq.com> Date: Fri, 1 Feb 2019 10:53:07 +0800 Subject: [PATCH 018/109] fixed submenu collapsed when refresh page (#3494) --- src/components/SiderMenu/SiderMenu.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 2522b4f0..b7782f7c 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -18,10 +18,14 @@ export default class SiderMenu extends PureComponent { } static getDerivedStateFromProps(props, state) { - const { pathname } = state; - if (props.location.pathname !== pathname) { + const { pathname, flatMenuKeysLen } = state; + if ( + props.location.pathname !== pathname || + props.flatMenuKeys.length !== flatMenuKeysLen + ) { return { pathname: props.location.pathname, + flatMenuKeysLen: props.flatMenuKeys.length, openKeys: getDefaultCollapsedSubMenus(props), }; } From 8f8d9f9d4e9616abd9080dce096739069673203e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 1 Feb 2019 15:39:13 +0800 Subject: [PATCH 019/109] perf: add checkout config in azure (#3498) --- azure-pipelines.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 51f38ac9..9a2c15c6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,12 +5,10 @@ name: ant design pro trigger: - - master - -resources: - repositories: - - repository: self - fetchDepth: 1 + batch: true + branches: + exclude: + - gh-pages jobs: - job: lintAndBuild @@ -19,6 +17,9 @@ jobs: vmImage: 'Ubuntu-16.04' steps: + - checkout: self + fetchDepth: 1 + clean: false - script: yarn install displayName: install - script: npm run lint @@ -35,6 +36,9 @@ jobs: options: '-u root' steps: + - checkout: self + fetchDepth: 1 + clean: false - script: yarn install displayName: install - script: npm run test:all @@ -44,6 +48,9 @@ jobs: pool: vmImage: 'vs2017-win2016' steps: + - checkout: self + fetchDepth: 1 + clean: false - task: NodeTool@0 inputs: versionSpec: '11.x' @@ -58,6 +65,9 @@ jobs: pool: vmImage: 'macOS-10.13' steps: + - checkout: self + fetchDepth: 1 + clean: false - task: NodeTool@0 inputs: versionSpec: '11.x' From 0b3ec67a4d3bc1285ff762c9d06714fc9dcb0136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Sun, 3 Feb 2019 08:49:28 +0800 Subject: [PATCH 020/109] :up: upgrade deps (#3503) --- package.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 9d57bffe..7b6a2ec0 100644 --- a/package.json +++ b/package.json @@ -31,19 +31,19 @@ "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro" }, "dependencies": { - "@antv/data-set": "^0.10.0", - "@babel/runtime": "^7.2.0", - "antd": "^3.11.6", - "bizcharts": "^3.4.2", + "@antv/data-set": "^0.10.1", + "@babel/runtime": "^7.3.1", + "antd": "^3.13.0", + "bizcharts": "^3.4.3", "bizcharts-plugin-slider": "^2.1.1-beta.1", "classnames": "^2.2.6", - "dva": "^2.4.0", + "dva": "^2.4.1", "enquire-js": "^0.2.1", - "hash.js": "^1.1.5", - "lodash": "^4.17.10", - "lodash-decorators": "^6.0.0", + "hash.js": "^1.1.7", + "lodash": "^4.17.11", + "lodash-decorators": "^6.0.1", "memoize-one": "^5.0.0", - "moment": "^2.22.2", + "moment": "^2.24.0", "numeral": "^2.0.6", "nzh": "^1.0.4", "omit.js": "^1.0.0", @@ -61,22 +61,22 @@ "react-router-dom": "^4.3.1" }, "devDependencies": { - "@types/react": "^16.7.7", - "@types/react-dom": "^16.0.10", + "@types/react": "^16.8.1", + "@types/react-dom": "^16.0.11", "antd-pro-merge-less": "^1.0.0", "antd-theme-webpack-plugin": "^1.2.0", "babel-eslint": "^10.0.1", "chalk": "^2.4.2", "check-prettier": "^1.0.1", - "cross-env": "^5.1.1", + "cross-env": "^5.2.0", "cross-port-killer": "^1.0.1", "enzyme": "3.8.0", - "eslint": "^5.12.1", + "eslint": "^5.13.0", "eslint-config-airbnb": "^17.1.0", - "eslint-config-prettier": "^3.6.0", + "eslint-config-prettier": "^4.0.0", "eslint-plugin-babel": "^5.3.0", "eslint-plugin-compat": "^2.6.3", - "eslint-plugin-import": "^2.15.0", + "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.0", "eslint-plugin-markdown": "^1.0.0", "eslint-plugin-react": "^7.12.4", @@ -84,14 +84,14 @@ "husky": "^1.3.1", "jest-puppeteer": "^3.9.0", "less": "^3.9.0", - "lint-staged": "^8.1.0", + "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", - "prettier": "1.16.1", + "prettier": "1.16.3", "slash2": "^2.0.0", - "stylelint": "^9.8.0", + "stylelint": "^9.10.1", "stylelint-config-prettier": "^4.0.0", - "stylelint-config-standard": "^18.0.0", + "stylelint-config-standard": "^18.2.0", "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", @@ -100,7 +100,7 @@ "umi-plugin-react": "^1.4.2" }, "optionalDependencies": { - "puppeteer": "^1.11.0" + "puppeteer": "^1.12.1" }, "lint-staged": { "**/*.{js,ts,tsx,json,jsx,less}": [ From 18c1ac609e66a4e421dff3e2fae6f4f0e7736f5b Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 3 Feb 2019 17:49:19 -0800 Subject: [PATCH 021/109] fix: unresponsive collapse btn on mobile (#3504) --- src/components/SiderMenu/SiderMenu.js | 14 ++++++++++++-- src/layouts/BasicLayout.js | 9 --------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index b7782f7c..aafd8c06 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -9,6 +9,8 @@ import { getDefaultCollapsedSubMenus } from './SiderMenuUtils'; const BaseMenu = React.lazy(() => import('./BaseMenu')); const { Sider } = Layout; +let firstMount = true; + export default class SiderMenu extends PureComponent { constructor(props) { super(props); @@ -17,6 +19,10 @@ export default class SiderMenu extends PureComponent { }; } + componentDidMount() { + firstMount = false; + } + static getDerivedStateFromProps(props, state) { const { pathname, flatMenuKeysLen } = state; if ( @@ -50,7 +56,7 @@ export default class SiderMenu extends PureComponent { }; render() { - const { logo, collapsed, onCollapse, fixSiderbar, theme } = this.props; + const { logo, collapsed, onCollapse, fixSiderbar, theme, isMobile } = this.props; const { openKeys } = this.state; const defaultProps = collapsed ? {} : { openKeys }; @@ -64,7 +70,11 @@ export default class SiderMenu extends PureComponent { collapsible collapsed={collapsed} breakpoint="lg" - onCollapse={onCollapse} + onCollapse={(collapse) => { + if (firstMount || !isMobile) { + onCollapse(collapse); + } + }} width={256} theme={theme} className={siderClassName} diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 4e9c2e52..cfcf704d 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -75,15 +75,6 @@ class BasicLayout extends React.Component { }); } - componentDidUpdate(preProps) { - // After changing to phone mode, - // if collapsed is true, you need to click twice to display - const { collapsed, isMobile } = this.props; - if (isMobile && !preProps.isMobile && !collapsed) { - this.handleMenuCollapse(false); - } - } - getContext() { const { location, breadcrumbNameMap } = this.props; return { From 2f1c4631c357cd99a7f795ceb75fd52e353b49d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 4 Feb 2019 22:09:43 +0800 Subject: [PATCH 022/109] style: prettier SiderMenu.js (#3501) * style: prettier SiderMenu.js * new config file --- azure-pipelines.yml | 16 ++++++++++------ src/components/SiderMenu/SiderMenu.js | 5 +---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9a2c15c6..05f40567 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,10 +5,7 @@ name: ant design pro trigger: - batch: true - branches: - exclude: - - gh-pages + - master jobs: - job: lintAndBuild @@ -18,13 +15,14 @@ jobs: steps: - checkout: self - fetchDepth: 1 clean: false - script: yarn install displayName: install - script: npm run lint displayName: lint - script: npm run build + env: + PROGRESS: none displayName: build - job: test @@ -42,6 +40,8 @@ jobs: - script: yarn install displayName: install - script: npm run test:all + env: + PROGRESS: none displayName: test - job: Windows @@ -59,6 +59,8 @@ jobs: - script: npm run lint displayName: lint - script: npm run build + env: + PROGRESS: none displayName: build - job: MacOS @@ -75,5 +77,7 @@ jobs: displayName: install - script: npm run lint displayName: lint - - script: npm run build + - script: npm run + env: + PROGRESS: none displayName: build diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index aafd8c06..17f41526 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -25,10 +25,7 @@ export default class SiderMenu extends PureComponent { static getDerivedStateFromProps(props, state) { const { pathname, flatMenuKeysLen } = state; - if ( - props.location.pathname !== pathname || - props.flatMenuKeys.length !== flatMenuKeysLen - ) { + if (props.location.pathname !== pathname || props.flatMenuKeys.length !== flatMenuKeysLen) { return { pathname: props.location.pathname, flatMenuKeysLen: props.flatMenuKeys.length, From 171ec4298d1a6b5a97b1f46599c4a1cb2a4568a6 Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Mon, 4 Feb 2019 22:34:44 +0800 Subject: [PATCH 023/109] fix ci error --- src/components/SiderMenu/SiderMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 17f41526..102b4b44 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -67,7 +67,7 @@ export default class SiderMenu extends PureComponent { collapsible collapsed={collapsed} breakpoint="lg" - onCollapse={(collapse) => { + onCollapse={collapse => { if (firstMount || !isMobile) { onCollapse(collapse); } From 178c48deda9b4278925c32ce72edf8485d83a7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 8 Feb 2019 23:24:34 +0800 Subject: [PATCH 024/109] feat: support pwa config (#3508) * feat: support pwa config * style: change code style --- config/config.js | 18 +++++--- src/defaultSettings.js | 1 + src/global.js | 99 ++++++++++++++++++++++-------------------- 3 files changed, 64 insertions(+), 54 deletions(-) diff --git a/config/config.js b/config/config.js index 887b0614..61fe8e2b 100644 --- a/config/config.js +++ b/config/config.js @@ -5,6 +5,8 @@ import webpackPlugin from './plugin.config'; import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; +const { pwa, primaryColor } = defaultSettings; + const plugins = [ [ 'umi-plugin-react', @@ -22,12 +24,14 @@ const plugins = [ loadingComponent: './components/PageLoading/index', webpackChunkName: true, }, - pwa: { - workboxPluginMode: 'InjectManifest', - workboxOptions: { - importWorkboxFrom: 'local', - }, - }, + pwa: pwa + ? { + workboxPluginMode: 'InjectManifest', + workboxOptions: { + importWorkboxFrom: 'local', + }, + } + : {}, ...(!process.env.TEST && os.platform() === 'darwin' ? { dll: { @@ -67,7 +71,7 @@ export default { // Theme for antd // https://ant.design/docs/react/customize-theme-cn theme: { - 'primary-color': defaultSettings.primaryColor, + 'primary-color': primaryColor, }, externals: { '@antv/data-set': 'DataSet', diff --git a/src/defaultSettings.js b/src/defaultSettings.js index ad025cae..dfdb5341 100644 --- a/src/defaultSettings.js +++ b/src/defaultSettings.js @@ -10,4 +10,5 @@ module.exports = { disableLocal: false, }, title: 'Ant Design Pro', + pwa: true, }; diff --git a/src/global.js b/src/global.js index 62f8cceb..bf60b418 100644 --- a/src/global.js +++ b/src/global.js @@ -1,54 +1,59 @@ import React from 'react'; import { notification, Button, message } from 'antd'; import { formatMessage } from 'umi/locale'; +import defaultSettings from './defaultSettings'; -// Notify user if offline now -window.addEventListener('sw.offline', () => { - message.warning(formatMessage({ id: 'app.pwa.offline' })); -}); +const { pwa } = defaultSettings; +// if pwa is true +if (pwa) { + // Notify user if offline now + window.addEventListener('sw.offline', () => { + message.warning(formatMessage({ id: 'app.pwa.offline' })); + }); -// Pop up a prompt on the page asking the user if they want to use the latest version -window.addEventListener('sw.updated', e => { - const reloadSW = async () => { - // Check if there is sw whose state is waiting in ServiceWorkerRegistration - // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration - const worker = e.detail && e.detail.waiting; - if (!worker) { - return Promise.resolve(); - } - // Send skip-waiting event to waiting SW with MessageChannel - await new Promise((resolve, reject) => { - const channel = new MessageChannel(); - channel.port1.onmessage = event => { - if (event.data.error) { - reject(event.data.error); - } else { - resolve(event.data); - } - }; - worker.postMessage({ type: 'skip-waiting' }, [channel.port2]); + // Pop up a prompt on the page asking the user if they want to use the latest version + window.addEventListener('sw.updated', e => { + const reloadSW = async () => { + // Check if there is sw whose state is waiting in ServiceWorkerRegistration + // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration + const worker = e.detail && e.detail.waiting; + if (!worker) { + return Promise.resolve(); + } + // Send skip-waiting event to waiting SW with MessageChannel + await new Promise((resolve, reject) => { + const channel = new MessageChannel(); + channel.port1.onmessage = event => { + if (event.data.error) { + reject(event.data.error); + } else { + resolve(event.data); + } + }; + worker.postMessage({ type: 'skip-waiting' }, [channel.port2]); + }); + // Refresh current page to use the updated HTML and other assets after SW has skiped waiting + window.location.reload(true); + return true; + }; + const key = `open${Date.now()}`; + const btn = ( + + ); + notification.open({ + message: formatMessage({ id: 'app.pwa.serviceworker.updated' }), + description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }), + btn, + key, + onClose: async () => {}, }); - // Refresh current page to use the updated HTML and other assets after SW has skiped waiting - window.location.reload(true); - return true; - }; - const key = `open${Date.now()}`; - const btn = ( - - ); - notification.open({ - message: formatMessage({ id: 'app.pwa.serviceworker.updated' }), - description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }), - btn, - key, - onClose: async () => {}, }); -}); +} From 1e996d8677ef3bafec663c81e1c9c57d9525e9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 8 Feb 2019 23:24:54 +0800 Subject: [PATCH 025/109] reset ci (#3507) --- azure-pipelines.yml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 05f40567..28457079 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,11 @@ name: ant design pro trigger: - master +resources: + repositories: + - repository: self + fetchDepth: 1 + jobs: - job: lintAndBuild @@ -14,15 +19,11 @@ jobs: vmImage: 'Ubuntu-16.04' steps: - - checkout: self - clean: false - script: yarn install displayName: install - script: npm run lint displayName: lint - script: npm run build - env: - PROGRESS: none displayName: build - job: test @@ -34,23 +35,15 @@ jobs: options: '-u root' steps: - - checkout: self - fetchDepth: 1 - clean: false - script: yarn install displayName: install - script: npm run test:all - env: - PROGRESS: none displayName: test - job: Windows pool: vmImage: 'vs2017-win2016' steps: - - checkout: self - fetchDepth: 1 - clean: false - task: NodeTool@0 inputs: versionSpec: '11.x' @@ -59,17 +52,12 @@ jobs: - script: npm run lint displayName: lint - script: npm run build - env: - PROGRESS: none displayName: build - job: MacOS pool: vmImage: 'macOS-10.13' steps: - - checkout: self - fetchDepth: 1 - clean: false - task: NodeTool@0 inputs: versionSpec: '11.x' @@ -77,7 +65,5 @@ jobs: displayName: install - script: npm run lint displayName: lint - - script: npm run - env: - PROGRESS: none + - script: npm run build displayName: build From 95b490b6184e512a6f32c84feffe382b8fe307d0 Mon Sep 17 00:00:00 2001 From: linyongping Date: Fri, 8 Feb 2019 23:30:05 +0800 Subject: [PATCH 026/109] add actionsText prop to TagSelect, add locales to List page #3367 (#3442) * add actionsText prop to TagSelect, add locales to List page * add actionsText prop to TagSelect, add locales to List page --- src/components/TagSelect/index.d.ts | 1 + src/components/TagSelect/index.js | 21 +++++++++++++++++---- src/locales/en-US.js | 2 ++ src/locales/en-US/component.js | 5 +++++ src/locales/pt-BR.js | 2 ++ src/locales/pt-BR/component.js | 5 +++++ src/locales/zh-CN.js | 2 ++ src/locales/zh-CN/component.js | 5 +++++ src/locales/zh-TW.js | 2 ++ src/locales/zh-TW/component.js | 5 +++++ src/pages/List/Applications.js | 11 ++++++++++- src/pages/List/Articles.js | 11 ++++++++++- src/pages/List/Projects.js | 11 ++++++++++- 13 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 src/locales/en-US/component.js create mode 100644 src/locales/pt-BR/component.js create mode 100644 src/locales/zh-CN/component.js create mode 100644 src/locales/zh-TW/component.js diff --git a/src/components/TagSelect/index.d.ts b/src/components/TagSelect/index.d.ts index 736ca52f..9de30263 100644 --- a/src/components/TagSelect/index.d.ts +++ b/src/components/TagSelect/index.d.ts @@ -7,6 +7,7 @@ export interface ITagSelectProps { value?: string[] | number[]; style?: React.CSSProperties; hideCheckAll?: boolean; + actionsText?: { expandText?: string; collapseText?: string; selectAllText?: string }; } export default class TagSelect extends React.Component { diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index f65764f5..34d6ba2d 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Tag, Icon } from 'antd'; @@ -15,8 +16,18 @@ const TagSelectOption = ({ children, checked, onChange, value }) => ( TagSelectOption.isTagSelectOption = true; class TagSelect extends Component { + static propTypes = { + actionsText: PropTypes.object, + hideCheckAll: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), + }; + static defaultProps = { hideCheckAll: false, + actionsText: { + expandText: 'Expand', + collapseText: 'Collapse', + selectAllText: 'All', + }, }; constructor(props) { @@ -88,19 +99,21 @@ class TagSelect extends Component { render() { const { value, expand } = this.state; - const { children, hideCheckAll, className, style, expandable } = this.props; - + const { children, hideCheckAll, className, style, expandable, actionsText } = this.props; const checkedAll = this.getAllTags().length === value.length; + const { expandText = 'Expand', collapseText = 'Collapse', selectAllText = 'All' } = + actionsText === null ? {} : actionsText; const cls = classNames(styles.tagSelect, className, { [styles.hasExpandTag]: expandable, [styles.expanded]: expand, }); + return (
{hideCheckAll ? null : ( - 全部 + {selectAllText} )} {value && @@ -117,7 +130,7 @@ class TagSelect extends Component { })} {expandable && ( - {expand ? '收起' : '展开'} + {expand ? collapseText : expandText} )}
diff --git a/src/locales/en-US.js b/src/locales/en-US.js index fcaffceb..25f2888c 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -9,6 +9,7 @@ import result from './en-US/result'; import settingDrawer from './en-US/settingDrawer'; import settings from './en-US/settings'; import pwa from './en-US/pwa'; +import component from './en-US/component'; export default { 'navBar.lang': 'Languages', @@ -30,4 +31,5 @@ export default { ...settingDrawer, ...settings, ...pwa, + ...component, }; diff --git a/src/locales/en-US/component.js b/src/locales/en-US/component.js new file mode 100644 index 00000000..3ba7eeda --- /dev/null +++ b/src/locales/en-US/component.js @@ -0,0 +1,5 @@ +export default { + 'component.tagSelect.expand': 'Expand', + 'component.tagSelect.collapse': 'Collapse', + 'component.tagSelect.all': 'All', +}; diff --git a/src/locales/pt-BR.js b/src/locales/pt-BR.js index d0fe21b7..af8bcee5 100644 --- a/src/locales/pt-BR.js +++ b/src/locales/pt-BR.js @@ -9,6 +9,7 @@ import result from './pt-BR/result'; import settingDrawer from './pt-BR/settingDrawer'; import settings from './pt-BR/settings'; import pwa from './pt-BR/pwa'; +import component from './pt-BR/component'; export default { 'navBar.lang': 'Idiomas', @@ -30,4 +31,5 @@ export default { ...settingDrawer, ...settings, ...pwa, + ...component, }; diff --git a/src/locales/pt-BR/component.js b/src/locales/pt-BR/component.js new file mode 100644 index 00000000..1af478de --- /dev/null +++ b/src/locales/pt-BR/component.js @@ -0,0 +1,5 @@ +export default { + 'component.tagSelect.expand': 'Expandir', + 'component.tagSelect.collapse': 'Colapso', + 'component.tagSelect.all': 'Todas', +}; diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index 4330d60a..cf601f37 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -9,6 +9,7 @@ import result from './zh-CN/result'; import settingDrawer from './zh-CN/settingDrawer'; import settings from './zh-CN/settings'; import pwa from './zh-CN/pwa'; +import component from './zh-CN/component'; export default { 'navBar.lang': '语言', @@ -30,4 +31,5 @@ export default { ...settingDrawer, ...settings, ...pwa, + ...component, }; diff --git a/src/locales/zh-CN/component.js b/src/locales/zh-CN/component.js new file mode 100644 index 00000000..1f1feadb --- /dev/null +++ b/src/locales/zh-CN/component.js @@ -0,0 +1,5 @@ +export default { + 'component.tagSelect.expand': '展开', + 'component.tagSelect.collapse': '收起', + 'component.tagSelect.all': '全部', +}; diff --git a/src/locales/zh-TW.js b/src/locales/zh-TW.js index 986820ef..c6217339 100644 --- a/src/locales/zh-TW.js +++ b/src/locales/zh-TW.js @@ -9,6 +9,7 @@ import result from './zh-TW/result'; import settingDrawer from './zh-TW/settingDrawer'; import settings from './zh-TW/settings'; import pwa from './zh-TW/pwa'; +import component from './zh-TW/component'; export default { 'navBar.lang': '語言', @@ -30,4 +31,5 @@ export default { ...settingDrawer, ...settings, ...pwa, + ...component, }; diff --git a/src/locales/zh-TW/component.js b/src/locales/zh-TW/component.js new file mode 100644 index 00000000..ba48e299 --- /dev/null +++ b/src/locales/zh-TW/component.js @@ -0,0 +1,5 @@ +export default { + 'component.tagSelect.expand': '展開', + 'component.tagSelect.collapse': '收起', + 'component.tagSelect.all': '全部', +}; diff --git a/src/pages/List/Applications.js b/src/pages/List/Applications.js index 4f32f8e6..e36012dd 100644 --- a/src/pages/List/Applications.js +++ b/src/pages/List/Applications.js @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react'; import numeral from 'numeral'; import { connect } from 'dva'; +import { FormattedMessage } from 'umi/locale'; import { Row, Col, Form, Card, Select, Icon, Avatar, List, Tooltip, Dropdown, Menu } from 'antd'; import TagSelect from '@/components/TagSelect'; import StandardFormRow from '@/components/StandardFormRow'; @@ -69,6 +70,14 @@ class FilterCardList extends PureComponent { }, }; + const actionsTextMap = { + expandText: , + collapseText: ( + + ), + selectAllText: , + }; + const itemMenu = ( @@ -96,7 +105,7 @@ class FilterCardList extends PureComponent { {getFieldDecorator('category')( - + 类目一 类目二 类目三 diff --git a/src/pages/List/Articles.js b/src/pages/List/Articles.js index 5df46d5f..c1c04b72 100644 --- a/src/pages/List/Articles.js +++ b/src/pages/List/Articles.js @@ -1,6 +1,7 @@ import React, { Component, Fragment } from 'react'; import { connect } from 'dva'; import { Form, Card, Select, List, Tag, Icon, Row, Col, Button } from 'antd'; +import { FormattedMessage } from 'umi/locale'; import TagSelect from '@/components/TagSelect'; import StandardFormRow from '@/components/StandardFormRow'; @@ -104,6 +105,14 @@ class SearchList extends Component { }, }; + const actionsTextMap = { + expandText: , + collapseText: ( + + ), + selectAllText: , + }; + const loadMore = list.length > 0 ? (
@@ -126,7 +135,7 @@ class SearchList extends Component { {getFieldDecorator('category')( - + 类目一 类目二 类目三 diff --git a/src/pages/List/Projects.js b/src/pages/List/Projects.js index 430ca420..3f4a6e9d 100644 --- a/src/pages/List/Projects.js +++ b/src/pages/List/Projects.js @@ -2,6 +2,7 @@ import React, { PureComponent } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { Row, Col, Form, Card, Select, List } from 'antd'; +import { FormattedMessage } from 'umi/locale'; import TagSelect from '@/components/TagSelect'; import AvatarList from '@/components/AvatarList'; @@ -96,6 +97,14 @@ class CoverCardList extends PureComponent { }, }; + const actionsTextMap = { + expandText: , + collapseText: ( + + ), + selectAllText: , + }; + return (
@@ -103,7 +112,7 @@ class CoverCardList extends PureComponent { {getFieldDecorator('category')( - + 类目一 类目二 类目三 From bb045ead169a227387ca24dc0a2f60c249c63b35 Mon Sep 17 00:00:00 2001 From: cwtuan Date: Sun, 10 Feb 2019 15:33:28 +0800 Subject: [PATCH 027/109] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=B9=81=E4=BD=93?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E6=96=87=E6=A1=88=20(#3511)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/zh-TW/globalHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/zh-TW/globalHeader.js b/src/locales/zh-TW/globalHeader.js index 0ab49d62..c7b4e6f6 100644 --- a/src/locales/zh-TW/globalHeader.js +++ b/src/locales/zh-TW/globalHeader.js @@ -3,7 +3,7 @@ export default { 'component.globalHeader.search.example1': '搜索提示壹', 'component.globalHeader.search.example2': '搜索提示二', 'component.globalHeader.search.example3': '搜索提示三', - 'component.globalHeader.help': '使用文檔', + 'component.globalHeader.help': '使用手冊', 'component.globalHeader.notification': '通知', 'component.globalHeader.notification.empty': '妳已查看所有通知', 'component.globalHeader.message': '消息', @@ -12,7 +12,7 @@ export default { 'component.globalHeader.event.empty': '妳已完成所有待辦', 'component.noticeIcon.clear': '清空', 'component.noticeIcon.cleared': '清空了', - 'component.noticeIcon.empty': '暫無數據', + 'component.noticeIcon.empty': '暫無資料', 'component.noticeIcon.loaded': '加載完畢', 'component.noticeIcon.loading-more': '加載更多', }; From 7c1e9d4192224dbf744d8c109b9a1693f11d948b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Mon, 11 Feb 2019 14:01:12 +0800 Subject: [PATCH 028/109] Route authority attribute behavior (#3514) --- src/layouts/BasicLayout.js | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index cfcf704d..89a706a1 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -88,20 +88,29 @@ class BasicLayout extends React.Component { return breadcrumbNameMap[pathKey]; }; - getRouterAuthority = (pathname, routeData) => { - let routeAuthority = ['noAuthority']; - const getAuthority = (key, routes) => { - routes.forEach(route => { - if (route.path && pathToRegexp(route.path).test(key)) { - routeAuthority = route.authority; - } else if (route.routes) { - routeAuthority = getAuthority(key, route.routes); + getRouteAuthority = (pathname, routeData) => { + const routes = routeData.slice(); // clone + let authorities; + + while (routes.length > 0) { + const route = routes.shift(); + // check partial route + if (pathToRegexp(`${route.path}(.*)`).test(pathname)) { + if (route.authority) { + authorities = route.authority; } - return route; - }); - return routeAuthority; - }; - return getAuthority(pathname, routeData); + // is exact route? + if (pathToRegexp(route.path).test(pathname)) { + break; + } + + if (route.routes) { + route.routes.forEach(r => routes.push(r)); + } + } + } + + return authorities; }; getPageTitle = (pathname, breadcrumbNameMap) => { @@ -161,7 +170,7 @@ class BasicLayout extends React.Component { } = this.props; const isTop = PropsLayout === 'topmenu'; - const routerConfig = this.getRouterAuthority(pathname, routes); + const routerConfig = this.getRouteAuthority(pathname, routes); const contentStyle = !fixedHeader ? { paddingTop: 0 } : {}; const layout = ( From 5ef08f7fae2c7b757f91e15e425ca53cdb034101 Mon Sep 17 00:00:00 2001 From: lf7817 <535536456@qq.com> Date: Mon, 11 Feb 2019 15:08:49 +0800 Subject: [PATCH 029/109] fix customize menu icon bug (#3509) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix customize menu icon bug 当采用自定义菜单图标(即通过url引用方式)且菜单折叠时,文字不隐藏 * fix customize menu icon bug 修改样式 --- src/components/SiderMenu/BaseMenu.js | 2 +- src/components/SiderMenu/index.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index 2ad61134..10a0eb76 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/src/components/SiderMenu/BaseMenu.js @@ -15,7 +15,7 @@ const { SubMenu } = Menu; // icon: , const getIcon = icon => { if (typeof icon === 'string' && isUrl(icon)) { - return icon; + return icon} />; } if (typeof icon === 'string') { return ; diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index c08248d1..fc14cd26 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -66,8 +66,8 @@ } .icon { + vertical-align: baseline; width: 14px; - margin-right: 10px; } :global { From 941a061ded4fb7cdfd3e16b1aff28c50ab647468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 12 Feb 2019 10:42:35 +0800 Subject: [PATCH 030/109] feat: add a demo that jump to details (#3502) * feat: add a demo that jump to details * feat: hide progress in coi * remove trigger config * remove fetchDepth: 1 * refactor: userinfo and application from api * style: fix code style --- azure-pipelines.yml | 17 +++++++++------ config/router.config.js | 6 ++++++ mock/profile.js | 33 +++++++++++++++++++++++------ src/pages/List/TableList.js | 6 ++++++ src/pages/Profile/BasicProfile.js | 29 +++++++++++++------------ src/pages/Profile/models/profile.js | 4 ++-- src/services/api.js | 4 ++-- 7 files changed, 69 insertions(+), 30 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 28457079..9c4c97e1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,11 +7,6 @@ name: ant design pro trigger: - master -resources: - repositories: - - repository: self - fetchDepth: 1 - jobs: - job: lintAndBuild @@ -19,11 +14,15 @@ jobs: vmImage: 'Ubuntu-16.04' steps: + - checkout: self + clean: false - script: yarn install displayName: install - script: npm run lint displayName: lint - script: npm run build + env: + PROGRESS: none displayName: build - job: test @@ -38,6 +37,8 @@ jobs: - script: yarn install displayName: install - script: npm run test:all + env: + PROGRESS: none displayName: test - job: Windows @@ -52,6 +53,8 @@ jobs: - script: npm run lint displayName: lint - script: npm run build + env: + PROGRESS: none displayName: build - job: MacOS @@ -65,5 +68,7 @@ jobs: displayName: install - script: npm run lint displayName: lint - - script: npm run build + - script: npm run + env: + PROGRESS: none displayName: build diff --git a/config/router.config.js b/config/router.config.js index 656027d2..733d9013 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -147,6 +147,12 @@ export default [ name: 'basic', component: './Profile/BasicProfile', }, + { + path: '/profile/basic/:id', + name: 'basic', + hideInMenu: true, + component: './Profile/BasicProfile', + }, { path: '/profile/advanced', name: 'advanced', diff --git a/mock/profile.js b/mock/profile.js index 03aecc56..228d686f 100644 --- a/mock/profile.js +++ b/mock/profile.js @@ -1,3 +1,5 @@ +import mockjs from 'mockjs'; + const basicGoods = [ { id: '1234561', @@ -140,19 +142,36 @@ const advancedOperation3 = [ memo: '-', }, ]; - -const getProfileBasicData = { - basicGoods, - basicProgress, -}; - const getProfileAdvancedData = { advancedOperation1, advancedOperation2, advancedOperation3, }; +const { Random } = mockjs; + export default { 'GET /api/profile/advanced': getProfileAdvancedData, - 'GET /api/profile/basic': getProfileBasicData, + 'GET /api/profile/basic': (req, res) => { + const { id } = req.query; + const application = { + id, + status: '已取货', + orderNo: Random.id(), + childOrderNo: Random.id(), + }; + const userInfo = { + name: Random.cname(), + tel: '18100000000', + delivery: '菜鸟物流', + addr: '浙江省杭州市西湖区万塘路18号', + remark: '备注', + }; + res.json({ + userInfo, + application, + basicGoods, + basicProgress, + }); + }, }; diff --git a/src/pages/List/TableList.js b/src/pages/List/TableList.js index 131d61aa..1230c509 100644 --- a/src/pages/List/TableList.js +++ b/src/pages/List/TableList.js @@ -1,6 +1,7 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; import moment from 'moment'; +import router from 'umi/router'; import { Row, Col, @@ -292,6 +293,7 @@ class TableList extends PureComponent { { title: '规则名称', dataIndex: 'name', + render: text => this.previewItem(text)}>{text}, }, { title: '描述', @@ -381,6 +383,10 @@ class TableList extends PureComponent { }); }; + previewItem = id => { + router.push(`/profile/basic/${id}`); + }; + handleFormReset = () => { const { form, dispatch } = this.props; form.resetFields(); diff --git a/src/pages/Profile/BasicProfile.js b/src/pages/Profile/BasicProfile.js index bd0b7c99..c339dba1 100644 --- a/src/pages/Profile/BasicProfile.js +++ b/src/pages/Profile/BasicProfile.js @@ -47,15 +47,18 @@ const progressColumns = [ })) class BasicProfile extends Component { componentDidMount() { - const { dispatch } = this.props; + const { dispatch, match } = this.props; + const { params } = match; + dispatch({ type: 'profile/fetchBasic', + payload: params.id || '1000000000', }); } render() { - const { profile, loading } = this.props; - const { basicGoods, basicProgress } = profile; + const { profile = {}, loading } = this.props; + const { basicGoods = [], basicProgress = [], userInfo = {}, application = {} } = profile; let goodsData = []; if (basicGoods.length) { let num = 0; @@ -142,21 +145,21 @@ class BasicProfile extends Component { }, ]; return ( - + - 1000000000 - 已取货 - 1234123421 - 3214321432 + {application.id} + {application.status} + {application.orderNo} + {application.childOrderNo} - 付小小 - 18100000000 - 菜鸟仓储 - 浙江省杭州市西湖区万塘路18号 - + {userInfo.name} + {userInfo.tel} + {userInfo.delivery} + {userInfo.addr} + {userInfo.remark}
退货商品
diff --git a/src/pages/Profile/models/profile.js b/src/pages/Profile/models/profile.js index de651b8a..3b9a290c 100644 --- a/src/pages/Profile/models/profile.js +++ b/src/pages/Profile/models/profile.js @@ -11,8 +11,8 @@ export default { }, effects: { - *fetchBasic(_, { call, put }) { - const response = yield call(queryBasicProfile); + *fetchBasic({ payload }, { call, put }) { + const response = yield call(queryBasicProfile, payload); yield put({ type: 'show', payload: response, diff --git a/src/services/api.js b/src/services/api.js index f79cefff..6e789bcc 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -58,8 +58,8 @@ export async function queryTags() { return request('/api/tags'); } -export async function queryBasicProfile() { - return request('/api/profile/basic'); +export async function queryBasicProfile(id) { + return request(`/api/profile/basic?id=${id}`); } export async function queryAdvancedProfile() { From ac3744074058fbfb76032b026b4458eda66dfdf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3=E8=80=81=E6=9C=B1?= Date: Tue, 12 Feb 2019 15:17:46 +0800 Subject: [PATCH 031/109] Enhance stylelint rules, fix propTypes error of TagSelect (#3518) * add stylelint shareable config for css modules * fix CSS pseudo element with double colon * support stylelint declaration-block-no-ignored-properties rule * support sorted CSS properties order for readability and consistency * autofix order of all styles by lint:fix script * fix propTypes error of TagSelect component * Revert "autofix order of all styles by lint:fix script" This reverts commit 51cb9d055f607489a259fd878d80c6b6e70c61de. * Revert "support sorted CSS properties order for readability and consistency" This reverts commit ff6c24d263cf5d3f73880bd7a5866efb4911de9f. * make lint:fix work for stylelint * Revert "Revert "autofix order of all styles by lint:fix script"" This reverts commit 946ed0a351542904e70680c166e47a1f5080d1ca. * Revert "Revert "support sorted CSS properties order for readability and consistency"" This reverts commit 31b557e3826e6e5c5cf9b591fc97e24b9b2abb6e. --- .stylelintrc.json | 12 +++-- package.json | 8 +++- src/components/ActiveChart/index.less | 8 ++-- src/components/ArticleListContent/index.less | 16 +++---- src/components/AvatarList/index.less | 4 +- src/components/Charts/ChartCard/index.less | 26 +++++----- src/components/Charts/Field/index.less | 6 +-- src/components/Charts/MiniProgress/index.less | 14 +++--- src/components/Charts/Pie/index.less | 36 +++++++------- src/components/Charts/Radar/index.less | 26 +++++----- src/components/Charts/WaterWave/index.less | 8 ++-- src/components/DescriptionList/index.less | 23 +++++---- src/components/EditableItem/index.less | 4 +- src/components/EditableLinkGroup/index.less | 6 +-- src/components/Ellipsis/index.less | 10 ++-- src/components/Exception/index.less | 22 ++++----- src/components/FooterToolbar/index.less | 14 +++--- src/components/GlobalFooter/index.less | 2 +- src/components/GlobalHeader/index.less | 28 +++++------ src/components/HeaderDropdown/index.less | 2 +- src/components/HeaderSearch/index.less | 8 ++-- src/components/Login/index.less | 10 ++-- src/components/NoticeIcon/NoticeList.less | 30 ++++++------ src/components/NoticeIcon/index.less | 4 +- src/components/NumberInfo/index.less | 24 +++++----- src/components/PageHeader/index.less | 14 +++--- src/components/Result/index.less | 16 +++---- src/components/SelectLang/index.less | 4 +- src/components/SettingDrawer/ThemeColor.less | 14 +++--- src/components/SettingDrawer/index.less | 34 +++++++------- src/components/SiderMenu/index.less | 34 +++++++------- src/components/StandardFormRow/index.less | 18 +++---- src/components/TagSelect/index.js | 2 +- src/components/TagSelect/index.less | 10 ++-- src/components/TopNavHeader/index.less | 22 ++++----- src/components/Trend/index.less | 4 +- src/layouts/Header.less | 2 +- src/layouts/UserLayout.less | 18 +++---- src/pages/Account/Center/Center.less | 20 ++++---- src/pages/Account/Settings/BaseView.less | 8 ++-- .../Account/Settings/GeographicView.less | 4 +- src/pages/Account/Settings/Info.less | 22 ++++----- src/pages/Account/Settings/PhoneView.less | 4 +- src/pages/Dashboard/Analysis.less | 39 +++++++-------- src/pages/Dashboard/Monitor.less | 2 +- src/pages/Dashboard/Workplace.less | 47 ++++++++++--------- src/pages/Forms/StepForm/style.less | 10 ++-- src/pages/Forms/style.less | 18 +++---- src/pages/List/Applications.less | 9 ++-- src/pages/List/BasicList.less | 28 +++++------ src/pages/List/CardList.less | 14 +++--- src/pages/List/Projects.less | 8 ++-- src/pages/List/TableList.less | 8 ++-- src/pages/Profile/AdvancedProfile.less | 10 ++-- src/pages/Profile/BasicProfile.less | 4 +- src/pages/User/Login.less | 6 +-- src/pages/User/Register.less | 2 +- src/utils/utils.less | 34 +++++++------- 58 files changed, 425 insertions(+), 415 deletions(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index b533bdd6..215bf081 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,9 +1,13 @@ { - "extends": ["stylelint-config-standard", "stylelint-config-prettier"], + "extends": [ + "stylelint-config-standard", + "stylelint-config-css-modules", + "stylelint-config-rational-order", + "stylelint-config-prettier" + ], + "plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"], "rules": { - "declaration-empty-line-before": null, "no-descending-specificity": null, - "selector-pseudo-class-no-unknown": null, - "selector-pseudo-element-colon-notation": null + "plugin/declaration-block-no-ignored-properties": true } } diff --git a/package.json b/package.json index 7b6a2ec0..b75d6910 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "build": "umi build", "site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy && npm run docker:push", "analyze": "cross-env ANALYZE=1 umi build", - "lint:style": "stylelint \"src/**/*.less\" --syntax less", + "lint:style": "stylelint 'src/**/*.less' --syntax less", "lint:prettier": "check-prettier lint", "lint": "eslint --ext .js src mock tests && npm run lint:style && npm run lint:prettier", - "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", + "lint:fix": "eslint --fix --ext .js src mock tests && stylelint --fix 'src/**/*.less' --syntax less", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js", "tslint": "npm run tslint:fix", @@ -90,8 +90,12 @@ "prettier": "1.16.3", "slash2": "^2.0.0", "stylelint": "^9.10.1", + "stylelint-config-css-modules": "^1.3.0", "stylelint-config-prettier": "^4.0.0", + "stylelint-config-rational-order": "^0.0.4", "stylelint-config-standard": "^18.2.0", + "stylelint-declaration-block-no-ignored-properties": "^1.1.0", + "stylelint-order": "^2.0.0", "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", diff --git a/src/components/ActiveChart/index.less b/src/components/ActiveChart/index.less index 99079a55..2f5d15f2 100644 --- a/src/components/ActiveChart/index.less +++ b/src/components/ActiveChart/index.less @@ -12,15 +12,15 @@ } .activeChartLegend { position: relative; - font-size: 0; - margin-top: 8px; height: 20px; + margin-top: 8px; + font-size: 0; line-height: 20px; span { display: inline-block; + width: 33.33%; font-size: 12px; text-align: center; - width: 33.33%; } span:first-child { text-align: left; @@ -31,9 +31,9 @@ } .dashedLine { position: relative; - height: 1px; top: -70px; left: -3px; + height: 1px; .line { position: absolute; diff --git a/src/components/ArticleListContent/index.less b/src/components/ArticleListContent/index.less index acf2c919..dd0baa10 100644 --- a/src/components/ArticleListContent/index.less +++ b/src/components/ArticleListContent/index.less @@ -2,25 +2,25 @@ .listContent { .description { - line-height: 22px; max-width: 720px; + line-height: 22px; } .extra { - color: @text-color-secondary; margin-top: 16px; + color: @text-color-secondary; line-height: 22px; & > :global(.ant-avatar) { - vertical-align: top; - margin-right: 8px; - width: 20px; - height: 20px; position: relative; top: 1px; + width: 20px; + height: 20px; + margin-right: 8px; + vertical-align: top; } & > em { + margin-left: 16px; color: @disabled-color; font-style: normal; - margin-left: 16px; } } } @@ -30,8 +30,8 @@ .extra { & > em { display: block; - margin-left: 0; margin-top: 8px; + margin-left: 0; } } } diff --git a/src/components/AvatarList/index.less b/src/components/AvatarList/index.less index 31d67056..45904ce6 100644 --- a/src/components/AvatarList/index.less +++ b/src/components/AvatarList/index.less @@ -11,10 +11,10 @@ .avatarItem { display: inline-block; - font-size: @font-size-base; - margin-left: -8px; width: @avatar-size-base; height: @avatar-size-base; + margin-left: -8px; + font-size: @font-size-base; :global { .ant-avatar { border: 1px solid #fff; diff --git a/src/components/Charts/ChartCard/index.less b/src/components/Charts/ChartCard/index.less index 0ddc486b..282f17d9 100644 --- a/src/components/Charts/ChartCard/index.less +++ b/src/components/Charts/ChartCard/index.less @@ -4,8 +4,8 @@ position: relative; .chartTop { position: relative; - overflow: hidden; width: 100%; + overflow: hidden; } .chartTopMargin { margin-bottom: 12px; @@ -26,45 +26,45 @@ } } .meta { + height: 22px; color: @text-color-secondary; font-size: @font-size-base; line-height: 22px; - height: 22px; } .action { - cursor: pointer; position: absolute; top: 4px; right: 0; line-height: 1; + cursor: pointer; } .total { - overflow: hidden; - text-overflow: ellipsis; - word-break: break-all; - white-space: nowrap; - color: @heading-color; + height: 38px; margin-top: 4px; margin-bottom: 0; + overflow: hidden; + color: @heading-color; font-size: 30px; line-height: 38px; - height: 38px; + white-space: nowrap; + text-overflow: ellipsis; + word-break: break-all; } .content { - margin-bottom: 12px; position: relative; width: 100%; + margin-bottom: 12px; } .contentFixed { position: absolute; - left: 0; bottom: 0; + left: 0; width: 100%; } .footer { - border-top: 1px solid @border-color-split; - padding-top: 9px; margin-top: 8px; + padding-top: 9px; + border-top: 1px solid @border-color-split; & > * { position: relative; } diff --git a/src/components/Charts/Field/index.less b/src/components/Charts/Field/index.less index 170ddc1d..4124471c 100644 --- a/src/components/Charts/Field/index.less +++ b/src/components/Charts/Field/index.less @@ -1,17 +1,17 @@ @import '~antd/lib/style/themes/default.less'; .field { - white-space: nowrap; + margin: 0; overflow: hidden; + white-space: nowrap; text-overflow: ellipsis; - margin: 0; .label, .number { font-size: @font-size-base; line-height: 22px; } .number { - color: @heading-color; margin-left: 8px; + color: @heading-color; } } diff --git a/src/components/Charts/MiniProgress/index.less b/src/components/Charts/MiniProgress/index.less index e5f148cb..40ba70be 100644 --- a/src/components/Charts/MiniProgress/index.less +++ b/src/components/Charts/MiniProgress/index.less @@ -1,31 +1,31 @@ @import '~antd/lib/style/themes/default.less'; .miniProgress { - padding: 5px 0; position: relative; width: 100%; + padding: 5px 0; .progressWrap { - background-color: @background-color-base; position: relative; + background-color: @background-color-base; } .progress { - transition: all 0.4s cubic-bezier(0.08, 0.82, 0.17, 1) 0s; - border-radius: 1px 0 0 1px; - background-color: @primary-color; width: 0; height: 100%; + background-color: @primary-color; + border-radius: 1px 0 0 1px; + transition: all 0.4s cubic-bezier(0.08, 0.82, 0.17, 1) 0s; } .target { position: absolute; top: 0; bottom: 0; span { - border-radius: 100px; position: absolute; top: 0; left: 0; - height: 4px; width: 2px; + height: 4px; + border-radius: 100px; } span:last-child { top: auto; diff --git a/src/components/Charts/Pie/index.less b/src/components/Charts/Pie/index.less index 7249d093..fc961b41 100644 --- a/src/components/Charts/Pie/index.less +++ b/src/components/Charts/Pie/index.less @@ -10,38 +10,38 @@ } .legend { position: absolute; + top: 50%; right: 0; min-width: 200px; - top: 50%; - transform: translateY(-50%); margin: 0 20px; - list-style: none; padding: 0; + list-style: none; + transform: translateY(-50%); li { - cursor: pointer; - margin-bottom: 16px; height: 22px; + margin-bottom: 16px; line-height: 22px; + cursor: pointer; &:last-child { margin-bottom: 0; } } } .dot { - border-radius: 8px; - display: inline-block; - margin-right: 8px; position: relative; top: -1px; - height: 8px; + display: inline-block; width: 8px; + height: 8px; + margin-right: 8px; + border-radius: 8px; } .line { - background-color: @border-color-split; display: inline-block; - margin-right: 8px; width: 1px; height: 16px; + margin-right: 8px; + background-color: @border-color-split; } .legendTitle { color: @text-color; @@ -58,24 +58,24 @@ } .total { position: absolute; - left: 50%; top: 50%; - text-align: center; + left: 50%; max-height: 62px; + text-align: center; transform: translate(-50%, -50%); & > h4 { - color: @text-color-secondary; - font-size: 14px; - line-height: 22px; height: 22px; margin-bottom: 8px; + color: @text-color-secondary; font-weight: normal; + font-size: 14px; + line-height: 22px; } & > p { - color: @heading-color; display: block; - font-size: 1.2em; height: 32px; + color: @heading-color; + font-size: 1.2em; line-height: 32px; white-space: nowrap; } diff --git a/src/components/Charts/Radar/index.less b/src/components/Charts/Radar/index.less index 15b8725c..437a7129 100644 --- a/src/components/Charts/Radar/index.less +++ b/src/components/Charts/Radar/index.less @@ -5,42 +5,42 @@ margin-top: 16px; .legendItem { position: relative; - text-align: center; - cursor: pointer; color: @text-color-secondary; line-height: 22px; + text-align: center; + cursor: pointer; p { margin: 0; } h6 { - color: @heading-color; + margin-top: 4px; + margin-bottom: 0; padding-left: 16px; + color: @heading-color; font-size: 24px; line-height: 32px; - margin-top: 4px; - margin-bottom: 0; } - &:after { - background-color: @border-color-split; + &::after { position: absolute; top: 8px; right: 0; - height: 40px; width: 1px; + height: 40px; + background-color: @border-color-split; content: ''; } } - > :last-child .legendItem:after { + > :last-child .legendItem::after { display: none; } .dot { - border-radius: 6px; - display: inline-block; - margin-right: 6px; position: relative; top: -1px; - height: 6px; + display: inline-block; width: 6px; + height: 6px; + margin-right: 6px; + border-radius: 6px; } } } diff --git a/src/components/Charts/WaterWave/index.less b/src/components/Charts/WaterWave/index.less index 43ba05ca..2e75f214 100644 --- a/src/components/Charts/WaterWave/index.less +++ b/src/components/Charts/WaterWave/index.less @@ -1,15 +1,15 @@ @import '~antd/lib/style/themes/default.less'; .waterWave { - display: inline-block; position: relative; + display: inline-block; transform-origin: left; .text { position: absolute; - left: 0; top: 32px; - text-align: center; + left: 0; width: 100%; + text-align: center; span { color: @text-color-secondary; font-size: 14px; @@ -17,8 +17,8 @@ } h4 { color: @heading-color; - line-height: 32px; font-size: 24px; + line-height: 32px; } } .waterWaveCanvasWrapper { diff --git a/src/components/DescriptionList/index.less b/src/components/DescriptionList/index.less index bfb33fcc..4048a128 100644 --- a/src/components/DescriptionList/index.less +++ b/src/components/DescriptionList/index.less @@ -10,35 +10,34 @@ } .title { - font-size: 14px; + margin-bottom: 16px; color: @heading-color; font-weight: 500; - margin-bottom: 16px; + font-size: 14px; } .term { - // Line-height is 22px IE dom height will calculate error - line-height: 20px; + display: table-cell; padding-bottom: 16px; - margin-right: 8px; color: @heading-color; + // Line-height is 22px IE dom height will calculate error + line-height: 20px; white-space: nowrap; - display: table-cell; - &:after { - content: ':'; - margin: 0 8px 0 2px; + &::after { position: relative; top: -0.5px; + margin: 0 8px 0 2px; + content: ':'; } } .detail { - line-height: 20px; + display: table-cell; width: 100%; padding-bottom: 16px; color: @text-color; - display: table-cell; + line-height: 20px; } &.small { @@ -66,8 +65,8 @@ &.vertical { .term { - padding-bottom: 8px; display: block; + padding-bottom: 8px; } .detail { diff --git a/src/components/EditableItem/index.less b/src/components/EditableItem/index.less index 457a18bd..7fdf3370 100644 --- a/src/components/EditableItem/index.less +++ b/src/components/EditableItem/index.less @@ -1,10 +1,10 @@ @import '~antd/lib/style/themes/default.less'; .editableItem { - line-height: @input-height-base; display: table; width: 100%; margin-top: (@font-size-base * @line-height-base - @input-height-base) / 2; + line-height: @input-height-base; .wrapper { display: table-row; @@ -18,8 +18,8 @@ } .icon { - cursor: pointer; text-align: right; + cursor: pointer; } } } diff --git a/src/components/EditableLinkGroup/index.less b/src/components/EditableLinkGroup/index.less index a421df6f..ba53315d 100644 --- a/src/components/EditableLinkGroup/index.less +++ b/src/components/EditableLinkGroup/index.less @@ -4,11 +4,11 @@ padding: 20px 0 8px 24px; font-size: 0; & > a { - color: @text-color; display: inline-block; - font-size: @font-size-base; - margin-bottom: 13px; width: 25%; + margin-bottom: 13px; + color: @text-color; + font-size: @font-size-base; &:hover { color: @primary-color; } diff --git a/src/components/Ellipsis/index.less b/src/components/Ellipsis/index.less index 2c4a867c..3c0360c1 100644 --- a/src/components/Ellipsis/index.less +++ b/src/components/Ellipsis/index.less @@ -1,24 +1,24 @@ .ellipsis { - overflow: hidden; display: inline-block; - word-break: break-all; width: 100%; + overflow: hidden; + word-break: break-all; } .lines { position: relative; .shadow { - display: block; position: absolute; + z-index: -999; + display: block; color: transparent; opacity: 0; - z-index: -999; } } .lineClamp { position: relative; + display: -webkit-box; overflow: hidden; text-overflow: ellipsis; - display: -webkit-box; } diff --git a/src/components/Exception/index.less b/src/components/Exception/index.less index b55fe3a9..45a2844b 100644 --- a/src/components/Exception/index.less +++ b/src/components/Exception/index.less @@ -11,24 +11,24 @@ width: 62.5%; padding-right: 152px; zoom: 1; - &:before, - &:after { + &::before, + &::after { content: ' '; display: table; } - &:after { + &::after { clear: both; - visibility: hidden; - font-size: 0; height: 0; + font-size: 0; + visibility: hidden; } } .imgEle { - height: 360px; + float: right; width: 100%; max-width: 430px; - float: right; + height: 360px; background-repeat: no-repeat; background-position: 50% 50%; background-size: contain; @@ -38,18 +38,18 @@ flex: auto; h1 { + margin-bottom: 24px; color: #434e59; - font-size: 72px; font-weight: 600; + font-size: 72px; line-height: 72px; - margin-bottom: 24px; } .desc { + margin-bottom: 16px; color: @text-color-secondary; font-size: 20px; line-height: 28px; - margin-bottom: 16px; } .actions { @@ -73,8 +73,8 @@ display: block; text-align: center; .imgBlock { - padding-right: 0; margin: 0 auto 24px; + padding-right: 0; } } } diff --git a/src/components/FooterToolbar/index.less b/src/components/FooterToolbar/index.less index de6606bd..5073cff6 100644 --- a/src/components/FooterToolbar/index.less +++ b/src/components/FooterToolbar/index.less @@ -2,21 +2,21 @@ .toolbar { position: fixed; - width: 100%; - bottom: 0; right: 0; + bottom: 0; + z-index: 9; + width: 100%; height: 56px; + padding: 0 24px; line-height: 56px; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03); background: #fff; border-top: 1px solid @border-color-split; - padding: 0 24px; - z-index: 9; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03); - &:after { - content: ''; + &::after { display: block; clear: both; + content: ''; } .left { diff --git a/src/components/GlobalFooter/index.less b/src/components/GlobalFooter/index.less index 101dcf04..e4b3dfd4 100644 --- a/src/components/GlobalFooter/index.less +++ b/src/components/GlobalFooter/index.less @@ -1,8 +1,8 @@ @import '~antd/lib/style/themes/default.less'; .globalFooter { - padding: 0 16px; margin: 48px 0 24px 0; + padding: 0 16px; text-align: center; .links { diff --git a/src/components/GlobalHeader/index.less b/src/components/GlobalHeader/index.less index 83a4151e..e66510b9 100644 --- a/src/components/GlobalHeader/index.less +++ b/src/components/GlobalHeader/index.less @@ -3,21 +3,21 @@ @pro-header-hover-bg: rgba(0, 0, 0, 0.025); .header { + position: relative; height: @layout-header-height; padding: 0; background: #fff; box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); - position: relative; } .logo { + display: inline-block; height: @layout-header-height; + padding: 0 0 0 24px; + font-size: 20px; line-height: @layout-header-height; vertical-align: top; - display: inline-block; - padding: 0 0 0 24px; cursor: pointer; - font-size: 20px; img { display: inline-block; vertical-align: middle; @@ -34,11 +34,11 @@ } .trigger { - font-size: 20px; height: @layout-header-height; + padding: ~'calc((@{layout-header-height} - 20px) / 2)' 24px; + font-size: 20px; cursor: pointer; transition: all 0.3s, padding 0s; - padding: ~'calc((@{layout-header-height} - 20px) / 2)' 24px; &:hover { background: @pro-header-hover-bg; } @@ -49,14 +49,14 @@ height: 100%; overflow: hidden; .action { - cursor: pointer; - padding: 0 12px; display: inline-block; - transition: all 0.3s; height: 100%; + padding: 0 12px; + cursor: pointer; + transition: all 0.3s; > i { - vertical-align: middle; color: @text-color; + vertical-align: middle; } &:hover { background: @pro-header-hover-bg; @@ -76,8 +76,8 @@ margin: ~'calc((@{layout-header-height} - 24px) / 2)' 0; margin-right: 8px; color: @primary-color; - background: rgba(255, 255, 255, 0.85); vertical-align: top; + background: rgba(255, 255, 255, 0.85); } } } @@ -111,14 +111,14 @@ padding: 22px 12px; } .logo { - padding-left: 12px; - padding-right: 12px; position: relative; + padding-right: 12px; + padding-left: 12px; } .right { position: absolute; - right: 12px; top: 0; + right: 12px; background: #fff; .account { .avatar { diff --git a/src/components/HeaderDropdown/index.less b/src/components/HeaderDropdown/index.less index 6494de0a..ef0c7591 100644 --- a/src/components/HeaderDropdown/index.less +++ b/src/components/HeaderDropdown/index.less @@ -2,8 +2,8 @@ .container > * { background-color: #fff; - box-shadow: @shadow-1-down; border-radius: 4px; + box-shadow: @shadow-1-down; } @media screen and (max-width: @screen-xs) { diff --git a/src/components/HeaderSearch/index.less b/src/components/HeaderSearch/index.less index e97386d8..88fadecd 100644 --- a/src/components/HeaderSearch/index.less +++ b/src/components/HeaderSearch/index.less @@ -2,21 +2,21 @@ .headerSearch { :global(.anticon-search) { - cursor: pointer; font-size: 16px; + cursor: pointer; } .input { - transition: width 0.3s, margin-left 0.3s; width: 0; background: transparent; border-radius: 0; + transition: width 0.3s, margin-left 0.3s; :global(.ant-select-selection) { background: transparent; } input { - border: 0; - padding-left: 0; padding-right: 0; + padding-left: 0; + border: 0; box-shadow: none !important; } &, diff --git a/src/components/Login/index.less b/src/components/Login/index.less index 646b6631..242e0675 100644 --- a/src/components/Login/index.less +++ b/src/components/Login/index.less @@ -3,9 +3,9 @@ .login { :global { .ant-tabs .ant-tabs-bar { - border-bottom: 0; margin-bottom: 24px; text-align: center; + border-bottom: 0; } .ant-form-item { @@ -19,9 +19,9 @@ } .icon { - font-size: 24px; - color: rgba(0, 0, 0, 0.2); margin-left: 16px; + color: rgba(0, 0, 0, 0.2); + font-size: 24px; vertical-align: middle; cursor: pointer; transition: color 0.3s; @@ -32,9 +32,9 @@ } .other { - text-align: left; margin-top: 24px; line-height: 22px; + text-align: left; .register { float: right; @@ -42,8 +42,8 @@ } .prefixIcon { - font-size: @font-size-base; color: @disabled-color; + font-size: @font-size-base; } .submit { diff --git a/src/components/NoticeIcon/NoticeList.less b/src/components/NoticeIcon/NoticeList.less index 8435414a..fc566ad0 100644 --- a/src/components/NoticeIcon/NoticeList.less +++ b/src/components/NoticeIcon/NoticeList.less @@ -7,19 +7,19 @@ display: none; } .item { - transition: all 0.3s; + padding-right: 24px; + padding-left: 24px; overflow: hidden; cursor: pointer; - padding-left: 24px; - padding-right: 24px; + transition: all 0.3s; .meta { width: 100%; } .avatar { - background: #fff; margin-top: 4px; + background: #fff; } .iconElement { font-size: 32px; @@ -35,58 +35,58 @@ background: @primary-1; } .title { - font-weight: normal; margin-bottom: 8px; + font-weight: normal; } .description { font-size: 12px; line-height: @line-height-base; } .datetime { - font-size: 12px; margin-top: 4px; + font-size: 12px; line-height: @line-height-base; } .extra { float: right; + margin-top: -1.5px; + margin-right: 0; color: @text-color-secondary; font-weight: normal; - margin-right: 0; - margin-top: -1.5px; } } .loadMore { padding: 8px 0; - cursor: pointer; color: @primary-6; text-align: center; + cursor: pointer; &.loadedAll { - cursor: unset; color: rgba(0, 0, 0, 0.25); + cursor: unset; } } } .notFound { - text-align: center; padding: 73px 0 88px 0; color: @text-color-secondary; + text-align: center; img { display: inline-block; - margin-bottom: 16px; height: 76px; + margin-bottom: 16px; } } .clear { height: 46px; + color: @text-color; line-height: 46px; text-align: center; - color: @text-color; - border-radius: 0 0 @border-radius-base @border-radius-base; border-top: 1px solid @border-color-split; - transition: all 0.3s; + border-radius: 0 0 @border-radius-base @border-radius-base; cursor: pointer; + transition: all 0.3s; &:hover { color: @heading-color; diff --git a/src/components/NoticeIcon/index.less b/src/components/NoticeIcon/index.less index 529a8f80..1c0593ee 100644 --- a/src/components/NoticeIcon/index.less +++ b/src/components/NoticeIcon/index.less @@ -1,13 +1,13 @@ @import '~antd/lib/style/themes/default.less'; .popover { - width: 336px; position: relative; + width: 336px; } .noticeButton { - cursor: pointer; display: inline-block; + cursor: pointer; transition: all 0.3s; } .icon { diff --git a/src/components/NumberInfo/index.less b/src/components/NumberInfo/index.less index c8fad650..4a77288c 100644 --- a/src/components/NumberInfo/index.less +++ b/src/components/NumberInfo/index.less @@ -2,51 +2,51 @@ .numberInfo { .suffix { + margin-left: 4px; color: @text-color; font-size: 16px; font-style: normal; - margin-left: 4px; } .numberInfoTitle { + margin-bottom: 16px; color: @text-color; font-size: @font-size-lg; - margin-bottom: 16px; transition: all 0.3s; } .numberInfoSubTitle { + height: 22px; + overflow: hidden; color: @text-color-secondary; font-size: @font-size-base; - height: 22px; line-height: 22px; - overflow: hidden; + white-space: nowrap; text-overflow: ellipsis; word-break: break-all; - white-space: nowrap; } .numberInfoValue { margin-top: 4px; - font-size: 0; overflow: hidden; + font-size: 0; + white-space: nowrap; text-overflow: ellipsis; word-break: break-all; - white-space: nowrap; & > span { - color: @heading-color; display: inline-block; - line-height: 32px; height: 32px; - font-size: 24px; margin-right: 32px; + color: @heading-color; + font-size: 24px; + line-height: 32px; } .subTotal { + margin-right: 0; color: @text-color-secondary; font-size: @font-size-lg; vertical-align: top; - margin-right: 0; i { + margin-left: 4px; font-size: 12px; transform: scale(0.82); - margin-left: 4px; } :global { .anticon-caret-up { diff --git a/src/components/PageHeader/index.less b/src/components/PageHeader/index.less index da947d09..81125bbd 100644 --- a/src/components/PageHeader/index.less +++ b/src/components/PageHeader/index.less @@ -1,8 +1,8 @@ @import '~antd/lib/style/themes/default.less'; .pageHeader { - background: @component-background; padding: 16px 32px 0 32px; + background: @component-background; border-bottom: @border-width-base @border-style-base @border-color-split; .wide { max-width: 1200px; @@ -27,8 +27,8 @@ :global { // 1px 可以让选中效果显示完成 .ant-tabs-bar { - border-bottom: none; margin-bottom: 1px; + border-bottom: none; } } } @@ -38,22 +38,22 @@ margin-right: 16px; padding-top: 1px; > img { + display: block; width: 28px; height: 28px; border-radius: @border-radius-base; - display: block; } } .title { - font-size: 20px; - font-weight: 500; color: @heading-color; + font-weight: 500; + font-size: 20px; } .action { - margin-left: 56px; min-width: 266px; + margin-left: 56px; :global { .ant-btn-group:not(:last-child), @@ -99,8 +99,8 @@ } .extraContent { - margin-left: 88px; min-width: 242px; + margin-left: 88px; } } diff --git a/src/components/Result/index.less b/src/components/Result/index.less index 5cd2aff5..00c95879 100644 --- a/src/components/Result/index.less +++ b/src/components/Result/index.less @@ -1,17 +1,17 @@ @import '~antd/lib/style/themes/default.less'; .result { - text-align: center; width: 72%; margin: 0 auto; + text-align: center; @media screen and (max-width: @screen-xs) { width: 100%; } .icon { + margin-bottom: 24px; font-size: 72px; line-height: 72px; - margin-bottom: 24px; & > .success { color: @success-color; @@ -23,25 +23,25 @@ } .title { - font-size: 24px; + margin-bottom: 16px; color: @heading-color; font-weight: 500; + font-size: 24px; line-height: 32px; - margin-bottom: 16px; } .description { + margin-bottom: 24px; + color: @text-color-secondary; font-size: 14px; line-height: 22px; - color: @text-color-secondary; - margin-bottom: 24px; } .extra { - background: #fafafa; padding: 24px 40px; - border-radius: @border-radius-sm; text-align: left; + background: #fafafa; + border-radius: @border-radius-sm; @media screen and (max-width: @screen-xs) { padding: 18px 20px; diff --git a/src/components/SelectLang/index.less b/src/components/SelectLang/index.less index 91d9df07..9f41ade9 100644 --- a/src/components/SelectLang/index.less +++ b/src/components/SelectLang/index.less @@ -10,9 +10,9 @@ } .dropDown { - cursor: pointer; - vertical-align: top; line-height: @layout-header-height; + vertical-align: top; + cursor: pointer; > i { font-size: 16px !important; transform: none !important; diff --git a/src/components/SettingDrawer/ThemeColor.less b/src/components/SettingDrawer/ThemeColor.less index 4983eb9c..52e63bea 100644 --- a/src/components/SettingDrawer/ThemeColor.less +++ b/src/components/SettingDrawer/ThemeColor.less @@ -1,21 +1,21 @@ .themeColor { - overflow: hidden; margin-top: 24px; + overflow: hidden; .title { - font-size: 14px; + margin-bottom: 12px; color: rgba(0, 0, 0, 0.65); + font-size: 14px; line-height: 22px; - margin-bottom: 12px; } .colorBlock { + float: left; width: 20px; height: 20px; - border-radius: 2px; - float: left; - cursor: pointer; margin-right: 8px; - text-align: center; color: #fff; font-weight: bold; + text-align: center; + border-radius: 2px; + cursor: pointer; } } diff --git a/src/components/SettingDrawer/index.less b/src/components/SettingDrawer/index.less index af4109be..4ee941c0 100644 --- a/src/components/SettingDrawer/index.less +++ b/src/components/SettingDrawer/index.less @@ -1,16 +1,16 @@ @import '~antd/lib/style/themes/default.less'; .content { + position: relative; min-height: 100%; background: #fff; - position: relative; } .blockChecbox { display: flex; .item { - margin-right: 16px; position: relative; + margin-right: 16px; // box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); border-radius: @border-radius-base; cursor: pointer; @@ -23,52 +23,52 @@ top: 0; right: 0; width: 100%; + height: 100%; padding-top: 15px; padding-left: 24px; - height: 100%; color: @primary-color; - font-size: 14px; font-weight: bold; + font-size: 14px; } } .color_block { + display: inline-block; width: 38px; height: 22px; margin: 4px; - border-radius: 4px; - cursor: pointer; margin-right: 12px; - display: inline-block; vertical-align: middle; + border-radius: 4px; + cursor: pointer; } .title { - font-size: 14px; + margin-bottom: 12px; color: @heading-color; + font-size: 14px; line-height: 22px; - margin-bottom: 12px; } .handle { position: absolute; top: 240px; - background: @primary-color; - width: 48px; - height: 48px; right: 300px; + z-index: 0; display: flex; justify-content: center; align-items: center; - cursor: pointer; - pointer-events: auto; - z-index: 0; - text-align: center; + width: 48px; + height: 48px; font-size: 16px; + text-align: center; + background: @primary-color; border-radius: 4px 0 0 4px; + cursor: pointer; + pointer-events: auto; } .productionHint { - font-size: 12px; margin-top: 16px; + font-size: 12px; } diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index fc14cd26..88722c87 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -3,42 +3,42 @@ @nav-header-height: @layout-header-height; .logo { - height: @nav-header-height; position: relative; - line-height: @nav-header-height; + height: @nav-header-height; padding-left: (@menu-collapsed-width - 32px) / 2; - transition: all 0.3s; - background: #002140; overflow: hidden; + line-height: @nav-header-height; + background: #002140; + transition: all 0.3s; img { display: inline-block; - vertical-align: middle; height: 32px; + vertical-align: middle; } h1 { - color: white; display: inline-block; - vertical-align: middle; - font-size: 20px; margin: 0 0 0 12px; - font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; + color: white; font-weight: 600; + font-size: 20px; + font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; + vertical-align: middle; } } .sider { - min-height: 100vh; - box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); position: relative; z-index: 10; + min-height: 100vh; + box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); &.fixSiderBar { - box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); position: fixed; top: 0; left: 0; + box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); :global { .ant-menu-root { - overflow-y: auto; height: ~'calc(100vh - @{nav-header-height})'; + overflow-y: auto; } .ant-menu-inline { border-right: 0; @@ -50,8 +50,8 @@ } } &.light { - box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); background-color: white; + box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); .logo { background: white; box-shadow: 1px 1px 0 0 @border-color-split; @@ -66,8 +66,8 @@ } .icon { - vertical-align: baseline; width: 14px; + vertical-align: baseline; } :global { @@ -87,15 +87,15 @@ .sider-menu-item-img + span, & > .ant-menu-submenu > .ant-menu-submenu-title .sider-menu-item-img + span { - max-width: 0; display: inline-block; + max-width: 0; opacity: 0; } } .ant-menu-item .sider-menu-item-img + span, .ant-menu-submenu-title .sider-menu-item-img + span { - transition: opacity 0.3s @ease-in-out, width 0.3s @ease-in-out; opacity: 1; + transition: opacity 0.3s @ease-in-out, width 0.3s @ease-in-out; } .ant-drawer-left { .ant-drawer-body { diff --git a/src/components/StandardFormRow/index.less b/src/components/StandardFormRow/index.less index 83ab019f..04272333 100644 --- a/src/components/StandardFormRow/index.less +++ b/src/components/StandardFormRow/index.less @@ -1,17 +1,17 @@ @import '~antd/lib/style/themes/default.less'; .standardFormRow { - border-bottom: 1px dashed @border-color-split; - padding-bottom: 16px; - margin-bottom: 16px; display: flex; + margin-bottom: 16px; + padding-bottom: 16px; + border-bottom: 1px dashed @border-color-split; :global { .ant-form-item { margin-right: 24px; } .ant-form-item-label label { - color: @text-color; margin-right: 0; + color: @text-color; } .ant-form-item-label, .ant-form-item-control { @@ -20,16 +20,16 @@ } } .label { + flex: 0 0 auto; + margin-right: 24px; color: @heading-color; font-size: @font-size-base; - margin-right: 24px; - flex: 0 0 auto; text-align: right; & > span { display: inline-block; height: 32px; line-height: 32px; - &:after { + &::after { content: ':'; } } @@ -45,9 +45,9 @@ } .standardFormRowLast { - border: none; - padding-bottom: 0; margin-bottom: 0; + padding-bottom: 0; + border: none; } .standardFormRowBlock { diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index 34d6ba2d..6d0394dd 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -18,7 +18,7 @@ TagSelectOption.isTagSelectOption = true; class TagSelect extends Component { static propTypes = { actionsText: PropTypes.object, - hideCheckAll: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), + hideCheckAll: PropTypes.bool, }; static defaultProps = { diff --git a/src/components/TagSelect/index.less b/src/components/TagSelect/index.less index 834b39a6..93694653 100644 --- a/src/components/TagSelect/index.less +++ b/src/components/TagSelect/index.less @@ -1,23 +1,23 @@ @import '~antd/lib/style/themes/default.less'; .tagSelect { - user-select: none; - margin-left: -8px; position: relative; - overflow: hidden; max-height: 32px; + margin-left: -8px; + overflow: hidden; line-height: 32px; transition: all 0.3s; + user-select: none; :global { .ant-tag { - padding: 0 8px; margin-right: 24px; + padding: 0 8px; font-size: @font-size-base; } } &.expanded { - transition: all 0.3s; max-height: 200px; + transition: all 0.3s; } .trigger { position: absolute; diff --git a/src/components/TopNavHeader/index.less b/src/components/TopNavHeader/index.less index b299fa96..aad3d74e 100644 --- a/src/components/TopNavHeader/index.less +++ b/src/components/TopNavHeader/index.less @@ -1,15 +1,15 @@ @import '~antd/lib/style/themes/default.less'; .head { + position: relative; width: 100%; - transition: background 0.3s, width 0.2s; height: @layout-header-height; box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); - position: relative; + transition: background 0.3s, width 0.2s; :global { .ant-menu-submenu.ant-menu-submenu-horizontal { - line-height: @layout-header-height; height: 100%; + line-height: @layout-header-height; .ant-menu-submenu-title { height: 100%; } @@ -28,8 +28,8 @@ padding-left: 0; } .left { - flex: 1; display: flex; + flex: 1; } .right { width: 324px; @@ -38,24 +38,24 @@ } .logo { + position: relative; width: 165px; height: @layout-header-height; - position: relative; + overflow: hidden; line-height: @layout-header-height; transition: all 0.3s; - overflow: hidden; img { display: inline-block; - vertical-align: middle; height: 32px; + vertical-align: middle; } h1 { - color: #fff; display: inline-block; - vertical-align: top; - font-size: 16px; margin: 0 0 0 12px; + color: #fff; font-weight: 400; + font-size: 16px; + vertical-align: top; } } @@ -66,7 +66,7 @@ } .menu { - border: none; height: @layout-header-height; line-height: @layout-header-height; + border: none; } diff --git a/src/components/Trend/index.less b/src/components/Trend/index.less index b14b802c..13618838 100644 --- a/src/components/Trend/index.less +++ b/src/components/Trend/index.less @@ -7,9 +7,9 @@ .up, .down { - margin-left: 4px; position: relative; top: 1px; + margin-left: 4px; i { font-size: 12px; transform: scale(0.83); @@ -19,8 +19,8 @@ color: @red-6; } .down { - color: @green-6; top: -1px; + color: @green-6; } &.trendItemGrey .up, diff --git a/src/layouts/Header.less b/src/layouts/Header.less index 394bfda1..cc2da962 100644 --- a/src/layouts/Header.less +++ b/src/layouts/Header.less @@ -2,7 +2,7 @@ position: fixed; top: 0; right: 0; - width: 100%; z-index: 9; + width: 100%; transition: width 0.2s; } diff --git a/src/layouts/UserLayout.less b/src/layouts/UserLayout.less index 5eb257a4..ba3d3235 100644 --- a/src/layouts/UserLayout.less +++ b/src/layouts/UserLayout.less @@ -9,18 +9,18 @@ } .lang { - text-align: right; width: 100%; height: 40px; line-height: 44px; + text-align: right; :global(.ant-dropdown-trigger) { margin-right: 24px; } } .content { - padding: 32px 0; flex: 1; + padding: 32px 0; } @media (min-width: @screen-md-min) { @@ -50,22 +50,22 @@ .logo { height: 44px; - vertical-align: top; margin-right: 16px; + vertical-align: top; } .title { - font-size: 33px; - color: @heading-color; - font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; - font-weight: 600; position: relative; top: 2px; + color: @heading-color; + font-weight: 600; + font-size: 33px; + font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif; } .desc { - font-size: @font-size-base; - color: @text-color-secondary; margin-top: 12px; margin-bottom: 40px; + color: @text-color-secondary; + font-size: @font-size-base; } diff --git a/src/pages/Account/Center/Center.less b/src/pages/Account/Center/Center.less index 37d6a203..f6434faf 100644 --- a/src/pages/Account/Center/Center.less +++ b/src/pages/Account/Center/Center.less @@ -2,8 +2,8 @@ @import '~@/utils/utils.less'; .avatarHolder { - text-align: center; margin-bottom: 24px; + text-align: center; & > img { width: 104px; @@ -12,19 +12,19 @@ } .name { + margin-bottom: 4px; + color: @heading-color; + font-weight: 500; font-size: 20px; line-height: 28px; - font-weight: 500; - color: @heading-color; - margin-bottom: 4px; } } .detail { p { + position: relative; margin-bottom: 8px; padding-left: 26px; - position: relative; &:last-child { margin-bottom: 0; @@ -33,10 +33,10 @@ i { position: absolute; - height: 14px; - width: 14px; - left: 0; top: 4px; + left: 0; + width: 14px; + height: 14px; background: url(https://gw.alipayobjects.com/zos/rmsportal/pBjWzVAHnOOtAUvZmZfy.svg); &.title { @@ -55,9 +55,9 @@ .tagsTitle, .teamTitle { - font-weight: 500; - color: @heading-color; margin-bottom: 12px; + color: @heading-color; + font-weight: 500; } .tags { diff --git a/src/pages/Account/Settings/BaseView.less b/src/pages/Account/Settings/BaseView.less index a0a2ffde..e1b09e93 100644 --- a/src/pages/Account/Settings/BaseView.less +++ b/src/pages/Account/Settings/BaseView.less @@ -5,18 +5,18 @@ padding-top: 12px; .left { - max-width: 448px; min-width: 224px; + max-width: 448px; } .right { flex: 1; padding-left: 104px; .avatar_title { height: 22px; - font-size: @font-size-base; + margin-bottom: 8px; color: @heading-color; + font-size: @font-size-base; line-height: 22px; - margin-bottom: 8px; } .avatar { width: 144px; @@ -39,11 +39,11 @@ flex-direction: column-reverse; .right { - padding: 20px; display: flex; flex-direction: column; align-items: center; max-width: 448px; + padding: 20px; .avatar_title { display: none; } diff --git a/src/pages/Account/Settings/GeographicView.less b/src/pages/Account/Settings/GeographicView.less index 22e35a29..fdc97500 100644 --- a/src/pages/Account/Settings/GeographicView.less +++ b/src/pages/Account/Settings/GeographicView.less @@ -2,12 +2,12 @@ .row { .item { - max-width: 220px; width: 50%; + max-width: 220px; } .item:first-child { - margin-right: 8px; width: ~'calc(50% - 8px)'; + margin-right: 8px; } } diff --git a/src/pages/Account/Settings/Info.less b/src/pages/Account/Settings/Info.less index b7a59fba..b391ad55 100644 --- a/src/pages/Account/Settings/Info.less +++ b/src/pages/Account/Settings/Info.less @@ -1,13 +1,13 @@ @import '~antd/lib/style/themes/default.less'; .main { + display: flex; width: 100%; height: 100%; - background-color: @body-background; - display: flex; padding-top: 16px; padding-bottom: 16px; overflow: auto; + background-color: @body-background; .leftmenu { width: 224px; border-right: @border-width-base @border-style-base @border-color-split; @@ -22,16 +22,16 @@ } .right { flex: 1; - padding-left: 40px; - padding-right: 40px; padding-top: 8px; + padding-right: 40px; padding-bottom: 8px; + padding-left: 40px; .title { - font-size: 20px; + margin-bottom: 12px; color: @heading-color; - line-height: 28px; font-weight: 500; - margin-bottom: 12px; + font-size: 20px; + line-height: 28px; } } :global { @@ -48,19 +48,19 @@ .ant-list-item-meta { // 账号绑定图标 .taobao { - color: #ff4000; display: block; + color: #ff4000; font-size: 48px; line-height: 48px; border-radius: @border-radius-base; } .dingding { - background-color: #2eabff; + margin: 2px; + padding: 6px; color: #fff; font-size: 32px; line-height: 32px; - padding: 6px; - margin: 2px; + background-color: #2eabff; border-radius: @border-radius-base; } .alipay { diff --git a/src/pages/Account/Settings/PhoneView.less b/src/pages/Account/Settings/PhoneView.less index 5c85970d..ee4328eb 100644 --- a/src/pages/Account/Settings/PhoneView.less +++ b/src/pages/Account/Settings/PhoneView.less @@ -1,11 +1,11 @@ @import '~antd/lib/style/themes/default.less'; .area_code { + width: 30%; max-width: 128px; margin-right: 8px; - width: 30%; } .phone_number { - max-width: 312px; width: ~'calc(70% - 8px)'; + max-width: 312px; } diff --git a/src/pages/Dashboard/Analysis.less b/src/pages/Dashboard/Analysis.less index 70877d66..f71bd34a 100644 --- a/src/pages/Dashboard/Analysis.less +++ b/src/pages/Dashboard/Analysis.less @@ -3,10 +3,10 @@ .iconGroup { i { - transition: color 0.32s; + margin-left: 16px; color: @text-color-secondary; cursor: pointer; - margin-left: 16px; + transition: color 0.32s; &:hover { color: @text-color; } @@ -19,37 +19,38 @@ list-style: none; li { .clearfix(); - margin-top: 16px; + display: flex; align-items: center; + margin-top: 16px; span { color: @text-color; font-size: 14px; line-height: 22px; } .rankingItemNumber { - background-color: @background-color-base; - border-radius: 20px; display: inline-block; - font-size: 12px; - font-weight: 600; - margin-right: 16px; + width: 20px; height: 20px; + margin-top: 1.5px; + margin-right: 16px; + font-weight: 600; + font-size: 12px; line-height: 20px; - width: 20px; text-align: center; - margin-top: 1.5px; + background-color: @background-color-base; + border-radius: 20px; &.active { - background-color: #314659; color: #fff; + background-color: #314659; } } .rankingItemTitle { flex: 1; + margin-right: 8px; + overflow: hidden; white-space: nowrap; text-overflow: ellipsis; - overflow: hidden; - margin-right: 8px; } } } @@ -58,8 +59,8 @@ display: inline-block; margin-right: 24px; a { - color: @text-color; margin-left: 24px; + color: @text-color; &:hover { color: @primary-color; } @@ -117,14 +118,14 @@ border-bottom: none; } .ant-tabs-nav-container-scrolling { - padding-left: 40px; padding-right: 40px; + padding-left: 40px; } - .ant-tabs-tab-prev-icon:before { + .ant-tabs-tab-prev-icon::before { position: relative; left: 6px; } - .ant-tabs-tab-next-icon:before { + .ant-tabs-tab-next-icon::before { position: relative; right: 6px; } @@ -139,16 +140,16 @@ height: calc(100% - 24px); } div[class^='ant-col']:last-child { + position: absolute\9; right: 0\9; height: 100%\9; - position: absolute\9; } :global { .ant-row { + position: relative\9; display: flex; display: block\9; flex-flow: row wrap; - position: relative\9; } } } diff --git a/src/pages/Dashboard/Monitor.less b/src/pages/Dashboard/Monitor.less index ca41f33e..82d72722 100644 --- a/src/pages/Dashboard/Monitor.less +++ b/src/pages/Dashboard/Monitor.less @@ -2,8 +2,8 @@ @import '~@/utils/utils.less'; .mapChart { - padding-top: 24px; height: 452px; + padding-top: 24px; text-align: center; img { display: inline-block; diff --git a/src/pages/Dashboard/Workplace.less b/src/pages/Dashboard/Workplace.less index 03801711..b67e0b64 100644 --- a/src/pages/Dashboard/Workplace.less +++ b/src/pages/Dashboard/Workplace.less @@ -17,65 +17,66 @@ flex: 0 1 72px; margin-bottom: 8px; & > span { - border-radius: 72px; display: block; width: 72px; height: 72px; + border-radius: 72px; } } .content { position: relative; top: 4px; - margin-left: 24px; flex: 1 1 auto; + margin-left: 24px; color: @text-color-secondary; line-height: 22px; .contentTitle { + margin-bottom: 12px; + color: @heading-color; + font-weight: 500; font-size: 20px; line-height: 28px; - font-weight: 500; - color: @heading-color; - margin-bottom: 12px; } } } .extraContent { .clearfix(); + float: right; white-space: nowrap; .statItem { - padding: 0 32px; position: relative; display: inline-block; + padding: 0 32px; > p:first-child { + margin-bottom: 4px; color: @text-color-secondary; font-size: @font-size-base; line-height: 22px; - margin-bottom: 4px; } > p { + margin: 0; color: @heading-color; font-size: 30px; line-height: 38px; - margin: 0; > span { color: @text-color-secondary; font-size: 20px; } } - &:after { - background-color: @border-color-split; + &::after { position: absolute; top: 8px; right: 0; width: 1px; height: 40px; + background-color: @border-color-split; content: ''; } &:last-child { padding-right: 0; - &:after { + &::after { display: none; } } @@ -85,16 +86,16 @@ .members { a { display: block; - margin: 12px 0; height: 24px; + margin: 12px 0; color: @text-color; transition: all 0.3s; .textOverflow(); .member { + margin-left: 12px; font-size: @font-size-base; line-height: 24px; vertical-align: top; - margin-left: 12px; } &:hover { color: @primary-color; @@ -105,22 +106,22 @@ .projectList { :global { .ant-card-meta-description { - color: @text-color-secondary; height: 44px; - line-height: 22px; overflow: hidden; + color: @text-color-secondary; + line-height: 22px; } } .cardTitle { font-size: 0; a { - color: @heading-color; + display: inline-block; + height: 24px; margin-left: 12px; + color: @heading-color; + font-size: @font-size-base; line-height: 24px; - height: 24px; - display: inline-block; vertical-align: top; - font-size: @font-size-base; &:hover { color: @primary-color; } @@ -131,25 +132,25 @@ } .projectItemContent { display: flex; + height: 20px; margin-top: 8px; overflow: hidden; font-size: 12px; - height: 20px; line-height: 20px; .textOverflow(); a { - color: @text-color-secondary; display: inline-block; flex: 1 1 0; + color: @text-color-secondary; .textOverflow(); &:hover { color: @primary-color; } } .datetime { - color: @disabled-color; flex: 0 0 auto; float: right; + color: @disabled-color; } } } @@ -186,7 +187,7 @@ .statItem { padding: 0 16px; text-align: left; - &:after { + &::after { display: none; } } diff --git a/src/pages/Forms/StepForm/style.less b/src/pages/Forms/StepForm/style.less index 713dd54c..452e1b3f 100644 --- a/src/pages/Forms/StepForm/style.less +++ b/src/pages/Forms/StepForm/style.less @@ -1,8 +1,8 @@ @import '~antd/lib/style/themes/default.less'; .stepForm { - margin: 40px auto 0; max-width: 500px; + margin: 40px auto 0; } .stepFormText { @@ -16,8 +16,8 @@ } .result { - margin: 0 auto; max-width: 560px; + margin: 0 auto; padding: 24px 0 8px; } @@ -25,9 +25,9 @@ padding: 0 56px; color: @text-color-secondary; h3 { - font-size: 16px; margin: 0 0 12px 0; color: @text-color-secondary; + font-size: 16px; line-height: 32px; } h4 { @@ -57,9 +57,9 @@ } } .label { + padding-right: 8px; color: @heading-color; text-align: right; - padding-right: 8px; @media screen and (max-width: @screen-sm) { text-align: left; } @@ -67,9 +67,9 @@ } .money { - font-family: 'Helvetica Neue', sans-serif; font-weight: 500; font-size: 20px; + font-family: 'Helvetica Neue', sans-serif; line-height: 14px; } diff --git a/src/pages/Forms/style.less b/src/pages/Forms/style.less index 6b12d3c3..cb23b0b4 100644 --- a/src/pages/Forms/style.less +++ b/src/pages/Forms/style.less @@ -5,9 +5,9 @@ } .heading { + margin: 0 0 16px 0; font-size: 14px; line-height: 22px; - margin: 0 0 16px 0; } .steps:global(.ant-steps) { @@ -16,9 +16,9 @@ } .errorIcon { - cursor: pointer; - color: @error-color; margin-right: 24px; + color: @error-color; + cursor: pointer; i { margin-right: 4px; } @@ -27,18 +27,18 @@ .errorPopover { :global { .ant-popover-inner-content { - padding: 0; + min-width: 256px; max-height: 290px; + padding: 0; overflow: auto; - min-width: 256px; } } } .errorListItem { + padding: 8px 16px; list-style: none; border-bottom: 1px solid @border-color-split; - padding: 8px 16px; cursor: pointer; transition: all 0.3s; &:hover { @@ -48,16 +48,16 @@ border: 0; } .errorIcon { - color: @error-color; float: left; margin-top: 4px; margin-right: 12px; padding-bottom: 22px; + color: @error-color; } .errorField { - font-size: 12px; - color: @text-color-secondary; margin-top: 2px; + color: @text-color-secondary; + font-size: 12px; } } diff --git a/src/pages/List/Applications.less b/src/pages/List/Applications.less index 8f5cb368..b770e127 100644 --- a/src/pages/List/Applications.less +++ b/src/pages/List/Applications.less @@ -20,23 +20,24 @@ } .cardInfo { .clearfix(); + margin-top: 16px; margin-left: 40px; & > div { position: relative; - text-align: left; float: left; width: 50%; + text-align: left; p { - line-height: 32px; - font-size: 24px; margin: 0; + font-size: 24px; + line-height: 32px; } p:first-child { + margin-bottom: 4px; color: @text-color-secondary; font-size: 12px; line-height: 20px; - margin-bottom: 4px; } } } diff --git a/src/pages/List/BasicList.less b/src/pages/List/BasicList.less index f086c501..fd226b0f 100644 --- a/src/pages/List/BasicList.less +++ b/src/pages/List/BasicList.less @@ -7,15 +7,15 @@ border-bottom: none; } .ant-card-head-title { - line-height: 32px; padding: 24px 0; + line-height: 32px; } .ant-card-extra { padding: 24px 0; } .ant-list-pagination { - text-align: right; margin-top: 24px; + text-align: right; } .ant-avatar-lg { width: 48px; @@ -27,35 +27,35 @@ position: relative; text-align: center; & > span { - color: @text-color-secondary; display: inline-block; + margin-bottom: 4px; + color: @text-color-secondary; font-size: @font-size-base; line-height: 22px; - margin-bottom: 4px; } & > p { + margin: 0; color: @heading-color; font-size: 24px; line-height: 32px; - margin: 0; } & > em { - background-color: @border-color-split; position: absolute; - height: 56px; - width: 1px; top: 0; right: 0; + width: 1px; + height: 56px; + background-color: @border-color-split; } } .listContent { font-size: 0; .listContentItem { - color: @text-color-secondary; display: inline-block; - vertical-align: middle; - font-size: @font-size-base; margin-left: 40px; + color: @text-color-secondary; + font-size: @font-size-base; + vertical-align: middle; > span { line-height: 20px; } @@ -67,8 +67,8 @@ } } .extraContentSearch { - margin-left: 16px; width: 272px; + margin-left: 16px; } } @@ -103,8 +103,8 @@ @media screen and (max-width: @screen-sm) { .standardList { .extraContentSearch { - margin-left: 0; width: 100%; + margin-left: 0; } .headerInfo { margin-bottom: 16px; @@ -180,8 +180,8 @@ .ant-form-item { margin-bottom: 12px; &:last-child { - padding-top: 4px; margin-bottom: 32px; + padding-top: 4px; } } } diff --git a/src/pages/List/CardList.less b/src/pages/List/CardList.less index 3d6feacc..02f806cb 100644 --- a/src/pages/List/CardList.less +++ b/src/pages/List/CardList.less @@ -9,9 +9,9 @@ .ant-card-meta-title { margin-bottom: 12px; & > a { - color: @heading-color; display: inline-block; max-width: 100%; + color: @heading-color; } } .ant-card-actions { @@ -36,21 +36,21 @@ } .extraImg { + width: 195px; margin-top: -60px; text-align: center; - width: 195px; img { width: 100%; } } .newButton { + width: 100%; + height: 188px; + color: @text-color-secondary; background-color: #fff; border-color: @border-color-base; border-radius: @border-radius-sm; - color: @text-color-secondary; - width: 100%; - height: 188px; } .cardAvatar { @@ -76,8 +76,8 @@ } } img { - vertical-align: middle; margin-right: 8px; + vertical-align: middle; } } @@ -100,8 +100,8 @@ } .contentLink { position: absolute; - left: 0; bottom: -4px; + left: 0; width: 1000px; a { margin-right: 16px; diff --git a/src/pages/List/Projects.less b/src/pages/List/Projects.less index 43b8d726..8469fc82 100644 --- a/src/pages/List/Projects.less +++ b/src/pages/List/Projects.less @@ -9,15 +9,15 @@ .ant-card-meta-title { margin-bottom: 4px; & > a { - color: @heading-color; display: inline-block; max-width: 100%; + color: @heading-color; } } .ant-card-meta-description { height: 44px; - line-height: 22px; overflow: hidden; + line-height: 22px; } } @@ -32,13 +32,13 @@ .cardItemContent { display: flex; + height: 20px; margin-top: 16px; margin-bottom: -4px; line-height: 20px; - height: 20px; & > span { - color: @text-color-secondary; flex: 1; + color: @text-color-secondary; font-size: 12px; } .avatarList { diff --git a/src/pages/List/TableList.less b/src/pages/List/TableList.less index 792757df..bc5601c1 100644 --- a/src/pages/List/TableList.less +++ b/src/pages/List/TableList.less @@ -13,13 +13,13 @@ .tableListForm { :global { .ant-form-item { - margin-bottom: 24px; - margin-right: 0; display: flex; + margin-right: 0; + margin-bottom: 24px; > .ant-form-item-label { width: auto; - line-height: 32px; padding-right: 8px; + line-height: 32px; } .ant-form-item-control { line-height: 32px; @@ -31,8 +31,8 @@ } .submitButtons { display: block; - white-space: nowrap; margin-bottom: 24px; + white-space: nowrap; } } diff --git a/src/pages/Profile/AdvancedProfile.less b/src/pages/Profile/AdvancedProfile.less index 3897f11c..4ee7621d 100644 --- a/src/pages/Profile/AdvancedProfile.less +++ b/src/pages/Profile/AdvancedProfile.less @@ -14,14 +14,14 @@ .noData { color: @disabled-color; - text-align: center; - line-height: 64px; font-size: 16px; + line-height: 64px; + text-align: center; i { - font-size: 24px; - margin-right: 16px; position: relative; top: 3px; + margin-right: 16px; + font-size: 24px; } } @@ -31,10 +31,10 @@ } .stepDescription { - font-size: 14px; position: relative; left: 38px; padding-top: 8px; + font-size: 14px; text-align: left; > div { diff --git a/src/pages/Profile/BasicProfile.less b/src/pages/Profile/BasicProfile.less index c830b050..5c3f94f5 100644 --- a/src/pages/Profile/BasicProfile.less +++ b/src/pages/Profile/BasicProfile.less @@ -1,8 +1,8 @@ @import '~antd/lib/style/themes/default.less'; .title { + margin-bottom: 16px; color: @heading-color; - font-size: 16px; font-weight: 500; - margin-bottom: 16px; + font-size: 16px; } diff --git a/src/pages/User/Login.less b/src/pages/User/Login.less index 14a99ff1..8eba81cf 100644 --- a/src/pages/User/Login.less +++ b/src/pages/User/Login.less @@ -8,9 +8,9 @@ } .icon { - font-size: 24px; - color: rgba(0, 0, 0, 0.2); margin-left: 16px; + color: rgba(0, 0, 0, 0.2); + font-size: 24px; vertical-align: middle; cursor: pointer; transition: color 0.3s; @@ -21,9 +21,9 @@ } .other { - text-align: left; margin-top: 24px; line-height: 22px; + text-align: left; .register { float: right; diff --git a/src/pages/User/Register.less b/src/pages/User/Register.less index acd1211a..c6d5b77c 100644 --- a/src/pages/User/Register.less +++ b/src/pages/User/Register.less @@ -11,8 +11,8 @@ } h3 { - font-size: 16px; margin-bottom: 20px; + font-size: 16px; } .getCaptcha { diff --git a/src/utils/utils.less b/src/utils/utils.less index 72579225..7be54ba5 100644 --- a/src/utils/utils.less +++ b/src/utils/utils.less @@ -1,34 +1,34 @@ .textOverflow() { overflow: hidden; + white-space: nowrap; text-overflow: ellipsis; word-break: break-all; - white-space: nowrap; } .textOverflowMulti(@line: 3, @bg: #fff) { - overflow: hidden; position: relative; - line-height: 1.5em; max-height: @line * 1.5em; - text-align: justify; margin-right: -1em; padding-right: 1em; - &:before { - background: @bg; - content: '...'; - padding: 0 1px; + overflow: hidden; + line-height: 1.5em; + text-align: justify; + &::before { position: absolute; right: 14px; bottom: 0; + padding: 0 1px; + background: @bg; + content: '...'; } - &:after { - background: white; - content: ''; - margin-top: 0.2em; + &::after { position: absolute; right: 14px; width: 1em; height: 1em; + margin-top: 0.2em; + background: white; + content: ''; } } @@ -36,15 +36,15 @@ // ------------------------ .clearfix() { zoom: 1; - &:before, - &:after { + &::before, + &::after { content: ' '; display: table; } - &:after { + &::after { clear: both; - visibility: hidden; - font-size: 0; height: 0; + font-size: 0; + visibility: hidden; } } From e7199e356736d483dd50b0b16c63649391d9ddce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=B7=E9=92=89?= <41830859@qq.com> Date: Wed, 13 Feb 2019 12:16:25 +0800 Subject: [PATCH 032/109] Update README.zh-CN.md --- README.zh-CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index bbecc625..c2312885 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -83,8 +83,8 @@ $ npm start # 访问 http://localhost:8000 ```bash # preview -$ docker pull chenshuai2144/ant-design-pro -$ docker run -p 80:80 chenshuai2144/ant-design-pro +$ docker pull antdesign/ant-design-pro +$ docker run -p 80:80 antdesign/ant-design-pro # open http://localhost # dev From f503724d90a4c4c058853a9ebdb9b38a1421b194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 13 Feb 2019 17:52:45 +0800 Subject: [PATCH 033/109] doc: add umi-badge (#3538) * doc: add umi-badge --- README.md | 1 + README.ru-RU.md | 1 + README.zh-CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index dffbec67..ce0725df 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md An out-of-box UI solution for enterprise applications as a React boilerplate. +[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) [![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) diff --git a/README.ru-RU.md b/README.ru-RU.md index dcd24611..ace97c25 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -6,6 +6,7 @@ UI-решение "из коробки" для корпоративных приложений как React boilerplate +[![Build With Umi](https://img.shields.io/badge/built--with-umi-blueviolet.svg)](https://github.com/umijs/umi) [![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) diff --git a/README.zh-CN.md b/README.zh-CN.md index c2312885..6b150506 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,6 +6,7 @@ 开箱即用的中台前端/设计解决方案。 +[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) [![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) From bd060c0643d9a7fbd8943f71dae481ea3540b6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Wed, 13 Feb 2019 18:01:25 +0800 Subject: [PATCH 034/109] Update README.ru-RU.md (#3539) add umi badge --- README.ru-RU.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.ru-RU.md b/README.ru-RU.md index ace97c25..22d16c9a 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -6,7 +6,7 @@ UI-решение "из коробки" для корпоративных приложений как React boilerplate -[![Build With Umi](https://img.shields.io/badge/built--with-umi-blueviolet.svg)](https://github.com/umijs/umi) +[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) [![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) From 65e822ea5451a9e22d7f7435ba8cc1c9a9a4ad03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 13 Feb 2019 18:10:56 +0800 Subject: [PATCH 035/109] feat: Officially traded will use cdn to optimize bizchart (#3535) --- config/config.js | 11 ++++++++--- src/pages/document.ejs | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/config.js b/config/config.js index 61fe8e2b..9b78b7e6 100644 --- a/config/config.js +++ b/config/config.js @@ -6,6 +6,7 @@ import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; const { pwa, primaryColor } = defaultSettings; +const { NODE_ENV, APP_TYPE, TEST } = process.env; const plugins = [ [ @@ -32,7 +33,7 @@ const plugins = [ }, } : {}, - ...(!process.env.TEST && os.platform() === 'darwin' + ...(!TEST && os.platform() === 'darwin' ? { dll: { include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], @@ -47,7 +48,7 @@ const plugins = [ // 针对 preview.pro.ant.design 的 GA 统计代码 // 业务上不需要这个 -if (process.env.APP_TYPE === 'site') { +if (APP_TYPE === 'site') { plugins.push([ 'umi-plugin-ga', { @@ -60,7 +61,7 @@ export default { // add for transfer to umi plugins, define: { - APP_TYPE: process.env.APP_TYPE || '', + APP_TYPE: APP_TYPE || '', }, treeShaking: true, targets: { @@ -75,6 +76,10 @@ export default { }, externals: { '@antv/data-set': 'DataSet', + // if is production externals react react-dom and bizcharts + ...(NODE_ENV === 'production' + ? { react: 'React', 'react-dom': 'ReactDOM', bizcharts: 'BizCharts' } + : {}), }, // proxy: { // '/server/api/': { diff --git a/src/pages/document.ejs b/src/pages/document.ejs index 36be3f61..84753665 100644 --- a/src/pages/document.ejs +++ b/src/pages/document.ejs @@ -9,7 +9,12 @@ /> Ant Design Pro - + <% if(context.env === 'production') { %> + + + + <% }%> + From 837b8c232d3ae4127db6ccf1117f5ebec6f3c029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Thu, 14 Feb 2019 09:54:29 +0800 Subject: [PATCH 036/109] route authority attribute behavior no use while (#3522) * route authority attribute behavior no use while --- src/layouts/BasicLayout.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 89a706a1..c992fb2b 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -90,27 +90,25 @@ class BasicLayout extends React.Component { getRouteAuthority = (pathname, routeData) => { const routes = routeData.slice(); // clone - let authorities; - - while (routes.length > 0) { - const route = routes.shift(); - // check partial route - if (pathToRegexp(`${route.path}(.*)`).test(pathname)) { - if (route.authority) { - authorities = route.authority; - } - // is exact route? - if (pathToRegexp(route.path).test(pathname)) { - break; - } - if (route.routes) { - route.routes.forEach(r => routes.push(r)); + const getAuthority = (routeDatas, path) => { + let authorities; + routeDatas.forEach(route => { + // check partial route + if (pathToRegexp(`${route.path}(.*)`).test(path)) { + if (route.authority) { + authorities = route.authority; + } + // is exact route? + if (!pathToRegexp(route.path).test(path) && route.routes) { + authorities = getAuthority(route.routes, path); + } } - } - } + }); + return authorities; + }; - return authorities; + return getAuthority(routes, pathname); }; getPageTitle = (pathname, breadcrumbNameMap) => { From 41a475dfac4c930a90664a52b978d00291235529 Mon Sep 17 00:00:00 2001 From: Lucas Bastianik Date: Thu, 14 Feb 2019 08:59:33 -0200 Subject: [PATCH 037/109] i18n pt-BR: analysis & component (#3540) * Translation of form and monitor (pt-BR) * Change flag of Portugal (pt-PT) to Brazil (pt-BR) * i18n pt-BR: analysis & component --- src/locales/pt-BR/analysis.js | 2 +- src/locales/pt-BR/component.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/pt-BR/analysis.js b/src/locales/pt-BR/analysis.js index 96a80adf..eb33f10b 100644 --- a/src/locales/pt-BR/analysis.js +++ b/src/locales/pt-BR/analysis.js @@ -21,7 +21,7 @@ export default { 'app.analysis.search-users': 'Pesquisa de Usuários', 'app.analysis.per-capita-search': 'Busca Per Capta', 'app.analysis.online-top-search': 'Mais Buscadas Online', - 'app.analysis.the-proportion-of-sales': 'The Proportion Of Sales', + 'app.analysis.the-proportion-of-sales': 'Proporção de Vendas', 'app.analysis.channel.all': 'Tudo', 'app.analysis.channel.online': 'Online', 'app.analysis.channel.stores': 'Lojas', diff --git a/src/locales/pt-BR/component.js b/src/locales/pt-BR/component.js index 1af478de..7cf9999c 100644 --- a/src/locales/pt-BR/component.js +++ b/src/locales/pt-BR/component.js @@ -1,5 +1,5 @@ export default { 'component.tagSelect.expand': 'Expandir', - 'component.tagSelect.collapse': 'Colapso', + 'component.tagSelect.collapse': 'Diminuir', 'component.tagSelect.all': 'Todas', }; From 7703b26deb2d904ccb9236834251b3a209de8911 Mon Sep 17 00:00:00 2001 From: vellengs Date: Fri, 15 Feb 2019 11:14:09 +0800 Subject: [PATCH 038/109] Fix missing export default (#3525) * fix types missing export default * Update package.json * Update index.d.ts * Update index.d.ts * Update index.d.ts --- .../Authorized/AuthorizedRoute.d.ts | 2 +- src/components/Charts/index.d.ts | 57 ++++++++++++++----- src/components/HeaderDropdown/index.d.ts | 2 + src/components/Login/LoginItem.d.ts | 2 +- 4 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 src/components/HeaderDropdown/index.d.ts diff --git a/src/components/Authorized/AuthorizedRoute.d.ts b/src/components/Authorized/AuthorizedRoute.d.ts index 912b283a..fc780004 100644 --- a/src/components/Authorized/AuthorizedRoute.d.ts +++ b/src/components/Authorized/AuthorizedRoute.d.ts @@ -10,4 +10,4 @@ export interface IAuthorizedRouteProps extends RouteProps { } export { authority }; -export class AuthorizedRoute extends React.Component {} +export default class AuthorizedRoute extends React.Component {} diff --git a/src/components/Charts/index.d.ts b/src/components/Charts/index.d.ts index 1ff27af2..57f1d527 100644 --- a/src/components/Charts/index.d.ts +++ b/src/components/Charts/index.d.ts @@ -1,17 +1,48 @@ import * as numeral from 'numeral'; -export { default as ChartCard } from './ChartCard'; -export { default as Bar } from './Bar'; -export { default as Pie } from './Pie'; -export { default as Radar } from './Radar'; -export { default as Gauge } from './Gauge'; -export { default as MiniArea } from './MiniArea'; -export { default as MiniBar } from './MiniBar'; -export { default as MiniProgress } from './MiniProgress'; -export { default as Field } from './Field'; -export { default as WaterWave } from './WaterWave'; -export { default as TagCloud } from './TagCloud'; -export { default as TimelineChart } from './TimelineChart'; +import { default as Bar } from './Bar'; +import { default as ChartCard } from './ChartCard'; +import { default as Field } from './Field'; +import { default as Gauge } from './Gauge'; +import { default as MiniArea } from './MiniArea'; +import { default as MiniBar } from './MiniBar'; +import { default as MiniProgress } from './MiniProgress'; +import { default as Pie } from './Pie'; +import { default as Radar } from './Radar'; +import { default as TagCloud } from './TagCloud'; +import { default as TimelineChart } from './TimelineChart'; +import { default as WaterWave } from './WaterWave'; declare const yuan: (value: number | string) => string; -export { yuan }; +declare const Charts: { + yuan: (value: number | string) => string; + Bar: Bar; + Pie: Pie; + Gauge: Gauge; + Radar: Radar; + MiniBar: MiniBar; + MiniArea: MiniArea; + MiniProgress: MiniProgress; + ChartCard: ChartCard; + Field: Field; + WaterWave: WaterWave; + TagCloud: TagCloud; + TimelineChart: TimelineChart; +}; + +export { + Charts as default, + yuan, + Bar, + Pie, + Gauge, + Radar, + MiniBar, + MiniArea, + MiniProgress, + ChartCard, + Field, + WaterWave, + TagCloud, + TimelineChart, +}; diff --git a/src/components/HeaderDropdown/index.d.ts b/src/components/HeaderDropdown/index.d.ts new file mode 100644 index 00000000..e9dac7e5 --- /dev/null +++ b/src/components/HeaderDropdown/index.d.ts @@ -0,0 +1,2 @@ +import * as React from 'react'; +export default class HeaderDropdown extends React.Component {} diff --git a/src/components/Login/LoginItem.d.ts b/src/components/Login/LoginItem.d.ts index 30a7a2d6..bcfb73b8 100644 --- a/src/components/Login/LoginItem.d.ts +++ b/src/components/Login/LoginItem.d.ts @@ -8,4 +8,4 @@ export interface ILoginItemProps { buttonText?: React.ReactNode; } -export class LoginItem extends React.Component {} +export default class LoginItem extends React.Component {} From 0ebcdc884ec9377249a8ad20041501b07a56d331 Mon Sep 17 00:00:00 2001 From: Ostwind <9837438@qq.com> Date: Fri, 15 Feb 2019 11:15:27 +0800 Subject: [PATCH 039/109] =?UTF-8?q?=E5=A2=9E=E5=8A=A0IconFont=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E3=80=81=E8=8F=9C=E5=8D=95=E5=9B=BE=E6=A0=87=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BD=BF=E7=94=A8=E8=87=AA=E5=B7=B1=E7=9A=84IconFont?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=9B=BE=E6=A0=87=20(#3517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feature: 1.add iconfont component; 2.menu can add iconfont icon. * fix: 调整菜单引入iconfont的方式为String. 1. 新增IconFont组件,需在组件内配置自己的IconFont图标项目地址; 2. 然后,菜单图标可以引入自己的IconFont图标,图标字符串以icon-开头. * ajust: put the IconFont Script Url into defaultSetting.js * 调整iconfontUrl名称 * fix:注释更新 * 留空iconfontUrl --- src/components/IconFont/index.js | 7 +++++++ src/components/SiderMenu/BaseMenu.js | 11 ++++++++--- src/defaultSettings.js | 4 ++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/components/IconFont/index.js diff --git a/src/components/IconFont/index.js b/src/components/IconFont/index.js new file mode 100644 index 00000000..0b99dec3 --- /dev/null +++ b/src/components/IconFont/index.js @@ -0,0 +1,7 @@ +import { Icon } from 'antd'; +import { iconfontUrl as scriptUrl } from '../../defaultSettings'; + +// 使用: +// import IconFont from '@/components/IconFont'; +// +export default Icon.createFromIconfontCN({ scriptUrl }); diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index 10a0eb76..6c8c7022 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/src/components/SiderMenu/BaseMenu.js @@ -6,18 +6,23 @@ import { urlToList } from '../_utils/pathTools'; import { getMenuMatches } from './SiderMenuUtils'; import { isUrl } from '@/utils/utils'; import styles from './index.less'; +import IconFont from '@/components/IconFont'; const { SubMenu } = Menu; // Allow menu.js config icon as string or ReactNode // icon: 'setting', +// icon: 'icon-geren' #For Iconfont , // icon: 'http://demo.com/icon.png', // icon: , const getIcon = icon => { - if (typeof icon === 'string' && isUrl(icon)) { - return icon} />; - } if (typeof icon === 'string') { + if (isUrl(icon)) { + return icon} />; + } + if (icon.startsWith('icon-')) { + return ; + } return ; } return icon; diff --git a/src/defaultSettings.js b/src/defaultSettings.js index dfdb5341..4ba7eb39 100644 --- a/src/defaultSettings.js +++ b/src/defaultSettings.js @@ -11,4 +11,8 @@ module.exports = { }, title: 'Ant Design Pro', pwa: true, + // your iconfont Symbol Scrip Url + // eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js + // 注意:如果需要图标多色,Iconfont图标项目里要进行批量去色处理 + iconfontUrl: '', }; From a79e2d000b3f3faaecc216e47e7d613ba2270cd2 Mon Sep 17 00:00:00 2001 From: Xudong Cai Date: Fri, 15 Feb 2019 17:48:43 +0800 Subject: [PATCH 040/109] Site title use defaultSettings (#3546) --- src/components/SiderMenu/SiderMenu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 102b4b44..da9520fa 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -5,6 +5,7 @@ import Link from 'umi/link'; import styles from './index.less'; import PageLoading from '../PageLoading'; import { getDefaultCollapsedSubMenus } from './SiderMenuUtils'; +import { title } from '../../defaultSettings'; const BaseMenu = React.lazy(() => import('./BaseMenu')); const { Sider } = Layout; @@ -79,7 +80,7 @@ export default class SiderMenu extends PureComponent { }> From 9f84663b016d165a42a6a95219d622f97a1ed305 Mon Sep 17 00:00:00 2001 From: Ostwind <9837438@qq.com> Date: Sat, 16 Feb 2019 17:30:01 +0800 Subject: [PATCH 041/109] Site title od top use defaultSettings (#3551) --- src/components/TopNavHeader/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TopNavHeader/index.js b/src/components/TopNavHeader/index.js index eca4dbe4..2d0e0656 100644 --- a/src/components/TopNavHeader/index.js +++ b/src/components/TopNavHeader/index.js @@ -4,6 +4,7 @@ import RightContent from '../GlobalHeader/RightContent'; import BaseMenu from '../SiderMenu/BaseMenu'; import { getFlatMenuKeys } from '../SiderMenu/SiderMenuUtils'; import styles from './index.less'; +import { title } from '../../defaultSettings'; export default class TopNavHeader extends PureComponent { state = { @@ -32,7 +33,7 @@ export default class TopNavHeader extends PureComponent {
Date: Mon, 18 Feb 2019 10:39:30 +0800 Subject: [PATCH 042/109] pref: optimize performance (#3542) * pref: optimize performance * pref: use less img * pref: use less img --- config/config.js | 6 +-- mock/api.js | 2 +- mock/user.js | 2 +- src/components/ActiveChart/index.js | 1 - src/components/Charts/AsyncLoadBizCharts.js | 42 +++++++++++++++++++++ src/components/Charts/g2.js | 15 -------- src/components/Charts/index.js | 35 +++++++++++------ src/global.js | 2 + src/pages/Account/Settings/BaseView.js | 2 +- src/pages/Dashboard/Analysis.js | 10 +++-- src/pages/Dashboard/Monitor.js | 14 ++++--- src/pages/Dashboard/Workplace.js | 8 +++- src/pages/document.ejs | 6 --- src/utils/utils.js | 11 ++++++ 14 files changed, 105 insertions(+), 51 deletions(-) create mode 100644 src/components/Charts/AsyncLoadBizCharts.js delete mode 100644 src/components/Charts/g2.js diff --git a/config/config.js b/config/config.js index 9b78b7e6..226d448e 100644 --- a/config/config.js +++ b/config/config.js @@ -24,6 +24,7 @@ const plugins = [ dynamicImport: { loadingComponent: './components/PageLoading/index', webpackChunkName: true, + level: 3, }, pwa: pwa ? { @@ -76,10 +77,7 @@ export default { }, externals: { '@antv/data-set': 'DataSet', - // if is production externals react react-dom and bizcharts - ...(NODE_ENV === 'production' - ? { react: 'React', 'react-dom': 'ReactDOM', bizcharts: 'BizCharts' } - : {}), + bizcharts: 'BizCharts', }, // proxy: { // '/server/api/': { diff --git a/mock/api.js b/mock/api.js index f1173bba..0286d072 100644 --- a/mock/api.js +++ b/mock/api.js @@ -22,7 +22,7 @@ const avatars = [ ]; const avatars2 = [ - 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', + 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png', 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png', 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png', diff --git a/mock/user.js b/mock/user.js index dd3f2402..2fb6c60a 100644 --- a/mock/user.js +++ b/mock/user.js @@ -3,7 +3,7 @@ export default { // 支持值为 Object 和 Array 'GET /api/currentUser': { name: 'Serati Ma', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', + avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', userid: '00000001', email: 'antdesign@alipay.com', signature: '海纳百川,有容乃大', diff --git a/src/components/ActiveChart/index.js b/src/components/ActiveChart/index.js index 3d9fbbaf..c14c061e 100644 --- a/src/components/ActiveChart/index.js +++ b/src/components/ActiveChart/index.js @@ -1,7 +1,6 @@ import React, { Component } from 'react'; import { MiniArea } from '../Charts'; import NumberInfo from '../NumberInfo'; - import styles from './index.less'; function fixedZero(val) { diff --git a/src/components/Charts/AsyncLoadBizCharts.js b/src/components/Charts/AsyncLoadBizCharts.js new file mode 100644 index 00000000..274bea56 --- /dev/null +++ b/src/components/Charts/AsyncLoadBizCharts.js @@ -0,0 +1,42 @@ +import React from 'react'; +import PageLoading from '../PageLoading'; +import { importCDN } from '@/utils/utils'; + +let isLoaderBizChart = false; +const loadBizCharts = async () => { + if (isLoaderBizChart) { + return Promise.resolve(true); + } + await Promise.all([ + importCDN('//gw.alipayobjects.com/os/lib/bizcharts/3.4.3/umd/BizCharts.min.js'), + importCDN('//gw.alipayobjects.com/os/lib/antv/data-set/0.10.1/dist/data-set.min.js'), + ]); + // eslint-disable-next-line no-console + console.log('bizCharts load success'); + isLoaderBizChart = true; + return Promise.resolve(true); +}; + +class AsyncLoadBizCharts extends React.Component { + state = { + loading: !isLoaderBizChart, + }; + + async componentDidMount() { + await loadBizCharts(); + this.setState({ + loading: false, + }); + } + + render() { + const { children } = this.props; + const { loading } = this.state; + if (!loading) { + return children; + } + return ; + } +} + +export { loadBizCharts, AsyncLoadBizCharts }; diff --git a/src/components/Charts/g2.js b/src/components/Charts/g2.js deleted file mode 100644 index 21e22c28..00000000 --- a/src/components/Charts/g2.js +++ /dev/null @@ -1,15 +0,0 @@ -// 全局 G2 设置 -import { track, setTheme } from 'bizcharts'; - -track(false); - -const config = { - defaultColor: '#1089ff', - shape: { - interval: { - fillOpacity: 1, - }, - }, -}; - -setTheme(config); diff --git a/src/components/Charts/index.js b/src/components/Charts/index.js index 78863fab..081663b3 100644 --- a/src/components/Charts/index.js +++ b/src/components/Charts/index.js @@ -1,17 +1,28 @@ +import React, { Suspense } from 'react'; import numeral from 'numeral'; -import './g2'; import ChartCard from './ChartCard'; -import Bar from './Bar'; -import Pie from './Pie'; -import Radar from './Radar'; -import Gauge from './Gauge'; -import MiniArea from './MiniArea'; -import MiniBar from './MiniBar'; -import MiniProgress from './MiniProgress'; -import Field from './Field'; -import WaterWave from './WaterWave'; -import TagCloud from './TagCloud'; -import TimelineChart from './TimelineChart'; + +const getComponent = Component => { + return props => { + return ( + + + + ); + }; +}; + +const Bar = getComponent(React.lazy(() => import('./Bar'))); +const Pie = getComponent(React.lazy(() => import('./Pie'))); +const Radar = getComponent(React.lazy(() => import('./Radar'))); +const Gauge = getComponent(React.lazy(() => import('./Gauge'))); +const MiniArea = getComponent(React.lazy(() => import('./MiniArea'))); +const MiniBar = getComponent(React.lazy(() => import('./MiniBar'))); +const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress'))); +const Field = getComponent(React.lazy(() => import('./Field'))); +const WaterWave = getComponent(React.lazy(() => import('./WaterWave'))); +const TagCloud = getComponent(React.lazy(() => import('./TagCloud'))); +const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart'))); const yuan = val => `¥ ${numeral(val).format('0,0')}`; diff --git a/src/global.js b/src/global.js index bf60b418..bebe4829 100644 --- a/src/global.js +++ b/src/global.js @@ -3,6 +3,8 @@ import { notification, Button, message } from 'antd'; import { formatMessage } from 'umi/locale'; import defaultSettings from './defaultSettings'; +window.React = React; + const { pwa } = defaultSettings; // if pwa is true if (pwa) { diff --git a/src/pages/Account/Settings/BaseView.js b/src/pages/Account/Settings/BaseView.js index 388a8358..f2f2b3a9 100644 --- a/src/pages/Account/Settings/BaseView.js +++ b/src/pages/Account/Settings/BaseView.js @@ -74,7 +74,7 @@ class BaseView extends Component { if (currentUser.avatar) { return currentUser.avatar; } - const url = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'; + const url = 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png'; return url; } diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 0b85db70..11fa66ad 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -1,12 +1,11 @@ import React, { Component, Suspense } from 'react'; import { connect } from 'dva'; import { Row, Col, Icon, Menu, Dropdown } from 'antd'; - import GridContent from '@/components/PageHeaderWrapper/GridContent'; import { getTimeDistance } from '@/utils/utils'; - import styles from './Analysis.less'; import PageLoading from '@/components/PageLoading'; +import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; const IntroduceRow = React.lazy(() => import('./IntroduceRow')); const SalesCard = React.lazy(() => import('./SalesCard')); @@ -26,6 +25,7 @@ class Analysis extends Component { }; componentDidMount() { + console.log('run'); const { dispatch } = this.props; this.reqRef = requestAnimationFrame(() => { dispatch({ @@ -184,4 +184,8 @@ class Analysis extends Component { } } -export default Analysis; +export default props => ( + + + +); diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index 62909174..d9bb87c6 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -1,4 +1,5 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; +import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Row, Col, Card, Tooltip } from 'antd'; @@ -8,7 +9,6 @@ import CountDown from '@/components/CountDown'; import ActiveChart from '@/components/ActiveChart'; import numeral from 'numeral'; import GridContent from '@/components/PageHeaderWrapper/GridContent'; - import Authorized from '@/utils/Authorized'; import styles from './Monitor.less'; @@ -27,7 +27,7 @@ const havePermissionAsync = new Promise(resolve => { monitor, loading: loading.models.monitor, })) -class Monitor extends PureComponent { +class Monitor extends Component { componentDidMount() { const { dispatch } = this.props; dispatch({ @@ -110,7 +110,7 @@ class Monitor extends PureComponent { } > map @@ -242,4 +242,8 @@ class Monitor extends PureComponent { } } -export default Monitor; +export default props => ( + + + +); diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index e9e44d45..3e7ff986 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -3,7 +3,7 @@ import moment from 'moment'; import { connect } from 'dva'; import Link from 'umi/link'; import { Row, Col, Card, List, Avatar } from 'antd'; - +import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { Radar } from '@/components/Charts'; import EditableLinkGroup from '@/components/EditableLinkGroup'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; @@ -253,4 +253,8 @@ class Workplace extends PureComponent { } } -export default Workplace; +export default props => ( + + + +); diff --git a/src/pages/document.ejs b/src/pages/document.ejs index 84753665..cf09effa 100644 --- a/src/pages/document.ejs +++ b/src/pages/document.ejs @@ -9,12 +9,6 @@ /> Ant Design Pro - <% if(context.env === 'production') { %> - - - - <% }%> - diff --git a/src/utils/utils.js b/src/utils/utils.js index d8d1739f..7531af67 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -181,3 +181,14 @@ export function formatWan(val) { export function isAntdPro() { return window.location.hostname === 'preview.pro.ant.design'; } + +export const importCDN = (url, name) => + new Promise(resolve => { + const dom = document.createElement('script'); + dom.src = url; + dom.type = 'text/javascript'; + dom.onload = () => { + resolve(window[name]); + }; + document.head.appendChild(dom); + }); From 9da468f4ec49b092dc08568855bca76c87dbbacf Mon Sep 17 00:00:00 2001 From: Ostwind <9837438@qq.com> Date: Mon, 18 Feb 2019 10:41:02 +0800 Subject: [PATCH 043/109] fix: Eslint warning of Mock dependence (#3554) --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 02f5cb12..10309cef 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,7 +24,7 @@ module.exports = { 2, { optionalDependencies: true, - devDependencies: ['**/tests/**.js', '/mock/**.js', '**/**.test.js'], + devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'], }, ], 'jsx-a11y/no-noninteractive-element-interactions': 0, From e1290d8e167f82c18abecbbf999c8adb5e75bd61 Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Mon, 18 Feb 2019 19:55:24 +0800 Subject: [PATCH 044/109] perf: use requestAnimationFrame --- src/components/ActiveChart/index.js | 22 ++++++++++----------- src/components/Charts/AsyncLoadBizCharts.js | 6 ++++-- src/components/Charts/index.js | 4 ++-- src/pages/Dashboard/Analysis.js | 1 - 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/components/ActiveChart/index.js b/src/components/ActiveChart/index.js index c14c061e..a7bf0bfc 100644 --- a/src/components/ActiveChart/index.js +++ b/src/components/ActiveChart/index.js @@ -33,18 +33,16 @@ export default class ActiveChart extends Component { } loopData = () => { - this.requestRef = requestAnimationFrame(() => { - this.timer = setTimeout(() => { - this.setState( - { - activeData: getActiveData(), - }, - () => { - this.loopData(); - } - ); - }, 1000); - }); + this.timer = setTimeout(() => { + this.setState( + { + activeData: getActiveData(), + }, + () => { + this.loopData(); + } + ); + }, 500); }; render() { diff --git a/src/components/Charts/AsyncLoadBizCharts.js b/src/components/Charts/AsyncLoadBizCharts.js index 274bea56..8d9a2cd0 100644 --- a/src/components/Charts/AsyncLoadBizCharts.js +++ b/src/components/Charts/AsyncLoadBizCharts.js @@ -24,8 +24,10 @@ class AsyncLoadBizCharts extends React.Component { async componentDidMount() { await loadBizCharts(); - this.setState({ - loading: false, + requestAnimationFrame(() => { + this.setState({ + loading: false, + }); }); } diff --git a/src/components/Charts/index.js b/src/components/Charts/index.js index 081663b3..56a1c565 100644 --- a/src/components/Charts/index.js +++ b/src/components/Charts/index.js @@ -1,11 +1,12 @@ import React, { Suspense } from 'react'; import numeral from 'numeral'; import ChartCard from './ChartCard'; +import Field from './Field'; const getComponent = Component => { return props => { return ( - + ); @@ -19,7 +20,6 @@ const Gauge = getComponent(React.lazy(() => import('./Gauge'))); const MiniArea = getComponent(React.lazy(() => import('./MiniArea'))); const MiniBar = getComponent(React.lazy(() => import('./MiniBar'))); const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress'))); -const Field = getComponent(React.lazy(() => import('./Field'))); const WaterWave = getComponent(React.lazy(() => import('./WaterWave'))); const TagCloud = getComponent(React.lazy(() => import('./TagCloud'))); const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart'))); diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 11fa66ad..cceab9bd 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -25,7 +25,6 @@ class Analysis extends Component { }; componentDidMount() { - console.log('run'); const { dispatch } = this.props; this.reqRef = requestAnimationFrame(() => { dispatch({ From 07f1209bbe7dbc950f37488a9ddb5853ff52e718 Mon Sep 17 00:00:00 2001 From: Zhoujingsai Date: Mon, 18 Feb 2019 11:13:22 +0800 Subject: [PATCH 045/109] Fix: onPressEnter trigger twice login request in IE11 --- src/pages/User/Login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/User/Login.js b/src/pages/User/Login.js index 54dd5c40..1987c639 100644 --- a/src/pages/User/Login.js +++ b/src/pages/User/Login.js @@ -100,7 +100,7 @@ class LoginPage extends Component { message: formatMessage({ id: 'validation.password.required' }), }, ]} - onPressEnter={() => this.loginForm.validateFields(this.handleSubmit)} + onPressEnter={(e) => {e.preventDefault();this.loginForm.validateFields(this.handleSubmit)}} /> From ece382784e441bb3fb4ec82233df1b62c5f568b2 Mon Sep 17 00:00:00 2001 From: Zhoujingsai Date: Mon, 18 Feb 2019 12:06:01 +0800 Subject: [PATCH 046/109] Fix: onPressEnter trigger twice login request in IE11 --- src/pages/User/Login.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/User/Login.js b/src/pages/User/Login.js index 1987c639..6ddece46 100644 --- a/src/pages/User/Login.js +++ b/src/pages/User/Login.js @@ -100,7 +100,10 @@ class LoginPage extends Component { message: formatMessage({ id: 'validation.password.required' }), }, ]} - onPressEnter={(e) => {e.preventDefault();this.loginForm.validateFields(this.handleSubmit)}} + onPressEnter={e => { + e.preventDefault(); + this.loginForm.validateFields(this.handleSubmit); + }} /> From 16d9370d99c012c470097b0b966f4795ad375bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 19 Feb 2019 12:10:52 +0800 Subject: [PATCH 047/109] Login title (#3564) * Added document title to UserLayout by identifying the current route object and using its name kaey to set the title * Adjusment to document title * feat: use same getPageTile function --- config/router.config.js | 10 +++-- src/layouts/BasicLayout.js | 35 +----------------- src/layouts/UserLayout.js | 71 +++++++++++++++++++++++++----------- src/locales/en-US/menu.js | 3 ++ src/locales/pt-BR/menu.js | 3 ++ src/locales/zh-CN/menu.js | 3 ++ src/locales/zh-TW/menu.js | 3 ++ src/pages/User/Login.less | 2 +- src/pages/User/Register.less | 2 +- src/utils/getPageTitle.js | 26 +++++++++++++ 10 files changed, 98 insertions(+), 60 deletions(-) create mode 100644 src/utils/getPageTitle.js diff --git a/config/router.config.js b/config/router.config.js index 733d9013..840fe833 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -5,9 +5,13 @@ export default [ component: '../layouts/UserLayout', routes: [ { path: '/user', redirect: '/user/login' }, - { path: '/user/login', component: './User/Login' }, - { path: '/user/register', component: './User/Register' }, - { path: '/user/register-result', component: './User/RegisterResult' }, + { path: '/user/login', name: 'login', component: './User/Login' }, + { path: '/user/register', name: 'register', component: './User/Register' }, + { + path: '/user/register-result', + name: 'register.result', + component: './User/RegisterResult', + }, ], }, // app diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index c992fb2b..33896876 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -1,14 +1,11 @@ import React, { Suspense } from 'react'; import { Layout } from 'antd'; import DocumentTitle from 'react-document-title'; -import isEqual from 'lodash/isEqual'; -import memoizeOne from 'memoize-one'; import { connect } from 'dva'; import { ContainerQuery } from 'react-container-query'; import classNames from 'classnames'; import pathToRegexp from 'path-to-regexp'; import Media from 'react-media'; -import { formatMessage } from 'umi/locale'; import Authorized from '@/utils/Authorized'; import logo from '../assets/logo.svg'; import Footer from './Footer'; @@ -17,8 +14,7 @@ import Context from './MenuContext'; import Exception403 from '../pages/Exception/403'; import PageLoading from '@/components/PageLoading'; import SiderMenu from '@/components/SiderMenu'; -import { menu, title } from '../defaultSettings'; - +import getPageTitle from '@/utils/getPageTitle'; import styles from './BasicLayout.less'; // lazy load SettingDrawer @@ -52,12 +48,6 @@ const query = { }; class BasicLayout extends React.Component { - constructor(props) { - super(props); - this.getPageTitle = memoizeOne(this.getPageTitle); - this.matchParamsPath = memoizeOne(this.matchParamsPath, isEqual); - } - componentDidMount() { const { dispatch, @@ -83,11 +73,6 @@ class BasicLayout extends React.Component { }; } - matchParamsPath = (pathname, breadcrumbNameMap) => { - const pathKey = Object.keys(breadcrumbNameMap).find(key => pathToRegexp(key).test(pathname)); - return breadcrumbNameMap[pathKey]; - }; - getRouteAuthority = (pathname, routeData) => { const routes = routeData.slice(); // clone @@ -111,22 +96,6 @@ class BasicLayout extends React.Component { return getAuthority(routes, pathname); }; - getPageTitle = (pathname, breadcrumbNameMap) => { - const currRouterData = this.matchParamsPath(pathname, breadcrumbNameMap); - - if (!currRouterData) { - return title; - } - const pageName = menu.disableLocal - ? currRouterData.name - : formatMessage({ - id: currRouterData.locale || currRouterData.name, - defaultMessage: currRouterData.name, - }); - - return `${pageName} - ${title}`; - }; - getLayoutStyle = () => { const { fixSiderbar, isMobile, collapsed, layout } = this.props; if (fixSiderbar && layout !== 'topmenu' && !isMobile) { @@ -206,7 +175,7 @@ class BasicLayout extends React.Component { ); return ( - + {params => ( diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js index 112c61c0..18fb176e 100644 --- a/src/layouts/UserLayout.js +++ b/src/layouts/UserLayout.js @@ -1,11 +1,14 @@ -import React, { Fragment } from 'react'; +import React, { Component, Fragment } from 'react'; import { formatMessage } from 'umi/locale'; +import { connect } from 'dva'; import Link from 'umi/link'; import { Icon } from 'antd'; import GlobalFooter from '@/components/GlobalFooter'; +import DocumentTitle from 'react-document-title'; import SelectLang from '@/components/SelectLang'; import styles from './UserLayout.less'; import logo from '../assets/logo.svg'; +import getPageTitle from '@/utils/getPageTitle'; const links = [ { @@ -31,26 +34,50 @@ const copyright = ( ); -const UserLayout = ({ children }) => ( - // @TODO -
-
- -
-
-
-
- - logo - Ant Design - +class UserLayout extends Component { + componentDidMount() { + const { + dispatch, + route: { routes, authority }, + } = this.props; + dispatch({ + type: 'menu/getMenuData', + payload: { routes, authority }, + }); + } + + render() { + const { + children, + location: { pathname }, + breadcrumbNameMap, + } = this.props; + return ( + +
+
+ +
+
+
+
+ + logo + Ant Design + +
+
Ant Design 是西湖区最具影响力的 Web 设计规范
+
+ {children} +
+
-
Ant Design 是西湖区最具影响力的 Web 设计规范
-
- {children} -
- -
-); + + ); + } +} -export default UserLayout; +export default connect(({ menu: menuModel }) => ({ + menuData: menuModel.menuData, + breadcrumbNameMap: menuModel.breadcrumbNameMap, +}))(UserLayout); diff --git a/src/locales/en-US/menu.js b/src/locales/en-US/menu.js index 3102a600..056c255e 100644 --- a/src/locales/en-US/menu.js +++ b/src/locales/en-US/menu.js @@ -1,5 +1,8 @@ export default { 'menu.home': 'Home', + 'menu.login': 'Login', + 'menu.register': 'Register', + 'menu.register.result': 'Register Result', 'menu.dashboard': 'Dashboard', 'menu.dashboard.analysis': 'Analysis', 'menu.dashboard.monitor': 'Monitor', diff --git a/src/locales/pt-BR/menu.js b/src/locales/pt-BR/menu.js index 257ab0c2..77ee7fd7 100644 --- a/src/locales/pt-BR/menu.js +++ b/src/locales/pt-BR/menu.js @@ -1,5 +1,8 @@ export default { 'menu.home': 'Início', + 'menu.login': 'Login', + 'menu.register': 'Registro', + 'menu.register.result': 'Resultado de registro', 'menu.dashboard': 'Dashboard', 'menu.dashboard.analysis': 'Análise', 'menu.dashboard.monitor': 'Monitor', diff --git a/src/locales/zh-CN/menu.js b/src/locales/zh-CN/menu.js index 1383b43f..5657c6e0 100644 --- a/src/locales/zh-CN/menu.js +++ b/src/locales/zh-CN/menu.js @@ -1,5 +1,8 @@ export default { 'menu.home': '首页', + 'menu.login': '登录', + 'menu.register': '注册', + 'menu.register.result': '注册结果', 'menu.dashboard': 'Dashboard', 'menu.dashboard.analysis': '分析页', 'menu.dashboard.monitor': '监控页', diff --git a/src/locales/zh-TW/menu.js b/src/locales/zh-TW/menu.js index 66831e0b..7bd71a7a 100644 --- a/src/locales/zh-TW/menu.js +++ b/src/locales/zh-TW/menu.js @@ -1,5 +1,8 @@ export default { 'menu.home': '首頁', + 'menu.login': '登錄', + 'menu.register': '註冊', + 'menu.register.resultt': '註冊結果', 'menu.dashboard': 'Dashboard', 'menu.dashboard.analysis': '分析頁', 'menu.dashboard.monitor': '監控頁', diff --git a/src/pages/User/Login.less b/src/pages/User/Login.less index 8eba81cf..34192942 100644 --- a/src/pages/User/Login.less +++ b/src/pages/User/Login.less @@ -1,7 +1,7 @@ @import '~antd/lib/style/themes/default.less'; .main { - width: 368px; + width: 388px; margin: 0 auto; @media screen and (max-width: @screen-sm) { width: 95%; diff --git a/src/pages/User/Register.less b/src/pages/User/Register.less index c6d5b77c..c7e22529 100644 --- a/src/pages/User/Register.less +++ b/src/pages/User/Register.less @@ -1,7 +1,7 @@ @import '~antd/lib/style/themes/default.less'; .main { - width: 368px; + width: 388px; margin: 0 auto; :global { diff --git a/src/utils/getPageTitle.js b/src/utils/getPageTitle.js new file mode 100644 index 00000000..09e69c32 --- /dev/null +++ b/src/utils/getPageTitle.js @@ -0,0 +1,26 @@ +import { formatMessage } from 'umi/locale'; +import pathToRegexp from 'path-to-regexp'; +import isEqual from 'lodash/isEqual'; +import memoizeOne from 'memoize-one'; +import { menu, title } from '../defaultSettings'; + +export const matchParamsPath = (pathname, breadcrumbNameMap) => { + const pathKey = Object.keys(breadcrumbNameMap).find(key => pathToRegexp(key).test(pathname)); + return breadcrumbNameMap[pathKey]; +}; +const getPageTitle = (pathname, breadcrumbNameMap) => { + const currRouterData = matchParamsPath(pathname, breadcrumbNameMap); + if (!currRouterData) { + return title; + } + const pageName = menu.disableLocal + ? currRouterData.name + : formatMessage({ + id: currRouterData.locale || currRouterData.name, + defaultMessage: currRouterData.name, + }); + + return `${pageName} - ${title}`; +}; + +export default memoizeOne(getPageTitle, isEqual); From 5ee8b5a0c20b59e4b6cb556a93c7ea536383d0e0 Mon Sep 17 00:00:00 2001 From: xiaohuoni <448627663@qq.com> Date: Thu, 21 Feb 2019 14:20:48 +0800 Subject: [PATCH 048/109] =?UTF-8?q?when=20select=203=20item=20=EF=BC=8Ctex?= =?UTF-8?q?t=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/List/Articles.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/List/Articles.js b/src/pages/List/Articles.js index c1c04b72..5ab311ba 100644 --- a/src/pages/List/Articles.js +++ b/src/pages/List/Articles.js @@ -154,8 +154,8 @@ class SearchList extends Component { - - + + {getFieldDecorator('owner', { initialValue: ['wjh', 'zxx'], })( From 5ec235625d91196d27c5d4e82263551387d8408b Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Thu, 21 Feb 2019 15:52:39 +0800 Subject: [PATCH 049/109] style: use standard frontmatter --- src/components/Authorized/index.md | 4 +--- src/components/Charts/index.md | 4 +--- src/components/GlobalFooter/index.md | 4 +--- src/components/HeaderSearch/index.en-US.md | 6 ++---- src/components/HeaderSearch/index.zh-CN.md | 6 ++---- src/components/PageHeader/index.md | 4 +--- src/components/Result/index.md | 4 +--- src/components/TagSelect/index.md | 4 +--- src/components/Trend/index.md | 4 +--- src/utils/getPageTitle.js | 1 + 10 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/components/Authorized/index.md b/src/components/Authorized/index.md index f3b2f80a..48c93f8f 100644 --- a/src/components/Authorized/index.md +++ b/src/components/Authorized/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: Authorized - zh-CN: Authorized +title: Authorized subtitle: 权限 cols: 1 order: 15 diff --git a/src/components/Charts/index.md b/src/components/Charts/index.md index cb7c9c96..e5f41c87 100644 --- a/src/components/Charts/index.md +++ b/src/components/Charts/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: Charts - zh-CN: Charts +title: Charts subtitle: 图表 order: 2 cols: 2 diff --git a/src/components/GlobalFooter/index.md b/src/components/GlobalFooter/index.md index 55b4be46..96e04fee 100644 --- a/src/components/GlobalFooter/index.md +++ b/src/components/GlobalFooter/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: GlobalFooter - zh-CN: GlobalFooter +title: GlobalFooter subtitle: 全局页脚 cols: 1 order: 7 diff --git a/src/components/HeaderSearch/index.en-US.md b/src/components/HeaderSearch/index.en-US.md index 6f4d06b4..989df886 100644 --- a/src/components/HeaderSearch/index.en-US.md +++ b/src/components/HeaderSearch/index.en-US.md @@ -1,7 +1,5 @@ --- -title: - en-US: HeaderSearch - zh-CN: HeaderSearch +title: HeaderSearch subtitle: Top search box cols: 1 order: 8 @@ -21,4 +19,4 @@ onSelect | Called when a option is selected. param is option's value and option 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 | booelan |false \ No newline at end of file +open | The input box is displayed | boolean |false \ No newline at end of file diff --git a/src/components/HeaderSearch/index.zh-CN.md b/src/components/HeaderSearch/index.zh-CN.md index 9c108c2b..83e74887 100644 --- a/src/components/HeaderSearch/index.zh-CN.md +++ b/src/components/HeaderSearch/index.zh-CN.md @@ -1,7 +1,5 @@ --- -title: - en-US: HeaderSearch - zh-CN: HeaderSearch +title: HeaderSearch subtitle: 顶部搜索框 cols: 1 order: 8 @@ -21,4 +19,4 @@ onSelect | 被选中时调用,参数为选中项的 value 值 | function(value onPressEnter | 按下回车时的回调 | function(value) | - onVisibleChange | 显示或隐藏文本框的回调 | function(value) |- defaultOpen | 输入框首次显示是否显示 | boolean | false -open | 控制输入框是否显示 | booelan |false \ No newline at end of file +open | 控制输入框是否显示 | boolean |false \ No newline at end of file diff --git a/src/components/PageHeader/index.md b/src/components/PageHeader/index.md index e82c8b89..48543f5f 100644 --- a/src/components/PageHeader/index.md +++ b/src/components/PageHeader/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: PageHeader - zh-CN: PageHeader +title: PageHeader subtitle: 页头 cols: 1 order: 11 diff --git a/src/components/Result/index.md b/src/components/Result/index.md index dc11206c..05e1c0e2 100644 --- a/src/components/Result/index.md +++ b/src/components/Result/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: Result - zh-CN: Result +title: Result subtitle: 处理结果 cols: 1 order: 12 diff --git a/src/components/TagSelect/index.md b/src/components/TagSelect/index.md index 25a42b57..8d21de7b 100644 --- a/src/components/TagSelect/index.md +++ b/src/components/TagSelect/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: TagSelect - zh-CN: TagSelect +title: TagSelect subtitle: 标签选择器 cols: 1 order: 13 diff --git a/src/components/Trend/index.md b/src/components/Trend/index.md index 3e3ac07a..96d83b85 100644 --- a/src/components/Trend/index.md +++ b/src/components/Trend/index.md @@ -1,7 +1,5 @@ --- -title: - en-US: Trend - zh-CN: Trend +title: Trend subtitle: 趋势标记 cols: 1 order: 14 diff --git a/src/utils/getPageTitle.js b/src/utils/getPageTitle.js index 09e69c32..0dd1e620 100644 --- a/src/utils/getPageTitle.js +++ b/src/utils/getPageTitle.js @@ -8,6 +8,7 @@ export const matchParamsPath = (pathname, breadcrumbNameMap) => { const pathKey = Object.keys(breadcrumbNameMap).find(key => pathToRegexp(key).test(pathname)); return breadcrumbNameMap[pathKey]; }; + const getPageTitle = (pathname, breadcrumbNameMap) => { const currRouterData = matchParamsPath(pathname, breadcrumbNameMap); if (!currRouterData) { From 412d0f6af422f9836d0e06e628440c102e24677b Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Thu, 21 Feb 2019 17:42:28 +0800 Subject: [PATCH 050/109] doc: remove subtitle in en-Us --- src/components/HeaderSearch/index.en-US.md | 2 +- src/components/NoticeIcon/index.en-US.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/HeaderSearch/index.en-US.md b/src/components/HeaderSearch/index.en-US.md index 989df886..9f2b5e8a 100644 --- a/src/components/HeaderSearch/index.en-US.md +++ b/src/components/HeaderSearch/index.en-US.md @@ -1,6 +1,6 @@ --- title: HeaderSearch -subtitle: Top search box +subtitle: cols: 1 order: 8 --- diff --git a/src/components/NoticeIcon/index.en-US.md b/src/components/NoticeIcon/index.en-US.md index a5a5f214..c6472780 100644 --- a/src/components/NoticeIcon/index.en-US.md +++ b/src/components/NoticeIcon/index.en-US.md @@ -1,6 +1,6 @@ --- title: NoticeIcon -subtitle: Notification Menu +subtitle: cols: 1 order: 9 --- From 022cf486476988bd568d37b35d7654c7429c584a Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Fri, 22 Feb 2019 09:52:30 +0800 Subject: [PATCH 051/109] better demo md --- src/components/Exception/demo/403.md | 4 ++-- src/components/Exception/demo/404.md | 4 ++-- src/components/Exception/demo/500.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Exception/demo/403.md b/src/components/Exception/demo/403.md index bb46037f..c0244ab1 100644 --- a/src/components/Exception/demo/403.md +++ b/src/components/Exception/demo/403.md @@ -1,8 +1,8 @@ --- order: 2 title: - zh-CN: 403 - en-US: 403 + zh-CN: 403 页面 + en-US: 403 Page --- ## zh-CN diff --git a/src/components/Exception/demo/404.md b/src/components/Exception/demo/404.md index db50de65..c54e99d4 100644 --- a/src/components/Exception/demo/404.md +++ b/src/components/Exception/demo/404.md @@ -1,8 +1,8 @@ --- order: 0 title: - zh-CN: 404 - en-US: 404 + zh-CN: 404 页面 + en-US: 404 Page --- ## zh-CN diff --git a/src/components/Exception/demo/500.md b/src/components/Exception/demo/500.md index 096ca8e5..2336e41e 100644 --- a/src/components/Exception/demo/500.md +++ b/src/components/Exception/demo/500.md @@ -1,8 +1,8 @@ --- order: 1 title: - zh-CN: 500 - en-US: 500 + zh-CN: 500 页面 + en-US: 500 Page --- ## zh-CN From aa2f14059c576587fcee622061a0b711152ad0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 22 Feb 2019 14:03:19 +0800 Subject: [PATCH 052/109] fix PageHeader no title bug (#3583) * fix PageHeader no title bug * default value --- src/components/PageHeader/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 5d47b345..17c1a7e2 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -15,7 +15,7 @@ export default class PageHeader extends PureComponent { render() { const { - title, + title = '', logo, action, content, @@ -53,7 +53,7 @@ export default class PageHeader extends PureComponent { {logo &&
{logo}
}
- {title &&

{title}

} +

{title}

{action &&
{action}
}
From 6e97ea9299a83f2b261f276d1d32bff018ffc5a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 22 Feb 2019 14:03:31 +0800 Subject: [PATCH 053/109] fix: React does not recognize the `staticContext` prop on a DOM element. (#3582) --- src/layouts/BlankLayout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/BlankLayout.js b/src/layouts/BlankLayout.js index 505270f8..ef39aa4c 100644 --- a/src/layouts/BlankLayout.js +++ b/src/layouts/BlankLayout.js @@ -1,3 +1,3 @@ import React from 'react'; -export default props =>
; +export default ({ children }) =>
{children}
; From 66fc774f71cd1089376114a2260dc7bcea4b296b Mon Sep 17 00:00:00 2001 From: Shuai Chen Date: Mon, 25 Feb 2019 16:33:04 +0800 Subject: [PATCH 054/109] doc: better demo --- src/components/NoticeIcon/demo/popover.md | 224 +++++++++++----------- 1 file changed, 117 insertions(+), 107 deletions(-) diff --git a/src/components/NoticeIcon/demo/popover.md b/src/components/NoticeIcon/demo/popover.md index be6bb861..9515c518 100644 --- a/src/components/NoticeIcon/demo/popover.md +++ b/src/components/NoticeIcon/demo/popover.md @@ -5,96 +5,107 @@ title: 带浮层卡片 点击展开通知卡片,展现多种类型的通知,通常放在导航工具栏。 -````jsx +```jsx import NoticeIcon from 'ant-design-pro/lib/NoticeIcon'; -import moment from 'moment'; -import groupBy from 'lodash/groupBy'; import { Tag } from 'antd'; -const data = [{ - id: '000000001', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '你收到了 14 份新周报', - datetime: '2017-08-09', - type: '通知', -}, { - id: '000000002', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', - title: '你推荐的 曲妮妮 已通过第三轮面试', - datetime: '2017-08-08', - type: '通知', -}, { - id: '000000003', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', - title: '这种模板可以区分多种通知类型', - datetime: '2017-08-07', - read: true, - type: '通知', -}, { - id: '000000004', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', - title: '左侧图标用于区分不同的类型', - datetime: '2017-08-07', - type: '通知', -}, { - id: '000000005', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '内容不要超过两行字,超出时自动截断', - datetime: '2017-08-07', - type: '通知', -}, { - id: '000000006', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '曲丽丽 评论了你', - description: '描述信息描述信息描述信息', - datetime: '2017-08-07', - type: '消息', - clickClose: true, -}, { - id: '000000007', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '朱偏右 回复了你', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: '消息', - clickClose: true, -}, { - id: '000000008', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '标题', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: '消息', - clickClose: true, -}, { - id: '000000009', - title: '任务名称', - description: '任务需要在 2017-01-12 20:00 前启动', - extra: '未开始', - status: 'todo', - type: '待办', -}, { - id: '000000010', - title: '第三方紧急代码变更', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '马上到期', - status: 'urgent', - type: '待办', -}, { - id: '000000011', - title: '信息安全考试', - description: '指派竹尔于 2017-01-09 前完成更新并发布', - extra: '已耗时 8 天', - status: 'doing', - type: '待办', -}, { - id: '000000012', - title: 'ABCD 版本发布', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '进行中', - status: 'processing', - type: '待办', -}]; +const data = [ + { + id: '000000001', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '你收到了 14 份新周报', + datetime: '2017-08-09', + type: '通知', + }, + { + id: '000000002', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', + title: '你推荐的 曲妮妮 已通过第三轮面试', + datetime: '2017-08-08', + type: '通知', + }, + { + id: '000000003', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', + title: '这种模板可以区分多种通知类型', + datetime: '2017-08-07', + read: true, + type: '通知', + }, + { + id: '000000004', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + datetime: '2017-08-07', + type: '通知', + }, + { + id: '000000005', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '内容不要超过两行字,超出时自动截断', + datetime: '2017-08-07', + type: '通知', + }, + { + id: '000000006', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '曲丽丽 评论了你', + description: '描述信息描述信息描述信息', + datetime: '2017-08-07', + type: '消息', + clickClose: true, + }, + { + id: '000000007', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '朱偏右 回复了你', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: '消息', + clickClose: true, + }, + { + id: '000000008', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '标题', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: '消息', + clickClose: true, + }, + { + id: '000000009', + title: '任务名称', + description: '任务需要在 2017-01-12 20:00 前启动', + extra: '未开始', + status: 'todo', + type: '待办', + }, + { + id: '000000010', + title: '第三方紧急代码变更', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '马上到期', + status: 'urgent', + type: '待办', + }, + { + id: '000000011', + title: '信息安全考试', + description: '指派竹尔于 2017-01-09 前完成更新并发布', + extra: '已耗时 8 天', + status: 'doing', + type: '待办', + }, + { + id: '000000012', + title: 'ABCD 版本发布', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '进行中', + status: 'processing', + type: '待办', + }, +]; function onItemClick(item, tabProps) { console.log(item, tabProps); @@ -108,32 +119,38 @@ function getNoticeData(notices) { if (notices.length === 0) { return {}; } - const newNotices = notices.map((notice) => { + const newNotices = notices.map(notice => { const newNotice = { ...notice }; - if (newNotice.datetime) { - newNotice.datetime = moment(notice.datetime).fromNow(); - } // transform id to item key if (newNotice.id) { newNotice.key = newNotice.id; } if (newNotice.extra && newNotice.status) { - const color = ({ + const color = { todo: '', processing: 'blue', urgent: 'red', doing: 'gold', - })[newNotice.status]; - newNotice.extra = {newNotice.extra}; + }[newNotice.status]; + newNotice.extra = ( + + {newNotice.extra} + + ); } return newNotice; }); - return groupBy(newNotices, 'type'); + return newNotices.reduce((pre, data) => { + if (!pre[data.type]) { + pre[data.type] = []; + } + pre[data.type].push(data); + return pre; + }, {}); } const noticeData = getNoticeData(data); - -ReactDOM.render( +const Demo = () => (
- +
-, mountNode); -```` - -```css +); +ReactDOM.render(, mountNode); ``` From 4ff141ad98550b537641e65ce8df4bcb71570359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Tue, 26 Feb 2019 14:21:05 +0800 Subject: [PATCH 055/109] remove drawer onHandleClick, ant-design/ant-design#15051 (#3602) --- src/components/SettingDrawer/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/SettingDrawer/index.js b/src/components/SettingDrawer/index.js index 4b279f59..cdb28aa3 100644 --- a/src/components/SettingDrawer/index.js +++ b/src/components/SettingDrawer/index.js @@ -137,7 +137,7 @@ class SettingDrawer extends PureComponent { onClose={this.togglerContent} placement="right" handler={ -
+
} - onHandleClick={this.togglerContent} style={{ zIndex: 999, }} From d15923c9ee86559f58e838cf5228d5574bfa5556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Wed, 27 Feb 2019 14:50:51 +0800 Subject: [PATCH 056/109] Use Umi Permission Routing (#3587) Use Umi Permission Routing --- config/router.config.js | 1 - src/layouts/BasicLayout.js | 32 +------------------------ src/models/menu.js | 3 ++- src/pages/Authorized.js | 49 +++++++++++++++++++++++++++++++------- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index 840fe833..0f54cc05 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -19,7 +19,6 @@ export default [ path: '/', component: '../layouts/BasicLayout', Routes: ['src/pages/Authorized'], - authority: ['admin', 'user'], routes: [ // dashboard { path: '/', redirect: '/dashboard/analysis' }, diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 33896876..06cc41fc 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -4,14 +4,11 @@ import DocumentTitle from 'react-document-title'; import { connect } from 'dva'; import { ContainerQuery } from 'react-container-query'; import classNames from 'classnames'; -import pathToRegexp from 'path-to-regexp'; import Media from 'react-media'; -import Authorized from '@/utils/Authorized'; import logo from '../assets/logo.svg'; import Footer from './Footer'; import Header from './Header'; import Context from './MenuContext'; -import Exception403 from '../pages/Exception/403'; import PageLoading from '@/components/PageLoading'; import SiderMenu from '@/components/SiderMenu'; import getPageTitle from '@/utils/getPageTitle'; @@ -73,29 +70,6 @@ class BasicLayout extends React.Component { }; } - getRouteAuthority = (pathname, routeData) => { - const routes = routeData.slice(); // clone - - const getAuthority = (routeDatas, path) => { - let authorities; - routeDatas.forEach(route => { - // check partial route - if (pathToRegexp(`${route.path}(.*)`).test(path)) { - if (route.authority) { - authorities = route.authority; - } - // is exact route? - if (!pathToRegexp(route.path).test(path) && route.routes) { - authorities = getAuthority(route.routes, path); - } - } - }); - return authorities; - }; - - return getAuthority(routes, pathname); - }; - getLayoutStyle = () => { const { fixSiderbar, isMobile, collapsed, layout } = this.props; if (fixSiderbar && layout !== 'topmenu' && !isMobile) { @@ -132,12 +106,10 @@ class BasicLayout extends React.Component { isMobile, menuData, breadcrumbNameMap, - route: { routes }, fixedHeader, } = this.props; const isTop = PropsLayout === 'topmenu'; - const routerConfig = this.getRouteAuthority(pathname, routes); const contentStyle = !fixedHeader ? { paddingTop: 0 } : {}; const layout = ( @@ -165,9 +137,7 @@ class BasicLayout extends React.Component { {...this.props} /> - }> - {children} - + {children}
diff --git a/src/models/menu.js b/src/models/menu.js index 218c7065..f0499163 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -97,6 +97,7 @@ export default { state: { menuData: [], + routerData: [], breadcrumbNameMap: {}, }, @@ -107,7 +108,7 @@ export default { const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(menuData); yield put({ type: 'save', - payload: { menuData, breadcrumbNameMap }, + payload: { menuData, breadcrumbNameMap, routerData: routes }, }); }, }, diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index c29d9610..875e1239 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -1,13 +1,44 @@ import React from 'react'; -import RenderAuthorized from '@/components/Authorized'; -import { getAuthority } from '@/utils/authority'; import Redirect from 'umi/redirect'; +import pathToRegexp from 'path-to-regexp'; +import { connect } from 'dva'; +import Authorized from '@/utils/Authorized'; -const Authority = getAuthority(); -const Authorized = RenderAuthorized(Authority); +function AuthComponent({ children, location, routerData, status }) { + const isLogin = status === 'ok'; -export default ({ children }) => ( - }> - {children} - -); + const getRouteAuthority = (pathname, routeData) => { + const routes = routeData.slice(); // clone + + const getAuthority = (routeDatas, path) => { + let authorities; + routeDatas.forEach(route => { + // check partial route + if (pathToRegexp(`${route.path}(.*)`).test(path)) { + if (route.authority) { + authorities = route.authority; + } + // is exact route? + if (!pathToRegexp(route.path).test(path) && route.routes) { + authorities = getAuthority(route.routes, path); + } + } + }); + return authorities; + }; + + return getAuthority(routes, pathname); + }; + return ( + : } + > + {children} + + ); +} +export default connect(({ menu: menuModel, login: loginModel }) => ({ + routerData: menuModel.routerData, + status: loginModel.status, +}))(AuthComponent); From 65ad840b058e57fa0de3efeff593da203079bf7e Mon Sep 17 00:00:00 2001 From: Ekszz Date: Wed, 27 Feb 2019 14:52:09 +0800 Subject: [PATCH 057/109] fix the problem that breadcrumbNameMap does not contain hidden menus. (#3606) --- src/models/menu.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/models/menu.js b/src/models/menu.js index f0499163..55e7909c 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -104,8 +104,9 @@ export default { effects: { *getMenuData({ payload }, { put }) { const { routes, authority } = payload; - const menuData = filterMenuData(memoizeOneFormatter(routes, authority)); - const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(menuData); + const originalMenuData = memoizeOneFormatter(routes, authority); + const menuData = filterMenuData(originalMenuData); + const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(originalMenuData); yield put({ type: 'save', payload: { menuData, breadcrumbNameMap, routerData: routes }, From c86c7c4fcc4821acdf3c86b7b9ca8a287a96038e Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Thu, 28 Feb 2019 04:20:26 +0000 Subject: [PATCH 058/109] Update enzyme to version 3.9.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b75d6910..20949546 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "check-prettier": "^1.0.1", "cross-env": "^5.2.0", "cross-port-killer": "^1.0.1", - "enzyme": "3.8.0", + "enzyme": "3.9.0", "eslint": "^5.13.0", "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.0.0", From 12ae727fb9b5bc4bba7c9ef10dd89af98f883763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Thu, 28 Feb 2019 13:54:21 +0800 Subject: [PATCH 059/109] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20949546..e2608b42 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "check-prettier": "^1.0.1", "cross-env": "^5.2.0", "cross-port-killer": "^1.0.1", - "enzyme": "3.9.0", + "enzyme": "^3.9.0", "eslint": "^5.13.0", "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.0.0", From e7f38846123c1c1639b47f7f69676d38550764a5 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Thu, 28 Feb 2019 05:30:40 +0000 Subject: [PATCH 060/109] Update jest-puppeteer to version 4.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2608b42..f21b48e4 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "eslint-plugin-react": "^7.12.4", "gh-pages": "^2.0.1", "husky": "^1.3.1", - "jest-puppeteer": "^3.9.0", + "jest-puppeteer": "^4.0.0", "less": "^3.9.0", "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", From b6979513b1946d6085a32ae4a05a08f22c03e561 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Thu, 28 Feb 2019 06:45:38 +0000 Subject: [PATCH 061/109] Update prettier to version 1.16.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f21b48e4..c68d148e 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", - "prettier": "1.16.3", + "prettier": "1.16.4", "slash2": "^2.0.0", "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", From 6088b87914eefca074229a1168d5200ad0472caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Thu, 28 Feb 2019 16:09:32 +0800 Subject: [PATCH 062/109] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c68d148e..e3163507 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", - "prettier": "1.16.4", + "prettier": "^1.16.4", "slash2": "^2.0.0", "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", From de370b5995ea3441830b7065cae817f7b391e205 Mon Sep 17 00:00:00 2001 From: Wenhao Liu Date: Thu, 28 Feb 2019 16:28:01 +0800 Subject: [PATCH 063/109] :bug: fix TagCloud style override bug (#3632) --- src/components/Charts/TagCloud/index.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/Charts/TagCloud/index.js b/src/components/Charts/TagCloud/index.js index d94699bd..4898d821 100644 --- a/src/components/Charts/TagCloud/index.js +++ b/src/components/Charts/TagCloud/index.js @@ -51,20 +51,16 @@ class TagCloud extends Component { initTagCloud = () => { function getTextAttrs(cfg) { - return Object.assign( - {}, - { - fillOpacity: cfg.opacity, - fontSize: cfg.origin._origin.size, - rotate: cfg.origin._origin.rotate, - text: cfg.origin._origin.text, - textAlign: 'center', - fontFamily: cfg.origin._origin.font, - fill: cfg.color, - textBaseline: 'Alphabetic', - }, - cfg.style - ); + return Object.assign({}, cfg.style, { + fillOpacity: cfg.opacity, + fontSize: cfg.origin._origin.size, + rotate: cfg.origin._origin.rotate, + text: cfg.origin._origin.text, + textAlign: 'center', + fontFamily: cfg.origin._origin.font, + fill: cfg.color, + textBaseline: 'Alphabetic', + }); } // 给point注册一个词云的shape From 30bdfb3dd0e6f9d0c71cd2c336ad017525b85fb4 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Thu, 28 Feb 2019 07:55:35 +0000 Subject: [PATCH 064/109] Update stylelint-config-prettier to version 5.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e3163507..0d6c8232 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "slash2": "^2.0.0", "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", - "stylelint-config-prettier": "^4.0.0", + "stylelint-config-prettier": "^5.0.0", "stylelint-config-rational-order": "^0.0.4", "stylelint-config-standard": "^18.2.0", "stylelint-declaration-block-no-ignored-properties": "^1.1.0", From aa09904fdb8b82cb52e3b5cb70f41289837858a9 Mon Sep 17 00:00:00 2001 From: shijun Wei <191796158@qq.com> Date: Mon, 4 Mar 2019 01:08:46 +0800 Subject: [PATCH 065/109] Update index.md (#3644) --- src/components/PageHeader/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/PageHeader/index.md b/src/components/PageHeader/index.md index 48543f5f..32a93426 100644 --- a/src/components/PageHeader/index.md +++ b/src/components/PageHeader/index.md @@ -12,6 +12,7 @@ order: 11 | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| | title | title 区域 | ReactNode | - | +| loading | 骨架屏loading状态 | boolean | false | | logo | logo区域 | ReactNode | - | | action | 操作区,位于 title 行的行尾 | ReactNode | - | | home | 默认的主页说明文字 | ReactNode | - | From 4025619d73fe8d5380f76e172881497d947851fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Mon, 4 Mar 2019 01:09:55 +0800 Subject: [PATCH 066/109] dead code (#3639) * dead code Close: #3637 * delete dead props --- src/components/SiderMenu/BaseMenu.js | 4 ++-- src/pages/Dashboard/Analysis.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index 6c8c7022..9ab66ec3 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/src/components/SiderMenu/BaseMenu.js @@ -33,13 +33,13 @@ export default class BaseMenu extends PureComponent { * 获得菜单子节点 * @memberof SiderMenu */ - getNavMenuItems = (menusData, parent) => { + getNavMenuItems = menusData => { if (!menusData) { return []; } return menusData .filter(item => item.name && !item.hideInMenu) - .map(item => this.getSubMenuOrItem(item, parent)) + .map(item => this.getSubMenuOrItem(item)) .filter(item => item); }; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index cceab9bd..07172cc8 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -39,7 +39,6 @@ class Analysis extends Component { type: 'chart/clear', }); cancelAnimationFrame(this.reqRef); - clearTimeout(this.timeoutId); } handleChangeSalesType = e => { From 6f0e24738ce1caeaf962106b167d50ed275b1255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E4=B9=90?= Date: Mon, 4 Mar 2019 01:13:24 +0800 Subject: [PATCH 067/109] [NoticeIcon] Replace `LoadMore` with `ViewMore` button (#3439) * enhance LoadMore: Debounce * enhance LoadMore: debounce * use Tag instead of div * rewrite margin-right of Tag * hide LoadMore in NoticeList without onLoadMore * another style * fix a mistake * remove local config * fix a bug * user-select: none * remover local config * replace global/fetchMoreNotices with global/fetchNotices * replace LoadMore with ViewMore * remove prop `name` in NoticeIcon * fix: tab title does not show correct text --- mock/notices.js | 209 +++++++++---------- src/components/Charts/index.js | 14 +- src/components/GlobalHeader/RightContent.js | 49 ++--- src/components/NoticeIcon/NoticeIconTab.d.ts | 5 +- src/components/NoticeIcon/NoticeList.js | 92 +++----- src/components/NoticeIcon/NoticeList.less | 21 +- src/components/NoticeIcon/demo/popover.md | 196 ++++++++--------- src/components/NoticeIcon/index.d.ts | 6 +- src/components/NoticeIcon/index.en-US.md | 15 +- src/components/NoticeIcon/index.js | 42 ++-- src/components/NoticeIcon/index.zh-CN.md | 13 +- src/layouts/Header.js | 1 - src/locales/en-US/globalHeader.js | 3 +- src/locales/pt-BR/globalHeader.js | 2 +- src/locales/zh-CN/globalHeader.js | 3 +- src/locales/zh-TW/globalHeader.js | 3 +- src/models/global.js | 42 +--- 17 files changed, 282 insertions(+), 434 deletions(-) diff --git a/mock/notices.js b/mock/notices.js index e07565df..505088e0 100644 --- a/mock/notices.js +++ b/mock/notices.js @@ -1,114 +1,101 @@ -const fakeNotices = [ - { - id: '000000001', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '你收到了 14 份新周报', - datetime: '2017-08-09', - type: 'notification', - }, - { - id: '000000002', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', - title: '你推荐的 曲妮妮 已通过第三轮面试', - datetime: '2017-08-08', - type: 'notification', - }, - { - id: '000000003', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', - title: '这种模板可以区分多种通知类型', - datetime: '2017-08-07', - read: true, - type: 'notification', - }, - { - id: '000000004', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', - title: '左侧图标用于区分不同的类型', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000005', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '内容不要超过两行字,超出时自动截断', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000006', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '曲丽丽 评论了你', - description: '描述信息描述信息描述信息', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000007', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '朱偏右 回复了你', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000008', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '标题', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000009', - title: '任务名称', - description: '任务需要在 2017-01-12 20:00 前启动', - extra: '未开始', - status: 'todo', - type: 'event', - }, - { - id: '000000010', - title: '第三方紧急代码变更', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '马上到期', - status: 'urgent', - type: 'event', - }, - { - id: '000000011', - title: '信息安全考试', - description: '指派竹尔于 2017-01-09 前完成更新并发布', - extra: '已耗时 8 天', - status: 'doing', - type: 'event', - }, - { - id: '000000012', - title: 'ABCD 版本发布', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '进行中', - status: 'processing', - type: 'event', - }, -]; - -const getNotices = (req, res) => { - if (req.query && req.query.type) { - const startFrom = parseInt(req.query.lastItemId, 10) + 1; - const result = fakeNotices - .filter(({ type }) => type === req.query.type) - .map((notice, index) => ({ - ...notice, - id: `0000000${startFrom + index}`, - })); - return res.json(startFrom > 24 ? result.concat(null) : result); - } - return res.json(fakeNotices); -}; +const getNotices = (req, res) => + res.json([ + { + id: '000000001', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '你收到了 14 份新周报', + datetime: '2017-08-09', + type: 'notification', + }, + { + id: '000000002', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', + title: '你推荐的 曲妮妮 已通过第三轮面试', + datetime: '2017-08-08', + type: 'notification', + }, + { + id: '000000003', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', + title: '这种模板可以区分多种通知类型', + datetime: '2017-08-07', + read: true, + type: 'notification', + }, + { + id: '000000004', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + datetime: '2017-08-07', + type: 'notification', + }, + { + id: '000000005', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '内容不要超过两行字,超出时自动截断', + datetime: '2017-08-07', + type: 'notification', + }, + { + id: '000000006', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '曲丽丽 评论了你', + description: '描述信息描述信息描述信息', + datetime: '2017-08-07', + type: 'message', + clickClose: true, + }, + { + id: '000000007', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '朱偏右 回复了你', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: 'message', + clickClose: true, + }, + { + id: '000000008', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '标题', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: 'message', + clickClose: true, + }, + { + id: '000000009', + title: '任务名称', + description: '任务需要在 2017-01-12 20:00 前启动', + extra: '未开始', + status: 'todo', + type: 'event', + }, + { + id: '000000010', + title: '第三方紧急代码变更', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '马上到期', + status: 'urgent', + type: 'event', + }, + { + id: '000000011', + title: '信息安全考试', + description: '指派竹尔于 2017-01-09 前完成更新并发布', + extra: '已耗时 8 天', + status: 'doing', + type: 'event', + }, + { + id: '000000012', + title: 'ABCD 版本发布', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '进行中', + status: 'processing', + type: 'event', + }, + ]); export default { 'GET /api/notices': getNotices, diff --git a/src/components/Charts/index.js b/src/components/Charts/index.js index 56a1c565..6fbcb743 100644 --- a/src/components/Charts/index.js +++ b/src/components/Charts/index.js @@ -3,15 +3,11 @@ import numeral from 'numeral'; import ChartCard from './ChartCard'; import Field from './Field'; -const getComponent = Component => { - return props => { - return ( - - - - ); - }; -}; +const getComponent = Component => props => ( + + + +); const Bar = getComponent(React.lazy(() => import('./Bar'))); const Pie = getComponent(React.lazy(() => import('./Pie'))); diff --git a/src/components/GlobalHeader/RightContent.js b/src/components/GlobalHeader/RightContent.js index dad360ff..3b07c3e6 100644 --- a/src/components/GlobalHeader/RightContent.js +++ b/src/components/GlobalHeader/RightContent.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { FormattedMessage, formatMessage } from 'umi/locale'; -import { Spin, Tag, Menu, Icon, Avatar, Tooltip } from 'antd'; +import { Spin, Tag, Menu, Icon, Avatar, Tooltip, message } from 'antd'; import moment from 'moment'; import groupBy from 'lodash/groupBy'; import NoticeIcon from '../NoticeIcon'; @@ -63,30 +63,13 @@ export default class GlobalHeaderRight extends PureComponent { }); }; - fetchMoreNotices = tabProps => { - const { list, name } = tabProps; - const { dispatch, notices = [] } = this.props; - const lastItemId = notices[notices.length - 1].id; - dispatch({ - type: 'global/fetchMoreNotices', - payload: { - lastItemId, - type: name, - offset: list.length, - }, - }); - }; - render() { const { currentUser, - fetchingMoreNotices, fetchingNotices, - loadedAllNotices, onNoticeVisibleChange, onMenuClick, onNoticeClear, - skeletonCount, theme, } = this.props; const menu = ( @@ -110,11 +93,6 @@ export default class GlobalHeaderRight extends PureComponent {
); - const loadMoreProps = { - skeletonCount, - loadedAll: loadedAllNotices, - loading: fetchingMoreNotices, - }; const noticeData = this.getNoticeData(); const unreadMsg = this.getUnreadData(noticeData); let className = styles.right; @@ -155,44 +133,43 @@ export default class GlobalHeaderRight extends PureComponent { console.log(item, tabProps); // eslint-disable-line this.changeReadState(item, tabProps); }} + loading={fetchingNotices} locale={{ emptyText: formatMessage({ id: 'component.noticeIcon.empty' }), clear: formatMessage({ id: 'component.noticeIcon.clear' }), - loadedAll: formatMessage({ id: 'component.noticeIcon.loaded' }), - loadMore: formatMessage({ id: 'component.noticeIcon.loading-more' }), + viewMore: formatMessage({ id: 'component.noticeIcon.view-more' }), + notification: formatMessage({ id: 'component.globalHeader.notification' }), + message: formatMessage({ id: 'component.globalHeader.message' }), + event: formatMessage({ id: 'component.globalHeader.event' }), }} onClear={onNoticeClear} - onLoadMore={this.fetchMoreNotices} onPopupVisibleChange={onNoticeVisibleChange} - loading={fetchingNotices} + onViewMore={() => message.info('Click on view more')} clearClose > {currentUser.name ? ( diff --git a/src/components/NoticeIcon/NoticeIconTab.d.ts b/src/components/NoticeIcon/NoticeIconTab.d.ts index 6ffaf032..869dbbf0 100644 --- a/src/components/NoticeIcon/NoticeIconTab.d.ts +++ b/src/components/NoticeIcon/NoticeIconTab.d.ts @@ -15,12 +15,9 @@ export interface INoticeIconTabProps { emptyText?: React.ReactNode; emptyImage?: string; list?: INoticeIconData[]; - loadedAll?: boolean; - loading?: boolean; name?: string; showClear?: boolean; - skeletonCount?: number; - skeletonProps?: SkeletonProps; + showViewMore?: boolean; style?: React.CSSProperties; title?: string; } diff --git a/src/components/NoticeIcon/NoticeList.js b/src/components/NoticeIcon/NoticeList.js index 6b73e6e0..63985abd 100644 --- a/src/components/NoticeIcon/NoticeList.js +++ b/src/components/NoticeIcon/NoticeList.js @@ -1,10 +1,8 @@ import React from 'react'; -import { Avatar, List, Skeleton } from 'antd'; +import { Avatar, List } from 'antd'; import classNames from 'classnames'; import styles from './NoticeList.less'; -let ListElement = null; - export default function NoticeList({ data = [], onClick, @@ -13,14 +11,9 @@ export default function NoticeList({ locale, emptyText, emptyImage, - loading, - onLoadMore, - visible, - loadedAll = true, - scrollToLoad = true, + onViewMore = null, showClear = true, - skeletonCount = 5, - skeletonProps = {}, + showViewMore = false, }) { if (data.length === 0) { return ( @@ -30,36 +23,10 @@ export default function NoticeList({
); } - const loadingList = Array.from({ length: loading ? skeletonCount : 0 }).map(() => ({ loading })); - const LoadMore = loadedAll ? ( -
- {locale.loadedAll} -
- ) : ( -
- {locale.loadMore} -
- ); - const onScroll = event => { - if (!scrollToLoad || loading || loadedAll) return; - if (typeof onLoadMore !== 'function') return; - const { currentTarget: t } = event; - if (t.scrollHeight - t.scrollTop - t.clientHeight <= 40) { - onLoadMore(event); - ListElement = t; - } - }; - if (!visible && ListElement) { - try { - ListElement.scrollTo(null, 0); - } catch (err) { - ListElement = null; - } - } return (
- - {[...data, ...loadingList].map((item, i) => { + + {data.map((item, i) => { const itemCls = classNames(styles.item, { [styles.read]: item.read, }); @@ -74,35 +41,36 @@ export default function NoticeList({ return ( onClick(item)}> - - - {item.title} -
{item.extra}
-
- } - description={ -
-
- {item.description} -
-
{item.datetime}
+ + {item.title} +
{item.extra}
+
+ } + description={ +
+
+ {item.description}
- } - /> - +
{item.datetime}
+
+ } + /> ); })} - {showClear ? ( -
- {locale.clear} {title} -
- ) : null} +
+ {showClear ? ( +
+ {locale.clear} {locale[title] || title} +
+ ) : null} + {showViewMore ?
{locale.viewMore}
: null} +
); } diff --git a/src/components/NoticeIcon/NoticeList.less b/src/components/NoticeIcon/NoticeList.less index fc566ad0..efa686cb 100644 --- a/src/components/NoticeIcon/NoticeList.less +++ b/src/components/NoticeIcon/NoticeList.less @@ -78,17 +78,28 @@ } } -.clear { +.bottomBar { height: 46px; color: @text-color; line-height: 46px; text-align: center; border-top: 1px solid @border-color-split; border-radius: 0 0 @border-radius-base @border-radius-base; - cursor: pointer; transition: all 0.3s; - - &:hover { - color: @heading-color; + div { + display: inline-block; + width: 50%; + cursor: pointer; + transition: all 0.3s; + user-select: none; + &:hover { + color: @heading-color; + } + &:only-child { + width: 100%; + } + &:not(:only-child):last-child { + border-left: 1px solid @border-color-split; + } } } diff --git a/src/components/NoticeIcon/demo/popover.md b/src/components/NoticeIcon/demo/popover.md index 9515c518..9694c5ef 100644 --- a/src/components/NoticeIcon/demo/popover.md +++ b/src/components/NoticeIcon/demo/popover.md @@ -9,103 +9,90 @@ title: 带浮层卡片 import NoticeIcon from 'ant-design-pro/lib/NoticeIcon'; import { Tag } from 'antd'; -const data = [ - { - id: '000000001', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '你收到了 14 份新周报', - datetime: '2017-08-09', - type: '通知', - }, - { - id: '000000002', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', - title: '你推荐的 曲妮妮 已通过第三轮面试', - datetime: '2017-08-08', - type: '通知', - }, - { - id: '000000003', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', - title: '这种模板可以区分多种通知类型', - datetime: '2017-08-07', - read: true, - type: '通知', - }, - { - id: '000000004', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', - title: '左侧图标用于区分不同的类型', - datetime: '2017-08-07', - type: '通知', - }, - { - id: '000000005', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '内容不要超过两行字,超出时自动截断', - datetime: '2017-08-07', - type: '通知', - }, - { - id: '000000006', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '曲丽丽 评论了你', - description: '描述信息描述信息描述信息', - datetime: '2017-08-07', - type: '消息', - clickClose: true, - }, - { - id: '000000007', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '朱偏右 回复了你', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: '消息', - clickClose: true, - }, - { - id: '000000008', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '标题', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: '消息', - clickClose: true, - }, - { - id: '000000009', - title: '任务名称', - description: '任务需要在 2017-01-12 20:00 前启动', - extra: '未开始', - status: 'todo', - type: '待办', - }, - { - id: '000000010', - title: '第三方紧急代码变更', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '马上到期', - status: 'urgent', - type: '待办', - }, - { - id: '000000011', - title: '信息安全考试', - description: '指派竹尔于 2017-01-09 前完成更新并发布', - extra: '已耗时 8 天', - status: 'doing', - type: '待办', - }, - { - id: '000000012', - title: 'ABCD 版本发布', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '进行中', - status: 'processing', - type: '待办', - }, -]; +const data = [{ + id: '000000001', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '你收到了 14 份新周报', + datetime: '2017-08-09', + type: 'notification', +}, { + id: '000000002', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', + title: '你推荐的 曲妮妮 已通过第三轮面试', + datetime: '2017-08-08', + type: 'notification', +}, { + id: '000000003', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', + title: '这种模板可以区分多种通知类型', + datetime: '2017-08-07', + read: true, + type: 'notification', +}, { + id: '000000004', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + datetime: '2017-08-07', + type: 'notification', +}, { + id: '000000005', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', + title: '内容不要超过两行字,超出时自动截断', + datetime: '2017-08-07', + type: 'notification', +}, { + id: '000000006', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '曲丽丽 评论了你', + description: '描述信息描述信息描述信息', + datetime: '2017-08-07', + type: 'message', + clickClose: true, +}, { + id: '000000007', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '朱偏右 回复了你', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: 'message', + clickClose: true, +}, { + id: '000000008', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', + title: '标题', + description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', + datetime: '2017-08-07', + type: 'message', + clickClose: true, +}, { + id: '000000009', + title: '任务名称', + description: '任务需要在 2017-01-12 20:00 前启动', + extra: '未开始', + status: 'todo', + type: 'event', +}, { + id: '000000010', + title: '第三方紧急代码变更', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '马上到期', + status: 'urgent', + type: 'event', +}, { + id: '000000011', + title: '信息安全考试', + description: '指派竹尔于 2017-01-09 前完成更新并发布', + extra: '已耗时 8 天', + status: 'doing', + type: 'event', +}, { + id: '000000012', + title: 'ABCD 版本发布', + description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', + extra: '进行中', + status: 'processing', + type: 'event', +}]; function onItemClick(item, tabProps) { console.log(item, tabProps); @@ -163,23 +150,20 @@ const Demo = () => ( > diff --git a/src/components/NoticeIcon/index.d.ts b/src/components/NoticeIcon/index.d.ts index f7d6479a..d32586d6 100644 --- a/src/components/NoticeIcon/index.d.ts +++ b/src/components/NoticeIcon/index.d.ts @@ -8,7 +8,7 @@ export interface INoticeIconProps { loading?: boolean; onClear?: (tabName: string) => void; onItemClick?: (item: INoticeIconData, tabProps: INoticeIconProps) => void; - onLoadMore?: (tabProps: INoticeIconProps) => void; + onViewMore?: (tabProps: INoticeIconProps) => void; onTabChange?: (tabTile: string) => void; style?: React.CSSProperties; onPopupVisibleChange?: (visible: boolean) => void; @@ -16,8 +16,8 @@ export interface INoticeIconProps { locale?: { emptyText: string; clear: string; - loadedAll: string; - loadMore: string; + viewMore: string; + [key: string]: string; }; clearClose?: boolean; } diff --git a/src/components/NoticeIcon/index.en-US.md b/src/components/NoticeIcon/index.en-US.md index c6472780..677fa216 100644 --- a/src/components/NoticeIcon/index.en-US.md +++ b/src/components/NoticeIcon/index.en-US.md @@ -5,7 +5,7 @@ cols: 1 order: 9 --- -用在导航工具栏上,作为整个产品统一的通知中心。 +Used in navigation toolbar as a unified notification center for the entire product. ## API @@ -16,11 +16,11 @@ bell | Change the bell Icon | ReactNode | `` loading | Popup card loading status | boolean | `false` onClear | Click to clear button the callback | function(tabName) | - onItemClick | Click on the list item's callback | function(item, tabProps) | - -onLoadMore | Callback of click for loading more | function(tabProps, event) | - onPopupVisibleChange | Popup Card Showing or Hiding Callbacks | function(visible) | - onTabChange | Switching callbacks for tabs | function(tabTitle) | - +onViewMore | Callback of click for view more | function(tabProps, event) | - popupVisible | Popup card display state | boolean | - -locale | Default message text | Object | `{ emptyText: 'No notifications', clear: 'Clear', loadedAll: 'Loaded', loadMore: 'Loading more' }` +locale | Default message text | Object | `{ emptyText: 'No notifications', clear: 'Clear', viewMore: 'Loading more' }` clearClose | Close menu after clear | boolean | `false` ### NoticeIcon.Tab @@ -31,14 +31,9 @@ count | Unread messages count of this tab | number | list.length emptyText | Message text when list is empty | ReactNode | - emptyImage | Image when list is empty | string | - list | List data, format refer to the following table | Array | `[]` -loadedAll | All messages have been loaded | boolean | `true` -loading | Loading status of this tab | boolean | `false` -name | identifier for message Tab | string | - -scrollToLoad | Scroll to load | boolean | `true` -skeletonCount | Number of skeleton when tab is loading | number | `5` -skeletonProps | Props of skeleton | SkeletonProps | `{}` showClear | Clear button display status | boolean | `true` -title | header for message Tab | string | - +showViewMore | View more button display status | boolean | `false` +title | header for message Tab, the actual text is `locale[title] || title` | string | - ### Tab data diff --git a/src/components/NoticeIcon/index.js b/src/components/NoticeIcon/index.js index 133819bb..5ba4a70e 100644 --- a/src/components/NoticeIcon/index.js +++ b/src/components/NoticeIcon/index.js @@ -16,13 +16,13 @@ export default class NoticeIcon extends PureComponent { onPopupVisibleChange: () => {}, onTabChange: () => {}, onClear: () => {}, + onViewMore: () => {}, loading: false, clearClose: false, locale: { emptyText: 'No notifications', clear: 'Clear', - loadedAll: 'Loaded', - loadMore: 'Loading more', + viewMore: 'More', }, emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg', }; @@ -53,53 +53,35 @@ export default class NoticeIcon extends PureComponent { onTabChange(tabType); }; - onLoadMore = (tabProps, event) => { - const { onLoadMore } = this.props; - onLoadMore(tabProps, event); + onViewMore = (tabProps, event) => { + const { onViewMore } = this.props; + onViewMore(tabProps, event); }; getNotificationBox() { - const { visible } = this.state; const { children, loading, locale } = this.props; if (!children) { return null; } const panes = React.Children.map(children, child => { - const { - list, - title, - name, - count, - emptyText, - emptyImage, - showClear, - loadedAll, - scrollToLoad, - skeletonCount, - skeletonProps, - loading: tabLoading, - } = child.props; + const { list, title, count, emptyText, emptyImage, showClear, showViewMore } = child.props; const len = list && list.length ? list.length : 0; const msgCount = count || count === 0 ? count : len; - const tabTitle = msgCount > 0 ? `${title} (${msgCount})` : title; + const localeTitle = locale[title] || title; + const tabTitle = msgCount > 0 ? `${localeTitle} (${msgCount})` : localeTitle; return ( - + this.onClear(name)} + onClear={() => this.onClear(title)} onClick={item => this.onItemClick(item, child.props)} - onLoadMore={event => this.onLoadMore(child.props, event)} - scrollToLoad={scrollToLoad} + onViewMore={event => this.onViewMore(child.props, event)} showClear={showClear} - skeletonCount={skeletonCount} - skeletonProps={skeletonProps} + showViewMore={showViewMore} title={title} - visible={visible} /> ); diff --git a/src/components/NoticeIcon/index.zh-CN.md b/src/components/NoticeIcon/index.zh-CN.md index 23dab220..fe722de7 100644 --- a/src/components/NoticeIcon/index.zh-CN.md +++ b/src/components/NoticeIcon/index.zh-CN.md @@ -16,11 +16,11 @@ bell | translate this please -> Change the bell Icon | ReactNode | ` ({ collapsed: global.collapsed, fetchingMoreNotices: loading.effects['global/fetchMoreNotices'], fetchingNotices: loading.effects['global/fetchNotices'], - loadedAllNotices: global.loadedAllNotices, notices: global.notices, setting, }))(HeaderView); diff --git a/src/locales/en-US/globalHeader.js b/src/locales/en-US/globalHeader.js index 29f21d7d..60b6d4ec 100644 --- a/src/locales/en-US/globalHeader.js +++ b/src/locales/en-US/globalHeader.js @@ -13,6 +13,5 @@ export default { 'component.noticeIcon.clear': 'Clear', 'component.noticeIcon.cleared': 'Cleared', 'component.noticeIcon.empty': 'No notifications', - 'component.noticeIcon.loaded': 'Loaded', - 'component.noticeIcon.loading-more': 'Loading more', + 'component.noticeIcon.view-more': 'View more', }; diff --git a/src/locales/pt-BR/globalHeader.js b/src/locales/pt-BR/globalHeader.js index eac034d5..c9273991 100644 --- a/src/locales/pt-BR/globalHeader.js +++ b/src/locales/pt-BR/globalHeader.js @@ -14,5 +14,5 @@ export default { 'component.noticeIcon.cleared': 'Limpo', 'component.noticeIcon.empty': 'Sem notificações', 'component.noticeIcon.loaded': 'Carregado', - 'component.noticeIcon.loading-more': 'Carregar mais', + 'component.noticeIcon.view-more': 'Veja mais', }; diff --git a/src/locales/zh-CN/globalHeader.js b/src/locales/zh-CN/globalHeader.js index 20453829..9fd66a58 100644 --- a/src/locales/zh-CN/globalHeader.js +++ b/src/locales/zh-CN/globalHeader.js @@ -13,6 +13,5 @@ export default { 'component.noticeIcon.clear': '清空', 'component.noticeIcon.cleared': '清空了', 'component.noticeIcon.empty': '暂无数据', - 'component.noticeIcon.loaded': '加载完毕', - 'component.noticeIcon.loading-more': '加载更多', + 'component.noticeIcon.view-more': '查看更多', }; diff --git a/src/locales/zh-TW/globalHeader.js b/src/locales/zh-TW/globalHeader.js index c7b4e6f6..ed584518 100644 --- a/src/locales/zh-TW/globalHeader.js +++ b/src/locales/zh-TW/globalHeader.js @@ -13,6 +13,5 @@ export default { 'component.noticeIcon.clear': '清空', 'component.noticeIcon.cleared': '清空了', 'component.noticeIcon.empty': '暫無資料', - 'component.noticeIcon.loaded': '加載完畢', - 'component.noticeIcon.loading-more': '加載更多', + 'component.noticeIcon.view-more': '查看更多', }; diff --git a/src/models/global.js b/src/models/global.js index 42895b59..34cff599 100644 --- a/src/models/global.js +++ b/src/models/global.js @@ -6,42 +6,14 @@ export default { state: { collapsed: false, notices: [], - loadedAllNotices: false, }, effects: { *fetchNotices(_, { call, put, select }) { const data = yield call(queryNotices); - const loadedAllNotices = data && data.length && data[data.length - 1] === null; - yield put({ - type: 'setLoadedStatus', - payload: loadedAllNotices, - }); yield put({ type: 'saveNotices', - payload: data.filter(item => item), - }); - const unreadCount = yield select( - state => state.global.notices.filter(item => !item.read).length - ); - yield put({ - type: 'user/changeNotifyCount', - payload: { - totalCount: data.length, - unreadCount, - }, - }); - }, - *fetchMoreNotices({ payload }, { call, put, select }) { - const data = yield call(queryNotices, payload); - const loadedAllNotices = data && data.length && data[data.length - 1] === null; - yield put({ - type: 'setLoadedStatus', - payload: loadedAllNotices, - }); - yield put({ - type: 'pushNotices', - payload: data.filter(item => item), + payload: data, }); const unreadCount = yield select( state => state.global.notices.filter(item => !item.read).length @@ -114,18 +86,6 @@ export default { notices: state.notices.filter(item => item.type !== payload), }; }, - pushNotices(state, { payload }) { - return { - ...state, - notices: [...state.notices, ...payload], - }; - }, - setLoadedStatus(state, { payload }) { - return { - ...state, - loadedAllNotices: payload, - }; - }, }, subscriptions: { From 8235142eb903da9d4dac0985a097b65ee372df4d Mon Sep 17 00:00:00 2001 From: Sean Bao Date: Tue, 5 Mar 2019 12:06:50 +0800 Subject: [PATCH 068/109] Fix margin top style error of Description List following Description List (#3653) --- src/components/DescriptionList/index.less | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/DescriptionList/index.less b/src/components/DescriptionList/index.less index 4048a128..c3cf8e69 100644 --- a/src/components/DescriptionList/index.less +++ b/src/components/DescriptionList/index.less @@ -8,6 +8,14 @@ overflow: hidden; } } + // fix margin top error of following descriptionList + & + & { + :global { + .ant-row { + margin-top: 16px; + } + } + } .title { margin-bottom: 16px; @@ -47,6 +55,14 @@ margin-bottom: -8px; } } + // fix margin top error of following descriptionList + & + .descriptionList { + :global { + .ant-row { + margin-top: 8px; + } + } + } .title { margin-bottom: 12px; color: @text-color; From a9efb31bc969dad007b7eef192a8fe75904d7de4 Mon Sep 17 00:00:00 2001 From: kennylbj <632786081@qq.com> Date: Fri, 8 Mar 2019 10:21:12 +0800 Subject: [PATCH 069/109] Fix authoriy inherit issue (#3679) --- src/pages/Authorized.js | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index 875e1239..960f2c6b 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -6,28 +6,20 @@ import Authorized from '@/utils/Authorized'; function AuthComponent({ children, location, routerData, status }) { const isLogin = status === 'ok'; + const getRouteAuthority = (path, routeData) => { + let authorities; + routeData.forEach(route => { + // match prefix + if (pathToRegexp(`${route.path}(.*)`).test(path)) { + authorities = route.authority || authorities; - const getRouteAuthority = (pathname, routeData) => { - const routes = routeData.slice(); // clone - - const getAuthority = (routeDatas, path) => { - let authorities; - routeDatas.forEach(route => { - // check partial route - if (pathToRegexp(`${route.path}(.*)`).test(path)) { - if (route.authority) { - authorities = route.authority; - } - // is exact route? - if (!pathToRegexp(route.path).test(path) && route.routes) { - authorities = getAuthority(route.routes, path); - } + // get children authority recursively + if (route.routes) { + authorities = getRouteAuthority(path, route.routes) || authorities; } - }); - return authorities; - }; - - return getAuthority(routes, pathname); + } + }); + return authorities; }; return ( Date: Tue, 12 Mar 2019 09:24:43 +0800 Subject: [PATCH 070/109] bug: fix the problem of logging out and backing back --- src/models/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/login.js b/src/models/login.js index 82fc4249..46bbeb7d 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -55,7 +55,7 @@ export default { }); reloadAuthorized(); yield put( - routerRedux.push({ + routerRedux.replace({ pathname: '/user/login', search: stringify({ redirect: window.location.href, From cb5a083410e5ff4aabe8a74081068de4374d5c4a Mon Sep 17 00:00:00 2001 From: Zhongjie Wu Date: Wed, 13 Mar 2019 13:48:06 +0800 Subject: [PATCH 071/109] Optimize asset chunking (#3650) * Optimize asset chunking * fix issues * don't apply chunking on on non async assets --- config/config.js | 4 ---- config/plugin.config.js | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/config/config.js b/config/config.js index 226d448e..1ffa812e 100644 --- a/config/config.js +++ b/config/config.js @@ -75,10 +75,6 @@ export default { theme: { 'primary-color': primaryColor, }, - externals: { - '@antv/data-set': 'DataSet', - bizcharts: 'BizCharts', - }, // proxy: { // '/server/api/': { // target: 'https://preview.pro.ant.design/', diff --git a/config/plugin.config.js b/config/plugin.config.js index b9e842d2..2273586e 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -4,6 +4,25 @@ import MergeLessPlugin from 'antd-pro-merge-less'; import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; import path from 'path'; +function getModulePackageName(module) { + if (!module.context) return null; + + const nodeModulesPath = path.join(__dirname, '../node_modules/'); + if (module.context.substring(0, nodeModulesPath.length) !== nodeModulesPath) { + return null; + } + + const moduleRelativePath = module.context.substring(nodeModulesPath.length); + const [moduleDirName] = moduleRelativePath.split(path.sep); + let packageName = moduleDirName; + // handle tree shaking + if (packageName.match('^_')) { + // eslint-disable-next-line prefer-destructuring + packageName = packageName.match(/^_(@?[^@]+)/)[1]; + } + return packageName; +} + export default config => { // pro 和 开发环境再添加这个插件 if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') { @@ -30,4 +49,32 @@ export default config => { }, ]); } + // optimize chunks + config.optimization + .runtimeChunk(false) // share the same chunks across different modules + .splitChunks({ + chunks: 'async', + name: 'vendors', + maxInitialRequests: Infinity, + minSize: 0, + cacheGroups: { + vendors: { + test: module => { + const packageName = getModulePackageName(module); + if (packageName) { + return ['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0; + } + return false; + }, + name(module) { + const packageName = getModulePackageName(module); + + if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) { + return 'viz'; // visualization package + } + return 'misc'; + }, + }, + }, + }); }; From 5684b5d579e6b25cfdb0962719b1755e3f7561d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 13 Mar 2019 14:31:46 +0800 Subject: [PATCH 072/109] feat: remove import lib (#3736) --- config/config.js | 2 +- src/components/Charts/AsyncLoadBizCharts.js | 44 --------------------- src/components/Charts/index.js | 28 +++++-------- src/pages/Dashboard/Analysis.js | 7 +--- src/pages/Dashboard/Monitor.js | 7 +--- src/pages/Dashboard/Workplace.js | 7 +--- 6 files changed, 14 insertions(+), 81 deletions(-) delete mode 100644 src/components/Charts/AsyncLoadBizCharts.js diff --git a/config/config.js b/config/config.js index 1ffa812e..9317a5b3 100644 --- a/config/config.js +++ b/config/config.js @@ -6,7 +6,7 @@ import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; const { pwa, primaryColor } = defaultSettings; -const { NODE_ENV, APP_TYPE, TEST } = process.env; +const { APP_TYPE, TEST } = process.env; const plugins = [ [ diff --git a/src/components/Charts/AsyncLoadBizCharts.js b/src/components/Charts/AsyncLoadBizCharts.js deleted file mode 100644 index 8d9a2cd0..00000000 --- a/src/components/Charts/AsyncLoadBizCharts.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import PageLoading from '../PageLoading'; -import { importCDN } from '@/utils/utils'; - -let isLoaderBizChart = false; -const loadBizCharts = async () => { - if (isLoaderBizChart) { - return Promise.resolve(true); - } - await Promise.all([ - importCDN('//gw.alipayobjects.com/os/lib/bizcharts/3.4.3/umd/BizCharts.min.js'), - importCDN('//gw.alipayobjects.com/os/lib/antv/data-set/0.10.1/dist/data-set.min.js'), - ]); - // eslint-disable-next-line no-console - console.log('bizCharts load success'); - isLoaderBizChart = true; - return Promise.resolve(true); -}; - -class AsyncLoadBizCharts extends React.Component { - state = { - loading: !isLoaderBizChart, - }; - - async componentDidMount() { - await loadBizCharts(); - requestAnimationFrame(() => { - this.setState({ - loading: false, - }); - }); - } - - render() { - const { children } = this.props; - const { loading } = this.state; - if (!loading) { - return children; - } - return ; - } -} - -export { loadBizCharts, AsyncLoadBizCharts }; diff --git a/src/components/Charts/index.js b/src/components/Charts/index.js index 6fbcb743..294eeb65 100644 --- a/src/components/Charts/index.js +++ b/src/components/Charts/index.js @@ -1,24 +1,16 @@ -import React, { Suspense } from 'react'; import numeral from 'numeral'; import ChartCard from './ChartCard'; import Field from './Field'; - -const getComponent = Component => props => ( - - - -); - -const Bar = getComponent(React.lazy(() => import('./Bar'))); -const Pie = getComponent(React.lazy(() => import('./Pie'))); -const Radar = getComponent(React.lazy(() => import('./Radar'))); -const Gauge = getComponent(React.lazy(() => import('./Gauge'))); -const MiniArea = getComponent(React.lazy(() => import('./MiniArea'))); -const MiniBar = getComponent(React.lazy(() => import('./MiniBar'))); -const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress'))); -const WaterWave = getComponent(React.lazy(() => import('./WaterWave'))); -const TagCloud = getComponent(React.lazy(() => import('./TagCloud'))); -const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart'))); +import Bar from './Bar'; +import Pie from './Pie'; +import Radar from './Radar'; +import Gauge from './Gauge'; +import MiniArea from './MiniArea'; +import MiniBar from './MiniBar'; +import MiniProgress from './MiniProgress'; +import WaterWave from './WaterWave'; +import TagCloud from './TagCloud'; +import TimelineChart from './TimelineChart'; const yuan = val => `¥ ${numeral(val).format('0,0')}`; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 07172cc8..0d222cc3 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -5,7 +5,6 @@ import GridContent from '@/components/PageHeaderWrapper/GridContent'; import { getTimeDistance } from '@/utils/utils'; import styles from './Analysis.less'; import PageLoading from '@/components/PageLoading'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; const IntroduceRow = React.lazy(() => import('./IntroduceRow')); const SalesCard = React.lazy(() => import('./SalesCard')); @@ -182,8 +181,4 @@ class Analysis extends Component { } } -export default props => ( - - - -); +export default Analysis; diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index d9bb87c6..a2d812ab 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Row, Col, Card, Tooltip } from 'antd'; @@ -242,8 +241,4 @@ class Monitor extends Component { } } -export default props => ( - - - -); +export default Monitor; diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 3e7ff986..d71b122a 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -3,7 +3,6 @@ import moment from 'moment'; import { connect } from 'dva'; import Link from 'umi/link'; import { Row, Col, Card, List, Avatar } from 'antd'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { Radar } from '@/components/Charts'; import EditableLinkGroup from '@/components/EditableLinkGroup'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; @@ -253,8 +252,4 @@ class Workplace extends PureComponent { } } -export default props => ( - - - -); +export default Workplace; From 3708b6f92fd9f773b34f21875159d3cf5039a172 Mon Sep 17 00:00:00 2001 From: yaphet Date: Thu, 14 Mar 2019 09:31:05 +0800 Subject: [PATCH 073/109] =?UTF-8?q?fix:=E5=B0=8F=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=AE=8C=E5=85=A8=20(#3726)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复小屏幕显示不完全问题 屏幕尺寸小于1200时,顶部菜单右侧内容被遮挡 * Update index.js * 格式化代码 --- src/components/TopNavHeader/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/TopNavHeader/index.js b/src/components/TopNavHeader/index.js index 2d0e0656..0b6440e6 100644 --- a/src/components/TopNavHeader/index.js +++ b/src/components/TopNavHeader/index.js @@ -13,7 +13,11 @@ export default class TopNavHeader extends PureComponent { static getDerivedStateFromProps(props) { return { - maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 280 - 165 - 40, + maxWidth: + (props.contentWidth === 'Fixed' && window.innerWidth > 1200 ? 1200 : window.innerWidth) - + 280 - + 120 - + 40, }; } From 32918e44e9ca0c877761f168d44f2134c7c2d204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=B7=E9=92=89?= <41830859@qq.com> Date: Thu, 14 Mar 2019 09:33:01 +0800 Subject: [PATCH 074/109] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=9C=89?= =?UTF-8?q?=E5=A4=9A=E4=B8=AAlayout=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=85=B6=E4=B8=AD=E4=B8=80=E4=B8=AAlayout=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89routes=EF=BC=8C=E5=B0=86=E5=8F=91=E6=94=B6=E5=88=B0?= =?UTF-8?q?=E5=8F=A6=E4=B8=80=E4=B8=AAlayout=E7=9A=84=E8=8F=9C=E5=8D=95=20?= =?UTF-8?q?(#3724)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/menu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/models/menu.js b/src/models/menu.js index 55e7909c..2e803f06 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -8,6 +8,9 @@ const { check } = Authorized; // Conversion router to menu. function formatter(data, parentAuthority, parentName) { + if (!data) { + return undefined; + } return data .map(item => { if (!item.name || !item.path) { @@ -75,6 +78,9 @@ const filterMenuData = menuData => { * @param {Object} menuData 菜单配置 */ const getBreadcrumbNameMap = menuData => { + if (!menuData) { + return {}; + } const routerMap = {}; const flattenMenuData = data => { From c98963e64268fda984ad8db190e83e401d50f48a Mon Sep 17 00:00:00 2001 From: Kevin Lee Date: Thu, 14 Mar 2019 09:35:10 +0800 Subject: [PATCH 075/109] fix(typings): completed the type definition of the HeaderDropdown component (#3694) --- src/components/HeaderDropdown/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/HeaderDropdown/index.d.ts b/src/components/HeaderDropdown/index.d.ts index e9dac7e5..43fa9aba 100644 --- a/src/components/HeaderDropdown/index.d.ts +++ b/src/components/HeaderDropdown/index.d.ts @@ -1,2 +1,8 @@ import * as React from 'react'; -export default class HeaderDropdown extends React.Component {} +import { DropDownProps } from 'antd/lib/dropdown'; + +export interface IHeaderDropdownProps extends DropDownProps { + overlayClassName?: string; +} + +export default class HeaderDropdown extends React.Component {} From ac993ae1d6e9cf4ba041786bdaacc4c275b80590 Mon Sep 17 00:00:00 2001 From: luker <714837275@qq.com> Date: Fri, 15 Mar 2019 11:07:17 +0800 Subject: [PATCH 076/109] =?UTF-8?q?render=20=E6=96=B9=E6=B3=95=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=20=E9=9C=80=E8=A6=81=E6=9C=89return=20=E5=9C=A8Tutori?= =?UTF-8?q?al=20=E6=96=87=E6=A1=A3=E4=B8=AD=20=E7=9A=8419=E8=A1=8C?= =?UTF-8?q?=E6=9C=89=E9=81=97=E6=BC=8F,=20=E8=A1=A5=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Authorized/demo/secured.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Authorized/demo/secured.md b/src/components/Authorized/demo/secured.md index 1e9537af..c030300e 100644 --- a/src/components/Authorized/demo/secured.md +++ b/src/components/Authorized/demo/secured.md @@ -16,7 +16,9 @@ const { Secured } = RenderAuthorized('user'); @Secured('admin') class TestSecuredString extends React.Component { render() { - ; + return ( + ; + ) } } ReactDOM.render( From bffa6379848f72bcae6d00666cf78c4973846582 Mon Sep 17 00:00:00 2001 From: yaphet Date: Sun, 17 Mar 2019 07:44:16 +0800 Subject: [PATCH 077/109] Fix bug (#3749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将./src/defaultSettings.js中pwa设置false时,‘umi-plugin-react’中pwa配置项的值应该是false;使用空对象{}依旧会开启 PWA 相关功能。 --- config/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.js b/config/config.js index 9317a5b3..934569dc 100644 --- a/config/config.js +++ b/config/config.js @@ -33,7 +33,7 @@ const plugins = [ importWorkboxFrom: 'local', }, } - : {}, + : false, ...(!TEST && os.platform() === 'darwin' ? { dll: { From 56a8b716141e5a5baf8cedbd6139971792f8f461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?chencheng=20=28=E4=BA=91=E8=B0=A6=29?= Date: Mon, 18 Mar 2019 21:41:25 +0800 Subject: [PATCH 078/109] fix: react-router-dom's Consumer problem (#3787) --- package.json | 3 +-- src/components/Authorized/AuthorizedRoute.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0d6c8232..3072b9a0 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "react-dom": "^16.7.0", "react-fittext": "^1.0.0", "react-media": "^1.9.2", - "react-router-dom": "^4.3.1" + "umi": "^2.4.4" }, "devDependencies": { "@types/react": "^16.8.1", @@ -99,7 +99,6 @@ "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", - "umi": "^2.4.4", "umi-plugin-ga": "^1.1.3", "umi-plugin-react": "^1.4.2" }, diff --git a/src/components/Authorized/AuthorizedRoute.js b/src/components/Authorized/AuthorizedRoute.js index 39c6a665..a622ed38 100644 --- a/src/components/Authorized/AuthorizedRoute.js +++ b/src/components/Authorized/AuthorizedRoute.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Route, Redirect } from 'react-router-dom'; +import { Route, Redirect } from 'umi'; import Authorized from './Authorized'; // TODO: umi只会返回render和rest From 63e632eeda18ea2a81d2227c846f2ce37b76ce92 Mon Sep 17 00:00:00 2001 From: chen shuai Date: Mon, 18 Mar 2019 23:11:34 +0800 Subject: [PATCH 079/109] fix: add login 404, fix #3741 --- config/router.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/router.config.js b/config/router.config.js index 0f54cc05..c961c7b6 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -12,6 +12,9 @@ export default [ name: 'register.result', component: './User/RegisterResult', }, + { + component: '404', + }, ], }, // app From 8b8712196a90e4fda36cae603622dfd7c58ce744 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Fri, 22 Mar 2019 12:18:43 +0800 Subject: [PATCH 080/109] Update eslint-plugin-compat to version 3.0.1 (#3770) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3072b9a0..7966b0fc 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.0.0", "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-compat": "^2.6.3", + "eslint-plugin-compat": "^3.0.1", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.0", "eslint-plugin-markdown": "^1.0.0", From 2a70fe0d2a208cc54e6dd658e0558b568c58c7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 22 Mar 2019 12:19:26 +0800 Subject: [PATCH 081/109] Cancel default permissions (#3693) --- config/router.config.js | 2 +- src/layouts/BasicLayout.js | 4 ++-- src/models/menu.js | 4 ++-- src/pages/Authorized.js | 1 + src/utils/authority.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index c961c7b6..2698abc9 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -24,7 +24,7 @@ export default [ Routes: ['src/pages/Authorized'], routes: [ // dashboard - { path: '/', redirect: '/dashboard/analysis' }, + { path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] }, { path: '/dashboard', name: 'dashboard', diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 06cc41fc..1aa231d4 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -48,7 +48,7 @@ class BasicLayout extends React.Component { componentDidMount() { const { dispatch, - route: { routes, authority }, + route: { routes, path, authority }, } = this.props; dispatch({ type: 'user/fetchCurrent', @@ -58,7 +58,7 @@ class BasicLayout extends React.Component { }); dispatch({ type: 'menu/getMenuData', - payload: { routes, authority }, + payload: { routes, path, authority }, }); } diff --git a/src/models/menu.js b/src/models/menu.js index 2e803f06..d9a9d2b1 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -109,8 +109,8 @@ export default { effects: { *getMenuData({ payload }, { put }) { - const { routes, authority } = payload; - const originalMenuData = memoizeOneFormatter(routes, authority); + const { routes, authority, path } = payload; + const originalMenuData = memoizeOneFormatter(routes, authority, path); const menuData = filterMenuData(originalMenuData); const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(originalMenuData); yield put({ diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index 960f2c6b..e2c92e89 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -21,6 +21,7 @@ function AuthComponent({ children, location, routerData, status }) { }); return authorities; }; + return ( Date: Fri, 22 Mar 2019 12:19:57 +0800 Subject: [PATCH 082/109] =?UTF-8?q?fix:=E8=A1=A5=E5=85=A8PageHeader?= =?UTF-8?q?=E7=BB=84=E4=BB=B6d.ts=E5=AE=9A=E4=B9=89=20(#3662)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:补全PageHeader组件d.ts定义 * add itemRender * prettier add history --- package.json | 1 + src/components/PageHeader/index.d.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package.json b/package.json index 7966b0fc..3990b358 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "umi": "^2.4.4" }, "devDependencies": { + "@types/history": "^4.7.2", "@types/react": "^16.8.1", "@types/react-dom": "^16.0.11", "antd-pro-merge-less": "^1.0.0", diff --git a/src/components/PageHeader/index.d.ts b/src/components/PageHeader/index.d.ts index eacbb2de..e3e1f321 100644 --- a/src/components/PageHeader/index.d.ts +++ b/src/components/PageHeader/index.d.ts @@ -1,4 +1,6 @@ +/// import * as React from 'react'; +import { Location } from 'history'; export interface IPageHeaderProps { title?: React.ReactNode | string; logo?: React.ReactNode | string; @@ -18,6 +20,9 @@ export interface IPageHeaderProps { home?: React.ReactNode; wide?: boolean; hiddenBreadcrumb?: boolean; + location?: Location; + itemRender: (menuItem: any) => React.ReactNode; + breadcrumbNameMap?: any; } export default class PageHeader extends React.Component {} From 7b84fe60e6fef8f224495f3c397baee4c74a7306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mesut=20Pi=C5=9Fkin?= Date: Fri, 22 Mar 2019 07:23:19 +0300 Subject: [PATCH 083/109] Turkish language (#3306) * turkish readme * typo fix --- README.md | 2 +- README.ru-RU.md | 2 +- README.tr-TR.md | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ README.zh-CN.md | 2 +- 4 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 README.tr-TR.md diff --git a/README.md b/README.md index ce0725df..06029c2e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) +English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md)

Ant Design Pro

diff --git a/README.ru-RU.md b/README.ru-RU.md index 22d16c9a..9ebefff6 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -1,4 +1,4 @@ -[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский +[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский | [Türkçe](./README.tr-TR.md)

Ant Design Pro

diff --git a/README.tr-TR.md b/README.tr-TR.md new file mode 100644 index 00000000..8d894293 --- /dev/null +++ b/README.tr-TR.md @@ -0,0 +1,131 @@ +[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | Türkçe + +

Ant Design Pro

+ +
+ +React ile kurumsal uygulamalar için taslak olarak geliştirilmiş kullanıma hazır bir UI çözümü. + +[![CircleCI Status](https://circleci.com/gh/ant-design/ant-design-pro.svg?style=svg)](https://circleci.com/gh/ant-design/ant-design-pro/) +[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) +[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) +[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇺🇸) +[![Gitter](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇨🇳) + + +![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) + +
+ +- Önizleme: http://preview.pro.ant.design +- Anasayfa: http://pro.ant.design +- Dokümantasyon: http://pro.ant.design/docs/getting-started +- ChangeLog: http://pro.ant.design/docs/changelog +- SSS: http://pro.ant.design/docs/faq +- Çinde barındırılan site: http://ant-design-pro.gitee.io + +## 2.0 Versiyonu Şimdi Yayında! 🎉🎉🎉 +[Announcing Ant Design Pro 2.0.0](https://medium.com/ant-design/beautiful-and-powerful-ant-design-pro-2-0-release-51358da5af95) + +## Çeviri Desteği :loudspeaker: + +Çeviriler için yardımınıza ihtiyacımız var: https://github.com/ant-design/ant-design-pro/issues/120 + +## Özellikler + +- :gem: **Zarif Tasarım**: Buradan [Ant Design özellikleri](http://ant.design/) +- :triangular_ruler: **Ortak Şablonlar**: Kurumsal uygulamalar için şablonlar +- :rocket: **Sanatsal gelişim durumu**: Newest development stack of React/umi/dva/antd +- :iphone: **Responsive**: Değişken ekran boyutları için tasarlanmıştır +- :art: **Tema Kullanımı**: Basit ayarlar ile özelleştirilebilir tema +- :globe_with_meridians: **Uluslararası**: Built-in i18n solution +- :gear: **Best Practices**: İyi kod için sağlam iş akışı +- :1234: **Mock Geliştirme**: Model(Mock) geliştirmeler için kolay çözüm +- :white_check_mark: **UI Testi**: Unit ve e2e testleri ile güvenli sürdürülebilirlik + +## Şablonlar + +``` +- Dashboard + - Analitik + - Monitör + - Çalışma alanı +- Form + - Basit Form + - Step Form + - Gelişmiş Form +- List + - Standard Tablo + - Standard Liste + - Kart Liste + - Arama Listesi (Project/Applications/Article) +- Profil + - Basit Profil + - Gelişmiş Profil +- Hesap + - Hesap Yönetimi + - Hesap Ayarları +- Sonuç + - Başarılı + - Hatalı +- Hatalar + - 403 + - 404 + - 500 +- Kullanıcı + - Giriş + - Kayıt + - Kayıt Sonucu +``` + +## Kullanım + +### bash ile kullanım + +```bash +$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1 +$ cd ant-design-pro +$ npm install +$ npm start # visit http://localhost:8000 +``` + +### Docker ile kullanım + +```bash +# preview +$ docker pull chenshuai2144/ant-design-pro +$ docker run -p 80:80 chenshuai2144/ant-design-pro +# open http://localhost + +# dev +$ npm run docker:dev + +# build +$ npm run docker:build + + +# production dev +$ npm run docker-prod:dev + +# production build +$ npm run docker-prod:build +``` + +Daha fazla talimat için [dokümantasyon](http://pro.ant.design/docs/getting-started) sayfasına göz atın. + +## Tarayıcı desteği + +Modern internet tarayıcıları ve IE11. + +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | +| --------- | --------- | --------- | --------- | --------- | +| IE11, Edge| son 2 versiyon | son 2 versiyon | son 2 versiyon | son 2 versiyon + +## Destek + +Her türlü desteğinize açığız, bu projeye nasıl katkıda bulunabileceğinize dair bazı örnekler: + +- Günlük işinizde Ant Design Pro kullanın. +- Hataları bildirmek veya soru sormak için [issues](http://github.com/ant-design/ant-design-pro/issues) gönderin. +- kodumuzu geliştirmek için [pull requests](http://github.com/ant-design/ant-design-pro/pulls) gönderin. diff --git a/README.zh-CN.md b/README.zh-CN.md index 6b150506..a4186f30 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,4 +1,4 @@ -[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) +[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md)

Ant Design Pro

From 19780739298bb36302361f75538036143a11c876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=8A=9B?= <3071730@qq.com> Date: Fri, 22 Mar 2019 12:25:58 +0800 Subject: [PATCH 084/109] feat: Add the `GGEditor` demo (#3810) * feat: Add the `GGEditor` demo * style: Update the size of the card * feat: Extract the `MenuItem` and `ToolbarButton` components * feat: Add the shape type of the line * feat: Extract the `DetailForm` components * feat: add PageHeader * fix: add all local laug * fix: Fix the height of the editor --- config/router.config.js | 23 ++++ package.json | 1 + public/ggeditor/flow/decision.svg | 29 ++++ public/ggeditor/flow/model.svg | 29 ++++ public/ggeditor/flow/normal.svg | 29 ++++ public/ggeditor/flow/start.svg | 29 ++++ public/ggeditor/koni/bank.svg | 29 ++++ public/ggeditor/koni/country.svg | 29 ++++ public/ggeditor/koni/icon.svg | 14 ++ public/ggeditor/koni/person.svg | 29 ++++ src/locales/en-US.js | 2 + src/locales/en-US/editor.js | 11 ++ src/locales/en-US/menu.js | 4 + src/locales/pt-BR.js | 2 + src/locales/pt-BR/editor.js | 11 ++ src/locales/pt-BR/menu.js | 4 + src/locales/zh-CN.js | 2 + src/locales/zh-CN/editor.js | 9 ++ src/locales/zh-CN/menu.js | 4 + src/locales/zh-TW.js | 2 + src/locales/zh-TW/editor.js | 9 ++ src/locales/zh-TW/menu.js | 4 + src/pages/Editor/GGEditor/Flow/index.js | 43 ++++++ src/pages/Editor/GGEditor/Flow/index.less | 41 ++++++ src/pages/Editor/GGEditor/Koni/index.js | 45 ++++++ .../Koni/shape/nodes/KoniCustomNode.js | 33 +++++ src/pages/Editor/GGEditor/Mind/index.js | 40 ++++++ .../Editor/GGEditor/common/IconFont/index.js | 7 + .../EditorContextMenu/FlowContextMenu.js | 36 +++++ .../EditorContextMenu/KoniContextMenu.js | 3 + .../components/EditorContextMenu/MenuItem.js | 20 +++ .../EditorContextMenu/MindContextMenu.js | 24 ++++ .../components/EditorContextMenu/index.js | 5 + .../components/EditorContextMenu/index.less | 39 ++++++ .../EditorDetailPanel/DetailForm.js | 129 ++++++++++++++++++ .../EditorDetailPanel/FlowDetailPanel.js | 29 ++++ .../EditorDetailPanel/KoniDetailPanel.js | 3 + .../EditorDetailPanel/MindDetailPanel.js | 20 +++ .../components/EditorDetailPanel/index.js | 5 + .../components/EditorDetailPanel/index.less | 10 ++ .../EditorItemPanel/FlowItemPanel.js | 55 ++++++++ .../EditorItemPanel/KoniItemPanel.js | 51 +++++++ .../components/EditorItemPanel/index.js | 4 + .../components/EditorItemPanel/index.less | 20 +++ .../components/EditorMinimap/index.js | 13 ++ .../components/EditorToolbar/FlowToolbar.js | 32 +++++ .../components/EditorToolbar/KoniToolbar.js | 3 + .../components/EditorToolbar/MindToolbar.js | 27 ++++ .../components/EditorToolbar/ToolbarButton.js | 24 ++++ .../components/EditorToolbar/index.js | 5 + .../components/EditorToolbar/index.less | 39 ++++++ .../Editor/GGEditor/mock/worldCup2018.json | 129 ++++++++++++++++++ 52 files changed, 1239 insertions(+) create mode 100644 public/ggeditor/flow/decision.svg create mode 100644 public/ggeditor/flow/model.svg create mode 100644 public/ggeditor/flow/normal.svg create mode 100644 public/ggeditor/flow/start.svg create mode 100644 public/ggeditor/koni/bank.svg create mode 100644 public/ggeditor/koni/country.svg create mode 100644 public/ggeditor/koni/icon.svg create mode 100644 public/ggeditor/koni/person.svg create mode 100644 src/locales/en-US/editor.js create mode 100644 src/locales/pt-BR/editor.js create mode 100644 src/locales/zh-CN/editor.js create mode 100644 src/locales/zh-TW/editor.js create mode 100644 src/pages/Editor/GGEditor/Flow/index.js create mode 100644 src/pages/Editor/GGEditor/Flow/index.less create mode 100644 src/pages/Editor/GGEditor/Koni/index.js create mode 100644 src/pages/Editor/GGEditor/Koni/shape/nodes/KoniCustomNode.js create mode 100644 src/pages/Editor/GGEditor/Mind/index.js create mode 100644 src/pages/Editor/GGEditor/common/IconFont/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/FlowContextMenu.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/KoniContextMenu.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/MenuItem.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/MindContextMenu.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorContextMenu/index.less create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/DetailForm.js create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/FlowDetailPanel.js create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/KoniDetailPanel.js create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/MindDetailPanel.js create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorDetailPanel/index.less create mode 100644 src/pages/Editor/GGEditor/components/EditorItemPanel/FlowItemPanel.js create mode 100644 src/pages/Editor/GGEditor/components/EditorItemPanel/KoniItemPanel.js create mode 100644 src/pages/Editor/GGEditor/components/EditorItemPanel/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorItemPanel/index.less create mode 100644 src/pages/Editor/GGEditor/components/EditorMinimap/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/FlowToolbar.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/KoniToolbar.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/MindToolbar.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/ToolbarButton.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/index.js create mode 100644 src/pages/Editor/GGEditor/components/EditorToolbar/index.less create mode 100644 src/pages/Editor/GGEditor/mock/worldCup2018.json diff --git a/config/router.config.js b/config/router.config.js index 2698abc9..32e8172c 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -93,6 +93,29 @@ export default [ }, ], }, + // editor + { + name: 'editor', + icon: 'highlight', + path: '/editor', + routes: [ + { + path: '/editor/flow', + name: 'flow', + component: './Editor/GGEditor/Flow', + }, + { + path: '/editor/mind', + name: 'mind', + component: './Editor/GGEditor/Mind', + }, + { + path: '/editor/koni', + name: 'koni', + component: './Editor/GGEditor/Koni', + }, + ], + }, // list { path: '/list', diff --git a/package.json b/package.json index 3990b358..7bc019c3 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "classnames": "^2.2.6", "dva": "^2.4.1", "enquire-js": "^0.2.1", + "gg-editor": "^2.0.2", "hash.js": "^1.1.7", "lodash": "^4.17.11", "lodash-decorators": "^6.0.1", diff --git a/public/ggeditor/flow/decision.svg b/public/ggeditor/flow/decision.svg new file mode 100644 index 00000000..7af317ce --- /dev/null +++ b/public/ggeditor/flow/decision.svg @@ -0,0 +1,29 @@ + + + + Group 3 + Created with Sketch. + + + + + + + + + + + + + + + + + + + Decision + + + + + \ No newline at end of file diff --git a/public/ggeditor/flow/model.svg b/public/ggeditor/flow/model.svg new file mode 100644 index 00000000..3fd8afaa --- /dev/null +++ b/public/ggeditor/flow/model.svg @@ -0,0 +1,29 @@ + + + + Group 4 + Created with Sketch. + + + + + + + + + + + + + + + + + + + Model + + + + + \ No newline at end of file diff --git a/public/ggeditor/flow/normal.svg b/public/ggeditor/flow/normal.svg new file mode 100644 index 00000000..53791e9f --- /dev/null +++ b/public/ggeditor/flow/normal.svg @@ -0,0 +1,29 @@ + + + + Group + Created with Sketch. + + + + + + + + + + + + + + + + + + + Normal + + + + + \ No newline at end of file diff --git a/public/ggeditor/flow/start.svg b/public/ggeditor/flow/start.svg new file mode 100644 index 00000000..3ab4c3cb --- /dev/null +++ b/public/ggeditor/flow/start.svg @@ -0,0 +1,29 @@ + + + + Group 2 + Created with Sketch. + + + + + + + + + + + + + + + + + + + Start + + + + + \ No newline at end of file diff --git a/public/ggeditor/koni/bank.svg b/public/ggeditor/koni/bank.svg new file mode 100644 index 00000000..7ec11643 --- /dev/null +++ b/public/ggeditor/koni/bank.svg @@ -0,0 +1,29 @@ + + + + Group 16 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/ggeditor/koni/country.svg b/public/ggeditor/koni/country.svg new file mode 100644 index 00000000..eeb861a7 --- /dev/null +++ b/public/ggeditor/koni/country.svg @@ -0,0 +1,29 @@ + + + + Group 18 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/ggeditor/koni/icon.svg b/public/ggeditor/koni/icon.svg new file mode 100644 index 00000000..0c3eba65 --- /dev/null +++ b/public/ggeditor/koni/icon.svg @@ -0,0 +1,14 @@ + + + + earth copy 53 + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/public/ggeditor/koni/person.svg b/public/ggeditor/koni/person.svg new file mode 100644 index 00000000..c9dcad00 --- /dev/null +++ b/public/ggeditor/koni/person.svg @@ -0,0 +1,29 @@ + + + + Group 17 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 25f2888c..a10691ce 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -10,6 +10,7 @@ import settingDrawer from './en-US/settingDrawer'; import settings from './en-US/settings'; import pwa from './en-US/pwa'; import component from './en-US/component'; +import editor from './en-US/editor'; export default { 'navBar.lang': 'Languages', @@ -32,4 +33,5 @@ export default { ...settings, ...pwa, ...component, + ...editor, }; diff --git a/src/locales/en-US/editor.js b/src/locales/en-US/editor.js new file mode 100644 index 00000000..81bd0f17 --- /dev/null +++ b/src/locales/en-US/editor.js @@ -0,0 +1,11 @@ +export default { + 'app.editor.flow.title': 'Flowchart Editor', + 'app.editor.flow.description': + 'The flow chart is an excellent way to represent the idea of the algorithm.', + 'app.editor.koni.title': 'Koni Editor', + 'app.editor.koni.description': + 'The topology diagram refers to the network structure diagram composed of network node devices and communication media.', + 'app.editor.mind.title': 'Mind Map Editor', + 'app.editor.mind.description': + 'The brain map is an effective graphical thinking tool for expressing divergent thinking. It is simple but effective and is a practical thinking tool.', +}; diff --git a/src/locales/en-US/menu.js b/src/locales/en-US/menu.js index 056c255e..1d673466 100644 --- a/src/locales/en-US/menu.js +++ b/src/locales/en-US/menu.js @@ -38,4 +38,8 @@ export default { 'menu.account.settings': 'Account Settings', 'menu.account.trigger': 'Trigger Error', 'menu.account.logout': 'Logout', + 'menu.editor': 'Editor', + 'menu.editor.flow': 'Flow Editor', + 'menu.editor.mind': 'Mind Editor', + 'menu.editor.koni': 'Koni Editor', }; diff --git a/src/locales/pt-BR.js b/src/locales/pt-BR.js index af8bcee5..19e82643 100644 --- a/src/locales/pt-BR.js +++ b/src/locales/pt-BR.js @@ -10,6 +10,7 @@ import settingDrawer from './pt-BR/settingDrawer'; import settings from './pt-BR/settings'; import pwa from './pt-BR/pwa'; import component from './pt-BR/component'; +import editor from './pt-BR/editor'; export default { 'navBar.lang': 'Idiomas', @@ -32,4 +33,5 @@ export default { ...settings, ...pwa, ...component, + ...editor, }; diff --git a/src/locales/pt-BR/editor.js b/src/locales/pt-BR/editor.js new file mode 100644 index 00000000..10237f9b --- /dev/null +++ b/src/locales/pt-BR/editor.js @@ -0,0 +1,11 @@ +export default { + 'app.editor.flow.title': 'Editor de diagrama de flujo', + 'app.editor.flow.description': + 'El diagrama de flujo es una excelente manera de representar la idea del algoritmo.', + 'app.editor.koni.title': 'Editor de topologia', + 'app.editor.koni.description': + 'El diagrama de topología se refiere al diagrama de estructura de red compuesto por dispositivos de nodo de red y medios de comunicación.', + 'app.editor.mind.title': 'Editor de mapas cerebrales', + 'app.editor.mind.description': + 'El mapa cerebral es una herramienta de pensamiento gráfico eficaz para expresar el pensamiento divergente. Es simple pero efectivo y es una herramienta de pensamiento práctico.', +}; diff --git a/src/locales/pt-BR/menu.js b/src/locales/pt-BR/menu.js index 77ee7fd7..ee82fb1e 100644 --- a/src/locales/pt-BR/menu.js +++ b/src/locales/pt-BR/menu.js @@ -38,4 +38,8 @@ export default { 'menu.account.settings': 'Configurar Conta', 'menu.account.trigger': 'Disparar Erro', 'menu.account.logout': 'Sair', + 'menu.editor': 'Editor', + 'menu.editor.flow': 'Flow Editor', + 'menu.editor.mind': 'Mind Editor', + 'menu.editor.koni': 'Koni Editor', }; diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index cf601f37..6cc85e4b 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -10,6 +10,7 @@ import settingDrawer from './zh-CN/settingDrawer'; import settings from './zh-CN/settings'; import pwa from './zh-CN/pwa'; import component from './zh-CN/component'; +import editor from './zh-CN/editor'; export default { 'navBar.lang': '语言', @@ -32,4 +33,5 @@ export default { ...settings, ...pwa, ...component, + ...editor, }; diff --git a/src/locales/zh-CN/editor.js b/src/locales/zh-CN/editor.js new file mode 100644 index 00000000..1688644e --- /dev/null +++ b/src/locales/zh-CN/editor.js @@ -0,0 +1,9 @@ +export default { + 'app.editor.flow.title': '流程图编辑器', + 'app.editor.flow.description': '千言万语不如一张图,流程图是表示算法思路的好方法', + 'app.editor.koni.title': '拓扑编辑器', + 'app.editor.koni.description': '拓扑结构图是指由网络节点设备和通信介质构成的网络结构图', + 'app.editor.mind.title': '脑图编辑器', + 'app.editor.mind.description': + '脑图是表达发散性思维的有效图形思维工具 ,它简单却又很有效,是一种实用性的思维工具。', +}; diff --git a/src/locales/zh-CN/menu.js b/src/locales/zh-CN/menu.js index 5657c6e0..0fb0069e 100644 --- a/src/locales/zh-CN/menu.js +++ b/src/locales/zh-CN/menu.js @@ -38,4 +38,8 @@ export default { 'menu.account.settings': '个人设置', 'menu.account.trigger': '触发报错', 'menu.account.logout': '退出登录', + 'menu.editor': '编辑页', + 'menu.editor.flow': '流程编辑器', + 'menu.editor.mind': '脑图编辑器', + 'menu.editor.koni': '拓扑编辑器', }; diff --git a/src/locales/zh-TW.js b/src/locales/zh-TW.js index c6217339..33351509 100644 --- a/src/locales/zh-TW.js +++ b/src/locales/zh-TW.js @@ -10,6 +10,7 @@ import settingDrawer from './zh-TW/settingDrawer'; import settings from './zh-TW/settings'; import pwa from './zh-TW/pwa'; import component from './zh-TW/component'; +import editor from './zh-TW/editor'; export default { 'navBar.lang': '語言', @@ -32,4 +33,5 @@ export default { ...settings, ...pwa, ...component, + ...editor, }; diff --git a/src/locales/zh-TW/editor.js b/src/locales/zh-TW/editor.js new file mode 100644 index 00000000..d1d13774 --- /dev/null +++ b/src/locales/zh-TW/editor.js @@ -0,0 +1,9 @@ +export default { + 'app.editor.flow.title': '流程圖編輯器', + 'app.editor.flow.description': '千言萬語不如一張圖,流程圖是表示算法思路的好方法', + 'app.editor.koni.title': '拓撲編輯器', + 'app.editor.koni.description': '拓撲結構圖是指由網絡節點設備和通信介質構成的網絡結構圖', + 'app.editor.mind.title': '腦圖編輯器', + 'app.editor.mind.description': + '腦圖是表達發散性思維的有效圖形思維工具 ,它簡單卻又很有效,是一種實用性的思維工具', +}; diff --git a/src/locales/zh-TW/menu.js b/src/locales/zh-TW/menu.js index 7bd71a7a..2cf5f9da 100644 --- a/src/locales/zh-TW/menu.js +++ b/src/locales/zh-TW/menu.js @@ -38,4 +38,8 @@ export default { 'menu.exception.not-find': '404', 'menu.exception.server-error': '500', 'menu.exception.trigger': '触发错误', + 'menu.editor': '編輯頁', + 'menu.editor.flow': '流程編輯器', + 'menu.editor.mind': '腦圖編輯器', + 'menu.editor.koni': '拓撲編輯器', }; diff --git a/src/pages/Editor/GGEditor/Flow/index.js b/src/pages/Editor/GGEditor/Flow/index.js new file mode 100644 index 00000000..6acac054 --- /dev/null +++ b/src/pages/Editor/GGEditor/Flow/index.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Flow } from 'gg-editor'; +import EditorMinimap from '../components/EditorMinimap'; +import { FlowContextMenu } from '../components/EditorContextMenu'; +import { FlowToolbar } from '../components/EditorToolbar'; +import { FlowItemPanel } from '../components/EditorItemPanel'; +import { FlowDetailPanel } from '../components/EditorDetailPanel'; +import styles from './index.less'; +import { FormattedMessage } from 'umi/locale'; +import PageHeaderWrapper from '@/components/PageHeaderWrapper'; + +const FlowPage = () => { + return ( + } + content={} + > + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowPage; diff --git a/src/pages/Editor/GGEditor/Flow/index.less b/src/pages/Editor/GGEditor/Flow/index.less new file mode 100644 index 00000000..aeffa829 --- /dev/null +++ b/src/pages/Editor/GGEditor/Flow/index.less @@ -0,0 +1,41 @@ +.editor { + display: flex; + flex: 1; + flex-direction: column; + width: 100%; + height: calc(100vh - 250px); + background: #fff; +} + +.editorHd { + padding: 8px; + border: 1px solid #e6e9ed; +} + +.editorBd { + flex: 1; +} + +.editorSidebar, +.editorContent { + display: flex; + flex-direction: column; +} + +.editorSidebar { + background: #fafafa; + + &:first-child { + border-right: 1px solid #e6e9ed; + } + + &:last-child { + border-left: 1px solid #e6e9ed; + } +} + +.flow, +.mind, +.koni { + flex: 1; +} diff --git a/src/pages/Editor/GGEditor/Koni/index.js b/src/pages/Editor/GGEditor/Koni/index.js new file mode 100644 index 00000000..5b46dfac --- /dev/null +++ b/src/pages/Editor/GGEditor/Koni/index.js @@ -0,0 +1,45 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Koni } from 'gg-editor'; +import EditorMinimap from '../components/EditorMinimap'; +import { KoniContextMenu } from '../components/EditorContextMenu'; +import { KoniToolbar } from '../components/EditorToolbar'; +import { KoniItemPanel } from '../components/EditorItemPanel'; +import { KoniDetailPanel } from '../components/EditorDetailPanel'; +import KoniCustomNode from './shape/nodes/KoniCustomNode'; +import styles from '../Flow/index.less'; +import { FormattedMessage } from 'umi/locale'; +import PageHeaderWrapper from '@/components/PageHeaderWrapper'; + +const KoniPage = () => { + return ( + } + content={} + > + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default KoniPage; diff --git a/src/pages/Editor/GGEditor/Koni/shape/nodes/KoniCustomNode.js b/src/pages/Editor/GGEditor/Koni/shape/nodes/KoniCustomNode.js new file mode 100644 index 00000000..4c13bb4f --- /dev/null +++ b/src/pages/Editor/GGEditor/Koni/shape/nodes/KoniCustomNode.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { RegisterNode } from 'gg-editor'; + +class KoniCustomNode extends React.Component { + render() { + const config = { + draw(item) { + const keyShape = this.drawKeyShape(item); + + // draw label + this.drawLabel(item); + + // draw image + const group = item.getGraphicGroup(); + const model = item.getModel(); + + group.addShape('image', { + attrs: { + x: -7, + y: -7, + img: model.icon, + }, + }); + + return keyShape; + }, + }; + + return ; + } +} + +export default KoniCustomNode; diff --git a/src/pages/Editor/GGEditor/Mind/index.js b/src/pages/Editor/GGEditor/Mind/index.js new file mode 100644 index 00000000..f33812d4 --- /dev/null +++ b/src/pages/Editor/GGEditor/Mind/index.js @@ -0,0 +1,40 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Mind } from 'gg-editor'; +import EditorMinimap from '../components/EditorMinimap'; +import { MindContextMenu } from '../components/EditorContextMenu'; +import { MindToolbar } from '../components/EditorToolbar'; +import { MindDetailPanel } from '../components/EditorDetailPanel'; +import data from '../mock/worldCup2018.json'; +import styles from '../Flow/index.less'; +import { FormattedMessage } from 'umi/locale'; +import PageHeaderWrapper from '@/components/PageHeaderWrapper'; + +const MindPage = () => { + return ( + } + content={} + > + + + + + + + + + + + + + + + + + + + ); +}; + +export default MindPage; diff --git a/src/pages/Editor/GGEditor/common/IconFont/index.js b/src/pages/Editor/GGEditor/common/IconFont/index.js new file mode 100644 index 00000000..3bba8d2e --- /dev/null +++ b/src/pages/Editor/GGEditor/common/IconFont/index.js @@ -0,0 +1,7 @@ +import { Icon } from 'antd'; + +const IconFont = Icon.createFromIconfontCN({ + scriptUrl: 'https://at.alicdn.com/t/font_1101588_01zniftxm9yp.js', +}); + +export default IconFont; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/FlowContextMenu.js b/src/pages/Editor/GGEditor/components/EditorContextMenu/FlowContextMenu.js new file mode 100644 index 00000000..cbb7041f --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/FlowContextMenu.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { NodeMenu, EdgeMenu, GroupMenu, MultiMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const FlowContextMenu = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowContextMenu; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/KoniContextMenu.js b/src/pages/Editor/GGEditor/components/EditorContextMenu/KoniContextMenu.js new file mode 100644 index 00000000..8b049a5e --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/KoniContextMenu.js @@ -0,0 +1,3 @@ +import FlowContextMenu from './FlowContextMenu'; + +export default FlowContextMenu; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/MenuItem.js b/src/pages/Editor/GGEditor/components/EditorContextMenu/MenuItem.js new file mode 100644 index 00000000..4cbde89e --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/MenuItem.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const MenuItem = props => { + const { command, icon, text } = props; + + return ( + +
+ + {text || upperFirst(command)} +
+
+ ); +}; + +export default MenuItem; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/MindContextMenu.js b/src/pages/Editor/GGEditor/components/EditorContextMenu/MindContextMenu.js new file mode 100644 index 00000000..2a9d43cd --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/MindContextMenu.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { NodeMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const MindContextMenu = () => { + return ( + + + + + + + + + + + + + + ); +}; + +export default MindContextMenu; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/index.js b/src/pages/Editor/GGEditor/components/EditorContextMenu/index.js new file mode 100644 index 00000000..16fcde01 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/index.js @@ -0,0 +1,5 @@ +import FlowContextMenu from './FlowContextMenu'; +import MindContextMenu from './MindContextMenu'; +import KoniContextMenu from './KoniContextMenu'; + +export { FlowContextMenu, MindContextMenu, KoniContextMenu }; diff --git a/src/pages/Editor/GGEditor/components/EditorContextMenu/index.less b/src/pages/Editor/GGEditor/components/EditorContextMenu/index.less new file mode 100644 index 00000000..8a2cdae3 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorContextMenu/index.less @@ -0,0 +1,39 @@ +.contextMenu { + display: none; + overflow: hidden; + background: #fff; + border-radius: 4px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + + .item { + display: flex; + align-items: center; + padding: 5px 12px; + cursor: pointer; + transition: all 0.3s; + user-select: none; + + &:hover { + background: #e6f7ff; + } + + i { + margin-right: 8px; + } + } + + :global { + .disable { + :local { + .item { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + background: #fff; + } + } + } + } + } +} diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/DetailForm.js b/src/pages/Editor/GGEditor/components/EditorDetailPanel/DetailForm.js new file mode 100644 index 00000000..3d680115 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/DetailForm.js @@ -0,0 +1,129 @@ +import React, { Fragment } from 'react'; +import { Card, Form, Input, Select } from 'antd'; +import { withPropsAPI } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; + +const { Item } = Form; +const { Option } = Select; + +const inlineFormItemLayout = { + labelCol: { + sm: { span: 8 }, + }, + wrapperCol: { + sm: { span: 16 }, + }, +}; + +class DetailForm extends React.Component { + get item() { + const { propsAPI } = this.props; + + return propsAPI.getSelected()[0]; + } + + handleSubmit = e => { + if (e && e.preventDefault) { + e.preventDefault(); + } + + const { form, propsAPI } = this.props; + const { getSelected, executeCommand, update } = propsAPI; + + setTimeout(() => { + form.validateFieldsAndScroll((err, values) => { + if (err) { + return; + } + + const item = getSelected()[0]; + + if (!item) { + return; + } + + executeCommand(() => { + update(item, { + ...values, + }); + }); + }); + }, 0); + }; + + renderEdgeShapeSelect = () => { + return ( + + ); + }; + + renderNodeDetail = () => { + const { form } = this.props; + const { label } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + renderEdgeDetail = () => { + const { form } = this.props; + const { label = '', shape = 'flow-smooth' } = this.item.getModel(); + + return ( + + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + + {form.getFieldDecorator('shape', { + initialValue: shape, + })(this.renderEdgeShapeSelect())} + + + ); + }; + + renderGroupDetail = () => { + const { form } = this.props; + const { label = '新建分组' } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + render() { + const { type } = this.props; + + if (!this.item) { + return null; + } + + return ( + +
+ {type === 'node' && this.renderNodeDetail()} + {type === 'edge' && this.renderEdgeDetail()} + {type === 'group' && this.renderGroupDetail()} +
+
+ ); + } +} + +export default Form.create()(withPropsAPI(DetailForm)); diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/FlowDetailPanel.js b/src/pages/Editor/GGEditor/components/EditorDetailPanel/FlowDetailPanel.js new file mode 100644 index 00000000..8d681618 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/FlowDetailPanel.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, EdgePanel, GroupPanel, MultiPanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const FlowDetailPanel = () => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowDetailPanel; diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/KoniDetailPanel.js b/src/pages/Editor/GGEditor/components/EditorDetailPanel/KoniDetailPanel.js new file mode 100644 index 00000000..18aea9a4 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/KoniDetailPanel.js @@ -0,0 +1,3 @@ +import FlowDetailPanel from './FlowDetailPanel'; + +export default FlowDetailPanel; diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/MindDetailPanel.js b/src/pages/Editor/GGEditor/components/EditorDetailPanel/MindDetailPanel.js new file mode 100644 index 00000000..6b4d5c9e --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/MindDetailPanel.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const MindDetailPanel = () => { + return ( + + + + + + + + + ); +}; + +export default MindDetailPanel; diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.js b/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.js new file mode 100644 index 00000000..8df063ef --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.js @@ -0,0 +1,5 @@ +import FlowDetailPanel from './FlowDetailPanel'; +import MindDetailPanel from './MindDetailPanel'; +import KoniDetailPanel from './KoniDetailPanel'; + +export { FlowDetailPanel, MindDetailPanel, KoniDetailPanel }; diff --git a/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.less b/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.less new file mode 100644 index 00000000..081945be --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorDetailPanel/index.less @@ -0,0 +1,10 @@ +.detailPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + } +} diff --git a/src/pages/Editor/GGEditor/components/EditorItemPanel/FlowItemPanel.js b/src/pages/Editor/GGEditor/components/EditorItemPanel/FlowItemPanel.js new file mode 100644 index 00000000..b3b46930 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorItemPanel/FlowItemPanel.js @@ -0,0 +1,55 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const FlowItemPanel = () => { + return ( + + + + + + + + + ); +}; + +export default FlowItemPanel; diff --git a/src/pages/Editor/GGEditor/components/EditorItemPanel/KoniItemPanel.js b/src/pages/Editor/GGEditor/components/EditorItemPanel/KoniItemPanel.js new file mode 100644 index 00000000..655ea99a --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorItemPanel/KoniItemPanel.js @@ -0,0 +1,51 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const KoniItemPanel = () => { + return ( + + + + + + + + ); +}; + +export default KoniItemPanel; diff --git a/src/pages/Editor/GGEditor/components/EditorItemPanel/index.js b/src/pages/Editor/GGEditor/components/EditorItemPanel/index.js new file mode 100644 index 00000000..2ba03fbb --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorItemPanel/index.js @@ -0,0 +1,4 @@ +import FlowItemPanel from './FlowItemPanel'; +import KoniItemPanel from './KoniItemPanel'; + +export { FlowItemPanel, KoniItemPanel }; diff --git a/src/pages/Editor/GGEditor/components/EditorItemPanel/index.less b/src/pages/Editor/GGEditor/components/EditorItemPanel/index.less new file mode 100644 index 00000000..a7acc366 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorItemPanel/index.less @@ -0,0 +1,20 @@ +.itemPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + + .ant-card-body { + display: flex; + flex-direction: column; + align-items: center; + + > div { + margin-bottom: 16px; + } + } + } +} diff --git a/src/pages/Editor/GGEditor/components/EditorMinimap/index.js b/src/pages/Editor/GGEditor/components/EditorMinimap/index.js new file mode 100644 index 00000000..8c86b242 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorMinimap/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Card } from 'antd'; +import { Minimap } from 'gg-editor'; + +const EditorMinimap = () => { + return ( + + + + ); +}; + +export default EditorMinimap; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/FlowToolbar.js b/src/pages/Editor/GGEditor/components/EditorToolbar/FlowToolbar.js new file mode 100644 index 00000000..374c1858 --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/FlowToolbar.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/KoniToolbar.js b/src/pages/Editor/GGEditor/components/EditorToolbar/KoniToolbar.js new file mode 100644 index 00000000..f222007a --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/KoniToolbar.js @@ -0,0 +1,3 @@ +import FlowToolbar from './FlowToolbar'; + +export default FlowToolbar; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/MindToolbar.js b/src/pages/Editor/GGEditor/components/EditorToolbar/MindToolbar.js new file mode 100644 index 00000000..1c83286a --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/MindToolbar.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/ToolbarButton.js b/src/pages/Editor/GGEditor/components/EditorToolbar/ToolbarButton.js new file mode 100644 index 00000000..eb5b4ffa --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/ToolbarButton.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { Tooltip } from 'antd'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const ToolbarButton = props => { + const { command, icon, text } = props; + + return ( + + + + + + ); +}; + +export default ToolbarButton; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/index.js b/src/pages/Editor/GGEditor/components/EditorToolbar/index.js new file mode 100644 index 00000000..ac08e3dc --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/index.js @@ -0,0 +1,5 @@ +import FlowToolbar from './FlowToolbar'; +import MindToolbar from './MindToolbar'; +import KoniToolbar from './KoniToolbar'; + +export { FlowToolbar, MindToolbar, KoniToolbar }; diff --git a/src/pages/Editor/GGEditor/components/EditorToolbar/index.less b/src/pages/Editor/GGEditor/components/EditorToolbar/index.less new file mode 100644 index 00000000..a5cca37c --- /dev/null +++ b/src/pages/Editor/GGEditor/components/EditorToolbar/index.less @@ -0,0 +1,39 @@ +.toolbar { + display: flex; + align-items: center; + + :global { + .command i { + display: inline-block; + width: 27px; + height: 27px; + margin: 0 6px; + padding-top: 6px; + text-align: center; + border: 1px solid #fff; + cursor: pointer; + + &:hover { + border: 1px solid #e6e9ed; + } + } + + .disable i { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + border: 1px solid #fff; + } + } + } +} + +.tooltip { + :global { + .ant-tooltip-inner { + font-size: 12px; + border-radius: 0; + } + } +} diff --git a/src/pages/Editor/GGEditor/mock/worldCup2018.json b/src/pages/Editor/GGEditor/mock/worldCup2018.json new file mode 100644 index 00000000..44f3e63f --- /dev/null +++ b/src/pages/Editor/GGEditor/mock/worldCup2018.json @@ -0,0 +1,129 @@ +{ + "roots": [ + { + "label": "法国", + "children": [ + { + "label": "克罗地亚", + "side": "left", + "children": [ + { + "label": "克罗地亚", + "children": [ + { + "label": "克罗地亚", + "children": [ + { + "label": "克罗地亚" + }, + { + "label": "丹麦" + } + ] + }, + { + "label": "俄罗斯", + "children": [ + { + "label": "俄罗斯" + }, + { + "label": "西班牙" + } + ] + } + ] + }, + { + "label": "英格兰", + "children": [ + { + "label": "英格兰", + "children": [ + { + "label": "英格兰" + }, + { + "label": "哥伦比亚" + } + ] + }, + { + "label": "瑞典", + "children": [ + { + "label": "瑞士" + }, + { + "label": "瑞典" + } + ] + } + ] + } + ] + }, + { + "label": "法国", + "side": "right", + "children": [ + { + "label": "法国", + "children": [ + { + "label": "法国", + "children": [ + { + "label": "法国" + }, + { + "label": "阿根廷" + } + ] + }, + { + "label": "乌拉圭", + "children": [ + { + "label": "乌拉圭" + }, + { + "label": "葡萄牙" + } + ] + } + ] + }, + { + "label": "比利时", + "children": [ + { + "label": "比利时", + "children": [ + { + "label": "比利时" + }, + { + "label": "日本" + } + ] + }, + { + "label": "巴西", + "children": [ + { + "label": "巴西" + }, + { + "label": "墨西哥" + } + ] + } + ] + } + ] + } + ] + } + ] +} From b7b675acf8dfb000743e5dfcfe1af8bd6c756508 Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 12:38:34 +0800 Subject: [PATCH 085/109] fix: fix i18 error --- src/models/menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/menu.js b/src/models/menu.js index d9a9d2b1..c49f8e20 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -18,7 +18,7 @@ function formatter(data, parentAuthority, parentName) { } let locale = 'menu'; - if (parentName) { + if (parentName && parentName !== '/') { locale = `${parentName}.${item.name}`; } else { locale = `menu.${item.name}`; From 0a7b12a8c5983cf2597d50d14ccca55a8ac40378 Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 14:04:40 +0800 Subject: [PATCH 086/109] feat: close club --- config/router.config.js | 46 ++++++++++++------------- src/locales/en-US/menu.js | 2 +- src/locales/pt-BR/menu.js | 2 +- src/locales/zh-CN/menu.js | 2 +- src/locales/zh-TW/menu.js | 2 +- src/pages/Editor/GGEditor/Flow/index.js | 2 ++ src/pages/Editor/GGEditor/Koni/index.js | 2 ++ src/pages/Editor/GGEditor/Mind/index.js | 2 ++ 8 files changed, 33 insertions(+), 27 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index 32e8172c..2bc602e8 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -93,29 +93,6 @@ export default [ }, ], }, - // editor - { - name: 'editor', - icon: 'highlight', - path: '/editor', - routes: [ - { - path: '/editor/flow', - name: 'flow', - component: './Editor/GGEditor/Flow', - }, - { - path: '/editor/mind', - name: 'mind', - component: './Editor/GGEditor/Mind', - }, - { - path: '/editor/koni', - name: 'koni', - component: './Editor/GGEditor/Koni', - }, - ], - }, // list { path: '/list', @@ -288,6 +265,29 @@ export default [ }, ], }, + // editor + { + name: 'editor', + icon: 'highlight', + path: '/editor', + routes: [ + { + path: '/editor/flow', + name: 'flow', + component: './Editor/GGEditor/Flow', + }, + { + path: '/editor/mind', + name: 'mind', + component: './Editor/GGEditor/Mind', + }, + { + path: '/editor/koni', + name: 'koni', + component: './Editor/GGEditor/Koni', + }, + ], + }, ], }, { diff --git a/src/locales/en-US/menu.js b/src/locales/en-US/menu.js index 1d673466..25805ead 100644 --- a/src/locales/en-US/menu.js +++ b/src/locales/en-US/menu.js @@ -38,7 +38,7 @@ export default { 'menu.account.settings': 'Account Settings', 'menu.account.trigger': 'Trigger Error', 'menu.account.logout': 'Logout', - 'menu.editor': 'Editor', + 'menu.editor': 'Graphic Editor', 'menu.editor.flow': 'Flow Editor', 'menu.editor.mind': 'Mind Editor', 'menu.editor.koni': 'Koni Editor', diff --git a/src/locales/pt-BR/menu.js b/src/locales/pt-BR/menu.js index ee82fb1e..994f73cd 100644 --- a/src/locales/pt-BR/menu.js +++ b/src/locales/pt-BR/menu.js @@ -38,7 +38,7 @@ export default { 'menu.account.settings': 'Configurar Conta', 'menu.account.trigger': 'Disparar Erro', 'menu.account.logout': 'Sair', - 'menu.editor': 'Editor', + 'menu.editor': 'Graphic Editor', 'menu.editor.flow': 'Flow Editor', 'menu.editor.mind': 'Mind Editor', 'menu.editor.koni': 'Koni Editor', diff --git a/src/locales/zh-CN/menu.js b/src/locales/zh-CN/menu.js index 0fb0069e..c057bb2a 100644 --- a/src/locales/zh-CN/menu.js +++ b/src/locales/zh-CN/menu.js @@ -38,7 +38,7 @@ export default { 'menu.account.settings': '个人设置', 'menu.account.trigger': '触发报错', 'menu.account.logout': '退出登录', - 'menu.editor': '编辑页', + 'menu.editor': '图形编辑器', 'menu.editor.flow': '流程编辑器', 'menu.editor.mind': '脑图编辑器', 'menu.editor.koni': '拓扑编辑器', diff --git a/src/locales/zh-TW/menu.js b/src/locales/zh-TW/menu.js index 2cf5f9da..2b1a49ea 100644 --- a/src/locales/zh-TW/menu.js +++ b/src/locales/zh-TW/menu.js @@ -38,7 +38,7 @@ export default { 'menu.exception.not-find': '404', 'menu.exception.server-error': '500', 'menu.exception.trigger': '触发错误', - 'menu.editor': '編輯頁', + 'menu.editor': '圖形編輯器', 'menu.editor.flow': '流程編輯器', 'menu.editor.mind': '腦圖編輯器', 'menu.editor.koni': '拓撲編輯器', diff --git a/src/pages/Editor/GGEditor/Flow/index.js b/src/pages/Editor/GGEditor/Flow/index.js index 6acac054..4dc19867 100644 --- a/src/pages/Editor/GGEditor/Flow/index.js +++ b/src/pages/Editor/GGEditor/Flow/index.js @@ -10,6 +10,8 @@ import styles from './index.less'; import { FormattedMessage } from 'umi/locale'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; +GGEditor.setTrackable(false); + const FlowPage = () => { return ( { return ( { return ( Date: Fri, 22 Mar 2019 14:33:04 +0800 Subject: [PATCH 087/109] fix : fix menu error --- .eslintrc.js | 2 +- config/router.config.js | 42 ++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 10309cef..5a1d3666 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,6 +34,6 @@ module.exports = { 'linebreak-style': 0, }, settings: { - polyfills: ['fetch', 'promises', 'url'], + polyfills: ['fetch', 'Promise', 'url', 'object-assign'], }, }; diff --git a/config/router.config.js b/config/router.config.js index 2bc602e8..e954ced9 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -265,28 +265,28 @@ export default [ }, ], }, - // editor + ], + }, + // editor + { + name: 'editor', + icon: 'highlight', + path: '/editor', + routes: [ { - name: 'editor', - icon: 'highlight', - path: '/editor', - routes: [ - { - path: '/editor/flow', - name: 'flow', - component: './Editor/GGEditor/Flow', - }, - { - path: '/editor/mind', - name: 'mind', - component: './Editor/GGEditor/Mind', - }, - { - path: '/editor/koni', - name: 'koni', - component: './Editor/GGEditor/Koni', - }, - ], + path: '/editor/flow', + name: 'flow', + component: './Editor/GGEditor/Flow', + }, + { + path: '/editor/mind', + name: 'mind', + component: './Editor/GGEditor/Mind', + }, + { + path: '/editor/koni', + name: 'koni', + component: './Editor/GGEditor/Koni', }, ], }, From 868b2c6d2fb8fff7358219c3aa72023a1f7fc6f4 Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 15:26:14 +0800 Subject: [PATCH 088/109] fix: fix eslint error --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7bc019c3..ebc3ab64 100644 --- a/package.json +++ b/package.json @@ -75,16 +75,16 @@ "enzyme": "^3.9.0", "eslint": "^5.13.0", "eslint-config-airbnb": "^17.1.0", - "eslint-config-prettier": "^4.0.0", + "eslint-config-prettier": "^4.1.0", "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-compat": "^3.0.1", + "eslint-plugin-compat": "^2.7.0", "eslint-plugin-import": "^2.16.0", - "eslint-plugin-jsx-a11y": "^6.2.0", + "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-markdown": "^1.0.0", "eslint-plugin-react": "^7.12.4", "gh-pages": "^2.0.1", "husky": "^1.3.1", - "jest-puppeteer": "^4.0.0", + "jest-puppeteer": "^4.1.0", "less": "^3.9.0", "lint-staged": "^8.1.1", "merge-umi-mock-data": "^1.0.4", @@ -102,7 +102,7 @@ "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", "umi-plugin-ga": "^1.1.3", - "umi-plugin-react": "^1.4.2" + "umi-plugin-react": "^1.7.2" }, "optionalDependencies": { "puppeteer": "^1.12.1" From c8d313572284f7928f7197821fc81305f82ab89c Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 15:57:19 +0800 Subject: [PATCH 089/109] fix: fix lint error --- .eslintrc.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5a1d3666..aeeca68f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,6 +34,6 @@ module.exports = { 'linebreak-style': 0, }, settings: { - polyfills: ['fetch', 'Promise', 'url', 'object-assign'], + polyfills: ['fetch', 'promises', 'url', 'object-assign'], }, }; diff --git a/package.json b/package.json index ebc3ab64..2ab530bd 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.1.0", "eslint-plugin-babel": "^5.3.0", - "eslint-plugin-compat": "^2.7.0", + "eslint-plugin-compat": "^2.6.3", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-markdown": "^1.0.0", From 72ce09897967d21ec15a2250de2d1cf47d832476 Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 16:26:55 +0800 Subject: [PATCH 090/109] fix: fix #3746,there is only one loading now --- src/layouts/BasicLayout.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 1aa231d4..249ff31f 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -9,7 +9,6 @@ import logo from '../assets/logo.svg'; import Footer from './Footer'; import Header from './Header'; import Context from './MenuContext'; -import PageLoading from '@/components/PageLoading'; import SiderMenu from '@/components/SiderMenu'; import getPageTitle from '@/utils/getPageTitle'; import styles from './BasicLayout.less'; @@ -154,7 +153,7 @@ class BasicLayout extends React.Component { )}
- }>{this.renderSettingDrawer()} + {this.renderSettingDrawer()} ); } From 8983d01be5baa5988c2298f97b975b4db5216bbc Mon Sep 17 00:00:00 2001 From: chen shuai Date: Fri, 22 Mar 2019 18:25:55 +0800 Subject: [PATCH 091/109] bugfix: fix demo md error --- src/components/Authorized/demo/secured.md | 2 +- src/components/Charts/Gauge/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Authorized/demo/secured.md b/src/components/Authorized/demo/secured.md index c030300e..1999852f 100644 --- a/src/components/Authorized/demo/secured.md +++ b/src/components/Authorized/demo/secured.md @@ -17,7 +17,7 @@ const { Secured } = RenderAuthorized('user'); class TestSecuredString extends React.Component { render() { return ( - ; + ) } } diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index 2249211a..e97f126e 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -146,7 +146,7 @@ class Gauge extends React.Component {

${title}

- ${data[0].value * 10}% + ${(data[0].value * 10).toFixed(2)}%

`} /> From 899950fbfabff7244bfb685568dc4a8490654cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 22 Mar 2019 21:51:08 +0800 Subject: [PATCH 092/109] Components Typings (#3815) * Trend * TopNavHeader * TagSelect * SiderMenu * SettingDrawer * StandardTable * StandardFormRow * SelectLang * Reault * PageHeaderWrapper * PageHeaderWrapper * PageHeader * NumberInfo * NoticeIcon * Login * code style * GlobalHeader Footer * Exception * Ellipsis * EditableLinkGroup * EditableItem * DescriptionList * AvticleList * Update src/components/AvatarList/AvatarItem.d.ts Co-Authored-By: xiaohuoni * Update src/components/Login/index.d.ts Co-Authored-By: xiaohuoni * remove '* as' * Update src/components/AvatarList/index.d.ts Co-Authored-By: xiaohuoni * TagSelect * SiderTheme CollapseType MenuMode * Login --- src/components/ArticleListContent/index.d.ts | 13 ++++++++++ .../Authorized/AuthorizedRoute.d.ts | 2 +- src/components/Authorized/index.d.ts | 2 +- src/components/AvatarList/AvatarItem.d.ts | 13 +++++++--- src/components/AvatarList/index.d.ts | 14 +++++----- src/components/Charts/Bar/index.d.ts | 2 +- src/components/Charts/ChartCard/index.d.ts | 2 +- src/components/Charts/Field/index.d.ts | 2 +- src/components/Charts/Gauge/index.d.ts | 2 +- src/components/Charts/MiniArea/index.d.ts | 2 +- src/components/Charts/MiniBar/index.d.ts | 2 +- src/components/Charts/MiniProgress/index.d.ts | 2 +- src/components/Charts/Pie/index.d.ts | 2 +- src/components/Charts/Radar/index.d.ts | 2 +- src/components/Charts/TagCloud/index.d.ts | 2 +- .../Charts/TimelineChart/index.d.ts | 2 +- src/components/Charts/WaterWave/index.d.ts | 2 +- src/components/CountDown/index.d.ts | 2 +- .../DescriptionList/Description.d.ts | 18 +++++++------ src/components/DescriptionList/index.d.ts | 14 +++++----- src/components/EditableItem/index.d.ts | 7 +++++ src/components/EditableLinkGroup/index.d.ts | 9 +++++++ src/components/Ellipsis/index.d.ts | 10 +++---- src/components/Exception/index.d.ts | 18 +++++++++---- src/components/FooterToolbar/index.d.ts | 7 ++--- src/components/GlobalFooter/index.d.ts | 7 ++--- src/components/GlobalHeader/RightContent.d.ts | 26 +++++++++++++++++++ src/components/GlobalHeader/index.d.ts | 13 ++++++++++ src/components/HeaderDropdown/index.d.ts | 10 ++++--- src/components/HeaderSearch/index.d.ts | 6 ++--- src/components/Login/LoginItem.d.ts | 25 +++++++++++++++--- src/components/Login/LoginTab.d.ts | 10 ++++--- src/components/Login/index.d.ts | 23 +++++++++------- src/components/NoticeIcon/NoticeIconTab.d.ts | 15 +++++++---- src/components/NoticeIcon/index.d.ts | 12 ++++----- src/components/NumberInfo/index.d.ts | 7 ++--- src/components/PageHeader/breadcrumb.d.ts | 6 ++--- src/components/PageHeader/index.d.ts | 17 +++++++----- .../PageHeaderWrapper/GridContent.d.ts | 8 ++++++ src/components/PageHeaderWrapper/index.d.ts | 12 +++++++++ src/components/Result/index.d.ts | 13 +++++----- src/components/SelectLang/index.d.ts | 7 +++++ .../SettingDrawer/BlockCheckbox.d.ts | 9 +++++++ src/components/SettingDrawer/ThemeColor.d.ts | 10 +++++++ src/components/SettingDrawer/index.d.ts | 24 +++++++++++++++++ src/components/SiderMenu/BaseMenu.d.ts | 23 ++++++++++++++++ src/components/SiderMenu/SiderMenu.d.ts | 11 ++++++++ src/components/SiderMenu/index.d.ts | 13 ++++++++++ src/components/StandardFormRow/index.d.ts | 11 ++++++++ src/components/StandardTable/index.d.ts | 19 ++++++++++++++ src/components/TagSelect/TagSelectOption.d.ts | 12 ++++++--- src/components/TagSelect/index.d.ts | 17 ++++++++---- src/components/TopNavHeader/index.d.ts | 25 ++++++++++++++++++ src/components/Trend/index.d.ts | 3 ++- 54 files changed, 429 insertions(+), 118 deletions(-) create mode 100644 src/components/ArticleListContent/index.d.ts create mode 100644 src/components/EditableItem/index.d.ts create mode 100644 src/components/EditableLinkGroup/index.d.ts create mode 100644 src/components/GlobalHeader/RightContent.d.ts create mode 100644 src/components/GlobalHeader/index.d.ts create mode 100644 src/components/PageHeaderWrapper/GridContent.d.ts create mode 100644 src/components/PageHeaderWrapper/index.d.ts create mode 100644 src/components/SelectLang/index.d.ts create mode 100644 src/components/SettingDrawer/BlockCheckbox.d.ts create mode 100644 src/components/SettingDrawer/ThemeColor.d.ts create mode 100644 src/components/SettingDrawer/index.d.ts create mode 100644 src/components/SiderMenu/BaseMenu.d.ts create mode 100644 src/components/SiderMenu/SiderMenu.d.ts create mode 100644 src/components/SiderMenu/index.d.ts create mode 100644 src/components/StandardFormRow/index.d.ts create mode 100644 src/components/StandardTable/index.d.ts create mode 100644 src/components/TopNavHeader/index.d.ts diff --git a/src/components/ArticleListContent/index.d.ts b/src/components/ArticleListContent/index.d.ts new file mode 100644 index 00000000..bb4988a9 --- /dev/null +++ b/src/components/ArticleListContent/index.d.ts @@ -0,0 +1,13 @@ +import React from 'react'; + +export interface ApplicationsProps { + data: { + content?: string; + updatedAt?: any; + avatar?: string; + owner?: string; + href?: string; + }; +} + +export default class ArticleListContent extends React.Component {} diff --git a/src/components/Authorized/AuthorizedRoute.d.ts b/src/components/Authorized/AuthorizedRoute.d.ts index fc780004..f94427da 100644 --- a/src/components/Authorized/AuthorizedRoute.d.ts +++ b/src/components/Authorized/AuthorizedRoute.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { RouteProps } from 'react-router'; type authorityFN = (currentAuthority?: string) => boolean; diff --git a/src/components/Authorized/index.d.ts b/src/components/Authorized/index.d.ts index b3e2f56c..72c98587 100644 --- a/src/components/Authorized/index.d.ts +++ b/src/components/Authorized/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import AuthorizedRoute, { authority } from './AuthorizedRoute'; export type IReactComponent

= | React.StatelessComponent

diff --git a/src/components/AvatarList/AvatarItem.d.ts b/src/components/AvatarList/AvatarItem.d.ts index 5681de77..0e809ab4 100644 --- a/src/components/AvatarList/AvatarItem.d.ts +++ b/src/components/AvatarList/AvatarItem.d.ts @@ -1,10 +1,15 @@ -import * as React from 'react'; -export interface IAvatarItemProps { +import React from 'react'; + +export declare type SizeType = number | 'small' | 'default' | 'large'; + +export interface AvatarItemProps { tips: React.ReactNode; src: string; + size?: SizeType; style?: React.CSSProperties; + onClick?: () => void; } -export default class AvatarItem extends React.Component { - constructor(props: IAvatarItemProps); +export default class AvatarItem extends React.Component { + constructor(props: AvatarItemProps); } diff --git a/src/components/AvatarList/index.d.ts b/src/components/AvatarList/index.d.ts index f49ca010..e454a8be 100644 --- a/src/components/AvatarList/index.d.ts +++ b/src/components/AvatarList/index.d.ts @@ -1,14 +1,14 @@ -import * as React from 'react'; -import AvatarItem from './AvatarItem'; +import React from 'react'; +import AvatarItem, { AvatarItemProps, SizeType } from './AvatarItem'; -export interface IAvatarListProps { - size?: 'large' | 'small' | 'mini' | 'default'; +export interface AvatarListProps { + Item?: React.ReactElement; + size?: SizeType; maxLength?: number; excessItemsStyle?: React.CSSProperties; style?: React.CSSProperties; - children: React.ReactElement | Array>; + children: React.ReactElement | Array>; } - -export default class AvatarList extends React.Component { +export default class AvatarList extends React.Component { public static Item: typeof AvatarItem; } diff --git a/src/components/Charts/Bar/index.d.ts b/src/components/Charts/Bar/index.d.ts index 48990825..67bb1dd0 100644 --- a/src/components/Charts/Bar/index.d.ts +++ b/src/components/Charts/Bar/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IBarProps { title: React.ReactNode; color?: string; diff --git a/src/components/Charts/ChartCard/index.d.ts b/src/components/Charts/ChartCard/index.d.ts index 0437c0c8..5153f5e0 100644 --- a/src/components/Charts/ChartCard/index.d.ts +++ b/src/components/Charts/ChartCard/index.d.ts @@ -1,5 +1,5 @@ import { CardProps } from 'antd/lib/card'; -import * as React from 'react'; +import React from 'react'; export interface IChartCardProps extends CardProps { title: React.ReactNode; diff --git a/src/components/Charts/Field/index.d.ts b/src/components/Charts/Field/index.d.ts index 975fb667..80b1bf1d 100644 --- a/src/components/Charts/Field/index.d.ts +++ b/src/components/Charts/Field/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IFieldProps { label: React.ReactNode; value: React.ReactNode; diff --git a/src/components/Charts/Gauge/index.d.ts b/src/components/Charts/Gauge/index.d.ts index 66e3c003..fe550091 100644 --- a/src/components/Charts/Gauge/index.d.ts +++ b/src/components/Charts/Gauge/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IGaugeProps { title: React.ReactNode; color?: string; diff --git a/src/components/Charts/MiniArea/index.d.ts b/src/components/Charts/MiniArea/index.d.ts index b223b68c..8b4e71ca 100644 --- a/src/components/Charts/MiniArea/index.d.ts +++ b/src/components/Charts/MiniArea/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; // g2已经更新到3.0 // 不带的写了 diff --git a/src/components/Charts/MiniBar/index.d.ts b/src/components/Charts/MiniBar/index.d.ts index 0c4bd6cc..b2685339 100644 --- a/src/components/Charts/MiniBar/index.d.ts +++ b/src/components/Charts/MiniBar/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IMiniBarProps { color?: string; height: number; diff --git a/src/components/Charts/MiniProgress/index.d.ts b/src/components/Charts/MiniProgress/index.d.ts index aaeb7261..0ef158e8 100644 --- a/src/components/Charts/MiniProgress/index.d.ts +++ b/src/components/Charts/MiniProgress/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IMiniProgressProps { target: number; color?: string; diff --git a/src/components/Charts/Pie/index.d.ts b/src/components/Charts/Pie/index.d.ts index 66c93eeb..63aecfa3 100644 --- a/src/components/Charts/Pie/index.d.ts +++ b/src/components/Charts/Pie/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IPieProps { animate?: boolean; color?: string; diff --git a/src/components/Charts/Radar/index.d.ts b/src/components/Charts/Radar/index.d.ts index 963ac8c3..6a7dd42a 100644 --- a/src/components/Charts/Radar/index.d.ts +++ b/src/components/Charts/Radar/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IRadarProps { title?: React.ReactNode; height: number; diff --git a/src/components/Charts/TagCloud/index.d.ts b/src/components/Charts/TagCloud/index.d.ts index 462650c4..ac25269d 100644 --- a/src/components/Charts/TagCloud/index.d.ts +++ b/src/components/Charts/TagCloud/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface ITagCloudProps { data: Array<{ name: string; diff --git a/src/components/Charts/TimelineChart/index.d.ts b/src/components/Charts/TimelineChart/index.d.ts index 40b94325..0f547e77 100644 --- a/src/components/Charts/TimelineChart/index.d.ts +++ b/src/components/Charts/TimelineChart/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface ITimelineChartProps { data: Array<{ x: number; diff --git a/src/components/Charts/WaterWave/index.d.ts b/src/components/Charts/WaterWave/index.d.ts index 8f5588d2..e30a7e48 100644 --- a/src/components/Charts/WaterWave/index.d.ts +++ b/src/components/Charts/WaterWave/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface IWaterWaveProps { title: React.ReactNode; color?: string; diff --git a/src/components/CountDown/index.d.ts b/src/components/CountDown/index.d.ts index d39a2e95..af658e3f 100644 --- a/src/components/CountDown/index.d.ts +++ b/src/components/CountDown/index.d.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export interface ICountDownProps { format?: (time: number) => void; target: Date | number; diff --git a/src/components/DescriptionList/Description.d.ts b/src/components/DescriptionList/Description.d.ts index 2a17be37..41c04970 100644 --- a/src/components/DescriptionList/Description.d.ts +++ b/src/components/DescriptionList/Description.d.ts @@ -1,9 +1,11 @@ -import * as React from 'react'; +import React from 'react'; +import { ColProps } from 'antd/es/col'; -export default class Description extends React.Component< - { - term: React.ReactNode; - style?: React.CSSProperties; - }, - any -> {} +export interface DescriptionProps extends ColProps { + column?: number; + key?: string | number; + style?: React.CSSProperties; + term?: React.ReactNode; +} + +export default class Description extends React.Component {} diff --git a/src/components/DescriptionList/index.d.ts b/src/components/DescriptionList/index.d.ts index 96ccfa7d..c0bb071c 100644 --- a/src/components/DescriptionList/index.d.ts +++ b/src/components/DescriptionList/index.d.ts @@ -1,15 +1,17 @@ -import * as React from 'react'; -import Description from './Description'; +import React from 'react'; +import Description, { DescriptionProps } from './Description'; -export interface IDescriptionListProps { - layout?: 'horizontal' | 'vertical'; +export interface DescriptionListProps { + className?: string; col?: number; - title: React.ReactNode; + description?: DescriptionProps[]; gutter?: number; + layout?: 'horizontal' | 'vertical'; size?: 'large' | 'small'; style?: React.CSSProperties; + title?: React.ReactNode; } -export default class DescriptionList extends React.Component { +export default class DescriptionList extends React.Component { public static Description: typeof Description; } diff --git a/src/components/EditableItem/index.d.ts b/src/components/EditableItem/index.d.ts new file mode 100644 index 00000000..fc69b274 --- /dev/null +++ b/src/components/EditableItem/index.d.ts @@ -0,0 +1,7 @@ +import React from 'react'; + +export interface EditableItemProps { + onChange?: (value?: string | string[] | number) => void; +} + +export default class EditableItem extends React.Component {} diff --git a/src/components/EditableLinkGroup/index.d.ts b/src/components/EditableLinkGroup/index.d.ts new file mode 100644 index 00000000..07a42abe --- /dev/null +++ b/src/components/EditableLinkGroup/index.d.ts @@ -0,0 +1,9 @@ +import React from 'react'; + +export interface EditableLinkGroupProps { + links: any[]; + onAdd: () => void; + linkElement: string; +} + +export default class EditableLinkGroup extends React.Component {} diff --git a/src/components/Ellipsis/index.d.ts b/src/components/Ellipsis/index.d.ts index 37d508d7..075fa789 100644 --- a/src/components/Ellipsis/index.d.ts +++ b/src/components/Ellipsis/index.d.ts @@ -1,13 +1,13 @@ -import * as React from 'react'; +import React from 'react'; import { TooltipProps } from 'antd/lib/tooltip'; -export interface IEllipsisTooltipProps extends TooltipProps { +export interface EllipsisTooltipProps extends TooltipProps { title?: undefined; overlayStyle?: undefined; } -export interface IEllipsisProps { - tooltip?: boolean | IEllipsisTooltipProps; +export interface EllipsisProps { + tooltip?: boolean | EllipsisTooltipProps; length?: number; lines?: number; style?: React.CSSProperties; @@ -18,4 +18,4 @@ export interface IEllipsisProps { export function getStrFullLength(str: string): number; export function cutStrByFullLength(str: string, maxLength: number): string; -export default class Ellipsis extends React.Component {} +export default class Ellipsis extends React.Component {} diff --git a/src/components/Exception/index.d.ts b/src/components/Exception/index.d.ts index a74abb1f..b8cb65dd 100644 --- a/src/components/Exception/index.d.ts +++ b/src/components/Exception/index.d.ts @@ -1,15 +1,23 @@ -import * as React from 'react'; -export interface IExceptionProps { +import React from 'react'; +import * as H from 'history'; + +export interface ExceptionProps< + L = { + to: H.LocationDescriptor; + href?: H.LocationDescriptor; + replace?: boolean; + innerRef?: (node: HTMLAnchorElement | null) => void; + } +> { type?: '403' | '404' | '500'; title?: React.ReactNode; desc?: React.ReactNode; img?: string; actions?: React.ReactNode; - linkElement?: string | React.ComponentType; + linkElement?: string | React.ComponentType; style?: React.CSSProperties; className?: string; backText?: React.ReactNode; redirect?: string; } - -export default class Exception extends React.Component {} +export default class Exception extends React.Component {} diff --git a/src/components/FooterToolbar/index.d.ts b/src/components/FooterToolbar/index.d.ts index 9c6ac5b4..9ec202c1 100644 --- a/src/components/FooterToolbar/index.d.ts +++ b/src/components/FooterToolbar/index.d.ts @@ -1,7 +1,8 @@ -import * as React from 'react'; -export interface IFooterToolbarProps { +import React from 'react'; +export interface FooterToolbarProps { extra: React.ReactNode; style?: React.CSSProperties; + className?: string; } -export default class FooterToolbar extends React.Component {} +export default class FooterToolbar extends React.Component {} diff --git a/src/components/GlobalFooter/index.d.ts b/src/components/GlobalFooter/index.d.ts index 3fa5c423..efde77db 100644 --- a/src/components/GlobalFooter/index.d.ts +++ b/src/components/GlobalFooter/index.d.ts @@ -1,5 +1,5 @@ -import * as React from 'react'; -export interface IGlobalFooterProps { +import React from 'react'; +export interface GlobalFooterProps { links?: Array<{ key?: string; title: React.ReactNode; @@ -8,6 +8,7 @@ export interface IGlobalFooterProps { }>; copyright?: React.ReactNode; style?: React.CSSProperties; + className?: string; } -export default class GlobalFooter extends React.Component {} +export default class GlobalFooter extends React.Component {} diff --git a/src/components/GlobalHeader/RightContent.d.ts b/src/components/GlobalHeader/RightContent.d.ts new file mode 100644 index 00000000..275d9996 --- /dev/null +++ b/src/components/GlobalHeader/RightContent.d.ts @@ -0,0 +1,26 @@ +import React from 'react'; +import { DropDownProps } from 'antd/lib/dropdown'; +import { ClickParam } from 'antd/es/menu'; +import { SiderTheme } from 'antd/es/Layout/Sider'; + +export interface GlobalHeaderRightProps { + notices?: any[]; + dispatch?: (args: any) => void; + currentUser?: { + avatar?: string; + name?: string; + title?: string; + group?: string; + signature?: string; + geographic?: any; + tags?: any[]; + unreadCount: number; + }; + fetchingNotices?: boolean; + onNoticeVisibleChange?: (visible: boolean) => void; + onMenuClick?: (param: ClickParam) => void; + onNoticeClear?: (tabName: string) => void; + theme?: SiderTheme; +} + +export default class GlobalHeaderRight extends React.Component {} diff --git a/src/components/GlobalHeader/index.d.ts b/src/components/GlobalHeader/index.d.ts new file mode 100644 index 00000000..7d2fcf6e --- /dev/null +++ b/src/components/GlobalHeader/index.d.ts @@ -0,0 +1,13 @@ +import React from 'react'; + +export interface GlobalHeaderProps { + collapsed?: boolean; + onCollapse?: (collapsed: boolean) => void; + isMobile?: boolean; + logo?: string; + onNoticeClear?: (type: string) => void; + onMenuClick?: ({ key: string }) => void; + onNoticeVisibleChange?: (b: boolean) => void; +} + +export default class GlobalHeader extends React.Component {} diff --git a/src/components/HeaderDropdown/index.d.ts b/src/components/HeaderDropdown/index.d.ts index 43fa9aba..a1fd50aa 100644 --- a/src/components/HeaderDropdown/index.d.ts +++ b/src/components/HeaderDropdown/index.d.ts @@ -1,8 +1,12 @@ -import * as React from 'react'; +import React from 'react'; import { DropDownProps } from 'antd/lib/dropdown'; -export interface IHeaderDropdownProps extends DropDownProps { +declare type OverlayFunc = () => React.ReactNode; + +export interface HeaderDropdownProps extends DropDownProps { overlayClassName?: string; + overlay: React.ReactNode | OverlayFunc; + placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter'; } -export default class HeaderDropdown extends React.Component {} +export default class HeaderDropdown extends React.Component {} diff --git a/src/components/HeaderSearch/index.d.ts b/src/components/HeaderSearch/index.d.ts index d78fde47..fcf7c11d 100644 --- a/src/components/HeaderSearch/index.d.ts +++ b/src/components/HeaderSearch/index.d.ts @@ -1,5 +1,5 @@ -import * as React from 'react'; -export interface IHeaderSearchProps { +import React from 'react'; +export interface HeaderSearchProps { placeholder?: string; dataSource?: string[]; defaultOpen?: boolean; @@ -12,4 +12,4 @@ export interface IHeaderSearchProps { className?: string; } -export default class HeaderSearch extends React.Component {} +export default class HeaderSearch extends React.Component {} diff --git a/src/components/Login/LoginItem.d.ts b/src/components/Login/LoginItem.d.ts index bcfb73b8..563e94e0 100644 --- a/src/components/Login/LoginItem.d.ts +++ b/src/components/Login/LoginItem.d.ts @@ -1,11 +1,28 @@ -import * as React from 'react'; -export interface ILoginItemProps { +import React from 'react'; +import { WrappedFormUtils } from 'antd/es/form/Form'; +import ItemMap from './map'; +import { Omit } from 'antd/es/_util/type'; + +export type WrappedLoginItemProps = Omit; +export type LoginItemType = { [K in keyof typeof ItemMap]: React.FC }; + +export interface LoginItemProps { name?: string; rules?: any[]; style?: React.CSSProperties; - onGetCaptcha?: () => void; + onGetCaptcha?: (event?: MouseEvent) => void; placeholder?: string; buttonText?: React.ReactNode; + onPressEnter?: (e: any) => void; + countDown?: number; + getCaptchaButtonText?: string; + getCaptchaSecondText?: string; + updateActive: (activeItem: any) => void; + form: WrappedFormUtils; + type: string; + defaultValue?: string; + customprops?: any; + onChange?: (e: any) => void; } -export default class LoginItem extends React.Component {} +export default class LoginItem extends React.Component {} diff --git a/src/components/Login/LoginTab.d.ts b/src/components/Login/LoginTab.d.ts index db651f7b..c3f13ecb 100644 --- a/src/components/Login/LoginTab.d.ts +++ b/src/components/Login/LoginTab.d.ts @@ -1,7 +1,11 @@ -import * as React from 'react'; +import React from 'react'; -export interface ILoginTabProps { +export interface LoginTabProps { key?: string; tab?: React.ReactNode; + tabUtil: { + addTab: (id: any) => void; + removeTab: (id: any) => void; + }; } -export default class LoginTab extends React.Component {} +export default class LoginTab extends React.Component {} diff --git a/src/components/Login/index.d.ts b/src/components/Login/index.d.ts index 6a6f67fe..f80d19b0 100644 --- a/src/components/Login/index.d.ts +++ b/src/components/Login/index.d.ts @@ -1,20 +1,25 @@ import Button from 'antd/lib/button'; -import * as React from 'react'; -import LoginItem from './LoginItem'; +import React from 'react'; +import LoginItem, { LoginItemProps, LoginItemType } from './LoginItem'; import LoginTab from './LoginTab'; +import { WrappedFormUtils } from 'antd/es/form/Form'; +import LoginSubmit from './LoginSubmit'; -export interface ILoginProps { +export interface LoginProps { defaultActiveKey?: string; onTabChange?: (key: string) => void; style?: React.CSSProperties; onSubmit?: (error: any, values: any) => void; + className?: string; } -export default class Login extends React.Component { +interface Login extends WrappedFormUtils {} +declare class Login extends React.Component { public static Tab: typeof LoginTab; - public static UserName: typeof LoginItem; - public static Password: typeof LoginItem; - public static Mobile: typeof LoginItem; - public static Captcha: typeof LoginItem; - public static Submit: typeof Button; + public static UserName: React.FC; + public static Password: React.FC; + public static Mobile: React.FC; + public static Captcha: React.FC; + public static Submit: typeof LoginSubmit; } +export default Login; diff --git a/src/components/NoticeIcon/NoticeIconTab.d.ts b/src/components/NoticeIcon/NoticeIconTab.d.ts index 869dbbf0..2f7781de 100644 --- a/src/components/NoticeIcon/NoticeIconTab.d.ts +++ b/src/components/NoticeIcon/NoticeIconTab.d.ts @@ -1,7 +1,7 @@ import { SkeletonProps } from 'antd/lib/skeleton'; -import * as React from 'react'; +import React from 'react'; -export interface INoticeIconData { +export interface NoticeIconData { avatar?: string | React.ReactNode; title?: React.ReactNode; description?: React.ReactNode; @@ -10,16 +10,21 @@ export interface INoticeIconData { style?: React.CSSProperties; } -export interface INoticeIconTabProps { +export interface NoticeIconTabProps { count?: number; emptyText?: React.ReactNode; emptyImage?: string; - list?: INoticeIconData[]; + list?: NoticeIconData[]; name?: string; showClear?: boolean; showViewMore?: boolean; style?: React.CSSProperties; title?: string; + data?: any[]; + onClick: (item: any) => void; + onClear: (item: any) => void; + locale: any; + onViewMore: (e: any) => void; } -export default class NoticeIconTab extends React.Component {} +export default class NoticeIconTab extends React.Component {} diff --git a/src/components/NoticeIcon/index.d.ts b/src/components/NoticeIcon/index.d.ts index d32586d6..18b3c433 100644 --- a/src/components/NoticeIcon/index.d.ts +++ b/src/components/NoticeIcon/index.d.ts @@ -1,14 +1,14 @@ -import * as React from 'react'; -import NoticeIconTab, { INoticeIconData } from './NoticeIconTab'; +import React from 'react'; +import NoticeIconTab, { NoticeIconData } from './NoticeIconTab'; -export interface INoticeIconProps { +export interface NoticeIconProps { count?: number; bell?: React.ReactNode; className?: string; loading?: boolean; onClear?: (tabName: string) => void; - onItemClick?: (item: INoticeIconData, tabProps: INoticeIconProps) => void; - onViewMore?: (tabProps: INoticeIconProps) => void; + onItemClick?: (item: NoticeIconData, tabProps: NoticeIconProps) => void; + onViewMore?: (tabProps: NoticeIconProps, e: MouseEvent) => void; onTabChange?: (tabTile: string) => void; style?: React.CSSProperties; onPopupVisibleChange?: (visible: boolean) => void; @@ -22,6 +22,6 @@ export interface INoticeIconProps { clearClose?: boolean; } -export default class NoticeIcon extends React.Component { +export default class NoticeIcon extends React.Component { public static Tab: typeof NoticeIconTab; } diff --git a/src/components/NumberInfo/index.d.ts b/src/components/NumberInfo/index.d.ts index ca93ba5d..6636db91 100644 --- a/src/components/NumberInfo/index.d.ts +++ b/src/components/NumberInfo/index.d.ts @@ -1,5 +1,5 @@ -import * as React from 'react'; -export interface INumberInfoProps { +import React from 'react'; +export interface NumberInfoProps { title?: React.ReactNode | string; subTitle?: React.ReactNode | string; total?: React.ReactNode | string; @@ -7,7 +7,8 @@ export interface INumberInfoProps { theme?: string; gap?: number; subTotal?: number; + suffix?: string; style?: React.CSSProperties; } -export default class NumberInfo extends React.Component {} +export default class NumberInfo extends React.Component {} diff --git a/src/components/PageHeader/breadcrumb.d.ts b/src/components/PageHeader/breadcrumb.d.ts index cfed4021..69a95dc1 100644 --- a/src/components/PageHeader/breadcrumb.d.ts +++ b/src/components/PageHeader/breadcrumb.d.ts @@ -1,6 +1,6 @@ -import * as React from 'react'; -import { IPageHeaderProps } from './index'; +import React from 'react'; +import { PageHeaderProps } from './index'; -export default class BreadcrumbView extends React.Component {} +export default class BreadcrumbView extends React.Component {} export function getBreadcrumb(breadcrumbNameMap: object, url: string): object; diff --git a/src/components/PageHeader/index.d.ts b/src/components/PageHeader/index.d.ts index e3e1f321..fb927e74 100644 --- a/src/components/PageHeader/index.d.ts +++ b/src/components/PageHeader/index.d.ts @@ -1,28 +1,31 @@ -/// -import * as React from 'react'; +import React from 'react'; import { Location } from 'history'; -export interface IPageHeaderProps { - title?: React.ReactNode | string; + +export interface PageHeaderProps { + title?: React.ReactNode | string | number; logo?: React.ReactNode | string; action?: React.ReactNode | string; content?: React.ReactNode; extraContent?: React.ReactNode; routes?: any[]; params?: any; - breadcrumbList?: Array<{ title: React.ReactNode; href?: string }>; + breadcrumbList?: Array<{ title: string | number; href?: string }>; tabList?: Array<{ key: string; tab: React.ReactNode }>; tabActiveKey?: string; tabDefaultActiveKey?: string; onTabChange?: (key: string) => void; tabBarExtraContent?: React.ReactNode; - linkElement?: React.ReactNode; + linkElement?: React.ReactNode | string; style?: React.CSSProperties; home?: React.ReactNode; wide?: boolean; hiddenBreadcrumb?: boolean; + className?: string; + loading?: boolean; + breadcrumbSeparator?: React.ReactNode; location?: Location; itemRender: (menuItem: any) => React.ReactNode; breadcrumbNameMap?: any; } -export default class PageHeader extends React.Component {} +export default class PageHeader extends React.Component {} diff --git a/src/components/PageHeaderWrapper/GridContent.d.ts b/src/components/PageHeaderWrapper/GridContent.d.ts new file mode 100644 index 00000000..a3d3a308 --- /dev/null +++ b/src/components/PageHeaderWrapper/GridContent.d.ts @@ -0,0 +1,8 @@ +import React from 'react'; + +export interface GridContentProps { + contentWidth: string; + children: React.ReactNode; +} + +export default class GridContent extends React.Component {} diff --git a/src/components/PageHeaderWrapper/index.d.ts b/src/components/PageHeaderWrapper/index.d.ts new file mode 100644 index 00000000..21c8759b --- /dev/null +++ b/src/components/PageHeaderWrapper/index.d.ts @@ -0,0 +1,12 @@ +import React from 'react'; +export interface ResultProps { + actions?: React.ReactNode; + className?: string; + description?: React.ReactNode; + extra?: React.ReactNode; + style?: React.CSSProperties; + title?: React.ReactNode; + type: 'success' | 'error'; +} + +export default class Result extends React.Component {} diff --git a/src/components/Result/index.d.ts b/src/components/Result/index.d.ts index 0c34c254..21c8759b 100644 --- a/src/components/Result/index.d.ts +++ b/src/components/Result/index.d.ts @@ -1,11 +1,12 @@ -import * as React from 'react'; -export interface IResultProps { - type: 'success' | 'error'; - title: React.ReactNode; +import React from 'react'; +export interface ResultProps { + actions?: React.ReactNode; + className?: string; description?: React.ReactNode; extra?: React.ReactNode; - actions?: React.ReactNode; style?: React.CSSProperties; + title?: React.ReactNode; + type: 'success' | 'error'; } -export default class Result extends React.Component {} +export default class Result extends React.Component {} diff --git a/src/components/SelectLang/index.d.ts b/src/components/SelectLang/index.d.ts new file mode 100644 index 00000000..d2c53fa3 --- /dev/null +++ b/src/components/SelectLang/index.d.ts @@ -0,0 +1,7 @@ +import React from 'react'; + +export interface SelectLangProps { + className?: string; +} + +export default class SelectLang extends React.Component {} diff --git a/src/components/SettingDrawer/BlockCheckbox.d.ts b/src/components/SettingDrawer/BlockCheckbox.d.ts new file mode 100644 index 00000000..1012294e --- /dev/null +++ b/src/components/SettingDrawer/BlockCheckbox.d.ts @@ -0,0 +1,9 @@ +import React from 'react'; + +export interface BlockChecboxProps { + value: string; + onChange: (key: string) => void; + list: any[]; +} + +export default class BlockChecbox extends React.Component {} diff --git a/src/components/SettingDrawer/ThemeColor.d.ts b/src/components/SettingDrawer/ThemeColor.d.ts new file mode 100644 index 00000000..17bc3e8d --- /dev/null +++ b/src/components/SettingDrawer/ThemeColor.d.ts @@ -0,0 +1,10 @@ +import React from 'react'; + +export interface TagProps { + color: string; + check: boolean; + className?: string; + onClick?: () => void; +} + +export default class ThemeColor extends React.Component {} diff --git a/src/components/SettingDrawer/index.d.ts b/src/components/SettingDrawer/index.d.ts new file mode 100644 index 00000000..22273089 --- /dev/null +++ b/src/components/SettingDrawer/index.d.ts @@ -0,0 +1,24 @@ +import React from 'react'; +import { SiderTheme } from 'antd/es/Layout/Sider'; + +export interface SettingModelState { + navTheme: string | SiderTheme; + primaryColor: string; + layout: string; + contentWidth: string; + fixedHeader: boolean; + autoHideHeader: boolean; + fixSiderbar: boolean; + menu: { disableLocal: boolean }; + title: string; + pwa: boolean; + iconfontUrl: string; + colorWeak: boolean; +} + +export interface SettingDrawerProps { + setting?: SettingModelState; + dispatch?: (args: any) => void; +} + +export default class SettingDrawer extends React.Component {} diff --git a/src/components/SiderMenu/BaseMenu.d.ts b/src/components/SiderMenu/BaseMenu.d.ts new file mode 100644 index 00000000..79fcf467 --- /dev/null +++ b/src/components/SiderMenu/BaseMenu.d.ts @@ -0,0 +1,23 @@ +import React from 'react'; +import * as H from 'history'; +import { SiderTheme, CollapseType } from 'antd/es/Layout/Sider'; + +import { MenuMode } from 'antd/es/menu'; + +export interface BaseMenuProps { + flatMenuKeys?: any[]; + location?: H.Location; + onCollapse?: (collapsed: boolean, type?: CollapseType) => void; + isMobile?: boolean; + openKeys?: any; + theme?: SiderTheme; + mode?: MenuMode; + className?: string; + collapsed?: boolean; + handleOpenChange?: (openKeys: any[]) => void; + menuData?: any[]; + style?: React.CSSProperties; + onOpenChange?: (openKeys: string[]) => void; +} + +export default class BaseMenu extends React.Component {} diff --git a/src/components/SiderMenu/SiderMenu.d.ts b/src/components/SiderMenu/SiderMenu.d.ts new file mode 100644 index 00000000..c18162a8 --- /dev/null +++ b/src/components/SiderMenu/SiderMenu.d.ts @@ -0,0 +1,11 @@ +import React from 'react'; +import * as H from 'history'; +import { BaseMenuProps } from './BaseMenu'; +import { SiderTheme } from 'antd/es/Layout/Sider'; + +export interface SiderMenuProps extends BaseMenuProps { + logo?: string; + fixSiderbar?: boolean; +} + +export default class SiderMenu extends React.Component {} diff --git a/src/components/SiderMenu/index.d.ts b/src/components/SiderMenu/index.d.ts new file mode 100644 index 00000000..383df9e1 --- /dev/null +++ b/src/components/SiderMenu/index.d.ts @@ -0,0 +1,13 @@ +import React from 'react'; +import { SiderTheme } from 'antd/es/Layout/Sider'; + +export interface SiderMenuProps { + isMobile: boolean; + menuData: any[]; + collapsed: boolean; + logo?: string; + theme?: SiderTheme; + onCollapse: (payload: boolean) => void; +} + +export default class SiderMenuWrapper extends React.Component {} diff --git a/src/components/StandardFormRow/index.d.ts b/src/components/StandardFormRow/index.d.ts new file mode 100644 index 00000000..de06c9b8 --- /dev/null +++ b/src/components/StandardFormRow/index.d.ts @@ -0,0 +1,11 @@ +import React from 'react'; + +export interface StandardFormRowProps { + title: string; + last?: boolean; + block?: boolean; + grid?: boolean; + style?: React.CSSProperties; +} + +export default class StandardFormRow extends React.Component {} diff --git a/src/components/StandardTable/index.d.ts b/src/components/StandardTable/index.d.ts new file mode 100644 index 00000000..d9addeff --- /dev/null +++ b/src/components/StandardTable/index.d.ts @@ -0,0 +1,19 @@ +import React from 'react'; +import { PaginationConfig, SorterResult, TableCurrentDataSource } from 'antd/lib/table'; + +export interface StandardTableProps { + columns: any; + onSelectRow: (row: any) => void; + data: any; + rowKey?: string; + selectedRows: any[]; + onChange?: ( + pagination: PaginationConfig, + filters: Record, + sorter: SorterResult, + extra?: TableCurrentDataSource + ) => void; + loading?: boolean; +} + +export default class StandardTable extends React.Component {} diff --git a/src/components/TagSelect/TagSelectOption.d.ts b/src/components/TagSelect/TagSelectOption.d.ts index 366b297a..3343d744 100644 --- a/src/components/TagSelect/TagSelectOption.d.ts +++ b/src/components/TagSelect/TagSelectOption.d.ts @@ -1,8 +1,12 @@ -import * as React from 'react'; +import React from 'react'; -export interface ITagSelectOptionProps { - value: string | number; +export interface TagSelectOptionProps { + value?: string | number; style?: React.CSSProperties; + checked?: boolean; + onChange?: (value: string | number, state: boolean) => void; } -export default class TagSelectOption extends React.Component {} +export default class TagSelectOption extends React.Component { + public static isTagSelectOption?: boolean; +} diff --git a/src/components/TagSelect/index.d.ts b/src/components/TagSelect/index.d.ts index 9de30263..c225a86f 100644 --- a/src/components/TagSelect/index.d.ts +++ b/src/components/TagSelect/index.d.ts @@ -1,16 +1,23 @@ -import * as React from 'react'; -import TagSelectOption from './TagSelectOption'; +import React from 'react'; +import TagSelectOption, { TagSelectOptionProps } from './TagSelectOption'; -export interface ITagSelectProps { +export interface TagSelectProps { onChange?: (value: string[]) => void; expandable?: boolean; value?: string[] | number[]; style?: React.CSSProperties; hideCheckAll?: boolean; - actionsText?: { expandText?: string; collapseText?: string; selectAllText?: string }; + actionsText?: { + expandText?: React.ReactNode; + collapseText?: React.ReactNode; + selectAllText?: React.ReactNode; + }; + className: string; + Option: TagSelectOptionProps; + children: React.ReactElement | Array>; } -export default class TagSelect extends React.Component { +export default class TagSelect extends React.Component { public static Option: typeof TagSelectOption; private children: | React.ReactElement diff --git a/src/components/TopNavHeader/index.d.ts b/src/components/TopNavHeader/index.d.ts new file mode 100644 index 00000000..2d6631be --- /dev/null +++ b/src/components/TopNavHeader/index.d.ts @@ -0,0 +1,25 @@ +import React from 'react'; +import { SiderTheme, CollapseType } from 'antd/es/Layout/Sider'; +import { MenuMode } from 'antd/es/menu'; + +export interface TopNavHeaderProps { + theme: SiderTheme; + contentWidth?: string; + menuData?: any[]; + logo?: string; + mode?: MenuMode; + flatMenuKeys?: any[]; + onCollapse?: (collapsed: boolean, type?: CollapseType) => void; + isMobile?: boolean; + openKeys?: any; + className?: string; + collapsed?: boolean; + handleOpenChange?: (openKeys: any[]) => void; + style?: React.CSSProperties; + onOpenChange?: (openKeys: string[]) => void; + onNoticeClear?: (type: string) => void; + onMenuClick?: ({ key: string }) => void; + onNoticeVisibleChange?: (b: boolean) => void; +} + +export default class TopNavHeader extends React.Component {} diff --git a/src/components/Trend/index.d.ts b/src/components/Trend/index.d.ts index 7dc02010..a7775ae9 100644 --- a/src/components/Trend/index.d.ts +++ b/src/components/Trend/index.d.ts @@ -1,10 +1,11 @@ -import * as React from 'react'; +import React from 'react'; export interface ITrendProps { colorful?: boolean; flag: 'up' | 'down'; style?: React.CSSProperties; reverseColor?: boolean; + className?: string; } export default class Trend extends React.Component {} From 090e1840fa74226af423d912ac94e313c2b5bb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E4=B9=90?= Date: Fri, 22 Mar 2019 21:51:40 +0800 Subject: [PATCH 093/109] [Authorized] fix props cannot be delivered if target is a react element (#3813) --- src/components/Authorized/CheckPermissions.js | 47 ++++++------------- src/components/Authorized/PromiseRender.js | 26 ++++++---- src/components/Authorized/Secured.js | 26 +++++++--- 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index ba83f5b9..4b49d1f8 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -2,21 +2,13 @@ import React from 'react'; import PromiseRender from './PromiseRender'; import { CURRENT } from './renderAuthorize'; -function isPromise(obj) { - return ( - !!obj && - (typeof obj === 'object' || typeof obj === 'function') && - typeof obj.then === 'function' - ); -} - /** * 通用权限检查方法 * Common check permissions method - * @param { 权限判定 Permission judgment type string |array | Promise | Function } authority - * @param { 你的权限 Your permission description type:string} currentAuthority - * @param { 通过的组件 Passing components } target - * @param { 未通过的组件 no pass components } Exception + * @param { 权限判定 | Permission judgment } authority + * @param { 你的权限 | Your permission description } currentAuthority + * @param { 通过的组件 | Passing components } target + * @param { 未通过的组件 | no pass components } Exception */ const checkPermissions = (authority, currentAuthority, target, Exception) => { // 没有判定权限.默认查看所有 @@ -26,47 +18,36 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { } // 数组处理 if (Array.isArray(authority)) { - if (authority.indexOf(currentAuthority) >= 0) { - return target; - } if (Array.isArray(currentAuthority)) { - for (let i = 0; i < currentAuthority.length; i += 1) { - const element = currentAuthority[i]; - if (authority.indexOf(element) >= 0) { - return target; - } + if (currentAuthority.some(item => authority.includes(item))) { + return target; } + } else if (authority.includes(currentAuthority)) { + return target; } return Exception; } - // string 处理 if (typeof authority === 'string') { - if (authority === currentAuthority) { - return target; - } if (Array.isArray(currentAuthority)) { - for (let i = 0; i < currentAuthority.length; i += 1) { - const element = currentAuthority[i]; - if (authority === element) { - return target; - } + if (currentAuthority.some(item => authority === item)) { + return target; } + } else if (authority === currentAuthority) { + return target; } return Exception; } - // Promise 处理 - if (isPromise(authority)) { + if (authority instanceof Promise) { return ; } - // Function 处理 if (typeof authority === 'function') { try { const bool = authority(currentAuthority); // 函数执行后返回值是 Promise - if (isPromise(bool)) { + if (bool instanceof Promise) { return ; } if (bool) { diff --git a/src/components/Authorized/PromiseRender.js b/src/components/Authorized/PromiseRender.js index 8e2a4059..58de6593 100644 --- a/src/components/Authorized/PromiseRender.js +++ b/src/components/Authorized/PromiseRender.js @@ -1,7 +1,9 @@ -import React from 'react'; import { Spin } from 'antd'; +import isEqual from 'lodash/isEqual'; +import React from 'react'; +import { isComponentClass } from './Secured'; -export default class PromiseRender extends React.PureComponent { +export default class PromiseRender extends React.Component { state = { component: null, }; @@ -10,10 +12,14 @@ export default class PromiseRender extends React.PureComponent { this.setRenderComponent(this.props); } - componentDidUpdate(nextProps) { - // new Props enter - this.setRenderComponent(nextProps); - } + shouldComponentUpdate = (nextProps, nextState) => { + const { component } = this.state; + if (!isEqual(nextProps, this.props)) { + this.setRenderComponent(nextProps); + } + if (nextState.component !== component) return true; + return false; + }; // set render Component : ok or error setRenderComponent(props) { @@ -37,8 +43,12 @@ export default class PromiseRender extends React.PureComponent { // Authorized render is already instantiated, children is no instantiated // Secured is not instantiated checkIsInstantiation = target => { - if (!React.isValidElement(target)) { - return target; + if (isComponentClass(target)) { + const Target = target; + return props => ; + } + if (React.isValidElement(target)) { + return props => React.cloneElement(target, props); } return () => target; }; diff --git a/src/components/Authorized/Secured.js b/src/components/Authorized/Secured.js index c935183d..25b961f0 100644 --- a/src/components/Authorized/Secured.js +++ b/src/components/Authorized/Secured.js @@ -1,31 +1,43 @@ import React from 'react'; import Exception from '../Exception'; import CheckPermissions from './CheckPermissions'; + /** * 默认不能访问任何页面 * default is "NULL" */ const Exception403 = () => ; +export const isComponentClass = component => { + if (!component) return false; + const proto = Object.getPrototypeOf(component); + if (proto === React.Component || proto === Function.prototype) return true; + return isComponentClass(proto); +}; + // Determine whether the incoming component has been instantiated // AuthorizedRoute is already instantiated // Authorized render is already instantiated, children is no instantiated // Secured is not instantiated const checkIsInstantiation = target => { - if (!React.isValidElement(target)) { - return target; + if (isComponentClass(target)) { + const Target = target; + return props => ; + } + if (React.isValidElement(target)) { + return props => React.cloneElement(target, props); } return () => target; }; /** - * 用于判断是否拥有权限访问此view权限 - * authority 支持传入 string, function:()=>boolean|Promise - * e.g. 'user' 只有user用户能访问 - * e.g. 'user,admin' user和 admin 都能访问 + * 用于判断是否拥有权限访问此 view 权限 + * authority 支持传入 string, () => boolean | Promise + * e.g. 'user' 只有 user 用户能访问 + * e.g. 'user,admin' user 和 admin 都能访问 * e.g. ()=>boolean 返回true能访问,返回false不能访问 * e.g. Promise then 能访问 catch不能访问 - * e.g. authority support incoming string, function: () => boolean | Promise + * e.g. authority support incoming string, () => boolean | Promise * e.g. 'user' only user user can access * e.g. 'user, admin' user and admin can access * e.g. () => boolean true to be able to visit, return false can not be accessed From 76e19f15b50218f0db71bc44bacbef9f6bb059ba Mon Sep 17 00:00:00 2001 From: Vitor Gultzgoff Date: Fri, 22 Mar 2019 10:52:10 -0300 Subject: [PATCH 094/109] Optional prop which is used as label for Tooltip #3761 (#3778) --- src/components/Charts/MiniProgress/index.d.ts | 1 + src/components/Charts/MiniProgress/index.js | 14 ++++++++++++-- src/locales/en-US/component.js | 1 + src/locales/pt-BR/component.js | 1 + src/locales/zh-CN/component.js | 1 + src/locales/zh-TW/component.js | 1 + 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/Charts/MiniProgress/index.d.ts b/src/components/Charts/MiniProgress/index.d.ts index 0ef158e8..6111d88d 100644 --- a/src/components/Charts/MiniProgress/index.d.ts +++ b/src/components/Charts/MiniProgress/index.d.ts @@ -1,6 +1,7 @@ import React from 'react'; export interface IMiniProgressProps { target: number; + targetLabel: string; color?: string; strokeWidth?: number; percent?: number; diff --git a/src/components/Charts/MiniProgress/index.js b/src/components/Charts/MiniProgress/index.js index 795c79b1..16ca2b7b 100644 --- a/src/components/Charts/MiniProgress/index.js +++ b/src/components/Charts/MiniProgress/index.js @@ -1,11 +1,21 @@ import React from 'react'; import { Tooltip } from 'antd'; +import { formatMessage } from 'umi/locale'; import styles from './index.less'; -const MiniProgress = ({ target, color = 'rgb(19, 194, 194)', strokeWidth, percent }) => ( +const MiniProgress = ({ + targetLabel, + target, + color = 'rgb(19, 194, 194)', + strokeWidth, + percent, +}) => (

- +
diff --git a/src/locales/en-US/component.js b/src/locales/en-US/component.js index 3ba7eeda..910f30e1 100644 --- a/src/locales/en-US/component.js +++ b/src/locales/en-US/component.js @@ -2,4 +2,5 @@ export default { 'component.tagSelect.expand': 'Expand', 'component.tagSelect.collapse': 'Collapse', 'component.tagSelect.all': 'All', + 'component.miniProgress.tooltipDefault': 'Target value', }; diff --git a/src/locales/pt-BR/component.js b/src/locales/pt-BR/component.js index 7cf9999c..d3a2c1b3 100644 --- a/src/locales/pt-BR/component.js +++ b/src/locales/pt-BR/component.js @@ -2,4 +2,5 @@ export default { 'component.tagSelect.expand': 'Expandir', 'component.tagSelect.collapse': 'Diminuir', 'component.tagSelect.all': 'Todas', + 'component.miniProgress.tooltipDefault': 'Valor alvo', }; diff --git a/src/locales/zh-CN/component.js b/src/locales/zh-CN/component.js index 1f1feadb..8d988ca0 100644 --- a/src/locales/zh-CN/component.js +++ b/src/locales/zh-CN/component.js @@ -2,4 +2,5 @@ export default { 'component.tagSelect.expand': '展开', 'component.tagSelect.collapse': '收起', 'component.tagSelect.all': '全部', + 'component.miniProgress.tooltipDefault': '目标值', }; diff --git a/src/locales/zh-TW/component.js b/src/locales/zh-TW/component.js index ba48e299..dde9eb59 100644 --- a/src/locales/zh-TW/component.js +++ b/src/locales/zh-TW/component.js @@ -2,4 +2,5 @@ export default { 'component.tagSelect.expand': '展開', 'component.tagSelect.collapse': '收起', 'component.tagSelect.all': '全部', + 'component.miniProgress.tooltipDefault': '目标值', }; From 831f9ea0196f67b0c9d1525ce971650dcc72c477 Mon Sep 17 00:00:00 2001 From: xiaohuoni <448627663@qq.com> Date: Sat, 23 Mar 2019 16:04:37 +0800 Subject: [PATCH 095/109] change exception --- src/locales/zh-CN/exception.js | 2 +- src/locales/zh-TW/exception.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/zh-CN/exception.js b/src/locales/zh-CN/exception.js index 6f645dae..1b89ab76 100644 --- a/src/locales/zh-CN/exception.js +++ b/src/locales/zh-CN/exception.js @@ -1,6 +1,6 @@ export default { 'app.exception.back': '返回首页', - 'app.exception.description.403': '抱歉,你无权访问该页面', + 'app.exception.description.403': '抱歉,你无权访问此页面', 'app.exception.description.404': '抱歉,你访问的页面不存在', 'app.exception.description.500': '抱歉,服务器出错了', }; diff --git a/src/locales/zh-TW/exception.js b/src/locales/zh-TW/exception.js index 24a26613..119140d7 100644 --- a/src/locales/zh-TW/exception.js +++ b/src/locales/zh-TW/exception.js @@ -1,6 +1,6 @@ export default { 'app.exception.back': '返回首頁', - 'app.exception.description.403': '抱歉,妳無權訪問該頁面', + 'app.exception.description.403': '抱歉,妳無權訪問此頁面', 'app.exception.description.404': '抱歉,妳訪問的頁面不存在', 'app.exception.description.500': '抱歉,服務器出錯了', }; From c51da8bf4c96be8a458f7caef16dc3e6fce9355c Mon Sep 17 00:00:00 2001 From: xiaohuoni <448627663@qq.com> Date: Sat, 23 Mar 2019 15:56:22 +0800 Subject: [PATCH 096/109] redirect of different origins will be ignored --- src/models/login.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/models/login.js b/src/models/login.js index 46bbeb7d..22a563da 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -33,8 +33,7 @@ export default { redirect = redirect.substr(redirect.indexOf('#') + 1); } } else { - window.location.href = redirect; - return; + redirect = null; } } yield put(routerRedux.replace(redirect || '/')); From c7e4983a0608df8e556d877a8083c0e944ea2590 Mon Sep 17 00:00:00 2001 From: xiaohuoni <448627663@qq.com> Date: Sat, 23 Mar 2019 09:49:26 +0800 Subject: [PATCH 097/109] fix: hasLogin redirect to login page --- src/pages/Authorized.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index e2c92e89..5889812b 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -3,9 +3,12 @@ import Redirect from 'umi/redirect'; import pathToRegexp from 'path-to-regexp'; import { connect } from 'dva'; import Authorized from '@/utils/Authorized'; +import { getAuthority } from '@/utils/authority'; +import Exception403 from '@/pages/Exception/403'; -function AuthComponent({ children, location, routerData, status }) { - const isLogin = status === 'ok'; +function AuthComponent({ children, location, routerData }) { + const auth = getAuthority(); + const isLogin = auth && auth[0] !== 'guest'; const getRouteAuthority = (path, routeData) => { let authorities; routeData.forEach(route => { @@ -21,17 +24,15 @@ function AuthComponent({ children, location, routerData, status }) { }); return authorities; }; - return ( : } + noMatch={isLogin ? : } > {children} ); } -export default connect(({ menu: menuModel, login: loginModel }) => ({ +export default connect(({ menu: menuModel }) => ({ routerData: menuModel.routerData, - status: loginModel.status, }))(AuthComponent); From 2d409d42970b309b16afa62382b594c404a154fb Mon Sep 17 00:00:00 2001 From: chen shuai Date: Mon, 25 Mar 2019 11:06:14 +0800 Subject: [PATCH 098/109] Upgrade 2.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ab530bd..d6fd19ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "2.2.1", + "version": "2.3.0", "description": "An out-of-box UI solution for enterprise applications", "private": true, "scripts": { From 81ff030b634c53bb2bd02ceebb6569126886d26d Mon Sep 17 00:00:00 2001 From: chen shuai Date: Mon, 25 Mar 2019 11:51:56 +0800 Subject: [PATCH 099/109] feat: Optimize the display of toolTips --- src/components/Charts/MiniProgress/index.js | 42 +++++++++---------- src/components/Charts/MiniProgress/index.less | 2 + src/pages/Dashboard/IntroduceRow.js | 12 +++++- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/components/Charts/MiniProgress/index.js b/src/components/Charts/MiniProgress/index.js index 16ca2b7b..6e9840f9 100644 --- a/src/components/Charts/MiniProgress/index.js +++ b/src/components/Charts/MiniProgress/index.js @@ -1,6 +1,5 @@ import React from 'react'; import { Tooltip } from 'antd'; -import { formatMessage } from 'umi/locale'; import styles from './index.less'; @@ -10,28 +9,27 @@ const MiniProgress = ({ color = 'rgb(19, 194, 194)', strokeWidth, percent, -}) => ( -
- -
- - +}) => { + return ( +
+ +
+ + +
+
+
+
- -
-
-
-); + ); +}; export default MiniProgress; diff --git a/src/components/Charts/MiniProgress/index.less b/src/components/Charts/MiniProgress/index.less index 40ba70be..e1e0b4fc 100644 --- a/src/components/Charts/MiniProgress/index.less +++ b/src/components/Charts/MiniProgress/index.less @@ -19,6 +19,8 @@ position: absolute; top: 0; bottom: 0; + z-index: 9; + width: 20px; span { position: absolute; top: 0; diff --git a/src/pages/Dashboard/IntroduceRow.js b/src/pages/Dashboard/IntroduceRow.js index 7262826f..e33a4001 100644 --- a/src/pages/Dashboard/IntroduceRow.js +++ b/src/pages/Dashboard/IntroduceRow.js @@ -1,6 +1,6 @@ import React, { memo } from 'react'; import { Row, Col, Icon, Tooltip } from 'antd'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage, formatMessage } from 'umi/locale'; import styles from './Analysis.less'; import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from '@/components/Charts'; import Trend from '@/components/Trend'; @@ -135,7 +135,15 @@ const IntroduceRow = memo(({ loading, visitData }) => ( } contentHeight={46} > - + From 223031398421b8ce3c15b17899f098e93fb68c6b Mon Sep 17 00:00:00 2001 From: chen shuai Date: Mon, 25 Mar 2019 12:04:25 +0800 Subject: [PATCH 100/109] bugfix: fix SettingDrawer style error --- src/components/SettingDrawer/index.js | 29 +++++++++++++++---------- src/components/SettingDrawer/index.less | 7 ++++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/components/SettingDrawer/index.js b/src/components/SettingDrawer/index.js index cdb28aa3..1a9be4f4 100644 --- a/src/components/SettingDrawer/index.js +++ b/src/components/SettingDrawer/index.js @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert, Tooltip } from 'antd'; import { formatMessage } from 'umi/locale'; import { CopyToClipboard } from 'react-copy-to-clipboard'; @@ -23,7 +23,7 @@ const Body = ({ children, title, style }) => ( ); @connect(({ setting }) => ({ setting })) -class SettingDrawer extends PureComponent { +class SettingDrawer extends Component { state = { collapse: false, }; @@ -207,17 +207,22 @@ class SettingDrawer extends PureComponent { - this.changeSetting('colorWeak', checked)} - />, + this.changeSetting('colorWeak', checked)} + /> + ), + }, ]} - > - {formatMessage({ id: 'app.setting.weakmode' })} - + /> Date: Mon, 25 Mar 2019 17:41:14 +0800 Subject: [PATCH 101/109] Repeated addition search (#3828) Close: #3791 Close: #3835 --- src/models/login.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/models/login.js b/src/models/login.js index 22a563da..b5d226aa 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -53,14 +53,17 @@ export default { }, }); reloadAuthorized(); - yield put( - routerRedux.replace({ - pathname: '/user/login', - search: stringify({ - redirect: window.location.href, - }), - }) - ); + // redirect + if (window.location.pathname !== '/user/login') { + yield put( + routerRedux.replace({ + pathname: '/user/login', + search: stringify({ + redirect: window.location.href, + }), + }) + ); + } }, }, From e8c8f8b90da85737bf36e47e2d875dcce53b9396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Tue, 26 Mar 2019 16:01:18 +0800 Subject: [PATCH 102/109] close page permission control (#3842) --- config/router.config.js | 5 +---- src/app.js | 35 +---------------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index e954ced9..15630ca5 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -21,10 +21,9 @@ export default [ { path: '/', component: '../layouts/BasicLayout', - Routes: ['src/pages/Authorized'], routes: [ // dashboard - { path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] }, + { path: '/', redirect: '/dashboard/analysis' }, { path: '/dashboard', name: 'dashboard', @@ -88,7 +87,6 @@ export default [ { path: '/form/advanced-form', name: 'advancedform', - authority: ['admin'], component: './Forms/AdvancedForm', }, ], @@ -162,7 +160,6 @@ export default [ { path: '/profile/advanced', name: 'advanced', - authority: ['admin'], component: './Profile/AdvancedProfile', }, ], diff --git a/src/app.js b/src/app.js index 0f35ff9a..2e98b22b 100644 --- a/src/app.js +++ b/src/app.js @@ -1,5 +1,3 @@ -import fetch from 'dva/fetch'; - export const dva = { config: { onError(err) { @@ -8,37 +6,6 @@ export const dva = { }, }; -let authRoutes = {}; - -function ergodicRoutes(routes, authKey, authority) { - routes.forEach(element => { - if (element.path === authKey) { - if (!element.authority) element.authority = []; // eslint-disable-line - Object.assign(element.authority, authority || []); - } else if (element.routes) { - ergodicRoutes(element.routes, authKey, authority); - } - return element; - }); -} - -export function patchRoutes(routes) { - Object.keys(authRoutes).map(authKey => - ergodicRoutes(routes, authKey, authRoutes[authKey].authority) - ); - window.g_routes = routes; -} - export function render(oldRender) { - fetch('/api/auth_routes') - .then(res => res.json()) - .then( - ret => { - authRoutes = ret; - oldRender(); - }, - () => { - oldRender(); - } - ); + oldRender(); } From e6fe497964d8fc298a0e9e58b96deaac85df2fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 26 Mar 2019 16:05:31 +0800 Subject: [PATCH 103/109] Revert "close page permission control (#3842)" (#3844) This reverts commit e8c8f8b90da85737bf36e47e2d875dcce53b9396. --- config/router.config.js | 5 ++++- src/app.js | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index 15630ca5..e954ced9 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -21,9 +21,10 @@ export default [ { path: '/', component: '../layouts/BasicLayout', + Routes: ['src/pages/Authorized'], routes: [ // dashboard - { path: '/', redirect: '/dashboard/analysis' }, + { path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] }, { path: '/dashboard', name: 'dashboard', @@ -87,6 +88,7 @@ export default [ { path: '/form/advanced-form', name: 'advancedform', + authority: ['admin'], component: './Forms/AdvancedForm', }, ], @@ -160,6 +162,7 @@ export default [ { path: '/profile/advanced', name: 'advanced', + authority: ['admin'], component: './Profile/AdvancedProfile', }, ], diff --git a/src/app.js b/src/app.js index 2e98b22b..0f35ff9a 100644 --- a/src/app.js +++ b/src/app.js @@ -1,3 +1,5 @@ +import fetch from 'dva/fetch'; + export const dva = { config: { onError(err) { @@ -6,6 +8,37 @@ export const dva = { }, }; +let authRoutes = {}; + +function ergodicRoutes(routes, authKey, authority) { + routes.forEach(element => { + if (element.path === authKey) { + if (!element.authority) element.authority = []; // eslint-disable-line + Object.assign(element.authority, authority || []); + } else if (element.routes) { + ergodicRoutes(element.routes, authKey, authority); + } + return element; + }); +} + +export function patchRoutes(routes) { + Object.keys(authRoutes).map(authKey => + ergodicRoutes(routes, authKey, authRoutes[authKey].authority) + ); + window.g_routes = routes; +} + export function render(oldRender) { - oldRender(); + fetch('/api/auth_routes') + .then(res => res.json()) + .then( + ret => { + authRoutes = ret; + oldRender(); + }, + () => { + oldRender(); + } + ); } From ca6453a3ab8659629b4dd17ffd71ecce5013675a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 26 Mar 2019 16:22:26 +0800 Subject: [PATCH 104/109] bugfix: fix #3576, add max-width --- src/components/Login/demo/basic.md | 125 ++++++++++++++++++----------- 1 file changed, 79 insertions(+), 46 deletions(-) diff --git a/src/components/Login/demo/basic.md b/src/components/Login/demo/basic.md index 5fbd0ca2..05475384 100644 --- a/src/components/Login/demo/basic.md +++ b/src/components/Login/demo/basic.md @@ -18,65 +18,94 @@ class LoginDemo extends React.Component { notice: '', type: 'tab2', autoLogin: true, - } + }; onSubmit = (err, values) => { - console.log('value collected ->', { ...values, autoLogin: this.state.autoLogin }); + console.log('value collected ->', { + ...values, + autoLogin: this.state.autoLogin, + }); if (this.state.type === 'tab1') { - this.setState({ - notice: '', - }, () => { - if (!err && (values.username !== 'admin' || values.password !== '888888')) { - setTimeout(() => { - this.setState({ - notice: 'The combination of username and password is incorrect!', - }); - }, 500); - } - }); + this.setState( + { + notice: '', + }, + () => { + if ( + !err && + (values.username !== 'admin' || values.password !== '888888') + ) { + setTimeout(() => { + this.setState({ + notice: + 'The combination of username and password is incorrect!', + }); + }, 500); + } + }, + ); } - } + }; onTabChange = (key) => { this.setState({ type: key, }); - } + }; changeAutoLogin = (e) => { this.setState({ autoLogin: e.target.checked, }); - } + }; render() { return ( - - - { - this.state.notice && - - } - - - - - - console.log('Get captcha!')} name="captcha" /> - -
- Keep me logged in - Forgot password -
- Login -
- Other login methods - - - - Register -
-
+
+ + + {this.state.notice && ( + + )} + + + + + + console.log('Get captcha!')} + name="captcha" + /> + +
+ + Keep me logged in + + + Forgot password + +
+ Login +
+ Other login methods + + + + + Register + +
+
+
); } } @@ -85,6 +114,10 @@ ReactDOM.render(, mountNode); ````