@zeedhi/zd-user-info-common 3.0.0 → 3.0.1

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,5 +1,2 @@
1
1
  export * from './user-info';
2
2
  export * from './interfaces';
3
- export * from './tek-user-info/interfaces';
4
- export * from './tek-user-info/tek-user-info';
5
- export * from './tek-user-info/tek-user-info-list';
@@ -1,117 +1,117 @@
1
- var y = Object.create;
2
- var S = Object.defineProperty;
3
- var G = Object.getOwnPropertyDescriptor;
4
- var K = (o, t) => (t = Symbol[o]) ? t : Symbol.for("Symbol." + o), E = (o) => {
5
- throw TypeError(o);
1
+ var Z = Object.create;
2
+ var P = Object.defineProperty;
3
+ var T = Object.getOwnPropertyDescriptor;
4
+ var U = (e, i) => (i = Symbol[e]) ? i : Symbol.for("Symbol." + e), C = (e) => {
5
+ throw TypeError(e);
6
6
  };
7
- var A = (o, t, e) => t in o ? S(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
8
- var P = (o, t) => S(o, "name", { value: t, configurable: !0 });
9
- var C = (o) => [, , , y((o == null ? void 0 : o[K("metadata")]) ?? null)], M = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], u = (o) => o !== void 0 && typeof o != "function" ? E("Function expected") : o, X = (o, t, e, i, a) => ({ kind: M[o], name: t, metadata: i, addInitializer: (r) => e._ ? E("Already initialized") : a.push(u(r || null)) }), q = (o, t) => A(t, K("metadata"), o[3]), T = (o, t, e, i) => {
10
- for (var a = 0, r = o[t >> 1], d = r && r.length; a < d; a++) t & 1 ? r[a].call(e) : i = r[a].call(e, i);
11
- return i;
12
- }, b = (o, t, e, i, a, r) => {
13
- var d, m, F, I, g, s = t & 7, f = !!(t & 8), c = !!(t & 16), v = s > 3 ? o.length + 1 : s ? f ? 1 : 2 : 0, k = M[s + 5], L = s > 3 && (o[v - 1] = []), Y = o[v] || (o[v] = []), h = s && (!c && !f && (a = a.prototype), s < 5 && (s > 3 || !c) && G(s < 4 ? a : { get [e]() {
14
- return x(this, r);
15
- }, set [e](l) {
16
- return V(this, r, l);
17
- } }, e));
18
- s ? c && s < 4 && P(r, (s > 2 ? "set " : s > 1 ? "get " : "") + e) : P(a, e);
19
- for (var R = i.length - 1; R >= 0; R--)
20
- I = X(s, e, F = {}, o[3], Y), s && (I.static = f, I.private = c, g = I.access = { has: c ? (l) => j(a, l) : (l) => e in l }, s ^ 3 && (g.get = c ? (l) => (s ^ 1 ? x : J)(l, a, s ^ 4 ? r : h.get) : (l) => l[e]), s > 2 && (g.set = c ? (l, O) => V(l, a, O, s ^ 4 ? r : h.set) : (l, O) => l[e] = O)), m = (0, i[R])(s ? s < 4 ? c ? r : h[k] : s > 4 ? void 0 : { get: h.get, set: h.set } : a, I), F._ = 1, s ^ 4 || m === void 0 ? u(m) && (s > 4 ? L.unshift(m) : s ? c ? r = m : h[k] = m : a = m) : typeof m != "object" || m === null ? E("Object expected") : (u(d = m.get) && (h.get = d), u(d = m.set) && (h.set = d), u(d = m.init) && L.unshift(d));
21
- return s || q(o, a), h && S(a, e, h), c ? s ^ 4 ? r : h : a;
22
- }, n = (o, t, e) => A(o, typeof t != "symbol" ? t + "" : t, e), U = (o, t, e) => t.has(o) || E("Cannot " + e), j = (o, t) => Object(t) !== t ? E('Cannot use the "in" operator on this value') : o.has(t), x = (o, t, e) => (U(o, t, "read from private field"), e ? e.call(o) : t.get(o));
23
- var V = (o, t, e, i) => (U(o, t, "write to private field"), i ? i.call(o, e) : t.set(o, e), e), J = (o, t, e) => (U(o, t, "access private method"), e);
24
- import { ComponentRender as Q, ModalService as Z, List as ee } from "@zeedhi/common";
25
- import { Singleton as w, Messages as D, Loader as z, Metadata as W, Http as te } from "@zeedhi/core";
26
- var H, N;
27
- H = [w];
28
- class p {
29
- constructor(t) {
30
- n(this, "component");
31
- this.component = t;
7
+ var R = (e, i, t) => i in e ? P(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
8
+ var L = (e, i) => P(e, "name", { value: i, configurable: !0 });
9
+ var N = (e) => [, , , Z((e == null ? void 0 : e[U("metadata")]) ?? null)], F = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], I = (e) => e !== void 0 && typeof e != "function" ? C("Function expected") : e, X = (e, i, t, n, h) => ({ kind: F[e], name: i, metadata: n, addInitializer: (a) => t._ ? C("Already initialized") : h.push(I(a || null)) }), Y = (e, i) => R(i, U("metadata"), e[3]), W = (e, i, t, n) => {
10
+ for (var h = 0, a = e[i >> 1], g = a && a.length; h < g; h++) i & 1 ? a[h].call(t) : n = a[h].call(t, n);
11
+ return n;
12
+ }, A = (e, i, t, n, h, a) => {
13
+ var g, r, x, u, f, o = i & 7, O = !!(i & 8), c = !!(i & 16), v = o > 3 ? e.length + 1 : o ? O ? 1 : 2 : 0, H = F[o + 5], E = o > 3 && (e[v - 1] = []), G = e[v] || (e[v] = []), m = o && (!c && !O && (h = h.prototype), o < 5 && (o > 3 || !c) && T(o < 4 ? h : { get [t]() {
14
+ return V(this, a);
15
+ }, set [t](l) {
16
+ return b(this, a, l);
17
+ } }, t));
18
+ o ? c && o < 4 && L(a, (o > 2 ? "set " : o > 1 ? "get " : "") + t) : L(h, t);
19
+ for (var S = n.length - 1; S >= 0; S--)
20
+ u = X(o, t, x = {}, e[3], G), o && (u.static = O, u.private = c, f = u.access = { has: c ? (l) => w(h, l) : (l) => t in l }, o ^ 3 && (f.get = c ? (l) => (o ^ 1 ? V : z)(l, h, o ^ 4 ? a : m.get) : (l) => l[t]), o > 2 && (f.set = c ? (l, _) => b(l, h, _, o ^ 4 ? a : m.set) : (l, _) => l[t] = _)), r = (0, n[S])(o ? o < 4 ? c ? a : m[H] : o > 4 ? void 0 : { get: m.get, set: m.set } : h, u), x._ = 1, o ^ 4 || r === void 0 ? I(r) && (o > 4 ? E.unshift(r) : o ? c ? a = r : m[H] = r : h = r) : typeof r != "object" || r === null ? C("Object expected") : (I(g = r.get) && (m.get = g), I(g = r.set) && (m.set = g), I(g = r.init) && E.unshift(g));
21
+ return o || Y(e, h), m && P(h, t, m), c ? o ^ 4 ? a : m : h;
22
+ }, s = (e, i, t) => R(e, typeof i != "symbol" ? i + "" : i, t), k = (e, i, t) => i.has(e) || C("Cannot " + t), w = (e, i) => Object(i) !== i ? C('Cannot use the "in" operator on this value') : e.has(i), V = (e, i, t) => (k(e, i, "read from private field"), t ? t.call(e) : i.get(e));
23
+ var b = (e, i, t, n) => (k(e, i, "write to private field"), n ? n.call(e, t) : i.set(e, t), t), z = (e, i, t) => (k(e, i, "access private method"), t);
24
+ import { ComponentRender as B } from "@zeedhi/common";
25
+ import { Singleton as M, Messages as j, Loader as q } from "@zeedhi/core";
26
+ var $, p;
27
+ $ = [M];
28
+ class d {
29
+ constructor(i) {
30
+ s(this, "component");
31
+ this.component = i;
32
32
  }
33
33
  get showChangeProfile() {
34
- const { changeProfile: t } = this.component.visibleItems;
35
- return t || t === void 0;
34
+ const { changeProfile: i } = this.component.visibleItems;
35
+ return i || i === void 0;
36
36
  }
37
37
  get showLogout() {
38
- const { logout: t } = this.component.visibleItems;
39
- return t || t === void 0;
38
+ const { logout: i } = this.component.visibleItems;
39
+ return i || i === void 0;
40
40
  }
41
41
  }
42
- N = C(null), p = b(N, 0, "UserInfoController", H, p), T(N, 1, p);
43
- class oe extends Q {
44
- constructor(e) {
45
- super(e);
42
+ p = N(null), d = A(p, 0, "UserInfoController", $, d), W(p, 1, d);
43
+ class K extends B {
44
+ constructor(t) {
45
+ super(t);
46
46
  /**
47
47
  * Dropdown activator
48
48
  */
49
- n(this, "activator");
49
+ s(this, "activator");
50
50
  /**
51
51
  * Props to be passed to the ZdAvatar component
52
52
  */
53
- n(this, "avatarProps", {});
53
+ s(this, "avatarProps", {});
54
54
  /**
55
55
  * Components to be rendered on the bottom slot
56
56
  */
57
- n(this, "bottomSlot", []);
57
+ s(this, "bottomSlot", []);
58
58
  /**
59
59
  * Components to be rendered on the center slot
60
60
  */
61
- n(this, "centerSlot", []);
61
+ s(this, "centerSlot", []);
62
62
  /**
63
63
  * Components to be rendered on the top slot
64
64
  */
65
- n(this, "topSlot", []);
65
+ s(this, "topSlot", []);
66
66
  /**
67
67
  * User name
68
68
  */
69
- n(this, "user", "");
69
+ s(this, "user", "");
70
70
  /**
71
71
  * User image
72
72
  */
73
- n(this, "userImage", "");
73
+ s(this, "userImage", "");
74
74
  /**
75
75
  * Designates if menu should close on outside-activator click.
76
76
  */
77
- n(this, "closeOnClick", !0);
77
+ s(this, "closeOnClick", !0);
78
78
  /**
79
79
  * Designates if menu should close when its content is clicked.
80
80
  */
81
- n(this, "closeOnContentClick", !0);
81
+ s(this, "closeOnContentClick", !0);
82
82
  /**
83
83
  * Applies position fixed to the dropdown.
84
84
  */
85
- n(this, "fixed", !1);
85
+ s(this, "fixed", !1);
86
86
  /**
87
87
  * Components to be rendered on the menu header
88
88
  */
89
- n(this, "headerSlot", []);
89
+ s(this, "headerSlot", []);
90
90
  /**
91
91
  * Props to be passed to the ZdImage component (rendered inside the avatar)
92
92
  */
93
- n(this, "imageProps", {});
93
+ s(this, "imageProps", {});
94
94
  /**
95
95
  * Offset the menu on the x-axis.
96
96
  */
97
- n(this, "offsetX", !1);
97
+ s(this, "offsetX", !1);
98
98
  /**
99
99
  * Offset the menu on the x-axis.
100
100
  */
101
- n(this, "offsetY", !0);
101
+ s(this, "offsetY", !0);
102
102
  /**
103
103
  * Designates whether menu should open on activator click.
104
104
  */
105
- n(this, "openOnClick", !0);
105
+ s(this, "openOnClick", !0);
106
106
  /**
107
107
  * Designates whether menu should open on activator hover.
108
108
  */
109
- n(this, "openOnHover", !1);
109
+ s(this, "openOnHover", !1);
110
110
  /**
111
111
  * Controls whether the component is visible or hidden.
112
112
  */
113
- n(this, "value", !1);
114
- n(this, "visibleItems", {
113
+ s(this, "value", !1);
114
+ s(this, "visibleItems", {
115
115
  userName: !0,
116
116
  changeProfile: !0,
117
117
  logout: !0
@@ -119,25 +119,25 @@ class oe extends Q {
119
119
  /**
120
120
  * Sets the height for the dropdown.
121
121
  */
122
- n(this, "height", "auto");
122
+ s(this, "height", "auto");
123
123
  /**
124
124
  * Sets the maximum height for the dropdown.
125
125
  */
126
- n(this, "maxHeight");
126
+ s(this, "maxHeight");
127
127
  /**
128
128
  * Sets the maximum width for the dropdown.
129
129
  */
130
- n(this, "maxWidth");
130
+ s(this, "maxWidth");
131
131
  /**
132
132
  * Sets the minimum height for the dropdown.
133
133
  */
134
- n(this, "minHeight");
134
+ s(this, "minHeight");
135
135
  /**
136
136
  * Sets the minimum width for the dropdown.
137
137
  */
138
- n(this, "minWidth");
139
- n(this, "propCenterSlot");
140
- this.user = this.getInitValue("user", e.user, this.user), this.userImage = this.getInitValue("userImage", e.userImage, this.userImage), this.closeOnClick = this.getInitValue("closeOnClick", e.closeOnClick, this.closeOnClick), this.closeOnContentClick = this.getInitValue("closeOnContentClick", e.closeOnContentClick, this.closeOnContentClick), this.fixed = this.getInitValue("fixed", e.fixed, this.fixed), this.offsetX = this.getInitValue("offsetX", e.offsetX, this.offsetX), this.offsetY = this.getInitValue("offsetY", e.offsetY, this.offsetY), this.openOnClick = this.getInitValue("openOnClick", e.openOnClick, this.openOnClick), this.openOnHover = this.getInitValue("openOnHover", e.openOnHover, this.openOnHover), this.value = this.getInitValue("value", e.value, this.value), this.visibleItems = this.getInitValue("visibleItems", e.visibleItems, this.visibleItems), this.height = this.getInitValue("height", e.height, this.height), this.maxHeight = this.getInitValue("maxHeight", e.maxHeight, this.maxHeight), this.minHeight = this.getInitValue("minHeight", e.minHeight, this.minHeight), this.maxWidth = this.getInitValue("maxWidth", e.maxWidth, this.maxWidth), this.minWidth = this.getInitValue("minWidth", e.minWidth, this.minWidth), this.avatarProps = e.avatarProps || this.avatarProps, this.imageProps = e.imageProps || this.imageProps, this.activator = e.activator || this.getActivator(), this.bottomSlot = e.bottomSlot || this.bottomSlot, this.propCenterSlot = e.centerSlot, this.topSlot = e.topSlot || this.topSlot, this.headerSlot = e.headerSlot || this.headerSlot, this.createAccessors();
138
+ s(this, "minWidth");
139
+ s(this, "propCenterSlot");
140
+ this.user = this.getInitValue("user", t.user, this.user), this.userImage = this.getInitValue("userImage", t.userImage, this.userImage), this.closeOnClick = this.getInitValue("closeOnClick", t.closeOnClick, this.closeOnClick), this.closeOnContentClick = this.getInitValue("closeOnContentClick", t.closeOnContentClick, this.closeOnContentClick), this.fixed = this.getInitValue("fixed", t.fixed, this.fixed), this.offsetX = this.getInitValue("offsetX", t.offsetX, this.offsetX), this.offsetY = this.getInitValue("offsetY", t.offsetY, this.offsetY), this.openOnClick = this.getInitValue("openOnClick", t.openOnClick, this.openOnClick), this.openOnHover = this.getInitValue("openOnHover", t.openOnHover, this.openOnHover), this.value = this.getInitValue("value", t.value, this.value), this.visibleItems = this.getInitValue("visibleItems", t.visibleItems, this.visibleItems), this.height = this.getInitValue("height", t.height, this.height), this.maxHeight = this.getInitValue("maxHeight", t.maxHeight, this.maxHeight), this.minHeight = this.getInitValue("minHeight", t.minHeight, this.minHeight), this.maxWidth = this.getInitValue("maxWidth", t.maxWidth, this.maxWidth), this.minWidth = this.getInitValue("minWidth", t.minWidth, this.minWidth), this.avatarProps = t.avatarProps || this.avatarProps, this.imageProps = t.imageProps || this.imageProps, this.activator = t.activator || this.getActivator(), this.bottomSlot = t.bottomSlot || this.bottomSlot, this.propCenterSlot = t.centerSlot, this.topSlot = t.topSlot || this.topSlot, this.headerSlot = t.headerSlot || this.headerSlot, this.createAccessors();
141
141
  }
142
142
  getActivator() {
143
143
  return {
@@ -177,7 +177,7 @@ class oe extends Q {
177
177
  cssClass: "zd-px-2",
178
178
  isVisible: `{{UserInfoController_${this.componentId}.showChangeProfile}}`,
179
179
  events: {
180
- click: ({ event: e, element: i }) => this.onProfileChange(e, i)
180
+ click: ({ event: t, element: n }) => this.onProfileChange(t, n)
181
181
  }
182
182
  },
183
183
  {
@@ -188,24 +188,24 @@ class oe extends Q {
188
188
  cssClass: "zd-px-2",
189
189
  isVisible: `{{UserInfoController_${this.componentId}.showLogout}}`,
190
190
  events: {
191
- click: ({ event: e, element: i }) => this.onLogoutClick(e, i)
191
+ click: ({ event: t, element: n }) => this.onLogoutClick(t, n)
192
192
  }
193
193
  }
194
194
  ]
195
195
  }
196
196
  ];
197
197
  }
198
- onLogoutClick(e, i) {
199
- this.callEvent("onLogoutClick", { event: e, element: i, component: this });
198
+ onLogoutClick(t, n) {
199
+ this.callEvent("onLogoutClick", { event: t, element: n, component: this });
200
200
  }
201
- onProfileChange(e, i) {
202
- this.callEvent("onProfileChange", { event: e, element: i, component: this });
201
+ onProfileChange(t, n) {
202
+ this.callEvent("onProfileChange", { event: t, element: n, component: this });
203
203
  }
204
204
  onCreated() {
205
- super.onCreated(), z.addController(`UserInfoController_${this.componentId}`, p, [this]), this.centerSlot = this.propCenterSlot ? this.propCenterSlot : this.getCenterSlot();
205
+ super.onCreated(), q.addController(`UserInfoController_${this.componentId}`, d, [this]), this.centerSlot = this.propCenterSlot ? this.propCenterSlot : this.getCenterSlot();
206
206
  }
207
207
  }
208
- D.add({
208
+ j.add({
209
209
  "pt-BR": {
210
210
  translation: {
211
211
  USERINFO_CHANGE_PROFILE: "Alterar perfil",
@@ -225,411 +225,6 @@ D.add({
225
225
  }
226
226
  }
227
227
  });
228
- var B, $;
229
- B = [w];
230
- class _ {
231
- constructor(t) {
232
- n(this, "component");
233
- this.component = t;
234
- }
235
- get versionInfo() {
236
- return this.component.versionInfo;
237
- }
238
- get name() {
239
- var t;
240
- return ((t = this.versionInfo) == null ? void 0 : t.name) || "";
241
- }
242
- set name(t) {
243
- this.versionInfo && (this.versionInfo.name = t);
244
- }
245
- get version() {
246
- var t;
247
- return ((t = this.versionInfo) == null ? void 0 : t.version) || "";
248
- }
249
- set version(t) {
250
- this.versionInfo && (this.versionInfo.version = t);
251
- }
252
- get hasDefaultEmail() {
253
- return !!this.component.defaultEmail;
254
- }
255
- get hasAboutImage() {
256
- return !!this.component.aboutImage;
257
- }
258
- mergeText(t, e) {
259
- return `<li>${t} - <b>${e}</b></li>`;
260
- }
261
- get mainVersion() {
262
- var t;
263
- return !((t = this.versionInfo) != null && t.name) || !this.versionInfo.version ? "" : `${this.versionInfo.name} - <b>${this.versionInfo.version}</b>`;
264
- }
265
- getItems(t) {
266
- return this.versionInfo ? `<ul>${this.versionInfo[t].map((i) => this.mergeText(i.name, i.version)).join("")}</ul>` : [];
267
- }
268
- get frontendItems() {
269
- return this.getItems("frontend");
270
- }
271
- get backendItems() {
272
- return this.getItems("backend");
273
- }
274
- get modulesItems() {
275
- return this.getItems("modules");
276
- }
277
- get showReportError() {
278
- const { reportError: t } = this.component.visibleItems;
279
- return t || t === void 0;
280
- }
281
- get showVersionInfo() {
282
- const { versionInfo: t } = this.component.visibleItems;
283
- return t || t === void 0;
284
- }
285
- get showAbout() {
286
- const { about: t } = this.component.visibleItems;
287
- return t || t === void 0;
288
- }
289
- }
290
- $ = C(null), _ = b($, 0, "TekUserInfoController", B, _), T($, 1, _);
291
- class ne extends oe {
292
- constructor(e) {
293
- super(e);
294
- n(this, "aboutModal");
295
- n(this, "reportModal");
296
- /**
297
- * Data about the application version
298
- */
299
- n(this, "versionInfo", null);
300
- /**
301
- * Default email address to be defined in the Report Bug form
302
- */
303
- n(this, "defaultEmail", "");
304
- /**
305
- * Url from which the version info will be retrieved
306
- */
307
- n(this, "versionUrl", "");
308
- /**
309
- * Path to the image to be shown on about modal
310
- */
311
- n(this, "aboutImage", "");
312
- n(this, "propBottomSlot");
313
- this.versionInfo = this.getInitValue("versionInfo", e.versionInfo, this.versionInfo), this.defaultEmail = this.getInitValue("defaultEmail", e.defaultEmail, this.defaultEmail), this.versionUrl = this.getInitValue("versionUrl", e.versionUrl, this.versionUrl), this.aboutImage = this.getInitValue("aboutImage", e.aboutImage, this.aboutImage), this.createAccessors(), this.propBottomSlot = e.bottomSlot;
314
- }
315
- getBottomSlot() {
316
- return [
317
- {
318
- name: `${this.name}_bottom_list`,
319
- component: "TekUserInfoList",
320
- parentName: this.name
321
- }
322
- ];
323
- }
324
- onAboutClick() {
325
- this.aboutModal || (this.aboutModal = Z.create({
326
- name: `${this.name}_about_modal`,
327
- cssClass: "about-modal",
328
- grid: { cols: 8, sm: 4, lg: 5 },
329
- children: [
330
- {
331
- name: `${this.name}_about_header`,
332
- component: "ZdHeader",
333
- color: "transparent",
334
- padless: !0,
335
- elevation: 0,
336
- rightSlot: [
337
- {
338
- name: `${this.name}_about_close_button`,
339
- component: "ZdModalCloseButton",
340
- small: !0,
341
- modalName: `${this.name}_about_modal`
342
- }
343
- ]
344
- },
345
- {
346
- name: `${this.name}_about_row`,
347
- component: "ZdTag",
348
- tag: "div",
349
- cssClass: "zd-justify-center zd-px-6",
350
- isVisible: `{{TekUserInfoController_${this.componentId}.hasAboutImage}}`,
351
- children: [
352
- {
353
- name: `${this.name}_about_image`,
354
- component: "ZdImage",
355
- width: "100%",
356
- src: this.aboutImage
357
- }
358
- ]
359
- },
360
- {
361
- name: `${this.name}_version_tabs`,
362
- cssClass: "zd-pt-3 zd-tekUserInfo-tab",
363
- component: "ZdTabs",
364
- tabs: [
365
- {
366
- name: `${this.name}_version_frontend_tab`,
367
- tabTitle: "Frontend",
368
- children: this.getVersionTree("frontend")
369
- },
370
- {
371
- name: `${this.name}_version_backend_tab`,
372
- tabTitle: "Backend",
373
- children: this.getVersionTree("backend")
374
- },
375
- {
376
- name: `${this.name}_version_modules_tab`,
377
- tabTitle: "Modules",
378
- children: this.getVersionTree("modules")
379
- }
380
- ]
381
- }
382
- ]
383
- })), this.aboutModal.show();
384
- }
385
- getVersionTree(e) {
386
- if (!this.versionInfo) return [];
387
- const i = {
388
- name: `${this.name}_version_${e}_main`,
389
- component: "ZdText",
390
- text: `{{TekUserInfoController_${this.componentId}.mainVersion}}`
391
- }, a = {
392
- name: `${this.name}_version_${e}`,
393
- component: "ZdText",
394
- cssClass: "zd-pl-4",
395
- text: `{{TekUserInfoController_${this.componentId}.${e}Items}}`
396
- };
397
- return [i, a];
398
- }
399
- onReportClick() {
400
- this.reportModal || (this.reportModal = Z.create({
401
- name: `${this.name}_report_modal`,
402
- children: [
403
- {
404
- name: `${this.name}_report_header`,
405
- component: "ZdHeader",
406
- color: "transparent",
407
- padless: !0,
408
- elevation: 0,
409
- leftSlot: [
410
- {
411
- name: `${this.name}_report_title`,
412
- component: "ZdText",
413
- text: "TEKUSERINFO_REPORT_ERROR",
414
- cssClass: "zd-theme-font-title"
415
- }
416
- ],
417
- rightSlot: [
418
- {
419
- name: `${this.name}_report_close_button`,
420
- component: "ZdModalCloseButton",
421
- small: !0,
422
- modalName: `${this.name}_report_modal`
423
- }
424
- ]
425
- },
426
- {
427
- name: `${this.name}_report_form`,
428
- component: "ZdForm",
429
- cssClass: "zd-pt-4",
430
- children: [
431
- {
432
- name: "report_email",
433
- component: "ZdTextInput",
434
- label: "E-mail",
435
- grid: {
436
- cols: "12"
437
- },
438
- value: this.defaultEmail,
439
- readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
440
- validations: {
441
- required: {},
442
- email: {}
443
- }
444
- },
445
- {
446
- name: "report_cc",
447
- component: "ZdTextInput",
448
- label: "CC",
449
- placeholder: "TEKUSERINFO_EMAIL_PLACEHOLDER",
450
- grid: {
451
- cols: "12"
452
- }
453
- },
454
- {
455
- name: "report_type",
456
- component: "ZdSelect",
457
- label: "TEKUSERINFO_TYPE",
458
- dataValue: "value",
459
- dataText: "text",
460
- datasource: {
461
- uniqueKey: "value",
462
- translate: !0,
463
- data: [
464
- { value: "0", text: "TEKUSERINFO_ERROR" },
465
- { value: "1", text: "TEKUSERINFO_IMPROVEMENT" }
466
- ]
467
- },
468
- grid: {
469
- cols: "12"
470
- },
471
- validations: {
472
- required: {}
473
- }
474
- },
475
- {
476
- name: "report_description",
477
- component: "ZdTextarea",
478
- label: "TEKUSERINFO_DESCRIPTION",
479
- grid: {
480
- cols: "12"
481
- },
482
- validations: {
483
- required: {}
484
- }
485
- }
486
- ]
487
- },
488
- {
489
- name: `${this.name}_report_footer`,
490
- component: "ZdFooter",
491
- color: "transparent",
492
- padless: !0,
493
- rightSlot: [
494
- {
495
- name: `${this.name}_report_cancel`,
496
- component: "ZdButton",
497
- label: "TEKUSERINFO_CANCEL",
498
- outline: !0,
499
- events: {
500
- click: () => {
501
- var e;
502
- (e = this.reportModal) == null || e.hide();
503
- }
504
- }
505
- },
506
- {
507
- name: `${this.name}_report_send`,
508
- component: "ZdButton",
509
- label: "TEKUSERINFO_SEND",
510
- events: {
511
- click: (e) => this.onSendReport(e)
512
- }
513
- }
514
- ]
515
- }
516
- ]
517
- })), this.reportModal.show();
518
- }
519
- async onSendReport({ event: e, element: i }) {
520
- if (!this.reportModal) return;
521
- const a = W.getInstance(`${this.name}_report_form`);
522
- (await a.validate()).valid && (this.callEvent("onSendReport", {
523
- event: e,
524
- element: i,
525
- component: this,
526
- form: a
527
- }), this.reportModal.hide());
528
- }
529
- onCreated() {
530
- super.onCreated(), z.addController(`TekUserInfoController_${this.componentId}`, _, [this]), this.bottomSlot = this.propBottomSlot ? this.propBottomSlot : this.getBottomSlot();
531
- }
532
- async onMounted(e) {
533
- if (super.onMounted(e), this.versionUrl) {
534
- const i = await te.get(this.versionUrl);
535
- this.versionInfo = i.data.versionInfo;
536
- }
537
- }
538
- }
539
- D.add({
540
- "pt-BR": {
541
- translation: {
542
- TEKUSERINFO_ABOUT: "Sobre",
543
- TEKUSERINFO_REPORT_ERROR: "Reportar Erro",
544
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separe e-mails usando ";"',
545
- TEKUSERINFO_TYPE: "Tipo",
546
- TEKUSERINFO_ERROR: "Erro",
547
- TEKUSERINFO_IMPROVEMENT: "Melhoria",
548
- TEKUSERINFO_DESCRIPTION: "Descrição",
549
- TEKUSERINFO_CANCEL: "Cancelar",
550
- TEKUSERINFO_SEND: "Enviar"
551
- }
552
- },
553
- "en-US": {
554
- translation: {
555
- TEKUSERINFO_ABOUT: "About",
556
- TEKUSERINFO_REPORT_ERROR: "Report Bug",
557
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separate e-mails using ";"',
558
- TEKUSERINFO_TYPE: "Type",
559
- TEKUSERINFO_ERROR: "Bug",
560
- TEKUSERINFO_IMPROVEMENT: "Improvement",
561
- TEKUSERINFO_DESCRIPTION: "Description",
562
- TEKUSERINFO_CANCEL: "Cancel",
563
- TEKUSERINFO_SEND: "Send"
564
- }
565
- },
566
- "es-CL": {
567
- translation: {
568
- TEKUSERINFO_ABOUT: "Sobre",
569
- TEKUSERINFO_REPORT_ERROR: "Reportar Error",
570
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separar e-mails usando ";"',
571
- TEKUSERINFO_TYPE: "Tipo",
572
- TEKUSERINFO_ERROR: "Error",
573
- TEKUSERINFO_IMPROVEMENT: "Mejora",
574
- TEKUSERINFO_DESCRIPTION: "Descripción",
575
- TEKUSERINFO_CANCEL: "Cancelar",
576
- TEKUSERINFO_SEND: "Enviar"
577
- }
578
- }
579
- });
580
- class re extends ee {
581
- constructor(e) {
582
- super(e);
583
- /**
584
- * Name of the user info component
585
- */
586
- n(this, "parentName", "");
587
- n(this, "dense", !0);
588
- this.parentName = e.parentName || "";
589
- }
590
- onCreated() {
591
- super.onCreated(), this.items = this.getItems();
592
- }
593
- getItems() {
594
- const e = this.parentName ? W.getInstance(this.parentName) : this.parent;
595
- if (!(e instanceof ne))
596
- throw Error(`Could not find the TekUserInfo component associated with ${this.name} TekUserInfoList`);
597
- return [
598
- {
599
- name: `${e.name}_version`,
600
- component: "ZdListItem",
601
- title: `{{TekUserInfoController_${e.componentId}.name}}`,
602
- subtitle: `{{TekUserInfoController_${e.componentId}.version}}`,
603
- isVisible: `{{TekUserInfoController_${e.componentId}.showVersionInfo}}`,
604
- cssClass: "zd-px-2"
605
- },
606
- {
607
- name: `${e.name}_about`,
608
- component: "ZdListItem",
609
- title: "TEKUSERINFO_ABOUT",
610
- prependIcon: "infoOutline",
611
- cssClass: "zd-px-2",
612
- isVisible: `{{TekUserInfoController_${e.componentId}.showAbout}}`,
613
- events: {
614
- click: () => e.onAboutClick()
615
- }
616
- },
617
- {
618
- name: `${e.name}_report`,
619
- component: "ZdListItem",
620
- title: "TEKUSERINFO_REPORT_ERROR",
621
- prependIcon: "mdi-ladybug",
622
- cssClass: "zd-px-2",
623
- isVisible: `{{TekUserInfoController_${e.componentId}.showReportError}}`,
624
- events: {
625
- click: () => e.onReportClick()
626
- }
627
- }
628
- ];
629
- }
630
- }
631
228
  export {
632
- ne as TekUserInfo,
633
- re as TekUserInfoList,
634
- oe as UserInfo
229
+ K as UserInfo
635
230
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-user-info-common",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -37,5 +37,5 @@
37
37
  "vite-plugin-dts": "^4.3.0",
38
38
  "vitest": "^2.1.8"
39
39
  },
40
- "gitHead": "4a32d69e039978568226f2285b2f3563bb41d614"
40
+ "gitHead": "2c2a25056f4faa91cf3d7a3227050ccde64d4fee"
41
41
  }
@@ -1,22 +0,0 @@
1
- import { TekUserInfo } from './tek-user-info';
2
- declare class TekUserInfoController {
3
- component: TekUserInfo;
4
- get versionInfo(): import('./interfaces').IVersionInfo | null;
5
- constructor(component: TekUserInfo);
6
- get name(): string;
7
- set name(value: string);
8
- get version(): string;
9
- set version(value: string);
10
- get hasDefaultEmail(): boolean;
11
- get hasAboutImage(): boolean;
12
- mergeText(name: string, version: string): string;
13
- get mainVersion(): string;
14
- protected getItems(tab: 'frontend' | 'backend' | 'modules'): string | never[];
15
- get frontendItems(): string | never[];
16
- get backendItems(): string | never[];
17
- get modulesItems(): string | never[];
18
- get showReportError(): boolean;
19
- get showVersionInfo(): boolean;
20
- get showAbout(): boolean;
21
- }
22
- export { TekUserInfoController };
@@ -1,27 +0,0 @@
1
- import { IList } from '@zeedhi/common';
2
- import { IUserInfo } from '../interfaces';
3
- export interface IVersionInfo {
4
- name: string;
5
- version: string;
6
- frontend: {
7
- name: string;
8
- version: string;
9
- }[];
10
- backend: {
11
- name: string;
12
- version: string;
13
- }[];
14
- modules: {
15
- name: string;
16
- version: string;
17
- }[];
18
- }
19
- export interface ITekUserInfo extends IUserInfo {
20
- aboutImage?: string;
21
- defaultEmail?: string;
22
- versionInfo?: IVersionInfo | null;
23
- versionUrl?: string;
24
- }
25
- export interface ITekUserInfoList extends IList {
26
- parentName?: string;
27
- }
@@ -1,32 +0,0 @@
1
- import { List } from '@zeedhi/common';
2
- import { ITekUserInfo, ITekUserInfoList } from './interfaces';
3
- export declare class TekUserInfoList extends List implements ITekUserInfoList {
4
- /**
5
- * Name of the user info component
6
- */
7
- parentName: string;
8
- dense: boolean;
9
- constructor(props: ITekUserInfo);
10
- onCreated(): void;
11
- protected getItems(): ({
12
- name: string;
13
- component: string;
14
- title: string;
15
- subtitle: string;
16
- isVisible: string;
17
- cssClass: string;
18
- prependIcon?: undefined;
19
- events?: undefined;
20
- } | {
21
- name: string;
22
- component: string;
23
- title: string;
24
- prependIcon: string;
25
- cssClass: string;
26
- isVisible: string;
27
- events: {
28
- click: () => void;
29
- };
30
- subtitle?: undefined;
31
- })[];
32
- }
@@ -1,37 +0,0 @@
1
- import { Button, IComponentRender, Modal } from '@zeedhi/common';
2
- import { IEventParam } from '@zeedhi/core';
3
- import { UserInfo } from '../user-info';
4
- import { ITekUserInfo, IVersionInfo } from './interfaces';
5
- export declare class TekUserInfo extends UserInfo implements ITekUserInfo {
6
- aboutModal?: Modal;
7
- reportModal?: Modal;
8
- /**
9
- * Data about the application version
10
- */
11
- versionInfo: IVersionInfo | null;
12
- /**
13
- * Default email address to be defined in the Report Bug form
14
- */
15
- defaultEmail: string;
16
- /**
17
- * Url from which the version info will be retrieved
18
- */
19
- versionUrl: string;
20
- /**
21
- * Path to the image to be shown on about modal
22
- */
23
- aboutImage: string;
24
- protected propBottomSlot?: IComponentRender[];
25
- constructor(props: ITekUserInfo);
26
- protected getBottomSlot(): IComponentRender[];
27
- onAboutClick(): void;
28
- protected getVersionTree(tab: 'frontend' | 'backend' | 'modules'): {
29
- name: string;
30
- component: string;
31
- text: string;
32
- }[];
33
- onReportClick(): void;
34
- onSendReport({ event, element }: IEventParam<Button>): Promise<void>;
35
- onCreated(): void;
36
- onMounted(element: any): Promise<void>;
37
- }