Bugs popover
This commit is contained in:
parent
c2530acafd
commit
1f1fcce5a8
|
@ -2,7 +2,7 @@
|
||||||
<vn-textfield vn-one label="Search" model="$ctrl.search"></vn-textfield>
|
<vn-textfield vn-one label="Search" model="$ctrl.search"></vn-textfield>
|
||||||
<vn-icon icon="keyboard_arrow_down" ng-click="searchbar.onClick($event)" style="cursor: pointer;"></vn-icon>
|
<vn-icon icon="keyboard_arrow_down" ng-click="searchbar.onClick($event)" style="cursor: pointer;"></vn-icon>
|
||||||
<vn-icon-button icon="search"></vn-icon-button>
|
<vn-icon-button icon="search"></vn-icon-button>
|
||||||
<vn-popover>
|
<vn-popover id="popover">
|
||||||
<vn-search-panel></vn-search-panel>
|
<vn-search-panel></vn-search-panel>
|
||||||
</vn-popover>
|
</vn-popover>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
|
@ -14,9 +14,20 @@ export function directive(resolver) {
|
||||||
return resolver.getTemplate(_NAME, attrs);
|
return resolver.getTemplate(_NAME, attrs);
|
||||||
},
|
},
|
||||||
controller: function($element) {
|
controller: function($element) {
|
||||||
|
var self = this;
|
||||||
|
var doc = angular.element(document);
|
||||||
|
function docMouseDownHandler (event) {
|
||||||
|
if (event != self.lastEvent)
|
||||||
|
self.hide();
|
||||||
|
}
|
||||||
this.onMouseDown = function(event) {
|
this.onMouseDown = function(event) {
|
||||||
this.lastEvent = event;
|
this.lastEvent = event;
|
||||||
};
|
};
|
||||||
|
this.hide = function ()
|
||||||
|
{
|
||||||
|
$element[0].style.display = 'none';
|
||||||
|
doc.off('mousedown', docMouseDownHandler);
|
||||||
|
}
|
||||||
this.show = function(parent) {
|
this.show = function(parent) {
|
||||||
var node = $element[0];
|
var node = $element[0];
|
||||||
var style = node.style;
|
var style = node.style;
|
||||||
|
@ -60,16 +71,7 @@ export function directive(resolver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
style.display = 'block';
|
style.display = 'block';
|
||||||
|
doc.on('mousedown', docMouseDownHandler);
|
||||||
var self = this;
|
|
||||||
var doc = angular.element(document);
|
|
||||||
var clickHandler = function(event) {
|
|
||||||
if (event != self.lastEvent) {
|
|
||||||
style.display = 'none';
|
|
||||||
doc.off('mousedown', clickHandler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doc.on('mousedown', clickHandler);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue