Skip to content
Snippets Groups Projects
Commit 918cce98 authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT
Browse files

FEAT #00000 TIME 0 add node_modules and dist

parent dc87370b
No related merge requests found
Showing
with 17604 additions and 15523 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,3 +2,5 @@
* Generated bundle index. Do not edit.
*/
export * from './public_api';
//# sourceMappingURL=angular2-draggable.d.ts.map
\ No newline at end of file
/**
* Generated bundle index. Do not edit.
*/
export * from './public_api';
{"version":3,"file":"angular2-draggable.d.ts","sources":["angular2-draggable.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\nexport * from './public_api';\n"]}
\ No newline at end of file
import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
import { IPosition } from './models/position';
import * as ɵngcc0 from '@angular/core';
export declare class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges, AfterViewInit {
private el;
private renderer;
......@@ -79,4 +80,8 @@ export declare class AngularDraggableDirective implements OnInit, OnDestroy, OnC
checkHandleTarget(target: EventTarget, element: Element): boolean;
onMouseDown(event: MouseEvent | TouchEvent): void;
onMouseMove(event: MouseEvent | TouchEvent): void;
static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<AngularDraggableDirective, never>;
static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<AngularDraggableDirective, "[ngDraggable]", ["ngDraggable"], { "outOfBounds": "outOfBounds"; "gridSize": "gridSize"; "inBounds": "inBounds"; "trackPosition": "trackPosition"; "scale": "scale"; "preventDefaultEvent": "preventDefaultEvent"; "position": "position"; "lockAxis": "lockAxis"; "zIndex": "zIndex"; "ngDraggable": "ngDraggable"; "bounds": "bounds"; "handle": "handle"; "zIndexMoving": "zIndexMoving"; }, { "started": "started"; "stopped": "stopped"; "edge": "edge"; "movingOffset": "movingOffset"; "endOffset": "endOffset"; }, never, never, false>;
}
//# sourceMappingURL=angular-draggable.directive.d.ts.map
\ No newline at end of file
import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
import { IPosition } from './models/position';
export declare class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges, AfterViewInit {
private el;
private renderer;
private allowDrag;
private moving;
private orignal;
private oldTrans;
private tempTrans;
private currTrans;
private oldZIndex;
private _zIndex;
private needTransform;
private draggingSub;
/**
* Bugfix: iFrames, and context unrelated elements block all events, and are unusable
* https://github.com/xieziyu/angular2-draggable/issues/84
*/
private _helperBlock;
started: EventEmitter<any>;
stopped: EventEmitter<any>;
edge: EventEmitter<any>;
/** Make the handle HTMLElement draggable */
handle: HTMLElement;
/** Set the bounds HTMLElement */
bounds: HTMLElement;
/** List of allowed out of bounds edges **/
outOfBounds: {
top: boolean;
right: boolean;
bottom: boolean;
left: boolean;
};
/** Round the position to nearest grid */
gridSize: number;
/** Set z-index when dragging */
zIndexMoving: string;
/** Set z-index when not dragging */
zIndex: string;
/** Whether to limit the element stay in the bounds */
inBounds: boolean;
/** Whether the element should use it's previous drag position on a new drag event. */
trackPosition: boolean;
/** Input css scale transform of element so translations are correct */
scale: number;
/** Whether to prevent default event */
preventDefaultEvent: boolean;
/** Set initial position by offsets */
position: IPosition;
/** Lock axis: 'x' or 'y' */
lockAxis: string;
/** Emit position offsets when moving */
movingOffset: EventEmitter<IPosition>;
/** Emit position offsets when put back */
endOffset: EventEmitter<IPosition>;
ngDraggable: any;
constructor(el: ElementRef, renderer: Renderer2);
ngOnInit(): void;
ngOnDestroy(): void;
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewInit(): void;
private getDragEl;
resetPosition(): void;
private moveTo;
private transform;
private pickUp;
private subscribeEvents;
private unsubscribeEvents;
boundsCheck(): {
'top': boolean;
'right': boolean;
'bottom': boolean;
'left': boolean;
};
/** Get current offset */
getCurrentOffset(): IPosition;
private putBack;
checkHandleTarget(target: EventTarget, element: Element): boolean;
onMouseDown(event: MouseEvent | TouchEvent): void;
onMouseMove(event: MouseEvent | TouchEvent): void;
}
{"version":3,"file":"angular-draggable.directive.d.ts","sources":["angular-draggable.directive.d.ts"],"names":[],"mappings":"AAAA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA","sourcesContent":["import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';\nimport { IPosition } from './models/position';\nexport declare class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges, AfterViewInit {\n private el;\n private renderer;\n private allowDrag;\n private moving;\n private orignal;\n private oldTrans;\n private tempTrans;\n private currTrans;\n private oldZIndex;\n private _zIndex;\n private needTransform;\n private draggingSub;\n /**\n * Bugfix: iFrames, and context unrelated elements block all events, and are unusable\n * https://github.com/xieziyu/angular2-draggable/issues/84\n */\n private _helperBlock;\n started: EventEmitter<any>;\n stopped: EventEmitter<any>;\n edge: EventEmitter<any>;\n /** Make the handle HTMLElement draggable */\n handle: HTMLElement;\n /** Set the bounds HTMLElement */\n bounds: HTMLElement;\n /** List of allowed out of bounds edges **/\n outOfBounds: {\n top: boolean;\n right: boolean;\n bottom: boolean;\n left: boolean;\n };\n /** Round the position to nearest grid */\n gridSize: number;\n /** Set z-index when dragging */\n zIndexMoving: string;\n /** Set z-index when not dragging */\n zIndex: string;\n /** Whether to limit the element stay in the bounds */\n inBounds: boolean;\n /** Whether the element should use it's previous drag position on a new drag event. */\n trackPosition: boolean;\n /** Input css scale transform of element so translations are correct */\n scale: number;\n /** Whether to prevent default event */\n preventDefaultEvent: boolean;\n /** Set initial position by offsets */\n position: IPosition;\n /** Lock axis: 'x' or 'y' */\n lockAxis: string;\n /** Emit position offsets when moving */\n movingOffset: EventEmitter<IPosition>;\n /** Emit position offsets when put back */\n endOffset: EventEmitter<IPosition>;\n ngDraggable: any;\n constructor(el: ElementRef, renderer: Renderer2);\n ngOnInit(): void;\n ngOnDestroy(): void;\n ngOnChanges(changes: SimpleChanges): void;\n ngAfterViewInit(): void;\n private getDragEl;\n resetPosition(): void;\n private moveTo;\n private transform;\n private pickUp;\n private subscribeEvents;\n private unsubscribeEvents;\n boundsCheck(): {\n 'top': boolean;\n 'right': boolean;\n 'bottom': boolean;\n 'left': boolean;\n };\n /** Get current offset */\n getCurrentOffset(): IPosition;\n private putBack;\n checkHandleTarget(target: EventTarget, element: Element): boolean;\n onMouseDown(event: MouseEvent | TouchEvent): void;\n onMouseMove(event: MouseEvent | TouchEvent): void;\n}\n"]}
\ No newline at end of file
import * as ɵngcc0 from '@angular/core';
import * as ɵngcc1 from './angular-draggable.directive';
import * as ɵngcc2 from './angular-resizable.directive';
export declare class AngularDraggableModule {
static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<AngularDraggableModule, never>;
static ɵmod: ɵngcc0.ɵɵNgModuleDeclaration<AngularDraggableModule, [typeof ɵngcc1.AngularDraggableDirective, typeof ɵngcc2.AngularResizableDirective], never, [typeof ɵngcc1.AngularDraggableDirective, typeof ɵngcc2.AngularResizableDirective]>;
static ɵinj: ɵngcc0.ɵɵInjectorDeclaration<AngularDraggableModule>;
}
//# sourceMappingURL=angular-draggable.module.d.ts.map
\ No newline at end of file
export declare class AngularDraggableModule {
}
{"version":3,"file":"angular-draggable.module.d.ts","sources":["angular-draggable.module.d.ts"],"names":[],"mappings":";;;AAAA;;;;AACA","sourcesContent":["export declare class AngularDraggableModule {\n}\n"]}
\ No newline at end of file
......@@ -2,6 +2,7 @@ import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges,
import { ResizeHandle } from './widgets/resize-handle';
import { ResizeHandleType } from './models/resize-handle-type';
import { IResizeEvent } from './models/resize-event';
import * as ɵngcc0 from '@angular/core';
export declare class AngularResizableDirective implements OnInit, OnChanges, OnDestroy, AfterViewInit {
private el;
private renderer;
......@@ -126,4 +127,8 @@ export declare class AngularResizableDirective implements OnInit, OnChanges, OnD
private getBounding;
private resetBounding;
private getGridSize;
static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<AngularResizableDirective, never>;
static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<AngularResizableDirective, "[ngResizable]", ["ngResizable"], { "rzHandles": "rzHandles"; "rzAspectRatio": "rzAspectRatio"; "rzContainment": "rzContainment"; "rzGrid": "rzGrid"; "rzMinWidth": "rzMinWidth"; "rzMinHeight": "rzMinHeight"; "rzMaxWidth": "rzMaxWidth"; "rzMaxHeight": "rzMaxHeight"; "preventDefaultEvent": "preventDefaultEvent"; "ngResizable": "ngResizable"; }, { "rzStart": "rzStart"; "rzResizing": "rzResizing"; "rzStop": "rzStop"; }, never, never, false>;
}
//# sourceMappingURL=angular-resizable.directive.d.ts.map
\ No newline at end of file
import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
import { ResizeHandle } from './widgets/resize-handle';
import { ResizeHandleType } from './models/resize-handle-type';
import { IResizeEvent } from './models/resize-event';
export declare class AngularResizableDirective implements OnInit, OnChanges, OnDestroy, AfterViewInit {
private el;
private renderer;
private _resizable;
private _handles;
private _handleType;
private _handleResizing;
private _direction;
private _directionChanged;
private _aspectRatio;
private _containment;
private _origMousePos;
/** Original Size and Position */
private _origSize;
private _origPos;
/** Current Size and Position */
private _currSize;
private _currPos;
/** Initial Size and Position */
private _initSize;
private _initPos;
/** Snap to gird */
private _gridSize;
private _bounding;
/**
* Bugfix: iFrames, and context unrelated elements block all events, and are unusable
* https://github.com/xieziyu/angular2-draggable/issues/84
*/
private _helperBlock;
private draggingSub;
private _adjusted;
/** Disables the resizable if set to false. */
ngResizable: any;
/**
* Which handles can be used for resizing.
* @example
* [rzHandles] = "'n,e,s,w,se,ne,sw,nw'"
* equals to: [rzHandles] = "'all'"
*
* */
rzHandles: ResizeHandleType;
/**
* Whether the element should be constrained to a specific aspect ratio.
* Multiple types supported:
* boolean: When set to true, the element will maintain its original aspect ratio.
* number: Force the element to maintain a specific aspect ratio during resizing.
*/
rzAspectRatio: boolean | number;
/**
* Constrains resizing to within the bounds of the specified element or region.
* Multiple types supported:
* Selector: The resizable element will be contained to the bounding box of the first element found by the selector.
* If no element is found, no containment will be set.
* Element: The resizable element will be contained to the bounding box of this element.
* String: Possible values: "parent".
*/
rzContainment: string | HTMLElement;
/**
* Snaps the resizing element to a grid, every x and y pixels.
* A number for both width and height or an array values like [ x, y ]
*/
rzGrid: number | number[];
/** The minimum width the resizable should be allowed to resize to. */
rzMinWidth: number;
/** The minimum height the resizable should be allowed to resize to. */
rzMinHeight: number;
/** The maximum width the resizable should be allowed to resize to. */
rzMaxWidth: number;
/** The maximum height the resizable should be allowed to resize to. */
rzMaxHeight: number;
/** Whether to prevent default event */
preventDefaultEvent: boolean;
/** emitted when start resizing */
rzStart: EventEmitter<IResizeEvent>;
/** emitted when start resizing */
rzResizing: EventEmitter<IResizeEvent>;
/** emitted when stop resizing */
rzStop: EventEmitter<IResizeEvent>;
constructor(el: ElementRef<HTMLElement>, renderer: Renderer2);
ngOnChanges(changes: SimpleChanges): void;
ngOnInit(): void;
ngOnDestroy(): void;
ngAfterViewInit(): void;
/** A method to reset size */
resetSize(): void;
/** A method to get current status */
getStatus(): {
size: {
width: number;
height: number;
};
position: {
top: number;
left: number;
};
};
private updateResizable;
/** Use it to update aspect */
private updateAspectRatio;
/** Use it to update containment */
private updateContainment;
/** Use it to create handle divs */
private createHandles;
/** Use it to create a handle */
private createHandleByType;
private removeHandles;
onMouseDown(event: MouseEvent | TouchEvent, handle: ResizeHandle): void;
private subscribeEvents;
private unsubscribeEvents;
onMouseLeave(): void;
onMouseMove(event: MouseEvent | TouchEvent): void;
private startResize;
private stopResize;
private onResizing;
private getResizingEvent;
private updateDirection;
private resizeTo;
private doResize;
private adjustByRatio;
private checkBounds;
private checkSize;
private getBounding;
private resetBounding;
private getGridSize;
}
{"version":3,"file":"angular-resizable.directive.d.ts","sources":["angular-resizable.directive.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA","sourcesContent":["import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';\nimport { ResizeHandle } from './widgets/resize-handle';\nimport { ResizeHandleType } from './models/resize-handle-type';\nimport { IResizeEvent } from './models/resize-event';\nexport declare class AngularResizableDirective implements OnInit, OnChanges, OnDestroy, AfterViewInit {\n private el;\n private renderer;\n private _resizable;\n private _handles;\n private _handleType;\n private _handleResizing;\n private _direction;\n private _directionChanged;\n private _aspectRatio;\n private _containment;\n private _origMousePos;\n /** Original Size and Position */\n private _origSize;\n private _origPos;\n /** Current Size and Position */\n private _currSize;\n private _currPos;\n /** Initial Size and Position */\n private _initSize;\n private _initPos;\n /** Snap to gird */\n private _gridSize;\n private _bounding;\n /**\n * Bugfix: iFrames, and context unrelated elements block all events, and are unusable\n * https://github.com/xieziyu/angular2-draggable/issues/84\n */\n private _helperBlock;\n private draggingSub;\n private _adjusted;\n /** Disables the resizable if set to false. */\n ngResizable: any;\n /**\n * Which handles can be used for resizing.\n * @example\n * [rzHandles] = \"'n,e,s,w,se,ne,sw,nw'\"\n * equals to: [rzHandles] = \"'all'\"\n *\n * */\n rzHandles: ResizeHandleType;\n /**\n * Whether the element should be constrained to a specific aspect ratio.\n * Multiple types supported:\n * boolean: When set to true, the element will maintain its original aspect ratio.\n * number: Force the element to maintain a specific aspect ratio during resizing.\n */\n rzAspectRatio: boolean | number;\n /**\n * Constrains resizing to within the bounds of the specified element or region.\n * Multiple types supported:\n * Selector: The resizable element will be contained to the bounding box of the first element found by the selector.\n * If no element is found, no containment will be set.\n * Element: The resizable element will be contained to the bounding box of this element.\n * String: Possible values: \"parent\".\n */\n rzContainment: string | HTMLElement;\n /**\n * Snaps the resizing element to a grid, every x and y pixels.\n * A number for both width and height or an array values like [ x, y ]\n */\n rzGrid: number | number[];\n /** The minimum width the resizable should be allowed to resize to. */\n rzMinWidth: number;\n /** The minimum height the resizable should be allowed to resize to. */\n rzMinHeight: number;\n /** The maximum width the resizable should be allowed to resize to. */\n rzMaxWidth: number;\n /** The maximum height the resizable should be allowed to resize to. */\n rzMaxHeight: number;\n /** Whether to prevent default event */\n preventDefaultEvent: boolean;\n /** emitted when start resizing */\n rzStart: EventEmitter<IResizeEvent>;\n /** emitted when start resizing */\n rzResizing: EventEmitter<IResizeEvent>;\n /** emitted when stop resizing */\n rzStop: EventEmitter<IResizeEvent>;\n constructor(el: ElementRef<HTMLElement>, renderer: Renderer2);\n ngOnChanges(changes: SimpleChanges): void;\n ngOnInit(): void;\n ngOnDestroy(): void;\n ngAfterViewInit(): void;\n /** A method to reset size */\n resetSize(): void;\n /** A method to get current status */\n getStatus(): {\n size: {\n width: number;\n height: number;\n };\n position: {\n top: number;\n left: number;\n };\n };\n private updateResizable;\n /** Use it to update aspect */\n private updateAspectRatio;\n /** Use it to update containment */\n private updateContainment;\n /** Use it to create handle divs */\n private createHandles;\n /** Use it to create a handle */\n private createHandleByType;\n private removeHandles;\n onMouseDown(event: MouseEvent | TouchEvent, handle: ResizeHandle): void;\n private subscribeEvents;\n private unsubscribeEvents;\n onMouseLeave(): void;\n onMouseMove(event: MouseEvent | TouchEvent): void;\n private startResize;\n private stopResize;\n private onResizing;\n private getResizingEvent;\n private updateDirection;\n private resizeTo;\n private doResize;\n private adjustByRatio;\n private checkBounds;\n private checkSize;\n private getBounding;\n private resetBounding;\n private getGridSize;\n}\n"]}
\ No newline at end of file
......@@ -23,15 +23,25 @@
},
"main": "bundles/angular2-draggable.umd.js",
"module": "fesm5/angular2-draggable.js",
"es2015_ivy_ngcc": "__ivy_ngcc__/fesm2015/angular2-draggable.js",
"es2015": "fesm2015/angular2-draggable.js",
"esm5": "esm5/angular2-draggable.js",
"esm2015": "esm2015/angular2-draggable.js",
"fesm5": "fesm5/angular2-draggable.js",
"fesm2015_ivy_ngcc": "__ivy_ngcc__/fesm2015/angular2-draggable.js",
"fesm2015": "fesm2015/angular2-draggable.js",
"typings": "angular2-draggable.d.ts",
"metadata": "angular2-draggable.metadata.json",
"sideEffects": false,
"dependencies": {
"tslib": "^1.9.0"
},
"__processed_by_ivy_ngcc__": {
"es2015": "14.3.0",
"fesm2015": "14.3.0",
"typings": "14.3.0"
},
"scripts": {
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by NGCC. This is not allowed.\\nPlease delete and rebuild the package, without compiling with NGCC, before attempting to publish.\\nNote that NGCC may have been run by importing this package into another project that is being built with Ivy enabled.\\n')\" && exit 1"
}
}
import { EventEmitter, Component, ElementRef, Input, Output, NgModule } from '@angular/core';
import SignaturePadNative from 'signature_pad';
import * as ɵngcc0 from '@angular/core';
class SignaturePad {
constructor(elementRef) {
// no op
this.elementRef = elementRef;
this.options = this.options || {};
this.onBeginEvent = new EventEmitter();
this.onEndEvent = new EventEmitter();
}
ngAfterContentInit() {
const canvas = this.elementRef.nativeElement.querySelector('canvas');
if (this.options.canvasHeight) {
canvas.height = this.options.canvasHeight;
}
if (this.options.canvasWidth) {
canvas.width = this.options.canvasWidth;
}
this.signaturePad = new SignaturePadNative(canvas, this.options);
this.signaturePad.onBegin = this.onBegin.bind(this);
this.signaturePad.onEnd = this.onEnd.bind(this);
}
ngOnDestroy() {
const canvas = this.elementRef.nativeElement.querySelector('canvas');
canvas.width = 0;
canvas.height = 0;
}
resizeCanvas() {
// 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.
const ratio = Math.max(window.devicePixelRatio || 1, 1);
const 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 an array of point groups
toData() {
if (this.signaturePad) {
return this.signaturePad.toData();
}
else {
return [];
}
}
// Draws signature image from an array of point groups
fromData(points) {
this.signaturePad.fromData(points);
}
// Returns signature image as data URL (see https://mdn.io/todataurl for the list of possible paramters)
toDataURL(imageType, quality) {
return this.signaturePad.toDataURL(imageType, quality); // save image as data URL
}
// Draws signature image from data URL
fromDataURL(dataURL, options = {}) {
// set default height and width on read data from URL
if (!options.hasOwnProperty('height') &&
this.options.canvasHeight) {
options.height = this.options.canvasHeight;
}
if (!options.hasOwnProperty('width') && this.options.canvasWidth) {
options.width = this.options.canvasWidth;
}
this.signaturePad.fromDataURL(dataURL, options);
}
// Clears the canvas
clear() {
this.signaturePad.clear();
}
// Returns true if canvas is empty, otherwise returns false
isEmpty() {
return this.signaturePad.isEmpty();
}
// Unbinds all event handlers
off() {
this.signaturePad.off();
}
// Rebinds all event handlers
on() {
this.signaturePad.on();
}
// set an option on the signaturePad - e.g. set('minWidth', 50);
set(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 begin
onBegin() {
this.onBeginEvent.emit(true);
}
// notify subscribers on signature end
onEnd() {
this.onEndEvent.emit(true);
}
queryPad() {
return this.signaturePad;
}
}
SignaturePad.ɵfac = function SignaturePad_Factory(t) { return new (t || SignaturePad)(ɵngcc0.ɵɵdirectiveInject(ɵngcc0.ElementRef)); };
SignaturePad.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SignaturePad, selectors: [["signature-pad"]], inputs: { options: "options" }, outputs: { onBeginEvent: "onBeginEvent", onEndEvent: "onEndEvent" }, decls: 1, vars: 0, template: function SignaturePad_Template(rf, ctx) { if (rf & 1) {
ɵngcc0.ɵɵelement(0, "canvas");
} }, encapsulation: 2 });
SignaturePad.ctorParameters = () => [
{ type: ElementRef }
];
SignaturePad.propDecorators = {
options: [{ type: Input }],
onBeginEvent: [{ type: Output }],
onEndEvent: [{ type: Output }]
};
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SignaturePad, [{
type: Component,
args: [{
template: '<canvas></canvas>',
selector: 'signature-pad'
}]
}], function () { return [{ type: ɵngcc0.ElementRef }]; }, { options: [{
type: Input
}], onBeginEvent: [{
type: Output
}], onEndEvent: [{
type: Output
}] }); })();
class SignaturePadModule {
}
SignaturePadModule.ɵfac = function SignaturePadModule_Factory(t) { return new (t || SignaturePadModule)(); };
SignaturePadModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: SignaturePadModule });
SignaturePadModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({});
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SignaturePadModule, [{
type: NgModule,
args: [{
declarations: [SignaturePad],
imports: [],
exports: [SignaturePad]
}]
}], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(SignaturePadModule, { declarations: [SignaturePad], exports: [SignaturePad] }); })();
/*
* Public API Surface of angular2-signaturepad
*/
/**
* Generated bundle index. Do not edit.
*/
export { SignaturePad, SignaturePadModule };
//# sourceMappingURL=angular2-signaturepad.js.map
\ No newline at end of file
{"version":3,"file":"angular2-signaturepad.js","sources":["../../projects/angular2-signaturepad/src/lib/angular2-signaturepad.component.ts","../../projects/angular2-signaturepad/src/lib/angular2-signaturepad.module.ts","../../../projects/angular2-signaturepad/src/public-api.ts","../../../projects/angular2-signaturepad/src/angular2-signaturepad.ts"],"names":["SignaturePadNative.default"],"mappings":";;;;MAwBa,YAAY;AAAG,IAQ1B,YAAY,UAAsB;AACpC;AACI,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AACjC,QAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;AACtC,QAAI,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAC3C,QAAI,IAAI,CAAC,UAAU,GAAG,IAAI,YAAY,EAAE,CAAC;AACzC,KAAG;AACH,IACS,kBAAkB;AAAK,QAC5B,MAAM,MAAM,GAAQ,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9E,QACI,IAAK,IAAI,CAAC,OAAe,CAAC,YAAY,EAAE;AAC5C,YAAM,MAAM,CAAC,MAAM,GAAI,IAAI,CAAC,OAAe,CAAC,YAAY,CAAC;AACzD,SAAK;AACL,QACI,IAAK,IAAI,CAAC,OAAe,CAAC,WAAW,EA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,\n EventEmitter,\n Input,\n Output,\n OnDestroy,\n} from '@angular/core';\n\nimport * as SignaturePadNative from 'signature_pad';\n\nexport interface Point {\n x: number;\n y: number;\n time: number;\n}\n\nexport type PointGroup = Array<Point>;\n\n@Component({\n template: '<canvas></canvas>',\n selector: 'signature-pad',\n})\nexport class SignaturePad implements AfterContentInit, OnDestroy {\n @Input() public options: any;\n @Output() public onBeginEvent: EventEmitter<boolean>;\n @Output() public onEndEvent: EventEmitter<boolean>;\n\n private signaturePad: any;\n private elementRef: ElementRef;\n\n constructor(elementRef: ElementRef) {\n // no op\n this.elementRef = elementRef;\n this.options = this.options || {};\n this.onBeginEvent = new EventEmitter();\n this.onEndEvent = new EventEmitter();\n }\n\n public ngAfterContentInit(): void {\n const canvas: any = this.elementRef.nativeElement.querySelector('canvas');\n\n if ((this.options as any).canvasHeight) {\n canvas.height = (this.options as any).canvasHeight;\n }\n\n if ((this.options as any).canvasWidth) {\n canvas.width = (this.options as any).canvasWidth;\n }\n\n this.signaturePad = new SignaturePadNative.default(canvas, this.options);\n this.signaturePad.onBegin = this.onBegin.bind(this);\n this.signaturePad.onEnd = this.onEnd.bind(this);\n }\n\n public ngOnDestroy(): void {\n const canvas: any = this.elementRef.nativeElement.querySelector('canvas');\n canvas.width = 0;\n canvas.height = 0;\n }\n\n public resizeCanvas(): void {\n // When zoomed out to less than 100%, for some very strange reason,\n // some browsers report devicePixelRatio as less than 1\n // and only part of the canvas is cleared then.\n const ratio: number = Math.max(window.devicePixelRatio || 1, 1);\n const canvas: any = this.signaturePad.canvas;\n canvas.width = canvas.offsetWidth * ratio;\n canvas.height = canvas.offsetHeight * ratio;\n canvas.getContext('2d').scale(ratio, ratio);\n this.signaturePad.clear(); // otherwise isEmpty() might return incorrect value\n }\n\n // Returns signature image as an array of point groups\n public toData(): Array<PointGroup> {\n if (this.signaturePad) {\n return this.signaturePad.toData();\n } else {\n return [];\n }\n }\n\n // Draws signature image from an array of point groups\n public fromData(points: Array<PointGroup>): void {\n this.signaturePad.fromData(points as any);\n }\n\n // Returns signature image as data URL (see https://mdn.io/todataurl for the list of possible paramters)\n public toDataURL(imageType?: string, quality?: number): string {\n return this.signaturePad.toDataURL(imageType, quality); // save image as data URL\n }\n\n // Draws signature image from data URL\n public fromDataURL(dataURL: string, options: any = {}): void {\n // set default height and width on read data from URL\n if (\n !options.hasOwnProperty('height') &&\n (this.options as any).canvasHeight\n ) {\n options.height = (this.options as any).canvasHeight;\n }\n if (!options.hasOwnProperty('width') && (this.options as any).canvasWidth) {\n options.width = (this.options as any).canvasWidth;\n }\n this.signaturePad.fromDataURL(dataURL, options);\n }\n\n // Clears the canvas\n public clear(): void {\n this.signaturePad.clear();\n }\n\n // Returns true if canvas is empty, otherwise returns false\n public isEmpty(): boolean {\n return this.signaturePad.isEmpty();\n }\n\n // Unbinds all event handlers\n public off(): void {\n this.signaturePad.off();\n }\n\n // Rebinds all event handlers\n public on(): void {\n this.signaturePad.on();\n }\n\n // set an option on the signaturePad - e.g. set('minWidth', 50);\n public set(option: string, value: any): void {\n switch (option) {\n case 'canvasHeight':\n this.signaturePad.canvas.height = value;\n break;\n case 'canvasWidth':\n this.signaturePad.canvas.width = value;\n break;\n default:\n this.signaturePad[option] = value;\n }\n }\n\n // notify subscribers on signature begin\n public onBegin(): void {\n this.onBeginEvent.emit(true);\n }\n\n // notify subscribers on signature end\n public onEnd(): void {\n this.onEndEvent.emit(true);\n }\n\n public queryPad(): any {\n return this.signaturePad;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { SignaturePad } from './angular2-signaturepad.component';\n\n@NgModule({\n declarations: [SignaturePad],\n imports: [],\n exports: [SignaturePad],\n})\nexport class SignaturePadModule {}\n","/*\n * Public API Surface of angular2-signaturepad\n */\n\nexport * from './lib/angular2-signaturepad.component';\nexport * from './lib/angular2-signaturepad.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"]}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment