@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.
- package/esm2020/lib/shared/directives/phone-mask.directive.mjs +19 -1
- package/fesm2015/csmart-ngc-smart-victim.mjs +18 -0
- package/fesm2015/csmart-ngc-smart-victim.mjs.map +1 -1
- package/fesm2020/csmart-ngc-smart-victim.mjs +18 -0
- package/fesm2020/csmart-ngc-smart-victim.mjs.map +1 -1
- package/package.json +1 -1
@@ -14,27 +14,45 @@ export class PhoneMaskDirective {
|
|
14
14
|
}
|
15
15
|
onInputChange(event, backspace) {
|
16
16
|
if (event) {
|
17
|
+
console.log('appPhoneMask');
|
18
|
+
console.log(event);
|
17
19
|
let newVal = event.replace(/\D/g, '');
|
20
|
+
console.log('newVal');
|
21
|
+
console.log(newVal);
|
18
22
|
if (backspace && newVal.length <= 6) {
|
19
23
|
newVal = newVal.substring(0, newVal.length - 1);
|
24
|
+
console.log('newVal 1');
|
25
|
+
console.log(newVal);
|
20
26
|
}
|
21
27
|
if (newVal.length === 0) {
|
22
28
|
newVal = '';
|
29
|
+
console.log('newVal 2');
|
30
|
+
console.log(newVal);
|
23
31
|
}
|
24
32
|
else if (newVal.length <= 3) {
|
25
33
|
newVal = newVal.replace(/^(\d{0,3})/, '($1)');
|
34
|
+
console.log('newVal 3');
|
35
|
+
console.log(newVal);
|
26
36
|
}
|
27
37
|
else if (newVal.length <= 6) {
|
28
38
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})/, '($1) $2');
|
39
|
+
console.log('newVal 4');
|
40
|
+
console.log(newVal);
|
29
41
|
}
|
30
42
|
else if (newVal.length <= 10) {
|
31
43
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
44
|
+
console.log('newVal 5');
|
45
|
+
console.log(newVal);
|
32
46
|
}
|
33
47
|
else {
|
34
48
|
newVal = newVal.substring(0, 10);
|
35
49
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
50
|
+
console.log('newVal 6');
|
51
|
+
console.log(newVal);
|
36
52
|
}
|
37
53
|
this.ngControl.valueAccessor.writeValue(newVal);
|
54
|
+
console.log('newVal 7');
|
55
|
+
console.log(newVal);
|
38
56
|
}
|
39
57
|
}
|
40
58
|
}
|
@@ -52,4 +70,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
52
70
|
type: HostListener,
|
53
71
|
args: ['keydown.backspace', ['$event']]
|
54
72
|
}] } });
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGhvbmUtbWFzay5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ2Mtc21hcnQtdmljdGltL3NyYy9saWIvc2hhcmVkL2RpcmVjdGl2ZXMvcGhvbmUtbWFzay5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDeEQsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUFnQixDQUFDOzs7QUFLM0MsTUFBTSxPQUFPLGtCQUFrQjtJQUU3QixZQUFtQixTQUFvQjtRQUFwQixjQUFTLEdBQVQsU0FBUyxDQUFXO0lBQUksQ0FBQztJQUc1QyxhQUFhLENBQUMsS0FBSztRQUNqQixJQUFJLENBQUMsYUFBYSxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBR0QsZ0JBQWdCLENBQUMsS0FBSztRQUNwQixJQUFJLENBQUMsYUFBYSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQU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mV3VmFsID0gbmV3VmFsLnJlcGxhY2UoL14oXFxkezAsM30pKFxcZHswLDN9KS8sICcoJDEpICQyJyk7XHJcblxyXG4gICAgICBjb25zb2xlLmxvZygnbmV3VmFsIDQnKTtcclxuICAgICAgY29uc29sZS5sb2cobmV3VmFsKTtcclxuICAgIH0gZWxzZSBpZiAobmV3VmFsLmxlbmd0aCA8PSAxMCkge1xyXG4gICAgICBuZXdWYWwgPSBuZXdWYWwucmVwbGFjZSgvXihcXGR7MCwzfSkoXFxkezAsM30pKFxcZHswLDR9KS8sICcoJDEpICQyLSQzJyk7XHJcblxyXG4gICAgICBjb25zb2xlLmxvZygnbmV3VmFsIDUnKTtcclxuICAgICAgY29uc29sZS5sb2cobmV3VmFsKTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgIG5ld1ZhbCA9IG5ld1ZhbC5zdWJzdHJpbmcoMCwgMTApO1xyXG4gICAgICBuZXdWYWwgPSBuZXdWYWwucmVwbGFjZSgvXihcXGR7MCwzfSkoXFxkezAsM30pKFxcZHswLDR9KS8sICcoJDEpICQyLSQzJyk7XHJcblxyXG4gICAgICBjb25zb2xlLmxvZygnbmV3VmFsIDYnKTtcclxuICAgICAgY29uc29sZS5sb2cobmV3VmFsKTtcclxuICAgIH1cclxuICAgIHRoaXMubmdDb250cm9sLnZhbHVlQWNjZXNzb3Iud3JpdGVWYWx1ZShuZXdWYWwpO1xyXG4gICAgY29uc29sZS5sb2coJ25ld1ZhbCA3Jyk7XHJcbiAgICBjb25zb2xlLmxvZyhuZXdWYWwpO1xyXG4gIH1cclxuXHJcbiAgfVxyXG59XHJcbiJdfQ==
|
@@ -658,27 +658,45 @@ class PhoneMaskDirective {
|
|
658
658
|
}
|
659
659
|
onInputChange(event, backspace) {
|
660
660
|
if (event) {
|
661
|
+
console.log('appPhoneMask');
|
662
|
+
console.log(event);
|
661
663
|
let newVal = event.replace(/\D/g, '');
|
664
|
+
console.log('newVal');
|
665
|
+
console.log(newVal);
|
662
666
|
if (backspace && newVal.length <= 6) {
|
663
667
|
newVal = newVal.substring(0, newVal.length - 1);
|
668
|
+
console.log('newVal 1');
|
669
|
+
console.log(newVal);
|
664
670
|
}
|
665
671
|
if (newVal.length === 0) {
|
666
672
|
newVal = '';
|
673
|
+
console.log('newVal 2');
|
674
|
+
console.log(newVal);
|
667
675
|
}
|
668
676
|
else if (newVal.length <= 3) {
|
669
677
|
newVal = newVal.replace(/^(\d{0,3})/, '($1)');
|
678
|
+
console.log('newVal 3');
|
679
|
+
console.log(newVal);
|
670
680
|
}
|
671
681
|
else if (newVal.length <= 6) {
|
672
682
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})/, '($1) $2');
|
683
|
+
console.log('newVal 4');
|
684
|
+
console.log(newVal);
|
673
685
|
}
|
674
686
|
else if (newVal.length <= 10) {
|
675
687
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
688
|
+
console.log('newVal 5');
|
689
|
+
console.log(newVal);
|
676
690
|
}
|
677
691
|
else {
|
678
692
|
newVal = newVal.substring(0, 10);
|
679
693
|
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
694
|
+
console.log('newVal 6');
|
695
|
+
console.log(newVal);
|
680
696
|
}
|
681
697
|
this.ngControl.valueAccessor.writeValue(newVal);
|
698
|
+
console.log('newVal 7');
|
699
|
+
console.log(newVal);
|
682
700
|
}
|
683
701
|
}
|
684
702
|
}
|