hy-app 0.6.9 → 0.7.1
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/hy-avatar/hy-avatar.vue +12 -5
- package/components/hy-avatar/props.ts +4 -2
- package/components/hy-avatar/typing.d.ts +8 -1
- package/components/hy-calendar/hy-calendar.vue +3 -2
- package/components/hy-calendar/month.vue +25 -5
- package/components/hy-calendar/props.ts +1 -1
- package/components/hy-calendar/typing.d.ts +9 -0
- package/components/hy-cascader/hy-cascader.vue +503 -0
- package/components/hy-cascader/index.scss +84 -0
- package/components/hy-cascader/props.ts +88 -0
- package/components/hy-cascader/typing.d.ts +34 -0
- package/components/hy-check-button/typing.d.ts +12 -7
- package/components/hy-code-input/hy-code-input.vue +33 -11
- package/components/hy-code-input/typing.d.ts +4 -0
- package/components/hy-config-provider/hy-config-provider.vue +58 -53
- package/components/hy-count-down/hy-count-down.vue +8 -8
- package/components/hy-count-down/typing.d.ts +16 -0
- package/components/hy-count-to/hy-count-to.vue +7 -7
- package/components/hy-count-to/typing.d.ts +24 -0
- package/components/hy-datetime-picker/props.ts +1 -1
- package/components/hy-datetime-picker/typing.d.ts +1 -1
- package/components/hy-dropdown/typing.d.ts +5 -0
- package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
- package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
- package/components/hy-folding-panel/typing.d.ts +23 -0
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
- package/components/hy-folding-panel-item/typing.d.ts +21 -0
- package/components/hy-form/hy-form.vue +2 -2
- package/components/hy-form/typing.d.ts +37 -0
- package/components/hy-form-item/typing.d.ts +1 -1
- package/components/hy-grid/hy-grid.vue +12 -12
- package/components/hy-grid/index.scss +1 -2
- package/components/hy-grid/props.ts +7 -2
- package/components/hy-grid/typing.d.ts +1 -1
- package/components/hy-icon/typing.d.ts +52 -9
- package/components/hy-keyboard/constants.ts +83 -0
- package/components/hy-keyboard/hy-keyboard.vue +375 -0
- package/components/hy-keyboard/index.scss +73 -0
- package/components/hy-keyboard/key/index.scss +79 -0
- package/components/hy-keyboard/key/index.vue +91 -0
- package/components/hy-keyboard/key/types.ts +1 -0
- package/components/hy-keyboard/props.ts +108 -0
- package/components/hy-keyboard/typing.d.ts +18 -0
- package/components/hy-list/hy-list.vue +15 -13
- package/components/hy-list/props.ts +1 -1
- package/components/hy-modal/typing.d.ts +2 -2
- package/components/hy-notice-bar/hy-column-notice.vue +54 -94
- package/components/hy-notice-bar/hy-notice-bar.vue +128 -96
- package/components/hy-notice-bar/hy-row-notice.vue +89 -121
- package/components/hy-notice-bar/props.ts +86 -85
- package/components/hy-notify/hy-notify.vue +10 -10
- package/components/hy-notify/typing.d.ts +35 -0
- package/components/hy-number-step/hy-number-step.vue +370 -367
- package/components/hy-number-step/index.scss +1 -0
- package/components/hy-number-step/props.ts +1 -1
- package/components/hy-picker/hy-picker.vue +126 -149
- package/components/hy-picker/props.ts +4 -1
- package/components/hy-picker/typing.d.ts +22 -0
- package/components/hy-popover/hy-popover.vue +2 -2
- package/components/hy-popover/typing.d.ts +1 -1
- package/components/hy-popup/hy-popup.vue +1 -1
- package/components/hy-popup/index.scss +1 -0
- package/components/hy-price/hy-price.vue +52 -23
- package/components/hy-price/props.ts +54 -54
- package/components/hy-radio/props.ts +1 -1
- package/components/hy-radio/typing.d.ts +5 -1
- package/components/hy-rolling-num/typing.d.ts +1 -0
- package/components/hy-signature/hy-signature.vue +17 -17
- package/components/hy-signature/typing.d.ts +1 -1
- package/components/hy-skeleton/index.scss +17 -0
- package/components/hy-steps/hy-steps.vue +1 -1
- package/components/hy-submit-bar/typing.d.ts +3 -3
- package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
- package/components/hy-swipe-action/index.scss +0 -1
- package/components/hy-switch/typing.d.ts +4 -0
- package/components/hy-tabbar/props.ts +2 -1
- package/components/hy-tabbar/typing.d.ts +5 -4
- package/components/hy-tabs/hy-tabs.vue +338 -336
- package/components/hy-tabs/index.scss +6 -6
- package/components/hy-tabs/typing.d.ts +41 -33
- package/components/hy-textarea/hy-textarea.vue +2 -2
- package/components/hy-textarea/typing.d.ts +4 -0
- package/components/hy-toast/hy-toast.vue +17 -9
- package/components/hy-toast/index.scss +1 -1
- package/components/hy-toast/typing.d.ts +56 -37
- package/components/hy-tooltip/hy-tooltip.vue +1 -1
- package/components/hy-tooltip/index.scss +1 -0
- package/components/hy-tooltip/props.ts +1 -1
- package/components/hy-upload/hy-upload.vue +16 -1
- package/components/hy-upload/index.scss +149 -144
- package/components/index.ts +6 -0
- package/global.d.ts +2 -0
- package/libs/api/http.ts +122 -119
- package/libs/config/icon.ts +442 -430
- package/libs/css/_function.scss +7 -13
- package/libs/css/iconfont.css +445 -441
- package/libs/css/theme.scss +3 -1
- package/libs/locale/lang/en-US.ts +4 -0
- package/libs/locale/lang/zh-CN.ts +4 -0
- package/libs/typing/index.ts +80 -0
- package/package.json +5 -2
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
- package/components/hy-qrcode/qrcode.js.bak +0 -1434
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@use "../../libs/css/theme" as *;
|
|
2
|
+
@use "../../libs/css/mixin" as *;
|
|
3
|
+
|
|
4
|
+
@include b(cascader) {
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
|
|
9
|
+
&-input {
|
|
10
|
+
position: relative;
|
|
11
|
+
.input-cover {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
z-index: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@include e(header) {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding: $hy-border-margin-padding-base;
|
|
27
|
+
border-bottom: $hy-border-line;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include e(header-title) {
|
|
31
|
+
font-size: $hy-font-size-base;
|
|
32
|
+
font-weight: $hy-font-weight-bold;
|
|
33
|
+
color: $hy-text-color;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include e(header-close) {
|
|
37
|
+
width: 60rpx;
|
|
38
|
+
height: 60rpx;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@include e(content) {
|
|
45
|
+
flex: 1;
|
|
46
|
+
overflow-y: auto;
|
|
47
|
+
padding: 0;
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@include e(item) {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
padding: $hy-border-margin-padding-lg $hy-border-margin-padding-base;
|
|
56
|
+
font-size: $hy-font-size-base;
|
|
57
|
+
color: $hy-text-color;
|
|
58
|
+
position: relative;
|
|
59
|
+
|
|
60
|
+
@include m(active) {
|
|
61
|
+
color: $hy-primary;
|
|
62
|
+
font-weight: $hy-font-weight-bold;
|
|
63
|
+
background: $hy-background--hover;
|
|
64
|
+
border-left: $hy-border-width-lg solid $hy-primary;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@include e(panel) {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include edeep(loading) {
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
left: 0;
|
|
78
|
+
bottom: 0;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
z-index: 10;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CascaderOption, CascaderValue, CascaderLazyLoad } from './typing'
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
import type { HyInputProps } from '../hy-input/typing'
|
|
4
|
+
import { useTranslate } from '../../libs'
|
|
5
|
+
|
|
6
|
+
const { t } = useTranslate('cascader')
|
|
7
|
+
|
|
8
|
+
const cascaderProps = {
|
|
9
|
+
/** 当前选中的值 */
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Object as PropType<CascaderValue>,
|
|
12
|
+
default: () => ({ value: [], label: [] })
|
|
13
|
+
},
|
|
14
|
+
/** 是否显示级联选择器弹窗 */
|
|
15
|
+
show: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
/** 级联选择器数据源 */
|
|
20
|
+
options: {
|
|
21
|
+
type: Array as PropType<CascaderOption[]>,
|
|
22
|
+
default: () => []
|
|
23
|
+
},
|
|
24
|
+
/** 是否显示顶部工具栏 */
|
|
25
|
+
showToolbar: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
/** 顶部标题 */
|
|
30
|
+
title: String,
|
|
31
|
+
/** 输入框占位提示文字 */
|
|
32
|
+
placeholder: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: () => t('placeholder')
|
|
35
|
+
},
|
|
36
|
+
/** 点击遮罩层是否关闭 */
|
|
37
|
+
closeOnClickOverlay: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
/** 弹出层的 z-index 值 */
|
|
42
|
+
zIndex: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 10076
|
|
45
|
+
},
|
|
46
|
+
/** 是否显示输入框 */
|
|
47
|
+
hasInput: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
/** 输入框配置 */
|
|
52
|
+
input: {
|
|
53
|
+
type: Object as PropType<HyInputProps>,
|
|
54
|
+
default: () => {}
|
|
55
|
+
},
|
|
56
|
+
/** 多选时的分隔符 */
|
|
57
|
+
separator: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ' / '
|
|
60
|
+
},
|
|
61
|
+
/** 选项值对应的 key */
|
|
62
|
+
valueKey: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'value'
|
|
65
|
+
},
|
|
66
|
+
/** 选项标签对应的 key */
|
|
67
|
+
labelKey: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'label'
|
|
70
|
+
},
|
|
71
|
+
/** 选项子级对应的 key */
|
|
72
|
+
childrenKey: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: 'children'
|
|
75
|
+
},
|
|
76
|
+
/** 异步加载子节点的回调函数,提供后将启用异步加载模式 */
|
|
77
|
+
lazyLoad: {
|
|
78
|
+
type: Function as PropType<CascaderLazyLoad>,
|
|
79
|
+
default: undefined
|
|
80
|
+
},
|
|
81
|
+
/** 选项对象中,标识叶子节点的 key */
|
|
82
|
+
isLeafKey: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'isLeaf'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default cascaderProps
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface CascaderOption {
|
|
2
|
+
value: string | number
|
|
3
|
+
label: string
|
|
4
|
+
children?: CascaderOption[]
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
isLeaf?: boolean
|
|
7
|
+
[key: string]: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CascaderValue {
|
|
11
|
+
value: (string | number)[]
|
|
12
|
+
label: string[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CascaderEmitValue {
|
|
16
|
+
value: (string | number)[]
|
|
17
|
+
label: string[]
|
|
18
|
+
selectedOptions: CascaderOption[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CascaderLazyLoad = (
|
|
22
|
+
option: CascaderOption | null,
|
|
23
|
+
tabIndex: number,
|
|
24
|
+
resolve: (children: CascaderOption[]) => void
|
|
25
|
+
) => void
|
|
26
|
+
|
|
27
|
+
export interface ICascaderEmits {
|
|
28
|
+
(e: 'close'): void
|
|
29
|
+
(e: 'cancel'): void
|
|
30
|
+
(e: 'confirm', params: CascaderEmitValue): void
|
|
31
|
+
(e: 'change', params: CascaderEmitValue): void
|
|
32
|
+
(e: 'update:show', show: boolean): void
|
|
33
|
+
(e: 'update:modelValue', value: CascaderValue): void
|
|
34
|
+
}
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import type checkButtonProps from './props'
|
|
3
|
+
|
|
4
|
+
export interface HyCheckButtonProps extends ExtractPropTypes<typeof checkButtonProps> {}
|
|
5
|
+
|
|
1
6
|
export interface CheckboxColumnsVo extends FieldNamesType {
|
|
2
7
|
/**
|
|
3
|
-
*
|
|
8
|
+
* 显示文本内容
|
|
4
9
|
* */
|
|
5
10
|
label?: string
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
12
|
+
* 值
|
|
8
13
|
* */
|
|
9
14
|
value?: string | number
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
16
|
+
* 是否选中
|
|
12
17
|
* */
|
|
13
18
|
checked?: boolean
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
21
|
+
* 是否禁用
|
|
17
22
|
* */
|
|
18
23
|
disabled?: boolean
|
|
19
24
|
}
|
|
20
25
|
export interface IFieldNames {
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
27
|
+
* 自定义columns的文本键
|
|
23
28
|
* */
|
|
24
29
|
label: string
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
31
|
+
* 自定义columns的值键
|
|
27
32
|
* */
|
|
28
33
|
value: string
|
|
29
34
|
/**
|
|
30
|
-
*
|
|
35
|
+
* 自定义columns的选中键
|
|
31
36
|
* */
|
|
32
37
|
checked: string
|
|
33
38
|
}
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
:style="{
|
|
36
36
|
height: boxSize
|
|
37
37
|
}"
|
|
38
|
-
@focus="
|
|
39
|
-
@blur="
|
|
38
|
+
@focus="handleFocus"
|
|
39
|
+
@blur="handleBlur"
|
|
40
40
|
/>
|
|
41
41
|
</view>
|
|
42
42
|
</template>
|
|
@@ -80,9 +80,19 @@ const boxSize = addUnit(props.size)
|
|
|
80
80
|
|
|
81
81
|
watch(
|
|
82
82
|
() => props.modelValue,
|
|
83
|
-
(newValue: string | number) => {
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
(newValue: string | number | undefined, oldValue: string | number | undefined) => {
|
|
84
|
+
const newValueStr = String(newValue).substring(0, props.maxlength)
|
|
85
|
+
inputValue.value = newValueStr
|
|
86
|
+
current.value = newValueStr.length
|
|
87
|
+
|
|
88
|
+
// 当值从外部更新时(如键盘组件),也触发change事件
|
|
89
|
+
if (newValue !== oldValue) {
|
|
90
|
+
emit('change', newValueStr)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (String(inputValue.value).length >= Number(props.maxlength)) {
|
|
94
|
+
emit('finish', inputValue.value)
|
|
95
|
+
}
|
|
86
96
|
},
|
|
87
97
|
|
|
88
98
|
{ immediate: true }
|
|
@@ -178,14 +188,30 @@ const itemClass = computed(() => {
|
|
|
178
188
|
})
|
|
179
189
|
|
|
180
190
|
/**
|
|
181
|
-
*
|
|
191
|
+
* 将输入的值,转为数组,给item历遍时,根据当前的索引显示数组的元素
|
|
182
192
|
*/
|
|
183
193
|
const codeArray = computed(() => {
|
|
184
194
|
return String(inputValue.value).split('')
|
|
185
195
|
})
|
|
186
196
|
|
|
187
197
|
/**
|
|
188
|
-
*
|
|
198
|
+
* 输入框获取焦点时触发
|
|
199
|
+
* */
|
|
200
|
+
const handleFocus = () => {
|
|
201
|
+
isFocus.value = true
|
|
202
|
+
emit('focus')
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 输入框失去焦点时触发
|
|
207
|
+
* */
|
|
208
|
+
const handleBlur = () => {
|
|
209
|
+
isFocus.value = false
|
|
210
|
+
emit('blur')
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 监听输入框的值发生变化
|
|
189
215
|
* */
|
|
190
216
|
const inputHandler = (e: InputOnInputEvent) => {
|
|
191
217
|
const value = e.detail.value
|
|
@@ -200,10 +226,6 @@ const inputHandler = (e: InputOnInputEvent) => {
|
|
|
200
226
|
emit('change', value)
|
|
201
227
|
// 修改通过v-model双向绑定的值
|
|
202
228
|
emit('update:modelValue', value)
|
|
203
|
-
// 达到用户指定输入长度时,发出完成事件
|
|
204
|
-
if (String(value).length >= Number(props.maxlength)) {
|
|
205
|
-
emit('finish', value)
|
|
206
|
-
}
|
|
207
229
|
}
|
|
208
230
|
</script>
|
|
209
231
|
|
|
@@ -1,53 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view :class="themeClass" :style="[themeStyle, { height: height ? addUnit(height) : '' }]">
|
|
3
|
-
<!-- @slot 默认插槽 -->
|
|
4
|
-
<slot />
|
|
5
|
-
</view>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
export default {
|
|
10
|
-
name: 'hy-config-provider',
|
|
11
|
-
options: {
|
|
12
|
-
addGlobalClass: true,
|
|
13
|
-
virtualHost: true,
|
|
14
|
-
styleIsolation: 'shared'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { computed } from 'vue'
|
|
21
|
-
import { addUnit, colorGradient } from '../../libs'
|
|
22
|
-
import configProviderProps from './props'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 将 ConfigProvider 组件的 theme 属性设置为 dark,可以开启深色模式。 深色模式会全局生效,使页面上的所有 Wot 组件变为深色风格。
|
|
26
|
-
* @displayName hy-config-provider
|
|
27
|
-
*/
|
|
28
|
-
defineOptions({})
|
|
29
|
-
|
|
30
|
-
const props = defineProps(configProviderProps)
|
|
31
|
-
|
|
32
|
-
const themeClass = computed(() => {
|
|
33
|
-
return [props.customClass, 'hy-config-provider', `hy-theme--${props.theme}`]
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const themeStyle = computed(() => {
|
|
37
|
-
return [
|
|
38
|
-
{
|
|
39
|
-
'--hy-theme-color': props.themeColor,
|
|
40
|
-
'--hy-theme--light':
|
|
41
|
-
props.theme === 'dark'
|
|
42
|
-
? colorGradient(props.themeColor, '#000')[60]
|
|
43
|
-
: colorGradient(props.themeColor)[80],
|
|
44
|
-
padding: addUnit(props.padding)
|
|
45
|
-
},
|
|
46
|
-
props.customStyle
|
|
47
|
-
]
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="themeClass" :style="[themeStyle, { height: height ? addUnit(height) : '' }]">
|
|
3
|
+
<!-- @slot 默认插槽 -->
|
|
4
|
+
<slot />
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'hy-config-provider',
|
|
11
|
+
options: {
|
|
12
|
+
addGlobalClass: true,
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
styleIsolation: 'shared'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { computed, provide, toRefs } from 'vue'
|
|
21
|
+
import { addUnit, colorGradient } from '../../libs'
|
|
22
|
+
import configProviderProps from './props'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 将 ConfigProvider 组件的 theme 属性设置为 dark,可以开启深色模式。 深色模式会全局生效,使页面上的所有 Wot 组件变为深色风格。
|
|
26
|
+
* @displayName hy-config-provider
|
|
27
|
+
*/
|
|
28
|
+
defineOptions({})
|
|
29
|
+
|
|
30
|
+
const props = defineProps(configProviderProps)
|
|
31
|
+
|
|
32
|
+
const themeClass = computed(() => {
|
|
33
|
+
return [props.customClass, 'hy-config-provider', `hy-theme--${props.theme}`]
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const themeStyle = computed(() => {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
'--hy-theme-color': props.themeColor,
|
|
40
|
+
'--hy-theme--light':
|
|
41
|
+
props.theme === 'dark'
|
|
42
|
+
? colorGradient(props.themeColor, '#000')[60]
|
|
43
|
+
: colorGradient(props.themeColor)[80],
|
|
44
|
+
padding: addUnit(props.padding)
|
|
45
|
+
},
|
|
46
|
+
props.customStyle
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// 提供给所有后代组件
|
|
51
|
+
provide('hy-config-provider', {
|
|
52
|
+
...toRefs(props)
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped lang="scss">
|
|
57
|
+
@import './index.scss';
|
|
58
|
+
</style>
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
|
26
26
|
import { isSameSecond, parseFormat, parseTimeData } from './index'
|
|
27
|
-
import type { ICountDownEmits } from './typing'
|
|
27
|
+
import type { ICountDownEmits, ICountDownExpose } from './typing'
|
|
28
28
|
import countDownProps from './props'
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -62,7 +62,7 @@ onUnmounted(() => {
|
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* 开始倒计时
|
|
66
66
|
*/
|
|
67
67
|
const start = () => {
|
|
68
68
|
if (runing.value) return
|
|
@@ -74,7 +74,7 @@ const start = () => {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* 根据是否展示毫秒,执行不同操作函数
|
|
78
78
|
*/
|
|
79
79
|
const toTick = () => {
|
|
80
80
|
if (props.millisecond) {
|
|
@@ -112,14 +112,14 @@ const microTick = () => {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
115
|
+
* 获取剩余的时间
|
|
116
116
|
*/
|
|
117
117
|
const getRemainTime = () => {
|
|
118
118
|
// 取最大值,防止出现小于0的剩余时间值
|
|
119
119
|
return Math.max(endTime.value - Date.now(), 0)
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* 设置剩余的时间
|
|
123
123
|
*/
|
|
124
124
|
const setRemainTime = (remain: number) => {
|
|
125
125
|
remainTime.value = remain
|
|
@@ -144,21 +144,21 @@ const reset = () => {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
147
|
+
* 暂停倒计时
|
|
148
148
|
* */
|
|
149
149
|
const pause = () => {
|
|
150
150
|
runing.value = false
|
|
151
151
|
clearTimeoutFn()
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* 清空定时器
|
|
155
155
|
* */
|
|
156
156
|
const clearTimeoutFn = () => {
|
|
157
157
|
clearTimeout(timer)
|
|
158
158
|
timer = null
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
defineExpose({
|
|
161
|
+
defineExpose<ICountDownExpose>({
|
|
162
162
|
reset,
|
|
163
163
|
start,
|
|
164
164
|
pause
|
|
@@ -12,3 +12,19 @@ export interface ICountDownEmits {
|
|
|
12
12
|
/** 倒计时结束触发 */
|
|
13
13
|
(e: 'finish'): void
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
/** HyCountDown 组件实例暴露的方法 */
|
|
17
|
+
export interface ICountDownExpose {
|
|
18
|
+
/**
|
|
19
|
+
* 重置倒计时
|
|
20
|
+
*/
|
|
21
|
+
reset: () => void
|
|
22
|
+
/**
|
|
23
|
+
* 开始倒计时
|
|
24
|
+
*/
|
|
25
|
+
start: () => void
|
|
26
|
+
/**
|
|
27
|
+
* 暂停倒计时
|
|
28
|
+
*/
|
|
29
|
+
pause: () => void
|
|
30
|
+
}
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
|
-
import type { ICountToEmits } from './typing'
|
|
29
|
+
import type { ICountToEmits, ICountToExpose } from './typing'
|
|
30
30
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
31
31
|
import { addUnit, isNumber } from '../../libs'
|
|
32
32
|
import countToProps from './props'
|
|
@@ -107,7 +107,7 @@ const cancelAnimationFrame = (id?: number) => {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* 开始滚动数字
|
|
111
111
|
* */
|
|
112
112
|
const start = () => {
|
|
113
113
|
localStartVal.value = props.startVal
|
|
@@ -118,7 +118,7 @@ const start = () => {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
121
|
+
* 暂定状态,重新再开始滚动;或者滚动状态下,暂停
|
|
122
122
|
* */
|
|
123
123
|
const reStart = () => {
|
|
124
124
|
if (paused.value) {
|
|
@@ -131,14 +131,14 @@ const reStart = () => {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* 暂停
|
|
135
135
|
* */
|
|
136
136
|
const stop = () => {
|
|
137
137
|
cancelAnimationFrame(rAF.value)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* 重新开始(暂停的情况下)
|
|
142
142
|
* */
|
|
143
143
|
const resume = () => {
|
|
144
144
|
if (!remaining.value) return
|
|
@@ -151,7 +151,7 @@ const resume = () => {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* 重置
|
|
155
155
|
* */
|
|
156
156
|
const reset = () => {
|
|
157
157
|
startTime.value = null
|
|
@@ -204,7 +204,7 @@ const destroyed = () => {
|
|
|
204
204
|
cancelAnimationFrame(rAF.value)
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
defineExpose({
|
|
207
|
+
defineExpose<ICountToExpose>({
|
|
208
208
|
start,
|
|
209
209
|
stop,
|
|
210
210
|
reStart,
|
|
@@ -2,3 +2,27 @@ export interface ICountToEmits {
|
|
|
2
2
|
/** 结束执行函数 */
|
|
3
3
|
(e: 'end'): void
|
|
4
4
|
}
|
|
5
|
+
|
|
6
|
+
/** HyCountTo 组件实例暴露的方法 */
|
|
7
|
+
export interface ICountToExpose {
|
|
8
|
+
/**
|
|
9
|
+
* 开始滚动数字
|
|
10
|
+
*/
|
|
11
|
+
start: () => void
|
|
12
|
+
/**
|
|
13
|
+
* 停止滚动
|
|
14
|
+
*/
|
|
15
|
+
stop: () => void
|
|
16
|
+
/**
|
|
17
|
+
* 重新开始或暂停滚动
|
|
18
|
+
*/
|
|
19
|
+
reStart: () => void
|
|
20
|
+
/**
|
|
21
|
+
* 恢复滚动(暂停状态下)
|
|
22
|
+
*/
|
|
23
|
+
resume: () => void
|
|
24
|
+
/**
|
|
25
|
+
* 重置到初始值
|
|
26
|
+
*/
|
|
27
|
+
reset: () => void
|
|
28
|
+
}
|
|
@@ -172,8 +172,8 @@ const onSelect = (item: DropdownMenuItem, index: number) => {
|
|
|
172
172
|
isOpen.value = false
|
|
173
173
|
if (index !== currentIndex.value) {
|
|
174
174
|
currentIndex.value = index
|
|
175
|
-
emit('change', item, index)
|
|
176
175
|
emit('update:modelValue', item.value)
|
|
176
|
+
emit('change', item, index)
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
<script setup lang="ts">
|
|
14
14
|
import { provide, ref, watch, toRefs } from 'vue'
|
|
15
|
-
import type { IFoldingPanelGroupEmits } from './typing'
|
|
15
|
+
import type { IFoldingPanelGroupEmits, IFoldingPanelExpose } from './typing'
|
|
16
16
|
import foldingPanelProps from './props'
|
|
17
17
|
|
|
18
18
|
const props = defineProps(foldingPanelProps)
|
|
@@ -36,7 +36,7 @@ watch(activeIndex, (newVal) => {
|
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
// 提供给子组件的方法
|
|
39
|
-
const updateActiveIndex = (index: number) => {
|
|
39
|
+
const updateActiveIndex = (index: number | string) => {
|
|
40
40
|
if (props.disabled) return
|
|
41
41
|
|
|
42
42
|
if (props.accordion) {
|
|
@@ -63,7 +63,7 @@ provide('hy-folding-panel', {
|
|
|
63
63
|
updateActiveIndex
|
|
64
64
|
})
|
|
65
65
|
// 对外暴露的方法
|
|
66
|
-
defineExpose({
|
|
66
|
+
defineExpose<IFoldingPanelExpose>({
|
|
67
67
|
/**
|
|
68
68
|
* 打开指定索引的面板
|
|
69
69
|
*/
|