mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +08:00
chore: add prettier ignore and format demo (#27270)
This commit is contained in:
parent
b5dc079228
commit
0822ac618f
@ -1,4 +1,8 @@
|
|||||||
|
**/*.png
|
||||||
**/*.svg
|
**/*.svg
|
||||||
|
CODEOWNERS
|
||||||
|
.dockerignore
|
||||||
|
Dockerfile.ui-test
|
||||||
package.json
|
package.json
|
||||||
.umi
|
.umi
|
||||||
.umi-production
|
.umi-production
|
||||||
@ -17,6 +21,8 @@ yarn-error.log
|
|||||||
*.snap
|
*.snap
|
||||||
components/*/*.js
|
components/*/*.js
|
||||||
components/*/*.jsx
|
components/*/*.jsx
|
||||||
|
components/*/*.md
|
||||||
|
docs/**/*.md
|
||||||
.gitignore
|
.gitignore
|
||||||
.npmignore
|
.npmignore
|
||||||
.prettierignore
|
.prettierignore
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
Use this section to tell people about which versions of your project are
|
Use this section to tell people about which versions of your project are currently being supported with security updates.
|
||||||
currently being supported with security updates.
|
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
@ -14,6 +13,4 @@ currently being supported with security updates.
|
|||||||
|
|
||||||
Use this section to tell people how to report a vulnerability.
|
Use this section to tell people how to report a vulnerability.
|
||||||
|
|
||||||
Tell them where to go, how often they can expect to get an update on a
|
Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the vulnerability is accepted or declined, etc.
|
||||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
|
||||||
declined, etc.
|
|
||||||
|
@ -57,9 +57,7 @@ ReactDOM.render(
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: 8 }}>
|
<div style={{ padding: 8 }}>
|
||||||
<Typography.Title level={4}>
|
<Typography.Title level={4}>Custom header</Typography.Title>
|
||||||
Custom header
|
|
||||||
</Typography.Title>
|
|
||||||
<Row gutter={8}>
|
<Row gutter={8}>
|
||||||
<Col>
|
<Col>
|
||||||
<Radio.Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
|
<Radio.Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
|
||||||
|
@ -62,11 +62,7 @@ function dropdownRender(menus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Cascader
|
<Cascader options={options} dropdownRender={dropdownRender} placeholder="Please select" />,
|
||||||
options={options}
|
|
||||||
dropdownRender={dropdownRender}
|
|
||||||
placeholder="Please select"
|
|
||||||
/>,
|
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -30,16 +30,8 @@ const data = [
|
|||||||
</p>
|
</p>
|
||||||
),
|
),
|
||||||
datetime: (
|
datetime: (
|
||||||
<Tooltip
|
<Tooltip title={moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss')}>
|
||||||
title={moment()
|
<span>{moment().subtract(1, 'days').fromNow()}</span>
|
||||||
.subtract(1, 'days')
|
|
||||||
.format('YYYY-MM-DD HH:mm:ss')}
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
{moment()
|
|
||||||
.subtract(1, 'days')
|
|
||||||
.fromNow()}
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -55,16 +47,8 @@ const data = [
|
|||||||
</p>
|
</p>
|
||||||
),
|
),
|
||||||
datetime: (
|
datetime: (
|
||||||
<Tooltip
|
<Tooltip title={moment().subtract(2, 'days').format('YYYY-MM-DD HH:mm:ss')}>
|
||||||
title={moment()
|
<span>{moment().subtract(2, 'days').fromNow()}</span>
|
||||||
.subtract(2, 'days')
|
|
||||||
.format('YYYY-MM-DD HH:mm:ss')}
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
{moment()
|
|
||||||
.subtract(2, 'days')
|
|
||||||
.fromNow()}
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -35,14 +35,14 @@ const Demo = () => {
|
|||||||
|
|
||||||
const onGenderChange = value => {
|
const onGenderChange = value => {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "male":
|
case 'male':
|
||||||
form.setFieldsValue({ note: "Hi, man!" });
|
form.setFieldsValue({ note: 'Hi, man!' });
|
||||||
return;
|
return;
|
||||||
case "female":
|
case 'female':
|
||||||
form.setFieldsValue({ note: "Hi, lady!" });
|
form.setFieldsValue({ note: 'Hi, lady!' });
|
||||||
return;
|
return;
|
||||||
case "other":
|
case 'other':
|
||||||
form.setFieldsValue({ note: "Hi there!" });
|
form.setFieldsValue({ note: 'Hi there!' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -251,7 +251,10 @@ const RegistrationForm = () => {
|
|||||||
name="agreement"
|
name="agreement"
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
rules={[
|
rules={[
|
||||||
{ validator:(_, value) => value ? Promise.resolve() : Promise.reject('Should accept agreement') },
|
{
|
||||||
|
validator: (_, value) =>
|
||||||
|
value ? Promise.resolve() : Promise.reject('Should accept agreement'),
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
{...tailFormItemLayout}
|
{...tailFormItemLayout}
|
||||||
>
|
>
|
||||||
|
@ -33,7 +33,7 @@ const data = [
|
|||||||
{
|
{
|
||||||
title: 'Title 5',
|
title: 'Title 5',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Title 6',
|
title: 'Title 6',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -57,11 +57,7 @@ ReactDOM.render(
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<List
|
<List grid={{ gutter: 16, column: 4 }} dataSource={data} renderItem={() => <ListItem />} />
|
||||||
grid={{ gutter: 16, column: 4 }}
|
|
||||||
dataSource={data}
|
|
||||||
renderItem={() => <ListItem />}
|
|
||||||
/>
|
|
||||||
<List
|
<List
|
||||||
grid={{ gutter: 16, column: 4 }}
|
grid={{ gutter: 16, column: 4 }}
|
||||||
dataSource={data}
|
dataSource={data}
|
||||||
|
@ -46,9 +46,7 @@ class App extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button onClick={this.showModal}>
|
<Button onClick={this.showModal}>Open Draggable Modal</Button>
|
||||||
Open Draggable Modal
|
|
||||||
</Button>
|
|
||||||
<Modal
|
<Modal
|
||||||
title={
|
title={
|
||||||
<div
|
<div
|
||||||
|
@ -38,7 +38,7 @@ const App = () => {
|
|||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
ReactDOM.render(<App />, mountNode);
|
ReactDOM.render(<App />, mountNode);
|
||||||
```
|
```
|
||||||
|
@ -20,15 +20,12 @@ import { Radio, Badge } from 'antd';
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Radio.Group buttonStyle="solid">
|
<Radio.Group buttonStyle="solid">
|
||||||
<Badge count={1}>
|
<Badge count={1}>
|
||||||
<Radio.Button value={1}>
|
<Radio.Button value={1}>Click Me</Radio.Button>
|
||||||
Click Me
|
|
||||||
</Radio.Button>
|
|
||||||
</Badge>
|
</Badge>
|
||||||
<Badge count={2}>
|
<Badge count={2}>
|
||||||
<Radio.Button value={2}>
|
<Radio.Button value={2}>Not Me</Radio.Button>
|
||||||
Not Me
|
|
||||||
</Radio.Button>
|
|
||||||
</Badge>
|
</Badge>
|
||||||
</Radio.Group>
|
</Radio.Group>,
|
||||||
, mountNode);
|
mountNode,
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
@ -22,10 +22,7 @@ function onChange(time, timeString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<TimePicker
|
<TimePicker onChange={onChange} defaultOpenValue={moment('00:00:00', 'HH:mm:ss')} />,
|
||||||
onChange={onChange}
|
|
||||||
defaultOpenValue={moment('00:00:00', 'HH:mm:ss')}
|
|
||||||
/>,
|
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -17,11 +17,5 @@ A disabled state of the `TimePicker`.
|
|||||||
import { TimePicker } from 'antd';
|
import { TimePicker } from 'antd';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(<TimePicker defaultValue={moment('12:08:23', 'HH:mm:ss')} disabled />, mountNode);
|
||||||
<TimePicker
|
|
||||||
defaultValue={moment('12:08:23', 'HH:mm:ss')}
|
|
||||||
disabled
|
|
||||||
/>,
|
|
||||||
mountNode,
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
@ -19,11 +19,5 @@ import moment from 'moment';
|
|||||||
|
|
||||||
const format = 'HH:mm';
|
const format = 'HH:mm';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(<TimePicker defaultValue={moment('12:08', format)} format={format} />, mountNode);
|
||||||
<TimePicker
|
|
||||||
defaultValue={moment('12:08', format)}
|
|
||||||
format={format}
|
|
||||||
/>,
|
|
||||||
mountNode,
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
@ -25,7 +25,7 @@ const Demo = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return <TimePicker value={value} onChange={onChange} />;
|
return <TimePicker value={value} onChange={onChange} />;
|
||||||
}
|
};
|
||||||
|
|
||||||
ReactDOM.render(<Demo />, mountNode);
|
ReactDOM.render(<Demo />, mountNode);
|
||||||
```
|
```
|
||||||
|
@ -27,9 +27,7 @@ class Demo extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
genTreeNode = (parentId, isLeaf = false) => {
|
genTreeNode = (parentId, isLeaf = false) => {
|
||||||
const random = Math.random()
|
const random = Math.random().toString(36).substring(2, 6);
|
||||||
.toString(36)
|
|
||||||
.substring(2, 6);
|
|
||||||
return {
|
return {
|
||||||
id: random,
|
id: random,
|
||||||
pId: parentId,
|
pId: parentId,
|
||||||
|
@ -71,7 +71,7 @@ class Demo extends React.Component {
|
|||||||
return callback(data[i], i, data);
|
return callback(data[i], i, data);
|
||||||
}
|
}
|
||||||
if (data[i].children) {
|
if (data[i].children) {
|
||||||
loop(data[i].children, key, callback);
|
loop(data[i].children, key, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ const treeData = [
|
|||||||
{ title: 'leaf', key: '0-1-0-1', icon: <CarryOutOutlined /> },
|
{ title: 'leaf', key: '0-1-0-1', icon: <CarryOutOutlined /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user