-
Notifications
You must be signed in to change notification settings - Fork 97
dialogAutoCloser
James Hou edited this page Jan 24, 2021
·
3 revisions
A simple component that counts down and auto closes a DialogService opened dialog by sending a messageService connected closedialog event.
This is meant to be used with DialogService when launching a Screen Flow as the final step.
However, there are a couple more ways to use it:
- As a visual countdown progress bar, handling the bubbled
closedialogCustom Event by yourself. - Refreshing an instance of
soqlDatatableby using theuniqueBoundaryandisRefreshTableproperties.- This sends a
boundaryscoped:refreshsoqldatatableLMS event.
- This sends a
NOTE: It is recommended you provide this component a
uniqueBoundaryscoped to its caller, otherwise it may close more dialogs than intended if Tab-Focused Dialogs is enabled.
<template>
<c-message-service></c-message-service>
<lightning-layout horizontal-align="center" multiple-rows>
<lightning-layout-item flexibility="shrink">
{messageTemplate}
</lightning-layout-item>
<lightning-layout-item size="12">
<lightning-progress-bar value={progress}></lightning-progress-bar>
</lightning-layout-item>
</lightning-layout>
</template>@api messageTemplate = 'Auto closing in {timer} seconds';
@api timer = 5;
...
renderedCallback() {
if (this._isRendered) {
return;
}
this._isRendered = true;
this._startProgressInterval();
this._startTimerInterval();
}
...Attributes
| name | type | access | required | default | description |
|---|---|---|---|---|---|
| messageTemplate | String | public | no | Auto closing in {timer} seconds | Message to display to user while countdown is running |
| timer | Number | public | no | 5 | Seconds until the component launches the closedialog LMS event |
Public Methods
None