@yorkjs/hive-ui 0.0.8 → 0.0.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-ui",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -62,6 +62,8 @@ export interface IProductCardProps {
62
62
  saleCount?: string | number
63
63
  /** 商品条码 */
64
64
  barcode?: string
65
+ /** 自定义标签 */
66
+ customTags?: React.ReactNode
65
67
  /** 规格描述文案 (如: 红色, 大号) */
66
68
  spec?: string
67
69
  /** 规格描述最大显示行数 (默认1) */
@@ -113,6 +115,7 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
113
115
  title,
114
116
  titleMaxLines = 1,
115
117
  productType,
118
+ customTags,
116
119
  showMultipleSpec,
117
120
  stockCount,
118
121
  saleCount,
@@ -229,7 +232,7 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
229
232
  })
230
233
  }, [deliveryTypes, labels])
231
234
 
232
- const stockAndSaleElem = useMemo(() => {
235
+ const stockAndSaleElem = useMemo(() => {
233
236
  if (!stockCount && !saleCount) return null
234
237
  return (
235
238
  <View className={styles['stock-and-sale']}>
@@ -306,6 +309,7 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
306
309
  </View>
307
310
  </ScrollView>
308
311
  )}
312
+ {customTags}
309
313
  {(activityType || deliveryTags) && (
310
314
  <View className={styles['tag-row']}>
311
315
  {activityType && labels.activity_type && (
@@ -1,60 +0,0 @@
1
- @import '../../styles/mixin.styl'
2
-
3
- $CELL_PADDING_HORIZONTAL = 16PX
4
- $CELL_PADDING_VERTICAL = 14PX
5
- $TITLE_FONT_SIZE = 16PX
6
-
7
- .field-card-container
8
- border-radius 10PX
9
- background-color var(--containerCard)
10
- margin 0 12PX
11
- margin-bottom 12PX
12
- overflow visible
13
-
14
- .card-header
15
- display flex
16
- flex-direction row
17
- align-items center
18
- justify-content space-between
19
- padding $CELL_PADDING_VERTICAL $CELL_PADDING_HORIZONTAL
20
- position relative
21
- min-height 48PX
22
- box-sizing border-box
23
- halfBorder(bottom, var(--lineBorder))
24
-
25
- .header-left
26
- flex 1
27
- display flex
28
- flex-direction row
29
- align-items center
30
- min-width 0
31
-
32
- .header-title
33
- color var(--textTitle)
34
- font-size $TITLE_FONT_SIZE
35
- font-weight 500
36
- line-height 1.4
37
- lineClamp(1)
38
-
39
- .edit-icon
40
- margin-left 6PX
41
- color var(--textMuted)
42
- flex-shrink 0
43
-
44
- .header-extra
45
- margin-left 12PX
46
- flex-shrink 0
47
- display flex
48
- align-items center
49
- // 动作区域通常字号稍小
50
- font-size 14PX
51
-
52
- .action-text
53
- color #FF4D4F
54
-
55
- .action-link
56
- color var(--primary)
57
-
58
- .card-content
59
- border-radius 0 0 10PX 10PX
60
- overflow hidden
@@ -1,83 +0,0 @@
1
- import React from 'react'
2
- import { View, Text, ITouchEvent } from '@tarojs/components'
3
-
4
- import { formatClassNames } from '../../util/function'
5
- import Icon from '../Icon'
6
-
7
- import styles from './index.module.styl'
8
-
9
- export interface FieldCardProps {
10
- /** 标题内容 */
11
- title: string
12
- /** 是否显示标题旁的编辑小图标 */
13
- showEditIcon?: boolean
14
- /** 右侧动作区域:支持字符串、Icon 或自定义节点 */
15
- extra?: React.ReactNode
16
- /** 点击整个 Header 区域的回调 */
17
- onHeaderClick?: (e: ITouchEvent) => void
18
- /** 点击右侧 extra 区域的回调 (如果传了 extra 且需要独立点击) */
19
- onExtraClick?: (e: ITouchEvent) => void
20
- /** 子组件 */
21
- children?: React.ReactNode
22
- /** 外部样式 */
23
- className?: string
24
- }
25
-
26
- const FieldCard: React.FC<FieldCardProps> = (props) => {
27
- const {
28
- title,
29
- showEditIcon = false,
30
- extra,
31
- onHeaderClick,
32
- onExtraClick,
33
- children,
34
- className
35
- } = props
36
-
37
- const handleExtraClick = (e: ITouchEvent) => {
38
- if (onExtraClick) {
39
- e.stopPropagation()
40
- onExtraClick(e)
41
- }
42
- }
43
-
44
- return (
45
- <View className={formatClassNames(styles['field-card-container'], className)}>
46
- <View className={styles['card-header']} onClick={onHeaderClick}>
47
- <View className={styles['header-left']}>
48
- <Text className={styles['header-title']}>{title}</Text>
49
- {
50
- showEditIcon
51
- ? (
52
- <Icon name='edit' size={14} className={styles['edit-icon']} />
53
- )
54
- : undefined
55
- }
56
- </View>
57
-
58
- {extra && (
59
- <View
60
- className={styles['header-extra']}
61
- onClick={handleExtraClick}
62
- >
63
- {
64
- typeof extra === 'string'
65
- ? (
66
- <Text className={styles['action-text']}>{extra}</Text>
67
- )
68
- : (
69
- extra
70
- )
71
- }
72
- </View>
73
- )}
74
- </View>
75
-
76
- <View className={styles['card-content']}>
77
- {children}
78
- </View>
79
- </View>
80
- )
81
- }
82
-
83
- export default FieldCard