oxy-uni-ui 1.2.3 → 2.0.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/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +353 -328
- package/components/common/util.ts +185 -32
- package/components/composables/index.ts +1 -0
- package/components/composables/usePopover.ts +24 -20
- package/components/composables/useVirtualScroll.ts +10 -9
- package/components/composables/useWindowResize.ts +35 -0
- package/components/oxy-action-sheet/index.scss +24 -11
- package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
- package/components/oxy-action-sheet/types.ts +7 -0
- package/components/oxy-backtop/index.scss +3 -3
- package/components/oxy-backtop/oxy-backtop.vue +9 -6
- package/components/oxy-backtop/types.ts +7 -7
- package/components/oxy-badge/index.scss +4 -4
- package/components/oxy-badge/oxy-badge.vue +3 -3
- package/components/oxy-badge/types.ts +2 -2
- package/components/oxy-button/index.scss +5 -5
- package/components/oxy-button/oxy-button.vue +5 -1
- package/components/oxy-calendar/index.scss +11 -11
- package/components/oxy-calendar/oxy-calendar.vue +1 -0
- package/components/oxy-calendar/types.ts +5 -0
- package/components/oxy-calendar-view/month/index.scss +4 -4
- package/components/oxy-calendar-view/month/types.ts +36 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
- package/components/oxy-calendar-view/year/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
- package/components/oxy-card/index.scss +2 -2
- package/components/oxy-cell/index.scss +8 -8
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox-group/index.scss +2 -2
- package/components/oxy-circle/oxy-circle.vue +10 -7
- package/components/oxy-circle/types.ts +5 -5
- package/components/oxy-col/oxy-col.vue +2 -2
- package/components/oxy-col-picker/index.scss +4 -4
- package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
- package/components/oxy-col-picker/types.ts +7 -2
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
- package/components/oxy-corner/index.scss +32 -32
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-curtain/index.scss +15 -15
- package/components/oxy-curtain/oxy-curtain.vue +4 -2
- package/components/oxy-curtain/types.ts +6 -1
- package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
- package/components/oxy-date-strip/types.ts +1 -1
- package/components/oxy-date-strip-item/index.scss +3 -3
- package/components/oxy-datetime-picker/index.scss +11 -11
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
- package/components/oxy-datetime-picker/types.ts +5 -0
- package/components/oxy-drop-menu/index.scss +3 -3
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
- package/components/oxy-drop-menu-item/types.ts +5 -0
- package/components/oxy-echarts/types.ts +6 -0
- package/components/oxy-fab/index.scss +8 -8
- package/components/oxy-fab/oxy-fab.vue +22 -3
- package/components/oxy-file-list/index.scss +24 -23
- package/components/oxy-file-list/oxy-file-list.vue +2 -2
- package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
- package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
- package/components/oxy-footer/index.scss +19 -0
- package/components/oxy-footer/oxy-footer.vue +78 -0
- package/components/oxy-footer/types.ts +17 -0
- package/components/oxy-form-item/types.ts +22 -1
- package/components/oxy-gap/oxy-gap.vue +2 -2
- package/components/oxy-gap/types.ts +2 -2
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid/types.ts +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
- package/components/oxy-grid-item/types.ts +1 -1
- package/components/oxy-guidance/index.scss +75 -0
- package/components/oxy-guidance/oxy-guidance.vue +201 -0
- package/components/oxy-guidance/types.ts +33 -0
- package/components/oxy-icon/oxy-icon.vue +2 -2
- package/components/oxy-icon/types.ts +1 -1
- package/components/oxy-img/oxy-img.vue +4 -4
- package/components/oxy-img/types.ts +3 -3
- package/components/oxy-img-cropper/index.scss +12 -12
- package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
- package/components/oxy-img-cropper/types.ts +2 -2
- package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
- package/components/oxy-img-lazy/types.ts +3 -3
- package/components/oxy-index-anchor/index.scss +2 -2
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
- package/components/oxy-index-bar/index.scss +3 -3
- package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
- package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
- package/components/oxy-input/index.scss +1 -1
- package/components/oxy-input-number/index.scss +5 -5
- package/components/oxy-input-number/oxy-input-number.vue +2 -2
- package/components/oxy-input-number/types.ts +3 -2
- package/components/oxy-keyboard/index.scss +5 -5
- package/components/oxy-keyboard/key/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -2
- package/components/oxy-keyboard/key/types.ts +15 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
- package/components/oxy-keyboard/types.ts +5 -0
- package/components/oxy-link/index.scss +2 -2
- package/components/oxy-list/oxy-list.vue +4 -3
- package/components/oxy-loading/oxy-loading.vue +8 -4
- package/components/oxy-loading/types.ts +1 -1
- package/components/oxy-loadmore/index.scss +3 -3
- package/components/oxy-long-press-menu/index.scss +93 -0
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
- package/components/oxy-long-press-menu/types.ts +34 -0
- package/components/oxy-message-box/index.scss +12 -11
- package/components/oxy-message-box/oxy-message-box.vue +11 -3
- package/components/oxy-message-box/types.ts +14 -0
- package/components/oxy-navbar/index.scss +2 -2
- package/components/oxy-navbar/oxy-navbar.vue +58 -13
- package/components/oxy-navbar/types.ts +8 -1
- package/components/oxy-navbar-capsule/types.ts +3 -0
- package/components/oxy-notice-bar/index.scss +3 -3
- package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
- package/components/oxy-notice-bar/types.ts +3 -3
- package/components/oxy-notify/index.ts +1 -0
- package/components/oxy-notify/oxy-notify.vue +3 -2
- package/components/oxy-notify/types.ts +7 -0
- package/components/oxy-pagination/index.scss +1 -1
- package/components/oxy-password-input/oxy-password-input.vue +2 -2
- package/components/oxy-password-input/types.ts +1 -1
- package/components/oxy-picker/index.scss +45 -2
- package/components/oxy-picker/oxy-picker.vue +100 -14
- package/components/oxy-picker/types.ts +29 -1
- package/components/oxy-picker-view/index.scss +3 -3
- package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
- package/components/oxy-popover/index.scss +9 -9
- package/components/oxy-popup/index.scss +2 -2
- package/components/oxy-popup/oxy-popup.vue +35 -2
- package/components/oxy-popup/types.ts +8 -1
- package/components/oxy-progress/index.scss +3 -3
- package/components/oxy-qrcode/draw.ts +398 -0
- package/components/oxy-qrcode/index.scss +2 -0
- package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
- package/components/oxy-qrcode/qrcode.ts +936 -0
- package/components/oxy-qrcode/types.ts +42 -0
- package/components/oxy-radio/index.scss +10 -10
- package/components/oxy-radio-group/index.scss +2 -2
- package/components/oxy-rate/types.ts +4 -4
- package/components/oxy-resize/index.scss +2 -2
- package/components/oxy-resize/oxy-resize.vue +4 -4
- package/components/oxy-resize/types.ts +3 -0
- package/components/oxy-rich-text/index.scss +30 -29
- package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
- package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
- package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
- package/components/oxy-rich-text/types.ts +6 -1
- package/components/oxy-row/oxy-row.vue +3 -3
- package/components/oxy-row/types.ts +1 -1
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-segmented/index.scss +16 -16
- package/components/oxy-segmented/oxy-segmented.vue +23 -3
- package/components/oxy-select/index.scss +144 -68
- package/components/oxy-select/oxy-select.vue +85 -50
- package/components/oxy-select/types.ts +13 -1
- package/components/oxy-select-picker/index.scss +7 -7
- package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
- package/components/oxy-select-picker/types.ts +2 -0
- package/components/oxy-sidebar-item/index.scss +1 -1
- package/components/oxy-signature/oxy-signature.vue +18 -10
- package/components/oxy-signature/types.ts +106 -13
- package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
- package/components/oxy-skeleton/types.ts +1 -1
- package/components/oxy-slider/index.scss +3 -3
- package/components/oxy-sort-button/index.scss +8 -8
- package/components/oxy-status-tip/index.scss +4 -4
- package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
- package/components/oxy-status-tip/types.ts +3 -3
- package/components/oxy-step/index.scss +14 -14
- package/components/oxy-sticky/oxy-sticky.vue +6 -6
- package/components/oxy-stream-render/types.ts +4 -1
- package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
- package/components/oxy-swiper/oxy-swiper.vue +6 -6
- package/components/oxy-swiper/types.ts +5 -5
- package/components/oxy-switch/index.scss +8 -8
- package/components/oxy-switch/oxy-switch.vue +2 -2
- package/components/oxy-switch/types.ts +1 -1
- package/components/oxy-tab/index.scss +11 -1
- package/components/oxy-tabbar/index.scss +1 -1
- package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
- package/components/oxy-table/index.scss +5 -5
- package/components/oxy-table/oxy-table.vue +8 -6
- package/components/oxy-table/types.ts +2 -2
- package/components/oxy-table-col/oxy-table-col.vue +3 -3
- package/components/oxy-table-col/types.ts +2 -2
- package/components/oxy-tabs/index.scss +43 -15
- package/components/oxy-tabs/oxy-tabs.vue +53 -19
- package/components/oxy-tabs/types.ts +15 -3
- package/components/oxy-tag/index.scss +15 -15
- package/components/oxy-text/index.scss +5 -1
- package/components/oxy-text/oxy-text.vue +76 -7
- package/components/oxy-text/types.ts +12 -0
- package/components/oxy-textarea/index.scss +6 -6
- package/components/oxy-toast/oxy-toast.vue +24 -8
- package/components/oxy-tooltip/index.scss +9 -9
- package/components/oxy-tree/index.scss +51 -15
- package/components/oxy-tree/oxy-tree.vue +13 -9
- package/components/oxy-tree/types.ts +12 -9
- package/components/oxy-upload/index.scss +21 -21
- package/components/oxy-upload/types.ts +2 -2
- package/components/oxy-verification-code/index.scss +6 -0
- package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
- package/components/oxy-verification-code/types.ts +82 -0
- package/components/oxy-video-preview/index.scss +4 -4
- package/components/oxy-virtual-scroll/index.scss +4 -4
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
- package/components/oxy-virtual-scroll/types.ts +14 -14
- package/components/oxy-voice-player/index.scss +908 -0
- package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
- package/components/oxy-voice-player/types.ts +567 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
- package/components/oxy-waterfall/types.ts +6 -6
- package/components/oxy-watermark/oxy-watermark.vue +35 -13
- package/components/oxy-watermark/types.ts +14 -14
- package/global.d.ts +2 -0
- package/locale/lang/ar-SA.ts +3 -0
- package/locale/lang/en-US.ts +3 -0
- package/locale/lang/zh-CN.ts +3 -0
- package/package.json +97 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/oxy-number-keyboard/index.scss +0 -78
- package/components/oxy-number-keyboard/key/index.scss +0 -81
- package/components/oxy-number-keyboard/key/index.vue +0 -78
- package/components/oxy-number-keyboard/key/types.ts +0 -11
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
- package/components/oxy-number-keyboard/types.ts +0 -83
- package/components/oxy-tree/components/tree-node-content.vue +0 -72
- package/components/oxy-tree/index.ts +0 -51
- package/oxy-uni-ui.zip +0 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp, makeNumericProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 内部音频上下文接口
|
|
6
|
+
*/
|
|
7
|
+
export interface InnerAudioContext {
|
|
8
|
+
/**
|
|
9
|
+
* 音频地址
|
|
10
|
+
*/
|
|
11
|
+
src: string
|
|
12
|
+
/**
|
|
13
|
+
* 是否循环播放
|
|
14
|
+
*/
|
|
15
|
+
loop: boolean
|
|
16
|
+
/**
|
|
17
|
+
* 音量
|
|
18
|
+
*/
|
|
19
|
+
volume: number
|
|
20
|
+
/**
|
|
21
|
+
* 总时长
|
|
22
|
+
*/
|
|
23
|
+
duration: number
|
|
24
|
+
/**
|
|
25
|
+
* 自动
|
|
26
|
+
*/
|
|
27
|
+
autoPlay: boolean
|
|
28
|
+
/**
|
|
29
|
+
* 当前播放时间
|
|
30
|
+
*/
|
|
31
|
+
currentTime: number
|
|
32
|
+
/**
|
|
33
|
+
* 缓冲时间
|
|
34
|
+
*/
|
|
35
|
+
buffered: number
|
|
36
|
+
/**
|
|
37
|
+
* 开始播放时间
|
|
38
|
+
*/
|
|
39
|
+
startTime: number
|
|
40
|
+
/**
|
|
41
|
+
* 播放
|
|
42
|
+
*/
|
|
43
|
+
play: () => void
|
|
44
|
+
/**
|
|
45
|
+
* 暂停
|
|
46
|
+
*/
|
|
47
|
+
pause: () => void
|
|
48
|
+
/**
|
|
49
|
+
* 停止
|
|
50
|
+
*/
|
|
51
|
+
stop: () => void
|
|
52
|
+
/**
|
|
53
|
+
* 跳转
|
|
54
|
+
*/
|
|
55
|
+
seek: (position: number) => void
|
|
56
|
+
/**
|
|
57
|
+
* 销毁
|
|
58
|
+
*/
|
|
59
|
+
destroy: () => void
|
|
60
|
+
/**
|
|
61
|
+
* 监听可以播放事件
|
|
62
|
+
*/
|
|
63
|
+
onCanplay: (callback: () => void) => void
|
|
64
|
+
/**
|
|
65
|
+
* 监听播放事件
|
|
66
|
+
*/
|
|
67
|
+
onPlay: (callback: () => void) => void
|
|
68
|
+
/**
|
|
69
|
+
* 监听暂停事件
|
|
70
|
+
*/
|
|
71
|
+
onPause: (callback: () => void) => void
|
|
72
|
+
/**
|
|
73
|
+
* 监听停止事件
|
|
74
|
+
*/
|
|
75
|
+
onStop: (callback: () => void) => void
|
|
76
|
+
/**
|
|
77
|
+
* 监听播放结束事件
|
|
78
|
+
*/
|
|
79
|
+
onEnded: (callback: () => void) => void
|
|
80
|
+
/**
|
|
81
|
+
* 监听错误事件
|
|
82
|
+
*/
|
|
83
|
+
onError: (callback: (error: { errMsg: string; errCode: number }) => void) => void
|
|
84
|
+
/**
|
|
85
|
+
* 监听时间更新事件
|
|
86
|
+
*/
|
|
87
|
+
onTimeUpdate: (callback: () => void) => void
|
|
88
|
+
/**
|
|
89
|
+
* 取消监听可以播放事件
|
|
90
|
+
*/
|
|
91
|
+
offCanplay: (callback?: () => void) => void
|
|
92
|
+
/**
|
|
93
|
+
* 取消监听播放事件
|
|
94
|
+
*/
|
|
95
|
+
offPlay: (callback?: () => void) => void
|
|
96
|
+
/**
|
|
97
|
+
* 取消监听暂停事件
|
|
98
|
+
*/
|
|
99
|
+
offPause: (callback?: () => void) => void
|
|
100
|
+
/**
|
|
101
|
+
* 取消监听停止事件
|
|
102
|
+
*/
|
|
103
|
+
offStop: (callback?: () => void) => void
|
|
104
|
+
/**
|
|
105
|
+
* 取消监听播放结束事件
|
|
106
|
+
*/
|
|
107
|
+
offEnded: (callback?: () => void) => void
|
|
108
|
+
/**
|
|
109
|
+
* 取消监听错误事件
|
|
110
|
+
*/
|
|
111
|
+
offError: (callback?: (error: { errMsg: string; errCode: number }) => void) => void
|
|
112
|
+
/**
|
|
113
|
+
* 取消监听时间更新事件
|
|
114
|
+
*/
|
|
115
|
+
offTimeUpdate: (callback?: () => void) => void
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 播放器模式
|
|
120
|
+
*/
|
|
121
|
+
export type VoicePlayerMode = 'list' | 'single' | 'random'
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 播放器主题
|
|
125
|
+
*/
|
|
126
|
+
export type VoicePlayerTheme = 'light' | 'dark'
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 播放器视图模式
|
|
130
|
+
*/
|
|
131
|
+
export type VoicePlayerViewMode = 'normal' | 'mini' | 'simple' | 'hideView'
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 播放器额外控制按钮
|
|
135
|
+
*/
|
|
136
|
+
export type VoicePlayerExtraControl = 'playMode' | 'favorite' | 'mini' | 'volume'
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 歌曲信息
|
|
140
|
+
*/
|
|
141
|
+
export interface VoicePlayerSongInfo {
|
|
142
|
+
/**
|
|
143
|
+
* 音频地址
|
|
144
|
+
*/
|
|
145
|
+
src: string
|
|
146
|
+
/**
|
|
147
|
+
* 标题
|
|
148
|
+
*/
|
|
149
|
+
title?: string
|
|
150
|
+
/**
|
|
151
|
+
* 歌手
|
|
152
|
+
*/
|
|
153
|
+
artist?: string
|
|
154
|
+
/**
|
|
155
|
+
* 专辑
|
|
156
|
+
*/
|
|
157
|
+
album?: string
|
|
158
|
+
/**
|
|
159
|
+
* 封面
|
|
160
|
+
*/
|
|
161
|
+
cover?: string
|
|
162
|
+
/**
|
|
163
|
+
* 歌词
|
|
164
|
+
*/
|
|
165
|
+
lyrics?: VoicePlayerLyricLine[]
|
|
166
|
+
/**
|
|
167
|
+
* 总时长
|
|
168
|
+
*/
|
|
169
|
+
duration?: number
|
|
170
|
+
[key: string]: any
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 歌词行
|
|
175
|
+
*/
|
|
176
|
+
export interface VoicePlayerLyricLine {
|
|
177
|
+
/**
|
|
178
|
+
* 时间
|
|
179
|
+
*/
|
|
180
|
+
time: number
|
|
181
|
+
/**
|
|
182
|
+
* 文本
|
|
183
|
+
*/
|
|
184
|
+
text: string
|
|
185
|
+
/**
|
|
186
|
+
* 翻译
|
|
187
|
+
*/
|
|
188
|
+
translation?: string
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 时间更新事件
|
|
193
|
+
*/
|
|
194
|
+
export interface VoicePlayerTimeUpdateEvent {
|
|
195
|
+
/**
|
|
196
|
+
* 当前播放时间
|
|
197
|
+
*/
|
|
198
|
+
currentTime: number
|
|
199
|
+
/**
|
|
200
|
+
* 总时长
|
|
201
|
+
*/
|
|
202
|
+
duration: number
|
|
203
|
+
/**
|
|
204
|
+
* 缓冲时间
|
|
205
|
+
*/
|
|
206
|
+
buffered?: number
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 歌曲切换事件
|
|
211
|
+
*/
|
|
212
|
+
export interface VoicePlayerSongChangeEvent {
|
|
213
|
+
/**
|
|
214
|
+
* 索引
|
|
215
|
+
*/
|
|
216
|
+
index: number
|
|
217
|
+
/**
|
|
218
|
+
* 歌曲信息
|
|
219
|
+
*/
|
|
220
|
+
song: VoicePlayerSongInfo
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* 音量变化事件
|
|
225
|
+
*/
|
|
226
|
+
export interface VoicePlayerVolumeChangeEvent {
|
|
227
|
+
/**
|
|
228
|
+
* 音量
|
|
229
|
+
*/
|
|
230
|
+
volume: number
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* 跳转事件
|
|
235
|
+
*/
|
|
236
|
+
export interface VoicePlayerSeekEvent {
|
|
237
|
+
/**
|
|
238
|
+
* 时间
|
|
239
|
+
*/
|
|
240
|
+
time: number
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 错误事件
|
|
245
|
+
*/
|
|
246
|
+
export interface VoicePlayerErrorEvent {
|
|
247
|
+
/**
|
|
248
|
+
* 错误信息
|
|
249
|
+
*/
|
|
250
|
+
message: string
|
|
251
|
+
/**
|
|
252
|
+
* 错误对象
|
|
253
|
+
*/
|
|
254
|
+
error: any
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 滑块变化事件
|
|
259
|
+
*/
|
|
260
|
+
export interface SliderChangeEvent {
|
|
261
|
+
detail: {
|
|
262
|
+
/**
|
|
263
|
+
* 值
|
|
264
|
+
*/
|
|
265
|
+
value: number
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* 触摸点
|
|
271
|
+
*/
|
|
272
|
+
export interface TouchPoint {
|
|
273
|
+
/**
|
|
274
|
+
* 触点相对于视口的 X 坐标
|
|
275
|
+
*/
|
|
276
|
+
clientX?: number
|
|
277
|
+
/**
|
|
278
|
+
* 触点相对于视口的 Y 坐标
|
|
279
|
+
*/
|
|
280
|
+
clientY?: number
|
|
281
|
+
/**
|
|
282
|
+
* 触点相对于文档的 X 坐标
|
|
283
|
+
*/
|
|
284
|
+
pageX?: number
|
|
285
|
+
/**
|
|
286
|
+
* 触点相对于文档的 Y 坐标
|
|
287
|
+
*/
|
|
288
|
+
pageY?: number
|
|
289
|
+
/**
|
|
290
|
+
* 触点相对于屏幕的 X 坐标
|
|
291
|
+
*/
|
|
292
|
+
x?: number
|
|
293
|
+
/**
|
|
294
|
+
* 触点相对于屏幕的 Y 坐标
|
|
295
|
+
*/
|
|
296
|
+
y?: number
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 触摸事件
|
|
301
|
+
*/
|
|
302
|
+
export interface TouchEvent {
|
|
303
|
+
/**
|
|
304
|
+
* 当前触点列表
|
|
305
|
+
*/
|
|
306
|
+
touches?: TouchPoint[]
|
|
307
|
+
/**
|
|
308
|
+
* 变化后的触点列表
|
|
309
|
+
*/
|
|
310
|
+
changedTouches?: TouchPoint[]
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export const voicePlayerProps = {
|
|
314
|
+
...baseProps,
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* 音频地址
|
|
318
|
+
*/
|
|
319
|
+
src: makeStringProp(''),
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* 标题
|
|
323
|
+
*/
|
|
324
|
+
title: makeStringProp(''),
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* 歌手
|
|
328
|
+
*/
|
|
329
|
+
artist: makeStringProp(''),
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* 专辑
|
|
333
|
+
*/
|
|
334
|
+
album: makeStringProp(''),
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* 封面
|
|
338
|
+
*/
|
|
339
|
+
cover: makeStringProp(''),
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 是否循环播放
|
|
343
|
+
*/
|
|
344
|
+
loop: makeBooleanProp(false),
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* 音量
|
|
348
|
+
*/
|
|
349
|
+
volume: makeNumericProp(1),
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* 播放列表
|
|
353
|
+
*/
|
|
354
|
+
playlist: {
|
|
355
|
+
type: Array as PropType<VoicePlayerSongInfo[]>,
|
|
356
|
+
default: () => []
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 播放模式
|
|
361
|
+
*/
|
|
362
|
+
playMode: makeStringProp<VoicePlayerMode>('list'),
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* 主题
|
|
366
|
+
*/
|
|
367
|
+
theme: makeStringProp<VoicePlayerTheme>('light'),
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 是否显示封面
|
|
371
|
+
*/
|
|
372
|
+
showCover: makeBooleanProp(true),
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 是否显示信息
|
|
376
|
+
*/
|
|
377
|
+
showInfo: makeBooleanProp(true),
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* 是否显示进度条
|
|
381
|
+
*/
|
|
382
|
+
showProgress: makeBooleanProp(true),
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* 是否显示上一首/下一首按钮
|
|
386
|
+
*/
|
|
387
|
+
showPrevNext: makeBooleanProp(true),
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* 额外控制按钮
|
|
391
|
+
*/
|
|
392
|
+
extraControls: {
|
|
393
|
+
type: Array as PropType<VoicePlayerExtraControl[]>,
|
|
394
|
+
default: () => []
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* 是否显示歌词
|
|
399
|
+
*/
|
|
400
|
+
showLyrics: makeBooleanProp(false),
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* 歌词
|
|
404
|
+
*/
|
|
405
|
+
lyrics: {
|
|
406
|
+
type: Array as PropType<VoicePlayerLyricLine[]>,
|
|
407
|
+
default: () => []
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* 是否显示翻译
|
|
412
|
+
*/
|
|
413
|
+
showTranslation: makeBooleanProp(false),
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* 视图模式
|
|
417
|
+
*/
|
|
418
|
+
viewMode: makeStringProp<VoicePlayerViewMode>('normal'),
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* 是否启用旋转
|
|
422
|
+
*/
|
|
423
|
+
enableRotation: makeBooleanProp(true),
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 是否可以跳转
|
|
427
|
+
*/
|
|
428
|
+
canSeek: makeBooleanProp(true),
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* 默认封面
|
|
432
|
+
*/
|
|
433
|
+
defaultCover: makeStringProp('')
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* 语音播放器事件
|
|
438
|
+
*/
|
|
439
|
+
export type VoicePlayerEmits = {
|
|
440
|
+
/**
|
|
441
|
+
* 播放事件
|
|
442
|
+
*/
|
|
443
|
+
play: []
|
|
444
|
+
/**
|
|
445
|
+
* 暂停事件
|
|
446
|
+
*/
|
|
447
|
+
pause: []
|
|
448
|
+
/**
|
|
449
|
+
* 停止事件
|
|
450
|
+
*/
|
|
451
|
+
stop: []
|
|
452
|
+
/**
|
|
453
|
+
* 播放结束事件
|
|
454
|
+
*/
|
|
455
|
+
ended: []
|
|
456
|
+
/**
|
|
457
|
+
* 可以播放事件
|
|
458
|
+
*/
|
|
459
|
+
canplay: [event: { duration: number }]
|
|
460
|
+
/**
|
|
461
|
+
* 时间更新事件
|
|
462
|
+
*/
|
|
463
|
+
timeupdate: [event: VoicePlayerTimeUpdateEvent]
|
|
464
|
+
/**
|
|
465
|
+
* 上一首事件
|
|
466
|
+
*/
|
|
467
|
+
prev: [event: VoicePlayerSongChangeEvent | null]
|
|
468
|
+
/**
|
|
469
|
+
* 下一首事件
|
|
470
|
+
*/
|
|
471
|
+
next: [event: VoicePlayerSongChangeEvent | null]
|
|
472
|
+
/**
|
|
473
|
+
* 歌曲切换事件
|
|
474
|
+
*/
|
|
475
|
+
'song-change': [event: VoicePlayerSongChangeEvent | null]
|
|
476
|
+
/**
|
|
477
|
+
* 播放模式变化事件
|
|
478
|
+
*/
|
|
479
|
+
'play-mode-change': [mode: VoicePlayerMode]
|
|
480
|
+
/**
|
|
481
|
+
* 视图模式变化事件
|
|
482
|
+
*/
|
|
483
|
+
'mode-change': [mode: VoicePlayerViewMode]
|
|
484
|
+
/**
|
|
485
|
+
* 音量变化事件
|
|
486
|
+
*/
|
|
487
|
+
'volume-change': [vol: number]
|
|
488
|
+
/**
|
|
489
|
+
* 收藏变化事件
|
|
490
|
+
*/
|
|
491
|
+
'favorite-change': [isFavorited: boolean, song?: VoicePlayerSongInfo]
|
|
492
|
+
/**
|
|
493
|
+
* 跳转事件
|
|
494
|
+
*/
|
|
495
|
+
seek: [event: VoicePlayerSeekEvent]
|
|
496
|
+
/**
|
|
497
|
+
* 封面错误事件
|
|
498
|
+
*/
|
|
499
|
+
'cover-error': []
|
|
500
|
+
/**
|
|
501
|
+
* 错误事件
|
|
502
|
+
*/
|
|
503
|
+
error: [event: VoicePlayerErrorEvent]
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* 语音播放器暴露方法
|
|
508
|
+
*/
|
|
509
|
+
export type VoicePlayerExpose = {
|
|
510
|
+
/**
|
|
511
|
+
* 播放
|
|
512
|
+
*/
|
|
513
|
+
play: () => void
|
|
514
|
+
/**
|
|
515
|
+
* 暂停
|
|
516
|
+
*/
|
|
517
|
+
pause: () => void
|
|
518
|
+
/**
|
|
519
|
+
* 停止
|
|
520
|
+
*/
|
|
521
|
+
stop: () => void
|
|
522
|
+
/**
|
|
523
|
+
* 跳转到指定时间
|
|
524
|
+
*/
|
|
525
|
+
seek: (time: number) => void
|
|
526
|
+
/**
|
|
527
|
+
* 设置音量
|
|
528
|
+
*/
|
|
529
|
+
setVolume: (volume: number) => void
|
|
530
|
+
/**
|
|
531
|
+
* 上一首
|
|
532
|
+
*/
|
|
533
|
+
prev: () => void
|
|
534
|
+
/**
|
|
535
|
+
* 下一首
|
|
536
|
+
*/
|
|
537
|
+
next: () => void
|
|
538
|
+
/**
|
|
539
|
+
* 切换到指定歌曲
|
|
540
|
+
*/
|
|
541
|
+
switchToSong: (index: number) => void
|
|
542
|
+
/**
|
|
543
|
+
* 获取播放状态
|
|
544
|
+
*/
|
|
545
|
+
getPlayState: () => {
|
|
546
|
+
/**
|
|
547
|
+
* 是否正在播放
|
|
548
|
+
*/
|
|
549
|
+
isPlaying: boolean
|
|
550
|
+
/**
|
|
551
|
+
* 当前播放时间
|
|
552
|
+
*/
|
|
553
|
+
currentTime: number
|
|
554
|
+
/**
|
|
555
|
+
* 总时长
|
|
556
|
+
*/
|
|
557
|
+
duration: number
|
|
558
|
+
/**
|
|
559
|
+
* 当前歌曲
|
|
560
|
+
*/
|
|
561
|
+
currentSong: VoicePlayerSongInfo | null
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export type VoicePlayerProps = ExtractPropTypes<typeof voicePlayerProps>
|
|
566
|
+
|
|
567
|
+
export type VoicePlayerInstance = ComponentPublicInstance<VoicePlayerProps, VoicePlayerExpose>
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
</script>
|
|
51
51
|
<script lang="ts" setup>
|
|
52
52
|
import type { ScrollViewOnRefresherrefreshEvent, ScrollViewOnScrollEvent } from '@uni-helper/uni-app-types/index'
|
|
53
|
-
import { objToStyle, isDef,
|
|
53
|
+
import { objToStyle, isDef, withDefaultUnit } from '../common/util'
|
|
54
54
|
import { computed, ref, watch, nextTick } from 'vue'
|
|
55
55
|
import { waterfallProps } from './types'
|
|
56
56
|
|
|
@@ -161,7 +161,7 @@ function clearColumn() {
|
|
|
161
161
|
const waterfallStyle = computed(() => {
|
|
162
162
|
const style: Record<string, any> = {}
|
|
163
163
|
if (isDef(props.height)) {
|
|
164
|
-
style['height'] =
|
|
164
|
+
style['height'] = withDefaultUnit(props.height)
|
|
165
165
|
}
|
|
166
166
|
return `${objToStyle(style)}${props.customStyle}`
|
|
167
167
|
})
|
|
@@ -169,10 +169,10 @@ const waterfallStyle = computed(() => {
|
|
|
169
169
|
const containerStyle = computed(() => {
|
|
170
170
|
const style: Record<string, any> = {}
|
|
171
171
|
if (props.leftGap) {
|
|
172
|
-
style['padding-left'] =
|
|
172
|
+
style['padding-left'] = withDefaultUnit(props.leftGap)
|
|
173
173
|
}
|
|
174
174
|
if (props.rightGap) {
|
|
175
|
-
style['padding-right'] =
|
|
175
|
+
style['padding-right'] = withDefaultUnit(props.rightGap)
|
|
176
176
|
}
|
|
177
177
|
return objToStyle(style)
|
|
178
178
|
})
|
|
@@ -180,7 +180,7 @@ const containerStyle = computed(() => {
|
|
|
180
180
|
const columnStyle = computed(() => {
|
|
181
181
|
const style: Record<string, any> = {}
|
|
182
182
|
if (props.columnGap) {
|
|
183
|
-
style['margin-left'] =
|
|
183
|
+
style['margin-left'] = withDefaultUnit(props.columnGap)
|
|
184
184
|
}
|
|
185
185
|
return objToStyle(style)
|
|
186
186
|
})
|
|
@@ -188,7 +188,7 @@ const columnStyle = computed(() => {
|
|
|
188
188
|
const itemStyle = computed(() => {
|
|
189
189
|
const style: Record<string, any> = {}
|
|
190
190
|
if (props.columnGap) {
|
|
191
|
-
style['margin-top'] =
|
|
191
|
+
style['margin-top'] = withDefaultUnit(props.columnGap)
|
|
192
192
|
}
|
|
193
193
|
return objToStyle(style)
|
|
194
194
|
})
|
|
@@ -20,7 +20,7 @@ export const waterfallProps = {
|
|
|
20
20
|
idKey: makeStringProp('id'),
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 容器的高度,number 类型按 `rpx` 语义处理
|
|
24
24
|
*/
|
|
25
25
|
height: numericProp,
|
|
26
26
|
|
|
@@ -33,21 +33,21 @@ export const waterfallProps = {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* 列与列的间隙
|
|
36
|
-
* 类型:number
|
|
37
|
-
* 默认值:
|
|
36
|
+
* 类型:number(number 类型按 `rpx` 语义处理)
|
|
37
|
+
* 默认值:40
|
|
38
38
|
*/
|
|
39
|
-
columnGap: makeNumberProp(
|
|
39
|
+
columnGap: makeNumberProp(40),
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* 左边和列表的间隙
|
|
43
|
-
* 类型:number
|
|
43
|
+
* 类型:number(number 类型按 `rpx` 语义处理)
|
|
44
44
|
* 默认值:0
|
|
45
45
|
*/
|
|
46
46
|
leftGap: makeNumberProp(0),
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* 右边和列表的间隙
|
|
50
|
-
* 类型:number
|
|
50
|
+
* 类型:number(number 类型按 `rpx` 语义处理)
|
|
51
51
|
* 默认值:0
|
|
52
52
|
*/
|
|
53
53
|
rightGap: makeNumberProp(0),
|