@mobilon-dev/chotto 0.3.107 → 0.3.109
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/README.md +33 -0
- package/dist/chotto.css +1 -1
- package/dist/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.js +32 -27
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +1 -1
- package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +58 -54
- package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.js +2 -2
- package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js +55 -56
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
- package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +42 -35
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
- package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +29 -22
- package/dist/hooks/messages/useMessageHoverActions.js +9 -8
- package/dist/hooks/uploadFile/types.js +4 -0
- package/dist/hooks/uploadFile/uploadFile.js +12 -13
- package/dist/hooks/uploadFile/useChottoUploader.js +56 -0
- package/dist/index.js +157 -152
- package/dist/types/apps/data/messages.d.ts +197 -0
- package/dist/types/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.d.ts +2 -0
- package/dist/types/components/2_chatinput_elements/FileUploader/FileUploader.vue.d.ts +11 -0
- package/dist/types/components/2_chatinput_elements/FileUploader/stories/FileUploader.stories.d.ts +2 -0
- package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.d.ts +13 -1
- package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/stories/WABAAttachmentSection.stories.d.ts +11 -1
- package/dist/types/components/2_elements/AudioRecorder/AudioRecorder.vue.d.ts +11 -0
- package/dist/types/components/2_elements/VideoRecorder/VideoRecorder.vue.d.ts +11 -0
- package/dist/types/hooks/messages/useMessageHoverActions.d.ts +2 -1
- package/dist/types/hooks/uploadFile/index.d.ts +2 -0
- package/dist/types/hooks/uploadFile/types.d.ts +12 -0
- package/dist/types/hooks/uploadFile/uploadFile.d.ts +2 -3
- package/dist/types/hooks/uploadFile/useChottoUploader.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { provide as
|
|
1
|
+
import { provide as s, inject as k, ref as i, onMounted as w, createElementBlock as u, openBlock as p, Fragment as B, createCommentVNode as W, createElementVNode as d, unref as S, normalizeClass as T, createVNode as M } from "vue";
|
|
2
2
|
import V from "../WABATemplateSelector/WABATemplateSelector.vue.js";
|
|
3
|
-
import {
|
|
3
|
+
import { chottoUploadFileKey as A } from "../../../hooks/uploadFile/types.js";
|
|
4
|
+
import { useMessageDraft as q } from "../../../hooks/useMessageDraft.js";
|
|
4
5
|
import "../../../hooks/useSearchModel.js";
|
|
5
6
|
import "../../../hooks/useTheme.js";
|
|
6
7
|
import "../../../hooks/useEmojiNative.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import
|
|
9
|
+
import C from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
9
10
|
/* empty css */
|
|
10
11
|
import "../../../locale/useLocale.js";
|
|
11
12
|
/* empty css */
|
|
@@ -13,7 +14,7 @@ import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
|
13
14
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
14
15
|
import "../../../functions/parseMarkdown.js";
|
|
15
16
|
/* empty css */
|
|
16
|
-
const
|
|
17
|
+
const U = {
|
|
17
18
|
__name: "ButtonWabaTemplateSelector",
|
|
18
19
|
props: {
|
|
19
20
|
wabaTemplates: {
|
|
@@ -39,6 +40,10 @@ const C = {
|
|
|
39
40
|
type: String,
|
|
40
41
|
default: "https://filebump2.services.mobilon.ru"
|
|
41
42
|
},
|
|
43
|
+
uploader: {
|
|
44
|
+
type: Function,
|
|
45
|
+
default: void 0
|
|
46
|
+
},
|
|
42
47
|
elevatedWindow: {
|
|
43
48
|
type: Boolean,
|
|
44
49
|
required: !1
|
|
@@ -49,39 +54,39 @@ const C = {
|
|
|
49
54
|
}
|
|
50
55
|
},
|
|
51
56
|
emits: ["sendWabaValues"],
|
|
52
|
-
setup(a, { emit:
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
+
setup(a, { emit: m }) {
|
|
58
|
+
const e = a;
|
|
59
|
+
s("filebumpUrl", e.filebumpUrl), e.uploader && s(A, e.uploader);
|
|
60
|
+
const c = k("chatAppId"), { getMessage: f } = q(c), y = i(null), t = i(null), v = m, b = () => {
|
|
61
|
+
e.mode == "click" && e.state == "active" && (t.value.style.display == "none" ? t.value.style.display = "inherit" : t.value.style.display == "inherit" && (t.value.style.display = "none"));
|
|
57
62
|
}, o = () => {
|
|
58
|
-
|
|
63
|
+
e.mode == "hover" && e.state == "active" && (t.value.style.display = "inherit");
|
|
59
64
|
}, l = () => {
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
65
|
+
e.mode == "hover" && e.state == "active" && (t.value.style.display = "none");
|
|
66
|
+
}, g = () => {
|
|
67
|
+
t.value.style.display = "none";
|
|
63
68
|
};
|
|
64
69
|
w(() => {
|
|
65
|
-
|
|
70
|
+
t.value.style.display = "none";
|
|
66
71
|
});
|
|
67
|
-
const
|
|
68
|
-
|
|
72
|
+
const h = (n) => {
|
|
73
|
+
v("sendWabaValues", n);
|
|
69
74
|
};
|
|
70
|
-
return (n, r) => (
|
|
71
|
-
S(
|
|
75
|
+
return (n, r) => (p(), u(B, null, [
|
|
76
|
+
S(f)().isRecording ? W("", !0) : (p(), u("button", {
|
|
72
77
|
key: 0,
|
|
73
78
|
ref_key: "templateButton",
|
|
74
|
-
ref:
|
|
79
|
+
ref: y,
|
|
75
80
|
class: T(["button-template", { "button-template-disabled": a.state == "disabled" }]),
|
|
76
|
-
onClick:
|
|
81
|
+
onClick: b,
|
|
77
82
|
onMouseover: o,
|
|
78
83
|
onMouseout: l
|
|
79
84
|
}, [...r[0] || (r[0] = [
|
|
80
|
-
|
|
85
|
+
d("span", { class: "pi pi-code" }, null, -1)
|
|
81
86
|
])], 34)),
|
|
82
|
-
|
|
87
|
+
d("div", {
|
|
83
88
|
ref_key: "template",
|
|
84
|
-
ref:
|
|
89
|
+
ref: t,
|
|
85
90
|
onMouseover: o,
|
|
86
91
|
onMouseout: l
|
|
87
92
|
}, [
|
|
@@ -90,13 +95,13 @@ const C = {
|
|
|
90
95
|
"group-templates": a.groupTemplates,
|
|
91
96
|
"elevated-window": a.elevatedWindow,
|
|
92
97
|
"chat-background": a.chatBackground,
|
|
93
|
-
onCloseTemplateWindow:
|
|
94
|
-
onSendWabaValues:
|
|
98
|
+
onCloseTemplateWindow: g,
|
|
99
|
+
onSendWabaValues: h
|
|
95
100
|
}, null, 8, ["waba-templates", "group-templates", "elevated-window", "chat-background"])
|
|
96
101
|
], 544)
|
|
97
102
|
], 64));
|
|
98
103
|
}
|
|
99
|
-
},
|
|
104
|
+
}, Q = /* @__PURE__ */ C(U, [["__scopeId", "data-v-8202d124"]]);
|
|
100
105
|
export {
|
|
101
|
-
|
|
106
|
+
Q as default
|
|
102
107
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FileUploader.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-f08e54cf"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { buildFilePreview as
|
|
3
|
-
import {
|
|
4
|
-
import { MAX_ATTACHED_FILES as D, useMessageDraft as
|
|
1
|
+
import { defineComponent as L, ref as n, inject as U, computed as _, unref as S, watchEffect as O, watch as $, onMounted as T, onUnmounted as R, createElementBlock as w, openBlock as A, Fragment as X, createCommentVNode as q, createElementVNode as c, normalizeClass as G, createVNode as J } from "vue";
|
|
2
|
+
import { buildFilePreview as K } from "../../../hooks/uploadFile/generatePreview.js";
|
|
3
|
+
import { useChottoUploader as Q } from "../../../hooks/uploadFile/useChottoUploader.js";
|
|
4
|
+
import { MAX_ATTACHED_FILES as D, useMessageDraft as W, getDraftFiles as C } from "../../../hooks/useMessageDraft.js";
|
|
5
5
|
import "../../../hooks/useSearchModel.js";
|
|
6
6
|
import "../../../hooks/useTheme.js";
|
|
7
7
|
import "../../../hooks/useEmojiNative.js";
|
|
@@ -12,20 +12,24 @@ import "../../../locale/useLocale.js";
|
|
|
12
12
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
13
13
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
14
14
|
import "../../../functions/parseMarkdown.js";
|
|
15
|
-
import
|
|
16
|
-
const
|
|
15
|
+
import Y from "./icons/FileUploaderIcon.vue.js";
|
|
16
|
+
const Z = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "file-uploader__status file-uploader__status--uploading"
|
|
19
|
-
},
|
|
19
|
+
}, ee = {
|
|
20
20
|
key: 1,
|
|
21
21
|
class: "file-uploader__status file-uploader__status--error"
|
|
22
|
-
},
|
|
22
|
+
}, te = ["disabled"], ye = /* @__PURE__ */ L({
|
|
23
23
|
__name: "FileUploader",
|
|
24
24
|
props: {
|
|
25
25
|
filebumpUrl: {
|
|
26
26
|
type: String,
|
|
27
27
|
default: ""
|
|
28
28
|
},
|
|
29
|
+
uploader: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
29
33
|
state: {
|
|
30
34
|
type: String,
|
|
31
35
|
default: "active"
|
|
@@ -36,65 +40,65 @@ const Y = {
|
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
emits: ["fileUploaded"],
|
|
39
|
-
setup(v, { emit:
|
|
40
|
-
const s = v,
|
|
43
|
+
setup(v, { emit: le }) {
|
|
44
|
+
const s = v, { upload: N } = Q({
|
|
45
|
+
uploader: () => s.uploader,
|
|
46
|
+
filebumpUrl: () => s.filebumpUrl
|
|
47
|
+
}), r = n(""), a = n(), M = n();
|
|
41
48
|
M.value;
|
|
42
|
-
const u =
|
|
49
|
+
const u = U("chatAppId"), V = U("maxAttachedFiles", D), { addMessageFiles: B, getMessage: g, setRecordingMessage: E } = W(u), F = _(() => {
|
|
43
50
|
const t = s.maxAttachedFiles;
|
|
44
51
|
if (typeof t == "number" && t > 0) return Math.floor(t);
|
|
45
|
-
const e =
|
|
52
|
+
const e = S(V);
|
|
46
53
|
return typeof e == "number" && e > 0 ? Math.floor(e) : D;
|
|
47
|
-
}),
|
|
48
|
-
let
|
|
54
|
+
}), p = n("#5F5F5F"), f = n("#404040"), y = n(!1);
|
|
55
|
+
let d = null;
|
|
49
56
|
const h = () => {
|
|
50
57
|
if (!u) {
|
|
51
|
-
|
|
58
|
+
p.value = "#5F5F5F", f.value = "#404040";
|
|
52
59
|
return;
|
|
53
60
|
}
|
|
54
61
|
const t = document.getElementById(u);
|
|
55
62
|
if (!t) {
|
|
56
|
-
|
|
63
|
+
p.value = "#5F5F5F", f.value = "#404040";
|
|
57
64
|
return;
|
|
58
65
|
}
|
|
59
66
|
const e = window.getComputedStyle(t), l = e.getPropertyValue("--chotto-fileuploader-trigger-color").trim(), i = e.getPropertyValue("--chotto-fileuploader-trigger-hover-color").trim();
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
67
|
+
p.value = l || "#5F5F5F", f.value = i || "#404040";
|
|
68
|
+
}, P = _(() => y.value ? f.value : p.value);
|
|
69
|
+
O(() => {
|
|
63
70
|
h();
|
|
64
71
|
});
|
|
65
72
|
const m = _(() => C(g()).length < F.value), b = () => {
|
|
66
73
|
a.value && (a.value.value = "");
|
|
67
|
-
},
|
|
68
|
-
const e = t.slice(0, Math.max(0,
|
|
74
|
+
}, j = () => F.value - C(g()).length, I = async (t) => {
|
|
75
|
+
const e = t.slice(0, Math.max(0, j()));
|
|
69
76
|
if (e.length) {
|
|
70
77
|
r.value = "uploading", E(!0);
|
|
71
78
|
try {
|
|
72
79
|
const l = [];
|
|
73
80
|
for (const i of e) {
|
|
74
|
-
const o = await
|
|
75
|
-
typeof s.filebumpUrl == "string" ? s.filebumpUrl : null,
|
|
76
|
-
i
|
|
77
|
-
);
|
|
81
|
+
const o = await N(i, { kind: "file" });
|
|
78
82
|
o.status == "success" ? l.push({
|
|
79
83
|
url: o.url,
|
|
80
84
|
name: o.name,
|
|
81
85
|
size: o.size,
|
|
82
86
|
type: o.type,
|
|
83
|
-
preview:
|
|
87
|
+
preview: K(o.name, o.preview)
|
|
84
88
|
}) : r.value = "error";
|
|
85
89
|
}
|
|
86
|
-
l.length ? (
|
|
90
|
+
l.length ? (B(l, F.value), r.value !== "error" && (r.value = "success")) : r.value !== "error" && (r.value = "error");
|
|
87
91
|
} finally {
|
|
88
92
|
E(!1);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
|
-
},
|
|
95
|
+
}, z = async () => {
|
|
92
96
|
var l;
|
|
93
97
|
const t = (l = a.value) == null ? void 0 : l.files, e = t ? Array.from(t) : [];
|
|
94
98
|
b(), await I(e);
|
|
95
|
-
},
|
|
99
|
+
}, H = () => {
|
|
96
100
|
a.value && m.value && s.state == "active" && (b(), a.value.click());
|
|
97
|
-
},
|
|
101
|
+
}, k = async (t) => {
|
|
98
102
|
var i;
|
|
99
103
|
if (!m.value || s.state !== "active") return;
|
|
100
104
|
const e = (i = t.clipboardData) == null ? void 0 : i.items;
|
|
@@ -102,59 +106,59 @@ const Y = {
|
|
|
102
106
|
const l = [];
|
|
103
107
|
for (const o of e)
|
|
104
108
|
if (o.type.indexOf("image") !== -1) {
|
|
105
|
-
const
|
|
106
|
-
|
|
109
|
+
const x = o.getAsFile();
|
|
110
|
+
x && l.push(x);
|
|
107
111
|
}
|
|
108
112
|
l.length && (t.preventDefault(), await I(l));
|
|
109
113
|
};
|
|
110
|
-
return
|
|
114
|
+
return $(
|
|
111
115
|
() => C(g()).length,
|
|
112
116
|
(t) => {
|
|
113
117
|
t || (r.value = "", b());
|
|
114
118
|
}
|
|
115
|
-
),
|
|
116
|
-
if (window.addEventListener("paste",
|
|
119
|
+
), T(() => {
|
|
120
|
+
if (window.addEventListener("paste", k), h(), u) {
|
|
117
121
|
const t = document.getElementById(u);
|
|
118
|
-
t && (
|
|
122
|
+
t && (d = new MutationObserver((e) => {
|
|
119
123
|
e.forEach((l) => {
|
|
120
124
|
l.type === "attributes" && l.attributeName === "data-theme" && h();
|
|
121
125
|
});
|
|
122
|
-
}),
|
|
126
|
+
}), d.observe(t, {
|
|
123
127
|
attributes: !0,
|
|
124
128
|
attributeFilter: ["data-theme"]
|
|
125
129
|
}));
|
|
126
130
|
}
|
|
127
|
-
}),
|
|
128
|
-
window.removeEventListener("paste",
|
|
129
|
-
}), (t, e) => (A(), w(
|
|
130
|
-
r.value === "uploading" ? (A(), w("div",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
])])) : r.value === "error" ? (A(), w("div",
|
|
134
|
-
|
|
135
|
-
])])) :
|
|
136
|
-
|
|
131
|
+
}), R(() => {
|
|
132
|
+
window.removeEventListener("paste", k), d && (d.disconnect(), d = null);
|
|
133
|
+
}), (t, e) => (A(), w(X, null, [
|
|
134
|
+
r.value === "uploading" ? (A(), w("div", Z, [...e[2] || (e[2] = [
|
|
135
|
+
c("span", null, "Загрузка", -1),
|
|
136
|
+
c("span", null, "файла...", -1)
|
|
137
|
+
])])) : r.value === "error" ? (A(), w("div", ee, [...e[3] || (e[3] = [
|
|
138
|
+
c("span", null, "Ошибка при загрузке файла.", -1)
|
|
139
|
+
])])) : q("", !0),
|
|
140
|
+
c("span", {
|
|
137
141
|
ref_key: "triggerElement",
|
|
138
142
|
ref: M,
|
|
139
|
-
class:
|
|
143
|
+
class: G(["file-uploader__trigger", { "file-uploader__disabled": !m.value || v.state == "disabled" }]),
|
|
140
144
|
disabled: !m.value || v.state == "disabled",
|
|
141
|
-
onClick:
|
|
145
|
+
onClick: H,
|
|
142
146
|
onMouseenter: e[0] || (e[0] = (l) => y.value = !0),
|
|
143
147
|
onMouseleave: e[1] || (e[1] = (l) => y.value = !1)
|
|
144
148
|
}, [
|
|
145
|
-
|
|
146
|
-
], 42,
|
|
147
|
-
|
|
149
|
+
J(S(Y), { fill: P.value }, null, 8, ["fill"])
|
|
150
|
+
], 42, te),
|
|
151
|
+
c("input", {
|
|
148
152
|
ref_key: "fileInput",
|
|
149
153
|
ref: a,
|
|
150
154
|
style: { display: "none" },
|
|
151
155
|
type: "file",
|
|
152
156
|
multiple: "",
|
|
153
|
-
onChange:
|
|
157
|
+
onChange: z
|
|
154
158
|
}, null, 544)
|
|
155
159
|
], 64));
|
|
156
160
|
}
|
|
157
161
|
});
|
|
158
162
|
export {
|
|
159
|
-
|
|
163
|
+
ye as default
|
|
160
164
|
};
|
package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./WABAAttachmentSection.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ o(t, [["__scopeId", "data-v-ad2e24d7"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { defineComponent as I, inject as E, ref as s, watch as g, createElementBlock as v, openBlock as u, Fragment as U, createBlock as A, createCommentVNode as h, normalizeClass as D, createElementVNode as p, toDisplayString as S } from "vue";
|
|
2
|
+
import P from "../FilePreview/FilePreview.vue.js";
|
|
3
|
+
import { useChottoUploader as V } from "../../../hooks/uploadFile/useChottoUploader.js";
|
|
4
4
|
import "../../../hooks/useMessageDraft.js";
|
|
5
5
|
import "../../../hooks/useSearchModel.js";
|
|
6
6
|
import "../../../hooks/useTheme.js";
|
|
@@ -12,10 +12,10 @@ import "../../../locale/useLocale.js";
|
|
|
12
12
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
13
13
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
14
14
|
import "../../../functions/parseMarkdown.js";
|
|
15
|
-
const
|
|
15
|
+
const N = ["accept"], O = { class: "attachment-section__info" }, j = {
|
|
16
16
|
key: 2,
|
|
17
17
|
class: "attachment-section__error-text"
|
|
18
|
-
},
|
|
18
|
+
}, Z = /* @__PURE__ */ I({
|
|
19
19
|
__name: "WABAAttachmentSection",
|
|
20
20
|
props: {
|
|
21
21
|
type: {
|
|
@@ -25,13 +25,20 @@ const O = ["accept"], B = { class: "attachment-section__info" }, G = {
|
|
|
25
25
|
templateId: {
|
|
26
26
|
type: String,
|
|
27
27
|
required: !0
|
|
28
|
+
},
|
|
29
|
+
uploader: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: void 0
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
emits: ["fileSelected"],
|
|
31
|
-
setup(m, { emit:
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
setup(m, { emit: _ }) {
|
|
36
|
+
const o = m, w = E("filebumpUrl", void 0), { upload: k } = V({
|
|
37
|
+
uploader: () => o.uploader,
|
|
38
|
+
filebumpUrl: () => w
|
|
39
|
+
}), c = s(null), n = s(), l = s(""), i = s(""), f = s(), d = _, z = () => {
|
|
40
|
+
n.value && i.value != "success" && n.value.click();
|
|
41
|
+
}, r = {
|
|
35
42
|
DOCUMENT: {
|
|
36
43
|
text: "Документ до 100 МБ",
|
|
37
44
|
accept: ".pdf,.doc,.docx,.xls,.xlsx",
|
|
@@ -53,78 +60,70 @@ const O = ["accept"], B = { class: "attachment-section__info" }, G = {
|
|
|
53
60
|
error: "Некорректный тип файла, выберите MP4 или MOV",
|
|
54
61
|
icon: "pi pi-video"
|
|
55
62
|
}
|
|
56
|
-
},
|
|
63
|
+
}, C = (a) => {
|
|
57
64
|
var x;
|
|
58
65
|
const t = (x = a.target.files) == null ? void 0 : x[0];
|
|
59
66
|
if (t) {
|
|
60
67
|
l.value = "";
|
|
61
68
|
const y = t.name.split(".");
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
isImage: e.preview.isImage,
|
|
78
|
-
isVideo: e.preview.isVideo,
|
|
79
|
-
isAudio: e.preview.isAudio,
|
|
80
|
-
fileName: e.name,
|
|
81
|
-
fileSize: e.preview.fileSize
|
|
82
|
-
}));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
69
|
+
r[o.type].accept.indexOf(y[y.length - 1]) == -1 ? l.value = r[o.type].error : t.size > r[o.type].maxSize ? l.value = "Файл слишком большого размера" : l.value || (c.value = t, i.value = "uploading", k(t, { kind: "file" }).then((e) => {
|
|
70
|
+
i.value = e.status, e.status == "success" && (d("fileSelected", {
|
|
71
|
+
url: e.url,
|
|
72
|
+
filename: e.name,
|
|
73
|
+
filesize: e.size,
|
|
74
|
+
filetype: e.type
|
|
75
|
+
}), e.preview && (f.value = {
|
|
76
|
+
previewUrl: e.preview.previewUrl,
|
|
77
|
+
isImage: e.preview.isImage,
|
|
78
|
+
isVideo: e.preview.isVideo,
|
|
79
|
+
isAudio: e.preview.isAudio,
|
|
80
|
+
fileName: e.name,
|
|
81
|
+
fileSize: e.preview.fileSize
|
|
82
|
+
}));
|
|
83
|
+
}));
|
|
85
84
|
}
|
|
86
|
-
},
|
|
87
|
-
|
|
85
|
+
}, F = () => {
|
|
86
|
+
c.value && (c.value = null, i.value = "");
|
|
88
87
|
};
|
|
89
|
-
return
|
|
88
|
+
return g(
|
|
90
89
|
() => i.value,
|
|
91
90
|
(a) => {
|
|
92
|
-
a === "" && (
|
|
91
|
+
a === "" && (n.value && (n.value.value = ""), c.value = null, d("fileSelected", null));
|
|
93
92
|
}
|
|
94
|
-
),
|
|
95
|
-
() =>
|
|
93
|
+
), g(
|
|
94
|
+
() => o.templateId,
|
|
96
95
|
() => {
|
|
97
96
|
i.value = "";
|
|
98
97
|
}
|
|
99
|
-
), (a, t) => (u(), v(
|
|
98
|
+
), (a, t) => (u(), v(U, null, [
|
|
100
99
|
i.value !== "success" ? (u(), v("div", {
|
|
101
100
|
key: 0,
|
|
102
|
-
class:
|
|
103
|
-
onClick:
|
|
101
|
+
class: D(["attachment-section", { "attachment-section__error": l.value }]),
|
|
102
|
+
onClick: z
|
|
104
103
|
}, [
|
|
105
|
-
|
|
104
|
+
p("input", {
|
|
106
105
|
id: "file-upload",
|
|
107
106
|
ref_key: "fileInput",
|
|
108
|
-
ref:
|
|
107
|
+
ref: n,
|
|
109
108
|
type: "file",
|
|
110
109
|
style: { display: "none" },
|
|
111
|
-
accept:
|
|
112
|
-
onChange:
|
|
113
|
-
}, null, 40,
|
|
114
|
-
t[1] || (t[1] =
|
|
115
|
-
|
|
116
|
-
t[0] || (t[0] =
|
|
117
|
-
|
|
110
|
+
accept: r[m.type].accept,
|
|
111
|
+
onChange: C
|
|
112
|
+
}, null, 40, N),
|
|
113
|
+
t[1] || (t[1] = p("span", { class: "pi pi-paperclip attachment-section__icon" }, null, -1)),
|
|
114
|
+
p("div", null, [
|
|
115
|
+
t[0] || (t[0] = p("p", { class: "attachment-section__title" }, " Прикрепить файл ", -1)),
|
|
116
|
+
p("p", O, S(r[m.type].text), 1)
|
|
118
117
|
])
|
|
119
|
-
], 2)) : i.value === "success" && f.value ? (u(),
|
|
118
|
+
], 2)) : i.value === "success" && f.value ? (u(), A(P, {
|
|
120
119
|
key: 1,
|
|
121
120
|
"file-info": f.value,
|
|
122
|
-
onReset:
|
|
123
|
-
}, null, 8, ["file-info"])) :
|
|
124
|
-
l.value ? (u(), v("div",
|
|
121
|
+
onReset: F
|
|
122
|
+
}, null, 8, ["file-info"])) : h("", !0),
|
|
123
|
+
l.value ? (u(), v("div", j, S(l.value), 1)) : h("", !0)
|
|
125
124
|
], 64));
|
|
126
125
|
}
|
|
127
126
|
});
|
|
128
127
|
export {
|
|
129
|
-
|
|
128
|
+
Z as default
|
|
130
129
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AudioRecorder.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-419a7965"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|