Interface: useComponentType
Defined in: packages/react-page-renderer/src/hooks/component.ts:7
Properties
cssClasses()
cssClasses: (
classRules
,component
?) =>string
Defined in: packages/react-page-renderer/src/hooks/component.ts:9
Generate a string of CSS classes from the properties of the passed-in
object that resolve to true
.
Parameters
classRules
Argument
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?
The component
requiring the composition of the CSS class names, if it has the
className
property set and requires its inclusion this time.
string
| ComponentType
Returns
string
String of CSS classes that had their property resolved
to true
.
fire()
fire: (
eventTarget
,eventName
,data
?,options
?) =>this
Defined in: packages/react-page-renderer/src/hooks/component.ts:12
Fires a new custom event of the specified name, carrying the provided data.
Note that this method does not prevent the event listeners to modify the data in any way. The order in which the event listeners will be executed is unspecified and should not be relied upon.
Note that the default options are
{ bubbles: true, cancelable: true }
, which is different from the
default values used in the native custom events
({ bubbles: false, cancelable: false }
).
Parameters
eventTarget
EventTarget
The event target at which the event will be dispatched (e.g. element/document/window).
eventName
string
The name of the event to fire.
data?
any
The data to pass to the event listeners.
options?
The
override of the default options passed to the constructor of the
custom event fired by this event bus.
The default options passed to the custom event constructor are
{ bubbles: true, cancelable: true }
.
Returns
this
This custom event bus.
Throws
Thrown if the provided event target cannot be used to fire the event.
See
https://developer.mozilla.org/en-US/docs/Web/API/Event/Event
link()
link: (
routeName
,params
) =>string
Defined in: packages/react-page-renderer/src/hooks/component.ts:11
Generates an absolute URL (including protocol, domain, etc) for the specified route by substituting the route's parameter placeholders with the provided parameter values.
Parameters
routeName
string
The unique name of the route, identifying the route to use.
params
Parameter values for the route's parameter placeholders. Extraneous parameters will be added as URL query.
Returns
string
An absolute URL for the specified route and parameters.
listen()
listen: (
eventTarget
,eventName
,listener
) =>this
Defined in: packages/react-page-renderer/src/hooks/component.ts:13
Registers the provided event listener to be executed when the specific custom event is fired by the same implementation of the event bus and passes through the specified event target.
When the specified event is fired, the event listener will be executed with the event passed as the first argument.
The order in which the event listeners will be executed is unspecified and should not be relied upon.
Parameters
eventTarget
EventTarget
The event target at which the listener should listen for the specified event.
eventName
string
The name of the event to listen for.
listener
The event listener to register.
Returns
this
This event bus.
localize()
localize: (
key
,parameters
?) =>string
Defined in: packages/react-page-renderer/src/hooks/component.ts:10
Retrieves the localization phrase identified by the specified key, evaluates the phrase's placeholder expressions using the provided parameters and returns the result.
Parameters
key
never
The key identifying the localization phrase.
parameters?
The map of parameter names to the parameter values to use. Defaults to an empty plain object.
Returns
string
The specified localization phrase with its placeholders evaluated using the provided parameters.
unlisten()
unlisten: (
eventTarget
,eventName
,listener
) =>this
Defined in: packages/react-page-renderer/src/hooks/component.ts:14
Removes the provided event listener from the set of event listeners executed when the specified custom event fired by the same implementation passes through the specified event target.
The method has no effect if the listener is not registered for the specified event at the specified event target.
Parameters
eventTarget
EventTarget
The event target at which the listener is listening for the event.
eventName
string
The name of the event listened for.
listener
The event listener to deregister.
Returns
this
This event bus.
utils
utils:
Utils
Defined in: packages/react-page-renderer/src/hooks/component.ts:8