dev #519

Merged
ysCha merged 3 commits from dev into dev-deploy 2025-12-24 10:42:37 +09:00
10 changed files with 1622 additions and 1822 deletions
Showing only changes of commit cc5734db16 - Show all commits

View File

@ -3,7 +3,7 @@ import { createCalculator } from '@/util/calc-utils'
import '@/styles/calc.scss'
export const CalculatorInput = forwardRef(
({ value, onChange, label, options = {}, id, className = 'calculator-input', readOnly = false, placeholder, name='', disabled = false }, ref) => {
({ value, onChange, label, options = {}, id, className = 'calculator-input', readOnly = false, placeholder, name='', disabled = false, maxLength = 6 }, ref) => {
const [showKeypad, setShowKeypad] = useState(false)
const [displayValue, setDisplayValue] = useState(value || '0')
const [hasOperation, setHasOperation] = useState(false)
@ -48,28 +48,56 @@ export const CalculatorInput = forwardRef(
const calculator = calculatorRef.current
let newDisplayValue = ''
// maxLength
if (maxLength > 0) {
const currentLength = (calculator.currentOperand || '').length + (calculator.previousOperand || '').length + (calculator.operation || '').length
if (currentLength >= maxLength) {
return
}
}
// 2
const shouldPreventInput = (value) => {
const decimalParts = (value || '').split('.')
if (!value) return false
const decimalParts = value.toString().split('.')
return decimalParts.length > 1 && decimalParts[1].length >= 2
}
//
const appendNumber = (current, num) => {
// maxLength
if (maxLength > 0 && (current + num).length > maxLength) {
return current
}
// 0 0
if (current === '0' && num !== '.' && !current.includes('.')) {
return num.toString()
}
// 0. 0
if (current === '0' && num === '0') {
return '0.'
}
return current + num
}
if (hasOperation) {
//
if (calculator.currentOperand === '0' || calculator.shouldResetDisplay) {
if (calculator.shouldResetDisplay) {
calculator.currentOperand = num.toString()
calculator.shouldResetDisplay = false
}else if (!shouldPreventInput(calculator.currentOperand)) { // 2
calculator.currentOperand = (calculator.currentOperand || '') + num
} else if (num === '.') {
if (!calculator.currentOperand.includes('.')) {
calculator.currentOperand = calculator.currentOperand || '0' + '.'
}
} else if (!shouldPreventInput(calculator.currentOperand)) {
calculator.currentOperand = appendNumber(calculator.currentOperand || '0', num)
}
// else {
// calculator.currentOperand = (calculator.currentOperand || '') + num
// }
newDisplayValue = calculator.previousOperand + calculator.operation + calculator.currentOperand
setDisplayValue(newDisplayValue)
} else {
//
if (displayValue === '0' || calculator.shouldResetDisplay) {
if (calculator.shouldResetDisplay) {
calculator.currentOperand = num.toString()
calculator.shouldResetDisplay = false
newDisplayValue = calculator.currentOperand
@ -77,8 +105,17 @@ export const CalculatorInput = forwardRef(
if (!hasOperation) {
onChange(calculator.currentOperand)
}
} else if (!shouldPreventInput(calculator.currentOperand)) { // 2
calculator.currentOperand = (calculator.currentOperand || '') + num
} else if (num === '.') {
if (!calculator.currentOperand.includes('.')) {
calculator.currentOperand = (calculator.currentOperand || '0') + '.'
newDisplayValue = calculator.currentOperand
setDisplayValue(newDisplayValue)
if (!hasOperation) {
onChange(newDisplayValue)
}
}
} else if (!shouldPreventInput(calculator.currentOperand)) {
calculator.currentOperand = appendNumber(calculator.currentOperand || '0', num)
newDisplayValue = calculator.currentOperand
setDisplayValue(newDisplayValue)
if (!hasOperation) {
@ -382,6 +419,7 @@ export const CalculatorInput = forwardRef(
placeholder={placeholder}
autoComplete={'off'}
disabled={disabled}
maxLength={maxLength}
/>
{showKeypad && !readOnly && (

View File

@ -57,6 +57,7 @@ export default function Qna() {
endRow : endRow,
schMainYn : 'N',
siteTpCd : 'QC',
langCd : 'JA',
})
const apiUrl = `${url}?${params.toString()}`

View File

@ -24,6 +24,7 @@ import { useSwal } from '@/hooks/useSwal'
import { QcastContext } from '@/app/QcastProvider'
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import {normalizeDigits, normalizeDecimal} from '@/util/input-utils'
import { CalculatorInput } from '@/components/common/input/CalcInput'
export default function Estimate({}) {
const [uniqueData, setUniqueData] = useState([])
const [handlePricingFlag, setHandlePricingFlag] = useState(false)
@ -1693,13 +1694,13 @@ export default function Estimate({}) {
{/* 파일첨부 끝 */}
{/* 견적특이사항 시작 */}
<div className="table-box-title-wrap">
<div className="title-wrap">
<h3 className="product">{getMessage('estimate.detail.header.specialEstimate')}</h3>
<div className="estimate-check-btn">
<button className={`estimate-arr-btn down mr5 ${hidden ? '' : 'on'}`} onClick={() => setHidden(false)}></button>
<button className={`estimate-arr-btn up ${hidden ? 'on' : ''}`} onClick={() => setHidden(true)}></button>
</div>
</div>
{/*<div className="title-wrap">*/}
{/* <h3 className="product">{getMessage('estimate.detail.header.specialEstimate')}</h3>*/}
{/* <div className="estimate-check-btn">*/}
{/* <button className={`estimate-arr-btn down mr5 ${hidden ? '' : 'on'}`} onClick={() => setHidden(false)}></button>*/}
{/* <button className={`estimate-arr-btn up ${hidden ? 'on' : ''}`} onClick={() => setHidden(true)}></button>*/}
{/* </div>*/}
{/*</div>*/}
</div>
{/* 견적 특이사항 코드영역시작 */}
<div className={`estimate-check-wrap ${hidden ? 'hide' : ''}`}>
@ -2106,25 +2107,60 @@ export default function Estimate({}) {
</td>
<td>
<div className="input-wrap" style={{ width: '100%' }}>
<input
type="text"
className="input-light al-r"
{/*<input*/}
{/* type="text"*/}
{/* 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(',', ''))}
disabled={item.itemId === '' || !!item?.paDispOrder}
onChange={(e) => {
onChangeAmount(e.target.value, item.dispOrder, index)
onChange={(value) =>{
onChangeAmount(value, item.dispOrder, index)
}}
maxLength={6}
/>
options={{
allowNegative: false,
allowDecimal: false
}}
/>
</div>
</td>
<td>{item.unit}</td>
<td>
<div className="form-flex-wrap">
<div className="input-wrap mr5">
<input
type="text"
className="input-light al-r"
{/*<input*/}
{/* type="text"*/}
{/* 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={
item.openFlg === '1'
? 'OPEN'
@ -2140,13 +2176,15 @@ export default function Estimate({}) {
: item.itemId === '' || !!item?.paDispOrder
? true
: item.openFlg === '1'
? true
: false
}
onChange={(e) => {
onChangeSalePrice(e.target.value, item.dispOrder, index)
onChange={(value) =>{
onChangeSalePrice(value, item.dispOrder, index)
}}
maxLength={12}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
</div>
{item.openFlg === '1' && (

View File

@ -235,11 +235,23 @@ export default function Module({ setTabNum }) {
<div className="eaves-keraba-td">
<div className="outline-form">
<div className="grid-select mr10">
<input
type="text"
{/*<input*/}
{/* type="text"*/}
{/* className="input-origin block"*/}
{/* value={inputVerticalSnowCover}*/}
{/* onChange={(e) => setInputVerticalSnowCover(normalizeDecimal(e.target.value))}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={inputVerticalSnowCover}
onChange={(e) => setInputVerticalSnowCover(normalizeDecimal(e.target.value))}
onChange={(value) => setInputVerticalSnowCover(value)}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
</div>
<span className="thin">cm</span>

View File

@ -638,7 +638,7 @@ export const Orientation = forwardRef((props, ref) => {
name=""
label=""
className="input-origin block"
value={inputInstallHeight}
value={inputVerticalSnowCover}
onChange={(value) => handleChangeVerticalSnowCover(value)}
options={{
allowNegative: false,

View File

@ -2125,12 +2125,12 @@ export default function StuffDetail() {
{/* {...register('verticalSnowCover')}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
id="verticalSnowCover"
name="verticalSnowCover"
label=""
className="input-light"
value={form.watch('verticalSnowCover') || ''}
onChange={()=>{}}
onChange={(value) => form.setValue('verticalSnowCover', value)}
options={{
allowNegative: false,
allowDecimal: false
@ -2197,12 +2197,12 @@ export default function StuffDetail() {
{/* {...register('installHeight')}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
id="installHeight"
name="installHeight"
label=""
className="input-light"
value={form.watch('installHeight') || ''}
onChange={()=>{}}
onChange={(value) => form.setValue('installHeight', value)}
options={{
allowNegative: false,
allowDecimal: false
@ -2721,12 +2721,12 @@ export default function StuffDetail() {
{/* {...register('verticalSnowCover')}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
id="verticalSnowCover"
name="verticalSnowCover"
label=""
className="input-light"
value={form.watch('verticalSnowCover') || ''}
onChange={()=>{}}
onChange={(value) => form.setValue('verticalSnowCover', value)}
options={{
allowNegative: false,
allowDecimal: false
@ -2797,12 +2797,12 @@ export default function StuffDetail() {
{/*/>*/}
<CalculatorInput
id=""
name=""
id="installHeight"
name="installHeight"
label=""
className="input-light"
value={form.watch('installHeight') || ''}
onChange={()=>{}}
onChange={(value) => form.setValue('installHeight', value)}
options={{
allowNegative: false,
allowDecimal: false

View File

@ -631,7 +631,7 @@ export function useMovementSetting(id) {
}
return Big(0); // 기본값으로 0 반환 또는 다른 적절한 기본값
})();
if (target.y1 === target.y2) {
if (Math.abs(target.y1 - target.y2) < 0.5) {
value = value.neg()
}
} else {

View File

@ -473,7 +473,20 @@ export function useRoofAllocationSetting(id) {
// Filter out any eaveHelpLines that are already in lines to avoid duplicates
const existingEaveLineIds = new Set(roofBase.lines.map((line) => line.id))
const newEaveLines = roofEaveHelpLines.filter((line) => !existingEaveLineIds.has(line.id))
roofBase.lines = [...newEaveLines]
// Filter out lines from roofBase.lines that share any points with newEaveLines
const linesToKeep = roofBase.lines.filter(roofLine => {
return !newEaveLines.some(eaveLine => {
// Check if any endpoint of roofLine matches any endpoint of eaveLine
return (
// Check if any endpoint of roofLine matches any endpoint of eaveLine
(Math.abs(roofLine.x1 - eaveLine.x1) < 0.1 && Math.abs(roofLine.y1 - eaveLine.y1) < 0.1) || // p1 matches p1
(Math.abs(roofLine.x2 - eaveLine.x2) < 0.1 && Math.abs(roofLine.y2 - eaveLine.y2) < 0.1) // p2 matches p2
);
});
});
// Combine remaining lines with newEaveLines
roofBase.lines = [...linesToKeep, ...newEaveLines];
} else {
roofBase.lines = [...roofEaveHelpLines]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff