dev #729
@ -3,16 +3,22 @@ import WithDraggable from '@/components/common/draggable/WithDraggable'
|
||||
import FlowLine from '@/components/floor-plan/modal/movement/type/FlowLine'
|
||||
import Updown from '@/components/floor-plan/modal/movement/type/Updown'
|
||||
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 } }) {
|
||||
const { getMessage } = useMessage()
|
||||
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 = {
|
||||
FLOW_LINE_REF,
|
||||
disableKeypad,
|
||||
}
|
||||
const updownProps = {
|
||||
UP_DOWN_REF,
|
||||
disableKeypad,
|
||||
}
|
||||
|
||||
return (
|
||||
@ -30,7 +36,10 @@ export default function MovementSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
{type === TYPE.FLOW_LINE && <FlowLine {...flowLineProps} />}
|
||||
{type === TYPE.UP_DOWN && <Updown {...updownProps} />}
|
||||
</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}>
|
||||
{getMessage('modal.common.save')}
|
||||
</button>
|
||||
|
||||
@ -9,7 +9,7 @@ const FLOW_LINE_TYPE = {
|
||||
UP_RIGHT: 'upRight',
|
||||
}
|
||||
|
||||
export default function FlowLine({ FLOW_LINE_REF }) {
|
||||
export default function FlowLine({ FLOW_LINE_REF, disableKeypad }) {
|
||||
const { getMessage } = useMessage()
|
||||
const [type, setType] = useState(FLOW_LINE_TYPE.DOWN_LEFT)
|
||||
const [filledInput, setFilledInput] = useState('')
|
||||
@ -87,6 +87,7 @@ export default function FlowLine({ FLOW_LINE_REF }) {
|
||||
value={filledInput}
|
||||
onFocus={handleFocus}
|
||||
onChange={(value)=>{setFilledInput(value)}}
|
||||
disableKeypad={disableKeypad}
|
||||
options={{
|
||||
allowNegative: false,
|
||||
allowDecimal: false
|
||||
|
||||
@ -10,7 +10,7 @@ const UP_DOWN_TYPE = {
|
||||
DOWN: 'down',
|
||||
}
|
||||
|
||||
export default function Updown({ UP_DOWN_REF }) {
|
||||
export default function Updown({ UP_DOWN_REF, disableKeypad }) {
|
||||
const { getMessage } = useMessage()
|
||||
const [type, setType] = useState(UP_DOWN_TYPE.UP)
|
||||
const [filledInput, setFilledInput] = useState('100')
|
||||
@ -87,6 +87,7 @@ export default function Updown({ UP_DOWN_REF }) {
|
||||
value={filledInput}
|
||||
onFocus={handleFocus}
|
||||
onChange={(value)=>{setFilledInput(value)}}
|
||||
disableKeypad={disableKeypad}
|
||||
options={{
|
||||
allowNegative: false,
|
||||
allowDecimal: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user