Add project files.
This commit is contained in:
51
SysApp/wwwroot/js/libs/js-AOverlay.js
Normal file
51
SysApp/wwwroot/js/libs/js-AOverlay.js
Normal file
@ -0,0 +1,51 @@
|
||||
export default class AOverlay extends window.AObject {
|
||||
constructor(p) {
|
||||
super();
|
||||
this.parent = p;
|
||||
this.IsActive = false;
|
||||
this.isClose = true;
|
||||
}
|
||||
createOverlay() {
|
||||
var c = document.createElement("div");
|
||||
c.classList.add("c-aoverlay");
|
||||
this.parent.appendChild(c);
|
||||
this.overlay = c;
|
||||
var f = function (e) {
|
||||
this.onOverlay_click.call(this, e);
|
||||
}.bind(this);
|
||||
c.addEventListener("click", f, false);
|
||||
|
||||
}
|
||||
setIndex(i) {
|
||||
this.overlay.style.zIndex = i;
|
||||
}
|
||||
showOverlay() {
|
||||
this.overlay.classList.add("show");
|
||||
this.IsActive = true;
|
||||
}
|
||||
isCloseOverlay(flag) {
|
||||
this.isClose = flag;
|
||||
}
|
||||
addChildNode(childNode) {
|
||||
this.overlay.appendChild(childNode);
|
||||
}
|
||||
|
||||
removeOverlay() {
|
||||
this.trigger("before_close");
|
||||
var f = function (e) {
|
||||
this.IsActive = false;
|
||||
this.trigger("after_close");
|
||||
this.overlay.removeEventListener("transitionend", f, false);
|
||||
}.bind(this);
|
||||
this.overlay.addEventListener("transitionend", f, false);
|
||||
this.overlay.classList.remove("show");
|
||||
|
||||
}
|
||||
onOverlay_click(e) {
|
||||
if ((e.target.classList.contains("modal-con") || e.target.classList.contains("c-aoverlay") )&& this.isClose) {
|
||||
this.removeOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user