@huyooo/file-explorer-frontend-vue 0.4.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/dist/components/Breadcrumb.vue.d.ts +11 -0
- package/dist/components/Breadcrumb.vue.d.ts.map +1 -0
- package/dist/components/CompressDialog.vue.d.ts +16 -0
- package/dist/components/CompressDialog.vue.d.ts.map +1 -0
- package/dist/components/ContextMenu.vue.d.ts +18 -0
- package/dist/components/ContextMenu.vue.d.ts.map +1 -0
- package/dist/components/FileGrid.vue.d.ts +40 -0
- package/dist/components/FileGrid.vue.d.ts.map +1 -0
- package/dist/components/FileIcon.vue.d.ts +13 -0
- package/dist/components/FileIcon.vue.d.ts.map +1 -0
- package/dist/components/FileInfoDialog.vue.d.ts +14 -0
- package/dist/components/FileInfoDialog.vue.d.ts.map +1 -0
- package/dist/components/FileList.vue.d.ts +37 -0
- package/dist/components/FileList.vue.d.ts.map +1 -0
- package/dist/components/FileListView.vue.d.ts +43 -0
- package/dist/components/FileListView.vue.d.ts.map +1 -0
- package/dist/components/FileSidebar.vue.d.ts +17 -0
- package/dist/components/FileSidebar.vue.d.ts.map +1 -0
- package/dist/components/ProgressDialog.vue.d.ts +28 -0
- package/dist/components/ProgressDialog.vue.d.ts.map +1 -0
- package/dist/components/SortIndicator.vue.d.ts +6 -0
- package/dist/components/SortIndicator.vue.d.ts.map +1 -0
- package/dist/components/StatusBar.vue.d.ts +27 -0
- package/dist/components/StatusBar.vue.d.ts.map +1 -0
- package/dist/components/Toolbar.vue.d.ts +60 -0
- package/dist/components/Toolbar.vue.d.ts.map +1 -0
- package/dist/components/Window.vue.d.ts +65 -0
- package/dist/components/Window.vue.d.ts.map +1 -0
- package/dist/composables/useApplicationIcon.d.ts +16 -0
- package/dist/composables/useApplicationIcon.d.ts.map +1 -0
- package/dist/composables/useDragAndDrop.d.ts +14 -0
- package/dist/composables/useDragAndDrop.d.ts.map +1 -0
- package/dist/composables/useMediaPlayer.d.ts +24 -0
- package/dist/composables/useMediaPlayer.d.ts.map +1 -0
- package/dist/composables/useSelection.d.ts +15 -0
- package/dist/composables/useSelection.d.ts.map +1 -0
- package/dist/composables/useWindowDrag.d.ts +18 -0
- package/dist/composables/useWindowDrag.d.ts.map +1 -0
- package/dist/composables/useWindowResize.d.ts +12 -0
- package/dist/composables/useWindowResize.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4051 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +268 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/fileTypeIcon.d.ts +6 -0
- package/dist/utils/fileTypeIcon.d.ts.map +1 -0
- package/dist/utils/folderTypeIcon.d.ts +14 -0
- package/dist/utils/folderTypeIcon.d.ts.map +1 -0
- package/package.json +55 -0
- package/src/components/Breadcrumb.vue +111 -0
- package/src/components/CompressDialog.vue +478 -0
- package/src/components/ContextMenu.vue +550 -0
- package/src/components/FileGrid.vue +504 -0
- package/src/components/FileIcon.vue +132 -0
- package/src/components/FileInfoDialog.vue +465 -0
- package/src/components/FileList.vue +421 -0
- package/src/components/FileListView.vue +321 -0
- package/src/components/FileSidebar.vue +158 -0
- package/src/components/ProgressDialog.vue +368 -0
- package/src/components/SortIndicator.vue +22 -0
- package/src/components/StatusBar.vue +43 -0
- package/src/components/Toolbar.vue +271 -0
- package/src/components/Window.vue +561 -0
- package/src/composables/useApplicationIcon.ts +79 -0
- package/src/composables/useDragAndDrop.ts +103 -0
- package/src/composables/useMediaPlayer.ts +174 -0
- package/src/composables/useSelection.ts +107 -0
- package/src/composables/useWindowDrag.ts +66 -0
- package/src/composables/useWindowResize.ts +134 -0
- package/src/index.ts +32 -0
- package/src/types/index.ts +273 -0
- package/src/utils/fileTypeIcon.ts +309 -0
- package/src/utils/folderTypeIcon.ts +132 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件类型(使用 const object 而非 enum,更好的 tree-shaking)
|
|
3
|
+
*/
|
|
4
|
+
export declare const FileType: {
|
|
5
|
+
readonly FOLDER: "folder";
|
|
6
|
+
readonly FILE: "file";
|
|
7
|
+
readonly IMAGE: "image";
|
|
8
|
+
readonly VIDEO: "video";
|
|
9
|
+
readonly MUSIC: "music";
|
|
10
|
+
readonly DOCUMENT: "document";
|
|
11
|
+
readonly CODE: "code";
|
|
12
|
+
readonly TEXT: "text";
|
|
13
|
+
readonly PDF: "pdf";
|
|
14
|
+
readonly ARCHIVE: "archive";
|
|
15
|
+
readonly APPLICATION: "application";
|
|
16
|
+
readonly UNKNOWN: "unknown";
|
|
17
|
+
};
|
|
18
|
+
export type FileType = typeof FileType[keyof typeof FileType];
|
|
19
|
+
/**
|
|
20
|
+
* 文件系统项
|
|
21
|
+
*/
|
|
22
|
+
export interface FileItem {
|
|
23
|
+
/** 唯一标识(通常是完整路径) */
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
type: FileType;
|
|
27
|
+
size?: string;
|
|
28
|
+
dateModified?: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
thumbnailUrl?: string;
|
|
31
|
+
children?: FileItem[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 视图模式
|
|
35
|
+
*/
|
|
36
|
+
export type ViewMode = 'grid' | 'list' | 'columns';
|
|
37
|
+
/**
|
|
38
|
+
* 排序配置
|
|
39
|
+
*/
|
|
40
|
+
export interface SortConfig {
|
|
41
|
+
field: 'name' | 'dateModified' | 'size' | 'type';
|
|
42
|
+
direction: 'asc' | 'desc';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 侧边栏项目
|
|
46
|
+
*/
|
|
47
|
+
export interface SidebarItem {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
icon?: string;
|
|
51
|
+
path?: string;
|
|
52
|
+
children?: SidebarItem[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 面包屑项
|
|
56
|
+
*/
|
|
57
|
+
export interface BreadcrumbItem {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 操作结果
|
|
63
|
+
*/
|
|
64
|
+
export interface OperationResult<T = void> {
|
|
65
|
+
success: boolean;
|
|
66
|
+
data?: T;
|
|
67
|
+
error?: string;
|
|
68
|
+
}
|
|
69
|
+
/** 压缩格式 */
|
|
70
|
+
export type CompressFormat = 'zip' | 'tar' | 'tgz' | 'tarbz2';
|
|
71
|
+
/** 压缩级别 */
|
|
72
|
+
export type CompressLevel = 'fast' | 'normal' | 'best';
|
|
73
|
+
/** 压缩选项 */
|
|
74
|
+
export interface CompressOptions {
|
|
75
|
+
format: CompressFormat;
|
|
76
|
+
level?: CompressLevel;
|
|
77
|
+
outputName: string;
|
|
78
|
+
outputDir: string;
|
|
79
|
+
deleteSource?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** 解压选项 */
|
|
82
|
+
export interface ExtractOptions {
|
|
83
|
+
targetDir: string;
|
|
84
|
+
deleteArchive?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** 压缩进度 */
|
|
87
|
+
export interface CompressProgress {
|
|
88
|
+
currentFile: string;
|
|
89
|
+
processedCount: number;
|
|
90
|
+
totalCount: number;
|
|
91
|
+
percent: number;
|
|
92
|
+
}
|
|
93
|
+
/** 压缩结果 */
|
|
94
|
+
export interface CompressResult {
|
|
95
|
+
success: boolean;
|
|
96
|
+
outputPath?: string;
|
|
97
|
+
error?: string;
|
|
98
|
+
}
|
|
99
|
+
/** 进度状态 */
|
|
100
|
+
export type ProgressStatus = 'pending' | 'processing' | 'success' | 'error';
|
|
101
|
+
/** 进度信息(UI 使用) */
|
|
102
|
+
export interface ProgressInfo {
|
|
103
|
+
type: 'compress' | 'extract';
|
|
104
|
+
status: ProgressStatus;
|
|
105
|
+
percent: number;
|
|
106
|
+
currentFile?: string;
|
|
107
|
+
processedCount?: number;
|
|
108
|
+
totalCount?: number;
|
|
109
|
+
error?: string;
|
|
110
|
+
outputPath?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 文件操作适配器接口
|
|
114
|
+
*/
|
|
115
|
+
export interface FileExplorerAdapter {
|
|
116
|
+
/** 读取目录 */
|
|
117
|
+
readDirectory(dirPath: string): Promise<FileItem[]>;
|
|
118
|
+
/** 读取系统路径目录 */
|
|
119
|
+
readSystemPath(pathId: string): Promise<FileItem[]>;
|
|
120
|
+
/** 获取系统路径 */
|
|
121
|
+
getSystemPath(pathId: string): Promise<string | null>;
|
|
122
|
+
/** 读取文件内容 */
|
|
123
|
+
readFileContent(filePath: string): Promise<string>;
|
|
124
|
+
/** 写入文件内容 */
|
|
125
|
+
writeFileContent(filePath: string, content: string): Promise<OperationResult>;
|
|
126
|
+
/** 创建文件夹 */
|
|
127
|
+
createFolder(parentDir: string, folderName: string): Promise<OperationResult<{
|
|
128
|
+
finalPath: string;
|
|
129
|
+
}>>;
|
|
130
|
+
/** 创建文件 */
|
|
131
|
+
createFile(parentDir: string, fileName: string, content?: string): Promise<OperationResult<{
|
|
132
|
+
finalPath: string;
|
|
133
|
+
}>>;
|
|
134
|
+
/** 删除文件 */
|
|
135
|
+
deleteFiles(paths: string[]): Promise<OperationResult>;
|
|
136
|
+
/** 重命名文件 */
|
|
137
|
+
renameFile(oldPath: string, newPath: string): Promise<OperationResult>;
|
|
138
|
+
/** 复制文件 */
|
|
139
|
+
copyFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
140
|
+
copiedPaths: string[];
|
|
141
|
+
}>>;
|
|
142
|
+
/** 移动文件 */
|
|
143
|
+
moveFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
144
|
+
movedPaths: string[];
|
|
145
|
+
}>>;
|
|
146
|
+
/** 使用系统默认应用打开 */
|
|
147
|
+
openPath(filePath: string): Promise<OperationResult>;
|
|
148
|
+
/** 复制文件到剪贴板 */
|
|
149
|
+
copyFilesToClipboard(filePaths: string[]): Promise<OperationResult>;
|
|
150
|
+
/** 获取剪贴板文件 */
|
|
151
|
+
getClipboardFiles(): Promise<OperationResult<{
|
|
152
|
+
files: string[];
|
|
153
|
+
}>>;
|
|
154
|
+
/** 粘贴文件 */
|
|
155
|
+
pasteFiles(targetDir: string, sourcePaths: string[]): Promise<OperationResult<{
|
|
156
|
+
pastedPaths: string[];
|
|
157
|
+
}>>;
|
|
158
|
+
/** 流式搜索文件 */
|
|
159
|
+
searchFilesStream(searchPath: string, pattern: string, searchId: string): Promise<OperationResult>;
|
|
160
|
+
/** 监听搜索结果 */
|
|
161
|
+
onSearchResults(callback: (data: {
|
|
162
|
+
searchId: string;
|
|
163
|
+
items: FileItem[];
|
|
164
|
+
done: boolean;
|
|
165
|
+
}) => void): () => void;
|
|
166
|
+
/** 压缩文件 */
|
|
167
|
+
compressFiles(sources: string[], options: CompressOptions): Promise<CompressResult>;
|
|
168
|
+
/** 解压文件 */
|
|
169
|
+
extractArchive(archivePath: string, options: ExtractOptions): Promise<CompressResult>;
|
|
170
|
+
/** 判断是否为压缩文件 */
|
|
171
|
+
isArchiveFile(filePath: string): Promise<boolean>;
|
|
172
|
+
/** 监听压缩进度 */
|
|
173
|
+
onCompressProgress(callback: (data: CompressProgress) => void): () => void;
|
|
174
|
+
/** 监听解压进度 */
|
|
175
|
+
onExtractProgress(callback: (data: CompressProgress) => void): () => void;
|
|
176
|
+
/** 监听目录变化 */
|
|
177
|
+
watchDirectory(dirPath: string, watchId: string): Promise<OperationResult>;
|
|
178
|
+
/** 停止监听目录 */
|
|
179
|
+
unwatchDirectory(watchId: string): Promise<OperationResult>;
|
|
180
|
+
/** 监听文件变化事件 */
|
|
181
|
+
onWatchEvent(callback: (data: {
|
|
182
|
+
watchId: string;
|
|
183
|
+
event: WatchEvent;
|
|
184
|
+
}) => void): () => void;
|
|
185
|
+
/** 显示文件/文件夹的系统属性窗口 */
|
|
186
|
+
showFileInfo(filePath: string): Promise<OperationResult>;
|
|
187
|
+
/** 在终端中打开目录 */
|
|
188
|
+
openInTerminal(dirPath: string): Promise<OperationResult>;
|
|
189
|
+
/** 通过 Cursor 打开 */
|
|
190
|
+
openInEditor(targetPath: string): Promise<OperationResult>;
|
|
191
|
+
/** 在新窗口中打开文件夹(使用系统文件管理器) */
|
|
192
|
+
openInNewWindow(folderPath: string): Promise<OperationResult>;
|
|
193
|
+
/** 请求窗口聚焦(用于右键打开菜单前激活窗口) */
|
|
194
|
+
requestWindowFocus(): void;
|
|
195
|
+
/** 检测媒体文件是否需要转码 */
|
|
196
|
+
mediaNeedsTranscode?(filePath: string): Promise<OperationResult<TranscodeInfo>>;
|
|
197
|
+
/** 获取可播放的媒体 URL(自动转码) */
|
|
198
|
+
mediaGetPlayableUrl?(filePath: string): Promise<{
|
|
199
|
+
success: boolean;
|
|
200
|
+
url?: string;
|
|
201
|
+
error?: string;
|
|
202
|
+
}>;
|
|
203
|
+
/** 获取媒体元数据 */
|
|
204
|
+
mediaGetMetadata?(filePath: string): Promise<OperationResult<MediaMetadata>>;
|
|
205
|
+
/** 监听转码进度 */
|
|
206
|
+
onMediaTranscodeProgress?(callback: (data: {
|
|
207
|
+
filePath: string;
|
|
208
|
+
progress: MediaTranscodeProgress;
|
|
209
|
+
}) => void): () => void;
|
|
210
|
+
/** 清理指定文件的转码缓存 */
|
|
211
|
+
mediaCleanupFile?(filePath: string): Promise<OperationResult>;
|
|
212
|
+
/** 打开媒体预览窗口(原生窗口) */
|
|
213
|
+
openMediaPreviewWindow?(filePath: string, mediaType: 'image' | 'video' | 'audio'): Promise<OperationResult>;
|
|
214
|
+
/** 关闭媒体预览窗口 */
|
|
215
|
+
closeMediaPreviewWindow?(filePath: string): Promise<OperationResult>;
|
|
216
|
+
}
|
|
217
|
+
/** 文件变化事件类型 */
|
|
218
|
+
export type WatchEventType = 'add' | 'change' | 'remove' | 'rename';
|
|
219
|
+
/** 文件变化事件 */
|
|
220
|
+
export interface WatchEvent {
|
|
221
|
+
type: WatchEventType;
|
|
222
|
+
path: string;
|
|
223
|
+
filename: string;
|
|
224
|
+
}
|
|
225
|
+
/** 媒体转码方式 */
|
|
226
|
+
export type TranscodeMethod = 'direct' | 'remux' | 'transcode';
|
|
227
|
+
/** 媒体转码状态 */
|
|
228
|
+
export type TranscodeStatus = 'idle' | 'checking' | 'transcoding' | 'ready' | 'error';
|
|
229
|
+
/** 媒体转码信息 */
|
|
230
|
+
export interface TranscodeInfo {
|
|
231
|
+
type: 'video' | 'audio';
|
|
232
|
+
needsTranscode: boolean;
|
|
233
|
+
method: TranscodeMethod;
|
|
234
|
+
estimatedTime?: number;
|
|
235
|
+
targetFormat?: string;
|
|
236
|
+
}
|
|
237
|
+
/** 媒体转码进度 */
|
|
238
|
+
export interface MediaTranscodeProgress {
|
|
239
|
+
percent: number;
|
|
240
|
+
time?: number;
|
|
241
|
+
duration?: number;
|
|
242
|
+
speed?: string;
|
|
243
|
+
}
|
|
244
|
+
/** 媒体元数据 */
|
|
245
|
+
export interface MediaMetadata {
|
|
246
|
+
filePath: string;
|
|
247
|
+
type: 'video' | 'audio';
|
|
248
|
+
duration: number;
|
|
249
|
+
title?: string;
|
|
250
|
+
artist?: string;
|
|
251
|
+
album?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 右键菜单项
|
|
255
|
+
*/
|
|
256
|
+
export interface ContextMenuItem {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
icon?: string;
|
|
260
|
+
shortcut?: string;
|
|
261
|
+
disabled?: boolean;
|
|
262
|
+
separator?: boolean;
|
|
263
|
+
danger?: boolean;
|
|
264
|
+
checked?: boolean;
|
|
265
|
+
action?: () => void;
|
|
266
|
+
children?: ContextMenuItem[];
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.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夹图标映射(基于 material-icon-theme.json)
|
|
3
|
+
*
|
|
4
|
+
* 原理:
|
|
5
|
+
* 1. KNOWN_TYPES:从 material-icon-theme.json 提取的所有 folder-{type} 类型
|
|
6
|
+
* 2. ALIASES:常见变体映射到标准名
|
|
7
|
+
* 3. 逻辑:目录名小写 → 查别名 → 查白名单 → 命中则返回 material-icon-theme:folder-{type}
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 根据文件夹名称获取对应的 material-icon-theme 图标名
|
|
11
|
+
* @returns 图标名 或 undefined(让上层兜底默认图标)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getFolderTypeIcon(folderName: string): string | undefined;
|
|
14
|
+
//# sourceMappingURL=folderTypeIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folderTypeIcon.d.ts","sourceRoot":"","sources":["../../src/utils/folderTypeIcon.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4GH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYxE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@huyooo/file-explorer-frontend-vue",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "File Explorer Frontend - Vue components for file management",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"development": "./src/index.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./style.css": "./dist/index.css"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "vite build",
|
|
24
|
+
"dev": "vite build --watch",
|
|
25
|
+
"typecheck": "vue-tsc --noEmit",
|
|
26
|
+
"clean": "rm -rf dist"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"vue": "^3.4.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@iconify/vue": "^5.0.0",
|
|
33
|
+
"lucide-vue-next": "^0.460.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
38
|
+
"typescript": "^5.0.0",
|
|
39
|
+
"vite": "^6.0.0",
|
|
40
|
+
"vite-plugin-dts": "^4.0.0",
|
|
41
|
+
"vue": "^3.4.0",
|
|
42
|
+
"vue-tsc": "^2.0.0"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"file",
|
|
46
|
+
"explorer",
|
|
47
|
+
"vue",
|
|
48
|
+
"frontend"
|
|
49
|
+
],
|
|
50
|
+
"author": "huyooo",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="file-breadcrumb">
|
|
3
|
+
<span
|
|
4
|
+
v-for="(item, index) in items"
|
|
5
|
+
:key="item.id"
|
|
6
|
+
class="file-breadcrumb-item"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
@click="handleClick(item, index)"
|
|
10
|
+
:class="[
|
|
11
|
+
'file-breadcrumb-link',
|
|
12
|
+
index === items.length - 1 ? 'file-breadcrumb-link--current' : ''
|
|
13
|
+
]"
|
|
14
|
+
>
|
|
15
|
+
{{ item.name }}
|
|
16
|
+
</span>
|
|
17
|
+
<Icon
|
|
18
|
+
v-if="index < items.length - 1"
|
|
19
|
+
icon="lucide:chevron-right"
|
|
20
|
+
:width="14"
|
|
21
|
+
:height="14"
|
|
22
|
+
class="file-breadcrumb-separator"
|
|
23
|
+
/>
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { Icon } from '@iconify/vue';
|
|
30
|
+
import type { BreadcrumbItem } from '../types';
|
|
31
|
+
|
|
32
|
+
// Props
|
|
33
|
+
const props = defineProps<{
|
|
34
|
+
items: BreadcrumbItem[];
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
// Events
|
|
38
|
+
const emit = defineEmits<{
|
|
39
|
+
(e: 'navigate', item: BreadcrumbItem, index: number): void;
|
|
40
|
+
}>();
|
|
41
|
+
|
|
42
|
+
const handleClick = (item: BreadcrumbItem, index: number) => {
|
|
43
|
+
// 点击最后一项不触发导航
|
|
44
|
+
if (index < props.items.length - 1) {
|
|
45
|
+
emit('navigate', item, index);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
.file-breadcrumb {
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 0.125rem;
|
|
55
|
+
overflow-x: auto;
|
|
56
|
+
padding: 0 0.25rem;
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
scrollbar-width: none;
|
|
59
|
+
-ms-overflow-style: none;
|
|
60
|
+
-webkit-app-region: no-drag; /* 面包屑内容不可拖拽,但空白区域可拖拽 */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.file-breadcrumb::-webkit-scrollbar {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.file-breadcrumb-item {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.file-breadcrumb-link {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 0.375rem;
|
|
77
|
+
padding: 0.25rem 0.5rem;
|
|
78
|
+
border-radius: 0.375rem;
|
|
79
|
+
font-size: 0.875rem;
|
|
80
|
+
transition: all 200ms;
|
|
81
|
+
border: none;
|
|
82
|
+
background: transparent;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
color: rgb(75, 85, 99);
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
text-overflow: ellipsis;
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.file-breadcrumb-link:hover {
|
|
91
|
+
background: rgba(229, 231, 233, 0.6);
|
|
92
|
+
color: rgb(17, 24, 39);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.file-breadcrumb-link--current {
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
color: rgb(17, 24, 39);
|
|
98
|
+
background: rgba(229, 231, 233, 0.5);
|
|
99
|
+
cursor: default;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.file-breadcrumb-link--current:hover {
|
|
103
|
+
background: rgba(229, 231, 233, 0.5);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.file-breadcrumb-separator {
|
|
107
|
+
color: rgb(156, 163, 175);
|
|
108
|
+
margin: 0 0.25rem;
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
}
|
|
111
|
+
</style>
|