@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.
Files changed (30) hide show
  1. package/README.md +33 -0
  2. package/dist/chotto.css +1 -1
  3. package/dist/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.js +32 -27
  4. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +1 -1
  5. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +58 -54
  6. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.js +2 -2
  7. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js +55 -56
  8. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
  9. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +42 -35
  10. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
  11. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +29 -22
  12. package/dist/hooks/messages/useMessageHoverActions.js +9 -8
  13. package/dist/hooks/uploadFile/types.js +4 -0
  14. package/dist/hooks/uploadFile/uploadFile.js +12 -13
  15. package/dist/hooks/uploadFile/useChottoUploader.js +56 -0
  16. package/dist/index.js +157 -152
  17. package/dist/types/apps/data/messages.d.ts +197 -0
  18. package/dist/types/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.d.ts +2 -0
  19. package/dist/types/components/2_chatinput_elements/FileUploader/FileUploader.vue.d.ts +11 -0
  20. package/dist/types/components/2_chatinput_elements/FileUploader/stories/FileUploader.stories.d.ts +2 -0
  21. package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.d.ts +13 -1
  22. package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/stories/WABAAttachmentSection.stories.d.ts +11 -1
  23. package/dist/types/components/2_elements/AudioRecorder/AudioRecorder.vue.d.ts +11 -0
  24. package/dist/types/components/2_elements/VideoRecorder/VideoRecorder.vue.d.ts +11 -0
  25. package/dist/types/hooks/messages/useMessageHoverActions.d.ts +2 -1
  26. package/dist/types/hooks/uploadFile/index.d.ts +2 -0
  27. package/dist/types/hooks/uploadFile/types.d.ts +12 -0
  28. package/dist/types/hooks/uploadFile/uploadFile.d.ts +2 -3
  29. package/dist/types/hooks/uploadFile/useChottoUploader.d.ts +16 -0
  30. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
- import { provide as h, inject as k, ref as s, onMounted as w, createElementBlock as i, openBlock as u, Fragment as B, createCommentVNode as W, createElementVNode as p, unref as S, normalizeClass as T, createVNode as M } from "vue";
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 { useMessageDraft as A } from "../../../hooks/useMessageDraft.js";
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 q from "../../../_virtual/_plugin-vue_export-helper.js";
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 C = {
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: d }) {
53
- const t = a;
54
- h("filebumpUrl", t.filebumpUrl);
55
- const m = k("chatAppId"), { getMessage: c } = A(m), f = s(null), e = s(null), y = d, v = () => {
56
- t.mode == "click" && t.state == "active" && (e.value.style.display == "none" ? e.value.style.display = "inherit" : e.value.style.display == "inherit" && (e.value.style.display = "none"));
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
- t.mode == "hover" && t.state == "active" && (e.value.style.display = "inherit");
63
+ e.mode == "hover" && e.state == "active" && (t.value.style.display = "inherit");
59
64
  }, l = () => {
60
- t.mode == "hover" && t.state == "active" && (e.value.style.display = "none");
61
- }, b = () => {
62
- e.value.style.display = "none";
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
- e.value.style.display = "none";
70
+ t.value.style.display = "none";
66
71
  });
67
- const g = (n) => {
68
- y("sendWabaValues", n);
72
+ const h = (n) => {
73
+ v("sendWabaValues", n);
69
74
  };
70
- return (n, r) => (u(), i(B, null, [
71
- S(c)().isRecording ? W("", !0) : (u(), i("button", {
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: f,
79
+ ref: y,
75
80
  class: T(["button-template", { "button-template-disabled": a.state == "disabled" }]),
76
- onClick: v,
81
+ onClick: b,
77
82
  onMouseover: o,
78
83
  onMouseout: l
79
84
  }, [...r[0] || (r[0] = [
80
- p("span", { class: "pi pi-code" }, null, -1)
85
+ d("span", { class: "pi pi-code" }, null, -1)
81
86
  ])], 34)),
82
- p("div", {
87
+ d("div", {
83
88
  ref_key: "template",
84
- ref: e,
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: b,
94
- onSendWabaValues: g
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
- }, O = /* @__PURE__ */ q(C, [["__scopeId", "data-v-e300d7b9"]]);
104
+ }, Q = /* @__PURE__ */ C(U, [["__scopeId", "data-v-8202d124"]]);
100
105
  export {
101
- O as default
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-0d65ea38"]]);
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 H, ref as n, inject as S, computed as _, unref as U, watchEffect as L, watch as O, onMounted as $, onUnmounted as T, createElementBlock as w, openBlock as A, Fragment as R, createCommentVNode as X, createElementVNode as d, normalizeClass as q, createVNode as G } from "vue";
2
- import { buildFilePreview as J } from "../../../hooks/uploadFile/generatePreview.js";
3
- import { uploadFile as K } from "../../../hooks/uploadFile/uploadFile.js";
4
- import { MAX_ATTACHED_FILES as D, useMessageDraft as Q, getDraftFiles as C } from "../../../hooks/useMessageDraft.js";
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 W from "./icons/FileUploaderIcon.vue.js";
16
- const Y = {
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
- }, Z = {
19
+ }, ee = {
20
20
  key: 1,
21
21
  class: "file-uploader__status file-uploader__status--error"
22
- }, ee = ["disabled"], Fe = /* @__PURE__ */ H({
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: te }) {
40
- const s = v, r = n(""), a = n(), M = n();
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 = S("chatAppId"), N = S("maxAttachedFiles", D), { addMessageFiles: V, getMessage: g, setRecordingMessage: E } = Q(u), F = _(() => {
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 = U(N);
52
+ const e = S(V);
46
53
  return typeof e == "number" && e > 0 ? Math.floor(e) : D;
47
- }), f = n("#5F5F5F"), p = n("#404040"), y = n(!1);
48
- let c = null;
54
+ }), p = n("#5F5F5F"), f = n("#404040"), y = n(!1);
55
+ let d = null;
49
56
  const h = () => {
50
57
  if (!u) {
51
- f.value = "#5F5F5F", p.value = "#404040";
58
+ p.value = "#5F5F5F", f.value = "#404040";
52
59
  return;
53
60
  }
54
61
  const t = document.getElementById(u);
55
62
  if (!t) {
56
- f.value = "#5F5F5F", p.value = "#404040";
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
- f.value = l || "#5F5F5F", p.value = i || "#404040";
61
- }, B = _(() => y.value ? p.value : f.value);
62
- L(() => {
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
- }, P = () => F.value - C(g()).length, I = async (t) => {
68
- const e = t.slice(0, Math.max(0, P()));
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 K(
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: J(o.name, o.preview)
87
+ preview: K(o.name, o.preview)
84
88
  }) : r.value = "error";
85
89
  }
86
- l.length ? (V(l, F.value), r.value !== "error" && (r.value = "success")) : r.value !== "error" && (r.value = "error");
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
- }, j = async () => {
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
- }, z = () => {
99
+ }, H = () => {
96
100
  a.value && m.value && s.state == "active" && (b(), a.value.click());
97
- }, x = async (t) => {
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 k = o.getAsFile();
106
- k && l.push(k);
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 O(
114
+ return $(
111
115
  () => C(g()).length,
112
116
  (t) => {
113
117
  t || (r.value = "", b());
114
118
  }
115
- ), $(() => {
116
- if (window.addEventListener("paste", x), h(), u) {
119
+ ), T(() => {
120
+ if (window.addEventListener("paste", k), h(), u) {
117
121
  const t = document.getElementById(u);
118
- t && (c = new MutationObserver((e) => {
122
+ t && (d = new MutationObserver((e) => {
119
123
  e.forEach((l) => {
120
124
  l.type === "attributes" && l.attributeName === "data-theme" && h();
121
125
  });
122
- }), c.observe(t, {
126
+ }), d.observe(t, {
123
127
  attributes: !0,
124
128
  attributeFilter: ["data-theme"]
125
129
  }));
126
130
  }
127
- }), T(() => {
128
- window.removeEventListener("paste", x), c && (c.disconnect(), c = null);
129
- }), (t, e) => (A(), w(R, null, [
130
- r.value === "uploading" ? (A(), w("div", Y, [...e[2] || (e[2] = [
131
- d("span", null, "Загрузка", -1),
132
- d("span", null, "файла...", -1)
133
- ])])) : r.value === "error" ? (A(), w("div", Z, [...e[3] || (e[3] = [
134
- d("span", null, "Ошибка при загрузке файла.", -1)
135
- ])])) : X("", !0),
136
- d("span", {
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: q(["file-uploader__trigger", { "file-uploader__disabled": !m.value || v.state == "disabled" }]),
143
+ class: G(["file-uploader__trigger", { "file-uploader__disabled": !m.value || v.state == "disabled" }]),
140
144
  disabled: !m.value || v.state == "disabled",
141
- onClick: z,
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
- G(U(W), { fill: B.value }, null, 8, ["fill"])
146
- ], 42, ee),
147
- d("input", {
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: j
157
+ onChange: z
154
158
  }, null, 544)
155
159
  ], 64));
156
160
  }
157
161
  });
158
162
  export {
159
- Fe as default
163
+ ye as default
160
164
  };
@@ -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 a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-8c8d4b41"]]);
4
+ const r = /* @__PURE__ */ o(t, [["__scopeId", "data-v-ad2e24d7"]]);
5
5
  export {
6
- a as default
6
+ r as default
7
7
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as E, ref as n, inject as F, watch as h, createElementBlock as v, openBlock as u, Fragment as A, createBlock as D, createCommentVNode as S, normalizeClass as P, createElementVNode as r, toDisplayString as _, unref as U } from "vue";
2
- import V from "../FilePreview/FilePreview.vue.js";
3
- import { uploadFile as N } from "../../../hooks/uploadFile/uploadFile.js";
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 O = ["accept"], B = { class: "attachment-section__info" }, G = {
15
+ const N = ["accept"], O = { class: "attachment-section__info" }, j = {
16
16
  key: 2,
17
17
  class: "attachment-section__error-text"
18
- }, $ = /* @__PURE__ */ E({
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: w }) {
32
- const c = m, z = n(F("filebumpUrl")), p = n(null), o = n(), l = n(""), i = n(""), f = n(), d = w, k = () => {
33
- o.value && i.value != "success" && o.value.click();
34
- }, s = {
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
- }, I = (a) => {
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
- if (s[c.type].accept.indexOf(y[y.length - 1]) == -1)
63
- l.value = s[c.type].error;
64
- else if (t.size > s[c.type].maxSize)
65
- l.value = "Файл слишком большого размера";
66
- else if (!l.value) {
67
- p.value = t, i.value = "uploading";
68
- const g = U(z.value);
69
- N(typeof g == "string" ? g : null, t).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
- });
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
- }, C = () => {
87
- p.value && (p.value = null, i.value = "");
85
+ }, F = () => {
86
+ c.value && (c.value = null, i.value = "");
88
87
  };
89
- return h(
88
+ return g(
90
89
  () => i.value,
91
90
  (a) => {
92
- a === "" && (o.value && (o.value.value = ""), p.value = null, d("fileSelected", null));
91
+ a === "" && (n.value && (n.value.value = ""), c.value = null, d("fileSelected", null));
93
92
  }
94
- ), h(
95
- () => c.templateId,
93
+ ), g(
94
+ () => o.templateId,
96
95
  () => {
97
96
  i.value = "";
98
97
  }
99
- ), (a, t) => (u(), v(A, null, [
98
+ ), (a, t) => (u(), v(U, null, [
100
99
  i.value !== "success" ? (u(), v("div", {
101
100
  key: 0,
102
- class: P(["attachment-section", { "attachment-section__error": l.value }]),
103
- onClick: k
101
+ class: D(["attachment-section", { "attachment-section__error": l.value }]),
102
+ onClick: z
104
103
  }, [
105
- r("input", {
104
+ p("input", {
106
105
  id: "file-upload",
107
106
  ref_key: "fileInput",
108
- ref: o,
107
+ ref: n,
109
108
  type: "file",
110
109
  style: { display: "none" },
111
- accept: s[m.type].accept,
112
- onChange: I
113
- }, null, 40, O),
114
- t[1] || (t[1] = r("span", { class: "pi pi-paperclip attachment-section__icon" }, null, -1)),
115
- r("div", null, [
116
- t[0] || (t[0] = r("p", { class: "attachment-section__title" }, " Прикрепить файл ", -1)),
117
- r("p", B, _(s[m.type].text), 1)
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(), D(V, {
118
+ ], 2)) : i.value === "success" && f.value ? (u(), A(P, {
120
119
  key: 1,
121
120
  "file-info": f.value,
122
- onReset: C
123
- }, null, 8, ["file-info"])) : S("", !0),
124
- l.value ? (u(), v("div", G, _(l.value), 1)) : S("", !0)
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
- $ as default
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 p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b3be7b0b"]]);
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-419a7965"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };