Merge pull request #5154 from GogoVega/typedInput-node-filter

Node filter support for typedInput's builtin node
pull/5158/head
Nick O'Leary 2025-06-06 10:50:31 +01:00 committed by GitHub
commit edf9fe1050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -519,10 +519,25 @@
} }
}, },
expand: function () { expand: function () {
var that = this; const that = this;
let filter;
if (that.options.node) {
let nodeFilter = that.options.node.filter;
if ((typeof nodeFilter === "string" || typeof nodeFilter === "object") && nodeFilter) {
if (!Array.isArray(nodeFilter)) {
nodeFilter = [nodeFilter];
}
filter = function (node) {
return nodeFilter.includes(node.type);
};
} else if (typeof nodeFilter === "function") {
filter = nodeFilter;
}
}
RED.tray.hide(); RED.tray.hide();
RED.view.selectNodes({ RED.view.selectNodes({
single: true, single: true,
filter: filter,
selected: [that.value()], selected: [that.value()],
onselect: function (selection) { onselect: function (selection) {
that.value(selection.id); that.value(selection.id);