hy-app 0.6.5 → 0.6.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/attributes.json +1 -0
- package/components/hy-calendar/hy-calendar.vue +376 -375
- package/components/hy-calendar/typing.d.ts +2 -0
- package/components/hy-cell-item/props.ts +1 -1
- package/components/hy-datetime-picker/hy-datetime-picker.vue +522 -536
- package/components/hy-datetime-picker/typing.d.ts +2 -0
- package/components/hy-grid/hy-grid.vue +33 -12
- package/components/hy-grid/index.scss +18 -0
- package/components/hy-grid/typing.d.ts +8 -7
- package/components/hy-menu/hy-menu.vue +117 -159
- package/components/hy-menu/props.ts +3 -3
- package/components/hy-menu/typing.d.ts +3 -4
- package/components/hy-notice-bar/hy-row-notice.vue +2 -2
- package/components/hy-qrcode/qrcode.js +1189 -1149
- package/components/hy-signature/hy-signature.vue +38 -32
- package/components/hy-steps/hy-steps.vue +276 -275
- package/components/hy-sticky/hy-sticky.vue +2 -1
- package/components/hy-swiper/hy-swiper.vue +230 -224
- package/components/hy-swiper/index.scss +5 -5
- package/components/hy-swiper/props.ts +1 -2
- package/components/hy-tabs/hy-tabs.vue +24 -23
- package/components/hy-tabs/props.ts +10 -3
- package/libs/composables/useShakeService.ts +64 -64
- package/libs/utils/utils.ts +1 -0
- package/package.json +1 -1
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<view class="hy-grid" ref="hy-grid" :style="gridStyle">
|
|
3
3
|
<template v-for="(item, i) in list" :key="i">
|
|
4
4
|
<view
|
|
5
|
-
class="
|
|
5
|
+
:class="getItemClass(i)"
|
|
6
6
|
hover-class="hy-grid__item--hover-class"
|
|
7
7
|
:hover-stay-time="200"
|
|
8
8
|
@tap="childClick(item)"
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
<script setup lang="ts">
|
|
47
47
|
import { computed } from 'vue'
|
|
48
48
|
import type { CSSProperties } from 'vue'
|
|
49
|
-
import type { IGridEmits } from './typing'
|
|
49
|
+
import type { GridItemVo, IGridEmits } from './typing'
|
|
50
50
|
import { addUnit } from '../../libs'
|
|
51
51
|
import gridProps from './props'
|
|
52
52
|
// 组件
|
|
@@ -62,10 +62,13 @@ const props = defineProps(gridProps)
|
|
|
62
62
|
const emit = defineEmits<IGridEmits>()
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* 宫格对齐方式
|
|
66
66
|
* */
|
|
67
67
|
const gridStyle = computed<CSSProperties>(() => {
|
|
68
|
-
let style: CSSProperties = {
|
|
68
|
+
let style: CSSProperties = {
|
|
69
|
+
gap: addUnit(props.gap),
|
|
70
|
+
gridTemplateColumns: `repeat(${props.col}, 1fr)`
|
|
71
|
+
}
|
|
69
72
|
switch (props.align) {
|
|
70
73
|
case 'left':
|
|
71
74
|
style.justifyContent = 'flex-start'
|
|
@@ -86,24 +89,42 @@ const itemStyle = computed<CSSProperties>(() => {
|
|
|
86
89
|
const style: CSSProperties = {
|
|
87
90
|
background: props.bgColor,
|
|
88
91
|
height: addUnit(props.itemHeight),
|
|
89
|
-
width: '100%'
|
|
90
|
-
border: props.border ? '0.5px solid #c8c7cc66' : ''
|
|
92
|
+
width: '100%'
|
|
91
93
|
}
|
|
92
94
|
return style
|
|
93
95
|
})
|
|
94
96
|
|
|
95
97
|
/**
|
|
96
|
-
*
|
|
98
|
+
* 获取宫格项的类名
|
|
99
|
+
* @param index 当前项的索引
|
|
100
|
+
* @returns 类名数组
|
|
101
|
+
*/
|
|
102
|
+
const getItemClass = computed(() => {
|
|
103
|
+
return (index: number): string[] => {
|
|
104
|
+
const classes: string[] = ['hy-grid__item']
|
|
105
|
+
if (props.border) {
|
|
106
|
+
classes.push('hy-grid__item--border')
|
|
107
|
+
// 判断是否为最后一列
|
|
108
|
+
if (index % props.col === props.col - 1) {
|
|
109
|
+
classes.push('hy-grid__item--border__last-col')
|
|
110
|
+
}
|
|
111
|
+
// 判断是否为最后一行
|
|
112
|
+
if (index >= props.list.length - props.col) {
|
|
113
|
+
classes.push('hy-grid__item--border__last-row')
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return classes
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 点击事件
|
|
97
122
|
* */
|
|
98
|
-
const childClick = (temp: string |
|
|
123
|
+
const childClick = (temp: string | GridItemVo) => {
|
|
99
124
|
emit('click', temp)
|
|
100
125
|
}
|
|
101
126
|
</script>
|
|
102
127
|
|
|
103
128
|
<style lang="scss" scoped>
|
|
104
|
-
.hy-grid {
|
|
105
|
-
grid-gap: v-bind(gap);
|
|
106
|
-
grid-template-columns: repeat(v-bind(col), 1fr);
|
|
107
|
-
}
|
|
108
129
|
@import './index.scss';
|
|
109
130
|
</style>
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
/* #ifndef APP-NVUE */
|
|
12
12
|
display: grid;
|
|
13
13
|
/* #endif */
|
|
14
|
+
|
|
14
15
|
@include e(item) {
|
|
15
16
|
align-items: center;
|
|
16
17
|
justify-content: center;
|
|
@@ -27,6 +28,23 @@
|
|
|
27
28
|
float: left;
|
|
28
29
|
/* #endif */
|
|
29
30
|
|
|
31
|
+
// 只有当有 border 类时才显示边框
|
|
32
|
+
@include m(border) {
|
|
33
|
+
// 添加右边框和下边框
|
|
34
|
+
border-right: $hy-border-line;
|
|
35
|
+
border-bottom: $hy-border-line;
|
|
36
|
+
|
|
37
|
+
// 最后一列不显示右边框
|
|
38
|
+
@include e(last-col) {
|
|
39
|
+
border-right: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 最后一行不显示下边框
|
|
43
|
+
@include e(last-row) {
|
|
44
|
+
border-bottom: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
@include m(hover-class) {
|
|
31
49
|
opacity: 0.7;
|
|
32
50
|
}
|
|
@@ -2,34 +2,35 @@ import type { HyIconProps } from '../hy-icon/typing'
|
|
|
2
2
|
|
|
3
3
|
export interface GridItemVo {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 图标名称或图片地址
|
|
6
6
|
* */
|
|
7
7
|
icon?: string
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 名称
|
|
10
10
|
* */
|
|
11
11
|
name?: string
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 图标属性api配置
|
|
14
14
|
* */
|
|
15
15
|
iconConfig?: Partial<HyIconProps>
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 自定义内容键值对
|
|
18
18
|
* */
|
|
19
19
|
[key: string]: any
|
|
20
20
|
}
|
|
21
|
+
|
|
21
22
|
export interface CustomKeysVo {
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* 自定义标题键名
|
|
24
25
|
* */
|
|
25
26
|
name: string
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* 自定义icon键名
|
|
28
29
|
* */
|
|
29
30
|
icon: string
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export interface IGridEmits {
|
|
33
34
|
/** 点击小菜单触发 */
|
|
34
|
-
(e: 'click', name: string |
|
|
35
|
+
(e: 'click', name: string | GridItemVo): void
|
|
35
36
|
}
|
|
@@ -1,159 +1,117 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="hy-menu" :style="{ width: addUnit(width) }">
|
|
3
|
-
<template v-for="(item, i) in list">
|
|
4
|
-
<view
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
:
|
|
17
|
-
:
|
|
18
|
-
:
|
|
19
|
-
:
|
|
20
|
-
:
|
|
21
|
-
:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:
|
|
35
|
-
:
|
|
36
|
-
:
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
import
|
|
64
|
-
import
|
|
65
|
-
import
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// }
|
|
119
|
-
// }
|
|
120
|
-
return prefix
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
const suffix = computed(() => {
|
|
124
|
-
let suffix: boolean = false
|
|
125
|
-
// if (sidebar) {
|
|
126
|
-
// let activeIndex: number = sidebar.children.findIndex((c: any) => {
|
|
127
|
-
// return c.value === sidebar.props.modelValue;
|
|
128
|
-
// });
|
|
129
|
-
//
|
|
130
|
-
// let currentIndex: number = sidebar.children.findIndex((c: any) => {
|
|
131
|
-
// return c.value === props.value;
|
|
132
|
-
// });
|
|
133
|
-
//
|
|
134
|
-
// if (currentIndex === activeIndex + 1) {
|
|
135
|
-
// suffix = true;
|
|
136
|
-
// }
|
|
137
|
-
// }
|
|
138
|
-
return suffix
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
function handleClick(temp: MenusType, i: number) {
|
|
142
|
-
if (temp?.disabled) {
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
current.value = i
|
|
146
|
-
emit('update:modelValue', temp.id)
|
|
147
|
-
emit('change', temp)
|
|
148
|
-
}
|
|
149
|
-
</script>
|
|
150
|
-
|
|
151
|
-
<style lang="scss" scoped>
|
|
152
|
-
@import './index.scss';
|
|
153
|
-
.hy-menu__item--active__color {
|
|
154
|
-
color: v-bind(color);
|
|
155
|
-
&::before {
|
|
156
|
-
background: v-bind(color);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-menu" :style="{ width: addUnit(width) }">
|
|
3
|
+
<template v-for="(item, i) in list">
|
|
4
|
+
<view @click="handleClick(item, i)" :class="menuItemClass(item)" :style="customStyle">
|
|
5
|
+
<template v-if="item.icon">
|
|
6
|
+
<slot v-if="$slots.icon" name="icon" :value="item.icon"></slot>
|
|
7
|
+
<hy-icon
|
|
8
|
+
v-else
|
|
9
|
+
class="hy-menu__item__icon"
|
|
10
|
+
:name="item.icon"
|
|
11
|
+
:color="current === i ? color || 'var(--hy-theme-color)' : ''"
|
|
12
|
+
:size="icon?.size || 16"
|
|
13
|
+
:bold="icon?.bold"
|
|
14
|
+
:customPrefix="icon?.customPrefix"
|
|
15
|
+
:imgMode="icon?.imgMode"
|
|
16
|
+
:width="icon?.width"
|
|
17
|
+
:height="icon?.height"
|
|
18
|
+
:top="icon?.top"
|
|
19
|
+
:stop="icon?.stop"
|
|
20
|
+
:round="icon?.round"
|
|
21
|
+
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
22
|
+
></hy-icon>
|
|
23
|
+
</template>
|
|
24
|
+
<slot v-if="$slots.default"></slot>
|
|
25
|
+
<text v-else class="hy-menu__item--title">{{ item.title }}</text>
|
|
26
|
+
<hy-badge
|
|
27
|
+
:value="item?.badge"
|
|
28
|
+
:offset="badge?.offset"
|
|
29
|
+
:shape="badge?.shape"
|
|
30
|
+
:color="badge?.color"
|
|
31
|
+
:bg-color="badge?.bgColor"
|
|
32
|
+
:inverted="badge?.inverted"
|
|
33
|
+
:type="badge?.type"
|
|
34
|
+
:number-type="badge?.numberType"
|
|
35
|
+
:is-dot="badge?.isDot"
|
|
36
|
+
:absolute="badge?.absolute"
|
|
37
|
+
:max="badge?.max"
|
|
38
|
+
:show-zero="badge?.showZero"
|
|
39
|
+
:custom-style="badge?.customStyle"
|
|
40
|
+
></hy-badge>
|
|
41
|
+
</view>
|
|
42
|
+
</template>
|
|
43
|
+
</view>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
export default {
|
|
48
|
+
name: 'hy-menu',
|
|
49
|
+
options: {
|
|
50
|
+
addGlobalClass: true,
|
|
51
|
+
virtualHost: true,
|
|
52
|
+
styleIsolation: 'shared'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { computed, ref, watch } from 'vue'
|
|
59
|
+
import type { IMenuEmits, MenuParamsVo } from './typing'
|
|
60
|
+
import { addUnit } from '../../libs'
|
|
61
|
+
import menuProps from './props'
|
|
62
|
+
// 组件
|
|
63
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
64
|
+
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
65
|
+
import index from '@/pages/mine/Index.vue'
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 垂直展示的导航栏,用于在不同的内容区域之间进行切换。
|
|
69
|
+
* @displayName hy-menu
|
|
70
|
+
*/
|
|
71
|
+
defineOptions({})
|
|
72
|
+
|
|
73
|
+
const props = defineProps(menuProps)
|
|
74
|
+
const emit = defineEmits<IMenuEmits>()
|
|
75
|
+
|
|
76
|
+
const current = ref<string | number>(0)
|
|
77
|
+
|
|
78
|
+
watch(
|
|
79
|
+
() => props.modelValue,
|
|
80
|
+
(newVal) => {
|
|
81
|
+
if (newVal) current.value = newVal
|
|
82
|
+
},
|
|
83
|
+
{ immediate: true }
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const menuItemClass = computed(() => {
|
|
87
|
+
return (temp: MenuParamsVo) => {
|
|
88
|
+
const classes = ['hy-menu__item', temp.disabled && 'hy-menu__item--disabled']
|
|
89
|
+
if (current.value === temp[props.id]) {
|
|
90
|
+
classes.push('hy-menu__item--active', props.color && 'hy-menu__item--active__color')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return classes
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
function handleClick(temp: MenuParamsVo, i: number) {
|
|
98
|
+
if (temp?.disabled) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
if (current.value !== temp.id) {
|
|
102
|
+
current.value = temp.id
|
|
103
|
+
emit('update:modelValue', temp.id)
|
|
104
|
+
emit('change', temp, i)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
@import './index.scss';
|
|
111
|
+
.hy-menu__item--active__color {
|
|
112
|
+
color: v-bind(color);
|
|
113
|
+
&::before {
|
|
114
|
+
background: v-bind(color);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MenuParamsVo } from './typing'
|
|
2
2
|
import type { CSSProperties, PropType } from 'vue'
|
|
3
3
|
import type { HyIconProps } from '../hy-icon/typing'
|
|
4
4
|
import type { HyBadgeProps } from '../hy-badge/typing'
|
|
5
5
|
|
|
6
6
|
const menuProps = {
|
|
7
7
|
/** 当前值 */
|
|
8
|
-
modelValue: [String, Number] as PropType<
|
|
8
|
+
modelValue: [String, Number] as PropType<MenuParamsVo['id']>,
|
|
9
9
|
/** 菜单数据集 */
|
|
10
10
|
list: {
|
|
11
|
-
type: Array as PropType<Array<
|
|
11
|
+
type: Array as PropType<Array<MenuParamsVo>>,
|
|
12
12
|
default: []
|
|
13
13
|
},
|
|
14
14
|
/** 对应的键 */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export interface MenusType {
|
|
1
|
+
export interface MenuParamsVo {
|
|
3
2
|
/**
|
|
4
3
|
* 唯一id
|
|
5
4
|
* */
|
|
@@ -28,7 +27,7 @@ export interface MenusType {
|
|
|
28
27
|
|
|
29
28
|
export interface IMenuEmits {
|
|
30
29
|
/** 选中触发 */
|
|
31
|
-
(e: 'change', temp:
|
|
30
|
+
(e: 'change', temp: MenuParamsVo, index: number): void
|
|
32
31
|
/** 选中触发 */
|
|
33
|
-
(e: 'update:modelValue', id:
|
|
32
|
+
(e: 'update:modelValue', id: MenuParamsVo['id']): void
|
|
34
33
|
}
|
|
@@ -59,8 +59,8 @@ watch(
|
|
|
59
59
|
// 进行一定的延时
|
|
60
60
|
await sleep()
|
|
61
61
|
// 查询盒子和文字的宽度
|
|
62
|
-
textWidth = (await getRect('.hy-notice__content--text', false, instance)).width
|
|
63
|
-
boxWidth = (await getRect('.hy-notice__content', false, instance)).width
|
|
62
|
+
textWidth = (await getRect('.hy-notice__content--text', false, instance)).width!
|
|
63
|
+
boxWidth = (await getRect('.hy-notice__content', false, instance)).width!
|
|
64
64
|
// 根据t=s/v(时间=路程/速度),这里为何不需要加上#u-notice-box的宽度,因为中设置了.u-notice-content样式中设置了padding-left: 100%
|
|
65
65
|
// 恰巧计算出来的结果中已经包含了#u-notice-box的宽度
|
|
66
66
|
animationDuration.value = `${textWidth / speed.value}s`
|