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