Home Reference Source
import Renderers from 'formatron/src/renderers/index.js'
public class | source

Renderers

You can directly use an instance of this class. valueRenderers

Collection of render functions of a specific type (eg. React renderers).

Constructor Summary

Public Constructor
public

Creates a new set of renderers for a set of types.

Member Summary

Public Members
public
public

Method Summary

Public Methods
public

bustCache(type: *, viewType: *, dataValue: *)

public

cache(type: *, viewType: *, dataValue: *, create: *): *

public

getDisplay(viewType: *, renderData: *): *

Returns a "pretty" data value that is represented by this view type.

public

getTableProps(viewType: *, renderData: *): *

Returns a map of properties to use to display a table.

public

getValue(viewType: *, renderData: *): *

Returns the raw data value that is represented by this view type.

public

getViewTypes(renderData: *): *

public

initialize(viewType: *, renderData: *): Promise

Initializes the view type to display with a specific set of data.

public

parseViewType(viewType: *, renderData: *): *

If the view type passed in is a string and if the viewTypes property exists in the renderData options, attempt to look up the viewType by name.

public

register(typeName: string, renderer: Renderer)

Registers a new renderer for a specific type.

public

renderFilter(viewType: *, renderData: *): *

public

renderFormField(viewType: *, renderData: *): *

public

renderFormFilter(viewType: *, renderData: *): *

public

renderStaticField(viewType: *, renderData: *): *

public

renderStaticTableCell(viewType: *, renderData: *): *

public

renderTableCell(viewType: *, renderData: *): *

Public Constructors

public constructor(renderers: object<string, Renderer>) source

Creates a new set of renderers for a set of types.

Params:

NameTypeAttributeDescription
renderers object<string, Renderer>

The set of renderers for each ViewType registered.

Public Members

public cachedValues: * source

public renderers: * source

Public Methods

public bustCache(type: *, viewType: *, dataValue: *) source

Params:

NameTypeAttributeDescription
type *
viewType *
dataValue *

public cache(type: *, viewType: *, dataValue: *, create: *): * source

Params:

NameTypeAttributeDescription
type *
viewType *
dataValue *
create *

Return:

*

public getDisplay(viewType: *, renderData: *): * source

Returns a "pretty" data value that is represented by this view type.

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public getTableProps(viewType: *, renderData: *): * source

Returns a map of properties to use to display a table.

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public getValue(viewType: *, renderData: *): * source

Returns the raw data value that is represented by this view type.

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public getViewTypes(renderData: *): * source

Params:

NameTypeAttributeDescription
renderData *

Return:

*

public initialize(viewType: *, renderData: *): Promise source

Initializes the view type to display with a specific set of data. This is normally to call the required API calls before the data is display.

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

Promise

Resolved upon completion, rejected if error loading.

public parseViewType(viewType: *, renderData: *): * source

If the view type passed in is a string and if the viewTypes property exists in the renderData options, attempt to look up the viewType by name.

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public register(typeName: string, renderer: Renderer) source

Registers a new renderer for a specific type.

Params:

NameTypeAttributeDescription
typeName string

The name of the renderer to register.

renderer Renderer

The renderer to register.

public renderFilter(viewType: *, renderData: *): * source

See Renderer#renderFilter

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public renderFormField(viewType: *, renderData: *): * source

See Renderer#renderFormField

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public renderFormFilter(viewType: *, renderData: *): * source

See Renderer#renderFormFilter

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public renderStaticField(viewType: *, renderData: *): * source

See Renderer#renderStaticField

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public renderStaticTableCell(viewType: *, renderData: *): * source

See Renderer#renderStaticTableCell

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*

public renderTableCell(viewType: *, renderData: *): * source

See Renderer#renderTableCell

Params:

NameTypeAttributeDescription
viewType *
renderData *

Return:

*