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

Commit

Permalink
add backdrop option to dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdanielamoitzi committed Oct 23, 2020
1 parent b237280 commit 50a45c1
Show file tree
Hide file tree
Showing 4 changed files with 22 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.

17 changes: 16 additions & 1 deletion src/components/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,25 @@ 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 50a45c1

Please sign in to comment.