From 0fd21e51f7c3df3775fae2138f0c0258e127dcee Mon Sep 17 00:00:00 2001 From: ymy Date: Fri, 31 Jul 2026 12:02:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(filelib-web):=20=E8=80=81=E5=B8=88?= =?UTF-8?q?=E7=AB=AF=E6=96=87=E4=BB=B6=E5=BA=93=E6=94=B9=E7=BD=91=E7=9B=98?= =?UTF-8?q?=E5=BC=8F=E7=BD=91=E6=A0=BC=E6=B5=8F=E8=A7=88(=E4=B8=8B?= =?UTF-8?q?=E9=92=BB=E5=AF=BC=E8=88=AA+=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新 GridLibraryView:双击下钻文件夹/项目,面包屑+返回跳级,项目内文件同网格, 双击进 FileEditor 预览;工具条按上下文出新建文件夹/项目/文件 - 右键菜单(ContextMenu):打开/新建子文件夹/重命名/授权管理/详情/删除, 按节点 role 动态显隐;文件菜单:打开预览/下载/删除;空白处右键出新建+刷新 - GridCard 大图标卡片(琥珀文件夹/立方体项目/文档文件);授权与详情复用 GrantsPanel/OverviewPanel(Modal 加 maxW prop);Icon 补 5 个图标 - 管理后台 /database 保留树状 LibraryView 不动;后端零改动 --- hub/filelib-web/src/lib/ContextMenu.svelte | 55 ++ hub/filelib-web/src/lib/GridCard.svelte | 47 ++ .../src/lib/GridLibraryView.svelte | 534 ++++++++++++++++++ hub/filelib-web/src/lib/Icon.svelte | 5 + hub/filelib-web/src/lib/Modal.svelte | 4 +- hub/filelib-web/src/routes/app/+page.svelte | 6 +- 6 files changed, 646 insertions(+), 5 deletions(-) create mode 100644 hub/filelib-web/src/lib/ContextMenu.svelte create mode 100644 hub/filelib-web/src/lib/GridCard.svelte create mode 100644 hub/filelib-web/src/lib/GridLibraryView.svelte diff --git a/hub/filelib-web/src/lib/ContextMenu.svelte b/hub/filelib-web/src/lib/ContextMenu.svelte new file mode 100644 index 0000000..97de58c --- /dev/null +++ b/hub/filelib-web/src/lib/ContextMenu.svelte @@ -0,0 +1,55 @@ + + + + + diff --git a/hub/filelib-web/src/lib/GridCard.svelte b/hub/filelib-web/src/lib/GridCard.svelte new file mode 100644 index 0000000..5880111 --- /dev/null +++ b/hub/filelib-web/src/lib/GridCard.svelte @@ -0,0 +1,47 @@ + + + diff --git a/hub/filelib-web/src/lib/GridLibraryView.svelte b/hub/filelib-web/src/lib/GridLibraryView.svelte new file mode 100644 index 0000000..4e91a70 --- /dev/null +++ b/hub/filelib-web/src/lib/GridLibraryView.svelte @@ -0,0 +1,534 @@ + + +
+ +
+ {#if view === "files" || stack.length > 0} + + {/if} + + + {#if view === "nodes" && canCreateHere} + + + {/if} + {#if view === "files" && projectCanEdit} + + {/if} + + +
+ {initial} + {$me?.displayName ?? $me?.userId ?? ""} + +
+
+ + +
+
{ e.preventDefault(); menu = { x: e.clientX, y: e.clientY, items: bgMenuItems() }; }} + > + {#if view === "nodes"} + {#if nodesError !== null} +
{nodesError}
+ {:else if children === null} +
加载中…
+ {:else if children.length === 0} +
+ {currentFolder === null ? "空文件库" : "空文件夹"}{canCreateHere ? " · 右键或点上方按钮新建" : ""} +
+ {:else} +
+ {#each children as n (n.id)} + (selected = n.id)} + onopen={() => openNode(n)} + oncontextmenu={(x, y) => (menu = { x, y, items: nodeMenuItems(n) })} + /> + {/each} +
+ {/if} + {:else} + {#if filesError !== null} +
{filesError}
+ {:else if files === null} +
加载中…
+ {:else if files.length === 0} +
空仓库{projectCanEdit ? " · 右键或点上方按钮新建文件" : ""}
+ {:else} +
+ {#each files as f (f.path)} + (selected = f.path)} + onopen={() => selectedFilePath.set(f.path)} + oncontextmenu={(x, y) => (menu = { x, y, items: fileMenuItems(f) })} + /> + {/each} +
+ {/if} + {/if} +
+ + {#if view === "files" && $selectedFilePath && projectNode} +
+ void loadFiles()} + onclose={clearSelectedFile} + /> +
+ {/if} +
+
+ +{#if menu} + (menu = null)} /> +{/if} + +{#if modal === "create"} + (modal = null)}> +
+ + +
+
+ + +
+
+ + +
+
+{/if} + +{#if modal === "rename" && renameTarget} + (modal = null)}> +
+ + +
+
+ + +
+
+{/if} + +{#if modal === "grants" && detailNode} + (modal = null)}> + + +{/if} + +{#if modal === "detail" && detailNode} + (modal = null)}> + + +{/if} + +{#if modal === "newFile"} + (modal = null)}> +
+ + +
+
+ + +
+
+ + +
+
+{/if} diff --git a/hub/filelib-web/src/lib/Icon.svelte b/hub/filelib-web/src/lib/Icon.svelte index 7c98aed..ce7c8ec 100644 --- a/hub/filelib-web/src/lib/Icon.svelte +++ b/hub/filelib-web/src/lib/Icon.svelte @@ -16,6 +16,11 @@ layers: "m12 2 9 5-9 5-9-5 9-5Zm9 11-9 5-9-5m18 5-9 5-9-5", clock: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Zm0-14v6l4 2", minus: "M5 12h14", + download: "M12 3v12m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2", + refresh: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6", + arrowLeft: "M19 12H5m0 0 6 6m-6-6 6-6", + info: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Zm0-10v6m0-11v.5", + shield: "M12 3l8 3v6c0 4.5-3.2 7.7-8 9-4.8-1.3-8-4.5-8-9V6l8-3Z", // 已归档(软删)标记用;与"删除"区分 —— 数据仍在,只是打了 archivedAt。 archive: "M3 8h18v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8Zm1-5h16l1 5H3l1-5Zm5 9h6", restore: "M3 12a9 9 0 1 0 3-6.7M3 4v4.5h4.5", diff --git a/hub/filelib-web/src/lib/Modal.svelte b/hub/filelib-web/src/lib/Modal.svelte index 233736a..025d742 100644 --- a/hub/filelib-web/src/lib/Modal.svelte +++ b/hub/filelib-web/src/lib/Modal.svelte @@ -1,7 +1,7 @@
{ if (e.target === e.currentTarget) onclose(); }} > -
+
{title}
{@render children()}
diff --git a/hub/filelib-web/src/routes/app/+page.svelte b/hub/filelib-web/src/routes/app/+page.svelte index 26fd7c1..30bb9bf 100644 --- a/hub/filelib-web/src/routes/app/+page.svelte +++ b/hub/filelib-web/src/routes/app/+page.svelte @@ -1,10 +1,10 @@ @@ -15,7 +15,7 @@
加载中…
{:else if $me}
- +
{:else}