🆙 upgrade rc-checkbox (#22761)

This commit is contained in:
偏右 2020-03-30 22:14:13 +08:00 committed by GitHub
parent cd0203d535
commit dc4d98a46a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 704 additions and 746 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ class App extends React.Component {
render() {
return (
<div>
<>
<Radio defaultChecked={false} disabled={this.state.disabled}>
Disabled
</Radio>
@ -37,12 +37,10 @@ class App extends React.Component {
<Radio defaultChecked disabled={this.state.disabled}>
Disabled
</Radio>
<div style={{ marginTop: 20 }}>
<Button type="primary" onClick={this.toggleDisabled}>
Toggle disabled
</Button>
</div>
</div>
<Button type="primary" onClick={this.toggleDisabled} style={{ marginTop: 20 }}>
Toggle disabled
</Button>
</>
);
}
}

View File

@ -17,26 +17,22 @@ Solid radio button style.
import { Radio } from 'antd';
ReactDOM.render(
<div>
<div>
<Radio.Group defaultValue="a" buttonStyle="solid">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
<div style={{ marginTop: 16 }}>
<Radio.Group defaultValue="c" buttonStyle="solid">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b" disabled>
Shanghai
</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
</div>,
<>
<Radio.Group defaultValue="a" buttonStyle="solid">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
<Radio.Group defaultValue="c" buttonStyle="solid" style={{ marginTop: 16 }}>
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b" disabled>
Shanghai
</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</>,
mountNode,
);
```

View File

@ -21,34 +21,28 @@ function onChange(e) {
}
ReactDOM.render(
<div>
<div>
<Radio.Group onChange={onChange} defaultValue="a">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
<div style={{ marginTop: 16 }}>
<Radio.Group onChange={onChange} defaultValue="a">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b" disabled>
Shanghai
</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
<div style={{ marginTop: 16 }}>
<Radio.Group disabled onChange={onChange} defaultValue="a">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
</div>,
<>
<Radio.Group onChange={onChange} defaultValue="a">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
<Radio.Group onChange={onChange} defaultValue="a" style={{ marginTop: 16 }}>
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b" disabled>
Shanghai
</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
<Radio.Group disabled onChange={onChange} defaultValue="a" style={{ marginTop: 16 }}>
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</>,
mountNode,
);
```

View File

@ -34,8 +34,9 @@ class App extends React.Component {
height: '30px',
lineHeight: '30px',
};
const { value } = this.state;
return (
<Radio.Group onChange={this.onChange} value={this.state.value}>
<Radio.Group onChange={this.onChange} value={value}>
<Radio style={radioStyle} value={1}>
Option A
</Radio>
@ -47,7 +48,7 @@ class App extends React.Component {
</Radio>
<Radio style={radioStyle} value={4}>
More...
{this.state.value === 4 ? <Input style={{ width: 100, marginLeft: 10 }} /> : null}
{value === 4 ? <Input style={{ width: 100, marginLeft: 10 }} /> : null}
</Radio>
</Radio.Group>
);

View File

@ -57,16 +57,17 @@ class App extends React.Component {
};
render() {
const { value1, value2, value3 } = this.state;
return (
<div>
<Radio.Group options={plainOptions} onChange={this.onChange1} value={this.state.value1} />
<Radio.Group options={options} onChange={this.onChange2} value={this.state.value2} />
<>
<Radio.Group options={plainOptions} onChange={this.onChange1} value={value1} />
<Radio.Group options={options} onChange={this.onChange2} value={value2} />
<Radio.Group
options={optionsWithDisabled}
onChange={this.onChange3}
value={this.state.value3}
value={value3}
/>
</div>
</>
);
}
}

View File

@ -16,16 +16,14 @@ Passing the `name` property to all `input[type="radio"]` that are in the same Ra
```jsx
import { Radio } from 'antd';
function App() {
return (
<Radio.Group name="radiogroup" defaultValue={1}>
<Radio value={1}>A</Radio>
<Radio value={2}>B</Radio>
<Radio value={3}>C</Radio>
<Radio value={4}>D</Radio>
</Radio.Group>
);
}
const App = () => (
<Radio.Group name="radiogroup" defaultValue={1}>
<Radio value={1}>A</Radio>
<Radio value={2}>B</Radio>
<Radio value={3}>C</Radio>
<Radio value={4}>D</Radio>
</Radio.Group>
);
ReactDOM.render(<App />, mountNode);
```

View File

@ -17,32 +17,26 @@ There are three sizes available: large, medium, and small. It can coordinate wit
import { Radio } from 'antd';
ReactDOM.render(
<div>
<div>
<Radio.Group defaultValue="a" size="large">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
<div style={{ marginTop: 16 }}>
<Radio.Group defaultValue="a">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
<div style={{ marginTop: 16 }}>
<Radio.Group defaultValue="a" size="small">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</div>
</div>,
<>
<Radio.Group defaultValue="a" size="large">
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
<Radio.Group defaultValue="a" style={{ marginTop: 16 }}>
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
<Radio.Group defaultValue="a" size="small" style={{ marginTop: 16 }}>
<Radio.Button value="a">Hangzhou</Radio.Button>
<Radio.Button value="b">Shanghai</Radio.Button>
<Radio.Button value="c">Beijing</Radio.Button>
<Radio.Button value="d">Chengdu</Radio.Button>
</Radio.Group>
</>,
mountNode,
);
```

View File

@ -108,7 +108,7 @@
"raf": "^3.4.1",
"rc-animate": "~2.10.2",
"rc-cascader": "~1.0.0",
"rc-checkbox": "~2.1.6",
"rc-checkbox": "~2.2.0",
"rc-collapse": "~1.11.3",
"rc-dialog": "~7.6.0",
"rc-drawer": "~3.1.1",