mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 01:11:26 +08:00
2d2d9f60c4
* feat: support type nav style * fix: some style for review issue * fix: active hover style * chore: use navigation and upgrade rc-steps * feat: support disabled prop for Steps.Step * feat: support subTitle and improve code style * fix: navigation steps item style * test: update snap test case * fix: test steps snapshots and review style issue * fix: lint issue * fix: lint style issue of steps * fix: update steps demo for review issue * fix: steps nav style detail * fix: steps nav fix style detail * fix: Steps subtitle overflow style in firefox * docs: fix Steps new api doc
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import * as React from 'react';
|
|
import * as PropTypes from 'prop-types';
|
|
import RcSteps from 'rc-steps';
|
|
import Icon from '../icon';
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
|
|
|
export interface StepsProps {
|
|
type?: 'default' | 'navigation';
|
|
className?: string;
|
|
current?: number;
|
|
direction?: 'horizontal' | 'vertical';
|
|
iconPrefix?: string;
|
|
initial?: number;
|
|
labelPlacement?: 'horizontal' | 'vertical';
|
|
prefixCls?: string;
|
|
progressDot?: boolean | Function;
|
|
size?: 'default' | 'small';
|
|
status?: 'wait' | 'process' | 'finish' | 'error';
|
|
style?: React.CSSProperties;
|
|
onChange?: (current: number) => void;
|
|
}
|
|
|
|
export interface StepProps {
|
|
className?: string;
|
|
description?: React.ReactNode;
|
|
icon?: React.ReactNode;
|
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
status?: 'wait' | 'process' | 'finish' | 'error';
|
|
disabled?: boolean;
|
|
title?: React.ReactNode;
|
|
style?: React.CSSProperties;
|
|
}
|
|
|
|
export default class Steps extends React.Component<StepsProps, any> {
|
|
static Step = RcSteps.Step as React.ClassicComponentClass<StepProps>;
|
|
|
|
static defaultProps = {
|
|
current: 0,
|
|
};
|
|
|
|
static propTypes = {
|
|
prefixCls: PropTypes.string,
|
|
iconPrefix: PropTypes.string,
|
|
current: PropTypes.number,
|
|
};
|
|
|
|
renderSteps = ({ getPrefixCls }: ConfigConsumerProps) => {
|
|
const prefixCls = getPrefixCls('steps', this.props.prefixCls);
|
|
const iconPrefix = getPrefixCls('', this.props.iconPrefix);
|
|
const icons = {
|
|
finish: <Icon type="check" className={`${prefixCls}-finish-icon`} />,
|
|
error: <Icon type="close" className={`${prefixCls}-error-icon`} />,
|
|
};
|
|
return <RcSteps icons={icons} {...this.props} prefixCls={prefixCls} iconPrefix={iconPrefix} />;
|
|
};
|
|
|
|
render() {
|
|
return <ConfigConsumer>{this.renderSteps}</ConfigConsumer>;
|
|
}
|
|
}
|