Skip to content

Commit

Permalink
🆙 upgrade rc-progress to 2.4.0 (#17168)
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored and zombieJ committed Jun 19, 2019
1 parent d0799fb commit a30dd26
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 74 deletions.
12 changes: 8 additions & 4 deletions components/progress/Circle.tsx
Expand Up @@ -17,15 +17,19 @@ const statusColorMap: Record<string, string> = {

function getPercentage({ percent, successPercent }: CircleProps) {
const ptg = validProgress(percent);
if (!successPercent) return ptg;
if (!successPercent) {
return ptg;
}

const successPtg = validProgress(successPercent);
return [successPercent, validProgress(ptg - successPtg)];
}

function getStrokeColor({ progressStatus, successPercent, strokeColor }: CircleProps) {
const color = strokeColor || statusColorMap[progressStatus];
if (!successPercent) return color;
if (!successPercent) {
return color;
}
return [statusColorMap.success, color];
}

Expand All @@ -49,15 +53,15 @@ const Circle: React.SFC<CircleProps> = props => {
};
const circleWidth = strokeWidth || 6;
const gapPos = gapPosition || (type === 'dashboard' && 'bottom') || 'top';
const gapDeg = gapDegree || (type === 'dashboard' && 75);
const gapDeg = gapDegree ? gapDegree : (type === 'dashboard' ? 75 : 0);

return (
<div className={`${prefixCls}-inner`} style={circleStyle}>
<RCCircle
percent={getPercentage(props)}
strokeWidth={circleWidth}
trailWidth={circleWidth}
strokeColor={getStrokeColor(props)}
strokeColor={getStrokeColor(props) as string}
strokeLinecap={strokeLinecap}
trailColor={trailColor}
prefixCls={prefixCls}
Expand Down
128 changes: 64 additions & 64 deletions components/progress/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -16,8 +16,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -27,8 +27,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -57,8 +57,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -68,8 +68,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -115,8 +115,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -126,8 +126,8 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -178,8 +178,8 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -189,8 +189,8 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="0"
Expand Down Expand Up @@ -279,8 +279,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -290,8 +290,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -320,8 +320,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -331,8 +331,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -378,8 +378,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -389,8 +389,8 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -440,8 +440,8 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -451,8 +451,8 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -569,8 +569,8 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -580,8 +580,8 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -610,8 +610,8 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -621,8 +621,8 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
Expand Down Expand Up @@ -1023,8 +1023,8 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="square"
Expand All @@ -1034,8 +1034,8 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="square"
stroke-width="6"
Expand Down Expand Up @@ -1064,8 +1064,8 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="square"
Expand All @@ -1075,8 +1075,8 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke-linecap="square"
stroke-width="6"
Expand Down Expand Up @@ -1138,8 +1138,8 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -1149,22 +1149,22 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
style="stroke:#87d068;stroke-dasharray:88.59291283123217px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
style="stroke:#108ee9;stroke-dasharray:88.59291283123217px 295.3097094374406px;stroke-dashoffset:-88.59291283123217px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
/>
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,-47
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
a 47,47 0 1 1 0,94
a 47,47 0 1 1 0,-94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
style="stroke:#108ee9;stroke-dasharray:88.59291283123217px 295.3097094374406px;stroke-dashoffset:-88.59291283123217px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
style="stroke:#87d068;stroke-dasharray:88.59291283123217px 295.3097094374406px;stroke-dashoffset:-0px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
/>
</svg>
<span
Expand All @@ -1189,8 +1189,8 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
<path
class="ant-progress-circle-trail"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke="#f3f3f3"
stroke-linecap="round"
Expand All @@ -1200,22 +1200,22 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
style="stroke:#87d068;stroke-dasharray:66.09291283123217px 295.3097094374406px;stroke-dashoffset:-37.5px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
style="stroke:#108ee9;stroke-dasharray:66.09291283123217px 295.3097094374406px;stroke-dashoffset:-103.59291283123217px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
/>
<path
class="ant-progress-circle-path"
d="M 50,50 m 0,47
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
a 47,47 0 1 1 0,-94
a 47,47 0 1 1 0,94"
fill-opacity="0"
stroke-linecap="round"
stroke-width="6"
style="stroke:#108ee9;stroke-dasharray:66.09291283123217px 295.3097094374406px;stroke-dashoffset:-103.59291283123217px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
style="stroke:#87d068;stroke-dasharray:66.09291283123217px 295.3097094374406px;stroke-dashoffset:-37.5px;transition:stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
/>
</svg>
<span
Expand Down

0 comments on commit a30dd26

Please sign in to comment.