only set height when height is supplied

This commit is contained in:
Hetu Nandu 2020-01-06 12:02:10 +05:30
parent 7820a4059c
commit efa0018d46
5 changed files with 7 additions and 16 deletions

View File

@ -129,7 +129,7 @@ interface ReduxStateProps {
export type DynamicAutocompleteInputProps = { export type DynamicAutocompleteInputProps = {
placeholder?: string; placeholder?: string;
leftIcon?: Function; leftIcon?: Function;
initialHeight: number; height?: number;
theme?: THEME; theme?: THEME;
meta?: Partial<WrappedFieldMetaProps>; meta?: Partial<WrappedFieldMetaProps>;
showLineNumbers?: boolean; showLineNumbers?: boolean;
@ -172,7 +172,9 @@ class DynamicAutocompleteInput extends Component<Props> {
completeSingle: false, completeSingle: false,
globalScope: this.props.dynamicData, globalScope: this.props.dynamicData,
}); });
this.editor.setSize(0, this.props.initialHeight); if (this.props.height) {
this.editor.setSize(0, this.props.height);
}
this.editor.eachLine(this.highlightBindings); this.editor.eachLine(this.highlightBindings);
} }
} }

View File

@ -32,16 +32,8 @@ const KeyValueRow = (props: Props & WrappedFieldArrayProps) => {
{props.fields.map((field: any, index: number) => ( {props.fields.map((field: any, index: number) => (
<FormRowWithLabel key={index}> <FormRowWithLabel key={index}>
{index === 0 && <FormLabel>{props.label}</FormLabel>} {index === 0 && <FormLabel>{props.label}</FormLabel>}
<DynamicTextField <DynamicTextField name={`${field}.key`} placeholder="Key" />
name={`${field}.key`} <DynamicTextField name={`${field}.value`} placeholder="Value" />
placeholder="Key"
initialHeight={32}
/>
<DynamicTextField
name={`${field}.value`}
placeholder="Value"
initialHeight={32}
/>
{index === props.fields.length - 1 ? ( {index === props.fields.length - 1 ? (
<Icon <Icon
icon="plus" icon="plus"

View File

@ -12,7 +12,6 @@ class CodeEditorControl extends BaseControl<ControlProps> {
<DynamicAutocompleteInput <DynamicAutocompleteInput
theme={"DARK"} theme={"DARK"}
input={{ value: this.props.propertyValue, onChange: this.onChange }} input={{ value: this.props.propertyValue, onChange: this.onChange }}
initialHeight={32}
/> />
</ControlWrapper> </ControlWrapper>
); );

View File

@ -23,7 +23,6 @@ class InputTextControl extends BaseControl<InputControlProps> {
touched: true, touched: true,
}} }}
theme={"DARK"} theme={"DARK"}
initialHeight={32}
/> />
</StyledDynamicInput> </StyledDynamicInput>
</ControlWrapper> </ControlWrapper>

View File

@ -146,7 +146,6 @@ const ApiEditorForm: React.FC<Props> = (props: Props) => {
placeholder="v1/method" placeholder="v1/method"
name="actionConfiguration.path" name="actionConfiguration.path"
leftIcon={FormIcons.SLASH_ICON} leftIcon={FormIcons.SLASH_ICON}
initialHeight={32}
/> />
</FormRow> </FormRow>
</MainConfiguration> </MainConfiguration>
@ -166,7 +165,7 @@ const ApiEditorForm: React.FC<Props> = (props: Props) => {
<JSONEditorFieldWrapper> <JSONEditorFieldWrapper>
<DynamicTextField <DynamicTextField
name="actionConfiguration.body" name="actionConfiguration.body"
initialHeight={300} height={300}
showLineNumbers showLineNumbers
allowTabIndent allowTabIndent
/> />