mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
refactor: solve circular reference of Description (#42812)
* refactor: solve circular reference of Description * refactor: solve circular reference of Table * Revert "refactor: solve circular reference of Table" This reverts commit 7664b016458bb031d8c51defd2fd740c2a1de3d5. * chore: add export
This commit is contained in:
parent
6889af430f
commit
875a221c62
10
components/descriptions/DescriptionsContext.ts
Normal file
10
components/descriptions/DescriptionsContext.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface DescriptionsContextProps {
|
||||
labelStyle?: React.CSSProperties;
|
||||
contentStyle?: React.CSSProperties;
|
||||
}
|
||||
|
||||
const DescriptionsContext = React.createContext<DescriptionsContextProps>({});
|
||||
|
||||
export default DescriptionsContext;
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import type { DescriptionsContextProps } from '.';
|
||||
import { DescriptionsContext } from '.';
|
||||
import Cell from './Cell';
|
||||
import type { DescriptionsContextProps } from './DescriptionsContext';
|
||||
import DescriptionsContext from './DescriptionsContext';
|
||||
import type { DescriptionsItemProps } from './Item';
|
||||
|
||||
interface CellConfig {
|
||||
|
@ -8,17 +8,11 @@ import useResponsiveObserver, { responsiveArray } from '../_util/responsiveObser
|
||||
import warning from '../_util/warning';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import useSize from '../config-provider/hooks/useSize';
|
||||
import DescriptionsContext from './DescriptionsContext';
|
||||
import DescriptionsItem from './Item';
|
||||
import Row from './Row';
|
||||
import useStyle from './style';
|
||||
|
||||
export interface DescriptionsContextProps {
|
||||
labelStyle?: React.CSSProperties;
|
||||
contentStyle?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export const DescriptionsContext = React.createContext<DescriptionsContextProps>({});
|
||||
|
||||
const DEFAULT_COLUMN_MAP: Record<Breakpoint, number> = {
|
||||
xxl: 3,
|
||||
xl: 3,
|
||||
@ -213,6 +207,9 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
Descriptions.displayName = 'Descriptions';
|
||||
}
|
||||
|
||||
export type { DescriptionsContextProps } from './DescriptionsContext';
|
||||
export { DescriptionsContext };
|
||||
|
||||
Descriptions.Item = DescriptionsItem;
|
||||
|
||||
export default Descriptions;
|
||||
|
Loading…
Reference in New Issue
Block a user