mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
112 lines
5.1 KiB
HTML
112 lines
5.1 KiB
HTML
|
|
<script type="text/html" data-template-name="rbe">
|
|
<div class="form-row">
|
|
<label for="node-input-func"><i class="fa fa-wrench"></i> <span data-i18n="rbe.label.func"></span></label>
|
|
<select type="text" id="node-input-func" style="width:70%;">
|
|
<option value="rbe" data-i18n="rbe.opts.rbe"></option>
|
|
<option value="rbei" data-i18n="rbe.opts.rbei"></option>
|
|
<option value="deadbandEq" data-i18n="rbe.opts.deadbandEq"></option>
|
|
<option value="deadband" data-i18n="rbe.opts.deadband"></option>
|
|
<option value="narrowbandEq" data-i18n="rbe.opts.narrowbandEq"></option>
|
|
<option value="narrowband" data-i18n="rbe.opts.narrowband"></option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row" id="node-bandgap">
|
|
<label for="node-input-gap"> </label>
|
|
<input type="text" id="node-input-gap" data-i18n="[placeholder]rbe.placeholder.bandgap" style="width:95px;">
|
|
<select type="text" id="node-input-inout" style="width:54%;">
|
|
<option value="out" data-i18n="rbe.opts.out"></option>
|
|
<option value="in" data-i18n="rbe.opts.in"></option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row" id="node-startvalue">
|
|
<label for="node-input-start"><i class="fa fa-thumb-tack"></i> <span data-i18n="rbe.label.start"></span></label>
|
|
<input type="text" id="node-input-start" data-i18n="[placeholder]rbe.placeholder.start" style="width:70%;">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
|
|
<input type="text" id="node-input-property" style="width:70%;"/>
|
|
</div>
|
|
<div class="form-row" style="margin-bottom: 0px;">
|
|
<label> </label>
|
|
<input type="checkbox" id="node-input-septopics" style="display:inline-block; width:20px; vertical-align:baseline;">
|
|
<label style="width: auto" for="node-input-septopics" data-i18n="rbe.label.septopics"></label>
|
|
</div>
|
|
<div class="form-row">
|
|
<label> </label>
|
|
<input type="text" id="node-input-topi" style="width:70%;"/>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="rbe.label.name"></span></label>
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]rbe.label.name" style="width:70%;">
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType("rbe", {
|
|
color:"#E2D96E",
|
|
category: 'function',
|
|
defaults: {
|
|
name: {value:""},
|
|
func: {value:"rbe"},
|
|
gap: {value:"",
|
|
validate:RED.validators.regex(/^(\d*[.]*\d*|)(%|)$/, {
|
|
property: RED._("node-red:rbe.label.gap")
|
|
})},
|
|
start: {value:""},
|
|
inout: {value:"out"},
|
|
septopics: {value:true},
|
|
property: {value:"payload", required:true,
|
|
label:RED._("node-red:rbe.label.property")},
|
|
topi: {value:"topic", required:true,
|
|
label:RED._("node-red:rbe.label.topic")}
|
|
},
|
|
inputs:1,
|
|
outputs:1,
|
|
icon: "rbe.png",
|
|
paletteLabel: "filter",
|
|
label: function() {
|
|
var ll = (this.func||"").replace("Eq","").replace("rbei",this._("rbe.rbe")).replace("rbe",this._("rbe.rbe"))||this._("rbe.rbe");
|
|
return this.name||ll||this._("rbe.rbe");
|
|
},
|
|
labelStyle: function() {
|
|
return this.name?"node_label_italic":"";
|
|
},
|
|
oneditprepare: function() {
|
|
if (this.property === undefined) {
|
|
$("#node-input-property").val("payload");
|
|
}
|
|
if (this.septopics === undefined) {
|
|
$("#node-input-septopics").prop('checked', true);
|
|
}
|
|
if (this.topi === undefined) {
|
|
$("#node-input-topi").val("topic");
|
|
}
|
|
|
|
$("#node-input-property").typedInput({default:'msg',types:['msg']});
|
|
$("#node-input-topi").typedInput({default:'msg',types:['msg']});
|
|
//$( "#node-input-gap" ).spinner({min:0});
|
|
if ($("#node-input-inout").val() === null) {
|
|
$("#node-input-inout").val("out");
|
|
}
|
|
$("#node-input-func").on("change",function() {
|
|
if (($("#node-input-func").val() === "rbe")||($("#node-input-func").val() === "rbei")) {
|
|
$("#node-bandgap").hide();
|
|
} else {
|
|
$("#node-bandgap").show();
|
|
}
|
|
if (($("#node-input-func").val() === "narrowband")||($("#node-input-func").val() === "narrowbandEq")) {
|
|
$("#node-startvalue").show();
|
|
} else {
|
|
$("#node-startvalue").hide();
|
|
}
|
|
});
|
|
$("#node-input-septopics").on("change", function() {
|
|
$("#node-input-topi").typedInput("disable",!this.checked);
|
|
})
|
|
$("#node-input-topi").typedInput("disable",!!!this.septopics);
|
|
|
|
}
|
|
});
|
|
</script>
|