[IMP] mail: better typing for composer and use Ref typedef

This PR complete the type definition for the props of the composer and replace
the custom Object by Ref type in the relevant place.

closes odoo/odoo#119593

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Didier (did)
2023-04-25 14:07:30 +02:00
parent eaacaf122d
commit 95b6b91fca
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -29,6 +29,15 @@ export const LONG_TYPING = 50000;
* @typedef {Object} Props
* @property {import("@mail/composer/composer_model").Composer} composer
* @property {import("@mail/utils/hooks").MessageToReplyTo} messageToReplyTo
* @property {import("@mail/utils/hooks").MessageEdition} [messageEdition]
* @property {'compact'|'normal'|'extended'} [mode] default: 'normal'
* @property {string} [placeholder]
* @property {string} [className]
* @property {function} [onDiscardCallback]
* @property {function} [onPostCallback]
* @property {Component} [messageComponent]
* @property {number} [autofocus]
* @property {import("@web/core/utils/hooks").Ref} [dropzoneRef]
* @extends {Component<Props, Env>}
*/
export class Composer extends Component {
@@ -41,7 +50,7 @@ export class Composer extends Component {
static defaultProps = {
mode: "normal",
className: "",
}; // mode = compact, normal, extended
};
static props = [
"composer",
"autofocus?",
@@ -22,7 +22,7 @@ import { escapeRegExp } from "@web/core/utils/strings";
/**
*
* @param {{ el:HTMLElement }} [ref]
* @param {import("@web/core/utils/hooks").Ref} [ref]
* @param {Object} props
* @param {import("@web/core/popover/popover_service").PopoverServiceAddOptions} [options]
* @param {function} [props.onSelect]
@@ -42,7 +42,7 @@ export function useEmojiPicker(ref, props, options = {}) {
};
/**
* @param {{ el: HTMLElement }} ref
* @param {import("@web/core/utils/hooks").Ref} ref
*/
function add(ref, onSelect, { show = false } = {}) {
const toggler = () => toggle(ref, onSelect);