hotfix: mode node id can be anything > 0
This commit is contained in:
parent
65f8fd06d3
commit
80750bd3e9
2 changed files with 15 additions and 4 deletions
|
|
@ -503,10 +503,14 @@ export default function ComponentForm(props: Props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOffsetValid = (min?: number, max?: number) => {
|
const isOffsetValid = (min?: number, max?: number) => {
|
||||||
let minimum = min ?? modeDictionaryValue(compMode?.mode.dictionaryB, "min") ?? 0;
|
const minimum = min ?? modeDictionaryValue(compMode?.mode.dictionaryB, "min") ?? 0;
|
||||||
let maximum = max ?? modeDictionaryValue(compMode?.mode.dictionaryB, "max") ?? 100;
|
const maximum = max ?? modeDictionaryValue(compMode?.mode.dictionaryB, "max") ?? 100;
|
||||||
if (compMode && form.component.settings.calibrate) {
|
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));
|
return !isNaN(Number(form.offset));
|
||||||
};
|
};
|
||||||
|
|
@ -850,6 +854,11 @@ export default function ComponentForm(props: Props) {
|
||||||
onFocus={selectText}
|
onFocus={selectText}
|
||||||
margin="normal"
|
margin="normal"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
inputProps={
|
||||||
|
compMode.mode.stepB !== undefined
|
||||||
|
? { step: compMode.mode.stepB }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
type={compMode.mode.entryB}
|
type={compMode.mode.entryB}
|
||||||
variant="outlined">
|
variant="outlined">
|
||||||
{compMode.mode.entryB === "select" &&
|
{compMode.mode.entryB === "select" &&
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,12 @@
|
||||||
],
|
],
|
||||||
"labelB": "To Node Id",
|
"labelB": "To Node Id",
|
||||||
"entryB": "number",
|
"entryB": "number",
|
||||||
|
"exclusiveMinimumB": true,
|
||||||
|
"stepB": "any",
|
||||||
"dictionaryB": [
|
"dictionaryB": [
|
||||||
{
|
{
|
||||||
"key": "min",
|
"key": "min",
|
||||||
"value": 1,
|
"value": 0,
|
||||||
"restricted": false
|
"restricted": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue