@mobilon-dev/chotto 0.3.90 → 0.3.92
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/dist/chotto.css +1 -1
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +1 -1
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +23 -23
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +3 -3
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +87 -103
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +218 -182
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +52 -79
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +35 -64
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +4 -0
- package/dist/components/2_feed_elements/CallMessage/CallMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/CallMessage/CallMessage.vue2.js +4 -0
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +33 -29
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +62 -58
- package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/MissedCallMessage/MissedCallMessage.vue2.js +27 -23
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +49 -41
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +105 -101
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +224 -138
- package/dist/components/3_compounds/ChatList/composables/useChatListFilter.js +18 -13
- package/dist/functions/renderAppleEmojis.js +127 -70
- package/dist/hooks/uploadFile/generatePreview.js +23 -11
- package/dist/hooks/useMessageDraft.js +73 -39
- package/dist/index.js +116 -114
- package/dist/locale/en.js +1 -0
- package/dist/locale/ru.js +1 -0
- package/dist/node_modules/vue3-emoji-picker-ru/dist/emoji-picker.es.js +106 -106
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/apps/data/messages.d.ts +52 -0
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -2
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -2
- package/dist/types/components/2_chatlist_elements/ChatItem/styles/types.d.ts +6 -0
- package/dist/types/components/2_feed_elements/AudioMessage/styles/types.d.ts +34 -0
- package/dist/types/components/2_feed_elements/CallMessage/styles/types.d.ts +26 -0
- package/dist/types/components/2_feed_elements/FileMessage/styles/types.d.ts +30 -0
- package/dist/types/components/2_feed_elements/ImageMessage/styles/types.d.ts +34 -0
- package/dist/types/components/2_feed_elements/StickerMessage/styles/types.d.ts +4 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +38 -2
- package/dist/types/components/2_feed_elements/TypingMessage/styles/types.d.ts +2 -0
- package/dist/types/components/2_feed_elements/VideoMessage/styles/types.d.ts +34 -0
- package/dist/types/components/3_compounds/ChatInput/ChatInput.vue.d.ts +3 -3
- package/dist/types/components/3_compounds/ChatInput/styles/types.d.ts +2 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +1 -27
- package/dist/types/functions/renderAppleEmojis.d.ts +17 -2
- package/dist/types/hooks/uploadFile/generatePreview.d.ts +2 -0
- package/dist/types/hooks/uploadFile/uploadFile.d.ts +9 -17
- package/dist/types/hooks/useMessageDraft.d.ts +30 -29
- package/dist/types/locale/en.d.ts +1 -0
- package/dist/types/locale/ru.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useImmediateDebouncedRef as
|
|
3
|
-
import { useMessageDraft as
|
|
1
|
+
import { defineComponent as Te, inject as be, ref as E, computed as _, watch as p, nextTick as S, unref as u, onMounted as we, onUnmounted as Ce, createElementBlock as k, openBlock as F, createElementVNode as h, createVNode as G, normalizeClass as z, createBlock as Ae, createCommentVNode as O, renderSlot as U, toDisplayString as Ee, withDirectives as Fe, withKeys as Me, vModelText as Re } from "vue";
|
|
2
|
+
import { useImmediateDebouncedRef as He } from "../../../hooks/useImmediateDebouncedRef.js";
|
|
3
|
+
import { useMessageDraft as ke } from "../../../hooks/useMessageDraft.js";
|
|
4
4
|
import "../../../hooks/useSearchModel.js";
|
|
5
5
|
import "../../../hooks/useTheme.js";
|
|
6
|
-
import { useEmojiNative as
|
|
6
|
+
import { useEmojiNative as Le } from "../../../hooks/useEmojiNative.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { t as
|
|
9
|
+
import { t as I } from "../../../locale/useLocale.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
12
12
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
13
13
|
import "../../../functions/parseMarkdown.js";
|
|
14
|
-
import { textToAppleEmojiHtml as
|
|
15
|
-
import { hideEditPreview as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
14
|
+
import { textToAppleEmojiHtml as De, textContainsEmoji as Pe, previousGraphemeIndex as Y, nextGraphemeIndex as V, snapIndexToGrapheme as $ } from "../../../functions/renderAppleEmojis.js";
|
|
15
|
+
import { hideEditPreview as We } from "../../../hooks/messages/useStartEdit.js";
|
|
16
|
+
import qe from "./icons/SendIcon.vue.js";
|
|
17
|
+
import Be from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
|
|
18
|
+
import ze from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
|
|
19
|
+
const Ke = { class: "chat-input__container" }, je = ["id"], Ne = ["id"], Ge = { class: "chat-input__inline-buttons" }, Oe = {
|
|
19
20
|
key: 0,
|
|
20
21
|
class: "chat-input__input chat-input__disabled-placeholder"
|
|
21
|
-
},
|
|
22
|
+
}, Ue = {
|
|
22
23
|
key: 1,
|
|
23
24
|
class: "chat-input__input-wrap"
|
|
24
|
-
},
|
|
25
|
+
}, Ye = ["innerHTML"], Ve = ["disabled", "placeholder"], $e = ["disabled"], Je = { class: "" }, Qe = { class: "chat-input__third-line" }, K = 40, gt = /* @__PURE__ */ Te({
|
|
25
26
|
__name: "ChatInput",
|
|
26
27
|
props: {
|
|
27
28
|
state: {
|
|
@@ -50,32 +51,84 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
|
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
emits: ["send", "typing"],
|
|
53
|
-
setup(
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
setup(T, { emit: J }) {
|
|
55
|
+
const L = J, b = be("chatAppId"), { resetMessage: Q, getMessage: o, setMessageText: M, setForceSendMessage: X, resetEdit: Z, resetMessageFile: ee } = ke(b), { isNative: te } = Le(b), n = E(), m = E(), v = E(null), w = E(!1), ne = He("", 2e3), D = _(() => {
|
|
56
|
+
var e;
|
|
57
|
+
return (e = o().file) == null ? void 0 : e.preview;
|
|
58
|
+
}), ie = _(
|
|
59
|
+
() => De(o().text || "", v.value)
|
|
60
|
+
), g = _(
|
|
61
|
+
() => !te.value && Pe(o().text || "")
|
|
56
62
|
), c = () => {
|
|
57
|
-
if (!
|
|
58
|
-
const e = n.value, t =
|
|
59
|
-
t.style.right =
|
|
63
|
+
if (!m.value || !n.value) return;
|
|
64
|
+
const e = n.value, t = m.value, l = Math.max(0, e.offsetWidth - e.clientWidth);
|
|
65
|
+
t.style.right = l > 0 ? `${l}px` : "", t.scrollTop = e.scrollTop;
|
|
60
66
|
};
|
|
61
|
-
let
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
let y = 0;
|
|
68
|
+
function P() {
|
|
69
|
+
v.value = null;
|
|
70
|
+
}
|
|
71
|
+
function le(e = "nearest") {
|
|
72
|
+
const t = n.value;
|
|
73
|
+
if (!t || !g.value) return;
|
|
74
|
+
const l = t.value, i = $(l, t.selectionStart, e), r = $(l, t.selectionEnd, e);
|
|
75
|
+
(i !== t.selectionStart || r !== t.selectionEnd) && t.setSelectionRange(i, r);
|
|
76
|
+
}
|
|
77
|
+
function W() {
|
|
78
|
+
le("nearest"), d();
|
|
79
|
+
}
|
|
80
|
+
function oe(e) {
|
|
81
|
+
if (!g.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
|
|
82
|
+
const t = n.value;
|
|
83
|
+
if (!t) return;
|
|
84
|
+
const l = t.value, i = t.selectionStart !== t.selectionEnd;
|
|
85
|
+
if (e.shiftKey) {
|
|
86
|
+
requestAnimationFrame(() => W());
|
|
65
87
|
return;
|
|
66
88
|
}
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
if (i) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
const x = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, A = e.key === "ArrowLeft" ? Y(l, x) : V(l, x);
|
|
92
|
+
t.setSelectionRange(A, A), d();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
const r = t.selectionStart, f = e.key === "ArrowLeft" ? Y(l, r) : V(l, r);
|
|
97
|
+
t.setSelectionRange(f, f), d();
|
|
98
|
+
}
|
|
99
|
+
function d() {
|
|
100
|
+
if (!g.value) {
|
|
101
|
+
P();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
y && cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
105
|
+
var f;
|
|
106
|
+
y = 0;
|
|
69
107
|
const e = n.value;
|
|
70
108
|
if (!e) {
|
|
71
|
-
|
|
109
|
+
P();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const t = e.selectionStart, l = e.selectionEnd;
|
|
113
|
+
if (t === l) {
|
|
114
|
+
v.value !== null && (v.value = null, S(c));
|
|
72
115
|
return;
|
|
73
116
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
117
|
+
const i = v.value;
|
|
118
|
+
if (i && i.start === t && i.end === l) return;
|
|
119
|
+
const r = ((f = m.value) == null ? void 0 : f.scrollTop) ?? 0;
|
|
120
|
+
v.value = { start: t, end: l }, S(() => {
|
|
121
|
+
m.value && (m.value.scrollTop = r), c();
|
|
122
|
+
});
|
|
76
123
|
});
|
|
77
124
|
}
|
|
78
|
-
|
|
125
|
+
function se(e) {
|
|
126
|
+
e.buttons && d();
|
|
127
|
+
}
|
|
128
|
+
function j() {
|
|
129
|
+
document.activeElement === n.value && d();
|
|
130
|
+
}
|
|
131
|
+
const a = T, ae = _(() => !!(a.state == "disabled" || o().text == "" && !o().file || o().isRecording)), re = _(() => {
|
|
79
132
|
var t;
|
|
80
133
|
if (a.inputButtonColor)
|
|
81
134
|
return a.inputButtonColor;
|
|
@@ -83,133 +136,158 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
|
|
|
83
136
|
return "#25D366";
|
|
84
137
|
const e = a.selectedChannel.channelId.toLowerCase();
|
|
85
138
|
return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
|
|
86
|
-
}),
|
|
139
|
+
}), ue = _(() => {
|
|
87
140
|
var t;
|
|
88
141
|
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
89
|
-
return
|
|
142
|
+
return I("component.ChatInput.InputPlaceholder");
|
|
90
143
|
const e = a.selectedChannel.channelId.toLowerCase();
|
|
91
|
-
return e.includes("whatsapp") || e.includes("waba") ?
|
|
144
|
+
return e.includes("whatsapp") || e.includes("waba") ? I("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? I("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? I("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? I("component.ChatInput.MaxInputPlaceholder") : I("component.ChatInput.InputPlaceholder");
|
|
92
145
|
});
|
|
93
|
-
|
|
94
|
-
() =>
|
|
146
|
+
p(
|
|
147
|
+
() => ne.value,
|
|
95
148
|
() => {
|
|
96
|
-
|
|
149
|
+
L("typing");
|
|
97
150
|
}
|
|
98
|
-
),
|
|
151
|
+
), p(
|
|
99
152
|
() => {
|
|
100
153
|
var e;
|
|
101
|
-
return (e =
|
|
154
|
+
return (e = o().edit) == null ? void 0 : e.messageId;
|
|
102
155
|
},
|
|
103
156
|
(e, t) => {
|
|
104
|
-
e != null && e !== t && (
|
|
105
|
-
if (!
|
|
106
|
-
const
|
|
107
|
-
|
|
157
|
+
e != null && e !== t && (w.value = !0, S(() => {
|
|
158
|
+
if (!w.value) return;
|
|
159
|
+
const l = n.value;
|
|
160
|
+
l && (C(l), w.value = !1, H(l), requestAnimationFrame(() => H(l)));
|
|
108
161
|
}));
|
|
109
162
|
}
|
|
110
|
-
),
|
|
163
|
+
), p(
|
|
111
164
|
() => a.focusOnInputArea,
|
|
112
165
|
() => {
|
|
113
|
-
a.focusOnInputArea &&
|
|
114
|
-
const e =
|
|
166
|
+
a.focusOnInputArea && S(() => {
|
|
167
|
+
const e = u(n);
|
|
115
168
|
e == null || e.focus();
|
|
116
169
|
});
|
|
117
170
|
},
|
|
118
171
|
{ immediate: !0 }
|
|
119
|
-
),
|
|
120
|
-
() =>
|
|
172
|
+
), p(
|
|
173
|
+
() => o().text,
|
|
121
174
|
() => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
e && (M(e), y.value && (y.value = !1, S(e), requestAnimationFrame(() => S(e))));
|
|
125
|
-
});
|
|
175
|
+
const e = n.value;
|
|
176
|
+
e && (C(e), w.value && (w.value = !1, H(e), requestAnimationFrame(() => H(e))));
|
|
126
177
|
},
|
|
127
|
-
{ immediate: !0 }
|
|
128
|
-
),
|
|
129
|
-
|
|
178
|
+
{ immediate: !0, flush: "post" }
|
|
179
|
+
), p(
|
|
180
|
+
() => o().id,
|
|
181
|
+
() => {
|
|
182
|
+
const e = n.value;
|
|
183
|
+
e && (R(e), requestAnimationFrame(() => {
|
|
184
|
+
const t = n.value;
|
|
185
|
+
t && C(t);
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
), p(g, (e) => {
|
|
189
|
+
e && S(() => {
|
|
130
190
|
const t = n.value;
|
|
131
191
|
if (!t) return;
|
|
132
|
-
const
|
|
133
|
-
|
|
192
|
+
const l = t.scrollTop;
|
|
193
|
+
C(t), t.scrollTop = l, c(), requestAnimationFrame(c);
|
|
134
194
|
});
|
|
135
195
|
});
|
|
136
|
-
function
|
|
137
|
-
const t =
|
|
196
|
+
function R(e) {
|
|
197
|
+
const t = o().inputHeight;
|
|
198
|
+
e.style.height = (t || K) + "px", (!t || t <= K) && (e.style.overflowY = "hidden");
|
|
199
|
+
}
|
|
200
|
+
function ce(e) {
|
|
201
|
+
const t = parseFloat(e.style.height);
|
|
202
|
+
Number.isFinite(t) && (o().inputHeight = t);
|
|
203
|
+
}
|
|
204
|
+
function C(e) {
|
|
205
|
+
const t = o().text || "";
|
|
206
|
+
if (e.value !== t || e.clientWidth === 0) {
|
|
207
|
+
R(e);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const l = e.scrollTop;
|
|
138
211
|
e.style.height = "auto";
|
|
139
|
-
const i = getComputedStyle(e),
|
|
212
|
+
const i = getComputedStyle(e), r = parseFloat(i.fontSize) || 16, f = parseFloat(i.lineHeight) || r * 1.4, x = K, A = f * 11, B = e.scrollHeight, ge = t.split(`
|
|
140
213
|
`).length > 1, s = document.createElement("div");
|
|
141
|
-
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent =
|
|
142
|
-
const
|
|
214
|
+
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = t, document.body.appendChild(s);
|
|
215
|
+
const ye = s.offsetWidth;
|
|
143
216
|
document.body.removeChild(s);
|
|
144
|
-
const
|
|
145
|
-
|
|
217
|
+
const xe = parseFloat(i.paddingLeft) || 0, _e = parseFloat(i.paddingRight) || 0, Se = e.clientWidth - xe - _e, Ie = ye > Se, N = ge || Ie;
|
|
218
|
+
if (N && B <= x + 1) {
|
|
219
|
+
R(e);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
t.trim() && N ? B <= A ? (e.style.height = B + "px", e.style.overflowY = "hidden") : (e.style.height = A + "px", e.style.overflowY = "auto", e.scrollTop = l) : (e.style.height = x + "px", e.style.overflowY = "hidden"), ce(e), c(), requestAnimationFrame(c);
|
|
146
223
|
}
|
|
147
|
-
function
|
|
148
|
-
if (a.state === "disabled" ||
|
|
224
|
+
function H(e) {
|
|
225
|
+
if (a.state === "disabled" || o().isRecording) return;
|
|
149
226
|
const t = e.value.length;
|
|
150
227
|
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, c();
|
|
151
228
|
}
|
|
152
|
-
|
|
153
|
-
() =>
|
|
229
|
+
p(
|
|
230
|
+
() => o().forceSend,
|
|
154
231
|
() => {
|
|
155
|
-
|
|
232
|
+
o().forceSend && (q(), X(!1));
|
|
156
233
|
}
|
|
157
234
|
);
|
|
158
|
-
const
|
|
235
|
+
const de = (e) => {
|
|
159
236
|
const t = e.target;
|
|
160
|
-
|
|
161
|
-
}, G = () => {
|
|
162
|
-
d(() => {
|
|
163
|
-
const e = n.value;
|
|
164
|
-
e && (e.style.height = "40px", e.style.overflowY = "hidden");
|
|
165
|
-
});
|
|
237
|
+
L("typing", t.value), d();
|
|
166
238
|
};
|
|
167
|
-
|
|
168
|
-
|
|
239
|
+
we(() => {
|
|
240
|
+
const e = n.value;
|
|
241
|
+
e && (R(e), C(e)), document.addEventListener("selectionchange", j);
|
|
242
|
+
}), Ce(() => {
|
|
243
|
+
document.removeEventListener("selectionchange", j), y && cancelAnimationFrame(y);
|
|
169
244
|
});
|
|
170
|
-
const
|
|
245
|
+
const fe = (e) => {
|
|
171
246
|
if (e.shiftKey) {
|
|
172
247
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
173
248
|
let t = n.value.selectionStart;
|
|
174
249
|
t && (n.value.setRangeText(`
|
|
175
|
-
`, t, t, "end"),
|
|
250
|
+
`, t, t, "end"), M(n.value.value));
|
|
176
251
|
}
|
|
177
252
|
e.preventDefault();
|
|
178
253
|
} else if (e.ctrlKey) {
|
|
179
254
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
180
255
|
let t = n.value.selectionStart;
|
|
181
256
|
t && (n.value.setRangeText(`
|
|
182
|
-
`, t, t, "end"),
|
|
257
|
+
`, t, t, "end"), M(n.value.value));
|
|
183
258
|
}
|
|
184
259
|
e.preventDefault();
|
|
185
260
|
} else
|
|
186
|
-
e.preventDefault(),
|
|
187
|
-
},
|
|
261
|
+
e.preventDefault(), q();
|
|
262
|
+
}, pe = (e) => {
|
|
188
263
|
if (n.value) {
|
|
189
264
|
const t = n.value.value;
|
|
190
265
|
n.value.value = e.newText;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
n.value && (n.value.setSelectionRange(
|
|
266
|
+
const l = e.newText.length - (t.length - (e.end - e.start)), i = e.start + l;
|
|
267
|
+
M(e.newText), S(() => {
|
|
268
|
+
n.value && (n.value.setSelectionRange(i, i), n.value.focus());
|
|
194
269
|
});
|
|
195
270
|
}
|
|
196
271
|
};
|
|
197
|
-
function
|
|
198
|
-
|
|
272
|
+
function he() {
|
|
273
|
+
ee();
|
|
274
|
+
}
|
|
275
|
+
function me() {
|
|
276
|
+
Z(), M(""), We(b), n.value && n.value.focus();
|
|
199
277
|
}
|
|
200
|
-
function
|
|
201
|
-
const e =
|
|
278
|
+
function ve() {
|
|
279
|
+
const e = o();
|
|
202
280
|
return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
|
|
203
281
|
}
|
|
204
|
-
const
|
|
205
|
-
var t,
|
|
206
|
-
const e =
|
|
207
|
-
if (e.value.edit &&
|
|
208
|
-
|
|
282
|
+
const q = () => {
|
|
283
|
+
var t, l;
|
|
284
|
+
const e = E(o());
|
|
285
|
+
if (e.value.edit && ve()) {
|
|
286
|
+
me();
|
|
209
287
|
return;
|
|
210
288
|
}
|
|
211
289
|
if (e.value.text != "" || e.value.file) {
|
|
212
|
-
const
|
|
290
|
+
const i = {
|
|
213
291
|
type: "",
|
|
214
292
|
text: "",
|
|
215
293
|
url: "",
|
|
@@ -217,70 +295,78 @@ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = {
|
|
|
217
295
|
size: "",
|
|
218
296
|
reply: void 0
|
|
219
297
|
};
|
|
220
|
-
e.value.file ? (
|
|
298
|
+
e.value.file ? (i.type = "message." + e.value.file.type, i.url = e.value.file.url, i.filename = e.value.file.name, i.size = (t = e.value.file.size) == null ? void 0 : t.toString(), i.text = (l = e == null ? void 0 : e.value) == null ? void 0 : l.text.trim()) : (i.type = "message.text", i.text = e.value.text.trim()), e.value.reply && (i.reply = e.value.reply), e.value.edit && (i.edit = e.value.edit), L("send", i), Q(), n.value && n.value.focus();
|
|
221
299
|
}
|
|
222
300
|
};
|
|
223
|
-
return (e, t) => (
|
|
224
|
-
|
|
225
|
-
id: "chat-input-reply-line-" +
|
|
301
|
+
return (e, t) => (F(), k("div", Ke, [
|
|
302
|
+
h("div", {
|
|
303
|
+
id: "chat-input-reply-line-" + u(b),
|
|
226
304
|
class: "chat-input__reply-line"
|
|
227
|
-
}, null, 8,
|
|
228
|
-
|
|
229
|
-
id: "chat-input-file-line-" +
|
|
230
|
-
class: "chat-input__file-line"
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
|
|
305
|
+
}, null, 8, je),
|
|
306
|
+
h("div", {
|
|
307
|
+
id: "chat-input-file-line-" + u(b),
|
|
308
|
+
class: z(["chat-input__file-line", { "chat-input__file-line--visible": !!D.value }])
|
|
309
|
+
}, [
|
|
310
|
+
D.value ? (F(), Ae(ze, {
|
|
311
|
+
key: 0,
|
|
312
|
+
"file-info": D.value,
|
|
313
|
+
onReset: he
|
|
314
|
+
}, null, 8, ["file-info"])) : O("", !0)
|
|
315
|
+
], 10, Ne),
|
|
316
|
+
h("div", Ge, [
|
|
317
|
+
U(e.$slots, "inline-buttons", {}, void 0, !0)
|
|
234
318
|
]),
|
|
235
|
-
|
|
236
|
-
|
|
319
|
+
T.disabledPlaceholder && (T.state == "disabled" || u(o)().isRecording) ? (F(), k("div", Oe, Ee(T.disabledPlaceholder), 1)) : (F(), k("div", Ue, [
|
|
320
|
+
g.value ? (F(), k("div", {
|
|
237
321
|
key: 0,
|
|
238
322
|
ref_key: "refMirror",
|
|
239
|
-
ref:
|
|
240
|
-
class:
|
|
323
|
+
ref: m,
|
|
324
|
+
class: "chat-input__input-mirror",
|
|
241
325
|
"aria-hidden": "true",
|
|
242
|
-
innerHTML:
|
|
243
|
-
}, null,
|
|
244
|
-
|
|
326
|
+
innerHTML: ie.value
|
|
327
|
+
}, null, 8, Ye)) : O("", !0),
|
|
328
|
+
Fe(h("textarea", {
|
|
245
329
|
ref_key: "refInput",
|
|
246
330
|
ref: n,
|
|
247
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
331
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => u(o)().text = l),
|
|
332
|
+
rows: "1",
|
|
333
|
+
disabled: T.state == "disabled" || u(o)().isRecording,
|
|
334
|
+
class: z(["chat-input__input", { "chat-input__input--emoji-images": g.value }]),
|
|
335
|
+
placeholder: ue.value,
|
|
336
|
+
onKeydown: [
|
|
337
|
+
oe,
|
|
338
|
+
Me(fe, ["enter"])
|
|
339
|
+
],
|
|
340
|
+
onInput: de,
|
|
256
341
|
onScroll: c,
|
|
257
|
-
onSelect:
|
|
258
|
-
onMouseup:
|
|
259
|
-
onKeyup:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
342
|
+
onSelect: d,
|
|
343
|
+
onMouseup: W,
|
|
344
|
+
onKeyup: W,
|
|
345
|
+
onMousemove: se,
|
|
346
|
+
onBlur: P
|
|
347
|
+
}, null, 42, Ve), [
|
|
348
|
+
[Re, u(o)().text]
|
|
263
349
|
])
|
|
264
350
|
])),
|
|
265
|
-
|
|
351
|
+
G(Be, {
|
|
266
352
|
textarea: n.value,
|
|
267
|
-
onFormatApplied:
|
|
353
|
+
onFormatApplied: pe
|
|
268
354
|
}, null, 8, ["textarea"]),
|
|
269
|
-
|
|
270
|
-
class:
|
|
271
|
-
disabled:
|
|
272
|
-
onClick:
|
|
355
|
+
h("button", {
|
|
356
|
+
class: z(["chat-input__button", { "chat-input__button-disabled": ae.value }]),
|
|
357
|
+
disabled: u(o)().isRecording,
|
|
358
|
+
onClick: q
|
|
273
359
|
}, [
|
|
274
|
-
|
|
275
|
-
|
|
360
|
+
h("span", Je, [
|
|
361
|
+
G(u(qe), { color: re.value }, null, 8, ["color"])
|
|
276
362
|
])
|
|
277
|
-
], 10,
|
|
278
|
-
|
|
279
|
-
|
|
363
|
+
], 10, $e),
|
|
364
|
+
h("div", Qe, [
|
|
365
|
+
U(e.$slots, "buttons", {}, void 0, !0)
|
|
280
366
|
])
|
|
281
367
|
]));
|
|
282
368
|
}
|
|
283
369
|
});
|
|
284
370
|
export {
|
|
285
|
-
|
|
371
|
+
gt as default
|
|
286
372
|
};
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
1
|
+
import { ref as c } from "vue";
|
|
2
|
+
function d({ props: e, emit: i }) {
|
|
3
|
+
const n = c("");
|
|
4
4
|
return {
|
|
5
|
-
filter:
|
|
5
|
+
filter: n,
|
|
6
6
|
getSortedAndFilteredChats: () => !e.chats || e.chats.length === 0 ? [] : e.chats.slice().filter((t) => {
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
if (
|
|
7
|
+
var l;
|
|
8
|
+
const a = e.activeTabId || "all";
|
|
9
|
+
if (a !== "all") {
|
|
10
|
+
if (a === "countUnread") {
|
|
11
11
|
if (t.countUnread <= 0) return !1;
|
|
12
|
-
} else if (
|
|
12
|
+
} else if (a.startsWith("tag_") && (!((l = t.contact) != null && l.tags) || !t.contact.tags.some((s) => s.tagId === a)))
|
|
13
13
|
return !1;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
if (e.searchQuery && e.searchQuery.trim() !== "")
|
|
16
|
+
return !0;
|
|
17
|
+
{
|
|
18
|
+
const s = (e.filterQuery || n.value).toLowerCase();
|
|
19
|
+
return (t.name ?? "").toLowerCase().includes(s) || (t.metadata ?? "").toLowerCase().includes(s);
|
|
20
|
+
}
|
|
16
21
|
}),
|
|
17
|
-
getFilter: (
|
|
18
|
-
|
|
22
|
+
getFilter: (r) => {
|
|
23
|
+
n.value = r, r.trim() !== "" ? i("search", r) : i("clear-search");
|
|
19
24
|
}
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
27
|
export {
|
|
23
|
-
|
|
28
|
+
d as useChatListFilter
|
|
24
29
|
};
|