Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: progress add inside and bottom text position #48157

Merged
merged 50 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e5fd3ec
feat: progress add inside and bottom text position
LonelySnowman Mar 28, 2024
19660c9
feat: merge feature branch
LonelySnowman Mar 29, 2024
567e014
feat: change progress percent position api
LonelySnowman Mar 31, 2024
0aad2fa
fix: change to follow coding standards
LonelySnowman Mar 31, 2024
25ba39b
docs: reset i18n zh file
LonelySnowman Mar 31, 2024
819b23e
fix: change to follow coding standards
LonelySnowman Mar 31, 2024
c54307a
fix: change to follow coding standards
LonelySnowman Mar 31, 2024
4f4fa21
docs: reset i18n file
LonelySnowman Mar 31, 2024
776c64a
fix: change to follow coding standards
LonelySnowman Mar 31, 2024
f4e4cce
docs: reset i18n file
LonelySnowman Apr 1, 2024
5a595ba
feat: progress inner text get brighten color
LonelySnowman Apr 1, 2024
38cc44d
feat: update progress snapshots
LonelySnowman Apr 1, 2024
a8dd119
fix: progress bottom layout center
LonelySnowman Apr 1, 2024
697afd1
feat: update steps snapshots
LonelySnowman Apr 1, 2024
92bf8a3
feat: update progress snapshots
LonelySnowman Apr 1, 2024
df99c9e
feat: update config provider snapshots
LonelySnowman Apr 1, 2024
547c623
Merge branch 'feature' into feat-progress-info-inside
li-jia-nan Apr 2, 2024
6c63464
feat: progress inner text add negate color
LonelySnowman Apr 2, 2024
4dc2735
feat: update progress snapshots
LonelySnowman Apr 2, 2024
d87cf55
feat: progress inner text add light bg color
LonelySnowman Apr 4, 2024
c6ef904
feat: progress inner text add light bg color
LonelySnowman Apr 4, 2024
1e36439
fix: fix conflict merge diff
LonelySnowman Apr 9, 2024
565695a
Merge branch 'feature' into feat-progress-info-inside
li-jia-nan Apr 16, 2024
236638c
feat: change progress percentPosition api
LonelySnowman Apr 16, 2024
9312237
feat: change progress component test
LonelySnowman Apr 16, 2024
eb2ae50
feat: update progress line component snapshot
LonelySnowman Apr 16, 2024
8e219d4
Merge branch 'feature' into feat-progress-info-inside
afc163 Apr 17, 2024
c6a440e
feat: progress component outer start layout text adapt
LonelySnowman Apr 21, 2024
4c190dd
Merge branch 'feat-progress-info-inside' of github.com:LonelySnowman/…
LonelySnowman Apr 21, 2024
e8548e1
Merge branch 'feature' into feat-progress-info-inside
LonelySnowman Apr 21, 2024
9856c51
Merge branch 'feature' into feat-progress-info-inside
li-jia-nan Apr 22, 2024
a08bfdc
feat: progress line change to flex layout
LonelySnowman Apr 25, 2024
15d87c5
feat: update progress snapshots
LonelySnowman Apr 25, 2024
aa90f40
Merge branch 'feature' into feat-progress-info-inside
LonelySnowman Apr 25, 2024
8f90d94
feat: update progress line style
LonelySnowman Apr 26, 2024
2d6880b
feat: update progress line style
LonelySnowman Apr 26, 2024
7dd088a
fix: progress line reset height use inline block
LonelySnowman Apr 29, 2024
d361336
fix: change progress is line type
LonelySnowman Apr 29, 2024
cb8dfa9
fix: change progress is line type
LonelySnowman Apr 29, 2024
097108c
Merge branch 'feature' into feat-progress-info-inside
afc163 Apr 30, 2024
869fa50
fix: delete progress outer styles
LonelySnowman Apr 30, 2024
15647ac
fix: change progress line type layout
LonelySnowman May 5, 2024
d1f5773
Merge branch 'feature' into feat-progress-info-inside
li-jia-nan May 5, 2024
1b799e8
fix: progress add outer style
LonelySnowman May 5, 2024
72457b9
feat: update progress snapshots
LonelySnowman May 5, 2024
e4da3e1
fix: change progress text bright color
LonelySnowman May 5, 2024
33f84f4
fix: optimized code volume
LonelySnowman May 9, 2024
9f39a95
fix: progress delete after style on inner layout
LonelySnowman May 9, 2024
a8df1f0
Merge branch 'feature' into feat-progress-info-inside
LonelySnowman May 9, 2024
ca8d0ec
fix: update progress test file
LonelySnowman May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21792,196 +21792,196 @@ exports[`ConfigProvider components Popover prefixCls 1`] = `
exports[`ConfigProvider components Progress configProvider 1`] = `
<div
aria-valuenow="0"
class="config-progress config-progress-status-normal config-progress-line config-progress-show-info config-progress-default"
class="config-progress config-progress-status-normal config-progress-line config-progress-line-align-end config-progress-line-position-outer config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="config-progress-inner"
>
<div
class="config-progress-bg"
class="config-progress-bg config-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="config-progress-text config-progress-text-end config-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="config-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress configProvider componentDisabled 1`] = `
<div
aria-valuenow="0"
class="config-progress config-progress-status-normal config-progress-line config-progress-show-info config-progress-default"
class="config-progress config-progress-status-normal config-progress-line config-progress-line-align-end config-progress-line-position-outer config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="config-progress-inner"
>
<div
class="config-progress-bg"
class="config-progress-bg config-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="config-progress-text config-progress-text-end config-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="config-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress configProvider componentSize large 1`] = `
<div
aria-valuenow="0"
class="config-progress config-progress-status-normal config-progress-line config-progress-show-info config-progress-default"
class="config-progress config-progress-status-normal config-progress-line config-progress-line-align-end config-progress-line-position-outer config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="config-progress-inner"
>
<div
class="config-progress-bg"
class="config-progress-bg config-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="config-progress-text config-progress-text-end config-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="config-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress configProvider componentSize middle 1`] = `
<div
aria-valuenow="0"
class="config-progress config-progress-status-normal config-progress-line config-progress-show-info config-progress-default"
class="config-progress config-progress-status-normal config-progress-line config-progress-line-align-end config-progress-line-position-outer config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="config-progress-inner"
>
<div
class="config-progress-bg"
class="config-progress-bg config-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="config-progress-text config-progress-text-end config-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="config-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress configProvider componentSize small 1`] = `
<div
aria-valuenow="0"
class="config-progress config-progress-status-normal config-progress-line config-progress-show-info config-progress-default"
class="config-progress config-progress-status-normal config-progress-line config-progress-line-align-end config-progress-line-position-outer config-progress-show-info config-progress-default"
role="progressbar"
>
<div
class="config-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="config-progress-inner"
>
<div
class="config-progress-bg"
class="config-progress-bg config-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="config-progress-text config-progress-text-end config-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="config-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress normal 1`] = `
<div
aria-valuenow="0"
class="ant-progress ant-progress-status-normal ant-progress-line ant-progress-show-info ant-progress-default"
class="ant-progress ant-progress-status-normal ant-progress-line ant-progress-line-align-end ant-progress-line-position-outer ant-progress-show-info ant-progress-default"
role="progressbar"
>
<div
class="ant-progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="ant-progress-inner"
>
<div
class="ant-progress-bg"
class="ant-progress-bg ant-progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="ant-progress-text ant-progress-text-end ant-progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="ant-progress-text"
title="0%"
>
0%
</span>
</div>
`;

exports[`ConfigProvider components Progress prefixCls 1`] = `
<div
aria-valuenow="0"
class="prefix-Progress prefix-Progress-status-normal prefix-Progress-line prefix-Progress-show-info prefix-Progress-default"
class="prefix-Progress prefix-Progress-status-normal prefix-Progress-line prefix-Progress-line-align-end prefix-Progress-line-position-outer prefix-Progress-show-info prefix-Progress-default"
role="progressbar"
>
<div
class="prefix-Progress-outer"
style="width: 100%; height: 8px;"
style="width: 100%;"
>
<div
class="prefix-Progress-inner"
>
<div
class="prefix-Progress-bg"
class="prefix-Progress-bg prefix-Progress-bg-outer"
style="width: 0%; height: 8px; --progress-percent: 0;"
/>
</div>
<span
class="prefix-Progress-text prefix-Progress-text-end prefix-Progress-text-outer"
title="0%"
>
0%
</span>
</div>
<span
class="prefix-Progress-text"
title="0%"
>
0%
</span>
</div>
`;

Expand Down
51 changes: 37 additions & 14 deletions components/progress/Line.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import * as React from 'react';
import { presetPrimaryColors } from '@ant-design/colors';

import classNames from 'classnames';
import { devUseWarning } from '../_util/warning';
import type { DirectionType } from '../config-provider';
import type { ProgressGradient, ProgressProps, StringGradients } from './progress';
import type {
ProgressGradient,
ProgressProps,
StringGradients,
PercentPositionType,
} from './progress';
import { LineStrokeColorVar, Percent } from './style';
import { getSize, getSuccessPercent, validProgress } from './utils';

interface LineProps extends ProgressProps {
prefixCls: string;
direction?: DirectionType;
children: React.ReactNode;
strokeColor?: string | ProgressGradient;
percentPosition: PercentPositionType;
LonelySnowman marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -82,9 +87,12 @@ const Line: React.FC<LineProps> = (props) => {
strokeLinecap = 'round',
children,
trailColor = null,
percentPosition,
success,
} = props;

const { align: infoAlign, type: infoPosition } = percentPosition;

const backgroundProps =
strokeColor && typeof strokeColor !== 'string'
? handleGradient(strokeColor, directionConfig)
Expand Down Expand Up @@ -126,21 +134,36 @@ const Line: React.FC<LineProps> = (props) => {

const outerStyle: React.CSSProperties = {
width: width < 0 ? '100%' : width,
height,
};

return (
<>
<div className={`${prefixCls}-outer`} style={outerStyle}>
<div className={`${prefixCls}-inner`} style={trailStyle}>
<div className={`${prefixCls}-bg`} style={percentStyle} />
{successPercent !== undefined ? (
<div className={`${prefixCls}-success-bg`} style={successPercentStyle} />
) : null}
</div>
const lineInner = (
<div className={`${prefixCls}-inner`} style={trailStyle}>
<div
className={classNames(`${prefixCls}-bg`, `${prefixCls}-bg-${infoPosition}`)}
style={percentStyle}
>
{infoPosition === 'inner' && children}
</div>
{successPercent !== undefined && (
<div className={`${prefixCls}-success-bg`} style={successPercentStyle} />
)}
</div>
);

const isOuterStart = infoPosition === 'outer' && infoAlign === 'start';
const isOuterEnd = infoPosition === 'outer' && infoAlign === 'end';

return infoPosition === 'outer' && infoAlign === 'center' ? (
<div className={`${prefixCls}-layout-bottom`}>
{lineInner}
{children}
</>
</div>
) : (
<div className={`${prefixCls}-outer`} style={outerStyle}>
{isOuterStart && children}
{lineInner}
{isOuterEnd && children}
</div>
);
};

Expand Down
Loading
Loading