general-library-union 2.7.2 → 2.7.4
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/package.json +1 -1
- package/public-api.ts +5 -1
- package/src/app/core/servicios/data-exporter-table.utils.ts +3 -3
- package/src/app/core/servicios/interceptores/loading-interceptor.ts +37 -0
- package/src/app/core/servicios/spinner-service.ts +18 -0
- package/src/styles/primeng/sass/overrides/_theme_styles_dark.scss +0 -4
package/package.json
CHANGED
package/public-api.ts
CHANGED
|
@@ -194,4 +194,8 @@ export * from './src/app/webcommon/pages/fuente-reporte/fuente-reporte.component
|
|
|
194
194
|
export * from './src/app/webcommon/popups/popup-sentencia/popup-sentencia.component';
|
|
195
195
|
|
|
196
196
|
//plantillas
|
|
197
|
-
export * from './src/app/webcommon/pages/cargue-plantilla/cargue-plantilla-general/cargue-plantilla-general.component';
|
|
197
|
+
export * from './src/app/webcommon/pages/cargue-plantilla/cargue-plantilla-general/cargue-plantilla-general.component';
|
|
198
|
+
|
|
199
|
+
//spinner load blockui
|
|
200
|
+
export * from './src/app/core/servicios/spinner-service';
|
|
201
|
+
export * from './src/app/core/servicios/interceptores/loading-interceptor';
|
|
@@ -28,9 +28,9 @@ export class DataExporter {
|
|
|
28
28
|
this.saveAsExcelFile(buffer, nombreArchivo);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
async exportExcelColumnas(lista: any[], nombreArchivo: string, columnas: string[]) {
|
|
31
|
+
async exportExcelColumnas(lista: any[], nombreArchivo: string, columnas: string[], nombreHoja?: string) {
|
|
32
32
|
const workbook = new Workbook();
|
|
33
|
-
const worksheet = workbook.addWorksheet('data');
|
|
33
|
+
const worksheet = workbook.addWorksheet(nombreHoja ? nombreHoja : 'data');
|
|
34
34
|
|
|
35
35
|
worksheet.columns = columnas.map(col => ({ header: col, key: col }));
|
|
36
36
|
|
|
@@ -50,7 +50,7 @@ export class DataExporter {
|
|
|
50
50
|
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
51
51
|
const EXCEL_EXTENSION = '.xlsx';
|
|
52
52
|
const data: Blob = new Blob([buffer], { type: EXCEL_TYPE });
|
|
53
|
-
FileSaver.saveAs(data, `${fileName}
|
|
53
|
+
FileSaver.saveAs(data, `${fileName}${EXCEL_EXTENSION}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
exportCSV(lista: any[], columnas: string[], nombreArchivo: string) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
|
|
3
|
+
import { Observable, throwError, TimeoutError, timer } from 'rxjs';
|
|
4
|
+
import { catchError, finalize, timeoutWith } from 'rxjs/operators';
|
|
5
|
+
import { SpinnerService } from '../spinner-service';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export class LoadingInterceptor implements HttpInterceptor {
|
|
12
|
+
|
|
13
|
+
constructor(private spinnerService: SpinnerService) {}
|
|
14
|
+
|
|
15
|
+
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>{
|
|
16
|
+
var spinnerActivated = false;
|
|
17
|
+
var timeElapsed: number = 0;
|
|
18
|
+
var intervalId: any;
|
|
19
|
+
intervalId = setInterval(() => {
|
|
20
|
+
timeElapsed++;
|
|
21
|
+
if (timeElapsed > 5 && !spinnerActivated) {
|
|
22
|
+
spinnerActivated = true;
|
|
23
|
+
this.spinnerService.show();
|
|
24
|
+
}
|
|
25
|
+
}, 1000);
|
|
26
|
+
|
|
27
|
+
return next.handle(req).pipe(
|
|
28
|
+
finalize(() => {
|
|
29
|
+
this.spinnerService.hide();
|
|
30
|
+
if (intervalId) {
|
|
31
|
+
clearInterval(intervalId);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root'
|
|
6
|
+
})
|
|
7
|
+
export class SpinnerService {
|
|
8
|
+
private spinnerSubject = new BehaviorSubject<boolean>(false);
|
|
9
|
+
spinner$ = this.spinnerSubject.asObservable();
|
|
10
|
+
|
|
11
|
+
show(): void {
|
|
12
|
+
this.spinnerSubject.next(true);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
hide(): void {
|
|
16
|
+
this.spinnerSubject.next(false);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -871,10 +871,6 @@ body {
|
|
|
871
871
|
padding: 5px;
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
-
// .p-toast.p-toast-top-right, .p-toast.p-toast-top-left, .p-toast.p-toast-top-center {
|
|
875
|
-
// z-index: 1105 !important;
|
|
876
|
-
// }
|
|
877
|
-
|
|
878
874
|
.my-toast.toast-text-small .p-toast-detail {
|
|
879
875
|
font-size: 0.7rem !important;
|
|
880
876
|
line-height: 18px !important;
|