Global

Members

(constant) ALTER_RETURN

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

busy :boolean

Determines if blocking action is currently in process.
Type:
  • boolean
Source:

(constant) componentConfigs

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

(constant) DEFAULT_APPEND_CONTENT

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

(constant) DEFAULT_INIT

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

(constant) DEFAULT_OPTIONS

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

(constant) DEFAULTS

Options
Properties:
Name Type Description
breakpoint String | Number The window width that defines the desktop size.
content String The class or ID of the content container.
container String The class or ID of the sidenav container.
gutter String | Number The space between the sidenav-slider and the sidenav-content.
navigation String The class or ID of the navigation container.
position String The position of the sidenav-slider. Possible values: left, right
type String The type of sidenav in desktop. Possible values: relative, fixed, fixed-push
typeMobile String The type of sidenav in mobile. Possible values: relative, fixed, fixed-push
url String | Object The URL to fetch the content to inject into .sidebar-body
width String | Number The width of the side navigation.
Source:

(constant) doHistory :boolean

Flag specifying whether history is to be processed (true if browser supports HTML5 session history APIs)
Type:
  • boolean
Source:

(constant) eventListeners :Array.<Object>

An array containing the event listeners.
Type:
  • Array.<Object>
Source:

(constant) eventListenersQueue :Array.<Object>

An array containing the event listeners currently queued for being dispatched.
Type:
  • Array.<Object>
Source:

(constant) eventNamesToSelectors

Keys are event names (eg. "click"). Values are objects mapping selectors to EventEmitters.
Source:

(constant) IDENTITY_ATTRIBUTES

A list of attributes that can contribute to the "identity" of an element, for the purposes of delegated event handling.
Source:

(constant) INSTANCE_MAP

Map from toggler DOM nodes to sidenav instances.
Source:

(constant) NEW_LINE

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

pageRenderState :Object

The page render state containing the all portlets and public parameters map.
Type:
  • Object
Source:

(constant) portletRegex :string

Regex for portlet-level events
Type:
  • string
Source:

Methods

applyTabSelectionDOMChanges(namespace, names, id, selectedTab, selectedTabSection)

Applies DOM changes that represent tab selection
Parameters:
Name Type Description
namespace String The portlet's namespace
names Array Names of all tabs
id String Tab id.
selectedTab HTMLElement Selected tab element
selectedTabSection HTMLElement Selected tab section element
Source:

cancelDebounce(debounced)

Cancels the scheduled debounced function.
Parameters:
Name Type Description
debounced function
Source:

component(id, value, componentConfig) → {object}

Registers a component and retrieves its instance from the global registry.
Parameters:
Name Type Description
id string The ID of the component to retrieve or register.
value object The component instance or a component constructor. If a constructor is provided, it will be invoked the first time the component is requested and its result will be stored and returned as the component.
componentConfig object The Custom component configuration. This can be used to provide additional hints for the system handling of the component lifecycle.
Source:
Returns:
The passed value, or the stored component for the provided ID.
Type
object

componentReady(…componentId) → {Promise}

Retrieves a list of component instances after they've been registered.
Parameters:
Name Type Attributes Description
componentId string <repeatable>
The IDs of the components to receive.
Source:
Returns:
A promise to be resolved with all the requested component instances after they've been successfully registered.
Type
Promise

debounce(fnnon-null, delay) → (non-null) {function}

Debounces function execution.
Parameters:
Name Type Description
fn function
delay number
Source:
Returns:
Type
function

decodeUpdateString(pageRenderState, updateString) → {Object}

Decodes the update strings. The update string is a JSON object containing the entire page state. This decoder returns an object containing the portlet data for portlets whose state has changed as compared to the current page state.
Parameters:
Name Type Description
pageRenderState Object The page render state.
updateString string The update string to decode.
Source:
Returns:
Type
Object

delegate(elementnon-null, eventName, selector, callbacknon-null) → {function}

Listens to the specified event on the given DOM element, but only calls the given callback listener when it's triggered by elements that match the given selector or target element.
Parameters:
Name Type Description
element Element The DOM element the event should be listened on.
eventName string The name of the event to listen to.
selector string Css selector that should match the event for the listener to be triggered.
callback function Function to be called when the event is triggered. It will receive the normalized event object.
Source:
Returns:
Can be used to remove the listener.
Type
function

destroyComponent(componentId)

Destroys the component registered by the provided component ID. This invokes the component's own destroy lifecycle methods (destroy or dispose) and deletes the internal references to the component in the component registry.
Parameters:
Name Type Description
componentId string The ID of the component to destroy.
Source:

destroyComponents(filterFn)

Destroys registered components matching the provided filter function. If no filter function is provided, it destroys all registered components.
Parameters:
Name Type Description
filterFn function A method that receives a component's destroy options and the component itself, and returns true if the component should be destroyed.
Source:

destroyUnfulfilledPromises()

Clears the component promises map to make sure pending promises don't get accidentally resolved at a later stage if a component with the same ID appears, causing stale code to run.
Source:

encodeFormAsString(portletId, form)

Function to extract data from form and encode it as an 'application/x-www-form-urlencoded' string.
Parameters:
Name Type Description
portletId string The portlet ID.
form HTMLFormElement Form to be submitted.
Source:

encodeParameter(name, values) → {string}

Helper for encoding a multi valued parameter.
Parameters:
Name Type Description
name string The parameter's name.
values Array.<string> The parameter's value.
Source:
Returns:
Type
string

generateActionUrl(portletId, url, The) → {Object}

Generates the required options for an action URL request according to the portletId, action URL and optional form element.
Parameters:
Name Type Description
portletId string The id of the portlet.
url string The action url.
The HTMLFormElement form element.
Source:
Returns:
Type
Object

generateParameterString(pageRenderState, portletId, name, type, group)

Helper for generating parameter strings for the URL
Parameters:
Name Type Description
pageRenderState Object The page render state.
portletId string The portlet ID.
name string The parameter's name.
type string The parameter's type.
group string The parameter's group.
Source:

generatePortletModeAndWindowStateString(pageRenderState, portletId) → {string}

Helper for generating portlet mode & window state strings for the URL.
Parameters:
Name Type Description
pageRenderState Object The page render state.
portletId string The portlet ID.
Source:
Returns:
Type
string

getComponentCache(componentId) → {object}

Retrieves a registered component's cached state.
Parameters:
Name Type Description
componentId string The ID used to register the component.
Source:
Returns:
The state the component had prior to the previous navigation.
Type
object

getElement()

Utility function that strips off a possible jQuery and Metal component wrappers from a DOM element.
Source:

getLayoutIcons()

Gets layout icons
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

getSessionValue(key, options) → {Promise}

Gets the Store utility fetch value for given key
Parameters:
Name Type Description
key String string for fetch request
options Object (currently only useHttpSession, defaulting to false)
Source:
Returns:
Type
Promise

getUniqueSelector()

Returns a unique selector for the supplied element. Ideally we'd just use the "id" attribute (assigning one if necessary), but the use of Metal components means that any "id" we assign will be blown away on the next state change.
Source:

getUpdatedPublicRenderParameters(pageRenderState, portletId, state) → {Object}

Gets the updated public parameters for the given portlet ID and new render state. Returns an object whose properties are the group indexes of the updated public parameters. The values are the new public parameter values.
Parameters:
Name Type Description
pageRenderState Object The page render state.
portletId string The portlet ID.
state RenderState The new render state.
Source:
Returns:
Object containing the updated public render parameters.
Type
Object

getUrl(pageRenderState, type, portletId, parameters, cache, resourceId) → {Promise}

Returns a URL of the specified type.
Parameters:
Name Type Description
pageRenderState Object The page render state.
type string The URL type.
portletId string The portlet ID.
parameters Object Additional parameters. May be null.
cache string Cacheability. Must be present if type = "RESOURCE". May be null.
resourceId string Resource ID. May be present if type = "RESOURCE". May be null.
Source:
Returns:
A promise that resolves the generated URL.
Type
Promise

hideLayoutPane(options)

Hides layout pane
Parameters:
Name Type Description
options Object
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

indent(level) → {String}

Returns a string for starting a new line at the specified indent level
Parameters:
Name Type Description
level number The level of indentation
Source:
Returns:
Return a string for starting a new line at the specified indent level
Type
String

initComponentCache()

Initializes the component cache mechanism.
Source:

isDisabled(elementnon-null) → {boolean}

Checks if element is disabled or whether it exists in a disabled element tree
Parameters:
Name Type Description
element Element The DOM element to check.
Source:
Returns:
Type
boolean

isParameterEqual(parameter1nullable, parameter2nullable) → {boolean}

Compares two parameters and returns a boolean indicating if they're equal or not.
Parameters:
Name Type Attributes Description
parameter1 Array.<string> <nullable>
The first parameter to compare.
parameter2 Array.<string> <nullable>
The second parameter to compare.
Source:
Returns:
Type
boolean

isParameterInStateEqual(pageRenderState, portletId, state, name) → {boolean}

Compares the values of the named parameter in the new render state with the values of that parameter in the current state.
Parameters:
Name Type Description
pageRenderState Object The page render state.
portletId string The portlet ID.
state RenderState The new render state.
name string The name of the parameter to check.
Source:
Returns:
True if the new parameter's value is different from the current value.
Type
boolean

isPublicParameter(pageRenderState, portletId, name) → {boolean}

Function for checking if a parameter is public.
Parameters:
Name Type Description
pageRenderState Object The page render state.
portletId string The portlet ID.
name string The name of the parameter to check.
Source:
Returns:
Type
boolean

minimizePortlet(portletSelector, trigger, options)

Minimizes portlet
Parameters:
Name Type Description
portletSelector String Portlet container selector
trigger HTMLElement Trigger element
options Object Additional options
Source:

offsetLeft()

Replacement for jQuery's `offset().left`.
Source:

openSimpleInputModal()

Function that implements the SimpleInputModal pattern, which allows manipulating small amounts of data with a form shown inside a modal.
Deprecated:
  • As of Athanasius (7.3.x), replaced by the default export
Source:

openToast(autoClose, container, containerId, message, title, displayType) → {ClayToast}

Function that implements the Toast pattern, which allows to present feedback to user actions as a toast message in the lower left corner of the page
Parameters:
Name Type Description
autoClose number | boolean Flag to indicate alert should automatically call onClose. It also accepts a duration (in ms) which indicates how long to wait. If true is passed in, the timeout will be 10000ms. See https://clayui.com/docs/components/alert.html for more details.
container HTMLElement Target element where the toast React component should be mounted.
containerId string The id of the element where the toast React component should be mounted.
message string | HTML The message to show in the toast notification
title string | HTML The title associated with the message
displayType string The displayType of notification to show. It can be one of the following: 'danger', 'info', 'success', 'warning'
Source:
Returns:
The Alert toast created
Type
ClayToast

proposeLayout(options)

Proposes layout
Parameters:
Name Type Description
options Object
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

publishToLive(options)

Publishes to live
Parameters:
Name Type Description
options Object
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

px()

For compatibility with jQuery, which will treat "100" as "100px".
Source:

register(portletId) → {Promise}

Registers a portlet client with the portlet hub.
Parameters:
Name Type Description
portletId string The unique portlet identifier
Source:
Returns:
A Promise object. Returns an PortletInit object containing functions for use by the portlet client on successful resolution. Returns an Error object containing a descriptive message on failure.
Type
Promise

runJSFromText()

Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Source:

setSessionValue(key, value, options) → {Promise}

Sets the Store utility fetch value
Parameters:
Name Type Description
key String of the formData
value Object | String of the key for the formData
options Object (currently only useHttpSession, defaulting to false)
Source:
Returns:
Type
Promise

showLayoutPane(options)

Shows layout pane
Parameters:
Name Type Description
options Object
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

showTab(namespace, names, id, callback)

Prepares and fires the an event that will show a tab
Parameters:
Name Type Description
namespace String The portlet's namespace
names Array Names of all tabs
id String Tab id.
callback function The callback function.
Source:

showTooltip(element, text)

Prepares given element to show tooltip
Parameters:
Name Type Description
element HTMLElement The portlet's namespace
text String Text to show in tooltip
Deprecated:
  • As of Athanasius (7.3.x), replaced by ClayTooltip
Source:

SimpleInputModal()

Manipulates small amounts of data with a form shown inside a modal.
Source:

stateChanged(pageRenderState, newState, portletId) → {boolean}

Returns true if input state differs from the current page state. Throws exception if input state is malformed.
Parameters:
Name Type Description
pageRenderState Object The (current) page render state.
newState RenderState The new state to be set.
portletId string The portlet ID.
Source:
Returns:
True if the two state are different.
Type
boolean

subscribe()

Creates a delegated event listener for `eventName` events on `elementOrSelector`.
Source:

toggleLayoutDetails(options)

Toggles layout details
Parameters:
Name Type Description
options Object
Deprecated:
  • As of Athanasius (7.3.x), with no direct replacement
Source:

validateArguments(args, min, max, types)

Used by the portlet hub methods to check the number and types of the arguments.
Parameters:
Name Type Default Description
args Array.<string> The argument list to be checked.
min number 0 The minimum number of arguments.
max number 1 The maximum number of arguments. If this value is undefined, the function can take any number of arguments greater than max.
types Array.<string> An array containing the expected parameter types in the order of occurrance in the argument array.
Source:
Throws:
Thrown if the parameters are in some manner incorrect.
Type
TypeError

validateForm(formnullable)

Validates an HTMLFormElement
Parameters:
Name Type Attributes Description
form HTMLFormElement <nullable>
The form element to be validated.
Source:
Throws:
  • Thrown if the form is not an HTMLFormElement.
    Type
    TypeError
  • Thrown if the form's method attribute is not valid.
    Type
    TypeError
  • Thrown if the form's enctype attribute is not valid.
    Type
    TypeError
  • Thrown if the form's enctype attribute is not valid.
    Type
    TypeError

validateParameters(parameters)

Verifies that the input parameters are in valid format. Parameters must be an object containing parameter names. It may also contain no property names which represents the case of having no parameters. If properties are present, each property must refer to an array of string values. The array length must be at least 1, because each parameter must have a value. However, a value of 'null' may appear in any array entry. To represent a null value, the property value must equal [null].
Parameters:
Name Type Description
parameters Object The parameters to check.
Source:
Throws:
Thrown if the parameters are incorrect.
Type
TypeError

validatePortletId(portletId, pageRenderState) → {boolean}

Validates the specificed portletId against the list of current portlet in the pageRenderState.
Parameters:
Name Type Description
portletId string The ID of the portlet to be registered.
pageRenderState Object The current pageRenderState.
Source:
Returns:
A flag indicating if the specified portlet id is valid.
Type
boolean

validateState(state, portletData)

Verifies that the input parameters are in valid format, that the portlet mode and window state values are allowed for the portlet.
Parameters:
Name Type Description
state RenderState The render state object to check.
portletData Object The porltet render state.
Source:
Throws:
Thrown if any component of the state is incorrect.
Type
TypeError

Type Definitions

callback(selectKeynon-null) → {array}

Returns a list of regions by country
Parameters:
Name Type Description
selectKey string The selected region ID
Source:
Returns:
Array of regions by country
Type
array

callback() → {array}

Returns a list of countries
Source:
Returns:
Array of countries
Type
array