AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { FieldType, StaticDropdownEmptyOption } from '@activepieces/shared';
import { useRef } from 'react';
import { SearchableSelect } from '@/components/custom/searchable-select';
import { cn } from '@/lib/utils';
import { useTableState } from './ap-table-state-provider';
import { useCellContext } from './cell-context';
const DropdownEditor = () => {
const {
value,
handleCellChange,
setIsEditing,
isEditing,
columnIdx,
disabled,
} = useCellContext();
const field = useTableState((state) => state.fields[columnIdx]);
const containerRef = useRef<HTMLDivElement>(null);
const handleChange = (newValue: string | null) => {
handleCellChange(newValue ?? '');
};
if (field?.type !== FieldType.STATIC_DROPDOWN) {
console.log(field);
console.error('DropdownEditor can only be used for STATIC_DROPDOWN fields');
return null;
}
return (
<div
className={cn('h-full w-full', {
'border-accent-9 border-2': isEditing,
})}
ref={containerRef}
>
<SearchableSelect
variant="ghost"
triggerClassName="rounded-none px-2"
onClose={() => {
setIsEditing(false);
}}
options={[
StaticDropdownEmptyOption,
...field.data.options.map((option) => ({
value: option.value,
label: option.value,
})),
]}
onChange={handleChange}
value={value}
disabled={disabled}
placeholder={''}
showDeselect={false}
openState={{
open: isEditing,
setOpen: setIsEditing,
}}
></SearchableSelect>
</div>
);
};
DropdownEditor.displayName = 'DropdownEditor';
export { DropdownEditor };