diff --git a/package.json b/package.json index 5f3cb6cabbab9c56d8b7bcf29c49cc2160b44c14..ac8c29c9ac5ade7a58a35cc4e1f3953b141916f5 100755 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "classnames": "^2.2.5", "dva": "^2.1.0", "dva-loading": "^1.0.4", - "enquire-js": "^0.1.1", + "enquire-js": "^0.2.1", "lodash": "^4.17.4", "lodash-decorators": "^4.4.1", "moment": "^2.19.1", diff --git a/src/components/DescriptionList/demo/basic.md b/src/components/DescriptionList/demo/basic.md index 8dd853474d880d7a1e72510384fd90185f593522..87954551e6fa564d56d327d4ca330f43f5e6c1b7 100644 --- a/src/components/DescriptionList/demo/basic.md +++ b/src/components/DescriptionList/demo/basic.md @@ -1,10 +1,18 @@ --- order: 0 -title: Basic +title: + zh-CN: 基本 + en-US: Basic --- +## zh-CN + 基本描述列表。 +## en-US + +Basic DescriptionList. + ````jsx import DescriptionList from 'ant-design-pro/lib/DescriptionList'; diff --git a/src/components/DescriptionList/demo/vertical.md b/src/components/DescriptionList/demo/vertical.md index a304f946bf2cbb819ef0d7808994130d358dd488..2742f7c9f6b0a907570617ab422b5341a2151a4b 100644 --- a/src/components/DescriptionList/demo/vertical.md +++ b/src/components/DescriptionList/demo/vertical.md @@ -1,10 +1,18 @@ --- order: 1 -title: Vertical +title: + zh-CN: 垂直型 + en-US: Vertical --- +## zh-CN + 垂直布局。 +## en-US + +Vertical layout. + ````jsx import DescriptionList from 'ant-design-pro/lib/DescriptionList'; diff --git a/src/components/DescriptionList/index.en-US.md b/src/components/DescriptionList/index.en-US.md new file mode 100644 index 0000000000000000000000000000000000000000..089f30b1a1502bd6bfd8754821870e5db5df55ac --- /dev/null +++ b/src/components/DescriptionList/index.en-US.md @@ -0,0 +1,33 @@ +--- +title: DescriptionList +cols: 1 +order: 4 +--- + +Groups display multiple read-only fields, which are common to informational displays on detail pages. + +## API + +### DescriptionList + +| Property | Description | Type | Default | +|----------|------------------------------------------|-------------|---------| +| layout | type of layout | Enum{'horizontal', 'vertical'} | 'horizontal' | +| col | specify the maximum number of columns to display, the final columns number is determined by col setting combined with [Responsive Rules](/components/DescriptionList#Responsive-Rules) | number(0 < col <= 4) | 3 | +| title | title | ReactNode | - | +| gutter | specify the distance between two items, unit is `px` | number | 32 | +| size | size of list | Enum{'large', 'small'} | - | + +#### Responsive Rules + +| Window Width | Columns Number | +|---------------------|---------------------------------------------| +| `≥768px` | `col` | +| `≥576px` | `col < 2 ? col : 2` | +| `<576px` | `1` | + +### DescriptionList.Description + +| Property | Description | Type | Default | +|----------|------------------------------------------|-------------|-------| +| term | item title | ReactNode | - | diff --git a/src/components/DescriptionList/index.md b/src/components/DescriptionList/index.zh-CN.md similarity index 90% rename from src/components/DescriptionList/index.md rename to src/components/DescriptionList/index.zh-CN.md index bfa60cb8aa565e9a4bb88e5bc7213a4894ca516b..b16a7fe76907bdffb1fa20c53ac1ba72552f19d3 100644 --- a/src/components/DescriptionList/index.md +++ b/src/components/DescriptionList/index.zh-CN.md @@ -1,7 +1,5 @@ --- -title: - en-US: DescriptionList - zh-CN: DescriptionList +title: DescriptionList subtitle: 描述列表 cols: 1 order: 4 @@ -19,7 +17,7 @@ order: 4 | col | 指定信息最多分几列展示,最终一行几列由 col 配置结合[响应式规则](/components/DescriptionList#响应式规则)决定 | number(0 < col <= 4) | 3 | | title | 列表标题 | ReactNode | - | | gutter | 列表项间距,单位为 `px` | number | 32 | -| size | 列表型号,可以设置为 `large` `small` | Enum{'large', 'small'} | - | +| size | 列表型号 | Enum{'large', 'small'} | - | #### 响应式规则 diff --git a/src/components/Ellipsis/demo/line.md b/src/components/Ellipsis/demo/line.md index 60b804c6b132b58fa526ed03ebe0e8edf14560de..bc31170dc317f3f9a942fd041fd16350aba60858 100644 --- a/src/components/Ellipsis/demo/line.md +++ b/src/components/Ellipsis/demo/line.md @@ -1,12 +1,23 @@ --- order: 1 -title: 按照行数省略 +title: + zh-CN: 按照行数省略 + en-US: Truncate according to the number of rows --- +## zh-CN + 通过设置 `lines` 属性指定最大行数,如果超过这个行数的文本会自动截取。但是在这种模式下所有 `children` 将会被转换成纯文本。 并且注意在这种模式下,外容器需要有指定的宽度(或设置自身宽度)。 +## en-US + +`lines` attribute specifies the maximum number of rows where the text will automatically be truncated when exceeded. In this mode, all children will be converted to plain text. + +Also note that, in this mode, the outer container needs to have a specified width (or set its own width). + + ````jsx import Ellipsis from 'ant-design-pro/lib/Ellipsis'; diff --git a/src/components/Ellipsis/demo/number.md b/src/components/Ellipsis/demo/number.md index 9302bb8588fb295655ac6d0a445c13be727d51ff..0bc1a0ff7847711f27ac85aa98ae222d14904be4 100644 --- a/src/components/Ellipsis/demo/number.md +++ b/src/components/Ellipsis/demo/number.md @@ -1,10 +1,18 @@ --- order: 0 -title: 按照字符数省略 +title: + zh-CN: 按照字符数省略 + en-US: Truncate according to the number of character --- +## zh-CN + 通过设置 `length` 属性指定文本最长长度,如果超过这个长度会自动截取。 +## en-US + +`length` attribute specifies the maximum length where the text will automatically be truncated when exceeded. + ````jsx import Ellipsis from 'ant-design-pro/lib/Ellipsis'; diff --git a/src/components/Ellipsis/index.en-US.md b/src/components/Ellipsis/index.en-US.md new file mode 100644 index 0000000000000000000000000000000000000000..fa5beb6433328c72e584fa6178c1fededd54a8ef --- /dev/null +++ b/src/components/Ellipsis/index.en-US.md @@ -0,0 +1,15 @@ +--- +title: Ellipsis +cols: 1 +order: 10 +--- + +When the text is too long, the Ellipsis automatically shortens it according to its length or the maximum number of lines. + +## API + +Property | Description | Type | Default +----|------|-----|------ +tooltip | tooltip for showing the full text content when hovering over | boolean | - +length | maximum number of characters in the text before being truncated | number | - +lines | maximum number of rows in the text before being truncated | number | `1` diff --git a/src/components/Ellipsis/index.md b/src/components/Ellipsis/index.zh-CN.md similarity index 91% rename from src/components/Ellipsis/index.md rename to src/components/Ellipsis/index.zh-CN.md index e53cd1cec5d173c0ce8e4e6dc613c7a4d4b24124..8fe98bb065e4571edbaf2c2181ea5277762d64e4 100644 --- a/src/components/Ellipsis/index.md +++ b/src/components/Ellipsis/index.zh-CN.md @@ -1,7 +1,5 @@ --- -title: - en-US: Ellipsis - zh-CN: Ellipsis +title: Ellipsis subtitle: 文本自动省略号 cols: 1 order: 10 diff --git a/src/components/Exception/demo/403.md b/src/components/Exception/demo/403.md index 85f0ad07284a998f5018b5b3df51842f8f347994..bb46037fea8daa2732c466c26c54f45a47d0fe22 100644 --- a/src/components/Exception/demo/403.md +++ b/src/components/Exception/demo/403.md @@ -1,18 +1,26 @@ --- order: 2 -title: 403 +title: + zh-CN: 403 + en-US: 403 --- +## zh-CN + 403 页面,配合自定义操作。 +## en-US + +403 page with custom operations. + ````jsx import Exception from 'ant-design-pro/lib/Exception'; import { Button } from 'antd'; const actions = (
- - + +
); ReactDOM.render( diff --git a/src/components/Exception/demo/404.md b/src/components/Exception/demo/404.md index 6ff2de78d75d19b0fe63f918cd81023c28821a72..db50de653eb2acb08c5ed4a0aa83ee3ff73e3180 100644 --- a/src/components/Exception/demo/404.md +++ b/src/components/Exception/demo/404.md @@ -1,10 +1,18 @@ --- order: 0 -title: 404 +title: + zh-CN: 404 + en-US: 404 --- +## zh-CN + 404 页面。 +## en-US + +404 page. + ````jsx import Exception from 'ant-design-pro/lib/Exception'; diff --git a/src/components/Exception/demo/500.md b/src/components/Exception/demo/500.md index 0ed9cedb5adc3a8a70ee1e77890c3e2bd599efa3..096ca8e511d2b19c952a68a9d1c8da606e747b28 100644 --- a/src/components/Exception/demo/500.md +++ b/src/components/Exception/demo/500.md @@ -1,10 +1,18 @@ --- order: 1 -title: 500 +title: + zh-CN: 500 + en-US: 500 --- +## zh-CN + 500 页面。 +## en-US + +500 page. + ````jsx import Exception from 'ant-design-pro/lib/Exception'; diff --git a/src/components/Exception/index.en-US.md b/src/components/Exception/index.en-US.md new file mode 100644 index 0000000000000000000000000000000000000000..320b0e719887df81b4773b74859ac7b55f3de12d --- /dev/null +++ b/src/components/Exception/index.en-US.md @@ -0,0 +1,18 @@ +--- +title: Exception +cols: 1 +order: 5 +--- + +Exceptions page is used to provide feedback on specific abnormal state. Usually, it contains an explanation of the error status, and provides users with suggestions or operations, to prevent users from feeling lost and confused. + +## API + +Property | Description | Type | Default +---------|-------------|------|-------- +type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | - +title | title | ReactNode | - +desc | supplementary description | ReactNode | - +img | the url of background image | string | - +actions | suggested operations, a default 'Home' link will show if not set | ReactNode | - +linkElement | to specify the element of link | string\|ReactElement | 'a' \ No newline at end of file diff --git a/src/components/Exception/index.md b/src/components/Exception/index.zh-CN.md similarity index 87% rename from src/components/Exception/index.md rename to src/components/Exception/index.zh-CN.md index 844146e0a095358974577a10506c3e66b5aca0dc..13e4e7eff0d620f4bd40c0098d7226c871923d43 100644 --- a/src/components/Exception/index.md +++ b/src/components/Exception/index.zh-CN.md @@ -1,7 +1,5 @@ --- -title: - en-US: Exception - zh-CN: Exception +title: Exception subtitle: 异常 cols: 1 order: 5 @@ -18,4 +16,4 @@ order: 5 | desc | 补充描述 | ReactNode | - | | img | 背景图片地址 | string | - | | actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效 | ReactNode | - | -| linkElement | 定义链接的元素,默认为 `a` | string\|ReactElement | - | +| linkElement | 定义链接的元素 | string\|ReactElement | 'a' | diff --git a/src/components/Login/index.js b/src/components/Login/index.js index 7847c80ccea7bd6d13cfc9d8529226b9b247d1d5..686358e0f45175c5240c1579080571c641aa692d 100644 --- a/src/components/Login/index.js +++ b/src/components/Login/index.js @@ -8,7 +8,6 @@ import LoginSubmit from './LoginSubmit'; import styles from './index.less'; import LoginContext from './loginContext'; -@Form.create() class Login extends Component { static defaultProps = { className: '', @@ -117,4 +116,4 @@ Object.keys(LoginItem).forEach(item => { Login[item] = LoginItem[item]; }); -export default Login; +export default Form.create()(Login); diff --git a/src/components/NumberInfo/demo/basic.md b/src/components/NumberInfo/demo/basic.md index a8ce97aca95a8882d61df61db98ae92ef34d339e..b399655ee40e07588b444110458e30b237a88a71 100644 --- a/src/components/NumberInfo/demo/basic.md +++ b/src/components/NumberInfo/demo/basic.md @@ -1,10 +1,18 @@ --- order: 0 -title: 演示 +title: + zh-CN: 演示 + en-US: Demo --- +## zh-CN + 各种数据文案的展现方式。 +## en-US + +Used for presenting various numerical data. + ````jsx import NumberInfo from 'ant-design-pro/lib/NumberInfo'; import numeral from 'numeral'; @@ -12,7 +20,7 @@ import numeral from 'numeral'; ReactDOM.render(
本周访问} + subTitle={Visits this week} total={numeral(12321).format('0,0')} status="up" subTotal={17.1} diff --git a/src/components/NumberInfo/index.en-US.md b/src/components/NumberInfo/index.en-US.md new file mode 100644 index 0000000000000000000000000000000000000000..b82afbe4f218b36603fa0c37dbb6431696d5f3ee --- /dev/null +++ b/src/components/NumberInfo/index.en-US.md @@ -0,0 +1,19 @@ +--- +title: NumberInfo +cols: 1 +order: 10 +--- + +Often used in data cards for highlighting the business data. + +## API + +Property | Description | Type | Default +----|------|-----|------ +title | title | ReactNode\|string | - +subTitle | subtitle | ReactNode\|string | - +total | total amount | ReactNode\|string | - +subTotal | total amount of additional information | ReactNode\|string | - +status | increase state | 'up \| down' | - +theme | state style | string | 'light' +gap | set the spacing (pixels) between numbers and descriptions | number | 8 diff --git a/src/components/NumberInfo/index.md b/src/components/NumberInfo/index.zh-CN.md similarity index 79% rename from src/components/NumberInfo/index.md rename to src/components/NumberInfo/index.zh-CN.md index 1116f990d76e9f742defca2a9d3c9d6cfd4a6027..719853948654a5c57939640cd35b9212adde365b 100644 --- a/src/components/NumberInfo/index.md +++ b/src/components/NumberInfo/index.zh-CN.md @@ -1,7 +1,5 @@ --- -title: - en-US: NumberInfo - zh-CN: NumberInfo +title: NumberInfo subtitle: 数据文本 cols: 1 order: 10 @@ -19,4 +17,4 @@ total | 总量 | ReactNode\|string | - subTotal | 子总量 | ReactNode\|string | - status | 增加状态 | 'up \| down' | - theme | 状态样式 | string | 'light' -gap | 设置数字和描述直接的间距(像素) | number | 8 +gap | 设置数字和描述之间的间距(像素)| number | 8 diff --git a/src/layouts/LoadingPage.js b/src/layouts/LoadingPage.js index 9ac550a121bedbcad15d6b3bcaf3f40e913c6c7c..5b3356a6b61a6b3e3a4220ae1aa57831948b8669 100644 --- a/src/layouts/LoadingPage.js +++ b/src/layouts/LoadingPage.js @@ -1,10 +1,10 @@ import React, { PureComponent } from 'react'; import { Spin } from 'antd'; -import { enquireScreen } from 'enquire-js'; import { connect } from 'dva'; +import { enquireScreen, unenquireScreen } from 'enquire-js'; + import BasicLayout from './BasicLayout'; import { getMenuData } from '../common/menu'; - /** * 根据菜单取得重定向地址. */ @@ -12,14 +12,14 @@ import { getMenuData } from '../common/menu'; const MenuData = getMenuData(); const getRedirectData = () => { const redirectData = []; - const getRedirect = (item) => { + const getRedirect = item => { if (item && item.children) { if (item.children[0] && item.children[0].path) { redirectData.push({ from: `${item.path}`, to: `${item.children[0].path}`, }); - item.children.forEach((children) => { + item.children.forEach(children => { getRedirect(children); }); } @@ -35,8 +35,9 @@ class LoadingPage extends PureComponent { loading: true, isMobile: false, }; + componentDidMount() { - enquireScreen((mobile) => { + this.enquireHandler = enquireScreen(mobile => { this.setState({ isMobile: mobile, }); @@ -48,7 +49,7 @@ class LoadingPage extends PureComponent { const settingString = urlParams.searchParams.get('setting'); if (settingString) { const setting = {}; - settingString.split(';').forEach((keyValue) => { + settingString.split(';').forEach(keyValue => { const [key, value] = keyValue.split(':'); setting[key] = value; }); @@ -59,6 +60,9 @@ class LoadingPage extends PureComponent { } this.hideLoading(); } + componentWillUnmount() { + unenquireScreen(this.enquireHandler); + } hideLoading() { this.setState({ loading: false, diff --git a/src/utils/request.js b/src/utils/request.js index 09fdf7fb33cf5a2335a1f8d9f9a87c9faccee3d0..591da964f5c9f08118bfb6c1e2daafcdaea4def0 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -59,7 +59,6 @@ export default function request(url, options) { // newOptions.body is FormData newOptions.headers = { Accept: 'application/json', - 'Content-Type': 'multipart/form-data', ...newOptions.headers, }; }