smart-energy-monitor/software/flow/node_modules/node-red-dashboard/nodes/ui_spacer.html

59 lines
2.2 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('ui_spacer', {
category: 'config',
color: '#D4F0F8',
defaults: {
name: {value: "spacer"},
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},
className: {value: ''}
},
z: RED.workspaces.active(),
inputs:0,
outputs:0,
hasUsers: false,
icon: "ui_spacer.png",
paletteLabel: 'spacer',
label: function() { return this.name + " " + this.width + "x" + this.height; },
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"
});
},
oneditsave: function() {
this.width = $("#node-input-width").val();
this.height = $("#node-input-height").val();
}
});
</script>
<script type="text/html" data-template-name="ui_spacer">
<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-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>
</script>