/** * @author jill * @date 2022/3/10 18:25 * @description 进度条 */ import React, { FunctionComponent } from 'react'; import './index.scss'; /** 进度条类型 **/ declare enum ProgressTypes { 'line' = 0, 'circle' = 1, 'dashboard' = 2 } export type ProgressType = typeof ProgressTypes[number]; /** 进度条状态 **/ declare enum ProgressStatuses { 'normal' = 0, 'exception' = 1, 'active' = 2, 'success' = 3 } /** 渐变进度条入参格式 两种 **/ export type StringGradients = { [percentage: string]: string; }; type FromToGradients = { from: string; to: string; }; type ColorStringGradients = [string, StringGradients]; export type ProgressGradient = { direction?: string; } & (StringGradients | FromToGradients); /** 进度条渐变方向 **/ export type DirectionType = 'ltr' | 'rtl' | undefined; /** 成功的进度条的配置 **/ export interface SuccessProps { /** 进度条值 **/ percent: number; /** 进度条颜色 **/ strokeColor?: string; } export interface ProgressProps { /** 自定义样式名 **/ className?: string; /** 样式 */ style?: React.CSSProperties; /** 类型,可选 line circle dashboard **/ type?: ProgressType; /** 百分比 **/ percent?: number | number[]; /** 内容的模板函数 **/ format?: (percent?: number | number[], successPercent?: number) => React.ReactNode; /** 状态,可选:success exception normal active(仅限 line) **/ status?: typeof ProgressStatuses[number]; /** 是否显示进度数值或状态图标 **/ showInfo?: boolean; /** 进度条线的宽度,单位 px **/ strokeWidth?: number; /** 进度条的样式 **/ strokeLinecap?: 'butt' | 'square' | 'round'; /** 进度条的色彩 **/ strokeColor?: string | ({ direction?: string; } & (StringGradients | FromToGradients | ColorStringGradients)); /** 未完成的分段的颜色 **/ trailColor?: string; /** 圆形进度条画布宽度,单位 px **/ width?: number; /** 成功进度条相关配置 **/ success?: SuccessProps; /** 仪表盘进度条缺口角度,可取值 0 ~ 295 **/ gapDegree?: number; /** 仪表盘进度条缺口位置 **/ gapPosition?: 'top' | 'bottom' | 'left' | 'right'; /** 进度条总共步数 **/ steps?: number; /** 渐变颜色的方向 **/ direction?: DirectionType; children?: React.ReactNode; } export declare const Progress: FunctionComponent; export default Progress;