@gitlab/ui
Version:
GitLab UI Components
33 lines (28 loc) • 947 B
JavaScript
import { tooltipActionEvents } from '../../utils/constants';
var tooltip_mixin = (function (tooltipRefName) {
return {
mounted: function mounted() {
var _this = this;
/**
* Pass through the events to programmatically open, close, enable
* and disable a tooltip or a popover.
*
* References
* https://bootstrap-vue.org/docs/components/popover#programmatically-show-and-hide-popover
* https://bootstrap-vue.org/docs/components/tooltip#programmatically-show-and-hide-tooltip
*/
tooltipActionEvents.forEach(function (event) {
return _this.$on(event, function () {
return _this.$refs[tooltipRefName].$emit(event);
});
});
},
beforeDestroy: function beforeDestroy() {
var _this2 = this;
tooltipActionEvents.forEach(function (event) {
return _this2.$off(event);
});
}
};
});
export default tooltip_mixin;