From 30d7766eeac69a4232fce352eefcce002b6beab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 18 Nov 2021 12:45:53 +0000 Subject: [PATCH] [IMP] mail,snailmail,web: remove t-on on component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preparation work to use OWL v2 in discuss code. Task-2694200 closes odoo/odoo#80024 Signed-off-by: Sébastien Theys (seb) --- .../src/components/activity/activity.js | 10 +++---- .../src/components/activity/activity.xml | 2 +- .../attachment_box/attachment_box.js | 11 ++++---- .../attachment_box/attachment_box.xml | 6 ++--- .../attachment_card/attachment_card.js | 4 +++ .../attachment_card/attachment_card.xml | 3 ++- .../attachment_delete_confirm_dialog.js | 14 +++++++++- .../attachment_delete_confirm_dialog.xml | 2 +- .../attachment_image/attachment_image.js | 4 +++ .../attachment_image/attachment_image.xml | 3 ++- .../attachment_list/attachment_list.js | 4 +++ .../attachment_list/attachment_list.xml | 4 +-- .../autocomplete_input/autocomplete_input.js | 16 ++++++++++-- .../autocomplete_input/autocomplete_input.xml | 2 +- .../src/components/chat_window/chat_window.js | 10 +++---- .../components/chat_window/chat_window.xml | 6 ++--- .../chat_window_header/chat_window_header.js | 8 +++++- .../chat_window_hidden_menu.js | 10 +++---- .../chat_window_hidden_menu.xml | 2 +- .../src/components/composer/composer.js | 26 +++++++++---------- .../src/components/composer/composer.xml | 10 +++---- .../composer_text_input.js | 20 +++++++++++--- .../composer_text_input.xml | 2 +- .../delete_message_confirm_dialog.xml | 4 +-- .../static/src/components/discuss/discuss.js | 18 ++++++------- .../static/src/components/discuss/discuss.xml | 4 +-- .../discuss_sidebar_category.xml | 2 +- .../src/components/drop_zone/drop_zone.js | 17 ++++++++---- .../emojis_popover/emojis_popover.js | 15 ++++++++--- .../components/file_uploader/file_uploader.js | 8 +++++- .../src/components/follower/follower.js | 4 +++ .../src/components/follower/follower.xml | 2 +- .../follower_list_menu/follower_list_menu.js | 1 + .../follower_list_menu/follower_list_menu.xml | 2 +- .../message_action_list.xml | 4 +-- .../messaging_menu/messaging_menu.js | 16 +++++------- .../messaging_menu/messaging_menu.xml | 4 +-- .../mobile_messaging_navbar.js | 12 ++++++--- .../rtc_call_viewer/rtc_call_viewer.xml | 4 +-- .../src/components/thread_view/thread_view.js | 4 +++ .../components/thread_view/thread_view.xml | 2 +- .../discuss_sidebar_category.js | 6 +---- .../message_action_list.js | 11 ++++---- .../static/src/components/message/message.js | 1 + .../static/src/components/message/message.xml | 2 +- .../snailmail_error_dialog.js | 4 +++ .../snailmail_error_dialog.xml | 2 +- .../static/src/legacy/js/core/owl_dialog.js | 10 +++++++ .../web/static/src/legacy/js/core/popover.js | 17 ++++++++++++ addons/web/static/src/legacy/xml/base.xml | 2 +- 50 files changed, 235 insertions(+), 122 deletions(-) diff --git a/addons/mail/static/src/components/activity/activity.js b/addons/mail/static/src/components/activity/activity.js index 73e7bfc8586..945cf13ff1c 100644 --- a/addons/mail/static/src/components/activity/activity.js +++ b/addons/mail/static/src/components/activity/activity.js @@ -26,6 +26,7 @@ export class Activity extends Component { * Useful to programmatically prompts the browser file uploader. */ this._fileUploaderRef = useRef('fileUploader'); + this._onAttachmentCreated = this._onAttachmentCreated.bind(this); } //-------------------------------------------------------------------------- @@ -105,12 +106,11 @@ export class Activity extends Component { /** * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {mail.attachment} ev.detail.attachment + * @param {Object} detail + * @param {mail.attachment} detail.attachment */ - _onAttachmentCreated(ev) { - this.activity.markAsDone({ attachments: [ev.detail.attachment] }); + _onAttachmentCreated(detail) { + this.activity.markAsDone({ attachments: [detail.attachment] }); } /** diff --git a/addons/mail/static/src/components/activity/activity.xml b/addons/mail/static/src/components/activity/activity.xml index 1147a841812..406b1355578 100644 --- a/addons/mail/static/src/components/activity/activity.xml +++ b/addons/mail/static/src/components/activity/activity.xml @@ -132,7 +132,7 @@ diff --git a/addons/mail/static/src/components/attachment_box/attachment_box.js b/addons/mail/static/src/components/attachment_box/attachment_box.js index 08e34196d4b..a73edcc2058 100644 --- a/addons/mail/static/src/components/attachment_box/attachment_box.js +++ b/addons/mail/static/src/components/attachment_box/attachment_box.js @@ -23,6 +23,7 @@ export class AttachmentBox extends Component { this._fileUploaderRef = useRef('fileUploader'); useComponentToModel({ fieldName: 'component', modelName: 'mail.attachment_box_view', propNameAsRecordLocalId: 'attachmentBoxViewLocalId' }); useRefToModel({ fieldName: 'fileUploaderRef', modelName: 'mail.attachment_box_view', propNameAsRecordLocalId: 'attachmentBoxViewLocalId', refName: 'fileUploader' }); + this._onDropZoneFilesDropped = this._onDropZoneFilesDropped.bind(this); } //-------------------------------------------------------------------------- @@ -42,13 +43,11 @@ export class AttachmentBox extends Component { /** * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {FileList} ev.detail.files + * @param {Object} detail + * @param {FileList} detail.files */ - async _onDropZoneFilesDropped(ev) { - ev.stopPropagation(); - await this._fileUploaderRef.comp.uploadFiles(ev.detail.files); + async _onDropZoneFilesDropped(detail) { + await this._fileUploaderRef.comp.uploadFiles(detail.files); this.isDropZoneVisible.value = false; } diff --git a/addons/mail/static/src/components/attachment_box/attachment_box.xml b/addons/mail/static/src/components/attachment_box/attachment_box.xml index 18394fb0b34..2e98c925e7d 100644 --- a/addons/mail/static/src/components/attachment_box/attachment_box.xml +++ b/addons/mail/static/src/components/attachment_box/attachment_box.xml @@ -15,7 +15,7 @@ @@ -23,7 +23,7 @@ diff --git a/addons/mail/static/src/components/attachment_image/attachment_image.js b/addons/mail/static/src/components/attachment_image/attachment_image.js index 164d7de8900..16d53f6f7a2 100644 --- a/addons/mail/static/src/components/attachment_image/attachment_image.js +++ b/addons/mail/static/src/components/attachment_image/attachment_image.js @@ -30,6 +30,10 @@ export class AttachmentImage extends Component { Object.assign(AttachmentImage, { props: { attachmentImageLocalId: String, + onAttachmentRemoved: { + type: Function, + optional: true, + }, }, template: 'mail.AttachmentImage', }); diff --git a/addons/mail/static/src/components/attachment_image/attachment_image.xml b/addons/mail/static/src/components/attachment_image/attachment_image.xml index 88f6a5658a2..f7b1bab0b85 100644 --- a/addons/mail/static/src/components/attachment_image/attachment_image.xml +++ b/addons/mail/static/src/components/attachment_image/attachment_image.xml @@ -35,7 +35,8 @@ diff --git a/addons/mail/static/src/components/attachment_list/attachment_list.js b/addons/mail/static/src/components/attachment_list/attachment_list.js index 978aade4a27..0a31361f90d 100644 --- a/addons/mail/static/src/components/attachment_list/attachment_list.js +++ b/addons/mail/static/src/components/attachment_list/attachment_list.js @@ -18,6 +18,10 @@ export class AttachmentList extends Component { Object.assign(AttachmentList, { props: { attachmentListLocalId: String, + onAttachmentRemoved: { + type: Function, + optional: true, + }, }, template: 'mail.AttachmentList', }); diff --git a/addons/mail/static/src/components/attachment_list/attachment_list.xml b/addons/mail/static/src/components/attachment_list/attachment_list.xml index 5c68fb7a754..d1724b094ba 100644 --- a/addons/mail/static/src/components/attachment_list/attachment_list.xml +++ b/addons/mail/static/src/components/attachment_list/attachment_list.xml @@ -6,12 +6,12 @@
- +
- +
diff --git a/addons/mail/static/src/components/autocomplete_input/autocomplete_input.js b/addons/mail/static/src/components/autocomplete_input/autocomplete_input.js index 1760220ffde..cad75ebec19 100644 --- a/addons/mail/static/src/components/autocomplete_input/autocomplete_input.js +++ b/addons/mail/static/src/components/autocomplete_input/autocomplete_input.js @@ -124,7 +124,9 @@ export class AutocompleteInput extends Component { * @param {MouseEvent} ev */ _onBlur(ev) { - this.trigger('o-hide'); + if (this.props.onHide) { + this.props.onHide(); + } } /** @@ -133,7 +135,9 @@ export class AutocompleteInput extends Component { */ _onKeydown(ev) { if (ev.key === 'Escape') { - this.trigger('o-hide'); + if (this.props.onHide) { + this.props.onHide(); + } } } @@ -156,6 +160,14 @@ Object.assign(AutocompleteInput, { }, isFocusOnMount: Boolean, isHtml: Boolean, + onFocusin: { + type: Function, + optional: true, + }, + onHide: { + type: Function, + optional: true, + }, placeholder: String, select: { type: Function, diff --git a/addons/mail/static/src/components/autocomplete_input/autocomplete_input.xml b/addons/mail/static/src/components/autocomplete_input/autocomplete_input.xml index 94a0abcb483..0946b325944 100644 --- a/addons/mail/static/src/components/autocomplete_input/autocomplete_input.xml +++ b/addons/mail/static/src/components/autocomplete_input/autocomplete_input.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/mail/static/src/components/chat_window/chat_window.js b/addons/mail/static/src/components/chat_window/chat_window.js index 05ccb21820e..245c76bb1ec 100644 --- a/addons/mail/static/src/components/chat_window/chat_window.js +++ b/addons/mail/static/src/components/chat_window/chat_window.js @@ -34,6 +34,8 @@ export class ChatWindow extends Component { // the following are passed as props to children this._onAutocompleteSelect = this._onAutocompleteSelect.bind(this); this._onAutocompleteSource = this._onAutocompleteSource.bind(this); + this._onClickedHeader = this._onClickedHeader.bind(this); + this._onFocusinThread = this._onFocusinThread.bind(this); } //-------------------------------------------------------------------------- @@ -179,10 +181,8 @@ export class ChatWindow extends Component { * window. * * @private - * @param {CustomEvent} ev */ - _onClickedHeader(ev) { - ev.stopPropagation(); + _onClickedHeader() { if (this.messaging.device.isMobile) { return; } @@ -199,10 +199,8 @@ export class ChatWindow extends Component { * Called when an element in the thread becomes focused. * * @private - * @param {FocusEvent} ev */ - _onFocusinThread(ev) { - ev.stopPropagation(); + _onFocusinThread() { if (!this.chatWindow) { // prevent crash on destroy return; diff --git a/addons/mail/static/src/components/chat_window/chat_window.xml b/addons/mail/static/src/components/chat_window/chat_window.xml index 91e0cffc62e..4b79e2e83e6 100644 --- a/addons/mail/static/src/components/chat_window/chat_window.xml +++ b/addons/mail/static/src/components/chat_window/chat_window.xml @@ -17,7 +17,7 @@ chatWindowLocalId="chatWindow.localId" hasCloseAsBackButton="props.hasCloseAsBackButton" isExpandable="props.isExpandable" - t-on-o-clicked="_onClickedHeader" + onClicked="_onClickedHeader" t-ref="header" /> @@ -32,7 +32,7 @@ hasComposerCurrentPartnerAvatar="false" hasComposerSendButton="messaging.device.isMobile" threadViewLocalId="chatWindow.threadView.localId" - t-on-focusin="_onFocusinThread" + onFocusin="_onFocusinThread" t-ref="thread" /> @@ -46,7 +46,7 @@ placeholder="newMessageFormInputPlaceholder" select="_onAutocompleteSelect" source="_onAutocompleteSource" - t-on-focusin="chatWindow.onFocusInNewMessageFormInput" + onFocusin="chatWindow.onFocusInNewMessageFormInput" t-ref="input" /> diff --git a/addons/mail/static/src/components/chat_window_header/chat_window_header.js b/addons/mail/static/src/components/chat_window_header/chat_window_header.js index e895c2321f5..b5287d4e047 100644 --- a/addons/mail/static/src/components/chat_window_header/chat_window_header.js +++ b/addons/mail/static/src/components/chat_window_header/chat_window_header.js @@ -60,7 +60,9 @@ export class ChatWindowHeader extends Component { return; } const chatWindow = this.chatWindow; - this.trigger('o-clicked', { chatWindow }); + if (this.props.onClicked) { + this.props.onClicked({ chatWindow }); + } } /** @@ -137,6 +139,10 @@ Object.assign(ChatWindowHeader, { chatWindowLocalId: String, hasCloseAsBackButton: Boolean, isExpandable: Boolean, + onClicked: { + type: Function, + optional: true, + }, }, template: 'mail.ChatWindowHeader', }); diff --git a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js index a6b6bea94ce..b5f5072c2be 100644 --- a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js +++ b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.js @@ -13,6 +13,7 @@ export class ChatWindowHiddenMenu extends Component { setup() { super.setup(); this._onClickCaptureGlobal = this._onClickCaptureGlobal.bind(this); + this._onClickedChatWindow = this._onClickedChatWindow.bind(this); /** * Reference of the dropup list. Useful to auto-set max height based on * browser screen height. @@ -109,12 +110,11 @@ export class ChatWindowHiddenMenu extends Component { /** * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {mail.chat_window} ev.detail.chatWindow + * @param {Object} detail + * @param {mail.chat_window} detail.chatWindow */ - _onClickedChatWindow(ev) { - const chatWindow = ev.detail.chatWindow; + _onClickedChatWindow(detail) { + const chatWindow = detail.chatWindow; chatWindow.makeActive(); this.messaging.chatWindowManager.closeHiddenMenu(); } diff --git a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.xml b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.xml index c0f59b071d9..44dfc7a1345 100644 --- a/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.xml +++ b/addons/mail/static/src/components/chat_window_hidden_menu/chat_window_hidden_menu.xml @@ -15,7 +15,7 @@ diff --git a/addons/mail/static/src/components/composer/composer.js b/addons/mail/static/src/components/composer/composer.js index 1625cb0b9d1..e6e32eceac2 100644 --- a/addons/mail/static/src/components/composer/composer.js +++ b/addons/mail/static/src/components/composer/composer.js @@ -36,6 +36,10 @@ export class Composer extends Component { this._onClickCaptureGlobal = this._onClickCaptureGlobal.bind(this); onMounted(() => this._mounted()); onWillUnmount(() => this._willUnmount()); + this._onDropZoneFilesDropped = this._onDropZoneFilesDropped.bind(this); + this._onComposerTextInputSendShortcut = this._onComposerTextInputSendShortcut.bind(this); + this._onPasteTextInput = this._onPasteTextInput.bind(this); + this._onEmojiSelection = this._onEmojiSelection.bind(this); } _mounted() { @@ -228,28 +232,24 @@ export class Composer extends Component { * Called when some files have been dropped in the dropzone. * * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {FileList} ev.detail.files + * @param {Object} detail + * @param {FileList} detail.files */ - async _onDropZoneFilesDropped(ev) { - ev.stopPropagation(); - await this._fileUploaderRef.comp.uploadFiles(ev.detail.files); + async _onDropZoneFilesDropped(detail) { + await this._fileUploaderRef.comp.uploadFiles(detail.files); this.isDropZoneVisible.value = false; } /** - * Handles `o-emoji-selection` event from the emoji popover. + * Handles `onEmojiSelection` callback from the emoji popover. * * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {string} ev.detail.unicode + * @param {Object} detail + * @param {string} detail.unicode */ - _onEmojiSelection(ev) { - ev.stopPropagation(); + _onEmojiSelection(detail) { this._textInputRef.comp.saveStateInStore(); - this.composerView.insertIntoTextInput(ev.detail.unicode); + this.composerView.insertIntoTextInput(detail.unicode); if (!this.messaging.device.isMobileDevice) { this.composerView.update({ doFocus: true }); } diff --git a/addons/mail/static/src/components/composer/composer.xml b/addons/mail/static/src/components/composer/composer.xml index 6d85d7529ca..f1769a58785 100644 --- a/addons/mail/static/src/components/composer/composer.xml +++ b/addons/mail/static/src/components/composer/composer.xml @@ -20,7 +20,7 @@ @@ -85,8 +85,8 @@ hasMentionSuggestionsBelowPosition="props.hasMentionSuggestionsBelowPosition" isCompact="props.isCompact" sendShortcuts="props.textInputSendShortcuts" - t-on-o-composer-text-input-send-shortcut="_onComposerTextInputSendShortcut" - t-on-paste="_onPasteTextInput" + onComposerTextInputSendShortcut="_onComposerTextInputSendShortcut" + onPaste="_onPasteTextInput" t-key="composerView.localId" t-ref="textInput" /> @@ -100,7 +100,7 @@
- + - + - + diff --git a/addons/mail/static/src/components/discuss/discuss.js b/addons/mail/static/src/components/discuss/discuss.js index 67ce61473cd..9b51bdb20ad 100644 --- a/addons/mail/static/src/components/discuss/discuss.js +++ b/addons/mail/static/src/components/discuss/discuss.js @@ -20,6 +20,8 @@ export class Discuss extends Component { this._onMobileAddItemHeaderInputSource = this._onMobileAddItemHeaderInputSource.bind(this); useUpdate({ func: () => this._update() }); onWillUnmount(() => this._willUnmount()); + this._onHideMobileAddItemHeader = this._onHideMobileAddItemHeader.bind(this); + this._onSelectMobileNavbarTab = this._onSelectMobileNavbarTab.bind(this); } _update() { @@ -132,10 +134,8 @@ export class Discuss extends Component { /** * @private - * @param {CustomEvent} ev */ - _onHideMobileAddItemHeader(ev) { - ev.stopPropagation(); + _onHideMobileAddItemHeader() { this.discuss.clearIsAddingItem(); } @@ -171,16 +171,14 @@ export class Discuss extends Component { /** * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {string} ev.detail.tabId + * @param {Object} detail + * @param {string} detail.tabId */ - _onSelectMobileNavbarTab(ev) { - ev.stopPropagation(); - if (this.discuss.activeMobileNavbarTabId === ev.detail.tabId) { + _onSelectMobileNavbarTab(detail) { + if (this.discuss.activeMobileNavbarTabId === detail.tabId) { return; } - this.discuss.update({ activeMobileNavbarTabId: ev.detail.tabId }); + this.discuss.update({ activeMobileNavbarTabId: detail.tabId }); if ( this.discuss.activeMobileNavbarTabId === 'mailbox' && (!this.discuss.thread || this.discuss.thread.model !== 'mailbox') diff --git a/addons/mail/static/src/components/discuss/discuss.xml b/addons/mail/static/src/components/discuss/discuss.xml index 392e366c90a..c95ef4995e1 100644 --- a/addons/mail/static/src/components/discuss/discuss.xml +++ b/addons/mail/static/src/components/discuss/discuss.xml @@ -39,7 +39,7 @@ placeholder="discuss.isAddingChannel ? addChannelInputPlaceholder : addChatInputPlaceholder" select="_onMobileAddItemHeaderInputSelect" source="_onMobileAddItemHeaderInputSource" - t-on-o-hide="_onHideMobileAddItemHeader" + onHide="_onHideMobileAddItemHeader" />
@@ -81,7 +81,7 @@ className="'o_Discuss_mobileNavbar'" activeTabId="discuss.activeMobileNavbarTabId" tabs="mobileNavbarTabs()" - t-on-o-select-mobile-messaging-navbar-tab="_onSelectMobileNavbarTab" + onSelectMobileMessagingNavbarTab="_onSelectMobileNavbarTab" /> diff --git a/addons/mail/static/src/components/discuss_sidebar_category/discuss_sidebar_category.xml b/addons/mail/static/src/components/discuss_sidebar_category/discuss_sidebar_category.xml index f4093ffe6d3..fc7b4753415 100644 --- a/addons/mail/static/src/components/discuss_sidebar_category/discuss_sidebar_category.xml +++ b/addons/mail/static/src/components/discuss_sidebar_category/discuss_sidebar_category.xml @@ -35,7 +35,7 @@ placeholder="category.newItemPlaceholderText" select="category.onAddItemAutocompleteSelect" source="category.onAddItemAutocompleteSource" - t-on-o-hide="category.onHideAddingItem" + onHide="category.onHideAddingItem" />
diff --git a/addons/mail/static/src/components/drop_zone/drop_zone.js b/addons/mail/static/src/components/drop_zone/drop_zone.js index 0fcc52117b9..978c2a8c5d0 100644 --- a/addons/mail/static/src/components/drop_zone/drop_zone.js +++ b/addons/mail/static/src/components/drop_zone/drop_zone.js @@ -106,7 +106,7 @@ export class DropZone extends Component { } /** - * Triggers the `o-dropzone-files-dropped` event when new files are dropped + * Trigger callback 'props.onDropzoneFilesDropped' with event when new files are dropped * on the dropzone, and then removes the visual drop effect. * * The parents should handle this event to process the files as they wish, @@ -118,9 +118,11 @@ export class DropZone extends Component { _onDrop(ev) { ev.preventDefault(); if (this._isDragSourceExternalFile(ev.dataTransfer)) { - this.trigger('o-dropzone-files-dropped', { - files: ev.dataTransfer.files, - }); + if (this.props.onDropzoneFilesDropped) { + this.props.onDropzoneFilesDropped({ + files: ev.dataTransfer.files, + }); + } } this.state.isDraggingInside = false; } @@ -128,7 +130,12 @@ export class DropZone extends Component { } Object.assign(DropZone, { - props: {}, + props: { + onDropzoneFilesDropped: { + type: Function, + optional: true, + }, + }, template: 'mail.DropZone', }); diff --git a/addons/mail/static/src/components/emojis_popover/emojis_popover.js b/addons/mail/static/src/components/emojis_popover/emojis_popover.js index 528545d6219..efb1ce8e26f 100644 --- a/addons/mail/static/src/components/emojis_popover/emojis_popover.js +++ b/addons/mail/static/src/components/emojis_popover/emojis_popover.js @@ -56,15 +56,22 @@ export class EmojisPopover extends Component { */ _onClickEmoji(ev) { this.close(); - this.trigger('o-emoji-selection', { - unicode: ev.currentTarget.dataset.unicode, - }); + if (this.props.onEmojiSelection) { + this.props.onEmojiSelection({ + unicode: ev.currentTarget.dataset.unicode, + }); + } } } Object.assign(EmojisPopover, { - props: {}, + props: { + onEmojiSelection: { + type: Function, + optional: true, + }, + }, template: 'mail.EmojisPopover', }); diff --git a/addons/mail/static/src/components/file_uploader/file_uploader.js b/addons/mail/static/src/components/file_uploader/file_uploader.js index 59426188a23..b9417fd74ef 100644 --- a/addons/mail/static/src/components/file_uploader/file_uploader.js +++ b/addons/mail/static/src/components/file_uploader/file_uploader.js @@ -154,7 +154,9 @@ export class FileUploader extends Component { originThread: (!composer && thread) ? replace(thread) : undefined, ...attachmentData, }); - this.trigger('o-attachment-created', { attachment }); + if (this.props.onAttachmentCreated) { + this.props.onAttachmentCreated({ attachment }); + } } /** @@ -177,6 +179,10 @@ Object.assign(FileUploader, { type: String, optional: true, }, + onAttachmentCreated: { + type: Function, + optional: true, + }, threadLocalId: { type: String, optional: true, diff --git a/addons/mail/static/src/components/follower/follower.js b/addons/mail/static/src/components/follower/follower.js index 38db4604396..baae2fa6353 100644 --- a/addons/mail/static/src/components/follower/follower.js +++ b/addons/mail/static/src/components/follower/follower.js @@ -53,6 +53,10 @@ export class Follower extends Component { Object.assign(Follower, { props: { followerLocalId: String, + onClick: { + type: Function, + optional: true, + }, }, template: 'mail.Follower', }); diff --git a/addons/mail/static/src/components/follower/follower.xml b/addons/mail/static/src/components/follower/follower.xml index bda08143d2d..a27bdf720f8 100644 --- a/addons/mail/static/src/components/follower/follower.xml +++ b/addons/mail/static/src/components/follower/follower.xml @@ -2,7 +2,7 @@ -
+
Avatar diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js index 77fa78694ce..fa4199903e1 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js @@ -22,6 +22,7 @@ export class FollowerListMenu extends Component { this._onClickCaptureGlobal = this._onClickCaptureGlobal.bind(this); onMounted(() => this._mounted()); onWillUnmount(() => this._willUnmount()); + this._onClickFollower = this._onClickFollower.bind(this); } _mounted() { diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml index 70998eb61af..c8104e7e104 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.xml @@ -22,7 +22,7 @@ diff --git a/addons/mail/static/src/components/message_action_list/message_action_list.xml b/addons/mail/static/src/components/message_action_list/message_action_list.xml index ea4e7025579..37e0b1e9cac 100644 --- a/addons/mail/static/src/components/message_action_list/message_action_list.xml +++ b/addons/mail/static/src/components/message_action_list/message_action_list.xml @@ -3,9 +3,9 @@
- + - +
@@ -59,7 +59,7 @@ className="'o_MessagingMenu_mobileNavbar'" activeTabId="messagingMenu.activeTabId" tabs="tabs" - t-on-o-select-mobile-messaging-navbar-tab="_onSelectMobileNavbarTab" + onSelectMobileMessagingNavbarTab="_onSelectMobileNavbarTab" />
diff --git a/addons/mail/static/src/components/mobile_messaging_navbar/mobile_messaging_navbar.js b/addons/mail/static/src/components/mobile_messaging_navbar/mobile_messaging_navbar.js index 3f0656794a3..98b7dceca18 100644 --- a/addons/mail/static/src/components/mobile_messaging_navbar/mobile_messaging_navbar.js +++ b/addons/mail/static/src/components/mobile_messaging_navbar/mobile_messaging_navbar.js @@ -15,9 +15,11 @@ export class MobileMessagingNavbar extends Component { * @param {MouseEvent} ev */ _onClick(ev) { - this.trigger('o-select-mobile-messaging-navbar-tab', { - tabId: ev.currentTarget.dataset.tabId, - }); + if (this.props.onSelectMobileMessagingNavbarTab) { + this.props.onSelectMobileMessagingNavbarTab({ + tabId: ev.currentTarget.dataset.tabId, + }); + } } } @@ -28,6 +30,10 @@ Object.assign(MobileMessagingNavbar, { }, props: { activeTabId: String, + onSelectMobileMessagingNavbarTab: { + type: Function, + optional: true, + }, tabs: { type: Array, element: { diff --git a/addons/mail/static/src/components/rtc_call_viewer/rtc_call_viewer.xml b/addons/mail/static/src/components/rtc_call_viewer/rtc_call_viewer.xml index a1b71dd1ce8..558c64d5ebc 100644 --- a/addons/mail/static/src/components/rtc_call_viewer/rtc_call_viewer.xml +++ b/addons/mail/static/src/components/rtc_call_viewer/rtc_call_viewer.xml @@ -51,7 +51,7 @@ - + @@ -59,7 +59,7 @@ - + diff --git a/addons/mail/static/src/components/thread_view/thread_view.js b/addons/mail/static/src/components/thread_view/thread_view.js index 714738523ba..1a4a719cdd8 100644 --- a/addons/mail/static/src/components/thread_view/thread_view.js +++ b/addons/mail/static/src/components/thread_view/thread_view.js @@ -128,6 +128,10 @@ Object.assign(ThreadView, { type: Boolean, optional: true, }, + onFocusin: { + type: Function, + optional: true, + }, showComposerAttachmentsExtensions: Boolean, showComposerAttachmentsFilenames: Boolean, threadViewLocalId: String, diff --git a/addons/mail/static/src/components/thread_view/thread_view.xml b/addons/mail/static/src/components/thread_view/thread_view.xml index 8b07effd394..ddd001938ee 100644 --- a/addons/mail/static/src/components/thread_view/thread_view.xml +++ b/addons/mail/static/src/components/thread_view/thread_view.xml @@ -2,7 +2,7 @@ -
+
diff --git a/addons/mail/static/src/models/discuss_sidebar_category/discuss_sidebar_category.js b/addons/mail/static/src/models/discuss_sidebar_category/discuss_sidebar_category.js index 9717b75b163..eb7b88648d8 100644 --- a/addons/mail/static/src/models/discuss_sidebar_category/discuss_sidebar_category.js +++ b/addons/mail/static/src/models/discuss_sidebar_category/discuss_sidebar_category.js @@ -182,11 +182,7 @@ registerModel({ await this.open(); } }, - /** - * @param {CustomEvent} ev - */ - onHideAddingItem(ev) { - ev.stopPropagation(); + onHideAddingItem() { this.update({ isAddingItem: false }); }, /** diff --git a/addons/mail/static/src/models/message_action_list/message_action_list.js b/addons/mail/static/src/models/message_action_list/message_action_list.js index 0142c2bd622..f95a02fa8ce 100644 --- a/addons/mail/static/src/models/message_action_list/message_action_list.js +++ b/addons/mail/static/src/models/message_action_list/message_action_list.js @@ -103,15 +103,14 @@ registerModel({ this.update({ showDeleteConfirm: false }); }, /** - * Handles `o-emoji-selection` event from the emoji popover. + * Handles `onEmojiSelection` calback from the emoji popover. * * @private - * @param {CustomEvent} ev - * @param {Object} ev.detail - * @param {string} ev.detail.unicode + * @param {Object} detail + * @param {string} detail.unicode */ - onEmojiSelection(ev) { - this.message.addReaction(ev.detail.unicode); + onEmojiSelection(detail) { + this.message.addReaction(detail.unicode); }, /** * @private diff --git a/addons/snailmail/static/src/components/message/message.js b/addons/snailmail/static/src/components/message/message.js index 3246eb38aa7..ad7630b5c61 100644 --- a/addons/snailmail/static/src/components/message/message.js +++ b/addons/snailmail/static/src/components/message/message.js @@ -12,6 +12,7 @@ patch(Message.prototype, 'snailmail/static/src/components/message/message.js', { */ setup() { this._super(); + this._onDialogClosedSnailmailError = this._onDialogClosedSnailmailError.bind(this); this.snailmailState = useState({ // Determine if the error dialog is displayed. hasDialog: false, diff --git a/addons/snailmail/static/src/components/message/message.xml b/addons/snailmail/static/src/components/message/message.xml index fb2f16c471d..21710a7eb99 100644 --- a/addons/snailmail/static/src/components/message/message.xml +++ b/addons/snailmail/static/src/components/message/message.xml @@ -18,7 +18,7 @@ - + diff --git a/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.js b/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.js index d6b695b7633..712870ebaab 100644 --- a/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.js +++ b/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.js @@ -78,6 +78,10 @@ Object.assign(SnailmailErrorDialog, { components: { Dialog }, props: { messageLocalId: String, + onClosed: { + type: Function, + optional: true, + }, }, template: 'snailmail.SnailmailErrorDialog', }); diff --git a/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.xml b/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.xml index af82d87e4f5..4e7297fe4a2 100644 --- a/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.xml +++ b/addons/snailmail/static/src/components/snailmail_error_dialog/snailmail_error_dialog.xml @@ -2,7 +2,7 @@ - +

diff --git a/addons/web/static/src/legacy/js/core/owl_dialog.js b/addons/web/static/src/legacy/js/core/owl_dialog.js index 5939b18c098..d5f15bf90d8 100644 --- a/addons/web/static/src/legacy/js/core/owl_dialog.js +++ b/addons/web/static/src/legacy/js/core/owl_dialog.js @@ -105,6 +105,9 @@ odoo.define('web.OwlDialog', function (require) { * @private */ _close() { + if (this.props.onClosed) { + this.props.onClosed(); + } this.trigger('dialog-closed'); } @@ -149,6 +152,12 @@ odoo.define('web.OwlDialog', function (require) { } } + _onDialogClosed() { + if (this.props.onClosed) { + this.props.onClosed(); + } + } + /** * @private */ @@ -248,6 +257,7 @@ odoo.define('web.OwlDialog', function (require) { backdrop: { validate: b => ['static', true, false].includes(b) }, contentClass: { type: String, optional: 1 }, fullscreen: { type: Boolean, optional: 1 }, + onClosed: { type: Function, optional: 1 }, renderFooter: Boolean, renderHeader: Boolean, size: { validate: s => ['extra-large', 'large', 'medium', 'small'].includes(s) }, diff --git a/addons/web/static/src/legacy/js/core/popover.js b/addons/web/static/src/legacy/js/core/popover.js index 3c6a4386364..e0bc95e6b5c 100644 --- a/addons/web/static/src/legacy/js/core/popover.js +++ b/addons/web/static/src/legacy/js/core/popover.js @@ -81,6 +81,9 @@ odoo.define('web.Popover', function (require) { _close() { this.state.displayed = false; + if (this.props.onClosed) { + this.props.onClosed(); + } this.trigger('o-popover-closed'); } @@ -173,8 +176,14 @@ odoo.define('web.Popover', function (require) { _onClick(ev) { this.state.displayed = !this.state.displayed; if (this.state.displayed) { + if (this.props.onOpened) { + this.props.onOpened(); + } this.trigger('o-popover-opened'); } else { + if (this.props.onClosed) { + this.props.onClosed(); + } this.trigger('o-popover-closed'); } } @@ -319,6 +328,14 @@ odoo.define('web.Popover', function (require) { position: 'bottom', }; Popover.props = { + onClosed: { + type: Function, + optional: true, + }, + onOpened: { + type: Function, + optional: true, + }, popoverClass: { type: String, optional: true, diff --git a/addons/web/static/src/legacy/xml/base.xml b/addons/web/static/src/legacy/xml/base.xml index 164c0d9958b..eb34cb1563b 100644 --- a/addons/web/static/src/legacy/xml/base.xml +++ b/addons/web/static/src/legacy/xml/base.xml @@ -242,7 +242,7 @@ -

+