@didaoktv/didaoui-uniapp 2.9.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/dd-cell/dd-cell.vue +20 -13
- package/components/dd-cell-group/dd-cell-group.vue +24 -3
- package/components/dd-field/dd-field.vue +13 -8
- package/components/dd-list-cell/dd-list-cell.vue +30 -7
- package/components/dd-price/dd-price.vue +13 -4
- package/components/dd-step/dd-step.vue +96 -35
- package/components/dd-steps/dd-steps.vue +6 -2
- package/package.json +1 -1
|
@@ -51,7 +51,8 @@ interface Props {
|
|
|
51
51
|
label?: string
|
|
52
52
|
value?: string
|
|
53
53
|
icon?: string
|
|
54
|
-
|
|
54
|
+
/** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
|
|
55
|
+
size?: 'sm' | 'md' | 'lg'
|
|
55
56
|
isLink?: boolean
|
|
56
57
|
arrowDirection?: 'left' | 'right' | 'up' | 'down'
|
|
57
58
|
required?: boolean | 'auto'
|
|
@@ -70,7 +71,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
70
71
|
label: '',
|
|
71
72
|
value: '',
|
|
72
73
|
icon: '',
|
|
73
|
-
size: '
|
|
74
|
+
size: 'md',
|
|
74
75
|
isLink: false,
|
|
75
76
|
arrowDirection: 'right',
|
|
76
77
|
required: false,
|
|
@@ -129,15 +130,21 @@ function handleClick(e: Event) {
|
|
|
129
130
|
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
130
131
|
@include dd-hairline-bottom(var(--dd-border-subtle, #{$dd-border-subtle}));
|
|
131
132
|
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
// 尺寸档由竖直 padding(8/12/16px)+ 根字号(12/14/16px)派生,横向留白恒定;
|
|
134
|
+
// 子元素字号统一用 em 跟随根字号,避免逐档重复声明
|
|
135
|
+
padding-top: $dd-space-3;
|
|
136
|
+
padding-bottom: $dd-space-3;
|
|
137
|
+
|
|
138
|
+
&--sm {
|
|
139
|
+
padding-top: $dd-space-2;
|
|
140
|
+
padding-bottom: $dd-space-2;
|
|
141
|
+
font-size: $dd-font-size-caption;
|
|
136
142
|
}
|
|
137
143
|
|
|
138
|
-
&--
|
|
144
|
+
&--lg {
|
|
139
145
|
padding-top: $dd-space-4;
|
|
140
146
|
padding-bottom: $dd-space-4;
|
|
147
|
+
font-size: $dd-font-size-lead;
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
&--center {
|
|
@@ -164,14 +171,14 @@ function handleClick(e: Event) {
|
|
|
164
171
|
}
|
|
165
172
|
|
|
166
173
|
&__icon-text {
|
|
167
|
-
font-size:
|
|
174
|
+
font-size: 1.286em;
|
|
168
175
|
line-height: 1;
|
|
169
176
|
color: var(--dd-primary-400, #{$dd-primary-400});
|
|
170
177
|
}
|
|
171
178
|
|
|
172
179
|
&__required {
|
|
173
180
|
color: var(--dd-error, #{$dd-error});
|
|
174
|
-
font-size:
|
|
181
|
+
font-size: 1em;
|
|
175
182
|
margin-right: 4rpx;
|
|
176
183
|
line-height: inherit;
|
|
177
184
|
text {
|
|
@@ -188,14 +195,14 @@ function handleClick(e: Event) {
|
|
|
188
195
|
}
|
|
189
196
|
|
|
190
197
|
&__title {
|
|
191
|
-
font-size:
|
|
198
|
+
font-size: 1em;
|
|
192
199
|
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
193
200
|
@include dd-ellipsis(1);
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
&__label {
|
|
197
204
|
margin-top: 4rpx;
|
|
198
|
-
font-size:
|
|
205
|
+
font-size: 0.857em;
|
|
199
206
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
200
207
|
@include dd-ellipsis(1);
|
|
201
208
|
}
|
|
@@ -209,12 +216,12 @@ function handleClick(e: Event) {
|
|
|
209
216
|
}
|
|
210
217
|
|
|
211
218
|
&__value {
|
|
212
|
-
font-size:
|
|
219
|
+
font-size: 1em;
|
|
213
220
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
214
221
|
}
|
|
215
222
|
|
|
216
223
|
&__arrow {
|
|
217
|
-
font-size:
|
|
224
|
+
font-size: 1.143em;
|
|
218
225
|
|
|
219
226
|
&--right {
|
|
220
227
|
transform: rotate(0deg);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view>
|
|
3
|
-
<view
|
|
3
|
+
<view
|
|
4
|
+
v-if="title || $slots.title"
|
|
5
|
+
class="dd-cell-group__title"
|
|
6
|
+
:class="[`dd-cell-group__title--${size}`, { 'dd-cell-group__title--inset': inset }]"
|
|
7
|
+
>
|
|
4
8
|
<slot name="title">{{ title }}</slot>
|
|
5
9
|
</view>
|
|
6
10
|
<view class="dd-cell-group" :class="{ 'dd-cell-group--inset': inset, 'dd-cell-group--border': border && !inset }">
|
|
@@ -16,12 +20,15 @@ interface Props {
|
|
|
16
20
|
inset?: boolean
|
|
17
21
|
/** 通栏模式下的首尾外框发丝线 */
|
|
18
22
|
border?: boolean
|
|
23
|
+
/** 分节标题尺寸档,只影响标题排版,不向子 cell 传递 */
|
|
24
|
+
size?: 'sm' | 'md' | 'lg'
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
withDefaults(defineProps<Props>(), {
|
|
22
28
|
title: '',
|
|
23
29
|
inset: false,
|
|
24
30
|
border: true,
|
|
31
|
+
size: 'md',
|
|
25
32
|
})
|
|
26
33
|
</script>
|
|
27
34
|
|
|
@@ -51,12 +58,26 @@ withDefaults(defineProps<Props>(), {
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
.dd-cell-group__title {
|
|
54
|
-
padding:
|
|
61
|
+
padding: $dd-space-4 $dd-space-4 $dd-space-2;
|
|
55
62
|
font-size: $dd-font-size-caption;
|
|
56
63
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
57
64
|
|
|
58
65
|
&--inset {
|
|
59
|
-
padding:
|
|
66
|
+
padding-left: $dd-space-3;
|
|
67
|
+
padding-right: $dd-space-3;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 尺寸档只调标题排版(竖直 padding + 字号),不级联到子 cell
|
|
71
|
+
&--sm {
|
|
72
|
+
padding-top: $dd-space-3;
|
|
73
|
+
padding-bottom: $dd-space-1;
|
|
74
|
+
font-size: $dd-font-size-overline;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&--lg {
|
|
78
|
+
padding-top: $dd-space-5;
|
|
79
|
+
padding-bottom: $dd-space-3;
|
|
80
|
+
font-size: $dd-font-size-body;
|
|
60
81
|
}
|
|
61
82
|
}
|
|
62
83
|
</style>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="dd-field"
|
|
4
4
|
:class="[
|
|
5
5
|
rootClass,
|
|
6
|
+
`dd-field--${size}`,
|
|
6
7
|
{
|
|
7
8
|
'dd-field--error': errorState,
|
|
8
9
|
'dd-field--disabled': disabledState,
|
|
@@ -11,7 +12,6 @@
|
|
|
11
12
|
'dd-field--center': center,
|
|
12
13
|
'dd-field--label-top': effectiveLabelPosition === 'top',
|
|
13
14
|
'dd-field--clickable': clickableState,
|
|
14
|
-
'dd-field--large': size === 'large',
|
|
15
15
|
},
|
|
16
16
|
]"
|
|
17
17
|
:hover-class="clickableState ? 'dd-field--active' : ''"
|
|
@@ -140,8 +140,8 @@ interface Props {
|
|
|
140
140
|
clickable?: boolean
|
|
141
141
|
isLink?: boolean
|
|
142
142
|
arrowDirection?: 'left' | 'right' | 'up' | 'down'
|
|
143
|
-
/**
|
|
144
|
-
size?: '
|
|
143
|
+
/** 单元格尺寸档,与 dd-cell 的 sm/md/lg 同一套竖直 rhythm(8/12/16px) */
|
|
144
|
+
size?: 'sm' | 'md' | 'lg'
|
|
145
145
|
icon?: string
|
|
146
146
|
leftIcon?: string
|
|
147
147
|
rightIcon?: string
|
|
@@ -193,7 +193,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
193
193
|
clickable: false,
|
|
194
194
|
isLink: false,
|
|
195
195
|
arrowDirection: 'right',
|
|
196
|
-
size: '
|
|
196
|
+
size: 'md',
|
|
197
197
|
icon: '',
|
|
198
198
|
leftIcon: '',
|
|
199
199
|
rightIcon: '',
|
|
@@ -437,7 +437,7 @@ defineExpose({ validate, validateWithTrigger, resetValidation, scrollIntoView, f
|
|
|
437
437
|
width: 100%;
|
|
438
438
|
// 单行/多行统一以 md 档为下限(border-box 下 padding 已含);textarea 靠内容自然增高,min-height 不限高
|
|
439
439
|
min-height: $dd-size-control-md;
|
|
440
|
-
padding:
|
|
440
|
+
padding: $dd-space-3 $dd-space-4;
|
|
441
441
|
overflow: hidden;
|
|
442
442
|
font-size: $dd-font-size-body;
|
|
443
443
|
line-height: $dd-line-height-lead;
|
|
@@ -457,9 +457,14 @@ defineExpose({ validate, validateWithTrigger, resetValidation, scrollIntoView, f
|
|
|
457
457
|
transform: scaleY(0.5);
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
&--
|
|
461
|
-
padding-top: $dd-space-
|
|
462
|
-
padding-bottom: $dd-space-
|
|
460
|
+
&--sm {
|
|
461
|
+
padding-top: $dd-space-2;
|
|
462
|
+
padding-bottom: $dd-space-2;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
&--lg {
|
|
466
|
+
padding-top: $dd-space-4;
|
|
467
|
+
padding-bottom: $dd-space-4;
|
|
463
468
|
}
|
|
464
469
|
|
|
465
470
|
&--center {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="dd-list-cell"
|
|
4
|
-
:class="
|
|
4
|
+
:class="[
|
|
5
|
+
`dd-list-cell--${size}`,
|
|
6
|
+
{ 'dd-list-cell--link': isLink || arrow, 'dd-list-cell--borderless': borderless },
|
|
7
|
+
]"
|
|
5
8
|
:hover-class="isLink || arrow ? 'dd-list-cell--active' : ''"
|
|
6
9
|
:hover-stay-time="100"
|
|
7
10
|
@click="onClick"
|
|
@@ -38,6 +41,8 @@ interface Props {
|
|
|
38
41
|
subtitle?: string
|
|
39
42
|
value?: string
|
|
40
43
|
icon?: string
|
|
44
|
+
/** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
|
|
45
|
+
size?: 'sm' | 'md' | 'lg'
|
|
41
46
|
arrow?: boolean
|
|
42
47
|
isLink?: boolean
|
|
43
48
|
borderless?: boolean
|
|
@@ -48,6 +53,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
48
53
|
subtitle: '',
|
|
49
54
|
value: '',
|
|
50
55
|
icon: '',
|
|
56
|
+
size: 'md',
|
|
51
57
|
arrow: false,
|
|
52
58
|
isLink: false,
|
|
53
59
|
borderless: false,
|
|
@@ -71,12 +77,29 @@ function onClick(e: Event) {
|
|
|
71
77
|
display: flex;
|
|
72
78
|
flex-direction: row;
|
|
73
79
|
align-items: center;
|
|
80
|
+
// 行高以 min-height 定档(md 48px = 原值),padding 只负责内容区留白与撑高
|
|
74
81
|
min-height: $dd-space-7;
|
|
75
|
-
padding:
|
|
82
|
+
padding: $dd-space-3 $dd-space-4;
|
|
76
83
|
box-sizing: border-box;
|
|
77
84
|
background: var(--dd-bg-elevated, #{$dd-bg-elevated});
|
|
85
|
+
font-size: $dd-font-size-body;
|
|
78
86
|
@include dd-hairline-bottom(var(--dd-border-default, #{$dd-border-default}));
|
|
79
87
|
|
|
88
|
+
// 三档:44/48/56px(sm 取控件 md 档 = 44px 触控下限),字号 12/14/16px 同步缩放
|
|
89
|
+
&--sm {
|
|
90
|
+
min-height: $dd-size-control-md;
|
|
91
|
+
padding-top: $dd-space-2;
|
|
92
|
+
padding-bottom: $dd-space-2;
|
|
93
|
+
font-size: $dd-font-size-caption;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&--lg {
|
|
97
|
+
min-height: $dd-space-7 + $dd-space-2;
|
|
98
|
+
padding-top: $dd-space-4;
|
|
99
|
+
padding-bottom: $dd-space-4;
|
|
100
|
+
font-size: $dd-font-size-lead;
|
|
101
|
+
}
|
|
102
|
+
|
|
80
103
|
&__icon {
|
|
81
104
|
flex-shrink: 0;
|
|
82
105
|
width: 56rpx;
|
|
@@ -88,7 +111,7 @@ function onClick(e: Event) {
|
|
|
88
111
|
}
|
|
89
112
|
|
|
90
113
|
&__icon-text {
|
|
91
|
-
font-size:
|
|
114
|
+
font-size: 1.429em;
|
|
92
115
|
line-height: 1;
|
|
93
116
|
color: var(--dd-primary-400, #{$dd-primary-400});
|
|
94
117
|
}
|
|
@@ -102,14 +125,14 @@ function onClick(e: Event) {
|
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
&__title {
|
|
105
|
-
font-size:
|
|
128
|
+
font-size: 1em;
|
|
106
129
|
font-weight: 500;
|
|
107
130
|
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
108
131
|
@include dd-ellipsis(1);
|
|
109
132
|
}
|
|
110
133
|
|
|
111
134
|
&__subtitle {
|
|
112
|
-
font-size:
|
|
135
|
+
font-size: 0.857em;
|
|
113
136
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
114
137
|
@include dd-ellipsis(1);
|
|
115
138
|
}
|
|
@@ -123,13 +146,13 @@ function onClick(e: Event) {
|
|
|
123
146
|
}
|
|
124
147
|
|
|
125
148
|
&__value {
|
|
126
|
-
font-size:
|
|
149
|
+
font-size: 1em;
|
|
127
150
|
font-weight: 500;
|
|
128
151
|
color: var(--dd-primary-400, #{$dd-primary-400});
|
|
129
152
|
}
|
|
130
153
|
|
|
131
154
|
&__arrow {
|
|
132
|
-
font-size:
|
|
155
|
+
font-size: 1.286em;
|
|
133
156
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
134
157
|
line-height: 1;
|
|
135
158
|
margin-left: $dd-space-1;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
:class="['dd-price--' + size, { 'dd-price--custom-color': color }]"
|
|
6
6
|
:style="color ? { color } : undefined"
|
|
7
7
|
>
|
|
8
|
-
<text v-if="prefix" class="dd-price__prefix">{{ prefix }}</text>
|
|
8
|
+
<text v-if="prefix" class="dd-price__prefix" :style="prefixColor ? { color: prefixColor } : undefined">{{ prefix }}</text>
|
|
9
9
|
<text class="dd-price__currency">{{ currency }}</text>
|
|
10
10
|
<text class="dd-price__integer">{{ pricePair[0] }}</text>
|
|
11
11
|
<text v-if="pricePair[1]" class="dd-price__decimal">{{ mark }}{{ pricePair[1] }}</text>
|
|
12
|
-
<text v-if="suffix" class="dd-price__suffix">{{ suffix }}</text>
|
|
12
|
+
<text v-if="suffix" class="dd-price__suffix" :style="suffixColor ? { color: suffixColor } : undefined">{{ suffix }}</text>
|
|
13
13
|
</view>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
@@ -31,8 +31,12 @@ interface Props {
|
|
|
31
31
|
suffix?: string
|
|
32
32
|
/** 尺寸:xxs 紧凑行最小号(房态卡片等 22rpx 正文旁)/ xs 最小号(一行四列小卡)/ sm 小号(购物车行/小卡)/ md 常规 / lg 大号(结算条/合计) */
|
|
33
33
|
size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg'
|
|
34
|
-
/** 主色(CSS
|
|
34
|
+
/** 主色(CSS 颜色/变量):整数、货币符、小数、前缀、后缀一起变色;不传则 inherit 跟随上下文(货币符/小数/前后缀保持次级灰) */
|
|
35
35
|
color?: string
|
|
36
|
+
/** 前缀颜色:不传默认跟随 color(color 也不传时保持次级灰) */
|
|
37
|
+
prefixColor?: string
|
|
38
|
+
/** 后缀颜色:不传默认跟随 color(color 也不传时保持次级灰) */
|
|
39
|
+
suffixColor?: string
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -44,6 +48,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
44
48
|
suffix: '',
|
|
45
49
|
size: 'md',
|
|
46
50
|
color: '',
|
|
51
|
+
prefixColor: '',
|
|
52
|
+
suffixColor: '',
|
|
47
53
|
})
|
|
48
54
|
|
|
49
55
|
const pricePair = computed<string[] | null>(() => {
|
|
@@ -88,8 +94,11 @@ const pricePair = computed<string[] | null>(() => {
|
|
|
88
94
|
font-size: 24rpx;
|
|
89
95
|
}
|
|
90
96
|
|
|
91
|
-
//
|
|
97
|
+
// 自定义主色:前后缀/货币符/小数默认是次级灰,传 color 时统一跟随主色
|
|
98
|
+
// prefixColor / suffixColor 单独传入时由行内 style 覆盖这里的 inherit
|
|
92
99
|
&--custom-color {
|
|
100
|
+
.dd-price__prefix,
|
|
101
|
+
.dd-price__suffix,
|
|
93
102
|
.dd-price__currency,
|
|
94
103
|
.dd-price__decimal {
|
|
95
104
|
color: inherit;
|
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="dd-step"
|
|
4
|
+
:class="[`dd-step--${direction}`, `dd-step--${status}`, `dd-step--${size}`]"
|
|
5
|
+
:style="colorStyle"
|
|
6
|
+
>
|
|
3
7
|
<template v-if="direction === 'horizontal'">
|
|
4
8
|
<view class="dd-step__head">
|
|
5
|
-
<view
|
|
6
|
-
v-if="!isLast"
|
|
7
|
-
class="dd-step__line"
|
|
8
|
-
:class="{ 'dd-step__line--first': isFirst }"
|
|
9
|
-
:style="lineStyle"
|
|
10
|
-
></view>
|
|
9
|
+
<view v-if="!isLast" class="dd-step__line" :style="lineStyle"></view>
|
|
11
10
|
<view class="dd-step__circle" :style="circleStyle">
|
|
12
|
-
<dd-icon
|
|
11
|
+
<dd-icon
|
|
12
|
+
v-if="icon || status === 'finish'"
|
|
13
|
+
:name="icon || 'success'"
|
|
14
|
+
class="dd-step__circle-text"
|
|
15
|
+
/>
|
|
13
16
|
<text v-else class="dd-step__circle-text">{{ index + 1 }}</text>
|
|
14
17
|
</view>
|
|
15
18
|
</view>
|
|
16
19
|
<view class="dd-step__content">
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
<!-- 默认插槽:传内容即整体接管标题/描述区(如自定义 tag、右对齐时间等富文本行);
|
|
21
|
+
未传内容时渲染 title/description 兜底,保持既有用法不变 -->
|
|
22
|
+
<slot>
|
|
23
|
+
<text class="dd-step__title">{{ title }}</text>
|
|
24
|
+
<text v-if="description" class="dd-step__desc">{{ description }}</text>
|
|
25
|
+
</slot>
|
|
19
26
|
</view>
|
|
20
27
|
</template>
|
|
21
28
|
|
|
22
29
|
<template v-else>
|
|
23
30
|
<view class="dd-step__head dd-step__head--vertical">
|
|
24
31
|
<view class="dd-step__circle" :style="circleStyle">
|
|
25
|
-
<dd-icon
|
|
32
|
+
<dd-icon
|
|
33
|
+
v-if="icon || status === 'finish'"
|
|
34
|
+
:name="icon || 'success'"
|
|
35
|
+
class="dd-step__circle-text"
|
|
36
|
+
/>
|
|
26
37
|
<text v-else class="dd-step__circle-text">{{ index + 1 }}</text>
|
|
27
38
|
</view>
|
|
28
39
|
<view
|
|
@@ -32,8 +43,10 @@
|
|
|
32
43
|
></view>
|
|
33
44
|
</view>
|
|
34
45
|
<view class="dd-step__content dd-step__content--vertical">
|
|
35
|
-
<
|
|
36
|
-
|
|
46
|
+
<slot>
|
|
47
|
+
<text class="dd-step__title">{{ title }}</text>
|
|
48
|
+
<text v-if="description" class="dd-step__desc">{{ description }}</text>
|
|
49
|
+
</slot>
|
|
37
50
|
</view>
|
|
38
51
|
</template>
|
|
39
52
|
</view>
|
|
@@ -50,11 +63,14 @@ type StepStatus = 'wait' | 'process' | 'finish'
|
|
|
50
63
|
interface Props {
|
|
51
64
|
title?: string
|
|
52
65
|
description?: string
|
|
66
|
+
/** 圆点内图标(dd-icon 名称),传入后替代序号/完成对勾 */
|
|
67
|
+
icon?: string
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
const props = withDefaults(defineProps<Props>(), {
|
|
56
71
|
title: '',
|
|
57
72
|
description: '',
|
|
73
|
+
icon: '',
|
|
58
74
|
})
|
|
59
75
|
|
|
60
76
|
const ctx = inject<any>('ddSteps', null)
|
|
@@ -64,6 +80,8 @@ const direction = computed<'horizontal' | 'vertical'>(() =>
|
|
|
64
80
|
ctx ? ctx.direction.value : 'horizontal'
|
|
65
81
|
)
|
|
66
82
|
|
|
83
|
+
const size = computed<'sm' | 'md' | 'lg'>(() => (ctx ? ctx.size.value : 'md'))
|
|
84
|
+
|
|
67
85
|
const status = computed<StepStatus>(() => {
|
|
68
86
|
if (!ctx) return 'wait'
|
|
69
87
|
const active = ctx.active.value
|
|
@@ -73,23 +91,24 @@ const status = computed<StepStatus>(() => {
|
|
|
73
91
|
})
|
|
74
92
|
|
|
75
93
|
const isLast = computed(() => (ctx ? index === ctx.count.value - 1 : true))
|
|
76
|
-
const isFirst = computed(() => index === 0)
|
|
77
94
|
|
|
78
|
-
const activeColor = computed(() => (ctx ? ctx.activeColor.value : '
|
|
79
|
-
const inactiveColor = computed(() => (ctx ? ctx.inactiveColor.value : '
|
|
95
|
+
const activeColor = computed(() => (ctx ? ctx.activeColor.value : ''))
|
|
96
|
+
const inactiveColor = computed(() => (ctx ? ctx.inactiveColor.value : ''))
|
|
80
97
|
|
|
81
|
-
|
|
98
|
+
// 仅在外部传入自定义色时覆盖组件私有 CSS 变量,默认色由样式层 token 提供
|
|
99
|
+
const colorStyle = computed(() => {
|
|
100
|
+
const vars: Record<string, string> = {}
|
|
101
|
+
if (activeColor.value) vars['--dd-step-active'] = activeColor.value
|
|
102
|
+
if (inactiveColor.value) vars['--dd-step-inactive'] = inactiveColor.value
|
|
103
|
+
return vars
|
|
104
|
+
})
|
|
82
105
|
|
|
83
106
|
const circleStyle = computed(() => ({
|
|
84
|
-
background: isActive.value ? activeColor.value : '#2A2A2A',
|
|
85
|
-
color: isActive.value ? '#FFFFFF' : inactiveColor.value,
|
|
86
107
|
// z-index 统一取 libs/config/zIndex.js(圆点 base 档内 +1,盖住连接线)
|
|
87
108
|
zIndex: zIndexConfig.base + 1,
|
|
88
109
|
}))
|
|
89
110
|
|
|
90
|
-
// ponytail: 水平连接线整段按本步骤 status 着色,current/首个 wait 左半段颜色为近似值
|
|
91
111
|
const lineStyle = computed(() => ({
|
|
92
|
-
background: status.value === 'finish' ? activeColor.value : inactiveColor.value,
|
|
93
112
|
// z-index 统一取 libs/config/zIndex.js(连接线垫底取 base 档)
|
|
94
113
|
zIndex: zIndexConfig.base,
|
|
95
114
|
}))
|
|
@@ -100,6 +119,25 @@ const lineStyle = computed(() => ({
|
|
|
100
119
|
@import '../../scss/mixins';
|
|
101
120
|
|
|
102
121
|
.dd-step {
|
|
122
|
+
/* 组件私有变量:默认取主题 token,外部传 activeColor/inactiveColor 时由 :style 覆盖 */
|
|
123
|
+
--dd-step-active: var(--dd-primary, #{$dd-primary});
|
|
124
|
+
--dd-step-inactive: var(--dd-step-inactive-color, #{$dd-step-inactive-color});
|
|
125
|
+
--dd-step-circle-bg: var(--dd-surface-container-high, #{$dd-surface-container-high});
|
|
126
|
+
--dd-step-circle-fg: #{$dd-color-white};
|
|
127
|
+
/* 尺寸档位:圆点直径 + 圆点/标题/描述字号 */
|
|
128
|
+
--dd-step-circle-size: #{$dd-size-icon-md};
|
|
129
|
+
--dd-step-font-size: #{$dd-font-size-caption};
|
|
130
|
+
|
|
131
|
+
&--sm {
|
|
132
|
+
--dd-step-circle-size: #{$dd-size-icon-sm};
|
|
133
|
+
--dd-step-font-size: #{$dd-font-size-overline};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&--lg {
|
|
137
|
+
--dd-step-circle-size: #{$dd-size-icon-lg};
|
|
138
|
+
--dd-step-font-size: #{$dd-font-size-body};
|
|
139
|
+
}
|
|
140
|
+
|
|
103
141
|
&--horizontal {
|
|
104
142
|
flex: 1;
|
|
105
143
|
display: flex;
|
|
@@ -108,56 +146,79 @@ const lineStyle = computed(() => ({
|
|
|
108
146
|
min-width: 0;
|
|
109
147
|
}
|
|
110
148
|
|
|
149
|
+
/* 垂直:左侧圆点+连接线,右侧文字 */
|
|
150
|
+
&--vertical {
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: stretch;
|
|
153
|
+
}
|
|
154
|
+
|
|
111
155
|
&__head {
|
|
112
156
|
position: relative;
|
|
113
157
|
width: 100%;
|
|
114
|
-
height:
|
|
158
|
+
height: var(--dd-step-circle-size);
|
|
115
159
|
display: flex;
|
|
116
160
|
align-items: center;
|
|
117
161
|
justify-content: center;
|
|
118
162
|
|
|
119
163
|
&--vertical {
|
|
120
|
-
width:
|
|
164
|
+
width: var(--dd-step-circle-size);
|
|
121
165
|
height: auto;
|
|
122
166
|
flex-direction: column;
|
|
167
|
+
/* 最后一步无连接线时圆点仍需顶部对齐,否则会被 head 垂直居中 */
|
|
168
|
+
justify-content: flex-start;
|
|
123
169
|
align-self: stretch;
|
|
170
|
+
flex-shrink: 0;
|
|
124
171
|
}
|
|
125
172
|
}
|
|
126
173
|
|
|
127
174
|
&__line {
|
|
128
175
|
position: absolute;
|
|
129
176
|
top: 50%;
|
|
130
|
-
left:
|
|
131
|
-
|
|
177
|
+
left: 50%;
|
|
178
|
+
/* 延伸到下一个圆点圆心(各步骤等宽) */
|
|
179
|
+
right: -50%;
|
|
132
180
|
height: 1px;
|
|
181
|
+
background: var(--dd-step-inactive);
|
|
133
182
|
transform: translateY(-50%);
|
|
134
183
|
|
|
135
|
-
&--first {
|
|
136
|
-
left: 50%;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
184
|
&--vertical {
|
|
140
185
|
position: static;
|
|
141
186
|
transform: none;
|
|
142
187
|
width: 1px;
|
|
188
|
+
height: auto;
|
|
143
189
|
flex: 1;
|
|
144
190
|
min-height: 32rpx;
|
|
145
|
-
|
|
191
|
+
/* 不留底部间隙,让线接到下一个圆点 */
|
|
192
|
+
margin: $dd-space-1 0 0;
|
|
146
193
|
}
|
|
147
194
|
}
|
|
148
195
|
|
|
149
196
|
&__circle {
|
|
150
197
|
position: relative;
|
|
151
|
-
width:
|
|
152
|
-
height:
|
|
198
|
+
width: var(--dd-step-circle-size);
|
|
199
|
+
height: var(--dd-step-circle-size);
|
|
153
200
|
border-radius: $dd-radius-full;
|
|
154
201
|
@include dd-flex-center;
|
|
155
202
|
flex-shrink: 0;
|
|
203
|
+
background: var(--dd-step-circle-bg);
|
|
204
|
+
color: var(--dd-step-inactive);
|
|
156
205
|
@include dd-transition(all 0.3s ease);
|
|
157
206
|
}
|
|
158
207
|
|
|
208
|
+
/* 进行中/已完成:圆点取品牌色,文字取反白色 */
|
|
209
|
+
&--process &__circle,
|
|
210
|
+
&--finish &__circle {
|
|
211
|
+
background: var(--dd-step-active);
|
|
212
|
+
color: var(--dd-step-circle-fg);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* 连接线按下一步骤状态着色:仅已完成段为品牌色 */
|
|
216
|
+
&--finish &__line {
|
|
217
|
+
background: var(--dd-step-active);
|
|
218
|
+
}
|
|
219
|
+
|
|
159
220
|
&__circle-text {
|
|
160
|
-
font-size:
|
|
221
|
+
font-size: var(--dd-step-font-size);
|
|
161
222
|
font-weight: 700;
|
|
162
223
|
line-height: 1;
|
|
163
224
|
}
|
|
@@ -176,7 +237,7 @@ const lineStyle = computed(() => ({
|
|
|
176
237
|
}
|
|
177
238
|
|
|
178
239
|
&__title {
|
|
179
|
-
font-size:
|
|
240
|
+
font-size: var(--dd-step-font-size);
|
|
180
241
|
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
181
242
|
line-height: $dd-line-height-caption;
|
|
182
243
|
}
|
|
@@ -184,7 +245,7 @@ const lineStyle = computed(() => ({
|
|
|
184
245
|
&__desc {
|
|
185
246
|
display: block;
|
|
186
247
|
margin-top: $dd-space-1;
|
|
187
|
-
font-size:
|
|
248
|
+
font-size: var(--dd-step-font-size);
|
|
188
249
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
189
250
|
line-height: 1.4;
|
|
190
251
|
}
|
|
@@ -13,6 +13,8 @@ interface Props {
|
|
|
13
13
|
direction?: 'horizontal' | 'vertical'
|
|
14
14
|
activeColor?: string
|
|
15
15
|
inactiveColor?: string
|
|
16
|
+
/** 圆点与文字尺寸档位 */
|
|
17
|
+
size?: 'sm' | 'md' | 'lg'
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -20,6 +22,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
20
22
|
direction: 'horizontal',
|
|
21
23
|
activeColor: '',
|
|
22
24
|
inactiveColor: '',
|
|
25
|
+
size: 'md',
|
|
23
26
|
})
|
|
24
27
|
|
|
25
28
|
const count = ref(0)
|
|
@@ -34,8 +37,9 @@ function register(): number {
|
|
|
34
37
|
provide('ddSteps', {
|
|
35
38
|
active: computed(() => props.active),
|
|
36
39
|
direction: computed(() => props.direction),
|
|
37
|
-
activeColor: computed(() => props.activeColor
|
|
38
|
-
inactiveColor: computed(() => props.inactiveColor
|
|
40
|
+
activeColor: computed(() => props.activeColor),
|
|
41
|
+
inactiveColor: computed(() => props.inactiveColor),
|
|
42
|
+
size: computed(() => props.size),
|
|
39
43
|
count,
|
|
40
44
|
register,
|
|
41
45
|
})
|