@csmart/ngc-smart-victim 1.14.26 → 1.14.28
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2020/lib/smart-victim.component.mjs +49 -48
- package/fesm2015/csmart-ngc-smart-victim.mjs +48 -47
- package/fesm2015/csmart-ngc-smart-victim.mjs.map +1 -1
- package/fesm2020/csmart-ngc-smart-victim.mjs +48 -47
- package/fesm2020/csmart-ngc-smart-victim.mjs.map +1 -1
- package/package.json +1 -1
- package/esm2020/lib/shared/directives/phone-mask.directive.mjs +0 -55
- package/lib/shared/directives/phone-mask.directive.d.ts +0 -11
package/package.json
CHANGED
@@ -1,55 +0,0 @@
|
|
1
|
-
import { Directive, HostListener } from '@angular/core';
|
2
|
-
import { NgControl } from '@angular/forms';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@angular/forms";
|
5
|
-
export class PhoneMaskDirective {
|
6
|
-
constructor(ngControl) {
|
7
|
-
this.ngControl = ngControl;
|
8
|
-
}
|
9
|
-
onModelChange(event) {
|
10
|
-
this.onInputChange(event, false);
|
11
|
-
}
|
12
|
-
keydownBackspace(event) {
|
13
|
-
this.onInputChange(event.target.value, true);
|
14
|
-
}
|
15
|
-
onInputChange(event, backspace) {
|
16
|
-
if (event) {
|
17
|
-
let newVal = event.replace(/\D/g, '');
|
18
|
-
if (backspace && newVal.length <= 6) {
|
19
|
-
newVal = newVal.substring(0, newVal.length - 1);
|
20
|
-
}
|
21
|
-
if (newVal.length === 0) {
|
22
|
-
newVal = '';
|
23
|
-
}
|
24
|
-
else if (newVal.length <= 3) {
|
25
|
-
newVal = newVal.replace(/^(\d{0,3})/, '($1)');
|
26
|
-
}
|
27
|
-
else if (newVal.length <= 6) {
|
28
|
-
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})/, '($1) $2');
|
29
|
-
}
|
30
|
-
else if (newVal.length <= 10) {
|
31
|
-
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
newVal = newVal.substring(0, 10);
|
35
|
-
newVal = newVal.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})/, '($1) $2-$3');
|
36
|
-
}
|
37
|
-
this.ngControl.valueAccessor.writeValue(newVal);
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
/** @nocollapse */ PhoneMaskDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneMaskDirective, deps: [{ token: i1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
|
42
|
-
/** @nocollapse */ PhoneMaskDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: PhoneMaskDirective, selector: "[formControlName][appPhoneMask]", host: { listeners: { "ngModelChange": "onModelChange($event)", "keydown.backspace": "keydownBackspace($event)" } }, ngImport: i0 });
|
43
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneMaskDirective, decorators: [{
|
44
|
-
type: Directive,
|
45
|
-
args: [{
|
46
|
-
selector: '[formControlName][appPhoneMask]',
|
47
|
-
}]
|
48
|
-
}], ctorParameters: function () { return [{ type: i1.NgControl }]; }, propDecorators: { onModelChange: [{
|
49
|
-
type: HostListener,
|
50
|
-
args: ['ngModelChange', ['$event']]
|
51
|
-
}], keydownBackspace: [{
|
52
|
-
type: HostListener,
|
53
|
-
args: ['keydown.backspace', ['$event']]
|
54
|
-
}] } });
|
55
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGhvbmUtbWFzay5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ2Mtc21hcnQtdmljdGltL3NyYy9saWIvc2hhcmVkL2RpcmVjdGl2ZXMvcGhvbmUtbWFzay5kaXJlY3RpdmUudHMiXSwibmFtZ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ZHswLDN9KS8sICcoJDEpJyk7XHJcbiAgICB9IGVsc2UgaWYgKG5ld1ZhbC5sZW5ndGggPD0gNikge1xyXG4gICAgICBuZXdWYWwgPSBuZXdWYWwucmVwbGFjZSgvXihcXGR7MCwzfSkoXFxkezAsM30pLywgJygkMSkgJDInKTtcclxuICAgIH0gZWxzZSBpZiAobmV3VmFsLmxlbmd0aCA8PSAxMCkge1xyXG4gICAgICBuZXdWYWwgPSBuZXdWYWwucmVwbGFjZSgvXihcXGR7MCwzfSkoXFxkezAsM30pKFxcZHswLDR9KS8sICcoJDEpICQyLSQzJyk7XHJcbiAgICB9IGVsc2Uge1xyXG4gICAgICBuZXdWYWwgPSBuZXdWYWwuc3Vic3RyaW5nKDAsIDEwKTtcclxuICAgICAgbmV3VmFsID0gbmV3VmFsLnJlcGxhY2UoL14oXFxkezAsM30pKFxcZHswLDN9KShcXGR7MCw0fSkvLCAnKCQxKSAkMi0kMycpO1xyXG4gICAgfVxyXG4gICAgdGhpcy5uZ0NvbnRyb2wudmFsdWVBY2Nlc3Nvci53cml0ZVZhbHVlKG5ld1ZhbCk7XHJcbiAgfVxyXG5cclxuICB9XHJcbn1cclxuIl19
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { NgControl } from '@angular/forms';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
export declare class PhoneMaskDirective {
|
4
|
-
ngControl: NgControl;
|
5
|
-
constructor(ngControl: NgControl);
|
6
|
-
onModelChange(event: any): void;
|
7
|
-
keydownBackspace(event: any): void;
|
8
|
-
onInputChange(event: any, backspace: any): void;
|
9
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PhoneMaskDirective, never>;
|
10
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<PhoneMaskDirective, "[formControlName][appPhoneMask]", never, {}, {}, never, never, false>;
|
11
|
-
}
|