hy-app 0.4.4 → 0.4.6
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/components/hy-action-sheet/hy-action-sheet.vue +1 -1
- package/components/hy-address-picker/hy-address-picker.vue +1 -1
- package/components/hy-avatar/hy-avatar.vue +1 -1
- package/components/hy-back-top/hy-back-top.vue +1 -2
- package/components/hy-badge/hy-badge.vue +1 -1
- package/components/hy-button/hy-button.vue +1 -2
- package/components/hy-calendar/hy-calendar.vue +3 -11
- package/components/hy-calendar/month.vue +3 -3
- package/components/hy-card/hy-card.vue +1 -1
- package/components/hy-cell/hy-cell.vue +1 -2
- package/components/hy-cell/props.ts +1 -1
- package/components/hy-check-button/hy-check-button.vue +2 -2
- package/components/hy-checkbox/hy-checkbox.vue +2 -3
- package/components/hy-checkbox-group/hy-checkbox-group.vue +1 -1
- package/components/hy-checkbox-item/hy-checkbox-item.vue +1 -2
- package/components/hy-code-input/hy-code-input.vue +1 -1
- package/components/hy-config-provider/hy-config-provider.vue +2 -3
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-count-down/index.ts +1 -1
- package/components/hy-count-to/hy-count-to.vue +1 -1
- package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -3
- package/components/hy-datetime-picker/props.ts +1 -1
- package/components/hy-divider/hy-divider.vue +1 -2
- package/components/hy-divider/props.ts +1 -1
- package/components/hy-dropdown/hy-dropdown.vue +2 -3
- package/components/hy-dropdown/props.ts +1 -1
- package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -2
- package/components/hy-empty/hy-empty.vue +1 -1
- package/components/hy-flex/hy-flex.vue +1 -1
- package/components/hy-float-button/hy-float-button.vue +1 -2
- package/components/hy-float-button/props.ts +14 -14
- package/components/hy-folding-panel/hy-folding-panel.vue +2 -3
- package/components/hy-folding-panel/props.ts +1 -1
- package/components/hy-form/hy-form.vue +1 -1
- package/components/hy-form-group/hy-form-group.vue +183 -111
- package/components/hy-form-group/typing.d.ts +1 -1
- package/components/hy-form-item/hy-form-item.vue +1 -1
- package/components/hy-grid/hy-grid.vue +1 -1
- package/components/hy-icon/hy-icon.vue +1 -1
- package/components/hy-icon/index.scss +1 -1
- package/components/hy-image/hy-image.vue +1 -2
- package/components/hy-image/props.ts +10 -10
- package/components/hy-input/hy-input.vue +1 -2
- package/components/hy-line/hy-line.vue +1 -1
- package/components/hy-line-progress/hy-line-progress.vue +1 -2
- package/components/hy-list/hy-list.vue +7 -5
- package/components/hy-loading/hy-loading.vue +11 -9
- package/components/hy-loading/index.scss +14 -5
- package/components/hy-menu/hy-menu.vue +1 -1
- package/components/hy-modal/hy-modal.vue +2 -2
- package/components/hy-modal/props.ts +13 -13
- package/components/hy-navbar/hy-navbar.vue +63 -60
- package/components/hy-navbar/props.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +1 -2
- package/components/hy-notice-bar/hy-notice-bar.vue +1 -1
- package/components/hy-notice-bar/hy-row-notice.vue +1 -2
- package/components/hy-notice-bar/props.ts +1 -1
- package/components/hy-notify/hy-notify.vue +1 -2
- package/components/hy-number-step/hy-number-step.vue +1 -2
- package/components/hy-overlay/hy-overlay.vue +1 -1
- package/components/hy-pagination/hy-pagination.vue +1 -1
- package/components/hy-picker/hy-picker.vue +1 -2
- package/components/hy-popover/hy-popover.vue +9 -3
- package/components/hy-popup/hy-popup.vue +2 -3
- package/components/hy-price/hy-price.vue +3 -2
- package/components/hy-qrcode/hy-qrcode.vue +1 -1
- package/components/hy-radio/hy-radio.vue +1 -2
- package/components/hy-rate/hy-rate.vue +7 -4
- package/components/hy-rate/props.ts +6 -6
- package/components/hy-read-more/hy-read-more.vue +1 -2
- package/components/hy-scroll-list/hy-scroll-list.vue +1 -1
- package/components/hy-scroll-list/props.ts +0 -1
- package/components/hy-search/hy-search.vue +4 -4
- package/components/hy-search/index.scss +1 -0
- package/components/hy-signature/hy-signature.vue +1 -1
- package/components/hy-slider/hy-slider.vue +3 -13
- package/components/hy-slider/props.ts +1 -1
- package/components/hy-status-bar/hy-status-bar.vue +1 -1
- package/components/hy-status-bar/props.ts +1 -1
- package/components/hy-steps/hy-steps.vue +1 -2
- package/components/hy-subsection/hy-subsection.vue +1 -1
- package/components/hy-subsection/props.ts +0 -1
- package/components/hy-subsection/typing.d.ts +0 -1
- package/components/hy-swipe-action/hy-swipe-action.vue +1 -2
- package/components/hy-swiper/hy-swiper-indicator.vue +1 -1
- package/components/hy-swiper/hy-swiper.vue +2 -3
- package/components/hy-swiper/typing.d.ts +35 -36
- package/components/hy-switch/hy-switch.vue +2 -2
- package/components/hy-switch/typing.d.ts +0 -1
- package/components/hy-tabs/hy-tabs.vue +2 -3
- package/components/hy-tag/hy-tag.vue +1 -2
- package/components/hy-text/hy-text.vue +2 -2
- package/components/hy-text/typing.d.ts +26 -26
- package/components/hy-textarea/hy-textarea.vue +2 -2
- package/components/hy-toast/hy-toast.vue +34 -19
- package/components/hy-toast/index.scss +3 -2
- package/components/hy-toast/typing.d.ts +1 -1
- package/components/hy-tooltip/hy-tooltip.vue +8 -2
- package/components/hy-transition/hy-transition.vue +1 -1
- package/components/hy-upload/hy-upload.vue +7 -2
- package/components/hy-upload/props.ts +1 -1
- package/components/hy-warn/hy-warn.vue +1 -2
- package/components/hy-warn/typing.d.ts +12 -13
- package/components/hy-waterfall/hy-waterfall.vue +1 -1
- package/components/hy-watermark/hy-watermark.vue +3 -2
- package/components/index.ts +117 -118
- package/index.ts +1 -7
- package/{api → libs/api}/http.ts +3 -3
- package/libs/common/index.ts +2 -0
- package/libs/common/queue.ts +28 -0
- package/{composables → libs/composables}/index.ts +1 -0
- package/{composables → libs/composables}/usePopover.ts +7 -2
- package/{common/shakeService.ts → libs/composables/useShakeService.ts} +4 -2
- package/{composables → libs/composables}/useShare.ts +3 -0
- package/libs/composables/useToast.ts +45 -0
- package/{composables → libs/composables}/useTouch.ts +3 -0
- package/libs/css/theme.scss +1 -1
- package/libs/css/vars.scss +2 -2
- package/{global → libs/global}/register-properties.ts +1 -1
- package/libs/index.ts +7 -0
- package/{typing → libs/typing}/index.ts +0 -1
- package/{typing → libs/typing}/modules/form.ts +7 -7
- package/{utils → libs/utils}/utils.ts +28 -0
- package/package.json +2 -2
- package/common/index.ts +0 -3
- package/common/queue.ts +0 -34
- package/components/hy-form/README.md +0 -301
- package/components/hy-text/index.ts +0 -0
- package/components/yk-dialog/yk-dialog.vue +0 -129
- package/composables/useToast.ts +0 -51
- package/typing/modules/dialog.ts +0 -17
- /package/{api → libs/api}/index.ts +0 -0
- /package/{common → libs/common}/versionControl.ts +0 -0
- /package/{composables → libs/composables}/useQueue.ts +0 -0
- /package/{config → libs/config}/color.ts +0 -0
- /package/{config → libs/config}/icon.ts +0 -0
- /package/{config → libs/config}/index.ts +0 -0
- /package/{static/font → libs/css}/iconfont.css +0 -0
- /package/{global → libs/global}/index.ts +0 -0
- /package/{typing → libs/typing}/modules/common.d.ts +0 -0
- /package/{typing → libs/typing}/modules/enum.ts +0 -0
- /package/{typing → libs/typing}/modules/http.ts +0 -0
- /package/{typing → libs/typing}/modules/icon.d.ts +0 -0
- /package/{typing → libs/typing}/modules/rect.ts +0 -0
- /package/{utils → libs/utils}/address.json +0 -0
- /package/{utils → libs/utils}/base64.ts +0 -0
- /package/{utils → libs/utils}/calendar.js +0 -0
- /package/{utils → libs/utils}/colorGradient.ts +0 -0
- /package/{utils → libs/utils}/index.ts +0 -0
- /package/{utils → libs/utils}/inside.ts +0 -0
- /package/{utils → libs/utils}/inspect.ts +0 -0
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
watch,
|
|
105
105
|
} from "vue";
|
|
106
106
|
import type { CSSProperties, PropType } from "vue";
|
|
107
|
-
import { addUnit, getRect, guid } from "../../
|
|
107
|
+
import { addUnit, getRect, guid } from "../../libs";
|
|
108
108
|
import type {
|
|
109
109
|
SignatureExpose,
|
|
110
110
|
SignatureResult,
|
|
@@ -156,21 +156,11 @@ export default {
|
|
|
156
156
|
</script>
|
|
157
157
|
|
|
158
158
|
<script setup lang="ts">
|
|
159
|
-
import {
|
|
160
|
-
computed,
|
|
161
|
-
getCurrentInstance,
|
|
162
|
-
onMounted,
|
|
163
|
-
ref,
|
|
164
|
-
toRefs,
|
|
165
|
-
watch,
|
|
166
|
-
} from "vue";
|
|
159
|
+
import { computed, getCurrentInstance, onMounted, ref, watch } from "vue";
|
|
167
160
|
import type { CSSProperties, PropType } from "vue";
|
|
168
|
-
import { addUnit, error, getRect, getPx } from "../../
|
|
161
|
+
import { addUnit, error, getRect, getPx } from "../../libs";
|
|
169
162
|
import type { ISliderEmits } from "./typing";
|
|
170
|
-
import type {
|
|
171
|
-
MovableViewOnChange,
|
|
172
|
-
SliderOnChangingEvent,
|
|
173
|
-
} from "@uni-helper/uni-types";
|
|
163
|
+
import type { SliderOnChangingEvent } from "@uni-helper/uni-types";
|
|
174
164
|
|
|
175
165
|
/**
|
|
176
166
|
* 一般用于表单中,手动选择一个区间范围的场景。
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type IProps from "./typing";
|
|
13
13
|
import defaultProps from "./props";
|
|
14
14
|
import { computed, type CSSProperties, ref } from "vue";
|
|
15
|
-
import { addUnit, getWindowInfo } from "../../
|
|
15
|
+
import { addUnit, getWindowInfo } from "../../libs";
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
18
18
|
|
|
@@ -148,8 +148,7 @@ import { computed, ref, onMounted, getCurrentInstance, watch } from "vue";
|
|
|
148
148
|
import type { CSSProperties, PropType } from "vue";
|
|
149
149
|
import type { IStepsEmits } from "./typing";
|
|
150
150
|
import type { StepListVo } from "./typing";
|
|
151
|
-
import { addUnit, getRect } from "../../
|
|
152
|
-
import { ColorConfig, IconConfig } from "../../config";
|
|
151
|
+
import { addUnit, getRect, ColorConfig, IconConfig } from "../../libs";
|
|
153
152
|
|
|
154
153
|
/**
|
|
155
154
|
* 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
import { computed, ref, onMounted, getCurrentInstance } from "vue";
|
|
36
36
|
import type { CSSProperties, PropType } from "vue";
|
|
37
37
|
import type { ISubsectionEmits, SubSectionVo } from "./typing";
|
|
38
|
-
import { addUnit, getRect, guid } from "../../
|
|
38
|
+
import { addUnit, getRect, guid } from "../../libs";
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* 该分段器一般用于用户从几个选项中选择某一个的场景
|
|
@@ -81,9 +81,8 @@ import type {
|
|
|
81
81
|
SwipeActionReason,
|
|
82
82
|
SwipeActionOptionsVo,
|
|
83
83
|
} from "./typing";
|
|
84
|
-
import { useTouch } from "../../
|
|
84
|
+
import { useTouch, getRect, guid } from "../../libs";
|
|
85
85
|
import { closeOther, pushToQueue, removeFromQueue } from "./index";
|
|
86
|
-
import { getRect, guid } from "../../utils";
|
|
87
86
|
|
|
88
87
|
/**
|
|
89
88
|
* 常用于单元格左右滑删除等手势操作。
|
|
@@ -103,10 +103,9 @@ export default {
|
|
|
103
103
|
</script>
|
|
104
104
|
|
|
105
105
|
<script setup lang="ts">
|
|
106
|
-
import { computed,
|
|
106
|
+
import { computed, ref, watch, getCurrentInstance } from "vue";
|
|
107
107
|
import type { CSSProperties, PropType } from "vue";
|
|
108
|
-
import { addUnit, isVideo } from "../../
|
|
109
|
-
import { IconConfig } from "../../config";
|
|
108
|
+
import { addUnit, isVideo, IconConfig } from "../../libs";
|
|
110
109
|
import type { ISwiperEmits, SwiperList, SwiperVo } from "./typing";
|
|
111
110
|
|
|
112
111
|
// 组件
|
|
@@ -1,128 +1,127 @@
|
|
|
1
|
-
import type { CSSProperties
|
|
2
|
-
import { HyApp } from '@/package/typing/modules/common'
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
3
2
|
|
|
4
3
|
export default interface HySwiperProps {
|
|
5
4
|
/**
|
|
6
5
|
* @description 轮播图数据
|
|
7
6
|
* */
|
|
8
|
-
list: (string | Record<string, unknown>)[]
|
|
7
|
+
list: (string | Record<string, unknown>)[];
|
|
9
8
|
/**
|
|
10
9
|
* @description list数组中指定对象的目标属性名(默认 'url' )
|
|
11
10
|
* */
|
|
12
|
-
keyName?: string
|
|
11
|
+
keyName?: string;
|
|
13
12
|
/**
|
|
14
13
|
* @description 是否显示面板指示器(默认 false )
|
|
15
14
|
* */
|
|
16
|
-
indicator?: boolean
|
|
15
|
+
indicator?: boolean;
|
|
17
16
|
/**
|
|
18
17
|
* @description 指示器非激活颜色(默认 '#FFFFFF' )
|
|
19
18
|
* */
|
|
20
|
-
indicatorActiveColor?: string
|
|
19
|
+
indicatorActiveColor?: string;
|
|
21
20
|
/**
|
|
22
21
|
* @description 指示器的激活颜色(默认 'rgba(255, 255, 255, 0.35)' )
|
|
23
22
|
* */
|
|
24
|
-
indicatorInactiveColor?: string
|
|
23
|
+
indicatorInactiveColor?: string;
|
|
25
24
|
/**
|
|
26
25
|
* @description 指示器样式,可通过bottom,left,right进行定位
|
|
27
26
|
* */
|
|
28
|
-
indicatorStyle?: CSSProperties
|
|
27
|
+
indicatorStyle?: CSSProperties;
|
|
29
28
|
/**
|
|
30
29
|
* @description 指示器模式(默认 'line' )
|
|
31
30
|
* */
|
|
32
|
-
indicatorMode?: HyApp.SwiperIndicatorModeType
|
|
31
|
+
indicatorMode?: HyApp.SwiperIndicatorModeType;
|
|
33
32
|
/**
|
|
34
33
|
* @description 是否自动切换(默认 true )
|
|
35
34
|
* */
|
|
36
|
-
autoplay?: boolean
|
|
35
|
+
autoplay?: boolean;
|
|
37
36
|
/**
|
|
38
37
|
* @description 当前所在滑块的 index(默认 0 )
|
|
39
38
|
* */
|
|
40
|
-
current?: number | string
|
|
39
|
+
current?: number | string;
|
|
41
40
|
/**
|
|
42
41
|
* @description 当前所在滑块的 item-id ,不能与 current 被同时指定
|
|
43
42
|
* */
|
|
44
|
-
currentItemId?: string
|
|
43
|
+
currentItemId?: string;
|
|
45
44
|
/**
|
|
46
45
|
* @description 滑块自动切换时间间隔(ms)(默认 3000 )
|
|
47
46
|
* */
|
|
48
|
-
interval?: number
|
|
47
|
+
interval?: number;
|
|
49
48
|
/**
|
|
50
49
|
* @description 滑块切换过程所需时间(ms)(默认 300 )
|
|
51
50
|
* */
|
|
52
|
-
duration?: number
|
|
51
|
+
duration?: number;
|
|
53
52
|
/**
|
|
54
53
|
* @description 播放到末尾后是否重新回到开头(默认 false )
|
|
55
54
|
* */
|
|
56
|
-
circular?: boolean
|
|
55
|
+
circular?: boolean;
|
|
57
56
|
/**
|
|
58
57
|
* @description 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持(默认 0 )
|
|
59
58
|
* */
|
|
60
|
-
previousMargin?: number | string
|
|
59
|
+
previousMargin?: number | string;
|
|
61
60
|
/**
|
|
62
61
|
* @description 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持(默认 0 )
|
|
63
62
|
* */
|
|
64
|
-
nextMargin?: number | string
|
|
63
|
+
nextMargin?: number | string;
|
|
65
64
|
/**
|
|
66
65
|
* @description 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持(默认 false )
|
|
67
66
|
* */
|
|
68
|
-
acceleration?: boolean
|
|
67
|
+
acceleration?: boolean;
|
|
69
68
|
/**
|
|
70
69
|
* @description 同时显示的滑块数量,nvue、支付宝小程序不支持(默认 1 )
|
|
71
70
|
* */
|
|
72
|
-
displayMultipleItems?: number
|
|
71
|
+
displayMultipleItems?: number;
|
|
73
72
|
/**
|
|
74
73
|
* @description 指定swiper切换缓动动画类型, 只对微信小程序有效(默认 'default' )
|
|
75
74
|
* */
|
|
76
|
-
easingFunction?: string
|
|
75
|
+
easingFunction?: string;
|
|
77
76
|
/**
|
|
78
77
|
* @description 图片的裁剪模式(默认 'aspectFill' )
|
|
79
78
|
* */
|
|
80
|
-
imgMode?: HyApp.ImageModeVo
|
|
79
|
+
imgMode?: HyApp.ImageModeVo;
|
|
81
80
|
/**
|
|
82
81
|
* @description 组件高度(默认 130 )
|
|
83
82
|
* */
|
|
84
|
-
height?: number
|
|
83
|
+
height?: number;
|
|
85
84
|
/**
|
|
86
85
|
* @description 背景颜色(默认 '#f3f4f6' )
|
|
87
86
|
* */
|
|
88
|
-
bgColor?: string
|
|
87
|
+
bgColor?: string;
|
|
89
88
|
/**
|
|
90
89
|
* @description 组件圆角,数值或带单位的字符串(默认 4 )
|
|
91
90
|
* */
|
|
92
|
-
radius?: number | string
|
|
91
|
+
radius?: number | string;
|
|
93
92
|
/**
|
|
94
93
|
* @description 是否加载中(默认 false )
|
|
95
94
|
* */
|
|
96
|
-
loading?: boolean
|
|
95
|
+
loading?: boolean;
|
|
97
96
|
/**
|
|
98
97
|
* @description 是否显示标题,要求数组对象中有title属性(默认 false )
|
|
99
98
|
* */
|
|
100
|
-
showTitle?: boolean
|
|
99
|
+
showTitle?: boolean;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
export interface SwiperList {
|
|
104
|
-
[key: string]: any
|
|
103
|
+
[key: string]: any;
|
|
105
104
|
/** 线上地址 */
|
|
106
|
-
url?: string
|
|
105
|
+
url?: string;
|
|
107
106
|
/** 标题 */
|
|
108
|
-
title?: string
|
|
107
|
+
title?: string;
|
|
109
108
|
/** 海报,为视频必填 */
|
|
110
|
-
poster?: string
|
|
109
|
+
poster?: string;
|
|
111
110
|
/** 轮播图展示类型 */
|
|
112
|
-
type?:
|
|
111
|
+
type?: "image" | "video";
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
export interface SwiperVo {
|
|
116
115
|
detail: {
|
|
117
|
-
current: number
|
|
118
|
-
}
|
|
116
|
+
current: number;
|
|
117
|
+
};
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
export interface ISwiperEmits {
|
|
122
121
|
/** 点击轮播图触发 */
|
|
123
|
-
(e:
|
|
122
|
+
(e: "click", index: number): void;
|
|
124
123
|
/** 滑动轮播图触发 */
|
|
125
|
-
(e:
|
|
124
|
+
(e: "change", temp: SwiperVo["detail"]): void;
|
|
126
125
|
/** 滑动轮播图触发 */
|
|
127
|
-
(e:
|
|
126
|
+
(e: "update:current", value: string | number): void;
|
|
128
127
|
}
|
|
@@ -54,9 +54,9 @@ export default {
|
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
56
|
<script setup lang="ts">
|
|
57
|
-
import {
|
|
57
|
+
import { watch, nextTick, computed } from "vue";
|
|
58
58
|
import type { CSSProperties, PropType } from "vue";
|
|
59
|
-
import { addUnit, error, isNumber } from "../../
|
|
59
|
+
import { addUnit, error, isNumber } from "../../libs";
|
|
60
60
|
import type { ISwitchEmits, SwiperValue } from "./typing";
|
|
61
61
|
// 组件
|
|
62
62
|
import HyLoading from "../hy-loading/hy-loading.vue";
|
|
@@ -158,10 +158,9 @@ import {
|
|
|
158
158
|
getCurrentInstance,
|
|
159
159
|
} from "vue";
|
|
160
160
|
import type { CSSProperties, PropType } from "vue";
|
|
161
|
-
import type { ITabsEmits } from "./typing";
|
|
162
|
-
import type { TabsItemVo } from "./typing";
|
|
161
|
+
import type { ITabsEmits, TabsItemVo } from "./typing";
|
|
163
162
|
import type HyBadgeProps from "../hy-badge/typing";
|
|
164
|
-
import { addUnit, getPx, getRect, sleep } from "../../
|
|
163
|
+
import { addUnit, getPx, getRect, sleep } from "../../libs";
|
|
165
164
|
// 组件
|
|
166
165
|
import HyBadge from "../hy-badge/hy-badge.vue";
|
|
167
166
|
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
@@ -58,8 +58,7 @@ export default {
|
|
|
58
58
|
import { computed } from "vue";
|
|
59
59
|
import type { CSSProperties, PropType } from "vue";
|
|
60
60
|
import type { ITagEmits } from "./typing";
|
|
61
|
-
import { IconConfig } from "../../
|
|
62
|
-
import { colorGradient } from "../../utils";
|
|
61
|
+
import { IconConfig, colorGradient } from "../../libs";
|
|
63
62
|
import type HyIconProps from "../hy-icon/typing";
|
|
64
63
|
|
|
65
64
|
// 组件
|
|
@@ -89,11 +89,11 @@ import {
|
|
|
89
89
|
formatTime,
|
|
90
90
|
isDate,
|
|
91
91
|
priceFormat,
|
|
92
|
-
} from "../../
|
|
92
|
+
} from "../../libs";
|
|
93
|
+
import type { InputOnConfirmEvent } from "@uni-helper/uni-types";
|
|
93
94
|
|
|
94
95
|
// 组件
|
|
95
96
|
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
96
|
-
import type { InputOnConfirmEvent } from "@uni-helper/uni-types";
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
2
|
|
|
3
|
-
export type TextMode =
|
|
3
|
+
export type TextMode = "text" | "price" | "phone" | "name" | "date" | "link";
|
|
4
4
|
|
|
5
5
|
export default interface HyTextProps {
|
|
6
6
|
/**
|
|
7
7
|
* @description 显示的值
|
|
8
8
|
* */
|
|
9
|
-
text: string | number
|
|
9
|
+
text: string | number;
|
|
10
10
|
/**
|
|
11
11
|
* @description 主题颜色
|
|
12
12
|
* */
|
|
13
|
-
type?: HyApp.ThemeType
|
|
13
|
+
type?: HyApp.ThemeType | "";
|
|
14
14
|
/**
|
|
15
15
|
* @description 是否显示(默认 true )
|
|
16
16
|
* */
|
|
17
|
-
show?: boolean
|
|
17
|
+
show?: boolean;
|
|
18
18
|
/**
|
|
19
19
|
* @description 前置图标
|
|
20
20
|
* */
|
|
21
|
-
prefixIcon?: string
|
|
21
|
+
prefixIcon?: string;
|
|
22
22
|
/**
|
|
23
23
|
* @description 后置图标
|
|
24
24
|
* */
|
|
25
|
-
suffixIcon?: string
|
|
25
|
+
suffixIcon?: string;
|
|
26
26
|
/**
|
|
27
27
|
* @description 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
|
|
28
28
|
* */
|
|
29
|
-
mode?: TextMode
|
|
29
|
+
mode?: TextMode;
|
|
30
30
|
/**
|
|
31
31
|
* @description mode=link下,配置的链接
|
|
32
32
|
* */
|
|
33
|
-
href?: string
|
|
33
|
+
href?: string;
|
|
34
34
|
/**
|
|
35
35
|
* @description 格式化规则
|
|
36
36
|
* */
|
|
37
|
-
format?: Function | string
|
|
37
|
+
format?: Function | string;
|
|
38
38
|
/**
|
|
39
39
|
* @description mode=phone时,点击文本是否拨打电话(默认 false )
|
|
40
40
|
* */
|
|
41
|
-
call?: boolean
|
|
41
|
+
call?: boolean;
|
|
42
42
|
/**
|
|
43
43
|
* @description 小程序的打开方式
|
|
44
44
|
* */
|
|
45
|
-
openType?: string
|
|
45
|
+
openType?: string;
|
|
46
46
|
/**
|
|
47
47
|
* @description 是否粗体,默认normal(默认 false )
|
|
48
48
|
* */
|
|
49
|
-
bold?: boolean
|
|
49
|
+
bold?: boolean;
|
|
50
50
|
/**
|
|
51
51
|
* @description 是否块状(默认 false )
|
|
52
52
|
* */
|
|
53
|
-
block?: boolean
|
|
53
|
+
block?: boolean;
|
|
54
54
|
/**
|
|
55
55
|
* @description 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
|
56
56
|
* */
|
|
57
|
-
lines?: string | number
|
|
57
|
+
lines?: string | number;
|
|
58
58
|
/**
|
|
59
59
|
* @description 文本颜色(默认 '#303133' )
|
|
60
60
|
* */
|
|
61
|
-
color?: string
|
|
61
|
+
color?: string;
|
|
62
62
|
/**
|
|
63
63
|
* @description 字体大小(默认 15 )
|
|
64
64
|
* */
|
|
65
|
-
size?: number | string
|
|
65
|
+
size?: number | string;
|
|
66
66
|
/**
|
|
67
67
|
* @description 图标的样式 (默认 {fontSize: '15px'} )
|
|
68
68
|
* */
|
|
69
|
-
iconStyle?: CSSProperties
|
|
69
|
+
iconStyle?: CSSProperties;
|
|
70
70
|
/**
|
|
71
71
|
* @description 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
|
|
72
72
|
* */
|
|
73
|
-
decoration?:
|
|
73
|
+
decoration?: "" | "none" | "underline" | "line-through";
|
|
74
74
|
/**
|
|
75
75
|
* @description 外边距,对象、字符串,数值形式均可(默认 0 )
|
|
76
76
|
* */
|
|
77
|
-
margin?: string
|
|
77
|
+
margin?: string;
|
|
78
78
|
/**
|
|
79
79
|
* @description 文本行高
|
|
80
80
|
* */
|
|
81
|
-
lineHeight?: string | number
|
|
81
|
+
lineHeight?: string | number;
|
|
82
82
|
/**
|
|
83
83
|
* @description 文本对齐方式,可选值left|center|right(默认 'left' )
|
|
84
84
|
* */
|
|
85
|
-
align?: HyApp.RowCenterType
|
|
85
|
+
align?: HyApp.RowCenterType;
|
|
86
86
|
/**
|
|
87
87
|
* @description 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
|
|
88
88
|
* */
|
|
89
|
-
wordWrap?:
|
|
89
|
+
wordWrap?: "normal" | "break-word" | "anywhere";
|
|
90
90
|
/**
|
|
91
91
|
* @description 是否占满剩余空间(默认:true)
|
|
92
92
|
* */
|
|
93
|
-
flex?: boolean
|
|
93
|
+
flex?: boolean;
|
|
94
94
|
/**
|
|
95
95
|
* @description 定义需要用到的外部样式
|
|
96
96
|
* */
|
|
97
|
-
customStyle?: CSSProperties
|
|
97
|
+
customStyle?: CSSProperties;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export interface ITextEmits {
|
|
101
101
|
/** 点击触发 */
|
|
102
|
-
(e:
|
|
102
|
+
(e: "click", event: any): void;
|
|
103
103
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<textarea
|
|
7
7
|
class="hy-textarea__field"
|
|
8
8
|
:value="innerValue"
|
|
9
|
-
:style="
|
|
9
|
+
:style="`height: ${autoHeight ? 'auto' : addUnit(height)}`"
|
|
10
10
|
:placeholder="placeholder || ''"
|
|
11
11
|
:placeholder-style="placeholderStyle"
|
|
12
12
|
:placeholder-class="placeholderClass"
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
import { computed, ref, watch, nextTick, inject } from "vue";
|
|
61
61
|
import type { CSSProperties, PropType } from "vue";
|
|
62
62
|
import type { ITextareaEmits } from "./typing";
|
|
63
|
-
import { addUnit } from "../../
|
|
63
|
+
import { addUnit } from "../../libs";
|
|
64
64
|
import type { FormItemContext } from "../hy-form-item/typing";
|
|
65
65
|
import type {
|
|
66
66
|
InputOnBlurEvent,
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
:zIndex="tmpConfig.overlay ? 10070 : -1"
|
|
5
5
|
:custom-style="overlayStyle"
|
|
6
6
|
>
|
|
7
|
-
<view
|
|
8
|
-
:style="[contentStyle]"
|
|
9
|
-
:class="[
|
|
10
|
-
'hy-toast__content',
|
|
11
|
-
'hy-toast__' + tmpConfig.type,
|
|
12
|
-
tmpConfig.type === 'loading' || tmpConfig.loading
|
|
13
|
-
? 'hy-toast__content--loading'
|
|
14
|
-
: '',
|
|
15
|
-
]"
|
|
16
|
-
>
|
|
7
|
+
<view :style="[contentStyle]" :class="contentClass">
|
|
17
8
|
<HyLoading
|
|
18
9
|
v-if="tmpConfig.loading"
|
|
19
10
|
:mode="tmpConfig.loadMode || 'circle'"
|
|
@@ -31,7 +22,12 @@
|
|
|
31
22
|
>
|
|
32
23
|
<HyIcon :name="iconNameCom" size="17" color="#FFFFFF"></HyIcon>
|
|
33
24
|
</view>
|
|
34
|
-
<text
|
|
25
|
+
<text
|
|
26
|
+
:class="[
|
|
27
|
+
'hy-toast__content--text',
|
|
28
|
+
!tmpConfig.icon ? `hy-toast__content--text__${tmpConfig.type}` : '',
|
|
29
|
+
]"
|
|
30
|
+
>
|
|
35
31
|
{{ tmpConfig.message }}
|
|
36
32
|
</text>
|
|
37
33
|
</view>
|
|
@@ -50,11 +46,10 @@ export default {
|
|
|
50
46
|
</script>
|
|
51
47
|
|
|
52
48
|
<script setup lang="ts">
|
|
53
|
-
import { computed, reactive, ref } from "vue";
|
|
49
|
+
import { computed, onMounted, onUnmounted, reactive, ref } from "vue";
|
|
54
50
|
import type { CSSProperties } from "vue";
|
|
55
|
-
import type
|
|
56
|
-
import { getWindowInfo, hexToRgb } from "../../
|
|
57
|
-
import { ColorConfig, iconName } from "../../config";
|
|
51
|
+
import type ToastOptions from "./typing";
|
|
52
|
+
import { ColorConfig, iconName, getWindowInfo, hexToRgb } from "../../libs";
|
|
58
53
|
// 组件
|
|
59
54
|
import HyOverlay from "../hy-overlay/hy-overlay.vue";
|
|
60
55
|
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
@@ -67,10 +62,10 @@ import HyLoading from "../hy-loading/hy-loading.vue";
|
|
|
67
62
|
defineOptions({});
|
|
68
63
|
|
|
69
64
|
const isShow = ref(false);
|
|
70
|
-
const tmpConfig = ref<
|
|
71
|
-
const config:
|
|
65
|
+
const tmpConfig = ref<ToastOptions>({});
|
|
66
|
+
const config: ToastOptions = reactive({
|
|
72
67
|
message: "",
|
|
73
|
-
type: "
|
|
68
|
+
type: "",
|
|
74
69
|
duration: 2000,
|
|
75
70
|
icon: false,
|
|
76
71
|
position: "center",
|
|
@@ -127,6 +122,14 @@ const contentStyle = computed(() => {
|
|
|
127
122
|
return style;
|
|
128
123
|
});
|
|
129
124
|
|
|
125
|
+
const contentClass = computed(() => {
|
|
126
|
+
return [
|
|
127
|
+
"hy-toast__content",
|
|
128
|
+
"hy-toast__" + tmpConfig.value.type,
|
|
129
|
+
tmpConfig.value.loading && "hy-toast__content--loading",
|
|
130
|
+
];
|
|
131
|
+
});
|
|
132
|
+
|
|
130
133
|
const loadingIconColor = computed(() => {
|
|
131
134
|
let colorTmp = "rgb(255, 255, 255)";
|
|
132
135
|
if (isThemeType(tmpConfig.value.type!)) {
|
|
@@ -137,10 +140,21 @@ const loadingIconColor = computed(() => {
|
|
|
137
140
|
return colorTmp;
|
|
138
141
|
});
|
|
139
142
|
|
|
143
|
+
onMounted(() => {
|
|
144
|
+
// 监听全局事件
|
|
145
|
+
uni.$on("__hy_toast_open__", show);
|
|
146
|
+
uni.$on("__hy_toast_close__", hide);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
onUnmounted(() => {
|
|
150
|
+
uni.$off("__hy_toast_open__", show);
|
|
151
|
+
uni.$off("__hy_toast_close__", hide);
|
|
152
|
+
});
|
|
153
|
+
|
|
140
154
|
/**
|
|
141
155
|
* @description 显示toast组件,由父组件通过xxx.show(options)形式调用
|
|
142
156
|
* */
|
|
143
|
-
const show = (options:
|
|
157
|
+
const show = (options: ToastOptions) => {
|
|
144
158
|
// 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
|
|
145
159
|
tmpConfig.value = Object.assign(config, options);
|
|
146
160
|
// 清除定时器
|
|
@@ -160,6 +174,7 @@ const show = (options: ToastParamsVo) => {
|
|
|
160
174
|
|
|
161
175
|
// 隐藏toast组件,由父组件通过this.$refs.xxx.hide()形式调用
|
|
162
176
|
const hide = () => {
|
|
177
|
+
config.loading = false;
|
|
163
178
|
clearTimer();
|
|
164
179
|
};
|
|
165
180
|
/**
|
|
@@ -146,9 +146,15 @@ import {
|
|
|
146
146
|
} from "vue";
|
|
147
147
|
import type { CSSProperties, PropType } from "vue";
|
|
148
148
|
import type { ITooltipEmits } from "./typing";
|
|
149
|
-
import { type Queue, queueKey, usePopover } from "../../composables";
|
|
150
149
|
import type { IPlacementVo } from "../hy-popover/typing";
|
|
151
|
-
import {
|
|
150
|
+
import {
|
|
151
|
+
type Queue,
|
|
152
|
+
queueKey,
|
|
153
|
+
usePopover,
|
|
154
|
+
closeOther,
|
|
155
|
+
removeFromQueue,
|
|
156
|
+
pushToQueue,
|
|
157
|
+
} from "../../libs";
|
|
152
158
|
|
|
153
159
|
// 组件
|
|
154
160
|
import HyTransition from "../hy-transition/hy-transition.vue";
|