@yorkjs/hive-ui 0.1.2 → 0.1.3

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.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -0,0 +1,56 @@
1
+ @import '../../styles/mixin.styl'
2
+ @import '../../styles/variable.styl'
3
+
4
+ $CELL_PADDING_HORIZONTAL = 10PX
5
+ $CELL_PADDING_VERTICAL = 15PX
6
+ $LABEL_MARGIN_RIGHT = 20PX
7
+
8
+ .display-card
9
+ padding $CELL_PADDING_VERTICAL $CELL_PADDING_HORIZONTAL
10
+ background-color var(--containerCard)
11
+ margin 0 $WING_BLANK
12
+ border-radius 10PX
13
+ &.show-top-gutter
14
+ margin-top $GUTTER_BLANK
15
+ &.show-bottom-gutter
16
+ margin-bottom $GUTTER_BLANK
17
+ &.show-top-blank
18
+ margin-top $CARD_BLANK
19
+
20
+ .card-header
21
+ display flex
22
+ justify-content space-between
23
+ align-items center
24
+ margin-bottom 15PX
25
+
26
+ .header-title
27
+ font-size 16PX
28
+ font-weight bold
29
+ color var(--textTitle)
30
+
31
+ .header-extra
32
+ font-size 14PX
33
+ color var(--textMuted)
34
+
35
+ .info-row
36
+ display flex
37
+ flex-direction row
38
+ align-items flex-start
39
+ margin-bottom 15PX
40
+ &:last-child
41
+ margin-bottom 0
42
+
43
+ .info-label
44
+ font-size 14PX
45
+ color var(--textContent)
46
+ flex-shrink 0
47
+ margin-right $LABEL_MARGIN_RIGHT
48
+ min-width 70PX
49
+
50
+ .info-value
51
+ flex 1
52
+ font-size 14PX
53
+ color var(--textTitle)
54
+ word-break break-all
55
+ display flex
56
+ flex-direction row
@@ -0,0 +1,120 @@
1
+ import React from 'react'
2
+ import { View, Text } from '@tarojs/components'
3
+ import styles from './index.module.styl'
4
+ import { formatClassNames } from '../../util/function'
5
+
6
+ interface IRowProps {
7
+ label: React.ReactNode
8
+ value?: React.ReactNode
9
+ children?: React.ReactNode
10
+ className?: string
11
+ }
12
+
13
+ const InfoRow: React.FC<IRowProps> = ({
14
+ label,
15
+ value,
16
+ children,
17
+ className
18
+ }) => (
19
+ <View
20
+ className={formatClassNames(styles['info-row'], className)}
21
+ >
22
+ <View className={styles['info-label']}>
23
+ {
24
+ typeof label === 'string'
25
+ ? <Text>{label}</Text>
26
+ : label
27
+ }
28
+ </View>
29
+ <View className={styles['info-value']}>
30
+ {children || value || '-'}
31
+ </View>
32
+ </View>
33
+ )
34
+
35
+ interface IBlockProps {
36
+ children?: React.ReactNode
37
+ className?: string
38
+ }
39
+
40
+ const InfoBlock: React.FC<IBlockProps> = ({
41
+ children,
42
+ className
43
+ }) => (
44
+ <View
45
+ className={className}
46
+ >
47
+ {children}
48
+ </View>
49
+ )
50
+
51
+ interface ICardProps {
52
+ title?: React.ReactNode
53
+ showTopGutter?: boolean
54
+ showBottomGutter?: boolean
55
+ showTopBlank?: boolean
56
+ extra?: React.ReactNode
57
+ children?: React.ReactNode
58
+ className?: string
59
+ style?: React.CSSProperties
60
+ }
61
+
62
+ const DisplayCardMain: React.FC<ICardProps> = ({
63
+ title,
64
+ extra,
65
+ children,
66
+ className,
67
+ style,
68
+ showTopGutter = false,
69
+ showBottomGutter = false,
70
+ showTopBlank = false,
71
+ }) => {
72
+ return (
73
+ <View
74
+ className={formatClassNames(
75
+ styles['display-card'],
76
+ {
77
+ [styles['show-top-gutter']]: showTopGutter,
78
+ [styles['show-bottom-gutter']]: showBottomGutter,
79
+ [styles['show-top-blank']]: showTopBlank,
80
+ },
81
+ className
82
+ )}
83
+ style={style}
84
+ >
85
+ {
86
+ (title || extra)
87
+ ? (
88
+ <View className={styles['card-header']}>
89
+ <View className={styles['header-title']}>
90
+ {
91
+ typeof title === 'string'
92
+ ? <Text>{title}</Text>
93
+ : title
94
+ }
95
+ </View>
96
+ {
97
+ extra ? (
98
+ <View className={styles['header-extra']}>
99
+ {extra}
100
+ </View>
101
+ )
102
+ : undefined
103
+ }
104
+ </View>
105
+ )
106
+ : undefined
107
+ }
108
+ <View className={styles['card-content']}>
109
+ {children}
110
+ </View>
111
+ </View>
112
+ )
113
+ }
114
+
115
+ const DisplayCard = Object.assign(DisplayCardMain, {
116
+ Row: InfoRow,
117
+ Block: InfoBlock,
118
+ })
119
+
120
+ export default DisplayCard
@@ -2,6 +2,8 @@
2
2
  export const MALL_PRODUCT_TYPE_REAL = 1
3
3
  export const MALL_PRODUCT_TYPE_VIRTUAL = 2
4
4
  export const MALL_PRODUCT_TYPE_SERVICE = 3
5
+ // 前端定义的字段后台不存在
6
+ export const MALL_PRODUCT_TYPE_COMBO = 4
5
7
 
6
8
  // 快递发货
7
9
  export const MALL_PRODUCT_DELIVERY_TYPE_EXPRESS = 1
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export { default as Icon } from './components/Icon'
6
6
  export { default as Checkbox } from './components/Checkbox'
7
7
  export { default as Tag } from './components/Tag'
8
8
  export { default as FieldCard } from './components/FieldCard'
9
+ export { default as DisplayCard } from './components/DisplayCard'
9
10
 
10
11
  export { default as FlowItem } from './item/FlowItem'
11
12
  export { default as ProductItem, setProductItemConfig } from './item/ProductItem'
@@ -20,13 +20,14 @@ import {
20
20
  PROMOTION_ACTIVITY_TYPE_HOT,
21
21
  PROMOTION_ACTIVITY_TYPE_PRESENT,
22
22
  PROMOTION_ACTIVITY_TYPE_COUNT_DISCOUNT,
23
+ MALL_PRODUCT_TYPE_COMBO,
23
24
  } from '../../constant/mall'
24
25
  import { getProductItemConfig } from './config'
25
26
 
26
27
  import styles from './index.module.styl'
27
28
 
28
29
  export interface IProductCardLabels {
29
- product_type?: { real: string; virtual: string; service: string }
30
+ product_type?: { real: string; virtual: string; service: string; combo: string }
30
31
  delivery_type?: { dine: string; self_pickup: string; delivery: string }
31
32
  activity_type?: { flash: string; brand: string; hot: string; present: string; full_discount: string }
32
33
  present_badge?: string
@@ -181,6 +182,10 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
181
182
  color: '#03BE02',
182
183
  text: labels.product_type?.service
183
184
  },
185
+ [MALL_PRODUCT_TYPE_COMBO] : {
186
+ color: '#E4B700',
187
+ text: labels.product_type?.combo
188
+ },
184
189
  }
185
190
  const item = colorMap[productType]
186
191
  if (!item) return null
@@ -5,7 +5,8 @@ let globalLabels: IProductCardLabels = {
5
5
  product_type: {
6
6
  real: '实物',
7
7
  virtual: '虚拟',
8
- service: '服务'
8
+ service: '服务',
9
+ combo: '套餐'
9
10
  },
10
11
  delivery_type: {
11
12
  dine: '堂食',