diff --git a/src/component/ComponentForm.tsx b/src/component/ComponentForm.tsx index 266c402..362b0ae 100644 --- a/src/component/ComponentForm.tsx +++ b/src/component/ComponentForm.tsx @@ -503,10 +503,14 @@ export default function ComponentForm(props: Props) { }; const isOffsetValid = (min?: number, max?: number) => { - let minimum = min ?? modeDictionaryValue(compMode?.mode.dictionaryB, "min") ?? 0; - let maximum = max ?? modeDictionaryValue(compMode?.mode.dictionaryB, "max") ?? 100; + const minimum = min ?? modeDictionaryValue(compMode?.mode.dictionaryB, "min") ?? 0; + const maximum = max ?? modeDictionaryValue(compMode?.mode.dictionaryB, "max") ?? 100; if (compMode && form.component.settings.calibrate) { - return Number(form.offset) <= maximum && Number(form.offset) >= minimum; + const offset = Number(form.offset); + const meetsMinimum = compMode.mode.exclusiveMinimumB + ? offset > minimum + : offset >= minimum; + return !isNaN(offset) && offset <= maximum && meetsMinimum; } return !isNaN(Number(form.offset)); }; @@ -850,6 +854,11 @@ export default function ComponentForm(props: Props) { onFocus={selectText} margin="normal" fullWidth + inputProps={ + compMode.mode.stepB !== undefined + ? { step: compMode.mode.stepB } + : undefined + } type={compMode.mode.entryB} variant="outlined"> {compMode.mode.entryB === "select" && diff --git a/src/component/ComponentMode.json b/src/component/ComponentMode.json index da36459..4443d1f 100644 --- a/src/component/ComponentMode.json +++ b/src/component/ComponentMode.json @@ -121,10 +121,12 @@ ], "labelB": "To Node Id", "entryB": "number", + "exclusiveMinimumB": true, + "stepB": "any", "dictionaryB": [ { "key": "min", - "value": 1, + "value": 0, "restricted": false }, {