@csmart/ngc-smart-victim 1.14.8 → 1.14.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -654,27 +654,45 @@ class PhoneMaskDirective {
654
654
  }
655
655
  onInputChange(event, backspace) {
656
656
  if (event) {
657
+ console.log('appPhoneMask');
658
+ console.log(event);
657
659
  let newVal = event.replace(/\D/g, '');
660
+ console.log('newVal');
661
+ console.log(newVal);
658
662
  if (backspace && newVal.length <= 6) {
659
663
  newVal = newVal.substring(0, newVal.length - 1);
664
+ console.log('newVal 1');
665
+ console.log(newVal);
660
666
  }
661
667
  if (newVal.length === 0) {
662
668
  newVal = '';
669
+ console.log('newVal 2');
670
+ console.log(newVal);
663
671
  }
664
672
  else if (newVal.length <= 3) {
665
673
  newVal = newVal.replace(/^(\d{0,3})/, '($1)');
674
+ console.log('newVal 3');
675
+ console.log(newVal);
666
676
  }
667
677
  else if (newVal.length <= 6) {
668
678
  newVal = newVal.replace(/^(\d{0,3})(\d{0,3})/, '($1) $2');
679
+ console.log('newVal 4');
680
+ console.log(newVal);
669
681
  }
670
682
  else if (newVal.length <= 10) {
671
683
  newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
684
+ console.log('newVal 5');
685
+ console.log(newVal);
672
686
  }
673
687
  else {
674
688
  newVal = newVal.substring(0, 10);
675
689
  newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
690
+ console.log('newVal 6');
691
+ console.log(newVal);
676
692
  }
677
693
  this.ngControl.valueAccessor.writeValue(newVal);
694
+ console.log('newVal 7');
695
+ console.log(newVal);
678
696
  }
679
697
  }
680
698
  }