tailjng 0.0.46 → 0.0.50
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/cli/settings/components-list.js +4 -0
- package/cli/settings/header-generator.js +1 -1
- package/fesm2022/tailjng.mjs +88 -25
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/interfaces/crud/api-response.d.ts +1 -1
- package/lib/interfaces/crud/crud.interface.d.ts +4 -0
- package/lib/services/crud/generic-crud.service.d.ts +4 -4
- package/lib/services/http/{error-handler-http.service.d.ts → errorHandler-http.service.d.ts} +6 -10
- package/lib/services/http/file-http.service.d.ts +27 -0
- package/package.json +2 -2
- package/public-api.d.ts +2 -1
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +7 -10
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +37 -8
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +13 -8
- package/src/lib/components/filter/filter-complete/complete-filter.component.ts +1 -1
- package/src/lib/components/icon/icon.component.css +0 -0
- package/src/lib/components/icon/icon.component.html +5 -0
- package/src/lib/components/icon/icon.component.ts +18 -0
- package/src/lib/components/progress-bar/progress-bar.component.html +22 -5
- package/src/lib/components/progress-bar/progress-bar.component.ts +1 -1
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +4 -2
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +4 -2
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.html +60 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.scss +0 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.ts +54 -0
- package/src/lib/components/table/table-complete/complete-table.component.ts +2 -2
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +108 -97
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +37 -18
- package/src/lib/components/toggle-radio/toggle-radio.component.ts +1 -1
|
@@ -90,6 +90,10 @@ function getComponentList() {
|
|
|
90
90
|
path: "src/lib/components/select/select-dropdown",
|
|
91
91
|
dependencies: [],
|
|
92
92
|
},
|
|
93
|
+
'sidebar-static': {
|
|
94
|
+
path: "src/lib/components/sidebar/sidebar-static",
|
|
95
|
+
dependencies: ["checkbox-switch"],
|
|
96
|
+
},
|
|
93
97
|
'form-container': {
|
|
94
98
|
path: "src/lib/components/form/form-container",
|
|
95
99
|
dependencies: [],
|
package/fesm2022/tailjng.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { InjectionToken, signal, computed, Injectable, Inject } from '@angular/c
|
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { formatDistanceToNowStrict } from 'date-fns';
|
|
5
5
|
import { es } from 'date-fns/locale';
|
|
6
|
-
import { map,
|
|
6
|
+
import { map, firstValueFrom, isObservable, forkJoin } from 'rxjs';
|
|
7
7
|
import * as i1$1 from '@angular/common/http';
|
|
8
8
|
import { HttpParams } from '@angular/common/http';
|
|
9
9
|
import { Link2Off, Link, Clipboard, CircleAlert, Clock, Calendar, EllipsisVertical, Trash, Edit, Pencil, PencilLine, ListRestart, FileUp, Download, MonitorUp, FileSpreadsheet, Cpu, Trash2, Eraser, ArrowDownWideNarrow, Filter, ArrowBigRight, ChevronsRight, ChevronRight, ChevronLeft, ChevronsLeft, Loader2, Moon, Sun, Save, Copy, Search, SquareDashedMousePointer, ChevronsUpDown, ChevronDown, ChevronUp, Eye, Upload, ImageOff, Images, Image, Minimize2, Scan, RefreshCcw, RotateCcw, RotateCw, ZoomOut, ZoomIn, Check, X, CircleHelp, TriangleAlert, CircleX, CircleCheck, Info } from 'lucide-angular';
|
|
@@ -943,7 +943,7 @@ class JGenericCrudService {
|
|
|
943
943
|
* @param params Parameters of the request.
|
|
944
944
|
* @returns Observable with the API response.
|
|
945
945
|
*/
|
|
946
|
-
|
|
946
|
+
findAll({ urlBase, endpoint, params }) {
|
|
947
947
|
const url = urlBase ? `${urlBase}/${endpoint}` : `${this.config.urlBase}/${endpoint}`;
|
|
948
948
|
let httpParams;
|
|
949
949
|
if (params)
|
|
@@ -957,7 +957,7 @@ class JGenericCrudService {
|
|
|
957
957
|
* @param id Identifier of the record.
|
|
958
958
|
* @returns Observable with the API response.
|
|
959
959
|
*/
|
|
960
|
-
|
|
960
|
+
findOne({ urlBase, endpoint, id }) {
|
|
961
961
|
const url = urlBase ? `${urlBase}/${endpoint}` : `${this.config.urlBase}/${endpoint}`;
|
|
962
962
|
return this.http.get(`${url}/${id}`).pipe(map(response => response.data[endpoint]));
|
|
963
963
|
}
|
|
@@ -1003,7 +1003,7 @@ class JGenericCrudService {
|
|
|
1003
1003
|
* @param data Data of a boolean record to update.
|
|
1004
1004
|
* @returns Observable with the API response.
|
|
1005
1005
|
*/
|
|
1006
|
-
|
|
1006
|
+
toggle({ urlBase, endpoint, id, data }) {
|
|
1007
1007
|
const url = urlBase ? `${urlBase}/${endpoint}` : `${this.config.urlBase}/${endpoint}`;
|
|
1008
1008
|
return this.http.put(`${url}/enable/${id}`, data);
|
|
1009
1009
|
}
|
|
@@ -1014,7 +1014,7 @@ class JGenericCrudService {
|
|
|
1014
1014
|
* @param data Data of multiple records to add.
|
|
1015
1015
|
* @returns Observable with the API response.
|
|
1016
1016
|
*/
|
|
1017
|
-
|
|
1017
|
+
createMany({ urlBase, endpoint, data }) {
|
|
1018
1018
|
const url = urlBase ? `${urlBase}/${endpoint}/bulk` : `${this.config.urlBase}/${endpoint}/bulk`;
|
|
1019
1019
|
return this.http.post(url, data);
|
|
1020
1020
|
}
|
|
@@ -1071,7 +1071,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1071
1071
|
args: [TAILJNG_CONFIG]
|
|
1072
1072
|
}] }, { type: i1$1.HttpClient }, { type: JParamsHttpService }, { type: JConverterCrudService }] });
|
|
1073
1073
|
|
|
1074
|
-
class
|
|
1074
|
+
class JFileHttpService {
|
|
1075
|
+
http;
|
|
1076
|
+
isImageAvailable = true;
|
|
1077
|
+
constructor(http) {
|
|
1078
|
+
this.http = http;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Obtener varias imágenes como Blob
|
|
1082
|
+
* @param files
|
|
1083
|
+
* @returns
|
|
1084
|
+
*/
|
|
1085
|
+
async getImagesBlob(files) {
|
|
1086
|
+
const blobs = files.map(file => {
|
|
1087
|
+
return file ? this.getImageBlob(file) : Promise.resolve(null);
|
|
1088
|
+
});
|
|
1089
|
+
return Promise.all(blobs).then(results => {
|
|
1090
|
+
// Regresar el array completo con los valores nulos en sus posiciones originales
|
|
1091
|
+
return results;
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Obtener la imagen como Blob (método original)
|
|
1096
|
+
* @param file
|
|
1097
|
+
* @returns
|
|
1098
|
+
*/
|
|
1099
|
+
getImageBlob(file) {
|
|
1100
|
+
return new Promise((resolve, reject) => {
|
|
1101
|
+
if (!file) {
|
|
1102
|
+
resolve(null);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
const reader = new FileReader();
|
|
1106
|
+
reader.onload = (event) => {
|
|
1107
|
+
const blob = new Blob([event.target.result], { type: file.type });
|
|
1108
|
+
resolve(blob);
|
|
1109
|
+
};
|
|
1110
|
+
reader.onerror = reject;
|
|
1111
|
+
reader.readAsArrayBuffer(file);
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Verificar la imagen
|
|
1116
|
+
* @param imageUrl
|
|
1117
|
+
* @returns
|
|
1118
|
+
*/
|
|
1119
|
+
async checkImageAvailability(imageUrl) {
|
|
1120
|
+
if (!imageUrl)
|
|
1121
|
+
return Promise.resolve(false);
|
|
1122
|
+
return firstValueFrom(this.http.get(imageUrl, { observe: 'response', responseType: 'blob' })).then(resp => resp.status === 200)
|
|
1123
|
+
.catch(() => false);
|
|
1124
|
+
}
|
|
1125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFileHttpService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1126
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFileHttpService, providedIn: 'root' });
|
|
1127
|
+
}
|
|
1128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFileHttpService, decorators: [{
|
|
1129
|
+
type: Injectable,
|
|
1130
|
+
args: [{
|
|
1131
|
+
providedIn: 'root'
|
|
1132
|
+
}]
|
|
1133
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
|
1134
|
+
|
|
1135
|
+
class JErrorHandlerHttpService {
|
|
1075
1136
|
/**
|
|
1076
1137
|
* Map HTTP status codes to user-friendly messages and alert types.
|
|
1077
1138
|
* This mapping helps in providing consistent error messages across the application.
|
|
@@ -1093,35 +1154,36 @@ class ErrorHandlerHttpService {
|
|
|
1093
1154
|
* @returns A structured error message.
|
|
1094
1155
|
*/
|
|
1095
1156
|
handleHttpError(error) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
type: 'error',
|
|
1101
|
-
title: 'Error desconocido',
|
|
1102
|
-
message: 'Ocurrió un error inesperado. Intente de nuevo más tarde.',
|
|
1103
|
-
persistent: true
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
const status = error?.status || 0;
|
|
1107
|
-
const backendMessage = error?.error?.msg || error?.message;
|
|
1157
|
+
const status = error.status;
|
|
1158
|
+
const backendMessage = (error?.error?.message || error?.error?.msg) ?? 'Ocurrió un error inesperado. Intente de nuevo más tarde.';
|
|
1159
|
+
const fields = error?.error?.fields ?? []; // Extraer los campos de error (si existen)
|
|
1160
|
+
// Obtener la información del error o usar un mensaje genérico
|
|
1108
1161
|
const errorInfo = this.errorMappings[status] || {
|
|
1109
1162
|
title: 'Error desconocido',
|
|
1110
|
-
message:
|
|
1163
|
+
message: backendMessage,
|
|
1111
1164
|
type: 'error',
|
|
1112
1165
|
persistent: true
|
|
1113
1166
|
};
|
|
1167
|
+
// Concatenar mensajes de los campos en 'fields' si existen
|
|
1168
|
+
let fieldsMessages = '';
|
|
1169
|
+
fields.forEach((fieldError) => {
|
|
1170
|
+
if (fieldError.info) {
|
|
1171
|
+
fieldsMessages += `<br>- ${fieldError.info}`;
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
// Si existen mensajes adicionales de los campos, los agregamos al mensaje principal
|
|
1175
|
+
const finalMessage = backendMessage + (fieldsMessages ? `<br><br>Detalles del campo:${fieldsMessages}` : '');
|
|
1114
1176
|
return {
|
|
1115
1177
|
type: errorInfo.type,
|
|
1116
1178
|
title: errorInfo.title,
|
|
1117
|
-
message:
|
|
1179
|
+
message: finalMessage, // Mensaje final con detalles adicionales
|
|
1118
1180
|
persistent: errorInfo.persistent
|
|
1119
1181
|
};
|
|
1120
1182
|
}
|
|
1121
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type:
|
|
1122
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type:
|
|
1183
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JErrorHandlerHttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1184
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JErrorHandlerHttpService, providedIn: 'root' });
|
|
1123
1185
|
}
|
|
1124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type:
|
|
1186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JErrorHandlerHttpService, decorators: [{
|
|
1125
1187
|
type: Injectable,
|
|
1126
1188
|
args: [{
|
|
1127
1189
|
providedIn: 'root'
|
|
@@ -1792,7 +1854,7 @@ class JUploadFilterService {
|
|
|
1792
1854
|
limit: 1000000,
|
|
1793
1855
|
filters: { ...defaultFilters }
|
|
1794
1856
|
});
|
|
1795
|
-
return this.genericService.
|
|
1857
|
+
return this.genericService.findAll({ endpoint: key, params }).pipe(map((response) => ({
|
|
1796
1858
|
key,
|
|
1797
1859
|
data: response.data[key] ?? [],
|
|
1798
1860
|
mappingInfo: obj
|
|
@@ -2011,10 +2073,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2011
2073
|
// cd dist/tailjng
|
|
2012
2074
|
// npm publish --access public
|
|
2013
2075
|
// npx tailjng add [component]
|
|
2076
|
+
// npm login
|
|
2014
2077
|
|
|
2015
2078
|
/**
|
|
2016
2079
|
* Generated bundle index. Do not edit.
|
|
2017
2080
|
*/
|
|
2018
2081
|
|
|
2019
|
-
export {
|
|
2082
|
+
export { JAlertDialogService, JAlertToastService, JCalendarService, JConverterCrudService, JDialogShared, JErrorHandlerHttpService, JExcelFilterService, JExcelService, JFileHttpService, JFormShared, JGenericCrudService, JIconsService, JParamsHttpService, JThemeService, JTransformService, JUploadFilterService, TAILJNG_CONFIG };
|
|
2020
2083
|
//# sourceMappingURL=tailjng.mjs.map
|