refactorizacion popover
This commit is contained in:
parent
53af148def
commit
81749e906d
|
@ -141,8 +141,7 @@ export class Popover {
|
||||||
let idNumber = parseInt(id.split('-')[1], 10);
|
let idNumber = parseInt(id.split('-')[1], 10);
|
||||||
popovers.forEach(
|
popovers.forEach(
|
||||||
val => {
|
val => {
|
||||||
let valId = angular.element(val).attr('id');
|
if (parseInt(val.id.split('-')[1], 10) > idNumber)
|
||||||
if (parseInt(valId.split('-')[1], 10) > idNumber)
|
|
||||||
this._removeElement(val);
|
this._removeElement(val);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -157,18 +156,17 @@ export class Popover {
|
||||||
);
|
);
|
||||||
this._checkOpens();
|
this._checkOpens();
|
||||||
}
|
}
|
||||||
_findParent(node) {
|
_findPopOver(node) {
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if ((node.className && node.className.indexOf('vn-popover') !== -1) ||
|
if (node.id && node.id.indexOf('popover-') !== -1) {
|
||||||
(node.id && node.id.indexOf('popover-') !== -1)) {
|
return node.id;
|
||||||
return angular.element(node).attr('id');
|
|
||||||
}
|
}
|
||||||
node = node.parentNode;
|
node = node.parentNode;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
onDocMouseDown(event) {
|
onDocMouseDown(event) {
|
||||||
let targetId = this._findParent(event.target);
|
let targetId = this._findPopOver(event.target);
|
||||||
if (targetId) {
|
if (targetId) {
|
||||||
this.hideChilds(targetId);
|
this.hideChilds(targetId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -177,7 +175,7 @@ export class Popover {
|
||||||
}
|
}
|
||||||
onDocKeyDown(event) {
|
onDocKeyDown(event) {
|
||||||
if (event.keyCode === 27) {
|
if (event.keyCode === 27) {
|
||||||
let targetId = this._findParent(this.latTarget);
|
let targetId = this._findPopOver(this.latTarget);
|
||||||
if (targetId) {
|
if (targetId) {
|
||||||
this.hideChilds(targetId);
|
this.hideChilds(targetId);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue