angular2-signaturepad
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -1,18 +0,2 @@ | ||
import { ElementRef } from '@angular/core'; | ||
export declare class SignaturePad { | ||
private options; | ||
private onEndEvent; | ||
private signaturePad; | ||
private elementRef; | ||
constructor(elementRef: ElementRef); | ||
ngAfterContentInit(): void; | ||
resizeCanvas(): void; | ||
toDataURL(): string; | ||
fromDataURL(dataURL: string): void; | ||
clear(): void; | ||
isEmpty(): boolean; | ||
off(): void; | ||
on(): void; | ||
set(option: string, value: any): void; | ||
onEnd(): void; | ||
export declare class SignaturePadModule { | ||
} |
115
index.js
@@ -1,102 +0,19 @@ | ||
'use strict'; | ||
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); | ||
}; | ||
"use strict"; | ||
var core_1 = require('@angular/core'); | ||
var SignaturePad = (function () { | ||
function SignaturePad(elementRef) { | ||
// no op | ||
this.elementRef = elementRef; | ||
this.options = this.options || {}; | ||
this.onEndEvent = new core_1.EventEmitter(); | ||
var signature_pad_1 = require('./signature-pad'); | ||
var SignaturePadModule = (function () { | ||
function SignaturePadModule() { | ||
} | ||
SignaturePad.prototype.ngAfterContentInit = function () { | ||
var sp = require('signature_pad'); | ||
var canvas = this.elementRef.nativeElement.querySelector('canvas'); | ||
var canvasHeightKey = 'canvasHeight'; | ||
if (this.options['canvasHeight']) { | ||
canvas.height = this.options['canvasHeight']; | ||
} | ||
if (this.options['canvasWidth']) { | ||
canvas.width = this.options['canvasWidth']; | ||
} | ||
this.signaturePad = new sp(canvas, this.options); | ||
this.signaturePad.onEnd = this.onEnd.bind(this); | ||
}; | ||
SignaturePad.prototype.resizeCanvas = function () { | ||
// When zoomed out to less than 100%, for some very strange reason, | ||
// some browsers report devicePixelRatio as less than 1 | ||
// and only part of the canvas is cleared then. | ||
var ratio = Math.max(window.devicePixelRatio || 1, 1); | ||
var canvas = this.signaturePad._canvas; | ||
canvas.width = canvas.offsetWidth * ratio; | ||
canvas.height = canvas.offsetHeight * ratio; | ||
canvas.getContext("2d").scale(ratio, ratio); | ||
this.signaturePad.clear(); // otherwise isEmpty() might return incorrect value | ||
}; | ||
// Returns signature image as data URL (see https://mdn.io/todataurl for the list of possible paramters) | ||
SignaturePad.prototype.toDataURL = function () { | ||
return this.signaturePad.toDataURL(); // save image as PNG | ||
}; | ||
// Draws signature image from data URL | ||
SignaturePad.prototype.fromDataURL = function (dataURL) { | ||
this.signaturePad.fromDataURL(dataURL); | ||
}; | ||
// Clears the canvas | ||
SignaturePad.prototype.clear = function () { | ||
this.signaturePad.clear(); | ||
}; | ||
// Returns true if canvas is empty, otherwise returns false | ||
SignaturePad.prototype.isEmpty = function () { | ||
return this.signaturePad.isEmpty(); | ||
}; | ||
// Unbinds all event handlers | ||
SignaturePad.prototype.off = function () { | ||
this.signaturePad.off(); | ||
}; | ||
// Rebinds all event handlers | ||
SignaturePad.prototype.on = function () { | ||
this.signaturePad.on(); | ||
}; | ||
// set an option on the signaturePad - e.g. set('minWidth', 50); | ||
SignaturePad.prototype.set = function (option, value) { | ||
switch (option) { | ||
case 'canvasHeight': | ||
this.signaturePad._canvas.height = value; | ||
break; | ||
case 'canvasWidth': | ||
this.signaturePad._canvas.width = value; | ||
break; | ||
default: | ||
this.signaturePad[option] = value; | ||
} | ||
}; | ||
// notify subscribers on signature end | ||
SignaturePad.prototype.onEnd = function () { | ||
this.onEndEvent.emit(true); | ||
}; | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Object) | ||
], SignaturePad.prototype, "options", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata('design:type', core_1.EventEmitter) | ||
], SignaturePad.prototype, "onEndEvent", void 0); | ||
SignaturePad = __decorate([ | ||
core_1.Component({ | ||
template: '<canvas></canvas>', | ||
selector: 'signature-pad', | ||
}), | ||
__metadata('design:paramtypes', [core_1.ElementRef]) | ||
], SignaturePad); | ||
return SignaturePad; | ||
SignaturePadModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ | ||
imports: [], | ||
declarations: [signature_pad_1.SignaturePad], | ||
exports: [signature_pad_1.SignaturePad], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
SignaturePadModule.ctorParameters = []; | ||
return SignaturePadModule; | ||
}()); | ||
exports.SignaturePad = SignaturePad; | ||
//# sourceMappingURL=index.js.map | ||
exports.SignaturePadModule = SignaturePadModule; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEscUJBQXlCLGVBQWUsQ0FBQyxDQUFBO0FBQ3pDLDhCQUE2QixpQkFBaUIsQ0FBQyxDQUFBO0FBSS9DO0lBQUE7SUFVQSxDQUFDO0lBVndDLDZCQUFVLEdBQTBCO1FBQzdFLEVBQUUsSUFBSSxFQUFFLGVBQVEsRUFBRSxJQUFJLEVBQUUsQ0FBQztvQkFDdkIsT0FBTyxFQUFFLEVBQUc7b0JBQ1osWUFBWSxFQUFFLENBQUUsNEJBQVksQ0FBRTtvQkFDOUIsT0FBTyxFQUFFLENBQUUsNEJBQVksQ0FBRTtpQkFDMUIsRUFBRyxFQUFFO0tBQ0wsQ0FBQztJQUNGLGtCQUFrQjtJQUNYLGlDQUFjLEdBQTZELEVBQ2pGLENBQUM7SUFDRix5QkFBQztBQUFELENBQUMsQUFWRCxJQVVDO0FBVlksMEJBQWtCLHFCQVU5QixDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgTmdNb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IFNpZ25hdHVyZVBhZCB9IGZyb20gJy4vc2lnbmF0dXJlLXBhZCc7XG5cblxuXG5leHBvcnQgY2xhc3MgU2lnbmF0dXJlUGFkTW9kdWxlIHsgc3RhdGljIGRlY29yYXRvcnM6IERlY29yYXRvckludm9jYXRpb25bXSA9IFtcbnsgdHlwZTogTmdNb2R1bGUsIGFyZ3M6IFt7XG4gIGltcG9ydHM6IFsgXSxcbiAgZGVjbGFyYXRpb25zOiBbIFNpZ25hdHVyZVBhZCBdLFxuICBleHBvcnRzOiBbIFNpZ25hdHVyZVBhZCBdLFxufSwgXSB9LFxuXTtcbi8qKiBAbm9jb2xsYXBzZSAqL1xuc3RhdGljIGN0b3JQYXJhbWV0ZXJzOiAoe3R5cGU6IGFueSwgZGVjb3JhdG9ycz86IERlY29yYXRvckludm9jYXRpb25bXX18bnVsbClbXSA9IFtcbl07XG59XG5cbmludGVyZmFjZSBEZWNvcmF0b3JJbnZvY2F0aW9uIHtcbiAgdHlwZTogRnVuY3Rpb247XG4gIGFyZ3M/OiBhbnlbXTtcbn1cbiJdfQ== |
{ | ||
"name": "angular2-signaturepad", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Angular2 Component wrapper for szimek / signature_pad", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"scripts": { | ||
"prepublish": "tsc", | ||
"prepublish": "node ./node_modules/@angular/compiler-cli/src/main.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -31,7 +31,14 @@ }, | ||
}, | ||
"peerDependencies": { | ||
"@angular/core": "^2.0.0-rc.6", | ||
"rxjs": "^5.0.0-beta.11", | ||
"zone.js": "^0.6.17" | ||
"devDependencies": { | ||
"@angular/common": "2.0.1", | ||
"@angular/compiler": "2.0.1", | ||
"@angular/compiler-cli": "0.6.3", | ||
"@angular/core": "2.0.1", | ||
"@angular/platform-browser": "2.0.1", | ||
"@angular/platform-browser-dynamic": "2.0.1", | ||
"@angular/platform-server": "2.0.1", | ||
"rxjs": "5.0.0-beta.12", | ||
"typescript": "2.0.3", | ||
"zone.js": "0.6.25" | ||
} | ||
} |
{ | ||
"compilerOptions": { | ||
"noImplicitAny": true, | ||
"module": "commonjs", | ||
"target": "ES5", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"sourceMap": true, | ||
"declaration": true | ||
}, | ||
"files": [ | ||
"index.ts", | ||
"typings/index.d.ts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
"compilerOptions": { | ||
"noImplicitAny": true, | ||
"module": "commonjs", | ||
"target": "es5", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
"declaration": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"moduleResolution": "node", | ||
"lib": [ | ||
"dom", | ||
"es6" | ||
] | ||
} | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"bundles" | ||
], | ||
"files": [ | ||
"index.ts" | ||
], | ||
"angularCompilerOptions": { | ||
"genDir": "./ngfactory", | ||
"debug": false | ||
} | ||
} |
@@ -54,3 +54,5 @@ { | ||
"no-unused-expression": true, | ||
"no-unused-variable": false, | ||
"no-unused-expression": true, | ||
"no-unused-variable": true, | ||
"no-unreachable": true, | ||
"no-use-before-declare": true, | ||
@@ -57,0 +59,0 @@ "no-var-keyword": true, |
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
1
22806
10
12
276
1