fix(Progress): StrokeLinecap style (#46551)

This commit is contained in:
ZN1996 2023-12-22 10:26:23 +08:00 committed by GitHub
parent 4bfdfdccdb
commit 142b4d7b4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -108,14 +108,16 @@ const Line: React.FC<LineProps> = (props) => {
warning.deprecated(!('strokeWidth' in props), 'strokeWidth', 'size');
}
const percentBorderRadius = strokeLinecap === 'square' || strokeLinecap === 'butt' ? 0 : '100px';
const percentStyle: React.CSSProperties = {
width: `100%`,
height,
borderRadius,
clipPath:
direction === 'rtl'
? `inset(0 0 0 ${100 - validProgress(percent)}% round 100px)`
: `inset(0 ${100 - validProgress(percent)}% 0 0 round 100px)`,
? `inset(0 0 0 ${100 - validProgress(percent)}% round ${percentBorderRadius})`
: `inset(0 ${100 - validProgress(percent)}% 0 0 round ${percentBorderRadius})`,
...backgroundProps,
};
@ -127,8 +129,8 @@ const Line: React.FC<LineProps> = (props) => {
borderRadius,
clipPath:
direction === 'rtl'
? `inset(0 0 0 ${100 - validProgress(successPercent)}% round 100px)`
: `inset(0 ${100 - validProgress(successPercent)}% 0 0 round 100px)`,
? `inset(0 0 0 ${100 - validProgress(successPercent)}% round ${percentBorderRadius})`
: `inset(0 ${100 - validProgress(successPercent)}% 0 0 round ${percentBorderRadius})`,
backgroundColor: success?.strokeColor,
};

View File

@ -2410,7 +2410,7 @@ Array [
>
<div
class="ant-progress-bg"
style="width: 100%; height: 8px; border-radius: 0; clip-path: inset(0 25% 0 0 round 100px);"
style="width: 100%; height: 8px; border-radius: 0; clip-path: inset(0 25% 0 0 round 0);"
/>
</div>
</div>

View File

@ -2318,7 +2318,7 @@ Array [
>
<div
class="ant-progress-bg"
style="width:100%;height:8px;border-radius:0;clip-path:inset(0 25% 0 0 round 100px)"
style="width:100%;height:8px;border-radius:0;clip-path:inset(0 25% 0 0 round 0)"
/>
</div>
</div>