alytus-ff 0.1.25 → 0.1.26

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/App.vue.d.ts CHANGED
@@ -1,5 +1,56 @@
1
+ import { IUser } from './types/User.ts';
2
+ import { LanguageAndFlag } from './types/Lang.ts';
3
+ import { IAccount } from './types/Account.ts';
1
4
  declare const _default: import('vue').DefineComponent<{}, {
2
5
  showDialog: import('vue').Ref<boolean, boolean>;
6
+ showDialog2: import('vue').Ref<boolean, boolean>;
7
+ baseUrl: import('vue').Ref<string, string>;
8
+ currentUser: import('vue').Ref<{
9
+ name: string;
10
+ surname: string | null;
11
+ initials: string;
12
+ color: string;
13
+ avatar_thumb: string | null;
14
+ email: string;
15
+ }, IUser | {
16
+ name: string;
17
+ surname: string | null;
18
+ initials: string;
19
+ color: string;
20
+ avatar_thumb: string | null;
21
+ email: string;
22
+ }>;
23
+ currentAccount: import('vue').Ref<{
24
+ id: number;
25
+ name: string;
26
+ surname: string | null;
27
+ initials: string;
28
+ }, IAccount | {
29
+ id: number;
30
+ name: string;
31
+ surname: string | null;
32
+ initials: string;
33
+ }>;
34
+ accounts: import('vue').Ref<{
35
+ id: number;
36
+ name: string;
37
+ surname: string | null;
38
+ initials: string;
39
+ }[], IAccount[] | {
40
+ id: number;
41
+ name: string;
42
+ surname: string | null;
43
+ initials: string;
44
+ }[]>;
45
+ langs: import('vue').Ref<{
46
+ title: string;
47
+ value: string;
48
+ icon: string;
49
+ }[], LanguageAndFlag[] | {
50
+ title: string;
51
+ value: string;
52
+ icon: string;
53
+ }[]>;
3
54
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {
4
55
  PageSubtitle: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
56
  subtitle: {
@@ -24,7 +75,7 @@ declare const _default: import('vue').DefineComponent<{}, {
24
75
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
25
76
  UserAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
26
77
  user: {
27
- type: import('vue').PropType<import('.').IUser>;
78
+ type: import('vue').PropType<IUser>;
28
79
  required: true;
29
80
  };
30
81
  size: {
@@ -39,7 +90,7 @@ declare const _default: import('vue').DefineComponent<{}, {
39
90
  fullName: import('vue').ComputedRef<string>;
40
91
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
41
92
  user: {
42
- type: import('vue').PropType<import('.').IUser>;
93
+ type: import('vue').PropType<IUser>;
43
94
  required: true;
44
95
  };
45
96
  size: {
@@ -53,7 +104,7 @@ declare const _default: import('vue').DefineComponent<{}, {
53
104
  }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
54
105
  AccountAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
55
106
  item: {
56
- type: import('vue').PropType<import('.').IAccount>;
107
+ type: import('vue').PropType<IAccount>;
57
108
  required: true;
58
109
  };
59
110
  size: {
@@ -62,7 +113,7 @@ declare const _default: import('vue').DefineComponent<{}, {
62
113
  };
63
114
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
64
115
  item: {
65
- type: import('vue').PropType<import('.').IAccount>;
116
+ type: import('vue').PropType<IAccount>;
66
117
  required: true;
67
118
  };
68
119
  size: {
@@ -152,5 +203,143 @@ declare const _default: import('vue').DefineComponent<{}, {
152
203
  noFullScreen: boolean;
153
204
  fullHeight: boolean;
154
205
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
206
+ UserMenu: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
207
+ currentUser: {
208
+ type: import('vue').PropType<IUser>;
209
+ required: true;
210
+ };
211
+ currentAccount: {
212
+ type: import('vue').PropType<IAccount>;
213
+ default: null;
214
+ };
215
+ currentLang: {
216
+ type: import('vue').PropType<LanguageAndFlag>;
217
+ required: true;
218
+ };
219
+ accounts: {
220
+ type: import('vue').PropType<IAccount[]>;
221
+ required: true;
222
+ };
223
+ langs: {
224
+ type: import('vue').PropType<LanguageAndFlag[]>;
225
+ required: true;
226
+ };
227
+ baseUrl: {
228
+ type: StringConstructor;
229
+ required: true;
230
+ };
231
+ texts: {
232
+ type: import('vue').PropType<{
233
+ [key: string]: string;
234
+ }>;
235
+ required: true;
236
+ };
237
+ }>, {
238
+ isOpen: import('vue').Ref<boolean, boolean>;
239
+ userName: import('vue').ComputedRef<string>;
240
+ langMenu: import('vue').Ref<boolean, boolean>;
241
+ selectAccount: (account: IAccount) => void;
242
+ openProfile: () => void;
243
+ switchLang: (lang: LanguageAndFlag) => void;
244
+ logOut: () => void;
245
+ }, {}, {}, {
246
+ mdiLogout(): string;
247
+ mdiAccount(): string;
248
+ mdiMenuDown(): string;
249
+ mdiCheck(): string;
250
+ formatFullName: (obj: {
251
+ name: string;
252
+ surname: string | null;
253
+ }) => string;
254
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("open-profile" | "select-account" | "switch-lang" | "log-out")[], "open-profile" | "select-account" | "switch-lang" | "log-out", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
255
+ currentUser: {
256
+ type: import('vue').PropType<IUser>;
257
+ required: true;
258
+ };
259
+ currentAccount: {
260
+ type: import('vue').PropType<IAccount>;
261
+ default: null;
262
+ };
263
+ currentLang: {
264
+ type: import('vue').PropType<LanguageAndFlag>;
265
+ required: true;
266
+ };
267
+ accounts: {
268
+ type: import('vue').PropType<IAccount[]>;
269
+ required: true;
270
+ };
271
+ langs: {
272
+ type: import('vue').PropType<LanguageAndFlag[]>;
273
+ required: true;
274
+ };
275
+ baseUrl: {
276
+ type: StringConstructor;
277
+ required: true;
278
+ };
279
+ texts: {
280
+ type: import('vue').PropType<{
281
+ [key: string]: string;
282
+ }>;
283
+ required: true;
284
+ };
285
+ }>> & Readonly<{
286
+ "onOpen-profile"?: ((...args: any[]) => any) | undefined;
287
+ "onSelect-account"?: ((...args: any[]) => any) | undefined;
288
+ "onSwitch-lang"?: ((...args: any[]) => any) | undefined;
289
+ "onLog-out"?: ((...args: any[]) => any) | undefined;
290
+ }>, {
291
+ currentAccount: IAccount;
292
+ }, {}, {
293
+ AccountAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
294
+ item: {
295
+ type: import('vue').PropType<IAccount>;
296
+ required: true;
297
+ };
298
+ size: {
299
+ type: NumberConstructor;
300
+ default: number;
301
+ };
302
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
303
+ item: {
304
+ type: import('vue').PropType<IAccount>;
305
+ required: true;
306
+ };
307
+ size: {
308
+ type: NumberConstructor;
309
+ default: number;
310
+ };
311
+ }>> & Readonly<{}>, {
312
+ size: number;
313
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
314
+ UserAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
315
+ user: {
316
+ type: import('vue').PropType<IUser>;
317
+ required: true;
318
+ };
319
+ size: {
320
+ type: NumberConstructor;
321
+ required: true;
322
+ };
323
+ baseUrl: {
324
+ type: StringConstructor;
325
+ required: true;
326
+ };
327
+ }>, {
328
+ fullName: import('vue').ComputedRef<string>;
329
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
330
+ user: {
331
+ type: import('vue').PropType<IUser>;
332
+ required: true;
333
+ };
334
+ size: {
335
+ type: NumberConstructor;
336
+ required: true;
337
+ };
338
+ baseUrl: {
339
+ type: StringConstructor;
340
+ required: true;
341
+ };
342
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
343
+ }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
155
344
  }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
156
345
  export default _default;
package/dist/alytus-ff.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as v, createElementBlock as g, openBlock as a, createElementVNode as c, createCommentVNode as y, toDisplayString as p, renderSlot as u, normalizeClass as f, resolveComponent as r, createBlock as m, withCtx as i, createVNode as _, createTextVNode as N, computed as z } from "vue";
2
- const B = v({
1
+ import { defineComponent as L, createElementBlock as g, openBlock as o, createElementVNode as u, createCommentVNode as V, toDisplayString as p, renderSlot as b, normalizeClass as A, resolveComponent as s, createBlock as f, withCtx as n, createVNode as l, createTextVNode as C, computed as E, ref as P, Fragment as z, renderList as B, normalizeProps as T, guardReactiveProps as D, mergeProps as R } from "vue";
2
+ const F = L({
3
3
  name: "PageTitle",
4
4
  props: {
5
5
  title: {
@@ -11,27 +11,27 @@ const B = v({
11
11
  default: null
12
12
  }
13
13
  }
14
- }), $ = (e, t) => {
15
- const o = e.__vccOpts || e;
16
- for (const [s, n] of t)
17
- o[s] = n;
18
- return o;
19
- }, U = { class: "mt-6 mb-3 ff-page-title" }, q = { class: "text-h5 ff-title" }, A = {
14
+ }), y = (e, t) => {
15
+ const r = e.__vccOpts || e;
16
+ for (const [c, i] of t)
17
+ r[c] = i;
18
+ return r;
19
+ }, I = { class: "mt-6 mb-3 ff-page-title" }, Z = { class: "text-h5 ff-title" }, G = {
20
20
  key: 0,
21
21
  class: "text-body-2 ff-description"
22
22
  };
23
- function w(e, t, o, s, n, l) {
24
- return a(), g("div", U, [
25
- c("div", null, [
26
- c("span", q, p(e.title), 1),
27
- e.description ? (a(), g("div", A, p(e.description), 1)) : y("", !0)
23
+ function K(e, t, r, c, i, m) {
24
+ return o(), g("div", I, [
25
+ u("div", null, [
26
+ u("span", Z, p(e.title), 1),
27
+ e.description ? (o(), g("div", G, p(e.description), 1)) : V("", !0)
28
28
  ]),
29
- c("div", null, [
30
- u(e.$slots, "buttons")
29
+ u("div", null, [
30
+ b(e.$slots, "buttons")
31
31
  ])
32
32
  ]);
33
33
  }
34
- const K = /* @__PURE__ */ $(B, [["render", w]]), P = v({
34
+ const ye = /* @__PURE__ */ y(F, [["render", K]]), J = L({
35
35
  name: "PageSubtitle",
36
36
  props: {
37
37
  subtitle: {
@@ -43,24 +43,24 @@ const K = /* @__PURE__ */ $(B, [["render", w]]), P = v({
43
43
  default: !1
44
44
  }
45
45
  }
46
- }), T = { class: "text-h6 font-weight-bold" };
47
- function D(e, t, o, s, n, l) {
48
- return a(), g("div", {
49
- class: f([e.firstPosition ? "mt-0" : "mt-7", "mb-4 ff-page-subtitle"])
46
+ }), W = { class: "text-h6 font-weight-bold" };
47
+ function Q(e, t, r, c, i, m) {
48
+ return o(), g("div", {
49
+ class: A([e.firstPosition ? "mt-0" : "mt-7", "mb-4 ff-page-subtitle"])
50
50
  }, [
51
- c("div", T, p(e.subtitle), 1),
52
- c("div", null, [
53
- u(e.$slots, "buttons")
51
+ u("div", W, p(e.subtitle), 1),
52
+ u("div", null, [
53
+ b(e.$slots, "buttons")
54
54
  ])
55
55
  ], 2);
56
56
  }
57
- const Q = /* @__PURE__ */ $(P, [["render", D]]);
58
- var F = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";
59
- const O = v({
57
+ const ke = /* @__PURE__ */ y(J, [["render", Q]]);
58
+ var X = "M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z", Y = "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z", j = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z", x = "M17 7L15.59 8.41L18.17 11H8V13H18.17L15.59 15.58L17 17L22 12M4 5H12V3H4C2.9 3 2 3.9 2 5V19C2 20.1 2.9 21 4 21H12V19H4V5Z", ee = "M7,10L12,15L17,10H7Z";
59
+ const te = L({
60
60
  name: "CustomDialog",
61
61
  methods: {
62
62
  mdiClose() {
63
- return F;
63
+ return j;
64
64
  }
65
65
  },
66
66
  props: {
@@ -89,45 +89,45 @@ const O = v({
89
89
  default: !1
90
90
  }
91
91
  }
92
- }), V = { class: "close-btn" };
93
- function H(e, t, o, s, n, l) {
94
- const d = r("v-btn"), h = r("v-card-text"), b = r("v-spacer"), C = r("v-card-actions"), S = r("v-card"), k = r("v-dialog");
95
- return a(), m(k, {
92
+ }), ne = { class: "close-btn" };
93
+ function le(e, t, r, c, i, m) {
94
+ const v = s("v-btn"), _ = s("v-card-text"), $ = s("v-spacer"), d = s("v-card-actions"), N = s("v-card"), U = s("v-dialog");
95
+ return o(), f(U, {
96
96
  "model-value": e.value,
97
97
  "max-width": "960",
98
98
  persistent: e.persistent,
99
99
  fullscreen: e.$vuetify.display.smAndDown && !e.noFullScreen,
100
- class: f([e.fullHeight ? "ff-dialog" : "ff-dialog ff-full-height"]),
100
+ class: A([e.fullHeight ? "ff-dialog" : "ff-dialog ff-full-height"]),
101
101
  "content-class": e.fullHeight ? "ff-full-height" : "",
102
- "onUpdate:modelValue": t[1] || (t[1] = (L) => e.$emit("close"))
102
+ "onUpdate:modelValue": t[1] || (t[1] = (k) => e.$emit("close"))
103
103
  }, {
104
- default: i(() => [
105
- u(e.$slots, "card", {}, () => [
106
- _(S, {
104
+ default: n(() => [
105
+ b(e.$slots, "card", {}, () => [
106
+ l(N, {
107
107
  title: e.title,
108
- class: f(e.fullHeight ? "ff-full-height" : "")
108
+ class: A(e.fullHeight ? "ff-full-height" : "")
109
109
  }, {
110
- append: i(() => [
111
- c("div", V, [
112
- _(d, {
110
+ append: n(() => [
111
+ u("div", ne, [
112
+ l(v, {
113
113
  variant: "text",
114
114
  icon: e.mdiClose(),
115
- onClick: t[0] || (t[0] = (L) => e.$emit("close"))
115
+ onClick: t[0] || (t[0] = (k) => e.$emit("close"))
116
116
  }, null, 8, ["icon"])
117
117
  ])
118
118
  ]),
119
- default: i(() => [
120
- _(h, null, {
121
- default: i(() => [
122
- u(e.$slots, "default")
119
+ default: n(() => [
120
+ l(_, null, {
121
+ default: n(() => [
122
+ b(e.$slots, "default")
123
123
  ]),
124
124
  _: 3
125
125
  }),
126
- e.noFooter ? y("", !0) : (a(), m(C, { key: 0 }, {
127
- default: i(() => [
128
- u(e.$slots, "left-footer"),
129
- _(b),
130
- u(e.$slots, "footer")
126
+ e.noFooter ? V("", !0) : (o(), f(d, { key: 0 }, {
127
+ default: n(() => [
128
+ b(e.$slots, "left-footer"),
129
+ l($),
130
+ b(e.$slots, "footer")
131
131
  ]),
132
132
  _: 3
133
133
  }))
@@ -139,7 +139,7 @@ function H(e, t, o, s, n, l) {
139
139
  _: 3
140
140
  }, 8, ["model-value", "persistent", "fullscreen", "class", "content-class"]);
141
141
  }
142
- const W = /* @__PURE__ */ $(O, [["render", H]]), R = v({
142
+ const Ce = /* @__PURE__ */ y(te, [["render", le]]), se = L({
143
143
  name: "AccountAvatar",
144
144
  props: {
145
145
  item: {
@@ -152,19 +152,19 @@ const W = /* @__PURE__ */ $(O, [["render", H]]), R = v({
152
152
  }
153
153
  }
154
154
  });
155
- function E(e, t, o, s, n, l) {
156
- const d = r("v-avatar");
157
- return a(), m(d, {
158
- class: f(`ff-avatar avatar-${e.size}-${e.item.initials.length >= 3 ? "l" : "s"}`),
155
+ function re(e, t, r, c, i, m) {
156
+ const v = s("v-avatar");
157
+ return o(), f(v, {
158
+ class: A(`ff-avatar avatar-${e.size}-${e.item.initials.length >= 3 ? "l" : "s"}`),
159
159
  size: e.size
160
160
  }, {
161
- default: i(() => [
162
- N(p(e.item.initials), 1)
161
+ default: n(() => [
162
+ C(p(e.item.initials), 1)
163
163
  ]),
164
164
  _: 1
165
165
  }, 8, ["class", "size"]);
166
166
  }
167
- const X = /* @__PURE__ */ $(R, [["render", E]]), I = (e) => e.surname ? `${e.name} ${e.surname}` : e.name, J = v({
167
+ const oe = /* @__PURE__ */ y(se, [["render", re]]), w = (e) => e.surname ? `${e.name} ${e.surname}` : e.name, Ae = (e) => e == null ? "" : e.name != null && e.name !== "" ? e.surname != null && e.surname !== "" ? `${e.name.trim().substring(0, 1).toUpperCase()}${e.surname.trim().substring(0, 1).toUpperCase()}` : e.name.trim().substring(0, 1).toUpperCase() : e.surname != null && e.surname !== "" ? e.surname.trim().substring(0, 1).toUpperCase() : "", ae = L({
168
168
  name: "UserAvatar",
169
169
  props: {
170
170
  user: {
@@ -181,42 +181,391 @@ const X = /* @__PURE__ */ $(R, [["render", E]]), I = (e) => e.surname ? `${e.nam
181
181
  }
182
182
  },
183
183
  setup(e) {
184
- return { fullName: z(() => I(e.user)) };
184
+ return { fullName: E(() => w(e.user)) };
185
185
  }
186
- }), M = { key: 1 };
187
- function Z(e, t, o, s, n, l) {
188
- const d = r("v-img"), h = r("v-avatar");
189
- return a(), m(h, {
186
+ }), ie = { key: 1 };
187
+ function ue(e, t, r, c, i, m) {
188
+ const v = s("v-img"), _ = s("v-avatar");
189
+ return o(), f(_, {
190
190
  color: e.user.avatar_thumb ? "light_grey_bg" : e.user.color ?? "primary",
191
- class: f(`avatar-${e.size}-${e.user.initials.length >= 3 ? "l" : "s"}`),
191
+ class: A(`avatar-${e.size}-${e.user.initials.length >= 3 ? "l" : "s"}`),
192
192
  size: e.size
193
193
  }, {
194
- default: i(() => [
195
- e.user.avatar_thumb ? (a(), m(d, {
194
+ default: n(() => [
195
+ e.user.avatar_thumb ? (o(), f(v, {
196
196
  key: 0,
197
197
  alt: e.fullName,
198
198
  src: `${e.baseUrl}/${e.user.avatar_thumb}`
199
- }, null, 8, ["alt", "src"])) : (a(), g("span", M, p(e.user.initials), 1))
199
+ }, null, 8, ["alt", "src"])) : (o(), g("span", ie, p(e.user.initials), 1))
200
200
  ]),
201
201
  _: 1
202
202
  }, 8, ["color", "class", "size"]);
203
203
  }
204
- const Y = /* @__PURE__ */ $(J, [["render", Z]]), j = (e) => e ? e.replace(/(?:\r\n|\r|\n)/g, "<br>") : "", x = (e) => JSON.parse(JSON.stringify(e)), ee = (e) => {
204
+ const ce = /* @__PURE__ */ y(ae, [["render", ue]]), de = L({
205
+ name: "UserMenu",
206
+ components: { AccountAvatar: oe, UserAvatar: ce },
207
+ methods: {
208
+ mdiLogout() {
209
+ return x;
210
+ },
211
+ mdiAccount() {
212
+ return X;
213
+ },
214
+ mdiMenuDown() {
215
+ return ee;
216
+ },
217
+ mdiCheck() {
218
+ return Y;
219
+ },
220
+ formatFullName: w
221
+ },
222
+ props: {
223
+ currentUser: {
224
+ type: Object,
225
+ required: !0
226
+ },
227
+ currentAccount: {
228
+ type: Object,
229
+ default: null
230
+ },
231
+ currentLang: {
232
+ type: Object,
233
+ required: !0
234
+ },
235
+ accounts: {
236
+ type: Array,
237
+ required: !0
238
+ },
239
+ langs: {
240
+ type: Array,
241
+ required: !0
242
+ },
243
+ baseUrl: {
244
+ type: String,
245
+ required: !0
246
+ },
247
+ texts: {
248
+ type: Object,
249
+ required: !0
250
+ }
251
+ },
252
+ emits: [
253
+ "open-profile",
254
+ "select-account",
255
+ "switch-lang",
256
+ "log-out"
257
+ ],
258
+ setup(e, { emit: t }) {
259
+ const r = P(!1), c = P(!1), i = E(() => e.currentUser != null ? w(e.currentUser) : "-");
260
+ return { isOpen: r, userName: i, langMenu: c, selectAccount: (d) => {
261
+ t("select-account", d);
262
+ }, openProfile: () => {
263
+ t("open-profile"), r.value = !1;
264
+ }, switchLang: (d) => {
265
+ t("switch-lang", d);
266
+ }, logOut: () => {
267
+ t("log-out");
268
+ } };
269
+ }
270
+ }), pe = { class: "ff-user-btn-text" }, me = { class: "name" }, ve = {
271
+ key: 0,
272
+ class: "comp"
273
+ }, fe = { class: "as-avatar" }, ge = ["src"], _e = ["src"], $e = { class: "as-avatar" }, he = { class: "as-avatar" };
274
+ function be(e, t, r, c, i, m) {
275
+ const v = s("UserAvatar"), _ = s("v-btn"), $ = s("v-list-subheader"), d = s("v-list-item"), N = s("AccountAvatar"), U = s("v-list-item-title"), k = s("v-icon"), M = s("v-list"), O = s("v-menu"), H = s("v-card-text"), q = s("v-card");
276
+ return o(), f(O, {
277
+ modelValue: e.isOpen,
278
+ "onUpdate:modelValue": t[2] || (t[2] = (h) => e.isOpen = h),
279
+ "close-on-content-click": !1
280
+ }, {
281
+ activator: n(({ props: h }) => [
282
+ l(_, R(h, { class: "ff-user-btn" }), {
283
+ default: n(() => [
284
+ l(v, {
285
+ size: 32,
286
+ user: e.currentUser,
287
+ "base-url": e.baseUrl + "/avatars"
288
+ }, null, 8, ["user", "base-url"]),
289
+ u("div", pe, [
290
+ u("div", me, p(e.userName), 1),
291
+ e.currentAccount ? (o(), g("div", ve, p(e.formatFullName(e.currentAccount)), 1)) : V("", !0)
292
+ ])
293
+ ]),
294
+ _: 2
295
+ }, 1040)
296
+ ]),
297
+ default: n(() => [
298
+ l(q, { class: "ff-user-manu-card" }, {
299
+ default: n(() => [
300
+ l(H, { class: "pa-0" }, {
301
+ default: n(() => [
302
+ l(M, null, {
303
+ default: n(() => {
304
+ var h;
305
+ return [
306
+ l($, null, {
307
+ default: n(() => [
308
+ C(p(e.texts["Logged in as"]) + ":", 1)
309
+ ]),
310
+ _: 1
311
+ }),
312
+ l(d, {
313
+ title: e.userName,
314
+ subtitle: ((h = e.currentUser) == null ? void 0 : h.email) ?? ""
315
+ }, {
316
+ prepend: n(() => [
317
+ l(v, {
318
+ size: 32,
319
+ user: e.currentUser,
320
+ "base-url": e.baseUrl + "/avatars"
321
+ }, null, 8, ["user", "base-url"])
322
+ ]),
323
+ _: 1
324
+ }, 8, ["title", "subtitle"]),
325
+ l($, null, {
326
+ default: n(() => [
327
+ C(p(e.texts["Choose active company"]) + ":", 1)
328
+ ]),
329
+ _: 1
330
+ }),
331
+ (o(!0), g(z, null, B(e.accounts, (a) => (o(), f(d, {
332
+ key: a.id,
333
+ onClick: (S) => e.selectAccount(a)
334
+ }, {
335
+ prepend: n(() => [
336
+ l(N, { item: a }, null, 8, ["item"])
337
+ ]),
338
+ append: n(() => {
339
+ var S;
340
+ return [
341
+ l(k, {
342
+ color: a.id === (((S = e.currentAccount) == null ? void 0 : S.id) ?? 0) ? "primary" : "white",
343
+ icon: e.mdiCheck()
344
+ }, null, 8, ["color", "icon"])
345
+ ];
346
+ }),
347
+ default: n(() => [
348
+ l(U, null, {
349
+ default: n(() => [
350
+ C(p(e.formatFullName(a)), 1)
351
+ ]),
352
+ _: 2
353
+ }, 1024)
354
+ ]),
355
+ _: 2
356
+ }, 1032, ["onClick"]))), 128)),
357
+ l($, null, {
358
+ default: n(() => [
359
+ C(p(e.texts.Actions) + ":", 1)
360
+ ]),
361
+ _: 1
362
+ }),
363
+ e.langs.length > 1 ? (o(), f(d, {
364
+ key: 0,
365
+ "append-icon": e.mdiMenuDown(),
366
+ onClick: t[1] || (t[1] = (a) => e.langMenu = !0)
367
+ }, {
368
+ prepend: n(() => [
369
+ u("div", fe, [
370
+ u("img", {
371
+ src: e.currentLang.icon,
372
+ height: "15",
373
+ width: "20",
374
+ alt: ""
375
+ }, null, 8, ge)
376
+ ])
377
+ ]),
378
+ default: n(() => [
379
+ l(U, null, {
380
+ default: n(() => [
381
+ l(O, {
382
+ modelValue: e.langMenu,
383
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => e.langMenu = a),
384
+ "close-on-content-click": !1
385
+ }, {
386
+ activator: n(({ props: a }) => [
387
+ u("span", T(D(a)), p(e.currentLang.title), 17)
388
+ ]),
389
+ default: n(() => [
390
+ l(M, null, {
391
+ default: n(() => [
392
+ (o(!0), g(z, null, B(e.langs, (a) => (o(), f(d, {
393
+ key: a.value,
394
+ title: a.title,
395
+ onClick: (S) => e.switchLang(a)
396
+ }, {
397
+ prepend: n(() => [
398
+ u("img", {
399
+ src: a.icon,
400
+ height: "18",
401
+ width: "24",
402
+ alt: "",
403
+ class: "mr-4"
404
+ }, null, 8, _e)
405
+ ]),
406
+ _: 2
407
+ }, 1032, ["title", "onClick"]))), 128))
408
+ ]),
409
+ _: 1
410
+ })
411
+ ]),
412
+ _: 1
413
+ }, 8, ["modelValue"])
414
+ ]),
415
+ _: 1
416
+ })
417
+ ]),
418
+ _: 1
419
+ }, 8, ["append-icon"])) : V("", !0),
420
+ l(d, {
421
+ title: e.texts["Profile settings"],
422
+ onClick: e.openProfile
423
+ }, {
424
+ prepend: n(() => [
425
+ u("div", $e, [
426
+ l(k, {
427
+ icon: e.mdiAccount()
428
+ }, null, 8, ["icon"])
429
+ ])
430
+ ]),
431
+ _: 1
432
+ }, 8, ["title", "onClick"]),
433
+ l(d, {
434
+ title: e.texts["Log out"],
435
+ onClick: e.logOut
436
+ }, {
437
+ prepend: n(() => [
438
+ u("div", he, [
439
+ l(k, {
440
+ icon: e.mdiLogout()
441
+ }, null, 8, ["icon"])
442
+ ])
443
+ ]),
444
+ _: 1
445
+ }, 8, ["title", "onClick"])
446
+ ];
447
+ }),
448
+ _: 1
449
+ })
450
+ ]),
451
+ _: 1
452
+ })
453
+ ]),
454
+ _: 1
455
+ })
456
+ ]),
457
+ _: 1
458
+ }, 8, ["modelValue"]);
459
+ }
460
+ const Ue = /* @__PURE__ */ y(de, [["render", be]]), Se = (e) => e ? e.replace(/(?:\r\n|\r|\n)/g, "<br>") : "", Ve = (e) => JSON.parse(JSON.stringify(e)), Ne = (e) => {
205
461
  let t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
206
462
  return t ? decodeURIComponent(t[3]) : null;
207
- }, te = (e, t, o, s) => {
208
- let n, l;
209
- return s == null && (s = "/"), l = "", o && (n = /* @__PURE__ */ new Date(), n.setTime(n.getTime() + o * 24 * 60 * 60 * 1e3), l = "; expires=" + n.toUTCString()), document.cookie = encodeURIComponent(e) + "=" + encodeURIComponent(t) + l + "; path=" + s, !0;
210
- };
463
+ }, we = (e, t, r, c) => {
464
+ let i, m;
465
+ return c == null && (c = "/"), m = "", r && (i = /* @__PURE__ */ new Date(), i.setTime(i.getTime() + r * 24 * 60 * 60 * 1e3), m = "; expires=" + i.toUTCString()), document.cookie = encodeURIComponent(e) + "=" + encodeURIComponent(t) + m + "; path=" + c, !0;
466
+ }, Me = (e, t) => {
467
+ for (const r of t) {
468
+ if (r === "/")
469
+ return e === "/";
470
+ if (e.startsWith(r))
471
+ return !0;
472
+ }
473
+ return !1;
474
+ }, Oe = [
475
+ { title: "lng.sv-se", value: "sv_SE" },
476
+ // $t("lng.sv-se")
477
+ { title: "lng.sl-si", value: "sl_SI" },
478
+ // $t("lng.sl-si")
479
+ { title: "lng.sk-sk", value: "sk_SK" },
480
+ // $t("lng.sk-sk")
481
+ { title: "lng.uk-ua", value: "uk_UA" },
482
+ // $t("lng.uk-ua")
483
+ { title: "lng.tr-tr", value: "tr_TR" },
484
+ // $t("lng.tr-tr")
485
+ { title: "lng.bg-bg", value: "bg_BG" },
486
+ // $t("lng.bg-bg")
487
+ { title: "lng.bs-ba", value: "bs_BA" },
488
+ // $t("lng.bs-ba")
489
+ { title: "lng.cy-gb", value: "cy_GB" },
490
+ // $t("lng.cy-gb")
491
+ { title: "lng.cs-cz", value: "cs_CZ" },
492
+ // $t("lng.cs-cz")
493
+ { title: "lng.ga-ie", value: "ga_IE" },
494
+ // $t("lng.ga-ie")
495
+ { title: "lng.it-it", value: "it_IT" },
496
+ // $t("lng.it-it")
497
+ { title: "lng.mk-mk", value: "mk_MK" },
498
+ // $t("lng.mk-mk")
499
+ { title: "lng.lt-lt", value: "lt_LT" },
500
+ // $t("lng.lt-lt")
501
+ { title: "lng.lv-lv", value: "lv_LV" },
502
+ // $t("lng.lv-lv")
503
+ { title: "lng.et-ee", value: "et_EE" },
504
+ // $t("lng.et-ee")
505
+ { title: "lng.en-gb", value: "en_GB" },
506
+ // $t("lng.en-gb")
507
+ { title: "lng.es-es", value: "es_ES" },
508
+ // $t("lng.es-es")
509
+ { title: "lng.hr-hr", value: "hr_HR" },
510
+ // $t("lng.hr-hr")
511
+ { title: "lng.hu-hu", value: "hu_HU" },
512
+ // $t("lng.hu-hu")
513
+ { title: "lng.pl-pl", value: "pl_PL" },
514
+ // $t("lng.pl-pl")
515
+ { title: "lng.da-dk", value: "da_DK" },
516
+ // $t("lng.da-dk")
517
+ { title: "lng.el-gr", value: "el_GR" },
518
+ // $t("lng.el-gr")
519
+ { title: "lng.de-de", value: "de_DE" },
520
+ // $t("lng.de-de")
521
+ { title: "lng.fi-fi", value: "fi_FI" },
522
+ // $t("lng.fi-fi")
523
+ { title: "lng.fr-fr", value: "fr_FR" },
524
+ // $t("lng.fr-fr")
525
+ { title: "lng.nb-no", value: "nb_NO" },
526
+ // $t("lng.nb-no")
527
+ { title: "lng.nl-nl", value: "nl_NL" },
528
+ // $t("lng.nl-nl")
529
+ { title: "lng.ru-ru", value: "ru_RU" },
530
+ // $t("lng.ru-ru")
531
+ { title: "lng.ro-ro", value: "ro_RO" },
532
+ // $t("lng.ro-ro")
533
+ { title: "lng.pt-pt", value: "pt_PT" }
534
+ // $t("lng.pt-pt")
535
+ ], Pe = [
536
+ { title: "lngin.et-ee", value: "et_EE" },
537
+ // $t("lngin.et-ee")
538
+ { title: "lngin.lv-lv", value: "lv_LV" },
539
+ // $t("lngin.lv-lv")
540
+ { title: "lngin.lt-lt", value: "lt_LT" },
541
+ // $t("lngin.lt-lt")
542
+ { title: "lngin.en-gb", value: "en_GB" },
543
+ // $t("lngin.en-gb")
544
+ { title: "lngin.pl-pl", value: "pl_PL" },
545
+ // $t("lngin.pl-pl")
546
+ { title: "lngin.es-es", value: "es_ES" },
547
+ // $t("lngin.es-es")
548
+ { title: "lngin.sv-se", value: "sv_SE" },
549
+ // $t("lngin.sv-se")
550
+ { title: "lngin.it-it", value: "it_IT" },
551
+ // $t("lngin.it-it")
552
+ { title: "lngin.de-de", value: "de_DE" }
553
+ // $t("lngin.de-de")
554
+ ];
211
555
  export {
212
- X as AccountAvatar,
213
- W as CustomDialog,
214
- Q as PageSubtitle,
215
- K as PageTitle,
216
- Y as UserAvatar,
217
- x as deepClone,
218
- I as formatFullName,
219
- ee as getCookie,
220
- j as nl2br,
221
- te as setCookie
556
+ oe as AccountAvatar,
557
+ Ce as CustomDialog,
558
+ Pe as InLanguages,
559
+ Oe as Languages,
560
+ ke as PageSubtitle,
561
+ ye as PageTitle,
562
+ ce as UserAvatar,
563
+ Ue as UserMenu,
564
+ Ve as deepClone,
565
+ w as formatFullName,
566
+ Ae as formatInitials,
567
+ Ne as getCookie,
568
+ Me as isActive,
569
+ Se as nl2br,
570
+ we as setCookie
222
571
  };
@@ -1 +1 @@
1
- (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o["Alytus FF"]={},o.Vue))})(this,function(o,e){"use strict";const m=e.defineComponent({name:"PageTitle",props:{title:{type:String,required:!0},description:{type:String,default:null}}}),i=(t,n)=>{const s=t.__vccOpts||t;for(const[r,l]of n)s[r]=l;return s},f={class:"mt-6 mb-3 ff-page-title"},u={class:"text-h5 ff-title"},$={key:0,class:"text-body-2 ff-description"};function g(t,n,s,r,l,a){return e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",null,[e.createElementVNode("span",u,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.renderSlot(t.$slots,"buttons")])])}const C=i(m,[["render",g]]),_=e.defineComponent({name:"PageSubtitle",props:{subtitle:{type:String,required:!0},firstPosition:{type:Boolean,default:!1}}}),h={class:"text-h6 font-weight-bold"};function y(t,n,s,r,l,a){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([t.firstPosition?"mt-0":"mt-7","mb-4 ff-page-subtitle"])},[e.createElementVNode("div",h,e.toDisplayString(t.subtitle),1),e.createElementVNode("div",null,[e.renderSlot(t.$slots,"buttons")])],2)}const k=i(_,[["render",y]]);var b="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";const S=e.defineComponent({name:"CustomDialog",methods:{mdiClose(){return b}},props:{value:{type:Boolean,required:!0},title:{type:String,default:null},persistent:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},noFullScreen:{type:Boolean,default:!1},fullHeight:{type:Boolean,default:!1}}}),B={class:"close-btn"};function N(t,n,s,r,l,a){const c=e.resolveComponent("v-btn"),d=e.resolveComponent("v-card-text"),O=e.resolveComponent("v-spacer"),H=e.resolveComponent("v-card-actions"),R=e.resolveComponent("v-card"),I=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(I,{"model-value":t.value,"max-width":"960",persistent:t.persistent,fullscreen:t.$vuetify.display.smAndDown&&!t.noFullScreen,class:e.normalizeClass([t.fullHeight?"ff-dialog":"ff-dialog ff-full-height"]),"content-class":t.fullHeight?"ff-full-height":"","onUpdate:modelValue":n[1]||(n[1]=J=>t.$emit("close"))},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"card",{},()=>[e.createVNode(R,{title:t.title,class:e.normalizeClass(t.fullHeight?"ff-full-height":"")},{append:e.withCtx(()=>[e.createElementVNode("div",B,[e.createVNode(c,{variant:"text",icon:t.mdiClose(),onClick:n[0]||(n[0]=J=>t.$emit("close"))},null,8,["icon"])])]),default:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3}),t.noFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(H,{key:0},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"left-footer"),e.createVNode(O),e.renderSlot(t.$slots,"footer")]),_:3}))]),_:3},8,["title","class"])])]),_:3},8,["model-value","persistent","fullscreen","class","content-class"])}const z=i(S,[["render",N]]),V=e.defineComponent({name:"AccountAvatar",props:{item:{type:Object,required:!0},size:{type:Number,default:32}}});function w(t,n,s,r,l,a){const c=e.resolveComponent("v-avatar");return e.openBlock(),e.createBlock(c,{class:e.normalizeClass(`ff-avatar avatar-${t.size}-${t.item.initials.length>=3?"l":"s"}`),size:t.size},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.item.initials),1)]),_:1},8,["class","size"])}const L=i(V,[["render",w]]),p=t=>t.surname?`${t.name} ${t.surname}`:t.name,A=e.defineComponent({name:"UserAvatar",props:{user:{type:Object,required:!0},size:{type:Number,required:!0},baseUrl:{type:String,required:!0}},setup(t){return{fullName:e.computed(()=>p(t.user))}}}),E={key:1};function D(t,n,s,r,l,a){const c=e.resolveComponent("v-img"),d=e.resolveComponent("v-avatar");return e.openBlock(),e.createBlock(d,{color:t.user.avatar_thumb?"light_grey_bg":t.user.color??"primary",class:e.normalizeClass(`avatar-${t.size}-${t.user.initials.length>=3?"l":"s"}`),size:t.size},{default:e.withCtx(()=>[t.user.avatar_thumb?(e.openBlock(),e.createBlock(c,{key:0,alt:t.fullName,src:`${t.baseUrl}/${t.user.avatar_thumb}`},null,8,["alt","src"])):(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(t.user.initials),1))]),_:1},8,["color","class","size"])}const T=i(A,[["render",D]]),U=t=>t?t.replace(/(?:\r\n|\r|\n)/g,"<br>"):"",P=t=>JSON.parse(JSON.stringify(t)),q=t=>{let n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},F=(t,n,s,r)=>{let l,a;return r==null&&(r="/"),a="",s&&(l=new Date,l.setTime(l.getTime()+s*24*60*60*1e3),a="; expires="+l.toUTCString()),document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(n)+a+"; path="+r,!0};o.AccountAvatar=L,o.CustomDialog=z,o.PageSubtitle=k,o.PageTitle=C,o.UserAvatar=T,o.deepClone=P,o.formatFullName=p,o.getCookie=q,o.nl2br=U,o.setCookie=F,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l["Alytus FF"]={},l.Vue))})(this,function(l,e){"use strict";const b=e.defineComponent({name:"PageTitle",props:{title:{type:String,required:!0},description:{type:String,default:null}}}),m=(t,n)=>{const o=t.__vccOpts||t;for(const[s,a]of n)o[s]=a;return o},L={class:"mt-6 mb-3 ff-page-title"},w={class:"text-h5 ff-title"},B={key:0,class:"text-body-2 ff-description"};function S(t,n,o,s,a,c){return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",null,[e.createElementVNode("span",w,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.renderSlot(t.$slots,"buttons")])])}const A=m(b,[["render",S]]),E=e.defineComponent({name:"PageSubtitle",props:{subtitle:{type:String,required:!0},firstPosition:{type:Boolean,default:!1}}}),U={class:"text-h6 font-weight-bold"};function D(t,n,o,s,a,c){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([t.firstPosition?"mt-0":"mt-7","mb-4 ff-page-subtitle"])},[e.createElementVNode("div",U,e.toDisplayString(t.subtitle),1),e.createElementVNode("div",null,[e.renderSlot(t.$slots,"buttons")])],2)}const T=m(E,[["render",D]]);var z="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",M="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",P="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",O="M17 7L15.59 8.41L18.17 11H8V13H18.17L15.59 15.58L17 17L22 12M4 5H12V3H4C2.9 3 2 3.9 2 5V19C2 20.1 2.9 21 4 21H12V19H4V5Z",q="M7,10L12,15L17,10H7Z";const F=e.defineComponent({name:"CustomDialog",methods:{mdiClose(){return P}},props:{value:{type:Boolean,required:!0},title:{type:String,default:null},persistent:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},noFullScreen:{type:Boolean,default:!1},fullHeight:{type:Boolean,default:!1}}}),H={class:"close-btn"};function I(t,n,o,s,a,c){const d=e.resolveComponent("v-btn"),p=e.resolveComponent("v-card-text"),u=e.resolveComponent("v-spacer"),i=e.resolveComponent("v-card-actions"),k=e.resolveComponent("v-card"),C=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(C,{"model-value":t.value,"max-width":"960",persistent:t.persistent,fullscreen:t.$vuetify.display.smAndDown&&!t.noFullScreen,class:e.normalizeClass([t.fullHeight?"ff-dialog":"ff-dialog ff-full-height"]),"content-class":t.fullHeight?"ff-full-height":"","onUpdate:modelValue":n[1]||(n[1]=g=>t.$emit("close"))},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"card",{},()=>[e.createVNode(k,{title:t.title,class:e.normalizeClass(t.fullHeight?"ff-full-height":"")},{append:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(d,{variant:"text",icon:t.mdiClose(),onClick:n[0]||(n[0]=g=>t.$emit("close"))},null,8,["icon"])])]),default:e.withCtx(()=>[e.createVNode(p,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3}),t.noFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i,{key:0},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"left-footer"),e.createVNode(u),e.renderSlot(t.$slots,"footer")]),_:3}))]),_:3},8,["title","class"])])]),_:3},8,["model-value","persistent","fullscreen","class","content-class"])}const R=m(F,[["render",I]]),Z=e.defineComponent({name:"AccountAvatar",props:{item:{type:Object,required:!0},size:{type:Number,default:32}}});function v(t,n,o,s,a,c){const d=e.resolveComponent("v-avatar");return e.openBlock(),e.createBlock(d,{class:e.normalizeClass(`ff-avatar avatar-${t.size}-${t.item.initials.length>=3?"l":"s"}`),size:t.size},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.item.initials),1)]),_:1},8,["class","size"])}const V=m(Z,[["render",v]]),_=t=>t.surname?`${t.name} ${t.surname}`:t.name,G=t=>t==null?"":t.name!=null&&t.name!==""?t.surname!=null&&t.surname!==""?`${t.name.trim().substring(0,1).toUpperCase()}${t.surname.trim().substring(0,1).toUpperCase()}`:t.name.trim().substring(0,1).toUpperCase():t.surname!=null&&t.surname!==""?t.surname.trim().substring(0,1).toUpperCase():"",K=e.defineComponent({name:"UserAvatar",props:{user:{type:Object,required:!0},size:{type:Number,required:!0},baseUrl:{type:String,required:!0}},setup(t){return{fullName:e.computed(()=>_(t.user))}}}),J={key:1};function W(t,n,o,s,a,c){const d=e.resolveComponent("v-img"),p=e.resolveComponent("v-avatar");return e.openBlock(),e.createBlock(p,{color:t.user.avatar_thumb?"light_grey_bg":t.user.color??"primary",class:e.normalizeClass(`avatar-${t.size}-${t.user.initials.length>=3?"l":"s"}`),size:t.size},{default:e.withCtx(()=>[t.user.avatar_thumb?(e.openBlock(),e.createBlock(d,{key:0,alt:t.fullName,src:`${t.baseUrl}/${t.user.avatar_thumb}`},null,8,["alt","src"])):(e.openBlock(),e.createElementBlock("span",J,e.toDisplayString(t.user.initials),1))]),_:1},8,["color","class","size"])}const $=m(K,[["render",W]]),Q=e.defineComponent({name:"UserMenu",components:{AccountAvatar:V,UserAvatar:$},methods:{mdiLogout(){return O},mdiAccount(){return z},mdiMenuDown(){return q},mdiCheck(){return M},formatFullName:_},props:{currentUser:{type:Object,required:!0},currentAccount:{type:Object,default:null},currentLang:{type:Object,required:!0},accounts:{type:Array,required:!0},langs:{type:Array,required:!0},baseUrl:{type:String,required:!0},texts:{type:Object,required:!0}},emits:["open-profile","select-account","switch-lang","log-out"],setup(t,{emit:n}){const o=e.ref(!1),s=e.ref(!1),a=e.computed(()=>t.currentUser!=null?_(t.currentUser):"-");return{isOpen:o,userName:a,langMenu:s,selectAccount:i=>{n("select-account",i)},openProfile:()=>{n("open-profile"),o.value=!1},switchLang:i=>{n("switch-lang",i)},logOut:()=>{n("log-out")}}}}),X={class:"ff-user-btn-text"},Y={class:"name"},j={key:0,class:"comp"},x={class:"as-avatar"},ee=["src"],te=["src"],ne={class:"as-avatar"},le={class:"as-avatar"};function oe(t,n,o,s,a,c){const d=e.resolveComponent("UserAvatar"),p=e.resolveComponent("v-btn"),u=e.resolveComponent("v-list-subheader"),i=e.resolveComponent("v-list-item"),k=e.resolveComponent("AccountAvatar"),C=e.resolveComponent("v-list-item-title"),g=e.resolveComponent("v-icon"),N=e.resolveComponent("v-list"),y=e.resolveComponent("v-menu"),ue=e.resolveComponent("v-card-text"),fe=e.resolveComponent("v-card");return e.openBlock(),e.createBlock(y,{modelValue:t.isOpen,"onUpdate:modelValue":n[2]||(n[2]=f=>t.isOpen=f),"close-on-content-click":!1},{activator:e.withCtx(({props:f})=>[e.createVNode(p,e.mergeProps(f,{class:"ff-user-btn"}),{default:e.withCtx(()=>[e.createVNode(d,{size:32,user:t.currentUser,"base-url":t.baseUrl+"/avatars"},null,8,["user","base-url"]),e.createElementVNode("div",X,[e.createElementVNode("div",Y,e.toDisplayString(t.userName),1),t.currentAccount?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(t.formatFullName(t.currentAccount)),1)):e.createCommentVNode("",!0)])]),_:2},1040)]),default:e.withCtx(()=>[e.createVNode(fe,{class:"ff-user-manu-card"},{default:e.withCtx(()=>[e.createVNode(ue,{class:"pa-0"},{default:e.withCtx(()=>[e.createVNode(N,null,{default:e.withCtx(()=>{var f;return[e.createVNode(u,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.texts["Logged in as"])+":",1)]),_:1}),e.createVNode(i,{title:t.userName,subtitle:((f=t.currentUser)==null?void 0:f.email)??""},{prepend:e.withCtx(()=>[e.createVNode(d,{size:32,user:t.currentUser,"base-url":t.baseUrl+"/avatars"},null,8,["user","base-url"])]),_:1},8,["title","subtitle"]),e.createVNode(u,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.texts["Choose active company"])+":",1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.accounts,r=>(e.openBlock(),e.createBlock(i,{key:r.id,onClick:h=>t.selectAccount(r)},{prepend:e.withCtx(()=>[e.createVNode(k,{item:r},null,8,["item"])]),append:e.withCtx(()=>{var h;return[e.createVNode(g,{color:r.id===(((h=t.currentAccount)==null?void 0:h.id)??0)?"primary":"white",icon:t.mdiCheck()},null,8,["color","icon"])]}),default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.formatFullName(r)),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128)),e.createVNode(u,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.texts.Actions)+":",1)]),_:1}),t.langs.length>1?(e.openBlock(),e.createBlock(i,{key:0,"append-icon":t.mdiMenuDown(),onClick:n[1]||(n[1]=r=>t.langMenu=!0)},{prepend:e.withCtx(()=>[e.createElementVNode("div",x,[e.createElementVNode("img",{src:t.currentLang.icon,height:"15",width:"20",alt:""},null,8,ee)])]),default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(y,{modelValue:t.langMenu,"onUpdate:modelValue":n[0]||(n[0]=r=>t.langMenu=r),"close-on-content-click":!1},{activator:e.withCtx(({props:r})=>[e.createElementVNode("span",e.normalizeProps(e.guardReactiveProps(r)),e.toDisplayString(t.currentLang.title),17)]),default:e.withCtx(()=>[e.createVNode(N,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.langs,r=>(e.openBlock(),e.createBlock(i,{key:r.value,title:r.title,onClick:h=>t.switchLang(r)},{prepend:e.withCtx(()=>[e.createElementVNode("img",{src:r.icon,height:"18",width:"24",alt:"",class:"mr-4"},null,8,te)]),_:2},1032,["title","onClick"]))),128))]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["append-icon"])):e.createCommentVNode("",!0),e.createVNode(i,{title:t.texts["Profile settings"],onClick:t.openProfile},{prepend:e.withCtx(()=>[e.createElementVNode("div",ne,[e.createVNode(g,{icon:t.mdiAccount()},null,8,["icon"])])]),_:1},8,["title","onClick"]),e.createVNode(i,{title:t.texts["Log out"],onClick:t.logOut},{prepend:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(g,{icon:t.mdiLogout()},null,8,["icon"])])]),_:1},8,["title","onClick"])]}),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])}const re=m(Q,[["render",oe]]),ae=t=>t?t.replace(/(?:\r\n|\r|\n)/g,"<br>"):"",se=t=>JSON.parse(JSON.stringify(t)),ie=t=>{let n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},ce=(t,n,o,s)=>{let a,c;return s==null&&(s="/"),c="",o&&(a=new Date,a.setTime(a.getTime()+o*24*60*60*1e3),c="; expires="+a.toUTCString()),document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(n)+c+"; path="+s,!0},de=(t,n)=>{for(const o of n){if(o==="/")return t==="/";if(t.startsWith(o))return!0}return!1},me=[{title:"lng.sv-se",value:"sv_SE"},{title:"lng.sl-si",value:"sl_SI"},{title:"lng.sk-sk",value:"sk_SK"},{title:"lng.uk-ua",value:"uk_UA"},{title:"lng.tr-tr",value:"tr_TR"},{title:"lng.bg-bg",value:"bg_BG"},{title:"lng.bs-ba",value:"bs_BA"},{title:"lng.cy-gb",value:"cy_GB"},{title:"lng.cs-cz",value:"cs_CZ"},{title:"lng.ga-ie",value:"ga_IE"},{title:"lng.it-it",value:"it_IT"},{title:"lng.mk-mk",value:"mk_MK"},{title:"lng.lt-lt",value:"lt_LT"},{title:"lng.lv-lv",value:"lv_LV"},{title:"lng.et-ee",value:"et_EE"},{title:"lng.en-gb",value:"en_GB"},{title:"lng.es-es",value:"es_ES"},{title:"lng.hr-hr",value:"hr_HR"},{title:"lng.hu-hu",value:"hu_HU"},{title:"lng.pl-pl",value:"pl_PL"},{title:"lng.da-dk",value:"da_DK"},{title:"lng.el-gr",value:"el_GR"},{title:"lng.de-de",value:"de_DE"},{title:"lng.fi-fi",value:"fi_FI"},{title:"lng.fr-fr",value:"fr_FR"},{title:"lng.nb-no",value:"nb_NO"},{title:"lng.nl-nl",value:"nl_NL"},{title:"lng.ru-ru",value:"ru_RU"},{title:"lng.ro-ro",value:"ro_RO"},{title:"lng.pt-pt",value:"pt_PT"}],pe=[{title:"lngin.et-ee",value:"et_EE"},{title:"lngin.lv-lv",value:"lv_LV"},{title:"lngin.lt-lt",value:"lt_LT"},{title:"lngin.en-gb",value:"en_GB"},{title:"lngin.pl-pl",value:"pl_PL"},{title:"lngin.es-es",value:"es_ES"},{title:"lngin.sv-se",value:"sv_SE"},{title:"lngin.it-it",value:"it_IT"},{title:"lngin.de-de",value:"de_DE"}];l.AccountAvatar=V,l.CustomDialog=R,l.InLanguages=pe,l.Languages=me,l.PageSubtitle=T,l.PageTitle=A,l.UserAvatar=$,l.UserMenu=re,l.deepClone=se,l.formatFullName=_,l.formatInitials=G,l.getCookie=ie,l.isActive=de,l.nl2br=ae,l.setCookie=ce,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,143 @@
1
+ import { PropType } from 'vue';
2
+ import { IUser } from '../../types/User.ts';
3
+ import { IAccount } from '../../types/Account.ts';
4
+ import { LanguageAndFlag } from '../../types/Lang.ts';
5
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
+ currentUser: {
7
+ type: PropType<IUser>;
8
+ required: true;
9
+ };
10
+ currentAccount: {
11
+ type: PropType<IAccount>;
12
+ default: null;
13
+ };
14
+ currentLang: {
15
+ type: PropType<LanguageAndFlag>;
16
+ required: true;
17
+ };
18
+ accounts: {
19
+ type: PropType<IAccount[]>;
20
+ required: true;
21
+ };
22
+ langs: {
23
+ type: PropType<LanguageAndFlag[]>;
24
+ required: true;
25
+ };
26
+ baseUrl: {
27
+ type: StringConstructor;
28
+ required: true;
29
+ };
30
+ texts: {
31
+ type: PropType<{
32
+ [key: string]: string;
33
+ }>;
34
+ required: true;
35
+ };
36
+ }>, {
37
+ isOpen: import('vue').Ref<boolean, boolean>;
38
+ userName: import('vue').ComputedRef<string>;
39
+ langMenu: import('vue').Ref<boolean, boolean>;
40
+ selectAccount: (account: IAccount) => void;
41
+ openProfile: () => void;
42
+ switchLang: (lang: LanguageAndFlag) => void;
43
+ logOut: () => void;
44
+ }, {}, {}, {
45
+ mdiLogout(): string;
46
+ mdiAccount(): string;
47
+ mdiMenuDown(): string;
48
+ mdiCheck(): string;
49
+ formatFullName: (obj: {
50
+ name: string;
51
+ surname: string | null;
52
+ }) => string;
53
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("open-profile" | "select-account" | "switch-lang" | "log-out")[], "open-profile" | "select-account" | "switch-lang" | "log-out", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
54
+ currentUser: {
55
+ type: PropType<IUser>;
56
+ required: true;
57
+ };
58
+ currentAccount: {
59
+ type: PropType<IAccount>;
60
+ default: null;
61
+ };
62
+ currentLang: {
63
+ type: PropType<LanguageAndFlag>;
64
+ required: true;
65
+ };
66
+ accounts: {
67
+ type: PropType<IAccount[]>;
68
+ required: true;
69
+ };
70
+ langs: {
71
+ type: PropType<LanguageAndFlag[]>;
72
+ required: true;
73
+ };
74
+ baseUrl: {
75
+ type: StringConstructor;
76
+ required: true;
77
+ };
78
+ texts: {
79
+ type: PropType<{
80
+ [key: string]: string;
81
+ }>;
82
+ required: true;
83
+ };
84
+ }>> & Readonly<{
85
+ "onOpen-profile"?: ((...args: any[]) => any) | undefined;
86
+ "onSelect-account"?: ((...args: any[]) => any) | undefined;
87
+ "onSwitch-lang"?: ((...args: any[]) => any) | undefined;
88
+ "onLog-out"?: ((...args: any[]) => any) | undefined;
89
+ }>, {
90
+ currentAccount: IAccount;
91
+ }, {}, {
92
+ AccountAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
93
+ item: {
94
+ type: PropType<IAccount>;
95
+ required: true;
96
+ };
97
+ size: {
98
+ type: NumberConstructor;
99
+ default: number;
100
+ };
101
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
102
+ item: {
103
+ type: PropType<IAccount>;
104
+ required: true;
105
+ };
106
+ size: {
107
+ type: NumberConstructor;
108
+ default: number;
109
+ };
110
+ }>> & Readonly<{}>, {
111
+ size: number;
112
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
113
+ UserAvatar: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
114
+ user: {
115
+ type: PropType<IUser>;
116
+ required: true;
117
+ };
118
+ size: {
119
+ type: NumberConstructor;
120
+ required: true;
121
+ };
122
+ baseUrl: {
123
+ type: StringConstructor;
124
+ required: true;
125
+ };
126
+ }>, {
127
+ fullName: import('vue').ComputedRef<string>;
128
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
129
+ user: {
130
+ type: PropType<IUser>;
131
+ required: true;
132
+ };
133
+ size: {
134
+ type: NumberConstructor;
135
+ required: true;
136
+ };
137
+ baseUrl: {
138
+ type: StringConstructor;
139
+ required: true;
140
+ };
141
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
142
+ }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
143
+ export default _default;
package/dist/index.d.ts CHANGED
@@ -3,11 +3,16 @@ import { default as PageSubtitle } from './components/Page/PageSubtitle.vue';
3
3
  import { default as CustomDialog } from './components/Dialog/CustomDialog.vue';
4
4
  import { default as AccountAvatar } from './components/Avatar/AccountAvatar.vue';
5
5
  import { default as UserAvatar } from './components/Avatar/UserAvatar.vue';
6
+ import { default as UserMenu } from './components/Nav/UserMenu.vue';
6
7
  import { nl2br } from './utils/HtmlUtil.ts';
7
8
  import { deepClone } from './utils/ObjectUtil.ts';
8
9
  import { getCookie, setCookie } from './utils/CookieUtil.ts';
9
- import { formatFullName } from './utils/StringUtil.ts';
10
+ import { formatFullName, formatInitials } from './utils/StringUtil.ts';
11
+ import { isActive } from './utils/NavUtil.ts';
10
12
  import { NameValuePair } from './types/Base.ts';
11
13
  import { IAccount } from './types/Account.ts';
12
14
  import { IUser } from './types/User.ts';
13
- export { PageTitle, PageSubtitle, CustomDialog, AccountAvatar, UserAvatar, nl2br, deepClone, getCookie, setCookie, formatFullName, NameValuePair, IAccount, IUser };
15
+ import { MenuItem } from './types/Nav.ts';
16
+ import { Language, LanguageAndFlag } from './types/Lang.ts';
17
+ import { Languages, InLanguages } from './utils/LangUtil.ts';
18
+ export { PageTitle, PageSubtitle, CustomDialog, AccountAvatar, UserAvatar, UserMenu, nl2br, deepClone, getCookie, setCookie, formatFullName, formatInitials, isActive, NameValuePair, IAccount, IUser, MenuItem, Language, LanguageAndFlag, Languages, InLanguages };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .ff-page-title,.ff-page-subtitle{display:flex;justify-content:space-between;align-items:center}.ff-page-title .v-btn,.ff-page-subtitle .v-btn{text-transform:unset;letter-spacing:.045em}.ff-dialog.v-dialog .close-btn{margin-right:-4px}@media screen and (min-width: 600px){.ff-dialog.v-dialog .close-btn{margin-right:-12px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:16px;padding-right:16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:36px;padding-right:36px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:16px;padding-right:16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:36px;padding-right:36px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding:12px 16px 16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding-left:36px;padding-right:36px}}.ff-full-height{height:100%}.ff-avatar{background:linear-gradient(180deg,#3c3c3c,#4f4f4f 25%,#787878)!important;color:#fff!important}.avatar-96-s{font-size:32px!important;font-weight:500!important}.avatar-96-l{font-size:26px!important;font-weight:500!important}.avatar-32-s{font-size:14px!important;font-weight:500!important;line-height:normal!important;letter-spacing:1px}.avatar-32-l{font-size:11px!important;font-weight:500!important;line-height:normal!important;letter-spacing:1px}
1
+ .ff-page-title,.ff-page-subtitle{display:flex;justify-content:space-between;align-items:center}.ff-page-title .v-btn,.ff-page-subtitle .v-btn{text-transform:unset;letter-spacing:.045em}.ff-dialog.v-dialog .close-btn{margin-right:-4px}@media screen and (min-width: 600px){.ff-dialog.v-dialog .close-btn{margin-right:-12px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:16px;padding-right:16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-item{padding-left:36px;padding-right:36px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:16px;padding-right:16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-text{padding-left:36px;padding-right:36px}}.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding:12px 16px 16px}@media screen and (min-width: 600px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding-left:24px;padding-right:24px}}@media screen and (min-width: 960px){.ff-dialog.v-dialog>.v-overlay__content>.v-card>.v-card-actions{padding-left:36px;padding-right:36px}}.ff-full-height{height:100%}.ff-avatar{background:linear-gradient(180deg,#3c3c3c,#4f4f4f 25%,#787878)!important;color:#fff!important}.avatar-96-s{font-size:32px!important;font-weight:500!important}.avatar-96-l{font-size:26px!important;font-weight:500!important}.avatar-32-s{font-size:14px!important;font-weight:500!important;line-height:normal!important;letter-spacing:1px}.avatar-32-l{font-size:11px!important;font-weight:500!important;line-height:normal!important;letter-spacing:1px}.ff-user-btn .v-avatar{margin-right:8px}.ff-user-btn .v-avatar .v-icon{width:32px;height:32px}.ff-user-btn-text{display:flex;flex-direction:column;gap:2px;letter-spacing:.05em}.ff-user-btn-text .name{text-align:left;font-weight:600;text-transform:none}.ff-user-btn-text .comp{text-align:left;text-transform:none;font-size:12px;color:#424242}.ff-user-manu-card{min-width:280px}.ff-user-manu-card .v-card-item__prepend{padding-right:16px}.ff-user-manu-card .v-card-item__prepend .v-icon{width:32px;height:32px}.ff-user-manu-card .v-card-actions .v-btn{line-height:36px;text-transform:unset;letter-spacing:.05em}.ff-user-manu-card .as-avatar{width:32px;height:32px;display:flex;justify-content:center;align-items:center;margin-right:16px}
@@ -1,4 +1,5 @@
1
1
  export interface IAccount {
2
+ id: number;
2
3
  name: string;
3
4
  surname: string | null;
4
5
  initials: string;
@@ -0,0 +1,7 @@
1
+ export type Language = {
2
+ title: string;
3
+ value: string;
4
+ };
5
+ export type LanguageAndFlag = Language & {
6
+ icon: string;
7
+ };
@@ -0,0 +1,6 @@
1
+ export type MenuItem = {
2
+ icon: string;
3
+ text: string;
4
+ link: string;
5
+ active: boolean;
6
+ };
@@ -4,4 +4,5 @@ export interface IUser {
4
4
  initials: string;
5
5
  color: string;
6
6
  avatar_thumb: string | null;
7
+ email: string;
7
8
  }
@@ -0,0 +1,3 @@
1
+ import { Language } from '../types/Lang.ts';
2
+ export declare const Languages: Language[];
3
+ export declare const InLanguages: Language[];
@@ -0,0 +1 @@
1
+ export declare const isActive: (route_path: string, links: string[]) => boolean;
@@ -2,3 +2,7 @@ export declare const formatFullName: (obj: {
2
2
  name: string;
3
3
  surname: string | null;
4
4
  }) => string;
5
+ export declare const formatInitials: (obj: {
6
+ name: string;
7
+ surname: string | null;
8
+ }) => string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alytus-ff",
3
3
  "private": false,
4
- "version": "0.1.25",
4
+ "version": "0.1.26",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <v-menu v-model="isOpen" :close-on-content-click="false">
3
+ <template v-slot:activator="{ props }">
4
+ <v-btn v-bind="props" class="ff-user-btn">
5
+ <UserAvatar :size="32" :user="currentUser" :base-url="baseUrl + '/avatars'" />
6
+ <div class="ff-user-btn-text">
7
+ <div class="name">{{ userName }}</div>
8
+ <div v-if="currentAccount" class="comp">{{ formatFullName(currentAccount) }}</div>
9
+ </div>
10
+ </v-btn>
11
+ </template>
12
+
13
+ <v-card class="ff-user-manu-card">
14
+ <v-card-text class="pa-0">
15
+ <v-list>
16
+ <v-list-subheader>{{ texts['Logged in as'] }}:</v-list-subheader>
17
+ <v-list-item :title="userName" :subtitle="currentUser?.email ?? ''">
18
+ <template v-slot:prepend>
19
+ <UserAvatar :size="32" :user="currentUser" :base-url="baseUrl + '/avatars'" />
20
+ </template>
21
+ </v-list-item>
22
+ <v-list-subheader>{{ texts['Choose active company'] }}:</v-list-subheader>
23
+ <v-list-item v-for="account in accounts" :key="account.id" @click="selectAccount(account)">
24
+ <template v-slot:prepend>
25
+ <AccountAvatar :item="account" />
26
+ </template>
27
+ <v-list-item-title>{{ formatFullName(account) }}</v-list-item-title>
28
+ <template v-slot:append>
29
+ <v-icon :color="account.id === (currentAccount?.id ?? 0) ? 'primary' : 'white'" :icon="mdiCheck()" />
30
+ </template>
31
+ </v-list-item>
32
+ <v-list-subheader>{{ texts['Actions'] }}:</v-list-subheader>
33
+ <v-list-item v-if="langs.length > 1" :append-icon="mdiMenuDown()" @click="langMenu = true">
34
+ <template v-slot:prepend>
35
+ <div class="as-avatar">
36
+ <img :src="currentLang.icon" height="15" width="20" alt="" />
37
+ </div>
38
+ </template>
39
+ <v-list-item-title>
40
+ <v-menu v-model="langMenu" :close-on-content-click="false">
41
+ <template v-slot:activator="{props}">
42
+ <span v-bind="props">{{currentLang.title}}</span>
43
+ </template>
44
+ <v-list>
45
+ <v-list-item v-for="lang in langs" :key="lang.value" :title="lang.title" @click="switchLang(lang)">
46
+ <template v-slot:prepend>
47
+ <img :src="lang.icon" height="18" width="24" alt="" class="mr-4" />
48
+ </template>
49
+ </v-list-item>
50
+ </v-list>
51
+ </v-menu>
52
+ </v-list-item-title>
53
+ </v-list-item>
54
+ <v-list-item :title="texts['Profile settings']" @click="openProfile">
55
+ <template v-slot:prepend>
56
+ <div class="as-avatar">
57
+ <v-icon :icon="mdiAccount()" />
58
+ </div>
59
+ </template>
60
+ </v-list-item>
61
+ <v-list-item :title="texts['Log out']" @click="logOut">
62
+ <template v-slot:prepend>
63
+ <div class="as-avatar">
64
+ <v-icon :icon="mdiLogout()" />
65
+ </div>
66
+ </template>
67
+ </v-list-item>
68
+ </v-list>
69
+ </v-card-text>
70
+ </v-card>
71
+ </v-menu>
72
+ </template>
73
+
74
+ <script lang="ts">
75
+ import {computed, defineComponent, PropType, ref} from "vue"
76
+ import UserAvatar from "../Avatar/UserAvatar.vue"
77
+ import AccountAvatar from "../Avatar/AccountAvatar.vue"
78
+ import {formatFullName} from "../../utils/StringUtil.ts";
79
+ import {IUser} from "../../types/User.ts";
80
+ import {IAccount} from "../../types/Account.ts";
81
+ import {LanguageAndFlag} from "../../types/Lang.ts";
82
+ import {mdiAccount, mdiCheck, mdiLogout, mdiMenuDown} from "@mdi/js";
83
+
84
+ export default defineComponent({
85
+ name: "UserMenu",
86
+ components: {AccountAvatar, UserAvatar},
87
+ methods: {
88
+ mdiLogout() {
89
+ return mdiLogout
90
+ },
91
+ mdiAccount() {
92
+ return mdiAccount
93
+ },
94
+ mdiMenuDown() {
95
+ return mdiMenuDown
96
+ },
97
+ mdiCheck() {
98
+ return mdiCheck
99
+ },
100
+ formatFullName
101
+ },
102
+ props: {
103
+ currentUser: {
104
+ type: Object as PropType<IUser>,
105
+ required: true
106
+ },
107
+ currentAccount: {
108
+ type: Object as PropType<IAccount>,
109
+ default: null
110
+ },
111
+ currentLang: {
112
+ type: Object as PropType<LanguageAndFlag>,
113
+ required: true
114
+ },
115
+ accounts: {
116
+ type: Array as PropType<IAccount[]>,
117
+ required: true
118
+ },
119
+ langs: {
120
+ type: Array as PropType<LanguageAndFlag[]>,
121
+ required: true
122
+ },
123
+ baseUrl: {
124
+ type: String,
125
+ required: true
126
+ },
127
+ texts: {
128
+ type: Object as PropType<{ [key: string]: string }>,
129
+ required: true
130
+ }
131
+ },
132
+ emits: [
133
+ "open-profile",
134
+ "select-account",
135
+ "switch-lang",
136
+ "log-out"
137
+ ],
138
+ setup(props, {emit}) {
139
+ const isOpen = ref(false)
140
+ const langMenu = ref(false)
141
+
142
+ const userName = computed(() => props.currentUser != null ? formatFullName(props.currentUser) : '-')
143
+
144
+ const selectAccount = (account: IAccount) => {
145
+ emit("select-account", account)
146
+ }
147
+ const openProfile = () => {
148
+ emit("open-profile")
149
+ isOpen.value = false
150
+ }
151
+ const switchLang = (lang: LanguageAndFlag) => {
152
+ emit("switch-lang", lang)
153
+ }
154
+ const logOut = () => {
155
+ emit("log-out")
156
+ }
157
+
158
+ return {isOpen, userName, langMenu, selectAccount, openProfile, switchLang, logOut}
159
+ }
160
+ })
161
+ </script>