Merge pull request 'dev' (#577) from dev into prd-deploy

Reviewed-on: #577
This commit is contained in:
ysCha 2026-01-12 15:39:51 +09:00
commit 4133f1b512
2 changed files with 46 additions and 7 deletions

View File

@ -63,6 +63,33 @@ export const CalculatorInput = forwardRef(
const calculator = calculatorRef.current const calculator = calculatorRef.current
let newDisplayValue = '' let newDisplayValue = ''
// (Selection)
if (inputRef.current) {
const { selectionStart, selectionEnd } = inputRef.current
//
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
// ( )
if (!hasOperation) {
calculator.currentOperand = num.toString()
calculator.previousOperand = ''
calculator.operation = undefined
calculator.shouldResetDisplay = false
newDisplayValue = calculator.currentOperand
setDisplayValue(newDisplayValue)
onChange(newDisplayValue)
requestAnimationFrame(() => {
if (inputRef.current) {
inputRef.current.focus()
inputRef.current.setSelectionRange(newDisplayValue.length, newDisplayValue.length)
}
})
return //
}
}
}
// maxLength // maxLength
if (maxLength > 0) { if (maxLength > 0) {
const currentLength = (calculator.currentOperand || '').length + (calculator.previousOperand || '').length + (calculator.operation || '').length const currentLength = (calculator.currentOperand || '').length + (calculator.previousOperand || '').length + (calculator.operation || '').length

View File

@ -2039,7 +2039,11 @@ export default function Estimate({}) {
} }
}} }}
menuPlacement={'auto'} menuPlacement={'auto'}
getOptionLabel={(x) => x.itemName + ' (' + x.itemNo + ')'} getOptionLabel={(x) => {
//
const doc = new DOMParser().parseFromString(x.itemName, 'text/html');
return (doc.documentElement.textContent || x.itemName) + ' (' + x.itemNo + ')';
}}
getOptionValue={(x) => x.itemNo} getOptionValue={(x) => x.itemNo}
components={{ components={{
SingleValue: ({ children, ...props }) => { SingleValue: ({ children, ...props }) => {
@ -2048,13 +2052,21 @@ export default function Estimate({}) {
}} }}
isClearable={false} isClearable={false}
isDisabled={!!item?.paDispOrder} isDisabled={!!item?.paDispOrder}
value={displayItemList.filter(function (option) { value={(() => {
if (item.itemNo === '') { const selectedOption = displayItemList.find((option) => {
return false return item.itemNo !== '' && option.itemId === item.itemId;
} else { });
return option.itemId === item.itemId
if (selectedOption) {
// itemName
const doc = new DOMParser().parseFromString(selectedOption.itemName, 'text/html');
return {
...selectedOption,
itemName: doc.documentElement.textContent || selectedOption.itemName
};
} }
})} return null;
})()}
/> />
) : ( ) : (
<Select <Select