hy-app 0.7.0 → 0.7.2
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-calendar/hy-calendar.vue +2 -2
- package/components/hy-calendar/typing.d.ts +9 -0
- 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-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 -6
- package/components/hy-list/hy-list.vue +346 -226
- package/components/hy-list/index.scss +0 -1
- package/components/hy-list/props.ts +69 -69
- package/components/hy-notify/hy-notify.vue +2 -2
- package/components/hy-notify/typing.d.ts +34 -21
- 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-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-signature/hy-signature.vue +17 -17
- package/components/hy-signature/typing.d.ts +1 -1
- package/components/hy-toast/hy-toast.vue +3 -3
- package/components/hy-toast/index.scss +1 -1
- package/components/hy-toast/typing.d.ts +14 -1
- package/libs/api/http.ts +122 -119
- package/libs/common/versionControl.ts +285 -102
- package/libs/css/theme.scss +2 -0
- package/package.json +1 -1
- package/web-types.json +1 -1
- package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
|
@@ -75,7 +75,6 @@ export default {
|
|
|
75
75
|
</script>
|
|
76
76
|
|
|
77
77
|
<script setup lang="ts">
|
|
78
|
-
import type { ICalendarEmits } from './typing'
|
|
79
78
|
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
|
80
79
|
import {
|
|
81
80
|
addUnit,
|
|
@@ -87,6 +86,7 @@ import {
|
|
|
87
86
|
range,
|
|
88
87
|
useTranslate
|
|
89
88
|
} from '../../libs'
|
|
89
|
+
import type { ICalendarEmits, ICalendarExpose } from './typing'
|
|
90
90
|
import Calendar from '../../libs/utils/calendar.js'
|
|
91
91
|
import calendarProps from './props'
|
|
92
92
|
import dayjs from 'dayjs/esm'
|
|
@@ -367,7 +367,7 @@ const updateMonthTop = (topArr = []) => {
|
|
|
367
367
|
scrollIntoDefaultMonth(selected)
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
defineExpose({
|
|
370
|
+
defineExpose<ICalendarExpose>({
|
|
371
371
|
setFormatter
|
|
372
372
|
})
|
|
373
373
|
</script>
|
|
@@ -45,3 +45,12 @@ export interface ICalendarEmits {
|
|
|
45
45
|
/** 触发关闭属性 */
|
|
46
46
|
(e: 'update:show', value: boolean): void
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
/** HyCalendar 组件实例暴露的方法 */
|
|
50
|
+
export interface ICalendarExpose {
|
|
51
|
+
/**
|
|
52
|
+
* 设置日期格式化函数
|
|
53
|
+
* @param formatter 格式化函数,接收日期字符串参数,返回格式化后的值
|
|
54
|
+
*/
|
|
55
|
+
setFormatter: (formatter: (value: string) => string) => void
|
|
56
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -17,3 +17,26 @@ export interface IFoldingPanelGroupEmits {
|
|
|
17
17
|
*/
|
|
18
18
|
(e: 'close', index: number | string): void
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/** HyFoldingPanel 组件实例暴露的方法 */
|
|
22
|
+
export interface IFoldingPanelExpose {
|
|
23
|
+
/**
|
|
24
|
+
* 打开指定索引的面板
|
|
25
|
+
* @param index 面板索引
|
|
26
|
+
*/
|
|
27
|
+
open: (index: number | string) => void
|
|
28
|
+
/**
|
|
29
|
+
* 关闭所有面板
|
|
30
|
+
*/
|
|
31
|
+
closeAll: () => void
|
|
32
|
+
/**
|
|
33
|
+
* 切换指定索引面板的状态
|
|
34
|
+
* @param index 面板索引
|
|
35
|
+
*/
|
|
36
|
+
toggle: (index: number | string) => void
|
|
37
|
+
/**
|
|
38
|
+
* 关闭指定索引的面板
|
|
39
|
+
* @param index 面板索引
|
|
40
|
+
*/
|
|
41
|
+
close: (index: number | string) => void
|
|
42
|
+
}
|
|
@@ -67,7 +67,7 @@ export default {
|
|
|
67
67
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
import { ref, computed, inject, onMounted } from 'vue'
|
|
70
|
-
import type { IFoldingPanelConfig, IFoldingPanelItemEmits } from './typing'
|
|
70
|
+
import type { IFoldingPanelConfig, IFoldingPanelItemEmits, IFoldingPanelItemExpose } from './typing'
|
|
71
71
|
import { addUnit, IconConfig } from '../../libs'
|
|
72
72
|
import foldingPanelItemProps from './props'
|
|
73
73
|
// 组件
|
|
@@ -124,7 +124,7 @@ const handleClick = () => {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// 对外暴露的方法
|
|
127
|
-
defineExpose({
|
|
127
|
+
defineExpose<IFoldingPanelItemExpose>({
|
|
128
128
|
/**
|
|
129
129
|
* 打开面板
|
|
130
130
|
*/
|
|
@@ -35,3 +35,24 @@ export interface IFoldingPanelItemEmits {
|
|
|
35
35
|
*/
|
|
36
36
|
(e: 'child-click', index: number | string): void
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
/** HyFoldingPanelItem 组件实例暴露的方法 */
|
|
40
|
+
export interface IFoldingPanelItemExpose {
|
|
41
|
+
/**
|
|
42
|
+
* 打开面板
|
|
43
|
+
*/
|
|
44
|
+
open: () => void
|
|
45
|
+
/**
|
|
46
|
+
* 关闭面板
|
|
47
|
+
*/
|
|
48
|
+
close: () => void
|
|
49
|
+
/**
|
|
50
|
+
* 切换面板状态
|
|
51
|
+
*/
|
|
52
|
+
toggle: () => void
|
|
53
|
+
/**
|
|
54
|
+
* 获取当前展开状态
|
|
55
|
+
* @returns 当前展开状态
|
|
56
|
+
*/
|
|
57
|
+
getExpanded: () => boolean
|
|
58
|
+
}
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
import { provide, reactive, ref, toRefs } from 'vue'
|
|
20
20
|
import { clearVal, isArray } from '../../libs'
|
|
21
21
|
import formProps from './props'
|
|
22
|
-
import type { IFormEmits } from './typing'
|
|
22
|
+
import type { IFormEmits, IFormExpose } from './typing'
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* 表单组件父组件,需要搭配hy-form-item
|
|
@@ -203,7 +203,7 @@ const submit = async () => {
|
|
|
203
203
|
return false
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
defineExpose({
|
|
206
|
+
defineExpose<IFormExpose>({
|
|
207
207
|
validate,
|
|
208
208
|
resetFields,
|
|
209
209
|
clearValidate,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue'
|
|
2
|
-
import type formProps from './props'
|
|
3
|
-
|
|
4
|
-
export interface HyFormProps extends ExtractPropTypes<typeof formProps> {}
|
|
5
|
-
export type HyFormSimpleProps = HyFormProps
|
|
6
|
-
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import type formProps from './props'
|
|
3
|
+
|
|
4
|
+
export interface HyFormProps extends ExtractPropTypes<typeof formProps> {}
|
|
5
|
+
export type HyFormSimpleProps = HyFormProps
|
|
6
|
+
|
|
7
7
|
export interface FormRule {
|
|
8
8
|
/**
|
|
9
9
|
* 是否必填
|
|
@@ -45,3 +45,34 @@ export interface IFormEmits {
|
|
|
45
45
|
/** 表单校验 */
|
|
46
46
|
(e: 'validate', valid: boolean, errors: AnyObject): void
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
/** HyForm 组件实例暴露的方法和属性 */
|
|
50
|
+
export interface IFormExpose {
|
|
51
|
+
/**
|
|
52
|
+
* 验证所有表单字段
|
|
53
|
+
* @returns Promise,验证成功时 resolve,失败时 reject 并返回错误信息
|
|
54
|
+
*/
|
|
55
|
+
validate: () => Promise<unknown>
|
|
56
|
+
/**
|
|
57
|
+
* 重置表单所有字段到初始值
|
|
58
|
+
*/
|
|
59
|
+
resetFields: () => void
|
|
60
|
+
/**
|
|
61
|
+
* 清除表单验证错误
|
|
62
|
+
* @param fields 可选,指定要清除的字段名数组,不传则清除所有
|
|
63
|
+
*/
|
|
64
|
+
clearValidate: (fields?: string[]) => void
|
|
65
|
+
/**
|
|
66
|
+
* 提交表单(会先执行验证)
|
|
67
|
+
* @returns Promise,验证成功时返回表单数据,失败时返回 false
|
|
68
|
+
*/
|
|
69
|
+
submit: () => Promise<AnyObject | false>
|
|
70
|
+
/**
|
|
71
|
+
* 表单数据对象
|
|
72
|
+
*/
|
|
73
|
+
formData: AnyObject
|
|
74
|
+
/**
|
|
75
|
+
* 表单错误信息
|
|
76
|
+
*/
|
|
77
|
+
errors: Record<string, string>
|
|
78
|
+
}
|