Node filter support for typedInput's builtin node

This commit is contained in:
GogoVega
2025-06-04 18:38:36 +02:00
parent 30215b02ac
commit 7a8d0abd59

View File

@@ -519,10 +519,25 @@
}
},
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") {
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.view.selectNodes({
single: true,
filter: filter,
selected: [that.value()],
onselect: function (selection) {
that.value(selection.id);