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

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.
@@ -0,0 +1,635 @@
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);
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;
32
+ }
33
+ get showChangeProfile() {
34
+ const { changeProfile: t } = this.component.visibleItems;
35
+ return t || t === void 0;
36
+ }
37
+ get showLogout() {
38
+ const { logout: t } = this.component.visibleItems;
39
+ return t || t === void 0;
40
+ }
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);
46
+ /**
47
+ * Dropdown activator
48
+ */
49
+ n(this, "activator");
50
+ /**
51
+ * Props to be passed to the ZdAvatar component
52
+ */
53
+ n(this, "avatarProps", {});
54
+ /**
55
+ * Components to be rendered on the bottom slot
56
+ */
57
+ n(this, "bottomSlot", []);
58
+ /**
59
+ * Components to be rendered on the center slot
60
+ */
61
+ n(this, "centerSlot", []);
62
+ /**
63
+ * Components to be rendered on the top slot
64
+ */
65
+ n(this, "topSlot", []);
66
+ /**
67
+ * User name
68
+ */
69
+ n(this, "user", "");
70
+ /**
71
+ * User image
72
+ */
73
+ n(this, "userImage", "");
74
+ /**
75
+ * Designates if menu should close on outside-activator click.
76
+ */
77
+ n(this, "closeOnClick", !0);
78
+ /**
79
+ * Designates if menu should close when its content is clicked.
80
+ */
81
+ n(this, "closeOnContentClick", !0);
82
+ /**
83
+ * Applies position fixed to the dropdown.
84
+ */
85
+ n(this, "fixed", !1);
86
+ /**
87
+ * Components to be rendered on the menu header
88
+ */
89
+ n(this, "headerSlot", []);
90
+ /**
91
+ * Props to be passed to the ZdImage component (rendered inside the avatar)
92
+ */
93
+ n(this, "imageProps", {});
94
+ /**
95
+ * Offset the menu on the x-axis.
96
+ */
97
+ n(this, "offsetX", !1);
98
+ /**
99
+ * Offset the menu on the x-axis.
100
+ */
101
+ n(this, "offsetY", !0);
102
+ /**
103
+ * Designates whether menu should open on activator click.
104
+ */
105
+ n(this, "openOnClick", !0);
106
+ /**
107
+ * Designates whether menu should open on activator hover.
108
+ */
109
+ n(this, "openOnHover", !1);
110
+ /**
111
+ * Controls whether the component is visible or hidden.
112
+ */
113
+ n(this, "value", !1);
114
+ n(this, "visibleItems", {
115
+ userName: !0,
116
+ changeProfile: !0,
117
+ logout: !0
118
+ });
119
+ /**
120
+ * Sets the height for the dropdown.
121
+ */
122
+ n(this, "height", "auto");
123
+ /**
124
+ * Sets the maximum height for the dropdown.
125
+ */
126
+ n(this, "maxHeight");
127
+ /**
128
+ * Sets the maximum width for the dropdown.
129
+ */
130
+ n(this, "maxWidth");
131
+ /**
132
+ * Sets the minimum height for the dropdown.
133
+ */
134
+ n(this, "minHeight");
135
+ /**
136
+ * Sets the minimum width for the dropdown.
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();
141
+ }
142
+ getActivator() {
143
+ return {
144
+ name: `${this.name}_activator_tooltip`,
145
+ component: "ZdTooltip",
146
+ bottom: !0,
147
+ label: this.user,
148
+ children: [
149
+ {
150
+ name: `${this.name}_activator`,
151
+ component: "ZdAvatar",
152
+ avatarSlot: [
153
+ {
154
+ name: `${this.name}_image`,
155
+ component: "ZdImage",
156
+ src: this.userImage,
157
+ ...this.imageProps
158
+ }
159
+ ],
160
+ ...this.avatarProps
161
+ }
162
+ ]
163
+ };
164
+ }
165
+ getCenterSlot() {
166
+ return [
167
+ {
168
+ name: `${this.name}_center_list`,
169
+ component: "ZdList",
170
+ dense: !0,
171
+ items: [
172
+ {
173
+ name: `${this.name}_change_profile`,
174
+ component: "ZdListItem",
175
+ title: "USERINFO_CHANGE_PROFILE",
176
+ prependIcon: "mdi-account",
177
+ cssClass: "zd-px-2",
178
+ isVisible: `{{UserInfoController_${this.componentId}.showChangeProfile}}`,
179
+ events: {
180
+ click: ({ event: e, element: i }) => this.onProfileChange(e, i)
181
+ }
182
+ },
183
+ {
184
+ name: `${this.name}_logout`,
185
+ component: "ZdListItem",
186
+ title: "USERINFO_LOGOUT",
187
+ prependIcon: "mdi-logout-variant",
188
+ cssClass: "zd-px-2",
189
+ isVisible: `{{UserInfoController_${this.componentId}.showLogout}}`,
190
+ events: {
191
+ click: ({ event: e, element: i }) => this.onLogoutClick(e, i)
192
+ }
193
+ }
194
+ ]
195
+ }
196
+ ];
197
+ }
198
+ onLogoutClick(e, i) {
199
+ this.callEvent("onLogoutClick", { event: e, element: i, component: this });
200
+ }
201
+ onProfileChange(e, i) {
202
+ this.callEvent("onProfileChange", { event: e, element: i, component: this });
203
+ }
204
+ onCreated() {
205
+ super.onCreated(), z.addController(`UserInfoController_${this.componentId}`, p, [this]), this.centerSlot = this.propCenterSlot ? this.propCenterSlot : this.getCenterSlot();
206
+ }
207
+ }
208
+ D.add({
209
+ "pt-BR": {
210
+ translation: {
211
+ USERINFO_CHANGE_PROFILE: "Alterar perfil",
212
+ USERINFO_LOGOUT: "Sair"
213
+ }
214
+ },
215
+ "en-US": {
216
+ translation: {
217
+ USERINFO_CHANGE_PROFILE: "Change profile",
218
+ USERINFO_LOGOUT: "Sign out"
219
+ }
220
+ },
221
+ "es-CL": {
222
+ translation: {
223
+ USERINFO_CHANGE_PROFILE: "Cambiar el perfil",
224
+ USERINFO_LOGOUT: "Salir"
225
+ }
226
+ }
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
+ export {
632
+ ne as TekUserInfo,
633
+ re as TekUserInfoList,
634
+ oe as UserInfo
635
+ };
package/package.json CHANGED
@@ -1,27 +1,41 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-user-info-common",
3
- "version": "1.3.4",
4
- "description": "Implementation of UserInfo componente using Zeedhi Next",
5
- "main": "dist/user-info-common.umd.js",
6
- "module": "dist/user-info-common.esm.js",
7
- "typings": "types/index.d.ts",
3
+ "version": "3.0.0",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
11
- "scripts": {
12
- "build": "rollup -c",
13
- "lint": "eslint . --fix --ext .ts",
14
- "test": "jest",
15
- "watch": "npm run build -- -w"
11
+ "module": "./dist/user-info-common.es.js",
12
+ "types": "./dist/types/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/user-info-common.es.js",
16
+ "types": "./dist/types/index.d.ts"
17
+ }
16
18
  },
17
- "devDependencies": {
18
- "@types/jest": "26.0.*",
19
- "jest": "26.6.*",
20
- "ts-jest": "26.5.*"
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc && vite build",
22
+ "test": "vitest run --coverage",
23
+ "test:watch": "vitest"
21
24
  },
22
25
  "peerDependencies": {
23
- "@zeedhi/common": "^1.57.0",
24
- "@zeedhi/core": "^1.57.0"
26
+ "@zeedhi/common": "^3.0.0",
27
+ "@zeedhi/core": "^3.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.10.2",
31
+ "@vitest/coverage-v8": "^2.1.8",
32
+ "@zeedhi/common": "^3.0.0",
33
+ "@zeedhi/core": "^3.0.0",
34
+ "jsdom": "^25.0.1",
35
+ "typescript": "~5.6.2",
36
+ "vite": "^5.4.0",
37
+ "vite-plugin-dts": "^4.3.0",
38
+ "vitest": "^2.1.8"
25
39
  },
26
- "gitHead": "0257077f641d5717050e0edd32c3b8e8a9d290b6"
40
+ "gitHead": "4a32d69e039978568226f2285b2f3563bb41d614"
27
41
  }