[agent-pipeline] pipe-20260311185722-je7c round-3
This commit is contained in:
parent
19b078cf02
commit
111023191e
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V2 타임라인 스케줄러 설정 패널
|
* V2 타임라인 스케줄러 설정 패널
|
||||||
* 토스식 단계별 UX: 스케줄 생성 설정 -> 리소스 설정 -> 표시 설정(접힘)
|
* 토스식 단계별 UX: 스케줄 데이터 설정 -> 소스 데이터 설정 -> 리소스 설정 -> 표시 설정(접힘) -> 고급 설정(접힘)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
@ -14,10 +14,10 @@ import { Button } from "@/components/ui/button";
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||||
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
|
||||||
import { Settings, ChevronDown, Check, ChevronsUpDown, Database, Users } from "lucide-react";
|
import { Settings, ChevronDown, Check, ChevronsUpDown, Database, Users, Layers } from "lucide-react";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { tableTypeApi } from "@/lib/api/screen";
|
import { tableTypeApi } from "@/lib/api/screen";
|
||||||
import type { TimelineSchedulerConfig, ScheduleType, SourceDataConfig, ResourceFieldMapping } from "@/lib/registry/components/v2-timeline-scheduler/types";
|
import type { TimelineSchedulerConfig, ScheduleType, SourceDataConfig, ResourceFieldMapping, FieldMapping, ZoomLevel } from "@/lib/registry/components/v2-timeline-scheduler/types";
|
||||||
import { zoomLevelOptions, scheduleTypeOptions } from "@/lib/registry/components/v2-timeline-scheduler/config";
|
import { zoomLevelOptions, scheduleTypeOptions } from "@/lib/registry/components/v2-timeline-scheduler/config";
|
||||||
|
|
||||||
interface V2TimelineSchedulerConfigPanelProps {
|
interface V2TimelineSchedulerConfigPanelProps {
|
||||||
|
|
@ -42,10 +42,13 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
const [tables, setTables] = useState<TableInfo[]>([]);
|
const [tables, setTables] = useState<TableInfo[]>([]);
|
||||||
const [sourceColumns, setSourceColumns] = useState<ColumnInfo[]>([]);
|
const [sourceColumns, setSourceColumns] = useState<ColumnInfo[]>([]);
|
||||||
const [resourceColumns, setResourceColumns] = useState<ColumnInfo[]>([]);
|
const [resourceColumns, setResourceColumns] = useState<ColumnInfo[]>([]);
|
||||||
|
const [scheduleColumns, setScheduleColumns] = useState<ColumnInfo[]>([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [sourceTableOpen, setSourceTableOpen] = useState(false);
|
const [sourceTableOpen, setSourceTableOpen] = useState(false);
|
||||||
const [resourceTableOpen, setResourceTableOpen] = useState(false);
|
const [resourceTableOpen, setResourceTableOpen] = useState(false);
|
||||||
|
const [customTableOpen, setCustomTableOpen] = useState(false);
|
||||||
const [displayOpen, setDisplayOpen] = useState(false);
|
const [displayOpen, setDisplayOpen] = useState(false);
|
||||||
|
const [advancedOpen, setAdvancedOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadTables = async () => {
|
const loadTables = async () => {
|
||||||
|
|
@ -117,6 +120,30 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
loadResourceColumns();
|
loadResourceColumns();
|
||||||
}, [config.resourceTable]);
|
}, [config.resourceTable]);
|
||||||
|
|
||||||
|
// 커스텀 테이블 또는 schedule_mng 컬럼 로드
|
||||||
|
useEffect(() => {
|
||||||
|
const loadScheduleColumns = async () => {
|
||||||
|
const tableName = config.useCustomTable && config.customTableName
|
||||||
|
? config.customTableName
|
||||||
|
: "schedule_mng";
|
||||||
|
try {
|
||||||
|
const columns = await tableTypeApi.getColumns(tableName);
|
||||||
|
if (Array.isArray(columns)) {
|
||||||
|
setScheduleColumns(
|
||||||
|
columns.map((col: any) => ({
|
||||||
|
columnName: col.column_name || col.columnName,
|
||||||
|
displayName: col.display_name || col.displayName || col.column_name || col.columnName,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("스케줄 테이블 컬럼 로드 오류:", err);
|
||||||
|
setScheduleColumns([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loadScheduleColumns();
|
||||||
|
}, [config.useCustomTable, config.customTableName]);
|
||||||
|
|
||||||
const updateConfig = (updates: Partial<TimelineSchedulerConfig>) => {
|
const updateConfig = (updates: Partial<TimelineSchedulerConfig>) => {
|
||||||
onChange({ ...config, ...updates });
|
onChange({ ...config, ...updates });
|
||||||
};
|
};
|
||||||
|
|
@ -130,6 +157,20 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateFieldMapping = (field: string, value: string) => {
|
||||||
|
updateConfig({
|
||||||
|
fieldMapping: {
|
||||||
|
...config.fieldMapping,
|
||||||
|
id: config.fieldMapping?.id || "id",
|
||||||
|
resourceId: config.fieldMapping?.resourceId || "resource_id",
|
||||||
|
title: config.fieldMapping?.title || "title",
|
||||||
|
startDate: config.fieldMapping?.startDate || "start_date",
|
||||||
|
endDate: config.fieldMapping?.endDate || "end_date",
|
||||||
|
[field]: value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const updateResourceFieldMapping = (field: string, value: string) => {
|
const updateResourceFieldMapping = (field: string, value: string) => {
|
||||||
updateConfig({
|
updateConfig({
|
||||||
resourceFieldMapping: {
|
resourceFieldMapping: {
|
||||||
|
|
@ -143,13 +184,13 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{/* ─── 1단계: 스케줄 생성 설정 ─── */}
|
{/* ─── 1단계: 스케줄 데이터 테이블 설정 ─── */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Database className="h-4 w-4 text-muted-foreground" />
|
<Layers className="h-4 w-4 text-muted-foreground" />
|
||||||
<p className="text-sm font-medium">스케줄 생성 설정</p>
|
<p className="text-sm font-medium">스케줄 데이터 테이블</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-[11px] text-muted-foreground">스케줄 자동 생성 시 참조할 원본 데이터를 설정해요 (저장: schedule_mng)</p>
|
<p className="text-[11px] text-muted-foreground">스케줄 데이터를 저장/조회할 테이블을 설정해요</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-lg border bg-muted/30 p-4 space-y-3">
|
<div className="rounded-lg border bg-muted/30 p-4 space-y-3">
|
||||||
|
|
@ -173,6 +214,259 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 커스텀 테이블 사용 여부 */}
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-muted-foreground">커스텀 테이블 사용</p>
|
||||||
|
<p className="text-[10px] text-muted-foreground mt-0.5">OFF: schedule_mng 사용</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config.useCustomTable ?? false}
|
||||||
|
onCheckedChange={(v) => updateConfig({ useCustomTable: v })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 커스텀 테이블 선택 (Combobox) */}
|
||||||
|
{config.useCustomTable && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<span className="text-xs text-muted-foreground">커스텀 테이블명</span>
|
||||||
|
<Popover open={customTableOpen} onOpenChange={setCustomTableOpen}>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
aria-expanded={customTableOpen}
|
||||||
|
className="h-8 w-full justify-between text-xs"
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
{config.customTableName
|
||||||
|
? tables.find((t) => t.tableName === config.customTableName)?.displayName ||
|
||||||
|
config.customTableName
|
||||||
|
: "커스텀 테이블 선택..."}
|
||||||
|
<ChevronsUpDown className="ml-2 h-3 w-3 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="p-0" style={{ width: "var(--radix-popover-trigger-width)" }} align="start">
|
||||||
|
<Command
|
||||||
|
filter={(value, search) => {
|
||||||
|
return value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CommandInput placeholder="테이블 검색..." className="text-xs" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs">테이블을 찾을 수 없습니다.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{tables.map((table) => (
|
||||||
|
<CommandItem
|
||||||
|
key={table.tableName}
|
||||||
|
value={`${table.displayName} ${table.tableName}`}
|
||||||
|
onSelect={() => {
|
||||||
|
updateConfig({ customTableName: table.tableName, selectedTable: table.tableName });
|
||||||
|
setCustomTableOpen(false);
|
||||||
|
}}
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 h-3 w-3",
|
||||||
|
config.customTableName === table.tableName ? "opacity-100" : "opacity-0"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span>{table.displayName}</span>
|
||||||
|
<span className="text-muted-foreground text-[10px]">{table.tableName}</span>
|
||||||
|
</div>
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 디자인 모드 표시용 테이블명 (selectedTable) */}
|
||||||
|
{!config.useCustomTable && (
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">디자인 모드 표시 테이블</span>
|
||||||
|
<Input
|
||||||
|
value={config.selectedTable || "schedule_mng"}
|
||||||
|
onChange={(e) => updateConfig({ selectedTable: e.target.value })}
|
||||||
|
placeholder="schedule_mng"
|
||||||
|
className="h-7 w-[140px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 스케줄 필드 매핑 */}
|
||||||
|
<div className="ml-1 border-l-2 border-primary/20 pl-3 space-y-2 pt-1">
|
||||||
|
<p className="text-xs font-medium text-primary">스케줄 필드 매핑</p>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">ID 필드 *</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.id || "schedule_id"}
|
||||||
|
onValueChange={(v) => updateFieldMapping("id", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">리소스 ID 필드 *</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.resourceId || "resource_id"}
|
||||||
|
onValueChange={(v) => updateFieldMapping("resourceId", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">제목 필드 *</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.title || "schedule_name"}
|
||||||
|
onValueChange={(v) => updateFieldMapping("title", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">시작일 필드 *</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.startDate || "start_date"}
|
||||||
|
onValueChange={(v) => updateFieldMapping("startDate", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">종료일 필드 *</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.endDate || "end_date"}
|
||||||
|
onValueChange={(v) => updateFieldMapping("endDate", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">상태 필드</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.status || ""}
|
||||||
|
onValueChange={(v) => updateFieldMapping("status", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">진행률 필드</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.progress || ""}
|
||||||
|
onValueChange={(v) => updateFieldMapping("progress", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">색상 필드</span>
|
||||||
|
<Select
|
||||||
|
value={config.fieldMapping?.color || ""}
|
||||||
|
onValueChange={(v) => updateFieldMapping("color", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{scheduleColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ─── 2단계: 소스 데이터 설정 ─── */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Database className="h-4 w-4 text-muted-foreground" />
|
||||||
|
<p className="text-sm font-medium">소스 데이터 설정</p>
|
||||||
|
</div>
|
||||||
|
<p className="text-[11px] text-muted-foreground">스케줄 자동 생성 시 참조할 원본 데이터를 설정해요</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded-lg border bg-muted/30 p-4 space-y-3">
|
||||||
{/* 소스 테이블 Combobox */}
|
{/* 소스 테이블 Combobox */}
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<span className="text-xs text-muted-foreground">소스 테이블 (수주/작업요청 등)</span>
|
<span className="text-xs text-muted-foreground">소스 테이블 (수주/작업요청 등)</span>
|
||||||
|
|
@ -318,7 +612,7 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ─── 2단계: 리소스 설정 ─── */}
|
{/* ─── 3단계: 리소스 설정 ─── */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Users className="h-4 w-4 text-muted-foreground" />
|
<Users className="h-4 w-4 text-muted-foreground" />
|
||||||
|
|
@ -427,11 +721,30 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">그룹 필드</span>
|
||||||
|
<Select
|
||||||
|
value={config.resourceFieldMapping?.group || ""}
|
||||||
|
onValueChange={(v) => updateResourceFieldMapping("group", v)}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="h-7 w-[130px] text-xs">
|
||||||
|
<SelectValue placeholder="선택" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{resourceColumns.map((col) => (
|
||||||
|
<SelectItem key={col.columnName} value={col.columnName}>
|
||||||
|
{col.displayName}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ─── 3단계: 표시 설정 (Collapsible) ─── */}
|
{/* ─── 4단계: 표시 설정 (Collapsible) ─── */}
|
||||||
<Collapsible open={displayOpen} onOpenChange={setDisplayOpen}>
|
<Collapsible open={displayOpen} onOpenChange={setDisplayOpen}>
|
||||||
<CollapsibleTrigger asChild>
|
<CollapsibleTrigger asChild>
|
||||||
<button
|
<button
|
||||||
|
|
@ -457,7 +770,7 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
<span className="text-xs text-muted-foreground">기본 줌 레벨</span>
|
<span className="text-xs text-muted-foreground">기본 줌 레벨</span>
|
||||||
<Select
|
<Select
|
||||||
value={config.defaultZoomLevel || "day"}
|
value={config.defaultZoomLevel || "day"}
|
||||||
onValueChange={(v) => updateConfig({ defaultZoomLevel: v as any })}
|
onValueChange={(v) => updateConfig({ defaultZoomLevel: v as ZoomLevel })}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-7 w-[100px] text-xs">
|
<SelectTrigger className="h-7 w-[100px] text-xs">
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
|
|
@ -472,6 +785,20 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 초기 표시 날짜 */}
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<span className="text-xs text-muted-foreground">초기 표시 날짜</span>
|
||||||
|
<p className="text-[10px] text-muted-foreground mt-0.5">비워두면 오늘 기준</p>
|
||||||
|
</div>
|
||||||
|
<Input
|
||||||
|
type="date"
|
||||||
|
value={config.initialDate || ""}
|
||||||
|
onChange={(e) => updateConfig({ initialDate: e.target.value || undefined })}
|
||||||
|
className="h-7 w-[140px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 높이 */}
|
{/* 높이 */}
|
||||||
<div className="flex items-center justify-between py-1">
|
<div className="flex items-center justify-between py-1">
|
||||||
<span className="text-xs text-muted-foreground">높이 (px)</span>
|
<span className="text-xs text-muted-foreground">높이 (px)</span>
|
||||||
|
|
@ -483,6 +810,21 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 최대 높이 */}
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">최대 높이 (px)</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={typeof config.maxHeight === "number" ? config.maxHeight : ""}
|
||||||
|
onChange={(e) => {
|
||||||
|
const val = e.target.value ? parseInt(e.target.value) : undefined;
|
||||||
|
updateConfig({ maxHeight: val });
|
||||||
|
}}
|
||||||
|
placeholder="제한 없음"
|
||||||
|
className="h-7 w-[100px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 행 높이 */}
|
{/* 행 높이 */}
|
||||||
<div className="flex items-center justify-between py-1">
|
<div className="flex items-center justify-between py-1">
|
||||||
<span className="text-xs text-muted-foreground">행 높이 (px)</span>
|
<span className="text-xs text-muted-foreground">행 높이 (px)</span>
|
||||||
|
|
@ -494,6 +836,62 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 헤더 높이 */}
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">헤더 높이 (px)</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={config.headerHeight || 60}
|
||||||
|
onChange={(e) => updateConfig({ headerHeight: parseInt(e.target.value) || 60 })}
|
||||||
|
className="h-7 w-[100px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 리소스 컬럼 너비 */}
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<span className="text-xs text-muted-foreground">리소스 컬럼 너비 (px)</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={config.resourceColumnWidth || 150}
|
||||||
|
onChange={(e) => updateConfig({ resourceColumnWidth: parseInt(e.target.value) || 150 })}
|
||||||
|
className="h-7 w-[100px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 셀 너비 (줌 레벨별) */}
|
||||||
|
<div className="space-y-2 pt-1">
|
||||||
|
<span className="text-xs text-muted-foreground">셀 너비 (줌 레벨별, px)</span>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="flex-1">
|
||||||
|
<span className="text-[10px] text-muted-foreground">일</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={config.cellWidth?.day || 60}
|
||||||
|
onChange={(e) => updateConfig({ cellWidth: { ...config.cellWidth, day: parseInt(e.target.value) || 60 } })}
|
||||||
|
className="h-7 text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1">
|
||||||
|
<span className="text-[10px] text-muted-foreground">주</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={config.cellWidth?.week || 120}
|
||||||
|
onChange={(e) => updateConfig({ cellWidth: { ...config.cellWidth, week: parseInt(e.target.value) || 120 } })}
|
||||||
|
className="h-7 text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1">
|
||||||
|
<span className="text-[10px] text-muted-foreground">월</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={config.cellWidth?.month || 40}
|
||||||
|
onChange={(e) => updateConfig({ cellWidth: { ...config.cellWidth, month: parseInt(e.target.value) || 40 } })}
|
||||||
|
className="h-7 text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Switch 토글들 */}
|
{/* Switch 토글들 */}
|
||||||
<div className="flex items-center justify-between py-1">
|
<div className="flex items-center justify-between py-1">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -550,6 +948,17 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm">충돌 표시</p>
|
||||||
|
<p className="text-[11px] text-muted-foreground">스케줄 겹침 시 경고를 표시해요</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config.showConflicts ?? true}
|
||||||
|
onCheckedChange={(v) => updateConfig({ showConflicts: v })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between py-1">
|
<div className="flex items-center justify-between py-1">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm">툴바 표시</p>
|
<p className="text-sm">툴바 표시</p>
|
||||||
|
|
@ -560,6 +969,111 @@ export const V2TimelineSchedulerConfigPanel: React.FC<V2TimelineSchedulerConfigP
|
||||||
onCheckedChange={(v) => updateConfig({ showToolbar: v })}
|
onCheckedChange={(v) => updateConfig({ showToolbar: v })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm">줌 컨트롤 표시</p>
|
||||||
|
<p className="text-[11px] text-muted-foreground">줌 레벨 변경 버튼을 보여줘요</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config.showZoomControls ?? true}
|
||||||
|
onCheckedChange={(v) => updateConfig({ showZoomControls: v })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm">네비게이션 표시</p>
|
||||||
|
<p className="text-[11px] text-muted-foreground">이전/다음/오늘 버튼을 보여줘요</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config.showNavigation ?? true}
|
||||||
|
onCheckedChange={(v) => updateConfig({ showNavigation: v })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between py-1">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm">추가 버튼 표시</p>
|
||||||
|
<p className="text-[11px] text-muted-foreground">스케줄 추가 버튼을 보여줘요</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={config.showAddButton ?? true}
|
||||||
|
onCheckedChange={(v) => updateConfig({ showAddButton: v })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CollapsibleContent>
|
||||||
|
</Collapsible>
|
||||||
|
|
||||||
|
{/* ─── 5단계: 고급 설정 - 상태별 색상 (Collapsible) ─── */}
|
||||||
|
<Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>
|
||||||
|
<CollapsibleTrigger asChild>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="flex w-full items-center justify-between rounded-lg border bg-muted/30 px-4 py-2.5 text-left transition-colors hover:bg-muted/50"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Settings className="h-4 w-4 text-muted-foreground" />
|
||||||
|
<span className="text-sm font-medium">상태별 색상</span>
|
||||||
|
</div>
|
||||||
|
<ChevronDown
|
||||||
|
className={cn(
|
||||||
|
"h-4 w-4 text-muted-foreground transition-transform duration-200",
|
||||||
|
advancedOpen && "rotate-180"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</CollapsibleTrigger>
|
||||||
|
<CollapsibleContent>
|
||||||
|
<div className="rounded-b-lg border border-t-0 p-4 space-y-3">
|
||||||
|
{[
|
||||||
|
{ key: "planned", label: "계획됨", defaultColor: "#3b82f6" },
|
||||||
|
{ key: "in_progress", label: "진행중", defaultColor: "#f59e0b" },
|
||||||
|
{ key: "completed", label: "완료", defaultColor: "#10b981" },
|
||||||
|
{ key: "delayed", label: "지연", defaultColor: "#ef4444" },
|
||||||
|
{ key: "cancelled", label: "취소", defaultColor: "#6b7280" },
|
||||||
|
].map((status) => (
|
||||||
|
<div key={status.key} className="flex items-center justify-between py-1">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div
|
||||||
|
className="h-3 w-3 rounded-full"
|
||||||
|
style={{
|
||||||
|
backgroundColor:
|
||||||
|
(config.statusColors as any)?.[status.key] || status.defaultColor,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="text-xs text-muted-foreground">{status.label}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1.5">
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
value={(config.statusColors as any)?.[status.key] || status.defaultColor}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateConfig({
|
||||||
|
statusColors: {
|
||||||
|
...config.statusColors,
|
||||||
|
[status.key]: e.target.value,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className="h-7 w-7 cursor-pointer rounded border"
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
value={(config.statusColors as any)?.[status.key] || status.defaultColor}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateConfig({
|
||||||
|
statusColors: {
|
||||||
|
...config.statusColors,
|
||||||
|
[status.key]: e.target.value,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className="h-7 w-[80px] text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</CollapsibleContent>
|
</CollapsibleContent>
|
||||||
</Collapsible>
|
</Collapsible>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue