Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
compatible with antd @ 4
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 17, 2019
1 parent 1f6e658 commit ecf9425
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 36 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
},
"license": "MIT",
"dependencies": {
"@ant-design/compatible": "^0.0.1-alpha.7",
"@ant-design/icons": "^4.0.0-alpha.11",
"antd": "^3.25.1",
"classnames": "^2.2.6",
"moment": "^2.24.0",
Expand Down
22 changes: 6 additions & 16 deletions src/Form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import React, { useState, useEffect } from 'react';
import {
Form,
Input,
Row,
Col,
TimePicker,
InputNumber,
DatePicker,
Select,
Button,
Icon,
} from 'antd';
import { DownOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Input, Row, Col, TimePicker, InputNumber, DatePicker, Select, Button } from 'antd';
import moment, { Moment } from 'moment';
import RcResizeObserver from 'rc-resize-observer';
import { FormComponentProps } from 'antd/lib/form';
Expand Down Expand Up @@ -231,13 +223,11 @@ const FormSearch = <T, U = {}>({ form, onSubmit, momentFormat = 'string' }: Form
}}
>
{collapse ? '展开' : '收起'}{' '}
<Icon
<DownOutlined
style={{
transition: '0.3s all',
transform: `rotate(${collapse ? 0 : 0.5}turn)`,
}}
type="down"
/>
}} />
</a>
)}
</Col>
Expand Down
19 changes: 8 additions & 11 deletions src/component/columnSetting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
import { Checkbox, Popover, Icon, Tooltip } from 'antd';
import { PushpinOutlined, SettingOutlined, VerticalAlignMiddleOutlined } from '@ant-design/icons';
import { Checkbox, Popover, Tooltip } from 'antd';
import Container, { ColumnsMapItem } from '../../container';
import { ProColumns } from '../../Table';
import './index.less';
Expand Down Expand Up @@ -74,23 +75,21 @@ const CheckboxList: React.FC<{
title="固定到左边"
show={fixed !== 'left'}
>
<Icon
type="pushpin"
<PushpinOutlined
style={{
transform: 'rotate(-90deg)',
}}
/>
}} />
</ToolTipIcon>
<ToolTipIcon columnKey={columnKey} fixed={undefined} title="取消固定" show={!!fixed}>
<Icon type="vertical-align-middle" />
<VerticalAlignMiddleOutlined />
</ToolTipIcon>
<ToolTipIcon
columnKey={columnKey}
fixed="right"
title="固定到右边"
show={fixed !== 'right'}
>
<Icon type="pushpin" />
<PushpinOutlined />
</ToolTipIcon>
</span>
</span>
Expand Down Expand Up @@ -213,13 +212,11 @@ const ColumnSetting = <T, U = {}>(props: ColumnSettingProps<T>) => {
document.body) as any) as HTMLElement
}
>
<Icon
type="setting"
<SettingOutlined
className={`${toolBarClassName}-item-icon`}
style={{
fontSize: 16,
}}
/>
}} />
</Tooltip>
</Popover>
);
Expand Down
7 changes: 4 additions & 3 deletions src/component/dropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import classnames from 'classnames';
import { Dropdown, Menu, Button, Icon } from 'antd';
import { DownOutlined, EllipsisOutlined } from '@ant-design/icons';
import { Dropdown, Menu, Button } from 'antd';
import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
import './index.less';

Expand Down Expand Up @@ -38,7 +39,7 @@ const DropdownButton: React.FC<DropdownProps> = ({
return (
<Dropdown overlay={menu} className={classnames(tempClassName, className)}>
<Button style={style}>
{children} <Icon type="down" />
{children} <DownOutlined />
</Button>
</Dropdown>
);
Expand Down Expand Up @@ -72,7 +73,7 @@ const TableDropdown: React.FC<DropdownProps> & { Button: typeof DropdownButton }
className={classnames(className, propsClassName)}
>
<a style={style}>
<Icon type="ellipsis" />
<EllipsisOutlined />
</a>
</Dropdown>
);
Expand Down
7 changes: 4 additions & 3 deletions src/component/toolBar/FullscreenIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Icon, Tooltip } from 'antd';
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd';

const FullScreenIcon = () => {
const [fullscreen, setFullscreen] = useState<boolean>(false);
Expand All @@ -15,7 +16,7 @@ const FullScreenIcon = () => {
((document.getElementById('ant-design-pro-table') || document.body) as any) as HTMLElement
}
>
<Icon type="fullscreen-exit" />
<FullscreenExitOutlined />
</Tooltip>
) : (
<Tooltip
Expand All @@ -24,7 +25,7 @@ const FullScreenIcon = () => {
((document.getElementById('ant-design-pro-table') || document.body) as any) as HTMLElement
}
>
<Icon type="fullscreen" />
<FullscreenOutlined />
</Tooltip>
);
};
Expand Down
7 changes: 4 additions & 3 deletions src/component/toolBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Icon, Divider, Tooltip } from 'antd';
import { ReloadOutlined, SettingOutlined } from '@ant-design/icons';
import { Divider, Tooltip } from 'antd';
import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
import ColumnSetting from '../columnSetting';

Expand Down Expand Up @@ -38,11 +39,11 @@ const buttonText = {
},
reload: {
text: '刷新',
icon: <Icon type="reload" />,
icon: <ReloadOutlined />,
},
setting: {
text: '列设置',
icon: <Icon type="setting" />,
icon: <SettingOutlined />,
},
};

Expand Down

0 comments on commit ecf9425

Please sign in to comment.