@webitel/ui-chats 0.1.4 → 0.1.5
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 +1 -1
- package/src/ui/the-chat-container.vue +39 -43
package/package.json
CHANGED
|
@@ -1,53 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class="the-chat-container">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
<slot name="main">
|
|
4
|
+
<dropzone
|
|
5
|
+
v-if="!isDropzoneDisabled && isDropzoneVisible"
|
|
6
|
+
@dragenter.prevent
|
|
7
|
+
@dragleave.prevent="handleDragLeave"
|
|
8
|
+
@drop="sendFile"
|
|
9
|
+
/>
|
|
10
|
+
<messages-container
|
|
11
|
+
:messages="props.messages"
|
|
12
|
+
:next="props.canLoadNextMessages"
|
|
13
|
+
:is-loading="props.isNextMessagesLoading"
|
|
14
|
+
:without-avatars="props.withoutAvatars"
|
|
15
|
+
@[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
|
|
16
|
+
/>
|
|
17
|
+
</slot>
|
|
18
|
+
<slot name="footer">
|
|
19
|
+
<chat-footer-wrapper v-if="!props.readonly">
|
|
20
|
+
<template #default>
|
|
21
|
+
<chat-text-field
|
|
22
|
+
v-model:text="draft"
|
|
23
|
+
@enter="sendMessage"
|
|
12
24
|
/>
|
|
13
|
-
<
|
|
14
|
-
:
|
|
15
|
-
|
|
16
|
-
:is-loading="props.isNextMessagesLoading"
|
|
17
|
-
:without-avatars="props.withoutAvatars"
|
|
18
|
-
@[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
|
|
25
|
+
<chat-input-actions-bar
|
|
26
|
+
:actions="props.chatActions"
|
|
27
|
+
@[ChatAction.SendMessage]="sendMessage"
|
|
19
28
|
@[ChatAction.AttachFiles]="sendFile"
|
|
20
|
-
/>
|
|
21
|
-
</slot>
|
|
22
|
-
<slot name="footer">
|
|
23
|
-
<chat-footer-wrapper
|
|
24
|
-
v-if="chatActions.includes(ChatAction.SendMessage)"
|
|
25
29
|
>
|
|
26
|
-
<template
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
<template
|
|
31
|
+
v-for="action in slottedChatActions"
|
|
32
|
+
:key="action"
|
|
33
|
+
#[action]="{ size }"
|
|
34
|
+
>
|
|
35
|
+
<slot
|
|
36
|
+
:name="`action:${action}`"
|
|
37
|
+
v-bind="{ size }"
|
|
30
38
|
/>
|
|
31
|
-
<chat-input-actions-bar
|
|
32
|
-
:actions="props.chatActions"
|
|
33
|
-
@[ChatAction.SendMessage]="sendMessage"
|
|
34
|
-
@[ChatAction.AttachFiles]="sendFile"
|
|
35
|
-
>
|
|
36
|
-
<template
|
|
37
|
-
v-for="action in slottedChatActions"
|
|
38
|
-
:key="action"
|
|
39
|
-
#[action]="{ size }"
|
|
40
|
-
>
|
|
41
|
-
<slot
|
|
42
|
-
:name="`action:${action}`"
|
|
43
|
-
v-bind="{ size }"
|
|
44
|
-
/>
|
|
45
|
-
</template>
|
|
46
|
-
</chat-input-actions-bar>
|
|
47
39
|
</template>
|
|
48
|
-
</chat-
|
|
49
|
-
</
|
|
50
|
-
|
|
40
|
+
</chat-input-actions-bar>
|
|
41
|
+
</template>
|
|
42
|
+
</chat-footer-wrapper>
|
|
43
|
+
</slot>
|
|
44
|
+
</section>
|
|
51
45
|
</template>
|
|
52
46
|
|
|
53
47
|
<script setup lang="ts">
|
|
@@ -77,6 +71,7 @@ const props = withDefaults(
|
|
|
77
71
|
canLoadNextMessages?: boolean; // 'next'
|
|
78
72
|
isNextMessagesLoading?: boolean;
|
|
79
73
|
withoutAvatars?: boolean;
|
|
74
|
+
readonly?: boolean; // hide chat footer with textarea and action-buttons
|
|
80
75
|
}>(),
|
|
81
76
|
{
|
|
82
77
|
size: ComponentSize.MD,
|
|
@@ -84,6 +79,7 @@ const props = withDefaults(
|
|
|
84
79
|
chatActions: () => [],
|
|
85
80
|
canLoadNextMessages: false,
|
|
86
81
|
isNextMessagesLoading: false,
|
|
82
|
+
readonly: false,
|
|
87
83
|
},
|
|
88
84
|
);
|
|
89
85
|
|