Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
adb37590
Commit
adb37590
authored
Oct 25, 2017
by
偏右
Committed by
GitHub
Oct 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor number info (#28)
* Add NumberInfo[gap] * Move NumberInfo outside Charts
parent
9d249064
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
72 additions
and
31 deletions
+72
-31
src/components/ActiveChart/index.js
src/components/ActiveChart/index.js
+2
-3
src/components/Charts/demo/mix.md
src/components/Charts/demo/mix.md
+2
-1
src/components/Charts/index.js
src/components/Charts/index.js
+0
-2
src/components/Charts/index.md
src/components/Charts/index.md
+0
-10
src/components/NumberInfo/demo/basic.md
src/components/NumberInfo/demo/basic.md
+29
-0
src/components/NumberInfo/index.js
src/components/NumberInfo/index.js
+6
-5
src/components/NumberInfo/index.less
src/components/NumberInfo/index.less
+6
-7
src/components/NumberInfo/index.md
src/components/NumberInfo/index.md
+19
-0
src/routes/Dashboard/Analysis.js
src/routes/Dashboard/Analysis.js
+6
-2
src/routes/Dashboard/Monitor.js
src/routes/Dashboard/Monitor.js
+2
-1
No files found.
src/components/ActiveChart/index.js
View file @
adb37590
import
React
,
{
PureComponent
}
from
'
react
'
;
import
React
,
{
PureComponent
}
from
'
react
'
;
import
{
NumberInfo
,
MiniArea
}
from
'
../Charts
'
;
import
{
MiniArea
}
from
'
../Charts
'
;
import
NumberInfo
from
'
../NumberInfo
'
;
import
{
fixedZero
}
from
'
../../utils/utils
'
;
import
{
fixedZero
}
from
'
../../utils/utils
'
;
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
...
@@ -46,9 +47,7 @@ export default class ActiveChart extends PureComponent {
...
@@ -46,9 +47,7 @@ export default class ActiveChart extends PureComponent {
<
MiniArea
<
MiniArea
animate
=
{
false
}
animate
=
{
false
}
line
line
borderColor
=
"
#00a2fc
"
borderWidth
=
{
2
}
borderWidth
=
{
2
}
color
=
"
#c9eafe
"
height
=
{
84
}
height
=
{
84
}
yAxis
=
{{
yAxis
=
{{
tickCount
:
3
,
tickCount
:
3
,
...
...
src/components/Charts/demo/mix.md
View file @
adb37590
...
@@ -6,8 +6,9 @@ title: 图表套件组合展示
...
@@ -6,8 +6,9 @@ title: 图表套件组合展示
利用 Ant Design Pro 提供的图表套件,可以灵活组合符合设计规范的图表来满足复杂的业务需求。
利用 Ant Design Pro 提供的图表套件,可以灵活组合符合设计规范的图表来满足复杂的业务需求。
````
jsx
````
jsx
import
{
ChartCard
,
yuan
,
Field
,
NumberInfo
,
MiniArea
,
MiniBar
,
MiniProgress
}
from
'
ant-design-pro/lib/Charts
'
;
import
{
ChartCard
,
yuan
,
Field
,
MiniArea
,
MiniBar
,
MiniProgress
}
from
'
ant-design-pro/lib/Charts
'
;
import
Trend
from
'
ant-design-pro/lib/Trend
'
;
import
Trend
from
'
ant-design-pro/lib/Trend
'
;
import
NumberInfo
from
'
ant-design-pro/lib/NumberInfo
'
;
import
{
Row
,
Col
,
Icon
,
Tooltip
}
from
'
antd
'
;
import
{
Row
,
Col
,
Icon
,
Tooltip
}
from
'
antd
'
;
import
numeral
from
'
numeral
'
;
import
numeral
from
'
numeral
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
...
...
src/components/Charts/index.js
View file @
adb37590
...
@@ -8,7 +8,6 @@ import MiniArea from './MiniArea';
...
@@ -8,7 +8,6 @@ import MiniArea from './MiniArea';
import
MiniBar
from
'
./MiniBar
'
;
import
MiniBar
from
'
./MiniBar
'
;
import
MiniProgress
from
'
./MiniProgress
'
;
import
MiniProgress
from
'
./MiniProgress
'
;
import
Field
from
'
./Field
'
;
import
Field
from
'
./Field
'
;
import
NumberInfo
from
'
./NumberInfo
'
;
import
WaterWave
from
'
./WaterWave
'
;
import
WaterWave
from
'
./WaterWave
'
;
import
TagCloud
from
'
./TagCloud
'
;
import
TagCloud
from
'
./TagCloud
'
;
import
TimelineChart
from
'
./TimelineChart
'
;
import
TimelineChart
from
'
./TimelineChart
'
;
...
@@ -26,7 +25,6 @@ export default {
...
@@ -26,7 +25,6 @@ export default {
MiniProgress
,
MiniProgress
,
ChartCard
,
ChartCard
,
Field
,
Field
,
NumberInfo
,
WaterWave
,
WaterWave
,
TagCloud
,
TagCloud
,
TimelineChart
,
TimelineChart
,
...
...
src/components/Charts/index.md
View file @
adb37590
...
@@ -119,16 +119,6 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
...
@@ -119,16 +119,6 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
| titleMap | 指标别名 | Object{y1: '客流量', y2: '支付笔数'} | - |
| titleMap | 指标别名 | Object{y1: '客流量', y2: '支付笔数'} | - |
| height | 高度值 | number | 400 |
| height | 高度值 | number | 400 |
### NumberInfo
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
| title | 标题 | ReactNode
\|
string | - |
| subTitle | 子标题 | ReactNode
\|
string | - |
| total | 总量 | ReactNode
\|
string | - |
| status | 增加状态 | 'up'
\/
'down' | - |
| theme | 状态样式 | string | 'light' |
### Field
### Field
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
...
...
src/components/NumberInfo/demo/basic.md
0 → 100644
View file @
adb37590
---
order
:
0
title
:
演示
---
各种数据文案的展现方式。
````
jsx
import
NumberInfo
from
'
ant-design-pro/lib/NumberInfo
'
;
import
numeral
from
'
numeral
'
;
ReactDOM
.
render
(
<
div
>
<
NumberInfo
subTitle
=
{
<
span
>
本周访问
</
span
>
}
total
=
{
numeral
(
12321
).
format
(
'
0,0
'
)
}
status
=
"up"
subTotal
=
{
17.1
}
/>
<
NumberInfo
subTitle
=
{
<
span
>
本周访问
</
span
>
}
total
=
{
numeral
(
12321
).
format
(
'
0,0
'
)
}
status
=
"up"
subTotal
=
{
17.1
}
style
=
{
{
marginTop
:
16
}
}
/>
</
div
>
,
mountNode
);
````
src/components/
Charts/
NumberInfo/index.js
→
src/components/NumberInfo/index.js
View file @
adb37590
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Icon
}
from
'
antd
'
;
import
{
Icon
}
from
'
antd
'
;
import
classNames
from
'
classnames
'
;
import
classNames
from
'
classnames
'
;
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
export
default
({
theme
,
title
,
subTitle
,
total
,
subTotal
,
status
,
suffix
,
...
rest
})
=>
(
export
default
({
theme
,
title
,
subTitle
,
total
,
subTotal
,
status
,
suffix
,
gap
,
...
rest
})
=>
(
<
div
<
div
className
=
{
className
=
{
classNames
(
styles
.
numberInfo
,
{
classNames
(
styles
.
numberInfo
,
{
...
@@ -13,9 +14,9 @@ export default ({ theme, title, subTitle, total, subTotal, status, suffix, ...re
...
@@ -13,9 +14,9 @@ export default ({ theme, title, subTitle, total, subTotal, status, suffix, ...re
}
}
{...
rest
}
{...
rest
}
>
>
{
title
&&
<
h4
>
{
title
}
<
/h4
>
}
{
title
&&
<
div
className
=
{
styles
.
numberInfoTitle
}
>
{
title
}
<
/div
>
}
{
subTitle
&&
<
h6
>
{
subTitle
}
<
/h6
>
}
{
subTitle
&&
<
div
className
=
{
styles
.
numberInfoSubTitle
}
>
{
subTitle
}
<
/div
>
}
<
div
>
<
div
className
=
{
styles
.
numberInfoValue
}
style
=
{
gap
?
{
marginTop
:
gap
}
:
null
}
>
<
span
>
<
span
>
{
total
}
{
total
}
{
suffix
&&
<
em
className
=
{
styles
.
suffix
}
>
{
suffix
}
<
/em>
}
{
suffix
&&
<
em
className
=
{
styles
.
suffix
}
>
{
suffix
}
<
/em>
}
...
...
src/components/
Charts/
NumberInfo/index.less
→
src/components/NumberInfo/index.less
View file @
adb37590
@import "~antd/lib/style/themes/default.less";
@import "~antd/lib/style/themes/default.less";
@import "../../
../
utils/utils.less";
@import "../../utils/utils.less";
.numberInfo {
.numberInfo {
.suffix {
.suffix {
...
@@ -8,22 +8,21 @@
...
@@ -8,22 +8,21 @@
font-style: normal;
font-style: normal;
margin-left: 4px;
margin-left: 4px;
}
}
h4
{
.numberInfoTitle
{
color: @text-color;
color: @text-color;
font-size: @font-size-lg;
font-size: @font-size-lg;
margin-bottom: 16px;
margin-bottom: 16px;
transition: all .3s;
transition: all .3s;
}
}
h6
{
.numberInfoSubTitle
{
color: @text-color-secondary;
color: @text-color-secondary;
font-size: @font-size-base;
font-size: @font-size-base;
font-weight: normal;
height: 22px;
height: 22px;
line-height: 22px;
line-height: 22px;
.textOverflow();
.textOverflow();
}
}
& > div
{
.numberInfoValue
{
margin-top:
8
px;
margin-top:
4
px;
font-size: 0;
font-size: 0;
.textOverflow();
.textOverflow();
& > span {
& > span {
...
@@ -48,7 +47,7 @@
...
@@ -48,7 +47,7 @@
}
}
}
}
.numberInfolight {
.numberInfolight {
& > div
{
.numberInfoValue
{
& > span {
& > span {
color: @text-color;
color: @text-color;
}
}
...
...
src/components/NumberInfo/index.md
0 → 100644
View file @
adb37590
---
type
:
General
title
:
NumberInfo
subtitle
:
数据文本
cols
:
1
---
常用在数据卡片中,用于突出展示某个业务数据。
## API
参数 | 说明 | 类型 | 默认值
----|------|-----|------
title | 标题 | ReactNode
\|
string | -
subTitle | 子标题 | ReactNode
\|
string | -
total | 总量 | ReactNode
\|
string | -
status | 增加状态 | 'up'
\/
'down' | -
theme | 状态样式 | string | 'light'
gap | 设置数字和描述直接的间距(像素) | number | 8
src/routes/Dashboard/Analysis.js
View file @
adb37590
...
@@ -3,9 +3,10 @@ import { connect } from 'dva';
...
@@ -3,9 +3,10 @@ import { connect } from 'dva';
import
{
Row
,
Col
,
Icon
,
Card
,
Tabs
,
Table
,
Radio
,
DatePicker
,
Tooltip
}
from
'
antd
'
;
import
{
Row
,
Col
,
Icon
,
Card
,
Tabs
,
Table
,
Radio
,
DatePicker
,
Tooltip
}
from
'
antd
'
;
import
numeral
from
'
numeral
'
;
import
numeral
from
'
numeral
'
;
import
{
import
{
ChartCard
,
yuan
,
MiniArea
,
MiniBar
,
MiniProgress
,
Field
,
Bar
,
Pie
,
NumberInfo
,
TimelineChart
,
ChartCard
,
yuan
,
MiniArea
,
MiniBar
,
MiniProgress
,
Field
,
Bar
,
Pie
,
TimelineChart
,
}
from
'
../../components/Charts
'
;
}
from
'
../../components/Charts
'
;
import
Trend
from
'
../../components/Trend
'
;
import
Trend
from
'
../../components/Trend
'
;
import
NumberInfo
from
'
../../components/NumberInfo
'
;
import
{
getTimeDistance
}
from
'
../../utils/utils
'
;
import
{
getTimeDistance
}
from
'
../../utils/utils
'
;
import
styles
from
'
./Analysis.less
'
;
import
styles
from
'
./Analysis.less
'
;
...
@@ -178,7 +179,8 @@ export default class Analysis extends Component {
...
@@ -178,7 +179,8 @@ export default class Analysis extends Component {
<
NumberInfo
<
NumberInfo
title
=
{
data
.
name
}
title
=
{
data
.
name
}
subTitle
=
"
转化率
"
subTitle
=
"
转化率
"
total
=
{
<
span
style
=
{{
top
:
'
-6px
'
,
position
:
'
relative
'
}}
>
{
data
.
cvr
*
100
}
%<
/span>
}
gap
=
{
2
}
total
=
{
`
${
data
.
cvr
*
100
}
%`
}
theme
=
{(
currentKey
!==
data
.
name
)
&&
'
light
'
}
theme
=
{(
currentKey
!==
data
.
name
)
&&
'
light
'
}
/
>
/
>
<
/Col
>
<
/Col
>
...
@@ -370,6 +372,7 @@ export default class Analysis extends Component {
...
@@ -370,6 +372,7 @@ export default class Analysis extends Component {
<
/Tooltip
>
<
/Tooltip
>
<
/span
>
<
/span
>
}
}
gap
=
{
8
}
total
=
{
numeral
(
12321
).
format
(
'
0,0
'
)}
total
=
{
numeral
(
12321
).
format
(
'
0,0
'
)}
status
=
"
up
"
status
=
"
up
"
subTotal
=
{
17.1
}
subTotal
=
{
17.1
}
...
@@ -386,6 +389,7 @@ export default class Analysis extends Component {
...
@@ -386,6 +389,7 @@ export default class Analysis extends Component {
total
=
{
2.7
}
total
=
{
2.7
}
status
=
"
down
"
status
=
"
down
"
subTotal
=
{
26.2
}
subTotal
=
{
26.2
}
gap
=
{
8
}
/
>
/
>
<
MiniArea
<
MiniArea
line
line
...
...
src/routes/Dashboard/Monitor.js
View file @
adb37590
...
@@ -3,7 +3,8 @@ import { connect } from 'dva';
...
@@ -3,7 +3,8 @@ import { connect } from 'dva';
import
{
Row
,
Col
,
Card
}
from
'
antd
'
;
import
{
Row
,
Col
,
Card
}
from
'
antd
'
;
import
numeral
from
'
numeral
'
;
import
numeral
from
'
numeral
'
;
import
{
NumberInfo
,
Pie
,
WaterWave
,
Gauge
,
TagCloud
}
from
'
../../components/Charts
'
;
import
{
Pie
,
WaterWave
,
Gauge
,
TagCloud
}
from
'
../../components/Charts
'
;
import
NumberInfo
from
'
../../components/NumberInfo
'
;
import
CountDown
from
'
../../components/CountDown
'
;
import
CountDown
from
'
../../components/CountDown
'
;
import
ActiveChart
from
'
../../components/ActiveChart
'
;
import
ActiveChart
from
'
../../components/ActiveChart
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment