bugfix
This commit is contained in:
parent
d573fa40f7
commit
ff954059cb
@ -14,6 +14,7 @@ bricks.BaseModal = class extends bricks.Layout {
|
||||
height:
|
||||
bgcolor:
|
||||
title:
|
||||
timeout:
|
||||
archor: cc ( tl, tc, tr
|
||||
cl, cc, cr
|
||||
bl, bc, br )
|
||||
@ -24,6 +25,8 @@ bricks.BaseModal = class extends bricks.Layout {
|
||||
this.set_height('100%');
|
||||
this.ancestor_add_widget = bricks.Layout.prototype.add_widget.bind(this);
|
||||
this.panel = new bricks.VBox({});
|
||||
this.timeout = options.timeout || 0;
|
||||
this.timeout_task = null;
|
||||
this.ancestor_add_widget(this.panel);
|
||||
this.panel.set_width(this.opts.width);
|
||||
this.panel.set_height(this.opts.height);
|
||||
@ -72,10 +75,18 @@ bricks.BaseModal = class extends bricks.Layout {
|
||||
}
|
||||
open(){
|
||||
this.dom_element.style.display = "";
|
||||
console.log('this.timeout=', this.timeout);
|
||||
if (this.timeout > 0){
|
||||
this.timeout_task = schedule_once(this.dismiss.bind(this), this.timeout);
|
||||
}
|
||||
}
|
||||
dismiss(){
|
||||
this.dom_element.style.display = "none";
|
||||
this.target_w.remove_widget(this);
|
||||
if (this.timeout_task){
|
||||
this.timeout_task.cancel();
|
||||
this.timeout_task = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
bricks.Modal = class extends bricks.BaseModal {
|
||||
|
@ -7,6 +7,7 @@
|
||||
"height":"40%",
|
||||
"archor":"cc",
|
||||
"title":"Test Title",
|
||||
"timeout":2,
|
||||
"message":"This is a test message"
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
"auto_close":true,
|
||||
"auto_open":true,
|
||||
"width":"700px",
|
||||
"timeout":2,
|
||||
"height":"400px",
|
||||
"archor":"cc"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user