catreact
Version:
Catavolt Core React Components
59 lines (58 loc) • 2.45 kB
TypeScript
/**
* Created by rburson on 3/13/17.
*/
import * as React from 'react';
import { CvProps, CvContext, CvEvent, CvActionFiredResult, CvResultCallback, CvStateChangeResult, CvNavigationResult } from './catreact-core';
import { PaneContext, ViewDesc, NavRequest, Either } from 'catavolt-sdk';
export interface CvViewDescProps extends CvProps {
/**
* Array of {@link CvListener}s that will be notified if a view is 'opened'
*/
actionListeners?: Array<(event: CvEvent<CvActionFiredResult>) => void>;
/**
* Array of {@link CvListener> that will be notified of a state change for which they may need to refresh
*/
stateChangeListeners?: Array<(event: CvEvent<CvStateChangeResult>) => void>;
/**
* The sdk {ViewDesc}
*/
viewDesc?: ViewDesc;
/**
* Register to receive {@link CvEvent}s of type {@link CvNavigationResult}
*/
navigationListeners?: Array<(event: CvEvent<CvNavigationResult>) => void>;
/**
* Provide a target for any navigations that originate from this action. The navTarget should
* correspond to the 'targetId' value of the coresident {@link CvNavigation} or {@link CvNavigator}.
* This is useful for single page apps where components may be coresident.
*/
navTarget?: string;
/**
* The sdk {PaneContext} associated with this action. If not specified, the context chain will be upwardly
* searched to find a component with a containing sdk {PaneContext} scopeObj
*/
paneContext?: PaneContext;
/**
* Render override function. It should accept the following params:
* @param cvContext The current cvContext. The cvContext.cvScope.scopeObj will be the sdk {ViewDesc} object
*/
renderer?: (cvContext: CvContext, callback: CvViewDescCallback) => {};
/**
* Name of the wrapping element (should be component name)
* Defaults to 'span' from backward compatibility's sake
*/
wrapperElemName?: string;
/**
* Props for the wrapping element
*/
wrapperElemProps?: any;
/**
* Name of the wrapperElem property that fires the 'open viewDesc' action (i.e. onClick or onPress)
* Defaults to 'onClick'
*/
wrapperEventHandlerName?: string;
}
export interface CvViewDescCallback {
openView(resultCallback?: CvResultCallback<Either<PaneContext, NavRequest>>): void;
}
export declare var CvViewDesc: React.ClassicComponentClass<CvViewDescProps>;