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.
Files changed (36) hide show
  1. package/attributes.json +1 -1
  2. package/components/hy-calendar/hy-calendar.vue +2 -2
  3. package/components/hy-calendar/typing.d.ts +9 -0
  4. package/components/hy-count-down/hy-count-down.vue +8 -8
  5. package/components/hy-count-down/typing.d.ts +16 -0
  6. package/components/hy-count-to/hy-count-to.vue +7 -7
  7. package/components/hy-count-to/typing.d.ts +24 -0
  8. package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
  9. package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
  10. package/components/hy-folding-panel/typing.d.ts +23 -0
  11. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
  12. package/components/hy-folding-panel-item/typing.d.ts +21 -0
  13. package/components/hy-form/hy-form.vue +2 -2
  14. package/components/hy-form/typing.d.ts +37 -6
  15. package/components/hy-list/hy-list.vue +346 -226
  16. package/components/hy-list/index.scss +0 -1
  17. package/components/hy-list/props.ts +69 -69
  18. package/components/hy-notify/hy-notify.vue +2 -2
  19. package/components/hy-notify/typing.d.ts +34 -21
  20. package/components/hy-number-step/hy-number-step.vue +370 -367
  21. package/components/hy-number-step/index.scss +1 -0
  22. package/components/hy-number-step/props.ts +1 -1
  23. package/components/hy-popover/hy-popover.vue +2 -2
  24. package/components/hy-popover/typing.d.ts +1 -1
  25. package/components/hy-popup/hy-popup.vue +1 -1
  26. package/components/hy-signature/hy-signature.vue +17 -17
  27. package/components/hy-signature/typing.d.ts +1 -1
  28. package/components/hy-toast/hy-toast.vue +3 -3
  29. package/components/hy-toast/index.scss +1 -1
  30. package/components/hy-toast/typing.d.ts +14 -1
  31. package/libs/api/http.ts +122 -119
  32. package/libs/common/versionControl.ts +285 -102
  33. package/libs/css/theme.scss +2 -0
  34. package/package.json +1 -1
  35. package/web-types.json +1 -1
  36. package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
@@ -61,6 +61,7 @@
61
61
  align-items: center;
62
62
  justify-content: center;
63
63
  color: $hy-text-color;
64
+ box-sizing: border-box;
64
65
 
65
66
  @include m(disabled) {
66
67
  color: $hy-text-color--disabled;
@@ -11,7 +11,7 @@ const numberStepProps = {
11
11
  /** 最小值 */
12
12
  min: {
13
13
  type: Number,
14
- default: 1
14
+ default: 0
15
15
  },
16
16
  /** 最大值 */
17
17
  max: {
@@ -115,7 +115,7 @@ import {
115
115
  inject,
116
116
  nextTick
117
117
  } from 'vue'
118
- import type { IPopoverEmits, PopoverExpose } from './typing'
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<PopoverExpose>({
244
+ defineExpose<IPopoverExpose>({
245
245
  open,
246
246
  close
247
247
  })
@@ -13,7 +13,7 @@ export type IPlacementVo =
13
13
  | 'right-end'
14
14
  export type IOffset = number | number[] | Record<'x' | 'y', number>
15
15
 
16
- export type PopoverExpose = {
16
+ export type IPopoverExpose = {
17
17
  open: () => void
18
18
  close: () => void
19
19
  }
@@ -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="18" bold></hy-icon>
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 { SignatureExpose, SignatureResult, Point, Line, ISignatureEmits } from './typing'
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
- * @description 添加计算笔画宽度的方法
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
- * @description 获取默认笔画宽度
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
- * @description 开始画线
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
- * @description 结束画线
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
- * @description 初始化 canvas
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
- * @description 清空 canvas
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
- * @description canvas划线
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
- * @description 重绘整个画布
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
- * @description 修改撤销功能
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
- * @description 修改恢复功能
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
- * @description 添加平滑线条绘制方法
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
- * @description 获取canvas上下文
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
- * @description 设置 canvasState
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
- * @description 设置线段
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
- * @description canvas 绘制图片输出成文件类型
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<SignatureExpose>({
636
+ defineExpose<ISignatureExpose>({
637
637
  init: initCanvas,
638
638
  clear,
639
639
  confirm: confirmSignature,
@@ -64,7 +64,7 @@ export interface Point {
64
64
  * @property restore - 恢复上一步操作
65
65
  * @property revoke - 撤销上一步操作
66
66
  */
67
- export type SignatureExpose = {
67
+ export type ISignatureExpose = {
68
68
  /** 初始化签名板
69
69
  * @param forceUpdate - 是否强制更新
70
70
  */
@@ -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, deepMerge } from '../../libs'
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
  })
@@ -13,7 +13,7 @@
13
13
  max-width: 600rpx;
14
14
  /* #endif */
15
15
  position: relative;
16
- z-index: 10090;
16
+ z-index: 11000;
17
17
 
18
18
  @include m(loading) {
19
19
  flex-direction: column;
@@ -1,6 +1,6 @@
1
1
  import type { HyIconProps } from '../hy-icon/typing'
2
2
 
3
- export default interface ToastOptions {
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 = this.config.baseURL + options.url || this.config.url
66
- options.data = options.data || this.config.data
67
- options.header = options.header || this.config.header
68
- options.method = options.method || this.config.method
69
- options.responseType = options.responseType || this.config.responseType
70
- options.timeout = options.timeout || this.config.timeout
71
- /* 合并默认配置 ... */
72
- return new Promise((resolve, reject) => {
73
- options = this.requestBefore(options) // ⭐这里会调用钩子
74
- uni.request({
75
- ...options,
76
- success: (res: UniNamespace.RequestSuccessCallbackResult) => {
77
- const after = this._responseSuccessHook ? this._responseSuccessHook(res) : res
78
- resolve(after)
79
- },
80
- fail: (err: UniNamespace.GeneralCallbackResult) => {
81
- const after = this._responseFailHook ? this._responseFailHook(err) : err
82
- reject(after)
83
- }
84
- })
85
- })
86
- }
87
-
88
- /**
89
- * post请求
90
- * @param url 请求地址
91
- * @param params 请求JSON参数
92
- * @param options 请求配置
93
- */
94
- post<T = any>(url: string, params?: any, options?: HyHttps.HttpRequestConfig): Promise<T> {
95
- return this.request({
96
- url: url,
97
- method: 'POST',
98
- data: params,
99
- ...options
100
- })
101
- }
102
-
103
- /**
104
- * get请求
105
- * @param url 请求地址
106
- * @param params URL查询参数
107
- * @param options 请求配置
108
- */
109
- get<T = any>(url: string, params?: any, options?: HyHttps.HttpRequestConfig): Promise<T> {
110
- if (params) {
111
- url += '?' + objectToUrlParams(params)
112
- }
113
- return this.request({
114
- url: url,
115
- method: 'GET',
116
- ...options
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
+ }