By default, the interaction outside the Overlay panel closes the Dialog immediately. This behavior can be prevented with the help of the dismissable property. At the same time, there is an option to display close at the top-right corner using the showCloseIcon property.
The Dialog component supports four event callbacks named onBeforeShow, onAfterShow, onBeforeHide, and onAfterHide, which will be invoked when the Dialog is shown or hidden.
The complete demo application with instructions is available on GitHub at
https://github.com/ova2/angular-development-with-primeng/tree/master/chapter6/overlaypanel.
https://github.com/ova2/angular-development-with-primeng/tree/master/chapter6/overlaypanel.