Interface: useComponentType
@ima/react-page-renderer.useComponentType
Properties
cssClasses
• cssClasses: (classRules
: Argument
, component?
: string
| ComponentType
) => string
Type declaration
▸ (classRules
, component?
): string
Generate a string of CSS classes from the properties of the passed-in
object that resolve to true
.
Parameters
Name | Type | Description |
---|---|---|
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? | string | ComponentType | 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
String of CSS classes that had their property resolved
to true
.
Defined in
packages/react-page-renderer/src/hooks/component.ts:9
fire
• fire: (eventTarget
: EventTarget
, eventName
: string
, data?
: any
, options?
: EventBusOptions
) => EventBus
Type declaration
▸ (eventTarget
, eventName
, data?
, options?
): EventBus
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
Name | Type | Description |
---|---|---|
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? | EventBusOptions | 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 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
Defined in
packages/react-page-renderer/src/hooks/component.ts:12
link
• link: (routeName
: string
, params
: RouteParams
) => string
Type declaration
▸ (routeName
, params
): string
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
Name | Type | Description |
---|---|---|
routeName | string | The unique name of the route, identifying the route to use. |
params | RouteParams | 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.
Defined in
packages/react-page-renderer/src/hooks/component.ts:11
listen
• listen: (eventTarget
: EventTarget
, eventName
: string
, listener
: EventBusListener
) => EventBus
Type declaration
▸ (eventTarget
, eventName
, listener
): EventBus
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
Name | Type | Description |
---|---|---|
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 | EventBusListener | The event listener to register. |
Returns
This event bus.
Defined in
packages/react-page-renderer/src/hooks/component.ts:13
localize
• localize: (key
: never
, parameters?
: ObjectParameters
) => string
Type declaration
▸ (key
, parameters?
): string
Retrieves the localization phrase identified by the specified key, evaluates the phrase's placeholder expressions using the provided parameters and returns the result.
Parameters
Name | Type | Description |
---|---|---|
key | never | The key identifying the localization phrase. |
parameters? | ObjectParameters | 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.
Defined in
packages/react-page-renderer/src/hooks/component.ts:10
unlisten
• unlisten: (eventTarget
: EventTarget
, eventName
: string
, listener
: EventBusListener
) => EventBus
Type declaration
▸ (eventTarget
, eventName
, listener
): EventBus
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
Name | Type | Description |
---|---|---|
eventTarget | EventTarget | The event target at which the listener is listening for the event. |
eventName | string | The name of the event listened for. |
listener | EventBusListener | The event listener to deregister. |
Returns
This event bus.
Defined in
packages/react-page-renderer/src/hooks/component.ts:14
utils
• utils: Utils