page/componentHelpers

Methods

(inner) cssClasses(component, classRules, includeComponentClassName) → {string}

Source:
Generate a string of CSS classes from the properties of the passed-in object that resolve to true.
Examples
this.cssClasses('my-class my-class-modificator', true);
this.cssClasses({
           'my-class': true,
           'my-class-modificator': this.props.modificator
       }, true);
Parameters:
Name Type Description
component AbstractComponent | AbstractPureComponent The component requiring the composition of the CSS class names.
classRules string | Object.<string, boolean> CSS classes in a string separated by whitespace, or a map of CSS class names to boolean values. The CSS class name will be included in the result only if the value is true.
includeComponentClassName boolean
Returns:
String of CSS classes that had their property resolved to true.
Type
string

(inner) defaultCssClasses(classRules, componentnullable) → {string}

Source:
Generate a string of CSS classes from the properties of the passed-in object that resolve to true.
Parameters:
Name Type Attributes Description
classRules string | Object.<string, boolean> CSS classes in a string separated by whitespace, or a map of CSS class names to boolean values. The CSS class name will be included in the result only if the value is true.
component AbstractComponent | AbstractPureComponent <nullable>
The component requiring the composition of the CSS class names, if it has the className property set and requires its inclusion this time.
Returns:
String of CSS classes that had their property resolved to true.
Type
string

(inner) fire(component, eventName, dataopt)

Source:
Creates and sends a new IMA.js DOM custom event from the provided component.
Parameters:
Name Type Attributes Default Description
component AbstractComponent | AbstractPureComponent The component at which's root element the event will originate.
eventName string The name of the event.
data * <optional>
null Data to send within the event.

(inner) getContextTypes(classConstructor) → {Object.<string, function(...*): boolean>}

Source:
Retrieves the context type declarations for the specified component.
Parameters:
Name Type Description
classConstructor function The constructor of the react component.
Returns:
The context type declarations associated with the specified component.
Type
Object.<string, function(...*): boolean>

(inner) getUtils(props, context) → {Object.<string, *>}

Source:
Retrieves the view utilities from the component's current context or properties (preferring the context).
Parameters:
Name Type Description
props Object.<string, *> The component's current properties.
context Object.<string, *> The component's current context.
Throws:
Error Throw if the view utils cannot be located in the provided properties nor context.
Returns:
The retrieved view utilities.
Type
Object.<string, *>
Source:
Generates an absolute URL using the provided route name (see the app/config/routes.js file). The provided parameters will replace the placeholders in the route pattern, while the extraneous parameters will be appended to the generated URL's query string.
Parameters:
Name Type Attributes Description
component AbstractComponent | AbstractPureComponent The component requiring the generating of the URL.
name string The route name.
params Object.<string, (number|string)> <optional>
Router parameters and extraneous parameters to add to the URL as a query string.
Returns:
The generated URL.
Type
string

(inner) listen(component, eventTarget, eventName, listener)

Source:
Registers the provided event listener for execution whenever an IMA.js DOM custom event of the specified name occurs at the specified event target.
Parameters:
Name Type Description
component AbstractComponent | AbstractPureComponent The component requesting the registration of the event listener.
eventTarget React.Element | EventTarget The react component or event target at which the listener should listen for the event.
eventName string The name of the event for which to listen.
listener function The listener for event to register.

(inner) localize(component, key, paramsopt) → {string}

Source:
Returns the localized phrase identified by the specified key. The placeholders in the localization phrase will be replaced by the provided values.
Parameters:
Name Type Attributes Description
component AbstractComponent | AbstractPureComponent The component requiring the localization.
key string Localization key.
params Object.<string, (number|string)> <optional>
Values for replacing the placeholders in the localization phrase.
Returns:
Localized phrase.
Type
string

(inner) setContextTypes(classConstructor, contextTypes) → {Object.<string, function(...*): boolean>}

Source:
Overrides the previously associated context type declarations for the specified component to the provided ones.
Parameters:
Name Type Description
classConstructor function The constructor of the react component.
contextTypes Object.<string, function(...*): boolean> The new context type declarations to associate with the specified component.
Returns:
The provided context type declarations.
Type
Object.<string, function(...*): boolean>

(inner) unlisten(component, eventTarget, eventName, listener)

Source:
Deregisters the provided event listener for an IMA.js DOM custom event of the specified name at the specified event target.
Parameters:
Name Type Description
component AbstractComponent | AbstractPureComponent The component that requested the registration of the event listener.
eventTarget React.Element | EventTarget The react component or event target at which the listener should listen for the event.
eventName string The name of the event for which to listen.
listener function The listener for event to register.