mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
refactor: solve statistic circular dependency issue (#42814)
This commit is contained in:
parent
1d24fb5679
commit
0a05213aeb
@ -4,9 +4,8 @@ import type { ConfigConsumerProps } from '../config-provider';
|
|||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import Skeleton from '../skeleton';
|
import Skeleton from '../skeleton';
|
||||||
import StatisticNumber from './Number';
|
import StatisticNumber from './Number';
|
||||||
import type { FormatConfig, valueType } from './utils';
|
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import Countdown from './Countdown';
|
import type { FormatConfig, valueType } from './utils';
|
||||||
|
|
||||||
export interface StatisticProps extends FormatConfig {
|
export interface StatisticProps extends FormatConfig {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -24,11 +23,7 @@ export interface StatisticProps extends FormatConfig {
|
|||||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompoundedComponent = {
|
const Statistic: React.FC<StatisticProps> = (props) => {
|
||||||
Countdown: typeof Countdown;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Statistic: React.FC<StatisticProps> & CompoundedComponent = (props) => {
|
|
||||||
const {
|
const {
|
||||||
prefixCls: customizePrefixCls,
|
prefixCls: customizePrefixCls,
|
||||||
className,
|
className,
|
||||||
@ -91,6 +86,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
Statistic.displayName = 'Statistic';
|
Statistic.displayName = 'Statistic';
|
||||||
}
|
}
|
||||||
|
|
||||||
Statistic.Countdown = Countdown;
|
|
||||||
|
|
||||||
export default Statistic;
|
export default Statistic;
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
import type { CountdownProps } from './Countdown';
|
import type { CountdownProps } from './Countdown';
|
||||||
|
import Countdown from './Countdown';
|
||||||
import type { StatisticProps } from './Statistic';
|
import type { StatisticProps } from './Statistic';
|
||||||
import Statistic from './Statistic';
|
import Statistic from './Statistic';
|
||||||
|
|
||||||
export type { StatisticProps, CountdownProps };
|
export type { StatisticProps, CountdownProps };
|
||||||
export default Statistic;
|
|
||||||
|
type CompoundedComponent = {
|
||||||
|
Countdown: typeof Countdown;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CompoundedStatistic = typeof Statistic & CompoundedComponent;
|
||||||
|
|
||||||
|
(Statistic as CompoundedStatistic).Countdown = Countdown;
|
||||||
|
|
||||||
|
export default Statistic as CompoundedStatistic;
|
||||||
|
0
components/statistic/interface.ts
Normal file
0
components/statistic/interface.ts
Normal file
Loading…
Reference in New Issue
Block a user