棟線移動・桁上げ下げ 토글추가
This commit is contained in:
parent
94f050d917
commit
84ac6d508f
@ -3,16 +3,22 @@ import WithDraggable from '@/components/common/draggable/WithDraggable'
|
|||||||
import FlowLine from '@/components/floor-plan/modal/movement/type/FlowLine'
|
import FlowLine from '@/components/floor-plan/modal/movement/type/FlowLine'
|
||||||
import Updown from '@/components/floor-plan/modal/movement/type/Updown'
|
import Updown from '@/components/floor-plan/modal/movement/type/Updown'
|
||||||
import { useMovementSetting } from '@/hooks/roofcover/useMovementSetting'
|
import { useMovementSetting } from '@/hooks/roofcover/useMovementSetting'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
export default function MovementSetting({ id, pos = { x: 50, y: 230 } }) {
|
export default function MovementSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { TYPE, closePopup, buttonType, type, setType, FLOW_LINE_REF, UP_DOWN_REF, handleSave } = useMovementSetting(id)
|
const { TYPE, closePopup, buttonType, type, setType, FLOW_LINE_REF, UP_DOWN_REF, handleSave } = useMovementSetting(id)
|
||||||
|
const [useCalcPad, setUseCalcPad] = useState(false)
|
||||||
|
const disableKeypad = !useCalcPad
|
||||||
|
|
||||||
const flowLineProps = {
|
const flowLineProps = {
|
||||||
FLOW_LINE_REF,
|
FLOW_LINE_REF,
|
||||||
|
disableKeypad,
|
||||||
}
|
}
|
||||||
const updownProps = {
|
const updownProps = {
|
||||||
UP_DOWN_REF,
|
UP_DOWN_REF,
|
||||||
|
disableKeypad,
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -30,7 +36,10 @@ export default function MovementSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
{type === TYPE.FLOW_LINE && <FlowLine {...flowLineProps} />}
|
{type === TYPE.FLOW_LINE && <FlowLine {...flowLineProps} />}
|
||||||
{type === TYPE.UP_DOWN && <Updown {...updownProps} />}
|
{type === TYPE.UP_DOWN && <Updown {...updownProps} />}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid-btn-wrap">
|
<div className="grid-btn-wrap" style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: '5px' }}>
|
||||||
|
<button style={{ width: 'auto' }} type="button" onClick={() => setUseCalcPad((prev) => !prev)}>
|
||||||
|
<Image src={useCalcPad ? '/static/images/common/Icon_ON_Black.png' : '/static/images/common/Icon_OFF_Black.png'} alt="toggle" width={34} height={34} />
|
||||||
|
</button>
|
||||||
<button className="btn-frame modal act" onClick={handleSave}>
|
<button className="btn-frame modal act" onClick={handleSave}>
|
||||||
{getMessage('modal.common.save')}
|
{getMessage('modal.common.save')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const FLOW_LINE_TYPE = {
|
|||||||
UP_RIGHT: 'upRight',
|
UP_RIGHT: 'upRight',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FlowLine({ FLOW_LINE_REF }) {
|
export default function FlowLine({ FLOW_LINE_REF, disableKeypad }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [type, setType] = useState(FLOW_LINE_TYPE.DOWN_LEFT)
|
const [type, setType] = useState(FLOW_LINE_TYPE.DOWN_LEFT)
|
||||||
const [filledInput, setFilledInput] = useState('')
|
const [filledInput, setFilledInput] = useState('')
|
||||||
@ -87,6 +87,7 @@ export default function FlowLine({ FLOW_LINE_REF }) {
|
|||||||
value={filledInput}
|
value={filledInput}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
onChange={(value)=>{setFilledInput(value)}}
|
onChange={(value)=>{setFilledInput(value)}}
|
||||||
|
disableKeypad={disableKeypad}
|
||||||
options={{
|
options={{
|
||||||
allowNegative: false,
|
allowNegative: false,
|
||||||
allowDecimal: false
|
allowDecimal: false
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const UP_DOWN_TYPE = {
|
|||||||
DOWN: 'down',
|
DOWN: 'down',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Updown({ UP_DOWN_REF }) {
|
export default function Updown({ UP_DOWN_REF, disableKeypad }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [type, setType] = useState(UP_DOWN_TYPE.UP)
|
const [type, setType] = useState(UP_DOWN_TYPE.UP)
|
||||||
const [filledInput, setFilledInput] = useState('100')
|
const [filledInput, setFilledInput] = useState('100')
|
||||||
@ -87,6 +87,7 @@ export default function Updown({ UP_DOWN_REF }) {
|
|||||||
value={filledInput}
|
value={filledInput}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
onChange={(value)=>{setFilledInput(value)}}
|
onChange={(value)=>{setFilledInput(value)}}
|
||||||
|
disableKeypad={disableKeypad}
|
||||||
options={{
|
options={{
|
||||||
allowNegative: false,
|
allowNegative: false,
|
||||||
allowDecimal: false
|
allowDecimal: false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user