Skip to content

Commit

Permalink
feat: do not use Autocomplete for TextField
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazawazi committed Jul 15, 2024
1 parent 1f55720 commit 73da3f8
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions frontend/src/components/FunixFunction/TextExtendedWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,80 @@ const TextExtendedWidget = ({
multilineConfig.multiline = false;
}

if (autocompleteOptions.length === 0) {
console.log("yes");
return (
<TextField
id={id}
placeholder={placeholder}
label={
displayLabel ? (
<MarkdownDiv
markdown={schema.title || label || "input"}
isRenderInline={true}
/>
) : null
}
fullWidth
autoFocus={autofocus}
required={required}
disabled={disabled || readonly}
type={
inputType === "number" || inputType === "integer"
? "number"
: schema.widget === "password"
? showPassword
? "text"
: "password"
: "text"
}
value={value || value === 0 ? value : ""}
error={rawErrors.length > 0}
onBlur={_onBlur}
onFocus={_onFocus}
onChange={({
target: { value },
}: React.ChangeEvent<HTMLInputElement>) => {
_onValueChange(value);
}}
InputLabelProps={{
required: false,
}}
{...multilineConfig}
size="small"
inputProps={{
style: {
resize:
schema.widget !== "password" &&
inputType !== "number" &&
inputType !== "integer"
? "vertical"
: "none",
},
}}
InputProps={{
endAdornment:
schema.widget === "password" ? (
<InputAdornment position="end">
<IconButton
onClick={() => setShowPassword((show) => !show)}
onMouseDown={(e) => e.preventDefault()}
edge="end"
sx={{
m: 0,
}}
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
) : (
<></>
),
}}
/>
);
}

return (
<Autocomplete
disableClearable
Expand Down

0 comments on commit 73da3f8

Please sign in to comment.