Browse Source
chore: code style optimization (#43457)
* chore: Code style optimization
* style: code optimize
pull/43458/head
thinkasany
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
38 additions and
33 deletions
-
components/descriptions/Cell.tsx
-
components/descriptions/index.tsx
-
components/tooltip/index.tsx
|
|
@ -19,19 +19,20 @@ export interface CellProps { |
|
|
|
colon?: boolean; |
|
|
|
} |
|
|
|
|
|
|
|
const Cell: React.FC<CellProps> = ({ |
|
|
|
itemPrefixCls, |
|
|
|
component, |
|
|
|
span, |
|
|
|
className, |
|
|
|
style, |
|
|
|
labelStyle, |
|
|
|
contentStyle, |
|
|
|
bordered, |
|
|
|
label, |
|
|
|
content, |
|
|
|
colon, |
|
|
|
}) => { |
|
|
|
const Cell: React.FC<CellProps> = (props) => { |
|
|
|
const { |
|
|
|
itemPrefixCls, |
|
|
|
component, |
|
|
|
span, |
|
|
|
className, |
|
|
|
style, |
|
|
|
labelStyle, |
|
|
|
contentStyle, |
|
|
|
bordered, |
|
|
|
label, |
|
|
|
content, |
|
|
|
colon, |
|
|
|
} = props; |
|
|
|
const Component = component as any; |
|
|
|
|
|
|
|
if (bordered) { |
|
|
|
|
|
@ -115,23 +115,28 @@ export interface DescriptionsProps { |
|
|
|
contentStyle?: React.CSSProperties; |
|
|
|
} |
|
|
|
|
|
|
|
function Descriptions({ |
|
|
|
prefixCls: customizePrefixCls, |
|
|
|
title, |
|
|
|
extra, |
|
|
|
column = DEFAULT_COLUMN_MAP, |
|
|
|
colon = true, |
|
|
|
bordered, |
|
|
|
layout, |
|
|
|
children, |
|
|
|
className, |
|
|
|
rootClassName, |
|
|
|
style, |
|
|
|
size: customizeSize, |
|
|
|
labelStyle, |
|
|
|
contentStyle, |
|
|
|
...restProps |
|
|
|
}: DescriptionsProps) { |
|
|
|
type CompoundedComponent = React.FC<DescriptionsProps> & { |
|
|
|
Item: typeof DescriptionsItem; |
|
|
|
}; |
|
|
|
|
|
|
|
const Descriptions: CompoundedComponent = (props) => { |
|
|
|
const { |
|
|
|
prefixCls: customizePrefixCls, |
|
|
|
title, |
|
|
|
extra, |
|
|
|
column = DEFAULT_COLUMN_MAP, |
|
|
|
colon = true, |
|
|
|
bordered, |
|
|
|
layout, |
|
|
|
children, |
|
|
|
className, |
|
|
|
rootClassName, |
|
|
|
style, |
|
|
|
size: customizeSize, |
|
|
|
labelStyle, |
|
|
|
contentStyle, |
|
|
|
...restProps |
|
|
|
} = props; |
|
|
|
const { getPrefixCls, direction } = React.useContext(ConfigContext); |
|
|
|
const prefixCls = getPrefixCls('descriptions', customizePrefixCls); |
|
|
|
const [screens, setScreens] = React.useState<ScreenMap>({}); |
|
|
@ -207,7 +212,7 @@ function Descriptions({ |
|
|
|
</div> |
|
|
|
</DescriptionsContext.Provider>, |
|
|
|
); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== 'production') { |
|
|
|
Descriptions.displayName = 'Descriptions'; |
|
|
|
|
|
@ -10,6 +10,7 @@ import useMergedState from 'rc-util/lib/hooks/useMergedState'; |
|
|
|
import type { CSSProperties } from 'react'; |
|
|
|
import * as React from 'react'; |
|
|
|
import type { PresetColorType } from '../_util/colors'; |
|
|
|
import type { RenderFunction } from '../_util/getRenderPropValue'; |
|
|
|
import { getTransitionName } from '../_util/motion'; |
|
|
|
import type { AdjustOverflow, PlacementsConfig } from '../_util/placements'; |
|
|
|
import getPlacements from '../_util/placements'; |
|
|
@ -110,8 +111,6 @@ export interface AbstractTooltipProps extends LegacyTooltipProps { |
|
|
|
destroyTooltipOnHide?: boolean | { keepParent?: boolean }; |
|
|
|
} |
|
|
|
|
|
|
|
export type RenderFunction = () => React.ReactNode; |
|
|
|
|
|
|
|
export interface TooltipPropsWithOverlay extends AbstractTooltipProps { |
|
|
|
title?: React.ReactNode | RenderFunction; |
|
|
|
overlay?: React.ReactNode | RenderFunction; |
|
|
|