From 197c107e7a7c50e9c697f57ef758902d45524c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:59:07 +0900 Subject: [PATCH 1/3] =?UTF-8?q?WithDraggablePanel=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/draggable/WithDraggable.jsx | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/components/common/draggable/WithDraggable.jsx b/src/components/common/draggable/WithDraggable.jsx index e2f769cc..49552eac 100644 --- a/src/components/common/draggable/WithDraggable.jsx +++ b/src/components/common/draggable/WithDraggable.jsx @@ -3,16 +3,7 @@ import { useState } from 'react' import Draggable from 'react-draggable' -export default function WithDraggable({ - isShow, - children, - pos = { x: 0, y: 0 }, - handle = '', - className = '', - isModal = true, - hasFooter = true, - isHidden = false, -}) { +export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 }, handle = '', className = '', hasFooter = true, isHidden = false }) { const [position, setPosition] = useState(pos) const handleOnDrag = (e, data) => { @@ -31,14 +22,10 @@ export default function WithDraggable({ onDrag={(e, data) => handleOnDrag(e, data)} handle={handle === '' ? '.modal-handle' : handle} > - {isModal ? ( -
- {children} - {hasFooter && } -
- ) : ( - <>{children} - )} +
+ {children} + {hasFooter && } +
)} @@ -68,15 +55,10 @@ function WithDraggableBody({ children }) { ) } -function WithDraggablePanel({ children }) { - return <>{children} -} - function WithDraggableFooter() { return
} WithDraggable.Header = WithDraggableHeader WithDraggable.Body = WithDraggableBody -WithDraggable.Panel = WithDraggablePanel WithDraggable.Footer = WithDraggableFooter From d7d4768ed7783b7c255a5c7a590d73215dfec58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:59:45 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EC=A7=91=EA=B3=84=ED=91=9C=20=EB=8B=A8?= =?UTF-8?q?=EB=8F=85=EC=9C=BC=EB=A1=9C=20Draggable=20Component=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/panelBatch/PanelBatchStatistics.jsx | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/components/floor-plan/modal/panelBatch/PanelBatchStatistics.jsx b/src/components/floor-plan/modal/panelBatch/PanelBatchStatistics.jsx index e789bc4a..fa4703be 100644 --- a/src/components/floor-plan/modal/panelBatch/PanelBatchStatistics.jsx +++ b/src/components/floor-plan/modal/panelBatch/PanelBatchStatistics.jsx @@ -11,60 +11,64 @@ import { canvasState } from '@/store/canvasAtom' import { POLYGON_TYPE } from '@/common/common' import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle' import { moduleSelectionDataState } from '@/store/selectedModuleOptions' +import Draggable from 'react-draggable' export default function PanelBatchStatistics() { const { getMessage } = useMessage() const [isFold, setIsFold] = useState(false) - const [pos, setPos] = useState({ - x: 0, - y: 30, - }) const canvas = useRecoilValue(canvasState) const { header, rows, footer } = useRecoilValue(moduleStatisticsState) const { setModuleStatisticsData } = useCircuitTrestle(true) const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState) + const [position, setPosition] = useState({ + x: 0, + y: 30, + }) + + const handleOnDrag = (e, data) => { + e.stopPropagation() + setPosition({ x: data.x, y: data.y }) + } useEffect(() => { if (moduleSelectionDataStore && moduleSelectionDataStore.module) setModuleStatisticsData() }, []) return ( - - -
-

{getMessage('modal.panel.batch.statistic')}

- -
- - - - {header.map((item, index) => ( - - ))} - - - - {rows.map((row, index) => ( - - {header.map((item, i) => ( - - ))} - + handleOnDrag(e, data)} handle=".penal-wrap"> +
+

{getMessage('modal.panel.batch.statistic')}

+ +
+
{item.name}
{row[item.prop] ?? 0}
+ + + {header.map((item, index) => ( + ))} - - {header.map((header, index) => ( - + + + + {rows.map((row, index) => ( + + {header.map((item, i) => ( + ))} - -
{item.name}
- {typeof footer[header.prop] === 'number' - ? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 }) - : footer[header.prop]} -
{row[item.prop] ?? 0}
-
+ ))} + + {header.map((header, index) => ( + + {typeof footer[header.prop] === 'number' + ? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 }) + : footer[header.prop]} + + ))} + + +
-
-
+ + ) } From d39b57f302a29272b8fbf08925d3e101b725edec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=8B=9D?= <43837214+Minsiki@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:00:15 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EB=B3=91=EC=84=A4=EC=9A=A9=20PCS=20Validat?= =?UTF-8?q?ion=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/PowerConditionalSelect.jsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx b/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx index 89aa30d7..b48ecffd 100644 --- a/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx @@ -165,6 +165,15 @@ export default function PowerConditionalSelect(props) { return } + if (selectedRow.pcsSerParallelYn === 'Y' && selectedModels.length === 0 && selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.SINGLE_P) { + swalFire({ + title: getMessage('modal.module.pcs.error1'), + icon: 'warning', + }) + + return + } + if (selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.MULTI) { setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }]) } else if (!selectedModels.find((m) => m.itemId === selectedRow.itemId)) { @@ -174,6 +183,11 @@ export default function PowerConditionalSelect(props) { } const onRemoveSelectedModel = (model) => { + const tempModels = selectedModels.filter((m) => m.id !== model.id) + if (tempModels.length === 1 && tempModels[0].pcsSerParallelYn === 'Y') { + setSelectedModels([]) + return + } setSelectedModels(selectedModels.filter((m) => m.id !== model.id)) } @@ -282,14 +296,6 @@ export default function PowerConditionalSelect(props) { - {/*
- - -
*/} ) }