Skip to content

Commit 02dd422

Browse files
shiqiWang0beier
andauthored
fix: unit coding style && name to import (#333)
* fix: unit coding style && name to import * fix: update contextMenu snapshot --------- Co-authored-by: beier <[email protected]>
1 parent 20183e2 commit 02dd422

File tree

21 files changed

+71
-92
lines changed

21 files changed

+71
-92
lines changed

src/blockHeader/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, ReactNode } from 'react';
22
import { QuestionCircleOutlined, UpOutlined } from '@ant-design/icons';
33
import { Tooltip } from 'antd';
44
import classNames from 'classnames';
@@ -10,13 +10,13 @@ export interface IBlockHeaderProps {
1010
// 标题
1111
title: string;
1212
// 标题前的图标,默认是一个色块
13-
beforeTitle?: React.ReactNode;
13+
beforeTitle?: ReactNode;
1414
// 标题后的提示图标或文案
15-
afterTitle?: React.ReactNode;
15+
afterTitle?: ReactNode;
1616
// 默认展示为问号的tooltip
17-
tooltip?: React.ReactNode;
17+
tooltip?: ReactNode;
1818
// 后缀自定义内容块
19-
addonAfter?: React.ReactNode;
19+
addonAfter?: ReactNode;
2020
/**
2121
* 小标题 font-size: 12px; line-height: 32px
2222
* 中标题 font-size: 14px; line-height: 40px
@@ -35,7 +35,7 @@ export interface IBlockHeaderProps {
3535
defaultExpand?: boolean;
3636
// 展开/收起时的回调
3737
onChange?: (expand: boolean) => void;
38-
children?: React.ReactNode;
38+
children?: ReactNode;
3939
}
4040
const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
4141
const prefixCls = 'dtc-block-header';

src/collapsibleActionItems/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import React from 'react';
1+
import React, { ReactNode } from 'react';
22
import { Button, ButtonProps, Divider, Dropdown, DropDownProps, Menu } from 'antd';
33
import { EllipsisOutlined } from '@ant-design/icons';
44

55
type ActionItem = {
66
key: React.Key;
7-
name: React.ReactNode;
7+
name: ReactNode;
88
disabled?: boolean;
9-
render?: () => React.ReactNode;
9+
render?: () => ReactNode;
1010
[propName: string]: any;
1111
};
1212

1313
interface ICollapsibleActionItems {
1414
maxCount?: number; // 最多展示数量,超出折叠到下拉菜单中
1515
actionItems: ActionItem[];
1616
className?: string;
17-
divider?: React.ReactNode; // 分隔符
18-
collapseIcon?: React.ReactNode; // 折叠菜单图标
17+
divider?: ReactNode; // 分隔符
18+
collapseIcon?: ReactNode; // 折叠菜单图标
1919
dropdownProps?: Partial<DropDownProps>;
2020
buttonProps?: Partial<ButtonProps>;
2121
onItemClick?(key: React.Key): void;

src/contextMenu/__tests__/__snapshots__/contextMenu.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports[`test contextMenu should match snapshot 1`] = `
2020
style="opacity: 0;"
2121
>
2222
<ul
23-
class="ant-dropdown-menu ant-dropdown-menu-root ant-dropdown-menu-vertical ant-dropdown-menu-light dt-contextMenu-menu"
23+
class="ant-dropdown-menu ant-dropdown-menu-root ant-dropdown-menu-vertical ant-dropdown-menu-light dtc-contextMenu-menu"
2424
data-menu-list="true"
2525
role="menu"
2626
tabindex="0"

src/contextMenu/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { CSSProperties, PropsWithChildren } from 'react';
1+
import React, { CSSProperties, PropsWithChildren, ReactNode } from 'react';
22
import { Dropdown, Menu, DropdownProps, Popconfirm, PopconfirmProps } from 'antd';
33
import './style.scss';
44

@@ -10,7 +10,7 @@ interface IMenuProps {
1010
/**
1111
* 菜单栏的标题文案
1212
*/
13-
text: React.ReactNode;
13+
text: ReactNode;
1414
/**
1515
* 菜单栏的样式
1616
*/
@@ -46,7 +46,7 @@ export default function ContextMenu({
4646
}: PropsWithChildren<IContextMenu>) {
4747
const menu = (
4848
<Menu
49-
className="dt-contextMenu-menu"
49+
className="dtc-contextMenu-menu"
5050
onClick={(item) => {
5151
item.domEvent.stopPropagation();
5252
data.find((i) => i.key === item.key)?.cb?.();

src/contextMenu/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.dt-contextMenu-menu {
1+
.dtc-contextMenu-menu {
22
padding: 0;
33
background: #FFF;
44
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);

src/copy/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { ReactNode, CSSProperties } from 'react';
22
import { Tooltip, message } from 'antd';
33
import { CopyOutlined } from '@ant-design/icons';
44
import useClippy from 'use-clippy';
@@ -7,10 +7,10 @@ import './style.scss';
77

88
export interface ICopyProps {
99
text: string;
10-
title?: React.ReactNode;
11-
button?: React.ReactNode;
10+
title?: ReactNode;
11+
button?: ReactNode;
1212
hideTooltip?: boolean;
13-
style?: React.CSSProperties;
13+
style?: CSSProperties;
1414
className?: string;
1515
onCopy?: (text: string) => void;
1616
}

src/dropdown/select.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, ReactNode } from 'react';
22
import { Button, Checkbox, Col, Dropdown, Row, Space, type DropDownProps } from 'antd';
33
import classNames from 'classnames';
44
import List from 'rc-virtual-list';
@@ -10,7 +10,7 @@ import './style.scss';
1010
interface IDropdownSelectProps
1111
extends Pick<DropDownProps, 'getPopupContainer'>,
1212
Required<Pick<CheckboxGroupProps, 'value' | 'options' | 'onChange'>> {
13-
children: React.ReactNode;
13+
children: ReactNode;
1414
className?: string;
1515
onSubmit?: (value: CheckboxValueType[]) => void;
1616
}

src/ellipsisText/demos/valueType.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { ReactNode, Component } from 'react';
22
import { EllipsisText } from 'dt-react-component';
33
import { Divider } from 'antd';
44

@@ -18,8 +18,8 @@ const element = (
1818

1919
const useEllipsisText = () => element;
2020

21-
class WithEllipsisText extends React.Component {
22-
render(): React.ReactNode {
21+
class WithEllipsisText extends Component {
22+
render(): ReactNode {
2323
return element;
2424
}
2525
}

src/ellipsisText/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import React, { useRef, useState, useLayoutEffect, useCallback, ReactNode } from 'react';
1+
import React, {
2+
useRef,
3+
useState,
4+
useLayoutEffect,
5+
useCallback,
6+
ReactNode,
7+
CSSProperties,
8+
} from 'react';
29
import { Tooltip } from 'antd';
310
import { AbstractTooltipProps, RenderFunction } from 'antd/lib/tooltip';
411
import classNames from 'classnames';
@@ -199,7 +206,7 @@ const EllipsisText = (props: IEllipsisTextProps) => {
199206
};
200207

201208
const renderText = useCallback(() => {
202-
const style: React.CSSProperties = {
209+
const style: CSSProperties = {
203210
maxWidth: width,
204211
cursor,
205212
};

src/empty/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { ReactNode, CSSProperties } from 'react';
22
import { Empty as AntdEmpty, EmptyProps } from 'antd';
33
import './style.scss';
44

@@ -14,16 +14,16 @@ export const IMG_MAP = {
1414
interface IProps {
1515
type?: 'default' | 'search' | 'chart' | 'project' | 'overview' | 'permission';
1616
height?: number;
17-
image?: React.ReactNode;
18-
imageStyle?: React.CSSProperties;
17+
image?: ReactNode;
18+
imageStyle?: CSSProperties;
1919
}
2020

2121
const Empty = (props: EmptyProps & IProps) => {
2222
const { type = 'default', height = 80, image, imageStyle, ...restProps } = props;
23-
let newImage: React.ReactNode = IMG_MAP[type] ? (
23+
let newImage: ReactNode = IMG_MAP[type] ? (
2424
<img src={require('./emptyImg/' + IMG_MAP[type])}></img>
2525
) : null;
26-
if (image) newImage = image as React.ReactNode;
26+
if (image) newImage = image as ReactNode;
2727
const newImageStyle = imageStyle ? { height, ...imageStyle } : { height };
2828
return (
2929
<div className="dtc-empty">

0 commit comments

Comments
 (0)