Don't allow people to set their instance name to an empty string (or only whitespace) (#240)
* make server name required * prevent space-only instance name * add useTrimLead to TextFieldProps
This commit is contained in:
@@ -42,6 +42,7 @@ export default function TextFieldWithSubmit(props: TextFieldWithSubmitProps) {
|
||||
configPath = '',
|
||||
initialValue,
|
||||
useTrim,
|
||||
useTrimLead,
|
||||
...textFieldProps // rest of props
|
||||
} = props;
|
||||
|
||||
@@ -73,7 +74,7 @@ export default function TextFieldWithSubmit(props: TextFieldWithSubmitProps) {
|
||||
if (onChange) {
|
||||
onChange({
|
||||
fieldName: changedFieldName,
|
||||
value: useTrim ? changedValue.trim() : changedValue,
|
||||
value: useTrim ? changedValue.trim() : useTrimLead ? changedValue.replace(/^\s+/g,'') : changedValue,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface TextFieldProps {
|
||||
tip?: string;
|
||||
type?: string;
|
||||
useTrim?: boolean;
|
||||
useTrimLead?: boolean;
|
||||
value?: string | number;
|
||||
onBlur?: FieldUpdaterFunc;
|
||||
onChange?: FieldUpdaterFunc;
|
||||
|
||||
Reference in New Issue
Block a user