sagittarius-admin-template 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +174 -2
- package/ng-package.json +11 -0
- package/package.json +48 -4
- package/src/lib/sagittarius-admin/drawer-component/drawer-component.html +1 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-component.scss +0 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-component.spec.ts +54 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-component.ts +123 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.html +23 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.scss +103 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.spec.ts +63 -0
- package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.ts +67 -0
- package/src/lib/sagittarius-admin/drawer-ref.ts +26 -0
- package/src/lib/sagittarius-admin/drawer-service.ts +58 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.html +150 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.labels.ts +63 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.models.ts +60 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.scss +592 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.spec.ts +45 -0
- package/src/lib/sagittarius-admin/sagittarius-admin.ts +159 -0
- package/src/public-api.ts +9 -0
- package/styles/sagittarius-admin.scss +496 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Component, ComponentRef, Injector, Type, ViewChild, ViewContainerRef, computed, inject, input, signal } from '@angular/core';
|
|
2
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
5
|
+
import { RouterLink } from '@angular/router';
|
|
6
|
+
import { DrawerRef } from '../../drawer-ref';
|
|
7
|
+
import { SG_ADMIN_LABELS } from '../../sagittarius-admin.labels';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'lib-drawer-content',
|
|
11
|
+
imports: [
|
|
12
|
+
MatIconModule,
|
|
13
|
+
MatButtonModule,
|
|
14
|
+
MatTooltipModule,
|
|
15
|
+
RouterLink,
|
|
16
|
+
],
|
|
17
|
+
templateUrl: './drawer-content.html',
|
|
18
|
+
styleUrl: './drawer-content.scss'
|
|
19
|
+
})
|
|
20
|
+
export class DrawerContent {
|
|
21
|
+
@ViewChild('vc', { read: ViewContainerRef, static: true }) vc!: ViewContainerRef;
|
|
22
|
+
|
|
23
|
+
protected readonly labels = inject(SG_ADMIN_LABELS);
|
|
24
|
+
|
|
25
|
+
readonly pos = input(0);
|
|
26
|
+
readonly drawerRef = input.required<DrawerRef>();
|
|
27
|
+
readonly fullPageIcon = input('open_in_full');
|
|
28
|
+
/** Ak chýba, použije sa `SgAdminLabels.drawerFullPage`. */
|
|
29
|
+
readonly fullPageLabelInput = input<string | undefined>(undefined, { alias: 'fullPageLabel' });
|
|
30
|
+
readonly fullPageLabel = computed(() => this.fullPageLabelInput() ?? this.labels.drawerFullPage);
|
|
31
|
+
readonly animating = signal(true);
|
|
32
|
+
/** Vrstva práve odchádza (animácia zatvárania). */
|
|
33
|
+
readonly leaving = signal(false);
|
|
34
|
+
private leaveDone?: () => void;
|
|
35
|
+
|
|
36
|
+
loadComponent<T>(component: Type<T>, injector: Injector): ComponentRef<T> {
|
|
37
|
+
this.vc.clear();
|
|
38
|
+
return this.vc.createComponent(component, { injector });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
onAnimationEnd(event: AnimationEvent) {
|
|
42
|
+
// animationend bubble-uje aj z obsahu – reaguj len na vlastnú animáciu
|
|
43
|
+
if (event.target === event.currentTarget) {
|
|
44
|
+
this.animating.set(false);
|
|
45
|
+
if (this.leaving()) {
|
|
46
|
+
this.leaveDone?.();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Spustí animáciu odchodu; promise sa splní po jej skončení (pri reduced motion hneď). */
|
|
52
|
+
leave(): Promise<void> {
|
|
53
|
+
if (typeof window === 'undefined' || window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
|
|
54
|
+
return Promise.resolve();
|
|
55
|
+
}
|
|
56
|
+
this.leaving.set(true);
|
|
57
|
+
return new Promise(resolve => {
|
|
58
|
+
this.leaveDone = resolve;
|
|
59
|
+
// poistka, ak animationend nepríde (napr. skrytý tab)
|
|
60
|
+
setTimeout(resolve, 300);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
close() {
|
|
65
|
+
this.drawerRef().close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { signal } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Referencia na otvorený drawer. Komponent zobrazený v draweri ju získa cez `inject(DrawerRef)`.
|
|
5
|
+
*/
|
|
6
|
+
export class DrawerRef {
|
|
7
|
+
readonly title = signal('');
|
|
8
|
+
/** URL samostatnej stránky; ak je nastavená, hlavička drawera zobrazí ikonu na jej otvorenie. */
|
|
9
|
+
readonly fullPageUrl = signal<string | any[] | null>(null);
|
|
10
|
+
|
|
11
|
+
constructor(private readonly closeFn: () => void) {}
|
|
12
|
+
|
|
13
|
+
/** Zatvorí tento drawer (krok späť v histórii prehliadača). */
|
|
14
|
+
close(): void {
|
|
15
|
+
this.closeFn();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setTitle(title: string): void {
|
|
19
|
+
this.title.set(title);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Nastaví (alebo `null` = skryje) odkaz na samostatnú stránku v hlavičke drawera. */
|
|
23
|
+
setFullPageUrl(url: string | any[] | null): void {
|
|
24
|
+
this.fullPageUrl.set(url);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Injectable, Type } from '@angular/core';
|
|
2
|
+
import { Location } from '@angular/common';
|
|
3
|
+
import type { DrawerComponent } from './drawer-component/drawer-component';
|
|
4
|
+
import type { SagittariusAdmin } from './sagittarius-admin';
|
|
5
|
+
import { DrawerRef } from './drawer-ref';
|
|
6
|
+
import { DrawerData, DrawerOptions } from './sagittarius-admin.models';
|
|
7
|
+
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root'
|
|
10
|
+
})
|
|
11
|
+
export class DrawerService {
|
|
12
|
+
private host?: DrawerComponent;
|
|
13
|
+
private app?: SagittariusAdmin;
|
|
14
|
+
|
|
15
|
+
constructor(private location: Location) { }
|
|
16
|
+
|
|
17
|
+
setHost(component: DrawerComponent, app: SagittariusAdmin) {
|
|
18
|
+
this.host = component;
|
|
19
|
+
this.app = app;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Otvorí komponent v draweri nad obsahom. Každé ďalšie volanie pridá novú vrstvu.
|
|
24
|
+
* Otvorenie pridá záznam do histórie, takže tlačidlo Späť v prehliadači zatvorí vrchnú vrstvu.
|
|
25
|
+
*
|
|
26
|
+
* @param data vstupy komponentu (signal `input()` aj bežné properties)
|
|
27
|
+
*/
|
|
28
|
+
open<T>(
|
|
29
|
+
component: Type<T>,
|
|
30
|
+
data?: DrawerData<T>,
|
|
31
|
+
options?: DrawerOptions
|
|
32
|
+
): { componentInstance: T, drawerRef: DrawerRef, close: () => void } {
|
|
33
|
+
if (!this.host || !this.app) {
|
|
34
|
+
throw new Error('Drawer host not initialized - <lib-sagittarius-admin> must be rendered');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { component: compRef, drawerRef } = this.host.loadComponent(component, data, options);
|
|
38
|
+
this.app.openDrawer();
|
|
39
|
+
this.location.go(this.location.path(true));
|
|
40
|
+
|
|
41
|
+
return { componentInstance: compRef.instance, drawerRef, close: () => drawerRef.close() };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Zatvorí vrchnú vrstvu drawera. */
|
|
45
|
+
closeTop() {
|
|
46
|
+
this.location.back();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Zatvorí všetky vrstvy (bez práce s históriou). */
|
|
50
|
+
closeAll() {
|
|
51
|
+
this.host?.closeAll();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @internal volá DrawerComponent, keď zanikne posledná vrstva */
|
|
55
|
+
close() {
|
|
56
|
+
this.app?.closeDrawer();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<div class="sg-admin-theme" [class.isHandset]="isHandset()" [class.isDesktop]="!isHandset()">
|
|
2
|
+
<aside class="sg-admin-theme-sidebar" [class.open]="sidebarOpen()" [class.collapsed]="collapsed()"
|
|
3
|
+
[class.expanded]="!collapsed()">
|
|
4
|
+
<div class="sg-admin-theme-sidebar-wrapper" [class.hover]="hovered()" [class.no-hover]="!hovered()"
|
|
5
|
+
(mouseenter)="setHovered(true)" (mouseleave)="setHovered(false)">
|
|
6
|
+
<div class="sg-admin-theme-sidebar-header">
|
|
7
|
+
<a class="sg-admin-theme-brand" [routerLink]="homeRoute()" (click)="onNavigate()">
|
|
8
|
+
<span class="sg-admin-theme-brand-mark">
|
|
9
|
+
@if (logoUrl()) {
|
|
10
|
+
<img [src]="logoUrl()" alt="">
|
|
11
|
+
} @else {
|
|
12
|
+
{{ shortTitle() }}
|
|
13
|
+
}
|
|
14
|
+
</span>
|
|
15
|
+
<span class="sg-admin-theme-sidebar-header-logo-lg">{{ appTitle() }}</span>
|
|
16
|
+
</a>
|
|
17
|
+
<button matIconButton class="mobile-only sg-admin-theme-sidebar-header-menu-button" (click)="closeSidebar()"
|
|
18
|
+
[attr.aria-label]="labels.closeMenu">
|
|
19
|
+
<mat-icon>close</mat-icon>
|
|
20
|
+
</button>
|
|
21
|
+
@if (collapsed()) {
|
|
22
|
+
@if (hovered()) {
|
|
23
|
+
<button matIconButton class="pc-only sg-admin-theme-sidebar-header-menu-button" (click)="toggleSidebar()"
|
|
24
|
+
[attr.aria-label]="labels.expandMenu">
|
|
25
|
+
<mat-icon>keyboard_double_arrow_right</mat-icon>
|
|
26
|
+
</button>
|
|
27
|
+
}
|
|
28
|
+
} @else {
|
|
29
|
+
<button matIconButton class="pc-only sg-admin-theme-sidebar-header-menu-button" (click)="toggleSidebar()"
|
|
30
|
+
[attr.aria-label]="labels.collapseMenu">
|
|
31
|
+
<mat-icon>keyboard_double_arrow_left</mat-icon>
|
|
32
|
+
</button>
|
|
33
|
+
}
|
|
34
|
+
</div>
|
|
35
|
+
<div class="sg-admin-theme-sidebar-body">
|
|
36
|
+
@if (user(); as u) {
|
|
37
|
+
<div class="sg-admin-theme-sidebar-profile">
|
|
38
|
+
<div class="sg-admin-theme-sidebar-profile-header">
|
|
39
|
+
<div class="sg-admin-theme-sidebar-profile-header-avatar">
|
|
40
|
+
@if (u.avatarUrl) {
|
|
41
|
+
<img [src]="u.avatarUrl" alt="">
|
|
42
|
+
} @else {
|
|
43
|
+
{{ userInitials() }}
|
|
44
|
+
}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="sg-admin-theme-sidebar-profile-footer">
|
|
48
|
+
<div class="sg-admin-theme-sidebar-profile-footer-name">{{ u.name }}</div>
|
|
49
|
+
@if (u.subtitle) {
|
|
50
|
+
<div class="sg-admin-theme-sidebar-profile-footer-subtitle">{{ u.subtitle }}</div>
|
|
51
|
+
}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
}
|
|
55
|
+
<nav>
|
|
56
|
+
@for (item of menuItems(); track $index) {
|
|
57
|
+
@if (item.spacer) {
|
|
58
|
+
<div class="sg-admin-theme-sidebar-nav-item-spacer">
|
|
59
|
+
<span class="sg-admin-theme-sidebar-nav-item-icon"></span>
|
|
60
|
+
<span class="sg-admin-theme-sidebar-nav-item-label">{{ item.label }}</span>
|
|
61
|
+
</div>
|
|
62
|
+
} @else {
|
|
63
|
+
<a class="sg-admin-theme-sidebar-nav-item" [routerLink]="item.route" routerLinkActive="active"
|
|
64
|
+
[routerLinkActiveOptions]="{ exact: !!item.exact }" (click)="onNavigate()" [attr.title]="item.label">
|
|
65
|
+
<span class="sg-admin-theme-sidebar-nav-item-wrapper">
|
|
66
|
+
<mat-icon class="sg-admin-theme-sidebar-nav-item-icon">{{ item.icon || 'circle' }}</mat-icon>
|
|
67
|
+
<span class="sg-admin-theme-sidebar-nav-item-label">{{ item.label }}</span>
|
|
68
|
+
</span>
|
|
69
|
+
@if (item.badge !== undefined && item.badge !== null) {
|
|
70
|
+
<span class="sg-admin-theme-sidebar-nav-item-badge">{{ item.badge }}</span>
|
|
71
|
+
}
|
|
72
|
+
</a>
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</nav>
|
|
76
|
+
<div class="sg-admin-theme-sidebar-bottom">
|
|
77
|
+
<ng-content select="[sg-admin-sidebar-bottom]"></ng-content>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</aside>
|
|
82
|
+
<div class="sg-admin-theme-body">
|
|
83
|
+
<header class="sg-admin-theme-header">
|
|
84
|
+
<div class="sg-admin-theme-header-left-box">
|
|
85
|
+
<button matIconButton class="mobile-only sg-admin-theme-header-left-box-menu-button" (click)="openSidebar()"
|
|
86
|
+
[attr.aria-label]="labels.openMenu">
|
|
87
|
+
<mat-icon>menu</mat-icon>
|
|
88
|
+
</button>
|
|
89
|
+
<a class="mobile-only sg-admin-theme-header-logo-lg" [routerLink]="homeRoute()">{{ appTitle() }}</a>
|
|
90
|
+
<ng-content select="[sg-admin-header-left]"></ng-content>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="sg-admin-theme-header-middle-box">
|
|
93
|
+
<ng-content select="[sg-admin-header-middle]"></ng-content>
|
|
94
|
+
<ng-content select="[sg-admin-header]"></ng-content>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="sg-admin-theme-header-right-box">
|
|
97
|
+
<ng-content select="[sg-admin-header-actions]"></ng-content>
|
|
98
|
+
@if (user(); as u) {
|
|
99
|
+
<button class="sg-admin-theme-header-user" [matMenuTriggerFor]="userMenu" [attr.aria-label]="labels.userMenu">
|
|
100
|
+
<span class="sg-admin-theme-header-user-avatar">
|
|
101
|
+
@if (u.avatarUrl) {
|
|
102
|
+
<img [src]="u.avatarUrl" alt="">
|
|
103
|
+
} @else {
|
|
104
|
+
{{ userInitials() }}
|
|
105
|
+
}
|
|
106
|
+
</span>
|
|
107
|
+
<span class="sg-admin-theme-header-user-name pc-only">{{ u.name }}</span>
|
|
108
|
+
<mat-icon class="pc-only">expand_more</mat-icon>
|
|
109
|
+
</button>
|
|
110
|
+
<mat-menu #userMenu="matMenu" xPosition="before" class="sg-admin-user-menu">
|
|
111
|
+
<div class="sg-admin-user-menu-header">
|
|
112
|
+
<div class="sg-admin-user-menu-name">{{ u.name }}</div>
|
|
113
|
+
@if (u.subtitle) {
|
|
114
|
+
<div class="sg-admin-user-menu-subtitle">{{ u.subtitle }}</div>
|
|
115
|
+
}
|
|
116
|
+
</div>
|
|
117
|
+
@for (item of userMenuItems(); track $index) {
|
|
118
|
+
@if (item.divider) {
|
|
119
|
+
<div class="sg-admin-user-menu-divider"></div>
|
|
120
|
+
} @else if (item.route) {
|
|
121
|
+
<a mat-menu-item [routerLink]="item.route" [disabled]="!!item.disabled" (click)="onUserMenuItem(item)">
|
|
122
|
+
@if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }
|
|
123
|
+
<span>{{ item.label }}</span>
|
|
124
|
+
</a>
|
|
125
|
+
} @else {
|
|
126
|
+
<button mat-menu-item [disabled]="!!item.disabled" (click)="onUserMenuItem(item)">
|
|
127
|
+
@if (item.icon) { <mat-icon>{{ item.icon }}</mat-icon> }
|
|
128
|
+
<span>{{ item.label }}</span>
|
|
129
|
+
</button>
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</mat-menu>
|
|
133
|
+
}
|
|
134
|
+
</div>
|
|
135
|
+
</header>
|
|
136
|
+
<main class="sg-admin-theme-main">
|
|
137
|
+
<div class="sg-admin-theme-drawer" [class.closed]="!drawerOpen()">
|
|
138
|
+
<lib-drawer-component></lib-drawer-component>
|
|
139
|
+
</div>
|
|
140
|
+
<div class="sg-admin-theme-content" [attr.inert]="drawerOpen() ? '' : null">
|
|
141
|
+
<ng-content></ng-content>
|
|
142
|
+
</div>
|
|
143
|
+
</main>
|
|
144
|
+
<footer class="sg-admin-theme-footer">
|
|
145
|
+
<ng-content select="[sg-admin-footer]">
|
|
146
|
+
<span>{{ appTitle() }}</span>
|
|
147
|
+
</ng-content>
|
|
148
|
+
</footer>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/** Texty zabudované v layoute (aria-label, tooltipy). */
|
|
4
|
+
export interface SgAdminLabels {
|
|
5
|
+
/** Otvorenie sidebaru hamburgerom na mobile. */
|
|
6
|
+
openMenu: string;
|
|
7
|
+
/** Zatvorenie sidebaru na mobile. */
|
|
8
|
+
closeMenu: string;
|
|
9
|
+
/** Pripnutie (rozbalenie) zbaleného sidebaru. */
|
|
10
|
+
expandMenu: string;
|
|
11
|
+
/** Zbalenie sidebaru. */
|
|
12
|
+
collapseMenu: string;
|
|
13
|
+
/** Tlačidlo používateľského menu v hlavičke. */
|
|
14
|
+
userMenu: string;
|
|
15
|
+
/** Zatvorenie prvej vrstvy drawera. */
|
|
16
|
+
drawerClose: string;
|
|
17
|
+
/** Návrat z vnorenej vrstvy drawera. */
|
|
18
|
+
drawerBack: string;
|
|
19
|
+
/** Predvolený tooltip / aria-label ikony `fullPageUrl` (prebije ho `DrawerOptions.fullPageLabel`). */
|
|
20
|
+
drawerFullPage: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Anglické texty (predvolené). */
|
|
24
|
+
export const SG_ADMIN_LABELS_EN: SgAdminLabels = {
|
|
25
|
+
openMenu: 'Open menu',
|
|
26
|
+
closeMenu: 'Close menu',
|
|
27
|
+
expandMenu: 'Pin menu',
|
|
28
|
+
collapseMenu: 'Collapse menu',
|
|
29
|
+
userMenu: 'User menu',
|
|
30
|
+
drawerClose: 'Close',
|
|
31
|
+
drawerBack: 'Back',
|
|
32
|
+
drawerFullPage: 'Open as full page',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Slovenské texty. */
|
|
36
|
+
export const SG_ADMIN_LABELS_SK: SgAdminLabels = {
|
|
37
|
+
openMenu: 'Otvoriť menu',
|
|
38
|
+
closeMenu: 'Zavrieť menu',
|
|
39
|
+
expandMenu: 'Pripnúť menu',
|
|
40
|
+
collapseMenu: 'Zbaliť menu',
|
|
41
|
+
userMenu: 'Používateľské menu',
|
|
42
|
+
drawerClose: 'Zavrieť',
|
|
43
|
+
drawerBack: 'Späť',
|
|
44
|
+
drawerFullPage: 'Otvoriť na celej stránke',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Texty layoutu; default `SG_ADMIN_LABELS_EN`. Nastav cez `provideSgAdminLabels()`. */
|
|
48
|
+
export const SG_ADMIN_LABELS = new InjectionToken<SgAdminLabels>('SG_ADMIN_LABELS', {
|
|
49
|
+
providedIn: 'root',
|
|
50
|
+
factory: () => SG_ADMIN_LABELS_EN,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Nastaví texty layoutu. Chýbajúce kľúče sa doplnia z angličtiny.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* providers: [provideSgAdminLabels(SG_ADMIN_LABELS_SK)]
|
|
58
|
+
* providers: [provideSgAdminLabels({ drawerClose: 'Schließen' })]
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function provideSgAdminLabels(labels: Partial<SgAdminLabels>): Provider {
|
|
62
|
+
return { provide: SG_ADMIN_LABELS, useValue: { ...SG_ADMIN_LABELS_EN, ...labels } };
|
|
63
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { InputSignalWithTransform } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/** Položka hlavného menu v sidebare. */
|
|
4
|
+
export interface SgMenuItem {
|
|
5
|
+
label: string;
|
|
6
|
+
/** Názov Material ikony (ligatúra), napr. `dashboard`. */
|
|
7
|
+
icon?: string;
|
|
8
|
+
/** Cieľová routa pre `routerLink`. */
|
|
9
|
+
route?: string | any[];
|
|
10
|
+
/** `true` = sekčný nadpis (nie je klikateľný). */
|
|
11
|
+
spacer?: boolean;
|
|
12
|
+
/** Presná zhoda pre zvýraznenie aktívnej položky (default `false`). */
|
|
13
|
+
exact?: boolean;
|
|
14
|
+
/** Voliteľný odznak vpravo (napr. počet). */
|
|
15
|
+
badge?: string | number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Prihlásený používateľ zobrazený v sidebare a v user menu. */
|
|
19
|
+
export interface SgUser {
|
|
20
|
+
name: string;
|
|
21
|
+
/** Druhý riadok pod menom (email, rola…). */
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
avatarUrl?: string;
|
|
24
|
+
/** Ak chýba, vypočíta sa z `name`. */
|
|
25
|
+
initials?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Položka rozbaľovacieho menu používateľa v hlavičke. */
|
|
29
|
+
export interface SgUserMenuItem {
|
|
30
|
+
label?: string;
|
|
31
|
+
icon?: string;
|
|
32
|
+
route?: string | any[];
|
|
33
|
+
action?: () => void;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** `true` = oddeľovač, ostatné polia sa ignorujú. */
|
|
36
|
+
divider?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Voľby pri otváraní drawera cez `DrawerService.open`. */
|
|
40
|
+
export interface DrawerOptions {
|
|
41
|
+
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* URL samostatnej stránky s rovnakým obsahom (napr. `/users/42` alebo `['/users', 42]`).
|
|
44
|
+
* Ak je zadaná, v pravom rohu hlavičky drawera sa zobrazí ikona, ktorá drawer zavrie
|
|
45
|
+
* a prejde na túto stránku. Dá sa meniť aj za behu cez `DrawerRef.setFullPageUrl()`.
|
|
46
|
+
*/
|
|
47
|
+
fullPageUrl?: string | any[];
|
|
48
|
+
/** Material ikona tlačidla (default `open_in_full`). */
|
|
49
|
+
fullPageIcon?: string;
|
|
50
|
+
/** Tooltip / aria-label tlačidla (default `SgAdminLabels.drawerFullPage` – „Open as full page“). */
|
|
51
|
+
fullPageLabel?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Dáta pre komponent v draweri: vlastnosti komponentu, pričom signal `input()`
|
|
56
|
+
* sa zadáva ako jeho hodnota (nie ako signál).
|
|
57
|
+
*/
|
|
58
|
+
export type DrawerData<T> = {
|
|
59
|
+
[K in keyof T]?: T[K] extends InputSignalWithTransform<any, infer W> ? W : T[K];
|
|
60
|
+
};
|