/** * Upload node config – allowed file types (multi-select), max size, multiple files. * Uses shared fileTypeMimeMapping for option definitions. */ import React from 'react'; import type { NodeConfigRendererProps } from './types'; import { getAcceptValues, parseAllowedTypes } from '../runtime/fileTypeMimeMapping'; import styles from '../../editor/Automation2FlowEditor.module.css'; function buildAcceptString(allowedTypes: string[]): string { if (allowedTypes.length === 0) return ''; return allowedTypes.join(','); } /** Get HTML accept string from node config (for file input). */ export function getAcceptStringFromConfig(config: Record): string { const types = parseAllowedTypes(config); return buildAcceptString(types); } const FILE_TYPE_CHIP_OPTIONS = getAcceptValues(); export const UploadNodeConfig: React.FC = ({ params, updateParam }) => { const allowedTypes = parseAllowedTypes(params); const maxSize = (params.maxSize as number) ?? 10; const multiple = (params.multiple as boolean) ?? false; const toggleType = (value: string) => { const next = allowedTypes.includes(value) ? allowedTypes.filter((v) => v !== value) : [...allowedTypes, value]; updateParam('allowedTypes', next); updateParam('accept', next.length ? buildAcceptString(next) : ''); // legacy compat for backend }; return (

Mehrfachauswahl möglich. Keine Auswahl = alle Typen erlaubt.

{FILE_TYPE_CHIP_OPTIONS.map((opt) => ( ))}
updateParam('maxSize', parseFloat(e.target.value) || 10)} />
); };