@webitel/ui-chats 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
v-if="!props.withoutAvatars"
|
|
14
14
|
class="chat-message__avatar-wrapper"
|
|
15
15
|
>
|
|
16
|
-
<
|
|
16
|
+
<wt-avatar
|
|
17
17
|
v-if="props.showAvatar"
|
|
18
|
-
:bot="isBot"
|
|
19
18
|
:username="getClientUsername"
|
|
19
|
+
:size="size"
|
|
20
|
+
:src="ComponentSize.SM || size"
|
|
21
|
+
:bot="isBot"
|
|
20
22
|
/>
|
|
21
23
|
</div>
|
|
22
24
|
<!-- click.stop prevents focus on textarea and allows to select the message-new text -->
|
|
@@ -54,19 +56,18 @@
|
|
|
54
56
|
</template>
|
|
55
57
|
|
|
56
58
|
<script setup lang="ts">
|
|
57
|
-
import { ComponentSize } from
|
|
58
|
-
import { computed, defineEmits, defineProps, inject } from
|
|
59
|
-
|
|
60
|
-
import type { ChatMessageType } from
|
|
61
|
-
import { useChatMessageFile } from
|
|
62
|
-
import { MessageAction } from
|
|
63
|
-
import
|
|
64
|
-
import
|
|
65
|
-
import
|
|
66
|
-
import
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import MessageTime from "./details/chat-message-time.vue";
|
|
59
|
+
import { ComponentSize } from '@webitel/ui-sdk/enums';
|
|
60
|
+
import { computed, defineEmits, defineProps, inject } from 'vue';
|
|
61
|
+
|
|
62
|
+
import type { ChatMessageType } from '../../../types/ChatMessage.types';
|
|
63
|
+
import { useChatMessageFile } from '../composables/useChatMessageFile';
|
|
64
|
+
import { MessageAction } from '../enums/MessageAction.enum';
|
|
65
|
+
import MessageBlockedError from './details/chat-message-blocked-error.vue';
|
|
66
|
+
import MessageDocument from './details/chat-message-document.vue';
|
|
67
|
+
import MessageImage from './details/chat-message-image.vue';
|
|
68
|
+
import MessagePlayer from './details/chat-message-player.vue';
|
|
69
|
+
import MessageText from './details/chat-message-text.vue';
|
|
70
|
+
import MessageTime from './details/chat-message-time.vue';
|
|
70
71
|
|
|
71
72
|
const props = withDefaults(
|
|
72
73
|
defineProps<{
|
|
@@ -78,7 +79,7 @@ const props = withDefaults(
|
|
|
78
79
|
{
|
|
79
80
|
showAvatar: false,
|
|
80
81
|
withoutAvatars: false,
|
|
81
|
-
username:
|
|
82
|
+
username: '',
|
|
82
83
|
},
|
|
83
84
|
);
|
|
84
85
|
|
|
@@ -87,17 +88,17 @@ const emit = defineEmits<{
|
|
|
87
88
|
(e: typeof MessageAction.InitializedPlayer, player: object): void;
|
|
88
89
|
}>();
|
|
89
90
|
|
|
90
|
-
const size = inject<ComponentSize>(
|
|
91
|
+
const size = inject<ComponentSize>('size');
|
|
91
92
|
|
|
92
93
|
const { image, media, document } = useChatMessageFile(props.message.file);
|
|
93
94
|
|
|
94
95
|
const isSelfSide = computed<boolean>(
|
|
95
|
-
() => props.message.member?.self || props.message.member?.type ===
|
|
96
|
+
() => props.message.member?.self || props.message.member?.type === 'webitel',
|
|
96
97
|
);
|
|
97
|
-
const isBot = computed<boolean>(() => props.message.member?.type ===
|
|
98
|
+
const isBot = computed<boolean>(() => props.message.member?.type === 'bot');
|
|
98
99
|
|
|
99
100
|
const getClientUsername = computed<string>(() => {
|
|
100
|
-
return !isSelfSide.value ? props.username :
|
|
101
|
+
return !isSelfSide.value ? props.username : ''; // need to show username avatar only for client
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
function handlePlayerInitialize(player) {
|
|
@@ -134,11 +135,7 @@ function handlePlayerInitialize(player) {
|
|
|
134
135
|
.chat-message__avatar-wrapper {
|
|
135
136
|
flex: 0 0 var(--spacing-lg);
|
|
136
137
|
width: var(--wt-avatar-size--size-sm);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.chat-message-avatar {
|
|
140
|
-
width: 100%;
|
|
141
|
-
flex: 0 0 var(--icon-lg-size);
|
|
138
|
+
pointer-events: none; // prevents dragging to upload file area
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
.chat-message--right .chat-message__content {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { ChatMessageType } from
|
|
1
|
+
import type { ChatMessageType } from '../../../types/ChatMessage.types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
message: ChatMessageType;
|
|
4
4
|
showAvatar?: boolean;
|
|
5
5
|
withoutAvatars?: boolean;
|
|
6
6
|
username?: string;
|
|
7
7
|
};
|
|
8
|
-
declare var __VLS_1: {},
|
|
8
|
+
declare var __VLS_1: {}, __VLS_45: {};
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
'before-message'?: (props: typeof __VLS_1) => any;
|
|
11
11
|
} & {
|
|
12
|
-
'after-message'?: (props: typeof
|
|
12
|
+
'after-message'?: (props: typeof __VLS_45) => any;
|
|
13
13
|
};
|
|
14
14
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
15
15
|
clickOnImage: () => any;
|
|
@@ -18,9 +18,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
18
18
|
onClickOnImage?: () => any;
|
|
19
19
|
onInitializedPlayer?: (player: object) => any;
|
|
20
20
|
}>, {
|
|
21
|
-
username: string;
|
|
22
21
|
showAvatar: boolean;
|
|
23
22
|
withoutAvatars: boolean;
|
|
23
|
+
username: string;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="chat-message-avatar"
|
|
4
|
-
>
|
|
5
|
-
<wt-avatar
|
|
6
|
-
:username="props.username"
|
|
7
|
-
:size="size"
|
|
8
|
-
:src="src"
|
|
9
|
-
/>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
import { WtAvatar } from "@webitel/ui-sdk/components";
|
|
15
|
-
import { ComponentSize } from "@webitel/ui-sdk/enums";
|
|
16
|
-
import { computed, defineProps, inject } from "vue";
|
|
17
|
-
|
|
18
|
-
import botIcon from "../../../../../../assets/icons/bot.svg";
|
|
19
|
-
|
|
20
|
-
const props = withDefaults(
|
|
21
|
-
defineProps<{
|
|
22
|
-
bot?: boolean;
|
|
23
|
-
username?: string;
|
|
24
|
-
}>(),
|
|
25
|
-
{
|
|
26
|
-
bot: false,
|
|
27
|
-
username: "",
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const injectedSize = inject<ComponentSize>("size");
|
|
32
|
-
|
|
33
|
-
const size = computed(() => {
|
|
34
|
-
return ComponentSize.SM || injectedSize; // todo: should injected size be considered?
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const src = computed(() => props.bot && botIcon);
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<style lang="scss" scoped>
|
|
41
|
-
.chat-message-avatar {
|
|
42
|
-
pointer-events: none; // prevents dragging to upload file area
|
|
43
|
-
}
|
|
44
|
-
</style>
|