@ramonbsales/noah-angular 1.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.
- package/README.md +84 -0
- package/fesm2022/ramonbsales-noah-angular.mjs +2188 -0
- package/fesm2022/ramonbsales-noah-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/breadcrumb/breadcrumb.component.d.ts +9 -0
- package/lib/components/button/button.component.d.ts +16 -0
- package/lib/components/checkbox/checkbox.component.d.ts +24 -0
- package/lib/components/dropdown/dropdown.component.d.ts +37 -0
- package/lib/components/input/input.component.d.ts +37 -0
- package/lib/components/table/table.component.d.ts +40 -0
- package/lib/components/toggle/toggle.component.d.ts +15 -0
- package/lib/interceptors/auth.interceptor.d.ts +15 -0
- package/lib/interceptors/index.d.ts +1 -0
- package/lib/pages/login/login.component.d.ts +82 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/local-storage/auth-storage.service.d.ts +65 -0
- package/lib/services/local-storage/local-storage.service.d.ts +82 -0
- package/lib/services/login/login.service.d.ts +96 -0
- package/lib/shared-components.component.d.ts +5 -0
- package/lib/shared-components.service.d.ts +6 -0
- package/lib/sidebar/sidebar.component.d.ts +83 -0
- package/lib/types/auth.types.d.ts +104 -0
- package/lib/types/sidebar.types.d.ts +52 -0
- package/package.json +44 -0
- package/public-api.d.ts +16 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
|
|
2
|
+
import { FormGroup } from '@angular/forms';
|
|
3
|
+
import { LoginService } from '../../services/login/login.service';
|
|
4
|
+
import { LoginCredentials, LoginResponse, LoginStatus, LoginState, LoginOptions } from '../../types/auth.types';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class LoginComponent implements OnInit, OnDestroy {
|
|
7
|
+
private loginService;
|
|
8
|
+
private destroy$;
|
|
9
|
+
private fb;
|
|
10
|
+
options: Partial<LoginOptions>;
|
|
11
|
+
showHeader: boolean;
|
|
12
|
+
showFooter: boolean;
|
|
13
|
+
logoUrl?: string;
|
|
14
|
+
backgroundImageUrl?: string;
|
|
15
|
+
customCssClass?: string;
|
|
16
|
+
loginSuccess: EventEmitter<LoginResponse>;
|
|
17
|
+
loginError: EventEmitter<string>;
|
|
18
|
+
formChange: EventEmitter<LoginCredentials>;
|
|
19
|
+
loginForm: FormGroup;
|
|
20
|
+
loginState$: import('rxjs').Observable<LoginState>;
|
|
21
|
+
isLoading$: import('rxjs').Observable<boolean>;
|
|
22
|
+
errors$: import('rxjs').Observable<any>;
|
|
23
|
+
showPassword: boolean;
|
|
24
|
+
LoginStatus: typeof LoginStatus;
|
|
25
|
+
constructor(loginService: LoginService);
|
|
26
|
+
/**
|
|
27
|
+
* Inicializa os observables
|
|
28
|
+
*/
|
|
29
|
+
private initializeObservables;
|
|
30
|
+
ngOnInit(): void;
|
|
31
|
+
ngOnDestroy(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Cria o formulário reativo
|
|
34
|
+
*/
|
|
35
|
+
private createForm;
|
|
36
|
+
/**
|
|
37
|
+
* Manipula mudanças de estado do login
|
|
38
|
+
*/
|
|
39
|
+
private handleStateChange;
|
|
40
|
+
/**
|
|
41
|
+
* Submete o formulário de login
|
|
42
|
+
*/
|
|
43
|
+
onSubmit(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Alterna visibilidade da senha
|
|
46
|
+
*/
|
|
47
|
+
togglePasswordVisibility(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Marca todos os campos como tocados para mostrar erros
|
|
50
|
+
*/
|
|
51
|
+
private markFormGroupTouched;
|
|
52
|
+
/**
|
|
53
|
+
* Verifica se campo tem erro específico
|
|
54
|
+
*/
|
|
55
|
+
hasFieldError(fieldName: string, errorType: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Obtém mensagem de erro do campo
|
|
58
|
+
*/
|
|
59
|
+
getFieldErrorMessage(fieldName: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Obtém label do campo
|
|
62
|
+
*/
|
|
63
|
+
private getFieldLabel;
|
|
64
|
+
/**
|
|
65
|
+
* Reseta o formulário
|
|
66
|
+
*/
|
|
67
|
+
resetForm(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Tenta fazer login com credenciais de demonstração
|
|
70
|
+
*/
|
|
71
|
+
loginWithDemo(userType: 'admin' | 'professor' | 'aluno'): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Manipula esqueci minha senha
|
|
74
|
+
*/
|
|
75
|
+
onForgotPassword(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Manipula criação de conta
|
|
78
|
+
*/
|
|
79
|
+
onCreateAccount(): void;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
|
|
81
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LoginComponent, "lib-login", never, { "options": { "alias": "options"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "showFooter": { "alias": "showFooter"; "required": false; }; "logoUrl": { "alias": "logoUrl"; "required": false; }; "backgroundImageUrl": { "alias": "backgroundImageUrl"; "required": false; }; "customCssClass": { "alias": "customCssClass"; "required": false; }; }, { "loginSuccess": "loginSuccess"; "loginError": "loginError"; "formChange": "formChange"; }, never, never, true, never>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { LocalStorageService } from './local-storage.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class AuthStorageService {
|
|
5
|
+
private storage;
|
|
6
|
+
private readonly TOKEN_KEY;
|
|
7
|
+
private readonly USER_DATA_KEY;
|
|
8
|
+
private isAuthenticated$;
|
|
9
|
+
get authState$(): Observable<boolean>;
|
|
10
|
+
constructor(storage: LocalStorageService);
|
|
11
|
+
private initAuthState;
|
|
12
|
+
/**
|
|
13
|
+
* Salva Access Token COM CRIPTOGRAFIA (backend fará todas as validações)
|
|
14
|
+
*/
|
|
15
|
+
setToken(token: string, expiryInMinutes?: number): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Recupera Access Token COM DESCRIPTOGRAFIA e validação de expiração
|
|
18
|
+
*/
|
|
19
|
+
getToken(): Promise<string | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Salva dados do usuário COM CRIPTOGRAFIA e validação básica
|
|
22
|
+
*/
|
|
23
|
+
setUserData(userData: any): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Recupera dados do usuário COM DESCRIPTOGRAFIA
|
|
26
|
+
*/
|
|
27
|
+
getUserData<T = any>(): Promise<T | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Verifica apenas se possui token (backend validará se é válido)
|
|
30
|
+
*/
|
|
31
|
+
hasToken(): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Verifica se está "aparentemente" autenticado (token existe)
|
|
34
|
+
*/
|
|
35
|
+
isAuthenticated(): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Limpa APENAS dados do cliente (não afeta refresh token no servidor)
|
|
38
|
+
*/
|
|
39
|
+
clearAuthData(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Decodifica payload do JWT (SEM validação - apenas para UI)
|
|
42
|
+
* IMPORTANTE: Use apenas para exibição, nunca para lógica de segurança
|
|
43
|
+
*
|
|
44
|
+
* ⚠️ ATENÇÃO: Agora requer token como parâmetro ou uso assíncrono
|
|
45
|
+
*/
|
|
46
|
+
decodeTokenPayload(token?: string): any;
|
|
47
|
+
/**
|
|
48
|
+
* Versão síncrona DESATUALIZADA (tokens agora são criptografados)
|
|
49
|
+
* ⚠️ AVISO: Esta versão não funciona mais com tokens criptografados
|
|
50
|
+
* Use getToken() async para acessar tokens de forma segura
|
|
51
|
+
*/
|
|
52
|
+
private getTokenSync;
|
|
53
|
+
/**
|
|
54
|
+
* Verifica se token está próximo de expirar (para UI)
|
|
55
|
+
* ⚠️ ATENÇÃO: Agora é assíncrono devido à criptografia
|
|
56
|
+
*/
|
|
57
|
+
isTokenExpiringSoon(minutesThreshold?: number): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Método utilitário: Obtém e decodifica token em uma operação
|
|
60
|
+
* Ideal para componentes que precisam dos dados do token para UI
|
|
61
|
+
*/
|
|
62
|
+
getDecodedTokenData(): Promise<any>;
|
|
63
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthStorageService, never>;
|
|
64
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthStorageService>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type StorageType = 'localStorage' | 'sessionStorage';
|
|
4
|
+
export interface StorageOptions {
|
|
5
|
+
encrypt?: boolean;
|
|
6
|
+
compress?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class LocalStorageService {
|
|
9
|
+
private storageAvailable;
|
|
10
|
+
get storageAvailable$(): Observable<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Salva item no storage com validação básica
|
|
13
|
+
*/
|
|
14
|
+
setItem<T>(key: string, value: T, storageType?: StorageType, options?: StorageOptions): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Recupera item do storage com tipo seguro
|
|
17
|
+
*/
|
|
18
|
+
getItem<T>(key: string, storageType?: StorageType, options?: StorageOptions): Promise<T | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Remove item específico
|
|
21
|
+
*/
|
|
22
|
+
removeItem(key: string, storageType?: StorageType): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Limpa todo o storage
|
|
25
|
+
*/
|
|
26
|
+
clear(storageType?: StorageType): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Verifica se item existe
|
|
29
|
+
*/
|
|
30
|
+
hasItem(key: string, storageType?: StorageType): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Salva item com expiração
|
|
33
|
+
*/
|
|
34
|
+
setItemWithExpiry<T>(key: string, value: T, expiryInMinutes: number, storageType?: StorageType): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Recupera item com verificação de expiração
|
|
37
|
+
*/
|
|
38
|
+
getItemWithExpiry<T>(key: string, storageType?: StorageType): Promise<T | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Obtém todas as chaves do storage
|
|
41
|
+
*/
|
|
42
|
+
getAllKeys(storageType?: StorageType): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Obtém tamanho ocupado do storage em bytes (aproximado)
|
|
45
|
+
*/
|
|
46
|
+
getStorageSize(storageType?: StorageType): number;
|
|
47
|
+
/**
|
|
48
|
+
* Monitor de eventos de storage
|
|
49
|
+
*/
|
|
50
|
+
monitorStorageEvents(): Observable<StorageEvent>;
|
|
51
|
+
/**
|
|
52
|
+
* Limpa itens expirados do storage
|
|
53
|
+
*/
|
|
54
|
+
cleanExpiredItems(storageType?: StorageType): Promise<number>;
|
|
55
|
+
/**
|
|
56
|
+
* Backup de todos os dados do storage
|
|
57
|
+
*/
|
|
58
|
+
backup(storageType?: StorageType): {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Restaura backup para o storage
|
|
63
|
+
*/
|
|
64
|
+
restore(backup: {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}, storageType?: StorageType): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* MÉTODOS PRIVADOS SIMPLIFICADOS
|
|
69
|
+
*/
|
|
70
|
+
private isStorageAvailable;
|
|
71
|
+
private getStorage;
|
|
72
|
+
private sanitizeKey;
|
|
73
|
+
private validateKey;
|
|
74
|
+
private safeJsonStringify;
|
|
75
|
+
private safeJsonParse;
|
|
76
|
+
private encryptData;
|
|
77
|
+
private decryptData;
|
|
78
|
+
private validateStorageEvent;
|
|
79
|
+
private lastEventTime;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
|
|
81
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { AuthProvider, LoginCredentials, LoginOptions, LoginResponse, LoginState, LoginValidationErrors, LogoutResponse, UserInfo } from '../../types/auth.types';
|
|
4
|
+
import { AuthStorageService } from '../local-storage/auth-storage.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Token de injeção para o AuthProvider
|
|
8
|
+
*/
|
|
9
|
+
export declare const AUTH_PROVIDER: InjectionToken<AuthProvider>;
|
|
10
|
+
export declare class LoginService {
|
|
11
|
+
private authStorage;
|
|
12
|
+
private authProvider?;
|
|
13
|
+
private readonly DEFAULT_OPTIONS;
|
|
14
|
+
private loginState$;
|
|
15
|
+
private currentOptions;
|
|
16
|
+
constructor(authStorage: AuthStorageService, authProvider?: AuthProvider | undefined);
|
|
17
|
+
/**
|
|
18
|
+
* Observable do estado completo do login
|
|
19
|
+
*/
|
|
20
|
+
get state$(): Observable<LoginState>;
|
|
21
|
+
/**
|
|
22
|
+
* Observable apenas do status de loading
|
|
23
|
+
*/
|
|
24
|
+
get isLoading$(): Observable<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Observable apenas do status de autenticação
|
|
27
|
+
*/
|
|
28
|
+
get isAuthenticated$(): Observable<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Observable apenas dos erros
|
|
31
|
+
*/
|
|
32
|
+
get errors$(): Observable<LoginValidationErrors>;
|
|
33
|
+
/**
|
|
34
|
+
* Observable do usuário atual
|
|
35
|
+
*/
|
|
36
|
+
get currentUser$(): Observable<UserInfo | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Configura opções do serviço de login
|
|
39
|
+
*/
|
|
40
|
+
configure(options: Partial<LoginOptions>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Realiza login com as credenciais fornecidas
|
|
43
|
+
*/
|
|
44
|
+
login(credentials: LoginCredentials): Promise<LoginResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Realiza logout
|
|
47
|
+
*/
|
|
48
|
+
logout(): Promise<LogoutResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Verifica se o usuário atual está autenticado
|
|
51
|
+
*/
|
|
52
|
+
checkAuthenticationStatus(): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Obtém informações do usuário atual
|
|
55
|
+
*/
|
|
56
|
+
getCurrentUser(): Promise<UserInfo | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Verifica se token está expirando em breve
|
|
59
|
+
* ⚠️ ATENÇÃO: Agora é assíncrono devido à criptografia
|
|
60
|
+
*/
|
|
61
|
+
isTokenExpiringSoon(minutesThreshold?: number): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Limpa erros do estado atual
|
|
64
|
+
*/
|
|
65
|
+
clearErrors(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Reseta estado do login
|
|
68
|
+
*/
|
|
69
|
+
resetLoginState(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Inicializa o serviço
|
|
72
|
+
*/
|
|
73
|
+
private initializeService;
|
|
74
|
+
/**
|
|
75
|
+
* Atualiza estado reativo
|
|
76
|
+
*/
|
|
77
|
+
private updateState;
|
|
78
|
+
/**
|
|
79
|
+
* Valida credenciais do formulário
|
|
80
|
+
*/
|
|
81
|
+
private validateCredentials;
|
|
82
|
+
/**
|
|
83
|
+
* Trata login bem-sucedido
|
|
84
|
+
*/
|
|
85
|
+
private handleSuccessfulLogin;
|
|
86
|
+
/**
|
|
87
|
+
* Trata falha de login
|
|
88
|
+
*/
|
|
89
|
+
private handleFailedLogin;
|
|
90
|
+
/**
|
|
91
|
+
* Simula resposta de login para desenvolvimento/demo
|
|
92
|
+
*/
|
|
93
|
+
private simulateLogin;
|
|
94
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginService, [null, { optional: true; }]>;
|
|
95
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LoginService>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SharedComponentsComponent {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharedComponentsComponent, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharedComponentsComponent, "lib-shared-components", never, {}, {}, never, never, true, never>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { SidebarMenuItem, SidebarConfig, SidebarState } from '../types/sidebar.types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class SidebarComponent implements OnInit, OnDestroy {
|
|
5
|
+
private destroy$;
|
|
6
|
+
private router;
|
|
7
|
+
config: Partial<SidebarConfig>;
|
|
8
|
+
menuItems: SidebarMenuItem[];
|
|
9
|
+
isCollapsed: boolean;
|
|
10
|
+
itemClick: EventEmitter<SidebarMenuItem>;
|
|
11
|
+
toggle: EventEmitter<boolean>;
|
|
12
|
+
overlayToggle: EventEmitter<boolean>;
|
|
13
|
+
logoClick: EventEmitter<void>;
|
|
14
|
+
private state$;
|
|
15
|
+
defaultConfig: Required<SidebarConfig>;
|
|
16
|
+
get currentState(): SidebarState;
|
|
17
|
+
get finalConfig(): Required<SidebarConfig>;
|
|
18
|
+
get sidebarWidth(): string;
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
ngOnDestroy(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Detecta mudanças de tela
|
|
23
|
+
*/
|
|
24
|
+
onResize(event: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Inicializa o estado do sidebar
|
|
27
|
+
*/
|
|
28
|
+
private initializeState;
|
|
29
|
+
/**
|
|
30
|
+
* Verifica se está em modo mobile
|
|
31
|
+
*/
|
|
32
|
+
private checkMobileState;
|
|
33
|
+
/**
|
|
34
|
+
* Detecta rota ativa
|
|
35
|
+
*/
|
|
36
|
+
private detectActiveRoute;
|
|
37
|
+
/**
|
|
38
|
+
* Encontra item ativo baseado na URL
|
|
39
|
+
*/
|
|
40
|
+
private findActiveItem;
|
|
41
|
+
/**
|
|
42
|
+
* Atualiza o estado
|
|
43
|
+
*/
|
|
44
|
+
private updateState;
|
|
45
|
+
/**
|
|
46
|
+
* Toggle do sidebar
|
|
47
|
+
*/
|
|
48
|
+
toggleSidebar(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Toggle do overlay (mobile)
|
|
51
|
+
*/
|
|
52
|
+
toggleOverlay(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clique no item do menu
|
|
55
|
+
*/
|
|
56
|
+
onItemClick(item: SidebarMenuItem, event: Event): void;
|
|
57
|
+
/**
|
|
58
|
+
* Toggle expansão de item com filhos
|
|
59
|
+
*/
|
|
60
|
+
toggleItemExpansion(item: SidebarMenuItem): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clique no logo
|
|
63
|
+
*/
|
|
64
|
+
onLogoClick(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Fecha overlay ao clicar fora (mobile)
|
|
67
|
+
*/
|
|
68
|
+
closeOverlay(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Verifica se item está ativo
|
|
71
|
+
*/
|
|
72
|
+
isItemActive(item: SidebarMenuItem): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Verifica se item tem filhos ativos
|
|
75
|
+
*/
|
|
76
|
+
hasActiveChild(item: SidebarMenuItem): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* TrackBy function para performance
|
|
79
|
+
*/
|
|
80
|
+
trackByItemId(index: number, item: SidebarMenuItem): string;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SidebarComponent, never>;
|
|
82
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SidebarComponent, "lib-sidebar", never, { "config": { "alias": "config"; "required": false; }; "menuItems": { "alias": "menuItems"; "required": false; }; "isCollapsed": { "alias": "isCollapsed"; "required": false; }; }, { "itemClick": "itemClick"; "toggle": "toggle"; "overlayToggle": "overlayToggle"; "logoClick": "logoClick"; }, never, ["[slot=footer]"], true, never>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos e interfaces para autenticação
|
|
3
|
+
*/
|
|
4
|
+
export interface LoginCredentials {
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LoginResponse {
|
|
9
|
+
success: boolean;
|
|
10
|
+
accessToken?: string;
|
|
11
|
+
user?: UserInfo;
|
|
12
|
+
expiresIn?: number;
|
|
13
|
+
message?: string;
|
|
14
|
+
errors?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface UserInfo {
|
|
17
|
+
id: string;
|
|
18
|
+
nome: string;
|
|
19
|
+
email: string;
|
|
20
|
+
perfil: string;
|
|
21
|
+
permissoes: string[];
|
|
22
|
+
avatar?: string;
|
|
23
|
+
lastLogin?: Date;
|
|
24
|
+
}
|
|
25
|
+
export interface LogoutResponse {
|
|
26
|
+
success: boolean;
|
|
27
|
+
message?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface RefreshTokenResponse {
|
|
30
|
+
success: boolean;
|
|
31
|
+
accessToken?: string;
|
|
32
|
+
expiresIn?: number;
|
|
33
|
+
message?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Estados do processo de login
|
|
37
|
+
*/
|
|
38
|
+
export declare enum LoginStatus {
|
|
39
|
+
IDLE = "IDLE",
|
|
40
|
+
LOADING = "LOADING",
|
|
41
|
+
SUCCESS = "SUCCESS",
|
|
42
|
+
ERROR = "ERROR"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Configurações opcionais para o login
|
|
46
|
+
*/
|
|
47
|
+
export interface LoginOptions {
|
|
48
|
+
title?: string;
|
|
49
|
+
subtitle?: string;
|
|
50
|
+
logoUrl?: string;
|
|
51
|
+
backgroundUrl?: string;
|
|
52
|
+
footerText?: string;
|
|
53
|
+
redirectUrl?: string;
|
|
54
|
+
showForgotPassword?: boolean;
|
|
55
|
+
showRegisterLink?: boolean;
|
|
56
|
+
passwordMinLength?: number;
|
|
57
|
+
links?: {
|
|
58
|
+
forgotPassword?: string;
|
|
59
|
+
register?: string;
|
|
60
|
+
termsOfService?: string;
|
|
61
|
+
privacyPolicy?: string;
|
|
62
|
+
};
|
|
63
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
64
|
+
primaryColor?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface que a aplicação deve implementar para comunicação com o backend
|
|
68
|
+
*/
|
|
69
|
+
export interface AuthProvider {
|
|
70
|
+
/**
|
|
71
|
+
* Realiza login no backend
|
|
72
|
+
*/
|
|
73
|
+
login(credentials: LoginCredentials): Promise<LoginResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Realiza logout no backend
|
|
76
|
+
*/
|
|
77
|
+
logout(): Promise<LogoutResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Renova o access token (opcional - se não implementado, usa apenas frontend)
|
|
80
|
+
*/
|
|
81
|
+
refreshToken?(): Promise<RefreshTokenResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Verifica se o token ainda é válido no backend (opcional)
|
|
84
|
+
*/
|
|
85
|
+
validateToken?(token: string): Promise<boolean>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Dados de erro de validação de formulário
|
|
89
|
+
*/
|
|
90
|
+
export interface LoginValidationErrors {
|
|
91
|
+
email?: string[];
|
|
92
|
+
password?: string[];
|
|
93
|
+
general?: string[];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Estado completo do login para uso reativo
|
|
97
|
+
*/
|
|
98
|
+
export interface LoginState {
|
|
99
|
+
status: LoginStatus;
|
|
100
|
+
user: UserInfo | null;
|
|
101
|
+
isAuthenticated: boolean;
|
|
102
|
+
errors: LoginValidationErrors;
|
|
103
|
+
lastAttempt: Date | null;
|
|
104
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface para itens do menu lateral
|
|
3
|
+
*/
|
|
4
|
+
export interface SidebarMenuItem {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
route?: string;
|
|
9
|
+
action?: () => void;
|
|
10
|
+
children?: SidebarMenuItem[];
|
|
11
|
+
isExpanded?: boolean;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
badge?: string | number;
|
|
15
|
+
divider?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configurações do sidebar
|
|
19
|
+
*/
|
|
20
|
+
export interface SidebarConfig {
|
|
21
|
+
width?: string;
|
|
22
|
+
collapsedWidth?: string;
|
|
23
|
+
position?: 'left' | 'right';
|
|
24
|
+
collapsible?: boolean;
|
|
25
|
+
autoCollapse?: boolean;
|
|
26
|
+
overlay?: boolean;
|
|
27
|
+
logo?: {
|
|
28
|
+
src: string;
|
|
29
|
+
alt: string;
|
|
30
|
+
route?: string;
|
|
31
|
+
};
|
|
32
|
+
theme?: 'light' | 'dark';
|
|
33
|
+
customCssClass?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Estado do sidebar
|
|
37
|
+
*/
|
|
38
|
+
export interface SidebarState {
|
|
39
|
+
isCollapsed: boolean;
|
|
40
|
+
isMobile: boolean;
|
|
41
|
+
isOverlayOpen: boolean;
|
|
42
|
+
activeItemId?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Eventos emitidos pelo sidebar
|
|
46
|
+
*/
|
|
47
|
+
export interface SidebarEvents {
|
|
48
|
+
itemClick: SidebarMenuItem;
|
|
49
|
+
toggle: boolean;
|
|
50
|
+
overlayToggle: boolean;
|
|
51
|
+
logoClick: void;
|
|
52
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ramonbsales/noah-angular",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Noah Angular - shared UI components",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"components",
|
|
8
|
+
"noah",
|
|
9
|
+
"ui"
|
|
10
|
+
],
|
|
11
|
+
"author": "Ramon Sales <ramonbsales@gmail.com>",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/ramonborges15/noah-angular.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/ramonborges15/noah-angular/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/ramonborges15/noah-angular#readme",
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@angular/common": "^19.2.0",
|
|
23
|
+
"@angular/core": "^19.2.0",
|
|
24
|
+
"rxjs": "^7.8.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"module": "fesm2022/ramonbsales-noah-angular.mjs",
|
|
34
|
+
"typings": "index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
"./package.json": {
|
|
37
|
+
"default": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./index.d.ts",
|
|
41
|
+
"default": "./fesm2022/ramonbsales-noah-angular.mjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './lib/shared-components.service';
|
|
2
|
+
export * from './lib/shared-components.component';
|
|
3
|
+
export * from './lib/components/dropdown/dropdown.component';
|
|
4
|
+
export * from './lib/components/input/input.component';
|
|
5
|
+
export * from './lib/components/button/button.component';
|
|
6
|
+
export * from './lib/components/checkbox/checkbox.component';
|
|
7
|
+
export * from './lib/components/toggle/toggle.component';
|
|
8
|
+
export * from './lib/components/breadcrumb/breadcrumb.component';
|
|
9
|
+
export * from './lib/components/table/table.component';
|
|
10
|
+
export * from './lib/sidebar/sidebar.component';
|
|
11
|
+
export * from './lib/pages/login/login.component';
|
|
12
|
+
export * from './lib/services';
|
|
13
|
+
export { AUTH_PROVIDER } from './lib/services/login/login.service';
|
|
14
|
+
export * from './lib/interceptors';
|
|
15
|
+
export * from './lib/types/auth.types';
|
|
16
|
+
export * from './lib/types/sidebar.types';
|