@dv.net/ui-kit 7.5.7 → 7.5.9

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dv.net/ui-kit",
3
3
  "private": false,
4
- "version": "7.5.7",
4
+ "version": "7.5.9",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "dist/index.js",
@@ -1,134 +0,0 @@
1
- import { defineComponent as $, ref as b, computed as n, watch as j, onUnmounted as I, createElementBlock as r, openBlock as i, createCommentVNode as u, createElementVNode as c, unref as k, toDisplayString as g, createVNode as G, createBlock as p, normalizeClass as q, Transition as H, withCtx as J, Fragment as A, renderList as B } from "vue";
2
- import { _ as K } from "./UiChatHeader.vue_vue_type_script_setup_true_lang.CkV0GeAh.js";
3
- import "./style.C3xG1ALc.js";
4
- import { _ as P } from "./UiChatFooter.vue_vue_type_script_setup_true_lang.DDY3HZXd.js";
5
- import { _ as Q } from "./UiChatMessage.vue_vue_type_script_setup_true_lang.BkD09EG5.js";
6
- /* empty css */
7
- import { _ as W } from "./UiChatManagerAlert.vue_vue_type_script_setup_true_lang.DzU8TXYU.js";
8
- /* empty css */
9
- import { d, u as X, t as Y } from "./useDatePicker.BwRlPS-o.js";
10
- import { config as l } from "../config/index.js";
11
- import { UiChatTicketStatusValue as L } from "../components/UiChat/types.js";
12
- import { d as Z } from "./UiChatAttachments.vue_vue_type_script_setup_true_lang.DDZ-aWa5.js";
13
- import { useBreakpoints as x } from "../composables/useBreakpoints.js";
14
- const ee = { class: "ui-chat" }, te = {
15
- key: 0,
16
- class: "ui-chat__top"
17
- }, ae = { class: "ui-chat__top-title" }, se = {
18
- key: 0,
19
- class: "ui-chat__top-id"
20
- }, ie = { class: "ui-chat__wrapper" }, ne = { class: "ui-chat__group-date" }, ye = /* @__PURE__ */ $({
21
- __name: "UiChat",
22
- props: {
23
- ticket: {},
24
- messages: { default: () => [] },
25
- currentUserUuid: {},
26
- showManagerAlert: { type: Boolean, default: !1 },
27
- managerAlertSeconds: {},
28
- ticketLoading: { type: Boolean, default: !1 },
29
- isCreateTicket: { type: Boolean, default: !1 },
30
- sendingLoading: { type: Boolean, default: !1 },
31
- enableReopenTicket: { type: Boolean, default: !1 }
32
- },
33
- emits: ["action-ticket", "submit", "attach"],
34
- setup(s, { expose: U, emit: z }) {
35
- d.extend(X), d.extend(Y);
36
- const h = z, { isDesktop: _ } = x(), w = b(), m = b(!s.isCreateTicket);
37
- let o = null;
38
- const M = n(() => l.uiChat.timezone || d.tz.guess()), v = (e) => {
39
- const t = d(e);
40
- return t.isValid() ? t.tz(M.value) : null;
41
- }, D = (e) => {
42
- const t = v(e);
43
- return t?.isValid() ? t.format(l.uiChat.dateFormat) : e.split(/[T\s]/)[0] || e;
44
- }, E = (e) => e.user.uuid === s.currentUserUuid, y = n(() => !s.messages.length || !s.ticket || !s.currentUserUuid), C = n(() => typeof s.ticket?.status?.value < "u"), S = n(() => C.value ? s.ticket?.status?.value === L.MANAGER_CLOSED || s.ticket?.status?.value === L.USER_CLOSED : !1), F = n(() => !(!s.isCreateTicket && !C.value || C.value && S.value)), R = n(() => s.isCreateTicket && y.value && !s.ticketLoading), V = n(() => {
45
- if (!y.value) return s.messages;
46
- if (!m.value) return [];
47
- const e = d().tz(M.value).format(l.uiChat.dateTimeFormat);
48
- return [Z(l.uiChat.translations.defaultMessage, e)];
49
- }), O = n(() => {
50
- const e = {};
51
- for (const t of V.value) {
52
- const a = D(t.created_at);
53
- e[a] || (e[a] = []), e[a].push(t);
54
- }
55
- for (const t in e)
56
- e[t].sort((a, f) => (v(a.created_at)?.valueOf() ?? 0) - (v(f.created_at)?.valueOf() ?? 0));
57
- return e;
58
- }), N = () => {
59
- w.value?.clearInputAndFiles();
60
- };
61
- return j(
62
- R,
63
- (e) => {
64
- if (o && (clearTimeout(o), o = null), !e) {
65
- m.value = !0;
66
- return;
67
- }
68
- m.value = !1, o = setTimeout(() => {
69
- m.value = !0;
70
- }, 1e3);
71
- },
72
- { immediate: !0 }
73
- ), I(() => {
74
- o && (clearTimeout(o), o = null);
75
- }), U({ clearInputAndFiles: N }), (e, t) => (i(), r("div", ee, [
76
- k(_) ? (i(), r("div", te, [
77
- c("span", ae, g(e.ticket?.subject || k(l).uiChat.translations.newTicket), 1),
78
- e.ticket?.id ? (i(), r("span", se, g(k(l).uiChat.translations.ticket) + " #" + g(e.ticket.id), 1)) : u("", !0)
79
- ])) : u("", !0),
80
- c("div", ie, [
81
- G(K, {
82
- ticket: e.ticket,
83
- "is-empty": y.value,
84
- "is-closed-ticket": S.value,
85
- "ticket-loading": e.ticketLoading,
86
- "enable-reopen-ticket": e.enableReopenTicket,
87
- onActionTicket: t[0] || (t[0] = (a) => h("action-ticket", a))
88
- }, null, 8, ["ticket", "is-empty", "is-closed-ticket", "ticket-loading", "enable-reopen-ticket"]),
89
- c("div", {
90
- class: q(["ui-chat__body", { "mobile-layout": k(_) }])
91
- }, [
92
- e.ticketLoading ? u("", !0) : (i(), p(H, {
93
- key: 0,
94
- name: "alert",
95
- mode: "out-in",
96
- appear: ""
97
- }, {
98
- default: J(() => [
99
- e.showManagerAlert ? (i(), p(W, {
100
- key: 0,
101
- seconds: e.managerAlertSeconds
102
- }, null, 8, ["seconds"])) : u("", !0)
103
- ]),
104
- _: 1
105
- })),
106
- e.ticketLoading ? u("", !0) : (i(!0), r(A, { key: 1 }, B(O.value, (a, f) => (i(), r("div", {
107
- key: f,
108
- class: "ui-chat__group"
109
- }, [
110
- c("div", ne, [
111
- c("span", null, g(f), 1)
112
- ]),
113
- (i(!0), r(A, null, B(a, (T) => (i(), p(Q, {
114
- key: T.id,
115
- message: T,
116
- "is-own": E(T)
117
- }, null, 8, ["message", "is-own"]))), 128))
118
- ]))), 128))
119
- ], 2),
120
- F.value ? (i(), p(P, {
121
- key: 0,
122
- ref_key: "footerRef",
123
- ref: w,
124
- "sending-loading": e.sendingLoading,
125
- onSubmit: t[1] || (t[1] = (a) => h("submit", a)),
126
- onAttach: t[2] || (t[2] = (a) => h("attach", a))
127
- }, null, 8, ["sending-loading"])) : u("", !0)
128
- ])
129
- ]));
130
- }
131
- });
132
- export {
133
- ye as _
134
- };
@@ -1,97 +0,0 @@
1
- import { defineComponent as w, ref as o, computed as U, createElementBlock as d, openBlock as h, createElementVNode as i, createVNode as _, Fragment as R, renderList as j, toDisplayString as E } from "vue";
2
- import { _ as g } from "./UiIcon.vue_vue_type_script_setup_true_lang.DFsApq5s.js";
3
- /* empty css */
4
- import { _ as I } from "./UiGallery.vue_vue_type_script_setup_true_lang.BT952T6m.js";
5
- /* empty css */
6
- const J = (n, u) => ({
7
- id: 0,
8
- ticket_id: 0,
9
- message: n,
10
- created_at: u,
11
- updated_at: u,
12
- files: [],
13
- attachments: [],
14
- user: { uuid: "", avatar: null, telegram: null, email: "", name: null }
15
- }), O = 10, f = ["jpg", "jpeg", "png", "heic", "heif"], K = f.join(", "), V = f.map((n) => `.${n}`).join(","), M = { class: "ui-chat-attachments" }, S = ["accept", "multiple"], $ = { class: "ui-chat-attachments__file" }, H = ["src", "alt"], x = { class: "ui-chat-attachments__overlay" }, B = ["onClick"], D = ["disabled", "onClick"], P = { class: "ui-chat-attachments__description" }, Q = /* @__PURE__ */ w({
16
- __name: "UiChatAttachments",
17
- props: {
18
- maxFiles: { default: () => O },
19
- accept: { default: () => V },
20
- sendingLoading: { type: Boolean, default: !1 }
21
- },
22
- emits: ["change"],
23
- setup(n, { expose: u, emit: A }) {
24
- const r = A, v = o(), t = o([]), l = o(/* @__PURE__ */ new Map()), F = () => {
25
- t.value.length >= n.maxFiles || n.sendingLoading || v.value?.click();
26
- }, y = (e) => {
27
- const a = e.target;
28
- if (!a.files?.length) return;
29
- const s = n.maxFiles - t.value.length, c = Array.from(a.files).slice(0, s);
30
- t.value.push(...c), r("change", t.value), a.value = "";
31
- }, C = (e) => {
32
- if (n.sendingLoading) return;
33
- const a = l.value.get(t.value[e]);
34
- a && (window.URL.revokeObjectURL(a), l.value.delete(t.value[e])), t.value.splice(e, 1), r("change", t.value);
35
- }, L = (e) => (l.value.has(e) || l.value.set(e, window.URL.createObjectURL(e)), l.value.get(e)), m = o(!1), p = o(0), b = U(() => t.value.map((e) => ({ file: e }))), k = (e) => {
36
- p.value = e, m.value = !0;
37
- };
38
- return u({ openFileDialog: F, clearFiles: () => {
39
- l.value.forEach((e) => window.URL.revokeObjectURL(e)), l.value.clear(), t.value = [], r("change", []);
40
- } }), (e, a) => (h(), d("div", M, [
41
- i("input", {
42
- ref_key: "fileInput",
43
- ref: v,
44
- type: "file",
45
- accept: e.accept,
46
- multiple: e.maxFiles > 1,
47
- hidden: "",
48
- onChange: y
49
- }, null, 40, S),
50
- (h(!0), d(R, null, j(t.value, (s, c) => (h(), d("div", {
51
- key: c,
52
- class: "ui-chat-attachments__item"
53
- }, [
54
- i("div", $, [
55
- i("img", {
56
- src: L(s),
57
- alt: s.name
58
- }, null, 8, H),
59
- i("div", x, [
60
- i("button", {
61
- class: "ui-chat-attachments__btn ui-chat-attachments__btn--show",
62
- onClick: (T) => k(c)
63
- }, [
64
- _(g, {
65
- name: "visibility",
66
- type: "400"
67
- })
68
- ], 8, B),
69
- i("button", {
70
- class: "ui-chat-attachments__btn ui-chat-attachments__btn--remove",
71
- disabled: e.sendingLoading,
72
- onClick: (T) => C(c)
73
- }, [
74
- _(g, {
75
- name: "close",
76
- type: "400"
77
- })
78
- ], 8, D)
79
- ])
80
- ]),
81
- i("span", P, E(s.name), 1)
82
- ]))), 128)),
83
- _(I, {
84
- modelValue: m.value,
85
- "onUpdate:modelValue": a[0] || (a[0] = (s) => m.value = s),
86
- images: b.value,
87
- "initial-index": p.value
88
- }, null, 8, ["modelValue", "images", "initial-index"])
89
- ]));
90
- }
91
- });
92
- export {
93
- O as A,
94
- Q as _,
95
- K as a,
96
- J as d
97
- };
@@ -1,106 +0,0 @@
1
- import { defineComponent as L, ref as d, computed as $, createElementBlock as V, openBlock as _, createElementVNode as e, createVNode as r, normalizeClass as h, unref as t, createBlock as x, createCommentVNode as B, withCtx as g, renderSlot as v, toDisplayString as c } from "vue";
2
- import { A as m, a as S, _ as T } from "./UiChatAttachments.vue_vue_type_script_setup_true_lang.DDZ-aWa5.js";
3
- /* empty css */
4
- import { _ as b } from "./UiIconButton.vue_vue_type_script_setup_true_lang.DMTMLuQZ.js";
5
- import "./style.C3xG1ALc.js";
6
- import { _ as z } from "./UiTextarea.vue_vue_type_script_setup_true_lang.D7yuONgD.js";
7
- /* empty css */
8
- import { _ as E } from "./UiTooltip.vue_vue_type_script_setup_true_lang.CHftlCxm.js";
9
- import { config as p } from "../config/index.js";
10
- import { useBreakpoints as D } from "../composables/useBreakpoints.js";
11
- const I = { class: "ui-chat__footer-wrapper" }, M = { class: "ui-chat__footer-tooltip" }, N = { class: "ui-chat__footer-input" }, K = /* @__PURE__ */ L({
12
- __name: "UiChatFooter",
13
- props: {
14
- sendingLoading: { type: Boolean, default: !1 }
15
- },
16
- emits: ["submit", "attach"],
17
- setup(C, { expose: y, emit: F }) {
18
- const u = F, { isDesktop: k } = D(), a = d(null), s = d([]), i = d(), A = $(() => s.value.length >= m), f = () => {
19
- !a.value || C.sendingLoading || u("submit", { message: a.value, files: s.value });
20
- };
21
- return y({ clearInputAndFiles: () => {
22
- if (a.value = null, i.value?.clearFiles) {
23
- i.value.clearFiles();
24
- return;
25
- }
26
- s.value = [], u("attach", []);
27
- } }), (o, l) => (_(), V("div", I, [
28
- e("div", {
29
- class: h(["ui-chat__footer", { "mobile-layout": t(k) }])
30
- }, [
31
- A.value ? B("", !0) : (_(), x(E, { key: 0 }, {
32
- text: g(() => [
33
- e("p", M, [
34
- e("span", null, c(t(p).uiChat.translations.maxFiles) + ": " + c(t(m)), 1),
35
- e("span", null, c(t(p).uiChat.translations.supportsFormats) + ": " + c(t(S)), 1)
36
- ])
37
- ]),
38
- default: g(() => [
39
- e("div", {
40
- class: "ui-chat__footer-control",
41
- onClick: l[0] || (l[0] = (n) => i.value?.openFileDialog())
42
- }, [
43
- v(o.$slots, "footer-left", {}, () => [
44
- r(b, {
45
- class: "ui-chat__footer-icon-button",
46
- "icon-name": "attach-file_add",
47
- type: "clear",
48
- "icon-type": "100",
49
- "icon-color": "#1968e5",
50
- size: "xl",
51
- "container-small": "",
52
- disabled: o.sendingLoading
53
- }, null, 8, ["disabled"])
54
- ])
55
- ])
56
- ]),
57
- _: 3
58
- })),
59
- e("div", N, [
60
- r(z, {
61
- class: "ui-chat__footer-input-el",
62
- modelValue: a.value,
63
- "onUpdate:modelValue": l[1] || (l[1] = (n) => a.value = n),
64
- size: "auto",
65
- placeholder: t(p).uiChat.translations.messagePlaceholder,
66
- submitOnEnter: "",
67
- disabled: o.sendingLoading,
68
- onSubmit: f,
69
- "is-empty-value-null": ""
70
- }, null, 8, ["modelValue", "placeholder", "disabled"])
71
- ]),
72
- e("div", {
73
- class: "ui-chat__footer-control",
74
- onClick: f
75
- }, [
76
- v(o.$slots, "footer-right", {}, () => [
77
- r(b, {
78
- class: "ui-chat__footer-icon-button",
79
- "icon-name": "send",
80
- type: "clear",
81
- "icon-type": "400",
82
- "icon-color": "#1968e5",
83
- size: "xl",
84
- "container-small": "",
85
- loading: o.sendingLoading,
86
- disabled: !a.value
87
- }, null, 8, ["loading", "disabled"])
88
- ])
89
- ])
90
- ], 2),
91
- r(T, {
92
- ref_key: "attachmentsRef",
93
- ref: i,
94
- "max-files": t(m),
95
- "sending-loading": o.sendingLoading,
96
- class: h(["ui-chat__footer-attachments", { "ui-chat__footer-attachments--empty": !s.value.length }]),
97
- onChange: l[2] || (l[2] = (n) => {
98
- s.value = n, u("attach", n);
99
- })
100
- }, null, 8, ["max-files", "sending-loading", "class"])
101
- ]));
102
- }
103
- });
104
- export {
105
- K as _
106
- };