ngx-dsxlibrary 2.21.34 → 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, isDevMode, HostListener, Directive, NgModule } from '@angular/core';
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';
@@ -3219,9 +3219,32 @@ const DSX_PALETTE = {
3219
3219
  excel: '#217346',
3220
3220
  download: '#E65100',
3221
3221
  };
3222
+ /** Tipos que necesitan un `[id]` mayor a 0 para poder mostrarse. */
3223
+ const TYPES_REQUIRING_ID = ['delete', 'softDelete', 'restore'];
3222
3224
  class DsxButtonComponent {
3223
3225
  _paramService = inject((ParameterValuesService));
3224
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
+ }
3225
3248
  get compactHostClass() {
3226
3249
  return this.isCompactIconButton;
3227
3250
  }
@@ -3526,7 +3549,7 @@ class DsxButtonComponent {
3526
3549
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DsxButtonComponent, decorators: [{
3527
3550
  type: Component,
3528
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"] }]
3529
- }], propDecorators: { compactHostClass: [{
3552
+ }], ctorParameters: () => [], propDecorators: { compactHostClass: [{
3530
3553
  type: HostBinding,
3531
3554
  args: ['class.dsx-button-compact-host']
3532
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"] }] } });