@hypericon/mico 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,7 @@ class DialogManager {
|
|
|
19
19
|
get isOpen() { return this.currentDialog !== undefined; }
|
|
20
20
|
constructor(options) {
|
|
21
21
|
this.debug = false;
|
|
22
|
+
this.backdropDismissTimeout = 100;
|
|
22
23
|
if (options === null || options === void 0 ? void 0 : options.debug)
|
|
23
24
|
this.debug = options.debug;
|
|
24
25
|
if (options === null || options === void 0 ? void 0 : options.containerEl) {
|
|
@@ -51,6 +52,7 @@ class DialogManager {
|
|
|
51
52
|
const manager = this;
|
|
52
53
|
const dialogId = `${Math.random().toString().replace("0.", "")}`;
|
|
53
54
|
return new Promise((resolve, reject) => {
|
|
55
|
+
const backdropDismissAvailableAt = Date.now() + this.backdropDismissTimeout;
|
|
54
56
|
mithril_1.default.mount(element, {
|
|
55
57
|
oninit() {
|
|
56
58
|
//
|
|
@@ -63,6 +65,8 @@ class DialogManager {
|
|
|
63
65
|
// Optionally wire up the backdrop to dismiss the dialog
|
|
64
66
|
if ((opts === null || opts === void 0 ? void 0 : opts.backdropDismiss) === true) {
|
|
65
67
|
dialog.addEventListener("click", (ev) => {
|
|
68
|
+
if (Date.now() < backdropDismissAvailableAt)
|
|
69
|
+
return;
|
|
66
70
|
// console.log(ev);
|
|
67
71
|
if (ev.target !== dom)
|
|
68
72
|
return;
|
|
@@ -13,6 +13,7 @@ export class DialogManager {
|
|
|
13
13
|
get isOpen() { return this.currentDialog !== undefined; }
|
|
14
14
|
constructor(options) {
|
|
15
15
|
this.debug = false;
|
|
16
|
+
this.backdropDismissTimeout = 100;
|
|
16
17
|
if (options === null || options === void 0 ? void 0 : options.debug)
|
|
17
18
|
this.debug = options.debug;
|
|
18
19
|
if (options === null || options === void 0 ? void 0 : options.containerEl) {
|
|
@@ -45,6 +46,7 @@ export class DialogManager {
|
|
|
45
46
|
const manager = this;
|
|
46
47
|
const dialogId = `${Math.random().toString().replace("0.", "")}`;
|
|
47
48
|
return new Promise((resolve, reject) => {
|
|
49
|
+
const backdropDismissAvailableAt = Date.now() + this.backdropDismissTimeout;
|
|
48
50
|
m.mount(element, {
|
|
49
51
|
oninit() {
|
|
50
52
|
//
|
|
@@ -57,6 +59,8 @@ export class DialogManager {
|
|
|
57
59
|
// Optionally wire up the backdrop to dismiss the dialog
|
|
58
60
|
if ((opts === null || opts === void 0 ? void 0 : opts.backdropDismiss) === true) {
|
|
59
61
|
dialog.addEventListener("click", (ev) => {
|
|
62
|
+
if (Date.now() < backdropDismissAvailableAt)
|
|
63
|
+
return;
|
|
60
64
|
// console.log(ev);
|
|
61
65
|
if (ev.target !== dom)
|
|
62
66
|
return;
|