ERP-node/frontend/lib/registry/components/v2-table-list/config-panels/StyleConfigPanel.tsx

130 lines
4.5 KiB
TypeScript
Raw Normal View History

"use client";
import React from "react";
import { Label } from "@/components/ui/label";
import { Checkbox } from "@/components/ui/checkbox";
export interface StyleConfigPanelProps {
config: any;
onChange: (key: string, value: any) => void;
onNestedChange: (parentKey: string, childKey: string, value: any) => void;
}
/**
* 패널: 테이블 (theme, headerStyle, rowHeight )
*/
export const StyleConfigPanel: React.FC<StyleConfigPanelProps> = ({
config,
onNestedChange,
}) => {
const tableStyle = config.tableStyle || {};
return (
<div className="space-y-6">
<div className="space-y-3">
<div>
<h3 className="text-sm font-semibold"> </h3>
<p className="text-muted-foreground text-[10px]"> </p>
</div>
<hr className="border-border" />
<div className="space-y-4">
<div className="space-y-1">
<Label htmlFor="tableTheme" className="text-xs">
</Label>
<select
id="tableTheme"
value={tableStyle.theme || "default"}
onChange={(e) =>
onNestedChange("tableStyle", "theme", e.target.value as "default" | "striped" | "bordered" | "minimal")
}
className="h-8 w-full rounded-md border px-2 text-xs"
>
<option value="default"></option>
<option value="striped"></option>
<option value="bordered"></option>
<option value="minimal"></option>
</select>
</div>
<div className="space-y-1">
<Label htmlFor="headerStyle" className="text-xs">
</Label>
<select
id="headerStyle"
value={tableStyle.headerStyle || "default"}
onChange={(e) =>
onNestedChange("tableStyle", "headerStyle", e.target.value as "default" | "dark" | "light")
}
className="h-8 w-full rounded-md border px-2 text-xs"
>
<option value="default"></option>
<option value="dark"></option>
<option value="light"></option>
</select>
</div>
<div className="space-y-1">
<Label htmlFor="rowHeight" className="text-xs">
</Label>
<select
id="rowHeight"
value={tableStyle.rowHeight || "normal"}
onChange={(e) =>
onNestedChange("tableStyle", "rowHeight", e.target.value as "compact" | "normal" | "comfortable")
}
className="h-8 w-full rounded-md border px-2 text-xs"
>
<option value="compact"></option>
<option value="normal"></option>
<option value="comfortable"></option>
</select>
</div>
<div className="flex items-center space-x-2">
<Checkbox
id="alternateRows"
checked={tableStyle.alternateRows ?? false}
onCheckedChange={(checked) => onNestedChange("tableStyle", "alternateRows", checked)}
/>
<Label htmlFor="alternateRows" className="text-xs">
</Label>
</div>
<div className="flex items-center space-x-2">
<Checkbox
id="hoverEffect"
checked={tableStyle.hoverEffect ?? true}
onCheckedChange={(checked) => onNestedChange("tableStyle", "hoverEffect", checked)}
/>
<Label htmlFor="hoverEffect" className="text-xs">
</Label>
</div>
<div className="space-y-1">
<Label htmlFor="borderStyle" className="text-xs">
</Label>
<select
id="borderStyle"
value={tableStyle.borderStyle || "light"}
onChange={(e) =>
onNestedChange("tableStyle", "borderStyle", e.target.value as "none" | "light" | "heavy")
}
className="h-8 w-full rounded-md border px-2 text-xs"
>
<option value="none"></option>
<option value="light"></option>
<option value="heavy"></option>
</select>
</div>
</div>
</div>
</div>
);
};