Skip to content

Commit

Permalink
feat(frontend): support resize TextField
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazawazi committed Nov 1, 2023
1 parent 7044c2c commit db43985
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/FunixFunction/TextExtendedWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ const TextExtendedWidget = ({
const freeSolo: boolean = contentPolicy != ContentPolicy.Whitelist;

const multilineConfig: MultilineProps = {};
multilineConfig.multiline = true;

if (schema.widget) {
const widget = schema.widget;

if (schema.widget.indexOf("textarea") !== -1) {
multilineConfig.multiline = true;
const parseResult = textareaWidgetParser(widget);

if (parseResult === "default") {
Expand All @@ -322,16 +322,14 @@ const TextExtendedWidget = ({
console.warn("Invalid widget syntax for textarea");
multilineConfig.rows = parseResult[0];
}
} else {
multilineConfig.multiline = false;
}
}

return (
<Autocomplete
disableClearable={
inputType === "number" ||
inputType === "integer" ||
schema.widget?.indexOf("textarea") !== -1
}
disableClearable
size="small"
value={value || value === 0 ? value : ""}
getOptionLabel={(option) => option.toString()}
Expand All @@ -352,9 +350,12 @@ const TextExtendedWidget = ({
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
{newParams.InputProps.endAdornment}
</>
);
} else {
newParams.inputProps.style = {
resize: "vertical",
};
}
return (
<TextField
Expand All @@ -370,6 +371,7 @@ const TextExtendedWidget = ({
/>
) : null
}
fullWidth
autoFocus={autofocus}
required={required}
disabled={disabled || readonly}
Expand Down

0 comments on commit db43985

Please sign in to comment.