Merge branch 'iipbs/common/main' into iipbs/fo/dev

This commit is contained in:
Your Name
2025-07-27 14:44:17 +09:00
3 changed files with 33 additions and 27 deletions
@@ -18,6 +18,7 @@ type MonthPickerProps = {
selectClass?: string;
readOnly?: boolean;
startYear?: number; // 시작 연도 props 추가
yearReadOnly?: boolean;
};
// yyyyMM → Date 객체
@@ -39,6 +40,7 @@ export const DateMonthPicker = ({
selectClass,
readOnly = false,
startYear,
yearReadOnly = false,
}: MonthPickerProps) => {
const [open, setOpen] = useState(false);
@@ -78,6 +80,7 @@ export const DateMonthPicker = ({
currentMonth={parsedDate}
onMonthChange={handleSelect}
startYear={startYear}
yearReadOnly={yearReadOnly}
/>
</PopoverContent>
</Popover>
@@ -29,9 +29,10 @@ export type MonthPickerProps = {
shouldClosePopover?: boolean
) => void;
startYear?: number;
yearReadOnly?: boolean;
};
export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) {
export function MonthPicker({ currentMonth, onMonthChange, startYear, yearReadOnly }: MonthPickerProps) {
const today = startOfToday();
const currentYear = today.getFullYear();
@@ -73,6 +74,7 @@ const selectedYear = parseInt(yearFromProp);
<div className="flex justify-center pt-1">
<Select
value={yearFromProp}
disabled={yearReadOnly}
onValueChange={(selectedYearStr) => {
const selectedYearNum = parseInt(selectedYearStr);
const newDate = new Date(
@@ -81,6 +81,8 @@ export function UiTable({
const handlePageChange = (page: number) => {
setCur(page);
onPageChange(page);
if (index == 0)
setIdx(0)
};
const handleCellClick = (index: number, headId: string) => {
@@ -90,6 +92,7 @@ export function UiTable({
}
};
return (
<>
{headName ? (
@@ -116,14 +119,13 @@ export function UiTable({
head.id.length > 1 &&
(boldArray.includes(index) ? (
<TableCell
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${
cellClick && idx === index
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
? "cursor-pointer !font-[1000]"
: cellClick
? "cursor-pointer"
: ""
} sticky top-20 z-40 bg-secondary !font-bold`}
style={{ top: `${headerHeight + index * 32-4}px` }}
} sticky top-20 z-40 bg-secondary !font-bold`}
style={{ top: `${headerHeight + index * 32 - 4}px` }}
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
@@ -131,39 +133,38 @@ export function UiTable({
? String(el[head.id] ?? "")
: String(el[head.id]).includes(".")
? String(el[head.id])
.split(".")
.map((part, index) =>
index === 0
? part.replace(
/\B(?=(\d{3})+(?!\d))/g,
",",
)
: part,
)
.join(".")
.split(".")
.map((part, index) =>
index === 0
? part.replace(
/\B(?=(\d{3})+(?!\d))/g,
",",
)
: part,
)
.join(".")
: String(el[head.id] ?? "").replace(
/\B(?=(\d{3})+(?!\d))/g,
",",
)}
/\B(?=(\d{3})+(?!\d))/g,
",",
)}
</TableCell>
) : (
<TableCell
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${
cellClick && idx === index
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
? "cursor-pointer !font-[1000]"
: cellClick
? "cursor-pointer"
: ""
} mt-[${boldArray.length * 40}px]`}
} mt-[${boldArray.length * 40}px]`}
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
{
//체크박스 유형애서 readOnly가 필요한 경우를 위해서 ChkClass 를 사용해서 readOnly 처리함.
typeof el[head.id] === "object" &&
el[head.id] !== null &&
"chk" in (el[head.id] as object) &&
"readonly" in (el[head.id] as object) ? (
el[head.id] !== null &&
"chk" in (el[head.id] as object) &&
"readonly" in (el[head.id] as object) ? (
<Checkbox
checked={
(el[head.id] as ChkClass)?.chk === true
@@ -199,9 +200,9 @@ export function UiTable({
.map((part, index) =>
index === 0
? part.replace(
/\B(?=(\d{3})+(?!\d))/g,
",",
)
/\B(?=(\d{3})+(?!\d))/g,
",",
)
: part,
)
.join(".")