mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
fix ts interface error (#43123)
Co-authored-by: Ali <ali.wu@miotech.com>
This commit is contained in:
parent
88ad66015b
commit
6b4afc9c3a
@ -50,7 +50,7 @@ Properties that shared by all types.
|
||||
| success | Configs of successfully progress bar | { percent: number, strokeColor: string } | - | - |
|
||||
| trailColor | The color of unfilled part | string | - | - |
|
||||
| type | To set the type, options: `line` `circle` `dashboard` | string | `line` |
|
||||
| size | Progress size | number \| \[number, number] \| "small" \| "default" | "default" | v5.3.0 |
|
||||
| size | Progress size | number \| \[number \| string, number] \| "small" \| "default" | "default" | v5.3.0 |
|
||||
|
||||
### `type="line"`
|
||||
|
||||
|
@ -51,7 +51,7 @@ demo:
|
||||
| success | 成功进度条相关配置 | { percent: number, strokeColor: string } | - | - |
|
||||
| trailColor | 未完成的分段的颜色 | string | - | - |
|
||||
| type | 类型,可选 `line` `circle` `dashboard` | string | `line` | - |
|
||||
| size | 进度条的尺寸 | number \| \[number, number] \| "small" \| "default" | "default" | v5.3.0 |
|
||||
| size | 进度条的尺寸 | number \| \[number \| string, number] \| "small" \| "default" | "default" | v5.3.0 |
|
||||
|
||||
### `type="line"`
|
||||
|
||||
|
@ -50,7 +50,7 @@ export interface ProgressProps extends ProgressAriaProps {
|
||||
style?: React.CSSProperties;
|
||||
gapDegree?: number;
|
||||
gapPosition?: 'top' | 'bottom' | 'left' | 'right';
|
||||
size?: number | [number, number] | ProgressSize;
|
||||
size?: number | [number | string, number] | ProgressSize;
|
||||
steps?: number;
|
||||
/** @deprecated Use `success` instead */
|
||||
successPercent?: number;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { presetPrimaryColors } from '@ant-design/colors';
|
||||
import warning from '../_util/warning';
|
||||
import type { CircleProps } from './Circle';
|
||||
import type { ProgressProps } from './progress';
|
||||
import warning from '../_util/warning';
|
||||
|
||||
export function validProgress(progress?: number) {
|
||||
if (!progress || progress < 0) {
|
||||
@ -35,10 +35,10 @@ export const getPercentage = ({ percent, success, successPercent }: ProgressProp
|
||||
return [realSuccessPercent, validProgress(validProgress(percent) - realSuccessPercent)];
|
||||
};
|
||||
|
||||
export const getStrokeColor = ({ success = {}, strokeColor }: Partial<CircleProps>): (
|
||||
| string
|
||||
| Record<PropertyKey, string>
|
||||
)[] => {
|
||||
export const getStrokeColor = ({
|
||||
success = {},
|
||||
strokeColor,
|
||||
}: Partial<CircleProps>): (string | Record<PropertyKey, string>)[] => {
|
||||
const { strokeColor: successColor } = success;
|
||||
return [successColor || presetPrimaryColors.green, strokeColor || null!];
|
||||
};
|
||||
@ -62,7 +62,7 @@ export const getSize = (
|
||||
} else if (typeof size === 'number') {
|
||||
[width, height] = [size, size];
|
||||
} else {
|
||||
[width = 14, height = 8] = size;
|
||||
[width = 14, height = 8] = size as [number, number];
|
||||
}
|
||||
width *= steps;
|
||||
} else if (type === 'line') {
|
||||
@ -72,7 +72,7 @@ export const getSize = (
|
||||
} else if (typeof size === 'number') {
|
||||
[width, height] = [size, size];
|
||||
} else {
|
||||
[width = -1, height = 8] = size;
|
||||
[width = -1, height = 8] = size as [number, number];
|
||||
}
|
||||
} else if (type === 'circle' || type === 'dashboard') {
|
||||
if (typeof size === 'string' || typeof size === 'undefined') {
|
||||
@ -88,8 +88,8 @@ export const getSize = (
|
||||
);
|
||||
}
|
||||
|
||||
width = size[0] ?? size[1] ?? 120;
|
||||
height = size[0] ?? size[1] ?? 120;
|
||||
width = (size[0] ?? size[1] ?? 120) as number;
|
||||
height = (size[0] ?? size[1] ?? 120) as number;
|
||||
}
|
||||
}
|
||||
return [width, height];
|
||||
|
Loading…
Reference in New Issue
Block a user