UNPKG

ngx-angular-qrcode

Version:

This library allow you to create beautiful QR Codes in Angular application.

2 lines 6.36 kB
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("qr-code-styling")):"function"==typeof define&&define.amd?define("ngx-angular-qrcode",["exports","@angular/core","qr-code-styling"],t):t((o=o||self)["ngx-angular-qrcode"]={},o.ng.core,o.QRCodeStyling)}(this,(function(o,t,r){"use strict";r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var e=function(){return(e=Object.assign||function(o){for(var t,r=1,e=arguments.length;r<e;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o}).apply(this,arguments)};function n(o,t,r,e){var n,i=arguments.length,p=i<3?t:null===e?e=Object.getOwnPropertyDescriptor(t,r):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(o,t,r,e);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(p=(i<3?n(p):i>3?n(t,r,p):n(t,r))||p);return i>3&&p&&Object.defineProperty(t,r,p),p}var i=function(){function o(){}return o.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new o},token:o,providedIn:"root"}),o=n([t.Injectable({providedIn:"root"})],o)}(),p=124,a=124,d={width:240,height:240,shape:"square",type:"canvas",data:"draft",margin:5,dotsOptions:{type:"dots",color:"#000000"},backgroundOptions:{color:"#ffffff"},cornersSquareOptions:{type:"square",color:"#000000"},cornersDotOptions:{type:"square",color:"#000000"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,margin:5,crossOrigin:"anonymous"}},s=function(){function o(){}return o.prototype.ngOnInit=function(){},o.prototype.ngOnChanges=function(o){this.displayQr()},o.prototype.ngAfterContentInit=function(){console.debug("🔥 this.qrData",this.qrData),this.displayQr()},o.prototype.displayQr=function(){var o,t,n,i,s,c,u;if(r){this.qrCodeCanvas.nativeElement.innerHTML="";var l={type:this.dotsGradientType,rotation:this.dotsGradientRotation,colorStops:[{offset:0,color:this.dotsStartColor},{offset:1,color:this.dotsEndColor}]},y={type:this.cornerSquareGradientType,rotation:this.cornerSquareGradientRotation,colorStops:[{offset:0,color:this.cornerSquareStartColor},{offset:1,color:this.cornerSquareEndColor}]},g={type:this.backgroundGradientType,rotation:this.backgroundGradientRotation,colorStops:[{offset:0,color:this.backgroundStartColor},{offset:1,color:this.backgroundEndColor}]},v={type:this.cornerDotGradientType,rotation:this.cornerDotGradientRotation,colorStops:[{offset:0,color:this.cornerDotStartColor},{offset:1,color:this.cornerDotEndColor}]},h=e(e({},d),{shape:this.shape,width:this.width||p,height:this.height||a,margin:this.margin||d.margin,data:this.qrData||"https://qrtrac.com",image:this.imageUrl,dotsOptions:e({type:this.dotsType||(null===(o=d.dotsOptions)||void 0===o?void 0:o.type),color:this.dotsColor},this.dotsGradient&&{gradient:l}),cornersSquareOptions:e({type:this.cornerSquareType||(null===(t=d.cornersSquareOptions)||void 0===t?void 0:t.type),color:this.cornerSquareColor},this.cornerSquareGradient&&{gradient:y}),cornersDotOptions:e({type:this.cornerDotType||(null===(n=d.cornersDotOptions)||void 0===n?void 0:n.type),color:this.cornerDotColor},this.cornerDotGradient&&{gradient:v}),backgroundOptions:e({color:this.backgroundColor},this.backgroundGradient&&{gradient:g}),imageOptions:{imageSize:this.imageSize||(null===(i=d.imageOptions)||void 0===i?void 0:i.imageSize),margin:this.imageMargin||(null===(s=d.imageOptions)||void 0===s?void 0:s.margin),hideBackgroundDots:this.hideImageBackgroundDots||(null===(c=d.imageOptions)||void 0===c?void 0:c.hideBackgroundDots)},qrOptions:{errorCorrectionLevel:this.errorCorrectionLevel||(null===(u=d.qrOptions)||void 0===u?void 0:u.errorCorrectionLevel)}});this.qrCodeStyle=new r(h),this.qrCodeStyle.append(this.qrCodeCanvas.nativeElement)}},o.prototype.download=function(o,t){console.debug("🔥 download called"),this.qrCodeStyle.download({name:t||"ngxs-qrcode",extension:o})},n([t.ViewChild("qrCodeCanvas",{static:!0})],o.prototype,"qrCodeCanvas",void 0),n([t.Input()],o.prototype,"qrData",void 0),n([t.Input()],o.prototype,"imageUrl",void 0),n([t.Input()],o.prototype,"shape",void 0),n([t.Input()],o.prototype,"width",void 0),n([t.Input()],o.prototype,"height",void 0),n([t.Input()],o.prototype,"margin",void 0),n([t.Input()],o.prototype,"dotsType",void 0),n([t.Input()],o.prototype,"dotsGradient",void 0),n([t.Input()],o.prototype,"dotsGradientType",void 0),n([t.Input()],o.prototype,"dotsGradientRotation",void 0),n([t.Input()],o.prototype,"dotsColor",void 0),n([t.Input()],o.prototype,"dotsStartColor",void 0),n([t.Input()],o.prototype,"dotsEndColor",void 0),n([t.Input()],o.prototype,"cornerSquareType",void 0),n([t.Input()],o.prototype,"cornerSquareGradient",void 0),n([t.Input()],o.prototype,"cornerSquareGradientType",void 0),n([t.Input()],o.prototype,"cornerSquareGradientRotation",void 0),n([t.Input()],o.prototype,"cornerSquareColor",void 0),n([t.Input()],o.prototype,"cornerSquareStartColor",void 0),n([t.Input()],o.prototype,"cornerSquareEndColor",void 0),n([t.Input()],o.prototype,"cornerDotType",void 0),n([t.Input()],o.prototype,"cornerDotGradient",void 0),n([t.Input()],o.prototype,"cornerDotGradientType",void 0),n([t.Input()],o.prototype,"cornerDotGradientRotation",void 0),n([t.Input()],o.prototype,"cornerDotColor",void 0),n([t.Input()],o.prototype,"cornerDotStartColor",void 0),n([t.Input()],o.prototype,"cornerDotEndColor",void 0),n([t.Input()],o.prototype,"backgroundType",void 0),n([t.Input()],o.prototype,"backgroundGradient",void 0),n([t.Input()],o.prototype,"backgroundGradientType",void 0),n([t.Input()],o.prototype,"backgroundGradientRotation",void 0),n([t.Input()],o.prototype,"backgroundColor",void 0),n([t.Input()],o.prototype,"backgroundStartColor",void 0),n([t.Input()],o.prototype,"backgroundEndColor",void 0),n([t.Input()],o.prototype,"imageSize",void 0),n([t.Input()],o.prototype,"imageMargin",void 0),n([t.Input()],o.prototype,"hideImageBackgroundDots",void 0),n([t.Input()],o.prototype,"errorCorrectionLevel",void 0),o=n([t.Component({selector:"qr-code",template:"\n <div #qrCodeCanvas></div> \n "})],o)}(),c=function(){function o(){}return o=n([t.NgModule({declarations:[s],imports:[],exports:[s]})],o)}();o.NgxAngularQrcodeComponent=s,o.NgxAngularQrcodeModule=c,o.NgxAngularQrcodeService=i,Object.defineProperty(o,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-angular-qrcode.umd.min.js.map