1 | import * as React from 'react';
|
2 | import { Async } from './Async';
|
3 | import { EventGroup } from './EventGroup';
|
4 | import { IDisposable } from './IDisposable';
|
5 | import { ISettingsMap } from './warn/warn';
|
6 | import { IBaseProps } from './BaseComponent.types';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export declare class BaseComponent<TProps extends IBaseProps = {}, TState = {}> extends React.Component<TProps, TState> {
|
16 | |
17 |
|
18 |
|
19 | static onError: (errorMessage?: string, ex?: any) => void;
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 | protected _skipComponentRefResolution: boolean;
|
26 | private __async;
|
27 | private __events;
|
28 | private __disposables;
|
29 | private __resolves;
|
30 | private __className;
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | constructor(props: TProps, context?: any);
|
37 | /**
|
38 | * When the component receives props, make sure the componentRef is updated.
|
39 | */
|
40 | componentDidUpdate(prevProps: TProps, prevState: TState): void;
|
41 | /**
|
42 | * When the component has mounted, update the componentRef.
|
43 | */
|
44 | componentDidMount(): void;
|
45 | /**
|
46 | * If we have disposables, dispose them automatically on unmount.
|
47 | */
|
48 | componentWillUnmount(): void;
|
49 | /**
|
50 | * Gets the object's class name.
|
51 | */
|
52 | readonly className: string;
|
53 | /**
|
54 | * Allows subclasses to push things to this._disposables to be auto disposed.
|
55 | */
|
56 | protected readonly _disposables: IDisposable[];
|
57 | /**
|
58 | * Gets the async instance associated with the component, created on demand. The async instance gives
|
59 | * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks
|
60 | * will be cleared/ignored automatically after unmounting. The helpers within the async object also
|
61 | * preserve the this pointer so that you don't need to "bind" the callbacks.
|
62 | */
|
63 | protected readonly _async: Async;
|
64 | /**
|
65 | * Gets the event group instance assocaited with the component, created on demand. The event instance
|
66 | * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks
|
67 | * will be automatically disconnected after unmounting. The helpers within the events object also
|
68 | * preserve the this reference so that you don't need to "bind" the callbacks.
|
69 | */
|
70 | protected readonly _events: EventGroup;
|
71 | /**
|
72 | * Helper to return a memoized ref resolver function.
|
73 | * @param refName - Name of the member to assign the ref to.
|
74 | * @returns A function instance keyed from the given refname.
|
75 | * @deprecated Use `createRef` from React.createRef.
|
76 | */
|
77 | protected _resolveRef(refName: string): (ref: React.ReactNode) => React.ReactNode;
|
78 | /**
|
79 | * Updates the componentRef (by calling it with "this" when necessary.)
|
80 | */
|
81 | protected _updateComponentRef(currentProps: IBaseProps, newProps?: IBaseProps): void;
|
82 | /**
|
83 | * Warns when a deprecated props are being used.
|
84 | *
|
85 | * @param deprecationMap - The map of deprecations, where key is the prop name and the value is
|
86 | * either null or a replacement prop name.
|
87 | */
|
88 | protected _warnDeprecations(deprecationMap: ISettingsMap<TProps>): void;
|
89 | /**
|
90 | * Warns when props which are mutually exclusive with each other are both used.
|
91 | *
|
92 | * @param mutuallyExclusiveMap - The map of mutually exclusive props.
|
93 | */
|
94 | protected _warnMutuallyExclusive(mutuallyExclusiveMap: ISettingsMap<TProps>): void;
|
95 | /**
|
96 | * Warns when props are required if a condition is met.
|
97 | *
|
98 | * @param requiredProps - The name of the props that are required when the condition is met.
|
99 | * @param conditionalPropName - The name of the prop that the condition is based on.
|
100 | * @param condition - Whether the condition is met.
|
101 | */
|
102 | protected _warnConditionallyRequiredProps(requiredProps: string[], conditionalPropName: string, condition: boolean): void;
|
103 | private _setComponentRef;
|
104 | }
|
105 | /**
|
106 | * Simple constant function for returning null, used to render empty templates in JSX.
|
107 | *
|
108 | * @public
|
109 | */
|
110 | export declare function nullRender(): JSX.Element | null;
|