()
| 188 | ) |
| 189 | |
| 190 | const renderInput = () => { |
| 191 | if (!inputParam) return null |
| 192 | |
| 193 | const value = data.inputs?.[inputParam.name] ?? inputParam.default ?? '' |
| 194 | |
| 195 | switch (inputParam.type) { |
| 196 | case 'string': |
| 197 | // When acceptVariable is enabled and suggestions are available, use VariableInput |
| 198 | // which provides inline {{ autocomplete |
| 199 | if (suggestionItems && suggestionItems.length > 0) { |
| 200 | return ( |
| 201 | <VariableInput |
| 202 | value={typeof value === 'string' ? value : ''} |
| 203 | onChange={(v) => handleDataChange(v)} |
| 204 | placeholder={inputParam.placeholder} |
| 205 | disabled={disabled} |
| 206 | rows={inputParam.rows} |
| 207 | suggestionItems={suggestionItems} |
| 208 | /> |
| 209 | ) |
| 210 | } |
| 211 | if (isExpandable) { |
| 212 | return ( |
| 213 | <Box sx={{ mt: 1 }}> |
| 214 | <RichTextEditor |
| 215 | value={typeof value === 'string' ? value : ''} |
| 216 | onChange={(html) => handleDataChange(html)} |
| 217 | placeholder={inputParam.placeholder} |
| 218 | disabled={disabled} |
| 219 | rows={inputParam.rows || 4} |
| 220 | /> |
| 221 | </Box> |
| 222 | ) |
| 223 | } |
| 224 | return ( |
| 225 | <TextField |
| 226 | fullWidth |
| 227 | size='small' |
| 228 | disabled={disabled} |
| 229 | placeholder={inputParam.placeholder} |
| 230 | value={value} |
| 231 | onChange={(e) => handleDataChange(e.target.value)} |
| 232 | sx={{ mt: 1 }} |
| 233 | /> |
| 234 | ) |
| 235 | case 'password': |
| 236 | case 'number': |
| 237 | return ( |
| 238 | <TextField |
| 239 | fullWidth |
| 240 | size='small' |
| 241 | disabled={disabled} |
| 242 | type={inputParam.type === 'password' ? 'password' : 'number'} |
| 243 | placeholder={inputParam.placeholder} |
| 244 | value={value} |
| 245 | onChange={(e) => handleDataChange(e.target.value)} |
| 246 | sx={{ mt: 1 }} |
| 247 | /> |
no test coverage detected