ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
274 lines • 9.04 kB
TypeScript
import * as i0 from "@angular/core";
import { Signal, TemplateRef } from "@angular/core";
import { NzQRCodeI18nInterface } from "ng-zorro-antd/i18n";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
declare namespace qrcodegen {
type bit = number;
type byte = number;
type int = number;
export class QrCode {
readonly version: int;
readonly errorCorrectionLevel: QrCode.Ecc;
static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
static encodeBinary(data: readonly byte[], ecl: QrCode.Ecc): QrCode;
static encodeSegments(segs: readonly QrSegment[], ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
readonly size: int;
readonly mask: int;
private readonly modules;
private readonly isFunction;
constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: readonly byte[], msk: int);
getModule(x: int, y: int): boolean;
getModules(): boolean[][];
private drawFunctionPatterns;
private drawFormatBits;
private drawVersion;
private drawFinderPattern;
private drawAlignmentPattern;
private setFunctionModule;
private addEccAndInterleave;
private drawCodewords;
private applyMask;
private getPenaltyScore;
private getAlignmentPatternPositions;
private static getNumRawDataModules;
private static getNumDataCodewords;
private static reedSolomonComputeDivisor;
private static reedSolomonComputeRemainder;
private static reedSolomonMultiply;
private finderPenaltyCountPatterns;
private finderPenaltyTerminateAndCount;
private finderPenaltyAddHistory;
static readonly MIN_VERSION: int;
static readonly MAX_VERSION: int;
private static readonly PENALTY_N1;
private static readonly PENALTY_N2;
private static readonly PENALTY_N3;
private static readonly PENALTY_N4;
private static readonly ECC_CODEWORDS_PER_BLOCK;
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
}
export class QrSegment {
readonly mode: QrSegment.Mode;
readonly numChars: int;
private readonly bitData;
static makeBytes(data: readonly byte[]): QrSegment;
static makeNumeric(digits: string): QrSegment;
static makeAlphanumeric(text: string): QrSegment;
static makeSegments(text: string): QrSegment[];
static makeEci(assignVal: int): QrSegment;
static isNumeric(text: string): boolean;
static isAlphanumeric(text: string): boolean;
constructor(mode: QrSegment.Mode, numChars: int, bitData: bit[]);
getData(): bit[];
static getTotalBits(segs: readonly QrSegment[], version: int): number;
private static toUtf8ByteArray;
private static readonly NUMERIC_REGEX;
private static readonly ALPHANUMERIC_REGEX;
private static readonly ALPHANUMERIC_CHARSET;
}
export {};
}
declare namespace qrcodegen {
namespace QrCode {
type int = number;
export class Ecc {
readonly ordinal: int;
readonly formatBits: int;
static readonly LOW: Ecc;
static readonly MEDIUM: Ecc;
static readonly QUARTILE: Ecc;
static readonly HIGH: Ecc;
private constructor();
}
export {};
}
}
declare namespace qrcodegen {
namespace QrSegment {
type int = number;
export class Mode {
readonly modeBits: int;
private readonly numBitsCharCount;
static readonly NUMERIC: Mode;
static readonly ALPHANUMERIC: Mode;
static readonly BYTE: Mode;
static readonly KANJI: Mode;
static readonly ECI: Mode;
private constructor();
numCharCountBits(ver: int): int;
}
export {};
}
}
import Ecc$1 = qrcodegen.QrCode.Ecc;
import QrCode$1 = qrcodegen.QrCode;
type Modules = ReturnType<QrCode$1['getModules']>;
interface Excavation {
x: number;
y: number;
w: number;
h: number;
}
type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
type ERROR_LEVEL_MAPPED_TYPE = { [index in ErrorCorrectionLevel]: Ecc$1; };
interface ImageSettings {
/**
* The URI of the embedded image.
*/
src: string;
/**
* The height, in pixels, of the image.
*/
height: number;
/**
* The width, in pixels, of the image.
*/
width: number;
/**
* Whether or not to "excavate" the modules around the embedded image. This
* means that any modules the embedded image overlaps will use the background
* color.
*/
excavate: boolean;
/**
* The horizontal offset of the embedded image, starting from the top left corner.
* Will center if not specified.
*/
x?: number;
/**
* The vertical offset of the embedded image, starting from the top left corner.
* Will center if not specified.
*/
y?: number;
/**
* The opacity of the embedded image in the range of 0-1.
* @defaultValue 1
*/
opacity?: number;
/**
* The cross-origin value to use when loading the image. This is used to
* ensure compatibility with CORS, particularly when extracting image data
* from QRCodeCanvas.
* Note: `undefined` is treated differently than the seemingly equivalent
* empty string. This is intended to align with HTML behavior where omitting
* the attribute behaves differently than the empty string.
*/
crossOrigin?: CrossOrigin;
}
declare namespace qrcode_component_d_exports {
export { NzQRCodeComponent };
}
export declare class NzQRCodeComponent {
private i18n;
locale: Signal<NzQRCodeI18nInterface>;
protected isBrowser: boolean;
readonly nzValue: import("@angular/core").InputSignal<string | string[]>;
readonly nzType: import("@angular/core").InputSignal<"canvas" | "svg">;
readonly nzColor: import("@angular/core").InputSignal<string>;
readonly nzBgColor: import("@angular/core").InputSignal<string>;
readonly nzSize: import("@angular/core").InputSignal<number>;
readonly nzIcon: import("@angular/core").InputSignal<string>;
readonly nzIconSize: import("@angular/core").InputSignal<number>;
readonly nzBordered: import("@angular/core").InputSignal<boolean>;
readonly nzStatus: import("@angular/core").InputSignal<"active" | "expired" | "loading" | "scanned">;
readonly nzLevel: import("@angular/core").InputSignal<ErrorCorrectionLevel>;
readonly nzStatusRender: import("@angular/core").InputSignal<string | TemplateRef<void> | null>;
readonly nzBoostLevel: import("@angular/core").InputSignal<boolean>;
readonly nzPadding: import("@angular/core").InputSignal<number>;
readonly nzRefresh: import("@angular/core").OutputEmitterRef<string>;
margin: import("@angular/core").WritableSignal<number>;
cells: import("@angular/core").WritableSignal<boolean[][]>;
numCells: import("@angular/core").WritableSignal<number>;
calculatedImageSettings: import("@angular/core").WritableSignal<{
x: number;
y: number;
h: number;
w: number;
excavation: Excavation | null;
opacity: number;
crossOrigin: CrossOrigin;
} | null>;
protected imageSettings: Signal<ImageSettings>;
constructor();
reloadQRCode(): void;
updateQRCodeData(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NzQRCodeComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzQRCodeComponent, "nz-qrcode", ["nzQRCode"], {
"nzValue": {
"alias": "nzValue";
"required": false;
"isSignal": true;
};
"nzType": {
"alias": "nzType";
"required": false;
"isSignal": true;
};
"nzColor": {
"alias": "nzColor";
"required": false;
"isSignal": true;
};
"nzBgColor": {
"alias": "nzBgColor";
"required": false;
"isSignal": true;
};
"nzSize": {
"alias": "nzSize";
"required": false;
"isSignal": true;
};
"nzIcon": {
"alias": "nzIcon";
"required": false;
"isSignal": true;
};
"nzIconSize": {
"alias": "nzIconSize";
"required": false;
"isSignal": true;
};
"nzBordered": {
"alias": "nzBordered";
"required": false;
"isSignal": true;
};
"nzStatus": {
"alias": "nzStatus";
"required": false;
"isSignal": true;
};
"nzLevel": {
"alias": "nzLevel";
"required": false;
"isSignal": true;
};
"nzStatusRender": {
"alias": "nzStatusRender";
"required": false;
"isSignal": true;
};
"nzBoostLevel": {
"alias": "nzBoostLevel";
"required": false;
"isSignal": true;
};
"nzPadding": {
"alias": "nzPadding";
"required": false;
"isSignal": true;
};
}, {
"nzRefresh": "nzRefresh";
}, never, never, true, never>;
}
export declare class NzQRCodeModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NzQRCodeModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NzQRCodeModule, never, [typeof NzQRCodeComponent], [typeof NzQRCodeComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NzQRCodeModule>;
}