@mobilon-dev/chotto 0.3.38 → 0.3.39
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_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
- package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +94 -86
- 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/components/2_chatlist_elements/ChatItem/styles/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./ChatItem.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ o(t, [["__scopeId", "data-v-b9128cb0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as rt, inject as ut, useId as dt, ref as p, computed as M, watch as ht, onMounted as mt, nextTick as b, onUnmounted as gt, createElementBlock as c, openBlock as o, createElementVNode as a, createCommentVNode as l, withModifiers as yt, normalizeClass as B, normalizeStyle as X, createVNode as I, withCtx as A, toDisplayString as r, createBlock as S, Teleport as vt, unref as C, Fragment as Y, renderList as ft } from "vue";
|
|
2
2
|
import { getStatus as pt, statuses as kt } from "../../../functions/getStatusMessage.js";
|
|
3
3
|
import "../../../functions/parseMarkdown.js";
|
|
4
4
|
import { t as U } from "../../../locale/useLocale.js";
|
|
@@ -8,7 +8,7 @@ import { useTheme as xt } from "../../../hooks/useTheme.js";
|
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
11
|
-
import
|
|
11
|
+
import H from "../../1_atoms/Tooltip/Tooltip.vue.js";
|
|
12
12
|
import _t from "../../1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js";
|
|
13
13
|
import Mt from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
|
|
14
14
|
import Ct from "../../1_icons/AvatarIcon.vue.js";
|
|
@@ -23,31 +23,37 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
|
|
|
23
23
|
class: "chat-item__time"
|
|
24
24
|
}, Ut = { class: "chat-item__status-unread-container" }, Lt = {
|
|
25
25
|
key: 0,
|
|
26
|
-
class: "pi pi-
|
|
26
|
+
class: "pi pi-clock"
|
|
27
27
|
}, Nt = {
|
|
28
28
|
key: 1,
|
|
29
|
-
class: "
|
|
29
|
+
class: "pi pi-exclamation-circle"
|
|
30
30
|
}, Dt = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "pi pi-check"
|
|
33
|
+
}, Vt = {
|
|
34
|
+
key: 1,
|
|
35
|
+
class: "chat-item__unread"
|
|
36
|
+
}, Xt = {
|
|
31
37
|
key: 2,
|
|
32
38
|
class: "chat-item__status-chat-container"
|
|
33
|
-
},
|
|
39
|
+
}, Yt = {
|
|
34
40
|
key: 0,
|
|
35
41
|
class: "chat-item__fixed pi pi-thumbtack"
|
|
36
|
-
},
|
|
42
|
+
}, Ht = {
|
|
37
43
|
key: 0,
|
|
38
44
|
id: "noSelectButton",
|
|
39
45
|
class: "chat-item__menu-button"
|
|
40
|
-
},
|
|
46
|
+
}, Ot = {
|
|
41
47
|
key: 1,
|
|
42
48
|
id: "noSelectButton",
|
|
43
49
|
class: "chat-item__menu-button"
|
|
44
|
-
},
|
|
50
|
+
}, Rt = {
|
|
45
51
|
key: 0,
|
|
46
52
|
class: "dialog__container"
|
|
47
|
-
},
|
|
53
|
+
}, Ft = ["onClick"], $t = ["src"], zt = {
|
|
48
54
|
key: 1,
|
|
49
55
|
class: "dialog__icon pi pi-user"
|
|
50
|
-
},
|
|
56
|
+
}, Wt = { class: "dialog__text-container" }, jt = { class: "dialog__name" }, qt = { class: "dialog__time" }, le = /* @__PURE__ */ rt({
|
|
51
57
|
__name: "ChatItem",
|
|
52
58
|
props: {
|
|
53
59
|
chat: {},
|
|
@@ -55,27 +61,27 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
|
|
|
55
61
|
contextMenuTrigger: { default: "hover" }
|
|
56
62
|
},
|
|
57
63
|
emits: ["select", "action", "expand"],
|
|
58
|
-
setup(
|
|
59
|
-
const
|
|
64
|
+
setup(i, { emit: O }) {
|
|
65
|
+
const R = ut("chatAppId"), { getTheme: L } = xt(R), e = i, k = O, u = dt(), d = p(!1), h = p(!1), w = p(!1), F = p(null), $ = () => {
|
|
60
66
|
w.value = !0;
|
|
61
|
-
}, $ = (t) => {
|
|
62
|
-
w.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && k("select", { chat: e.chat, dialog: null }), w.value = !1;
|
|
63
67
|
}, z = (t) => {
|
|
68
|
+
w.value || t.target instanceof HTMLElement && t.target.id != "noSelectButton" && k("select", { chat: e.chat, dialog: null }), w.value = !1;
|
|
69
|
+
}, W = (t) => {
|
|
64
70
|
k("select", { chat: e.chat, dialog: t });
|
|
65
|
-
},
|
|
71
|
+
}, j = () => e.chat.isSelected ? "chat-item__selected" : "", q = (t) => t.isSelected ? "dialog__selected" : "", N = (t) => {
|
|
66
72
|
e.contextMenuTrigger === "rightClick" && T(), k("action", { chat: e.chat, ...t });
|
|
67
73
|
}, T = () => {
|
|
68
74
|
const t = document.getElementById("context-menu-rightclick-" + u);
|
|
69
75
|
t && (t.style.top = "0", t.style.left = "0", t.style.opacity = "0", t.style.display = "none"), h.value = !1;
|
|
70
|
-
},
|
|
76
|
+
}, G = () => {
|
|
71
77
|
document.querySelectorAll('[id^="context-menu-rightclick-"]').forEach((n) => {
|
|
72
|
-
const
|
|
73
|
-
|
|
78
|
+
const s = n;
|
|
79
|
+
s.id !== "context-menu-rightclick-" + u && (s.style.top = "0", s.style.left = "0", s.style.opacity = "0", s.style.display = "none");
|
|
74
80
|
});
|
|
75
|
-
},
|
|
81
|
+
}, J = () => e.chat.dialogs ? [...e.chat.dialogs].sort((t, n) => Number(t["lastActivity.timestamp"]) > Number(n["lastActivity.timestamp"]) ? -1 : Number(t["lastActivity.timestamp"]) < Number(n["lastActivity.timestamp"]) ? 1 : (Number(t["lastActivity.timestamp"]) == Number(n["lastActivity.timestamp"]), 0)) : [], K = M(() => pt(e.chat["lastMessage.status"])), P = M(() => e.chat.showEmptyIndicator || e.chat.countUnread > 0), Q = M(() => e.chat.countUnread > 0 ? e.chat.countUnread > 99 ? "99+" : e.chat.countUnread : e.chat.showEmptyIndicator ? "" : void 0);
|
|
76
82
|
let x;
|
|
77
|
-
const m = p(0),
|
|
78
|
-
|
|
83
|
+
const m = p(0), Z = [U("component.ChatItem.typing") + ".", U("component.ChatItem.typing") + "..", U("component.ChatItem.typing") + "..."], tt = M(() => e.chat.typing ? Z[m.value] : e.chat.lastMessage);
|
|
84
|
+
ht(
|
|
79
85
|
() => e.chat.typing,
|
|
80
86
|
() => {
|
|
81
87
|
e.chat.typing ? x = setInterval(() => {
|
|
@@ -84,140 +90,142 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
|
|
|
84
90
|
},
|
|
85
91
|
{ immediate: !0 }
|
|
86
92
|
);
|
|
87
|
-
const
|
|
93
|
+
const et = () => {
|
|
88
94
|
e.contextMenuTrigger === "hover" && (d.value = !0);
|
|
89
|
-
}, et = (t) => {
|
|
90
|
-
e.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? d.value = !0 : d.value = !1);
|
|
91
95
|
}, nt = (t) => {
|
|
92
|
-
e.contextMenuTrigger === "
|
|
96
|
+
e.contextMenuTrigger === "hover" && (t.relatedTarget instanceof HTMLElement && t.relatedTarget.className == "context-menu__list" ? d.value = !0 : d.value = !1);
|
|
93
97
|
}, it = (t) => {
|
|
94
|
-
|
|
98
|
+
e.contextMenuTrigger === "rightClick" && e.chat.actions && st(t);
|
|
99
|
+
}, st = (t) => {
|
|
100
|
+
G(), h.value = !0, b(() => {
|
|
95
101
|
const n = document.getElementById("context-menu-rightclick-" + u);
|
|
96
102
|
if (n) {
|
|
97
|
-
const
|
|
103
|
+
const s = t.clientX, E = t.clientY;
|
|
98
104
|
n.style.display = "inherit";
|
|
99
105
|
const _ = n.getBoundingClientRect();
|
|
100
106
|
n.style.display = "none", b(() => {
|
|
101
|
-
const
|
|
102
|
-
let
|
|
103
|
-
|
|
107
|
+
const at = window.innerWidth, lt = window.innerHeight, g = window.scrollX || window.pageXOffset, y = window.scrollY || window.pageYOffset;
|
|
108
|
+
let v = s + g, f = E + y;
|
|
109
|
+
v + _.width > at + g && (v = s + g - _.width), f + _.height > lt + y && (f = E + y - _.height), v < g && (v = g), f < y && (f = y), n.style.top = f + "px", n.style.left = v + "px", n.style.opacity = "1", n.style.display = "inherit";
|
|
104
110
|
});
|
|
105
111
|
}
|
|
106
112
|
});
|
|
107
113
|
}, ot = () => {
|
|
108
|
-
},
|
|
114
|
+
}, ct = () => {
|
|
109
115
|
}, D = (t) => {
|
|
110
116
|
if (e.contextMenuTrigger === "rightClick" && h.value) {
|
|
111
|
-
const n = t.target,
|
|
112
|
-
(!
|
|
117
|
+
const n = t.target, s = document.getElementById("context-menu-rightclick-" + u);
|
|
118
|
+
(!s || !s.contains(n)) && T();
|
|
113
119
|
}
|
|
114
120
|
}, V = () => {
|
|
115
121
|
e.contextMenuTrigger === "rightClick" && h.value && T();
|
|
116
122
|
};
|
|
117
|
-
return
|
|
123
|
+
return mt(() => {
|
|
118
124
|
e.contextMenuTrigger === "rightClick" && (document.addEventListener("click", D), window.addEventListener("scroll", V, !0), b(() => {
|
|
119
125
|
const t = document.getElementById("context-menu-rightclick-" + u);
|
|
120
126
|
t && (t.style.display = "none", t.style.opacity = "0");
|
|
121
127
|
}));
|
|
122
|
-
}),
|
|
128
|
+
}), gt(() => {
|
|
123
129
|
document.removeEventListener("click", D), window.removeEventListener("scroll", V, !0);
|
|
124
|
-
}), (t, n) => (
|
|
130
|
+
}), (t, n) => (o(), c("div", null, [
|
|
125
131
|
a("div", {
|
|
126
132
|
ref_key: "containerRef",
|
|
127
|
-
ref:
|
|
128
|
-
class: B(["chat-item__container",
|
|
129
|
-
onMouseenter:
|
|
130
|
-
onMouseleave:
|
|
131
|
-
onClick:
|
|
132
|
-
onContextmenu:
|
|
133
|
+
ref: F,
|
|
134
|
+
class: B(["chat-item__container", j()]),
|
|
135
|
+
onMouseenter: et,
|
|
136
|
+
onMouseleave: nt,
|
|
137
|
+
onClick: z,
|
|
138
|
+
onContextmenu: yt(it, ["prevent"])
|
|
133
139
|
}, [
|
|
134
140
|
a("div", wt, [
|
|
135
141
|
a("span", {
|
|
136
142
|
class: "chat-item__status-user",
|
|
137
143
|
style: X({ backgroundColor: e.chat.status })
|
|
138
144
|
}, null, 4),
|
|
139
|
-
e.chat.avatar ? (
|
|
145
|
+
e.chat.avatar ? (o(), c("img", {
|
|
140
146
|
key: 0,
|
|
141
147
|
src: e.chat.avatar,
|
|
142
148
|
height: "48",
|
|
143
149
|
width: "48"
|
|
144
|
-
}, null, 8, Tt)) : (
|
|
150
|
+
}, null, 8, Tt)) : (o(), c("div", Et, [
|
|
145
151
|
I(Ct)
|
|
146
152
|
]))
|
|
147
153
|
]),
|
|
148
154
|
a("div", bt, [
|
|
149
|
-
I(
|
|
150
|
-
text:
|
|
155
|
+
I(H, {
|
|
156
|
+
text: i.chat.name,
|
|
151
157
|
position: "bottom"
|
|
152
158
|
}, {
|
|
153
159
|
default: A(() => [
|
|
154
|
-
a("div", Bt, r(
|
|
160
|
+
a("div", Bt, r(i.chat.name), 1)
|
|
155
161
|
]),
|
|
156
162
|
_: 1
|
|
157
163
|
}, 8, ["text"]),
|
|
158
|
-
I(
|
|
159
|
-
text:
|
|
164
|
+
I(H, {
|
|
165
|
+
text: i.chat.lastMessage,
|
|
160
166
|
position: "bottom"
|
|
161
167
|
}, {
|
|
162
168
|
default: A(() => [
|
|
163
|
-
|
|
169
|
+
i.chat.lastMessage || i.chat.typing ? (o(), c("div", It, r(tt.value), 1)) : l("", !0)
|
|
164
170
|
]),
|
|
165
171
|
_: 1
|
|
166
172
|
}, 8, ["text"])
|
|
167
173
|
]),
|
|
168
174
|
a("div", At, [
|
|
169
|
-
|
|
170
|
-
d.value &&
|
|
175
|
+
i.chat["lastActivity.time"] && (!i.chat.actions || !d.value) ? (o(), c("div", St, r(i.chat["lastActivity.time"]), 1)) : l("", !0),
|
|
176
|
+
d.value && i.chat.actions && i.contextMenuTrigger === "hover" ? (o(), S(_t, {
|
|
171
177
|
key: 1,
|
|
172
178
|
mode: "click",
|
|
173
179
|
"menu-side": "bottom-right",
|
|
174
|
-
actions:
|
|
180
|
+
actions: i.chat.actions,
|
|
175
181
|
onClick: N,
|
|
176
|
-
onButtonClick:
|
|
177
|
-
onMenuMouseLeave: n[0] || (n[0] = (
|
|
182
|
+
onButtonClick: $,
|
|
183
|
+
onMenuMouseLeave: n[0] || (n[0] = (s) => d.value = !1)
|
|
178
184
|
}, {
|
|
179
185
|
default: A(() => [...n[2] || (n[2] = [
|
|
180
186
|
a("span", { class: "pi pi-ellipsis-h chat-item__actions-trigger" }, null, -1)
|
|
181
187
|
])]),
|
|
182
188
|
_: 1
|
|
183
189
|
}, 8, ["actions"])) : l("", !0),
|
|
184
|
-
(
|
|
185
|
-
|
|
190
|
+
(o(), S(vt, { to: "body" }, [
|
|
191
|
+
i.contextMenuTrigger === "rightClick" && i.chat.actions && h.value ? (o(), S(Mt, {
|
|
186
192
|
key: 0,
|
|
187
193
|
id: "context-menu-rightclick-" + C(u),
|
|
188
|
-
actions:
|
|
194
|
+
actions: i.chat.actions,
|
|
189
195
|
"data-theme": C(L)().theme ? C(L)().theme : "light",
|
|
190
196
|
onClick: N,
|
|
191
197
|
onMouseenter: ot,
|
|
192
|
-
onMouseleave:
|
|
198
|
+
onMouseleave: ct
|
|
193
199
|
}, null, 8, ["id", "actions", "data-theme"])) : l("", !0)
|
|
194
200
|
])),
|
|
195
201
|
a("div", Ut, [
|
|
196
|
-
C(kt).includes(
|
|
202
|
+
C(kt).includes(i.chat["lastMessage.status"]) ? (o(), c("div", {
|
|
197
203
|
key: 0,
|
|
198
|
-
class: B(["chat-item__status-message",
|
|
204
|
+
class: B(["chat-item__status-message", K.value])
|
|
199
205
|
}, [
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
i.chat["lastMessage.status"] === "pending" ? (o(), c("span", Lt)) : i.chat["lastMessage.status"] === "error" ? (o(), c("span", Nt)) : (o(), c(Y, { key: 2 }, [
|
|
207
|
+
i.chat["lastMessage.status"] !== "sent" ? (o(), c("span", Dt)) : l("", !0),
|
|
208
|
+
n[3] || (n[3] = a("span", { class: "pi pi-check" }, null, -1))
|
|
209
|
+
], 64))
|
|
202
210
|
], 2)) : l("", !0),
|
|
203
|
-
|
|
211
|
+
P.value ? (o(), c("div", Vt, r(Q.value), 1)) : l("", !0)
|
|
204
212
|
]),
|
|
205
|
-
|
|
206
|
-
|
|
213
|
+
i.chat.countUnread < 1 ? (o(), c("div", Xt, [
|
|
214
|
+
i.chat.isFixedTop || i.chat.isFixedBottom ? (o(), c("span", Yt)) : l("", !0)
|
|
207
215
|
])) : l("", !0)
|
|
208
216
|
]),
|
|
209
|
-
e.showDialogs &&
|
|
217
|
+
e.showDialogs && i.chat.dialogs ? (o(), c("div", {
|
|
210
218
|
key: 0,
|
|
211
219
|
class: "chat-item__dialog-buttons",
|
|
212
|
-
onClick: n[1] || (n[1] = (
|
|
220
|
+
onClick: n[1] || (n[1] = (s) => k("expand", e.chat))
|
|
213
221
|
}, [
|
|
214
|
-
e.showDialogs && !
|
|
222
|
+
e.showDialogs && !i.chat.dialogsExpanded ? (o(), c("button", Ht, [...n[4] || (n[4] = [
|
|
215
223
|
a("span", {
|
|
216
224
|
id: "noSelectButton",
|
|
217
225
|
class: "pi pi-angle-down"
|
|
218
226
|
}, null, -1)
|
|
219
227
|
])])) : l("", !0),
|
|
220
|
-
e.showDialogs &&
|
|
228
|
+
e.showDialogs && i.chat.dialogsExpanded ? (o(), c("button", Ot, [...n[5] || (n[5] = [
|
|
221
229
|
a("span", {
|
|
222
230
|
id: "noSelectButton",
|
|
223
231
|
class: "pi pi-angle-up"
|
|
@@ -225,33 +233,33 @@ const wt = { class: "chat-item__avatar-container" }, Tt = ["src"], Et = {
|
|
|
225
233
|
])])) : l("", !0)
|
|
226
234
|
])) : l("", !0)
|
|
227
235
|
], 34),
|
|
228
|
-
e.showDialogs &&
|
|
229
|
-
(
|
|
230
|
-
key:
|
|
231
|
-
class: B(["dialog__item",
|
|
232
|
-
onClick: (E) =>
|
|
236
|
+
e.showDialogs && i.chat.dialogsExpanded ? (o(), c("div", Rt, [
|
|
237
|
+
(o(!0), c(Y, null, ft(J(), (s) => (o(), c("div", {
|
|
238
|
+
key: s.dialogId,
|
|
239
|
+
class: B(["dialog__item", q(s)]),
|
|
240
|
+
onClick: (E) => W(s)
|
|
233
241
|
}, [
|
|
234
|
-
|
|
242
|
+
s.icon ? (o(), c("img", {
|
|
235
243
|
key: 0,
|
|
236
244
|
class: "dialog__icon",
|
|
237
|
-
src:
|
|
245
|
+
src: s.icon,
|
|
238
246
|
height: "16",
|
|
239
247
|
width: "16"
|
|
240
|
-
}, null, 8,
|
|
241
|
-
a("div",
|
|
242
|
-
a("div",
|
|
243
|
-
a("div",
|
|
248
|
+
}, null, 8, $t)) : (o(), c("span", zt)),
|
|
249
|
+
a("div", Wt, [
|
|
250
|
+
a("div", jt, r(s.name), 1),
|
|
251
|
+
a("div", qt, r(s["lastActivity.time"]), 1)
|
|
244
252
|
]),
|
|
245
|
-
|
|
253
|
+
s.countUnread > 0 ? (o(), c("div", {
|
|
246
254
|
key: 2,
|
|
247
255
|
class: "chat-item__unread",
|
|
248
|
-
style: X(
|
|
249
|
-
}, r(
|
|
250
|
-
], 10,
|
|
256
|
+
style: X(s.colorUnread ? { backgroundColor: s.colorUnread } : {})
|
|
257
|
+
}, r(s.countUnread > 99 ? "99+" : s.countUnread), 5)) : l("", !0)
|
|
258
|
+
], 10, Ft))), 128))
|
|
251
259
|
])) : l("", !0)
|
|
252
260
|
]));
|
|
253
261
|
}
|
|
254
262
|
});
|
|
255
263
|
export {
|
|
256
|
-
|
|
264
|
+
le as default
|
|
257
265
|
};
|