@ng-vagabond-lab/ng-dsv 0.0.6 → 0.0.8
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/api/dto/api.dto.d.ts +23 -0
- package/api/dto/api.pageable.dto.d.ts +28 -0
- package/api/index.d.ts +5 -0
- package/api/interceptor/api.interceptor.d.ts +2 -0
- package/api/public-api.d.ts +4 -0
- package/api/service/api.service.d.ts +15 -0
- package/base/component/base.route.component.d.ts +13 -0
- package/base/index.d.ts +5 -0
- package/base/public-api.d.ts +1 -0
- package/fesm2022/ng-vagabond-lab-ng-dsv-api.mjs +94 -0
- package/fesm2022/ng-vagabond-lab-ng-dsv-api.mjs.map +1 -0
- package/fesm2022/ng-vagabond-lab-ng-dsv-base.mjs +31 -0
- package/fesm2022/ng-vagabond-lab-ng-dsv-base.mjs.map +1 -0
- package/fesm2022/ng-vagabond-lab-ng-dsv-ds-menu.mjs +3 -2
- package/fesm2022/ng-vagabond-lab-ng-dsv-ds-menu.mjs.map +1 -1
- package/fesm2022/ng-vagabond-lab-ng-dsv-ds-theme.mjs +0 -1
- package/fesm2022/ng-vagabond-lab-ng-dsv-ds-theme.mjs.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ID = string | number | undefined | null;
|
|
2
|
+
export type Primitif = string | number | boolean | undefined | null;
|
|
3
|
+
export type JSONValue = Primitif | {
|
|
4
|
+
[x: string]: JSONValue;
|
|
5
|
+
} | Array<JSONValue> | IApiDto;
|
|
6
|
+
export type JSONObject = {
|
|
7
|
+
[x: string]: JSONValue;
|
|
8
|
+
} | Array<JSONObject> | IApiDto;
|
|
9
|
+
export type JSON = {
|
|
10
|
+
[x: string]: JSON | Primitif;
|
|
11
|
+
};
|
|
12
|
+
export type Target = {
|
|
13
|
+
target: {
|
|
14
|
+
value: JSONObject;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export interface IApiDto {
|
|
18
|
+
id?: ID;
|
|
19
|
+
creationDate?: string;
|
|
20
|
+
updatedDate?: string;
|
|
21
|
+
deletedDate?: string;
|
|
22
|
+
active?: boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface IPageableDto<T> {
|
|
2
|
+
totalPages?: number;
|
|
3
|
+
totalElements?: number;
|
|
4
|
+
size?: number;
|
|
5
|
+
content: T;
|
|
6
|
+
number?: number;
|
|
7
|
+
sort?: {
|
|
8
|
+
empty: boolean;
|
|
9
|
+
sorted: boolean;
|
|
10
|
+
unsorted: boolean;
|
|
11
|
+
};
|
|
12
|
+
pageable?: {
|
|
13
|
+
offset: number;
|
|
14
|
+
sort: {
|
|
15
|
+
empty: boolean;
|
|
16
|
+
sorted: boolean;
|
|
17
|
+
unsorted: boolean;
|
|
18
|
+
};
|
|
19
|
+
pageNumber: number;
|
|
20
|
+
pageSize: number;
|
|
21
|
+
paged: boolean;
|
|
22
|
+
unpaged: boolean;
|
|
23
|
+
};
|
|
24
|
+
first?: boolean;
|
|
25
|
+
last?: boolean;
|
|
26
|
+
numberOfElements?: number;
|
|
27
|
+
empty?: boolean;
|
|
28
|
+
}
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { JSONObject } from '../dto/api.dto';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ApiService {
|
|
5
|
+
private readonly httpClient;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
constructor(httpClient: HttpClient);
|
|
8
|
+
setBaseUrl(url: string): void;
|
|
9
|
+
get<T>(url: string, callback: (data: T) => void): void;
|
|
10
|
+
post<T>(url: string, data: T, callback: (data: T) => void): void;
|
|
11
|
+
info(url: string, data: JSONObject): void;
|
|
12
|
+
error(url: string, error: JSONObject): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApiService, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApiService>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Params } from '@angular/router';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare abstract class BaseRouteComponent implements OnInit {
|
|
6
|
+
protected activatedRoute: ActivatedRoute;
|
|
7
|
+
routeObservable: Subscription | null;
|
|
8
|
+
constructor(activatedRoute: ActivatedRoute);
|
|
9
|
+
ngOnInit(): void;
|
|
10
|
+
protected abstract ngOnInitAfter(params: Params): void;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseRouteComponent, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseRouteComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
13
|
+
}
|
package/base/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component/base.route.component';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as i1 from '@angular/common/http';
|
|
2
|
+
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, inject } from '@angular/core';
|
|
5
|
+
import { catchError, throwError, switchMap } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
class ApiService {
|
|
8
|
+
httpClient;
|
|
9
|
+
baseUrl;
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.httpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
setBaseUrl(url) {
|
|
14
|
+
this.baseUrl = url;
|
|
15
|
+
}
|
|
16
|
+
get(url, callback) {
|
|
17
|
+
this.httpClient.get(this.baseUrl + url).subscribe({
|
|
18
|
+
next: (res) => {
|
|
19
|
+
this.info(url, res);
|
|
20
|
+
callback(res);
|
|
21
|
+
},
|
|
22
|
+
error: (error) => {
|
|
23
|
+
this.error(url, error);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
post(url, data, callback) {
|
|
28
|
+
this.httpClient.post(this.baseUrl + url, data).subscribe({
|
|
29
|
+
next: (res) => {
|
|
30
|
+
this.info(url, res);
|
|
31
|
+
callback(res);
|
|
32
|
+
},
|
|
33
|
+
error: (error) => {
|
|
34
|
+
this.error(url, error);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
info(url, data) {
|
|
39
|
+
console.log(url, data);
|
|
40
|
+
}
|
|
41
|
+
error(url, error) {
|
|
42
|
+
console.error(url, error);
|
|
43
|
+
}
|
|
44
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ApiService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
45
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ApiService, providedIn: 'root' });
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ApiService, decorators: [{
|
|
48
|
+
type: Injectable,
|
|
49
|
+
args: [{
|
|
50
|
+
providedIn: 'root',
|
|
51
|
+
}]
|
|
52
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
53
|
+
|
|
54
|
+
const authInterceptor = (req, next) => {
|
|
55
|
+
const httpClient = inject(HttpClient);
|
|
56
|
+
return next(getToken(req)).pipe(catchError((error) => {
|
|
57
|
+
if (error instanceof HttpErrorResponse &&
|
|
58
|
+
!req.url.includes('auth/') &&
|
|
59
|
+
error.status === 401) {
|
|
60
|
+
return handle401Error(httpClient, req, next);
|
|
61
|
+
}
|
|
62
|
+
return throwError(() => error);
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
const getToken = (req) => {
|
|
66
|
+
const jwt = JSON.parse(localStorage.getItem('user-connected'))?.jwt;
|
|
67
|
+
if (!req.url.includes('/auth/')) {
|
|
68
|
+
const headers = req.headers.set('Authorization', `Bearer ${jwt}`);
|
|
69
|
+
return req.clone({
|
|
70
|
+
headers,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return req;
|
|
74
|
+
};
|
|
75
|
+
const handle401Error = (httpClient, request, next) => {
|
|
76
|
+
console.log('401 error');
|
|
77
|
+
const jwtRefresh = JSON.parse(localStorage.getItem('user-connected'))?.jwtRefresh;
|
|
78
|
+
const apiService = inject(ApiService);
|
|
79
|
+
return httpClient
|
|
80
|
+
.post(apiService.baseUrl + '/auth/refresh-token', {
|
|
81
|
+
refreshToken: jwtRefresh,
|
|
82
|
+
})
|
|
83
|
+
.pipe(switchMap((response) => {
|
|
84
|
+
localStorage.setItem('user-connected', JSON.stringify(response));
|
|
85
|
+
return next(getToken(request));
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Generated bundle index. Do not edit.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
export { ApiService, authInterceptor };
|
|
94
|
+
//# sourceMappingURL=ng-vagabond-lab-ng-dsv-api.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-vagabond-lab-ng-dsv-api.mjs","sources":["../../../projects/ng-dsv/api/service/api.service.ts","../../../projects/ng-dsv/api/interceptor/api.interceptor.ts","../../../projects/ng-dsv/api/ng-vagabond-lab-ng-dsv-api.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { JSONObject } from '../dto/api.dto';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ApiService {\n baseUrl!: string;\n\n constructor(private readonly httpClient: HttpClient) {}\n\n setBaseUrl(url: string) {\n this.baseUrl = url;\n }\n\n get<T>(url: string, callback: (data: T) => void) {\n this.httpClient.get<T>(this.baseUrl + url).subscribe({\n next: (res) => {\n this.info(url, res as JSONObject);\n callback(res);\n },\n error: (error: JSONObject) => {\n this.error(url, error);\n },\n });\n }\n\n post<T>(url: string, data: T, callback: (data: T) => void) {\n this.httpClient.post<T>(this.baseUrl + url, data).subscribe({\n next: (res) => {\n this.info(url, res as JSONObject);\n callback(res);\n },\n error: (error: JSONObject) => {\n this.error(url, error);\n },\n });\n }\n\n info(url: string, data: JSONObject) {\n console.log(url, data);\n }\n\n error(url: string, error: JSONObject) {\n console.error(url, error);\n }\n}\n","import {\n HttpClient,\n HttpErrorResponse,\n HttpHandlerFn,\n HttpInterceptorFn,\n HttpRequest,\n} from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { catchError, switchMap, throwError } from 'rxjs';\nimport { ApiService } from '../service/api.service';\n\nexport const authInterceptor: HttpInterceptorFn = (req, next) => {\n const httpClient = inject(HttpClient);\n return next(getToken(req)).pipe(\n catchError((error) => {\n if (\n error instanceof HttpErrorResponse &&\n !req.url.includes('auth/') &&\n error.status === 401\n ) {\n return handle401Error(httpClient, req, next);\n }\n\n return throwError(() => error);\n })\n );\n};\n\nconst getToken = <T>(req: HttpRequest<T>) => {\n const jwt = JSON.parse(localStorage.getItem('user-connected')!)?.jwt;\n if (!req.url.includes('/auth/')) {\n const headers = req.headers.set('Authorization', `Bearer ${jwt}`);\n\n return req.clone({\n headers,\n });\n }\n return req;\n};\n\nconst handle401Error = <T>(\n httpClient: HttpClient,\n request: HttpRequest<T>,\n next: HttpHandlerFn\n) => {\n console.log('401 error');\n\n const jwtRefresh = JSON.parse(\n localStorage.getItem('user-connected')!\n )?.jwtRefresh;\n\n const apiService = inject(ApiService);\n\n return httpClient\n .post(apiService.baseUrl + '/auth/refresh-token', {\n refreshToken: jwtRefresh,\n })\n .pipe(\n switchMap((response) => {\n localStorage.setItem('user-connected', JSON.stringify(response));\n return next(getToken(request));\n })\n );\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAOa,UAAU,CAAA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AA,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAA,OAAA,EAAU,GAAG,CAAA,CAAE,CAAC;QAEjE,OAAO,GAAG,CAAC,KAAK,CAAC;YACf,OAAO;AACR,SAAA,CAAC;;AAEJ,IAAA,OAAO,GAAG;AACZ,CAAC;AAED,MAAM,cAAc,GAAG,CACrB,UAAsB,EACtB,OAAuB,EACvB,IAAmB,KACjB;AACF,IAAA,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAExB,IAAA,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAC3B,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAE,CACxC,EAAE,UAAU;AAEb,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAErC,IAAA,OAAO;AACJ,SAAA,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,qBAAqB,EAAE;AAChD,QAAA,YAAY,EAAE,UAAU;KACzB;AACA,SAAA,IAAI,CACH,SAAS,CAAC,CAAC,QAAQ,KAAI;AACrB,QAAA,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAChE,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KAC/B,CAAC,CACH;AACL,CAAC;;AC/DD;;AAEG;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/router';
|
|
4
|
+
|
|
5
|
+
class BaseRouteComponent {
|
|
6
|
+
activatedRoute;
|
|
7
|
+
routeObservable = null;
|
|
8
|
+
constructor(activatedRoute) {
|
|
9
|
+
this.activatedRoute = activatedRoute;
|
|
10
|
+
}
|
|
11
|
+
ngOnInit() {
|
|
12
|
+
this.routeObservable = this.activatedRoute.params.subscribe((params) => {
|
|
13
|
+
this.ngOnInitAfter(params);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: BaseRouteComponent, deps: [{ token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
17
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.7", type: BaseRouteComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
18
|
+
}
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: BaseRouteComponent, decorators: [{
|
|
20
|
+
type: Component,
|
|
21
|
+
args: [{
|
|
22
|
+
template: '',
|
|
23
|
+
}]
|
|
24
|
+
}], ctorParameters: () => [{ type: i1.ActivatedRoute }] });
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generated bundle index. Do not edit.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export { BaseRouteComponent };
|
|
31
|
+
//# sourceMappingURL=ng-vagabond-lab-ng-dsv-base.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-vagabond-lab-ng-dsv-base.mjs","sources":["../../../projects/ng-dsv/base/component/base.route.component.ts","../../../projects/ng-dsv/base/ng-vagabond-lab-ng-dsv-base.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { ActivatedRoute, Params } from '@angular/router';\nimport { Subscription } from 'rxjs';\n\n@Component({\n template: '',\n})\nexport abstract class BaseRouteComponent implements OnInit {\n routeObservable: Subscription | null = null;\n\n constructor(protected activatedRoute: ActivatedRoute) {}\n\n ngOnInit() {\n this.routeObservable = this.activatedRoute.params.subscribe((params) => {\n this.ngOnInitAfter(params);\n });\n }\n\n protected abstract ngOnInitAfter(params: Params): void;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAOsB,kBAAkB,CAAA;AAGhB,IAAA,cAAA;IAFtB,eAAe,GAAwB,IAAI;AAE3C,IAAA,WAAA,CAAsB,cAA8B,EAAA;QAA9B,IAAc,CAAA,cAAA,GAAd,cAAc;;IAEpC,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,KAAI;AACrE,YAAA,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;AAC5B,SAAC,CAAC;;uGARgB,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,wEAF5B,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAEQ,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAHvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as i2 from '@angular/common';
|
|
1
2
|
import { CommonModule } from '@angular/common';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
4
|
import { Component, effect, Input, HostListener, signal, Injectable } from '@angular/core';
|
|
@@ -52,11 +53,11 @@ class DsvMenuComponent {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: DsvMenuComponent, deps: [{ token: MenuService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
55
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.7", type: DsvMenuComponent, isStandalone: true, selector: "dsv-menu", inputs: { showFooter: "showFooter" }, host: { listeners: { "document:click": "onClickOutside($event)" } }, ngImport: i0, template: "<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;background-color:var(--white);color:var(--text);width:240px;transform:translate(0)!important}:host.open{transform:translate(0)!important}:host .footer{display:flex;align-items:center;justify-content:center;padding:10px}::ng-deep .dark dsv-menu{background-color:var(--background-dark);color:var(--text-dark)}@media only screen and (max-width: 1000px){:host{position:fixed;height:-webkit-fill-available;z-index:1201;transform:translate(-100%)!important;transition:transform .3s ease-in-out}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: DsvThemeSwitchComponent, selector: "dsv-theme-switch" }, { kind: "component", type: DsvContainerComponent, selector: "dsv-container", inputs: ["column"] }] });
|
|
56
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.7", type: DsvMenuComponent, isStandalone: true, selector: "dsv-menu", inputs: { showFooter: "showFooter" }, host: { listeners: { "document:click": "onClickOutside($event)" } }, ngImport: i0, template: "<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\" *ngIf=\"showFooter\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;background-color:var(--white);color:var(--text);width:240px;transform:translate(0)!important}:host.open{transform:translate(0)!important}:host .footer{display:flex;align-items:center;justify-content:center;padding:10px}::ng-deep .dark dsv-menu{background-color:var(--background-dark);color:var(--text-dark)}@media only screen and (max-width: 1000px){:host{position:fixed;height:-webkit-fill-available;z-index:1201;transform:translate(-100%)!important;transition:transform .3s ease-in-out}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DsvThemeSwitchComponent, selector: "dsv-theme-switch" }, { kind: "component", type: DsvContainerComponent, selector: "dsv-container", inputs: ["column"] }] });
|
|
56
57
|
}
|
|
57
58
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: DsvMenuComponent, decorators: [{
|
|
58
59
|
type: Component,
|
|
59
|
-
args: [{ selector: 'dsv-menu', standalone: true, imports: [CommonModule, DsvThemeSwitchComponent, DsvContainerComponent], template: "<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;background-color:var(--white);color:var(--text);width:240px;transform:translate(0)!important}:host.open{transform:translate(0)!important}:host .footer{display:flex;align-items:center;justify-content:center;padding:10px}::ng-deep .dark dsv-menu{background-color:var(--background-dark);color:var(--text-dark)}@media only screen and (max-width: 1000px){:host{position:fixed;height:-webkit-fill-available;z-index:1201;transform:translate(-100%)!important;transition:transform .3s ease-in-out}}\n"] }]
|
|
60
|
+
args: [{ selector: 'dsv-menu', standalone: true, imports: [CommonModule, DsvThemeSwitchComponent, DsvContainerComponent], template: "<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\" *ngIf=\"showFooter\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;background-color:var(--white);color:var(--text);width:240px;transform:translate(0)!important}:host.open{transform:translate(0)!important}:host .footer{display:flex;align-items:center;justify-content:center;padding:10px}::ng-deep .dark dsv-menu{background-color:var(--background-dark);color:var(--text-dark)}@media only screen and (max-width: 1000px){:host{position:fixed;height:-webkit-fill-available;z-index:1201;transform:translate(-100%)!important;transition:transform .3s ease-in-out}}\n"] }]
|
|
60
61
|
}], ctorParameters: () => [{ type: MenuService }, { type: i0.ElementRef }], propDecorators: { showFooter: [{
|
|
61
62
|
type: Input
|
|
62
63
|
}], onClickOutside: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-menu.mjs","sources":["../../../projects/ng-dsv/ds/menu/component/button/menu.button.component.ts","../../../projects/ng-dsv/ds/menu/component/button/menu.button.component.html","../../../projects/ng-dsv/ds/menu/component/menu.component.ts","../../../projects/ng-dsv/ds/menu/component/menu.component.html","../../../projects/ng-dsv/ds/menu/service/menu.service.ts","../../../projects/ng-dsv/ds/menu/ng-vagabond-lab-ng-dsv-ds-menu.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { MenuService } from '../../public-api';\n\n@Component({\n selector: 'dsv-menu-button',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: './menu.button.component.html',\n styleUrls: ['./menu.button.component.scss'],\n})\nexport class DsvMenuButtonComponent {\n constructor(private menuService: MenuService) {}\n\n doToogleMenu() {\n this.menuService.toogleMenu();\n }\n}\n","<dsv-button\n icon=\"ri-menu-line\"\n color=\"inherit\"\n (callback)=\"doToogleMenu()\"\n></dsv-button>\n","import { CommonModule } from '@angular/common';\nimport {\n Component,\n effect,\n ElementRef,\n HostListener,\n Input,\n OnInit,\n} from '@angular/core';\nimport { DsvContainerComponent } from '@ng-vagabond-lab/ng-dsv/ds/container';\nimport { DsvThemeSwitchComponent } from '@ng-vagabond-lab/ng-dsv/ds/theme';\nimport { MenuService } from '../public-api';\n\n@Component({\n selector: 'dsv-menu',\n standalone: true,\n imports: [CommonModule, DsvThemeSwitchComponent, DsvContainerComponent],\n templateUrl: './menu.component.html',\n styleUrls: ['./menu.component.scss'],\n})\nexport class DsvMenuComponent implements OnInit {\n @Input() showFooter: boolean = true;\n\n constructor(\n private menuService: MenuService,\n private elementRef: ElementRef\n ) {\n effect(() => {\n const menu = document.getElementsByTagName('dsv-menu')[0];\n const collapse = document.getElementById('collapse');\n if (this.menuService.isMenuOpen()) {\n menu?.classList?.add('open');\n collapse?.classList.add('show');\n } else {\n menu?.classList?.remove('open');\n collapse?.classList.remove('show');\n }\n });\n }\n\n ngOnInit() {\n this.menuService.isMenuOpen() &&\n document.getElementsByTagName('dsv-container')[0].classList.add('show');\n }\n\n @HostListener('document:click', ['$event'])\n onClickOutside(event: Event) {\n if (\n this.menuService.isMenuOpen() &&\n !this.elementRef.nativeElement.contains(event.target)\n ) {\n this.menuService.toogleMenu();\n }\n }\n}\n","<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MenuService {\n isMenuOpen: WritableSignal<boolean> = signal(false);\n\n toogleMenu() {\n this.isMenuOpen.update((toogle) => !toogle);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.MenuService"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-menu.mjs","sources":["../../../projects/ng-dsv/ds/menu/component/button/menu.button.component.ts","../../../projects/ng-dsv/ds/menu/component/button/menu.button.component.html","../../../projects/ng-dsv/ds/menu/component/menu.component.ts","../../../projects/ng-dsv/ds/menu/component/menu.component.html","../../../projects/ng-dsv/ds/menu/service/menu.service.ts","../../../projects/ng-dsv/ds/menu/ng-vagabond-lab-ng-dsv-ds-menu.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { MenuService } from '../../public-api';\n\n@Component({\n selector: 'dsv-menu-button',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: './menu.button.component.html',\n styleUrls: ['./menu.button.component.scss'],\n})\nexport class DsvMenuButtonComponent {\n constructor(private menuService: MenuService) {}\n\n doToogleMenu() {\n this.menuService.toogleMenu();\n }\n}\n","<dsv-button\n icon=\"ri-menu-line\"\n color=\"inherit\"\n (callback)=\"doToogleMenu()\"\n></dsv-button>\n","import { CommonModule } from '@angular/common';\nimport {\n Component,\n effect,\n ElementRef,\n HostListener,\n Input,\n OnInit,\n} from '@angular/core';\nimport { DsvContainerComponent } from '@ng-vagabond-lab/ng-dsv/ds/container';\nimport { DsvThemeSwitchComponent } from '@ng-vagabond-lab/ng-dsv/ds/theme';\nimport { MenuService } from '../public-api';\n\n@Component({\n selector: 'dsv-menu',\n standalone: true,\n imports: [CommonModule, DsvThemeSwitchComponent, DsvContainerComponent],\n templateUrl: './menu.component.html',\n styleUrls: ['./menu.component.scss'],\n})\nexport class DsvMenuComponent implements OnInit {\n @Input() showFooter: boolean = true;\n\n constructor(\n private menuService: MenuService,\n private elementRef: ElementRef\n ) {\n effect(() => {\n const menu = document.getElementsByTagName('dsv-menu')[0];\n const collapse = document.getElementById('collapse');\n if (this.menuService.isMenuOpen()) {\n menu?.classList?.add('open');\n collapse?.classList.add('show');\n } else {\n menu?.classList?.remove('open');\n collapse?.classList.remove('show');\n }\n });\n }\n\n ngOnInit() {\n this.menuService.isMenuOpen() &&\n document.getElementsByTagName('dsv-container')[0].classList.add('show');\n }\n\n @HostListener('document:click', ['$event'])\n onClickOutside(event: Event) {\n if (\n this.menuService.isMenuOpen() &&\n !this.elementRef.nativeElement.contains(event.target)\n ) {\n this.menuService.toogleMenu();\n }\n }\n}\n","<dsv-container>\n <ng-content></ng-content>\n</dsv-container>\n<div class=\"footer\" *ngIf=\"showFooter\">\n <dsv-theme-switch></dsv-theme-switch>\n</div>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MenuService {\n isMenuOpen: WritableSignal<boolean> = signal(false);\n\n toogleMenu() {\n this.isMenuOpen.update((toogle) => !toogle);\n }\n}\n","/**\n * Generated b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AA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACJD;;AAEG;;;;"}
|
|
@@ -86,7 +86,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
86
86
|
args: [{ selector: 'dsv-theme-switch', standalone: true, imports: [CommonModule, DsvButtonComponent], template: "<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n" }]
|
|
87
87
|
}], ctorParameters: () => [{ type: ThemeService }] });
|
|
88
88
|
|
|
89
|
-
console.log('default theme :', localStorage.getItem('theme'));
|
|
90
89
|
class ThemeService {
|
|
91
90
|
themeMode = signal(localStorage.getItem('theme') ?? 'light');
|
|
92
91
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-theme.mjs","sources":["../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.ts","../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.html","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.ts","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.html","../../../projects/ng-dsv/ds/theme/service/dsv.theme.service.ts","../../../projects/ng-dsv/ds/theme/ng-vagabond-lab-ng-dsv-ds-theme.ts"],"sourcesContent":["import { Component, HostBinding, Input } from '@angular/core';\n\nexport type ThemeType = {\n background?: string;\n backgroundDark?: string;\n text?: string;\n textDark?: string;\n primary?: string;\n secondary?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n};\n\n@Component({\n selector: 'dsv-theme',\n standalone: true,\n imports: [],\n templateUrl: './dsv.theme.component.html',\n styleUrls: ['./dsv.theme.component.scss'],\n})\nexport class DsvThemeComponent {\n @Input()\n theme: ThemeType = {};\n\n @HostBinding('style.--background')\n background!: string;\n\n @HostBinding('style.--background-dark')\n backgroundDark!: string;\n\n @HostBinding('style.--text')\n text!: string;\n\n @HostBinding('style.--text-dark')\n textDark!: string;\n\n @HostBinding('style.--primary')\n primary!: string;\n\n @HostBinding('style.--secondary')\n secondary!: string;\n\n @HostBinding('style.--success')\n success!: string;\n\n @HostBinding('style.--info')\n info!: string;\n\n @HostBinding('style.--warning')\n warning!: string;\n\n @HostBinding('style.--error')\n error!: string;\n\n ngOnInit() {\n this.background = this.theme.background ?? 'rgb(220, 220, 220)';\n this.backgroundDark = this.theme.backgroundDark ?? 'rgb(31, 31, 31)';\n this.text = this.theme.text ?? '#000';\n this.textDark = this.theme.textDark ?? '#fff';\n this.primary = this.theme.primary ?? '#AAA';\n this.secondary = this.theme.secondary ?? '#AAA';\n this.success = this.theme.success ?? '#439746';\n this.info = this.theme.info ?? '#1b78c4';\n this.warning = this.theme.warning ?? '#dca603';\n this.error = this.theme.error ?? '#da1709';\n }\n}\n","<ng-content></ng-content>\n<div id=\"collapse\"></div>\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { ThemeService } from '../../public-api';\n\nexport type Theme = {\n primary: string;\n text: string;\n};\n\n@Component({\n selector: 'dsv-theme-switch',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: `./dsv.theme.switch.component.html`,\n})\nexport class DsvThemeSwitchComponent {\n constructor(private themeService: ThemeService) {}\n\n switchTheme() {\n this.themeService.switchTheme();\n }\n\n isLightMode() {\n return this.themeService.themeMode() === 'light';\n }\n}\n","<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\nexport type ThemeMode = 'dark' | 'light';\n\
|
|
1
|
+
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-theme.mjs","sources":["../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.ts","../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.html","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.ts","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.html","../../../projects/ng-dsv/ds/theme/service/dsv.theme.service.ts","../../../projects/ng-dsv/ds/theme/ng-vagabond-lab-ng-dsv-ds-theme.ts"],"sourcesContent":["import { Component, HostBinding, Input } from '@angular/core';\n\nexport type ThemeType = {\n background?: string;\n backgroundDark?: string;\n text?: string;\n textDark?: string;\n primary?: string;\n secondary?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n};\n\n@Component({\n selector: 'dsv-theme',\n standalone: true,\n imports: [],\n templateUrl: './dsv.theme.component.html',\n styleUrls: ['./dsv.theme.component.scss'],\n})\nexport class DsvThemeComponent {\n @Input()\n theme: ThemeType = {};\n\n @HostBinding('style.--background')\n background!: string;\n\n @HostBinding('style.--background-dark')\n backgroundDark!: string;\n\n @HostBinding('style.--text')\n text!: string;\n\n @HostBinding('style.--text-dark')\n textDark!: string;\n\n @HostBinding('style.--primary')\n primary!: string;\n\n @HostBinding('style.--secondary')\n secondary!: string;\n\n @HostBinding('style.--success')\n success!: string;\n\n @HostBinding('style.--info')\n info!: string;\n\n @HostBinding('style.--warning')\n warning!: string;\n\n @HostBinding('style.--error')\n error!: string;\n\n ngOnInit() {\n this.background = this.theme.background ?? 'rgb(220, 220, 220)';\n this.backgroundDark = this.theme.backgroundDark ?? 'rgb(31, 31, 31)';\n this.text = this.theme.text ?? '#000';\n this.textDark = this.theme.textDark ?? '#fff';\n this.primary = this.theme.primary ?? '#AAA';\n this.secondary = this.theme.secondary ?? '#AAA';\n this.success = this.theme.success ?? '#439746';\n this.info = this.theme.info ?? '#1b78c4';\n this.warning = this.theme.warning ?? '#dca603';\n this.error = this.theme.error ?? '#da1709';\n }\n}\n","<ng-content></ng-content>\n<div id=\"collapse\"></div>\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { ThemeService } from '../../public-api';\n\nexport type Theme = {\n primary: string;\n text: string;\n};\n\n@Component({\n selector: 'dsv-theme-switch',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: `./dsv.theme.switch.component.html`,\n})\nexport class DsvThemeSwitchComponent {\n constructor(private themeService: ThemeService) {}\n\n switchTheme() {\n this.themeService.switchTheme();\n }\n\n isLightMode() {\n return this.themeService.themeMode() === 'light';\n }\n}\n","<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\nexport type ThemeMode = 'dark' | 'light';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ThemeService {\n themeMode: WritableSignal<ThemeMode> = signal(\n (localStorage.getItem('theme') as ThemeMode) ?? 'light'\n );\n\n constructor() {\n let html = document.getElementsByTagName('body')[0];\n html.classList.add(this.themeMode());\n }\n\n switchTheme() {\n let html = document.getElementsByTagName('body')[0];\n html.classList.remove(this.themeMode());\n\n let newMode: ThemeMode = this.themeMode() === 'dark' ? 'light' : 'dark';\n this.themeMode.set(newMode);\n localStorage.setItem('theme', newMode);\n html.classList.add(newMode);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\n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AA,IAAI,OAAO,GAAc,IAAI,CAAC,SAAS,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM;AACvE,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;AAC3B,QAAA,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;AACtC,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;;uGAjBlB,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cAFX,MAAM,EAAA,CAAA;;2FAEP,YAAY,EAAA,UAAA,EAAA,CAAA;kBAHxB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-vagabond-lab/ng-dsv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.1.7",
|
|
6
6
|
"@angular/core": "^19.1.7"
|
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
"types": "./index.d.ts",
|
|
20
20
|
"default": "./fesm2022/ng-vagabond-lab-ng-dsv.mjs"
|
|
21
21
|
},
|
|
22
|
+
"./api": {
|
|
23
|
+
"types": "./api/index.d.ts",
|
|
24
|
+
"default": "./fesm2022/ng-vagabond-lab-ng-dsv-api.mjs"
|
|
25
|
+
},
|
|
26
|
+
"./base": {
|
|
27
|
+
"types": "./base/index.d.ts",
|
|
28
|
+
"default": "./fesm2022/ng-vagabond-lab-ng-dsv-base.mjs"
|
|
29
|
+
},
|
|
22
30
|
"./i18n": {
|
|
23
31
|
"types": "./i18n/index.d.ts",
|
|
24
32
|
"default": "./fesm2022/ng-vagabond-lab-ng-dsv-i18n.mjs"
|