summaryrefslogtreecommitdiff
path: root/lib/swp/table
diff options
context:
space:
mode:
Diffstat (limited to 'lib/swp/table')
-rw-r--r--lib/swp/table/swp-table-columns.tsx2
-rw-r--r--lib/swp/table/swp-table-toolbar.tsx23
-rw-r--r--lib/swp/table/swp-table.tsx19
3 files changed, 28 insertions, 16 deletions
diff --git a/lib/swp/table/swp-table-columns.tsx b/lib/swp/table/swp-table-columns.tsx
index dd605453..f79a7441 100644
--- a/lib/swp/table/swp-table-columns.tsx
+++ b/lib/swp/table/swp-table-columns.tsx
@@ -17,7 +17,6 @@ export const swpDocumentColumns: ColumnDef<SwpDocumentWithStats>[] = [
<Button
variant="ghost"
size="sm"
- onClick={row.getToggleExpandedHandler()}
className="h-8 w-8 p-0"
>
{row.getIsExpanded() ? (
@@ -182,7 +181,6 @@ export const swpRevisionColumns: ColumnDef<RevisionRow>[] = [
<Button
variant="ghost"
size="sm"
- onClick={row.getToggleExpandedHandler()}
className="h-8 w-8 p-0 ml-8"
>
{row.getIsExpanded() ? (
diff --git a/lib/swp/table/swp-table-toolbar.tsx b/lib/swp/table/swp-table-toolbar.tsx
index 7c5f2f2e..6858f42e 100644
--- a/lib/swp/table/swp-table-toolbar.tsx
+++ b/lib/swp/table/swp-table-toolbar.tsx
@@ -84,6 +84,20 @@ export function SwpTableToolbar({
});
};
+ /**
+ * 파일 업로드 핸들러
+ * 1) 네트워크 드라이브에 정해진 규칙대로, 파일이름 기반으로 파일 업로드하기 (단, cpyCd는 어떻게 해결할지 고민해봐야 함...)
+ * 2) 1~N개 파일 받아서, 파일 이름 기준으로 파싱해서 SaveInBoxList API를 통해 업로드 처리
+ *
+ * 개발중인 동안은 토스트 반환하도록 처리
+ */
+ const handleUploadFiles = () => {
+ toast({
+ title: "파일 업로드",
+ description: "현재 개발중입니다.",
+ });
+ }
+
// 검색 적용
const handleSearch = () => {
onFiltersChange(localFilters);
@@ -122,15 +136,16 @@ export function SwpTableToolbar({
{isSyncing ? "동기화 중..." : "SWP 동기화"}
</Button>
- <Button variant="outline" size="sm" disabled>
- <Download className="h-4 w-4 mr-2" />
- Excel 내보내기
- </Button>
</div>
<div className="text-sm text-muted-foreground">
SWP 문서 관리 시스템
</div>
+ <div>
+ <Button variant="outline" size="sm" onClick={handleUploadFiles}>
+ 파일 업로드하기
+ </Button>
+ </div>
</div>
{/* 검색 필터 */}
diff --git a/lib/swp/table/swp-table.tsx b/lib/swp/table/swp-table.tsx
index 9e8f7f6a..fb3a504e 100644
--- a/lib/swp/table/swp-table.tsx
+++ b/lib/swp/table/swp-table.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState } from "react";
+import React, { useState } from "react";
import {
useReactTable,
getCoreRowModel,
@@ -53,7 +53,7 @@ export function SwpTable({
onExpandedChange: setExpanded,
getCoreRowModel: getCoreRowModel(),
getExpandedRowModel: getExpandedRowModel(),
- getRowCanExpand: (row) => true, // 모든 문서는 확장 가능
+ getRowCanExpand: () => true, // 모든 문서는 확장 가능
});
// 리비전 로드
@@ -106,7 +106,7 @@ export function SwpTable({
// 문서 행 확장 핸들러
const handleDocumentExpand = (docNo: string, isExpanded: boolean) => {
- if (!isExpanded) {
+ if (isExpanded) {
loadRevisions(docNo);
}
};
@@ -135,10 +135,9 @@ export function SwpTable({
<TableBody>
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row) => (
- <>
+ <React.Fragment key={row.id}>
{/* 문서 행 */}
<TableRow
- key={row.id}
data-state={row.getIsSelected() && "selected"}
className="hover:bg-muted/50"
>
@@ -187,7 +186,7 @@ export function SwpTable({
</TableCell>
</TableRow>
)}
- </>
+ </React.Fragment>
))
) : (
<TableRow>
@@ -264,7 +263,7 @@ function RevisionSubTable({
});
const handleRevisionExpand = (revisionId: number, isExpanded: boolean) => {
- if (!isExpanded) {
+ if (isExpanded) {
onLoadFiles(revisionId);
}
};
@@ -290,9 +289,9 @@ function RevisionSubTable({
</TableHeader>
<TableBody>
{revisionTable.getRowModel().rows.map((row) => (
- <>
+ <React.Fragment key={row.id}>
{/* 리비전 행 */}
- <TableRow key={row.id} className="bg-muted/20">
+ <TableRow className="bg-muted/20">
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>
{cell.column.id === "expander" ? (
@@ -333,7 +332,7 @@ function RevisionSubTable({
</TableCell>
</TableRow>
)}
- </>
+ </React.Fragment>
))}
</TableBody>
</Table>