diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js index c8e62890f..e2773f4f6 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js @@ -40,6 +40,8 @@ RED.palette.editor = (function() { // Install tab - search input let searchInput; + const SMALL_CATALOGUE_SIZE = 40 + const typesInUse = {}; const semverre = /^(\d+)(\.(\d+))?(\.(\d+))?(-([0-9A-Za-z-]+))?(\.([0-9A-Za-z-.]+))?$/; @@ -643,14 +645,14 @@ RED.palette.editor = (function() { return (m.catalog.name === selectedCatalog); }) } - refreshFilteredItems(); + searchInput.searchBox('change') searchInput.searchBox('count',filteredList.length+" / "+loadedList.length); } function refreshFilteredItems() { packageList.editableList('empty'); var currentFilter = searchInput.searchBox('value').trim(); - if (currentFilter === "" && loadedList.length > 20){ + if (currentFilter === "" && loadedList.length > SMALL_CATALOGUE_SIZE){ packageList.editableList('addItem',{count:loadedList.length}) return; } @@ -1204,7 +1206,7 @@ RED.palette.editor = (function() { delay: 300, change: function() { var searchTerm = $(this).val().trim().toLowerCase(); - if (searchTerm.length > 0 || loadedList.length < 20) { + if (searchTerm.length > 0 || loadedList.length < SMALL_CATALOGUE_SIZE) { const searchTerms = [] searchTerm.split(',').forEach(term => { term = term.trim() @@ -1217,6 +1219,10 @@ RED.palette.editor = (function() { } }) filteredList = loadedList.filter(function(m) { + if (searchTerms.length === 0 && loadedList.length < SMALL_CATALOGUE_SIZE) { + // Show all items if the catalogue is small enough and there is no search term + return true + } for (let i = 0; i < searchTerms.length; i++) { const location = m.index.indexOf(searchTerms[i].term) if (