@ticatec/uniface-element 0.2.3 → 0.3.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/dist/accordion/README.md +169 -0
- package/dist/accordion/README_CN.md +176 -0
- package/dist/action-bar/README.md +275 -0
- package/dist/action-bar/README_CN.md +285 -0
- package/dist/app-layout/README.md +374 -0
- package/dist/app-layout/README_CN.md +381 -0
- package/dist/app-top-bar/README.md +357 -0
- package/dist/app-top-bar/README_CN.md +365 -0
- package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
- package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
- package/dist/base-calendar/CalendarBase.svelte +0 -3
- package/dist/box/README.md +385 -0
- package/dist/box/README_CN.md +393 -0
- package/dist/breadcrumbs/README.md +442 -0
- package/dist/breadcrumbs/README_CN.md +442 -0
- package/dist/button/Button.svelte +27 -7
- package/dist/button/Button.svelte.d.ts +3 -1
- package/dist/button/IconButton.svelte +26 -6
- package/dist/button/IconButton.svelte.d.ts +3 -1
- package/dist/button/IconButton_README.md +513 -0
- package/dist/button/IconButton_README_CN.md +513 -0
- package/dist/button/README.md +428 -0
- package/dist/button/README_CN.md +428 -0
- package/dist/button/TextButton.svelte +26 -6
- package/dist/button/TextButton.svelte.d.ts +3 -1
- package/dist/button/TextButton_README.md +571 -0
- package/dist/button/TextButton_README_CN.md +571 -0
- package/dist/card/README.md +666 -0
- package/dist/card/README_CN.md +666 -0
- package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
- package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
- package/dist/cascade-options-select/README.md +663 -2
- package/dist/cascade-options-select/README_CN.md +664 -0
- package/dist/checkbox/CheckBox.svelte +20 -6
- package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
- package/dist/checkbox/README.md +562 -0
- package/dist/checkbox/README_CN.md +727 -0
- package/dist/common-editor/NumberInput.svelte +39 -26
- package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
- package/dist/concise-data-table/ConciseListTable.svelte +133 -36
- package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
- package/dist/concise-data-table/DataCell.svelte +5 -6
- package/dist/concise-data-table/DataRow.svelte +22 -2
- package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
- package/dist/concise-data-table/README.md +606 -0
- package/dist/concise-data-table/README_CN.md +611 -0
- package/dist/context-menu/ContextMenu.svelte +138 -21
- package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
- package/dist/context-menu/ContextMenuItem.d.ts +20 -4
- package/dist/context-menu/README.md +551 -0
- package/dist/context-menu/README_CN.md +551 -0
- package/dist/criteria-field/CriteriaField.svelte +3 -5
- package/dist/criteria-field/README.md +532 -0
- package/dist/criteria-field/README_CN.md +532 -0
- package/dist/data-table/README.md +712 -0
- package/dist/data-table/README_CN.md +712 -0
- package/dist/date-picker/DatePicker.svelte +44 -7
- package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
- package/dist/date-picker/DateTimePicker.svelte +32 -8
- package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
- package/dist/date-picker/README.md +326 -0
- package/dist/date-picker/README_CN.md +316 -0
- package/dist/date-picker/ScrollBar.svelte +18 -8
- package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
- package/dist/date-picker/TimePanel.svelte +5 -5
- package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
- package/dist/date-range/README.md +374 -0
- package/dist/date-range/README_CN.md +374 -0
- package/dist/dialog/DialogBoard.svelte +1 -1
- package/dist/dialog/README.md +596 -0
- package/dist/dialog/README_CN.md +596 -0
- package/dist/drawer/README.md +679 -1
- package/dist/drawer/README_CN.md +679 -0
- package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
- package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
- package/dist/group-box/group-check-box/README.md +749 -0
- package/dist/group-box/group-check-box/README_CN.md +750 -0
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
- package/dist/group-box/group-radio-box/README.md +920 -0
- package/dist/group-box/group-radio-box/README_CN.md +920 -0
- package/dist/image-files/README.md +1346 -0
- package/dist/image-files/README_CN.md +1346 -0
- package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
- package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
- package/dist/lib/forwardAllEvents.d.ts +3 -0
- package/dist/lib/forwardAllEvents.js +24 -0
- package/dist/list-box/README.md +579 -0
- package/dist/list-box/README_CN.md +682 -0
- package/dist/lookup-editor/LookupEditor.svelte +15 -3
- package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
- package/dist/lookup-editor/README.md +684 -0
- package/dist/lookup-editor/README_CN.md +684 -0
- package/dist/memo-editor/MemoEditor.svelte +77 -27
- package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
- package/dist/memo-editor/README.md +819 -0
- package/dist/memo-editor/README_CN.md +819 -0
- package/dist/message-box/README.md +398 -0
- package/dist/message-box/README_CN.md +398 -0
- package/dist/number-editor/NumberEditor.svelte +2 -2
- package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
- package/dist/number-editor/README.md +353 -22
- package/dist/number-editor/README_CN.md +357 -0
- package/dist/number-range/README.md +443 -0
- package/dist/number-range/README_CN.md +443 -0
- package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
- package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
- package/dist/options-multi-select/README.md +480 -0
- package/dist/options-multi-select/README_CN.md +480 -0
- package/dist/options-select/OptionsSelect.svelte +36 -5
- package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
- package/dist/options-select/README.md +632 -0
- package/dist/options-select/README_CN.md +632 -0
- package/dist/page/README.md +605 -0
- package/dist/page/README_CN.md +605 -0
- package/dist/pagination/README.md +946 -0
- package/dist/pagination/README_CN.md +946 -0
- package/dist/pagination-panel/README.md +1075 -0
- package/dist/pagination-panel/README_CN.md +1075 -0
- package/dist/popup-hint/README.md +841 -0
- package/dist/popup-hint/README_CN.md +840 -0
- package/dist/progress-bar/README.md +242 -0
- package/dist/progress-bar/README_CN.md +242 -0
- package/dist/progress-step-bar/README.md +316 -0
- package/dist/progress-step-bar/README_CN.md +316 -0
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
- package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
- package/dist/prompts-text-editor/README.md +329 -0
- package/dist/prompts-text-editor/README_CN.md +329 -0
- package/dist/property-editor/README.md +969 -0
- package/dist/property-editor/README_CN.md +969 -0
- package/dist/radio-button/README.md +372 -0
- package/dist/radio-button/README_CN.md +372 -0
- package/dist/radio-button/RadioButton.svelte +32 -3
- package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
- package/dist/search-box/README.md +425 -0
- package/dist/search-box/README_CN.md +424 -0
- package/dist/search-box/SearchBox.svelte +22 -6
- package/dist/search-box/SearchBox.svelte.d.ts +4 -1
- package/dist/tabs/README.md +919 -0
- package/dist/tabs/README_CN.md +920 -0
- package/dist/tag/README.md +922 -0
- package/dist/tag/README_CN.md +922 -0
- package/dist/text-editor/PasswordEditor.svelte +17 -2
- package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
- package/dist/text-editor/PasswordEditor_README.md +551 -0
- package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
- package/dist/text-editor/README.md +466 -0
- package/dist/text-editor/README_CN.md +466 -0
- package/dist/text-editor/TextEditor.svelte +51 -19
- package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
- package/dist/ticatec-uniface-web.css +1 -0
- package/dist/time-editor/README.md +498 -24
- package/dist/time-editor/README_CN.md +498 -0
- package/dist/time-editor/TimeEditor.svelte +7 -3
- package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
- package/dist/toast/README.md +667 -0
- package/dist/toast/README_CN.md +667 -0
- package/dist/transfer/README.md +795 -0
- package/dist/transfer/Transfer.svelte +6 -4
- package/dist/transfer/Transfer.svelte.d.ts +3 -1
- package/dist/tree-view/README.md +761 -0
- package/dist/tree-view/README_CN.md +761 -0
- package/dist/tree-view/TreeView.svelte +5 -3
- package/dist/tree-view/TreeView.svelte.d.ts +3 -1
- package/dist/unit-number-editor/README.md +546 -20
- package/dist/unit-number-editor/README_CN.md +525 -0
- package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
- package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
- package/docs/form-field/cn/README_CN.md +364 -0
- package/docs/form-field/en/README.md +364 -0
- package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
- package/docs/form-panel/flex-form/en/README.md +586 -0
- package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
- package/docs/form-panel/flex-row-form/en/README.md +787 -0
- package/docs/form-panel/grid-form/en/README.md +744 -0
- package/package.json +1 -1
- package/dist/drawer/README-CN.md +0 -1
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
# Tag 标签组件
|
|
2
|
+
|
|
3
|
+
一个灵活的标签组件,用于标注、分类和状态指示。支持多种变体、颜色主题、可移除功能和尺寸选项。非常适合显示分类、过滤器、用户选择和状态指示器。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ticatec/uniface-element
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 导入
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 基本用法
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<script>
|
|
21
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
22
|
+
|
|
23
|
+
function handleRemove() {
|
|
24
|
+
console.log('标签已移除');
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Tag text="基本标签" />
|
|
29
|
+
<Tag text="可移除标签" removable={true} removeHandler={handleRemove} />
|
|
30
|
+
<Tag text="不可移除标签" removable={false} />
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 属性
|
|
34
|
+
|
|
35
|
+
| 属性 | 类型 | 默认值 | 描述 |
|
|
36
|
+
|------|------|---------|-------------|
|
|
37
|
+
| `text` | `string` | `""` | 标签的文本内容 |
|
|
38
|
+
| `size` | `"big" \| "middle" \| "small"` | `"middle"` | 标签尺寸 |
|
|
39
|
+
| `variant` | `"borderless" \| "border" \| "round"` | `"border"` | 标签的视觉变体 |
|
|
40
|
+
| `removable` | `boolean` | `true` | 标签是否可移除 |
|
|
41
|
+
| `removeHandler` | `MouseClickHandler` | `null` | 点击移除图标时的回调函数 |
|
|
42
|
+
| `color` | `string` | `null` | 颜色主题(1-12) |
|
|
43
|
+
| `style` | `string` | `""` | 附加 CSS 样式 |
|
|
44
|
+
| `class` | `string` | `""` | CSS 类名 |
|
|
45
|
+
|
|
46
|
+
## 示例
|
|
47
|
+
|
|
48
|
+
### 基本标签
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<script>
|
|
52
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<div class="tag-demo">
|
|
56
|
+
<h3>基本标签</h3>
|
|
57
|
+
<div class="tag-group">
|
|
58
|
+
<Tag text="默认" />
|
|
59
|
+
<Tag text="技术" />
|
|
60
|
+
<Tag text="设计" />
|
|
61
|
+
<Tag text="开发" />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<style>
|
|
66
|
+
.tag-demo {
|
|
67
|
+
margin: 20px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.tag-group {
|
|
71
|
+
display: flex;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 不同尺寸
|
|
79
|
+
|
|
80
|
+
```svelte
|
|
81
|
+
<script>
|
|
82
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<div class="size-demo">
|
|
86
|
+
<h3>标签尺寸</h3>
|
|
87
|
+
|
|
88
|
+
<div class="size-section">
|
|
89
|
+
<h4>小标签</h4>
|
|
90
|
+
<div class="tag-group">
|
|
91
|
+
<Tag text="小标签" size="small" />
|
|
92
|
+
<Tag text="分类" size="small" color="1" />
|
|
93
|
+
<Tag text="标签" size="small" color="2" />
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div class="size-section">
|
|
98
|
+
<h4>中等标签(默认)</h4>
|
|
99
|
+
<div class="tag-group">
|
|
100
|
+
<Tag text="中等标签" size="middle" />
|
|
101
|
+
<Tag text="分类" size="middle" color="1" />
|
|
102
|
+
<Tag text="标签" size="middle" color="2" />
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="size-section">
|
|
107
|
+
<h4>大标签</h4>
|
|
108
|
+
<div class="tag-group">
|
|
109
|
+
<Tag text="大标签" size="big" />
|
|
110
|
+
<Tag text="分类" size="big" color="1" />
|
|
111
|
+
<Tag text="标签" size="big" color="2" />
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
.size-demo {
|
|
118
|
+
margin: 20px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.size-section {
|
|
122
|
+
margin-bottom: 20px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.size-section h4 {
|
|
126
|
+
margin: 12px 0 8px 0;
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
color: #666;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tag-group {
|
|
132
|
+
display: flex;
|
|
133
|
+
gap: 8px;
|
|
134
|
+
flex-wrap: wrap;
|
|
135
|
+
align-items: center;
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 不同变体
|
|
141
|
+
|
|
142
|
+
```svelte
|
|
143
|
+
<script>
|
|
144
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<div class="variant-demo">
|
|
148
|
+
<h3>标签变体</h3>
|
|
149
|
+
|
|
150
|
+
<div class="variant-section">
|
|
151
|
+
<h4>边框变体(默认)</h4>
|
|
152
|
+
<div class="tag-group">
|
|
153
|
+
<Tag text="边框标签" variant="border" />
|
|
154
|
+
<Tag text="JavaScript" variant="border" color="1" />
|
|
155
|
+
<Tag text="React" variant="border" color="2" />
|
|
156
|
+
<Tag text="Vue" variant="border" color="3" />
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="variant-section">
|
|
161
|
+
<h4>圆形变体</h4>
|
|
162
|
+
<div class="tag-group">
|
|
163
|
+
<Tag text="圆形标签" variant="round" />
|
|
164
|
+
<Tag text="JavaScript" variant="round" color="1" />
|
|
165
|
+
<Tag text="React" variant="round" color="2" />
|
|
166
|
+
<Tag text="Vue" variant="round" color="3" />
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div class="variant-section">
|
|
171
|
+
<h4>无边框变体</h4>
|
|
172
|
+
<div class="tag-group">
|
|
173
|
+
<Tag text="无边框标签" variant="borderless" />
|
|
174
|
+
<Tag text="JavaScript" variant="borderless" color="1" />
|
|
175
|
+
<Tag text="React" variant="borderless" color="2" />
|
|
176
|
+
<Tag text="Vue" variant="borderless" color="3" />
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<style>
|
|
182
|
+
.variant-demo {
|
|
183
|
+
margin: 20px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.variant-section {
|
|
187
|
+
margin-bottom: 20px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.variant-section h4 {
|
|
191
|
+
margin: 12px 0 8px 0;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
color: #666;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.tag-group {
|
|
197
|
+
display: flex;
|
|
198
|
+
gap: 8px;
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
}
|
|
201
|
+
</style>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 颜色主题
|
|
205
|
+
|
|
206
|
+
```svelte
|
|
207
|
+
<script>
|
|
208
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
209
|
+
|
|
210
|
+
const colorThemes = [
|
|
211
|
+
{ color: "1", name: "蓝色", description: "主要操作" },
|
|
212
|
+
{ color: "2", name: "绿色", description: "成功状态" },
|
|
213
|
+
{ color: "3", name: "红色", description: "错误状态" },
|
|
214
|
+
{ color: "4", name: "黄色", description: "警告状态" },
|
|
215
|
+
{ color: "5", name: "粉色", description: "高亮显示" },
|
|
216
|
+
{ color: "6", name: "青色", description: "信息提示" },
|
|
217
|
+
{ color: "7", name: "橙色", description: "警报" },
|
|
218
|
+
{ color: "8", name: "琥珀色", description: "待处理状态" },
|
|
219
|
+
{ color: "9", name: "靛蓝", description: "导航" },
|
|
220
|
+
{ color: "10", name: "紫色", description: "创意内容" },
|
|
221
|
+
{ color: "11", name: "酸橙色", description: "新鲜内容" },
|
|
222
|
+
{ color: "12", name: "灰色", description: "中性状态" }
|
|
223
|
+
];
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<div class="color-demo">
|
|
227
|
+
<h3>颜色主题</h3>
|
|
228
|
+
|
|
229
|
+
<div class="color-grid">
|
|
230
|
+
{#each colorThemes as theme}
|
|
231
|
+
<div class="color-item">
|
|
232
|
+
<Tag text={theme.name} color={theme.color} />
|
|
233
|
+
<p class="color-description">{theme.description}</p>
|
|
234
|
+
</div>
|
|
235
|
+
{/each}
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<h4>所有变体与颜色结合</h4>
|
|
239
|
+
<div class="variant-comparison">
|
|
240
|
+
<div class="variant-row">
|
|
241
|
+
<span class="variant-label">边框:</span>
|
|
242
|
+
<Tag text="技术" variant="border" color="1" />
|
|
243
|
+
<Tag text="设计" variant="border" color="2" />
|
|
244
|
+
<Tag text="市场营销" variant="border" color="3" />
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="variant-row">
|
|
248
|
+
<span class="variant-label">圆形:</span>
|
|
249
|
+
<Tag text="技术" variant="round" color="1" />
|
|
250
|
+
<Tag text="设计" variant="round" color="2" />
|
|
251
|
+
<Tag text="市场营销" variant="round" color="3" />
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div class="variant-row">
|
|
255
|
+
<span class="variant-label">无边框:</span>
|
|
256
|
+
<Tag text="技术" variant="borderless" color="1" />
|
|
257
|
+
<Tag text="设计" variant="borderless" color="2" />
|
|
258
|
+
<Tag text="市场营销" variant="borderless" color="3" />
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<style>
|
|
264
|
+
.color-demo {
|
|
265
|
+
margin: 20px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.color-grid {
|
|
269
|
+
display: grid;
|
|
270
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
271
|
+
gap: 16px;
|
|
272
|
+
margin-bottom: 24px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.color-item {
|
|
276
|
+
text-align: center;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.color-description {
|
|
280
|
+
margin: 8px 0 0 0;
|
|
281
|
+
font-size: 12px;
|
|
282
|
+
color: #666;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.variant-comparison h4 {
|
|
286
|
+
margin: 20px 0 12px 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.variant-row {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
292
|
+
gap: 12px;
|
|
293
|
+
margin: 8px 0;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.variant-label {
|
|
297
|
+
min-width: 80px;
|
|
298
|
+
font-size: 14px;
|
|
299
|
+
color: #666;
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 可移除标签
|
|
305
|
+
|
|
306
|
+
```svelte
|
|
307
|
+
<script>
|
|
308
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
309
|
+
|
|
310
|
+
let tags = [
|
|
311
|
+
{ id: 1, text: "JavaScript", color: "1" },
|
|
312
|
+
{ id: 2, text: "React", color: "2" },
|
|
313
|
+
{ id: 3, text: "Vue.js", color: "3" },
|
|
314
|
+
{ id: 4, text: "Angular", color: "4" },
|
|
315
|
+
{ id: 5, text: "Svelte", color: "5" }
|
|
316
|
+
];
|
|
317
|
+
|
|
318
|
+
function removeTag(tagId) {
|
|
319
|
+
tags = tags.filter(tag => tag.id !== tagId);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function addTag() {
|
|
323
|
+
const newTagText = prompt("请输入标签名称:");
|
|
324
|
+
if (newTagText) {
|
|
325
|
+
const newTag = {
|
|
326
|
+
id: Date.now(),
|
|
327
|
+
text: newTagText,
|
|
328
|
+
color: String(Math.floor(Math.random() * 12) + 1)
|
|
329
|
+
};
|
|
330
|
+
tags = [...tags, newTag];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
</script>
|
|
334
|
+
|
|
335
|
+
<div class="removable-demo">
|
|
336
|
+
<h3>可移除标签</h3>
|
|
337
|
+
<p>将鼠标悬停在标签上以查看移除图标</p>
|
|
338
|
+
|
|
339
|
+
<div class="tag-container">
|
|
340
|
+
{#each tags as tag}
|
|
341
|
+
<Tag
|
|
342
|
+
text={tag.text}
|
|
343
|
+
color={tag.color}
|
|
344
|
+
removable={true}
|
|
345
|
+
removeHandler={() => removeTag(tag.id)}
|
|
346
|
+
/>
|
|
347
|
+
{/each}
|
|
348
|
+
|
|
349
|
+
<button class="add-tag-btn" on:click={addTag}>+ 添加标签</button>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
<div class="tag-count">
|
|
353
|
+
标签总数:{tags.length}
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
<style>
|
|
358
|
+
.removable-demo {
|
|
359
|
+
margin: 20px;
|
|
360
|
+
max-width: 600px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.removable-demo p {
|
|
364
|
+
margin: 8px 0 16px 0;
|
|
365
|
+
color: #666;
|
|
366
|
+
font-size: 14px;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.tag-container {
|
|
370
|
+
display: flex;
|
|
371
|
+
gap: 8px;
|
|
372
|
+
flex-wrap: wrap;
|
|
373
|
+
align-items: center;
|
|
374
|
+
margin-bottom: 16px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.add-tag-btn {
|
|
378
|
+
padding: 4px 12px;
|
|
379
|
+
border: 2px dashed #ccc;
|
|
380
|
+
background: transparent;
|
|
381
|
+
border-radius: 4px;
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
font-size: 12px;
|
|
384
|
+
color: #666;
|
|
385
|
+
line-height: 20px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.add-tag-btn:hover {
|
|
389
|
+
border-color: #007bff;
|
|
390
|
+
color: #007bff;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.tag-count {
|
|
394
|
+
font-size: 14px;
|
|
395
|
+
color: #666;
|
|
396
|
+
}
|
|
397
|
+
</style>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### 状态标签
|
|
401
|
+
|
|
402
|
+
```svelte
|
|
403
|
+
<script>
|
|
404
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
405
|
+
|
|
406
|
+
const statusItems = [
|
|
407
|
+
{ name: "活跃用户", status: "在线", color: "2", count: 1240 },
|
|
408
|
+
{ name: "待处理订单", status: "待处理", color: "4", count: 45 },
|
|
409
|
+
{ name: "失败请求", status: "错误", color: "3", count: 12 },
|
|
410
|
+
{ name: "已完成任务", status: "成功", color: "2", count: 89 },
|
|
411
|
+
{ name: "审核中", status: "审核", color: "1", count: 23 },
|
|
412
|
+
{ name: "草稿文章", status: "草稿", color: "12", count: 7 }
|
|
413
|
+
];
|
|
414
|
+
</script>
|
|
415
|
+
|
|
416
|
+
<div class="status-demo">
|
|
417
|
+
<h3>状态指示器</h3>
|
|
418
|
+
|
|
419
|
+
<div class="status-grid">
|
|
420
|
+
{#each statusItems as item}
|
|
421
|
+
<div class="status-item">
|
|
422
|
+
<div class="status-header">
|
|
423
|
+
<span class="status-name">{item.name}</span>
|
|
424
|
+
<Tag text={item.status} color={item.color} size="small" variant="round" removable={false} />
|
|
425
|
+
</div>
|
|
426
|
+
<div class="status-count">{item.count}</div>
|
|
427
|
+
</div>
|
|
428
|
+
{/each}
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<style>
|
|
433
|
+
.status-demo {
|
|
434
|
+
margin: 20px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.status-grid {
|
|
438
|
+
display: grid;
|
|
439
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
440
|
+
gap: 16px;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.status-item {
|
|
444
|
+
padding: 16px;
|
|
445
|
+
border: 1px solid #eee;
|
|
446
|
+
border-radius: 8px;
|
|
447
|
+
background: #fafafa;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.status-header {
|
|
451
|
+
display: flex;
|
|
452
|
+
justify-content: space-between;
|
|
453
|
+
align-items: center;
|
|
454
|
+
margin-bottom: 8px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.status-name {
|
|
458
|
+
font-size: 14px;
|
|
459
|
+
color: #333;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.status-count {
|
|
463
|
+
font-size: 24px;
|
|
464
|
+
font-weight: bold;
|
|
465
|
+
color: #333;
|
|
466
|
+
}
|
|
467
|
+
</style>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### 标签输入组件
|
|
471
|
+
|
|
472
|
+
```svelte
|
|
473
|
+
<script>
|
|
474
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
475
|
+
|
|
476
|
+
let inputTags = ["前端", "javascript"];
|
|
477
|
+
let inputValue = "";
|
|
478
|
+
|
|
479
|
+
function addTag(event) {
|
|
480
|
+
if (event.key === 'Enter' && inputValue.trim()) {
|
|
481
|
+
const newTag = inputValue.trim().toLowerCase();
|
|
482
|
+
if (!inputTags.includes(newTag)) {
|
|
483
|
+
inputTags = [...inputTags, newTag];
|
|
484
|
+
}
|
|
485
|
+
inputValue = "";
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function removeInputTag(tagToRemove) {
|
|
490
|
+
inputTags = inputTags.filter(tag => tag !== tagToRemove);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function clearAllTags() {
|
|
494
|
+
inputTags = [];
|
|
495
|
+
}
|
|
496
|
+
</script>
|
|
497
|
+
|
|
498
|
+
<div class="tag-input-demo">
|
|
499
|
+
<h3>标签输入组件</h3>
|
|
500
|
+
|
|
501
|
+
<div class="tag-input-container">
|
|
502
|
+
<label for="tag-input">技能:</label>
|
|
503
|
+
<div class="input-wrapper">
|
|
504
|
+
<div class="tag-display">
|
|
505
|
+
{#each inputTags as tag, index}
|
|
506
|
+
<Tag
|
|
507
|
+
text={tag}
|
|
508
|
+
color={String((index % 12) + 1)}
|
|
509
|
+
size="small"
|
|
510
|
+
variant="round"
|
|
511
|
+
removable={true}
|
|
512
|
+
removeHandler={() => removeInputTag(tag)}
|
|
513
|
+
/>
|
|
514
|
+
{/each}
|
|
515
|
+
|
|
516
|
+
<input
|
|
517
|
+
id="tag-input"
|
|
518
|
+
type="text"
|
|
519
|
+
bind:value={inputValue}
|
|
520
|
+
on:keydown={addTag}
|
|
521
|
+
placeholder={inputTags.length === 0 ? "输入后按回车添加标签" : "添加更多..."}
|
|
522
|
+
class="tag-input"
|
|
523
|
+
/>
|
|
524
|
+
</div>
|
|
525
|
+
|
|
526
|
+
<div class="input-actions">
|
|
527
|
+
<button on:click={clearAllTags} disabled={inputTags.length === 0}>
|
|
528
|
+
清除所有
|
|
529
|
+
</button>
|
|
530
|
+
</div>
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
<div class="tag-suggestions">
|
|
534
|
+
<span class="suggestions-label">建议:</span>
|
|
535
|
+
{#each ["react", "vue", "angular", "svelte", "typescript"] as suggestion}
|
|
536
|
+
<button
|
|
537
|
+
class="suggestion-btn"
|
|
538
|
+
on:click={() => {
|
|
539
|
+
if (!inputTags.includes(suggestion)) {
|
|
540
|
+
inputTags = [...inputTags, suggestion];
|
|
541
|
+
}
|
|
542
|
+
}}
|
|
543
|
+
disabled={inputTags.includes(suggestion)}
|
|
544
|
+
>
|
|
545
|
+
{suggestion}
|
|
546
|
+
</button>
|
|
547
|
+
{/each}
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
|
|
551
|
+
<div class="output">
|
|
552
|
+
<h4>当前标签:</h4>
|
|
553
|
+
<pre>{JSON.stringify(inputTags, null, 2)}</pre>
|
|
554
|
+
</div>
|
|
555
|
+
</div>
|
|
556
|
+
|
|
557
|
+
<style>
|
|
558
|
+
.tag-input-demo {
|
|
559
|
+
margin: 20px;
|
|
560
|
+
max-width: 600px;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.tag-input-container {
|
|
564
|
+
border: 1px solid #ddd;
|
|
565
|
+
border-radius: 8px;
|
|
566
|
+
padding: 16px;
|
|
567
|
+
background: #fafafa;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.tag-input-container label {
|
|
571
|
+
display: block;
|
|
572
|
+
margin-bottom: 8px;
|
|
573
|
+
font-weight: 500;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.input-wrapper {
|
|
577
|
+
display: flex;
|
|
578
|
+
gap: 12px;
|
|
579
|
+
align-items: flex-start;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.tag-display {
|
|
583
|
+
flex: 1;
|
|
584
|
+
display: flex;
|
|
585
|
+
flex-wrap: wrap;
|
|
586
|
+
gap: 6px;
|
|
587
|
+
align-items: center;
|
|
588
|
+
min-height: 32px;
|
|
589
|
+
padding: 8px;
|
|
590
|
+
border: 1px solid #ccc;
|
|
591
|
+
border-radius: 4px;
|
|
592
|
+
background: white;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.tag-input {
|
|
596
|
+
border: none;
|
|
597
|
+
outline: none;
|
|
598
|
+
flex: 1;
|
|
599
|
+
min-width: 120px;
|
|
600
|
+
font-size: 14px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.tag-input::placeholder {
|
|
604
|
+
color: #999;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.input-actions button {
|
|
608
|
+
padding: 8px 12px;
|
|
609
|
+
border: 1px solid #dc3545;
|
|
610
|
+
background: white;
|
|
611
|
+
color: #dc3545;
|
|
612
|
+
border-radius: 4px;
|
|
613
|
+
cursor: pointer;
|
|
614
|
+
font-size: 12px;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.input-actions button:hover:not(:disabled) {
|
|
618
|
+
background: #dc3545;
|
|
619
|
+
color: white;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.input-actions button:disabled {
|
|
623
|
+
opacity: 0.5;
|
|
624
|
+
cursor: not-allowed;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.tag-suggestions {
|
|
628
|
+
margin-top: 12px;
|
|
629
|
+
display: flex;
|
|
630
|
+
gap: 6px;
|
|
631
|
+
align-items: center;
|
|
632
|
+
flex-wrap: wrap;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.suggestions-label {
|
|
636
|
+
font-size: 12px;
|
|
637
|
+
color: #666;
|
|
638
|
+
margin-right: 8px;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.suggestion-btn {
|
|
642
|
+
padding: 4px 8px;
|
|
643
|
+
border: 1px solid #007bff;
|
|
644
|
+
background: white;
|
|
645
|
+
color: #007bff;
|
|
646
|
+
border-radius: 12px;
|
|
647
|
+
cursor: pointer;
|
|
648
|
+
font-size: 11px;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.suggestion-btn:hover:not(:disabled) {
|
|
652
|
+
background: #007bff;
|
|
653
|
+
color: white;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.suggestion-btn:disabled {
|
|
657
|
+
opacity: 0.5;
|
|
658
|
+
cursor: not-allowed;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.output {
|
|
662
|
+
margin-top: 20px;
|
|
663
|
+
padding: 16px;
|
|
664
|
+
background: #f8f9fa;
|
|
665
|
+
border-radius: 4px;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.output h4 {
|
|
669
|
+
margin: 0 0 8px 0;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.output pre {
|
|
673
|
+
margin: 0;
|
|
674
|
+
font-size: 12px;
|
|
675
|
+
}
|
|
676
|
+
</style>
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### 标签分类
|
|
680
|
+
|
|
681
|
+
```svelte
|
|
682
|
+
<script>
|
|
683
|
+
import Tag from "@ticatec/uniface-element/Tag";
|
|
684
|
+
|
|
685
|
+
const categories = [
|
|
686
|
+
{
|
|
687
|
+
name: "技术",
|
|
688
|
+
color: "1",
|
|
689
|
+
tags: ["JavaScript", "TypeScript", "Python", "React", "Vue.js"]
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: "技能",
|
|
693
|
+
color: "2",
|
|
694
|
+
tags: ["前端", "后端", "运维", "UI/UX", "测试"]
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: "兴趣",
|
|
698
|
+
color: "3",
|
|
699
|
+
tags: ["开源", "AI/ML", "Web3", "移动端", "游戏"]
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
name: "工具",
|
|
703
|
+
color: "4",
|
|
704
|
+
tags: ["VS Code", "Git", "Docker", "AWS", "Figma"]
|
|
705
|
+
}
|
|
706
|
+
];
|
|
707
|
+
|
|
708
|
+
let selectedTags = [];
|
|
709
|
+
|
|
710
|
+
function toggleTag(tag) {
|
|
711
|
+
if (selectedTags.includes(tag)) {
|
|
712
|
+
selectedTags = selectedTags.filter(t => t !== tag);
|
|
713
|
+
} else {
|
|
714
|
+
selectedTags = [...selectedTags, tag];
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
</script>
|
|
718
|
+
|
|
719
|
+
<div class="category-demo">
|
|
720
|
+
<h3>标签分类</h3>
|
|
721
|
+
|
|
722
|
+
<div class="categories">
|
|
723
|
+
{#each categories as category}
|
|
724
|
+
<div class="category-section">
|
|
725
|
+
<div class="category-header">
|
|
726
|
+
<Tag text={category.name} color={category.color} removable={false} variant="round" />
|
|
727
|
+
<span class="tag-count">({category.tags.length})</span>
|
|
728
|
+
</div>
|
|
729
|
+
|
|
730
|
+
<div class="category-tags">
|
|
731
|
+
{#each category.tags as tag}
|
|
732
|
+
<button
|
|
733
|
+
class="tag-button"
|
|
734
|
+
class:selected={selectedTags.includes(tag)}
|
|
735
|
+
on:click={() => toggleTag(tag)}
|
|
736
|
+
>
|
|
737
|
+
<Tag
|
|
738
|
+
text={tag}
|
|
739
|
+
color={selectedTags.includes(tag) ? category.color : "12"}
|
|
740
|
+
size="small"
|
|
741
|
+
removable={false}
|
|
742
|
+
/>
|
|
743
|
+
</button>
|
|
744
|
+
{/each}
|
|
745
|
+
</div>
|
|
746
|
+
</div>
|
|
747
|
+
{/each}
|
|
748
|
+
</div>
|
|
749
|
+
|
|
750
|
+
<div class="selected-summary">
|
|
751
|
+
<h4>已选标签 ({selectedTags.length})</h4>
|
|
752
|
+
<div class="selected-tags">
|
|
753
|
+
{#each selectedTags as tag}
|
|
754
|
+
<Tag
|
|
755
|
+
text={tag}
|
|
756
|
+
color="1"
|
|
757
|
+
size="small"
|
|
758
|
+
variant="round"
|
|
759
|
+
removable={true}
|
|
760
|
+
removeHandler={() => toggleTag(tag)}
|
|
761
|
+
/>
|
|
762
|
+
{/each}
|
|
763
|
+
</div>
|
|
764
|
+
</div>
|
|
765
|
+
</div>
|
|
766
|
+
|
|
767
|
+
<style>
|
|
768
|
+
.category-demo {
|
|
769
|
+
margin: 20px;
|
|
770
|
+
max-width: 800px;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
.categories {
|
|
774
|
+
display: grid;
|
|
775
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
776
|
+
gap: 20px;
|
|
777
|
+
margin-bottom: 24px;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.category-section {
|
|
781
|
+
padding: 16px;
|
|
782
|
+
border: 1px solid #eee;
|
|
783
|
+
border-radius: 8px;
|
|
784
|
+
background: #fafafa;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
.category-header {
|
|
788
|
+
display: flex;
|
|
789
|
+
align-items: center;
|
|
790
|
+
gap: 8px;
|
|
791
|
+
margin-bottom: 12px;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.tag-count {
|
|
795
|
+
font-size: 12px;
|
|
796
|
+
color: #666;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
.category-tags {
|
|
800
|
+
display: flex;
|
|
801
|
+
flex-wrap: wrap;
|
|
802
|
+
gap: 6px;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
.tag-button {
|
|
806
|
+
border: none;
|
|
807
|
+
background: none;
|
|
808
|
+
padding: 0;
|
|
809
|
+
cursor: pointer;
|
|
810
|
+
border-radius: 4px;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.tag-button:hover {
|
|
814
|
+
transform: translateY(-1px);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.tag-button.selected {
|
|
818
|
+
transform: scale(1.05);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.selected-summary {
|
|
822
|
+
padding: 16px;
|
|
823
|
+
background: #f8f9fa;
|
|
824
|
+
border-radius: 8px;
|
|
825
|
+
border-left: 4px solid #007bff;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.selected-summary h4 {
|
|
829
|
+
margin: 0 0 12px 0;
|
|
830
|
+
color: #333;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.selected-tags {
|
|
834
|
+
display: flex;
|
|
835
|
+
flex-wrap: wrap;
|
|
836
|
+
gap: 6px;
|
|
837
|
+
}
|
|
838
|
+
</style>
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
## 功能
|
|
842
|
+
|
|
843
|
+
- **多种变体**:支持边框、圆形和无边框样式
|
|
844
|
+
- **尺寸选项**:支持小、中、大尺寸
|
|
845
|
+
- **颜色主题**:12种预定义颜色主题,带有语义含义
|
|
846
|
+
- **可移除功能**:可选的移除图标,带有悬停交互
|
|
847
|
+
- **灵活样式**:支持自定义 CSS 类和内联样式
|
|
848
|
+
- **响应式设计**:适配不同屏幕尺寸
|
|
849
|
+
- **悬停效果**:交互式移除图标
|
|
850
|
+
|
|
851
|
+
## 颜色主题参考
|
|
852
|
+
|
|
853
|
+
| 颜色 | 主题 | 使用场景 |
|
|
854
|
+
|-------|-------|----------|
|
|
855
|
+
| 1 | 蓝色 | 主要操作、链接、导航 |
|
|
856
|
+
| 2 | 绿色 | 成功状态、完成动作 |
|
|
857
|
+
| 3 | 红色 | 错误状态、关键警报 |
|
|
858
|
+
| 4 | 黄色 | 警告状态、注意 |
|
|
859
|
+
| 5 | 粉色 | 高亮显示、特殊功能 |
|
|
860
|
+
| 6 | 青色 | 信息提示、建议 |
|
|
861
|
+
| 7 | 橙色 | 警报、通知 |
|
|
862
|
+
| 8 | 琥珀色 | 待处理状态、进行中 |
|
|
863
|
+
| 9 | 靛蓝 | 导航、次要操作 |
|
|
864
|
+
| 10 | 紫色 | 创意内容、高级功能 |
|
|
865
|
+
| 11 | 酸橙色 | 新鲜内容、新项目 |
|
|
866
|
+
| 12 | 灰色 | 中性、默认状态 |
|
|
867
|
+
|
|
868
|
+
## 样式
|
|
869
|
+
|
|
870
|
+
Tag 组件使用 CSS 自定义属性进行主题化:
|
|
871
|
+
|
|
872
|
+
```css
|
|
873
|
+
:root {
|
|
874
|
+
--uniface-default-text-color: #374151;
|
|
875
|
+
--uniface-primary-border-color: #E2E8F0;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/* 自定义标签样式 */
|
|
879
|
+
.uniface-tag {
|
|
880
|
+
/* 容器样式 */
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
.uniface-tag > div {
|
|
884
|
+
/* 标签内容样式 */
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
.uniface-tag .uniface-remove-icon {
|
|
888
|
+
/* 移除图标样式 */
|
|
889
|
+
}
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
## 可访问性
|
|
893
|
+
|
|
894
|
+
- 正确的语义化 HTML 结构
|
|
895
|
+
- 支持键盘导航的移除功能
|
|
896
|
+
- 高对比度颜色主题
|
|
897
|
+
- 兼容屏幕阅读器
|
|
898
|
+
- 交互元素的焦点指示器
|
|
899
|
+
|
|
900
|
+
## 最佳实践
|
|
901
|
+
|
|
902
|
+
1. **颜色使用**:在整个应用中保持颜色一致性
|
|
903
|
+
2. **可移除标签**:在移除标签时提供清晰的反馈
|
|
904
|
+
3. **标签限制**:考虑限制标签数量以改善用户体验
|
|
905
|
+
4. **响应式设计**:在不同屏幕尺寸上测试标签布局
|
|
906
|
+
5. **语义含义**:使用与语义含义匹配的颜色主题
|
|
907
|
+
6. **性能**:对于大型标签列表,考虑使用虚拟化
|
|
908
|
+
|
|
909
|
+
## 浏览器支持
|
|
910
|
+
|
|
911
|
+
- 支持 CSS 自定义属性的现代浏览器
|
|
912
|
+
- 兼容 Svelte 5+
|
|
913
|
+
- 支持悬停和焦点交互
|
|
914
|
+
- 支持 Flexbox 布局
|
|
915
|
+
- 完整的 TypeScript 支持
|
|
916
|
+
|
|
917
|
+
## 相关组件
|
|
918
|
+
|
|
919
|
+
- `Chip` - 带有交互动作的芯片组件
|
|
920
|
+
- `Badge` - 小型状态指示器
|
|
921
|
+
- `Label` - 表单字段标签
|
|
922
|
+
- `Button` - 交互按钮组件
|