Browse Source

💄 fix eslint problems

pull/13325/head
afc163 6 years ago
parent
commit
83c192ea3e
No known key found for this signature in database GPG Key ID: 738F973FCE5C6B48
  1. 31
      .eslintrc.js
  2. 14
      components/affix/__tests__/Affix.test.js
  3. 3
      components/alert/demo/banner.md
  4. 3
      components/alert/demo/basic.md
  5. 5
      components/alert/demo/closable.md
  6. 3
      components/alert/demo/close-text.md
  7. 3
      components/alert/demo/custom-icon.md
  8. 3
      components/alert/demo/description.md
  9. 3
      components/alert/demo/icon.md
  10. 3
      components/alert/demo/smooth-closed.md
  11. 3
      components/alert/demo/style.md
  12. 4
      components/anchor/__tests__/Anchor.test.js
  13. 3
      components/anchor/demo/basic.md
  14. 3
      components/anchor/demo/onClick.md
  15. 3
      components/anchor/demo/static.md
  16. 4
      components/auto-complete/demo/options.md
  17. 4
      components/auto-complete/demo/uncertain-category.md
  18. 3
      components/avatar/demo/badge.md
  19. 3
      components/avatar/demo/basic.md
  20. 3
      components/avatar/demo/type.md
  21. 3
      components/badge/demo/basic.md
  22. 4
      components/badge/demo/change.md
  23. 3
      components/badge/demo/dot.md
  24. 3
      components/badge/demo/link.md
  25. 3
      components/badge/demo/no-wrapper.md
  26. 3
      components/badge/demo/overflow.md
  27. 3
      components/badge/demo/status.md
  28. 3
      components/badge/demo/title.md
  29. 4
      components/breadcrumb/__tests__/router.test.js
  30. 3
      components/breadcrumb/demo/basic.md
  31. 7
      components/breadcrumb/demo/router-4.md
  32. 7
      components/breadcrumb/demo/router.md
  33. 3
      components/breadcrumb/demo/separator.md
  34. 3
      components/breadcrumb/demo/withIcon.md
  35. 3
      components/button/demo/basic.md
  36. 3
      components/button/demo/block.md
  37. 3
      components/button/demo/ghost.md
  38. 4
      components/button/demo/multiple.md
  39. 3
      components/calendar/demo/basic.md
  40. 3
      components/calendar/demo/card.md
  41. 3
      components/calendar/demo/notice-calendar.md
  42. 3
      components/card/demo/basic.md
  43. 3
      components/card/demo/border-less.md
  44. 3
      components/card/demo/flexible-content.md
  45. 3
      components/card/demo/grid-card.md
  46. 3
      components/card/demo/in-column.md
  47. 3
      components/card/demo/inner.md
  48. 4
      components/card/demo/loading.md
  49. 3
      components/card/demo/meta.md
  50. 3
      components/card/demo/simple.md
  51. 2
      components/carousel/__tests__/index.test.js
  52. 3
      components/carousel/demo/autoplay.md
  53. 3
      components/carousel/demo/basic.md
  54. 3
      components/carousel/demo/fade.md
  55. 3
      components/carousel/demo/vertical.md
  56. 3
      components/cascader/demo/basic.md
  57. 3
      components/cascader/demo/change-on-select.md
  58. 3
      components/cascader/demo/custom-render.md
  59. 3
      components/cascader/demo/default-value.md
  60. 3
      components/cascader/demo/disabled-option.md
  61. 3
      components/cascader/demo/fields-name.md
  62. 3
      components/cascader/demo/hover.md
  63. 3
      components/cascader/demo/size.md
  64. 3
      components/cascader/demo/suffix.md
  65. 3
      components/checkbox/demo/basic.md
  66. 32
      components/checkbox/demo/check-all.md
  67. 30
      components/checkbox/demo/controller.md
  68. 3
      components/checkbox/demo/disabled.md
  69. 3
      components/checkbox/demo/group.md
  70. 3
      components/collapse/demo/accordion.md
  71. 3
      components/collapse/demo/basic.md
  72. 3
      components/collapse/demo/borderless.md
  73. 3
      components/collapse/demo/custom.md
  74. 3
      components/collapse/demo/mix.md
  75. 3
      components/collapse/demo/noarrow.md
  76. 7
      components/date-picker/__tests__/DatePicker.test.js
  77. 8
      components/date-picker/__tests__/showTime.test.js
  78. 3
      components/date-picker/demo/basic.md
  79. 3
      components/date-picker/demo/date-render.md
  80. 3
      components/date-picker/demo/disabled.md
  81. 3
      components/date-picker/demo/extra-footer.md
  82. 3
      components/date-picker/demo/format.md
  83. 3
      components/date-picker/demo/mode.md
  84. 3
      components/date-picker/demo/suffix.md
  85. 3
      components/date-picker/demo/time.md
  86. 3
      components/divider/demo/horizontal.md
  87. 3
      components/divider/demo/orientation.md
  88. 3
      components/divider/demo/vertical.md
  89. 4
      components/drawer/demo/from-drawer.md
  90. 4
      components/drawer/demo/user-profile.md
  91. 3
      components/dropdown/demo/basic.md
  92. 3
      components/dropdown/demo/context-menu.md
  93. 7
      components/dropdown/demo/dropdown-button.md
  94. 9
      components/dropdown/demo/event.md
  95. 3
      components/dropdown/demo/item.md
  96. 3
      components/dropdown/demo/overlay-visible.md
  97. 3
      components/dropdown/demo/placement.md
  98. 3
      components/dropdown/demo/sub-menu.md
  99. 3
      components/dropdown/demo/trigger.md
  100. 2
      components/form/__tests__/index.test.js

31
.eslintrc.js

@ -14,33 +14,18 @@ const eslintrc = {
'babel',
],
rules: {
'func-names': 0,
'arrow-body-style': 0,
'react/sort-comp': 0,
'react/prop-types': 0,
'react/jsx-first-prop-new-line': 0,
'react/jsx-one-expression-per-line': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'import/no-extraneous-dependencies': ['error', {
devDependencies: ['site/**', 'tests/**', 'scripts/**', '**/*.test.js', '**/__tests__/*', '*.config.js', '**/*.md'],
}],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.md'] }],
'import/extensions': 0,
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0,
'prefer-destructuring': 0,
'no-param-reassign': 0,
'no-return-assign': 0,
'max-len': 0,
'consistent-return': 0,
'no-redeclare': 0,
'react/require-extension': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/anchor-has-content': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/anchor-is-valid': 0,
'react/no-danger': 0,
'comma-dangle': ['error', 'always-multiline'],
'function-paren-newline': 0,
'object-curly-newline': 0,
'no-restricted-globals': 0,
},
};
@ -61,9 +46,13 @@ if (process.env.RUN_ENV === 'DEMO') {
'react/no-access-state-in-setstate': 0,
'react/destructuring-assignment': 0,
'react/no-multi-comp': 0,
'react/prefer-stateless-function': 0,
'jsx-a11y/href-no-hash': 0,
'import/newline-after-import': 0,
'prefer-destructuring': 0, // TODO: remove later
'max-len': 0, // TODO: remove later
'consistent-return': 0, // TODO: remove later
'no-return-assign': 0, // TODO: remove later
'no-param-reassign': 0, // TODO: remove later
'import/no-extraneous-dependencies': 0,
});
}

14
components/affix/__tests__/Affix.test.js

@ -12,9 +12,7 @@ class AffixMounter extends React.Component {
});
}
getTarget = () => {
return this.container;
}
getTarget = () => this.container
render() {
return (
@ -34,7 +32,7 @@ class AffixMounter extends React.Component {
>
<Affix
target={() => this.container}
ref={ele => this.affix = ele}
ref={(ele) => { this.affix = ele; }}
{...this.props}
>
<Button type="primary">
@ -59,11 +57,9 @@ describe('Affix Render', () => {
});
const scrollTo = (top) => {
wrapper.instance().affix.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => {
return {
bottom: 100, height: 28, left: 0, right: 0, top: 50 - top, width: 195,
};
});
wrapper.instance().affix.fixedNode.parentNode.getBoundingClientRect = jest.fn(() => ({
bottom: 100, height: 28, left: 0, right: 0, top: 50 - top, width: 195,
}));
wrapper.instance().container.scrollTop = top;
events.scroll({
type: 'scroll',

3
components/alert/demo/banner.md

@ -27,5 +27,6 @@ ReactDOM.render(
<br />
<Alert type="error" message="Error text" banner />
</div>,
mountNode);
mountNode
);
````

3
components/alert/demo/basic.md

@ -18,7 +18,8 @@ import { Alert } from 'antd';
ReactDOM.render(
<Alert message="Success Text" type="success" />,
mountNode);
mountNode
);
````
<style>

5
components/alert/demo/closable.md

@ -16,7 +16,7 @@ To show close button.
````jsx
import { Alert } from 'antd';
const onClose = function (e) {
const onClose = (e) => {
console.log(e, 'I was closed.');
};
@ -36,5 +36,6 @@ ReactDOM.render(
onClose={onClose}
/>
</div>,
mountNode);
mountNode
);
````

3
components/alert/demo/close-text.md

@ -18,5 +18,6 @@ import { Alert } from 'antd';
ReactDOM.render(
<Alert message="Info Text" type="info" closeText="Close Now" />,
mountNode);
mountNode
);
````

3
components/alert/demo/custom-icon.md

@ -55,5 +55,6 @@ ReactDOM.render(
showIcon
/>
</div>,
mountNode);
mountNode
);
````

3
components/alert/demo/description.md

@ -39,5 +39,6 @@ ReactDOM.render(
type="error"
/>
</div>,
mountNode);
mountNode
);
````

3
components/alert/demo/icon.md

@ -47,5 +47,6 @@ ReactDOM.render(
showIcon
/>
</div>,
mountNode);
mountNode
);
````

3
components/alert/demo/smooth-closed.md

@ -46,5 +46,6 @@ class App extends React.Component {
ReactDOM.render(
<App />,
mountNode);
mountNode
);
````

3
components/alert/demo/style.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Alert message="Warning Text" type="warning" />
<Alert message="Error Text" type="error" />
</div>,
mountNode);
mountNode
);
````

4
components/anchor/__tests__/Anchor.test.js

@ -92,7 +92,7 @@ describe('Anchor Render', () => {
let anchorInstance = null;
function AnchorUpdate({ href }) {
return (
<Anchor ref={c => anchorInstance = c}>
<Anchor ref={(c) => { anchorInstance = c; }}>
<Link href={href} title="API" />
</Anchor>
);
@ -107,7 +107,7 @@ describe('Anchor Render', () => {
it('Anchor onClick event', () => {
let event;
let link;
const handleClick = (...arg) => ([event, link] = arg);
const handleClick = (...arg) => { [event, link] = arg; };
const href = '#API';
const title = 'API';

3
components/anchor/demo/basic.md

@ -27,7 +27,8 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```
<style>

3
components/anchor/demo/onClick.md

@ -32,5 +32,6 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```

3
components/anchor/demo/static.md

@ -27,5 +27,6 @@ ReactDOM.render(
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>,
mountNode);
mountNode
);
```

4
components/auto-complete/demo/options.md

@ -35,9 +35,7 @@ class Complete extends React.Component {
render() {
const { result } = this.state;
const children = result.map((email) => {
return <Option key={email}>{email}</Option>;
});
const children = result.map(email => <Option key={email}>{email}</Option>);
return (
<AutoComplete
style={{ width: 200 }}

4
components/auto-complete/demo/uncertain-category.md

@ -15,7 +15,9 @@ Demonstration of [Lookup Patterns: Uncertain Category](https://ant.design/docs/s
Basic Usage, set datasource of autocomplete with `dataSource` property.
````jsx
import { Icon, Button, Input, AutoComplete } from 'antd';
import {
Icon, Button, Input, AutoComplete,
} from 'antd';
const Option = AutoComplete.Option;

3
components/avatar/demo/badge.md

@ -25,5 +25,6 @@ ReactDOM.render(
<Badge dot><Avatar shape="square" icon="user" /></Badge>
</span>
</div>,
mountNode);
mountNode
);
````

3
components/avatar/demo/basic.md

@ -31,7 +31,8 @@ ReactDOM.render(
<Avatar shape="square" size="small" icon="user" />
</div>
</div>,
mountNode);
mountNode
);
````
<style>

3
components/avatar/demo/type.md

@ -25,7 +25,8 @@ ReactDOM.render(
<Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>U</Avatar>
<Avatar style={{ backgroundColor: '#87d068' }} icon="user" />
</div>,
mountNode);
mountNode
);
````
<style>

3
components/badge/demo/basic.md

@ -25,7 +25,8 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````
<style>

4
components/badge/demo/change.md

@ -14,7 +14,9 @@ title:
The count will be animated as it changes.
````jsx
import { Badge, Button, Icon, Switch } from 'antd';
import {
Badge, Button, Icon, Switch,
} from 'antd';
const ButtonGroup = Button.Group;

3
components/badge/demo/dot.md

@ -29,7 +29,8 @@ ReactDOM.render(
<a href="#">Link something</a>
</Badge>
</div>,
mountNode);
mountNode
);
````
<style>

3
components/badge/demo/link.md

@ -22,5 +22,6 @@ ReactDOM.render(
<span className="head-example" />
</Badge>
</a>,
mountNode);
mountNode
);
````

3
components/badge/demo/no-wrapper.md

@ -24,7 +24,8 @@ ReactDOM.render(
<Badge count={4} style={{ backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset' }} />
<Badge count={109} style={{ backgroundColor: '#52c41a' }} />
</div>,
mountNode);
mountNode
);
````
<style>

3
components/badge/demo/overflow.md

@ -31,5 +31,6 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````

3
components/badge/demo/status.md

@ -34,5 +34,6 @@ ReactDOM.render(
<br />
<Badge status="warning" text="Warning" />
</div>,
mountNode);
mountNode
);
````

3
components/badge/demo/title.md

@ -22,7 +22,8 @@ ReactDOM.render(
<a href="#" className="head-example" />
</Badge>
</div>,
mountNode);
mountNode
);
````
<style>

4
components/breadcrumb/__tests__/router.test.js

@ -1,5 +1,7 @@
import React from 'react';
import { Route, Switch, Link, withRouter, MemoryRouter } from 'react-router-dom';
import {
Route, Switch, Link, withRouter, MemoryRouter,
} from 'react-router-dom';
import { mount } from 'enzyme';
import Breadcrumb from '../index';

3
components/breadcrumb/demo/basic.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Breadcrumb.Item><a href="">Application List</a></Breadcrumb.Item>
<Breadcrumb.Item>An Application</Breadcrumb.Item>
</Breadcrumb>,
mountNode);
mountNode
);
````

7
components/breadcrumb/demo/router-4.md

@ -16,7 +16,9 @@ title:
Used together with `react-router@4` or other router.
````jsx
import { HashRouter as Router, Route, Switch, Link, withRouter } from 'react-router-dom';
import {
HashRouter as Router, Route, Switch, Link, withRouter,
} from 'react-router-dom';
import { Breadcrumb, Alert } from 'antd';
const Apps = () => (
@ -77,7 +79,8 @@ ReactDOM.render(
<Router>
<Home />
</Router>,
mountNode);
mountNode
);
````
````css

7
components/breadcrumb/demo/router.md

@ -16,7 +16,9 @@ title:
Used together with `react-router@2` `react-router@3`.
````jsx
import { Router, Route, Link, hashHistory } from 'react-router';
import {
Router, Route, Link, hashHistory,
} from 'react-router';
import { Breadcrumb, Alert } from 'antd';
const Apps = () => (
@ -52,7 +54,8 @@ ReactDOM.render(
</Route>
</Route>
</Router>,
mountNode);
mountNode
);
````
````css

3
components/breadcrumb/demo/separator.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Breadcrumb.Item href="">Application List</Breadcrumb.Item>
<Breadcrumb.Item>An Application</Breadcrumb.Item>
</Breadcrumb>,
mountNode);
mountNode
);
````

3
components/breadcrumb/demo/withIcon.md

@ -29,5 +29,6 @@ ReactDOM.render(
Application
</Breadcrumb.Item>
</Breadcrumb>,
mountNode);
mountNode
);
````

3
components/button/demo/basic.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Button type="dashed">Dashed</Button>
<Button type="danger">Danger</Button>
</div>,
mountNode);
mountNode
);
````

3
components/button/demo/block.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Button type="dashed" block>Dashed</Button>
<Button type="danger" block>danger</Button>
</div>,
mountNode);
mountNode
);
````

3
components/button/demo/ghost.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Button type="dashed" ghost>Dashed</Button>
<Button type="danger" ghost>danger</Button>
</div>,
mountNode);
mountNode
);
````

4
components/button/demo/multiple.md

@ -15,7 +15,9 @@ If you need several buttons, we recommend that you use 1 primary button + n seco
````jsx
import { Button, Menu, Dropdown, Icon } from 'antd';
import {
Button, Menu, Dropdown, Icon,
} from 'antd';
function handleMenuClick(e) {
console.log('click', e);

3
components/calendar/demo/basic.md

@ -22,5 +22,6 @@ function onPanelChange(value, mode) {
ReactDOM.render(
<Calendar onPanelChange={onPanelChange} />,
mountNode);
mountNode
);
````

3
components/calendar/demo/card.md

@ -24,5 +24,6 @@ ReactDOM.render(
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4 }}>
<Calendar fullscreen={false} onPanelChange={onPanelChange} />
</div>,
mountNode);
mountNode
);
````

3
components/calendar/demo/notice-calendar.md

@ -77,7 +77,8 @@ function monthCellRender(value) {
ReactDOM.render(
<Calendar dateCellRender={dateCellRender} monthCellRender={monthCellRender} />,
mountNode);
mountNode
);
````
````css

3
components/card/demo/basic.md

@ -26,7 +26,8 @@ ReactDOM.render(
<p>Card content</p>
<p>Card content</p>
</Card>,
mountNode);
mountNode
);
````
<style>

3
components/card/demo/border-less.md

@ -24,5 +24,6 @@ ReactDOM.render(
<p>Card content</p>
</Card>
</div>,
mountNode);
mountNode
);
````

3
components/card/demo/flexible-content.md

@ -30,5 +30,6 @@ ReactDOM.render(
description="www.instagram.com"
/>
</Card>,
mountNode);
mountNode
);
````

3
components/card/demo/grid-card.md

@ -31,5 +31,6 @@ ReactDOM.render(
<Card.Grid style={gridStyle}>Content</Card.Grid>
<Card.Grid style={gridStyle}>Content</Card.Grid>
</Card>,
mountNode);
mountNode
);
````

3
components/card/demo/in-column.md

@ -30,5 +30,6 @@ ReactDOM.render(
</Col>
</Row>
</div>,
mountNode);
mountNode
);
````

3
components/card/demo/inner.md

@ -44,5 +44,6 @@ ReactDOM.render(
Inner Card content
</Card>
</Card>,
mountNode);
mountNode
);
````

4
components/card/demo/loading.md

@ -14,7 +14,9 @@ title:
Shows a loading indicator while the contents of the card is being fetched.
````jsx
import { Skeleton, Switch, Card, Icon, Avatar } from 'antd';
import {
Skeleton, Switch, Card, Icon, Avatar,
} from 'antd';
const { Meta } = Card;

3
components/card/demo/meta.md

@ -30,5 +30,6 @@ ReactDOM.render(
description="This is the description"
/>
</Card>,
mountNode);
mountNode
);
````

3
components/card/demo/simple.md

@ -22,5 +22,6 @@ ReactDOM.render(
<p>Card content</p>
<p>Card content</p>
</Card>,
mountNode);
mountNode
);
````

2
components/carousel/__tests__/index.test.js

@ -49,7 +49,7 @@ describe('Carousel', () => {
it('cancel resize listener when unmount', async () => {
const wrapper = mount(<Carousel autoplay><div>1</div><div>2</div><div>3</div></Carousel>);
const onWindowResized = wrapper.instance().onWindowResized;
const { onWindowResized } = wrapper.instance();
const spy = jest.spyOn(wrapper.instance().onWindowResized, 'cancel');
const spy2 = jest.spyOn(window, 'removeEventListener');
wrapper.unmount();

3
components/carousel/demo/autoplay.md

@ -23,7 +23,8 @@ ReactDOM.render(
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</Carousel>,
mountNode);
mountNode
);
````
````css

3
components/carousel/demo/basic.md

@ -27,7 +27,8 @@ ReactDOM.render(
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</Carousel>,
mountNode);
mountNode
);
````
````css

3
components/carousel/demo/fade.md

@ -23,7 +23,8 @@ ReactDOM.render(
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</Carousel>,
mountNode);
mountNode
);
````
````css

3
components/carousel/demo/vertical.md

@ -23,7 +23,8 @@ ReactDOM.render(
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</Carousel>,
mountNode);
mountNode
);
````
````css

3
components/cascader/demo/basic.md

@ -46,5 +46,6 @@ function onChange(value) {
ReactDOM.render(
<Cascader options={options} onChange={onChange} placeholder="Please select" />,
mountNode);
mountNode
);
````

3
components/cascader/demo/change-on-select.md

@ -46,5 +46,6 @@ function onChange(value) {
ReactDOM.render(
<Cascader options={options} onChange={onChange} changeOnSelect />,
mountNode);
mountNode
);
````

3
components/cascader/demo/custom-render.md

@ -66,5 +66,6 @@ ReactDOM.render(
displayRender={displayRender}
style={{ width: '100%' }}
/>,
mountNode);
mountNode
);
````

3
components/cascader/demo/default-value.md

@ -46,5 +46,6 @@ function onChange(value) {
ReactDOM.render(
<Cascader defaultValue={['zhejiang', 'hangzhou', 'xihu']} options={options} onChange={onChange} />,
mountNode);
mountNode
);
````

3
components/cascader/demo/disabled-option.md

@ -47,5 +47,6 @@ function onChange(value) {
ReactDOM.render(
<Cascader options={options} onChange={onChange} />,
mountNode);
mountNode
);
````

3
components/cascader/demo/fields-name.md

@ -46,5 +46,6 @@ function onChange(value) {
ReactDOM.render(
<Cascader fieldNames={{ label: 'name', value: 'code', children: 'items' }} options={options} onChange={onChange} placeholder="Please select" />,
mountNode);
mountNode
);
````

3
components/cascader/demo/hover.md

@ -56,5 +56,6 @@ ReactDOM.render(
displayRender={displayRender}
onChange={onChange}
/>,
mountNode);
mountNode
);
````

3
components/cascader/demo/size.md

@ -50,5 +50,6 @@ ReactDOM.render(
<Cascader options={options} onChange={onChange} /><br /><br />
<Cascader size="small" options={options} onChange={onChange} /><br /><br />
</div>,
mountNode);
mountNode
);
````

3
components/cascader/demo/suffix.md

@ -61,5 +61,6 @@ ReactDOM.render(
placeholder="Please select"
/>
</div>,
mountNode);
mountNode
);
````

3
components/checkbox/demo/basic.md

@ -22,5 +22,6 @@ function onChange(e) {
ReactDOM.render(
<Checkbox onChange={onChange}>Checkbox</Checkbox>,
mountNode);
mountNode
);
````

32
components/checkbox/demo/check-all.md

@ -28,6 +28,22 @@ class App extends React.Component {
checkAll: false,
};
onChange = (checkedList) => {
this.setState({
checkedList,
indeterminate: !!checkedList.length && (checkedList.length < plainOptions.length),
checkAll: checkedList.length === plainOptions.length,
});
}
onCheckAllChange = (e) => {
this.setState({
checkedList: e.target.checked ? plainOptions : [],
indeterminate: false,
checkAll: e.target.checked,
});
}
render() {
return (
<div>
@ -45,22 +61,6 @@ class App extends React.Component {
</div>
);
}
onChange = (checkedList) => {
this.setState({
checkedList,
indeterminate: !!checkedList.length && (checkedList.length < plainOptions.length),
checkAll: checkedList.length === plainOptions.length,
});
}
onCheckAllChange = (e) => {
this.setState({
checkedList: e.target.checked ? plainOptions : [],
indeterminate: false,
checkAll: e.target.checked,
});
}
}
ReactDOM.render(<App />, mountNode);

30
components/checkbox/demo/controller.md

@ -22,6 +22,21 @@ class App extends React.Component {
disabled: false,
};
toggleChecked = () => {
this.setState({ checked: !this.state.checked });
}
toggleDisable = () => {
this.setState({ disabled: !this.state.disabled });
}
onChange = (e) => {
console.log('checked = ', e.target.checked);
this.setState({
checked: e.target.checked,
});
}
render() {
const label = `${this.state.checked ? 'Checked' : 'Unchecked'}-${this.state.disabled ? 'Disabled' : 'Enabled'}`;
return (
@ -55,21 +70,6 @@ class App extends React.Component {
</div>
);
}
toggleChecked = () => {
this.setState({ checked: !this.state.checked });
}
toggleDisable = () => {
this.setState({ disabled: !this.state.disabled });
}
onChange = (e) => {
console.log('checked = ', e.target.checked);
this.setState({
checked: e.target.checked,
});
}
}
ReactDOM.render(<App />, mountNode);

3
components/checkbox/demo/disabled.md

@ -22,5 +22,6 @@ ReactDOM.render(
<br />
<Checkbox defaultChecked disabled />
</div>,
mountNode);
mountNode
);
````

3
components/checkbox/demo/group.md

@ -42,5 +42,6 @@ ReactDOM.render(
<br /><br />
<CheckboxGroup options={optionsWithDisabled} disabled defaultValue={['Apple']} onChange={onChange} />
</div>,
mountNode);
mountNode
);
````

3
components/collapse/demo/accordion.md

@ -36,5 +36,6 @@ ReactDOM.render(
<p>{text}</p>
</Panel>
</Collapse>,
mountNode);
mountNode
);
````

3
components/collapse/demo/basic.md

@ -40,7 +40,8 @@ ReactDOM.render(
<p>{text}</p>
</Panel>
</Collapse>,
mountNode);
mountNode
);
````
<style>

3
components/collapse/demo/borderless.md

@ -38,5 +38,6 @@ ReactDOM.render(
{text}
</Panel>
</Collapse>,
mountNode);
mountNode
);
````

3
components/collapse/demo/custom.md

@ -44,5 +44,6 @@ ReactDOM.render(
<p>{text}</p>
</Panel>
</Collapse>,
mountNode);
mountNode
);
````

3
components/collapse/demo/mix.md

@ -44,5 +44,6 @@ ReactDOM.render(
<p>{text}</p>
</Panel>
</Collapse>,
mountNode);
mountNode
);
````

3
components/collapse/demo/noarrow.md

@ -37,5 +37,6 @@ ReactDOM.render(
<p>{text}</p>
</Panel>
</Collapse>,
mountNode);
mountNode
);
````

7
components/date-picker/__tests__/DatePicker.test.js

@ -80,16 +80,17 @@ describe('DatePicker', () => {
onChange = (value) => {
let { cleared } = this.state;
let newValue = value;
if (cleared) {
value = moment(moment(value).format('YYYY-MM-DD 12:12:12'));
newValue = moment(moment(value).format('YYYY-MM-DD 12:12:12'));
cleared = false;
}
if (!value) {
if (!newValue) {
cleared = true;
}
this.setState({ value, cleared });
this.setState({ value: newValue, cleared });
}
render() {

8
components/date-picker/__tests__/showTime.test.js

@ -83,7 +83,13 @@ describe('RangePicker with showTime', () => {
const onChangeFn = jest.fn();
const onOpenChangeFn = jest.fn();
const wrapper = mount(
<RangePicker showTime open onOk={onOkFn} onChange={onChangeFn} onOpenChange={onOpenChangeFn} />
<RangePicker
showTime
open
onOk={onOkFn}
onChange={onChangeFn}
onOpenChange={onOpenChangeFn}
/>
);
const calendarWrapper = mount(wrapper.find('Trigger').instance().getComponent());

3
components/date-picker/demo/basic.md

@ -32,5 +32,6 @@ ReactDOM.render(
<br />
<WeekPicker onChange={onChange} placeholder="Select week" />
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/date-render.md

@ -49,5 +49,6 @@ ReactDOM.render(
}}
/>
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/disabled.md

@ -31,5 +31,6 @@ ReactDOM.render(
disabled
/>
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/extra-footer.md

@ -26,5 +26,6 @@ ReactDOM.render(
<RangePicker renderExtraFooter={() => 'extra footer'} showTime />
<MonthPicker renderExtraFooter={() => 'extra footer'} placeholder="Select month" />
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/format.md

@ -32,5 +32,6 @@ ReactDOM.render(
format={dateFormat}
/>
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/mode.md

@ -79,5 +79,6 @@ ReactDOM.render(
<br />
<ControlledRangePicker />
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/suffix.md

@ -42,5 +42,6 @@ ReactDOM.render(
<br />
<WeekPicker suffixIcon="ab" onChange={onChange} placeholder="Select week" />
</div>,
mountNode);
mountNode
);
````

3
components/date-picker/demo/time.md

@ -45,5 +45,6 @@ ReactDOM.render(
onOk={onOk}
/>
</div>,
mountNode);
mountNode
);
````

3
components/divider/demo/horizontal.md

@ -26,5 +26,6 @@ ReactDOM.render(
<Divider dashed />
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p>
</div>,
mountNode);
mountNode
);
````

3
components/divider/demo/orientation.md

@ -23,5 +23,6 @@ ReactDOM.render(
<Divider orientation="right">Right Text</Divider>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p>
</div>,
mountNode);
mountNode
);
````

3
components/divider/demo/vertical.md

@ -24,5 +24,6 @@ ReactDOM.render(
<Divider type="vertical" />
<a href="#">Link</a>
</div>,
mountNode);
mountNode
);
````

4
components/drawer/demo/from-drawer.md

@ -14,7 +14,9 @@ title:
A drawer containing an editable form which needs to be collapsed by clicking the close button.
```jsx
import { Drawer, Form, Button, Col, Row, Input, Select, DatePicker } from 'antd';
import {
Drawer, Form, Button, Col, Row, Input, Select, DatePicker,
} from 'antd';
const { Option } = Select;

4
components/drawer/demo/user-profile.md

@ -14,7 +14,9 @@ title:
Use when you need to quickly preview the outline of the object. Such as list item preview.
```jsx
import { Drawer, List, Avatar, Divider, Col, Row } from 'antd';
import {
Drawer, List, Avatar, Divider, Col, Row,
} from 'antd';
const pStyle = {
fontSize: 16,

3
components/dropdown/demo/basic.md

@ -36,5 +36,6 @@ ReactDOM.render(
Hover me <Icon type="down" />
</a>
</Dropdown>,
mountNode);
mountNode
);
````

3
components/dropdown/demo/context-menu.md

@ -28,5 +28,6 @@ ReactDOM.render(
<Dropdown overlay={menu} trigger={['contextMenu']}>
<span style={{ userSelect: 'none' }}>Right Click on Me</span>
</Dropdown>,
mountNode);
mountNode
);
````

7
components/dropdown/demo/dropdown-button.md

@ -14,7 +14,9 @@ title:
A button is on the left, and a related functional menu is on the right.
````jsx
import { Menu, Dropdown, Button, Icon, message } from 'antd';
import {
Menu, Dropdown, Button, Icon, message,
} from 'antd';
function handleButtonClick(e) {
message.info('Click on left button.');
@ -53,5 +55,6 @@ ReactDOM.render(
</Button>
</Dropdown>
</div>,
mountNode);
mountNode
);
````

9
components/dropdown/demo/event.md

@ -14,9 +14,11 @@ title:
An event will be triggered when you click menu items, in which you can make different operations according to item's key.
````jsx
import { Menu, Dropdown, Icon, message } from 'antd';
import {
Menu, Dropdown, Icon, message,
} from 'antd';
const onClick = function ({ key }) {
const onClick = ({ key }) => {
message.info(`Click on item ${key}`);
};
@ -34,5 +36,6 @@ ReactDOM.render(
Hover me, Click menu item <Icon type="down" />
</a>
</Dropdown>,
mountNode);
mountNode
);
````

3
components/dropdown/demo/item.md

@ -35,5 +35,6 @@ ReactDOM.render(
Hover me <Icon type="down" />
</a>
</Dropdown>,
mountNode);
mountNode
);
````

3
components/dropdown/demo/overlay-visible.md

@ -40,7 +40,8 @@ class OverlayVisible extends React.Component {
</Menu>
);
return (
<Dropdown overlay={menu}
<Dropdown
overlay={menu}
onVisibleChange={this.handleVisibleChange}
visible={this.state.visible}
>

3
components/dropdown/demo/placement.md

@ -52,7 +52,8 @@ ReactDOM.render(
<Button>topRight</Button>
</Dropdown>
</div>,
mountNode);
mountNode
);
````
````css

3
components/dropdown/demo/sub-menu.md

@ -39,5 +39,6 @@ ReactDOM.render(
Cascading menu <Icon type="down" />
</a>
</Dropdown>,
mountNode);
mountNode
);
````

3
components/dropdown/demo/trigger.md

@ -35,5 +35,6 @@ ReactDOM.render(
Click me <Icon type="down" />
</a>
</Dropdown>,
mountNode);
mountNode
);
````

2
components/form/__tests__/index.test.js

@ -32,7 +32,7 @@ describe('Form', () => {
}
const Wrapped = Form.create()(TestForm);
let form;
mount(<Wrapped wrappedComponentRef={node => form = node} />);
mount(<Wrapped wrappedComponentRef={(node) => { form = node; }} />);
expect(form).toBeInstanceOf(TestForm);
});
});

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save