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_numeric.html 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <script type="text/javascript">
  2. RED.nodes.registerType('ui_numeric',{
  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: 'numeric'},
  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. wrap: {value: false},
  22. passthru: {value: true},
  23. topic: {value: 'topic', validate: (RED.validators.hasOwnProperty('typedInput')?RED.validators.typedInput('topicType'):function(v) { return true})},
  24. topicType: {value: 'msg'},
  25. format: {value: '{{value}}'},
  26. min: {value: 0, required: true, validate: RED.validators.number()},
  27. max: {value: 10, required: true, validate: RED.validators.number()},
  28. step: {value: 1},
  29. className: {value: ''}
  30. },
  31. inputs:1,
  32. outputs:1,
  33. outputLabels: function() { return this.min+" - "+this.max; },
  34. icon: "ui_numeric.png",
  35. paletteLabel: 'numeric',
  36. label: function() { return this.name || (~this.label.indexOf("{{") ? null : this.label) || 'numeric'; },
  37. labelStyle: function() { return this.name?"node_label_italic":""; },
  38. oneditprepare: function() {
  39. $("#node-input-size").elementSizer({
  40. width: "#node-input-width",
  41. height: "#node-input-height",
  42. group: "#node-input-group"
  43. });
  44. $('#node-input-topic').typedInput({
  45. default: 'str',
  46. typeField: $("#node-input-topicType"),
  47. types: ['str','msg','flow','global']
  48. });
  49. }
  50. });
  51. </script>
  52. <script type="text/html" data-template-name="ui_numeric">
  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-format"><i class="fa fa-i-cursor"></i> Value Format</label>
  73. <input type="text" id="node-input-format" placeholder="{{value}}">
  74. </div>
  75. <div class="form-row">
  76. <label for="node-input-min"><i class="fa fa-arrows-h"></i> Range</label>
  77. <span for="node-input-min">min</span>
  78. <input type="text" id="node-input-min" style="width:60px">
  79. <span for="not-input-max" style="margin-left:22px;">max</span>
  80. <input type="text" id="node-input-max" style="width:60px">
  81. <span for="not-input-step" style="margin-left:22px;">step</span>
  82. <input type="text" id="node-input-step" style="width:60px">
  83. </div>
  84. <div class="form-row">
  85. <label style="width:auto" for="node-input-wrap"><i class="fa fa-refresh"></i> Wrap value from max to min and min to max.</label>
  86. <input type="checkbox" id="node-input-wrap" style="display:inline-block; width:auto; vertical-align:top;">
  87. </div>
  88. <div class="form-row">
  89. <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>
  90. <input type="checkbox" checked id="node-input-passthru" style="display:inline-block; width:auto; vertical-align:top;">
  91. </div>
  92. <div class="form-row">
  93. <label style="width:auto" for="node-input-payload"><i class="fa fa-envelope-o"></i> When changed, send:</label>
  94. </div>
  95. <div class="form-row">
  96. <label style="padding-left:25px; margin-right:-25px">Payload</label>
  97. <label style="width:auto">Current value</label>
  98. </div>
  99. <div class="form-row">
  100. <label for="node-input-topic" style="padding-left:25px; margin-right:-25px">Topic</label>
  101. <input type="text" id="node-input-topic">
  102. <input type="hidden" id="node-input-topicType">
  103. </div>
  104. <div class="form-row">
  105. <label for="node-input-className"><i class="fa fa-code"></i> Class</label>
  106. <input type="text" id="node-input-className" placeholder="Optional CSS class name(s) for widget"/>
  107. </div>
  108. <div class="form-row">
  109. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  110. <input type="text" id="node-input-name">
  111. </div>
  112. </script>