@progress/kendo-angular-barcodes 1.0.0-next.202203230834 → 2.0.0-dev.202204131407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { qrcodeValidator } from '@progress/kendo-charts';
6
+ /**
7
+ * Creates a value validator for a particular Barcode type.
8
+ *
9
+ * @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
10
+ * @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
11
+ *
12
+ * @example
13
+ * ```ts-no-run
14
+ * const control = new FormControl('Фоо', createQRCodeValidator());
15
+ * console.log(control.errors);
16
+ *
17
+ * // {
18
+ * // qrcode: {
19
+ * // message: 'Unsupported character in QR Code: "Ф".',
20
+ * // value: '1234',
21
+ * // type: 'EAN13'
22
+ * // }
23
+ * // }
24
+ * ```
25
+ */
26
+ export const createQRCodeValidator = (encoding = 'ISO_8859_1') => {
27
+ const validator = qrcodeValidator(encoding);
28
+ return (control) => {
29
+ if (!control.value) {
30
+ return null;
31
+ }
32
+ const result = validator(control.value);
33
+ if (result.valid === true) {
34
+ return null;
35
+ }
36
+ return {
37
+ qrcode: {
38
+ message: result.error.message,
39
+ value: control.value,
40
+ encoding: encoding
41
+ }
42
+ };
43
+ };
44
+ };
@@ -0,0 +1,122 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
6
+ import { QRCode } from '@progress/kendo-charts';
7
+ import { BaseComponent } from './base.component';
8
+ import { packageMetadata } from './package-metadata';
9
+ import * as i0 from "@angular/core";
10
+ import * as i1 from "@progress/kendo-angular-common";
11
+ const DEFAULT_COLOR = '#000';
12
+ const DEFAULT_BACKGROUND = '#fff';
13
+ const DEFAULT_ERROR_CORRECTION = 'L';
14
+ /**
15
+ * Represents the Kendo UI QR Code component for Angular.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { Component } from '@angular/core';
20
+ *
21
+ * _@Component({
22
+ * selector: 'my-app',
23
+ * template: `
24
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
25
+ * </kendo-qrcode>
26
+ * `
27
+ * })
28
+ * export class AppComponent {
29
+ * }
30
+ * ```
31
+ */
32
+ export class QRCodeComponent extends BaseComponent {
33
+ constructor(element, renderer, ngZone) {
34
+ super(element, renderer, ngZone);
35
+ this.element = element;
36
+ this.renderer = renderer;
37
+ this.ngZone = ngZone;
38
+ /**
39
+ * Limits the automatic resizing of the QR Code. Sets the maximum number of times per second
40
+ * that the component redraws its content when the size of its container changes.
41
+ * Defaults to `10`. To disable the automatic resizing, set it to `0`.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * _@Component({
46
+ * selector: 'my-app',
47
+ * template: `
48
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
49
+ * [resizeRateLimit]="2">
50
+ * </kendo-qrcode>
51
+ * `
52
+ * })
53
+ * export class AppComponent {
54
+ * }
55
+ * ```
56
+ */
57
+ this.resizeRateLimit = 10;
58
+ }
59
+ get options() {
60
+ return {
61
+ background: this.background || DEFAULT_BACKGROUND,
62
+ border: this.border,
63
+ color: this.color || DEFAULT_COLOR,
64
+ encoding: this.encoding,
65
+ errorCorrection: this.errorCorrection || DEFAULT_ERROR_CORRECTION,
66
+ overlay: this.overlay || {},
67
+ padding: this.padding,
68
+ renderAs: this.renderAs,
69
+ size: this.size,
70
+ value: this.value
71
+ };
72
+ }
73
+ createInstance(element, options) {
74
+ return new QRCode(element, options, this.onError.bind(this));
75
+ }
76
+ onError(error) {
77
+ error.name = packageMetadata.productName + ' QRCode';
78
+ if (this.isDevMode()) {
79
+ throw error;
80
+ }
81
+ else {
82
+ console.warn(error);
83
+ }
84
+ }
85
+ }
86
+ QRCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
87
+ QRCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: QRCodeComponent, selector: "kendo-qrcode", inputs: { background: "background", border: "border", color: "color", encoding: "encoding", errorCorrection: "errorCorrection", overlay: "overlay", padding: "padding", renderAs: "renderAs", size: "size", value: "value", resizeRateLimit: "resizeRateLimit" }, exportAs: ["kendoQRCode"], usesInheritance: true, ngImport: i0, template: `
88
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
89
+ `, isInline: true, components: [{ type: i1.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeComponent, decorators: [{
91
+ type: Component,
92
+ args: [{
93
+ changeDetection: ChangeDetectionStrategy.OnPush,
94
+ selector: 'kendo-qrcode',
95
+ exportAs: 'kendoQRCode',
96
+ template: `
97
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
98
+ `
99
+ }]
100
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { background: [{
101
+ type: Input
102
+ }], border: [{
103
+ type: Input
104
+ }], color: [{
105
+ type: Input
106
+ }], encoding: [{
107
+ type: Input
108
+ }], errorCorrection: [{
109
+ type: Input
110
+ }], overlay: [{
111
+ type: Input
112
+ }], padding: [{
113
+ type: Input
114
+ }], renderAs: [{
115
+ type: Input
116
+ }], size: [{
117
+ type: Input
118
+ }], value: [{
119
+ type: Input
120
+ }], resizeRateLimit: [{
121
+ type: Input
122
+ }] } });
@@ -0,0 +1,52 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { NgModule } from '@angular/core';
6
+ import { ResizeSensorModule } from '@progress/kendo-angular-common';
7
+ import { QRCodeComponent } from './qrcode.component';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
11
+ * definition for the QR Code component.
12
+ *
13
+ * @example
14
+ *
15
+ * ```ts-no-run
16
+ * // Import the QR Code module
17
+ * import { QRCodeModule } from '@progress/kendo-angular-barcodes';
18
+ *
19
+ * // The browser platform with a compiler
20
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
21
+ *
22
+ * import { NgModule } from '@angular/core';
23
+ *
24
+ * // Import the app component
25
+ * import { AppComponent } from './app.component';
26
+ *
27
+ * // Define the app module
28
+ * _@NgModule({
29
+ * declarations: [AppComponent], // declare app component
30
+ * imports: [BrowserModule, QRCodeModule], // import QRCodeModule module
31
+ * bootstrap: [AppComponent]
32
+ * })
33
+ * export class AppModule {}
34
+ *
35
+ * // Compile and launch the module
36
+ * platformBrowserDynamic().bootstrapModule(AppModule);
37
+ *
38
+ * ```
39
+ */
40
+ export class QRCodeModule {
41
+ }
42
+ QRCodeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
43
+ QRCodeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeModule, declarations: [QRCodeComponent], imports: [ResizeSensorModule], exports: [QRCodeComponent] });
44
+ QRCodeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeModule, imports: [[ResizeSensorModule]] });
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QRCodeModule, decorators: [{
46
+ type: NgModule,
47
+ args: [{
48
+ declarations: [QRCodeComponent],
49
+ imports: [ResizeSensorModule],
50
+ exports: [QRCodeComponent]
51
+ }]
52
+ }] });