()
| 18992 | default: |
| 18993 | console.error('Unknown field type:', fieldType); |
| 18994 | return; |
| 18995 | } |
| 18996 | |
| 18997 | if (fieldType === 'filament') { |
| 18998 | filamentValueByLabel = new Map(); |
| 18999 | items = (items || []).map((f) => { |
| 19000 | const id = String(f && f.id != null ? f.id : f); |
| 19001 | const label = (typeof window.formatFilamentLabel === 'function' && f && typeof f === 'object') |
| 19002 | ? window.formatFilamentLabel(f) |
| 19003 | : String(f && f.name ? f.name : id); |
| 19004 | filamentValueByLabel.set(label, id); |
| 19005 | return label; |
| 19006 | }); |
| 19007 | } |
| 19008 | |
| 19009 | // Sort items alphabetically |
| 19010 | items.sort((a, b) => a.localeCompare(b)); |
| 19011 | |
| 19012 | // Filter out empty values |
| 19013 | items = items.filter(item => item && item.trim() !== ''); |
| 19014 | |
| 19015 | if (items.length === 0) { |
| 19016 | const li = document.createElement('li'); |
| 19017 | li.textContent = 'No items found'; |
| 19018 | li.style.color = '#888'; |
| 19019 | li.style.cursor = 'default'; |
no test coverage detected