Skip to content

DialogService

James Hou edited this page Jan 24, 2021 · 2 revisions

This component is composed inside MessageServiceHandler and provides it with the public methods for creating modals via Aura's overlayLibrary.

Primarily used by messageService for message publishing, MessageServiceHandler receives the subscription and delegates to this component.

It is not recommended to use this component directly.

Specification

Attributes

name type access required default description
overlayPromise Object public no Stores the returned overlay promise from overlayLibrary.

If a callback is specified by the caller, this is returned.

Public Methods

Arguments for this component are not in JS Object {} notation so that they can be explicitly listed out in the component itself.

For that reason, it is recommended to use messageService / MessageServiceHandler to call these functions.

name arguments description
showPopover (
body,
bodyParams,
referenceSelector,
cssClass,
callback
)
No examples for this one yet.
modal (
auraId,
headerLabel,
body,
bodyParams,
mainActionReference,
mainActionLabel,
callback,
)
Compatible with Aura dialog bodies.

body is the component name (Aura notation) to be created in a dialog.

bodyParams are public attributes to be passed from the caller to the body.

mainActionReference uses component.getReference to connect the primary action in ModalFooter to a function on the body to be created.
This allows you to avoid writing a button specifically at the bottom of the body to be created.

mainActionLabel changes the label of the primary action on ModalFooter.

callback is optionally specified to return the overlayPromise if needed. Alternatively, listen for the dialogready LMS Event.
modalLarge (
auraId,
headerLabel,
body,
bodyParams,
mainActionReference,
mainActionLabel,
callback,
isLargeModal = true
)
Compatible with Aura dialog bodies.

Same as modal, with wider dialog box using slds-modal_large
bodyModal (
auraId,
headerLabel,
body,
bodyParams,
callback
)
Compatible with LWC dialog bodies.

Same as modal except without connectivity to a mainAction via component.getReference which doesn't work on LWCs, even with @api functions.

Instead, a slim footer called EventFooter is created which is subscribing to the dialogclose event for closing the dialog.

Write your own Cancel and Primary Action button on the dialog body that is dynamically being created.
bodyModalLarge (
auraId,
headerLabel,
body,
bodyParams,
callback,
isLargeModal = true
)
Compatible with LWC dialog bodies.

Same as bodyModal, with wider dialog box using slds-modal_large
Clone this wiki locally