1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import _mergeJSXProps from 'babel-helper-vue-jsx-merge-props';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util';
function isString(str) {
return typeof str === 'string';
}
export default {
name: 'Step',
props: {
prefixCls: PropTypes.string,
wrapperStyle: PropTypes.object,
itemWidth: PropTypes.string,
status: PropTypes.string,
iconPrefix: PropTypes.string,
icon: PropTypes.any,
adjustMarginRight: PropTypes.string,
stepNumber: PropTypes.string,
description: PropTypes.any,
title: PropTypes.any,
progressDot: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
tailContent: PropTypes.any,
icons: PropTypes.shape({
finish: PropTypes.any,
error: PropTypes.any
}).loose
},
methods: {
renderIconNode: function renderIconNode() {
var _iconClassName;
var h = this.$createElement;
var _getOptionProps = getOptionProps(this),
prefixCls = _getOptionProps.prefixCls,
stepNumber = _getOptionProps.stepNumber,
status = _getOptionProps.status,
iconPrefix = _getOptionProps.iconPrefix,
icons = _getOptionProps.icons;
var progressDot = this.progressDot;
if (progressDot === undefined) {
progressDot = this.$scopedSlots.progressDot;
}
var icon = getComponentFromProp(this, 'icon');
var title = getComponentFromProp(this, 'title');
var description = getComponentFromProp(this, 'description');
var iconNode = void 0;
var iconClassName = (_iconClassName = {}, _defineProperty(_iconClassName, prefixCls + '-icon', true), _defineProperty(_iconClassName, iconPrefix + 'icon', true), _defineProperty(_iconClassName, iconPrefix + 'icon-' + icon, icon && isString(icon)), _defineProperty(_iconClassName, iconPrefix + 'icon-check', !icon && status === 'finish' && icons && !icons.finish), _defineProperty(_iconClassName, iconPrefix + 'icon-close', !icon && status === 'error' && icons && !icons.error), _iconClassName);
var iconDot = h('span', { 'class': prefixCls + '-icon-dot' });
// `progressDot` enjoy the highest priority
if (progressDot) {
if (typeof progressDot === 'function') {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[progressDot({ index: stepNumber - 1, status: status, title: title, description: description, prefixCls: prefixCls })]
);
} else {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[iconDot]
);
}
} else if (icon && !isString(icon)) {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[icon]
);
} else if (icons && icons.finish && status === 'finish') {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[icons.finish]
);
} else if (icons && icons.error && status === 'error') {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[icons.error]
);
} else if (icon || status === 'finish' || status === 'error') {
iconNode = h('span', { 'class': iconClassName });
} else {
iconNode = h(
'span',
{ 'class': prefixCls + '-icon' },
[stepNumber]
);
}
return iconNode;
}
},
render: function render() {
var _classString;
var h = arguments[0];
var _getOptionProps2 = getOptionProps(this),
prefixCls = _getOptionProps2.prefixCls,
itemWidth = _getOptionProps2.itemWidth,
_getOptionProps2$stat = _getOptionProps2.status,
status = _getOptionProps2$stat === undefined ? 'wait' : _getOptionProps2$stat,
tailContent = _getOptionProps2.tailContent,
adjustMarginRight = _getOptionProps2.adjustMarginRight;
var title = getComponentFromProp(this, 'title');
var description = getComponentFromProp(this, 'description');
var classString = (_classString = {}, _defineProperty(_classString, prefixCls + '-item', true), _defineProperty(_classString, prefixCls + '-item-' + status, true), _defineProperty(_classString, prefixCls + '-item-custom', getComponentFromProp(this, 'icon')), _classString);
var stepProps = {
'class': classString,
on: this.$listeners
};
var stepItemStyle = {};
if (itemWidth) {
stepItemStyle.width = itemWidth;
}
if (adjustMarginRight) {
stepItemStyle.marginRight = adjustMarginRight;
}
return h(
'div',
_mergeJSXProps([stepProps, { style: stepItemStyle }]),
[h(
'div',
{ 'class': prefixCls + '-item-tail' },
[tailContent]
), h(
'div',
{ 'class': prefixCls + '-item-icon' },
[this.renderIconNode()]
), h(
'div',
{ 'class': prefixCls + '-item-content' },
[h(
'div',
{ 'class': prefixCls + '-item-title' },
[title]
), description && h(
'div',
{ 'class': prefixCls + '-item-description' },
[description]
)]
)]
);
}
};