1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-21 22:50:55 +00:00

Fix #158, min/max not being applied correctly to grouped elements.

This commit is contained in:
Ian Gray 2022-02-11 20:47:15 +00:00
parent 0fe60e91a9
commit c2dadf536e
4 changed files with 21 additions and 18 deletions

27
data/js/controls.js vendored
View File

@ -433,24 +433,27 @@ function start() {
case UI_MIN: case UI_MIN:
if (data.parentControl) { if (data.parentControl) {
var parent = $("#id" + data.parentControl + " input"); //Is it applied to a slider?
if (parent.size()) { if($('#sl' + data.parentControl).length) {
parent.attr("min", data.value); $('#sl' + data.parentControl).attr("min", data.value);
} else if($('#num' + data.parentControl).length) {
//Or a number
$('#num' + data.parentControl).attr("min", data.value);
} }
} }
break; break;
case UI_MAX: case UI_MAX:
if (data.parentControl) { if (data.parentControl) {
var parent = $("#id" + data.parentControl + " input"); //Is it applied to a slider?
if (parent.size()) { if($('#sl' + data.parentControl).length) {
if(!parent.attr("type")) { $('#sl' + data.parentControl).attr("max", data.value);
//type is not set so therefore it is a text input } else if($('#text' + data.parentControl).length) {
parent.attr("maxlength", data.value); //Is it a text element
} else { $('#text' + data.parentControl).attr("maxlength", data.value);
//type might be range (slider) or number } else if($('#num' + data.parentControl).length) {
parent.attr("max", data.value); //Or a number
} $('#num' + data.parentControl).attr("max", data.value);
} }
} }
break; break;

View File

@ -25,8 +25,8 @@ data.selected+
">"+ ">"+
data.label+ data.label+
"</option>");} "</option>");}
break;case UI_MIN:if(data.parentControl){var parent=$("#id"+data.parentControl+" input");if(parent.size()){parent.attr("min",data.value);}} break;case UI_MIN:if(data.parentControl){if($('#sl'+data.parentControl).length){$('#sl'+data.parentControl).attr("min",data.value);}else if($('#num'+data.parentControl).length){$('#num'+data.parentControl).attr("min",data.value);}}
break;case UI_MAX:if(data.parentControl){var parent=$("#id"+data.parentControl+" input");if(parent.size()){if(!parent.attr("type")){parent.attr("maxlength",data.value);}else{parent.attr("max",data.value);}}} break;case UI_MAX:if(data.parentControl){if($('#sl'+data.parentControl).length){$('#sl'+data.parentControl).attr("max",data.value);}else if($('#text'+data.parentControl).length){$('#text'+data.parentControl).attr("maxlength",data.value);}else if($('#num'+data.parentControl).length){$('#num'+data.parentControl).attr("max",data.value);}}
break;case UI_STEP:if(data.parentControl){var parent=$("#id"+data.parentControl+" input");if(parent.size()){parent.attr("step",data.value);}} break;case UI_STEP:if(data.parentControl){var parent=$("#id"+data.parentControl+" input");if(parent.size()){parent.attr("step",data.value);}}
break;case UI_GRAPH:if(data.visible){addToHTML(data);graphData[data.id]=restoreGraphData(data.id);renderGraphSvg(graphData[data.id],"graph"+data.id);} break;case UI_GRAPH:if(data.visible){addToHTML(data);graphData[data.id]=restoreGraphData(data.id);renderGraphSvg(graphData[data.id],"graph"+data.id);}
break;case ADD_GRAPH_POINT:var ts=Math.round(new Date().getTime()/1000);graphData[data.id].push({x:ts,y:data.value});saveGraphData();renderGraphSvg(graphData[data.id],"graph"+data.id);break;case CLEAR_GRAPH:graphData[data.id]=[];saveGraphData();renderGraphSvg(graphData[data.id],"graph"+data.id);break;case UI_ACCEL:if(hasAccel)break;hasAccel=true;if(data.visible){addToHTML(data);requestOrientationPermission();} break;case ADD_GRAPH_POINT:var ts=Math.round(new Date().getTime()/1000);graphData[data.id].push({x:ts,y:data.value});saveGraphData();renderGraphSvg(graphData[data.id],"graph"+data.id);break;case CLEAR_GRAPH:graphData[data.id]=[];saveGraphData();renderGraphSvg(graphData[data.id],"graph"+data.id);break;case UI_ACCEL:if(hasAccel)break;hasAccel=true;if(data.visible){addToHTML(data);requestOrientationPermission();}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long