import React, { Component, ReactNode } from "react"; import { ModelStateChangeHandler, ReactReduxService } from "./redux/react-redux.service"; import { BaseReactModel } from "./base-react-model"; import { IApplicationContext } from "@symph/core"; import { IInitialModelState, ReactAppInitManager, ReactRouteInitStatus } from "./react-app-init-manager"; import type { Location } from "history"; import { IReactRoute } from "./interfaces"; import { NavigateFunction, PathMatch } from "react-router"; export declare type ControllerBaseStateType = { _modelStateVersion: number; [keys: string]: unknown; }; export interface BaseReactController extends IInitialModelState { onInitialModelStaticStateDid?(): void; } interface ControllerProps { route?: IReactRoute; match?: PathMatch; location?: Location; navigate?: NavigateFunction; } /** * todo model 状态发生改变后,如何精细的判断是否有必要刷新组件? */ export declare abstract class BaseReactController, TState = Record, TContext extends IApplicationContext = IApplicationContext> extends Component { __proto__: typeof React.Component; /** * 向后兼容: * 进行组件渲染的的准备工作,可以在服务端和浏览器上运行, * @param context */ componentPrepare(context: any): Promise; protected appContext: IApplicationContext; protected reduxStore: ReactReduxService; protected isCtlMounted: boolean; protected _models: Array>; protected hasInitInvoked: boolean; private hasInjectProps; /** * 注入 initManager, 以便监听initManager中的状态 * @protected */ protected initManager: ReactAppInitManager; protected location: Location; prepareComponent(): Promise; private isRendingView; private modelStateDeps; private isWaitingInitStaticDid; constructor(props: TProps, context: TContext); _patch_shouldComponentUpdate(nextProps: Readonly, nextState: Readonly, nextContext: any): boolean; _patch_pre_componentDidMount(): void; _patch_componentWillUnmount(): void; protected bindProps(props: TProps): void; private triggerOnInitialModelStaticStateDid; protected init(): Promise; /** * !import: must called in subclass of constructor * @private */ private injectProps; private registersModel; private createModelProxy; protected modelStateListener: ModelStateChangeHandler; protected isModelStateChange: (modelNameSpace: string, nextModelState: Record, preModelState: Record) => boolean; protected getInitState(): import("./react-app-init-manager").ReactPageInitState; protected setInitState({ initStatic, init }: { initStatic?: ReactRouteInitStatus; init?: ReactRouteInitStatus; }): void; render(): ReactNode; abstract renderView(): ReactNode; } export {};