1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add compact searchBox to status/catch/complete nodes

This commit is contained in:
Nick O'Leary 2020-06-01 21:09:58 +01:00
parent dc412b305c
commit 2ce424b567
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
7 changed files with 65 additions and 16 deletions

View File

@ -38,6 +38,11 @@
this.element.addClass("red-ui-searchBox-input"); this.element.addClass("red-ui-searchBox-input");
this.uiContainer = this.element.wrap("<div>").parent(); this.uiContainer = this.element.wrap("<div>").parent();
this.uiContainer.addClass("red-ui-searchBox-container"); this.uiContainer.addClass("red-ui-searchBox-container");
if (this.options.style === "compact") {
this.uiContainer.addClass("red-ui-searchBox-compact");
}
if (this.element.parents("form").length === 0) { if (this.element.parents("form").length === 0) {
var form = this.element.wrap("<form>").parent(); var form = this.element.wrap("<form>").parent();
form.addClass("red-ui-searchBox-form"); form.addClass("red-ui-searchBox-form");

View File

@ -202,6 +202,7 @@ RED.sidebar.info.outliner = (function() {
var toolbar = $("<div>", {class:"red-ui-sidebar-header red-ui-info-toolbar"}).appendTo(container); var toolbar = $("<div>", {class:"red-ui-sidebar-header red-ui-info-toolbar"}).appendTo(container);
searchInput = $('<input type="text" data-i18n="[placeholder]menu.label.search">').appendTo(toolbar).searchBox({ searchInput = $('<input type="text" data-i18n="[placeholder]menu.label.search">').appendTo(toolbar).searchBox({
style: "compact",
delay: 300, delay: 300,
change: function() { change: function() {
var val = $(this).val(); var val = $(this).val();

View File

@ -504,18 +504,6 @@ div.red-ui-info-table {
width: calc(100% - 150px); width: calc(100% - 150px);
max-width: 250px; max-width: 250px;
background: $palette-header-background; background: $palette-header-background;
input.red-ui-searchBox-input {
border: 1px solid $secondary-border-color;
border-radius: 3px;
font-size: 12px;
height: 26px;
}
input:focus.red-ui-searchBox-input {
border: 1px solid $secondary-border-color;
}
i.fa-search, i.fa-times {
top: 7px;
}
} }
} }

View File

@ -71,3 +71,14 @@
border-radius: 4px; border-radius: 4px;
} }
} }
.red-ui-searchBox-compact {
input.red-ui-searchBox-input,input:focus.red-ui-searchBox-input {
border: 1px solid $secondary-border-color;
border-radius: 3px;
font-size: 12px;
height: 26px;
}
i.fa-times,i.fa-search {
top: 7px;
}
}

View File

@ -2,7 +2,8 @@
<div class="form-row node-input-target-row"> <div class="form-row node-input-target-row">
<button id="node-input-complete-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button> <button id="node-input-complete-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button>
</div> </div>
<div class="form-row node-input-target-row node-input-target-list-row" style="min-height: 100px"> <div class="form-row node-input-target-row node-input-target-list-row" style="position: relative; min-height: 100px">
<div style="position: absolute; top: -30px; right: 0;"><input type="text" id="node-input-complete-target-filter"></div>
<div id="node-input-complete-target-container-div"></div> <div id="node-input-complete-target-container-div"></div>
</div> </div>
@ -45,6 +46,20 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row"); var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px"); editorRow.css("height",height+"px");
}; };
$("#node-input-complete-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
} else {
dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
}
}
});
var dirList = $("#node-input-complete-target-container-div").css({width: "100%", height: "100%"}) var dirList = $("#node-input-complete-target-container-div").css({width: "100%", height: "100%"})
.treeList({multi:true}).on("treelistitemmouseover", function(e, item) { .treeList({multi:true}).on("treelistitemmouseover", function(e, item) {

View File

@ -14,7 +14,8 @@
<div class="form-row node-input-target-row"> <div class="form-row node-input-target-row">
<button id="node-input-catch-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button> <button id="node-input-catch-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button>
</div> </div>
<div class="form-row node-input-target-row node-input-target-list-row" style="min-height: 100px"> <div class="form-row node-input-target-row node-input-target-list-row" style="position: relative; min-height: 100px">
<div style="position: absolute; top: -30px; right: 0;"><input type="text" id="node-input-catch-target-filter"></div>
<div id="node-input-catch-target-container-div"></div> <div id="node-input-catch-target-container-div"></div>
</div> </div>
@ -60,7 +61,20 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row"); var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px"); editorRow.css("height",height+"px");
}; };
$("#node-input-catch-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
} else {
dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
}
}
});
var dirList = $("#node-input-catch-target-container-div").css({width: "100%", height: "100%"}) var dirList = $("#node-input-catch-target-container-div").css({width: "100%", height: "100%"})
.treeList({multi:true}).on("treelistitemmouseover", function(e, item) { .treeList({multi:true}).on("treelistitemmouseover", function(e, item) {
item.node.highlighted = true; item.node.highlighted = true;

View File

@ -10,7 +10,8 @@
<div class="form-row node-input-target-row"> <div class="form-row node-input-target-row">
<button id="node-input-status-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button> <button id="node-input-status-target-select" class="red-ui-button" data-i18n="common.label.selectNodes"></button>
</div> </div>
<div class="form-row node-input-target-row node-input-target-list-row" style="min-height: 100px"> <div class="form-row node-input-target-row node-input-target-list-row" style="position: relative; min-height: 100px">
<div style="position: absolute; top: -30px; right: 0;"><input type="text" id="node-input-status-target-filter"></div>
<div id="node-input-status-target-container-div"></div> <div id="node-input-status-target-container-div"></div>
</div> </div>
<div class="form-row"> <div class="form-row">
@ -48,6 +49,20 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row"); var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px"); editorRow.css("height",height+"px");
}; };
$("#node-input-status-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
} else {
dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
}
}
});
var dirList = $("#node-input-status-target-container-div").css({width: "100%", height: "100%"}) var dirList = $("#node-input-status-target-container-div").css({width: "100%", height: "100%"})
.treeList({multi:true}).on("treelistitemmouseover", function(e, item) { .treeList({multi:true}).on("treelistitemmouseover", function(e, item) {