mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-16 22:38:23 +00:00
Initial commit.
This commit is contained in:
41
ui/src/components/AutocompleteInput.tsx
Normal file
41
ui/src/components/AutocompleteInput.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { Form } from "antd";
|
||||
|
||||
import Autocomplete, { OptionCallbackFunc, OptionsCallbackFunc } from "./Autocomplete";
|
||||
|
||||
|
||||
interface IProps {
|
||||
formRef: React.RefObject<any>,
|
||||
label: string,
|
||||
name: string,
|
||||
required?: boolean;
|
||||
value?: string;
|
||||
getOption: (s: string, fn: OptionCallbackFunc) => void,
|
||||
getOptions: (s: string, fn: OptionsCallbackFunc) => void,
|
||||
}
|
||||
|
||||
|
||||
class AutocompleteInput extends Component<IProps> {
|
||||
render() {
|
||||
return(
|
||||
<Form.Item
|
||||
rules={[{
|
||||
required: this.props.required,
|
||||
message: `Please select a ${this.props.label}`,
|
||||
}]}
|
||||
label={this.props.label}
|
||||
name={this.props.name}
|
||||
>
|
||||
<Autocomplete
|
||||
placeholder={`Select a ${this.props.label}`}
|
||||
className=""
|
||||
getOption={this.props.getOption}
|
||||
getOptions={this.props.getOptions}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default AutocompleteInput;
|
Reference in New Issue
Block a user