Node-Red configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ui_group.html 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <script type="text/javascript">
  2. // convert to i18 text
  3. function c_ui_group(x) {
  4. return RED._("node-red-dashboard/ui_group:ui_group."+x);
  5. }
  6. RED.nodes.registerType('ui_group',{
  7. category: 'config',
  8. defaults: {
  9. name: {value: c_ui_group("label.default")},
  10. tab: {type:"ui_tab", required: true },
  11. order: {value: 0},
  12. disp: {value: true},
  13. width: {value: 6},
  14. collapse: {value: false},
  15. disabled: {value: false},
  16. hidden: {value: false},
  17. className: {value: ''},
  18. },
  19. sort: function(A,B) {
  20. if (A.tab !== B.tab) {
  21. var tabA = RED.nodes.node(A.tab);
  22. var tabB = RED.nodes.node(B.tab);
  23. if (!tabA && tabB) {
  24. return -1;
  25. }
  26. else if (tabA && !tabB) {
  27. return 1;
  28. }
  29. else {
  30. return tabA.order - tabB.order;
  31. }
  32. }
  33. return A.order - B.order;
  34. },
  35. paletteLabel: 'dashboard group',
  36. label: function() {
  37. var tabNode = RED.nodes.node(this.tab);
  38. if (tabNode) {
  39. return "["+(tabNode.name||c_ui_group("label.tab"))+"] " + (this.name || c_ui_group("label.group"));
  40. }
  41. return "["+c_ui_group("label.unassigned")+"] " + (this.name || c_ui_group("label.group"));
  42. },
  43. labelStyle: function() { return this.name?"node_label_italic":""; },
  44. oneditprepare: function() {
  45. $("#node-input-size").elementSizer({
  46. width: "#node-config-input-width",
  47. auto: false
  48. });
  49. $("#node-config-input-disp").on("change", function() {
  50. if ($("#node-config-input-disp").is(":checked")) {
  51. $("#group-collapse-flag").show();
  52. }
  53. else {
  54. $("#group-collapse-flag").hide();
  55. $("#node-config-input-collapse").prop("checked",false);
  56. }
  57. });
  58. }
  59. });
  60. </script>
  61. <script type="text/html" data-template-name="ui_group">
  62. <div class="form-row">
  63. <label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="ui_group.label.name"></span></label>
  64. <input type="text" id="node-config-input-name">
  65. </div>
  66. <div class="form-row">
  67. <label for="node-config-input-tab"><i class="fa fa-table"></i> <span data-i18n="ui_group.label.tab"></span></label>
  68. <input type="text" id="node-config-input-tab">
  69. </div>
  70. <div class="form-row">
  71. <label for="node-config-input-className"><i class="fa fa-code"></i> <span data-i18n="ui_group.label.className"></label>
  72. <input type="text" id="node-config-input-className" data-i18n="[placeholder]ui_group.label.classNamePlaceholder"/>
  73. </div>
  74. <div class="form-row">
  75. <label for="node-config-input-width"><i class="fa fa-arrows-h"></i> <span data-i18n="ui_group.label.width"></span></label>
  76. <input type="hidden" id="node-config-input-width">
  77. <button class="editor-button" id="node-input-size"></button>
  78. </div>
  79. <div class="form-row">
  80. <input style="margin:8px 0 10px 102px; width:20px;" type="checkbox" checked id="node-config-input-disp"> <label style="width:auto" for="node-config-input-disp"><span data-i18n="ui_group.display-name"></span></label>
  81. </div>
  82. <div class="form-row" id="group-collapse-flag">
  83. <input style="margin:8px 0 10px 102px; width:20px;" type="checkbox" id="node-config-input-collapse"> <label style="width:auto" for="node-config-input-collapse"><span data-i18n="ui_group.collapse-name"></span></label>
  84. </div>
  85. </script>