| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- import React, { useState, useLayoutEffect, Component } from 'react';
- import { storiesOf } from '@storybook/react';
- import { Button, Modal, TreeSelect, Row, Col, Avatar, Icon, Select as BasicSelect,
- Form,
- useFormState,
- useFormApi,
- useFieldApi,
- useFieldState,
- withFormState,
- withFormApi,
- withField,
- ArrayField,
- AutoComplete,
- Collapse } from '../../../index';
- const InputGroupDemo = () => {
- const selectProps = {
- style: { width: '100px' },
- placeholder: '国家',
- field: 'country',
- rules: [
- { required: true }
- ]
- };
- return (
- <>
- <Form onSubmit={(values) => console.log(values)} labelPosition='top' style={{ width: 600 }}>
- <Form.InputGroup label={{ text: 'Movie', required: true }} labelPosition="left" style={{ width: 500 }}>
- <Form.Select {...selectProps} field='area'>
- <Form.Select.Option value="crime">+86</Form.Select.Option>
- <Form.Select.Option value="comedy">+1</Form.Select.Option>
- <Form.Select.Option value="tragedy">+83</Form.Select.Option>
- </Form.Select>
- <Form.Input placeholder="手机号码" style={{ width: 100 }} field="phone" noLabel rules={[{ required: true }]} />
- <Form.InputNumber placeholder="评分" style={{ width: 140 }} field="MovieScore" noLabel />
- </Form.InputGroup>
- <Form.InputGroup label={{ text: (<span>手机号码</span>), required: true }} labelPosition='top' extraText='i am extraText of Form.InputGroup'>
- <Form.Select style={{ width: 150 }} field='phonePrefix1' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input initValue='18912345678' style={{ width: 250 }} field='phoneNumber1' trigger={['mount', 'change']} validate={val => 'always errors'} showClear />
- </Form.InputGroup>
-
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='top'
- extraTextPosition='middle'
- extraText='i am extraText of Form.InputGroup'>
- <Form.Select style={{ width: 150 }} field='phonePrefix1' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input initValue='18912345678' style={{ width: 250 }} field='phoneNumber1' trigger={['mount', 'change']} validate={val => 'always errors'} showClear />
- </Form.InputGroup>
- <Form.InputGroup label={{ text: (<span>手机号码</span>), required: true }} labelPosition='left' style={{ width: 400 }}>
- <Form.Select style={{ width: 150 }} field='phonePrefix2' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input initValue='18912345678' style={{ width: 250 }} field='phoneNumber2' showClear />
- </Form.InputGroup>
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='left'
- extraTextPosition='bottom'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix3' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber3' trigger={['mount', 'change']} validate={val => 'always errors'} showClear />
- </Form.InputGroup>
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='left'
- extraTextPosition='middle'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix4' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber4' trigger={['mount', 'change']} validate={val => 'always errors'} rules={[{ required: true }]} showClear />
- </Form.InputGroup>
- <Button htmlType='submit'>提交</Button>
- </Form>
- <Form
- labelCol={{ span: 2 }}
- wrapperCol={{ span: 22 }}
- >
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='left'
- extraTextPosition='bottom'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix3' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber3' trigger={['mount', 'change']} validate={val => 'always errors'} showClear />
- </Form.InputGroup>
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='left'
- extraTextPosition='middle'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix4' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber4' trigger={['mount', 'change']} validate={val => 'always errors'} rules={[{ required: true }]} showClear />
- </Form.InputGroup>
- </Form>
- <Form
- labelCol={{ span: 4 }}
- wrapperCol={{ span: 20 }}
- >
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='top'
- extraTextPosition='bottom'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix3' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber3' trigger={['mount', 'change']} validate={val => 'always errors'} showClear />
- </Form.InputGroup>
- <Form.InputGroup
- label={{ text: (<span>手机号码</span>), required: true }}
- labelPosition='top'
- extraTextPosition='middle'
- extraText='i am extraText of Form.InputGroup'
- style={{ width: 400 }}
- >
- <Form.Select style={{ width: 150 }} field='phonePrefix4' initValue='+86' rules={[{ required: true }]} showClear>
- <Form.Select.Option value='+1'>美国+1</Form.Select.Option>
- <Form.Select.Option value='+852'>香港+852</Form.Select.Option>
- <Form.Select.Option value='+86'>中国+86</Form.Select.Option>
- <Form.Select.Option value='+81'>日本+81</Form.Select.Option>
- </Form.Select>
- <Form.Input style={{ width: 250 }} field='phoneNumber4' trigger={['mount', 'change']} validate={val => 'always errors'} rules={[{ required: true }]} showClear />
- </Form.InputGroup>
- </Form>
- </>
- );
- };
- export { InputGroupDemo };
|