@yorkjs/hive-ui 2.3.5 → 2.3.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/package.json
CHANGED
|
@@ -110,10 +110,19 @@
|
|
|
110
110
|
align-items flex-end
|
|
111
111
|
flex-shrink 0
|
|
112
112
|
|
|
113
|
+
.flow-item-amount-row
|
|
114
|
+
display flex
|
|
115
|
+
flex-direction row
|
|
116
|
+
align-items center
|
|
117
|
+
|
|
113
118
|
.flow-item-amount
|
|
114
119
|
font-size 16PX
|
|
115
120
|
color var(--textTitle)
|
|
116
121
|
|
|
122
|
+
.flow-item-amount-status
|
|
123
|
+
margin-left 5PX
|
|
124
|
+
font-size 16PX
|
|
125
|
+
|
|
117
126
|
.flow-item-desc
|
|
118
127
|
margin-top 5PX
|
|
119
128
|
font-size 12PX
|
|
@@ -21,6 +21,10 @@ interface IProps {
|
|
|
21
21
|
amount?: string | number
|
|
22
22
|
/** 金额颜色,不传默认 */
|
|
23
23
|
amountColor?: string
|
|
24
|
+
/** 金额右侧的状态文字(如"已退款") */
|
|
25
|
+
amountStatus?: string
|
|
26
|
+
/** 状态文字颜色 */
|
|
27
|
+
amountStatusColor?: string
|
|
24
28
|
/** 右侧下方的描述或状态 */
|
|
25
29
|
desc?: string
|
|
26
30
|
/** 描述文字颜色 */
|
|
@@ -40,6 +44,8 @@ const FlowItem: React.FC<IProps> = (props) => {
|
|
|
40
44
|
titleExtra,
|
|
41
45
|
amount,
|
|
42
46
|
amountColor,
|
|
47
|
+
amountStatus,
|
|
48
|
+
amountStatusColor,
|
|
43
49
|
desc,
|
|
44
50
|
descColor,
|
|
45
51
|
showSeparator = true,
|
|
@@ -128,12 +134,26 @@ const FlowItem: React.FC<IProps> = (props) => {
|
|
|
128
134
|
{
|
|
129
135
|
amount !== undefined
|
|
130
136
|
? (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
<View className="flow-item-amount-row">
|
|
138
|
+
<Text
|
|
139
|
+
className="flow-item-amount"
|
|
140
|
+
style={amountColor ? { color: amountColor } : {}}
|
|
141
|
+
>
|
|
142
|
+
{amount}
|
|
143
|
+
</Text>
|
|
144
|
+
{
|
|
145
|
+
!isEmpty(amountStatus)
|
|
146
|
+
? (
|
|
147
|
+
<Text
|
|
148
|
+
className="flow-item-amount-status"
|
|
149
|
+
style={amountStatusColor ? { color: amountStatusColor } : {}}
|
|
150
|
+
>
|
|
151
|
+
{amountStatus}
|
|
152
|
+
</Text>
|
|
153
|
+
)
|
|
154
|
+
: undefined
|
|
155
|
+
}
|
|
156
|
+
</View>
|
|
137
157
|
)
|
|
138
158
|
: undefined
|
|
139
159
|
}
|
|
@@ -49,6 +49,10 @@ export interface IProductCardProps {
|
|
|
49
49
|
image: { url: string }
|
|
50
50
|
/** 是否显示售罄标记 */
|
|
51
51
|
showSoldOut?: boolean
|
|
52
|
+
/** 是否显图片上的遮罩 */
|
|
53
|
+
showImageOverlay?: boolean
|
|
54
|
+
/** 遮罩文案 */
|
|
55
|
+
imageOverlayText?: string
|
|
52
56
|
/** 是否显示已下架标记 */
|
|
53
57
|
showOffline?: boolean
|
|
54
58
|
/** 商品标题 */
|
|
@@ -57,6 +61,8 @@ export interface IProductCardProps {
|
|
|
57
61
|
titleMaxLines?: number
|
|
58
62
|
/** 商品类型:实物/虚拟/服务 */
|
|
59
63
|
productType?: number
|
|
64
|
+
/** 自定义商品类型 */
|
|
65
|
+
productTypeCustom?: { color: string; text: string, backgroundColor?: string }
|
|
60
66
|
/** 是否显示“多规格”标签 */
|
|
61
67
|
showMultipleSpec?: boolean
|
|
62
68
|
/** 库存数量文案 */
|
|
@@ -124,6 +130,7 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
124
130
|
title,
|
|
125
131
|
titleMaxLines = 1,
|
|
126
132
|
productType,
|
|
133
|
+
productTypeCustom,
|
|
127
134
|
customTags,
|
|
128
135
|
showMultipleSpec,
|
|
129
136
|
stockCount,
|
|
@@ -144,6 +151,8 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
144
151
|
remainingTotal,
|
|
145
152
|
buyCount,
|
|
146
153
|
showSoldOut = false,
|
|
154
|
+
showImageOverlay = false,
|
|
155
|
+
imageOverlayText = '',
|
|
147
156
|
showOffline = false,
|
|
148
157
|
showCheckbox = false,
|
|
149
158
|
checkboxChecked = false,
|
|
@@ -159,6 +168,10 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
159
168
|
children
|
|
160
169
|
} = props
|
|
161
170
|
|
|
171
|
+
const isOverlayVisible = useMemo(() => {
|
|
172
|
+
return showSoldOut || showOffline || showImageOverlay
|
|
173
|
+
}, [showSoldOut, showOffline, showImageOverlay])
|
|
174
|
+
|
|
162
175
|
const handleCardClick = (e: ITouchEvent) => {
|
|
163
176
|
if (showCheckbox) {
|
|
164
177
|
if (!checkboxDisabled) {
|
|
@@ -178,7 +191,27 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
178
191
|
}, [])
|
|
179
192
|
|
|
180
193
|
const productTypeTag = useMemo(() => {
|
|
181
|
-
|
|
194
|
+
|
|
195
|
+
if (productTypeCustom) {
|
|
196
|
+
return (
|
|
197
|
+
<View className={styles['product-tag-container']}>
|
|
198
|
+
<Tag
|
|
199
|
+
type='light-warning'
|
|
200
|
+
text={productTypeCustom.text}
|
|
201
|
+
className="product-tag"
|
|
202
|
+
style={{
|
|
203
|
+
backgroundColor: productTypeCustom.backgroundColor,
|
|
204
|
+
color: productTypeCustom.color
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
</View>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (productType === undefined) {
|
|
212
|
+
return null
|
|
213
|
+
}
|
|
214
|
+
|
|
182
215
|
const colorMap: Record<number, { color: string; text: string | undefined }> = {
|
|
183
216
|
[MALL_PRODUCT_TYPE_REAL]: {
|
|
184
217
|
color: 'var(--primary)',
|
|
@@ -209,7 +242,7 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
209
242
|
/>
|
|
210
243
|
</View>
|
|
211
244
|
)
|
|
212
|
-
}, [productType, labels])
|
|
245
|
+
}, [productType, labels, productTypeCustom])
|
|
213
246
|
|
|
214
247
|
const deliveryTags = useMemo(() => {
|
|
215
248
|
if (isEmpty(deliveryTypes)) return null
|
|
@@ -319,10 +352,10 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
|
|
|
319
352
|
className={styles['product-image']}
|
|
320
353
|
mode='aspectFill'
|
|
321
354
|
/>
|
|
322
|
-
{
|
|
355
|
+
{isOverlayVisible && (
|
|
323
356
|
<View className={styles['status-overlay']}>
|
|
324
357
|
<Text className={styles['status-text']}>
|
|
325
|
-
{showSoldOut ? labels.sold_out : labels.offline}
|
|
358
|
+
{showImageOverlay ? imageOverlayText : showSoldOut ? labels.sold_out : labels.offline}
|
|
326
359
|
</Text>
|
|
327
360
|
</View>
|
|
328
361
|
)}
|