antd#Input JavaScript Examples
The following examples show how to use
antd#Input.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js From acy-dex-interface with MIT License | 6 votes |
render() {
const { value, editable } = this.state;
return (
<div className={styles.editableItem}>
{editable ? (
<div className={styles.wrapper}>
<Input value={value} onChange={this.handleChange} onPressEnter={this.check} />
<Icon type="check" className={styles.icon} onClick={this.check} />
</div>
) : (
<div className={styles.wrapper}>
<span>{value || ' '}</span>
<Icon type="edit" className={styles.icon} onClick={this.edit} />
</div>
)}
</div>
);
}
Example #2
Source File: UploadVideo.test.js From video-journal-for-teams-fe with MIT License | 6 votes |
describe("<UploadVideo>", () => {
let store;
let wrapper;
beforeAll(() => {
store = mockStore({
User: {
videoStream: {
raw: null,
},
},
});
});
afterEach(() => {
wrapper.unmount();
});
test("should render self without error", () => {
wrapper = shallow(<UploadVideo />);
});
test("should render a <Form> with <Input>'s", () => {
wrapper = shallow(<UploadVideo />).dive();
expect(wrapper.exists(Form)).toBe(true);
expect(wrapper.exists(Input)).toBe(true);
});
});
Example #3
Source File: TodoListUI.js From Front-end-learning-to-organize-notes with MIT License | 6 votes |
TodoListUI = (props) => {
return (
<div style={{ margin: '10px' }}>
<div>
<Input
placeholder={props.inputValue}
style={{ width: '250px', marginRight: '10px' }}
onChange={props.changeInputValue}
value={props.inputValue}
/>
<Button
type="primary"
onClick={props.clickBtn}
>增加</Button>
</div>
<div style={{ margin: '10px', width: '300px' }}>
<List
bordered
dataSource={props.list}
renderItem={(item, index) => (<List.Item onClick={() => { props.deleteItem(index) }}>{item}</List.Item>)}
></List>
</div>
</div>
);
}
Example #4
Source File: index.js From react_management_template with Apache License 2.0 | 6 votes |
render() {
return (
<Row className="login" justify="center" align="middle" >
<Col span={8}>
<h1>欢迎登录后台管理系统</h1>
<Form className="login-form" initialValues={{ remember: true }}>
<Form.Item name="username" rules={[{ required: true, message: '请输入用户名!!!' }]}>
<Input name="username" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="请输入用户名" onChange={this.onInputChange} />
</Form.Item>
<Form.Item name="password" rules={[{ required: true, message: '请输入密码!!!' }]}>
<Input name="password" prefix={<LockOutlined className="site-form-item-icon" />}type="password" placeholder="请输入密码" onChange={this.onInputChange} />
</Form.Item>
<Form.Item>
<Form.Item name="remember" valuePropName="checked" noStyle>
<Checkbox>记住用户和密码</Checkbox>
</Form.Item>
<a className="login-form-forgot" >
忘记密码
</a>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" className="login-form-button" onClick={this.onSubmit} >
登录
</Button>
</Form.Item>
</Form>
</Col>
</Row>
);
}
Example #5
Source File: challengesTagSort.js From ctf_platform with MIT License | 6 votes |
SubmitFlagForm = (props) => {
const [form] = Form.useForm();
return (
<Form
form={form}
name="submit-flag"
className="submit-flag-form"
onFinish={(values) => { props.submitFlag(values); form.resetFields() }}
style={{ display: "flex", justifyContent: "center", width: "100%", marginTop: "2vh" }}
>
<Form.Item
name="flag"
rules={[{ required: true, message: 'Hint: Flags are not blank.' }]}>
<Input disabled={props.currentChallengeSolved} style={{ width: "45ch" }} placeholder={props.currentChallengeStatus} />
</Form.Item>
<Form.Item>
<Button disabled={props.currentChallengeSolved} type="primary" htmlType="submit" icon={<FlagOutlined />}>Submit</Button>
</Form.Item>
</Form>
);
}
Example #6
Source File: Add_Certificate_Page.jsx From camprec with MIT License | 6 votes |
render(){
return (
<>
<Navbar_student/>
<section className="image width height">
<h3 className="card-title card_us"><strong>Add New Certificate</strong></h3>
<Form className="addjb margin-top" >
<FormItem >
<div className="form-group margin-t ">
<Input type="TEXT" className="form-control" placeholder="Course" onChange={this.updateInput} required />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t">
<Input type="TEXT" className="form-control" placeholder="valid_till(yyyy-mm-dd)" onChange={this.updatevalid_till} />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t">
<Input type="TEXT" className="form-control" placeholder="Institute Offering" onChange={this.updateinstitutes} />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t">
<Input type="TEXT" className="form-control" placeholder="Certificate Link" onChange={this.updatelink} />
</div>
</FormItem>
<input type= "submit" className="btn margin-top margin-b" onClick={this.add_experience} id='button' value="Add"/>
</Form>
</section>
</>
);
}
Example #7
Source File: Styles.js From dexwebapp with Apache License 2.0 | 6 votes |
SearchInput = styled(Input)`
height: 24px !important;
margin-left: 4px;
padding-left: 4px !important;
font-size: 0.85rem !important;
font-weight: normal !important;
box-shadow: none !important;
border-radius: 0px !important;
wave-animation-width: 0px !important;
border-top: none;
border-bottom: 2px solid ${(props) => props.theme.inputBorderColor} !important;
color: ${(props) => props.theme.textWhite} !important;
::placeholder {
color: ${(props) => props.theme.textDim}!important;
}
:hover {
order-bottom: 2px solid ${(props) => props.theme.primary} !important;
}
:focus {
box-shadow: none;
border-radius: 0px;
border-top: none;
border-bottom: 2px solid ${(props) => props.theme.primary} !important;
}
`
Example #8
Source File: edit.js From FP with MIT License | 6 votes |
MutiFormBox = (props) => {
const { option, value, onChange } = props;
const [opts, setOpts] = useState(option || []);
const tpl = [...value];
const addRow = () => {
let base = {label: '', value: ''}
setOpts(prev => [...prev, base])
onChange([...tpl, base])
}
const delRow = (index) => {
opts.splice(index, 1)
setOpts([...opts])
}
const handleChange = (index, e) => {
// console.log(index, e.target.value)
tpl[index].label = tpl[index].value = e.target.value
onChange(tpl)
}
return <div className={styles.mutiRow}>
{
opts.map((item, i) => {
return <div key={i} className={styles.mutiItem}>
<span className={styles.label}>{`选项${i}:`}</span>
<div className={styles.formItem}><Input defaultValue={value[i] ? value[i].label : ''} onChange={handleChange.bind(this, i)} /><MinusCircleOutlined onClick={delRow.bind(this, i)} /></div>
</div>
})
}
<Button type="primary" onClick={addRow} block>
<PlusOutlined />
</Button>
</div>
}
Example #9
Source File: create-edit-group.js From doraemon with GNU General Public License v3.0 | 6 votes |
render() {
const { getFieldDecorator } = this.props.form
const { id, visiable } = this.state
return (
<Modal
title={id ? '编辑报警组' : '添加报警组'}
visible={visiable}
onOk={this.handleOk}
onCancel={this.handleCancel}
maskClosable={false}
>
<Form {...formItemLayout} layout="horizontal">
<Form.Item label="组名">
{getFieldDecorator('name', {
rules: [
{ required: true, message: '请输入组名' },
],
})(<Input />)}
</Form.Item>
<Form.Item label="成员">
{getFieldDecorator('user', {
rules: [
{ required: true, message: '请输入成员' },
],
})(<DInput />)}
</Form.Item>
</Form>
</Modal>
)
}
Example #10
Source File: index.js From online-test-platform with Apache License 2.0 | 6 votes |
render() {
const { className, placeholder, open, ...restProps } = this.props;
const { searchMode, value } = this.state;
delete restProps.defaultOpen; // for rc-select not affected
const inputClass = classNames(styles.input, {
[styles.show]: searchMode,
});
return (
<span
className={classNames(className, styles.headerSearch)}
onClick={this.enterSearchMode}
onTransitionEnd={({ propertyName }) => {
if (propertyName === 'width' && !searchMode) {
const { onVisibleChange } = this.props;
onVisibleChange(searchMode);
}
}}
>
<Icon type="search" key="Icon" />
<AutoComplete
key="AutoComplete"
{...restProps}
className={inputClass}
value={value}
onChange={this.onChange}
>
<Input
ref={node => {
this.input = node;
}}
aria-label={placeholder}
placeholder={placeholder}
onKeyDown={this.onKeyDown}
onBlur={this.leaveSearchMode}
/>
</AutoComplete>
</span>
);
}
Example #11
Source File: componentConfig.jsx From schema-plugin-flow with MIT License | 6 votes |
BlurInput = props => {
const { value } = props;
const [val, setVal] = useState(value);
useEffect(() => {
setVal(value);
}, [value]);
return (
<Input onChange={e => { setVal(e.target.value) }} value={val} onBlur={() => props.onChange(val)} />
)
}
Example #12
Source File: custom-form.js From ant-design-charts with MIT License | 6 votes |
InputComponent = (props) => {
const { config, plugin = {} } = props;
const { placeholder, disabled } = config;
const { updateNode } = plugin;
const [label, setLabel] = useState(config?.label);
const onLabelChange = async (e) => {
setLabel(e.target.value);
updateNode({
label: e.target.value,
});
};
useEffect(() => {
setLabel(config?.label);
}, [config]);
return (
<div style={{ padding: 12 }}>
<label>标签: </label>
<Input value={label} onChange={onLabelChange} placeholder={placeholder} disabled={disabled} />
</div>
);
}
Example #13
Source File: index.js From acy-dex-interface with MIT License | 5 votes |
AcyInput = ({ children, ...rest }) => {
return (
<Input className={styles.acyinput} {...rest} />
);
}
Example #14
Source File: index.jsx From vpp with MIT License | 5 votes |
HeaderSearch = props => {
const {
className,
defaultValue,
onVisibleChange,
placeholder,
open,
defaultOpen,
...restProps
} = props;
const inputRef = useRef(null);
const [value, setValue] = useMergeValue(defaultValue, {
value: props.value,
onChange: props.onChange,
});
const [searchMode, setSearchMode] = useMergeValue(defaultOpen || false, {
value: props.open,
onChange: onVisibleChange,
});
const inputClass = classNames(styles.input, {
[styles.show]: searchMode,
});
return (
<div
className={classNames(className, styles.headerSearch)}
onClick={() => {
setSearchMode(true);
if (searchMode && inputRef.current) {
inputRef.current.focus();
}
}}
onTransitionEnd={({ propertyName }) => {
if (propertyName === 'width' && !searchMode) {
if (onVisibleChange) {
onVisibleChange(searchMode);
}
}
}}
>
<SearchOutlined
key="Icon"
style={{
cursor: 'pointer',
}}
/>
<AutoComplete
key="AutoComplete"
className={inputClass}
value={value}
style={{
height: 28,
marginTop: -6,
}}
options={restProps.options}
onChange={setValue}
>
<Input
ref={inputRef}
defaultValue={defaultValue}
aria-label={placeholder}
placeholder={placeholder}
onKeyDown={e => {
if (e.key === 'Enter') {
if (restProps.onSearch) {
restProps.onSearch(value);
}
}
}}
onBlur={() => {
setSearchMode(false);
}}
/>
</AutoComplete>
</div>
);
}
Example #15
Source File: cartHeader.js From shopping-cart-fe with MIT License | 5 votes |
CartHeader = ({
logoPath,
badgeCount = 0,
currency = '',
totalDue = 0,
displayBack,
displayTotal,
top = false
}) => {
const dispatch = useDispatch();
const cartContents = useSelector((state) => state.cart);
const storeDetails = useSelector((state) => state.user.user);
const sign = useCurrency(storeDetails.currency);
const totalPrice = (arr) => {
return arr.reduce((sum, item) => {
return sum + item.price * item.quantity;
}, 0);
};
const totalQuantity = (arr) => {
return arr.reduce((sum, item) => {
return sum + item.quantity;
}, 0);
};
const change = (e) => {
dispatch(creators.setString(e.target.value));
};
return (
<Row className={top ? 'color cart-header' : 'cart-header'} type="flex" justify="space-between" align="middle">
<Col span={6} className="logo">
{displayBack ? (
<Icon onClick={history.goBack} type="left-circle" />
) : (
<img src={logoPath || NoLogo} alt="Store Logo" />
)}
</Col>
<Col span={12} className="total">
{displayTotal ? (
`Total: ${sign}${totalPrice(cartContents).toFixed(2)}`
) : (
<Input onChange={change} placeholder="Search..." />
)}
</Col>
<NavLink to="/review">
<Col span={6} className="icon">
<Badge style={{ backgroundColor: 'gold', color: 'black' }} count={totalQuantity(cartContents)}>
<Icon type="shopping-cart" style={{ color: 'black' }} />
</Badge>
</Col>
</NavLink>
</Row>
);
}
Example #16
Source File: FeedbackForm.js From video-journal-for-teams-fe with MIT License | 5 votes |
{ TextArea } = Input
Example #17
Source File: index.js From react_management_template with Apache License 2.0 | 5 votes |
render() {
return (
<div>
<Card title="内敛表单" className="card-wrap-login">
<Form name="horizontal_login" layout="inline">
<Form.Item name="username" rules={[{ required: true, message: 'Please input your username!' }]}>
<Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="用户名" />
</Form.Item>
<Form.Item name="password" rules={[{ required: true, message: 'Please input your password!' }]}>
<Input prefix={<LockOutlined className="site-form-item-icon" />} type="password" placeholder="密码"/>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
登录
</Button>
</Form.Item>
</Form>
</Card>
<Card title="外联表单" className="card-wrap">
<Form name="normal_login" className="login-form" initialValues={{ remember: true }}>
<Form.Item rules={[{ required: true, message: '请输入用户名!!!' }]}>
<Input name="username" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="请输入用户名" onChange={this.onInputChange} />
</Form.Item>
<Form.Item rules={[{ required: true, message: '请输入密码!!!' }]}>
<Input name="password" prefix={<LockOutlined className="site-form-item-icon" />} type="password" placeholder="请输入密码" onChange={this.onInputChange}/>
</Form.Item>
<Form.Item>
<Form.Item name="remember" valuePropName="checked" noStyle>
<Checkbox>记住密码</Checkbox>
</Form.Item>
<a className="login-form-forgot" href="">
忘记密码
</a>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" className="login-form-button" onClick={this.onhandleSubmit}>
登录
</Button>
</Form.Item>
</Form>
</Card>
</div>
);
}
Example #18
Source File: ForgetPassword.js From official-website-backend with MIT License | 5 votes |
function ForgetPassword() {
const loggedIn = Object.keys(authHeader()).length ? true : false;
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const handleForgetPassword = (data) => {
setLoading(true);
postForgetPassword(data).then((res) => {
alert(res.data);
setLoading(false);
});
};
if (loggedIn) return <Redirect to="/" />;
return (
<div className="container login-container">
<h1 className="login-header">Forget Password</h1>
<div className="login-form">
<Form form={form} onFinish={handleForgetPassword} autoComplete="off">
<Form.Item
name={"email"}
label="Enter your Email"
style={{ display: "block" }}
rules={[
{
type: "email",
message: "Please enter a valid email",
},
{
required: true,
message: "Please enter your email",
},
]}
>
<Input />
</Form.Item>
<div className="login-submit-container">
<Form.Item className="login-submit">
<Button
type="secondary"
htmlType="submit"
size="large"
className="bbs"
disabled={loading}
>
Send Link
</Button>
</Form.Item>
<Link to="/login" style={{ display: "block" }}>
<small>Back to Login</small>
</Link>
</div>
</Form>
</div>
</div>
);
}
Example #19
Source File: composer.js From volt-mx-tutorials with Apache License 2.0 | 5 votes |
{ TextArea } = Input
Example #20
Source File: adminChallengeCreate.js From ctf_platform with MIT License | 5 votes |
render() {
return (
<Layout className="form-style">
<Modal
title={null}
visible={this.state.previewModal}
footer={null}
bodyStyle={{ textAlign: "center" }}
onCancel={() => { this.setState({ previewModal: false }) }}
>
<Tabs defaultActiveKey="challenge">
<TabPane
tab={<span><ProfileOutlined /> Challenge</span>}
key="challenge"
>
{this.state.challengeWriteup !== "" && (
<Tooltip title="View writeups for this challenge">
<Button shape="circle" size="large" style={{ position: "absolute", right: "2ch" }} type="primary" icon={<SolutionOutlined />} onClick={() => { window.open(this.state.challengeWriteup) }} />
</Tooltip>
)}
{this.state.challengeWriteup === "" && (
<Tooltip title="Writeups are not available for this challenge">
<Button disabled shape="circle" size="large" style={{ position: "absolute", right: "2ch" }} type="primary" icon={<SolutionOutlined />} />
</Tooltip>
)}
<h1 style={{ fontSize: "150%" }}>{this.state.previewChallenge.name}</h1>
<div>
{this.state.challengeTags}
</div>
<h2 style={{ color: "#1765ad", marginTop: "2vh", marginBottom: "6vh", fontSize: "200%" }}>{this.state.previewChallenge.points}</h2>
<div className="challengeModal">
<MarkdownRender>{this.state.previewChallenge.description}</MarkdownRender>
</div>
<div style={{ marginTop: "6vh", display: "flex", flexDirection: "column" }}>
{this.state.challengeHints}
</div>
<div style={{ display: "flex", justifyContent: "center" }}>
<Input style={{ width: "45ch" }} defaultValue="" placeholder={"Enter a flag"} />
<Button type="primary" icon={<FlagOutlined />}>Submit</Button>
</div>
<div style={{ display: "flex", flexDirection: "row", justifyContent: "space-between", marginTop: "2vh" }}>
<p>Challenge Author: <em>You</em></p>
<p style={{ color: "#d87a16", fontWeight: 500 }}>Attempts Remaining: {this.state.previewChallenge.max_attempts}</p>
</div>
</TabPane>
</Tabs>
</Modal>
<div style={{ display: "flex", alignItems: "center", alignContent: "center" }}>
<Button type="primary" onClick={this.props.handleBack} icon={<LeftOutlined />} style={{ maxWidth: "20ch", marginBottom: "3vh", marginRight: "2vw" }}>Back</Button>
<h1 style={{ fontSize: "180%" }}> <FlagTwoTone /> Create New Challenge</h1>
</div>
<CreateChallengeForm allCat={this.props.allCat} challenges={this.props.challenges} handleCreateBack={this.props.handleCreateBack.bind(this)} previewChallenge={this.previewChallenge.bind(this)} state={this.state} loadingStatus={this.state.loading} setState={this.setState.bind(this)}></CreateChallengeForm>
</Layout>
);
}
Example #21
Source File: index.js From QiskitFlow with Apache License 2.0 | 5 votes |
export function Login({ login, user, loggedIn, loginError }) {
useInjectReducer({ key: 'login', reducer });
useInjectSaga({ key: 'login', saga });
const onFinish = values => {
const { username, password } = values;
login(username, password);
};
const onFinishFailed = errorInfo => {
console.log('Failed:', errorInfo);
};
console.log(loginError)
return (
<Card title="Login form" style={{ marginTop: 20}}>
<Form
{...layout}
name="login-form"
initialValues={{ remember: true }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
<Form.Item
label="Username"
name="username"
validateStatus={loginError ? 'error' : ''}
rules={[{ required: true, message: 'Please input your username!' }]}
>
<Input />
</Form.Item>
<Form.Item
label="Password"
name="password"
validateStatus={loginError ? 'error' : ''}
help={loginError ? 'Invalid login or password' : ''}
rules={[{ required: true, message: 'Please input your password!' }]}
>
<Input.Password />
</Form.Item>
<Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
Login
</Button>
</Form.Item>
</Form>
</Card>
);
}
Example #22
Source File: Admin_Signup_Page.jsx From camprec with MIT License | 5 votes |
render(){
return (
<>
<Navbar/>
<div className="image width">
<h3 className="card-title card_us"><strong>College Signup</strong></h3>
<Form className="editjb margin-top center m-l" >
<FormItem >
<div className="form-group margin-t center">
<Input type="TEXT" className=" boderb form-control " placeholder="college email" onChange={this.updateInput} required />
</div>
</FormItem>
<FormItem >
<div className="form-group margin-t center">
<Input type="password" className=" boderb form-control " placeholder="college Password" onChange={this.updatePassword} required />
</div>
</FormItem>
<FormItem >
<div className="form-group margin-t center">
<Input type="TEXT" className=" boderb form-control " placeholder="college name" onChange={this.updateName} required />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college location" onChange={this.updateLocation} />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college year of establishment" onChange={this.updateYear} />
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college Website" onChange={this.updateWebsite} required/>
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className=" boderb form-control" placeholder="college facebook-link" onChange={this.updateFacebook} required/>
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college LinkedIn-link" onChange={this.updateLinkedin} required/>
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college instagram-link" onChange={this.updateInstagram} required/>
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="college twitter-link" onChange={this.updateTwitter} required/>
</div>
</FormItem>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control" placeholder="Disc Vedio Link" onChange={this.updateVediolink} required/>
</div>
<FormItem>
<div className="form-group margin-t center">
<Input type="TEXT" className="boderb form-control size" placeholder="college Description" onChange={this.updateAbout} required/>
</div>
</FormItem>
</FormItem>
<input type= "submit" className="btn margin-top m-l2 center" onClick={this.login_link} id='button' value="Submit"/>
</Form>
</div>
</>
);
}
Example #23
Source File: ForceWithdrawModal.js From dexwebapp with Apache License 2.0 | 5 votes |
{ Search } = Input
Example #24
Source File: baseForm.js From FP with MIT License | 5 votes |
{ TextArea } = Input
Example #25
Source File: index.jsx From react-antd-admin-template with MIT License | 5 votes |
render() {
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange,
};
return (
<div className="app-container">
<Collapse defaultActiveKey={["1"]}>
<Panel header="导出选项" key="1">
<Form layout="inline">
<Form.Item label="文件名:">
<Input
style={{ width: "250px" }}
prefix={
<Icon type="file" style={{ color: "rgba(0,0,0,.25)" }} />
}
placeholder="请输入文件名(默认excel-file)"
onChange={this.filenameChange}
/>
</Form.Item>
<Form.Item label="单元格宽度是否自适应:">
<Radio.Group
onChange={this.autoWidthChange}
value={this.state.autoWidth}
>
<Radio value={true}>是</Radio>
<Radio value={false}>否</Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="文件类型:">
<Select
defaultValue="xlsx"
style={{ width: 120 }}
onChange={this.bookTypeChange}
>
<Select.Option value="xlsx">xlsx</Select.Option>
<Select.Option value="csv">csv</Select.Option>
<Select.Option value="txt">txt</Select.Option>
</Select>
</Form.Item>
<Form.Item>
<Button
type="primary"
icon="file-excel"
onClick={this.handleDownload.bind(null, "all")}
>
全部导出
</Button>
</Form.Item>
<Form.Item>
<Button
type="primary"
icon="file-excel"
onClick={this.handleDownload.bind(null, "selected")}
>
导出已选择项
</Button>
</Form.Item>
</Form>
</Panel>
</Collapse>
<br />
<Table
bordered
columns={columns}
rowKey={(record) => record.id}
dataSource={this.state.list}
pagination={false}
rowSelection={rowSelection}
loading={this.state.downloadLoading}
/>
</div>
);
}
Example #26
Source File: LoginPage.js From cra-template-redux-auth-starter with MIT License | 5 votes |
function LoginPage() {
const loader = useSelector(state => state.authentication.loader)
const dispatch = useDispatch();
return (
<div className="container">
<Form
name="normal_login"
className="form"
initialValues={{
remember: true,
}}
onFinish={() => dispatch(login(
{'email': '[email protected]', 'password': 'cityslicka'},
))
}
>
<Form.Item
name="username"
rules={[
{
required: true,
message: 'Please input your Username!',
},
]}
>
<Input size="large"
prefix={<UserOutlined className="site-form-item-icon"/>}
placeholder="Username"
autoComplete="username"
/>
</Form.Item>
<Form.Item
name="password"
rules={[
{
required: true,
message: 'Please input your Password!',
},
]}
>
<Input
prefix={<LockOutlined className="site-form-item-icon"/>}
type="password"
placeholder="Password"
size="large"
autoComplete="current-password"
/>
</Form.Item>
<Form.Item>
<Form.Item name="remember" valuePropName="checked" noStyle>
<Checkbox>Remember me</Checkbox>
</Form.Item>
</Form.Item>
<Form.Item>
<Button loading={loader} type="primary" htmlType="submit" className="login-form-button"
size="large">Log in
</Button>
</Form.Item>
</Form>
</div>
);
}
Example #27
Source File: contact.js From portfolyo-mern with MIT License | 5 votes |
{ TextArea } = Input
Example #28
Source File: alerts.js From doraemon with GNU General Public License v3.0 | 5 votes |
render() { const { dataSource, page, labalWidth } = this.state const { getFieldDecorator } = this.props.form const columns = [ { title: 'id', align: 'center', dataIndex: 'id', sorter: (a, b) => a.id - b.id }, { title: 'Rule ID', align: 'center', dataIndex: 'rule_id', render: ruleId => (<Link to={`/rules?id=${ruleId}`}>{ruleId}</Link>), }, { title: '报警值', align: 'center', dataIndex: 'value' }, { title: '当前状态', align: 'center', dataIndex: 'status', render: status => ( <span>{status === 2 ? '报警' : status === 0 ? '恢复' : '已确认'}</span> ), }, { title: '异常分钟数', align: 'center', dataIndex: 'count', render: count => ( <span>{count+1}</span> ), }, { title: '标题', align: 'center', dataIndex: 'summary', width: 100 }, { title: 'label', align: 'center', dataIndex: 'labels', width: labalWidth, render: (labels) => { if (labels && Object.prototype.toString.call(labels) === '[object Object]') { return Object.keys(labels).map(key => <Tag color="cyan" style={{ marginTop: '5px' }}>{key}: {labels[key]}</Tag>) } return '-' }, }, { title: '描述', align: 'center', dataIndex: 'description' }, { title: '确认人', align: 'center', dataIndex: 'confirmed_by' }, { title: '触发时间', align: 'center', dataIndex: 'fired_at', width: tableTimeWidth, render: firedAt => ( <span>{firedAt === '0001-01-01T00:00:00Z' ? '--' : moment(firedAt).format('YYYY.MM.DD HH:mm:ss')}</span> ), }, { title: '确认时间', align: 'center', dataIndex: 'confirmed_at', width: tableTimeWidth, render: confirmedAt => ( <span>{confirmedAt === '0001-01-01T00:00:00Z' ? '--' : moment(confirmedAt).format('YYYY.MM.DD HH:mm:ss')}</span> ), }, { title: '确认截止时间', align: 'center', dataIndex: 'confirmed_before', width: tableTimeWidth, render: confirmedBefore => ( <span>{confirmedBefore === '0001-01-01T00:00:00Z' ? '--' : moment(confirmedBefore).format('YYYY.MM.DD HH:mm:ss')}</span> ), }, { title: '恢复时间', align: 'center', dataIndex: 'resolved_at', width: tableTimeWidth, render: resolvedAt => ( <span>{resolvedAt === '0001-01-01T00:00:00Z' ? '--' : moment(resolvedAt).format('YYYY.MM.DD HH:mm:ss')}</span> ), }, ] return ( <div> <Form layout="inline" onSubmit={this.handleSearch}> <Form.Item label="标题"> {getFieldDecorator('summary', {})(<Input placeholder="请输入标题" />)} </Form.Item> <Form.Item label="状态"> {getFieldDecorator('status', { initialValue: -1, })(<Select> <Option value={-1}>所有</Option> <Option value={0}>恢复</Option> <Option value={1}>已确认</Option> <Option value={2}>报警</Option> </Select>)} </Form.Item> <Form.Item label="报警时间" style={{ marginBottom: 0 }}> <Form.Item style={{ marginRight: 0 }}> {getFieldDecorator('timestart', {})(<DatePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ defaultValue: moment('00:00:00', 'HH:mm:ss') }} placeholder="报警开始时间" />)} </Form.Item> <span style={{ width: '24px', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>~</span> <Form.Item style={{ marginBottom: 0 }}> {getFieldDecorator('timeend', {})(<DatePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ defaultValue: moment('00:00:00', 'HH:mm:ss') }} placeholder="报警结束时间" />)} </Form.Item> </Form.Item> <Form.Item> <Button type="primary" htmlType="submit">查询</Button> </Form.Item> </Form> <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ x: 1300 }} rowKey="id" /> <div style={{ display: 'flex', justifyContent: 'flex-end', paddingTop: '15px' }}> <Pagination onChange={this.pageChange} current={page.current} pageSize={page.size} total={page.total} /> </div> </div> ) }
Example #29
Source File: index.js From topology-react with MIT License | 5 votes |
MQTTForm = ({ form: { getFieldDecorator, validateFields } }) => {
/**
* 连接mqtt
*/
const onHandleConnectMQTT = () => {
validateFields((err, value) => {
if(err) return;
const { mqtt, clientId, username, password } = value;
canvas.openMqtt(mqtt, {
clientId,
username,
password
});
});
}
return (
<Form {...formLayout}>
<Row>
<Col span={24}>
<Form.Item label="URL地址">
{getFieldDecorator('mqtt', {
initialValue: ''
})(<Input placeholder="请输入URL地址" />)}
</Form.Item>
</Col>
<Col span={24}>
<Form.Item label="Client ID">
{getFieldDecorator('clientId', {
initialValue: ''
})(<Input placeholder="请输入Client ID(不能重复使用,可为空)" />)}
</Form.Item>
</Col>
<Col span={24}>
<Form.Item label="用户名">
{getFieldDecorator('username', {
initialValue: ''
})(<Input placeholder="请输入用户名" />)}
</Form.Item>
</Col>
<Col span={24}>
<Form.Item label="密码">
{getFieldDecorator('password', {
initialValue: ''
})(<Input type="password" placeholder="请输入密码" />)}
</Form.Item>
</Col>
<Col span={24}>
<Form.Item label="Topics *">
{getFieldDecorator('topics', {
initialValue: ''
})(<Input placeholder="请输入Topics" />)}
</Form.Item>
</Col>
<Col span={24}>
<Button type="primary" style={{ marginLeft: 20, width: 235 }} onClick={() => onHandleConnectMQTT()}>
测试连接
</Button>
</Col>
</Row>
</Form>
);
}