[FIX] web: make Popover patchable

Allows customization for enterprise.

Task ID: 2347640

X-original-commit: 5ac640611e21e6a7ac1c02e632e4550155c98f9a
This commit is contained in:
Pierre Paridans
2021-01-14 13:53:05 +00:00
parent 3d0773d963
commit a3f2a7b83a
+10 -4
View File
@@ -1,6 +1,8 @@
odoo.define('web.Popover', function () {
odoo.define('web.Popover', function (require) {
'use strict';
const patchMixin = require('web.patchMixin');
const { Component, hooks, misc, QWeb } = owl;
const { Portal } = misc;
const { useRef, useState } = hooks;
@@ -79,6 +81,10 @@ odoo.define('web.Popover', function () {
this._hasGlobalEventListeners = true;
}
_close() {
this.state.displayed = false;
}
/**
* Computes the popover according to its props. This method will try to position the
* popover as requested (according to the `position` props). If the requested position
@@ -184,7 +190,7 @@ odoo.define('web.Popover', function () {
if (this.popoverRef.el && this.popoverRef.el.contains(ev.target)) {
return;
}
this.state.displayed = false;
this._close();
}
/**
@@ -192,7 +198,7 @@ odoo.define('web.Popover', function () {
* @param {Event} ev
*/
_onPopoverClose(ev) {
this.state.displayed = false;
this._close();
}
/**
@@ -312,5 +318,5 @@ odoo.define('web.Popover', function () {
QWeb.registerComponent('Popover', Popover);
return Popover;
return patchMixin(Popover);
});