hy-app 0.2.5 → 0.2.7
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/common/index.ts +2 -1
- package/common/shakeService.ts +60 -0
- package/components/hy-action-sheet/hy-action-sheet.vue +184 -0
- package/components/hy-action-sheet/index.scss +123 -0
- package/components/hy-action-sheet/props.ts +18 -0
- package/components/hy-action-sheet/typing.d.ts +96 -0
- package/components/hy-address-picker/hy-address-picker.vue +75 -91
- package/components/hy-avatar/hy-avatar.vue +64 -73
- package/components/hy-button/hy-button.vue +3 -3
- package/components/hy-button/typing.d.ts +35 -31
- package/components/hy-cell/typing.d.ts +27 -24
- package/components/hy-empty/hy-empty.vue +30 -37
- package/components/hy-empty/icon.ts +78 -0
- package/components/hy-empty/index.scss +2 -1
- package/components/hy-empty/props.ts +10 -9
- package/components/hy-empty/typing.d.ts +39 -14
- package/components/hy-float-button/hy-float-button.vue +183 -17
- package/components/hy-float-button/props.ts +17 -15
- package/components/hy-float-button/typing.d.ts +51 -27
- package/components/hy-icon/hy-icon.vue +39 -41
- package/components/hy-icon/props.ts +17 -16
- package/components/hy-icon/typing.d.ts +24 -20
- package/components/hy-image/hy-image.vue +69 -104
- package/components/hy-image/index.scss +21 -5
- package/components/hy-image/props.ts +11 -10
- package/components/hy-image/typing.d.ts +23 -19
- package/components/hy-modal/hy-modal.vue +42 -54
- package/components/hy-modal/index.scss +56 -32
- package/components/hy-modal/props.ts +15 -14
- package/components/hy-modal/typing.d.ts +23 -17
- package/components/hy-popover/hy-popover.vue +200 -0
- package/components/hy-popover/index.scss +83 -0
- package/components/hy-popover/props.ts +13 -0
- package/components/hy-popover/typing.d.ts +56 -0
- package/components/hy-popup/index.scss +2 -2
- package/components/hy-popup/props.ts +7 -7
- package/components/hy-popup/typing.d.ts +17 -17
- package/components/hy-qrcode/hy-qrcode.vue +44 -45
- package/components/hy-rate/props.ts +6 -6
- package/components/hy-signature/props.ts +14 -14
- package/components/hy-tooltip/index.scss +2 -2
- package/components/hy-transition/hy-transition.vue +64 -72
- package/components/hy-transition/typing.d.ts +10 -6
- package/composables/index.ts +4 -2
- package/composables/usePopover.ts +221 -0
- package/composables/useQueue.ts +52 -0
- package/libs/css/_config.scss +5 -0
- package/libs/css/_function.scss +89 -0
- package/libs/css/mixin.scss +146 -21
- package/libs/css/vars.css +3 -1
- package/package.json +2 -2
- package/theme.scss +2 -1
- package/utils/inside.ts +96 -108
- package/utils/inspect.ts +48 -40
- package/utils/utils.ts +170 -187
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@use "../../theme.scss" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
$z-index: 998;
|
|
5
|
+
|
|
6
|
+
@include b(popover) {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: inline-block;
|
|
9
|
+
|
|
10
|
+
@include edeep(icon) {
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
font-size: 18px;
|
|
13
|
+
margin-right: 5px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* 菜单 */
|
|
17
|
+
@include e(menu-inner) {
|
|
18
|
+
position: relative;
|
|
19
|
+
padding: 20rpx 0;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
|
|
23
|
+
&:not(:last-child) {
|
|
24
|
+
border-bottom: $hy-border-line;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@include e(menu) {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
padding: 0 $hy-border-margin-padding-base;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
z-index: $z-index;
|
|
33
|
+
position: relative;
|
|
34
|
+
background-color: $hy-background--container;
|
|
35
|
+
border-radius: $hy-border-radius-sm;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include edeep(pos) {
|
|
39
|
+
position: absolute;
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
background-clip: padding-box;
|
|
42
|
+
text-align: center;
|
|
43
|
+
min-height: 36px;
|
|
44
|
+
z-index: $z-index;
|
|
45
|
+
transition: opacity 0.2s;
|
|
46
|
+
box-shadow: $hy-box-shadow;
|
|
47
|
+
border-radius: $hy-border-radius-sm;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@include e(hidden) {
|
|
52
|
+
left: -220vw;
|
|
53
|
+
visibility: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@include e(container) {
|
|
57
|
+
position: relative;
|
|
58
|
+
border-radius: $hy-border-radius-sm;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@include e(inner) {
|
|
62
|
+
position: relative;
|
|
63
|
+
padding: $hy-border-margin-padding-base;
|
|
64
|
+
line-height: 22px;
|
|
65
|
+
z-index: $z-index;
|
|
66
|
+
background-color: $hy-background--container;
|
|
67
|
+
border-radius: $hy-border-radius-sm;
|
|
68
|
+
box-sizing: content-box;
|
|
69
|
+
width: 200px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@include edeep(close-icon) {
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
position: absolute;
|
|
76
|
+
right: -10px;
|
|
77
|
+
top: -7px;
|
|
78
|
+
padding: 10px;
|
|
79
|
+
z-index: $z-index;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@include squareArrow(6px, $hy-background--container, $z-index, $hy-box-shadow);
|
|
83
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type IPlacementVo =
|
|
4
|
+
| 'top'
|
|
5
|
+
| 'top-start'
|
|
6
|
+
| 'top-end'
|
|
7
|
+
| 'bottom'
|
|
8
|
+
| 'bottom-start'
|
|
9
|
+
| 'bottom-end'
|
|
10
|
+
| 'left'
|
|
11
|
+
| 'left-start'
|
|
12
|
+
| 'left-end'
|
|
13
|
+
| 'right'
|
|
14
|
+
| 'right-start'
|
|
15
|
+
| 'right-end'
|
|
16
|
+
export type IOffset = number | number[] | Record<'x' | 'y', number>
|
|
17
|
+
|
|
18
|
+
export type PopoverExpose = {
|
|
19
|
+
open: () => void
|
|
20
|
+
close: () => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default interface HyOverlayProps {
|
|
24
|
+
/**
|
|
25
|
+
* @description 控制 popover 的显示状态
|
|
26
|
+
* */
|
|
27
|
+
modelValue?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* @description 显示的内容,也可以通过 slot#content 传入
|
|
30
|
+
*/
|
|
31
|
+
content?: string | Record<string, any>[]
|
|
32
|
+
/**
|
|
33
|
+
* @description 指定 popover 的放置位置:top / top-start / top-end / bottom / bottom-start / bottom-end / left / left-start / left-end / right / right-start / right-end
|
|
34
|
+
*/
|
|
35
|
+
placement?: IPlacementVo
|
|
36
|
+
/**
|
|
37
|
+
* @description 控制 popover 的显示状态
|
|
38
|
+
*/
|
|
39
|
+
offset?: IOffset
|
|
40
|
+
/**
|
|
41
|
+
* @description 是否禁用 popover
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* @description 是否显示关闭按钮
|
|
46
|
+
*/
|
|
47
|
+
showClose?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* 当前显示的模式,决定内容的展现形式,可选值:normal(普通模式)/ menu(菜单模式)
|
|
50
|
+
*/
|
|
51
|
+
mode?: 'normal' | 'menu'
|
|
52
|
+
/**
|
|
53
|
+
* @description 定义需要用到的外部样式
|
|
54
|
+
* */
|
|
55
|
+
customStyle?: CSSProperties
|
|
56
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type IProps from
|
|
1
|
+
import type IProps from './typing'
|
|
2
2
|
|
|
3
3
|
const defaultProps: IProps = {
|
|
4
4
|
show: false,
|
|
5
5
|
overlay: true,
|
|
6
|
-
mode:
|
|
6
|
+
mode: 'bottom',
|
|
7
7
|
duration: 300,
|
|
8
8
|
closeable: false,
|
|
9
9
|
overlayStyle: {},
|
|
@@ -12,10 +12,10 @@ const defaultProps: IProps = {
|
|
|
12
12
|
zIndex: 10075,
|
|
13
13
|
safeAreaInsetBottom: true,
|
|
14
14
|
safeAreaInsetTop: false,
|
|
15
|
-
closeIconPos:
|
|
16
|
-
round:
|
|
15
|
+
closeIconPos: 'top-right',
|
|
16
|
+
round: '',
|
|
17
17
|
zoom: true,
|
|
18
|
-
bgColor:
|
|
19
|
-
}
|
|
18
|
+
bgColor: '',
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
export default defaultProps
|
|
21
|
+
export default defaultProps
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
3
|
export default interface HyPopupProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 是否展示弹窗 (默认 false )
|
|
6
6
|
* */
|
|
7
|
-
show: boolean
|
|
7
|
+
show: boolean
|
|
8
8
|
/**
|
|
9
9
|
* @description 是否显示遮罩 (默认 true )
|
|
10
10
|
* */
|
|
11
|
-
overlay?: boolean
|
|
11
|
+
overlay?: boolean
|
|
12
12
|
/**
|
|
13
13
|
* @description 弹出方向(默认 'bottom' )
|
|
14
14
|
* */
|
|
15
|
-
mode?: HyApp.LayoutType
|
|
15
|
+
mode?: HyApp.LayoutType
|
|
16
16
|
/**
|
|
17
17
|
* @description 动画时长,单位ms (默认 300 )
|
|
18
18
|
* */
|
|
19
|
-
duration?: number
|
|
19
|
+
duration?: number
|
|
20
20
|
/**
|
|
21
21
|
* @description 是否显示关闭图标(默认 false )
|
|
22
22
|
* */
|
|
23
|
-
closeable?: boolean
|
|
23
|
+
closeable?: boolean
|
|
24
24
|
/**
|
|
25
25
|
* @description 自定义遮罩的样式
|
|
26
26
|
* */
|
|
27
|
-
overlayStyle?: CSSProperties
|
|
27
|
+
overlayStyle?: CSSProperties
|
|
28
28
|
/**
|
|
29
29
|
* @description 遮罩透明度,0-1之间(默认 0.5)
|
|
30
30
|
* */
|
|
31
|
-
overlayOpacity?: number
|
|
31
|
+
overlayOpacity?: number
|
|
32
32
|
/**
|
|
33
33
|
* @description 点击遮罩是否关闭弹窗 (默认 true )
|
|
34
34
|
* */
|
|
35
|
-
closeOnClickOverlay?: boolean
|
|
35
|
+
closeOnClickOverlay?: boolean
|
|
36
36
|
/**
|
|
37
37
|
* @description 层级 (默认 10075 )
|
|
38
38
|
* */
|
|
39
|
-
zIndex?: number
|
|
39
|
+
zIndex?: number
|
|
40
40
|
/**
|
|
41
41
|
* @description 是否为iPhoneX留出底部安全距离 (默认 true )
|
|
42
42
|
* */
|
|
43
|
-
safeAreaInsetBottom?: boolean
|
|
43
|
+
safeAreaInsetBottom?: boolean
|
|
44
44
|
/**
|
|
45
45
|
* @description 是否留出顶部安全距离(状态栏高度) (默认 false )
|
|
46
46
|
* */
|
|
47
|
-
safeAreaInsetTop?: boolean
|
|
47
|
+
safeAreaInsetTop?: boolean
|
|
48
48
|
/**
|
|
49
49
|
* @description 自定义关闭图标位置(默认 'top-right' )
|
|
50
50
|
* */
|
|
51
|
-
closeIconPos?:
|
|
51
|
+
closeIconPos?: 'top-left' | 'top-right'
|
|
52
52
|
/**
|
|
53
53
|
* @description 圆角值(默认 0)
|
|
54
54
|
* */
|
|
55
|
-
round?: number
|
|
55
|
+
round?: string | number
|
|
56
56
|
/**
|
|
57
57
|
* @description 当mode=center时 是否开启缩放(默认 true )
|
|
58
58
|
* */
|
|
59
|
-
zoom?: boolean
|
|
59
|
+
zoom?: boolean
|
|
60
60
|
/**
|
|
61
61
|
* @description 背景颜色
|
|
62
62
|
* */
|
|
63
|
-
bgColor?: string
|
|
63
|
+
bgColor?: string
|
|
64
64
|
/**
|
|
65
65
|
* @description 自定义样式
|
|
66
66
|
* */
|
|
67
|
-
customStyle?: CSSProperties
|
|
67
|
+
customStyle?: CSSProperties
|
|
68
68
|
}
|
|
@@ -26,40 +26,39 @@ export default {
|
|
|
26
26
|
options: {
|
|
27
27
|
addGlobalClass: true,
|
|
28
28
|
virtualHost: true,
|
|
29
|
-
styleIsolation: 'shared'
|
|
30
|
-
}
|
|
29
|
+
styleIsolation: 'shared',
|
|
30
|
+
},
|
|
31
31
|
}
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<script setup lang="ts">
|
|
35
|
-
import { getCurrentInstance, toRefs, ref, onMounted } from
|
|
36
|
-
import defaultProps from
|
|
37
|
-
import type IProps from
|
|
38
|
-
import QRCode from
|
|
39
|
-
import { addUnit, error } from
|
|
40
|
-
import { IconConfig } from
|
|
35
|
+
import { getCurrentInstance, toRefs, ref, onMounted } from 'vue'
|
|
36
|
+
import defaultProps from './props'
|
|
37
|
+
import type IProps from './typing'
|
|
38
|
+
import QRCode from './qrcode.js'
|
|
39
|
+
import { addUnit, error } from '../../utils'
|
|
40
|
+
import { IconConfig } from '../../config'
|
|
41
41
|
|
|
42
42
|
// 组件
|
|
43
|
-
import HyIcon from
|
|
44
|
-
import HyLoading from
|
|
43
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
44
|
+
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
45
45
|
|
|
46
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
47
|
-
const { text, allowPreview } = toRefs(props)
|
|
48
|
-
const emit = defineEmits([
|
|
46
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
47
|
+
const { text, allowPreview } = toRefs(props)
|
|
48
|
+
const emit = defineEmits(['result', 'preview', 'longPress'])
|
|
49
49
|
|
|
50
|
-
const instance = getCurrentInstance()
|
|
51
|
-
const loading = ref(false)
|
|
52
|
-
const qrcode = ref(
|
|
53
|
-
const result = ref(
|
|
50
|
+
const instance = getCurrentInstance()
|
|
51
|
+
const loading = ref(false)
|
|
52
|
+
const qrcode = ref('')
|
|
53
|
+
const result = ref('')
|
|
54
54
|
|
|
55
55
|
onMounted(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
56
|
+
initQrCode()
|
|
57
|
+
})
|
|
59
58
|
|
|
60
59
|
const initQrCode = () => {
|
|
61
60
|
if (text.value) {
|
|
62
|
-
loading.value = true
|
|
61
|
+
loading.value = true
|
|
63
62
|
qrcode.value = new QRCode({
|
|
64
63
|
context: instance, // 上下文环境
|
|
65
64
|
canvasId: props.cid, // canvas-id
|
|
@@ -76,34 +75,34 @@ const initQrCode = () => {
|
|
|
76
75
|
imageSize: props.iconSize, // 二维码图标大小
|
|
77
76
|
cbResult: function (res: any) {
|
|
78
77
|
// 生成二维码的回调
|
|
79
|
-
_result(res)
|
|
78
|
+
_result(res)
|
|
80
79
|
},
|
|
81
|
-
})
|
|
80
|
+
})
|
|
82
81
|
} else {
|
|
83
|
-
error(
|
|
82
|
+
error('二维码内容不能为空')
|
|
84
83
|
}
|
|
85
|
-
}
|
|
84
|
+
}
|
|
86
85
|
|
|
87
86
|
const _result = (res: any) => {
|
|
88
|
-
loading.value = false
|
|
89
|
-
result.value = res
|
|
90
|
-
emit(
|
|
91
|
-
}
|
|
87
|
+
loading.value = false
|
|
88
|
+
result.value = res
|
|
89
|
+
emit('result', res)
|
|
90
|
+
}
|
|
92
91
|
|
|
93
92
|
const _saveCode = () => {
|
|
94
|
-
if (result.value !=
|
|
93
|
+
if (result.value != '') {
|
|
95
94
|
uni.saveImageToPhotosAlbum({
|
|
96
95
|
filePath: result.value,
|
|
97
96
|
success: function () {
|
|
98
97
|
uni.showToast({
|
|
99
|
-
title:
|
|
100
|
-
icon:
|
|
98
|
+
title: '二维码保存成功',
|
|
99
|
+
icon: 'success',
|
|
101
100
|
duration: 2000,
|
|
102
|
-
})
|
|
101
|
+
})
|
|
103
102
|
},
|
|
104
|
-
})
|
|
103
|
+
})
|
|
105
104
|
}
|
|
106
|
-
}
|
|
105
|
+
}
|
|
107
106
|
/**
|
|
108
107
|
* @description 预览
|
|
109
108
|
* */
|
|
@@ -114,29 +113,29 @@ const preview = (e) => {
|
|
|
114
113
|
uni.previewImage({
|
|
115
114
|
urls: [result.value],
|
|
116
115
|
longPressActions: {
|
|
117
|
-
itemList: [
|
|
116
|
+
itemList: ['保存二维码图片'],
|
|
118
117
|
success: function (data) {
|
|
119
118
|
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
|
120
119
|
switch (data.tapIndex) {
|
|
121
120
|
case 0:
|
|
122
|
-
_saveCode()
|
|
123
|
-
break
|
|
121
|
+
_saveCode()
|
|
122
|
+
break
|
|
124
123
|
}
|
|
125
124
|
},
|
|
126
125
|
fail: function (err) {
|
|
127
|
-
console.error(err.errMsg)
|
|
126
|
+
console.error(err.errMsg)
|
|
128
127
|
},
|
|
129
128
|
},
|
|
130
|
-
})
|
|
129
|
+
})
|
|
131
130
|
}
|
|
132
|
-
emit(
|
|
133
|
-
}
|
|
131
|
+
emit('preview', result.value, e)
|
|
132
|
+
}
|
|
134
133
|
|
|
135
134
|
const onLongPress = () => {
|
|
136
|
-
emit(
|
|
137
|
-
}
|
|
135
|
+
emit('longPress')
|
|
136
|
+
}
|
|
138
137
|
</script>
|
|
139
138
|
|
|
140
139
|
<style lang="scss" scoped>
|
|
141
|
-
@import
|
|
140
|
+
@import './index.scss';
|
|
142
141
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ColorConfig, IconConfig } from
|
|
2
|
-
import type IProps from
|
|
1
|
+
import { ColorConfig, IconConfig } from '../../config'
|
|
2
|
+
import type IProps from './typing'
|
|
3
3
|
|
|
4
4
|
const defaultProps: IProps = {
|
|
5
5
|
modelValue: 1,
|
|
@@ -7,13 +7,13 @@ const defaultProps: IProps = {
|
|
|
7
7
|
disabled: false,
|
|
8
8
|
readonly: false,
|
|
9
9
|
size: 18,
|
|
10
|
-
inactiveColor:
|
|
11
|
-
activeColor:
|
|
10
|
+
inactiveColor: '#b2b2b2',
|
|
11
|
+
activeColor: '#FFF00D',
|
|
12
12
|
gutter: 4,
|
|
13
13
|
minCount: 1,
|
|
14
14
|
allowHalf: false,
|
|
15
15
|
activeIcon: IconConfig.STAR_FILL,
|
|
16
16
|
inactiveIcon: IconConfig.STAR,
|
|
17
17
|
touchable: true,
|
|
18
|
-
}
|
|
19
|
-
export default defaultProps
|
|
18
|
+
}
|
|
19
|
+
export default defaultProps
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type IProps from
|
|
1
|
+
import type IProps from './typing'
|
|
2
2
|
|
|
3
3
|
const defaultProps: IProps = {
|
|
4
|
-
penColor:
|
|
5
|
-
lineWidth:
|
|
6
|
-
clearText:
|
|
7
|
-
revokeText:
|
|
8
|
-
restoreText:
|
|
9
|
-
confirmText:
|
|
10
|
-
fileType:
|
|
4
|
+
penColor: '#000',
|
|
5
|
+
lineWidth: 3,
|
|
6
|
+
clearText: '清空',
|
|
7
|
+
revokeText: '撤销',
|
|
8
|
+
restoreText: '恢复',
|
|
9
|
+
confirmText: '确认',
|
|
10
|
+
fileType: 'png',
|
|
11
11
|
quality: 1,
|
|
12
12
|
exportScale: 1,
|
|
13
13
|
disabled: false,
|
|
14
14
|
height: 1,
|
|
15
15
|
width: 1,
|
|
16
|
-
round:
|
|
17
|
-
backgroundColor:
|
|
16
|
+
round: '10rpx',
|
|
17
|
+
backgroundColor: '',
|
|
18
18
|
disableScroll: true,
|
|
19
19
|
enableHistory: false,
|
|
20
20
|
step: 1,
|
|
21
|
-
undoText:
|
|
22
|
-
redoText:
|
|
21
|
+
undoText: '',
|
|
22
|
+
redoText: '',
|
|
23
23
|
pressure: false,
|
|
24
24
|
minWidth: 2,
|
|
25
25
|
maxWidth: 6,
|
|
26
26
|
minSpeed: 1.5,
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
export default defaultProps
|
|
29
|
+
export default defaultProps
|