From 6debee6b5729b5d2247138637c03e4808e30e754 Mon Sep 17 00:00:00 2001 From: truthwing Date: Tue, 22 Apr 2025 17:19:34 +0900 Subject: [PATCH 01/30] =?UTF-8?q?search=20base=20form=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?(=EC=82=AC=EC=9A=A9=EB=B2=95=EC=9D=80=20=EB=A9=94=EC=8B=A0?= =?UTF-8?q?=EC=A0=80=EB=A1=9C=20=EC=9A=B0=EC=84=A0=20=EC=A0=84=EB=8B=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/index.ts | 19 +-- .../src/ui/search_base_form/index.tsx | 134 ++++++++++++++++++ .../src/ui/search_form_left/index.tsx | 4 +- 3 files changed, 146 insertions(+), 11 deletions(-) create mode 100644 packages/common/business_components/src/ui/search_base_form/index.tsx diff --git a/packages/common/business_components/src/ui/index.ts b/packages/common/business_components/src/ui/index.ts index e2273e8e5..e591be5b5 100644 --- a/packages/common/business_components/src/ui/index.ts +++ b/packages/common/business_components/src/ui/index.ts @@ -1,20 +1,21 @@ export * from "./chart"; export * from "./date_picker"; +export * from "./dialog_ui"; +export * from "./excel_download"; export * from "./file-upload"; export * from "./form"; export * from "./form_ui"; +export * from "./list_div"; +export * from "./main_content_div"; export * from "./scroll"; +export * from "./search_base_form"; export * from "./search_form"; +export * from "./search_form_left"; +export * from "./search_form_right"; export * from "./search_input"; export * from "./search_input_select"; export * from "./select"; -export * from "./table"; -export * from "./main_content_div"; -export * from "./title"; -export * from "./search_form_left"; -export * from "./search_form_right"; -export * from "./table_div"; -export * from "./list_div"; export * from "./tab"; -export * from "./dialog_ui"; -export * from "./excel_download"; \ No newline at end of file +export * from "./table"; +export * from "./table_div"; +export * from "./title"; diff --git a/packages/common/business_components/src/ui/search_base_form/index.tsx b/packages/common/business_components/src/ui/search_base_form/index.tsx new file mode 100644 index 000000000..da21761ee --- /dev/null +++ b/packages/common/business_components/src/ui/search_base_form/index.tsx @@ -0,0 +1,134 @@ +import { Button } from "@common/components/ui"; +import { useCallback, useEffect, useState } from "react"; +import { SearchFormLeft, type EnvPartSelectDataType } from "../search_form_left"; +import { SearchFormRight } from "../search_form_right"; +import type { SelectDataType } from "../search_input_select"; +type SearchBaseType = { + leftChildren:React.ReactNode; + rightChildren:React.ReactNode; + selectSidoData?: SelectDataType[] | []; + selectSigunData?: SelectDataType[] | []; + selectRegionData?: SelectDataType[] | []; + selectUnitWaterShedData?: SelectDataType[] | []; + selectMiddleRegionData?: SelectDataType[] | []; + selectEnvPartData?: EnvPartSelectDataType[] | []; + queryClick:(returnType:ReturnType) => void; + excelClick:(returnType:ReturnType) => void; + btnClass:string; +} +export type ReturnType = { + partValue: string; + sidoValue: string; + sigunValue: string; + regionValue: string; + unitWaterShedValue: string; + middleRegionValue: string; + envPartValue: string; + envPartSidoValue: string; + envPartSigunValue: string; +} + + +function SearchBaseForm ({ + leftChildren, + rightChildren, + selectSidoData, + selectSigunData, + selectRegionData, + selectUnitWaterShedData, + selectMiddleRegionData, + selectEnvPartData, + btnClass, + queryClick, + }: SearchBaseType) { + const [partValue, setPartValue] = useState("0"); + const [sidoValue, setSidoValue] = useState("0"); + const [sigunValue, setSigunValue] = useState("0"); + const [regionValue, setRegionValue] = useState("0"); + const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); + const [middleRegionValue, setMiddleRegionValue] = useState("0"); + const [envPartValue, setEnvPartValue] = useState("0"); + const [envPartSidoValue, setEnvPartSidoValue] = useState("0"); + const [envPartSigunValue, setEnvPartSigunValue] = useState("0"); + const [resetTrigger, setResetTrigger] = useState(false); + const queryVal = () => { + console.log("조회버튼 클릭"); + queryClick({ + partValue: partValue, + sidoValue: sidoValue, + sigunValue: sigunValue, + regionValue: regionValue, + unitWaterShedValue: untitWaterShedValue, + middleRegionValue: middleRegionValue, + envPartValue: envPartValue, + envPartSidoValue: envPartSidoValue, + envPartSigunValue: envPartSigunValue, + }); + } + const initVal = useCallback(() => { + setResetTrigger(true); + }, [setResetTrigger]); + useEffect(() => { + if (resetTrigger) { + setResetTrigger(false); + } + }, [resetTrigger]); + const excelDownload = useCallback(() => { + console.log("엑셀다운로드 클릭"); + console.log(partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue); + }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); + // useEffect(() => { + // if (ref && ref.current) { + // ref.current.partValue = partValue; + // ref.current.sidoValue = sidoValue; + // ref.current.sigunValue = sigunValue; + // ref.current.regionValue = regionValue; + // ref.current.unitWaterShedValue = untitWaterShedValue; + // ref.current.middleRegionValue = middleRegionValue; + // ref.current.envPartValue = envPartValue; + // ref.current.envPartSidoValue = envPartSidoValue; + // ref.current.envPartSigunValue = envPartSigunValue; + // } + // }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); + return ( +
+ + {leftChildren} + + + +
+ + +
+ {rightChildren} +
+
+ ) + } + + export { SearchBaseForm }; + \ No newline at end of file diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index 248e8f625..fbd56a68f 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -41,7 +41,7 @@ type SearchFormLeftProps = { resetTrigger?: boolean; } -type EnvPartSelectDataType = SelectDataType & { +export type EnvPartSelectDataType = SelectDataType & { adstDliStrCd: string, } @@ -315,4 +315,4 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel ) } -export { SearchFormLeft }; \ No newline at end of file +export { SearchFormLeft }; From 675a3583b7d93bbb76371b8935ccd7173af8556a Mon Sep 17 00:00:00 2001 From: truthwing Date: Tue, 22 Apr 2025 17:30:23 +0900 Subject: [PATCH 02/30] =?UTF-8?q?=EC=97=91=EC=85=80=20=ED=81=B4=EB=A6=AD?= =?UTF-8?q?=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=EB=8F=84=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/search_base_form/index.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/common/business_components/src/ui/search_base_form/index.tsx b/packages/common/business_components/src/ui/search_base_form/index.tsx index da21761ee..372a52695 100644 --- a/packages/common/business_components/src/ui/search_base_form/index.tsx +++ b/packages/common/business_components/src/ui/search_base_form/index.tsx @@ -40,6 +40,7 @@ function SearchBaseForm ({ selectEnvPartData, btnClass, queryClick, + excelClick }: SearchBaseType) { const [partValue, setPartValue] = useState("0"); const [sidoValue, setSidoValue] = useState("0"); @@ -76,6 +77,17 @@ function SearchBaseForm ({ const excelDownload = useCallback(() => { console.log("엑셀다운로드 클릭"); console.log(partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue); + excelClick({ + partValue: partValue, + sidoValue: sidoValue, + sigunValue: sigunValue, + regionValue: regionValue, + unitWaterShedValue: untitWaterShedValue, + middleRegionValue: middleRegionValue, + envPartValue: envPartValue, + envPartSidoValue: envPartSidoValue, + envPartSigunValue: envPartSigunValue, + }) }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); // useEffect(() => { // if (ref && ref.current) { From 75aeadd69dc2ffd20f18046ffa90205fe514b0ef Mon Sep 17 00:00:00 2001 From: truthwing Date: Tue, 22 Apr 2025 17:57:45 +0900 Subject: [PATCH 03/30] =?UTF-8?q?SearchBaseForm=20ref=20=EC=97=B0=EA=B2=B0?= =?UTF-8?q?=20=EC=99=84=EB=A3=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/search_base_form/index.tsx | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/common/business_components/src/ui/search_base_form/index.tsx b/packages/common/business_components/src/ui/search_base_form/index.tsx index 372a52695..93de69169 100644 --- a/packages/common/business_components/src/ui/search_base_form/index.tsx +++ b/packages/common/business_components/src/ui/search_base_form/index.tsx @@ -15,6 +15,7 @@ type SearchBaseType = { queryClick:(returnType:ReturnType) => void; excelClick:(returnType:ReturnType) => void; btnClass:string; + ref:React.RefObject; } export type ReturnType = { partValue: string; @@ -40,7 +41,8 @@ function SearchBaseForm ({ selectEnvPartData, btnClass, queryClick, - excelClick + excelClick, + ref }: SearchBaseType) { const [partValue, setPartValue] = useState("0"); const [sidoValue, setSidoValue] = useState("0"); @@ -74,9 +76,7 @@ function SearchBaseForm ({ setResetTrigger(false); } }, [resetTrigger]); - const excelDownload = useCallback(() => { - console.log("엑셀다운로드 클릭"); - console.log(partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue); + const excelDownload = () => { excelClick({ partValue: partValue, sidoValue: sidoValue, @@ -88,20 +88,21 @@ function SearchBaseForm ({ envPartSidoValue: envPartSidoValue, envPartSigunValue: envPartSigunValue, }) + }; + useEffect(() => { + if (ref && ref.current) { + const customRef = ref.current as HTMLDivElement & ReturnType; + customRef.partValue = partValue; + customRef.sidoValue = sidoValue; + customRef.sigunValue = sigunValue; + customRef.regionValue = regionValue; + customRef.unitWaterShedValue = untitWaterShedValue; + customRef.middleRegionValue = middleRegionValue; + customRef.envPartValue = envPartValue; + customRef.envPartSidoValue = envPartSidoValue; + customRef.envPartSigunValue = envPartSigunValue; + } }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); - // useEffect(() => { - // if (ref && ref.current) { - // ref.current.partValue = partValue; - // ref.current.sidoValue = sidoValue; - // ref.current.sigunValue = sigunValue; - // ref.current.regionValue = regionValue; - // ref.current.unitWaterShedValue = untitWaterShedValue; - // ref.current.middleRegionValue = middleRegionValue; - // ref.current.envPartValue = envPartValue; - // ref.current.envPartSidoValue = envPartSidoValue; - // ref.current.envPartSigunValue = envPartSigunValue; - // } - // }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); return (
Date: Wed, 23 Apr 2025 17:15:00 +0900 Subject: [PATCH 04/30] =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B2=84?= =?UTF-8?q?=ED=81=B0=20=ED=81=B4=EB=A6=AD=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=ED=99=98=EA=B2=BD=EC=B2=AD=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=8B=9C=EB=8F=84=20=EC=8B=9C?= =?UTF-8?q?=EA=B5=B0=EA=B5=AC=EC=97=90=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/search_base_form/index.tsx | 36 ++++++-------- .../src/ui/search_form_left/index.tsx | 49 +++++++++---------- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/packages/common/business_components/src/ui/search_base_form/index.tsx b/packages/common/business_components/src/ui/search_base_form/index.tsx index 93de69169..ae68ad301 100644 --- a/packages/common/business_components/src/ui/search_base_form/index.tsx +++ b/packages/common/business_components/src/ui/search_base_form/index.tsx @@ -14,25 +14,24 @@ type SearchBaseType = { selectEnvPartData?: EnvPartSelectDataType[] | []; queryClick:(returnType:ReturnType) => void; excelClick:(returnType:ReturnType) => void; + initClick:() => void; btnClass:string; - ref:React.RefObject; + ref:React.RefObject; } export type ReturnType = { partValue: string; - sidoValue: string; - sigunValue: string; - regionValue: string; + sidoValue: string; + sigunValue: string; + regionValue: string; unitWaterShedValue: string; middleRegionValue: string; envPartValue: string; - envPartSidoValue: string; - envPartSigunValue: string; } function SearchBaseForm ({ - leftChildren, - rightChildren, + leftChildren, + rightChildren, selectSidoData, selectSigunData, selectRegionData, @@ -42,17 +41,16 @@ function SearchBaseForm ({ btnClass, queryClick, excelClick, + initClick, ref }: SearchBaseType) { - const [partValue, setPartValue] = useState("0"); + const [partValue, setPartValue] = useState("A"); const [sidoValue, setSidoValue] = useState("0"); const [sigunValue, setSigunValue] = useState("0"); const [regionValue, setRegionValue] = useState("0"); const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); const [middleRegionValue, setMiddleRegionValue] = useState("0"); const [envPartValue, setEnvPartValue] = useState("0"); - const [envPartSidoValue, setEnvPartSidoValue] = useState("0"); - const [envPartSigunValue, setEnvPartSigunValue] = useState("0"); const [resetTrigger, setResetTrigger] = useState(false); const queryVal = () => { console.log("조회버튼 클릭"); @@ -64,8 +62,6 @@ function SearchBaseForm ({ unitWaterShedValue: untitWaterShedValue, middleRegionValue: middleRegionValue, envPartValue: envPartValue, - envPartSidoValue: envPartSidoValue, - envPartSigunValue: envPartSigunValue, }); } const initVal = useCallback(() => { @@ -85,13 +81,11 @@ function SearchBaseForm ({ unitWaterShedValue: untitWaterShedValue, middleRegionValue: middleRegionValue, envPartValue: envPartValue, - envPartSidoValue: envPartSidoValue, - envPartSigunValue: envPartSigunValue, }) }; useEffect(() => { if (ref && ref.current) { - const customRef = ref.current as HTMLDivElement & ReturnType; + const customRef = ref.current; customRef.partValue = partValue; customRef.sidoValue = sidoValue; customRef.sigunValue = sigunValue; @@ -99,10 +93,8 @@ function SearchBaseForm ({ customRef.unitWaterShedValue = untitWaterShedValue; customRef.middleRegionValue = middleRegionValue; customRef.envPartValue = envPartValue; - customRef.envPartSidoValue = envPartSidoValue; - customRef.envPartSigunValue = envPartSigunValue; } - }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); + }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, ref]); return (
{leftChildren} @@ -130,7 +122,7 @@ function SearchBaseForm ({ 엑셀다운로드
-
-