Browse Source

UI: Json React Form - textarea height fix

pull/2663/head
Igor Kulikov 6 years ago
parent
commit
1e079457c7
  1. 12
      ui-ngx/src/app/shared/components/json-form/react/json-form-text.tsx
  2. 9
      ui-ngx/src/app/shared/components/json-form/react/json-form.scss

12
ui-ngx/src/app/shared/components/json-form/react/json-form-text.tsx

@ -56,8 +56,14 @@ class ThingsboardText extends React.Component<JsonFormFieldProps, ThingsboardTex
}
const multiline = this.props.form.type === 'textarea';
const rows = multiline ? this.props.form.rows : 1;
const rowsMax = multiline ? this.props.form.rowsMax : 1;
let rows = 1;
let rowsMax = 1;
let minHeight = 48;
if (multiline) {
rows = this.props.form.rows || 2;
rowsMax = this.props.form.rowsMax;
minHeight = 19 * rows + 48;
}
return (
<div>
@ -77,7 +83,7 @@ class ThingsboardText extends React.Component<JsonFormFieldProps, ThingsboardTex
rowsMax={rowsMax}
onFocus={this.onFocus}
onBlur={this.onBlur}
style={this.props.form.style || {width: '100%'}}/>
style={this.props.form.style || {width: '100%', minHeight: minHeight + 'px'}}/>
</div>
);
}

9
ui-ngx/src/app/shared/components/json-form/react/json-form.scss

@ -58,6 +58,15 @@ $previewSize: 100px !default;
.tb-field {
padding-bottom: 18px;
.MuiInputBase-multiline {
flex: 1;
flex-direction: column;
.MuiInputBase-inputMultiline {
flex: 1;
}
}
&.tb-required {
label::after {
font-size: 13px;

Loading…
Cancel
Save