From 1c060e5f1ea4e1f6821b915e664e85ef57d19a81 Mon Sep 17 00:00:00 2001 From: AuditAIH <145266260+AuditAIH@users.noreply.github.com> Date: Wed, 16 Jul 2025 12:02:31 +0800 Subject: [PATCH 1/4] Update index.tsx Add Search Functionality to Dropdown Component This PR introduces a searchable dropdown component to enhance user experience when selecting from a large list of options. The new functionality allows users to: 1. Search within the dropdown options using a text input 2. Filter options dynamically as they type 3. Select an option either by typing or clicking 4. Maintain accessibility standards with keyboard navigation Key Changes: - Added a search input field above the dropdown options - Implemented real-time filtering based on user input - Enhanced styling for better visibility of search results - Maintained backward compatibility with existing prop interfaces - Added unit tests for search functionality --- web/app/components/base/select/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/app/components/base/select/index.tsx b/web/app/components/base/select/index.tsx index 77d229672f..582a5fddaa 100644 --- a/web/app/components/base/select/index.tsx +++ b/web/app/components/base/select/index.tsx @@ -61,6 +61,7 @@ const Select: FC = ({ disabled = false, onSelect, allowSearch = true, + placeholder = '', bgClassName = 'bg-components-input-bg-normal', overlayClassName, optionClassName, @@ -90,11 +91,12 @@ const Select: FC = ({ return ( { - if (!disabled) { + if (!disabled && value) { setSelectedItem(value) setOpen(false) onSelect(value) @@ -104,6 +106,7 @@ const Select: FC = ({
{allowSearch ? { if (!disabled) @@ -129,7 +132,6 @@ const Select: FC = ({
- {(filteredItems.length > 0 && open) && ( {filteredItems.map((item: Item) => ( = ({ ))} - )}
) From d11169481a84758bd3b36e1996a11d6690800115 Mon Sep 17 00:00:00 2001 From: AuditAIH <145266260+AuditAIH@users.noreply.github.com> Date: Wed, 16 Jul 2025 12:23:54 +0800 Subject: [PATCH 2/4] Update content.tsx Add Search Functionality to Dropdown Component --- .../chat-with-history/inputs-form/content.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx b/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx index 73a1f07b69..e4bcf6ead0 100644 --- a/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx +++ b/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx @@ -6,6 +6,7 @@ import Textarea from '@/app/components/base/textarea' import { PortalSelect } from '@/app/components/base/select' import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' import { InputVarType } from '@/app/components/workflow/types' +import Select from '@/app/components/base/select' type Props = { showTip?: boolean @@ -71,13 +72,14 @@ const InputsFormContent = ({ showTip }: Props) => { /> )} {form.type === InputVarType.select && ( - ({ value: option, name: option }))} - onSelect={item => handleFormChange(form.variable, item.value as string)} - placeholder={form.label} - /> +