ngx-dsxlibrary 2.21.59 → 2.21.60
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.
|
@@ -3676,7 +3676,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3676
3676
|
const defaults = {
|
|
3677
3677
|
title: '',
|
|
3678
3678
|
message: '',
|
|
3679
|
-
dataPreview: undefined,
|
|
3680
3679
|
icon: undefined,
|
|
3681
3680
|
confirmButtonText: undefined,
|
|
3682
3681
|
cancelButtonText: undefined,
|
|
@@ -3690,7 +3689,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3690
3689
|
title: '¿Archivar registro?',
|
|
3691
3690
|
message: 'El registro dejará de estar visible en las listas principales, pero podrás recuperarlo más tarde.' +
|
|
3692
3691
|
(dataPreview ? `<br>${dataPreview}` : ''),
|
|
3693
|
-
dataPreview,
|
|
3694
3692
|
icono: 'icon/folder01.png',
|
|
3695
3693
|
confirmButtonText: 'Archivar',
|
|
3696
3694
|
cancelButtonText: 'Cancelar',
|
|
@@ -3704,7 +3702,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3704
3702
|
title: '¿Restaurar registro?',
|
|
3705
3703
|
message: 'El registro volverá a estar <strong>activo</strong> y visible en todas las listas principales del sistema.' +
|
|
3706
3704
|
(dataPreview ? `<br>${dataPreview}` : ''),
|
|
3707
|
-
dataPreview,
|
|
3708
3705
|
icono: 'icon/documentation.png',
|
|
3709
3706
|
confirmButtonText: 'Sí, restaurar',
|
|
3710
3707
|
cancelButtonText: 'Dejar archivado',
|
|
@@ -3719,7 +3716,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3719
3716
|
title: '¿Eliminar permanentemente?',
|
|
3720
3717
|
message: 'Esta acción <strong>no se puede deshacer</strong>. Se perderán todos los datos asociados a este registro de forma inmediata.' +
|
|
3721
3718
|
(dataPreview ? `<br>${dataPreview}` : ''),
|
|
3722
|
-
dataPreview,
|
|
3723
3719
|
icono: 'icon/delete.png',
|
|
3724
3720
|
confirmButtonText: 'Eliminar permanentemente',
|
|
3725
3721
|
cancelButtonText: 'Cancelar',
|
|
@@ -3733,7 +3729,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3733
3729
|
title: '¿Guardar registro?',
|
|
3734
3730
|
message: 'El nuevo registro se guardará en el sistema.' +
|
|
3735
3731
|
(dataPreview ? `<br>${dataPreview}` : ''),
|
|
3736
|
-
dataPreview,
|
|
3737
3732
|
icono: 'icon2/save_2029637.png',
|
|
3738
3733
|
confirmButtonText: 'Guardar',
|
|
3739
3734
|
cancelButtonText: 'Cancelar',
|
|
@@ -3747,7 +3742,6 @@ function getActionMessageConfig(action, secondArg, thirdArg) {
|
|
|
3747
3742
|
title: '¿Actualizar registro?',
|
|
3748
3743
|
message: 'Los cambios realizados se actualizarán en el sistema.' +
|
|
3749
3744
|
(dataPreview ? `<br>${dataPreview}` : ''),
|
|
3750
|
-
dataPreview,
|
|
3751
3745
|
icono: 'icon2/save_2029637.png',
|
|
3752
3746
|
confirmButtonText: 'Actualizar',
|
|
3753
3747
|
cancelButtonText: 'Cancelar',
|
|
@@ -6060,7 +6054,7 @@ class ScrollTableService {
|
|
|
6060
6054
|
* @param marginBottom Margen de seguridad inferior (por defecto 75px para paginadores)
|
|
6061
6055
|
* @param minHeight Altura mínima permitida para evitar valores muy pequeños o negativos
|
|
6062
6056
|
*/
|
|
6063
|
-
calculateAvailableHeight(element, marginBottom = 75, minHeight =
|
|
6057
|
+
calculateAvailableHeight(element, marginBottom = 75, minHeight = 200) {
|
|
6064
6058
|
const safeMinHeight = Number.isFinite(minHeight)
|
|
6065
6059
|
? Math.max(100, Math.floor(minHeight))
|
|
6066
6060
|
: 300;
|
|
@@ -6098,13 +6092,25 @@ class AutoScrollHeightDirective {
|
|
|
6098
6092
|
marginBottom = input(75, ...(ngDevMode ? [{ debugName: "marginBottom" }] : /* istanbul ignore next */ []));
|
|
6099
6093
|
// Altura mínima de seguridad para evitar valores demasiado pequeños
|
|
6100
6094
|
minHeight = input(300, ...(ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []));
|
|
6095
|
+
// Parámetros para estimar filas visibles en la tabla sin afectar el layout del contenedor.
|
|
6096
|
+
rowHeight = input(40, ...(ngDevMode ? [{ debugName: "rowHeight" }] : /* istanbul ignore next */ []));
|
|
6097
|
+
tableChromeReserve = input(210, ...(ngDevMode ? [{ debugName: "tableChromeReserve" }] : /* istanbul ignore next */ []));
|
|
6098
|
+
minRows = input(6, ...(ngDevMode ? [{ debugName: "minRows" }] : /* istanbul ignore next */ []));
|
|
6099
|
+
maxRows = input(25, ...(ngDevMode ? [{ debugName: "maxRows" }] : /* istanbul ignore next */ []));
|
|
6100
|
+
tableScrollMinHeight = input(140, ...(ngDevMode ? [{ debugName: "tableScrollMinHeight" }] : /* istanbul ignore next */ []));
|
|
6101
6101
|
// Evento que emite el string de píxeles resultante (ej: "520px")
|
|
6102
6102
|
heightCalculated = output();
|
|
6103
|
+
// Evento opcional con la cantidad de filas recomendadas para el alto actual.
|
|
6104
|
+
rowsCalculated = output();
|
|
6105
|
+
// Evento opcional con altura específica para [scrollHeight] de p-table.
|
|
6106
|
+
tableScrollHeightCalculated = output();
|
|
6103
6107
|
ngZone = inject(NgZone);
|
|
6104
6108
|
scrollService = inject(ScrollTableService);
|
|
6105
6109
|
resizeObserver;
|
|
6106
6110
|
rafId = null;
|
|
6107
6111
|
lastEmittedHeight = null;
|
|
6112
|
+
lastEmittedRows = null;
|
|
6113
|
+
lastEmittedTableScrollHeight = null;
|
|
6108
6114
|
pendingTimeouts = new Set();
|
|
6109
6115
|
isInitializing = true;
|
|
6110
6116
|
pendingInitialHeight = null;
|
|
@@ -6150,10 +6156,7 @@ class AutoScrollHeightDirective {
|
|
|
6150
6156
|
this.isInitializing = false;
|
|
6151
6157
|
// Emite una sola vez el último valor estable de la fase inicial.
|
|
6152
6158
|
if (this.pendingInitialHeight !== null) {
|
|
6153
|
-
|
|
6154
|
-
this.lastEmittedHeight = this.pendingInitialHeight;
|
|
6155
|
-
this.emitHeight(this.pendingInitialHeight);
|
|
6156
|
-
}
|
|
6159
|
+
this.publishMetrics(this.pendingInitialHeight);
|
|
6157
6160
|
this.pendingInitialHeight = null;
|
|
6158
6161
|
}
|
|
6159
6162
|
}, delayMs);
|
|
@@ -6190,16 +6193,31 @@ class AutoScrollHeightDirective {
|
|
|
6190
6193
|
this.rafId = null;
|
|
6191
6194
|
}
|
|
6192
6195
|
recalcular() {
|
|
6196
|
+
if (!this.isHostVisible()) {
|
|
6197
|
+
return;
|
|
6198
|
+
}
|
|
6193
6199
|
const alturaCalculada = this.scrollService.calculateAvailableHeight(this.el.nativeElement, this.marginBottom(), this.minHeight());
|
|
6194
6200
|
if (this.isInitializing) {
|
|
6195
6201
|
this.pendingInitialHeight = alturaCalculada;
|
|
6196
6202
|
return;
|
|
6197
6203
|
}
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
this.lastEmittedHeight
|
|
6202
|
-
|
|
6204
|
+
this.publishMetrics(alturaCalculada);
|
|
6205
|
+
}
|
|
6206
|
+
publishMetrics(height) {
|
|
6207
|
+
if (this.lastEmittedHeight !== height) {
|
|
6208
|
+
this.lastEmittedHeight = height;
|
|
6209
|
+
this.emitHeight(height);
|
|
6210
|
+
}
|
|
6211
|
+
const suggestedRows = this.calculateSuggestedRows(height);
|
|
6212
|
+
if (this.lastEmittedRows !== suggestedRows) {
|
|
6213
|
+
this.lastEmittedRows = suggestedRows;
|
|
6214
|
+
this.emitRows(suggestedRows);
|
|
6215
|
+
}
|
|
6216
|
+
const suggestedTableScrollHeight = this.calculateTableScrollHeight(suggestedRows);
|
|
6217
|
+
if (this.lastEmittedTableScrollHeight !== suggestedTableScrollHeight) {
|
|
6218
|
+
this.lastEmittedTableScrollHeight = suggestedTableScrollHeight;
|
|
6219
|
+
this.emitTableScrollHeight(suggestedTableScrollHeight);
|
|
6220
|
+
}
|
|
6203
6221
|
}
|
|
6204
6222
|
emitHeight(value) {
|
|
6205
6223
|
if (NgZone.isInAngularZone()) {
|
|
@@ -6210,15 +6228,121 @@ class AutoScrollHeightDirective {
|
|
|
6210
6228
|
this.heightCalculated.emit(value);
|
|
6211
6229
|
});
|
|
6212
6230
|
}
|
|
6231
|
+
emitRows(value) {
|
|
6232
|
+
if (NgZone.isInAngularZone()) {
|
|
6233
|
+
this.rowsCalculated.emit(value);
|
|
6234
|
+
return;
|
|
6235
|
+
}
|
|
6236
|
+
this.ngZone.run(() => {
|
|
6237
|
+
this.rowsCalculated.emit(value);
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6240
|
+
emitTableScrollHeight(value) {
|
|
6241
|
+
if (NgZone.isInAngularZone()) {
|
|
6242
|
+
this.tableScrollHeightCalculated.emit(value);
|
|
6243
|
+
return;
|
|
6244
|
+
}
|
|
6245
|
+
this.ngZone.run(() => {
|
|
6246
|
+
this.tableScrollHeightCalculated.emit(value);
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6249
|
+
calculateSuggestedRows(heightPxString) {
|
|
6250
|
+
const availablePx = this.parsePx(heightPxString, this.minHeight());
|
|
6251
|
+
const rowPx = Math.max(20, Math.floor(this.rowHeight()));
|
|
6252
|
+
const reservePx = this.getEffectiveTableChromeReserve();
|
|
6253
|
+
const minRows = Math.max(1, Math.floor(this.minRows()));
|
|
6254
|
+
const maxRows = Math.max(minRows, this.getEffectiveMaxRows(minRows));
|
|
6255
|
+
const usablePx = Math.max(0, availablePx - reservePx);
|
|
6256
|
+
const calculated = Math.max(minRows, Math.floor(usablePx / rowPx));
|
|
6257
|
+
return Math.min(calculated, maxRows);
|
|
6258
|
+
}
|
|
6259
|
+
getEffectiveMaxRows(minRows) {
|
|
6260
|
+
const baseMaxRows = Math.max(minRows, Math.floor(this.maxRows()));
|
|
6261
|
+
if (typeof window === 'undefined') {
|
|
6262
|
+
return baseMaxRows;
|
|
6263
|
+
}
|
|
6264
|
+
const viewportHeight = window.innerHeight;
|
|
6265
|
+
if (viewportHeight <= 640) {
|
|
6266
|
+
return Math.min(baseMaxRows, 8);
|
|
6267
|
+
}
|
|
6268
|
+
if (viewportHeight <= 700) {
|
|
6269
|
+
return Math.min(baseMaxRows, 10);
|
|
6270
|
+
}
|
|
6271
|
+
if (viewportHeight <= 760) {
|
|
6272
|
+
return Math.min(baseMaxRows, 12);
|
|
6273
|
+
}
|
|
6274
|
+
return baseMaxRows;
|
|
6275
|
+
}
|
|
6276
|
+
getEffectiveTableChromeReserve() {
|
|
6277
|
+
const baseReserve = Math.max(0, Math.floor(this.tableChromeReserve()));
|
|
6278
|
+
if (typeof window === 'undefined') {
|
|
6279
|
+
return baseReserve;
|
|
6280
|
+
}
|
|
6281
|
+
const viewportHeight = window.innerHeight;
|
|
6282
|
+
// En pantallas bajas reservamos más espacio para asegurar paginador dentro del bloque gris.
|
|
6283
|
+
if (viewportHeight <= 640) {
|
|
6284
|
+
return 200;
|
|
6285
|
+
}
|
|
6286
|
+
if (viewportHeight <= 700) {
|
|
6287
|
+
return baseReserve + 56;
|
|
6288
|
+
}
|
|
6289
|
+
if (viewportHeight <= 760) {
|
|
6290
|
+
return baseReserve + 32;
|
|
6291
|
+
}
|
|
6292
|
+
// En pantallas altas se puede reservar menos "chrome" para permitir más filas visibles.
|
|
6293
|
+
if (viewportHeight > 820) {
|
|
6294
|
+
return Math.max(120, baseReserve - 80);
|
|
6295
|
+
}
|
|
6296
|
+
if (viewportHeight > 700) {
|
|
6297
|
+
return Math.max(140, baseReserve - 40);
|
|
6298
|
+
}
|
|
6299
|
+
// En pantallas bajas conservamos reserva completa para no tapar paginación.
|
|
6300
|
+
return baseReserve;
|
|
6301
|
+
}
|
|
6302
|
+
parsePx(value, fallback) {
|
|
6303
|
+
const parsed = Number.parseInt(value, 10);
|
|
6304
|
+
if (!Number.isFinite(parsed)) {
|
|
6305
|
+
return Math.max(0, Math.floor(fallback));
|
|
6306
|
+
}
|
|
6307
|
+
return Math.max(0, Math.floor(parsed));
|
|
6308
|
+
}
|
|
6309
|
+
calculateTableScrollHeight(suggestedRows) {
|
|
6310
|
+
const rowPx = Math.max(20, Math.floor(this.rowHeight()));
|
|
6311
|
+
const minHeightPx = Math.max(120, Math.floor(this.tableScrollMinHeight()));
|
|
6312
|
+
const viewportHeight = typeof window !== 'undefined' ? window.innerHeight : 0;
|
|
6313
|
+
const lowViewportAdjustment = viewportHeight > 0 && viewportHeight <= 640 ? 40 : 24;
|
|
6314
|
+
const calculatedPx = Math.max(minHeightPx, suggestedRows * rowPx - lowViewportAdjustment);
|
|
6315
|
+
return `${calculatedPx}px`;
|
|
6316
|
+
}
|
|
6317
|
+
isHostVisible() {
|
|
6318
|
+
if (typeof window === 'undefined') {
|
|
6319
|
+
return true;
|
|
6320
|
+
}
|
|
6321
|
+
const host = this.el.nativeElement;
|
|
6322
|
+
if (!host.isConnected) {
|
|
6323
|
+
return false;
|
|
6324
|
+
}
|
|
6325
|
+
if (host.getClientRects().length === 0) {
|
|
6326
|
+
return false;
|
|
6327
|
+
}
|
|
6328
|
+
const style = window.getComputedStyle(host);
|
|
6329
|
+
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
6330
|
+
return false;
|
|
6331
|
+
}
|
|
6332
|
+
if (host.offsetParent === null && style.position !== 'fixed') {
|
|
6333
|
+
return false;
|
|
6334
|
+
}
|
|
6335
|
+
return true;
|
|
6336
|
+
}
|
|
6213
6337
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: AutoScrollHeightDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6214
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: AutoScrollHeightDirective, isStandalone: true, selector: "[appAutoScrollHeight]", inputs: { marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { heightCalculated: "heightCalculated" }, host: { listeners: { "window:resize": "onResize()" } }, ngImport: i0 });
|
|
6338
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: AutoScrollHeightDirective, isStandalone: true, selector: "[appAutoScrollHeight]", inputs: { marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, tableChromeReserve: { classPropertyName: "tableChromeReserve", publicName: "tableChromeReserve", isSignal: true, isRequired: false, transformFunction: null }, minRows: { classPropertyName: "minRows", publicName: "minRows", isSignal: true, isRequired: false, transformFunction: null }, maxRows: { classPropertyName: "maxRows", publicName: "maxRows", isSignal: true, isRequired: false, transformFunction: null }, tableScrollMinHeight: { classPropertyName: "tableScrollMinHeight", publicName: "tableScrollMinHeight", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { heightCalculated: "heightCalculated", rowsCalculated: "rowsCalculated", tableScrollHeightCalculated: "tableScrollHeightCalculated" }, host: { listeners: { "window:resize": "onResize()" } }, ngImport: i0 });
|
|
6215
6339
|
}
|
|
6216
6340
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: AutoScrollHeightDirective, decorators: [{
|
|
6217
6341
|
type: Directive,
|
|
6218
6342
|
args: [{
|
|
6219
6343
|
selector: '[appAutoScrollHeight]',
|
|
6220
6344
|
}]
|
|
6221
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { marginBottom: [{ type: i0.Input, args: [{ isSignal: true, alias: "marginBottom", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], heightCalculated: [{ type: i0.Output, args: ["heightCalculated"] }], onResize: [{
|
|
6345
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { marginBottom: [{ type: i0.Input, args: [{ isSignal: true, alias: "marginBottom", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], tableChromeReserve: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableChromeReserve", required: false }] }], minRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "minRows", required: false }] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", required: false }] }], tableScrollMinHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableScrollMinHeight", required: false }] }], heightCalculated: [{ type: i0.Output, args: ["heightCalculated"] }], rowsCalculated: [{ type: i0.Output, args: ["rowsCalculated"] }], tableScrollHeightCalculated: [{ type: i0.Output, args: ["tableScrollHeightCalculated"] }], onResize: [{
|
|
6222
6346
|
type: HostListener,
|
|
6223
6347
|
args: ['window:resize']
|
|
6224
6348
|
}] } });
|
|
@@ -6394,6 +6518,328 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
|
|
|
6394
6518
|
}]
|
|
6395
6519
|
}] });
|
|
6396
6520
|
|
|
6521
|
+
class TablePreviewService {
|
|
6522
|
+
directivasRegistradas = new Set();
|
|
6523
|
+
rows = signal([], ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
6524
|
+
registrarDirectiva(instancia) {
|
|
6525
|
+
this.directivasRegistradas.add(instancia);
|
|
6526
|
+
}
|
|
6527
|
+
removerDirectiva(instancia) {
|
|
6528
|
+
this.directivasRegistradas.delete(instancia);
|
|
6529
|
+
}
|
|
6530
|
+
recolectarDatosTabla() {
|
|
6531
|
+
const lista = [];
|
|
6532
|
+
this.directivasRegistradas.forEach((directiva) => {
|
|
6533
|
+
const row = directiva.obtenerCapturaEstatica?.();
|
|
6534
|
+
if (row && row.cells?.length) {
|
|
6535
|
+
lista.push(row);
|
|
6536
|
+
}
|
|
6537
|
+
});
|
|
6538
|
+
this.rows.set(lista);
|
|
6539
|
+
}
|
|
6540
|
+
buildTableRowsSummaryHtml(options = {}) {
|
|
6541
|
+
const rows = this.rows();
|
|
6542
|
+
if (!rows || rows.length === 0) {
|
|
6543
|
+
return '';
|
|
6544
|
+
}
|
|
6545
|
+
return this.buildHtmlFromRows(rows, options.showLabel ?? false);
|
|
6546
|
+
}
|
|
6547
|
+
limpiar() {
|
|
6548
|
+
this.rows.set([]);
|
|
6549
|
+
this.directivasRegistradas.clear();
|
|
6550
|
+
}
|
|
6551
|
+
/**
|
|
6552
|
+
* Alternativa directa para casos en botones de fila:
|
|
6553
|
+
* construye el HTML sin depender de directivas ni del ciclo de detección de Angular.
|
|
6554
|
+
*/
|
|
6555
|
+
buildSingleRowSummaryHtml(row, columns, options = {}) {
|
|
6556
|
+
if (!row || !columns || columns.length === 0) {
|
|
6557
|
+
return '';
|
|
6558
|
+
}
|
|
6559
|
+
const includeEmpty = options.includeEmpty ?? false;
|
|
6560
|
+
const headerMap = options.headerMap ?? {};
|
|
6561
|
+
const resolvedColumns = columns
|
|
6562
|
+
.map((column) => typeof column === 'string' ? { key: column.trim() } : column)
|
|
6563
|
+
.filter((column) => (column.key || '').trim().length > 0);
|
|
6564
|
+
const cells = [];
|
|
6565
|
+
for (const column of resolvedColumns) {
|
|
6566
|
+
const key = (column.key || '').trim();
|
|
6567
|
+
const rawValue = this.getValueByPath(row, key);
|
|
6568
|
+
const valueText = this.normalizeValue(rawValue);
|
|
6569
|
+
if (!includeEmpty && valueText.trim() === '') {
|
|
6570
|
+
continue;
|
|
6571
|
+
}
|
|
6572
|
+
const label = headerMap[key]?.trim() || column.label?.trim() || this.humanizeKey(key);
|
|
6573
|
+
cells.push({ key, label, value: valueText });
|
|
6574
|
+
}
|
|
6575
|
+
if (cells.length === 0) {
|
|
6576
|
+
return '';
|
|
6577
|
+
}
|
|
6578
|
+
const summary = {
|
|
6579
|
+
rowId: (options.rowId || 'seleccionada').trim(),
|
|
6580
|
+
cells,
|
|
6581
|
+
};
|
|
6582
|
+
return this.buildHtmlFromRows([summary], options.showLabel ?? false);
|
|
6583
|
+
}
|
|
6584
|
+
buildHtmlFromRows(rows, showLabel) {
|
|
6585
|
+
const bodyHtml = rows
|
|
6586
|
+
.map((row) => {
|
|
6587
|
+
const rowSpan = Math.max(1, row.cells.length);
|
|
6588
|
+
return row.cells
|
|
6589
|
+
.map((cell, cellIndex) => {
|
|
6590
|
+
const filaCell = cellIndex === 0
|
|
6591
|
+
? `
|
|
6592
|
+
<td rowspan="${rowSpan}" style="padding: 8px; text-align: center; vertical-align: top; color: #495057; font-size: 0.8rem; border-right: 1px solid #f0f0f0;">
|
|
6593
|
+
<div style="font-weight: 700; color: #212529;">${row.rowId}</div>
|
|
6594
|
+
</td>
|
|
6595
|
+
`
|
|
6596
|
+
: '';
|
|
6597
|
+
return `
|
|
6598
|
+
<tr style="border-bottom: 1px solid #f0f0f0;">
|
|
6599
|
+
${filaCell}
|
|
6600
|
+
${showLabel
|
|
6601
|
+
? `<td style="padding: 8px; text-align: left; color: #6c757d; font-size: 0.85rem;">${cell.label}</td>`
|
|
6602
|
+
: ''}
|
|
6603
|
+
<td style="padding: 8px; text-align: left; font-weight: 500; color: #212529; font-size: 0.85rem;">${cell.value || '---'}</td>
|
|
6604
|
+
</tr>
|
|
6605
|
+
`;
|
|
6606
|
+
})
|
|
6607
|
+
.join('');
|
|
6608
|
+
})
|
|
6609
|
+
.join('');
|
|
6610
|
+
return `
|
|
6611
|
+
<div style="margin-top: 12px; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; font-family: sans-serif;">
|
|
6612
|
+
<table style="width: 100%; border-collapse: collapse; background-color: #ffffff;">
|
|
6613
|
+
<thead style="background-color: #f8f9fa; border-bottom: 1px solid #e0e0e0;">
|
|
6614
|
+
<tr>
|
|
6615
|
+
<th style="padding: 8px; text-align: center; font-size: 0.85rem; font-weight: 600; color: #495057; width: 84px;">Fila</th>
|
|
6616
|
+
${showLabel
|
|
6617
|
+
? '<th style="padding: 8px; text-align: left; font-size: 0.85rem; font-weight: 600; color: #495057;">Etiqueta</th>'
|
|
6618
|
+
: ''}
|
|
6619
|
+
<th style="padding: 8px; text-align: left; font-size: 0.85rem; font-weight: 600; color: #495057;">Valor</th>
|
|
6620
|
+
</tr>
|
|
6621
|
+
</thead>
|
|
6622
|
+
<tbody>
|
|
6623
|
+
${bodyHtml}
|
|
6624
|
+
</tbody>
|
|
6625
|
+
</table>
|
|
6626
|
+
</div>
|
|
6627
|
+
`;
|
|
6628
|
+
}
|
|
6629
|
+
getValueByPath(source, path) {
|
|
6630
|
+
const parts = path
|
|
6631
|
+
.split('.')
|
|
6632
|
+
.map((p) => p.trim())
|
|
6633
|
+
.filter(Boolean);
|
|
6634
|
+
let current = source;
|
|
6635
|
+
for (const part of parts) {
|
|
6636
|
+
if (current === null || current === undefined) {
|
|
6637
|
+
return null;
|
|
6638
|
+
}
|
|
6639
|
+
if (typeof current !== 'object') {
|
|
6640
|
+
return null;
|
|
6641
|
+
}
|
|
6642
|
+
current = current[part];
|
|
6643
|
+
}
|
|
6644
|
+
return current;
|
|
6645
|
+
}
|
|
6646
|
+
normalizeValue(value) {
|
|
6647
|
+
if (value === null || value === undefined) {
|
|
6648
|
+
return '';
|
|
6649
|
+
}
|
|
6650
|
+
if (value instanceof Date) {
|
|
6651
|
+
return value.toISOString();
|
|
6652
|
+
}
|
|
6653
|
+
if (typeof value === 'object') {
|
|
6654
|
+
try {
|
|
6655
|
+
return JSON.stringify(value);
|
|
6656
|
+
}
|
|
6657
|
+
catch {
|
|
6658
|
+
return String(value);
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
return String(value);
|
|
6662
|
+
}
|
|
6663
|
+
humanizeKey(key) {
|
|
6664
|
+
if (!key)
|
|
6665
|
+
return '';
|
|
6666
|
+
const spaced = key
|
|
6667
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
6668
|
+
.replace(/[_.-]+/g, ' ')
|
|
6669
|
+
.trim();
|
|
6670
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
6671
|
+
}
|
|
6672
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: TablePreviewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6673
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: TablePreviewService, providedIn: 'root' });
|
|
6674
|
+
}
|
|
6675
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: TablePreviewService, decorators: [{
|
|
6676
|
+
type: Injectable,
|
|
6677
|
+
args: [{
|
|
6678
|
+
providedIn: 'root',
|
|
6679
|
+
}]
|
|
6680
|
+
}] });
|
|
6681
|
+
|
|
6682
|
+
class CaptureTableRowDirective {
|
|
6683
|
+
// Objeto de la fila actual (ej: item de p-table)
|
|
6684
|
+
appCaptureTableRow = input(null, ...(ngDevMode ? [{ debugName: "appCaptureTableRow" }] : /* istanbul ignore next */ []));
|
|
6685
|
+
// Columnas a capturar para el resumen del mensaje.
|
|
6686
|
+
// Puede recibir solo keys (string) para no duplicar labels en cada pantalla.
|
|
6687
|
+
captureTableColumns = input([], ...(ngDevMode ? [{ debugName: "captureTableColumns" }] : /* istanbul ignore next */ []));
|
|
6688
|
+
// Columnas a excluir del resumen (prioridad alta sobre la lista de captura).
|
|
6689
|
+
captureTableExcludeKeys = input([], ...(ngDevMode ? [{ debugName: "captureTableExcludeKeys" }] : /* istanbul ignore next */ []));
|
|
6690
|
+
// Si no se define captureTableColumns, por defecto NO captura nada
|
|
6691
|
+
// (solo captura columnas explícitas para evitar ruido).
|
|
6692
|
+
captureUseObjectKeysWhenColumnsEmpty = input(false, ...(ngDevMode ? [{ debugName: "captureUseObjectKeysWhenColumnsEmpty" }] : /* istanbul ignore next */ []));
|
|
6693
|
+
// Mapa opcional de labels por key para ajustes puntuales.
|
|
6694
|
+
captureTableHeaderMap = input({}, ...(ngDevMode ? [{ debugName: "captureTableHeaderMap" }] : /* istanbul ignore next */ []));
|
|
6695
|
+
// Identificador opcional de fila para encabezado visual
|
|
6696
|
+
captureTableRowId = input('seleccionada', ...(ngDevMode ? [{ debugName: "captureTableRowId" }] : /* istanbul ignore next */ []));
|
|
6697
|
+
// Si es false, omite columnas vacias del resumen
|
|
6698
|
+
captureIncludeEmpty = input(false, ...(ngDevMode ? [{ debugName: "captureIncludeEmpty" }] : /* istanbul ignore next */ []));
|
|
6699
|
+
previewService = inject(TablePreviewService);
|
|
6700
|
+
el = inject(ElementRef);
|
|
6701
|
+
ngOnInit() {
|
|
6702
|
+
this.previewService.registrarDirectiva(this);
|
|
6703
|
+
}
|
|
6704
|
+
ngOnDestroy() {
|
|
6705
|
+
this.previewService.removerDirectiva(this);
|
|
6706
|
+
}
|
|
6707
|
+
obtenerCapturaEstatica() {
|
|
6708
|
+
const row = this.appCaptureTableRow();
|
|
6709
|
+
const columns = this.resolveColumns(row);
|
|
6710
|
+
const headerLabels = this.getHeaderLabels();
|
|
6711
|
+
if (!row || !columns || columns.length === 0) {
|
|
6712
|
+
return null;
|
|
6713
|
+
}
|
|
6714
|
+
const cells = [];
|
|
6715
|
+
columns.forEach((column, index) => {
|
|
6716
|
+
const rawValue = this.getValueByPath(row, column.key);
|
|
6717
|
+
const valueText = this.normalizeValue(rawValue);
|
|
6718
|
+
if (!this.captureIncludeEmpty() && valueText.trim() === '') {
|
|
6719
|
+
return;
|
|
6720
|
+
}
|
|
6721
|
+
cells.push({
|
|
6722
|
+
key: column.key,
|
|
6723
|
+
label: this.resolveLabel(column, index, headerLabels),
|
|
6724
|
+
value: valueText,
|
|
6725
|
+
});
|
|
6726
|
+
});
|
|
6727
|
+
if (cells.length === 0) {
|
|
6728
|
+
return null;
|
|
6729
|
+
}
|
|
6730
|
+
const rowId = (this.captureTableRowId() || 'seleccionada').trim();
|
|
6731
|
+
return {
|
|
6732
|
+
rowId,
|
|
6733
|
+
cells,
|
|
6734
|
+
};
|
|
6735
|
+
}
|
|
6736
|
+
getValueByPath(source, path) {
|
|
6737
|
+
const parts = path
|
|
6738
|
+
.split('.')
|
|
6739
|
+
.map((p) => p.trim())
|
|
6740
|
+
.filter(Boolean);
|
|
6741
|
+
let current = source;
|
|
6742
|
+
for (const part of parts) {
|
|
6743
|
+
if (current === null || current === undefined) {
|
|
6744
|
+
return null;
|
|
6745
|
+
}
|
|
6746
|
+
if (typeof current !== 'object') {
|
|
6747
|
+
return null;
|
|
6748
|
+
}
|
|
6749
|
+
current = current[part];
|
|
6750
|
+
}
|
|
6751
|
+
return current;
|
|
6752
|
+
}
|
|
6753
|
+
normalizeValue(value) {
|
|
6754
|
+
if (value === null || value === undefined) {
|
|
6755
|
+
return '';
|
|
6756
|
+
}
|
|
6757
|
+
if (value instanceof Date) {
|
|
6758
|
+
return value.toISOString();
|
|
6759
|
+
}
|
|
6760
|
+
if (typeof value === 'object') {
|
|
6761
|
+
try {
|
|
6762
|
+
return JSON.stringify(value);
|
|
6763
|
+
}
|
|
6764
|
+
catch {
|
|
6765
|
+
return String(value);
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
return String(value);
|
|
6769
|
+
}
|
|
6770
|
+
resolveColumns(row) {
|
|
6771
|
+
const excludes = new Set((this.captureTableExcludeKeys() || []).map((k) => k.trim()));
|
|
6772
|
+
const explicitColumns = (this.captureTableColumns() || [])
|
|
6773
|
+
.map((column) => {
|
|
6774
|
+
if (typeof column === 'string') {
|
|
6775
|
+
return { key: column.trim() };
|
|
6776
|
+
}
|
|
6777
|
+
return {
|
|
6778
|
+
key: (column.key || '').trim(),
|
|
6779
|
+
label: column.label,
|
|
6780
|
+
};
|
|
6781
|
+
})
|
|
6782
|
+
.filter((column) => column.key.length > 0)
|
|
6783
|
+
.filter((column) => !excludes.has(column.key));
|
|
6784
|
+
if (explicitColumns.length > 0) {
|
|
6785
|
+
return explicitColumns;
|
|
6786
|
+
}
|
|
6787
|
+
if (!this.captureUseObjectKeysWhenColumnsEmpty() || !row) {
|
|
6788
|
+
return [];
|
|
6789
|
+
}
|
|
6790
|
+
return Object.keys(row)
|
|
6791
|
+
.filter((key) => !excludes.has(key))
|
|
6792
|
+
.map((key) => ({ key }));
|
|
6793
|
+
}
|
|
6794
|
+
resolveLabel(column, index, headerLabels) {
|
|
6795
|
+
const key = (column.key || '').trim();
|
|
6796
|
+
const map = this.captureTableHeaderMap() || {};
|
|
6797
|
+
const byMap = map[key]?.trim();
|
|
6798
|
+
if (byMap) {
|
|
6799
|
+
return byMap;
|
|
6800
|
+
}
|
|
6801
|
+
const byColumn = column.label?.trim();
|
|
6802
|
+
if (byColumn) {
|
|
6803
|
+
return byColumn;
|
|
6804
|
+
}
|
|
6805
|
+
const byHeader = headerLabels[index]?.trim();
|
|
6806
|
+
if (byHeader) {
|
|
6807
|
+
return byHeader;
|
|
6808
|
+
}
|
|
6809
|
+
return this.humanizeKey(key);
|
|
6810
|
+
}
|
|
6811
|
+
getHeaderLabels() {
|
|
6812
|
+
const host = this.el.nativeElement;
|
|
6813
|
+
const headerEls = host.querySelectorAll('thead th');
|
|
6814
|
+
return Array.from(headerEls)
|
|
6815
|
+
.map((th) => this.normalizeHeaderText(th.textContent || ''))
|
|
6816
|
+
.filter((text) => text.length > 0);
|
|
6817
|
+
}
|
|
6818
|
+
normalizeHeaderText(text) {
|
|
6819
|
+
return text
|
|
6820
|
+
.replace(/[↕⇅▴▾▲▼]/g, '')
|
|
6821
|
+
.replace(/\s+/g, ' ')
|
|
6822
|
+
.trim();
|
|
6823
|
+
}
|
|
6824
|
+
humanizeKey(key) {
|
|
6825
|
+
if (!key)
|
|
6826
|
+
return '';
|
|
6827
|
+
const spaced = key
|
|
6828
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
6829
|
+
.replace(/[_.-]+/g, ' ')
|
|
6830
|
+
.trim();
|
|
6831
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
6832
|
+
}
|
|
6833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CaptureTableRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6834
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: CaptureTableRowDirective, isStandalone: true, selector: "[appCaptureTableRow]", inputs: { appCaptureTableRow: { classPropertyName: "appCaptureTableRow", publicName: "appCaptureTableRow", isSignal: true, isRequired: false, transformFunction: null }, captureTableColumns: { classPropertyName: "captureTableColumns", publicName: "captureTableColumns", isSignal: true, isRequired: false, transformFunction: null }, captureTableExcludeKeys: { classPropertyName: "captureTableExcludeKeys", publicName: "captureTableExcludeKeys", isSignal: true, isRequired: false, transformFunction: null }, captureUseObjectKeysWhenColumnsEmpty: { classPropertyName: "captureUseObjectKeysWhenColumnsEmpty", publicName: "captureUseObjectKeysWhenColumnsEmpty", isSignal: true, isRequired: false, transformFunction: null }, captureTableHeaderMap: { classPropertyName: "captureTableHeaderMap", publicName: "captureTableHeaderMap", isSignal: true, isRequired: false, transformFunction: null }, captureTableRowId: { classPropertyName: "captureTableRowId", publicName: "captureTableRowId", isSignal: true, isRequired: false, transformFunction: null }, captureIncludeEmpty: { classPropertyName: "captureIncludeEmpty", publicName: "captureIncludeEmpty", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
6835
|
+
}
|
|
6836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CaptureTableRowDirective, decorators: [{
|
|
6837
|
+
type: Directive,
|
|
6838
|
+
args: [{
|
|
6839
|
+
selector: '[appCaptureTableRow]',
|
|
6840
|
+
}]
|
|
6841
|
+
}], propDecorators: { appCaptureTableRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "appCaptureTableRow", required: false }] }], captureTableColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureTableColumns", required: false }] }], captureTableExcludeKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureTableExcludeKeys", required: false }] }], captureUseObjectKeysWhenColumnsEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureUseObjectKeysWhenColumnsEmpty", required: false }] }], captureTableHeaderMap: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureTableHeaderMap", required: false }] }], captureTableRowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureTableRowId", required: false }] }], captureIncludeEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "captureIncludeEmpty", required: false }] }] } });
|
|
6842
|
+
|
|
6397
6843
|
/**
|
|
6398
6844
|
* Directiva que permite solo la entrada de:
|
|
6399
6845
|
* - Dígitos (0-9)
|
|
@@ -8015,8 +8461,8 @@ class ResultResponseService {
|
|
|
8015
8461
|
const guideHtml = this.buildAssociatedGuideHtml(response?.data);
|
|
8016
8462
|
const mainMessage = this.formatPrimaryAlertMessage(response.message);
|
|
8017
8463
|
this._sweetAlert2DialogService.Dialog(response.title, `${mainMessage}${guideHtml}`, // Se concatena limpiamente sin alterar la lógica
|
|
8018
|
-
|
|
8019
|
-
|
|
8464
|
+
'icon/sign.png', {
|
|
8465
|
+
showCancelButton: false,
|
|
8020
8466
|
showConfirmButton: true,
|
|
8021
8467
|
});
|
|
8022
8468
|
return false;
|
|
@@ -9064,5 +9510,5 @@ function minimumAgeValidator(minimumAge, referenceDate) {
|
|
|
9064
9510
|
* Generated bundle index. Do not edit.
|
|
9065
9511
|
*/
|
|
9066
9512
|
|
|
9067
|
-
export { ACTION_TYPES, AlertaService, AppMessageErrorComponent, AppMessageHelpComponent, ArrowNavigationDirective, AuthorizeService, AutoScrollHeightDirective, BaseCRUDService, CACHE_KEYS, CacheService, CaptureLabelDirective, CssV2Component, DSX_PALETTE, DateIndicator, DocxPreviewComponent, DsxAddToolsModule, DsxButtonComponent, DsxEnableDisable, DsxMessagesService, DsxStatusToggle, DteService, ENVIRONMENT, EndpointService, ErrorHandlerService, FileComponent, FormPreviewService, GTQFormatter, HeaderDsx, HelpersService, HttpHelpersService, INITIAL_PARAMETERS, IcoLabel, IconDsxComponent, JoinByPipe, JsonHighlightPipe, JsonValuesDebujComponent, JsonViewerComponent, KpicardComponent, LoadingComponent, LoadingLottieComponent, LogoDsxComponent, MasterDetailChangeService, NavbarDsxComponent, NetworkStatusComponent, OnlyRangoPatternDirective, ParameterValuesService, PdfPreviewComponent, PrimeNgModule, QrGenerator, ResultFileService, SWEET_ALERT_THEMES, ScreenInspector, SecurityService, SelectAllOnFocusDirective, SpinnerLoadingService, SweetAlert2DialogService, TemplateHighlight, TokenPurposeLogin, TruncatePipe, UtilityAddService, asyncExistsValidator, atLeastOneFieldRequiredValidator, chainControlGroups, createCurrencyFormatter, createInitialCache, createTypedCacheProvider, cuiValidator, dateMinMaxValidator, dateRangeValidator, dateRangeValidatorFromTo, developmentEnvironment, getActionMessageConfig, getZeroBasedRolIndex, guardTokenPurposeGuard, httpAuthorizeInterceptor, minimumAgeValidator, nitValidator, productionEnvironment, provideEnvironment, templateStructureValidator, templateVariablesValidator, validateEnvironmentConfig };
|
|
9513
|
+
export { ACTION_TYPES, AlertaService, AppMessageErrorComponent, AppMessageHelpComponent, ArrowNavigationDirective, AuthorizeService, AutoScrollHeightDirective, BaseCRUDService, CACHE_KEYS, CacheService, CaptureLabelDirective, CaptureTableRowDirective, CssV2Component, DSX_PALETTE, DateIndicator, DocxPreviewComponent, DsxAddToolsModule, DsxButtonComponent, DsxEnableDisable, DsxMessagesService, DsxStatusToggle, DteService, ENVIRONMENT, EndpointService, ErrorHandlerService, FileComponent, FormPreviewService, GTQFormatter, HeaderDsx, HelpersService, HttpHelpersService, INITIAL_PARAMETERS, IcoLabel, IconDsxComponent, JoinByPipe, JsonHighlightPipe, JsonValuesDebujComponent, JsonViewerComponent, KpicardComponent, LoadingComponent, LoadingLottieComponent, LogoDsxComponent, MasterDetailChangeService, NavbarDsxComponent, NetworkStatusComponent, OnlyRangoPatternDirective, ParameterValuesService, PdfPreviewComponent, PrimeNgModule, QrGenerator, ResultFileService, SWEET_ALERT_THEMES, ScreenInspector, SecurityService, SelectAllOnFocusDirective, SpinnerLoadingService, SweetAlert2DialogService, TablePreviewService, TemplateHighlight, TokenPurposeLogin, TruncatePipe, UtilityAddService, asyncExistsValidator, atLeastOneFieldRequiredValidator, chainControlGroups, createCurrencyFormatter, createInitialCache, createTypedCacheProvider, cuiValidator, dateMinMaxValidator, dateRangeValidator, dateRangeValidatorFromTo, developmentEnvironment, getActionMessageConfig, getZeroBasedRolIndex, guardTokenPurposeGuard, httpAuthorizeInterceptor, minimumAgeValidator, nitValidator, productionEnvironment, provideEnvironment, templateStructureValidator, templateVariablesValidator, validateEnvironmentConfig };
|
|
9068
9514
|
//# sourceMappingURL=ngx-dsxlibrary.mjs.map
|