Merge branch 'iipbs/sn/dev'

This commit is contained in:
2026-09-08 22:29:39 +09:00
108 changed files with 2515 additions and 1371 deletions
@@ -57,6 +57,10 @@ function Gis({
// 외부 업무 흐름에서 특정 시설물 레이어를 기존 체크 상태에 추가하도록 요청한다.
checkedLayerRequest = null,
searchBar: SearchBar,
// 화면별 상단 정렬과 인접 패널 회피를 위한 검색바 위치 전용 클래스다.
searchBarContainerClassName = "",
// sn 관망도처럼 베이스맵 선택지를 항상 노출하는 화면에서만 탭 형태를 사용한다.
alwaysVisibleMapTabs = false,
waterDepth: WaterDepth = null,
layerSettingView: LayerSettingView = null,
inlineLayerSettingView,
@@ -65,6 +69,8 @@ function Gis({
layerLegendIconVisible,
// 목록·액션 아이콘이 지도 레이어 체크를 선행 조건으로 요구하는지 여부다.
layerIconRequiresChecked = true,
// 목록 액션의 기능은 유지하면서 텍스트를 목록 아이콘으로 표시할지 여부다.
layerActionIconOnly = false,
isPlaying = false,
setIsPlaying = () => { },
targetLayerTypes = [],
@@ -79,11 +85,14 @@ function Gis({
viewExtent,
viewMinZoom,
showZoomLevel = false,
toolBarIconSize,
zoomGuide,
showFloatingSearchButton = true,
treeTogglePosition = "center",
detachedTreeToggleButton = false,
showLayerPanelTitle = true,
// sn 관망도처럼 트리와 선택 설정을 카드 두 개로 구분해야 하는 화면에서만 활성화한다.
sectionedTreePanel = false,
showZoomScaleInfo = false,
}) {
const mapRef = useRef();
@@ -322,6 +331,7 @@ function Gis({
layerIconVisible={layerIconVisible}
layerLegendIconVisible={layerLegendIconVisible}
layerIconRequiresChecked={layerIconRequiresChecked}
layerActionIconOnly={layerActionIconOnly}
sinkholeLegendIconVisible={sinkholeLegendIconVisible}
isPlaying={isPlaying}
setIsPlaying={setIsPlaying}
@@ -334,6 +344,7 @@ function Gis({
toggleButtonPosition={treeTogglePosition}
detachedToggleButton={detachedTreeToggleButton}
showLayerPanelTitle={showLayerPanelTitle}
sectionedPanel={sectionedTreePanel}
/>
{typeof WaterDepth === "function" && (
@@ -363,15 +374,15 @@ function Gis({
)}
{/* 시도/시군구 조회 영역 */}
{SearchBar && (
<div className="absolute left-1/2 top-4 z-30 w-max -translate-x-1/2 rounded">
<div className={`absolute left-1/2 top-4 z-30 w-max -translate-x-1/2 rounded ${searchBarContainerClassName}`}>
{SearchBar}
</div>
)}
<GisToolBar />
<GisToolBar iconSize={toolBarIconSize} />
{showZoomLevel && (
<GisZoomLevel zoomGuide={zoomGuide} showZoomScaleInfo={showZoomScaleInfo} />
)}
<GisMapToggle />
<GisMapToggle alwaysVisibleTabs={alwaysVisibleMapTabs} />
<GisSelect
onFeatureSelect={handleFeatureSelect}
onMapBlankClick={onMapBlankClick}
@@ -1,30 +1,67 @@
import React, { useContext, useState } from 'react';
import { GisContext } from './Gis';
import React, { useContext, useState } from "react";
import { GisContext } from "./Gis";
export default React.memo(function MapToggleBtn() {
const { gisCore } = useContext(GisContext);
const [activeMap, setActiveMap] = useState({ label: '일반', type: 'base' }); // 기본 선택값
export default React.memo(function MapToggleBtn({ alwaysVisibleTabs = false }) {
const { gisCore } = useContext(GisContext);
const [activeMap, setActiveMap] = useState({ label: "일반", type: "base" }); // 기본 선택값
const handleSelect = mapObj => {
setActiveMap(mapObj);
gisCore.changeBaseLayer(mapObj.type);
};
const handleSelect = (mapObj) => {
setActiveMap(mapObj);
gisCore.changeBaseLayer(mapObj.type);
};
return (
<div className="mapbtn">
<button className="sprite_gis viewer" title="지도선택">지도 선택</button>
<ul className="choice_map">
<li className={activeMap.type === 'base' ? 'on' : ''}>
<button className="map1" id="base" title="일반지도" onClick={() => handleSelect({ label: '일반', type: 'base' })}>
<div>일반지도</div>
</button>
</li>
<li className={activeMap.type === 'satellite' ? 'on' : ''}>
<button className="map2" id="satelite" title="위성지도" onClick={() => handleSelect({ label: '위성', type: 'satellite' })}>
<div>위성지도</div>
</button>
</li>
</ul>
</div>
);
if (alwaysVisibleTabs) {
return (
<div className="mapbtn mapbtn-tabs">
<div className="map-type-tabs" role="group" aria-label="지도 유형 선택">
<button
type="button"
aria-pressed={activeMap.type === "base"}
className={activeMap.type === "base" ? "on" : ""}
onClick={() => handleSelect({ label: "일반", type: "base" })}
>
일반지도
</button>
<button
type="button"
aria-pressed={activeMap.type === "satellite"}
className={activeMap.type === "satellite" ? "on" : ""}
onClick={() => handleSelect({ label: "위성", type: "satellite" })}
>
위성지도
</button>
</div>
</div>
);
}
return (
<div className="mapbtn">
<button className="sprite_gis viewer" title="지도선택">
지도 선택
</button>
<ul className="choice_map">
<li className={activeMap.type === "base" ? "on" : ""}>
<button
className="map1"
id="base"
title="일반지도"
onClick={() => handleSelect({ label: "일반", type: "base" })}
>
<div>일반지도</div>
</button>
</li>
<li className={activeMap.type === "satellite" ? "on" : ""}>
<button
className="map2"
id="satelite"
title="위성지도"
onClick={() => handleSelect({ label: "위성", type: "satellite" })}
>
<div>위성지도</div>
</button>
</li>
</ul>
</div>
);
});
@@ -1,71 +1,102 @@
import React from 'react';
import GisApp from './lib/gis.core';
import GisOlMeasure from './lib/gis.measure';
import { useContext } from 'react';
import { useGisContext } from './Gis';
export default React.memo(function GisToolBar() {
const { gisMap } = useGisContext();
if (!gisMap) return <></>;
const gisMeasuer = new GisOlMeasure(gisMap);
GisApp.Module.measure = gisMeasuer;
const zoomIn = () => {
if (gisMap.getView().getMaxZoom() > gisMap.getView().getZoom()) {
gisMap.getView().animate({
zoom: gisMap.getView().getZoom() + 1,
duration: 250,
});
}
};
const zoomOut = () => {
if (gisMap.getView().getMaxZoom() > gisMap.getView().getZoom()) {
gisMap.getView().animate({
zoom: gisMap.getView().getZoom() - 1,
duration: 250,
});
}
};
import React from "react";
import { RotateCcw, Ruler, Scan, ZoomIn, ZoomOut } from "lucide-react";
import GisApp from "./lib/gis.core";
import GisOlMeasure from "./lib/gis.measure";
import { useContext } from "react";
import { useGisContext } from "./Gis";
export default React.memo(function GisToolBar({ iconSize }) {
const { gisMap } = useGisContext();
const useVectorIcons = Number.isFinite(iconSize) && iconSize > 0;
if (!gisMap) return <></>;
const gisMeasuer = new GisOlMeasure(gisMap);
GisApp.Module.measure = gisMeasuer;
const zoomIn = () => {
if (gisMap.getView().getMaxZoom() > gisMap.getView().getZoom()) {
gisMap.getView().animate({
zoom: gisMap.getView().getZoom() + 1,
duration: 250,
});
}
};
const zoomOut = () => {
if (gisMap.getView().getMaxZoom() > gisMap.getView().getZoom()) {
gisMap.getView().animate({
zoom: gisMap.getView().getZoom() - 1,
duration: 250,
});
}
};
const measure = type => {
gisMeasuer.addInteraction(type);
};
const measure = (type) => {
gisMeasuer.addInteraction(type);
};
const reset = () => {
gisMeasuer.removeFeature();
};
return (
<>
<div className="custom-toolbar">
<div className="tool-bar">
<h3>toolbar 영역</h3>
<ul>
<li>
<div className="btn_control_zoomin" title="확대" onClick={zoomIn}>
<span>확대</span>
</div>
</li>
<li>
<div className="btn_control_zoomout" title="축소" onClick={zoomOut}>
<span>축소</span>
</div>
</li>
<li>
<div className="btn_control_ruler btn_control_measure" title="거리 측정" onClick={() => measure(GisApp.measure.LineString)}>
<span>거리측정</span>
</div>
</li>
<li>
<div className="btn_control_area btn_control_measure" title="면적 측정" onClick={() => measure(GisApp.measure.Polygon)}>
<span>면적측정</span>
</div>
</li>
<li>
<div className="sprite_gis icon4 btn_select_cancel" title="리셋" onClick={() => reset()}>
<span>리셋</span>
</div>
</li>
</ul>
</div>
</div>
</>
);
const reset = () => {
gisMeasuer.removeFeature();
};
return (
<>
<div className="custom-toolbar">
<div
className={`tool-bar ${useVectorIcons ? "tool-bar-vector-icons" : ""}`}
>
<h3>toolbar 영역</h3>
<ul>
<li>
<div className="btn_control_zoomin" title="확대" onClick={zoomIn}>
{useVectorIcons && (
<ZoomIn size={iconSize} aria-hidden="true" />
)}
<span>확대</span>
</div>
</li>
<li>
<div
className="btn_control_zoomout"
title="축소"
onClick={zoomOut}
>
{useVectorIcons && (
<ZoomOut size={iconSize} aria-hidden="true" />
)}
<span>축소</span>
</div>
</li>
<li>
<div
className="btn_control_ruler btn_control_measure"
title="거리 측정"
onClick={() => measure(GisApp.measure.LineString)}
>
{useVectorIcons && <Ruler size={iconSize} aria-hidden="true" />}
<span>거리측정</span>
</div>
</li>
<li>
<div
className="btn_control_area btn_control_measure"
title="면적 측정"
onClick={() => measure(GisApp.measure.Polygon)}
>
{useVectorIcons && <Scan size={iconSize} aria-hidden="true" />}
<span>면적측정</span>
</div>
</li>
<li>
<div
className="sprite_gis icon4 btn_select_cancel"
title="리셋"
onClick={() => reset()}
>
{useVectorIcons && (
<RotateCcw size={iconSize} aria-hidden="true" />
)}
<span>리셋</span>
</div>
</li>
</ul>
</div>
</div>
</>
);
});
@@ -4,7 +4,7 @@ import {
getBackendOptions,
DndProvider,
} from "@minoru/react-dnd-treeview";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { ChevronLeft, ChevronRight, Layers } from "lucide-react";
import React, { useEffect, useLayoutEffect, useState, useRef, useCallback } from "react";
import { showBusinessUserMessage } from "../../lib/user-message";
@@ -33,7 +33,9 @@ import GisApp from "./lib/gis.core";
* - layerIconVisible: (선택) 레이어 행 우측 액션 아이콘 노출 여부를 결정하는 함수
* - layerLegendIconVisible: (선택) 레이어 행 범례 아이콘 노출 여부를 결정하는 함수
* - layerIconRequiresChecked: (선택) 액션 실행 전에 레이어 체크를 요구할지 여부
* - layerActionIconOnly: (선택) 목록 액션을 텍스트 대신 목록 아이콘으로 표시할지 여부
* - detachedToggleButton: (선택) 접기/펼치기 버튼을 패널 밖 고정 핸들로 노출할지 여부
* - sectionedPanel: (선택) 트리와 선택 레이어 설정을 회색 배경 위의 독립 카드로 표시할지 여부
*/
export default React.memo(function GisTree({
checkedNodes = [],
@@ -53,12 +55,14 @@ export default React.memo(function GisTree({
layerIconVisible,
layerLegendIconVisible = () => true,
layerIconRequiresChecked = true,
layerActionIconOnly = false,
sinkholeLegendIconVisible = false,
inlineLayerSettingView,
treeSectionClassName = "",
toggleButtonPosition = "center",
showLayerPanelTitle = true,
detachedToggleButton = false,
sectionedPanel = false,
}) {
const { gisCore, treeData } = useGisContext();
@@ -584,38 +588,57 @@ export default React.memo(function GisTree({
// 렌더링
// =====================
if (!treeData || treeData.length === 0) return null;
const toggleButtonPositionClass =
toggleButtonPosition === "top" ? "top-4" : "top-1/2 -translate-y-1/2";
const thinScrollbarClass =
"[scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px]";
const treeSectionClassNames = [treeSectionClassName, thinScrollbarClass].filter(Boolean).join(" ");
"[scrollbar-gutter:stable] [scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px]";
const treeSectionClassNames = [treeSectionClassName].filter(Boolean).join(" ");
// 섹션형 패널은 지도 트리와 선택 레이어 설정을 각각 독립된 카드로 구분한다.
const panelShellClassName = sectionedPanel
? "gap-[6px] border-r-0 bg-[#E5E5E5] p-1"
: "border-r border-border bg-background";
const treePanelClassName = sectionedPanel
? "min-h-0 grow flex-col overflow-hidden rounded-[6px] border border-border bg-background shadow-none"
: "min-h-0 grow overflow-hidden border-none bg-background shadow-none";
const treeContentScrollClassName = sectionedPanel
? `min-h-0 flex-1 overflow-y-scroll ${thinScrollbarClass}`
: `h-full overflow-y-auto p-2 ${showLayerPanelTitle ? "pt-0" : "pt-2"} ${thinScrollbarClass}`;
return (
<>
{/* 사이드 패널 */}
<div
className={`gis-layer-panel absolute left-0 top-0 z-40 flex h-full w-[250px] flex-col overflow-hidden border-r border-border bg-background text-foreground transition-all duration-300 ${visible
? "translate-x-0 opacity-100"
: "pointer-events-none -translate-x-full opacity-0"
className={`gis-layer-panel absolute left-0 top-0 z-40 flex h-full w-[250px] flex-col overflow-hidden text-foreground duration-300 ${sectionedPanel ? "transition-transform ease-in-out" : "transition-all"} ${panelShellClassName} ${visible
? sectionedPanel ? "translate-x-0" : "translate-x-0 opacity-100"
: sectionedPanel ? "pointer-events-none -translate-x-full" : "pointer-events-none -translate-x-full opacity-0"
}`}
>
<div
ref={layerPanelScrollRef}
onScroll={handleLayerPanelScroll}
className={`grow overflow-y-auto border-none p-2 ${showLayerPanelTitle ? "pt-0" : "pt-2"} shadow-none ${activeTab === "layers" ? "block" : "hidden"
className={`${treePanelClassName} ${activeTab === "layers" ? (sectionedPanel ? "flex" : "block") : "hidden"
}`}
>
{showLayerPanelTitle && (
<>
<h3 className="gis-layer-panel-title mx-2 my-4 text-center text-3xl font-bold text-label">시설물</h3>
<hr className="mb-4 border-border" />
</>
{sectionedPanel && (
<div className="gis-layer-section-header flex h-[38px] shrink-0 items-center gap-2 border-b border-border bg-background px-3">
<span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-sm bg-[#EAF3FF] text-[#168CFF]">
<Layers size={14} strokeWidth={2} />
</span>
<h3 className="text-[1.4rem] font-bold text-foreground">레이어 관리</h3>
</div>
)}
{/* DnD Tree */}
<div className={treeSectionClassNames || undefined}>
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
<div
ref={layerPanelScrollRef}
onScroll={handleLayerPanelScroll}
className={treeContentScrollClassName}
>
{showLayerPanelTitle && (
<>
<h3 className="gis-layer-panel-title mx-2 my-4 text-center text-3xl font-bold text-label">시설물</h3>
<hr className="mb-4 border-border" />
</>
)}
{/* DnD Tree */}
<div className={treeSectionClassNames || undefined}>
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
<Tree
tree={nodes}
rootId={null}
@@ -642,7 +665,7 @@ export default React.memo(function GisTree({
return (
<div style={{ display: isVisible ? "block" : "none" }}>
<div
className="gis-layer-row flex w-full items-center gap-2 rounded px-2 py-1 hover:bg-accent"
className={`gis-layer-row flex w-full items-center gap-2 rounded px-2 py-1 ${sectionedPanel ? "hover:bg-[#f5f5f5]" : "hover:bg-accent"}`}
style={{
marginInlineStart: depth * 16,
width: `calc(100% - ${depth * 16}px)`,
@@ -671,21 +694,39 @@ export default React.memo(function GisTree({
>
{node.text}
</span>
{showLayerActionButton && (
<button
type="button"
className="gis-layer-action-button ml-auto shrink-0 rounded-sm border border-primary bg-background px-2 py-[1px] text-[1.1rem] font-medium leading-5 text-primary transition-colors hover:bg-accent"
onClick={() =>
handleLayerImgClick(
{showLayerActionButton && (
<button
type="button"
className={layerActionIconOnly
? "gis-layer-action-button ml-auto grid h-[24px] w-[24px] shrink-0 place-items-center rounded-sm bg-transparent p-0 text-[#168CFF] transition-colors hover:bg-accent"
: "gis-layer-action-button ml-auto shrink-0 rounded-sm border border-primary bg-background px-2 py-[1px] text-[1.1rem] font-medium leading-5 text-primary transition-colors hover:bg-accent"}
onClick={() =>
handleLayerImgClick(
node.data.lyrTyNm,
node.id,
node
)
}
title={`${node.text} 목록보기`}
>
목록보기
</button>
)
}
title={`${node.text} 목록보기`}
aria-label={`${node.text} 목록보기`}
>
{layerActionIconOnly ? (
<svg
aria-hidden="true"
viewBox="0 0 24 24"
className="h-[18px] w-[18px]"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
>
<path d="M9 6h11M9 12h11M9 18h11" />
<path d="M4 6h.01M4 12h.01M4 18h.01" strokeWidth="3" />
</svg>
) : (
"목록보기"
)}
</button>
)}
{!showLayerActionButton && showLayerActionIcon && (
<span className="shrink-0">
@@ -720,11 +761,16 @@ export default React.memo(function GisTree({
return aOrder - bOrder;
}}
/>
</DndProvider>
</DndProvider>
</div>
</div>
</div>
{LayerSettingView && (
<div className="gis-layer-setting shrink-0 bg-background px-2 pb-3">
<div
className={sectionedPanel
? "gis-layer-setting shrink-0 bg-transparent p-0"
: "gis-layer-setting shrink-0 bg-background px-2 pb-3"}
>
<LayerSettingView />
</div>
)}
@@ -737,24 +783,31 @@ export default React.memo(function GisTree({
</button>
)}
</div>
{detachedToggleButton && visible && (
{detachedToggleButton && (
<button
onClick={() => setVisible(false)}
className={`gis-layer-toggle absolute left-[250px] z-50 flex h-[36px] w-[20px] transform items-center justify-center rounded-[4px] border border-border bg-background text-primary shadow-[0_8px_18px_rgba(15,23,42,0.14)] transition hover:bg-accent ${toggleButtonPositionClass}`}
title="접기"
onClick={() => setVisible(!visible)}
className={`gis-layer-toggle absolute left-[250px] z-50 flex h-[36px] transform items-center justify-center border border-border bg-background shadow-[0_8px_18px_rgba(15,23,42,0.14)] transition-transform duration-300 ease-in-out hover:bg-accent ${visible ? "translate-x-0" : "-translate-x-[250px]"} ${sectionedPanel
? "w-[20px] rounded-l-none rounded-r-[4px] text-[#666666]"
: "w-[20px] rounded-[4px] text-primary"
} ${toggleButtonPositionClass}`}
title={visible ? "접기" : "열기"}
aria-label={visible ? "레이어 패널 접기" : "레이어 패널 열기"}
aria-expanded={visible}
>
<ChevronLeft className="h-4 w-4" />
{visible ? (
<ChevronLeft className={sectionedPanel ? "h-8 w-8" : "h-4 w-4"} />
) : (
<ChevronRight className={sectionedPanel ? "h-8 w-8" : "h-4 w-4"} />
)}
</button>
)}
{!visible && (
{!visible && !detachedToggleButton && (
<button
onClick={() => setVisible(true)}
className={detachedToggleButton
? `gis-layer-toggle absolute left-0 z-50 flex h-[36px] w-[20px] transform items-center justify-center rounded-[4px] border border-border bg-background text-primary shadow-[0_8px_18px_rgba(15,23,42,0.14)] transition hover:bg-accent ${toggleButtonPositionClass}`
: `gis-layer-toggle absolute left-[-3px] z-50 transform rounded-r border border-r border-border bg-background px-1 py-2 text-foreground shadow-sm ${toggleButtonPositionClass}`}
className={`gis-layer-toggle absolute left-[-3px] z-50 transform rounded-r border border-r border-border bg-background px-1 py-2 text-foreground shadow-sm ${toggleButtonPositionClass}`}
title="열기"
>
{detachedToggleButton ? <ChevronRight className="h-4 w-4" /> : <ChevronRight size={16} />}
<ChevronRight size={16} />
</button>
)}
</>
@@ -101,6 +101,56 @@
text-align: center;
}
.mapbtn.mapbtn-tabs {
width: auto;
}
.mapbtn .map-type-tabs {
display: flex;
width: 144px;
height: 40px;
padding: 2px;
overflow: hidden;
box-sizing: border-box;
background: #fff;
border: 1px solid #9aa7b8;
border-radius: 6px;
box-shadow: 0 0 5px #999;
}
.mapbtn .map-type-tabs button {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
min-width: 0;
height: 100%;
padding: 0 8px;
box-sizing: border-box;
background: #fff;
border-radius: 6px;
border: 0;
color: #666;
font-family: inherit;
font-size: 12px;
font-weight: 600;
line-height: 18px;
white-space: nowrap;
}
.mapbtn .map-type-tabs button.on {
background: #0279fa;
color: #fff;
}
.mapbtn .map-type-tabs button:focus-visible {
position: relative;
z-index: 1;
outline: 2px solid #2094fa;
outline-offset: -2px;
}
.tool-bar {
position: absolute;
top: 70px;
@@ -186,9 +236,9 @@
bottom: 6px;
display: flex;
flex-direction: column;
gap: 4px;
min-width: 126px;
padding: 7px 10px;
gap: 8px;
min-width: 130px;
padding: 8px 10px;
border: 1px solid #9aa7b8;
border-radius: 6px;
background: rgba(255, 255, 255, 0.96);
@@ -242,9 +292,14 @@
cursor: pointer;
}
.zoom-level-panel .zoom-level-btn:first-child {
border-radius: 3px 3px 0 0;
}
.zoom-level-panel .zoom-level-btn:last-child {
border-top: 1px solid #eeeeee;
border-bottom: 0 none;
border-radius: 0 0 3px 3px;
}
.zoom-level-btn:hover {
@@ -32,6 +32,8 @@ interface SearchBarProps {
facilityTypes: { text: string; val: string }[];
sidoSearchZoom?: number;
facilityLayerFilter?: FacilityLayerFilter;
/** 관망도 전용 3개 셀렉트와 조회 버튼을 하나로 연결한 검색바 레이아웃이다. */
integrated?: boolean;
}
interface CenterSelectDataType extends SelectDataType {
@@ -43,6 +45,7 @@ export const ProcSearchBar = ({
facilityTypes,
sidoSearchZoom = 11,
facilityLayerFilter,
integrated = false,
}: SearchBarProps) => {
const [sidoValue, setSidoValue] = useState("0");
const [sigunValue, setSigunValue] = useState("0");
@@ -473,6 +476,75 @@ export const ProcSearchBar = ({
await searchLayer.showSearchResultsFromGeoJSON(layerNm, featureId);
};
if (integrated) {
const selectRootClass = "box-border !h-[44px] !w-full !p-0";
const selectTriggerClass =
"relative box-border !h-[44px] !w-full !border-0 !bg-white !px-4 !py-0 !text-[14px] !font-normal !leading-[20px] !text-[#374151] focus:!z-[2] focus:!ring-2 focus:!ring-inset focus:!ring-[#2094FA] data-[state=open]:!z-[2] data-[state=open]:!ring-2 data-[state=open]:!ring-inset data-[state=open]:!ring-[#2094FA] [&>span]:!block [&>span]:min-w-0 [&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap [&>span]:!leading-[20px] [&>span]:pr-2 [&>svg]:!h-8 [&>svg]:!w-8 [&>svg]:shrink-0 [&>svg]:!text-[#6B7280] [&>svg]:!opacity-100";
return (
<div className="flex h-[44px] w-[656px] box-border items-center overflow-hidden rounded-[8px] bg-white p-0 shadow-[0_2px_4px_rgba(60,64,67,0.3),0_4px_10px_rgba(60,64,67,0.18)]">
<div className="group relative h-[44px] w-[192px] shrink-0 box-border">
<SelectBox
labelClass="hidden"
className={selectRootClass}
selectClass={`${selectTriggerClass} !rounded-none focus:!rounded-l-[8px] data-[state=open]:!rounded-l-[8px]`}
label=""
selectArray={sidoData}
onSelectValue={(val: any) =>
onSelectValue(val.toString(), "ctpvCd")
}
value={sidoValue}
selectContentClass="z-[101]"
/>
<span
aria-hidden="true"
className="pointer-events-none absolute right-0 top-1/2 z-[1] h-[24px] w-px -translate-y-1/2 bg-[#D5DCE5] group-focus-within:hidden"
/>
</div>
<div className="group relative h-[44px] w-[192px] shrink-0 box-border">
<SelectBox
labelClass="hidden"
className={selectRootClass}
selectClass={`${selectTriggerClass} !rounded-none`}
label=""
selectArray={filteredSigunData}
onSelectValue={(val: any) =>
onSelectValue(val.toString(), "sggCd")
}
value={sigunValue}
selectContentClass="z-[101]"
/>
<span
aria-hidden="true"
className="pointer-events-none absolute right-0 top-1/2 z-[1] h-[24px] w-px -translate-y-1/2 bg-[#D5DCE5] group-focus-within:hidden"
/>
</div>
<div className="h-[44px] w-[192px] shrink-0 box-border">
<SelectBox
labelClass="hidden"
className={selectRootClass}
selectClass={`${selectTriggerClass} !rounded-none`}
label=""
selectArray={facilityData}
onSelectValue={(val: any) =>
onSelectValue(val.toString(), "fcltCd")
}
value={facilityValue}
selectContentClass="z-[101]"
/>
</div>
<Button
color="primary"
className="box-border !h-[44px] !w-[80px] shrink-0 !rounded-none !bg-[#0279FA] !p-0 text-[14px] font-semibold leading-5 text-white"
size="default"
onClick={handleSearch}
>
조회
</Button>
</div>
);
}
return (
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
@@ -253,7 +253,7 @@ function StandardDataTable<T>({
return (
<div
className={cn(
"standard-data-table card card-border min-w-0 overflow-hidden",
"standard-data-table card card-border w-full max-w-full min-w-0 overflow-hidden",
flushOuterMargin && "!m-0",
shouldFillAvailableHeight ? "flex min-h-0 flex-1 flex-col" : "shrink-0",
className,
@@ -277,7 +277,7 @@ function StandardDataTable<T>({
<div
className={cn(
"card !m-[1.2rem] min-w-0 overflow-hidden !p-0",
"card !mx-[0.4rem] !my-[1.2rem] min-w-0 overflow-hidden !p-0",
shouldFillAvailableHeight && "flex min-h-0 flex-1 flex-col",
)}
>
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import { createContext, useContext, type ReactNode } from "react";
import { Label } from "@common/components";
@@ -31,8 +31,11 @@ type StandardFormSectionProps = {
children: ReactNode;
columns?: StandardFormColumns;
className?: string;
wideLabels?: boolean;
};
const StandardFormWideLabelsContext = createContext(false);
type StandardFormFieldProps = {
id?: string;
label: ReactNode;
@@ -50,6 +53,7 @@ function StandardFormSection({
children,
columns = 3,
className = "",
wideLabels = false,
}: StandardFormSectionProps) {
return (
<section
@@ -58,11 +62,13 @@ function StandardFormSection({
<h4 className="border-b border-border bg-container px-4 py-3 text-[1.4rem] font-semibold text-label">
{title}
</h4>
<div
className={`grid grid-cols-1 gap-px bg-border ${SECTION_GRID_CLASS[columns]}`}
>
{children}
</div>
<StandardFormWideLabelsContext.Provider value={wideLabels}>
<div
className={`grid grid-cols-1 gap-px bg-border ${SECTION_GRID_CLASS[columns]}`}
>
{children}
</div>
</StandardFormWideLabelsContext.Provider>
</section>
);
}
@@ -78,9 +84,11 @@ function StandardFormField({
children,
className = "",
}: StandardFormFieldProps) {
const wideLabels = useContext(StandardFormWideLabelsContext);
return (
<div
className={`grid min-w-0 grid-cols-[9rem_minmax(0,1fr)] bg-background sm:grid-cols-[11.5rem_minmax(0,1fr)] ${FIELD_SPAN_CLASS[columns][span]} ${className}`}
className={`grid min-w-0 grid-cols-[9rem_minmax(0,1fr)] bg-background ${wideLabels ? "sm:grid-cols-[18rem_minmax(0,1fr)]" : "sm:grid-cols-[11.5rem_minmax(0,1fr)]"} ${FIELD_SPAN_CLASS[columns][span]} ${className}`}
>
<Label
htmlFor={id}
@@ -89,7 +97,7 @@ function StandardFormField({
{required ? <span className="mr-1 text-red-600">*</span> : null}
{label}
</Label>
<div className="min-w-0 p-3">
<div className="flex min-w-0 flex-col justify-center p-3">
{children}
{error ? (
<p className="mt-1 text-[1.2rem] text-red-600" role="alert">
@@ -43,7 +43,7 @@ function StandardPopupLayout({
className,
)}
>
<header className="card-header min-h-[5.2rem] shrink-0 gap-3">
<header className="card-header !mx-0 min-h-[5.2rem] shrink-0 gap-3 !px-[1.2rem]">
<h1 className="min-w-0 text-[1.8rem] font-semibold text-label">
{title}
</h1>
@@ -66,7 +66,7 @@ function StandardPopupLayout({
<div
className={cn(
"flex min-h-0 flex-1 flex-col gap-[1.2rem] overflow-y-auto bg-background p-3",
"flex min-h-0 flex-1 flex-col gap-[1.2rem] overflow-y-auto bg-background p-3 !px-[1.2rem]",
bodyClassName,
)}
>
@@ -77,47 +77,69 @@ function DataTable<T>({
function THead<T>({ table }: { table: TableInstance<T> }) {
return (
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
const columnRelativeDepth = header.depth - header.column.depth;
if (
!header.isPlaceholder &&
columnRelativeDepth > 1 &&
header.id === header.column.id
) {
return null;
}
{table
.getHeaderGroups()
.map((headerGroup, headerGroupIndex, headerGroups) => (
<TableRow
key={headerGroup.id}
className={cn(
headerGroups.length > 1 &&
headerGroupIndex === 0 &&
"!border-b-0",
)}
>
{headerGroup.headers.map((header) => {
const columnRelativeDepth = header.depth - header.column.depth;
if (
!header.isPlaceholder &&
columnRelativeDepth > 1 &&
header.id === header.column.id
) {
return null;
}
let rowSpan = 1;
if (header.isPlaceholder) {
const leafs = header.getLeafHeaders();
rowSpan = (leafs?.[leafs.length - 1]?.depth ?? 0) - header.depth;
}
let rowSpan = 1;
if (header.isPlaceholder) {
const leafs = header.getLeafHeaders();
rowSpan =
(leafs?.[leafs.length - 1]?.depth ?? 0) - header.depth;
}
const { meta } = header.column.columnDef;
const { meta } = header.column.columnDef;
return (
<TableHead
key={header.id}
className="sticky top-0 z-10"
colSpan={header.colSpan}
rowSpan={rowSpan}
{...meta}
>
{flexRender(
header.column.columnDef.header,
header.getContext(),
)}
</TableHead>
);
})}
</TableRow>
))}
const isNestedGroupHeader =
!header.isPlaceholder && hasNestedColumns(header.column);
return (
<TableHead
key={header.id}
className={cn(
"sticky top-0 z-10",
isNestedGroupHeader && "data-table-group-header",
)}
colSpan={header.colSpan}
rowSpan={rowSpan}
{...meta}
>
{flexRender(
header.column.columnDef.header,
header.getContext(),
)}
</TableHead>
);
})}
</TableRow>
))}
</TableHeader>
);
}
function hasNestedColumns<T>(
column: import("@tanstack/react-table").Column<T, unknown>,
) {
return column.columns.length > 0;
}
function Pagination<T>({ table }: { table: TableInstance<T> }) {
const pageCount = table.getPageCount();
const currentPage = table.getState().pagination.pageIndex;
@@ -18,6 +18,18 @@
.table-ui.default th {
@apply bg-[#5987bf] text-[#fff];
}
.table-ui th.data-table-group-header {
background-image: linear-gradient(
to right,
transparent 0.2rem,
var(--background) 0.2rem,
var(--background) calc(100% - 0.2rem),
transparent calc(100% - 0.2rem)
);
background-position: left bottom;
background-repeat: no-repeat;
background-size: 100% 1px;
}
.table-ui.default td {
@apply border-b border-b-border text-label;
}