angularx-qrcode
Version:
Simple QRCode module generator for Angular 4-21 and Ionic 3-8 using node-qrcode
61 lines (57 loc) • 3.23 kB
TypeScript
import * as i0 from '@angular/core';
import { OnChanges, EventEmitter, ElementRef } from '@angular/core';
import { SafeUrl } from '@angular/platform-browser';
type QRCodeErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H' | 'low' | 'medium' | 'quartile' | 'high';
interface QRCodeConfigType {
color: {
dark: string;
light: string;
};
errorCorrectionLevel: QRCodeErrorCorrectionLevel;
margin: number;
scale: number;
version?: QRCodeVersion;
width: number;
}
type QRCodeElementType = 'url' | 'img' | 'canvas' | 'svg';
type QRCodeVersion = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40;
type RGBAColor = `#${string}`;
type FixMeLater = any;
declare class QRCodeComponent implements OnChanges {
allowEmptyString: boolean;
colorDark: string;
colorLight: string;
cssClass: string;
elementType: QRCodeElementType;
errorCorrectionLevel: QRCodeErrorCorrectionLevel;
imageSrc?: string;
imageHeight?: number | string;
imageWidth?: number | string;
margin: number;
qrdata: string;
scale: number;
version?: QRCodeVersion;
width: number;
alt?: string;
ariaLabel?: string;
title?: string;
qrCodeURL: EventEmitter<SafeUrl>;
qrcElement: ElementRef;
context: CanvasRenderingContext2D | null;
private centerImage?;
private renderer;
private sanitizer;
ngOnChanges(): Promise<void>;
protected isValidQrCodeText(data: string | null): boolean;
private toDataURL;
private toCanvas;
private toSVG;
private renderElement;
private createQRCode;
convertBase64ImageUrlToBlob(base64ImageUrl: string): Blob;
emitQRCodeURL(element: HTMLCanvasElement | HTMLImageElement | SVGSVGElement): void;
static ɵfac: i0.ɵɵFactoryDeclaration<QRCodeComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<QRCodeComponent, "qrcode", never, { "allowEmptyString": { "alias": "allowEmptyString"; "required": false; }; "colorDark": { "alias": "colorDark"; "required": false; }; "colorLight": { "alias": "colorLight"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "elementType": { "alias": "elementType"; "required": false; }; "errorCorrectionLevel": { "alias": "errorCorrectionLevel"; "required": false; }; "imageSrc": { "alias": "imageSrc"; "required": false; }; "imageHeight": { "alias": "imageHeight"; "required": false; }; "imageWidth": { "alias": "imageWidth"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "qrdata": { "alias": "qrdata"; "required": false; }; "scale": { "alias": "scale"; "required": false; }; "version": { "alias": "version"; "required": false; }; "width": { "alias": "width"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, { "qrCodeURL": "qrCodeURL"; }, never, never, true, never>;
}
export { QRCodeComponent };
export type { FixMeLater, QRCodeConfigType, QRCodeElementType, QRCodeErrorCorrectionLevel, QRCodeVersion, RGBAColor };