feat: remove usage of .sync and define explicitly emits (#10209)

References

- https://v3-migration.vuejs.org/breaking-changes/v-model
-
https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html
This commit is contained in:
Shivam Mishra
2024-10-03 12:44:18 +05:30
committed by GitHub
parent edc1fe2363
commit b8d0252511
82 changed files with 224 additions and 221 deletions

View File

@@ -1,20 +1,20 @@
<script>
import { defineModel } from 'vue';
import { useVuelidate } from '@vuelidate/core';
import { required, minLength, email } from '@vuelidate/validators';
import { useAlert } from 'dashboard/composables';
export default {
props: {
show: {
type: Boolean,
default: false,
},
currentChat: {
type: Object,
default: () => ({}),
},
},
emits: ['cancel'],
setup() {
return { v$: useVuelidate() };
const show = defineModel('show', { type: Boolean, default: false });
return { v$: useVuelidate(), show };
},
data() {
return {
@@ -80,9 +80,8 @@ export default {
};
</script>
<!-- eslint-disable vue/no-mutating-props -->
<template>
<woot-modal :show.sync="show" :on-close="onCancel">
<woot-modal v-model:show="show" :on-close="onCancel">
<div class="flex flex-col h-auto overflow-auto">
<woot-modal-header
:header-title="$t('EMAIL_TRANSCRIPT.TITLE')"

View File

@@ -547,9 +547,9 @@ export default {
</div>
</div>
<ReplyBox
v-model:popout-reply-box="isPopOutReplyBox"
:conversation-id="currentChat.id"
:popout-reply-box.sync="isPopOutReplyBox"
@togglePopout="showPopOutReplyBox"
@toggle-popout="showPopOutReplyBox"
/>
</div>
</div>

View File

@@ -1,5 +1,6 @@
<script>
import { defineAsyncComponent } from 'vue';
// [TODO] The popout events are needlessly complex and should be simplified
import { defineAsyncComponent, defineModel } from 'vue';
import { mapGetters } from 'vuex';
import { useAlert } from 'dashboard/composables';
import { useUISettings } from 'dashboard/composables/useUISettings';
@@ -65,12 +66,7 @@ export default {
ArticleSearchPopover,
},
mixins: [inboxMixin, fileUploadMixin, keyboardEventListenerMixins],
props: {
popoutReplyBox: {
type: Boolean,
default: false,
},
},
emits: ['update:popoutReplyBox', 'togglePopout'],
setup() {
const {
uiSettings,
@@ -79,8 +75,14 @@ export default {
fetchSignatureFlagFromUISettings,
} = useUISettings();
const popoutReplyBox = defineModel('popoutReplyBox', {
type: Boolean,
default: false,
});
return {
uiSettings,
popoutReplyBox,
updateUISettings,
isEditorHotKeyEnabled,
fetchSignatureFlagFromUISettings,
@@ -1081,15 +1083,15 @@ export default {
:banner-message="$t('CONVERSATION.NOT_ASSIGNED_TO_YOU')"
has-action-button
:action-button-label="$t('CONVERSATION.ASSIGN_TO_ME')"
@primaryAction="onClickSelfAssign"
@primary-action="onClickSelfAssign"
/>
<ReplyTopPanel
:mode="replyType"
:is-message-length-reaching-threshold="isMessageLengthReachingThreshold"
:characters-remaining="charactersRemaining"
:popout-reply-box="popoutReplyBox"
@setReplyMode="setReplyMode"
@togglePopout="$emit('togglePopout')"
@set-reply-mode="setReplyMode"
@toggle-popout="$emit('togglePopout')"
/>
<ArticleSearchPopover
v-if="showArticleSearchPopover && connectedPortalSlug"

View File

@@ -17,6 +17,7 @@ export default {
default: '',
},
},
emits: ['update:bccEmails', 'update:ccEmails', 'update:toEmails'],
setup() {
return { v$: useVuelidate() };
},

View File

@@ -1,4 +1,5 @@
<script>
import { defineModel } from 'vue';
import TemplatesPicker from './TemplatesPicker.vue';
import TemplateParser from './TemplateParser.vue';
export default {
@@ -11,10 +12,12 @@ export default {
type: Number,
default: undefined,
},
show: {
type: Boolean,
default: true,
},
},
emits: ['onSend', 'cancel'],
setup() {
const show = defineModel('show', { type: Boolean, default: false });
return { show };
},
data() {
return {
@@ -47,9 +50,8 @@ export default {
};
</script>
<!-- eslint-disable vue/no-mutating-props -->
<template>
<woot-modal :show.sync="show" :on-close="onClose" size="modal-big">
<woot-modal v-model:show="show" :on-close="onClose" size="modal-big">
<woot-modal-header
:header-title="$t('WHATSAPP_TEMPLATES.MODAL.TITLE')"
:header-content="modalHeaderContent"
@@ -58,13 +60,13 @@ export default {
<TemplatesPicker
v-if="!selectedWaTemplate"
:inbox-id="inboxId"
@onSelect="pickTemplate"
@on-select="pickTemplate"
/>
<TemplateParser
v-else
:template="selectedWaTemplate"
@resetTemplate="onResetTemplate"
@sendMessage="onSendMessage"
@reset-template="onResetTemplate"
@send-message="onSendMessage"
/>
</div>
</woot-modal>

View File

@@ -26,7 +26,7 @@ export default {
<template>
<div class="image message-text__wrap">
<img :src="url" @click="onClick" @error="$emit('error')" />
<woot-modal full-width :show.sync="show" :on-close="onClose">
<woot-modal v-model:show="show" full-width :on-close="onClose">
<img :src="url" class="modal-image skip-context-menu" />
</woot-modal>
</div>

View File

@@ -116,7 +116,7 @@ export default {
</audio>
<GalleryView
v-if="show"
:show.sync="show"
v-model:show="show"
:attachment="attachment"
:all-attachments="filteredCurrentChatAttachments"
@error="onImgError"

View File

@@ -106,7 +106,7 @@ export default {
</button>
<GalleryView
v-if="showGalleryViewer"
:show.sync="showGalleryViewer"
v-model:show="showGalleryViewer"
:attachment="attachment"
:all-attachments="availableAttachments"
@error="onClose"

View File

@@ -30,7 +30,7 @@ export default {
<template>
<div class="video message-text__wrap">
<video ref="videoElement" :src="url" muted playsInline @click="onClick" />
<woot-modal :show.sync="show" :on-close="onClose">
<woot-modal v-model:show="show" :on-close="onClose">
<video
:src="url"
controls

View File

@@ -7,10 +7,6 @@ import { messageTimestamp } from 'shared/helpers/timeHelper';
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
const props = defineProps({
show: {
type: Boolean,
required: true,
},
attachment: {
type: Object,
required: true,
@@ -22,6 +18,7 @@ const props = defineProps({
});
const emit = defineEmits(['close']);
const show = defineModel('show', { type: Boolean, default: false });
const getters = useStoreGetters();
@@ -208,11 +205,10 @@ onMounted(() => {
});
</script>
<!-- eslint-disable vue/no-mutating-props -->
<template>
<woot-modal
v-model:show="show"
full-width
:show.sync="show"
:show-close-button="false"
:on-close="onClose"
>

View File

@@ -240,7 +240,7 @@ export default {
{{ $t('BULK_ACTION.ALL_CONVERSATIONS_SELECTED_ALERT') }}
</div>
<woot-modal
:show.sync="showCustomTimeSnoozeModal"
v-model:show="showCustomTimeSnoozeModal"
:on-close="hideCustomSnoozeModal"
>
<CustomSnoozeModal

View File

@@ -122,7 +122,7 @@ onMounted(() => {
@unlinkIssue="unlinkIssue"
/>
<woot-modal
:show.sync="shouldShowPopup"
v-model:show="shouldShowPopup"
:on-close="closePopup"
:close-on-backdrop-click="false"
class="!items-start [&>div]:!top-12 [&>div]:sticky"