Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #120 from phovea/dmoitzi/add-backdrop-option-to-di…
Browse files Browse the repository at this point in the history
…alog

Add backdrop option to dialog
  • Loading branch information
Anita Steiner authored Oct 23, 2020
2 parents b237280 + 1acd418 commit 57995be
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dist/components/dialogs.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/components/dialogs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/components/dialogs.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion src/components/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ export class Dialog {
private bakKeyDownListener: (ev: KeyboardEvent) => any = null; // temporal for restoring an old keydown listener
static openDialogs: number = 0;

constructor(title: string, primaryBtnText = 'OK', additionalCSSClasses: string = '') {
/**
* @param title Dialog title
* @param primaryBtnText Label for primary button
* @param additionalCSSClasses additional css classes for the dialog
* @param backdrop sets backdrop option for bootstrap modal
*
* false: show no backdrop;
*
* true: show backdrop, dialog closes on click outside;
*
* static: show backdrop, dialog does not close on click outside;
* @default backdrop true
*/
constructor(title: string, primaryBtnText = 'OK', additionalCSSClasses: string = '', backdrop: boolean | 'static' = true) {
const dialog = document.createElement('div');
dialog.setAttribute('role', 'dialog');
dialog.classList.add('modal', 'fade');
$(dialog).modal({backdrop});
dialog.innerHTML = `
<div class="modal-dialog ${additionalCSSClasses}" role="document">
<div class="modal-content">
Expand Down

0 comments on commit 57995be

Please sign in to comment.