@progress/kendo-charts
Version:
Kendo UI platform-independent Charts library
132 lines (115 loc) • 3.82 kB
TypeScript
import { Group } from '@progress/kendo-drawing';
import { Border, Padding, RenderMode } from './field-types';
import { ValidationResult } from './validation';
/**
* The QR Code encoding modes.
*/
export type QRCodeEncoding =
'ISO_8859_1' | 'UTF_8';
/**
* The QR Code error correction levels.
*
* * "L" - approximately 7% of the codewords can be restored.
* * "M" - approximately 15% of the codewords can be restored.
* * "Q" - approximately 25% of the codewords can be restored.
* * "H" - approximately 30% of the codewords can be restored.
*/
export type QRCodeErrorCorrection =
'L' | 'M' | 'Q' | 'H';
/**
* The QR Code image overlay configuration.
*/
export interface QRCodeOverlay {
height?: number;
imageUrl?: string;
type?: 'image' | 'swiss';
width?: number;
}
/**
* The QR Code configuration options.
*/
export interface QRCodeOptions {
/**
* The background color of the QR code. Accepts a valid CSS color string, including hex and rgb.
*
* @default "white"
*/
background?: string;
/**
* The border of the QR code.
*/
border?: Border;
/**
* The color of the QR code. Accepts a valid CSS color string, including hex and rgb.
*
* @default "black"
*/
color?: string;
/**
* The encoding mode used to encode the value.
*
* > *Important:* The UTF-8 encoding is not included in the specifications and is not supported by all readers.
*
* The possible values are:
* * "ISO_8859_1" - supports all characters from the [ISO/IEC 8859-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) character set.
* * "UTF_8" - supports all [Unicode](https://en.wikipedia.org/wiki/List_of_Unicode_characters) characters.
*
* @default "ISO_8859_1"
*/
encoding?: QRCodeEncoding;
/**
* The error correction level to use.
*
* The possible values are:
* * "L" - approximately 7% of the codewords can be restored.
* * "M" - approximately 15% of the codewords can be restored.
* * "Q" - approximately 25% of the codewords can be restored.
* * "H" - approximately 30% of the codewords can be restored.
*
* @default "L"
*/
errorCorrection?: QRCodeErrorCorrection;
/**
* An optional image overlay that will placed over the QR Code.
*
* > **Note:** Always test if the code reads correctly with the overlay.
* > Depending on the length of the value and the size of the overlay, you might need to raise the `errorCorrection` to "M" or "H".
*/
overlay?: QRCodeOverlay;
/**
* The padding of the QR Code. A numeric value sets all paddings.
*
* @default 0
*/
padding?: Padding | number;
/**
* Sets the preferred rendering mode of the QR Code.
*
* The supported values are:
* * "canvas" - renders the component as a Canvas element.
* * "svg" - renders the component as an inline SVG document.
*
* @default "svg"
*/
renderAs?: RenderMode;
/**
* Specifies the size of a QR Code. Numeric values are treated as pixels.
*
* If no size is specified, it will be determined from the element width and height.
* In case the element has width or height of zero, a default value of 200 pixels will be used.
*
* @default "200px"
*/
size?: number | string;
/**
* The value of the QR Code.
*/
value: number | string;
}
export class QRCode {
constructor(element: Element, options: QRCodeOptions, errorHandler?: (error: Error) => void);
public redraw(): void;
public setOptions(options: QRCodeOptions): void;
public exportVisual(): Group;
}
export function qrcodeValidator(encoding: QRCodeEncoding): (value: number | string) => ValidationResult;