2019-01-12 03:33:27 +00:00
|
|
|
import PropTypes from '../_util/vue-types';
|
|
|
|
import { initDefaultProps, getOptionProps } from '../_util/props-util';
|
|
|
|
import VcSteps from '../vc-steps';
|
|
|
|
import Icon from '../icon';
|
2018-03-09 10:52:31 +00:00
|
|
|
|
|
|
|
const getStepsProps = (defaultProps = {}) => {
|
|
|
|
const props = {
|
|
|
|
prefixCls: PropTypes.string,
|
|
|
|
iconPrefix: PropTypes.string,
|
|
|
|
current: PropTypes.number,
|
2018-11-30 02:50:26 +00:00
|
|
|
initial: PropTypes.number,
|
2018-12-10 05:42:19 +00:00
|
|
|
labelPlacement: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'),
|
2018-03-09 10:52:31 +00:00
|
|
|
status: PropTypes.oneOf(['wait', 'process', 'finish', 'error']),
|
|
|
|
size: PropTypes.oneOf(['default', 'small']),
|
|
|
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
2019-01-12 03:33:27 +00:00
|
|
|
progressDot: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
|
|
|
};
|
|
|
|
return initDefaultProps(props, defaultProps);
|
|
|
|
};
|
2018-03-09 10:52:31 +00:00
|
|
|
|
2018-09-19 05:21:57 +00:00
|
|
|
const Steps = {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'ASteps',
|
2018-03-09 10:52:31 +00:00
|
|
|
props: getStepsProps({
|
|
|
|
prefixCls: 'ant-steps',
|
|
|
|
iconPrefix: 'ant',
|
|
|
|
current: 0,
|
|
|
|
}),
|
2018-04-08 13:17:20 +00:00
|
|
|
Step: { ...VcSteps.Step, name: 'AStep' },
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
const props = getOptionProps(this);
|
|
|
|
const { prefixCls } = props;
|
2018-11-30 02:50:26 +00:00
|
|
|
const icons = {
|
2019-01-12 03:33:27 +00:00
|
|
|
finish: <Icon type="check" class={`${prefixCls}-finish-icon`} />,
|
|
|
|
error: <Icon type="close" class={`${prefixCls}-error-icon`} />,
|
|
|
|
};
|
2018-03-09 10:52:31 +00:00
|
|
|
const stepsProps = {
|
2018-11-09 09:51:56 +00:00
|
|
|
props: {
|
2018-11-30 02:50:26 +00:00
|
|
|
icons,
|
2018-11-30 11:58:45 +00:00
|
|
|
...props,
|
2018-11-09 09:51:56 +00:00
|
|
|
},
|
2018-03-09 10:52:31 +00:00
|
|
|
on: this.$listeners,
|
2018-03-13 02:19:00 +00:00
|
|
|
scopedSlots: this.$scopedSlots,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
return <VcSteps {...stepsProps}>{this.$slots.default}</VcSteps>;
|
2018-03-09 10:52:31 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-03-19 02:16:27 +00:00
|
|
|
|
2018-09-19 05:21:57 +00:00
|
|
|
/* istanbul ignore next */
|
2019-01-12 03:33:27 +00:00
|
|
|
Steps.install = function(Vue) {
|
|
|
|
Vue.component(Steps.name, Steps);
|
|
|
|
Vue.component(Steps.Step.name, Steps.Step);
|
|
|
|
};
|
2018-09-19 05:21:57 +00:00
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
export default Steps;
|