Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ui_spacer.html 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <script type="text/javascript">
  2. RED.nodes.registerType('ui_spacer', {
  3. category: 'config',
  4. color: '#D4F0F8',
  5. defaults: {
  6. name: {value: "spacer"},
  7. group: {type: 'ui_group', required:true},
  8. order: {value: 0},
  9. width: {value: 0, validate: function(v) {
  10. var width = v||0;
  11. var currentGroup = $('#node-input-group').val()||this.group;
  12. var groupNode = RED.nodes.node(currentGroup);
  13. var valid = !groupNode || +width <= +groupNode.width;
  14. $("#node-input-size").toggleClass("input-error",!valid);
  15. return valid;
  16. }
  17. },
  18. height: {value: 0},
  19. className: {value: ''}
  20. },
  21. z: RED.workspaces.active(),
  22. inputs:0,
  23. outputs:0,
  24. hasUsers: false,
  25. icon: "ui_spacer.png",
  26. paletteLabel: 'spacer',
  27. label: function() { return this.name + " " + this.width + "x" + this.height; },
  28. labelStyle: function() { return this.name?"node_label_italic":""; },
  29. oneditprepare: function() {
  30. $("#node-input-size").elementSizer({
  31. width: "#node-input-width",
  32. height: "#node-input-height",
  33. group: "#node-input-group"
  34. });
  35. },
  36. oneditsave: function() {
  37. this.width = $("#node-input-width").val();
  38. this.height = $("#node-input-height").val();
  39. }
  40. });
  41. </script>
  42. <script type="text/html" data-template-name="ui_spacer">
  43. <div class="form-row">
  44. <label for="node-input-group"><i class="fa fa-table"></i> Group</label>
  45. <input type="text" id="node-input-group">
  46. </div>
  47. <div class="form-row">
  48. <label><i class="fa fa-object-group"></i> Size</label>
  49. <input type="hidden" id="node-input-width">
  50. <input type="hidden" id="node-input-height">
  51. <button class="editor-button" id="node-input-size"></button>
  52. </div>
  53. <div class="form-row">
  54. <label for="node-input-className"><i class="fa fa-code"></i> Class</label>
  55. <input type="text" id="node-input-className" placeholder="Optional CSS class name(s) for widget"/>
  56. </div>
  57. </script>