Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "core/CvForm"

Index

Interfaces

Variables

Variables

CvForm

CvForm: ClassicComponentClass<CvFormProps> = React.createClass<CvFormProps, CvFormState>({mixins: [CvBaseMixin],componentDidMount: function () {},componentWillUnmount: function() {const formContext = this.formContext();if (formContext && formContext.isDestroyed) {(this.eventRegistry() as CvEventRegistry).removeFromCache(CvResourceManager.resourceIdForObject(formContext, this.catavolt()));}},getChildContext: function () {const ctx = this.getDefaultChildContext();ctx.cvContext.scopeCtx.scopeObj = this.formContext();return ctx;},getDefaultProps: function() {return {formContext: null,formRenderer: null,childFormComponentRenderer:null,listComponentRenderer:null,detailsComponentRenderer:null,mapComponentRenderer:null,printMarkupComponentRenderer:null,graphComponentRenderer:null,stateChangeListeners:[]}},render: function () {const formContext = this.formContext();if (formContext && !formContext.isDestroyed) {if (this.props.renderer) {return this.props.renderer(this.getChildContext().cvContext);} else if (React.Children.count(this.props.children) > 0) {return this.props.children} else {const childComponents:Array<ReactElement<any>> = formContext.childrenContexts.map((context, i) => {const childComponent = this._getChildComponent(context, i);if(childComponent && childComponent.key != null) {return childComponent;} else {return childComponent ? React.cloneElement(childComponent, {key: i}) : null;}});return this.props.formRenderer ? this.props.formRenderer(this.getChildContext().cvContext, childComponents) : null;}} else {return null;}},refresh: function() {this.forceUpdate();},formContext: function (nextProps) {return (nextProps && nextProps.formContext) || this.props.formContext || this.firstInScope(FormContext);},_checkDestroyed: function() {const formContext = this.formContext();if (formContext && formContext.isDestroyed) {const event:CvEvent<CvStateChangeResult> ={type: CvEventType.STATE_CHANGE,resourceId: CvResourceManager.resourceIdForObject(formContext, this.catavolt()),eventObj: {source: formContext, type: CvStateChangeType.DESTROYED}};this.props.stateChangeListeners.forEach(listener=> {listener(event)});}},_getChildComponent: function(context:PaneContext, index:number) {let childComponent = null;if(context.hasError) {Log.error("Failed to load pane with: " + JSON.stringify(context.error));} else if(context instanceof FormContext) {childComponent = this.props.childFormComponentRenderer ?this.props.childFormComponentRenderer(context, this._stateChangeListener, index) : null;}else if (context instanceof ListContext) {childComponent = this.props.listComponentRenderer ?this.props.listComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof DetailsContext) {childComponent = this.props.detailsComponentRenderer ?this.props.detailsComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof MapContext) {childComponent = this.props.mapComponentRenderer ?this.props.mapComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof PrintMarkupContext) {childComponent = this.props.printMarkupComponentRenderer ?this.props.printMarkupComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof GraphContext) {childComponent = this.props.graphComponentRenderer ?this.props.graphComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof ImagePickerContext) {childComponent = this.props.imagePickerComponentRenderer ?this.props.imagePickerComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof CalendarContext) {childComponent = this.props.calendarComponentRenderer ?this.props.calendarComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof BarcodeScanContext) {childComponent = this.props.barcodeScanComponentRenderer ?this.props.barcodeScanComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof GeoFixContext) {childComponent = this.props.geoFixComponentRenderer ?this.props.geoFixComponentRenderer(context, this._stateChangeListener, index) : null;} else if (context instanceof GeoLocationContext) {childComponent = this.props.geoLocationComponentRenderer ?this.props.geoLocationComponentRenderer(context, this._stateChangeListener, index) : null;} else {Log.info('Not yet handling display for ' + context.constructor['name']);childComponent = <div>{'Not yet handling display for ' + context.constructor['name']}</div>}return childComponent;},_stateChangeListener: function(event:CvEvent<CvStateChangeResult>) {if(event.eventObj.type === CvStateChangeType.DESTROYED) {this._checkDestroyed();this.refresh();} else {this.props.stateChangeListeners.forEach(listener=> {listener(event)});}},})

Generated using TypeDoc