Compare commits
No commits in common. "f9359c6445adc27a2c80940a82bbc4fc26d9fde7" and "a46fec833fcda2597f11531d01695667d35489a3" have entirely different histories.
f9359c6445
...
a46fec833f
@ -3,7 +3,7 @@ import { createCalculator } from '@/util/calc-utils'
|
|||||||
import '@/styles/calc.scss'
|
import '@/styles/calc.scss'
|
||||||
|
|
||||||
export const CalculatorInput = forwardRef(
|
export const CalculatorInput = forwardRef(
|
||||||
({ value, onChange, label, options = {}, id, className = 'calculator-input', readOnly = false, placeholder, name='', disabled = false, maxLength = 6 }, ref) => {
|
({ value, onChange, label, options = {}, id, className = 'calculator-input', readOnly = false, placeholder, name='', disabled = false }, ref) => {
|
||||||
const [showKeypad, setShowKeypad] = useState(false)
|
const [showKeypad, setShowKeypad] = useState(false)
|
||||||
const [displayValue, setDisplayValue] = useState(value || '0')
|
const [displayValue, setDisplayValue] = useState(value || '0')
|
||||||
const [hasOperation, setHasOperation] = useState(false)
|
const [hasOperation, setHasOperation] = useState(false)
|
||||||
@ -48,14 +48,6 @@ export const CalculatorInput = forwardRef(
|
|||||||
const calculator = calculatorRef.current
|
const calculator = calculatorRef.current
|
||||||
let newDisplayValue = ''
|
let newDisplayValue = ''
|
||||||
|
|
||||||
// maxLength 체크
|
|
||||||
if (maxLength > 0) {
|
|
||||||
const currentLength = (calculator.currentOperand || '').length + (calculator.previousOperand || '').length + (calculator.operation || '').length
|
|
||||||
if (currentLength >= maxLength) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 소수점 이하 2자리 제한 로직 추가
|
// 소수점 이하 2자리 제한 로직 추가
|
||||||
const shouldPreventInput = (value) => {
|
const shouldPreventInput = (value) => {
|
||||||
if (!value) return false
|
if (!value) return false
|
||||||
@ -65,10 +57,6 @@ export const CalculatorInput = forwardRef(
|
|||||||
|
|
||||||
// 숫자 추가 함수
|
// 숫자 추가 함수
|
||||||
const appendNumber = (current, num) => {
|
const appendNumber = (current, num) => {
|
||||||
// maxLength 체크
|
|
||||||
if (maxLength > 0 && (current + num).length > maxLength) {
|
|
||||||
return current
|
|
||||||
}
|
|
||||||
// 현재 값이 0이고 소수점이 없을 때 0이 아닌 숫자를 입력하면 대체
|
// 현재 값이 0이고 소수점이 없을 때 0이 아닌 숫자를 입력하면 대체
|
||||||
if (current === '0' && num !== '.' && !current.includes('.')) {
|
if (current === '0' && num !== '.' && !current.includes('.')) {
|
||||||
return num.toString()
|
return num.toString()
|
||||||
@ -419,7 +407,6 @@ export const CalculatorInput = forwardRef(
|
|||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
autoComplete={'off'}
|
autoComplete={'off'}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
maxLength={maxLength}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{showKeypad && !readOnly && (
|
{showKeypad && !readOnly && (
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import { useSwal } from '@/hooks/useSwal'
|
|||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||||
import {normalizeDigits, normalizeDecimal} from '@/util/input-utils'
|
import {normalizeDigits, normalizeDecimal} from '@/util/input-utils'
|
||||||
import { CalculatorInput } from '@/components/common/input/CalcInput'
|
|
||||||
export default function Estimate({}) {
|
export default function Estimate({}) {
|
||||||
const [uniqueData, setUniqueData] = useState([])
|
const [uniqueData, setUniqueData] = useState([])
|
||||||
const [handlePricingFlag, setHandlePricingFlag] = useState(false)
|
const [handlePricingFlag, setHandlePricingFlag] = useState(false)
|
||||||
@ -2107,27 +2106,15 @@ export default function Estimate({}) {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div className="input-wrap" style={{ width: '100%' }}>
|
<div className="input-wrap" style={{ width: '100%' }}>
|
||||||
{/*<input*/}
|
<input
|
||||||
{/* type="text"*/}
|
type="text"
|
||||||
{/* className="input-light al-r"*/}
|
className="input-light al-r"
|
||||||
{/* value={convertNumberToPriceDecimal(item?.amount?.replaceAll(',', ''))}*/}
|
|
||||||
{/* disabled={item.itemId === '' || !!item?.paDispOrder}*/}
|
|
||||||
{/* onChange={(e) => {*/}
|
|
||||||
{/* onChangeAmount(e.target.value, item.dispOrder, index)*/}
|
|
||||||
{/* }}*/}
|
|
||||||
{/* maxLength={6}*/}
|
|
||||||
{/*/>*/}
|
|
||||||
<CalculatorInput
|
|
||||||
className={"input-light al-r"}
|
|
||||||
value={convertNumberToPriceDecimal(item?.amount?.replaceAll(',', ''))}
|
value={convertNumberToPriceDecimal(item?.amount?.replaceAll(',', ''))}
|
||||||
disabled={item.itemId === '' || !!item?.paDispOrder}
|
disabled={item.itemId === '' || !!item?.paDispOrder}
|
||||||
onChange={(value) =>{
|
onChange={(e) => {
|
||||||
onChangeAmount(value, item.dispOrder, index)
|
onChangeAmount(e.target.value, item.dispOrder, index)
|
||||||
}}
|
|
||||||
options={{
|
|
||||||
allowNegative: false,
|
|
||||||
allowDecimal: false
|
|
||||||
}}
|
}}
|
||||||
|
maxLength={6}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -2135,32 +2122,9 @@ export default function Estimate({}) {
|
|||||||
<td>
|
<td>
|
||||||
<div className="form-flex-wrap">
|
<div className="form-flex-wrap">
|
||||||
<div className="input-wrap mr5">
|
<div className="input-wrap mr5">
|
||||||
{/*<input*/}
|
<input
|
||||||
{/* type="text"*/}
|
type="text"
|
||||||
{/* className="input-light al-r"*/}
|
className="input-light al-r"
|
||||||
{/* value={*/}
|
|
||||||
{/* item.openFlg === '1'*/}
|
|
||||||
{/* ? 'OPEN'*/}
|
|
||||||
{/* : convertNumberToPriceDecimal(item?.showSalePrice === '0' ? null : item?.salePrice?.replaceAll(',', ''))*/}
|
|
||||||
{/* }*/}
|
|
||||||
{/* disabled={*/}
|
|
||||||
{/* item.openFlg === '1'*/}
|
|
||||||
{/* ? true*/}
|
|
||||||
{/* : estimateContextState?.estimateType === 'YJSS'*/}
|
|
||||||
{/* ? item?.paDispOrder*/}
|
|
||||||
{/* ? true*/}
|
|
||||||
{/* : item.pkgMaterialFlg !== '1'*/}
|
|
||||||
{/* : item.itemId === '' || !!item?.paDispOrder*/}
|
|
||||||
{/* ? true*/}
|
|
||||||
{/* : item.openFlg === '1'*/}
|
|
||||||
{/* }*/}
|
|
||||||
{/* onChange={(e) => {*/}
|
|
||||||
{/* onChangeSalePrice(e.target.value, item.dispOrder, index)*/}
|
|
||||||
{/* }}*/}
|
|
||||||
{/* maxLength={12}*/}
|
|
||||||
{/*/>*/}
|
|
||||||
<CalculatorInput
|
|
||||||
className={"input-light al-r"}
|
|
||||||
value={
|
value={
|
||||||
item.openFlg === '1'
|
item.openFlg === '1'
|
||||||
? 'OPEN'
|
? 'OPEN'
|
||||||
@ -2176,15 +2140,13 @@ export default function Estimate({}) {
|
|||||||
: item.itemId === '' || !!item?.paDispOrder
|
: item.itemId === '' || !!item?.paDispOrder
|
||||||
? true
|
? true
|
||||||
: item.openFlg === '1'
|
: item.openFlg === '1'
|
||||||
|
? true
|
||||||
|
: false
|
||||||
}
|
}
|
||||||
onChange={(value) =>{
|
onChange={(e) => {
|
||||||
onChangeSalePrice(value, item.dispOrder, index)
|
onChangeSalePrice(e.target.value, item.dispOrder, index)
|
||||||
}}
|
}}
|
||||||
maxLength={12}
|
maxLength={12}
|
||||||
options={{
|
|
||||||
allowNegative: false,
|
|
||||||
allowDecimal: false
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{item.openFlg === '1' && (
|
{item.openFlg === '1' && (
|
||||||
|
|||||||
@ -729,7 +729,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
//coordinateText(line)
|
coordinateText(line)
|
||||||
canvas.add(line)
|
canvas.add(line)
|
||||||
line.bringToFront()
|
line.bringToFront()
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user