@fjyueke/bify-mcp 1.0.0
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +248 -0
- package/metaData/components/action-sheet/api.md +74 -0
- package/metaData/components/action-sheet/doc.md +243 -0
- package/metaData/components/action-sheet/example/index.tsx +116 -0
- package/metaData/components/area-picker/api.md +25 -0
- package/metaData/components/area-picker/doc.md +132 -0
- package/metaData/components/area-picker/example/index.tsx +60 -0
- package/metaData/components/avatar/api.md +19 -0
- package/metaData/components/avatar/doc.md +170 -0
- package/metaData/components/avatar/example/index.tsx +76 -0
- package/metaData/components/back-top/api.md +21 -0
- package/metaData/components/back-top/doc.md +142 -0
- package/metaData/components/back-top/example/index.tsx +96 -0
- package/metaData/components/backdrop/api.md +20 -0
- package/metaData/components/backdrop/doc.md +98 -0
- package/metaData/components/backdrop/example/index.tsx +33 -0
- package/metaData/components/badge/api.md +10 -0
- package/metaData/components/badge/doc.md +169 -0
- package/metaData/components/badge/example/index.tsx +81 -0
- package/metaData/components/button/api.md +31 -0
- package/metaData/components/button/doc.md +235 -0
- package/metaData/components/button/example/index.tsx +235 -0
- package/metaData/components/calendar/api.md +62 -0
- package/metaData/components/calendar/doc.md +516 -0
- package/metaData/components/calendar/example/index.tsx +501 -0
- package/metaData/components/cascader/api.md +55 -0
- package/metaData/components/cascader/doc.md +358 -0
- package/metaData/components/cascader/example/index.tsx +159 -0
- package/metaData/components/cell/api.md +37 -0
- package/metaData/components/cell/doc.md +158 -0
- package/metaData/components/cell/example/index.tsx +44 -0
- package/metaData/components/checkbox/api.md +35 -0
- package/metaData/components/checkbox/doc.md +203 -0
- package/metaData/components/checkbox/example/index.tsx +94 -0
- package/metaData/components/circle/api.md +17 -0
- package/metaData/components/circle/doc.md +123 -0
- package/metaData/components/circle/example/index.tsx +81 -0
- package/metaData/components/collapse/api.md +31 -0
- package/metaData/components/collapse/doc.md +142 -0
- package/metaData/components/collapse/example/index.tsx +81 -0
- package/metaData/components/config-provider/api.md +7 -0
- package/metaData/components/config-provider/doc.md +193 -0
- package/metaData/components/config-provider/example/index.tsx +54 -0
- package/metaData/components/countdown/api.md +46 -0
- package/metaData/components/countdown/doc.md +167 -0
- package/metaData/components/countdown/example/index.tsx +70 -0
- package/metaData/components/datetime-picker/api.md +25 -0
- package/metaData/components/datetime-picker/doc.md +317 -0
- package/metaData/components/datetime-picker/example/index.tsx +265 -0
- package/metaData/components/dialog/api.md +66 -0
- package/metaData/components/dialog/doc.md +292 -0
- package/metaData/components/dialog/example/index.tsx +138 -0
- package/metaData/components/divider/api.md +15 -0
- package/metaData/components/divider/doc.md +108 -0
- package/metaData/components/divider/example/index.tsx +45 -0
- package/metaData/components/dropdown-menu/api.md +37 -0
- package/metaData/components/dropdown-menu/doc.md +279 -0
- package/metaData/components/dropdown-menu/example/index.tsx +182 -0
- package/metaData/components/empty/api.md +20 -0
- package/metaData/components/empty/doc.md +126 -0
- package/metaData/components/empty/example/index.tsx +66 -0
- package/metaData/components/field/api.md +10 -0
- package/metaData/components/field/doc.md +274 -0
- package/metaData/components/field/example/index.tsx +203 -0
- package/metaData/components/fixed-nav/api.md +21 -0
- package/metaData/components/fixed-nav/doc.md +196 -0
- package/metaData/components/fixed-nav/example/index.tsx +80 -0
- package/metaData/components/fixed-view/api.md +10 -0
- package/metaData/components/fixed-view/doc.md +25 -0
- package/metaData/components/fixed-view/example/index.tsx +12 -0
- package/metaData/components/flex/api.md +18 -0
- package/metaData/components/flex/doc.md +103 -0
- package/metaData/components/flex/example/index.tsx +58 -0
- package/metaData/components/floating-bubble/api.md +18 -0
- package/metaData/components/floating-bubble/doc.md +94 -0
- package/metaData/components/floating-bubble/example/index.tsx +55 -0
- package/metaData/components/floating-panel/api.md +19 -0
- package/metaData/components/floating-panel/doc.md +174 -0
- package/metaData/components/floating-panel/example/index.tsx +131 -0
- package/metaData/components/form/api.md +124 -0
- package/metaData/components/form/doc.md +759 -0
- package/metaData/components/form/example/index.tsx +222 -0
- package/metaData/components/grid/api.md +28 -0
- package/metaData/components/grid/doc.md +167 -0
- package/metaData/components/grid/example/index.tsx +80 -0
- package/metaData/components/image/api.md +42 -0
- package/metaData/components/image/doc.md +117 -0
- package/metaData/components/image/example/index.tsx +76 -0
- package/metaData/components/index-list/api.md +39 -0
- package/metaData/components/index-list/doc.md +176 -0
- package/metaData/components/index-list/example/index.tsx +110 -0
- package/metaData/components/list/api.md +30 -0
- package/metaData/components/list/doc.md +317 -0
- package/metaData/components/list/example/index.tsx +218 -0
- package/metaData/components/loading/api.md +10 -0
- package/metaData/components/loading/doc.md +113 -0
- package/metaData/components/loading/example/index.tsx +47 -0
- package/metaData/components/navbar/api.md +26 -0
- package/metaData/components/navbar/doc.md +85 -0
- package/metaData/components/navbar/example/index.tsx +28 -0
- package/metaData/components/notice-bar/api.md +28 -0
- package/metaData/components/notice-bar/doc.md +154 -0
- package/metaData/components/notice-bar/example/index.tsx +107 -0
- package/metaData/components/notify/api.md +28 -0
- package/metaData/components/notify/doc.md +140 -0
- package/metaData/components/notify/example/index.tsx +89 -0
- package/metaData/components/number-keyboard/api.md +21 -0
- package/metaData/components/number-keyboard/doc.md +247 -0
- package/metaData/components/number-keyboard/example/index.tsx +201 -0
- package/metaData/components/pagination/api.md +18 -0
- package/metaData/components/pagination/doc.md +113 -0
- package/metaData/components/pagination/example/index.tsx +73 -0
- package/metaData/components/password-input/api.md +25 -0
- package/metaData/components/password-input/doc.md +126 -0
- package/metaData/components/password-input/example/index.tsx +124 -0
- package/metaData/components/picker/api.md +61 -0
- package/metaData/components/picker/doc.md +336 -0
- package/metaData/components/picker/example/index.tsx +232 -0
- package/metaData/components/popup/api.md +48 -0
- package/metaData/components/popup/doc.md +150 -0
- package/metaData/components/popup/example/index.tsx +214 -0
- package/metaData/components/progress/api.md +11 -0
- package/metaData/components/progress/doc.md +105 -0
- package/metaData/components/progress/example/index.tsx +58 -0
- package/metaData/components/pull-refresh/api.md +18 -0
- package/metaData/components/pull-refresh/doc.md +198 -0
- package/metaData/components/pull-refresh/example/index.tsx +153 -0
- package/metaData/components/radio/api.md +26 -0
- package/metaData/components/radio/doc.md +201 -0
- package/metaData/components/radio/example/index.tsx +103 -0
- package/metaData/components/rate/api.md +23 -0
- package/metaData/components/rate/doc.md +122 -0
- package/metaData/components/rate/example/index.tsx +36 -0
- package/metaData/components/rolling-text/api.md +23 -0
- package/metaData/components/rolling-text/doc.md +153 -0
- package/metaData/components/rolling-text/example/index.tsx +150 -0
- package/metaData/components/safe-area/api.md +8 -0
- package/metaData/components/safe-area/doc.md +30 -0
- package/metaData/components/safe-area/example/index.tsx +16 -0
- package/metaData/components/search/api.md +35 -0
- package/metaData/components/search/doc.md +185 -0
- package/metaData/components/search/example/index.tsx +101 -0
- package/metaData/components/share-sheet/api.md +48 -0
- package/metaData/components/share-sheet/doc.md +215 -0
- package/metaData/components/share-sheet/example/index.tsx +143 -0
- package/metaData/components/sidebar/api.md +28 -0
- package/metaData/components/sidebar/doc.md +122 -0
- package/metaData/components/sidebar/example/index.tsx +58 -0
- package/metaData/components/signature/api.md +19 -0
- package/metaData/components/signature/doc.md +115 -0
- package/metaData/components/signature/example/index.tsx +56 -0
- package/metaData/components/skeleton/api.md +45 -0
- package/metaData/components/skeleton/doc.md +131 -0
- package/metaData/components/skeleton/example/index.tsx +80 -0
- package/metaData/components/slider/api.md +28 -0
- package/metaData/components/slider/doc.md +151 -0
- package/metaData/components/slider/example/index.tsx +54 -0
- package/metaData/components/space/api.md +12 -0
- package/metaData/components/space/doc.md +125 -0
- package/metaData/components/space/example/index.tsx +75 -0
- package/metaData/components/stepper/api.md +37 -0
- package/metaData/components/stepper/doc.md +152 -0
- package/metaData/components/stepper/example/index.tsx +45 -0
- package/metaData/components/steps/api.md +9 -0
- package/metaData/components/steps/doc.md +143 -0
- package/metaData/components/steps/example/index.tsx +93 -0
- package/metaData/components/sticky/api.md +16 -0
- package/metaData/components/sticky/doc.md +87 -0
- package/metaData/components/sticky/example/index.tsx +62 -0
- package/metaData/components/swipe-cell/api.md +19 -0
- package/metaData/components/swipe-cell/doc.md +105 -0
- package/metaData/components/swipe-cell/example/index.tsx +62 -0
- package/metaData/components/swiper/api.md +22 -0
- package/metaData/components/swiper/doc.md +228 -0
- package/metaData/components/swiper/example/index.tsx +118 -0
- package/metaData/components/switch/api.md +17 -0
- package/metaData/components/switch/doc.md +110 -0
- package/metaData/components/switch/example/index.tsx +57 -0
- package/metaData/components/tabbar/api.md +27 -0
- package/metaData/components/tabbar/doc.md +160 -0
- package/metaData/components/tabbar/example/index.tsx +99 -0
- package/metaData/components/tabs/api.md +36 -0
- package/metaData/components/tabs/doc.md +307 -0
- package/metaData/components/tabs/example/index.tsx +231 -0
- package/metaData/components/tag/api.md +17 -0
- package/metaData/components/tag/doc.md +162 -0
- package/metaData/components/tag/example/index.tsx +84 -0
- package/metaData/components/text-ellipsis/api.md +26 -0
- package/metaData/components/text-ellipsis/doc.md +135 -0
- package/metaData/components/text-ellipsis/example/index.tsx +44 -0
- package/metaData/components/timeline/api.md +20 -0
- package/metaData/components/timeline/doc.md +210 -0
- package/metaData/components/timeline/example/index.tsx +145 -0
- package/metaData/components/toast/api.md +39 -0
- package/metaData/components/toast/doc.md +256 -0
- package/metaData/components/toast/example/index.tsx +136 -0
- package/metaData/components/tree-select/api.md +19 -0
- package/metaData/components/tree-select/doc.md +185 -0
- package/metaData/components/tree-select/example/index.tsx +112 -0
- package/metaData/components/uploader/api.md +32 -0
- package/metaData/components/uploader/doc.md +340 -0
- package/metaData/components/uploader/example/index.tsx +222 -0
- package/metaData/components/watermark/api.md +18 -0
- package/metaData/components/watermark/doc.md +97 -0
- package/metaData/components/watermark/example/index.tsx +62 -0
- package/metaData/components-index.json +274 -0
- package/package.json +56 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Tag 标签
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于标记关键词和概括主要内容。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Tag } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
通过 `color` 属性控制标签颜色。
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Tag>标签</Tag>
|
|
21
|
+
<Tag color="primary">标签</Tag>
|
|
22
|
+
<Tag color="info">标签</Tag>
|
|
23
|
+
<Tag color="success">标签</Tag>
|
|
24
|
+
<Tag color="warning">标签</Tag>
|
|
25
|
+
<Tag color="danger">标签</Tag>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 空心样式
|
|
29
|
+
|
|
30
|
+
设置 `variant="outlined"` 属性设置为空心样式。
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<Tag color="primary" variant="outlined">
|
|
34
|
+
标签
|
|
35
|
+
</Tag>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 圆角样式
|
|
39
|
+
|
|
40
|
+
通过 `shape="rounded"` 设置为圆角样式。
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Tag color="primary" shape="rounded">
|
|
44
|
+
标签
|
|
45
|
+
</Tag>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 右侧圆角样式
|
|
49
|
+
|
|
50
|
+
通过 `shape="roundedRight"` 设置为圆角样式。
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<Tag color="primary" shape="roundedRight">
|
|
54
|
+
标签
|
|
55
|
+
</Tag>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 左侧圆角样式
|
|
59
|
+
|
|
60
|
+
通过 `shape="roundedLeft"` 设置为圆角样式。
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<Tag color="primary" shape="roundedLeft">
|
|
64
|
+
标签
|
|
65
|
+
</Tag>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 可关闭标签
|
|
69
|
+
|
|
70
|
+
添加 `closeable` 属性表示标签是可关闭的,关闭标签时会触发 `onClose` 事件,在 `onClose` 事件中可以执行隐藏标签的逻辑。
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
function CloseTag() {
|
|
74
|
+
const [visible, setVisible] = useState(true)
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
{visible && (
|
|
78
|
+
<Tag color="primary" size="medium" closeable onClose={() => setVisible(false)}>
|
|
79
|
+
标签
|
|
80
|
+
</Tag>
|
|
81
|
+
)}
|
|
82
|
+
</>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 标签大小
|
|
88
|
+
|
|
89
|
+
通过 `size` 属性调整标签大小。
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<Tag color="primary" children="标签" />
|
|
93
|
+
<Tag color="primary" size="medium" children="标签" />
|
|
94
|
+
<Tag color="primary" size="large" children="标签" />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 自定义颜色
|
|
98
|
+
|
|
99
|
+
通过 `color` 和 `textColor` 属性设置标签颜色。
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Tag style={{ backgroundColor: "#7232dd" }} children="标签" />
|
|
103
|
+
<Tag style={{ backgroundColor: "#ffe1e1", color: "#ad0000" }} children="标签" />
|
|
104
|
+
<Tag style={{ color: "#7232dd" }} variant="outlined" children="标签" />
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## API
|
|
108
|
+
|
|
109
|
+
### Props
|
|
110
|
+
|
|
111
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
112
|
+
| --------- | ------------------------------------------------------------ | --------- | --------- |
|
|
113
|
+
| size | 大小,可选值为 `large` `medium` | _string_ | - |
|
|
114
|
+
| color | 类型,可选值为 `primary` `info` `success` `danger` `warning` | _string_ | `default` |
|
|
115
|
+
| shape | 形状,可选值为 `rounded` `roundedRight` `roundedLeft` | _string_ | `square` |
|
|
116
|
+
| closeable | 是否为可关闭标签 | _boolean_ | `false` |
|
|
117
|
+
|
|
118
|
+
### Events
|
|
119
|
+
|
|
120
|
+
| 事件名 | 说明 | 回调参数 |
|
|
121
|
+
| ------- | -------------- | -------------------- |
|
|
122
|
+
| onClick | 点击时触发 | _event: ITouchEvent_ |
|
|
123
|
+
| onClose | 关闭标签时触发 | _event: ITouchEvent_ |
|
|
124
|
+
|
|
125
|
+
## 主题定制
|
|
126
|
+
|
|
127
|
+
### 样式变量
|
|
128
|
+
|
|
129
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
130
|
+
|
|
131
|
+
| 名称 | 默认值 | 描述 |
|
|
132
|
+
| --------------------------------------- | ----------------------------------------------------------------------- | ---- |
|
|
133
|
+
| --tag-padding | _var(0 var(--padding-base))_ | - |
|
|
134
|
+
| --tag-color | _var(--white)_ | - |
|
|
135
|
+
| --tag-font-size | _var(--font-size-sm)_ | - |
|
|
136
|
+
| --tag-border-radius | _2px \* $hd_ | - |
|
|
137
|
+
| --tag-line-height | _16px \* $hd_ | - |
|
|
138
|
+
| --tag-medium-padding | _2px * $hd 6px * $hd_ | - |
|
|
139
|
+
| --tag-large-padding | _var(--padding-base) var(--padding-xs)_ | - |
|
|
140
|
+
| --tag-large-border-radius | _var(--border-radius-md)_ | - |
|
|
141
|
+
| --tag-large-font-size | _var(--font-size-md)_ | - |
|
|
142
|
+
| --tag-rounded-border-radius | _var(--border-radius-max)_ | - |
|
|
143
|
+
| --tag-rounded-right-padding | _var(--tag-rounded-right-padding, 0 (6px \* $hd) 0 var(--padding-base)_ | - |
|
|
144
|
+
| --tag-rounded-left-padding | _var(--tag-rounded-left-padding, 0 var(--padding-base) 0 (6px \* $hd))_ | - |
|
|
145
|
+
| --tag-rounded-right-medium-padding | _2px * $hd 8px * $hd 2px * $hd 6px * $hd_ | - |
|
|
146
|
+
| --tag-rounded-left-medium-padding | _2px * $hd 6px * $hd 2px * $hd 8px * $hd_ | - |
|
|
147
|
+
| --tag-rounded-right-large-padding | _var(--padding-base) 6px \* $hd var(--padding-base) var(--padding-xs)_ | - |
|
|
148
|
+
| --tag-rounded-left-large-padding | _var(--padding-base) var(--padding-xs) var(--padding-base) 6px \* $hd_ | - |
|
|
149
|
+
| --tag-default-color | _var(--gray-6)_ | - |
|
|
150
|
+
| --tag-default-background-color | _var(--gray-6)_ | - |
|
|
151
|
+
| --tag-primary-color | _var(--primary-color)_ | - |
|
|
152
|
+
| --tag-primary-background-color | _var(--primary-color)_ | - |
|
|
153
|
+
| --tag-info-color | _var(--info-color)_ | - |
|
|
154
|
+
| --tag-info-background-color | _var(--info-color)_ | - |
|
|
155
|
+
| --tag-success-color | _var(--success-color)_ | - |
|
|
156
|
+
| --tag-success-background-color | _var(--success-color)_ | - |
|
|
157
|
+
| --tag-warning-color | _var(--warning-color)_ | - |
|
|
158
|
+
| --tag-warning-background-color | _var(--warning-color)_ | - |
|
|
159
|
+
| --tag-danger-color | _var(--danger-color)_ | - |
|
|
160
|
+
| --tag-danger-background-color | _var(--danger-color)_ | - |
|
|
161
|
+
| --tag-outlined-background-color | _var(--white)_ | - |
|
|
162
|
+
| --tag-border-color <br>`v0.4.0-alpha.0` | _var(--tag-border-color, currentColor)_ | - |
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {Cell, Tag} from "@fjyueke/bify-core"
|
|
2
|
+
import {useState} from "react"
|
|
3
|
+
import Block from "../../../components/block"
|
|
4
|
+
import Page from "../../../components/page"
|
|
5
|
+
import "./index.scss"
|
|
6
|
+
|
|
7
|
+
function CloseTag() {
|
|
8
|
+
const [visible, setVisible] = useState(true)
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{visible && (
|
|
12
|
+
<Tag color="primary" size="medium" closeable onClose={() => setVisible(false)}>
|
|
13
|
+
标签
|
|
14
|
+
</Tag>
|
|
15
|
+
)}
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function TagDemo() {
|
|
21
|
+
return (
|
|
22
|
+
<Page title="Tag 标签" className="tag-demo">
|
|
23
|
+
<Block variant="card" title="基础用法">
|
|
24
|
+
<Cell title="颜色 default">
|
|
25
|
+
<Tag>标签</Tag>
|
|
26
|
+
</Cell>
|
|
27
|
+
<Cell title="颜色 primary">
|
|
28
|
+
<Tag color="primary">标签</Tag>
|
|
29
|
+
</Cell>
|
|
30
|
+
<Cell title="颜色 info">
|
|
31
|
+
<Tag color="info">标签</Tag>
|
|
32
|
+
</Cell>
|
|
33
|
+
<Cell title="颜色 success">
|
|
34
|
+
<Tag color="success">标签</Tag>
|
|
35
|
+
</Cell>
|
|
36
|
+
<Cell title="颜色 warning">
|
|
37
|
+
<Tag color="warning">标签</Tag>
|
|
38
|
+
</Cell>
|
|
39
|
+
<Cell title="颜色 danger">
|
|
40
|
+
<Tag color="danger">标签</Tag>
|
|
41
|
+
</Cell>
|
|
42
|
+
</Block>
|
|
43
|
+
<Block variant="card" title="样式风格">
|
|
44
|
+
<Cell title="空心样式">
|
|
45
|
+
<Tag color="primary" variant="outlined" children="标签"/>
|
|
46
|
+
</Cell>
|
|
47
|
+
<Cell title="圆角样式">
|
|
48
|
+
<Tag color="primary" shape="rounded" children="标签"/>
|
|
49
|
+
</Cell>
|
|
50
|
+
<Cell title="右侧圆角样式">
|
|
51
|
+
<Tag color="primary" shape="roundedRight" children="标签"/>
|
|
52
|
+
</Cell>
|
|
53
|
+
<Cell title="左侧圆角样式">
|
|
54
|
+
<Tag color="primary" shape="roundedLeft" children="标签"/>
|
|
55
|
+
</Cell>
|
|
56
|
+
<Cell title="可关闭标签">
|
|
57
|
+
<CloseTag/>
|
|
58
|
+
</Cell>
|
|
59
|
+
</Block>
|
|
60
|
+
<Block variant="card" title="标签大小">
|
|
61
|
+
<Cell title="小号标签">
|
|
62
|
+
<Tag color="primary" children="标签"/>
|
|
63
|
+
</Cell>
|
|
64
|
+
<Cell title="中号标签">
|
|
65
|
+
<Tag color="primary" size="medium" children="标签"/>
|
|
66
|
+
</Cell>
|
|
67
|
+
<Cell title="大号标签">
|
|
68
|
+
<Tag color="primary" size="large" children="标签"/>
|
|
69
|
+
</Cell>
|
|
70
|
+
</Block>
|
|
71
|
+
<Block variant="card" title="自定义颜色">
|
|
72
|
+
<Cell title="背景颜色">
|
|
73
|
+
<Tag style={{backgroundColor: "#7232dd"}} children="标签"/>
|
|
74
|
+
</Cell>
|
|
75
|
+
<Cell title="文字颜色">
|
|
76
|
+
<Tag style={{backgroundColor: "#ffe1e1", color: "#ad0000"}} children="标签"/>
|
|
77
|
+
</Cell>
|
|
78
|
+
<Cell title="空心颜色">
|
|
79
|
+
<Tag style={{color: "#7232dd"}} variant="outlined" children="标签"/>
|
|
80
|
+
</Cell>
|
|
81
|
+
</Block>
|
|
82
|
+
</Page>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| ------------ | ----------------------------------- | ------------------ | ------- |
|
|
7
|
+
| rows | 展示的行数 | _number \| string_ | `1` |
|
|
8
|
+
| content | 需要展示的文本 | _string_ | - |
|
|
9
|
+
| expandText | 展开操作的文案 | _string_ | - |
|
|
10
|
+
| collapseText | 收起操作的文案 | _string_ | - |
|
|
11
|
+
| dots | 省略号的文本内容 | _string_ | `'...'` |
|
|
12
|
+
| position | 省略位置,可选值为 `start` `middle` | _string_ | `'end'` |
|
|
13
|
+
|
|
14
|
+
### Events
|
|
15
|
+
|
|
16
|
+
| 事件名 | 说明 | 回调参数 |
|
|
17
|
+
| ------------- | ------------------- | ------------------- |
|
|
18
|
+
| onClickAction | 点击展开/收起时触发 | _expanded: boolean_ |
|
|
19
|
+
|
|
20
|
+
### 方法
|
|
21
|
+
|
|
22
|
+
通过 `ref` 可以获取到 TextEllipsis 实例并调用实例方法
|
|
23
|
+
|
|
24
|
+
| 方法名 | 说明 | 参数 | 返回值 |
|
|
25
|
+
| :----- | -------- | ---- | ------ |
|
|
26
|
+
| toggle `v0.7.0` | 切换文本的展开状态,传 true 为展开,false 为收起,不传参为切换 | _expanded?: boolean_ | - |
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# TextEllipsis 文本省略
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
对长文本进行省略,支持展开/收起。
|
|
6
|
+
|
|
7
|
+
请升级 `taroify` 到 >= `v0.1.1-alpha.9` 版本来使用该组件。
|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { TextEllipsis } from "@fjyueke/bify-core"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 代码演示
|
|
16
|
+
|
|
17
|
+
### 基础用法
|
|
18
|
+
|
|
19
|
+
默认展示 `1` 行,超过 `1` 行显示省略号。
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<TextEllipsis content="慢慢来,不要急,生活给你出了难题,可也终有一天会给出答案。" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 展开/收起
|
|
26
|
+
|
|
27
|
+
超过行数支持展开/收起。
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<TextEllipsis
|
|
31
|
+
content="似水流年是一个人所有的一切,只有这个东西,才真正归你所有。其余的一切,都是片刻的欢娱和不幸,转眼间就已跑到那似水流年里去了。"
|
|
32
|
+
expandText="展开"
|
|
33
|
+
collapseText="收起"
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 自定义展示行数
|
|
38
|
+
|
|
39
|
+
通过设置 `rows` 限制展示行数。
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<TextEllipsis
|
|
43
|
+
content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。"
|
|
44
|
+
rows={2}
|
|
45
|
+
expandText="展开"
|
|
46
|
+
collapseText="收起"
|
|
47
|
+
/>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 自定义省略位置
|
|
51
|
+
|
|
52
|
+
通过设置 `position` 控制省略位置。
|
|
53
|
+
|
|
54
|
+
- 头部省略:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<TextEllipsis
|
|
58
|
+
content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。"
|
|
59
|
+
position="start"
|
|
60
|
+
rows={3}
|
|
61
|
+
expandText="展开"
|
|
62
|
+
collapseText="收起"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- 中部省略:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
<TextEllipsis
|
|
70
|
+
content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。"
|
|
71
|
+
position="middle"
|
|
72
|
+
rows={3}
|
|
73
|
+
expandText="展开"
|
|
74
|
+
collapseText="收起"
|
|
75
|
+
/>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 手动控制
|
|
79
|
+
|
|
80
|
+
通过 ref 可以获取到 TextEllipsis 实例并调用实例方法
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
const wrapRef = useRef<TextEllipsisInstance>(null);
|
|
84
|
+
|
|
85
|
+
const onClick = () => {
|
|
86
|
+
wrapRef.current?.toggle(true)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Block variant="card" title="方法调用">
|
|
91
|
+
<TextEllipsis ref={wrapRef} content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" position="start" rows={3} expandText="展开" collapseText="收起" />
|
|
92
|
+
<Button onClick={onClick}>展开</Button>
|
|
93
|
+
</Block>
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## API
|
|
98
|
+
|
|
99
|
+
### Props
|
|
100
|
+
|
|
101
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
102
|
+
| ------------ | ----------------------------------- | ------------------ | ------- |
|
|
103
|
+
| rows | 展示的行数 | _number \| string_ | `1` |
|
|
104
|
+
| content | 需要展示的文本 | _string_ | - |
|
|
105
|
+
| expandText | 展开操作的文案 | _string_ | - |
|
|
106
|
+
| collapseText | 收起操作的文案 | _string_ | - |
|
|
107
|
+
| dots | 省略号的文本内容 | _string_ | `'...'` |
|
|
108
|
+
| position | 省略位置,可选值为 `start` `middle` | _string_ | `'end'` |
|
|
109
|
+
|
|
110
|
+
### Events
|
|
111
|
+
|
|
112
|
+
| 事件名 | 说明 | 回调参数 |
|
|
113
|
+
| ------------- | ------------------- | ------------------- |
|
|
114
|
+
| onClickAction | 点击展开/收起时触发 | _expanded: boolean_ |
|
|
115
|
+
|
|
116
|
+
### 方法
|
|
117
|
+
|
|
118
|
+
通过 `ref` 可以获取到 TextEllipsis 实例并调用实例方法
|
|
119
|
+
|
|
120
|
+
| 方法名 | 说明 | 参数 | 返回值 |
|
|
121
|
+
| :----- | -------- | ---- | ------ |
|
|
122
|
+
| toggle `v0.7.0` | 切换文本的展开状态,传 true 为展开,false 为收起,不传参为切换 | _expanded?: boolean_ | - |
|
|
123
|
+
|
|
124
|
+
## 主题定制
|
|
125
|
+
|
|
126
|
+
### 样式变量
|
|
127
|
+
|
|
128
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
129
|
+
|
|
130
|
+
| 名称 | 默认值 | 描述 |
|
|
131
|
+
| ---------------------------------- | --------------- | -------------- |
|
|
132
|
+
| --text-ellipsis-font-size | _14px \* $hd_ | 文本字体大小 |
|
|
133
|
+
| --text-ellipsis-content-font-color | _var(--gray-8)_ | 文本字体颜色 |
|
|
134
|
+
| --text-ellipsis-line-height | _1.6_ | 文本的行高 |
|
|
135
|
+
| --text-ellipsis-action-color | _var(--blue)_ | 操作按钮的颜色 |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useRef } from "react"
|
|
2
|
+
import { TextEllipsis, Button } from "@fjyueke/bify-core"
|
|
3
|
+
import type { TextEllipsisInstance } from "@fjyueke/bify-core/text-ellipsis";
|
|
4
|
+
import Block from "../../../components/block"
|
|
5
|
+
import Page from "../../../components/page"
|
|
6
|
+
|
|
7
|
+
import "./index.scss"
|
|
8
|
+
|
|
9
|
+
const FunTextEllipsis = () => {
|
|
10
|
+
const wrapRef = useRef<TextEllipsisInstance>(null);
|
|
11
|
+
|
|
12
|
+
const onClick = () => {
|
|
13
|
+
wrapRef.current?.toggle(true)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Block variant="card" title="方法调用">
|
|
18
|
+
<TextEllipsis ref={wrapRef} content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" position="start" rows={3} expandText="展开" collapseText="收起" />
|
|
19
|
+
<Button onClick={onClick}>展开</Button>
|
|
20
|
+
</Block>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function TextEllipsisDemo() {
|
|
25
|
+
return (
|
|
26
|
+
<Page title="TextEllipsis 文本省略" className="text-props-ellipsis-demo">
|
|
27
|
+
<Block variant="card" title="基础用法">
|
|
28
|
+
<TextEllipsis content="慢慢来,不要急,生活给你出了难题,可也终有一天会给出答案。" />
|
|
29
|
+
</Block>
|
|
30
|
+
<Block variant="card" title="展开/收起">
|
|
31
|
+
<TextEllipsis content="似水流年是一个人所有的一切,只有这个东西,才真正归你所有。其余的一切,都是片刻的欢娱和不幸,转眼间就已跑到那似水流年里去了。" expandText="展开" collapseText="收起" />
|
|
32
|
+
</Block>
|
|
33
|
+
<Block variant="card" title="自定义展示行数">
|
|
34
|
+
<TextEllipsis content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" rows={2} expandText="展开" collapseText="收起" />
|
|
35
|
+
<TextEllipsis style={{ marginTop: "0.2rem" }} content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" rows={4} expandText="展开" collapseText="收起" />
|
|
36
|
+
</Block>
|
|
37
|
+
<Block variant="card" title="自定义省略位置">
|
|
38
|
+
<TextEllipsis content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" position="start" rows={3} expandText="展开" collapseText="收起" />
|
|
39
|
+
<TextEllipsis style={{ marginTop: "0.2rem" }} content="那一天我二十一岁,在我一生的黄金时代。我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云。后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样。可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我。" position="middle" rows={3} expandText="展开" collapseText="收起" />
|
|
40
|
+
</Block>
|
|
41
|
+
<FunTextEllipsis />
|
|
42
|
+
</Page>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Timeline Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| position | 位置布局,可选值为 `left` `right` `alternate` `alternate-reverse` | _string_ | - |
|
|
8
|
+
|
|
9
|
+
### Timeline.Item Props
|
|
10
|
+
|
|
11
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| dot | 圆点 | _ReactNode \| TimelineDotProps_ | - |
|
|
14
|
+
|
|
15
|
+
### Timeline.Dot Props
|
|
16
|
+
|
|
17
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| variant | 圆点变体,可选值为 `outlined` | _string_ | `filled` |
|
|
20
|
+
| color | 圆点颜色,可选值为 `primary` `info` `success` `warning` `danger` | _string_ | `default` |
|