angular-imask
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -8,8 +8,8 @@ import { ElementRef, Provider, Renderer2, EventEmitter, OnDestroy, OnChanges, AfterViewInit } from '@angular/core'; | ||
maskRef: any; | ||
_onTouched: any; | ||
_onChange: any; | ||
imask: any; | ||
unmask?: boolean; | ||
accept: EventEmitter<{}>; | ||
complete: EventEmitter<{}>; | ||
_onTouched: () => void; | ||
_onChange: any; | ||
accept: EventEmitter<string>; | ||
complete: EventEmitter<string>; | ||
constructor(elementRef: ElementRef, renderer: Renderer2); | ||
@@ -16,0 +16,0 @@ maskValue: any; |
@@ -1,9 +0,16 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var forms_1 = require("@angular/forms"); | ||
var IMask = require("imask"); | ||
exports.MASKEDINPUT_VALUE_ACCESSOR = { | ||
provide: forms_1.NG_VALUE_ACCESSOR, | ||
useExisting: core_1.forwardRef(function () { return IMaskDirective; }), | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
import { Directive, ElementRef, Input, Output, forwardRef, Renderer2, HostListener, EventEmitter } from '@angular/core'; | ||
import { NG_VALUE_ACCESSOR } from '@angular/forms'; | ||
import IMask from 'imask'; | ||
export var MASKEDINPUT_VALUE_ACCESSOR = { | ||
provide: NG_VALUE_ACCESSOR, | ||
useExisting: forwardRef(function () { return IMaskDirective; }), | ||
multi: true | ||
@@ -15,2 +22,6 @@ }; | ||
this.renderer = renderer; | ||
this._onTouched = function () { }; | ||
this._onChange = function () { }; | ||
this.accept = new EventEmitter(); | ||
this.complete = new EventEmitter(); | ||
} | ||
@@ -21,3 +32,3 @@ Object.defineProperty(IMaskDirective.prototype, "maskValue", { | ||
return this.elementRef.nativeElement.value; | ||
return this.unmask ? this.maskRef.value : this.maskRef.unmaskedValue; | ||
return this.unmask ? this.maskRef.unmaskedValue : this.maskRef.value; | ||
}, | ||
@@ -88,5 +99,35 @@ set: function (value) { | ||
IMaskDirective.prototype.onBlur = function () { this._onTouched(); }; | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], IMaskDirective.prototype, "imask", void 0); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Boolean) | ||
], IMaskDirective.prototype, "unmask", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", EventEmitter) | ||
], IMaskDirective.prototype, "accept", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", EventEmitter) | ||
], IMaskDirective.prototype, "complete", void 0); | ||
__decorate([ | ||
HostListener('blur'), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", []), | ||
__metadata("design:returntype", void 0) | ||
], IMaskDirective.prototype, "onBlur", null); | ||
IMaskDirective = __decorate([ | ||
Directive({ | ||
selector: '[imask]', | ||
providers: [MASKEDINPUT_VALUE_ACCESSOR] | ||
}), | ||
__metadata("design:paramtypes", [ElementRef, | ||
Renderer2]) | ||
], IMaskDirective); | ||
return IMaskDirective; | ||
}()); | ||
exports.IMaskDirective = IMaskDirective; | ||
export { IMaskDirective }; | ||
//# sourceMappingURL=imask.directive.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"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]","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"}}]}],"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","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__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"}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["blur"]}]}]}}}}] | ||
[{"__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]","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"}}]}],"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","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__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"}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["blur"]}]}]}}}},{"__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]","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"}}]}],"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","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__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"}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["blur"]}]}]}}}}] |
@@ -1,12 +0,23 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var common_1 = require("@angular/common"); | ||
var imask_directive_1 = require("./imask.directive"); | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { IMaskDirective } from './imask.directive'; | ||
var IMaskModule = /** @class */ (function () { | ||
function IMaskModule() { | ||
} | ||
IMaskModule = __decorate([ | ||
NgModule({ | ||
imports: [CommonModule], | ||
declarations: [IMaskDirective], | ||
exports: [IMaskDirective] | ||
}) | ||
], IMaskModule); | ||
return IMaskModule; | ||
}()); | ||
exports.IMaskModule = IMaskModule; | ||
export { IMaskModule }; | ||
//# sourceMappingURL=imask.module.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"IMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}],"exports":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}]}]}]}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"IMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}],"exports":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}]}]}]}}},{"__symbolic":"module","version":1,"metadata":{"IMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}],"exports":[{"__symbolic":"reference","module":"./imask.directive","name":"IMaskDirective"}]}]}]}}}] |
@@ -1,2 +0,2 @@ | ||
export { IMaskDirective } from './imask.directive'; | ||
export { IMaskModule } from './imask.module'; | ||
export * from './imask.directive'; | ||
export * from './imask.module'; |
@@ -1,7 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var imask_directive_1 = require("./imask.directive"); | ||
exports.IMaskDirective = imask_directive_1.IMaskDirective; | ||
var imask_module_1 = require("./imask.module"); | ||
exports.IMaskModule = imask_module_1.IMaskModule; | ||
export * from './imask.directive'; | ||
export * from './imask.module'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./imask.directive","export":["IMaskDirective"]},{"from":"./imask.module","export":["IMaskModule"]}]}] | ||
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./imask.directive"},{"from":"./imask.module"}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./imask.directive"},{"from":"./imask.module"}]}] |
{ | ||
"name": "angular-imask", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Angular IMask Plugin", | ||
"main": "dist/index.js", | ||
"main": "dist/angular-imask.umd.js", | ||
"module": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "npm run test", | ||
"build": "rimraf dist && ngc", | ||
"build": "rimraf dist && ngc && rollup -c", | ||
"prepublishOnly": "npm run build" | ||
@@ -25,12 +27,16 @@ }, | ||
"peerDependencies": { | ||
"@angular/core": ">=2.0.0", | ||
"@angular/forms": ">=2.0.0" | ||
"@angular/common": ">=4.0.0", | ||
"@angular/core": ">=4.0.0", | ||
"@angular/forms": ">=4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@angular/common": "^5.0.5", | ||
"@angular/compiler": "^5.0.5", | ||
"@angular/compiler-cli": "^5.0.5", | ||
"@angular/core": "^5.0.5", | ||
"@angular/forms": "^5.0.5", | ||
"@angular/common": "^4.0.0", | ||
"@angular/compiler": "^4.0.0", | ||
"@angular/compiler-cli": "^4.0.0", | ||
"@angular/core": "^4.0.0", | ||
"@angular/forms": "^4.0.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.52.1", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rxjs": "^5.5.3", | ||
@@ -37,0 +43,0 @@ "typescript": "^2.6.2" |
@@ -10,7 +10,24 @@ # Angular IMask Plugin | ||
## Mask input example | ||
## Setup | ||
```javascript | ||
import {IMaskModule} from 'angular-imask'; | ||
// TODO | ||
@NgModule({ | ||
imports: [ | ||
IMaskModule, | ||
... | ||
], | ||
... | ||
}) {...} | ||
``` | ||
## Usage | ||
```html | ||
<input | ||
[imask]="{mask: '+{7}(000)000-00-00'}" <!--see more mask props in a guide--> | ||
[unmask]="true" <!--optionally use `unmaskedValue` or `value` otherwise--> | ||
(accept)="onAccept" <!--first argument is `value` or `unmaskedValue` depending on prop above--> | ||
(complete)="onComplete" | ||
/> | ||
``` | ||
More options see in a [guide](https://unmanner.github.io/imaskjs/guide.html). |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
33640
17
339
33
4
11
1