@mobilon-dev/chotto 0.3.62 → 0.3.64

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.
@@ -1,16 +1,19 @@
1
- import { toRef as B, computed as I, ref as m, onMounted as P, nextTick as S, onUnmounted as U, watch as W, createElementBlock as a, openBlock as n, normalizeClass as s, createCommentVNode as u, createElementVNode as d, normalizeStyle as J, Fragment as E, renderList as T, createBlock as q, withCtx as y, toDisplayString as A, createVNode as w } from "vue";
2
- import K from "../../1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js";
3
- import O from "../../1_icons/SettingsIcon.vue.js";
4
- import R from "../../1_atoms/Tooltip/Tooltip.vue.js";
1
+ import { toRef as E, computed as T, ref as f, onMounted as W, nextTick as q, onUnmounted as J, watch as K, createElementBlock as a, openBlock as o, normalizeClass as s, createCommentVNode as u, createElementVNode as d, normalizeStyle as O, Fragment as A, renderList as w, createBlock as y, withCtx as k, toDisplayString as M, createVNode as R } from "vue";
2
+ import Q from "../../1_atoms/ButtonContextMenu/ButtonContextMenu.vue.js";
3
+ import F from "../../1_icons/SettingsIcon.vue.js";
4
+ import L from "../../1_atoms/Tooltip/Tooltip.vue.js";
5
5
  /* empty css */
6
- import Q from "../../../_virtual/_plugin-vue_export-helper.js";
7
- const X = ["onClick"], Z = ["src", "alt"], $ = {
6
+ import X from "../../../_virtual/_plugin-vue_export-helper.js";
7
+ const Z = ["onClick"], $ = ["src", "alt"], ee = {
8
8
  key: 1,
9
9
  class: "sidebar__notification-count"
10
- }, ee = { class: "sidebar__scroll-container" }, te = ["onClick"], oe = ["src", "alt"], ne = ["src"], ie = { key: 2 }, ae = {
10
+ }, te = { class: "sidebar__scroll-container" }, ne = ["onClick"], oe = ["src", "alt"], ie = ["src"], ae = { key: 2 }, se = {
11
11
  key: 2,
12
12
  class: "sidebar__settings-container"
13
- }, se = { class: "sidebar__settings-btn" }, re = {
13
+ }, re = {
14
+ class: "sidebar__settings-btn",
15
+ type: "button"
16
+ }, le = {
14
17
  __name: "SideBar",
15
18
  props: {
16
19
  sidebarItems: {
@@ -32,160 +35,179 @@ const X = ["onClick"], Z = ["src", "alt"], $ = {
32
35
  type: Boolean,
33
36
  required: !1,
34
37
  default: !0
38
+ },
39
+ settingsButtonMode: {
40
+ type: String,
41
+ required: !1,
42
+ default: "menu"
43
+ // 'menu' | 'action'
35
44
  }
36
45
  },
37
- emits: ["selectItem"],
38
- setup(i, { emit: M }) {
39
- const k = i, f = B(k, "sidebarItems"), F = B(k, "menuActions"), L = M, C = I(
40
- () => f.value.filter((e) => e.isFixedBottom).sort((e, t) => t.notificationCount - e.notificationCount)
41
- ), N = I(
42
- () => f.value.filter((e) => !e.isFixedBottom).sort((e, t) => t.notificationCount - e.notificationCount)
43
- ), V = (e) => {
44
- const t = f.value.find((o) => o.itemId === e);
45
- L("selectItem", t);
46
- }, p = (e, t) => {
47
- D(e.currentTarget), V(t);
48
- }, H = (e) => {
46
+ emits: ["selectItem", "settingsClick"],
47
+ setup(i, { emit: N }) {
48
+ const C = i, m = E(C, "sidebarItems"), p = E(C, "menuActions"), z = N, x = T(
49
+ () => m.value.filter((e) => e.isFixedBottom).sort((e, t) => t.notificationCount - e.notificationCount)
50
+ ), V = T(
51
+ () => m.value.filter((e) => !e.isFixedBottom).sort((e, t) => t.notificationCount - e.notificationCount)
52
+ ), H = (e) => {
53
+ const t = m.value.find((n) => n.itemId === e);
54
+ z("selectItem", t);
55
+ }, B = (e, t) => {
56
+ P(e.currentTarget), H(t);
57
+ }, Y = (e) => {
49
58
  const t = e.split(" ");
50
59
  return t.length > 2 ? t.slice(0, 2).join(" ") : e;
51
- }, Y = (e) => {
60
+ }, j = (e) => {
52
61
  console.log("Выбрано действие:", e), typeof e.action == "function" && e.action();
53
- }, j = () => {
62
+ }, D = () => {
54
63
  console.log("Кнопка меню была нажата");
55
- }, l = m(null), v = m(!1), g = m(0), h = m(40), b = m(!1), z = (e) => {
64
+ }, G = () => {
65
+ var t;
66
+ z("settingsClick");
67
+ const e = (t = p.value) == null ? void 0 : t[0];
68
+ e && typeof e.action == "function" && !e.disabled && e.action();
69
+ }, l = f(null), h = f(!1), v = f(0), g = f(40), b = f(!1), I = (e) => {
56
70
  const t = l.value;
57
71
  if (!t || !e) return 0;
58
- const o = t.getBoundingClientRect(), r = e.getBoundingClientRect(), G = r.top + r.height / 2 - o.top - h.value / 2;
59
- return Math.max(0, G);
72
+ const n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), U = r.top + r.height / 2 - n.top - g.value / 2;
73
+ return Math.max(0, U);
60
74
  }, _ = () => {
61
75
  if (!l.value) return;
62
76
  const t = l.value.querySelector(".sidebar__image--active");
63
- t ? (g.value = z(t), v.value = !0) : v.value = !1;
64
- }, D = (e) => {
77
+ t ? (v.value = I(t), h.value = !0) : h.value = !1;
78
+ }, P = (e) => {
65
79
  try {
66
80
  if (!e || !l.value) return;
67
81
  const t = e.querySelector(".sidebar__image");
68
82
  if (!t) return;
69
- const o = z(t), r = 12, c = 160;
70
- b.value = !0, h.value = r, setTimeout(() => {
71
- g.value = o, requestAnimationFrame(() => {
72
- h.value = 40, setTimeout(() => {
83
+ const n = I(t), r = 12, c = 160;
84
+ b.value = !0, g.value = r, setTimeout(() => {
85
+ v.value = n, requestAnimationFrame(() => {
86
+ g.value = 40, setTimeout(() => {
73
87
  b.value = !1;
74
88
  }, c);
75
89
  });
76
90
  }, c);
77
91
  } catch {
78
92
  }
79
- }, x = () => _();
80
- return P(() => {
93
+ }, S = () => _();
94
+ return W(() => {
81
95
  var t;
82
- S(_), window.addEventListener("resize", x);
96
+ q(_), window.addEventListener("resize", S);
83
97
  const e = (t = l.value) == null ? void 0 : t.querySelector(".sidebar__scroll-container");
84
98
  e && e.addEventListener("scroll", _);
85
- }), U(() => {
99
+ }), J(() => {
86
100
  var t;
87
- window.removeEventListener("resize", x);
101
+ window.removeEventListener("resize", S);
88
102
  const e = (t = l.value) == null ? void 0 : t.querySelector(".sidebar__scroll-container");
89
103
  e && e.removeEventListener("scroll", _);
90
- }), W(() => f.value.map((e) => e.selected), () => S(_)), (e, t) => (n(), a("div", {
104
+ }), K(() => m.value.map((e) => e.selected), () => q(_)), (e, t) => (o(), a("div", {
91
105
  ref_key: "containerRef",
92
106
  ref: l,
93
107
  class: s(["sidebar__container", { "sidebar-horizontal__container": i.horizontal }])
94
108
  }, [
95
- !i.horizontal && v.value ? (n(), a("span", {
109
+ !i.horizontal && h.value ? (o(), a("span", {
96
110
  key: 0,
97
111
  class: s(["sidebar__selected-bar", { "is-animating": b.value }]),
98
- style: J({ top: g.value + "px", height: h.value + "px" })
112
+ style: O({ top: v.value + "px", height: g.value + "px" })
99
113
  }, null, 6)) : u("", !0),
100
- C.value.length > 0 ? (n(), a("ul", {
114
+ x.value.length > 0 ? (o(), a("ul", {
101
115
  key: 1,
102
116
  class: s(["sidebar__list-fixed", { "sidebar-horizontal__list-fixed": i.horizontal }])
103
117
  }, [
104
- (n(!0), a(E, null, T(C.value, (o, r) => (n(), a("li", {
118
+ (o(!0), a(A, null, w(x.value, (n, r) => (o(), a("li", {
105
119
  key: r,
106
120
  class: s(["sidebar__item-fixed", { "sidebar-horizontal__item": i.horizontal }]),
107
- onClick: (c) => p(c, o.itemId)
121
+ onClick: (c) => B(c, n.itemId)
108
122
  }, [
109
- o.name ? (n(), q(R, {
123
+ n.name ? (o(), y(L, {
110
124
  key: 0,
111
- text: H(o.name),
125
+ text: Y(n.name),
112
126
  position: "right",
113
127
  offset: 8
114
128
  }, {
115
- default: y(() => [
129
+ default: k(() => [
116
130
  d("img", {
117
- src: o.icon,
118
- alt: o.name,
131
+ src: n.icon,
132
+ alt: n.name,
119
133
  class: s(["sidebar__image", {
120
- "sidebar__image--active": o.selected === !0,
134
+ "sidebar__image--active": n.selected === !0,
121
135
  "sidebar-horizontal__image": i.horizontal
122
136
  }])
123
- }, null, 10, Z),
137
+ }, null, 10, $),
124
138
  t[0] || (t[0] = d("p", null, "Мои", -1))
125
139
  ]),
126
140
  _: 2
127
141
  }, 1032, ["text"])) : u("", !0),
128
- o.notificationCount ? (n(), a("span", $, A(o.notificationCount > 99 ? "99+" : o.notificationCount), 1)) : u("", !0)
129
- ], 10, X))), 128))
142
+ n.notificationCount ? (o(), a("span", ee, M(n.notificationCount > 99 ? "99+" : n.notificationCount), 1)) : u("", !0)
143
+ ], 10, Z))), 128))
130
144
  ], 2)) : u("", !0),
131
- d("div", ee, [
145
+ d("div", te, [
132
146
  d("ul", {
133
147
  class: s(["sidebar__list", { "sidebar-horizontal__list": i.horizontal }])
134
148
  }, [
135
- (n(!0), a(E, null, T(N.value, (o, r) => (n(), a("li", {
149
+ (o(!0), a(A, null, w(V.value, (n, r) => (o(), a("li", {
136
150
  key: r,
137
151
  class: s(["sidebar__item", { "sidebar-horizontal__item": i.horizontal }]),
138
- onClick: (c) => p(c, o.itemId)
152
+ onClick: (c) => B(c, n.itemId)
139
153
  }, [
140
- o.name ? (n(), q(R, {
154
+ n.name ? (o(), y(L, {
141
155
  key: 0,
142
- text: o.name,
156
+ text: n.name,
143
157
  position: "right",
144
158
  offset: 8
145
159
  }, {
146
- default: y(() => [
160
+ default: k(() => [
147
161
  d("img", {
148
- src: o.icon,
149
- alt: o.name,
162
+ src: n.icon,
163
+ alt: n.name,
150
164
  class: s(["sidebar__image", {
151
- "sidebar__image--active": o.selected === !0,
165
+ "sidebar__image--active": n.selected === !0,
152
166
  "sidebar-horizontal__image": i.horizontal
153
167
  }])
154
168
  }, null, 10, oe)
155
169
  ]),
156
170
  _: 2
157
- }, 1032, ["text"])) : (n(), a("img", {
171
+ }, 1032, ["text"])) : (o(), a("img", {
158
172
  key: 1,
159
- src: o.icon,
173
+ src: n.icon,
160
174
  alt: "icon",
161
175
  class: s(["sidebar__image", {
162
- "sidebar__image--active": o.selected === !0,
176
+ "sidebar__image--active": n.selected === !0,
163
177
  "sidebar-horizontal__image": i.horizontal
164
178
  }])
165
- }, null, 10, ne)),
166
- o.notificationCount ? (n(), a("span", ie, A(o.notificationCount > 99 ? "99+" : o.notificationCount), 1)) : u("", !0)
167
- ], 10, te))), 128))
179
+ }, null, 10, ie)),
180
+ n.notificationCount ? (o(), a("span", ae, M(n.notificationCount > 99 ? "99+" : n.notificationCount), 1)) : u("", !0)
181
+ ], 10, ne))), 128))
168
182
  ], 2)
169
183
  ]),
170
- i.showSettings ? (n(), a("div", ae, [
171
- w(K, {
172
- actions: F.value,
184
+ i.showSettings ? (o(), a("div", se, [
185
+ i.settingsButtonMode === "menu" ? (o(), y(Q, {
186
+ key: 0,
187
+ actions: p.value,
173
188
  mode: "click",
174
189
  "menu-side": "top-right",
175
- onClick: Y,
176
- onButtonClick: j
190
+ onClick: j,
191
+ onButtonClick: D
177
192
  }, {
178
- default: y(() => [
179
- d("button", se, [
180
- w(O)
193
+ default: k(() => [
194
+ d("button", re, [
195
+ R(F)
181
196
  ])
182
197
  ]),
183
198
  _: 1
184
- }, 8, ["actions"])
199
+ }, 8, ["actions"])) : (o(), a("button", {
200
+ key: 1,
201
+ class: "sidebar__settings-btn",
202
+ type: "button",
203
+ onClick: G
204
+ }, [
205
+ R(F)
206
+ ]))
185
207
  ])) : u("", !0)
186
208
  ], 2));
187
209
  }
188
- }, fe = /* @__PURE__ */ Q(re, [["__scopeId", "data-v-8b18d054"]]);
210
+ }, ge = /* @__PURE__ */ X(le, [["__scopeId", "data-v-eb5412c6"]]);
189
211
  export {
190
- fe as default
212
+ ge as default
191
213
  };