hy-app 0.4.13 → 0.5.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/hy-action-sheet/hy-action-sheet.vue +155 -238
- package/components/hy-action-sheet/props.ts +68 -15
- package/components/hy-action-sheet/typing.d.ts +115 -115
- package/components/hy-address-picker/hy-address-picker.vue +185 -289
- package/components/hy-address-picker/props.ts +97 -21
- package/components/hy-address-picker/typing.d.ts +90 -89
- package/components/hy-avatar/hy-avatar.vue +121 -204
- package/components/hy-avatar/props.ts +76 -18
- package/components/hy-avatar/typing.d.ts +63 -62
- package/components/hy-back-top/hy-back-top.vue +65 -120
- package/components/hy-back-top/props.ts +57 -16
- package/components/hy-back-top/typing.d.ts +43 -42
- package/components/hy-badge/hy-badge.vue +66 -138
- package/components/hy-badge/props.ts +73 -17
- package/components/hy-badge/typing.d.ts +59 -58
- package/components/hy-button/hy-button.vue +226 -375
- package/components/hy-button/props.ts +129 -158
- package/components/hy-calendar/header.vue +48 -64
- package/components/hy-calendar/hy-calendar.vue +274 -438
- package/components/hy-calendar/month.vue +508 -516
- package/components/hy-calendar/props.ts +157 -35
- package/components/hy-calendar/typing.d.ts +129 -128
- package/components/hy-card/hy-card.vue +118 -240
- package/components/hy-card/index.scss +1 -2
- package/components/hy-card/props.ts +122 -27
- package/components/hy-card/typing.d.ts +119 -118
- package/components/hy-cell/hy-cell.vue +176 -258
- package/components/hy-cell/props.ts +71 -17
- package/components/hy-cell/typing.d.ts +87 -86
- package/components/hy-check-button/hy-check-button.vue +69 -139
- package/components/hy-check-button/props.ts +72 -18
- package/components/hy-check-button/typing.d.ts +74 -73
- package/components/hy-checkbox/hy-checkbox.vue +170 -263
- package/components/hy-checkbox/props.ts +94 -24
- package/components/hy-checkbox/typing.d.ts +72 -72
- package/components/hy-checkbox-group/hy-checkbox-group.vue +25 -100
- package/components/hy-checkbox-group/props.ts +80 -0
- package/components/hy-checkbox-group/typing.d.ts +65 -65
- package/components/hy-checkbox-item/hy-checkbox-item.vue +140 -177
- package/components/hy-checkbox-item/props.ts +24 -0
- package/components/hy-checkbox-item/typing.d.ts +4 -3
- package/components/hy-code-input/hy-code-input.vue +179 -262
- package/components/hy-code-input/props.ts +84 -18
- package/components/hy-code-input/typing.d.ts +71 -71
- package/components/hy-config-provider/hy-config-provider.vue +28 -50
- package/components/hy-config-provider/props.ts +26 -11
- package/components/hy-config-provider/typing.d.ts +20 -20
- package/components/hy-count-down/hy-count-down.vue +103 -131
- package/components/hy-count-down/props.ts +30 -8
- package/components/hy-count-down/typing.d.ts +25 -25
- package/components/hy-count-to/hy-count-to.vue +148 -213
- package/components/hy-count-to/props.ts +60 -15
- package/components/hy-count-to/typing.d.ts +46 -46
- package/components/hy-coupon/README.md +133 -0
- package/components/hy-coupon/hy-coupon.vue +180 -0
- package/components/hy-coupon/index.scss +553 -0
- package/components/hy-coupon/props.ts +129 -0
- package/components/hy-coupon/typing.d.ts +146 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +415 -580
- package/components/hy-datetime-picker/props.ts +142 -32
- package/components/hy-datetime-picker/typing.d.ts +132 -132
- package/components/hy-divider/hy-divider.vue +90 -169
- package/components/hy-divider/props.ts +78 -19
- package/components/hy-divider/typing.d.ts +60 -60
- package/components/hy-dropdown/hy-dropdown.vue +37 -71
- package/components/hy-dropdown/props.ts +38 -15
- package/components/hy-dropdown/typing.d.ts +44 -44
- package/components/hy-dropdown-item/hy-dropdown-item.vue +141 -173
- package/components/hy-dropdown-item/props.ts +19 -8
- package/components/hy-empty/hy-empty.vue +75 -129
- package/components/hy-empty/props.ts +57 -15
- package/components/hy-empty/typing.d.ts +84 -84
- package/components/hy-flex/hy-flex.vue +33 -88
- package/components/hy-flex/props.ts +58 -0
- package/components/hy-flex/typing.d.ts +14 -16
- package/components/hy-float-button/hy-float-button.vue +289 -406
- package/components/hy-float-button/props.ts +109 -25
- package/components/hy-folding-panel/hy-folding-panel.vue +86 -374
- package/components/hy-folding-panel/props.ts +40 -15
- package/components/hy-folding-panel/typing.d.ts +52 -63
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +186 -228
- package/components/hy-folding-panel-item/index.scss +87 -0
- package/components/hy-folding-panel-item/props.ts +81 -0
- package/components/hy-folding-panel-item/typing.d.ts +23 -0
- package/components/hy-form/hy-form.vue +172 -212
- package/components/hy-form/props.ts +37 -0
- package/components/hy-form/typing.d.ts +68 -61
- package/components/hy-form-group/typing.d.ts +74 -74
- package/components/hy-form-item/hy-form-item.vue +100 -129
- package/components/hy-form-item/props.ts +25 -0
- package/components/hy-form-item/typing.d.ts +40 -37
- package/components/hy-grid/hy-grid.vue +76 -132
- package/components/hy-grid/props.ts +58 -16
- package/components/hy-grid/typing.d.ts +66 -66
- package/components/hy-icon/hy-icon.vue +84 -161
- package/components/hy-icon/props.ts +76 -22
- package/components/hy-icon/typing.d.ts +83 -82
- package/components/hy-image/hy-image.vue +142 -272
- package/components/hy-image/props.ts +105 -23
- package/components/hy-image/typing.d.ts +84 -87
- package/components/hy-input/hy-input.vue +230 -421
- package/components/hy-input/props.ts +183 -35
- package/components/hy-input/typing.d.ts +169 -169
- package/components/hy-line/hy-line.vue +34 -72
- package/components/hy-line/props.ts +41 -10
- package/components/hy-line/typing.d.ts +29 -29
- package/components/hy-line-progress/hy-line-progress.vue +66 -101
- package/components/hy-line-progress/props.ts +31 -10
- package/components/hy-line-progress/typing.d.ts +29 -29
- package/components/hy-list/hy-list.vue +151 -220
- package/components/hy-list/props.ts +67 -16
- package/components/hy-list/typing.d.ts +52 -52
- package/components/hy-loading/hy-loading.vue +63 -119
- package/components/hy-loading/props.ts +63 -15
- package/components/hy-loading/typing.d.ts +49 -49
- package/components/hy-menu/hy-menu.vue +124 -166
- package/components/hy-menu/props.ts +42 -10
- package/components/hy-menu/typing.d.ts +60 -60
- package/components/hy-modal/hy-modal.vue +127 -218
- package/components/hy-modal/props.ts +89 -24
- package/components/hy-navbar/hy-navbar.vue +104 -177
- package/components/hy-navbar/props.ts +76 -22
- package/components/hy-navbar/typing.d.ts +81 -81
- package/components/hy-notice-bar/hy-notice-bar.vue +67 -144
- package/components/hy-notice-bar/props.ts +80 -19
- package/components/hy-notice-bar/typing.d.ts +62 -62
- package/components/hy-notify/hy-notify.vue +128 -177
- package/components/hy-notify/props.ts +49 -12
- package/components/hy-notify/typing.d.ts +45 -41
- package/components/hy-number-step/hy-number-step.vue +281 -394
- package/components/hy-number-step/props.ts +110 -27
- package/components/hy-number-step/typing.d.ts +120 -120
- package/components/hy-overlay/hy-overlay.vue +39 -66
- package/components/hy-overlay/props.ts +31 -8
- package/components/hy-pagination/hy-pagination.vue +100 -155
- package/components/hy-pagination/props.ts +53 -13
- package/components/hy-picker/hy-picker.vue +309 -430
- package/components/hy-picker/index.scss +8 -12
- package/components/hy-picker/props.ts +110 -26
- package/components/hy-popover/hy-popover.vue +190 -252
- package/components/hy-popover/props.ts +48 -10
- package/components/hy-popup/hy-popup.vue +162 -248
- package/components/hy-popup/props.ts +82 -18
- package/components/hy-price/hy-price.vue +45 -104
- package/components/hy-price/props.ts +52 -12
- package/components/hy-price/typing.d.ts +41 -36
- package/components/hy-qrcode/hy-qrcode.vue +115 -185
- package/components/hy-qrcode/props.ts +68 -18
- package/components/hy-qrcode/typing.d.ts +67 -66
- package/components/hy-radio/hy-radio.vue +161 -259
- package/components/hy-radio/props.ts +95 -25
- package/components/hy-radio/typing.d.ts +85 -84
- package/components/hy-rate/hy-rate.vue +185 -270
- package/components/hy-rate/props.ts +76 -18
- package/components/hy-rate/typing.d.ts +61 -60
- package/components/hy-read-more/hy-read-more.vue +93 -136
- package/components/hy-read-more/props.ts +43 -13
- package/components/hy-scroll-list/hy-scroll-list.vue +81 -102
- package/components/hy-scroll-list/props.ts +22 -11
- package/components/hy-search/hy-search.vue +155 -284
- package/components/hy-search/props.ts +130 -25
- package/components/hy-signature/hy-signature.vue +491 -635
- package/components/hy-signature/props.ts +115 -26
- package/components/hy-signature/typing.d.ts +138 -138
- package/components/hy-slider/hy-slider.vue +388 -477
- package/components/hy-slider/props.ts +75 -19
- package/components/hy-steps/hy-steps.vue +212 -279
- package/components/hy-steps/props.ts +47 -13
- package/components/hy-submit-bar/hy-submit-bar.vue +137 -222
- package/components/hy-submit-bar/props.ts +89 -20
- package/components/hy-submit-bar/typing.d.ts +86 -85
- package/components/hy-subsection/hy-subsection.vue +132 -185
- package/components/hy-subsection/props.ts +50 -17
- package/components/hy-subsection/typing.d.ts +52 -52
- package/components/hy-swipe-action/hy-swipe-action.vue +228 -283
- package/components/hy-swipe-action/props.ts +43 -18
- package/components/hy-swipe-action/typing.d.ts +46 -46
- package/components/hy-swiper/hy-swiper.vue +159 -286
- package/components/hy-swiper/props.ts +126 -28
- package/components/hy-swiper/typing.d.ts +115 -115
- package/components/hy-switch/hy-switch.vue +112 -176
- package/components/hy-switch/props.ts +60 -15
- package/components/hy-switch/typing.d.ts +63 -63
- package/components/hy-tabBar/hy-tabBar.vue +64 -60
- package/components/hy-tabs/hy-tabs.vue +277 -380
- package/components/hy-tabs/props.ts +75 -18
- package/components/hy-tag/hy-tag.vue +111 -204
- package/components/hy-tag/props.ts +81 -19
- package/components/hy-text/hy-text.vue +200 -322
- package/components/hy-text/props.ts +107 -28
- package/components/hy-textarea/hy-textarea.vue +147 -256
- package/components/hy-textarea/props.ts +112 -25
- package/components/hy-textarea/typing.d.ts +42 -42
- package/components/hy-toast/hy-toast.vue +135 -143
- package/components/hy-tooltip/hy-tooltip.vue +220 -306
- package/components/hy-tooltip/props.ts +79 -15
- package/components/hy-transition/hy-transition.vue +111 -138
- package/components/hy-transition/props.ts +30 -8
- package/components/hy-upload/hy-upload.vue +320 -469
- package/components/hy-upload/props.ts +130 -27
- package/components/hy-warn/hy-warn.vue +80 -129
- package/components/hy-warn/props.ts +47 -12
- package/components/hy-waterfall/hy-waterfall.vue +139 -163
- package/components/hy-waterfall/props.ts +19 -7
- package/components/hy-watermark/hy-watermark.vue +762 -870
- package/components/hy-watermark/props.ts +103 -22
- package/global.d.ts +2 -0
- package/libs/css/theme.scss +3 -3
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-folding-panel/index.scss +0 -9
|
@@ -1,21 +1,77 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { ColorConfig } from "../../libs/config";
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
3
2
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
3
|
+
const sliderProps = {
|
|
4
|
+
/** 滑块默认值 */
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 0
|
|
8
|
+
},
|
|
9
|
+
/** 滑块的大小,取值范围为 12 - 28 */
|
|
10
|
+
blockSize: {
|
|
11
|
+
type: [String, Number],
|
|
12
|
+
default: 18
|
|
13
|
+
},
|
|
14
|
+
/** 最小值 */
|
|
15
|
+
min: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 0
|
|
18
|
+
},
|
|
19
|
+
/** 最大值 */
|
|
20
|
+
max: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 100
|
|
23
|
+
},
|
|
24
|
+
/** 步长 */
|
|
25
|
+
step: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 1
|
|
28
|
+
},
|
|
29
|
+
/** 底部选择部分的背景颜色 */
|
|
30
|
+
activeColor: String,
|
|
31
|
+
/** 底部条背景颜色 */
|
|
32
|
+
inactiveColor: String,
|
|
33
|
+
/** 滑块颜色 */
|
|
34
|
+
blockColor: String,
|
|
35
|
+
/** 是否显示当前的选择值 */
|
|
36
|
+
showValue: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
/** 是否禁用滑块 */
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
/** 是否渲染uni-app框架内置组件 */
|
|
46
|
+
useNative: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
/** 滑块条高度,单位rpx */
|
|
51
|
+
height: {
|
|
52
|
+
type: [String, Number],
|
|
53
|
+
default: 2
|
|
54
|
+
},
|
|
55
|
+
/** 双滑块时值 */
|
|
56
|
+
rangeValue: {
|
|
57
|
+
type: Array as PropType<number[]>,
|
|
58
|
+
default: [0, 0]
|
|
59
|
+
},
|
|
60
|
+
/** 是否区间的模式 */
|
|
61
|
+
isRange: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
/** 给滑块自定义样式,对象形式 */
|
|
66
|
+
blockStyle: {
|
|
67
|
+
type: Object as PropType<CSSProperties>
|
|
68
|
+
},
|
|
69
|
+
/** 定义需要用到的外部样式 */
|
|
70
|
+
customStyle: {
|
|
71
|
+
type: Object as PropType<CSSProperties>
|
|
72
|
+
},
|
|
73
|
+
/** 自定义外部类名 */
|
|
74
|
+
customClass: String
|
|
75
|
+
}
|
|
20
76
|
|
|
21
|
-
export default
|
|
77
|
+
export default sliderProps
|
|
@@ -1,334 +1,267 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
:style="lineStyle(item, i)"
|
|
17
|
-
></view>
|
|
18
|
-
<!-- 线条 -->
|
|
2
|
+
<view :class="[`hy-steps--${direction}`, 'hy-steps']">
|
|
3
|
+
<template v-for="(item, i) in list" :key="i">
|
|
4
|
+
<view ref="hy-steps-item" :class="[`hy-steps-item--${direction}`, 'hy-steps-item']">
|
|
5
|
+
<!-- 线条 -->
|
|
6
|
+
<view
|
|
7
|
+
v-if="i > 0"
|
|
8
|
+
:class="[
|
|
9
|
+
`hy-steps-item__line--${direction}`,
|
|
10
|
+
'hy-steps-item__line',
|
|
11
|
+
statusClass(i, item.error)
|
|
12
|
+
]"
|
|
13
|
+
:style="lineStyle(item, i)"
|
|
14
|
+
></view>
|
|
15
|
+
<!-- 线条 -->
|
|
19
16
|
|
|
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
|
-
></HyIcon>
|
|
91
|
-
</view>
|
|
92
|
-
</template>
|
|
93
|
-
</view>
|
|
94
|
-
<!-- 步骤状态 -->
|
|
17
|
+
<!-- 步骤状态 -->
|
|
18
|
+
<view
|
|
19
|
+
:class="[
|
|
20
|
+
`hy-steps-item__wrapper--${direction}`,
|
|
21
|
+
dot ? `hy-steps-item__wrapper--dot` : statusClass(i, item.error),
|
|
22
|
+
'hy-steps-item__wrapper'
|
|
23
|
+
]"
|
|
24
|
+
:style="itemStyleInner"
|
|
25
|
+
>
|
|
26
|
+
<slot v-if="$slots.icon" name="icon" :error="item?.error" :index="i"></slot>
|
|
27
|
+
<template v-else>
|
|
28
|
+
<view
|
|
29
|
+
:class="[
|
|
30
|
+
'hy-steps-item__wrapper--dot__item',
|
|
31
|
+
`hy-steps-item__wrapper--dot__${statusClass(i, item.error)}`
|
|
32
|
+
]"
|
|
33
|
+
v-if="dot"
|
|
34
|
+
:style="{
|
|
35
|
+
backgroundColor: statusColor(i, item?.error)
|
|
36
|
+
}"
|
|
37
|
+
></view>
|
|
38
|
+
<view
|
|
39
|
+
class="hy-steps-item__wrapper__icon"
|
|
40
|
+
v-else-if="activeIcon || inactiveIcon"
|
|
41
|
+
>
|
|
42
|
+
<hy-icon
|
|
43
|
+
:name="i <= current ? activeIcon : inactiveIcon"
|
|
44
|
+
:size="iconSize"
|
|
45
|
+
:color="i <= current ? activeColor : inactiveColor"
|
|
46
|
+
></hy-icon>
|
|
47
|
+
</view>
|
|
48
|
+
<view
|
|
49
|
+
v-else
|
|
50
|
+
:style="{
|
|
51
|
+
backgroundColor:
|
|
52
|
+
statusClass(i, item.error) === 'process'
|
|
53
|
+
? activeColor
|
|
54
|
+
: 'transparent',
|
|
55
|
+
borderColor: statusColor(i, item?.error)
|
|
56
|
+
}"
|
|
57
|
+
class="hy-steps-item__wrapper__circle"
|
|
58
|
+
>
|
|
59
|
+
<text
|
|
60
|
+
v-if="
|
|
61
|
+
statusClass(i, item.error) === 'process' ||
|
|
62
|
+
statusClass(i, item.error) === 'wait'
|
|
63
|
+
"
|
|
64
|
+
class="hy-steps-item__wrapper__circle__text"
|
|
65
|
+
:style="{
|
|
66
|
+
color: textColor(i)
|
|
67
|
+
}"
|
|
68
|
+
>
|
|
69
|
+
{{ i + 1 }}
|
|
70
|
+
</text>
|
|
71
|
+
<hy-icon
|
|
72
|
+
v-else
|
|
73
|
+
:color="
|
|
74
|
+
statusClass(i, item.error) === 'error' ? 'error' : activeColor
|
|
75
|
+
"
|
|
76
|
+
:size="iconSize"
|
|
77
|
+
:name="
|
|
78
|
+
statusClass(i, item.error) === 'error'
|
|
79
|
+
? IconConfig.CLOSE
|
|
80
|
+
: IconConfig.CHECK_MASK
|
|
81
|
+
"
|
|
82
|
+
></hy-icon>
|
|
83
|
+
</view>
|
|
84
|
+
</template>
|
|
85
|
+
</view>
|
|
86
|
+
<!-- 步骤状态 -->
|
|
95
87
|
|
|
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
|
-
></slot>
|
|
124
|
-
<text v-else :style="{ fontSize: '12px', color: '#999' }">{{
|
|
125
|
-
item.desc
|
|
126
|
-
}}</text>
|
|
127
|
-
</template>
|
|
128
|
-
</view>
|
|
129
|
-
<!-- 内容区域 -->
|
|
130
|
-
</view>
|
|
131
|
-
</template>
|
|
132
|
-
</view>
|
|
88
|
+
<!-- 内容区域 -->
|
|
89
|
+
<view
|
|
90
|
+
class="hy-steps-item__content"
|
|
91
|
+
:class="[`hy-steps-item__content--${direction}`]"
|
|
92
|
+
:style="[contentStyle]"
|
|
93
|
+
>
|
|
94
|
+
<slot v-if="$slots.content" name="content" :record="item" :index="i"></slot>
|
|
95
|
+
<template v-else>
|
|
96
|
+
<slot
|
|
97
|
+
v-if="$slots.title"
|
|
98
|
+
name="title"
|
|
99
|
+
:title="item.title"
|
|
100
|
+
:index="i"
|
|
101
|
+
></slot>
|
|
102
|
+
<text v-else :class="titleClass(i, item.error)">
|
|
103
|
+
{{ item.title }}
|
|
104
|
+
</text>
|
|
105
|
+
<slot v-if="$slots.desc" name="desc" :desc="item.desc" :index="i"></slot>
|
|
106
|
+
<text v-else :style="{ fontSize: '12px', color: '#999' }">{{
|
|
107
|
+
item.desc
|
|
108
|
+
}}</text>
|
|
109
|
+
</template>
|
|
110
|
+
</view>
|
|
111
|
+
<!-- 内容区域 -->
|
|
112
|
+
</view>
|
|
113
|
+
</template>
|
|
114
|
+
</view>
|
|
133
115
|
</template>
|
|
134
116
|
|
|
135
117
|
<script lang="ts">
|
|
136
118
|
export default {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
119
|
+
name: 'hy-steps',
|
|
120
|
+
options: {
|
|
121
|
+
addGlobalClass: true,
|
|
122
|
+
virtualHost: true,
|
|
123
|
+
styleIsolation: 'shared'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
144
126
|
</script>
|
|
145
127
|
|
|
146
128
|
<script setup lang="ts">
|
|
147
|
-
import { computed, ref, onMounted, getCurrentInstance, watch } from
|
|
148
|
-
import type { CSSProperties
|
|
149
|
-
import type { IStepsEmits } from
|
|
150
|
-
import type { StepListVo } from
|
|
151
|
-
import { addUnit, getRect, ColorConfig, IconConfig } from
|
|
129
|
+
import { computed, ref, onMounted, getCurrentInstance, watch } from 'vue'
|
|
130
|
+
import type { CSSProperties } from 'vue'
|
|
131
|
+
import type { IStepsEmits } from './typing'
|
|
132
|
+
import type { StepListVo } from './typing'
|
|
133
|
+
import { addUnit, getRect, ColorConfig, IconConfig } from '../../libs'
|
|
134
|
+
import stepsProps from './props'
|
|
135
|
+
// 组件
|
|
136
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
152
137
|
|
|
153
138
|
/**
|
|
154
139
|
* 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
|
155
140
|
* @displayName hy-steps
|
|
156
141
|
*/
|
|
157
|
-
defineOptions({})
|
|
158
|
-
|
|
159
|
-
// 组件
|
|
160
|
-
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
142
|
+
defineOptions({})
|
|
161
143
|
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
/** 设置当前处于第几步 */
|
|
165
|
-
current: {
|
|
166
|
-
type: Number,
|
|
167
|
-
default: 0,
|
|
168
|
-
},
|
|
169
|
-
/** 步骤条的数据集 */
|
|
170
|
-
list: {
|
|
171
|
-
type: Array as PropType<StepListVo[]>,
|
|
172
|
-
default: [],
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* 方向
|
|
176
|
-
* @values row,column
|
|
177
|
-
* */
|
|
178
|
-
direction: {
|
|
179
|
-
type: String,
|
|
180
|
-
default: "row",
|
|
181
|
-
},
|
|
182
|
-
/** 激活状态颜色 */
|
|
183
|
-
activeColor: {
|
|
184
|
-
type: String,
|
|
185
|
-
default: "",
|
|
186
|
-
},
|
|
187
|
-
/** 未激活状态颜色 */
|
|
188
|
-
inactiveColor: {
|
|
189
|
-
type: String,
|
|
190
|
-
default: "",
|
|
191
|
-
},
|
|
192
|
-
/** 激活状态的图标 */
|
|
193
|
-
activeIcon: String,
|
|
194
|
-
/** 未激活状态图标 */
|
|
195
|
-
inactiveIcon: String,
|
|
196
|
-
/** 是否显示点类型 */
|
|
197
|
-
dot: {
|
|
198
|
-
type: Boolean,
|
|
199
|
-
default: false,
|
|
200
|
-
},
|
|
201
|
-
/** 图标大小 */
|
|
202
|
-
iconSize: {
|
|
203
|
-
type: [String, Number],
|
|
204
|
-
default: 17,
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
const emit = defineEmits<IStepsEmits>();
|
|
144
|
+
const props = defineProps(stepsProps)
|
|
145
|
+
const emit = defineEmits<IStepsEmits>()
|
|
208
146
|
|
|
209
147
|
const size = ref<UniApp.NodeInfo>({
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
})
|
|
213
|
-
const instance = getCurrentInstance()
|
|
148
|
+
height: 0,
|
|
149
|
+
width: 0
|
|
150
|
+
})
|
|
151
|
+
const instance = getCurrentInstance()
|
|
214
152
|
|
|
215
153
|
watch(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
154
|
+
() => props.current,
|
|
155
|
+
(newVal: number) => {
|
|
156
|
+
if (props.list[newVal - 1]?.error) {
|
|
157
|
+
const index = props.list.findIndex((item) => item.error)
|
|
158
|
+
emit('update:current', index)
|
|
159
|
+
emit('change', index)
|
|
160
|
+
}
|
|
222
161
|
}
|
|
223
|
-
|
|
224
|
-
);
|
|
162
|
+
)
|
|
225
163
|
|
|
226
164
|
// 字体标题类名
|
|
227
165
|
const titleClass = computed(() => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
166
|
+
return (index: number, error: boolean) => {
|
|
167
|
+
const classes = ['hy-steps-item__content__title']
|
|
168
|
+
if (props.current === index) {
|
|
169
|
+
classes.push('hy-steps-item__content__title--active')
|
|
232
170
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
171
|
+
if (error) {
|
|
172
|
+
classes.push('hy-steps-item__content__title--error')
|
|
173
|
+
}
|
|
174
|
+
}
|
|
237
175
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
})
|
|
176
|
+
return classes
|
|
177
|
+
}
|
|
178
|
+
})
|
|
241
179
|
// 字体颜色
|
|
242
180
|
const textColor = computed(() => {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
});
|
|
181
|
+
return (index: number) => (index === props.current ? '#ffffff' : props.inactiveColor)
|
|
182
|
+
})
|
|
246
183
|
|
|
247
184
|
/**
|
|
248
185
|
* @description 线条样式
|
|
249
186
|
* */
|
|
250
187
|
const lineStyle = computed(() => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
188
|
+
return (temp: StepListVo, index: number): CSSProperties => {
|
|
189
|
+
const style: CSSProperties = {}
|
|
190
|
+
if (props.direction === 'row') {
|
|
191
|
+
style.width = addUnit(size.value.width! - 25)
|
|
192
|
+
style.left = addUnit(-size.value.width! / 2 + 12)
|
|
193
|
+
} else {
|
|
194
|
+
style.height = addUnit(size.value.height! - 30)
|
|
195
|
+
style.top = addUnit(25)
|
|
196
|
+
}
|
|
197
|
+
style.backgroundColor = temp.error ? '' : index < props.current ? '' : props.inactiveColor
|
|
198
|
+
return style
|
|
259
199
|
}
|
|
260
|
-
|
|
261
|
-
? ""
|
|
262
|
-
: index < props.current
|
|
263
|
-
? ""
|
|
264
|
-
: props.inactiveColor;
|
|
265
|
-
return style;
|
|
266
|
-
};
|
|
267
|
-
});
|
|
200
|
+
})
|
|
268
201
|
|
|
269
202
|
const itemStyleInner = computed(() => {
|
|
270
|
-
|
|
271
|
-
})
|
|
203
|
+
return {}
|
|
204
|
+
})
|
|
272
205
|
/**
|
|
273
206
|
* @description 状态类名
|
|
274
207
|
* */
|
|
275
208
|
const statusClass = computed(() => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
209
|
+
return (index: number, error: boolean = false) => {
|
|
210
|
+
if (props.current == index) {
|
|
211
|
+
return error ? 'error' : 'process'
|
|
212
|
+
} else if (props.current > index) {
|
|
213
|
+
return 'finish'
|
|
214
|
+
} else {
|
|
215
|
+
return 'wait'
|
|
216
|
+
}
|
|
283
217
|
}
|
|
284
|
-
|
|
285
|
-
});
|
|
218
|
+
})
|
|
286
219
|
const statusColor = computed(() => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
220
|
+
return (index: number, error?: boolean) => {
|
|
221
|
+
let colorTmp: string | number
|
|
222
|
+
switch (statusClass.value(index, error)) {
|
|
223
|
+
case 'finish':
|
|
224
|
+
colorTmp = props.activeColor
|
|
225
|
+
break
|
|
226
|
+
case 'error':
|
|
227
|
+
colorTmp = ColorConfig.error
|
|
228
|
+
break
|
|
229
|
+
case 'process':
|
|
230
|
+
colorTmp = props.dot ? props.current : 'transparent'
|
|
231
|
+
break
|
|
232
|
+
default:
|
|
233
|
+
colorTmp = props.inactiveColor
|
|
234
|
+
break
|
|
235
|
+
}
|
|
236
|
+
return colorTmp
|
|
302
237
|
}
|
|
303
|
-
|
|
304
|
-
};
|
|
305
|
-
});
|
|
238
|
+
})
|
|
306
239
|
|
|
307
240
|
const contentStyle = computed<CSSProperties>(() => {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
241
|
+
const style: CSSProperties = {}
|
|
242
|
+
if (props.direction === 'column') {
|
|
243
|
+
style.marginLeft = props.dot ? '2px' : '6px'
|
|
244
|
+
style.marginTop = props.dot ? '0px' : '6px'
|
|
245
|
+
} else {
|
|
246
|
+
style.marginTop = props.dot ? '2px' : '6px'
|
|
247
|
+
style.marginLeft = props.dot ? '2px' : '6px'
|
|
248
|
+
}
|
|
316
249
|
|
|
317
|
-
|
|
318
|
-
})
|
|
250
|
+
return style
|
|
251
|
+
})
|
|
319
252
|
|
|
320
253
|
onMounted(() => {
|
|
321
|
-
|
|
322
|
-
})
|
|
254
|
+
getStepsItemRect()
|
|
255
|
+
})
|
|
323
256
|
|
|
324
257
|
// 获取组件的尺寸,用于设置横线的位置
|
|
325
258
|
const getStepsItemRect = () => {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
259
|
+
getRect('.hy-steps-item', false, instance).then((rect) => {
|
|
260
|
+
size.value = rect as UniApp.NodeInfo
|
|
261
|
+
})
|
|
262
|
+
}
|
|
330
263
|
</script>
|
|
331
264
|
|
|
332
265
|
<style lang="scss" scoped>
|
|
333
|
-
@import
|
|
266
|
+
@import './index.scss';
|
|
334
267
|
</style>
|