sapenlinea-components 0.11.91 → 0.11.92

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.
@@ -3632,6 +3632,8 @@ class FeatureCard {
3632
3632
  const yyyy = d.getFullYear();
3633
3633
  return `${dd}/${mm}/${yyyy}`;
3634
3634
  }
3635
+ case 'number':
3636
+ return isNaN(numValue) ? raw : `${Math.trunc(numValue)}`;
3635
3637
  default:
3636
3638
  return raw;
3637
3639
  }
@@ -3669,7 +3671,21 @@ class FeatureCard {
3669
3671
  let nextDescription = target.value;
3670
3672
  const currentFeature = this.feature();
3671
3673
  // Validar y filtrar entrada para tipos numéricos
3672
- if (currentFeature?.type && ['money', 'percentage', 'measurement'].includes(currentFeature.type)) {
3674
+ if (currentFeature?.type === 'number') {
3675
+ // Solo dígitos enteros
3676
+ nextDescription = nextDescription.replace(/[^0-9]/g, '');
3677
+ // Aplicar límite máximo en tiempo real
3678
+ if (currentFeature.max !== undefined && nextDescription !== '') {
3679
+ const numericValue = parseInt(nextDescription, 10);
3680
+ if (!isNaN(numericValue) && numericValue > currentFeature.max) {
3681
+ nextDescription = currentFeature.max.toString();
3682
+ }
3683
+ }
3684
+ if (target.value !== nextDescription) {
3685
+ target.value = nextDescription;
3686
+ }
3687
+ }
3688
+ else if (currentFeature?.type && ['money', 'percentage', 'measurement'].includes(currentFeature.type)) {
3673
3689
  // Permitir solo números y punto decimal
3674
3690
  nextDescription = nextDescription.replace(/[^0-9.]/g, '');
3675
3691
  // Evitar múltiples puntos decimales
@@ -3684,7 +3700,6 @@ class FeatureCard {
3684
3700
  nextDescription = currentFeature.max.toString();
3685
3701
  }
3686
3702
  }
3687
- // Sincronizar el valor visual del input si cambió por el filtrado o límite
3688
3703
  if (target.value !== nextDescription) {
3689
3704
  target.value = nextDescription;
3690
3705
  }
@@ -3713,7 +3728,7 @@ class FeatureCard {
3713
3728
  this.isEditingDescription.set(false);
3714
3729
  // Aplicar límite mínimo al perder el foco (para evitar interrumpir mientras se escribe)
3715
3730
  const currentFeature = this.feature();
3716
- if (currentFeature?.type && ['money', 'percentage', 'measurement'].includes(currentFeature.type) && currentFeature.min !== undefined) {
3731
+ if (currentFeature?.type && ['money', 'percentage', 'measurement', 'number'].includes(currentFeature.type) && currentFeature.min !== undefined) {
3717
3732
  const currentRaw = this.descriptionValue();
3718
3733
  const numericValue = parseFloat(currentRaw);
3719
3734
  if (!isNaN(numericValue) && numericValue < currentFeature.min) {