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:
Zack Chang 2023-06-25 12:10:31 +08:00 committed by GitHub
parent 6889af430f
commit 875a221c62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

View 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;

View File

@ -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 {

View File

@ -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;