fantasia-ui 0.1.31 → 0.2.2
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/README.en.md +242 -84
- package/README.md +241 -83
- package/dist/assets/index.d.ts +5 -0
- package/dist/components/index.d.ts +27 -3
- package/dist/components/modules/FAffix.vue.d.ts +21 -0
- package/dist/components/modules/FAvatar.vue.d.ts +6 -0
- package/dist/components/modules/FBadge.vue.d.ts +24 -0
- package/dist/components/modules/FBreadcrumb.vue.d.ts +24 -0
- package/dist/components/modules/FButton.vue.d.ts +21 -0
- package/dist/components/modules/FCard.vue.d.ts +31 -0
- package/dist/components/modules/FCol.vue.d.ts +22 -0
- package/dist/components/modules/FContainer.vue.d.ts +20 -0
- package/dist/components/modules/FDivider.vue.d.ts +6 -0
- package/dist/components/modules/FDropdown.vue.d.ts +35 -0
- package/dist/components/modules/FIcon.vue.d.ts +20 -0
- package/dist/components/modules/FImage.vue.d.ts +23 -0
- package/dist/components/modules/FInput.vue.d.ts +27 -0
- package/dist/components/modules/FLink.vue.d.ts +21 -0
- package/dist/components/modules/FLoading.vue.d.ts +6 -0
- package/dist/components/modules/FPagination.vue.d.ts +16 -0
- package/dist/components/modules/FProgress.vue.d.ts +6 -0
- package/dist/components/modules/FRate.vue.d.ts +22 -0
- package/dist/components/modules/FRow.vue.d.ts +24 -0
- package/dist/components/modules/FSelect.vue.d.ts +17 -0
- package/dist/components/modules/FSpace.vue.d.ts +9 -0
- package/dist/components/modules/FTabs.vue.d.ts +24 -0
- package/dist/components/modules/FTag.vue.d.ts +25 -0
- package/dist/components/modules/FText.vue.d.ts +22 -0
- package/dist/components/modules/FTooltip.vue.d.ts +31 -0
- package/dist/components/modules/FTypography.vue.d.ts +22 -0
- package/dist/fantasia-ui.es.js +1556 -34405
- package/dist/fantasia-ui.umd.js +2 -62
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/types/assets/index.d.ts +5 -0
- package/dist/types/assets/index.js +5 -0
- package/dist/types/components/index.d.ts +27 -0
- package/dist/types/components/index.js +27 -0
- package/dist/types/components/modules/base.d.ts +7 -0
- package/dist/types/components/modules/f-affix.d.ts +5 -0
- package/dist/types/components/modules/f-avatar.d.ts +10 -0
- package/dist/types/components/modules/f-badge.d.ts +9 -0
- package/dist/types/components/modules/f-breadcrumb.d.ts +10 -0
- package/dist/types/components/modules/f-button.d.ts +9 -0
- package/dist/types/components/modules/f-card.d.ts +6 -0
- package/dist/types/components/modules/f-col.d.ts +15 -0
- package/dist/types/components/modules/f-container.d.ts +4 -0
- package/dist/types/components/modules/f-dialog.d.ts +6 -0
- package/dist/types/components/modules/f-divider.d.ts +8 -0
- package/dist/types/components/modules/f-dropdown.d.ts +17 -0
- package/dist/types/components/modules/f-form.d.ts +83 -0
- package/dist/types/components/modules/f-icon.d.ts +5 -0
- package/dist/types/components/modules/f-image.d.ts +8 -0
- package/dist/types/components/modules/f-input.d.ts +9 -0
- package/dist/types/components/modules/f-link.d.ts +8 -0
- package/dist/types/components/modules/f-loading.d.ts +6 -0
- package/dist/types/components/modules/f-menu.d.ts +13 -0
- package/dist/types/components/modules/f-pagination.d.ts +6 -0
- package/dist/types/components/modules/f-progress.d.ts +7 -0
- package/dist/types/components/modules/f-rate.d.ts +12 -0
- package/dist/types/components/modules/f-row.d.ts +9 -0
- package/dist/types/components/modules/f-slider-captcha.d.ts +16 -0
- package/dist/types/components/modules/f-space.d.ts +11 -0
- package/dist/types/components/modules/f-table.d.ts +12 -0
- package/dist/types/components/modules/f-tabs.d.ts +12 -0
- package/dist/types/components/modules/f-tag.d.ts +10 -0
- package/dist/types/components/modules/f-tagsview.d.ts +7 -0
- package/dist/types/components/modules/f-text.d.ts +10 -0
- package/dist/types/components/modules/f-toolbar.d.ts +26 -0
- package/dist/types/components/modules/f-tooltip.d.ts +10 -0
- package/dist/types/components/modules/f-upload.d.ts +11 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +15 -0
- package/dist/types/models/index.d.ts +26 -0
- package/dist/types/types/components/index.d.ts +32 -0
- package/dist/types/types/components/index.js +32 -0
- package/dist/types/types/components/modules/base.d.ts +7 -0
- package/dist/types/types/components/modules/base.js +1 -0
- package/dist/types/types/components/modules/f-affix.d.ts +5 -0
- package/dist/types/types/components/modules/f-affix.js +1 -0
- package/dist/types/types/components/modules/f-avatar.d.ts +10 -0
- package/dist/types/types/components/modules/f-avatar.js +1 -0
- package/dist/types/types/components/modules/f-badge.d.ts +9 -0
- package/dist/types/types/components/modules/f-badge.js +1 -0
- package/dist/types/types/components/modules/f-breadcrumb.d.ts +10 -0
- package/dist/types/types/components/modules/f-breadcrumb.js +1 -0
- package/dist/types/types/components/modules/f-button.d.ts +9 -0
- package/dist/types/types/components/modules/f-button.js +1 -0
- package/dist/types/types/components/modules/f-card.d.ts +6 -0
- package/dist/types/types/components/modules/f-card.js +1 -0
- package/dist/types/types/components/modules/f-col.d.ts +15 -0
- package/dist/types/types/components/modules/f-col.js +1 -0
- package/dist/types/types/components/modules/f-container.d.ts +4 -0
- package/dist/types/types/components/modules/f-container.js +1 -0
- package/dist/types/types/components/modules/f-dialog.d.ts +6 -0
- package/dist/types/types/components/modules/f-dialog.js +1 -0
- package/dist/types/types/components/modules/f-divider.d.ts +8 -0
- package/dist/types/types/components/modules/f-divider.js +1 -0
- package/dist/types/types/components/modules/f-dropdown.d.ts +17 -0
- package/dist/types/types/components/modules/f-dropdown.js +1 -0
- package/dist/types/types/components/modules/f-form.d.ts +83 -0
- package/dist/types/types/components/modules/f-form.js +1 -0
- package/dist/types/types/components/modules/f-icon.d.ts +5 -0
- package/dist/types/types/components/modules/f-icon.js +1 -0
- package/dist/types/types/components/modules/f-image.d.ts +8 -0
- package/dist/types/types/components/modules/f-image.js +1 -0
- package/dist/types/types/components/modules/f-input.d.ts +9 -0
- package/dist/types/types/components/modules/f-input.js +1 -0
- package/dist/types/types/components/modules/f-link.d.ts +8 -0
- package/dist/types/types/components/modules/f-link.js +1 -0
- package/dist/types/types/components/modules/f-loading.d.ts +6 -0
- package/dist/types/types/components/modules/f-loading.js +1 -0
- package/dist/types/types/components/modules/f-menu.d.ts +13 -0
- package/dist/types/types/components/modules/f-menu.js +1 -0
- package/dist/types/types/components/modules/f-pagination.d.ts +6 -0
- package/dist/types/types/components/modules/f-pagination.js +1 -0
- package/dist/types/types/components/modules/f-progress.d.ts +7 -0
- package/dist/types/types/components/modules/f-progress.js +1 -0
- package/dist/types/types/components/modules/f-rate.d.ts +12 -0
- package/dist/types/types/components/modules/f-rate.js +1 -0
- package/dist/types/types/components/modules/f-row.d.ts +9 -0
- package/dist/types/types/components/modules/f-row.js +1 -0
- package/dist/types/types/components/modules/f-slider-captcha.d.ts +16 -0
- package/dist/types/types/components/modules/f-slider-captcha.js +2 -0
- package/dist/types/types/components/modules/f-space.d.ts +11 -0
- package/dist/types/types/components/modules/f-space.js +1 -0
- package/dist/types/types/components/modules/f-table.d.ts +12 -0
- package/dist/types/types/components/modules/f-table.js +1 -0
- package/dist/types/types/components/modules/f-tabs.d.ts +12 -0
- package/dist/types/types/components/modules/f-tabs.js +1 -0
- package/dist/types/types/components/modules/f-tag.d.ts +10 -0
- package/dist/types/types/components/modules/f-tag.js +1 -0
- package/dist/types/types/components/modules/f-tagsview.d.ts +7 -0
- package/dist/types/types/components/modules/f-tagsview.js +1 -0
- package/dist/types/types/components/modules/f-text.d.ts +10 -0
- package/dist/types/types/components/modules/f-text.js +1 -0
- package/dist/types/types/components/modules/f-toolbar.d.ts +26 -0
- package/dist/types/types/components/modules/f-toolbar.js +1 -0
- package/dist/types/types/components/modules/f-tooltip.d.ts +10 -0
- package/dist/types/types/components/modules/f-tooltip.js +1 -0
- package/dist/types/types/components/modules/f-upload.d.ts +11 -0
- package/dist/types/types/components/modules/f-upload.js +1 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.js +2 -0
- package/dist/types/types/models/index.d.ts +26 -0
- package/dist/types/types/models/index.js +1 -0
- package/package.json +15 -11
- package/dist/components/modules/FTable.vue.d.ts +0 -153
- package/dist/components/modules/FUpload.vue.d.ts +0 -1428
- package/dist/favicon.ico +0 -0
- package/dist/types/modules/f-table.d.ts +0 -64
- package/dist/types/modules/f-upload.d.ts +0 -15
package/README.en.md
CHANGED
|
@@ -1,103 +1,261 @@
|
|
|
1
|
-
# Fantasia UI
|
|
1
|
+
# Fantasia UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/fantasia-ui" alt="npm version">
|
|
5
|
+
<img src="https://img.shields.io/npm/dm/fantasia-ui" alt="npm downloads">
|
|
6
|
+
<img src="https://img.shields.io/npm/l/fantasia-ui" alt="license">
|
|
7
|
+
<img src="https://img.shields.io/badge/vue-3.x-brightgreen.svg" alt="vue3">
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
A modern UI component library based on Vue 3 + TypeScript
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
English | <a href="./README.md">简体中文</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- 🎨 **Modern Design** - Clean and elegant design style
|
|
21
|
+
- 🔧 **TypeScript** - Full TypeScript support with type definitions
|
|
22
|
+
- 📦 **Tree Shaking** - Support on-demand loading to reduce bundle size
|
|
23
|
+
- ⚡ **Vue 3** - Built with Vue 3 Composition API
|
|
24
|
+
- 🎯 **Out of the Box** - Rich components for daily development needs
|
|
25
|
+
- 📱 **Responsive** - Mobile-friendly interaction experience
|
|
26
|
+
|
|
27
|
+
## 📦 Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# npm
|
|
31
|
+
npm install fantasia-ui
|
|
32
|
+
|
|
33
|
+
# yarn
|
|
34
|
+
yarn add fantasia-ui
|
|
35
|
+
|
|
36
|
+
# pnpm
|
|
37
|
+
pnpm add fantasia-ui
|
|
38
|
+
```
|
|
4
39
|
|
|
5
|
-
|
|
40
|
+
## 🔨 Quick Start
|
|
6
41
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
42
|
+
### Global Registration
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// main.ts
|
|
46
|
+
import { createApp } from 'vue'
|
|
47
|
+
import FantasiaUI, { install } from 'fantasia-ui'
|
|
48
|
+
import 'fantasia-ui/dist/index.css'
|
|
49
|
+
import App from './App.vue'
|
|
50
|
+
|
|
51
|
+
const app = createApp(App)
|
|
52
|
+
app.use(install)
|
|
53
|
+
app.mount('#app')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Import on Demand
|
|
10
57
|
|
|
11
58
|
```vue
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { FButton, FInput } from 'fantasia-ui'
|
|
61
|
+
import 'fantasia-ui/dist/index.css'
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<FButton type="primary">Button</FButton>
|
|
66
|
+
<FInput v-model="value" placeholder="Please input" />
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 📚 Component List
|
|
71
|
+
|
|
72
|
+
### Basic Components
|
|
73
|
+
- **FButton** - Button
|
|
74
|
+
- **FIcon** - Icon
|
|
75
|
+
- **FText** - Text
|
|
76
|
+
- **FLink** - Link
|
|
77
|
+
- **FTypography** - Typography
|
|
78
|
+
|
|
79
|
+
### Layout Components
|
|
80
|
+
- **FContainer** - Container
|
|
81
|
+
- **FRow** - Row
|
|
82
|
+
- **FCol** - Column
|
|
83
|
+
- **FSpace** - Space
|
|
84
|
+
- **FDivider** - Divider
|
|
85
|
+
|
|
86
|
+
### Data Display
|
|
87
|
+
- **FCard** - Card
|
|
88
|
+
- **FImage** - Image
|
|
89
|
+
- **FAvatar** - Avatar
|
|
90
|
+
- **FBadge** - Badge
|
|
91
|
+
- **FTag** - Tag
|
|
92
|
+
- **FProgress** - Progress
|
|
93
|
+
- **FRate** - Rate
|
|
94
|
+
- **FBreadcrumb** - Breadcrumb
|
|
95
|
+
|
|
96
|
+
### Form Components
|
|
97
|
+
- **FInput** - Input
|
|
98
|
+
- **FSelect** - Select
|
|
99
|
+
- **FUpload** - Upload
|
|
100
|
+
|
|
101
|
+
### Data Components
|
|
102
|
+
- **FPagination** - Pagination
|
|
103
|
+
- **FTabs** - Tabs
|
|
104
|
+
|
|
105
|
+
### Feedback Components
|
|
106
|
+
- **FLoading** - Loading
|
|
107
|
+
- **FTooltip** - Tooltip
|
|
108
|
+
- **FSliderCaptcha** - Slider Captcha
|
|
109
|
+
|
|
110
|
+
### Others
|
|
111
|
+
- **FDropdown** - Dropdown
|
|
112
|
+
- **FAffix** - Affix
|
|
113
|
+
|
|
114
|
+
## 📝 Usage Examples
|
|
115
|
+
|
|
116
|
+
### Button Component
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<script setup lang="ts">
|
|
120
|
+
import { FButton } from 'fantasia-ui'
|
|
121
|
+
|
|
122
|
+
const handleClick = () => {
|
|
123
|
+
console.log('clicked!')
|
|
29
124
|
}
|
|
30
125
|
</script>
|
|
31
126
|
|
|
32
127
|
<template>
|
|
33
|
-
|
|
128
|
+
<FButton type="primary" @click="handleClick">
|
|
129
|
+
Primary Button
|
|
130
|
+
</FButton>
|
|
131
|
+
<FButton type="success">Success Button</FButton>
|
|
132
|
+
<FButton type="warning">Warning Button</FButton>
|
|
133
|
+
<FButton type="danger">Danger Button</FButton>
|
|
34
134
|
</template>
|
|
35
135
|
```
|
|
36
136
|
|
|
37
|
-
###
|
|
137
|
+
### Upload Component
|
|
38
138
|
|
|
39
139
|
```vue
|
|
40
|
-
<script lang="ts"
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const columns = reactive<Columns[]>([
|
|
53
|
-
{
|
|
54
|
-
prop: 'id',
|
|
55
|
-
label: 'ID'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
prop: 'nickname',
|
|
59
|
-
label: 'Nickname'
|
|
60
|
-
}
|
|
61
|
-
])
|
|
62
|
-
|
|
63
|
-
const actions = reactive<Actions[]>([
|
|
64
|
-
{
|
|
65
|
-
action: 'switch',
|
|
66
|
-
event: 'change',
|
|
67
|
-
prop: 'change',
|
|
68
|
-
config: {
|
|
69
|
-
activeText: 'Enable',
|
|
70
|
-
inactiveText: 'Disable',
|
|
71
|
-
activeValue: 0,
|
|
72
|
-
inactiveValue: 1
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
action: 'button',
|
|
77
|
-
event: 'delete',
|
|
78
|
-
label: 'Delete',
|
|
79
|
-
type: 'danger',
|
|
80
|
-
icon: 'delete'
|
|
81
|
-
}
|
|
82
|
-
])
|
|
83
|
-
|
|
84
|
-
const handleAction = (row: any, event: string) => {
|
|
85
|
-
switch (event) {
|
|
86
|
-
case 'change':
|
|
87
|
-
console.log("Switched");
|
|
88
|
-
break;
|
|
89
|
-
case 'delete':
|
|
90
|
-
console.log("Deleted");
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
140
|
+
<script setup lang="ts">
|
|
141
|
+
import { FUpload } from 'fantasia-ui'
|
|
142
|
+
|
|
143
|
+
const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
|
|
144
|
+
try {
|
|
145
|
+
// Upload logic
|
|
146
|
+
console.log('Upload file:', file)
|
|
147
|
+
done()
|
|
148
|
+
} catch (err) {
|
|
149
|
+
error(err)
|
|
150
|
+
}
|
|
93
151
|
}
|
|
94
152
|
</script>
|
|
95
153
|
|
|
96
154
|
<template>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
155
|
+
<FUpload
|
|
156
|
+
crop
|
|
157
|
+
mosaic
|
|
158
|
+
@upload="handleUpload"
|
|
159
|
+
/>
|
|
102
160
|
</template>
|
|
103
|
-
```
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Pagination Component
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<script setup lang="ts">
|
|
167
|
+
import { FPagination } from 'fantasia-ui'
|
|
168
|
+
import { ref } from 'vue'
|
|
169
|
+
|
|
170
|
+
const currentPage = ref(1)
|
|
171
|
+
const pageSize = ref(10)
|
|
172
|
+
const total = ref(100)
|
|
173
|
+
|
|
174
|
+
const handlePageChange = (page: number) => {
|
|
175
|
+
currentPage.value = page
|
|
176
|
+
console.log('Current page:', page)
|
|
177
|
+
}
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<template>
|
|
181
|
+
<FPagination
|
|
182
|
+
v-model:current-page="currentPage"
|
|
183
|
+
v-model:page-size="pageSize"
|
|
184
|
+
:total="total"
|
|
185
|
+
@change="handlePageChange"
|
|
186
|
+
/>
|
|
187
|
+
</template>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Layout Components
|
|
191
|
+
|
|
192
|
+
```vue
|
|
193
|
+
<script setup lang="ts">
|
|
194
|
+
import { FRow, FCol, FSpace } from 'fantasia-ui'
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<!-- Grid Layout -->
|
|
199
|
+
<FRow :gutter="20">
|
|
200
|
+
<FCol :span="12">Column 1</FCol>
|
|
201
|
+
<FCol :span="12">Column 2</FCol>
|
|
202
|
+
</FRow>
|
|
203
|
+
|
|
204
|
+
<!-- Space Layout -->
|
|
205
|
+
<FSpace direction="horizontal" :size="16">
|
|
206
|
+
<FButton>Button 1</FButton>
|
|
207
|
+
<FButton>Button 2</FButton>
|
|
208
|
+
<FButton>Button 3</FButton>
|
|
209
|
+
</FSpace>
|
|
210
|
+
</template>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 🎨 Theme Customization
|
|
214
|
+
|
|
215
|
+
The component library supports theme customization via CSS variables:
|
|
216
|
+
|
|
217
|
+
```css
|
|
218
|
+
:root {
|
|
219
|
+
--primary-color: #409eff;
|
|
220
|
+
--success-color: #67c23a;
|
|
221
|
+
--warning-color: #e6a23c;
|
|
222
|
+
--danger-color: #f56c6c;
|
|
223
|
+
--info-color: #909399;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 📖 TypeScript Support
|
|
228
|
+
|
|
229
|
+
Fantasia UI provides complete TypeScript type definitions:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import type {
|
|
233
|
+
FButtonProps,
|
|
234
|
+
FInputProps,
|
|
235
|
+
FAvatarProps,
|
|
236
|
+
// ... other types
|
|
237
|
+
} from 'fantasia-ui'
|
|
238
|
+
|
|
239
|
+
// Use types
|
|
240
|
+
const buttonProps: FButtonProps = {
|
|
241
|
+
type: 'primary',
|
|
242
|
+
size: 'large',
|
|
243
|
+
disabled: false
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 🔗 Links
|
|
248
|
+
|
|
249
|
+
- [Changelog](./CHANGELOG.md)
|
|
250
|
+
- [Issues](https://github.com/yourusername/fantasia-ui/issues)
|
|
251
|
+
- [Contributing Guide](./CONTRIBUTING.md)
|
|
252
|
+
|
|
253
|
+
## 📄 License
|
|
254
|
+
|
|
255
|
+
[MIT](./LICENSE) License © 2024 Shuster
|
|
256
|
+
|
|
257
|
+
## 🤝 Contributing
|
|
258
|
+
|
|
259
|
+
Issues and Pull Requests are welcome!
|
|
260
|
+
|
|
261
|
+
If this project helps you, please give it a ⭐️ Star!
|
package/README.md
CHANGED
|
@@ -1,103 +1,261 @@
|
|
|
1
|
-
# Fantasia UI
|
|
1
|
+
# Fantasia UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/fantasia-ui" alt="npm version">
|
|
5
|
+
<img src="https://img.shields.io/npm/dm/fantasia-ui" alt="npm downloads">
|
|
6
|
+
<img src="https://img.shields.io/npm/l/fantasia-ui" alt="license">
|
|
7
|
+
<img src="https://img.shields.io/badge/vue-3.x-brightgreen.svg" alt="vue3">
|
|
8
|
+
</p>
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
<p align="center">
|
|
11
|
+
一个基于 Vue 3 + TypeScript 的现代化 UI 组件库
|
|
12
|
+
</p>
|
|
6
13
|
|
|
7
|
-
>
|
|
8
|
-
>
|
|
9
|
-
>
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="./README.en.md">English</a> | 简体中文
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## ✨ 特性
|
|
19
|
+
|
|
20
|
+
- 🎨 **现代化设计** - 简洁优雅的设计风格
|
|
21
|
+
- 🔧 **TypeScript** - 完整的类型定义支持
|
|
22
|
+
- 📦 **按需加载** - 支持 Tree Shaking,减小打包体积
|
|
23
|
+
- ⚡ **Vue 3** - 基于 Vue 3 Composition API
|
|
24
|
+
- 🎯 **开箱即用** - 丰富的组件,满足日常开发需求
|
|
25
|
+
- 📱 **响应式** - 移动端友好的交互体验
|
|
26
|
+
|
|
27
|
+
## 📦 安装
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# npm
|
|
31
|
+
npm install fantasia-ui
|
|
32
|
+
|
|
33
|
+
# yarn
|
|
34
|
+
yarn add fantasia-ui
|
|
35
|
+
|
|
36
|
+
# pnpm
|
|
37
|
+
pnpm add fantasia-ui
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🔨 快速开始
|
|
41
|
+
|
|
42
|
+
### 全局注册
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// main.ts
|
|
46
|
+
import { createApp } from 'vue'
|
|
47
|
+
import FantasiaUI, { install } from 'fantasia-ui'
|
|
48
|
+
import 'fantasia-ui/dist/index.css'
|
|
49
|
+
import App from './App.vue'
|
|
50
|
+
|
|
51
|
+
const app = createApp(App)
|
|
52
|
+
app.use(install)
|
|
53
|
+
app.mount('#app')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 按需引入
|
|
10
57
|
|
|
11
58
|
```vue
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { FButton, FInput } from 'fantasia-ui'
|
|
61
|
+
import 'fantasia-ui/dist/index.css'
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<FButton type="primary">按钮</FButton>
|
|
66
|
+
<FInput v-model="value" placeholder="请输入" />
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 📚 组件列表
|
|
71
|
+
|
|
72
|
+
### 基础组件
|
|
73
|
+
- **FButton** - 按钮
|
|
74
|
+
- **FIcon** - 图标
|
|
75
|
+
- **FText** - 文本
|
|
76
|
+
- **FLink** - 链接
|
|
77
|
+
- **FTypography** - 排版
|
|
78
|
+
|
|
79
|
+
### 布局组件
|
|
80
|
+
- **FContainer** - 容器
|
|
81
|
+
- **FRow** - 行
|
|
82
|
+
- **FCol** - 列
|
|
83
|
+
- **FSpace** - 间距
|
|
84
|
+
- **FDivider** - 分割线
|
|
85
|
+
|
|
86
|
+
### 数据展示
|
|
87
|
+
- **FCard** - 卡片
|
|
88
|
+
- **FImage** - 图片
|
|
89
|
+
- **FAvatar** - 头像
|
|
90
|
+
- **FBadge** - 徽章
|
|
91
|
+
- **FTag** - 标签
|
|
92
|
+
- **FProgress** - 进度条
|
|
93
|
+
- **FRate** - 评分
|
|
94
|
+
- **FBreadcrumb** - 面包屑
|
|
95
|
+
|
|
96
|
+
### 表单组件
|
|
97
|
+
- **FInput** - 输入框
|
|
98
|
+
- **FSelect** - 选择器
|
|
99
|
+
- **FUpload** - 上传
|
|
100
|
+
|
|
101
|
+
### 数据组件
|
|
102
|
+
- **FPagination** - 分页
|
|
103
|
+
- **FTabs** - 标签页
|
|
104
|
+
|
|
105
|
+
### 反馈组件
|
|
106
|
+
- **FLoading** - 加载
|
|
107
|
+
- **FTooltip** - 提示
|
|
108
|
+
- **FSliderCaptcha** - 滑块验证
|
|
109
|
+
|
|
110
|
+
### 其他
|
|
111
|
+
- **FDropdown** - 下拉菜单
|
|
112
|
+
- **FAffix** - 固钉
|
|
113
|
+
|
|
114
|
+
## 📝 使用示例
|
|
115
|
+
|
|
116
|
+
### 按钮组件
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<script setup lang="ts">
|
|
120
|
+
import { FButton } from 'fantasia-ui'
|
|
121
|
+
|
|
122
|
+
const handleClick = () => {
|
|
123
|
+
console.log('clicked!')
|
|
29
124
|
}
|
|
30
125
|
</script>
|
|
31
126
|
|
|
32
127
|
<template>
|
|
33
|
-
<
|
|
128
|
+
<FButton type="primary" @click="handleClick">
|
|
129
|
+
主要按钮
|
|
130
|
+
</FButton>
|
|
131
|
+
<FButton type="success">成功按钮</FButton>
|
|
132
|
+
<FButton type="warning">警告按钮</FButton>
|
|
133
|
+
<FButton type="danger">危险按钮</FButton>
|
|
34
134
|
</template>
|
|
35
135
|
```
|
|
36
136
|
|
|
37
|
-
###
|
|
137
|
+
### 上传组件
|
|
38
138
|
|
|
39
139
|
```vue
|
|
40
|
-
<script lang="ts"
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
const columns = reactive<Columns[]>([
|
|
53
|
-
{
|
|
54
|
-
prop: 'id',
|
|
55
|
-
label: 'ID'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
prop: 'nickname',
|
|
59
|
-
label: '昵称'
|
|
60
|
-
}
|
|
61
|
-
])
|
|
62
|
-
|
|
63
|
-
const actions = reactive<Actions[]>([
|
|
64
|
-
{
|
|
65
|
-
action: 'switch',
|
|
66
|
-
event: 'change',
|
|
67
|
-
prop: 'change',
|
|
68
|
-
config: {
|
|
69
|
-
activeText: '启用',
|
|
70
|
-
inactiveText: '禁用',
|
|
71
|
-
activeValue: 0,
|
|
72
|
-
inactiveValue: 1
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
action: 'button',
|
|
77
|
-
event: 'delete',
|
|
78
|
-
label: '删除',
|
|
79
|
-
type: 'danger',
|
|
80
|
-
icon: 'delete'
|
|
81
|
-
}
|
|
82
|
-
])
|
|
83
|
-
|
|
84
|
-
const handleAction = (row: any, event: string) => {
|
|
85
|
-
switch (event) {
|
|
86
|
-
case 'change':
|
|
87
|
-
console.log("切换了");
|
|
88
|
-
break;
|
|
89
|
-
case 'delete':
|
|
90
|
-
console.log("删除了");
|
|
91
|
-
break;
|
|
140
|
+
<script setup lang="ts">
|
|
141
|
+
import { FUpload } from 'fantasia-ui'
|
|
142
|
+
|
|
143
|
+
const handleUpload = (file: File, done: () => void, error: (err: any) => void) => {
|
|
144
|
+
try {
|
|
145
|
+
// 上传逻辑
|
|
146
|
+
console.log('上传文件:', file)
|
|
147
|
+
done()
|
|
148
|
+
} catch (err) {
|
|
149
|
+
error(err)
|
|
92
150
|
}
|
|
93
151
|
}
|
|
94
152
|
</script>
|
|
95
153
|
|
|
96
154
|
<template>
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
155
|
+
<FUpload
|
|
156
|
+
crop
|
|
157
|
+
mosaic
|
|
158
|
+
@upload="handleUpload"
|
|
159
|
+
/>
|
|
102
160
|
</template>
|
|
103
|
-
```
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 分页组件
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<script setup lang="ts">
|
|
167
|
+
import { FPagination } from 'fantasia-ui'
|
|
168
|
+
import { ref } from 'vue'
|
|
169
|
+
|
|
170
|
+
const currentPage = ref(1)
|
|
171
|
+
const pageSize = ref(10)
|
|
172
|
+
const total = ref(100)
|
|
173
|
+
|
|
174
|
+
const handlePageChange = (page: number) => {
|
|
175
|
+
currentPage.value = page
|
|
176
|
+
console.log('当前页:', page)
|
|
177
|
+
}
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<template>
|
|
181
|
+
<FPagination
|
|
182
|
+
v-model:current-page="currentPage"
|
|
183
|
+
v-model:page-size="pageSize"
|
|
184
|
+
:total="total"
|
|
185
|
+
@change="handlePageChange"
|
|
186
|
+
/>
|
|
187
|
+
</template>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 布局组件
|
|
191
|
+
|
|
192
|
+
```vue
|
|
193
|
+
<script setup lang="ts">
|
|
194
|
+
import { FRow, FCol, FSpace } from 'fantasia-ui'
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<!-- 栅格布局 -->
|
|
199
|
+
<FRow :gutter="20">
|
|
200
|
+
<FCol :span="12">列 1</FCol>
|
|
201
|
+
<FCol :span="12">列 2</FCol>
|
|
202
|
+
</FRow>
|
|
203
|
+
|
|
204
|
+
<!-- 间距布局 -->
|
|
205
|
+
<FSpace direction="horizontal" :size="16">
|
|
206
|
+
<FButton>按钮 1</FButton>
|
|
207
|
+
<FButton>按钮 2</FButton>
|
|
208
|
+
<FButton>按钮 3</FButton>
|
|
209
|
+
</FSpace>
|
|
210
|
+
</template>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 🎨 主题定制
|
|
214
|
+
|
|
215
|
+
组件库支持 CSS 变量自定义主题:
|
|
216
|
+
|
|
217
|
+
```css
|
|
218
|
+
:root {
|
|
219
|
+
--primary-color: #409eff;
|
|
220
|
+
--success-color: #67c23a;
|
|
221
|
+
--warning-color: #e6a23c;
|
|
222
|
+
--danger-color: #f56c6c;
|
|
223
|
+
--info-color: #909399;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 📖 TypeScript 支持
|
|
228
|
+
|
|
229
|
+
Fantasia UI 提供完整的 TypeScript 类型定义:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import type {
|
|
233
|
+
FButtonProps,
|
|
234
|
+
FInputProps,
|
|
235
|
+
FAvatarProps,
|
|
236
|
+
// ... 其他类型
|
|
237
|
+
} from 'fantasia-ui'
|
|
238
|
+
|
|
239
|
+
// 使用类型
|
|
240
|
+
const buttonProps: FButtonProps = {
|
|
241
|
+
type: 'primary',
|
|
242
|
+
size: 'large',
|
|
243
|
+
disabled: false
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 🔗 相关链接
|
|
248
|
+
|
|
249
|
+
- [更新日志](./CHANGELOG.md)
|
|
250
|
+
- [问题反馈](https://github.com/yourusername/fantasia-ui/issues)
|
|
251
|
+
- [贡献指南](./CONTRIBUTING.md)
|
|
252
|
+
|
|
253
|
+
## 📄 开源协议
|
|
254
|
+
|
|
255
|
+
[MIT](./LICENSE) License © 2024 Shuster
|
|
256
|
+
|
|
257
|
+
## 🤝 贡献
|
|
258
|
+
|
|
259
|
+
欢迎提交 Issue 和 Pull Request!
|
|
260
|
+
|
|
261
|
+
如果这个项目对你有帮助,请给一个 ⭐️ Star 支持一下!
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as Theme } from './icons/theme-light-dark.svg';
|
|
2
|
+
import { default as ThemeDark } from './icons/theme-dark.svg';
|
|
3
|
+
import { default as ThemeLight } from './icons/theme-light.svg';
|
|
4
|
+
import { default as PictureError } from './icons/picture_error.svg';
|
|
5
|
+
export { Theme, ThemeDark, ThemeLight, PictureError };
|