Merge pull request '대시보드 수정사항 적용' (#134) from feat/dashboard into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/134
This commit is contained in:
commit
16d0c1eda8
|
|
@ -392,12 +392,21 @@ export default function DashboardDesigner({ dashboardId: initialDashboardId }: D
|
||||||
// 사이드바 적용
|
// 사이드바 적용
|
||||||
const handleApplySidebar = useCallback(
|
const handleApplySidebar = useCallback(
|
||||||
(updatedElement: DashboardElement) => {
|
(updatedElement: DashboardElement) => {
|
||||||
updateElement(updatedElement.id, updatedElement);
|
// 현재 요소의 최신 상태를 가져와서 position과 size는 유지
|
||||||
// 사이드바는 열린 채로 유지하여 연속 수정 가능
|
const currentElement = elements.find((el) => el.id === updatedElement.id);
|
||||||
// 단, sidebarElement도 업데이트해서 최신 상태 반영
|
if (currentElement) {
|
||||||
setSidebarElement(updatedElement);
|
// position과 size는 현재 상태 유지, 나머지만 업데이트
|
||||||
|
const finalElement = {
|
||||||
|
...updatedElement,
|
||||||
|
position: currentElement.position,
|
||||||
|
size: currentElement.size,
|
||||||
|
};
|
||||||
|
updateElement(finalElement.id, finalElement);
|
||||||
|
// 사이드바도 최신 상태로 업데이트
|
||||||
|
setSidebarElement(finalElement);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[updateElement],
|
[elements, updateElement],
|
||||||
);
|
);
|
||||||
|
|
||||||
// 레이아웃 저장
|
// 레이아웃 저장
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ export function ListWidget({ element }: ListWidgetProps) {
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
) : (
|
||||||
paginatedRows.map((row, idx) => (
|
paginatedRows.map((row, idx) => (
|
||||||
<TableRow key={idx} className={config.stripedRows ? undefined : ""}>
|
<TableRow key={idx} className={config.stripedRows && idx % 2 === 1 ? "bg-muted/50" : ""}>
|
||||||
{displayColumns
|
{displayColumns
|
||||||
.filter((col) => col.visible)
|
.filter((col) => col.visible)
|
||||||
.map((col) => (
|
.map((col) => (
|
||||||
|
|
|
||||||
|
|
@ -119,22 +119,13 @@ export function UnifiedColumnEditor({ queryResult, config, onConfigChange }: Uni
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={col.id}
|
key={col.id}
|
||||||
draggable
|
|
||||||
onDragStart={(e) => {
|
|
||||||
handleDragStart(index);
|
|
||||||
e.currentTarget.style.cursor = "grabbing";
|
|
||||||
}}
|
|
||||||
onDragOver={(e) => handleDragOver(e, index)}
|
onDragOver={(e) => handleDragOver(e, index)}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
onDragEnd={(e) => {
|
|
||||||
handleDragEnd();
|
|
||||||
e.currentTarget.style.cursor = "grab";
|
|
||||||
}}
|
|
||||||
className={`group relative rounded-md border transition-all ${
|
className={`group relative rounded-md border transition-all ${
|
||||||
col.visible
|
col.visible
|
||||||
? "border-primary/40 bg-primary/5 shadow-sm"
|
? "border-primary/40 bg-primary/5 shadow-sm"
|
||||||
: "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm"
|
: "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm"
|
||||||
} cursor-grab active:cursor-grabbing ${draggedIndex === index ? "scale-95 opacity-50" : ""}`}
|
} ${draggedIndex === index ? "scale-95 opacity-50" : ""}`}
|
||||||
>
|
>
|
||||||
{/* 헤더 */}
|
{/* 헤더 */}
|
||||||
<div className="flex items-center gap-2 px-2.5 py-2">
|
<div className="flex items-center gap-2 px-2.5 py-2">
|
||||||
|
|
@ -143,7 +134,20 @@ export function UnifiedColumnEditor({ queryResult, config, onConfigChange }: Uni
|
||||||
onCheckedChange={() => handleToggle(col.id)}
|
onCheckedChange={() => handleToggle(col.id)}
|
||||||
className="data-[state=checked]:bg-primary data-[state=checked]:border-primary h-4 w-4 shrink-0 rounded-full"
|
className="data-[state=checked]:bg-primary data-[state=checked]:border-primary h-4 w-4 shrink-0 rounded-full"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
draggable
|
||||||
|
onDragStart={(e) => {
|
||||||
|
handleDragStart(index);
|
||||||
|
e.currentTarget.style.cursor = "grabbing";
|
||||||
|
}}
|
||||||
|
onDragEnd={(e) => {
|
||||||
|
handleDragEnd();
|
||||||
|
e.currentTarget.style.cursor = "grab";
|
||||||
|
}}
|
||||||
|
className="cursor-grab active:cursor-grabbing"
|
||||||
|
>
|
||||||
<GripVertical className="group-hover:text-primary h-3.5 w-3.5 shrink-0 text-gray-400 transition-colors" />
|
<GripVertical className="group-hover:text-primary h-3.5 w-3.5 shrink-0 text-gray-400 transition-colors" />
|
||||||
|
</div>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="truncate text-[11px] font-medium text-gray-900">
|
<span className="truncate text-[11px] font-medium text-gray-900">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue