angular-imask
Advanced tools
Comparing version 4.1.3 to 4.1.4
@@ -44,2 +44,3 @@ (function (global, factory) { | ||
this._composing = false; | ||
this._writing = false; | ||
if (this._compositionMode == null) { | ||
@@ -116,7 +117,20 @@ this._compositionMode = !_isAndroid(); | ||
}; | ||
IMaskDirective.prototype.beginWrite = function (value) { | ||
this._writing = true; | ||
this._writingValue = value; | ||
}; | ||
IMaskDirective.prototype.endWrite = function () { | ||
this._writing = false; | ||
return this._writingValue; | ||
}; | ||
IMaskDirective.prototype.writeValue = function (value) { | ||
value = value == null ? '' : value; | ||
if (this.maskRef) { | ||
if (this.maskValue !== value) | ||
this.beginWrite(value); | ||
if (this.maskValue !== value || | ||
// handle cases like Number('') === 0, | ||
// for details see https://github.com/uNmAnNeR/imaskjs/issues/134 | ||
(typeof value !== 'string' && this.maskRef.value === '')) { | ||
this.maskValue = value; | ||
} | ||
} | ||
@@ -128,5 +142,10 @@ else { | ||
IMaskDirective.prototype._onAccept = function () { | ||
this.onChange(this.maskValue); | ||
var value = this.maskValue; | ||
// if value was not changed during writing don't fire events | ||
// for details see https://github.com/uNmAnNeR/imaskjs/issues/136 | ||
if (this._writing && value === this.endWrite()) | ||
return; | ||
this.onChange(value); | ||
this.onTouched(); | ||
this.accept.emit(this.maskValue); | ||
this.accept.emit(value); | ||
}; | ||
@@ -133,0 +152,0 @@ IMaskDirective.prototype._onComplete = function () { |
@@ -13,2 +13,4 @@ import { ElementRef, Provider, Renderer2, EventEmitter, OnDestroy, OnChanges, AfterViewInit } from '@angular/core'; | ||
private _composing; | ||
private _writingValue; | ||
private _writing; | ||
imask: any; | ||
@@ -26,2 +28,4 @@ unmask?: boolean | 'typed'; | ||
ngOnDestroy(): void; | ||
beginWrite(value: any): void; | ||
endWrite(): any; | ||
writeValue(value: any): void; | ||
@@ -28,0 +32,0 @@ _onAccept(): void; |
@@ -40,2 +40,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this._composing = false; | ||
this._writing = false; | ||
if (this._compositionMode == null) { | ||
@@ -112,7 +113,20 @@ this._compositionMode = !_isAndroid(); | ||
}; | ||
IMaskDirective.prototype.beginWrite = function (value) { | ||
this._writing = true; | ||
this._writingValue = value; | ||
}; | ||
IMaskDirective.prototype.endWrite = function () { | ||
this._writing = false; | ||
return this._writingValue; | ||
}; | ||
IMaskDirective.prototype.writeValue = function (value) { | ||
value = value == null ? '' : value; | ||
if (this.maskRef) { | ||
if (this.maskValue !== value) | ||
this.beginWrite(value); | ||
if (this.maskValue !== value || | ||
// handle cases like Number('') === 0, | ||
// for details see https://github.com/uNmAnNeR/imaskjs/issues/134 | ||
(typeof value !== 'string' && this.maskRef.value === '')) { | ||
this.maskValue = value; | ||
} | ||
} | ||
@@ -124,5 +138,10 @@ else { | ||
IMaskDirective.prototype._onAccept = function () { | ||
this.onChange(this.maskValue); | ||
var value = this.maskValue; | ||
// if value was not changed during writing don't fire events | ||
// for details see https://github.com/uNmAnNeR/imaskjs/issues/136 | ||
if (this._writing && value === this.endWrite()) | ||
return; | ||
this.onChange(value); | ||
this.onTouched(); | ||
this.accept.emit(this.maskValue); | ||
this.accept.emit(value); | ||
}; | ||
@@ -129,0 +148,0 @@ IMaskDirective.prototype._onComplete = function () { |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"MASKEDINPUT_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"IMaskDirective"},"multi":true},"IMaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[imask]","host":{"(input)":"_handleInput($event.target.value)","(blur)":"onTouched()","(compositionstart)":"_compositionStart()","(compositionend)":"_compositionEnd($event.target.value)","$quoted$":["(input)","(blur)","(compositionstart)","(compositionend)"]},"providers":[{"__symbolic":"reference","name":"MASKEDINPUT_VALUE_ACCESSOR"}]}]}],"members":{"imask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"unmask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"imaskElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"accept":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"complete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/forms","name":"COMPOSITION_BUFFER_MODE"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","name":"boolean"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"destroyMask":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"_onAccept":[{"__symbolic":"method"}],"_onComplete":[{"__symbolic":"method"}],"initMask":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_handleInput":[{"__symbolic":"method"}],"_compositionStart":[{"__symbolic":"method"}],"_compositionEnd":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"MASKEDINPUT_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"IMaskDirective"},"multi":true},"IMaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[imask]","host":{"(input)":"_handleInput($event.target.value)","(blur)":"onTouched()","(compositionstart)":"_compositionStart()","(compositionend)":"_compositionEnd($event.target.value)"},"providers":[{"__symbolic":"reference","name":"MASKEDINPUT_VALUE_ACCESSOR"}]}]}],"members":{"imask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"unmask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"imaskElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"accept":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"complete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/forms","name":"COMPOSITION_BUFFER_MODE"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","name":"boolean"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"destroyMask":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"_onAccept":[{"__symbolic":"method"}],"_onComplete":[{"__symbolic":"method"}],"initMask":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_handleInput":[{"__symbolic":"method"}],"_compositionStart":[{"__symbolic":"method"}],"_compositionEnd":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"MASKEDINPUT_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"IMaskDirective"},"multi":true},"IMaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[imask]","host":{"(input)":"_handleInput($event.target.value)","(blur)":"onTouched()","(compositionstart)":"_compositionStart()","(compositionend)":"_compositionEnd($event.target.value)","$quoted$":["(input)","(blur)","(compositionstart)","(compositionend)"]},"providers":[{"__symbolic":"reference","name":"MASKEDINPUT_VALUE_ACCESSOR"}]}]}],"members":{"imask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"unmask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"imaskElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"accept":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"complete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/forms","name":"COMPOSITION_BUFFER_MODE"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","name":"boolean"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"destroyMask":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"beginWrite":[{"__symbolic":"method"}],"endWrite":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"_onAccept":[{"__symbolic":"method"}],"_onComplete":[{"__symbolic":"method"}],"initMask":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_handleInput":[{"__symbolic":"method"}],"_compositionStart":[{"__symbolic":"method"}],"_compositionEnd":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"MASKEDINPUT_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"IMaskDirective"},"multi":true},"IMaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[imask]","host":{"(input)":"_handleInput($event.target.value)","(blur)":"onTouched()","(compositionstart)":"_compositionStart()","(compositionend)":"_compositionEnd($event.target.value)"},"providers":[{"__symbolic":"reference","name":"MASKEDINPUT_VALUE_ACCESSOR"}]}]}],"members":{"imask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"unmask":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"imaskElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"accept":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"complete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/forms","name":"COMPOSITION_BUFFER_MODE"}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","name":"boolean"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"destroyMask":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"beginWrite":[{"__symbolic":"method"}],"endWrite":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"_onAccept":[{"__symbolic":"method"}],"_onComplete":[{"__symbolic":"method"}],"initMask":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_handleInput":[{"__symbolic":"method"}],"_compositionStart":[{"__symbolic":"method"}],"_compositionEnd":[{"__symbolic":"method"}]}}}}] |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "Angular IMask Plugin", | ||
@@ -43,5 +43,5 @@ "main": "dist/angular-imask.umd.js", | ||
"dependencies": { | ||
"imask": "^4.1.3" | ||
"imask": "^4.1.4" | ||
}, | ||
"gitHead": "3acd703dae07f94b57e2124e0fdcb1d8832c68c2" | ||
"gitHead": "8357407c0f41b1bff42b3fab32e7c91afb94821e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50390
508
Updatedimask@^4.1.4