@mobilon-dev/chotto 0.3.85 → 0.3.86
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 +174 -165
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.js +21 -18
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.js +32 -27
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.js +44 -35
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -0
- package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.d.ts +3 -1
- package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.d.ts +3 -0
- package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.d.ts +4 -2
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { needsAttributeConfirmation as m } from "./useCommunicationAttributes.js";
|
|
2
|
-
import { resolveRecentChannelSelection as
|
|
3
|
-
function
|
|
2
|
+
import { resolveRecentChannelSelection as K } from "./useCommunicationRecentSelection.js";
|
|
3
|
+
function Z({
|
|
4
4
|
activeChannelType: l,
|
|
5
5
|
channels: v,
|
|
6
6
|
selectedChannel: i,
|
|
@@ -9,7 +9,8 @@ function Y({
|
|
|
9
9
|
confirmingAttributeId: q,
|
|
10
10
|
isAttributeBlocked: u,
|
|
11
11
|
closeMenu: a,
|
|
12
|
-
|
|
12
|
+
pinMenuOpen: A,
|
|
13
|
+
hasMultipleChannels: G,
|
|
13
14
|
getSingleChannelForType: x,
|
|
14
15
|
getAvailableChannels: C,
|
|
15
16
|
isChannelEmpty: d,
|
|
@@ -20,13 +21,13 @@ function Y({
|
|
|
20
21
|
panelPendingSelection: f
|
|
21
22
|
}) {
|
|
22
23
|
const b = (n, e, r) => {
|
|
23
|
-
u(n) || (q.value = n.id, t("confirm-attribute", {
|
|
24
|
+
u(n) || (A(), q.value = n.id, t("confirm-attribute", {
|
|
24
25
|
attributeId: n.id,
|
|
25
26
|
channelId: e,
|
|
26
27
|
channelType: r,
|
|
27
28
|
attribute: n
|
|
28
29
|
}));
|
|
29
|
-
},
|
|
30
|
+
}, H = (n, e, r) => {
|
|
30
31
|
if (m(n)) {
|
|
31
32
|
b(n, e, r);
|
|
32
33
|
return;
|
|
@@ -60,34 +61,36 @@ function Y({
|
|
|
60
61
|
h(n);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
if (!
|
|
64
|
+
if (!G(e)) {
|
|
64
65
|
const r = x(e);
|
|
65
|
-
r &&
|
|
66
|
+
r && H(n, r.channelId, e);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
70
|
selectSingleChannel: j,
|
|
70
71
|
selectChannel: (n) => {
|
|
71
72
|
const e = z.value, r = l.value;
|
|
72
|
-
if (!e || !r
|
|
73
|
+
if (!e || !r) {
|
|
73
74
|
a();
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (!u(e)) {
|
|
78
|
+
if (m(e)) {
|
|
79
|
+
b(e, n, r);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
t("select-attribute-channel", {
|
|
83
|
+
attributeId: e.id,
|
|
84
|
+
channelId: n
|
|
85
|
+
}), s.value = r, i.value = v.value.find((c) => c.channelId === n) ?? {}, d(n) && I.value ? R() : S(), a();
|
|
79
86
|
}
|
|
80
|
-
t("select-attribute-channel", {
|
|
81
|
-
attributeId: e.id,
|
|
82
|
-
channelId: n
|
|
83
|
-
}), s.value = r, i.value = v.value.find((c) => c.channelId === n) ?? {}, d(n) && I.value ? R() : S(), a();
|
|
84
87
|
},
|
|
85
88
|
availableChannels: () => {
|
|
86
89
|
const n = l.value;
|
|
87
90
|
return n ? C(n) : [];
|
|
88
91
|
},
|
|
89
92
|
applyRecentChannelButtonSelection: (n, e, r) => {
|
|
90
|
-
const c =
|
|
93
|
+
const c = K(
|
|
91
94
|
n,
|
|
92
95
|
e,
|
|
93
96
|
r,
|
|
@@ -104,7 +107,7 @@ function Y({
|
|
|
104
107
|
}), t("select-attribute-channel", {
|
|
105
108
|
attributeId: P.id,
|
|
106
109
|
channelId: o
|
|
107
|
-
}), s.value = n, i.value = v.value.find((
|
|
110
|
+
}), s.value = n, i.value = v.value.find((J) => J.channelId === o) ?? {}, d(o) && I.value ? R() : S(), !0);
|
|
108
111
|
},
|
|
109
112
|
clearPanelPendingSelection: () => {
|
|
110
113
|
f && (f.value = null);
|
|
@@ -112,5 +115,5 @@ function Y({
|
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
117
|
export {
|
|
115
|
-
|
|
118
|
+
Z as useCommunicationActions
|
|
116
119
|
};
|
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
panelRef:
|
|
4
|
-
selectedChannelType:
|
|
5
|
-
frozenAttribute:
|
|
1
|
+
import { ref as n, nextTick as p } from "vue";
|
|
2
|
+
function w({
|
|
3
|
+
panelRef: d,
|
|
4
|
+
selectedChannelType: h,
|
|
5
|
+
frozenAttribute: r
|
|
6
6
|
}) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const u = n(null), C = n(null), a = n(!1), s = n(!1), t = n(!1), l = n(!1), i = () => {
|
|
8
|
+
l.value = !1, a.value = !1, u.value = null, r.value = null, s.value = !1;
|
|
9
|
+
}, m = () => {
|
|
10
|
+
l.value = !0;
|
|
11
|
+
}, c = () => {
|
|
12
|
+
t.value = !0, p(() => {
|
|
13
|
+
p(() => {
|
|
14
|
+
t.value = !1;
|
|
13
15
|
});
|
|
14
16
|
});
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
+
}, f = (e) => {
|
|
18
|
+
l.value = !1, u.value = e, a.value = !0, s.value = !1, r.value = null, c();
|
|
17
19
|
};
|
|
18
20
|
return {
|
|
19
|
-
activeChannelType:
|
|
20
|
-
hoveredChannel:
|
|
21
|
-
showMenu:
|
|
22
|
-
showSubMenu:
|
|
21
|
+
activeChannelType: u,
|
|
22
|
+
hoveredChannel: C,
|
|
23
|
+
showMenu: a,
|
|
24
|
+
showSubMenu: s,
|
|
25
|
+
retainOpenUntilDismiss: l,
|
|
23
26
|
handleChannelClick: (e) => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
27
|
+
if (h.value === e && u.value === e) {
|
|
28
|
+
i();
|
|
26
29
|
return;
|
|
27
30
|
}
|
|
28
|
-
|
|
31
|
+
f(e);
|
|
29
32
|
},
|
|
30
|
-
openMenu:
|
|
31
|
-
closeMenu:
|
|
33
|
+
openMenu: f,
|
|
34
|
+
closeMenu: i,
|
|
35
|
+
pinMenuOpen: m,
|
|
36
|
+
armOutsideClickSuppression: c,
|
|
32
37
|
handleClickOutside: (e) => {
|
|
33
|
-
if (
|
|
38
|
+
if (t.value || l.value)
|
|
34
39
|
return;
|
|
35
|
-
const o =
|
|
40
|
+
const o = d.value;
|
|
36
41
|
if (!o)
|
|
37
42
|
return;
|
|
38
|
-
const
|
|
39
|
-
Array.isArray(
|
|
43
|
+
const v = typeof e.composedPath == "function" ? e.composedPath() : [];
|
|
44
|
+
Array.isArray(v) && v.includes(o) || o.contains(e.target) || i();
|
|
40
45
|
}
|
|
41
46
|
};
|
|
42
47
|
}
|
|
43
48
|
export {
|
|
44
|
-
|
|
49
|
+
w as useCommunicationMenu
|
|
45
50
|
};
|
|
@@ -1,58 +1,67 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
activeChannelType:
|
|
4
|
-
showSubMenu:
|
|
5
|
-
frozenAttribute:
|
|
6
|
-
hoveredAttribute:
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ref as E } from "vue";
|
|
2
|
+
function O({
|
|
3
|
+
activeChannelType: S,
|
|
4
|
+
showSubMenu: u,
|
|
5
|
+
frozenAttribute: n,
|
|
6
|
+
hoveredAttribute: c,
|
|
7
|
+
confirmingAttributeId: v,
|
|
8
|
+
retainOpenUntilDismiss: i,
|
|
9
|
+
hasMultipleChannels: b,
|
|
10
|
+
isAttributeBlocked: f
|
|
9
11
|
}) {
|
|
10
|
-
const
|
|
12
|
+
const l = E(0), y = () => i.value || !!v.value || f(c.value ?? n.value);
|
|
11
13
|
return {
|
|
12
|
-
subMenuTop:
|
|
13
|
-
handleAttributeMouseEnter: (e,
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
subMenuTop: l,
|
|
15
|
+
handleAttributeMouseEnter: (e, o) => {
|
|
16
|
+
const t = S.value;
|
|
17
|
+
if (!t || !b(t))
|
|
18
|
+
return null;
|
|
19
|
+
if (i.value || v.value) {
|
|
20
|
+
const a = n.value ?? c.value;
|
|
21
|
+
if (u.value || a && a.id !== e.id)
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return c.value = e, u.value = !0, n.value = e, o;
|
|
16
25
|
},
|
|
17
26
|
handleAttributeMouseLeave: () => {
|
|
18
|
-
|
|
27
|
+
u.value || (n.value = null);
|
|
19
28
|
},
|
|
20
29
|
keepSubMenuOpen: () => {
|
|
21
|
-
|
|
30
|
+
u.value = !0;
|
|
22
31
|
},
|
|
23
32
|
closeSubMenu: () => {
|
|
24
|
-
|
|
33
|
+
y() || (u.value = !1, n.value = null);
|
|
25
34
|
},
|
|
26
|
-
alignSubMenuWithTarget: (e,
|
|
27
|
-
var
|
|
28
|
-
if (!
|
|
29
|
-
|
|
35
|
+
alignSubMenuWithTarget: (e, o) => {
|
|
36
|
+
var t, a, d;
|
|
37
|
+
if (!o) {
|
|
38
|
+
l.value = 0;
|
|
30
39
|
return;
|
|
31
40
|
}
|
|
32
41
|
try {
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
|
|
42
|
+
const p = (t = e.value) == null ? void 0 : t.querySelector(".attributes-menu"), s = (a = e.value) == null ? void 0 : a.querySelector(".sub-menu-header"), m = (d = e.value) == null ? void 0 : d.querySelector(".sub-menu");
|
|
43
|
+
if (!p) {
|
|
44
|
+
l.value = 0;
|
|
36
45
|
return;
|
|
37
46
|
}
|
|
38
|
-
const
|
|
39
|
-
let
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
47
|
+
const B = p.getBoundingClientRect(), C = o.getBoundingClientRect();
|
|
48
|
+
let g = 0;
|
|
49
|
+
if (s) {
|
|
50
|
+
const r = s.getBoundingClientRect(), T = getComputedStyle(s), h = parseFloat(T.marginBottom || "0");
|
|
51
|
+
g = r.height + (Number.isNaN(h) ? 0 : h);
|
|
43
52
|
}
|
|
44
|
-
let
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
|
|
53
|
+
let M = 0;
|
|
54
|
+
if (m) {
|
|
55
|
+
const r = getComputedStyle(m);
|
|
56
|
+
M = parseFloat(r.paddingTop || "0") || 0;
|
|
48
57
|
}
|
|
49
|
-
|
|
58
|
+
l.value = C.top - B.top - g - M - 2;
|
|
50
59
|
} catch {
|
|
51
|
-
|
|
60
|
+
l.value = 0;
|
|
52
61
|
}
|
|
53
62
|
}
|
|
54
63
|
};
|
|
55
64
|
}
|
|
56
65
|
export {
|
|
57
|
-
|
|
66
|
+
O as useCommunicationSubMenu
|
|
58
67
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
/** Снять pin и закрыть оба меню (вызывать с host при ОК на splash). */
|
|
3
|
+
closeMenu: () => void;
|
|
2
4
|
$emit: (event: "select-attribute-channel" | "confirm-attribute" | "phone-call" | "reset-blocked-attributes", ...args: any[]) => void;
|
|
3
5
|
channels: unknown[];
|
|
4
6
|
messages: unknown[];
|
package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ interface UseCommunicationActionsOptions {
|
|
|
32
32
|
confirmingAttributeId: Ref<string | null>;
|
|
33
33
|
isAttributeBlocked: (attribute: ContactAttribute | null | undefined) => boolean;
|
|
34
34
|
closeMenu: () => void;
|
|
35
|
+
/** Закрепить меню до closeMenu (клик снаружи) — на время confirm-attribute. */
|
|
36
|
+
pinMenuOpen: () => void;
|
|
35
37
|
hasMultipleChannels: (channelType: string) => boolean;
|
|
36
38
|
getSingleChannelForType: (channelType: string) => Channel | null;
|
|
37
39
|
getAvailableChannels: (channelType: string) => Channel[];
|
|
@@ -50,7 +52,7 @@ interface UseCommunicationActionsOptions {
|
|
|
50
52
|
/**
|
|
51
53
|
* Инкапсулирует действия панели: звонок, выбор каналов, выбор атрибутов.
|
|
52
54
|
*/
|
|
53
|
-
export declare function useCommunicationActions({ activeChannelType, channels, selectedChannel, selectedChannelType, hoveredAttribute, confirmingAttributeId, isAttributeBlocked, closeMenu, hasMultipleChannels, getSingleChannelForType, getAvailableChannels, isChannelEmpty, isNewDialog, showDefaultChannelTooltipWithTimer, clearDefaultChannelTooltip, emit, panelPendingSelection, }: UseCommunicationActionsOptions): {
|
|
55
|
+
export declare function useCommunicationActions({ activeChannelType, channels, selectedChannel, selectedChannelType, hoveredAttribute, confirmingAttributeId, isAttributeBlocked, closeMenu, pinMenuOpen, hasMultipleChannels, getSingleChannelForType, getAvailableChannels, isChannelEmpty, isNewDialog, showDefaultChannelTooltipWithTimer, clearDefaultChannelTooltip, emit, panelPendingSelection, }: UseCommunicationActionsOptions): {
|
|
54
56
|
handlePhoneCall: (attribute: ContactAttribute | null | undefined) => void;
|
|
55
57
|
handleAttributeClick: (attribute: ContactAttribute) => void;
|
|
56
58
|
selectSingleChannel: (attribute: ContactAttribute, channelId: string) => void;
|
package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.d.ts
CHANGED
|
@@ -18,9 +18,12 @@ export declare function useCommunicationMenu({ panelRef, selectedChannelType, fr
|
|
|
18
18
|
hoveredChannel: Ref<string | null, string | null>;
|
|
19
19
|
showMenu: Ref<boolean, boolean>;
|
|
20
20
|
showSubMenu: Ref<boolean, boolean>;
|
|
21
|
+
retainOpenUntilDismiss: Ref<boolean, boolean>;
|
|
21
22
|
handleChannelClick: (channelType: string) => void;
|
|
22
23
|
openMenu: (channelType: string) => void;
|
|
23
24
|
closeMenu: () => void;
|
|
25
|
+
pinMenuOpen: () => void;
|
|
26
|
+
armOutsideClickSuppression: () => void;
|
|
24
27
|
handleClickOutside: (event: Event) => void;
|
|
25
28
|
};
|
|
26
29
|
export {};
|
package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { type Ref } from 'vue';
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
2
|
import type { ContactAttribute } from './useCommunicationAttributes';
|
|
3
3
|
interface UseCommunicationSubMenuOptions {
|
|
4
4
|
activeChannelType: Ref<string | null>;
|
|
5
5
|
showSubMenu: Ref<boolean>;
|
|
6
6
|
frozenAttribute: Ref<ContactAttribute | null>;
|
|
7
7
|
hoveredAttribute: Ref<ContactAttribute | null>;
|
|
8
|
+
confirmingAttributeId: Ref<string | null> | ComputedRef<string | null>;
|
|
9
|
+
retainOpenUntilDismiss: Ref<boolean>;
|
|
8
10
|
hasMultipleChannels: (channelType: string) => boolean;
|
|
9
11
|
isAttributeBlocked: (attribute: ContactAttribute | null | undefined) => boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Управляет состоянием подменю выбора канала и hover-состояниями атрибутов.
|
|
13
15
|
*/
|
|
14
|
-
export declare function useCommunicationSubMenu({ activeChannelType, showSubMenu, frozenAttribute, hoveredAttribute, hasMultipleChannels, isAttributeBlocked, }: UseCommunicationSubMenuOptions): {
|
|
16
|
+
export declare function useCommunicationSubMenu({ activeChannelType, showSubMenu, frozenAttribute, hoveredAttribute, confirmingAttributeId, retainOpenUntilDismiss, hasMultipleChannels, isAttributeBlocked, }: UseCommunicationSubMenuOptions): {
|
|
15
17
|
subMenuTop: Ref<number, number>;
|
|
16
18
|
handleAttributeMouseEnter: (attribute: ContactAttribute, eventTarget: EventTarget | null) => EventTarget | null;
|
|
17
19
|
handleAttributeMouseLeave: () => void;
|
package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
4
|
component: import("vue").DefineComponent<{}, {
|
|
5
|
+
closeMenu: () => void;
|
|
5
6
|
$emit: (event: "select-attribute-channel" | "confirm-attribute" | "phone-call" | "reset-blocked-attributes", ...args: any[]) => void;
|
|
6
7
|
channels: unknown[];
|
|
7
8
|
messages: unknown[];
|