iot-backend/software/flow/node_modules/node-red-dashboard/nodes/ui_slider.html

113 lines
5.2 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('ui_slider',{
category: RED._("node-red-dashboard/ui_base:ui_base.label.category"),
color: 'rgb(176, 223, 227)',
defaults: {
name: {value: ''},
label: {value: 'slider'},
tooltip: {value: ''},
group: {type: 'ui_group', required: true},
order: {value: 0},
width: {value: 0, validate: function(v) {
var width = v||0;
var currentGroup = $('#node-input-group').val()||this.group;
var groupNode = RED.nodes.node(currentGroup);
var valid = !groupNode || +width <= +groupNode.width;
$("#node-input-size").toggleClass("input-error",!valid);
return valid;
}
},
height: {value: 0},
passthru: {value: true},
outs: {value: 'all'},
topic: {value: 'topic', validate: (RED.validators.hasOwnProperty('typedInput')?RED.validators.typedInput('topicType'):function(v) { return true})},
topicType: {value: 'msg'},
min: {value: 0, required:true, validate:RED.validators.number()},
max: {value: 10, required:true, validate:RED.validators.number()},
step: {value: 1},
className: {value: ''}
},
inputs:1,
outputs:1,
outputLabels: function() { return this.min+" - "+this.max; },
icon: "ui_slider.png",
paletteLabel: 'slider',
label: function() { return this.name || (~this.label.indexOf("{{") ? null : this.label) || 'slider'; },
labelStyle: function() { return this.name?"node_label_italic":""; },
oneditprepare: function() {
$("#node-input-size").elementSizer({
width: "#node-input-width",
height: "#node-input-height",
group: "#node-input-group"
});
$('#node-input-topic').typedInput({
default: 'str',
typeField: $("#node-input-topicType"),
types: ['str','msg','flow','global']
});
if (!$("#node-input-outs").val()) { $("#node-input-outs").val("all") }
}
});
</script>
<script type="text/html" data-template-name="ui_slider">
<div class="form-row">
<label for="node-input-group"><i class="fa fa-table"></i> Group</label>
<input type="text" id="node-input-group">
</div>
<div class="form-row">
<label><i class="fa fa-object-group"></i> Size</label>
<input type="hidden" id="node-input-width">
<input type="hidden" id="node-input-height">
<button class="editor-button" id="node-input-size"></button>
</div>
<div class="form-row">
<label for="node-input-label"><i class="fa fa-i-cursor"></i> Label</label>
<input type="text" id="node-input-label">
</div>
<div class="form-row">
<label for="node-input-tooltip"><i class="fa fa-info-circle"></i> Tooltip</label>
<input type="text" id="node-input-tooltip" placeholder="optional tooltip">
</div>
<div class="form-row">
<label for="node-input-min"><i class="fa fa-arrows-h"></i> Range</label>
<span for="node-input-min">min</span>
<input type="text" id="node-input-min" style="width:60px">
<span for="not-input-max" style="margin-left:22px;">max</span>
<input type="text" id="node-input-max" style="width:60px">
<span for="not-input-step" style="margin-left:22px;">step</span>
<input type="text" id="node-input-step" style="width:60px">
</div>
<div class="form-row">
<label for="node-input-outs"><i class="fa fa-sign-out"></i> Output</label>
<select id="node-input-outs" style="width:204px">
<option value="all">continuously while sliding</option>
<option value="end">only on release</option>
</select>
</div>
<div class="form-row">
<label style="width:auto" for="node-input-passthru"><i class="fa fa-arrow-right"></i> If <code>msg</code> arrives on input, pass through to output: </label>
<input type="checkbox" checked id="node-input-passthru" style="display:inline-block; width:auto; vertical-align:top;">
</div>
<div class="form-row">
<label style="width:auto" for="node-input-payload"><i class="fa fa-envelope-o"></i> When changed, send:</label>
</div>
<div class="form-row">
<label style="padding-left:25px; margin-right:-25px">Payload</label>
<label style="width:auto">Current value</label>
</div>
<div class="form-row">
<label for="node-input-topic" style="padding-left:25px; margin-right:-25px">Topic</label>
<input type="text" id="node-input-topic">
</div>
<div class="form-row">
<label for="node-input-className"><i class="fa fa-code"></i> Class</label>
<input type="text" id="node-input-className" placeholder="Optional CSS class name(s) for widget"/>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
<input type="hidden" id="node-input-topicType">
</div>
</script>