ngx-dsxlibrary 2.21.33 → 2.21.35
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1$1 from '@angular/common';
|
|
2
2
|
import { DecimalPipe, CommonModule, AsyncPipe } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Input, Component, forwardRef, viewChild, input, signal, EventEmitter, effect, Output, model, inject, computed, InjectionToken, Injectable, output, HostBinding, Pipe, ViewEncapsulation,
|
|
4
|
+
import { Input, Component, forwardRef, viewChild, input, signal, EventEmitter, effect, Output, model, inject, computed, InjectionToken, Injectable, isDevMode, output, HostBinding, Pipe, ViewEncapsulation, HostListener, Directive, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1 from 'primeng/tag';
|
|
6
6
|
import { TagModule } from 'primeng/tag';
|
|
7
7
|
import * as i2$2 from '@angular/forms';
|
|
@@ -3169,6 +3169,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
3169
3169
|
*
|
|
3170
3170
|
* **Consulta / Descarga**
|
|
3171
3171
|
* - `view` → Previsualizar o abrir detalle (azul cielo)
|
|
3172
|
+
* - `export` → Exportar información a Excel (verde Excel)
|
|
3172
3173
|
* - `download` → Descargar archivo o recurso (ámbar cálido)
|
|
3173
3174
|
*/
|
|
3174
3175
|
const ACTION_TYPES = {
|
|
@@ -3182,6 +3183,7 @@ const ACTION_TYPES = {
|
|
|
3182
3183
|
saveOrUpdate: 'saveOrUpdate',
|
|
3183
3184
|
refresh: 'refresh',
|
|
3184
3185
|
view: 'view',
|
|
3186
|
+
export: 'export',
|
|
3185
3187
|
download: 'download',
|
|
3186
3188
|
};
|
|
3187
3189
|
/**
|
|
@@ -3201,6 +3203,7 @@ const ACTION_TYPES = {
|
|
|
3201
3203
|
* | neutral | Gris azulado | Acción secundaria / navegación sin contexto |
|
|
3202
3204
|
* | restore | Violeta suave | Deshacer / restaurar estado anterior |
|
|
3203
3205
|
* | view | Teal profundo | Ver / previsualizar detalle |
|
|
3206
|
+
* | excel | Verde Excel | Exportar información a hoja de cálculo |
|
|
3204
3207
|
* | download | Naranja quemado| Descargar archivo o recurso |
|
|
3205
3208
|
*/
|
|
3206
3209
|
const DSX_PALETTE = {
|
|
@@ -3213,11 +3216,35 @@ const DSX_PALETTE = {
|
|
|
3213
3216
|
neutral: '#90A4AE',
|
|
3214
3217
|
restore: '#AB47BC',
|
|
3215
3218
|
view: '#00838F',
|
|
3219
|
+
excel: '#217346',
|
|
3216
3220
|
download: '#E65100',
|
|
3217
3221
|
};
|
|
3222
|
+
/** Tipos que necesitan un `[id]` mayor a 0 para poder mostrarse. */
|
|
3223
|
+
const TYPES_REQUIRING_ID = ['delete', 'softDelete', 'restore'];
|
|
3218
3224
|
class DsxButtonComponent {
|
|
3219
3225
|
_paramService = inject((ParameterValuesService));
|
|
3220
3226
|
_router = inject(Router);
|
|
3227
|
+
constructor() {
|
|
3228
|
+
if (isDevMode()) {
|
|
3229
|
+
effect(() => {
|
|
3230
|
+
const type = this.type();
|
|
3231
|
+
const needsId = TYPES_REQUIRING_ID.includes(type) ||
|
|
3232
|
+
this.requiresIdGreaterThanZero() ||
|
|
3233
|
+
this.requireIdInput();
|
|
3234
|
+
if (!needsId)
|
|
3235
|
+
return;
|
|
3236
|
+
const explicitId = this.getNormalizedId();
|
|
3237
|
+
const routeId = this.getIdFromNavigationTarget(this.effectiveRouterLink());
|
|
3238
|
+
const resolvedId = explicitId ?? routeId;
|
|
3239
|
+
const isValid = typeof resolvedId === 'number' && resolvedId > 0;
|
|
3240
|
+
if (!isValid) {
|
|
3241
|
+
alert(`[dsx-button] El botón de tipo "${type}" requiere un [id] numérico mayor a 0 para mostrarse.\n` +
|
|
3242
|
+
`Agrega [id]="tuId()" al elemento <dsx-button type="${type}">.\n` +
|
|
3243
|
+
`El botón permanecerá oculto hasta que se provea un id válido.`);
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3221
3248
|
get compactHostClass() {
|
|
3222
3249
|
return this.isCompactIconButton;
|
|
3223
3250
|
}
|
|
@@ -3522,7 +3549,7 @@ class DsxButtonComponent {
|
|
|
3522
3549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DsxButtonComponent, decorators: [{
|
|
3523
3550
|
type: Component,
|
|
3524
3551
|
args: [{ selector: 'dsx-button', imports: [Button, TooltipModule], template: "<!--Bot\u00F3n con las configuraciones din\u00E1micas para CRUD -->\r\n@if (showButton()) {\r\n<p-button\r\n [label]=\"buttonLabel\"\r\n [style]=\"buttonStyle\"\r\n [styleClass]=\"buttonStyleClass\"\r\n [pTooltip]=\"tooltip\"\r\n [tooltipDisabled]=\"disabled()\"\r\n tooltipPosition=\"top\"\r\n [raised]=\"isCompactIconButton ? false : raised()\"\r\n [rounded]=\"rounded()\"\r\n [text]=\"isCompactIconButton\"\r\n [size]=\"buttonSize\"\r\n severity=\"secondary\"\r\n [disabled]=\"disabled()\"\r\n [icon]=\"primeIcon\"\r\n (click)=\"onButtonClick()\"\r\n></p-button>\r\n}\r\n", styles: [":host{display:inline-flex;margin-bottom:.25rem}:host.dsx-button-compact-host{margin-bottom:0}:host ::ng-deep .p-button .p-button-label{font-family:Montserrat,Roboto,sans-serif;font-weight:500;letter-spacing:.01em}:host ::ng-deep .p-button.dsx-button-compact{min-height:2rem;padding-block:.2rem}:host ::ng-deep .p-button .material-symbols-outlined.p-button-icon{line-height:1;vertical-align:middle}:host ::ng-deep .p-button.dsx-button-compact .p-button-icon{margin:0;font-size:1.2rem;line-height:1}:host ::ng-deep .p-button.dsx-button-compact .material-symbols-outlined.p-button-icon{font-variation-settings:\"FILL\" 1,\"wght\" 500,\"GRAD\" 0,\"opsz\" 24}:host ::ng-deep .p-button:disabled,:host ::ng-deep .p-button.p-disabled{cursor:not-allowed!important;opacity:.45!important;filter:grayscale(.2) saturate(.75)}:host ::ng-deep .p-button:disabled *,:host ::ng-deep .p-button.p-disabled *{cursor:not-allowed!important}\n"] }]
|
|
3525
|
-
}], propDecorators: { compactHostClass: [{
|
|
3552
|
+
}], ctorParameters: () => [], propDecorators: { compactHostClass: [{
|
|
3526
3553
|
type: HostBinding,
|
|
3527
3554
|
args: ['class.dsx-button-compact-host']
|
|
3528
3555
|
}], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], routerLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "routerLink", required: false }] }], routerPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "routerPath", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], iconOnlyWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnlyWidth", required: false }] }], raised: [{ type: i0.Input, args: [{ isSignal: true, alias: "raised", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], parameterName: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameterName", required: false }] }], parameterExpectedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameterExpectedValue", required: false }] }], parameterIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameterIndex", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], requireIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "requireIdInput", required: false }] }], requiresIdGreaterThanZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "requiresIdGreaterThanZero", required: false }] }], labelOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelOverride", required: false }] }], tooltipOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOverride", required: false }] }], iconOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOverride", required: false }] }], primeIconOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "primeIconOverride", required: false }] }], colorOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorOverride", required: false }] }], outlinedOverride: [{ type: i0.Input, args: [{ isSignal: true, alias: "outlinedOverride", required: false }] }], action: [{ type: i0.Output, args: ["action"] }] } });
|
|
@@ -3598,6 +3625,13 @@ const ACTION_CONFIG = {
|
|
|
3598
3625
|
colorToken: 'view',
|
|
3599
3626
|
tooltip: 'Vista previa',
|
|
3600
3627
|
},
|
|
3628
|
+
export: {
|
|
3629
|
+
label: 'Exportar',
|
|
3630
|
+
icon: 'file_export',
|
|
3631
|
+
primeIcon: 'pi pi-file-excel',
|
|
3632
|
+
colorToken: 'excel',
|
|
3633
|
+
tooltip: 'Exportar a Excel',
|
|
3634
|
+
},
|
|
3601
3635
|
download: {
|
|
3602
3636
|
label: 'Descargar',
|
|
3603
3637
|
icon: 'download',
|