hy-app 0.5.5 → 0.5.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/components/hy-back-top/props.ts +2 -3
- package/components/hy-badge/props.ts +1 -1
- package/components/hy-badge/typing.d.ts +5 -0
- package/components/hy-button/props.ts +1 -1
- package/components/hy-card/hy-card.vue +2 -1
- package/components/hy-card/index.scss +5 -1
- package/components/hy-card/props.ts +3 -4
- package/components/hy-cell/hy-cell.vue +9 -190
- package/components/hy-cell/props.ts +7 -26
- package/components/hy-cell/typing.d.ts +2 -41
- package/components/hy-cell-item/hy-cell-item.vue +160 -0
- package/components/hy-cell-item/index.scss +100 -0
- package/components/hy-cell-item/props.ts +66 -0
- package/components/hy-cell-item/typing.d.ts +7 -0
- package/components/hy-checkbox-group/props.ts +1 -1
- package/components/hy-checkbox-item/typing.d.ts +3 -3
- package/components/hy-grid/props.ts +1 -1
- package/components/hy-grid/typing.d.ts +1 -2
- package/components/hy-icon/props.ts +1 -1
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-input/hy-input.vue +19 -22
- package/components/hy-input/props.ts +1 -1
- package/components/hy-menu/props.ts +2 -2
- package/components/hy-number-step/props.ts +1 -1
- package/components/hy-price/hy-price.vue +9 -2
- package/components/hy-search/props.ts +1 -2
- package/components/hy-status-bar/typing.d.ts +12 -0
- package/components/hy-sticky/hy-sticky.vue +226 -0
- package/components/hy-sticky/index.scss +29 -0
- package/components/hy-sticky/props.ts +24 -0
- package/components/hy-sticky/typing.d.ts +4 -0
- package/components/hy-switch/props.ts +1 -1
- package/components/hy-tabbar/props.ts +1 -1
- package/components/hy-tabbar-group/index.scss +56 -56
- package/components/hy-tabbar-group/props.ts +1 -1
- package/components/hy-tabbar-item/index.scss +42 -42
- package/components/hy-tabbar-item/props.ts +24 -24
- package/components/hy-tabs/props.ts +1 -1
- package/components/hy-tag/props.ts +1 -1
- package/global.d.ts +1 -0
- package/libs/css/theme.scss +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-cell/index.scss +0 -136
- /package/components/hy-tabbar-group/{typing.ts → typing.d.ts} +0 -0
- /package/components/hy-tabbar-item/{typing.ts → typing.d.ts} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type IProps from './typing'
|
|
2
1
|
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
2
|
+
import type { HyIconProps } from '../hy-icon/typing'
|
|
4
3
|
|
|
5
4
|
const backTopProps = {
|
|
6
5
|
/**
|
|
@@ -55,7 +54,7 @@ const backTopProps = {
|
|
|
55
54
|
})
|
|
56
55
|
},
|
|
57
56
|
/** 自定义外部类名 */
|
|
58
|
-
customClass: String
|
|
57
|
+
customClass: String
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
export default backTopProps
|
|
@@ -114,7 +114,8 @@ const cardClass = computed(() => {
|
|
|
114
114
|
return [
|
|
115
115
|
props.border && 'hy-border',
|
|
116
116
|
props.full && 'hy-card__full',
|
|
117
|
-
hasBorder && 'hy-card--border'
|
|
117
|
+
hasBorder && 'hy-card--border',
|
|
118
|
+
props.customClass
|
|
118
119
|
].filter(Boolean)
|
|
119
120
|
})
|
|
120
121
|
const cardStyle = computed(() => {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@include e(title) {
|
|
43
|
-
max-width:
|
|
43
|
+
max-width: 400rpx;
|
|
44
44
|
font-size: $hy-font-size-base;
|
|
45
45
|
@include lineEllipsis;
|
|
46
46
|
}
|
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
@include m(right) {
|
|
55
55
|
color: $hy-text-color--grey;
|
|
56
56
|
margin-left: $hy-border-margin-padding-sm;
|
|
57
|
+
|
|
58
|
+
@include e(text) {
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
|
|
@@ -114,10 +114,9 @@ const cardProps = {
|
|
|
114
114
|
/** 底部自定义样式 */
|
|
115
115
|
footStyle: Object as PropType<CSSProperties>,
|
|
116
116
|
/** 定义需要用到的外部样式 */
|
|
117
|
-
customStyle:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
117
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
118
|
+
/** 自定义外部类名 */
|
|
119
|
+
customClass: String
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
export default cardProps
|
|
@@ -1,137 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :
|
|
3
|
-
<
|
|
4
|
-
:class="['hy-cell--title', showVertical && 'hy-cell--title__vertical']"
|
|
5
|
-
v-if="title || $slots['title']"
|
|
6
|
-
>
|
|
7
|
-
<!-- @slot 标题插槽 -->
|
|
8
|
-
<slot v-if="$slots.title" name="title" :title="title"></slot>
|
|
9
|
-
<text v-else class="hy-cell--title__text">{{ title }}</text>
|
|
10
|
-
</view>
|
|
11
|
-
<view class="hy-cell__body" :style="{ 'border-radius': addUnit(borderRadius) }">
|
|
12
|
-
<!-- @slot 整体插槽 -->
|
|
13
|
-
<slot v-if="$slots.default"></slot>
|
|
14
|
-
<template v-else v-for="(item, i) in list" :key="i">
|
|
15
|
-
<view
|
|
16
|
-
:class="ItemClass"
|
|
17
|
-
:hover-class="containerClass(item)"
|
|
18
|
-
:hover-stay-time="250"
|
|
19
|
-
:style="{
|
|
20
|
-
borderBottom: border && i !== list.length - 1 ? '1rpx solid #c8c7cc66' : ''
|
|
21
|
-
}"
|
|
22
|
-
@tap="clickHandler($event, item, i)"
|
|
23
|
-
>
|
|
24
|
-
<view class="hy-cell__body--container__content">
|
|
25
|
-
<view
|
|
26
|
-
v-if="item?.icon?.name || $slots.icon"
|
|
27
|
-
class="hy-cell__body--container__content--icon"
|
|
28
|
-
>
|
|
29
|
-
<!-- @slot 图标插槽 -->
|
|
30
|
-
<slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
|
|
31
|
-
<HyIcon
|
|
32
|
-
v-else
|
|
33
|
-
:size="iconSize"
|
|
34
|
-
:name="item?.icon?.name"
|
|
35
|
-
:color="disabled || item?.disabled ? '#c0c0c0' : item?.icon?.color"
|
|
36
|
-
:bold="item?.icon?.bold"
|
|
37
|
-
:customPrefix="item?.icon?.customPrefix"
|
|
38
|
-
:imgMode="item?.icon?.imgMode"
|
|
39
|
-
:width="item?.icon?.width"
|
|
40
|
-
:height="item?.icon?.height"
|
|
41
|
-
:top="item?.icon?.top"
|
|
42
|
-
:stop="item?.icon?.stop"
|
|
43
|
-
:round="item?.icon?.round"
|
|
44
|
-
:customStyle="item?.icon?.customStyle"
|
|
45
|
-
></HyIcon>
|
|
46
|
-
</view>
|
|
47
|
-
<view class="hy-cell__body--container__content--title">
|
|
48
|
-
<!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
|
|
49
|
-
<!-- @slot 列表标题插槽 -->
|
|
50
|
-
<slot
|
|
51
|
-
v-if="$slots['cell-title']"
|
|
52
|
-
name="cell-title"
|
|
53
|
-
:title="item?.title"
|
|
54
|
-
></slot>
|
|
55
|
-
<text
|
|
56
|
-
v-else
|
|
57
|
-
class="hy-cell__body--container__content--title__text"
|
|
58
|
-
:class="[(disabled || item?.disabled) && 'hy-cell__disabled']"
|
|
59
|
-
>
|
|
60
|
-
{{ item?.title }}
|
|
61
|
-
</text>
|
|
62
|
-
<!-- @slot 列表小标题插槽 -->
|
|
63
|
-
<template v-if="item?.subhead">
|
|
64
|
-
<slot v-if="$slots.sub" name="sub" :sub="item.subhead"></slot>
|
|
65
|
-
<text
|
|
66
|
-
v-else
|
|
67
|
-
class="hy-cell__body--container__content--title__sub"
|
|
68
|
-
:class="[disabled && 'hy-cell__disabled']"
|
|
69
|
-
>
|
|
70
|
-
{{ item.subhead }}
|
|
71
|
-
</text>
|
|
72
|
-
</template>
|
|
73
|
-
</view>
|
|
74
|
-
</view>
|
|
75
|
-
<view
|
|
76
|
-
class="hy-cell__body--container__center"
|
|
77
|
-
:style="{
|
|
78
|
-
justifyContent:
|
|
79
|
-
arrange === 'left'
|
|
80
|
-
? 'flex-start'
|
|
81
|
-
: arrange === 'right'
|
|
82
|
-
? 'flex-end'
|
|
83
|
-
: 'center'
|
|
84
|
-
}"
|
|
85
|
-
>
|
|
86
|
-
<!-- @slot 值内容插槽 -->
|
|
87
|
-
<slot v-if="$slots.value" name="value" :record="item"></slot>
|
|
88
|
-
<text
|
|
89
|
-
v-else-if="value || item?.value"
|
|
90
|
-
:class="[
|
|
91
|
-
'hy-cell__body__container__center--value',
|
|
92
|
-
disabled && 'hy-cell--disabled'
|
|
93
|
-
]"
|
|
94
|
-
>
|
|
95
|
-
{{ item.value || value }}
|
|
96
|
-
</text>
|
|
97
|
-
</view>
|
|
98
|
-
<view
|
|
99
|
-
class="hy-cell__body--container__right-icon"
|
|
100
|
-
:class="[
|
|
101
|
-
`hy-cell__body--container__right-icon--${item?.arrowDirection || arrowDirection}`
|
|
102
|
-
]"
|
|
103
|
-
>
|
|
104
|
-
<!-- @slot 右边按钮插槽 -->
|
|
105
|
-
<slot
|
|
106
|
-
v-if="$slots['right-icon']"
|
|
107
|
-
name="right-icon"
|
|
108
|
-
:icon="item?.rightIcon || rightIcon"
|
|
109
|
-
></slot>
|
|
110
|
-
<HyIcon
|
|
111
|
-
v-else
|
|
112
|
-
:name="item?.rightIcon?.name || rightIcon?.name || IconConfig.RIGHT"
|
|
113
|
-
:color="
|
|
114
|
-
disabled || item?.disabled
|
|
115
|
-
? '#c0c0c0'
|
|
116
|
-
: item?.rightIcon?.color || rightIcon?.color
|
|
117
|
-
"
|
|
118
|
-
:bold="item?.rightIcon?.bold || rightIcon?.bold"
|
|
119
|
-
:customPrefix="item?.rightIcon?.customPrefix || rightIcon?.customPrefix"
|
|
120
|
-
:imgMode="item?.rightIcon?.imgMode || rightIcon?.imgMode"
|
|
121
|
-
:width="item?.rightIcon?.width || rightIcon?.width"
|
|
122
|
-
:height="item?.rightIcon?.height || rightIcon?.height"
|
|
123
|
-
:top="item?.rightIcon?.top || rightIcon?.name"
|
|
124
|
-
:stop="item?.rightIcon?.stop || rightIcon?.stop"
|
|
125
|
-
:round="item?.rightIcon?.round || rightIcon?.round"
|
|
126
|
-
:customStyle="item?.rightIcon?.customStyle || rightIcon?.customStyle"
|
|
127
|
-
></HyIcon>
|
|
128
|
-
</view>
|
|
129
|
-
</view>
|
|
130
|
-
|
|
131
|
-
<!-- @slot 底部插槽 -->
|
|
132
|
-
<slot name="bottom" :record="item" />
|
|
133
|
-
</template>
|
|
134
|
-
</view>
|
|
2
|
+
<view :class="['hy-cell', customClass]" :style="customStyle">
|
|
3
|
+
<slot></slot>
|
|
135
4
|
</view>
|
|
136
5
|
</template>
|
|
137
6
|
|
|
@@ -146,69 +15,19 @@ export default {
|
|
|
146
15
|
</script>
|
|
147
16
|
|
|
148
17
|
<script setup lang="ts">
|
|
149
|
-
import {
|
|
150
|
-
import type { ICellEmits } from './typing'
|
|
151
|
-
import type { CellContentVo } from './typing'
|
|
152
|
-
import { IconConfig, addUnit } from '../../libs'
|
|
18
|
+
import { provide, toRefs } from 'vue'
|
|
153
19
|
import cellProps from './props'
|
|
154
|
-
|
|
155
|
-
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* cell单元格一般用于一组列表的情况,比如个人中心页,设置页等
|
|
159
|
-
* @displayName hy-cell
|
|
160
|
-
*/
|
|
161
|
-
defineOptions({})
|
|
20
|
+
import type { ICellEmits } from './typing'
|
|
162
21
|
|
|
163
|
-
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
164
22
|
const props = defineProps(cellProps)
|
|
165
23
|
const emit = defineEmits<ICellEmits>()
|
|
166
24
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return (temp: CellContentVo): string => {
|
|
172
|
-
return [
|
|
173
|
-
!props.disabled &&
|
|
174
|
-
!temp?.disabled &&
|
|
175
|
-
props.clickable &&
|
|
176
|
-
'hy-cell__body--container__clickable'
|
|
177
|
-
]
|
|
178
|
-
.filter(Boolean)
|
|
179
|
-
.join()
|
|
25
|
+
provide('hy-cell', {
|
|
26
|
+
...toRefs(props),
|
|
27
|
+
onClick: (name: string | number) => {
|
|
28
|
+
emit('click', name)
|
|
180
29
|
}
|
|
181
30
|
})
|
|
182
|
-
const ItemClass = computed(() => {
|
|
183
|
-
return ['hy-cell__body--container', `hy-cell__body--container__${props.size}`]
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
const iconSize = computed(() => {
|
|
187
|
-
switch (props.size) {
|
|
188
|
-
case 'large':
|
|
189
|
-
return 25
|
|
190
|
-
case 'medium':
|
|
191
|
-
return 20
|
|
192
|
-
case 'small':
|
|
193
|
-
return 15
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @description 点击cell
|
|
199
|
-
* */
|
|
200
|
-
const clickHandler = (e: Event, temp: CellContentVo, index: number) => {
|
|
201
|
-
if (props.disabled) return
|
|
202
|
-
emit('click', temp, index)
|
|
203
|
-
if (temp?.url) {
|
|
204
|
-
uni.navigateTo({
|
|
205
|
-
url: temp.url
|
|
206
|
-
})
|
|
207
|
-
}
|
|
208
|
-
e.stopPropagation()
|
|
209
|
-
}
|
|
210
31
|
</script>
|
|
211
32
|
|
|
212
|
-
<style lang="scss" scoped>
|
|
213
|
-
@import './index.scss';
|
|
214
|
-
</style>
|
|
33
|
+
<style lang="scss" scoped></style>
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import type { CellContentVo } from './typing'
|
|
2
1
|
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
4
2
|
|
|
5
3
|
const cellProps = {
|
|
6
|
-
/** cell列表数据 */
|
|
7
|
-
list: {
|
|
8
|
-
type: Array as PropType<Array<CellContentVo>>,
|
|
9
|
-
default: () => [],
|
|
10
|
-
required: true
|
|
11
|
-
},
|
|
12
|
-
/** 头部标题 */
|
|
13
|
-
title: String,
|
|
14
|
-
/** 是否显示标题前缀竖线 */
|
|
15
|
-
showVertical: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
default: true
|
|
18
|
-
},
|
|
19
4
|
/** 是否显示cell下边框 */
|
|
20
5
|
border: {
|
|
21
6
|
type: Boolean,
|
|
22
7
|
default: true
|
|
23
8
|
},
|
|
24
|
-
/** 圆角 */
|
|
25
|
-
borderRadius: {
|
|
26
|
-
type: [String, Number],
|
|
27
|
-
default: '5px'
|
|
28
|
-
},
|
|
29
9
|
/** 是否禁用cell */
|
|
30
10
|
disabled: {
|
|
31
11
|
type: Boolean,
|
|
@@ -44,8 +24,6 @@ const cellProps = {
|
|
|
44
24
|
type: [String, Number],
|
|
45
25
|
default: 'medium'
|
|
46
26
|
},
|
|
47
|
-
/** 右侧的内容 */
|
|
48
|
-
value: String,
|
|
49
27
|
/**
|
|
50
28
|
* 内容是否垂直居中(主要是针对右侧的value部分)
|
|
51
29
|
* @values left,center,right
|
|
@@ -54,9 +32,10 @@ const cellProps = {
|
|
|
54
32
|
type: String,
|
|
55
33
|
default: 'right'
|
|
56
34
|
},
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
type:
|
|
35
|
+
/** 是否展示右侧图标 */
|
|
36
|
+
isRightIcon: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
60
39
|
},
|
|
61
40
|
/**
|
|
62
41
|
* 右侧箭头的方向
|
|
@@ -67,7 +46,9 @@ const cellProps = {
|
|
|
67
46
|
default: 'right'
|
|
68
47
|
},
|
|
69
48
|
/** 定义需要用到的外部样式 */
|
|
70
|
-
customStyle: Object as PropType<CSSProperties
|
|
49
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
50
|
+
/** 自定义外部类名 */
|
|
51
|
+
customClass: String
|
|
71
52
|
}
|
|
72
53
|
|
|
73
54
|
export default cellProps
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
import { HyApp } from '../../typing'
|
|
2
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
3
|
-
|
|
4
|
-
export interface CellContentVo extends AnyObject {
|
|
5
|
-
/**
|
|
6
|
-
* @description 单元格左图标
|
|
7
|
-
* */
|
|
8
|
-
icon?: Partial<HyIconProps>
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @description 单元格标题
|
|
12
|
-
* */
|
|
13
|
-
title?: string
|
|
14
|
-
/**
|
|
15
|
-
* @description 单元格副标题
|
|
16
|
-
* */
|
|
17
|
-
subhead?: string
|
|
18
|
-
/**
|
|
19
|
-
* @description 是否禁用单元格
|
|
20
|
-
* */
|
|
21
|
-
disabled?: boolean
|
|
22
|
-
/**
|
|
23
|
-
* @description 单元格右图标集合
|
|
24
|
-
* */
|
|
25
|
-
rightIcon?: Partial<HyIconProps>
|
|
26
|
-
/**
|
|
27
|
-
* @description 单元格值
|
|
28
|
-
* */
|
|
29
|
-
value?: string | number | boolean
|
|
30
|
-
/**
|
|
31
|
-
* @description 跳转页面地址
|
|
32
|
-
* */
|
|
33
|
-
url?: string
|
|
34
|
-
/**
|
|
35
|
-
* @description 单元格右侧箭头的方向,可选值为:left,up,down,right
|
|
36
|
-
* */
|
|
37
|
-
arrowDirection?: HyApp.RotateType
|
|
38
|
-
}
|
|
39
|
-
|
|
40
1
|
export interface ICellEmits {
|
|
41
|
-
/**
|
|
42
|
-
(e: 'click',
|
|
2
|
+
/** 点击单元格触发 */
|
|
3
|
+
(e: 'click', name: string | number): void
|
|
43
4
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="cellClass"
|
|
4
|
+
:hover-class="hoverClass"
|
|
5
|
+
:style="customStyle"
|
|
6
|
+
:hover-stay-time="250"
|
|
7
|
+
@tap="clickHandler"
|
|
8
|
+
>
|
|
9
|
+
<view class="hy-cell-item__left">
|
|
10
|
+
<view v-if="icon || $slots.icon" class="hy-cell-item__left--icon">
|
|
11
|
+
<!-- @slot 图标插槽 -->
|
|
12
|
+
<slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
|
|
13
|
+
<hy-icon
|
|
14
|
+
v-else
|
|
15
|
+
:size="iconSize"
|
|
16
|
+
:name="icon?.name"
|
|
17
|
+
:color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : icon?.color"
|
|
18
|
+
:bold="icon?.bold"
|
|
19
|
+
:customPrefix="icon?.customPrefix"
|
|
20
|
+
:imgMode="icon?.imgMode"
|
|
21
|
+
:width="icon?.width"
|
|
22
|
+
:height="icon?.height"
|
|
23
|
+
:top="icon?.top"
|
|
24
|
+
:stop="icon?.stop"
|
|
25
|
+
:round="icon?.round"
|
|
26
|
+
:customStyle="icon?.customStyle"
|
|
27
|
+
></hy-icon>
|
|
28
|
+
</view>
|
|
29
|
+
<view class="hy-cell-item__left--title">
|
|
30
|
+
<!-- @slot 列表标题插槽 -->
|
|
31
|
+
<slot v-if="$slots.title" name="title" :title="title"></slot>
|
|
32
|
+
<text v-else class="hy-cell-item__left--title__text">
|
|
33
|
+
{{ title }}
|
|
34
|
+
</text>
|
|
35
|
+
<!-- @slot 列表小标题插槽 -->
|
|
36
|
+
<slot v-if="$slots.sub" name="sub" :sub="sub"></slot>
|
|
37
|
+
<text v-else-if="sub" class="hy-cell-item__left--title__sub">
|
|
38
|
+
{{ sub }}
|
|
39
|
+
</text>
|
|
40
|
+
</view>
|
|
41
|
+
</view>
|
|
42
|
+
<view
|
|
43
|
+
class="hy-cell-item__center"
|
|
44
|
+
:style="{
|
|
45
|
+
justifyContent:
|
|
46
|
+
cellConfig?.arrange.value === 'left'
|
|
47
|
+
? 'flex-start'
|
|
48
|
+
: cellConfig?.arrange.value === 'right'
|
|
49
|
+
? 'flex-end'
|
|
50
|
+
: 'center'
|
|
51
|
+
}"
|
|
52
|
+
>
|
|
53
|
+
<!-- @slot 值内容插槽 -->
|
|
54
|
+
<slot v-if="$slots.value" name="value" :record="item"></slot>
|
|
55
|
+
<text v-else-if="value" class="hy-cell-item__center--value">
|
|
56
|
+
{{ value }}
|
|
57
|
+
</text>
|
|
58
|
+
</view>
|
|
59
|
+
<view
|
|
60
|
+
:class="[
|
|
61
|
+
'hy-cell-item__right',
|
|
62
|
+
`hy-cell-item__right--${cellConfig?.arrowDirection.value}`
|
|
63
|
+
]"
|
|
64
|
+
v-if="cellConfig?.isRightIcon.value"
|
|
65
|
+
>
|
|
66
|
+
<!-- @slot 右边按钮插槽 -->
|
|
67
|
+
<slot v-if="$slots['right-icon']" name="right-icon" :icon="rightIcon"></slot>
|
|
68
|
+
<hy-icon
|
|
69
|
+
v-else
|
|
70
|
+
:name="rightIcon?.name || IconConfig.RIGHT"
|
|
71
|
+
:color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : rightIcon?.color"
|
|
72
|
+
:bold="rightIcon?.bold"
|
|
73
|
+
:customPrefix="rightIcon?.customPrefix"
|
|
74
|
+
:imgMode="rightIcon?.imgMode"
|
|
75
|
+
:width="rightIcon?.width"
|
|
76
|
+
:height="rightIcon?.height"
|
|
77
|
+
:stop="rightIcon?.stop"
|
|
78
|
+
:round="rightIcon?.round"
|
|
79
|
+
:customStyle="rightIcon?.customStyle"
|
|
80
|
+
:customClass="rightIcon?.customClass"
|
|
81
|
+
></hy-icon>
|
|
82
|
+
</view>
|
|
83
|
+
</view>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script lang="ts">
|
|
87
|
+
export default {
|
|
88
|
+
name: 'hy-cell-item',
|
|
89
|
+
options: {
|
|
90
|
+
virtualHost: true,
|
|
91
|
+
styleIsolation: 'shared'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import { computed, inject } from 'vue'
|
|
98
|
+
import cellItemProps from './props'
|
|
99
|
+
import type { ICellContext } from './typing'
|
|
100
|
+
import { IconConfig } from '../../libs'
|
|
101
|
+
import type { ICellEmits } from '../hy-cell/typing'
|
|
102
|
+
// 组件
|
|
103
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
104
|
+
|
|
105
|
+
const props = defineProps(cellItemProps)
|
|
106
|
+
const emit = defineEmits<ICellEmits>()
|
|
107
|
+
const cellConfig = inject<ICellContext>('hy-cell')
|
|
108
|
+
|
|
109
|
+
// 单元格类名
|
|
110
|
+
const cellClass = computed(() => {
|
|
111
|
+
return [
|
|
112
|
+
'hy-cell-item',
|
|
113
|
+
`hy-cell-item--${cellConfig?.size.value}`,
|
|
114
|
+
cellConfig?.border.value && 'hy-border__bottom',
|
|
115
|
+
(props.disabled || cellConfig?.disabled.value) && 'hy-cell-item__disabled',
|
|
116
|
+
props.customClass
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// 计算什么时候出现点击状态
|
|
121
|
+
const hoverClass = computed(() => {
|
|
122
|
+
if (!(props.disabled || cellConfig?.disabled.value) && cellConfig?.clickable.value) {
|
|
123
|
+
return 'hy-cell-item__clickable'
|
|
124
|
+
} else {
|
|
125
|
+
return ''
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// 图标大小
|
|
130
|
+
const iconSize = computed(() => {
|
|
131
|
+
switch (cellConfig?.size.value) {
|
|
132
|
+
case 'large':
|
|
133
|
+
return 25
|
|
134
|
+
case 'medium':
|
|
135
|
+
return 20
|
|
136
|
+
case 'small':
|
|
137
|
+
return 15
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 点击cell
|
|
143
|
+
* */
|
|
144
|
+
const clickHandler = (e: Event) => {
|
|
145
|
+
if (cellConfig?.disabled.value || props.disabled) return
|
|
146
|
+
if (props.stop) e.stopPropagation()
|
|
147
|
+
|
|
148
|
+
emit('click', props.name)
|
|
149
|
+
cellConfig?.onClick(props.name)
|
|
150
|
+
if (props.url) {
|
|
151
|
+
;(uni as any)[props.linkType]({
|
|
152
|
+
url: props.url
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<style lang="scss" scoped>
|
|
159
|
+
@import './index.scss';
|
|
160
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
2
|
+
@use "../../libs/css/theme" as *;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@include b(cell-item) {
|
|
6
|
+
@include flex(row);
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
flex: 1;
|
|
10
|
+
background-color: $hy-background--container;
|
|
11
|
+
|
|
12
|
+
/* 大 */
|
|
13
|
+
@include m(large) {
|
|
14
|
+
font-size: $hy-font-size-lg;
|
|
15
|
+
padding: 35rpx;
|
|
16
|
+
line-height: 25px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* 默认 */
|
|
20
|
+
@include m(medium) {
|
|
21
|
+
font-size: $hy-font-size-base;
|
|
22
|
+
padding: 30rpx;
|
|
23
|
+
line-height: 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* 小 */
|
|
27
|
+
@include m(small) {
|
|
28
|
+
font-size: $hy-font-size-sm;
|
|
29
|
+
padding: 25rpx;
|
|
30
|
+
line-height: 15px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*点击状态*/
|
|
34
|
+
@include e(clickable) {
|
|
35
|
+
background-color: $hy-background--hover;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include e(left) {
|
|
39
|
+
@include flex(row);
|
|
40
|
+
/*左边icon*/
|
|
41
|
+
@include m(icon) {
|
|
42
|
+
@include flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
margin-right: 10px;
|
|
45
|
+
}
|
|
46
|
+
/*行头部*/
|
|
47
|
+
@include m(title) {
|
|
48
|
+
margin-right: $hy-border-margin-padding-sm;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
|
|
52
|
+
/*sub值*/
|
|
53
|
+
@include e(sub) {
|
|
54
|
+
margin-top: $hy-border-margin-padding-sm;
|
|
55
|
+
color: $hy-text-color--grey;
|
|
56
|
+
font-size: 24rpx;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*cell值*/
|
|
62
|
+
@include e(center) {
|
|
63
|
+
@include flex;
|
|
64
|
+
max-width: 90%;
|
|
65
|
+
flex: 1;
|
|
66
|
+
@include m(value) {
|
|
67
|
+
line-height: 24px;
|
|
68
|
+
color: $hy-text-color--grey;
|
|
69
|
+
margin-right: $hy-border-margin-padding-sm;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*右边icon*/
|
|
74
|
+
@include e(right) {
|
|
75
|
+
transition: transform 0.3s;
|
|
76
|
+
:deep(.hy-icon) {
|
|
77
|
+
color: $hy-text-color--3;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include m(up) {
|
|
81
|
+
transform: rotate(-90deg);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@include m(left) {
|
|
85
|
+
transform: rotate(180deg);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@include m(down) {
|
|
89
|
+
transform: rotate(90deg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include e(disabled) {
|
|
94
|
+
color: $hy-text-color--disabled;
|
|
95
|
+
background: $hy-background--disabled;
|
|
96
|
+
/* #ifndef APP-NVUE */
|
|
97
|
+
cursor: not-allowed;
|
|
98
|
+
/* #endif */
|
|
99
|
+
}
|
|
100
|
+
}
|