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
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
inject,
|
|
116
116
|
nextTick
|
|
117
117
|
} from 'vue'
|
|
118
|
-
import type { IPopoverEmits,
|
|
118
|
+
import type { IPopoverEmits, IPopoverExpose } from './typing'
|
|
119
119
|
import {
|
|
120
120
|
type Queue,
|
|
121
121
|
queueKey,
|
|
@@ -241,7 +241,7 @@ function updateModelValue(value: boolean) {
|
|
|
241
241
|
emit('update:modelValue', value)
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
defineExpose<
|
|
244
|
+
defineExpose<IPopoverExpose>({
|
|
245
245
|
open,
|
|
246
246
|
close
|
|
247
247
|
})
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
hover-class="hy-popup__content__close--hover"
|
|
31
31
|
hover-stay-time="150"
|
|
32
32
|
>
|
|
33
|
-
<hy-icon :name="IconConfig.CLOSE" color="#909399" size="
|
|
33
|
+
<hy-icon :name="IconConfig.CLOSE" color="#909399" size="28"></hy-icon>
|
|
34
34
|
</view>
|
|
35
35
|
<!-- <hy-safe-bottom v-if="safeAreaInsetBottom"></hy-safe-bottom>-->
|
|
36
36
|
</view>
|
|
@@ -99,7 +99,7 @@ export default {
|
|
|
99
99
|
import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch } from 'vue'
|
|
100
100
|
import type { CSSProperties } from 'vue'
|
|
101
101
|
import { addUnit, getRect, guid } from '../../libs'
|
|
102
|
-
import type {
|
|
102
|
+
import type { ISignatureExpose, SignatureResult, Point, Line, ISignatureEmits } from './typing'
|
|
103
103
|
// #ifdef MP-WEIXIN
|
|
104
104
|
import { canvas2dAdapter } from './canvasHelper'
|
|
105
105
|
// #endif
|
|
@@ -165,7 +165,7 @@ const currentLine = ref<Line>() // 当前正在绘制的线
|
|
|
165
165
|
const currentStep = ref(0) // 当前步骤
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* 添加计算笔画宽度的方法
|
|
169
169
|
* */
|
|
170
170
|
function calculateLineWidth(speed: number): number {
|
|
171
171
|
if (!props.pressure) return props.lineWidth
|
|
@@ -178,7 +178,7 @@ function calculateLineWidth(speed: number): number {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
181
|
+
* 获取默认笔画宽度
|
|
182
182
|
* */
|
|
183
183
|
const getDefaultLineWidth = () => {
|
|
184
184
|
if (props.pressure) {
|
|
@@ -189,7 +189,7 @@ const getDefaultLineWidth = () => {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
192
|
+
* 开始画线
|
|
193
193
|
* */
|
|
194
194
|
const startDrawing = (e: any) => {
|
|
195
195
|
e.preventDefault()
|
|
@@ -219,7 +219,7 @@ const startDrawing = (e: any) => {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
*
|
|
222
|
+
* 结束画线
|
|
223
223
|
* */
|
|
224
224
|
const stopDrawing = (e: TouchEvent) => {
|
|
225
225
|
e.preventDefault()
|
|
@@ -250,7 +250,7 @@ const stopDrawing = (e: TouchEvent) => {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
|
-
*
|
|
253
|
+
* 初始化 canvas
|
|
254
254
|
* @param forceUpdate 是否强制更新
|
|
255
255
|
*/
|
|
256
256
|
const initCanvas = (forceUpdate: boolean = false) => {
|
|
@@ -269,7 +269,7 @@ const initCanvas = (forceUpdate: boolean = false) => {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
*
|
|
272
|
+
* 清空 canvas
|
|
273
273
|
* */
|
|
274
274
|
const clear = () => {
|
|
275
275
|
lines.value = []
|
|
@@ -285,7 +285,7 @@ const confirmSignature = () => {
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
288
|
+
* canvas划线
|
|
289
289
|
* */
|
|
290
290
|
const draw = (e: any) => {
|
|
291
291
|
e.preventDefault()
|
|
@@ -349,7 +349,7 @@ const draw = (e: any) => {
|
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
|
-
*
|
|
352
|
+
* 重绘整个画布
|
|
353
353
|
* */
|
|
354
354
|
const redrawCanvas = () => {
|
|
355
355
|
const { ctx } = canvasState
|
|
@@ -422,7 +422,7 @@ const redrawCanvas = () => {
|
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
/**
|
|
425
|
-
*
|
|
425
|
+
* 修改撤销功能
|
|
426
426
|
* */
|
|
427
427
|
const revoke = () => {
|
|
428
428
|
if (!lines.value.length) return
|
|
@@ -434,7 +434,7 @@ const revoke = () => {
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
|
-
*
|
|
437
|
+
* 修改恢复功能
|
|
438
438
|
* */
|
|
439
439
|
const restore = () => {
|
|
440
440
|
if (!redoLines.value.length) return
|
|
@@ -446,7 +446,7 @@ const restore = () => {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
/**
|
|
449
|
-
*
|
|
449
|
+
* 添加平滑线条绘制方法
|
|
450
450
|
* */
|
|
451
451
|
function drawSmoothLine(prePoint: Point, point: Point) {
|
|
452
452
|
const { ctx } = canvasState
|
|
@@ -513,7 +513,7 @@ onBeforeMount(() => {
|
|
|
513
513
|
})
|
|
514
514
|
|
|
515
515
|
/**
|
|
516
|
-
*
|
|
516
|
+
* 获取canvas上下文
|
|
517
517
|
*/
|
|
518
518
|
function getContext() {
|
|
519
519
|
return new Promise<UniApp.CanvasContext>((resolve) => {
|
|
@@ -557,7 +557,7 @@ function getContext() {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
/**
|
|
560
|
-
*
|
|
560
|
+
* 设置 canvasState
|
|
561
561
|
*/
|
|
562
562
|
function setCanvasState(width: number, height: number) {
|
|
563
563
|
canvasState.canvasHeight = height * pixelRatio.value
|
|
@@ -565,7 +565,7 @@ function setCanvasState(width: number, height: number) {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
/**
|
|
568
|
-
*
|
|
568
|
+
* 设置线段
|
|
569
569
|
* */
|
|
570
570
|
function setLine() {
|
|
571
571
|
const { ctx } = canvasState
|
|
@@ -578,7 +578,7 @@ function setLine() {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
/**
|
|
581
|
-
*
|
|
581
|
+
* canvas 绘制图片输出成文件类型
|
|
582
582
|
*/
|
|
583
583
|
function canvasToImage() {
|
|
584
584
|
const { fileType, quality, exportScale } = props
|
|
@@ -633,7 +633,7 @@ function clearCanvas() {
|
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
-
defineExpose<
|
|
636
|
+
defineExpose<ISignatureExpose>({
|
|
637
637
|
init: initCanvas,
|
|
638
638
|
clear,
|
|
639
639
|
confirm: confirmSignature,
|
|
@@ -54,8 +54,8 @@ export default {
|
|
|
54
54
|
<script setup lang="ts">
|
|
55
55
|
import { computed, onMounted, onUnmounted, reactive, ref } from 'vue'
|
|
56
56
|
import type { CSSProperties } from 'vue'
|
|
57
|
-
import type ToastOptions from './typing'
|
|
58
|
-
import { ColorConfig, iconName, getWindowInfo, hexToRgb
|
|
57
|
+
import type { IToastExpose, ToastOptions } from './typing'
|
|
58
|
+
import { ColorConfig, iconName, getWindowInfo, hexToRgb } from '../../libs'
|
|
59
59
|
// 组件
|
|
60
60
|
import HyOverlay from '../hy-overlay/hy-overlay.vue'
|
|
61
61
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
@@ -197,7 +197,7 @@ const clearTimer = () => {
|
|
|
197
197
|
// config.loading = false
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
defineExpose({
|
|
200
|
+
defineExpose<IToastExpose>({
|
|
201
201
|
show,
|
|
202
202
|
hide
|
|
203
203
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HyIconProps } from '../hy-icon/typing'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface ToastOptions {
|
|
4
4
|
/**
|
|
5
5
|
* 显示文本
|
|
6
6
|
* */
|
|
@@ -42,3 +42,16 @@ export default interface ToastOptions {
|
|
|
42
42
|
* */
|
|
43
43
|
complete?: Function | null
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
/** HyToast 组件实例暴露的方法 */
|
|
47
|
+
export interface IToastExpose {
|
|
48
|
+
/**
|
|
49
|
+
* 显示 Toast
|
|
50
|
+
* @param options Toast 配置选项
|
|
51
|
+
*/
|
|
52
|
+
show: (options: ToastOptions) => void
|
|
53
|
+
/**
|
|
54
|
+
* 隐藏 Toast
|
|
55
|
+
*/
|
|
56
|
+
hide: () => void
|
|
57
|
+
}
|
package/libs/api/http.ts
CHANGED
|
@@ -1,119 +1,122 @@
|
|
|
1
|
-
import { objectToUrlParams } from '../../libs'
|
|
2
|
-
|
|
3
|
-
export class Http {
|
|
4
|
-
/**
|
|
5
|
-
* 默认请求配置
|
|
6
|
-
*/
|
|
7
|
-
config: HyHttps.HttpRequestConfig = {
|
|
8
|
-
baseURL: '',
|
|
9
|
-
url: '',
|
|
10
|
-
data: {},
|
|
11
|
-
dataType: 'json',
|
|
12
|
-
header: {},
|
|
13
|
-
method: 'POST',
|
|
14
|
-
responseType: 'text',
|
|
15
|
-
timeout: 10000
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* 私有回调槽 */
|
|
19
|
-
private _requestHook?: (conf: UniNamespace.RequestOptions) => UniNamespace.RequestOptions
|
|
20
|
-
private _responseSuccessHook?: (res: UniNamespace.RequestSuccessCallbackResult) => any
|
|
21
|
-
private _responseFailHook?: (err: UniNamespace.GeneralCallbackResult) => any
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @description 拦截器
|
|
25
|
-
*/
|
|
26
|
-
interceptor = {
|
|
27
|
-
/**
|
|
28
|
-
* @description 请求拦截 请求配置
|
|
29
|
-
* @param hook
|
|
30
|
-
*/
|
|
31
|
-
request: (hook: (conf: UniNamespace.RequestOptions) => UniNamespace.RequestOptions) => {
|
|
32
|
-
this._requestHook = hook
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* @description 响应拦截
|
|
36
|
-
* @param success 成功响应
|
|
37
|
-
* @param fail 失败响应
|
|
38
|
-
*/
|
|
39
|
-
response: (
|
|
40
|
-
success?: (response: UniNamespace.RequestSuccessCallbackResult) => any,
|
|
41
|
-
fail?: (error: UniNamespace.GeneralCallbackResult) => any
|
|
42
|
-
) => {
|
|
43
|
-
if (success) {
|
|
44
|
-
this._responseSuccessHook = success
|
|
45
|
-
}
|
|
46
|
-
if (fail) {
|
|
47
|
-
this._responseFailHook = fail
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @description 请求拦截
|
|
54
|
-
* @param conf 请求配置
|
|
55
|
-
*/
|
|
56
|
-
private requestBefore(conf: UniNamespace.RequestOptions): UniNamespace.RequestOptions {
|
|
57
|
-
return this._requestHook ? this._requestHook(conf) : conf
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @description uni异步请求
|
|
62
|
-
* @param options 请求配置
|
|
63
|
-
*/
|
|
64
|
-
async request<T = any>(options: UniNamespace.RequestOptions): Promise<T> {
|
|
65
|
-
options.url =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
options.
|
|
70
|
-
options.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
url
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
import { objectToUrlParams } from '../../libs'
|
|
2
|
+
|
|
3
|
+
export class Http {
|
|
4
|
+
/**
|
|
5
|
+
* 默认请求配置
|
|
6
|
+
*/
|
|
7
|
+
config: HyHttps.HttpRequestConfig = {
|
|
8
|
+
baseURL: '',
|
|
9
|
+
url: '',
|
|
10
|
+
data: {},
|
|
11
|
+
dataType: 'json',
|
|
12
|
+
header: {},
|
|
13
|
+
method: 'POST',
|
|
14
|
+
responseType: 'text',
|
|
15
|
+
timeout: 10000
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 私有回调槽 */
|
|
19
|
+
private _requestHook?: (conf: UniNamespace.RequestOptions) => UniNamespace.RequestOptions
|
|
20
|
+
private _responseSuccessHook?: (res: UniNamespace.RequestSuccessCallbackResult) => any
|
|
21
|
+
private _responseFailHook?: (err: UniNamespace.GeneralCallbackResult) => any
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description 拦截器
|
|
25
|
+
*/
|
|
26
|
+
interceptor = {
|
|
27
|
+
/**
|
|
28
|
+
* @description 请求拦截 请求配置
|
|
29
|
+
* @param hook
|
|
30
|
+
*/
|
|
31
|
+
request: (hook: (conf: UniNamespace.RequestOptions) => UniNamespace.RequestOptions) => {
|
|
32
|
+
this._requestHook = hook
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* @description 响应拦截
|
|
36
|
+
* @param success 成功响应
|
|
37
|
+
* @param fail 失败响应
|
|
38
|
+
*/
|
|
39
|
+
response: (
|
|
40
|
+
success?: (response: UniNamespace.RequestSuccessCallbackResult) => any,
|
|
41
|
+
fail?: (error: UniNamespace.GeneralCallbackResult) => any
|
|
42
|
+
) => {
|
|
43
|
+
if (success) {
|
|
44
|
+
this._responseSuccessHook = success
|
|
45
|
+
}
|
|
46
|
+
if (fail) {
|
|
47
|
+
this._responseFailHook = fail
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description 请求拦截
|
|
54
|
+
* @param conf 请求配置
|
|
55
|
+
*/
|
|
56
|
+
private requestBefore(conf: UniNamespace.RequestOptions): UniNamespace.RequestOptions {
|
|
57
|
+
return this._requestHook ? this._requestHook(conf) : conf
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @description uni异步请求
|
|
62
|
+
* @param options 请求配置
|
|
63
|
+
*/
|
|
64
|
+
async request<T = any>(options: UniNamespace.RequestOptions): Promise<T> {
|
|
65
|
+
options.url =
|
|
66
|
+
options.url && /^https?:\/\//.test(options.url)
|
|
67
|
+
? options.url
|
|
68
|
+
: this.config.baseURL + options.url
|
|
69
|
+
options.data = options.data || this.config.data
|
|
70
|
+
options.header = options.header || this.config.header
|
|
71
|
+
options.method = options.method || this.config.method
|
|
72
|
+
options.responseType = options.responseType || this.config.responseType
|
|
73
|
+
options.timeout = options.timeout || this.config.timeout
|
|
74
|
+
/* 合并默认配置 ... */
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
options = this.requestBefore(options) // ⭐这里会调用钩子
|
|
77
|
+
uni.request({
|
|
78
|
+
...options,
|
|
79
|
+
success: (res: UniNamespace.RequestSuccessCallbackResult) => {
|
|
80
|
+
const after = this._responseSuccessHook ? this._responseSuccessHook(res) : res
|
|
81
|
+
resolve(after)
|
|
82
|
+
},
|
|
83
|
+
fail: (err: UniNamespace.GeneralCallbackResult) => {
|
|
84
|
+
const after = this._responseFailHook ? this._responseFailHook(err) : err
|
|
85
|
+
reject(after)
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* post请求
|
|
93
|
+
* @param url 请求地址
|
|
94
|
+
* @param params 请求JSON参数
|
|
95
|
+
* @param options 请求配置
|
|
96
|
+
*/
|
|
97
|
+
post<T = any>(url: string, params?: any, options?: HyHttps.HttpRequestConfig): Promise<T> {
|
|
98
|
+
return this.request({
|
|
99
|
+
url: url,
|
|
100
|
+
method: 'POST',
|
|
101
|
+
data: params,
|
|
102
|
+
...options
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* get请求
|
|
108
|
+
* @param url 请求地址
|
|
109
|
+
* @param params URL查询参数
|
|
110
|
+
* @param options 请求配置
|
|
111
|
+
*/
|
|
112
|
+
get<T = any>(url: string, params?: any, options?: HyHttps.HttpRequestConfig): Promise<T> {
|
|
113
|
+
if (params) {
|
|
114
|
+
url += '?' + objectToUrlParams(params)
|
|
115
|
+
}
|
|
116
|
+
return this.request({
|
|
117
|
+
url: url,
|
|
118
|
+
method: 'GET',
|
|
119
|
+
...options
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
}
|