enter key chains through the battery S/N fields
This commit is contained in:
parent
1ccdcca21a
commit
18d47232b7
|
|
@ -1020,11 +1020,30 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
||||||
{Array.from({ length: batteryCount }, (_, batIdx) => (
|
{Array.from({ length: batteryCount }, (_, batIdx) => (
|
||||||
<TextField
|
<TextField
|
||||||
key={`bat-${invIdx}-${clIdx}-${batIdx}`}
|
key={`bat-${invIdx}-${clIdx}-${batIdx}`}
|
||||||
|
id={`bat-${invIdx}-${clIdx}-${batIdx}`}
|
||||||
label={intl.formatMessage({ id: 'batteryNSerialNumber', defaultMessage: 'Battery {n} Serial Number' }, { n: batIdx + 1 })}
|
label={intl.formatMessage({ id: 'batteryNSerialNumber', defaultMessage: 'Battery {n} Serial Number' }, { n: batIdx + 1 })}
|
||||||
value={batterySnTree[invIdx]?.[clIdx]?.[batIdx] || ''}
|
value={batterySnTree[invIdx]?.[clIdx]?.[batIdx] || ''}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
handleBatterySnTreeChange(invIdx, clIdx, batIdx, e.target.value)
|
handleBatterySnTreeChange(invIdx, clIdx, batIdx, e.target.value)
|
||||||
}
|
}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter' && presetConfig) {
|
||||||
|
e.preventDefault();
|
||||||
|
let nextInv = invIdx, nextCl = clIdx, nextBat = batIdx + 1;
|
||||||
|
if (nextBat >= presetConfig[invIdx][clIdx]) {
|
||||||
|
nextBat = 0;
|
||||||
|
nextCl = clIdx + 1;
|
||||||
|
if (nextCl >= presetConfig[invIdx].length) {
|
||||||
|
nextCl = 0;
|
||||||
|
nextInv = invIdx + 1;
|
||||||
|
if (nextInv >= presetConfig.length) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const nextId = `bat-${nextInv}-${nextCl}-${nextBat}`;
|
||||||
|
const nextInput = document.getElementById(nextId) as HTMLInputElement | null;
|
||||||
|
if (nextInput) nextInput.focus();
|
||||||
|
}
|
||||||
|
}}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder={canEdit ? 'Scan or enter serial number' : ''}
|
placeholder={canEdit ? 'Scan or enter serial number' : ''}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue