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_slider.html 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <script type="text/javascript">
  2. RED.nodes.registerType('ui_slider',{
  3. category: RED._("node-red-dashboard/ui_base:ui_base.label.category"),
  4. color: 'rgb(176, 223, 227)',
  5. defaults: {
  6. name: {value: ''},
  7. label: {value: 'slider'},
  8. tooltip: {value: ''},
  9. group: {type: 'ui_group', required: true},
  10. order: {value: 0},
  11. width: {value: 0, validate: function(v) {
  12. var width = v||0;
  13. var currentGroup = $('#node-input-group').val()||this.group;
  14. var groupNode = RED.nodes.node(currentGroup);
  15. var valid = !groupNode || +width <= +groupNode.width;
  16. $("#node-input-size").toggleClass("input-error",!valid);
  17. return valid;
  18. }
  19. },
  20. height: {value: 0},
  21. passthru: {value: true},
  22. outs: {value: 'all'},
  23. topic: {value: 'topic', validate: (RED.validators.hasOwnProperty('typedInput')?RED.validators.typedInput('topicType'):function(v) { return true})},
  24. topicType: {value: 'msg'},
  25. min: {value: 0, required:true, validate:RED.validators.number()},
  26. max: {value: 10, required:true, validate:RED.validators.number()},
  27. step: {value: 1},
  28. className: {value: ''}
  29. },
  30. inputs:1,
  31. outputs:1,
  32. outputLabels: function() { return this.min+" - "+this.max; },
  33. icon: "ui_slider.png",
  34. paletteLabel: 'slider',
  35. label: function() { return this.name || (~this.label.indexOf("{{") ? null : this.label) || 'slider'; },
  36. labelStyle: function() { return this.name?"node_label_italic":""; },
  37. oneditprepare: function() {
  38. $("#node-input-size").elementSizer({
  39. width: "#node-input-width",
  40. height: "#node-input-height",
  41. group: "#node-input-group"
  42. });
  43. $('#node-input-topic').typedInput({
  44. default: 'str',
  45. typeField: $("#node-input-topicType"),
  46. types: ['str','msg','flow','global']
  47. });
  48. if (!$("#node-input-outs").val()) { $("#node-input-outs").val("all") }
  49. }
  50. });
  51. </script>
  52. <script type="text/html" data-template-name="ui_slider">
  53. <div class="form-row">
  54. <label for="node-input-group"><i class="fa fa-table"></i> Group</label>
  55. <input type="text" id="node-input-group">
  56. </div>
  57. <div class="form-row">
  58. <label><i class="fa fa-object-group"></i> Size</label>
  59. <input type="hidden" id="node-input-width">
  60. <input type="hidden" id="node-input-height">
  61. <button class="editor-button" id="node-input-size"></button>
  62. </div>
  63. <div class="form-row">
  64. <label for="node-input-label"><i class="fa fa-i-cursor"></i> Label</label>
  65. <input type="text" id="node-input-label">
  66. </div>
  67. <div class="form-row">
  68. <label for="node-input-tooltip"><i class="fa fa-info-circle"></i> Tooltip</label>
  69. <input type="text" id="node-input-tooltip" placeholder="optional tooltip">
  70. </div>
  71. <div class="form-row">
  72. <label for="node-input-min"><i class="fa fa-arrows-h"></i> Range</label>
  73. <span for="node-input-min">min</span>
  74. <input type="text" id="node-input-min" style="width:60px">
  75. <span for="not-input-max" style="margin-left:22px;">max</span>
  76. <input type="text" id="node-input-max" style="width:60px">
  77. <span for="not-input-step" style="margin-left:22px;">step</span>
  78. <input type="text" id="node-input-step" style="width:60px">
  79. </div>
  80. <div class="form-row">
  81. <label for="node-input-outs"><i class="fa fa-sign-out"></i> Output</label>
  82. <select id="node-input-outs" style="width:204px">
  83. <option value="all">continuously while sliding</option>
  84. <option value="end">only on release</option>
  85. </select>
  86. </div>
  87. <div class="form-row">
  88. <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>
  89. <input type="checkbox" checked id="node-input-passthru" style="display:inline-block; width:auto; vertical-align:top;">
  90. </div>
  91. <div class="form-row">
  92. <label style="width:auto" for="node-input-payload"><i class="fa fa-envelope-o"></i> When changed, send:</label>
  93. </div>
  94. <div class="form-row">
  95. <label style="padding-left:25px; margin-right:-25px">Payload</label>
  96. <label style="width:auto">Current value</label>
  97. </div>
  98. <div class="form-row">
  99. <label for="node-input-topic" style="padding-left:25px; margin-right:-25px">Topic</label>
  100. <input type="text" id="node-input-topic">
  101. </div>
  102. <div class="form-row">
  103. <label for="node-input-className"><i class="fa fa-code"></i> Class</label>
  104. <input type="text" id="node-input-className" placeholder="Optional CSS class name(s) for widget"/>
  105. </div>
  106. <div class="form-row">
  107. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  108. <input type="text" id="node-input-name">
  109. <input type="hidden" id="node-input-topicType">
  110. </div>
  111. </script>