UNPKG

jamis

Version:

一种支持通过JSON配置方式生成页面的组件库

71 lines (70 loc) 3.94 kB
/** * @file 角标组件 */ import React from 'react'; import hoistNonReactStatic from 'hoist-non-react-statics'; import type { BadgeProps } from '../types'; declare const Badge: React.FC<BadgeProps> & { propsList?: string[]; }; export { Badge }; /** * @deprecated 切换到使用`useBadge` */ export declare function withBadge<P extends object>(Component: React.ComponentType<P>): { new (props: (P & BadgeProps) | Readonly<P & BadgeProps>): { ref: any; getWrappedInstance: () => any; refFn: (ref: any) => void; render(): JSX.Element; context: unknown; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & BadgeProps>) => (Pick<{}, K> | {} | null)) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<P & BadgeProps>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<P & BadgeProps>, prevState: Readonly<{}>): any | null; componentDidUpdate?(prevProps: Readonly<P & BadgeProps>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<P & BadgeProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & BadgeProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): void; }; new (props: P & BadgeProps, context: any): { ref: any; getWrappedInstance: () => any; refFn: (ref: any) => void; render(): JSX.Element; context: unknown; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & BadgeProps>) => (Pick<{}, K> | {} | null)) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<P & BadgeProps>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<P & BadgeProps>, prevState: Readonly<{}>): any | null; componentDidUpdate?(prevProps: Readonly<P & BadgeProps>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<P & BadgeProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & BadgeProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<P & BadgeProps>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; contextType?: React.Context<any> | undefined; } & hoistNonReactStatic.NonReactStatics<React.ComponentType<P>, {}>; export declare const useBadge: (children: JSX.Element, badge?: BadgeProps["badge"], data?: any) => JSX.Element;