@coffic/cosy-ui 0.8.10 → 0.8.12
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/app.css +1 -1
- package/dist/src-astro/alert/index.ts +7 -15
- package/dist/src-astro/assets/iconData.ts +100 -0
- package/dist/src-astro/button/index_astro.ts +2 -56
- package/dist/src-astro/card/CardCourse.astro +31 -11
- package/dist/src-astro/card/index.ts +15 -25
- package/dist/src-astro/code-container/CodeContainer.astro +205 -5
- package/dist/src-astro/code-container/index.ts +9 -13
- package/dist/src-astro/contact/index.ts +16 -20
- package/dist/src-astro/errors/index.ts +0 -62
- package/dist/src-astro/footer/index.ts +1 -30
- package/dist/src-astro/header/Header.astro +1 -2
- package/dist/src-astro/header/index.ts +1 -40
- package/dist/src-astro/hero/index.ts +1 -39
- package/dist/src-astro/icons/ChartIcon.astro +28 -0
- package/dist/src-astro/icons/DashboardIcon.astro +28 -0
- package/dist/src-astro/icons/DeleteIcon.astro +28 -0
- package/dist/src-astro/icons/DocumentIcon.astro +28 -0
- package/dist/src-astro/icons/DownloadIcon.astro +28 -0
- package/dist/src-astro/icons/EditIcon.astro +28 -0
- package/dist/src-astro/icons/FolderIcon.astro +28 -0
- package/dist/src-astro/icons/HeartIcon.astro +28 -0
- package/dist/src-astro/icons/HomeIcon.astro +28 -0
- package/dist/src-astro/icons/MailIcon.astro +28 -0
- package/dist/src-astro/icons/MessageIcon.astro +28 -0
- package/dist/src-astro/icons/NotificationIcon.astro +28 -0
- package/dist/src-astro/icons/ReportIcon.astro +28 -0
- package/dist/src-astro/icons/SaveIcon.astro +28 -0
- package/dist/src-astro/icons/SecurityIcon.astro +28 -0
- package/dist/src-astro/icons/StarIcon.astro +28 -0
- package/dist/src-astro/icons/ToolsIcon.astro +28 -0
- package/dist/src-astro/icons/UploadIcon.astro +28 -0
- package/dist/src-astro/icons/UsersIcon.astro +28 -0
- package/dist/src-astro/icons/WalletIcon.astro +28 -0
- package/dist/src-astro/icons/index.ts +20 -0
- package/dist/src-astro/layout-app/index.ts +5 -9
- package/dist/src-astro/layout-dashboard/DashboardLayout.astro +159 -555
- package/dist/src-astro/layout-dashboard/DashboardSidebar.astro +219 -0
- package/dist/src-astro/layout-dashboard/DashboardTopNavbar.astro +164 -0
- package/dist/src-astro/layout-dashboard/index.ts +14 -8
- package/dist/src-astro/layout-dashboard/tools.ts +0 -0
- package/dist/src-astro/layout-dashboard/types.ts +319 -0
- package/package.json +1 -1
- package/dist/src-astro/alert/EAlertBasic.astro +0 -11
- package/dist/src-astro/alert/EAlertBasicContainer.astro +0 -11
- package/dist/src-astro/alert/EAlertCustomStyle.astro +0 -16
- package/dist/src-astro/alert/EAlertCustomStyleContainer.astro +0 -11
- package/dist/src-astro/alert/EAlertError.astro +0 -6
- package/dist/src-astro/alert/EAlertInfo.astro +0 -6
- package/dist/src-astro/alert/EAlertSuccess.astro +0 -6
- package/dist/src-astro/alert/EAlertTypesContainer.astro +0 -43
- package/dist/src-astro/alert/EAlertWarning.astro +0 -6
- package/dist/src-astro/alert/EAlertWithTitle.astro +0 -12
- package/dist/src-astro/alert/EAlertWithTitleContainer.astro +0 -11
- package/dist/src-astro/button/ButtonBasic.astro +0 -18
- package/dist/src-astro/button/ButtonBasicContainer.astro +0 -11
- package/dist/src-astro/button/ButtonBlock.astro +0 -5
- package/dist/src-astro/button/ButtonError.astro +0 -5
- package/dist/src-astro/button/ButtonGhost.astro +0 -5
- package/dist/src-astro/button/ButtonIconBoth.astro +0 -9
- package/dist/src-astro/button/ButtonIconLeft.astro +0 -8
- package/dist/src-astro/button/ButtonIconRight.astro +0 -8
- package/dist/src-astro/button/ButtonInfo.astro +0 -5
- package/dist/src-astro/button/ButtonLinkContainer.astro +0 -19
- package/dist/src-astro/button/ButtonNeutral.astro +0 -5
- package/dist/src-astro/button/ButtonOutline.astro +0 -5
- package/dist/src-astro/button/ButtonShapeCircle.astro +0 -5
- package/dist/src-astro/button/ButtonShapeDefault.astro +0 -5
- package/dist/src-astro/button/ButtonShapeSquare.astro +0 -5
- package/dist/src-astro/button/ButtonShapes.astro +0 -23
- package/dist/src-astro/button/ButtonShapesContainer.astro +0 -29
- package/dist/src-astro/button/ButtonSizes.astro +0 -15
- package/dist/src-astro/button/ButtonSizesContainer.astro +0 -11
- package/dist/src-astro/button/ButtonStates.astro +0 -12
- package/dist/src-astro/button/ButtonStatesContainer.astro +0 -11
- package/dist/src-astro/button/ButtonSuccess.astro +0 -5
- package/dist/src-astro/button/ButtonVariantsContainer.astro +0 -73
- package/dist/src-astro/button/ButtonWarning.astro +0 -5
- package/dist/src-astro/button/ButtonWide.astro +0 -5
- package/dist/src-astro/button/ButtonWidth.astro +0 -8
- package/dist/src-astro/button/ButtonWidthContainer.astro +0 -19
- package/dist/src-astro/button/ButtonWithIcons.astro +0 -25
- package/dist/src-astro/button/ButtonWithIconsContainer.astro +0 -29
- package/dist/src-astro/card/CardBasic.astro +0 -5
- package/dist/src-astro/card/ECardBasic.astro +0 -13
- package/dist/src-astro/card/ECardBasicContainer.astro +0 -11
- package/dist/src-astro/card/ECardClickable.astro +0 -16
- package/dist/src-astro/card/ECardClickableContainer.astro +0 -11
- package/dist/src-astro/card/ECardCompact.astro +0 -13
- package/dist/src-astro/card/ECardCompactContainer.astro +0 -11
- package/dist/src-astro/card/ECardCustomStyle.astro +0 -17
- package/dist/src-astro/card/ECardCustomStyleContainer.astro +0 -11
- package/dist/src-astro/card/ECardWithImage.astro +0 -16
- package/dist/src-astro/card/ECardWithImageContainer.astro +0 -11
- package/dist/src-astro/card/ECardWithSubtitle.astro +0 -13
- package/dist/src-astro/card/ECardWithSubtitleContainer.astro +0 -11
- package/dist/src-astro/code-container/ECodeContainerBasic.astro +0 -19
- package/dist/src-astro/code-container/ECodeContainerMultiple.astro +0 -49
- package/dist/src-astro/contact/EContactBasic.astro +0 -15
- package/dist/src-astro/contact/EContactBasicContainer.astro +0 -11
- package/dist/src-astro/contact/EContactCompact.astro +0 -11
- package/dist/src-astro/contact/EContactCompactContainer.astro +0 -11
- package/dist/src-astro/contact/EContactCustomStyle.astro +0 -21
- package/dist/src-astro/contact/EContactCustomStyleContainer.astro +0 -11
- package/dist/src-astro/contact/EContactSocial.astro +0 -20
- package/dist/src-astro/contact/EContactSocialContainer.astro +0 -11
- package/dist/src-astro/contact/EContactWithTitle.astro +0 -17
- package/dist/src-astro/contact/EContactWithTitleContainer.astro +0 -11
- package/dist/src-astro/errors/E403Basic.astro +0 -11
- package/dist/src-astro/errors/E403BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E404Basic.astro +0 -11
- package/dist/src-astro/errors/E404BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E404WithDebug.astro +0 -18
- package/dist/src-astro/errors/E500Basic.astro +0 -11
- package/dist/src-astro/errors/E500BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E503Maintenance.astro +0 -20
- package/dist/src-astro/errors/E503MaintenanceContainer.astro +0 -21
- package/dist/src-astro/errors/EErrorPageCustomStyle.astro +0 -21
- package/dist/src-astro/errors/EErrorPageCustomStyleContainer.astro +0 -21
- package/dist/src-astro/errors/EErrorPageShowcase.astro +0 -68
- package/dist/src-astro/errors/EErrorPageShowcaseContainer.astro +0 -21
- package/dist/src-astro/footer/EFooterBasic.astro +0 -18
- package/dist/src-astro/footer/EFooterBasicContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterComplete.astro +0 -50
- package/dist/src-astro/footer/EFooterCompleteContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterFeaturesContainer.astro +0 -40
- package/dist/src-astro/footer/EFooterWithLogo.astro +0 -28
- package/dist/src-astro/footer/EFooterWithLogoContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithNavigation.astro +0 -24
- package/dist/src-astro/footer/EFooterWithNavigationContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithProducts.astro +0 -24
- package/dist/src-astro/footer/EFooterWithProductsContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithSocial.astro +0 -24
- package/dist/src-astro/footer/EFooterWithSocialContainer.astro +0 -11
- package/dist/src-astro/header/HeaderBasic.astro +0 -19
- package/dist/src-astro/header/HeaderCustomNavbarCenter.astro +0 -28
- package/dist/src-astro/header/HeaderCustomNavbarEnd.astro +0 -25
- package/dist/src-astro/header/HeaderCustomNavbarStart.astro +0 -27
- package/dist/src-astro/header/HeaderCustomPosition.astro +0 -34
- package/dist/src-astro/header/HeaderWithNavigation.astro +0 -27
- package/dist/src-astro/hero/EHeroAlignCenter.astro +0 -13
- package/dist/src-astro/hero/EHeroAlignContainer.astro +0 -27
- package/dist/src-astro/hero/EHeroAlignLeft.astro +0 -13
- package/dist/src-astro/hero/EHeroAlignRight.astro +0 -13
- package/dist/src-astro/hero/EHeroBackgroundContainer.astro +0 -18
- package/dist/src-astro/hero/EHeroBackgroundImage.astro +0 -16
- package/dist/src-astro/hero/EHeroBackgroundImageContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroBasic.astro +0 -12
- package/dist/src-astro/hero/EHeroBasicContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroGradientBackground.astro +0 -10
- package/dist/src-astro/hero/EHeroPlainBackground.astro +0 -10
- package/dist/src-astro/hero/EHeroWithButton.astro +0 -14
- package/dist/src-astro/hero/EHeroWithButtonContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroWithImage.astro +0 -16
- package/dist/src-astro/hero/EHeroWithImageContainer.astro +0 -11
- package/dist/src-astro/layout-app/AppLayoutBasic.astro +0 -54
- package/dist/src-astro/layout-dashboard/DashboardLayoutBasic.astro +0 -51
@@ -0,0 +1,319 @@
|
|
1
|
+
/**
|
2
|
+
* 仪表盘组件的共享类型定义
|
3
|
+
*/
|
4
|
+
|
5
|
+
export interface NavItem {
|
6
|
+
href: string;
|
7
|
+
icon?: string; // 现在是可选的,会根据 href 自动推断
|
8
|
+
text: string;
|
9
|
+
badge?: string | number;
|
10
|
+
items?: NavItem[];
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
* 用户菜单项接口
|
15
|
+
*/
|
16
|
+
export interface UserMenuItem {
|
17
|
+
href: string;
|
18
|
+
text: string;
|
19
|
+
icon?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* 侧边栏尺寸类型
|
24
|
+
*/
|
25
|
+
export type SidebarSize = 'sm' | 'md' | 'lg' | 'xl';
|
26
|
+
|
27
|
+
/**
|
28
|
+
* 侧边栏尺寸配置映射
|
29
|
+
*/
|
30
|
+
export const sidebarSizeMap: Record<SidebarSize, string> = {
|
31
|
+
'sm': 'cosy:w-48', // 12rem (192px)
|
32
|
+
'md': 'cosy:w-64', // 16rem (256px) - 默认
|
33
|
+
'lg': 'cosy:w-72', // 18rem (288px)
|
34
|
+
'xl': 'cosy:w-80', // 20rem (320px)
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
38
|
+
* 获取侧边栏宽度样式类
|
39
|
+
* @param size 侧边栏尺寸
|
40
|
+
* @returns 对应的 CSS 类名
|
41
|
+
*/
|
42
|
+
export function getSidebarWidth(size: SidebarSize = 'md'): string {
|
43
|
+
return sidebarSizeMap[size];
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* 侧边栏背景色主题类型
|
48
|
+
*/
|
49
|
+
export type SidebarTheme = 'default' | 'dark' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
|
50
|
+
|
51
|
+
/**
|
52
|
+
* 侧边栏背景色主题配置映射
|
53
|
+
*/
|
54
|
+
export const sidebarThemeMap: Record<SidebarTheme, { bg: string; headerBg: string; textColor: string; borderColor: string }> = {
|
55
|
+
'default': {
|
56
|
+
bg: 'cosy:bg-base-300',
|
57
|
+
headerBg: 'cosy:bg-base-300',
|
58
|
+
textColor: 'cosy:text-base-content',
|
59
|
+
borderColor: 'cosy:border-base-200'
|
60
|
+
},
|
61
|
+
'dark': {
|
62
|
+
bg: 'cosy:bg-base-100',
|
63
|
+
headerBg: 'cosy:bg-base-100',
|
64
|
+
textColor: 'cosy:text-base-content',
|
65
|
+
borderColor: 'cosy:border-base-200'
|
66
|
+
},
|
67
|
+
'neutral': {
|
68
|
+
bg: 'cosy:bg-neutral',
|
69
|
+
headerBg: 'cosy:bg-neutral',
|
70
|
+
textColor: 'cosy:text-neutral-content',
|
71
|
+
borderColor: 'cosy:border-neutral-focus'
|
72
|
+
},
|
73
|
+
'primary': {
|
74
|
+
bg: 'cosy:bg-primary',
|
75
|
+
headerBg: 'cosy:bg-primary',
|
76
|
+
textColor: 'cosy:text-primary-content',
|
77
|
+
borderColor: 'cosy:border-primary-focus'
|
78
|
+
},
|
79
|
+
'secondary': {
|
80
|
+
bg: 'cosy:bg-secondary',
|
81
|
+
headerBg: 'cosy:bg-secondary',
|
82
|
+
textColor: 'cosy:text-secondary-content',
|
83
|
+
borderColor: 'cosy:border-secondary-focus'
|
84
|
+
},
|
85
|
+
'accent': {
|
86
|
+
bg: 'cosy:bg-accent',
|
87
|
+
headerBg: 'cosy:bg-accent',
|
88
|
+
textColor: 'cosy:text-accent-content',
|
89
|
+
borderColor: 'cosy:border-accent-focus'
|
90
|
+
},
|
91
|
+
'info': {
|
92
|
+
bg: 'cosy:bg-info',
|
93
|
+
headerBg: 'cosy:bg-info',
|
94
|
+
textColor: 'cosy:text-info-content',
|
95
|
+
borderColor: 'cosy:border-info-focus'
|
96
|
+
},
|
97
|
+
'success': {
|
98
|
+
bg: 'cosy:bg-success',
|
99
|
+
headerBg: 'cosy:bg-success',
|
100
|
+
textColor: 'cosy:text-success-content',
|
101
|
+
borderColor: 'cosy:border-success-focus'
|
102
|
+
},
|
103
|
+
'warning': {
|
104
|
+
bg: 'cosy:bg-warning',
|
105
|
+
headerBg: 'cosy:bg-warning',
|
106
|
+
textColor: 'cosy:text-warning-content',
|
107
|
+
borderColor: 'cosy:border-warning-focus'
|
108
|
+
},
|
109
|
+
'error': {
|
110
|
+
bg: 'cosy:bg-error',
|
111
|
+
headerBg: 'cosy:bg-error',
|
112
|
+
textColor: 'cosy:text-error-content',
|
113
|
+
borderColor: 'cosy:border-error-focus'
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
/**
|
118
|
+
* 获取侧边栏主题样式类
|
119
|
+
* @param theme 侧边栏主题
|
120
|
+
* @returns 对应的样式配置
|
121
|
+
*/
|
122
|
+
export function getSidebarTheme(theme: SidebarTheme = 'default') {
|
123
|
+
return sidebarThemeMap[theme];
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* 主内容区域背景主题类型
|
128
|
+
*/
|
129
|
+
export type MainBackgroundTheme = 'transparent' | 'base-100' | 'base-200' | 'base-300' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'gradient-warm' | 'gradient-cool' | 'gradient-rainbow' | 'gradient-sunset' | 'gradient-ocean' | 'gradient-forest';
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
/**
|
134
|
+
* 主内容区域背景主题配置映射
|
135
|
+
*/
|
136
|
+
export const mainBackgroundThemeMap: Record<MainBackgroundTheme, string> = {
|
137
|
+
'transparent': '',
|
138
|
+
'base-100': 'cosy:bg-base-100',
|
139
|
+
'base-200': 'cosy:bg-base-200',
|
140
|
+
'base-300': 'cosy:bg-base-300',
|
141
|
+
'neutral': 'cosy:bg-neutral',
|
142
|
+
'primary': 'cosy:bg-primary',
|
143
|
+
'secondary': 'cosy:bg-secondary',
|
144
|
+
'accent': 'cosy:bg-accent',
|
145
|
+
'info': 'cosy:bg-info',
|
146
|
+
'success': 'cosy:bg-success',
|
147
|
+
'warning': 'cosy:bg-warning',
|
148
|
+
'error': 'cosy:bg-error',
|
149
|
+
'gradient-warm': 'cosy:bg-gradient-to-br cosy:from-orange-100 cosy:via-red-50 cosy:to-pink-100',
|
150
|
+
'gradient-cool': 'cosy:bg-gradient-to-br cosy:from-blue-100 cosy:via-cyan-50 cosy:to-green-100',
|
151
|
+
'gradient-rainbow': 'cosy:bg-gradient-to-br cosy:from-purple-100 cosy:via-pink-50 cosy:to-blue-100',
|
152
|
+
'gradient-sunset': 'cosy:bg-gradient-to-br cosy:from-yellow-100 cosy:via-orange-50 cosy:to-red-100',
|
153
|
+
'gradient-ocean': 'cosy:bg-gradient-to-br cosy:from-blue-100 cosy:via-teal-50 cosy:to-cyan-100',
|
154
|
+
'gradient-forest': 'cosy:bg-gradient-to-br cosy:from-green-100 cosy:via-emerald-50 cosy:to-teal-100'
|
155
|
+
};
|
156
|
+
|
157
|
+
/**
|
158
|
+
* 获取主内容区域背景主题样式类
|
159
|
+
* @param theme 主内容区域背景主题
|
160
|
+
* @returns 对应的样式类名
|
161
|
+
*/
|
162
|
+
export function getMainBackgroundTheme(theme: MainBackgroundTheme = 'transparent'): string {
|
163
|
+
return mainBackgroundThemeMap[theme];
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* 基于 href 关键词匹配图标名称的映射表
|
168
|
+
*/
|
169
|
+
const hrefToIconMap: Record<string, string> = {
|
170
|
+
// 主页相关
|
171
|
+
'dashboard': 'dashboard',
|
172
|
+
'home': 'home',
|
173
|
+
'index': 'home',
|
174
|
+
|
175
|
+
// 用户相关
|
176
|
+
'user': 'user',
|
177
|
+
'users': 'users',
|
178
|
+
'profile': 'user',
|
179
|
+
'account': 'user',
|
180
|
+
'member': 'users',
|
181
|
+
'team': 'users',
|
182
|
+
|
183
|
+
// 设置相关
|
184
|
+
'setting': 'settings',
|
185
|
+
'config': 'settings',
|
186
|
+
'preference': 'settings',
|
187
|
+
'admin': 'settings',
|
188
|
+
'manage': 'settings',
|
189
|
+
'tool': 'tools',
|
190
|
+
|
191
|
+
// 数据相关
|
192
|
+
'chart': 'chart',
|
193
|
+
'analytics': 'chart',
|
194
|
+
'report': 'report',
|
195
|
+
'statistic': 'chart',
|
196
|
+
'data': 'chart',
|
197
|
+
|
198
|
+
// 文档相关
|
199
|
+
'doc': 'document',
|
200
|
+
'document': 'document',
|
201
|
+
'file': 'document',
|
202
|
+
'page': 'document',
|
203
|
+
'article': 'document',
|
204
|
+
'content': 'document',
|
205
|
+
|
206
|
+
// 日历和时间
|
207
|
+
'calendar': 'calendar',
|
208
|
+
'schedule': 'calendar',
|
209
|
+
'event': 'calendar',
|
210
|
+
'date': 'calendar',
|
211
|
+
|
212
|
+
// 通知和消息
|
213
|
+
'notification': 'notification',
|
214
|
+
'message': 'message',
|
215
|
+
'chat': 'message',
|
216
|
+
'mail': 'mail',
|
217
|
+
'email': 'mail',
|
218
|
+
'inbox': 'inboxArchive',
|
219
|
+
|
220
|
+
// 搜索
|
221
|
+
'search': 'search',
|
222
|
+
'find': 'search',
|
223
|
+
|
224
|
+
// 收藏和标记
|
225
|
+
'favorite': 'star',
|
226
|
+
'bookmark': 'star',
|
227
|
+
'star': 'star',
|
228
|
+
'like': 'heart',
|
229
|
+
|
230
|
+
// 文件夹和目录
|
231
|
+
'folder': 'folder',
|
232
|
+
'directory': 'folder',
|
233
|
+
'category': 'folder',
|
234
|
+
|
235
|
+
// 安全和权限
|
236
|
+
'security': 'security',
|
237
|
+
'permission': 'security',
|
238
|
+
'auth': 'security',
|
239
|
+
'login': 'security',
|
240
|
+
|
241
|
+
// 财务相关
|
242
|
+
'payment': 'wallet',
|
243
|
+
'billing': 'wallet',
|
244
|
+
'finance': 'wallet',
|
245
|
+
'money': 'wallet',
|
246
|
+
'wallet': 'wallet',
|
247
|
+
|
248
|
+
// 操作相关
|
249
|
+
'edit': 'edit',
|
250
|
+
'delete': 'delete',
|
251
|
+
'remove': 'delete',
|
252
|
+
'save': 'save',
|
253
|
+
'download': 'download',
|
254
|
+
'upload': 'upload',
|
255
|
+
'refresh': 'refresh',
|
256
|
+
'logout': 'logout',
|
257
|
+
'signin': 'login',
|
258
|
+
'signout': 'logout',
|
259
|
+
'exit': 'logout',
|
260
|
+
|
261
|
+
// 工具和实用程序
|
262
|
+
'clipboard': 'clipboard',
|
263
|
+
'link': 'link',
|
264
|
+
'menu': 'menu',
|
265
|
+
'close': 'close',
|
266
|
+
'check': 'check',
|
267
|
+
'help': 'help',
|
268
|
+
'support': 'help',
|
269
|
+
};
|
270
|
+
|
271
|
+
/**
|
272
|
+
* 根据 href 自动推断图标名称
|
273
|
+
* @param href 链接地址
|
274
|
+
* @param fallbackIcon 如果匹配失败时使用的默认图标
|
275
|
+
* @returns 图标名称
|
276
|
+
*/
|
277
|
+
export function getIconFromHref(href: string, fallbackIcon: string = 'folder'): string {
|
278
|
+
// 将 href 转换为小写并移除路径分隔符
|
279
|
+
const normalizedHref = href.toLowerCase().replace(/[\/\-_]/g, '');
|
280
|
+
|
281
|
+
// 遍历映射表,找到匹配的关键词
|
282
|
+
for (const [keyword, iconName] of Object.entries(hrefToIconMap)) {
|
283
|
+
if (normalizedHref.includes(keyword)) {
|
284
|
+
return iconName;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
return fallbackIcon;
|
289
|
+
}
|
290
|
+
|
291
|
+
/**
|
292
|
+
* 根据 NavItem 获取完整的图标信息
|
293
|
+
* @param item 导航项
|
294
|
+
* @returns 图标名称
|
295
|
+
*/
|
296
|
+
export function getNavItemIcon(item: NavItem): string {
|
297
|
+
// 如果显式指定了图标,优先使用
|
298
|
+
if (item.icon) {
|
299
|
+
return item.icon;
|
300
|
+
}
|
301
|
+
|
302
|
+
// 否则根据 href 自动推断
|
303
|
+
return getIconFromHref(item.href);
|
304
|
+
}
|
305
|
+
|
306
|
+
/**
|
307
|
+
* 根据 UserMenuItem 获取完整的图标信息
|
308
|
+
* @param item 用户菜单项
|
309
|
+
* @returns 图标名称
|
310
|
+
*/
|
311
|
+
export function getUserMenuItemIcon(item: UserMenuItem): string {
|
312
|
+
// 如果显式指定了图标,优先使用
|
313
|
+
if (item.icon) {
|
314
|
+
return item.icon;
|
315
|
+
}
|
316
|
+
|
317
|
+
// 否则根据 href 自动推断,用户菜单默认图标为 'user'
|
318
|
+
return getIconFromHref(item.href, 'user');
|
319
|
+
}
|
package/package.json
CHANGED
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { CodeContainer } from '../../index-astro';
|
3
|
-
import AlertBasic from './EAlertBasic.astro';
|
4
|
-
import AlertBasicSourceCode from './EAlertBasic.astro?raw';
|
5
|
-
---
|
6
|
-
|
7
|
-
<CodeContainer codes={[AlertBasicSourceCode]}>
|
8
|
-
<div id="tab-1">
|
9
|
-
<AlertBasic />
|
10
|
-
</div>
|
11
|
-
</CodeContainer>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* @component Alert.CustomStyle
|
4
|
-
*
|
5
|
-
* @description
|
6
|
-
* 展示如何使用class属性自定义Alert组件的样式。
|
7
|
-
*/
|
8
|
-
import '../../style.ts';
|
9
|
-
import { Alert } from '../../index-astro';
|
10
|
-
---
|
11
|
-
|
12
|
-
<Alert
|
13
|
-
type="info"
|
14
|
-
class="cosy:bg-purple-100 cosy:text-purple-800 cosy:border-purple-300">
|
15
|
-
这是一个自定义样式的提示框
|
16
|
-
</Alert>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { CodeContainer } from '../../index-astro';
|
3
|
-
import AlertCustomStyle from './EAlertCustomStyle.astro';
|
4
|
-
import AlertCustomStyleSourceCode from './EAlertCustomStyle.astro?raw';
|
5
|
-
---
|
6
|
-
|
7
|
-
<CodeContainer codes={[AlertCustomStyleSourceCode]}>
|
8
|
-
<div id="tab-1">
|
9
|
-
<AlertCustomStyle />
|
10
|
-
</div>
|
11
|
-
</CodeContainer>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* @component Alert.Types
|
4
|
-
*
|
5
|
-
* @description
|
6
|
-
* 展示Alert组件的所有类型:info、success、warning、error。
|
7
|
-
*/
|
8
|
-
import '../../style.ts';
|
9
|
-
import { CodeContainer } from '../../index-astro';
|
10
|
-
import AlertInfo from './EAlertInfo.astro';
|
11
|
-
import AlertSuccess from './EAlertSuccess.astro';
|
12
|
-
import AlertWarning from './EAlertWarning.astro';
|
13
|
-
import AlertError from './EAlertError.astro';
|
14
|
-
import AlertInfoSourceCode from './EAlertInfo.astro?raw';
|
15
|
-
import AlertSuccessSourceCode from './EAlertSuccess.astro?raw';
|
16
|
-
import AlertWarningSourceCode from './EAlertWarning.astro?raw';
|
17
|
-
import AlertErrorSourceCode from './EAlertError.astro?raw';
|
18
|
-
---
|
19
|
-
|
20
|
-
<CodeContainer
|
21
|
-
titles={['Info', 'Success', 'Warning', 'Error']}
|
22
|
-
codes={[
|
23
|
-
AlertInfoSourceCode,
|
24
|
-
AlertSuccessSourceCode,
|
25
|
-
AlertWarningSourceCode,
|
26
|
-
AlertErrorSourceCode,
|
27
|
-
]}>
|
28
|
-
<div id="tab-1">
|
29
|
-
<AlertInfo />
|
30
|
-
</div>
|
31
|
-
|
32
|
-
<div id="tab-2">
|
33
|
-
<AlertSuccess />
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="tab-3">
|
37
|
-
<AlertWarning />
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<div id="tab-4">
|
41
|
-
<AlertError />
|
42
|
-
</div>
|
43
|
-
</CodeContainer>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { CodeContainer } from '../../index-astro';
|
3
|
-
import AlertWithTitle from './EAlertWithTitle.astro';
|
4
|
-
import WithTitleSourceCode from './EAlertWithTitle.astro?raw';
|
5
|
-
---
|
6
|
-
|
7
|
-
<CodeContainer codes={[WithTitleSourceCode]}>
|
8
|
-
<div id="tab-1">
|
9
|
-
<AlertWithTitle />
|
10
|
-
</div>
|
11
|
-
</CodeContainer>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import Button from './Button.astro';
|
3
|
-
---
|
4
|
-
|
5
|
-
<div class="cosy:flex cosy:flex-wrap cosy:gap-2">
|
6
|
-
<Button>默认按钮</Button>
|
7
|
-
<Button variant="primary">主要按钮</Button>
|
8
|
-
<Button variant="secondary">次要按钮</Button>
|
9
|
-
<Button variant="accent">强调按钮</Button>
|
10
|
-
<Button variant="info">信息按钮</Button>
|
11
|
-
<Button variant="success">成功按钮</Button>
|
12
|
-
<Button variant="warning">警告按钮</Button>
|
13
|
-
<Button variant="error">错误按钮</Button>
|
14
|
-
<Button variant="ghost">幽灵按钮</Button>
|
15
|
-
<Button variant="link">链接按钮</Button>
|
16
|
-
<Button variant="outline">轮廓按钮</Button>
|
17
|
-
<Button variant="neutral">中性按钮</Button>
|
18
|
-
</div>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { CodeContainer } from '../../index-astro';
|
3
|
-
import ButtonBasic from './ButtonBasic.astro';
|
4
|
-
import ButtonBasicSourceCode from './ButtonBasic.astro?raw';
|
5
|
-
---
|
6
|
-
|
7
|
-
<CodeContainer codes={[ButtonBasicSourceCode]} titles={['Basic']}>
|
8
|
-
<div id="tab-1">
|
9
|
-
<ButtonBasic />
|
10
|
-
</div>
|
11
|
-
</CodeContainer>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { CodeContainer } from '../../index-astro';
|
3
|
-
import ButtonLink from './ButtonLink.astro';
|
4
|
-
import ButtonLinkExternal from './ButtonLinkExternal.astro';
|
5
|
-
import ButtonLinkSourceCode from './ButtonLink.astro?raw';
|
6
|
-
import ButtonLinkExternalSourceCode from './ButtonLinkExternal.astro?raw';
|
7
|
-
---
|
8
|
-
|
9
|
-
<CodeContainer
|
10
|
-
titles={['基础链接', '外部链接', 'Vue']}
|
11
|
-
codes={[ButtonLinkSourceCode, ButtonLinkExternalSourceCode]}>
|
12
|
-
<div id="tab-1">
|
13
|
-
<ButtonLink />
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<div id="tab-2">
|
17
|
-
<ButtonLinkExternal />
|
18
|
-
</div>
|
19
|
-
</CodeContainer>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import Button from './Button.astro';
|
3
|
-
---
|
4
|
-
|
5
|
-
<div class="cosy:flex cosy:flex-wrap cosy:gap-2">
|
6
|
-
<Button>默认形状</Button>
|
7
|
-
|
8
|
-
<Button shape="circle" variant="primary">
|
9
|
-
<span slot="icon-left">🔄</span>
|
10
|
-
</Button>
|
11
|
-
|
12
|
-
<Button shape="square" variant="success">
|
13
|
-
<span slot="icon-left">✨</span>
|
14
|
-
</Button>
|
15
|
-
|
16
|
-
<Button shape="circle" variant="warning" size="lg">
|
17
|
-
<span slot="icon-left">⚡</span>
|
18
|
-
</Button>
|
19
|
-
|
20
|
-
<Button shape="square" variant="error" size="sm">
|
21
|
-
<span slot="icon-left">❌</span>
|
22
|
-
</Button>
|
23
|
-
</div>
|