@mobilon-dev/chotto 0.3.59 → 0.3.61
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_blocks/CommunicationPanel/CommunicationPanel.vue.js +263 -205
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +3 -3
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +54 -49
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -0
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { uploadFile as
|
|
4
|
-
import { useMessageDraft as
|
|
1
|
+
import { defineComponent as O, ref as n, inject as P, computed as B, watchEffect as $, onMounted as H, onUnmounted as L, createElementBlock as _, openBlock as u, Fragment as R, createCommentVNode as b, createElementVNode as p, createBlock as V, normalizeClass as j, createVNode as T, unref as h, Teleport as q } from "vue";
|
|
2
|
+
import G from "../FilePreview/FilePreview.vue.js";
|
|
3
|
+
import { uploadFile as J } from "../../../hooks/uploadFile/uploadFile.js";
|
|
4
|
+
import { useMessageDraft as K } from "../../../hooks/useMessageDraft.js";
|
|
5
5
|
import "../../../hooks/useSearchModel.js";
|
|
6
6
|
import "../../../hooks/useTheme.js";
|
|
7
7
|
/* empty css */
|
|
@@ -9,14 +9,14 @@ import "../../../hooks/useTheme.js";
|
|
|
9
9
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
10
10
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
11
11
|
import "../../../functions/parseMarkdown.js";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
12
|
+
import Q from "./icons/FileUploaderIcon.vue.js";
|
|
13
|
+
const W = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "file-uploader__status file-uploader__status--uploading"
|
|
16
|
-
},
|
|
16
|
+
}, X = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "file-uploader__status file-uploader__status--error"
|
|
19
|
-
},
|
|
19
|
+
}, Y = ["disabled"], ce = /* @__PURE__ */ O({
|
|
20
20
|
__name: "FileUploader",
|
|
21
21
|
props: {
|
|
22
22
|
filebumpUrl: {
|
|
@@ -29,8 +29,10 @@ const Q = {
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
emits: ["fileUploaded"],
|
|
32
|
-
setup(m, { emit:
|
|
33
|
-
const v = m,
|
|
32
|
+
setup(m, { emit: Z }) {
|
|
33
|
+
const v = m, s = n(""), r = n(), f = n(), C = n();
|
|
34
|
+
C.value;
|
|
35
|
+
const i = P("chatAppId"), { setMessageFile: N, resetMessageFile: z, getMessage: I, setRecordingMessage: E } = K(i), c = n("#5F5F5F"), d = n("#404040"), g = n(!1);
|
|
34
36
|
let a = null;
|
|
35
37
|
const y = () => {
|
|
36
38
|
if (!i) {
|
|
@@ -44,35 +46,38 @@ const Q = {
|
|
|
44
46
|
}
|
|
45
47
|
const t = window.getComputedStyle(l), e = t.getPropertyValue("--chotto-fileuploader-trigger-color").trim(), o = t.getPropertyValue("--chotto-fileuploader-trigger-hover-color").trim();
|
|
46
48
|
c.value = e || "#5F5F5F", d.value = o || "#404040";
|
|
47
|
-
}, A =
|
|
48
|
-
|
|
49
|
+
}, A = B(() => g.value ? d.value : c.value);
|
|
50
|
+
$(() => {
|
|
49
51
|
y();
|
|
50
52
|
});
|
|
51
|
-
const F =
|
|
53
|
+
const F = B(() => !I().file), w = () => {
|
|
54
|
+
r.value && (r.value.value = "");
|
|
55
|
+
}, k = () => {
|
|
52
56
|
const l = document.getElementById("chat-input-file-line-" + i);
|
|
53
|
-
l && (l.style.display = "none"), z(), f.value = void 0,
|
|
54
|
-
},
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
l && (l.style.display = "none"), z(), f.value = void 0, s.value = "", w();
|
|
58
|
+
}, D = async () => {
|
|
59
|
+
var t, e;
|
|
60
|
+
const l = (e = (t = r.value) == null ? void 0 : t.files) == null ? void 0 : e[0];
|
|
61
|
+
k(), l && await M(l), w();
|
|
62
|
+
}, x = () => {
|
|
63
|
+
r.value && F.value && v.state == "active" && (w(), r.value.click());
|
|
64
|
+
}, U = async (l) => {
|
|
60
65
|
var e;
|
|
61
66
|
const t = (e = l.clipboardData) == null ? void 0 : e.items;
|
|
62
67
|
if (t) {
|
|
63
68
|
for (let o of t)
|
|
64
69
|
if (o.type.indexOf("image") !== -1) {
|
|
65
70
|
l.preventDefault();
|
|
66
|
-
const
|
|
67
|
-
|
|
71
|
+
const S = o.getAsFile();
|
|
72
|
+
S && M(S);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
|
-
},
|
|
71
|
-
|
|
75
|
+
}, M = async (l) => {
|
|
76
|
+
s.value = "uploading", E(!0);
|
|
72
77
|
const t = typeof v.filebumpUrl == "string" ? v.filebumpUrl : null;
|
|
73
|
-
await
|
|
74
|
-
if (
|
|
75
|
-
|
|
78
|
+
await J(t, l).then((e) => {
|
|
79
|
+
if (E(!1), s.value = e.status, e.status == "success") {
|
|
80
|
+
N({
|
|
76
81
|
url: e.url,
|
|
77
82
|
name: e.name,
|
|
78
83
|
size: e.size,
|
|
@@ -90,8 +95,8 @@ const Q = {
|
|
|
90
95
|
}
|
|
91
96
|
});
|
|
92
97
|
};
|
|
93
|
-
return
|
|
94
|
-
if (window.addEventListener("paste",
|
|
98
|
+
return H(() => {
|
|
99
|
+
if (window.addEventListener("paste", U), y(), i) {
|
|
95
100
|
const l = document.getElementById(i);
|
|
96
101
|
l && (a = new MutationObserver((t) => {
|
|
97
102
|
t.forEach((e) => {
|
|
@@ -102,46 +107,46 @@ const Q = {
|
|
|
102
107
|
attributeFilter: ["data-theme"]
|
|
103
108
|
}));
|
|
104
109
|
}
|
|
105
|
-
}),
|
|
106
|
-
window.removeEventListener("paste",
|
|
107
|
-
}), (l, t) => (u(),
|
|
108
|
-
|
|
110
|
+
}), L(() => {
|
|
111
|
+
window.removeEventListener("paste", U), a && (a.disconnect(), a = null);
|
|
112
|
+
}), (l, t) => (u(), _(R, null, [
|
|
113
|
+
s.value === "uploading" ? (u(), _("div", W, [...t[2] || (t[2] = [
|
|
109
114
|
p("span", null, "Загрузка", -1),
|
|
110
115
|
p("span", null, "файла...", -1)
|
|
111
|
-
])])) :
|
|
116
|
+
])])) : s.value === "error" ? (u(), _("div", X, [...t[3] || (t[3] = [
|
|
112
117
|
p("span", null, "Ошибка при загрузке файла.", -1)
|
|
113
|
-
])])) :
|
|
118
|
+
])])) : b("", !0),
|
|
114
119
|
p("span", {
|
|
115
120
|
ref_key: "triggerElement",
|
|
116
|
-
ref:
|
|
117
|
-
class:
|
|
121
|
+
ref: C,
|
|
122
|
+
class: j(["file-uploader__trigger", { "file-uploader__disabled": !F.value || m.state == "disabled" }]),
|
|
118
123
|
disabled: !F.value || m.state == "disabled",
|
|
119
|
-
onClick:
|
|
124
|
+
onClick: x,
|
|
120
125
|
onMouseenter: t[0] || (t[0] = (e) => g.value = !0),
|
|
121
126
|
onMouseleave: t[1] || (t[1] = (e) => g.value = !1)
|
|
122
127
|
}, [
|
|
123
|
-
|
|
124
|
-
], 42,
|
|
128
|
+
T(h(Q), { fill: A.value }, null, 8, ["fill"])
|
|
129
|
+
], 42, Y),
|
|
125
130
|
p("input", {
|
|
126
131
|
ref_key: "fileInput",
|
|
127
|
-
ref:
|
|
132
|
+
ref: r,
|
|
128
133
|
style: { display: "none" },
|
|
129
134
|
type: "file",
|
|
130
|
-
onChange:
|
|
135
|
+
onChange: D
|
|
131
136
|
}, null, 544),
|
|
132
|
-
|
|
137
|
+
h(I)().file ? (u(), V(q, {
|
|
133
138
|
key: 2,
|
|
134
|
-
to: "#chat-input-file-line-" +
|
|
139
|
+
to: "#chat-input-file-line-" + h(i)
|
|
135
140
|
}, [
|
|
136
|
-
f.value ? (u(),
|
|
141
|
+
f.value ? (u(), V(G, {
|
|
137
142
|
key: 0,
|
|
138
143
|
"file-info": f.value,
|
|
139
|
-
onReset:
|
|
140
|
-
}, null, 8, ["file-info"])) :
|
|
141
|
-
], 8, ["to"])) :
|
|
144
|
+
onReset: k
|
|
145
|
+
}, null, 8, ["file-info"])) : b("", !0)
|
|
146
|
+
], 8, ["to"])) : b("", !0)
|
|
142
147
|
], 64));
|
|
143
148
|
}
|
|
144
149
|
});
|
|
145
150
|
export {
|
|
146
|
-
|
|
151
|
+
ce as default
|
|
147
152
|
};
|
|
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
8
8
|
isNewDialog: boolean;
|
|
9
9
|
selectedDialog: Record<string, any>;
|
|
10
10
|
emptyChannelsPlaceholder: Record<string, any>;
|
|
11
|
+
attributeTooltips: Record<string, any>;
|
|
11
12
|
showChannelIcons: boolean;
|
|
12
13
|
$props: {
|
|
13
14
|
readonly channels?: unknown[] | undefined;
|
|
@@ -18,6 +19,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
18
19
|
readonly isNewDialog?: boolean | undefined;
|
|
19
20
|
readonly selectedDialog?: Record<string, any> | undefined;
|
|
20
21
|
readonly emptyChannelsPlaceholder?: Record<string, any> | undefined;
|
|
22
|
+
readonly attributeTooltips?: Record<string, any> | undefined;
|
|
21
23
|
readonly showChannelIcons?: boolean | undefined;
|
|
22
24
|
};
|
|
23
25
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ declare const meta: {
|
|
|
11
11
|
isNewDialog: boolean;
|
|
12
12
|
selectedDialog: Record<string, any>;
|
|
13
13
|
emptyChannelsPlaceholder: Record<string, any>;
|
|
14
|
+
attributeTooltips: Record<string, any>;
|
|
14
15
|
showChannelIcons: boolean;
|
|
15
16
|
$props: {
|
|
16
17
|
readonly channels?: unknown[] | undefined;
|
|
@@ -21,6 +22,7 @@ declare const meta: {
|
|
|
21
22
|
readonly isNewDialog?: boolean | undefined;
|
|
22
23
|
readonly selectedDialog?: Record<string, any> | undefined;
|
|
23
24
|
readonly emptyChannelsPlaceholder?: Record<string, any> | undefined;
|
|
25
|
+
readonly attributeTooltips?: Record<string, any> | undefined;
|
|
24
26
|
readonly showChannelIcons?: boolean | undefined;
|
|
25
27
|
};
|
|
26
28
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|