diff --git a/apps/st/src/components/module/DataGrid.tsx b/apps/st/src/components/module/DataGrid.tsx index 3635d9f99..0cdd2bf94 100644 --- a/apps/st/src/components/module/DataGrid.tsx +++ b/apps/st/src/components/module/DataGrid.tsx @@ -729,7 +729,6 @@ const DataGrid = ({ idFieldName = "id", enableSort = false, gridHeight = 55, // vh 단위 - onRowDblClick, headerHeight = 60, fitStyle = GridFitStyle.EVEN, }: DataGridProps) => { @@ -789,20 +788,25 @@ useEffect(() => { const gridView = gridRef.current?.gridView; if (!gridView || !onCellDblClick) return; - (gridView as any).onCellDblClicked = (_grid: unknown, clickData: { cellType?: string; itemIndex?: number }) => { + gridView.onCellDblClicked = (_grid, clickData) => { if (clickData.cellType !== "data" || clickData.itemIndex === undefined) return; const row = rowDataRef.current[clickData.itemIndex]; - const cellIndex = (gridView as any).getCurrent?.(); - const fieldName = cellIndex?.fieldName ?? cellIndex?.column ?? ""; - if (row) onCellDblClick({ // ← 여기는 Props 콜백 호출이라 그대로 - row: row as Record, - fieldName, - itemIndex: clickData.itemIndex - }); + const cellIndex = gridView.getCurrent(); + const column = cellIndex.column; + const fieldName = + cellIndex.fieldName ?? + (typeof column === "string" ? column : ""); + if (row) { + onCellDblClick({ + row: row as Record, + fieldName, + itemIndex: clickData.itemIndex, + }); + } }; return () => { - (gridView as any).onCellDblClicked = undefined; + gridView.onCellDblClicked = undefined; }; }, [onCellDblClick]); useLayoutEffect(() => { diff --git a/apps/st/src/components/statistics/management/DomesticPopulationTab.tsx b/apps/st/src/components/statistics/management/DomesticPopulationTab.tsx index 56b3ead4e..02803315d 100644 --- a/apps/st/src/components/statistics/management/DomesticPopulationTab.tsx +++ b/apps/st/src/components/statistics/management/DomesticPopulationTab.tsx @@ -1,7 +1,7 @@ import { Button } from "@common/components"; import type { RealGridReact } from "realgrid-react"; import DataGrid from "@/components/module/DataGrid"; -import type { ColumnInfo } from "@/components/type/DataGrid.type"; +import type { ColumnInfo, GridViewWithEditCommit } from "@/components/type/DataGrid.type"; import { DomesticPopulationLeftColumnConfig, DomesticPopulationRightColumnConfig, @@ -12,7 +12,6 @@ import { UpperCodeSelectDialog } from "@/components/statistics/management/UpperC import type { usePopulationMappingTab } from "@/components/statistics/management/hooks/usePopulationMappingTab"; import { asGridRowData, asGridRowSetter, fromGridRow } from "@/components/statistics/management/lib/gridCast"; import type { DomesticPopulationItem } from "@/entities/statistics/model/ppltn/statistics-domestic-population-interface"; -import type { DataCellClickCallbackParams } from "@/components/type/DataGrid.type"; const leftColumnInfo: ColumnInfo = { @@ -99,7 +98,10 @@ const DomesticPopulationTab = ({ tab, statsYr, onFileButtonClick }: Props) => { onDataCellClick={({ row, fieldName }) => { if (fieldName === "mpinCd") return; if (fieldName === "admdstCd") { - (rightGridRef.current?.gridView as any)?.commit?.(); // ← commit 먼저 + const gridView = rightGridRef.current?.gridView as + | GridViewWithEditCommit + | undefined; + gridView?.commit?.(); setTimeout(() => { tab.setRightRowData((prev) => prev.map((r) => diff --git a/apps/st/src/components/statistics/management/ForeignPopulationTab.tsx b/apps/st/src/components/statistics/management/ForeignPopulationTab.tsx index f469dbf95..c6c6e5895 100644 --- a/apps/st/src/components/statistics/management/ForeignPopulationTab.tsx +++ b/apps/st/src/components/statistics/management/ForeignPopulationTab.tsx @@ -1,6 +1,6 @@ import { Button } from "@common/components"; import DataGrid from "@/components/module/DataGrid"; -import type { ColumnInfo } from "@/components/type/DataGrid.type"; +import type { ColumnInfo, GridViewWithEditCommit } from "@/components/type/DataGrid.type"; import { useRef } from "react"; import type { RealGridReact } from "realgrid-react"; import { @@ -97,7 +97,10 @@ const ForeignPopulationTab = ({ tab, statsYr, onFileButtonClick }: Props) => { onDataCellClick={({ row, fieldName }) => { if (fieldName === "mpinCd") return; if (fieldName === "admdstCd") { - (rightGridRef.current?.gridView as any)?.commit?.(); + const gridView = rightGridRef.current?.gridView as + | GridViewWithEditCommit + | undefined; + gridView?.commit?.(); setTimeout(() => { tab.setRightRowData((prev) => prev.map((r) => diff --git a/apps/st/src/components/statistics/management/hooks/useAdmdstRenewalTab.ts b/apps/st/src/components/statistics/management/hooks/useAdmdstRenewalTab.ts index a1fecef7b..2d1ab2d86 100644 --- a/apps/st/src/components/statistics/management/hooks/useAdmdstRenewalTab.ts +++ b/apps/st/src/components/statistics/management/hooks/useAdmdstRenewalTab.ts @@ -97,7 +97,7 @@ console.log("reducedList 이상한 것:", reducedList.filter(r => r.adstCd.lengt }; - const handleRowClick = async (rowData: AdmdstRenewalAddedItem, statsYr: string) => { + const handleRowClick = async (rowData: AdmdstRenewalAddedItem, _statsYr: string) => { const adstCd = String(rowData.adstCd ?? ""); if (!adstCd) { alert("행정동코드가 없습니다."); return; } diff --git a/apps/st/src/components/statistics/review/ExcretaTreatmentFacilityRvw.tsx b/apps/st/src/components/statistics/review/ExcretaTreatmentFacilityRvw.tsx index d7bd7a122..c053df71d 100644 --- a/apps/st/src/components/statistics/review/ExcretaTreatmentFacilityRvw.tsx +++ b/apps/st/src/components/statistics/review/ExcretaTreatmentFacilityRvw.tsx @@ -30,7 +30,7 @@ import { } from "@/components/statistics/review/ReviewOpinionDialog"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { ExcretaTreatmentFacilityInfoList } from "@/components/util/column/review/ExcretaTreatmentFacilityRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleExcludeMergeCells, toGridRows } from "@/components/util/grid/gridFunction"; const excretaTreatmentFacilityTab = ExcretaTreatmentFacilityInfoList[0]; @@ -67,6 +67,11 @@ const ExcretaTreatmentFacilityRvw = () => { }; }, []); + const cellStyleCallback = useMemo( + () => buildReviewRowTypeCurrCellStyleExcludeMergeCells(columnInfo.columns), + [columnInfo], + ); + const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => { const submit = statsStatusInfo.submitStatusCd != null @@ -280,7 +285,7 @@ const ExcretaTreatmentFacilityRvw = () => { showHeaderCheckbox={false} fixedColumns={columnInfo.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={cellStyleCallback} /> diff --git a/apps/st/src/components/statistics/review/PrivateSewageFacilityRvw.tsx b/apps/st/src/components/statistics/review/PrivateSewageFacilityRvw.tsx index 3d995127a..8281fb558 100644 --- a/apps/st/src/components/statistics/review/PrivateSewageFacilityRvw.tsx +++ b/apps/st/src/components/statistics/review/PrivateSewageFacilityRvw.tsx @@ -30,7 +30,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { PrivateSewageFacilityInfoListRvw } from "@/components/util/column/review/PrivateSewageFacilityColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = PrivateSewageFacilityInfoListRvw[0]?.tabKey ?? "ST00080001"; @@ -85,6 +85,11 @@ const PrivateSewageFacilityRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -391,7 +396,7 @@ const PrivateSewageFacilityRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/PublicSewageFacilityRvw.tsx b/apps/st/src/components/statistics/review/PublicSewageFacilityRvw.tsx index 837197c75..45079dbea 100644 --- a/apps/st/src/components/statistics/review/PublicSewageFacilityRvw.tsx +++ b/apps/st/src/components/statistics/review/PublicSewageFacilityRvw.tsx @@ -22,7 +22,7 @@ import { type ReviewOpinionDialogContext, } from "@/components/statistics/review/ReviewOpinionDialog"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleExcludeMergeCells, toGridRows } from "@/components/util/grid/gridFunction"; import { PublicSewageFacilityInfoList } from "@/components/util/column/review/PublicSewageFacilityRvwColumn"; @@ -55,6 +55,11 @@ const PublicSewageFacilityRvw = () => { }; }, []); + const cellStyleCallback = useMemo( + () => buildReviewRowTypeCurrCellStyleExcludeMergeCells(columnInfo.columns), + [columnInfo], + ); + const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => { const submit = statsStatusInfo.submitStatusCd != null ? String(statsStatusInfo.submitStatusCd) : ""; const prvn = statsStatusInfo.prvnStatusCd != null ? String(statsStatusInfo.prvnStatusCd) : ""; @@ -250,7 +255,7 @@ const PublicSewageFacilityRvw = () => { rowStartNum={columnInfo.rowStartNum} rowData={rowData} setRowData={setRowData} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={cellStyleCallback} /> { }; }, []); + const cellStyleCallback = useMemo( + () => buildReviewRowTypeCurrCellStyleExcludeMergeCells(columnInfo.columns), + [columnInfo], + ); + const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => { const submit = statsStatusInfo.submitStatusCd != null @@ -270,7 +275,7 @@ const PumpingStationRvw = () => { showHeaderCheckbox={false} fixedColumns={columnInfo.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={cellStyleCallback} /> diff --git a/apps/st/src/components/statistics/review/SewageExcretaRelatedRvw.tsx b/apps/st/src/components/statistics/review/SewageExcretaRelatedRvw.tsx index 2b52f7bed..2a4741661 100644 --- a/apps/st/src/components/statistics/review/SewageExcretaRelatedRvw.tsx +++ b/apps/st/src/components/statistics/review/SewageExcretaRelatedRvw.tsx @@ -30,7 +30,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewageExcretaRelatedInfoListRvw } from "@/components/util/column/review/SewageExcretaRelatedRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewageExcretaRelatedInfoListRvw[0]?.tabKey ?? "ST00120001"; @@ -88,6 +88,11 @@ const SewageExcretaRelatedRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -396,7 +401,7 @@ const SewageExcretaRelatedRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SewageExcretaSlurgeRvw.tsx b/apps/st/src/components/statistics/review/SewageExcretaSlurgeRvw.tsx index 04caffe8e..3d38d84c5 100644 --- a/apps/st/src/components/statistics/review/SewageExcretaSlurgeRvw.tsx +++ b/apps/st/src/components/statistics/review/SewageExcretaSlurgeRvw.tsx @@ -30,7 +30,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewageExcretaSludgeInfoListRvw } from "@/components/util/column/review/SewageExcretaSlurgeRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewageExcretaSludgeInfoListRvw[0]?.tabKey ?? "ST00110001"; @@ -88,6 +88,11 @@ const SewageExcretaSlurgeRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -397,7 +402,7 @@ const SewageExcretaSlurgeRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx b/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx index e01b33cb3..585556a7d 100644 --- a/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx +++ b/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx @@ -27,7 +27,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewagePipeMaintainColumnInfoList } from "@/components/util/column/review/SewagePipeMaintainRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewagePipeMaintainColumnInfoList[0]?.tabKey ?? "ST00030001"; @@ -103,6 +103,11 @@ const SewagePipeMaintainRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -409,7 +414,7 @@ const SewagePipeMaintainRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SewagePipeRvw.tsx b/apps/st/src/components/statistics/review/SewagePipeRvw.tsx index cfb70260d..ea105fd2f 100644 --- a/apps/st/src/components/statistics/review/SewagePipeRvw.tsx +++ b/apps/st/src/components/statistics/review/SewagePipeRvw.tsx @@ -32,7 +32,7 @@ import type { } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewagePipeColumnInfoListRvw } from "@/components/util/column/review/SewagePipeRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewagePipeColumnInfoListRvw[0]?.tabKey ?? "ST00020001"; @@ -156,6 +156,12 @@ const SewagePipeRvw = () => { })), [], ); + + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -459,7 +465,7 @@ const SewagePipeRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx b/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx index 3c9f2d34d..3bcf889ee 100644 --- a/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx +++ b/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx @@ -25,7 +25,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewageReservoirPumpInfoListRvw } from "@/components/util/column/review/SewageReservoirPumpRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewageReservoirPumpInfoListRvw[0]?.tabKey ?? "ST00040001"; @@ -107,6 +107,11 @@ const SewageReservoirPumpRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const activeStatsCd = activeStatsStatusInfo.statsCd ?? activeTab; const reviewOpinionContext = useMemo(() => { @@ -415,7 +420,7 @@ const SewageReservoirPumpRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SewerageFinanceRvw.tsx b/apps/st/src/components/statistics/review/SewerageFinanceRvw.tsx index 1757350db..e73e0653a 100644 --- a/apps/st/src/components/statistics/review/SewerageFinanceRvw.tsx +++ b/apps/st/src/components/statistics/review/SewerageFinanceRvw.tsx @@ -30,7 +30,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { SewerageFinanceInfoListRvw } from "@/components/util/column/review/SewerageFinanceRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = SewerageFinanceInfoListRvw[0]?.tabKey ?? "ST00090001"; @@ -88,6 +88,11 @@ const SewerageFinanceRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -394,7 +399,7 @@ const SewerageFinanceRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/SeweragePenetrationRateRvw.tsx b/apps/st/src/components/statistics/review/SeweragePenetrationRateRvw.tsx index e55fa0cd8..2fb7c8375 100644 --- a/apps/st/src/components/statistics/review/SeweragePenetrationRateRvw.tsx +++ b/apps/st/src/components/statistics/review/SeweragePenetrationRateRvw.tsx @@ -18,7 +18,7 @@ import type { import { statisticsApi } from "@/entities/statistics/api/statistics-service"; import { statisticsManagementApi } from "@/entities/statistics/api/statistics-management-service"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleExcludeMergeCells, toGridRows } from "@/components/util/grid/gridFunction"; import { ReviewOpinionDialog, type ReviewOpinionDialogContext, @@ -54,6 +54,11 @@ const SeweragePenetrationRateRvw = () => { }; }, []); + const cellStyleCallback = useMemo( + () => buildReviewRowTypeCurrCellStyleExcludeMergeCells(columnInfo.columns), + [columnInfo], + ); + const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => { const submit = statsStatusInfo.submitStatusCd != null ? String(statsStatusInfo.submitStatusCd) : ""; const prvn = statsStatusInfo.prvnStatusCd != null ? String(statsStatusInfo.prvnStatusCd) : ""; @@ -245,7 +250,7 @@ const SeweragePenetrationRateRvw = () => { rowStartNum={columnInfo.rowStartNum} rowData={rowData} setRowData={setRowData} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={cellStyleCallback} /> { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -395,7 +400,7 @@ const SewerageServiceLevelRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/statistics/review/WaterReuseRvw.tsx b/apps/st/src/components/statistics/review/WaterReuseRvw.tsx index ea2c16854..8fda5b79a 100644 --- a/apps/st/src/components/statistics/review/WaterReuseRvw.tsx +++ b/apps/st/src/components/statistics/review/WaterReuseRvw.tsx @@ -30,7 +30,7 @@ import { import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type"; import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { WaterReuseInfoListRvw } from "@/components/util/column/review/WaterReuseRvwColumn"; -import { reviewRowTypeCurrCellStyleCallback, toGridRows } from "@/components/util/grid/gridFunction"; +import { buildReviewRowTypeCurrCellStyleCallbackByTab, toGridRows } from "@/components/util/grid/gridFunction"; const firstTabKey = WaterReuseInfoListRvw[0]?.tabKey ?? "ST00100001"; @@ -91,6 +91,11 @@ const WaterReuseRvw = () => { })); }, []); + const reviewCellStyleCallbackByTab = useMemo( + () => buildReviewRowTypeCurrCellStyleCallbackByTab(columnInfo), + [columnInfo], + ); + const reviewOpinionContext = useMemo(() => { if (lastSearchValues == null) return null; return { @@ -398,7 +403,7 @@ const WaterReuseRvw = () => { showHeaderCheckbox={false} fixedColumns={info.fixedColumns} enableSort={false} - cellStyleCallback={reviewRowTypeCurrCellStyleCallback} + cellStyleCallback={reviewCellStyleCallbackByTab.get(tabKey)} /> ); diff --git a/apps/st/src/components/type/DataGrid.type.ts b/apps/st/src/components/type/DataGrid.type.ts index d3608ad3a..00e4fbb01 100644 --- a/apps/st/src/components/type/DataGrid.type.ts +++ b/apps/st/src/components/type/DataGrid.type.ts @@ -81,6 +81,12 @@ export type GridView = { getDataRow(itemIndex: number): number; }; +/** RealGrid gridView 편집 확정 API (realgrid-react gridView 타입에 미포함) */ +export type GridViewWithEditCommit = { + commit?: (force?: boolean) => void; + cancel?: () => void; +}; + export type MergeCallback = ( grid: GridView, column: DataColumn, diff --git a/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts b/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts index de413a34b..98980f88d 100644 --- a/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts @@ -52,7 +52,7 @@ const rawMaintainList = [ ] }, { name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, mergeCells: true, sortdisable: true }, - { name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, mergeCells: true }, + // { name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, mergeCells: true }, { name: 'displayYear', fieldName: 'displayYear', @@ -125,7 +125,7 @@ const rawMaintainList = [ items: [ { column: 'ctpvNm', footerUserSpans: [{ colspan: 4 }, { colspan: 4 }] }, 'sggNm', - 'admdstNm', + // 'admdstNm', ] }, 'displayYear', @@ -197,7 +197,7 @@ const rawMaintainList = [ ] }, { name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, mergeCells: true, sortdisable: true }, - { name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, mergeCells: true }, + // { name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, mergeCells: true }, { name: 'displayYear', fieldName: 'displayYear', @@ -277,7 +277,7 @@ const rawMaintainList = [ items: [ { column: 'ctpvNm', footerUserSpans: [{ colspan: 4 }, { colspan: 4 }] }, // sido -> ctpvNm 'sggNm', - 'admdstNm' + // 'admdstNm' ] }, 'displayYear', diff --git a/apps/st/src/components/util/column/review/SewerageFinanceRvwColumn.ts b/apps/st/src/components/util/column/review/SewerageFinanceRvwColumn.ts index f5a9665ef..5e5e1f372 100644 --- a/apps/st/src/components/util/column/review/SewerageFinanceRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SewerageFinanceRvwColumn.ts @@ -51,13 +51,13 @@ const reviewAddressColumns = [ mergeCells: true, sortdisable: true, }, - { - name: "admdstNm", - fieldName: "admdstNm", - header: { text: "행정구역명" }, - mergeCells: true, - sortdisable: true, - }, + // { + // name: "admdstNm", + // fieldName: "admdstNm", + // header: { text: "행정구역명" }, + // mergeCells: true, + // sortdisable: true, + // }, { name: "displayYear", fieldName: "displayYear", @@ -73,7 +73,7 @@ const reviewAddressLayout = { items: [ { column: "ctpvNm", footerUserSpans: [{ colspan: 4 }, { colspan: 4 }] }, "sggNm", - "admdstNm", + // "admdstNm", ], }; diff --git a/apps/st/src/components/util/grid/gridFunction.ts b/apps/st/src/components/util/grid/gridFunction.ts index 09f88fde9..ae19943d8 100644 --- a/apps/st/src/components/util/grid/gridFunction.ts +++ b/apps/st/src/components/util/grid/gridFunction.ts @@ -1,4 +1,4 @@ -import type { CellStyleCallback } from "@/components/type/DataGrid.type"; +import type { CellStyleCallback, ColumnConfig } from "@/components/type/DataGrid.type"; /** 검토(review) 그리드: rowType이 CURR인 행(당해 연도) 흰색 배경 */ export const reviewRowTypeCurrCellStyleCallback: CellStyleCallback = ({ row }) => { @@ -8,6 +8,59 @@ export const reviewRowTypeCurrCellStyleCallback: CellStyleCallback = ({ row }) = return undefined; }; +/** 검토(review) CURR 행 스타일 — 지정 컬럼은 제외(merge/fixed 영역 깜빡임 방지) */ +export function createReviewRowTypeCurrCellStyleCallback(options?: { + excludeFieldNames?: readonly string[]; +}): CellStyleCallback { + const excluded = + options?.excludeFieldNames != null + ? new Set(options.excludeFieldNames) + : null; + + return ({ row, fieldName }) => { + if (excluded?.has(fieldName)) { + return undefined; + } + if (String(row.rowType ?? "") === "CURR") { + return "rg-cell-rowtype-curr"; + } + return undefined; + }; +} + +/** mergeCells 컬럼은 CURR 스타일 제외(merge 영역 깜빡임 방지) */ +function collectMergeCellFieldNames( + columns: readonly Pick[], +): string[] { + return columns + .filter((col) => col.mergeCells === true && col.fieldName) + .map((col) => col.fieldName); +} + +export function buildReviewRowTypeCurrCellStyleExcludeMergeCells( + columns: readonly Pick[], +): CellStyleCallback { + return createReviewRowTypeCurrCellStyleCallback({ + excludeFieldNames: collectMergeCellFieldNames(columns), + }); +} + +export function buildReviewRowTypeCurrCellStyleCallbackByTab( + tabs: readonly { + tabKey: string; + columns?: readonly Pick[]; + }[], +): Map { + const map = new Map(); + for (const tab of tabs) { + map.set( + tab.tabKey, + buildReviewRowTypeCurrCellStyleExcludeMergeCells(tab.columns ?? []), + ); + } + return map; +} + /** * 객체 배열을 그리드 row 형식으로 변환 (null/undefined → ""). * 어떤 엔티티 타입이든 공통 사용 가능.