@cccteam/ccc-lib 0.0.12 → 0.0.14
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/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs +7 -15
- package/fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs +10 -9
- package/fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs +9 -10
- package/fesm2022/cccteam-ccc-lib-src-auth-forms.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs +11 -18
- package/fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs +45 -13
- package/fesm2022/cccteam-ccc-lib-src-auth-service.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-types.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs +4 -4
- package/fesm2022/cccteam-ccc-lib-src-ui-alert.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs +41 -0
- package/fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs.map +1 -0
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs +13 -11
- package/fesm2022/cccteam-ccc-lib-src-ui-interceptor.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs +11 -5
- package/fesm2022/cccteam-ccc-lib-src-ui-notification-service.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs +10 -20
- package/fesm2022/cccteam-ccc-lib-src-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cccteam-ccc-lib.mjs +3 -4
- package/fesm2022/cccteam-ccc-lib.mjs.map +1 -1
- package/index.d.ts +12 -5
- package/package.json +11 -15
- package/src/auth-authentication-guard/index.d.ts +6 -5
- package/src/auth-authorization-guard/index.d.ts +6 -5
- package/src/auth-forms/index.d.ts +43 -3
- package/src/auth-has-permission/index.d.ts +15 -5
- package/src/auth-service/index.d.ts +36 -5
- package/src/types/index.d.ts +131 -3
- package/src/ui-alert/index.d.ts +16 -5
- package/src/ui-core-service/index.d.ts +20 -0
- package/src/ui-interceptor/index.d.ts +16 -5
- package/src/ui-notification-service/index.d.ts +33 -5
- package/src/ui-sidenav/index.d.ts +33 -5
- package/src/util-request-options/index.d.ts +12 -5
- package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs +0 -109
- package/fesm2022/cccteam-ccc-lib-src-auth-state.mjs.map +0 -1
- package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs +0 -100
- package/fesm2022/cccteam-ccc-lib-src-ui-core-state.mjs.map +0 -1
- package/public-api.d.ts +0 -13
- package/src/auth-authentication-guard/authentication.guard.d.ts +0 -3
- package/src/auth-authentication-guard/public-api.d.ts +0 -1
- package/src/auth-authorization-guard/authorization.guard.d.ts +0 -3
- package/src/auth-authorization-guard/public-api.d.ts +0 -1
- package/src/auth-forms/ccc-field/ccc-field.component.d.ts +0 -25
- package/src/auth-forms/form-helpers.d.ts +0 -16
- package/src/auth-forms/public-api.d.ts +0 -2
- package/src/auth-has-permission/has-permission.directive.d.ts +0 -12
- package/src/auth-has-permission/public-api.d.ts +0 -1
- package/src/auth-service/auth.service.d.ts +0 -24
- package/src/auth-service/public-api.d.ts +0 -1
- package/src/auth-state/auth.state.d.ts +0 -27
- package/src/auth-state/index.d.ts +0 -5
- package/src/auth-state/public-api.d.ts +0 -1
- package/src/types/auth.actions.d.ts +0 -41
- package/src/types/core.actions.d.ts +0 -31
- package/src/types/notification-message.d.ts +0 -18
- package/src/types/permissions.d.ts +0 -15
- package/src/types/public-api.d.ts +0 -6
- package/src/types/session-info.d.ts +0 -9
- package/src/types/tokens.d.ts +0 -13
- package/src/ui-alert/alert.component.d.ts +0 -13
- package/src/ui-alert/public-api.d.ts +0 -1
- package/src/ui-core-state/core.state.d.ts +0 -28
- package/src/ui-core-state/index.d.ts +0 -5
- package/src/ui-core-state/public-api.d.ts +0 -1
- package/src/ui-interceptor/api.interceptor.d.ts +0 -12
- package/src/ui-interceptor/public-api.d.ts +0 -1
- package/src/ui-notification-service/notification.service.d.ts +0 -30
- package/src/ui-notification-service/public-api.d.ts +0 -1
- package/src/ui-sidenav/public-api.d.ts +0 -1
- package/src/ui-sidenav/sidenav.component.d.ts +0 -31
- package/src/util-request-options/public-api.d.ts +0 -1
- package/src/util-request-options/request-options.d.ts +0 -8
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, NgZone, Injectable } from '@angular/core';
|
|
3
3
|
import { Router } from '@angular/router';
|
|
4
|
-
import {
|
|
4
|
+
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
5
|
+
import { BASE_URL, AlertLevel } from '@cccteam/ccc-lib/src/types';
|
|
6
|
+
import { UiCoreService } from '@cccteam/ccc-lib/src/ui-core-service';
|
|
5
7
|
import { CUSTOM_HTTP_REQUEST_OPTIONS } from '@cccteam/ccc-lib/src/util-request-options';
|
|
6
|
-
import { Store } from '@ngxs/store';
|
|
7
8
|
import { catchError, throwError, finalize } from 'rxjs';
|
|
8
9
|
|
|
9
10
|
class ApiInterceptor {
|
|
10
|
-
|
|
11
|
+
ui = inject(UiCoreService);
|
|
12
|
+
auth = inject(AuthService);
|
|
11
13
|
router = inject(Router);
|
|
12
14
|
ngZone = inject(NgZone);
|
|
13
15
|
baseUrl = inject(BASE_URL);
|
|
14
16
|
intercept(request, next) {
|
|
15
|
-
this.
|
|
17
|
+
this.ui.beginActivity(request.method + ' ' + request.url);
|
|
16
18
|
return next.handle(request).pipe(catchError((error) => {
|
|
17
19
|
if (error.status === 401) {
|
|
18
20
|
this.ngZone.run(() => {
|
|
19
|
-
this.
|
|
21
|
+
this.auth.redirectUrl.set(this.baseUrl + this.router.url);
|
|
20
22
|
this.router.navigate(['/login']);
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
25
|
if (!request.context.get(CUSTOM_HTTP_REQUEST_OPTIONS).suppressGlobalError) {
|
|
24
26
|
const message = error.error?.message ?? error.message ?? error.error;
|
|
25
|
-
this.
|
|
27
|
+
this.ui.publishError({
|
|
26
28
|
message: message,
|
|
27
29
|
level: AlertLevel.ERROR,
|
|
28
30
|
link: '',
|
|
29
|
-
})
|
|
31
|
+
});
|
|
30
32
|
}
|
|
31
33
|
return throwError(() => error);
|
|
32
34
|
}), finalize(() => {
|
|
33
|
-
this.
|
|
35
|
+
this.ui.endActivity(request.method + ' ' + request.url);
|
|
34
36
|
}));
|
|
35
37
|
}
|
|
36
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
37
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ApiInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
39
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ApiInterceptor });
|
|
38
40
|
}
|
|
39
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ApiInterceptor, decorators: [{
|
|
40
42
|
type: Injectable
|
|
41
43
|
}] });
|
|
42
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-ui-interceptor.mjs","sources":["../../../projects/ccc-lib/src/ui-interceptor/api.interceptor.ts","../../../projects/ccc-lib/src/ui-interceptor/cccteam-ccc-lib-src-ui-interceptor.ts"],"sourcesContent":["import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { inject, Injectable, NgZone } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { AlertLevel,
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib-src-ui-interceptor.mjs","sources":["../../../projects/ccc-lib/src/ui-interceptor/api.interceptor.ts","../../../projects/ccc-lib/src/ui-interceptor/cccteam-ccc-lib-src-ui-interceptor.ts"],"sourcesContent":["import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { inject, Injectable, NgZone } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { AuthService } from '@cccteam/ccc-lib/src/auth-service';\nimport { AlertLevel, BASE_URL } from '@cccteam/ccc-lib/src/types';\nimport { UiCoreService } from '@cccteam/ccc-lib/src/ui-core-service';\nimport { CUSTOM_HTTP_REQUEST_OPTIONS } from '@cccteam/ccc-lib/src/util-request-options';\nimport { catchError, finalize, Observable, throwError } from 'rxjs';\n\n@Injectable()\nexport class ApiInterceptor implements HttpInterceptor {\n private ui = inject(UiCoreService);\n private auth = inject(AuthService);\n private router = inject(Router);\n private ngZone = inject(NgZone);\n private baseUrl = inject(BASE_URL);\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n this.ui.beginActivity(request.method + ' ' + request.url);\n\n return next.handle(request).pipe(\n catchError((error: HttpErrorResponse): Observable<HttpEvent<unknown>> => {\n if (error.status === 401) {\n this.ngZone.run(() => {\n this.auth.redirectUrl.set(this.baseUrl + this.router.url);\n this.router.navigate(['/login']);\n });\n }\n if (!request.context.get(CUSTOM_HTTP_REQUEST_OPTIONS).suppressGlobalError) {\n const message = error.error?.message ?? error.message ?? error.error;\n this.ui.publishError({\n message: message,\n level: AlertLevel.ERROR,\n link: '',\n });\n }\n\n return throwError(() => error);\n }),\n finalize(() => {\n this.ui.endActivity(request.method + ' ' + request.url);\n }),\n );\n }\n}\n","/**\n *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vB,oBAAA,IAAI,EAAE,EAAE;AACT,iBAAA,CAAC;;AAGJ,YAAA,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC;AAChC,SAAC,CAAC,EACF,QAAQ,CAAC,MAAK;AACZ,YAAA,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;SACxD,CAAC,CACH;;uGAhCQ,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAd,cAAc,EAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACTD;;AAEG;;;;"}
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { signal, Injectable } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
class NotificationService {
|
|
5
|
-
notificationId = 0;
|
|
5
|
+
notificationId = signal(0);
|
|
6
6
|
_notifications = signal([]);
|
|
7
7
|
notifications = this._notifications.asReadonly();
|
|
8
8
|
/**
|
|
@@ -11,10 +11,16 @@ class NotificationService {
|
|
|
11
11
|
* @returns The unique ID assigned to the notification.
|
|
12
12
|
*/
|
|
13
13
|
addGlobalNotification(notification) {
|
|
14
|
+
this.notificationId.update((id) => id + 1);
|
|
14
15
|
const newNotification = {
|
|
15
16
|
...notification,
|
|
16
|
-
id: this.notificationId
|
|
17
|
+
id: this.notificationId(),
|
|
17
18
|
};
|
|
19
|
+
const existingNotification = this._notifications().find((n) => n.message === newNotification.message);
|
|
20
|
+
if (existingNotification) {
|
|
21
|
+
this.updateNotification({ ...existingNotification, ...newNotification });
|
|
22
|
+
return existingNotification.id;
|
|
23
|
+
}
|
|
18
24
|
this._notifications.update((current) => [...current, newNotification]);
|
|
19
25
|
return newNotification.id;
|
|
20
26
|
}
|
|
@@ -39,10 +45,10 @@ class NotificationService {
|
|
|
39
45
|
updateNotification(updatedNotification) {
|
|
40
46
|
this._notifications.update((current) => current.map((notification) => notification.id === updatedNotification.id ? { ...notification, ...updatedNotification } : notification));
|
|
41
47
|
}
|
|
42
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
43
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
49
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NotificationService, providedIn: 'root' });
|
|
44
50
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NotificationService, decorators: [{
|
|
46
52
|
type: Injectable,
|
|
47
53
|
args: [{
|
|
48
54
|
providedIn: 'root',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-ui-notification-service.mjs","sources":["../../../projects/ccc-lib/src/ui-notification-service/notification.service.ts","../../../projects/ccc-lib/src/ui-notification-service/cccteam-ccc-lib-src-ui-notification-service.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { CreateNotificationMessage, NotificationMessage } from '@cccteam/ccc-lib/src/types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NotificationService {\n private notificationId = 0;\n private _notifications = signal<NotificationMessage[]>([]);\n notifications = this._notifications.asReadonly();\n\n /**\n * Adds a new global notification.\n * @param notification The notification message to add.\n * @returns The unique ID assigned to the notification.\n */\n addGlobalNotification(notification: CreateNotificationMessage): number {\n const newNotification: NotificationMessage = {\n ...notification,\n id: this.notificationId
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib-src-ui-notification-service.mjs","sources":["../../../projects/ccc-lib/src/ui-notification-service/notification.service.ts","../../../projects/ccc-lib/src/ui-notification-service/cccteam-ccc-lib-src-ui-notification-service.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { CreateNotificationMessage, NotificationMessage } from '@cccteam/ccc-lib/src/types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NotificationService {\n private notificationId = signal(0);\n private _notifications = signal<NotificationMessage[]>([]);\n notifications = this._notifications.asReadonly();\n\n /**\n * Adds a new global notification.\n * @param notification The notification message to add.\n * @returns The unique ID assigned to the notification.\n */\n addGlobalNotification(notification: CreateNotificationMessage): number {\n this.notificationId.update((id) => id + 1);\n const newNotification: NotificationMessage = {\n ...notification,\n id: this.notificationId(),\n };\n const existingNotification = this._notifications().find((n) => n.message === newNotification.message);\n if (existingNotification) {\n this.updateNotification({ ...existingNotification, ...newNotification });\n return existingNotification.id;\n }\n this._notifications.update((current) => [...current, newNotification]);\n return newNotification.id;\n }\n\n /**\n * Dismisses a global notification by its ID.\n * @param notificationId The ID of the notification to dismiss.\n */\n dismissGlobalNotificationById(notificationId: number): void {\n this._notifications.update((current) => current.filter((notification) => notification.id !== notificationId));\n }\n\n /**\n * Dismisses a specific global notification.\n * @param notification The notification to dismiss.\n */\n dismissGlobalNotification(notification: NotificationMessage): void {\n this.dismissGlobalNotificationById(notification.id);\n }\n\n /**\n * Updates an existing notification.\n * @param updatedNotification The notification with updated information.\n */\n updateNotification(updatedNotification: NotificationMessage): void {\n this._notifications.update((current) =>\n current.map((notification) =>\n notification.id === updatedNotification.id ? { ...notification, ...updatedNotification } : notification,\n ),\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAMa,mBAAmB,CAAA;AACtB,IAAA,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC;AAC1B,IAAA,cAAc,GAAG,MAAM,CAAwB,EAAE,CAAC;AAC1D,IAAA,aAAa,GAAG,IAAI,CAA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G,EAAE,GAAG,YAAY,EAAE,GAAG,mBAAmB,EAAE,GAAG,YAAY,CACxG,CACF;;uGAlDQ,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cAFlB,MAAM,EAAA,CAAA;;2FAEP,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i3 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject,
|
|
5
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { inject, computed, Input, Component } from '@angular/core';
|
|
6
5
|
import { MatButtonModule } from '@angular/material/button';
|
|
7
6
|
import { MatExpansionModule } from '@angular/material/expansion';
|
|
8
7
|
import * as i1 from '@angular/material/icon';
|
|
@@ -10,24 +9,15 @@ import { MatIconModule } from '@angular/material/icon';
|
|
|
10
9
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
11
10
|
import * as i2 from '@angular/router';
|
|
12
11
|
import { RouterModule } from '@angular/router';
|
|
13
|
-
import { Store } from '@ngxs/store';
|
|
14
12
|
import { HasPermissionDirective } from '@cccteam/ccc-lib/src/auth-has-permission';
|
|
15
|
-
import {
|
|
16
|
-
import { tap } from 'rxjs';
|
|
13
|
+
import { UiCoreService } from '@cccteam/ccc-lib/src/ui-core-service';
|
|
17
14
|
|
|
18
15
|
class SidenavComponent {
|
|
19
|
-
|
|
20
|
-
destroyRef = inject(DestroyRef);
|
|
16
|
+
ui = inject(UiCoreService);
|
|
21
17
|
navGroups;
|
|
22
|
-
currentNav =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.select(CoreState.currentSidenavIdentifier)
|
|
26
|
-
.pipe(tap((identifier) => {
|
|
27
|
-
this.currentNav = this.updateNavItems(identifier);
|
|
28
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
29
|
-
.subscribe();
|
|
30
|
-
}
|
|
18
|
+
currentNav = computed(() => {
|
|
19
|
+
return this.updateNavItems(this.ui.currentSidenavIdentifier());
|
|
20
|
+
});
|
|
31
21
|
/**
|
|
32
22
|
* Updates the currentNav based on the identifier
|
|
33
23
|
* @param identifier
|
|
@@ -44,10 +34,10 @@ class SidenavComponent {
|
|
|
44
34
|
}
|
|
45
35
|
return this.navGroups[identifier];
|
|
46
36
|
}
|
|
47
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
48
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
37
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SidenavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
38
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: SidenavComponent, isStandalone: true, selector: "ccc-sidenav", inputs: { navGroups: "navGroups" }, ngImport: i0, template: "<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav(); track navItem) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItem }\"></ng-container>\n }\n </nav>\n</div>\n<ng-template #typeRendererTemplate let-navItem=\"navItem\">\n @switch (navItem.type) {\n @case ('header') {\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('link') {\n <ng-container [ngTemplateOutlet]=\"linkTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('expandable') {\n <ng-container\n [ngTemplateOutlet]=\"expandableTemplate\"\n [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n }\n</ng-template>\n<ng-template #headerTemplate let-navItem=\"navItem\">\n <div class=\"link-header\">{{ navItem.label }}</div>\n</ng-template>\n<ng-template #linkTemplate let-navItem=\"navItem\">\n <a [routerLink]=\"navItem.routerLink\" *cccHasPermission=\"navItem.permission\">\n <div class=\"nav-item\" routerLinkActive=\"active-link\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.icon }}\n </mat-icon>\n </div>\n <div class=\"text\">\n {{ navItem.label | titlecase }}\n </div>\n </div>\n </div>\n </a>\n</ng-template>\n<ng-template #expandableTemplate let-navItem=\"navItem\">\n <div class=\"nav-item\" aria-hidden=\"true\" (click)=\"navItem.isExpanded = !navItem.isExpanded\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.isExpanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </div>\n <div class=\"text\">{{ navItem.label }}</div>\n </div>\n </div>\n @if (navItem.isExpanded) {\n <div class=\"expandable-links\">\n @for (navItemChild of navItem.children; track navItemChild) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItemChild }\"> </ng-container>\n }\n </div>\n }\n</ng-template>\n", styles: [".nav-container{padding:0;height:100%}nav{max-width:100%;margin:0 10px}.nav-item{width:100%;height:48px;font-size:18px;display:flex;flex-direction:column;justify-content:center;color:#003b49;padding:0 15px;position:relative}.nav-item:hover{background-color:#0000000a;transition:background-color .1s ease}.nav-item:active{background-color:#0000001a;transition:background-color .1s ease}.link-header{color:#003b49;text-transform:uppercase;font-weight:700;font-size:12px;margin:20px 0 0 5px}.link-button{display:flex;flex-direction:row;width:100%}.link-button .icon{min-width:20px;margin-right:10px;display:flex;flex-direction:column;justify-content:center}.link-button .text{margin-right:10px;text-align:left;display:flex;flex-direction:row;justify-content:left;text-decoration:capitalize}.expandable-links{display:flex;flex-direction:column;width:100%;padding-left:30px}a:active,a:link,a:visited{color:#003b49!important}a{text-decoration:none}.active-link:before{content:\"\";position:absolute;left:3px;width:5px;height:38px;background-color:#003b49}.active-link{background-color:#0000000a;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i2.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3.TitleCasePipe, name: "titlecase" }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "directive", type: HasPermissionDirective, selector: "[cccHasPermission]", inputs: ["cccHasPermission"] }] });
|
|
49
39
|
}
|
|
50
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SidenavComponent, decorators: [{
|
|
51
41
|
type: Component,
|
|
52
42
|
args: [{ selector: 'ccc-sidenav', imports: [
|
|
53
43
|
MatIconModule,
|
|
@@ -57,7 +47,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
57
47
|
MatButtonModule,
|
|
58
48
|
MatSidenavModule,
|
|
59
49
|
HasPermissionDirective,
|
|
60
|
-
], template: "<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav; track navItem
|
|
50
|
+
], template: "<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav(); track navItem) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItem }\"></ng-container>\n }\n </nav>\n</div>\n<ng-template #typeRendererTemplate let-navItem=\"navItem\">\n @switch (navItem.type) {\n @case ('header') {\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('link') {\n <ng-container [ngTemplateOutlet]=\"linkTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('expandable') {\n <ng-container\n [ngTemplateOutlet]=\"expandableTemplate\"\n [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n }\n</ng-template>\n<ng-template #headerTemplate let-navItem=\"navItem\">\n <div class=\"link-header\">{{ navItem.label }}</div>\n</ng-template>\n<ng-template #linkTemplate let-navItem=\"navItem\">\n <a [routerLink]=\"navItem.routerLink\" *cccHasPermission=\"navItem.permission\">\n <div class=\"nav-item\" routerLinkActive=\"active-link\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.icon }}\n </mat-icon>\n </div>\n <div class=\"text\">\n {{ navItem.label | titlecase }}\n </div>\n </div>\n </div>\n </a>\n</ng-template>\n<ng-template #expandableTemplate let-navItem=\"navItem\">\n <div class=\"nav-item\" aria-hidden=\"true\" (click)=\"navItem.isExpanded = !navItem.isExpanded\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.isExpanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </div>\n <div class=\"text\">{{ navItem.label }}</div>\n </div>\n </div>\n @if (navItem.isExpanded) {\n <div class=\"expandable-links\">\n @for (navItemChild of navItem.children; track navItemChild) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItemChild }\"> </ng-container>\n }\n </div>\n }\n</ng-template>\n", styles: [".nav-container{padding:0;height:100%}nav{max-width:100%;margin:0 10px}.nav-item{width:100%;height:48px;font-size:18px;display:flex;flex-direction:column;justify-content:center;color:#003b49;padding:0 15px;position:relative}.nav-item:hover{background-color:#0000000a;transition:background-color .1s ease}.nav-item:active{background-color:#0000001a;transition:background-color .1s ease}.link-header{color:#003b49;text-transform:uppercase;font-weight:700;font-size:12px;margin:20px 0 0 5px}.link-button{display:flex;flex-direction:row;width:100%}.link-button .icon{min-width:20px;margin-right:10px;display:flex;flex-direction:column;justify-content:center}.link-button .text{margin-right:10px;text-align:left;display:flex;flex-direction:row;justify-content:left;text-decoration:capitalize}.expandable-links{display:flex;flex-direction:column;width:100%;padding-left:30px}a:active,a:link,a:visited{color:#003b49!important}a{text-decoration:none}.active-link:before{content:\"\";position:absolute;left:3px;width:5px;height:38px;background-color:#003b49}.active-link{background-color:#0000000a;position:relative}\n"] }]
|
|
61
51
|
}], propDecorators: { navGroups: [{
|
|
62
52
|
type: Input
|
|
63
53
|
}] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib-src-ui-sidenav.mjs","sources":["../../../projects/ccc-lib/src/ui-sidenav/sidenav.component.ts","../../../projects/ccc-lib/src/ui-sidenav/sidenav.component.html","../../../projects/ccc-lib/src/ui-sidenav/cccteam-ccc-lib-src-ui-sidenav.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component,
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib-src-ui-sidenav.mjs","sources":["../../../projects/ccc-lib/src/ui-sidenav/sidenav.component.ts","../../../projects/ccc-lib/src/ui-sidenav/sidenav.component.html","../../../projects/ccc-lib/src/ui-sidenav/cccteam-ccc-lib-src-ui-sidenav.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, inject, Input, Signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatSidenavModule } from '@angular/material/sidenav';\nimport { RouterModule } from '@angular/router';\n\nimport { HasPermissionDirective } from '@cccteam/ccc-lib/src/auth-has-permission';\nimport { PermissionScope } from '@cccteam/ccc-lib/src/types';\nimport { UiCoreService } from '@cccteam/ccc-lib/src/ui-core-service';\n\nexport interface NavItem {\n type: 'link' | 'header' | 'expandable';\n routerLink?: string[];\n label: string;\n icon?: string;\n permission?: PermissionScope;\n children?: NavItem[];\n isExpanded?: boolean;\n attentionCount?: Signal<number>;\n}\n\nexport type NavGroups = Record<string, NavItem[]>;\n\n@Component({\n selector: 'ccc-sidenav',\n templateUrl: './sidenav.component.html',\n styleUrls: ['./sidenav.component.scss'],\n imports: [\n MatIconModule,\n RouterModule,\n CommonModule,\n MatExpansionModule,\n MatButtonModule,\n MatSidenavModule,\n HasPermissionDirective,\n ],\n})\nexport class SidenavComponent {\n ui = inject(UiCoreService);\n\n @Input() navGroups?: NavGroups;\n currentNav = computed(() => {\n return this.updateNavItems(this.ui.currentSidenavIdentifier());\n });\n\n /**\n * Updates the currentNav based on the identifier\n * @param identifier\n * @returns NavItem[]\n * @memberof SidenavComponent\n */\n updateNavItems(identifier: string): NavItem[] {\n if (!this.navGroups) {\n return [];\n }\n if (!this.navGroups[identifier]) {\n // pick the first one if the identifier is not found so we don't break the UI\n identifier = Object.keys(this.navGroups)[0];\n }\n return this.navGroups[identifier];\n }\n}\n","<div class=\"nav-container\">\n <nav>\n @for (navItem of currentNav(); track navItem) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItem }\"></ng-container>\n }\n </nav>\n</div>\n<ng-template #typeRendererTemplate let-navItem=\"navItem\">\n @switch (navItem.type) {\n @case ('header') {\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('link') {\n <ng-container [ngTemplateOutlet]=\"linkTemplate\" [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n @case ('expandable') {\n <ng-container\n [ngTemplateOutlet]=\"expandableTemplate\"\n [ngTemplateOutletContext]=\"{ navItem: navItem }\"></ng-container>\n }\n }\n</ng-template>\n<ng-template #headerTemplate let-navItem=\"navItem\">\n <div class=\"link-header\">{{ navItem.label }}</div>\n</ng-template>\n<ng-template #linkTemplate let-navItem=\"navItem\">\n <a [routerLink]=\"navItem.routerLink\" *cccHasPermission=\"navItem.permission\">\n <div class=\"nav-item\" routerLinkActive=\"active-link\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.icon }}\n </mat-icon>\n </div>\n <div class=\"text\">\n {{ navItem.label | titlecase }}\n </div>\n </div>\n </div>\n </a>\n</ng-template>\n<ng-template #expandableTemplate let-navItem=\"navItem\">\n <div class=\"nav-item\" aria-hidden=\"true\" (click)=\"navItem.isExpanded = !navItem.isExpanded\">\n <div class=\"link-button\">\n <div class=\"icon\">\n <mat-icon class=\"material-icons-outlined\" [inline]=\"true\">\n {{ navItem.isExpanded ? 'expand_less' : 'expand_more' }}\n </mat-icon>\n </div>\n <div class=\"text\">{{ navItem.label }}</div>\n </div>\n </div>\n @if (navItem.isExpanded) {\n <div class=\"expandable-links\">\n @for (navItemChild of navItem.children; track navItemChild) {\n <ng-container *ngTemplateOutlet=\"typeRendererTemplate; context: { navItem: navItemChild }\"> </ng-container>\n }\n </div>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"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,MAAA,EAAA,CAAA,slCAAA,CAAA,EAAA;8BAKQ,SAAS,EAAA,CAAA;sBAAjB;;;AE1CH;;AAEG;;;;"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
+
export * from '@cccteam/ccc-lib/src/auth-service';
|
|
2
|
+
export * from '@cccteam/ccc-lib/src/ui-core-service';
|
|
1
3
|
export * from '@cccteam/ccc-lib/src/auth-has-permission';
|
|
2
4
|
export * from '@cccteam/ccc-lib/src/auth-forms';
|
|
3
5
|
export * from '@cccteam/ccc-lib/src/auth-authentication-guard';
|
|
4
6
|
export * from '@cccteam/ccc-lib/src/auth-authorization-guard';
|
|
5
|
-
export * from '@cccteam/ccc-lib/src/auth-service';
|
|
6
7
|
export * from '@cccteam/ccc-lib/src/util-request-options';
|
|
7
|
-
export * from '@cccteam/ccc-lib/src/auth-state';
|
|
8
8
|
export * from '@cccteam/ccc-lib/src/types';
|
|
9
9
|
export * from '@cccteam/ccc-lib/src/ui-alert';
|
|
10
10
|
export * from '@cccteam/ccc-lib/src/ui-sidenav';
|
|
11
11
|
export * from '@cccteam/ccc-lib/src/ui-interceptor';
|
|
12
12
|
export * from '@cccteam/ccc-lib/src/ui-notification-service';
|
|
13
|
-
export * from '@cccteam/ccc-lib/src/ui-core-state';
|
|
14
13
|
|
|
15
14
|
/*
|
|
16
15
|
* Public API Surface of ccc-lib
|
|
17
16
|
*/
|
|
18
|
-
// Auth
|
|
17
|
+
// Auth service
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cccteam-ccc-lib.mjs","sources":["../../../projects/ccc-lib/src/public-api.ts","../../../projects/ccc-lib/src/cccteam-ccc-lib.ts"],"sourcesContent":["/*\n * Public API Surface of ccc-lib\n */\n\n// Auth
|
|
1
|
+
{"version":3,"file":"cccteam-ccc-lib.mjs","sources":["../../../projects/ccc-lib/src/public-api.ts","../../../projects/ccc-lib/src/cccteam-ccc-lib.ts"],"sourcesContent":["/*\n * Public API Surface of ccc-lib\n */\n\n// Auth service\nexport * from '@cccteam/ccc-lib/src/auth-service';\n\n// UI Core service\nexport * from '@cccteam/ccc-lib/src/ui-core-service';\n\n// Auth directives\nexport * from '@cccteam/ccc-lib/src/auth-has-permission';\n\n// Auth forms\nexport * from '@cccteam/ccc-lib/src/auth-forms';\n\n// Auth guards\nexport * from '@cccteam/ccc-lib/src/auth-authentication-guard';\nexport * from '@cccteam/ccc-lib/src/auth-authorization-guard';\n\n// Util\nexport * from '@cccteam/ccc-lib/src/util-request-options';\n\n// Types\nexport * from '@cccteam/ccc-lib/src/types';\n\n// Ui components\nexport * from '@cccteam/ccc-lib/src/ui-alert';\nexport * from '@cccteam/ccc-lib/src/ui-sidenav';\n\n// Ui interceptor\nexport * from '@cccteam/ccc-lib/src/ui-interceptor';\n\n// Ui services\nexport * from '@cccteam/ccc-lib/src/ui-notification-service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;AAEG;AAEH;;ACJA;;AAEG"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from '
|
|
1
|
+
export * from '@cccteam/ccc-lib/src/auth-service';
|
|
2
|
+
export * from '@cccteam/ccc-lib/src/ui-core-service';
|
|
3
|
+
export * from '@cccteam/ccc-lib/src/auth-has-permission';
|
|
4
|
+
export * from '@cccteam/ccc-lib/src/auth-forms';
|
|
5
|
+
export * from '@cccteam/ccc-lib/src/auth-authentication-guard';
|
|
6
|
+
export * from '@cccteam/ccc-lib/src/auth-authorization-guard';
|
|
7
|
+
export * from '@cccteam/ccc-lib/src/util-request-options';
|
|
8
|
+
export * from '@cccteam/ccc-lib/src/types';
|
|
9
|
+
export * from '@cccteam/ccc-lib/src/ui-alert';
|
|
10
|
+
export * from '@cccteam/ccc-lib/src/ui-sidenav';
|
|
11
|
+
export * from '@cccteam/ccc-lib/src/ui-interceptor';
|
|
12
|
+
export * from '@cccteam/ccc-lib/src/ui-notification-service';
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cccteam/ccc-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git://github.com/cccteam/ccc-lib.git"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@angular/common": "^
|
|
10
|
-
"@angular/core": "^
|
|
9
|
+
"@angular/common": "^20.0.0",
|
|
10
|
+
"@angular/core": "^20.0.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"tslib": "^2.3.0"
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./src/auth-authentication-guard/index.d.ts",
|
|
28
28
|
"default": "./fesm2022/cccteam-ccc-lib-src-auth-authentication-guard.mjs"
|
|
29
29
|
},
|
|
30
|
+
"./src/auth-authorization-guard": {
|
|
31
|
+
"types": "./src/auth-authorization-guard/index.d.ts",
|
|
32
|
+
"default": "./fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs"
|
|
33
|
+
},
|
|
30
34
|
"./src/auth-forms": {
|
|
31
35
|
"types": "./src/auth-forms/index.d.ts",
|
|
32
36
|
"default": "./fesm2022/cccteam-ccc-lib-src-auth-forms.mjs"
|
|
@@ -35,18 +39,10 @@
|
|
|
35
39
|
"types": "./src/auth-has-permission/index.d.ts",
|
|
36
40
|
"default": "./fesm2022/cccteam-ccc-lib-src-auth-has-permission.mjs"
|
|
37
41
|
},
|
|
38
|
-
"./src/auth-authorization-guard": {
|
|
39
|
-
"types": "./src/auth-authorization-guard/index.d.ts",
|
|
40
|
-
"default": "./fesm2022/cccteam-ccc-lib-src-auth-authorization-guard.mjs"
|
|
41
|
-
},
|
|
42
42
|
"./src/auth-service": {
|
|
43
43
|
"types": "./src/auth-service/index.d.ts",
|
|
44
44
|
"default": "./fesm2022/cccteam-ccc-lib-src-auth-service.mjs"
|
|
45
45
|
},
|
|
46
|
-
"./src/auth-state": {
|
|
47
|
-
"types": "./src/auth-state/index.d.ts",
|
|
48
|
-
"default": "./fesm2022/cccteam-ccc-lib-src-auth-state.mjs"
|
|
49
|
-
},
|
|
50
46
|
"./src/types": {
|
|
51
47
|
"types": "./src/types/index.d.ts",
|
|
52
48
|
"default": "./fesm2022/cccteam-ccc-lib-src-types.mjs"
|
|
@@ -55,9 +51,9 @@
|
|
|
55
51
|
"types": "./src/ui-alert/index.d.ts",
|
|
56
52
|
"default": "./fesm2022/cccteam-ccc-lib-src-ui-alert.mjs"
|
|
57
53
|
},
|
|
58
|
-
"./src/ui-core-
|
|
59
|
-
"types": "./src/ui-core-
|
|
60
|
-
"default": "./fesm2022/cccteam-ccc-lib-src-ui-core-
|
|
54
|
+
"./src/ui-core-service": {
|
|
55
|
+
"types": "./src/ui-core-service/index.d.ts",
|
|
56
|
+
"default": "./fesm2022/cccteam-ccc-lib-src-ui-core-service.mjs"
|
|
61
57
|
},
|
|
62
58
|
"./src/ui-interceptor": {
|
|
63
59
|
"types": "./src/ui-interceptor/index.d.ts",
|
|
@@ -76,4 +72,4 @@
|
|
|
76
72
|
"default": "./fesm2022/cccteam-ccc-lib-src-util-request-options.mjs"
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
|
-
}
|
|
75
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
declare const AuthenticationGuard: (route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) => Observable<boolean>;
|
|
5
|
+
|
|
6
|
+
export { AuthenticationGuard };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
declare const AuthorizationGuard: (route: ActivatedRouteSnapshot) => Signal<boolean>;
|
|
5
|
+
|
|
6
|
+
export { AuthorizationGuard };
|
|
@@ -1,5 +1,45 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, Signal } from '@angular/core';
|
|
3
|
+
import { AuthService } from '@cccteam/ccc-lib/src/auth-service';
|
|
4
|
+
import { Resource, Domain } from '@cccteam/ccc-lib/src/types';
|
|
5
|
+
import { FormGroup, FormArray } from '@angular/forms';
|
|
6
|
+
|
|
7
|
+
declare enum InputMode {
|
|
8
|
+
Read = "read",
|
|
9
|
+
Edit = "edit"
|
|
10
|
+
}
|
|
11
|
+
declare class CccInputFieldComponent implements OnInit {
|
|
12
|
+
auth: AuthService;
|
|
13
|
+
className: _angular_core.InputSignal<unknown>;
|
|
14
|
+
mode: _angular_core.InputSignal<InputMode>;
|
|
15
|
+
resource: _angular_core.InputSignal<Resource>;
|
|
16
|
+
domain: _angular_core.InputSignal<Domain>;
|
|
17
|
+
value: _angular_core.InputSignal<unknown>;
|
|
18
|
+
name: _angular_core.InputSignal<string>;
|
|
19
|
+
inputMode: typeof InputMode;
|
|
20
|
+
canEdit: Signal<boolean>;
|
|
21
|
+
canEditSelector: boolean;
|
|
22
|
+
canRead: Signal<boolean>;
|
|
23
|
+
canReadSelector: boolean;
|
|
24
|
+
ngOnInit(): void;
|
|
25
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CccInputFieldComponent, never>;
|
|
26
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CccInputFieldComponent, "ccc-input-field", never, { "className": { "alias": "className"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": true; "isSignal": true; }; "resource": { "alias": "resource"; "required": true; "isSignal": true; }; "domain": { "alias": "domain"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "name": { "alias": "name"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
27
|
+
}
|
|
28
|
+
|
|
1
29
|
/**
|
|
2
|
-
*
|
|
30
|
+
* Accepts a FormGroup and compares it to an object to return the dirty form values
|
|
31
|
+
* as a sparse object
|
|
32
|
+
* @param form - FormGroup
|
|
33
|
+
* @param compareData - object to compare form values against
|
|
34
|
+
* @returns Partial<T>
|
|
35
|
+
* @example sparseFormData<UserCreate>(this.userForm, initUser)
|
|
3
36
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
37
|
+
declare function sparseFormData<T>(form: FormGroup, compareData: T): T;
|
|
38
|
+
/**
|
|
39
|
+
* Accepts a FormArray and removes empty strings
|
|
40
|
+
* @param formArray - FormArray
|
|
41
|
+
* @returns FormArray
|
|
42
|
+
*/
|
|
43
|
+
declare function cleanStringFormArray(formArray: FormArray): FormArray;
|
|
44
|
+
|
|
45
|
+
export { CccInputFieldComponent, InputMode, cleanStringFormArray, sparseFormData };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { PermissionScope } from '@cccteam/ccc-lib/src/types';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class HasPermissionDirective {
|
|
5
|
+
private auth;
|
|
6
|
+
private templateRef;
|
|
7
|
+
private viewContainer;
|
|
8
|
+
private scope;
|
|
9
|
+
set cccHasPermission(scope: PermissionScope);
|
|
10
|
+
constructor();
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HasPermissionDirective, never>;
|
|
12
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HasPermissionDirective, "[cccHasPermission]", never, { "cccHasPermission": { "alias": "cccHasPermission"; "required": false; }; }, {}, never, never, true, never>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { HasPermissionDirective };
|
|
@@ -1,5 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { SessionInfo, PermissionScope, Resource, Permission } from '@cccteam/ccc-lib/src/types';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
declare class AuthService {
|
|
7
|
+
private apiUrl;
|
|
8
|
+
http: HttpClient;
|
|
9
|
+
private authenticatedSignal;
|
|
10
|
+
private sessionInfoSignal;
|
|
11
|
+
redirectUrl: _angular_core.WritableSignal<string>;
|
|
12
|
+
authenticated: _angular_core.Signal<boolean>;
|
|
13
|
+
sessionInfo: _angular_core.Signal<SessionInfo>;
|
|
14
|
+
constructor(apiUrl: string);
|
|
15
|
+
private static permissionFn;
|
|
16
|
+
hasPermission(scope?: PermissionScope): boolean;
|
|
17
|
+
static requiresPermission(resource: Resource, permission: Permission): boolean;
|
|
18
|
+
private initializePermissionFn;
|
|
19
|
+
/**
|
|
20
|
+
* Logs a user out.
|
|
21
|
+
*
|
|
22
|
+
* @returns Observable with a boolean indicating whether they were logged out.
|
|
23
|
+
*/
|
|
24
|
+
logout(): Observable<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Checks a user's session with the server.
|
|
27
|
+
*
|
|
28
|
+
* @returns Observable with the user session info
|
|
29
|
+
*/
|
|
30
|
+
checkUserSession(): Observable<SessionInfo>;
|
|
31
|
+
loginRoute(): string;
|
|
32
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthService, never>;
|
|
33
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthService>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { AuthService };
|