@yorkjs/hive-ui 0.1.3 → 0.1.5
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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import '../../styles/mixin.styl'
|
|
2
|
+
@import '../../styles/variable.styl'
|
|
3
|
+
|
|
4
|
+
.card
|
|
5
|
+
border-radius 10PX
|
|
6
|
+
overflow hidden
|
|
7
|
+
background-color var(--containerCard)
|
|
8
|
+
margin 0 $WING_BLANK
|
|
9
|
+
&.show-top-gutter
|
|
10
|
+
margin-top $GUTTER_BLANK
|
|
11
|
+
&.show-bottom-gutter
|
|
12
|
+
margin-bottom $GUTTER_BLANK
|
|
13
|
+
&.show-top-blank
|
|
14
|
+
margin-top $CARD_BLANK
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View } from '@tarojs/components'
|
|
3
|
+
import { formatClassNames } from '../../util/function'
|
|
4
|
+
|
|
5
|
+
import styles from './index.module.styl'
|
|
6
|
+
|
|
7
|
+
export interface CardProps {
|
|
8
|
+
className?: string
|
|
9
|
+
showTopGutter?: boolean
|
|
10
|
+
showBottomGutter?: boolean
|
|
11
|
+
showTopBlank?: boolean
|
|
12
|
+
children?: React.ReactNode
|
|
13
|
+
onClick?: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CellCard: React.FC<CardProps> = ({
|
|
17
|
+
showTopGutter = false,
|
|
18
|
+
showBottomGutter = false,
|
|
19
|
+
showTopBlank = false,
|
|
20
|
+
onClick,
|
|
21
|
+
className,
|
|
22
|
+
children
|
|
23
|
+
}) => {
|
|
24
|
+
const combinedClass = formatClassNames(
|
|
25
|
+
styles['card'],
|
|
26
|
+
{
|
|
27
|
+
[styles['show-top-gutter']]: showTopGutter,
|
|
28
|
+
[styles['show-bottom-gutter']]: showBottomGutter,
|
|
29
|
+
[styles['show-top-blank']]: showTopBlank,
|
|
30
|
+
},
|
|
31
|
+
className
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View
|
|
36
|
+
className={combinedClass}
|
|
37
|
+
onClick={onClick}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</View>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default CellCard
|
|
@@ -23,6 +23,8 @@ export interface CellProps {
|
|
|
23
23
|
showSeparator?: boolean
|
|
24
24
|
showTopBorder?: boolean
|
|
25
25
|
showBottomBorder?: boolean
|
|
26
|
+
clickable?: boolean
|
|
27
|
+
readOnly?: boolean
|
|
26
28
|
onClick?: () => void
|
|
27
29
|
className?: string
|
|
28
30
|
children?: React.ReactNode
|
|
@@ -43,18 +45,25 @@ const Cell: React.FC<CellProps> = (props) => {
|
|
|
43
45
|
showSeparator = false,
|
|
44
46
|
showTopBorder = false,
|
|
45
47
|
showBottomBorder = false,
|
|
48
|
+
clickable,
|
|
49
|
+
readOnly = false,
|
|
46
50
|
onClick,
|
|
47
51
|
className,
|
|
48
52
|
children
|
|
49
53
|
} = props
|
|
50
54
|
|
|
55
|
+
const finalRequired = readOnly ? false : required
|
|
56
|
+
const finalShowArrow = readOnly ? false : showArrow
|
|
57
|
+
const isClickable = readOnly ? false : (clickable !== undefined ? clickable : !!onClick)
|
|
58
|
+
|
|
51
59
|
const containerClass = formatClassNames(
|
|
52
60
|
styles['cell-container'],
|
|
53
61
|
vertical ? styles['is-vertical'] : styles['is-horizontal'],
|
|
54
62
|
{
|
|
55
|
-
[styles['is-clickable']]:
|
|
63
|
+
[styles['is-clickable']]: isClickable,
|
|
56
64
|
[styles['border-top']]: showTopBorder,
|
|
57
65
|
[styles['border-bottom']]: showBottomBorder,
|
|
66
|
+
[styles['is-readonly']]: readOnly
|
|
58
67
|
},
|
|
59
68
|
className
|
|
60
69
|
)
|
|
@@ -77,7 +86,10 @@ const Cell: React.FC<CellProps> = (props) => {
|
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
return (
|
|
80
|
-
<View
|
|
89
|
+
<View
|
|
90
|
+
className={containerClass}
|
|
91
|
+
onClick={readOnly ? undefined : onClick}
|
|
92
|
+
>
|
|
81
93
|
<View className={innerClass}>
|
|
82
94
|
<View className={styles['cell-main']}>
|
|
83
95
|
{
|
|
@@ -101,13 +113,19 @@ const Cell: React.FC<CellProps> = (props) => {
|
|
|
101
113
|
<View className={styles['title-section']}>
|
|
102
114
|
{
|
|
103
115
|
typeof title === 'string'
|
|
104
|
-
?
|
|
116
|
+
? (
|
|
117
|
+
<CellTitle
|
|
118
|
+
title={title}
|
|
119
|
+
required={finalRequired}
|
|
120
|
+
tooltip={tooltip}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
105
123
|
: title
|
|
106
124
|
}
|
|
107
125
|
</View>
|
|
108
126
|
</View>
|
|
109
127
|
{
|
|
110
|
-
|
|
128
|
+
finalShowArrow
|
|
111
129
|
? <View className={styles['arrow-wrapper']}><CellArrow /></View>
|
|
112
130
|
: undefined
|
|
113
131
|
}
|
|
@@ -130,7 +148,13 @@ const Cell: React.FC<CellProps> = (props) => {
|
|
|
130
148
|
>
|
|
131
149
|
{
|
|
132
150
|
typeof title === 'string'
|
|
133
|
-
?
|
|
151
|
+
? (
|
|
152
|
+
<CellTitle
|
|
153
|
+
title={title}
|
|
154
|
+
required={finalRequired}
|
|
155
|
+
tooltip={tooltip}
|
|
156
|
+
/>
|
|
157
|
+
)
|
|
134
158
|
: title
|
|
135
159
|
}
|
|
136
160
|
</View>
|
|
@@ -138,7 +162,7 @@ const Cell: React.FC<CellProps> = (props) => {
|
|
|
138
162
|
{renderContent()}
|
|
139
163
|
</View>
|
|
140
164
|
{
|
|
141
|
-
|
|
165
|
+
finalShowArrow
|
|
142
166
|
? <View className={styles['arrow-wrapper']}><CellArrow /></View>
|
|
143
167
|
: undefined
|
|
144
168
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ 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
9
|
export { default as DisplayCard } from './components/DisplayCard'
|
|
10
|
+
export { default as Card } from './components/Card'
|
|
10
11
|
|
|
11
12
|
export { default as FlowItem } from './item/FlowItem'
|
|
12
13
|
export { default as ProductItem, setProductItemConfig } from './item/ProductItem'
|