|
|
|
import * as React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import omit from 'omit.js';
|
|
|
|
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
|
|
|
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
|
|
|
import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
|
|
|
|
import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
|
|
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
|
|
|
import { tuple } from '../_util/type';
|
|
|
|
import devWarning from '../_util/devWarning';
|
|
|
|
import Line from './Line';
|
|
|
|
import Circle from './Circle';
|
|
|
|
import Steps from './Steps';
|
|
|
|
import { validProgress, getSuccessPercent } from './utils';
|
|
|
|
|
|
|
|
const ProgressTypes = tuple('line', 'circle', 'dashboard');
|
|
|
|
export type ProgressType = typeof ProgressTypes[number];
|
|
|
|
const ProgressStatuses = tuple('normal', 'exception', 'active', 'success');
|
|
|
|
export type ProgressSize = 'default' | 'small';
|
|
|
|
export type StringGradients = { [percentage: string]: string };
|
|
|
|
type FromToGradients = { from: string; to: string };
|
|
|
|
export type ProgressGradient = { direction?: string } & (StringGradients | FromToGradients);
|
|
|
|
|
|
|
|
export interface SuccessProps {
|
|
|
|
percent?: number;
|
|
|
|
/** @deprecated Use `percent` instead */
|
|
|
|
progress?: number;
|
|
|
|
strokeColor?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProgressProps {
|
|
|
|
prefixCls?: string;
|
|
|
|
className?: string;
|
|
|
|
type?: ProgressType;
|
|
|
|
percent?: number;
|
|
|
|
format?: (percent?: number, successPercent?: number) => React.ReactNode;
|
|
|
|
status?: typeof ProgressStatuses[number];
|
|
|
|
showInfo?: boolean;
|
|
|
|
strokeWidth?: number;
|
|
|
|
strokeLinecap?: 'butt' | 'square' | 'round';
|
|
|
|
strokeColor?: string | ProgressGradient;
|
|
|
|
trailColor?: string;
|
|
|
|
width?: number;
|
|