@progress/kendo-angular-barcodes 0.1.1 → 0.2.0
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.
- package/dist/cdn/js/kendo-angular-barcodes.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/barcode-validator.js +51 -0
- package/dist/es/barcode.component.js +11 -1
- package/dist/es/base.component.js +4 -1
- package/dist/es/main.js +2 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/qrcode-validator.js +45 -0
- package/dist/es/qrcode.component.js +11 -1
- package/dist/es2015/barcode-validator.d.ts +28 -0
- package/dist/es2015/barcode-validator.js +51 -0
- package/dist/es2015/barcode.component.d.ts +1 -0
- package/dist/es2015/barcode.component.js +11 -1
- package/dist/es2015/base.component.d.ts +1 -0
- package/dist/es2015/base.component.js +4 -1
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +2 -0
- package/dist/es2015/main.js +2 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/qrcode-validator.d.ts +26 -0
- package/dist/es2015/qrcode-validator.js +44 -0
- package/dist/es2015/qrcode.component.d.ts +1 -0
- package/dist/es2015/qrcode.component.js +11 -1
- package/dist/fesm2015/index.js +112 -6
- package/dist/fesm5/index.js +113 -6
- package/dist/npm/barcode-validator.js +53 -0
- package/dist/npm/barcode.component.js +11 -1
- package/dist/npm/base.component.js +3 -0
- package/dist/npm/main.js +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/qrcode-validator.js +47 -0
- package/dist/npm/qrcode.component.js +11 -1
- package/dist/systemjs/kendo-angular-barcodes.js +1 -1
- package/package.json +4 -2
package/dist/fesm2015/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { __decorate, __metadata } from 'tslib';
|
|
6
|
-
import { Input, ViewChild, ElementRef, Component, ChangeDetectionStrategy, Renderer2, NgZone, NgModule } from '@angular/core';
|
|
7
|
-
import { Barcode, QRCode } from '@progress/kendo-charts';
|
|
6
|
+
import { isDevMode, Input, ViewChild, ElementRef, Component, ChangeDetectionStrategy, Renderer2, NgZone, NgModule } from '@angular/core';
|
|
7
|
+
import { Barcode, QRCode, barcodeValidator, qrcodeValidator } from '@progress/kendo-charts';
|
|
8
8
|
import { isDocumentAvailable, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
9
9
|
import { exportImage, exportSVG } from '@progress/kendo-drawing';
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
@@ -16,7 +16,7 @@ const packageMetadata = {
|
|
|
16
16
|
name: '@progress/kendo-angular-barcodes',
|
|
17
17
|
productName: 'Kendo UI for Angular',
|
|
18
18
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
19
|
-
publishDate:
|
|
19
|
+
publishDate: 1641993026,
|
|
20
20
|
version: '',
|
|
21
21
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
22
22
|
};
|
|
@@ -104,6 +104,9 @@ class BaseComponent {
|
|
|
104
104
|
this.instance.setOptions(this.options);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
isDevMode() {
|
|
108
|
+
return isDevMode();
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
111
|
__decorate([
|
|
109
112
|
Input(),
|
|
@@ -175,7 +178,16 @@ let BarcodeComponent = class BarcodeComponent extends BaseComponent {
|
|
|
175
178
|
};
|
|
176
179
|
}
|
|
177
180
|
createInstance(element, options) {
|
|
178
|
-
return new Barcode(element, options);
|
|
181
|
+
return new Barcode(element, options, this.onError.bind(this));
|
|
182
|
+
}
|
|
183
|
+
onError(error) {
|
|
184
|
+
error.name = packageMetadata.productName + ' Barcode';
|
|
185
|
+
if (this.isDevMode()) {
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
console.warn(error);
|
|
190
|
+
}
|
|
179
191
|
}
|
|
180
192
|
};
|
|
181
193
|
__decorate([
|
|
@@ -303,7 +315,16 @@ let QRCodeComponent = class QRCodeComponent extends BaseComponent {
|
|
|
303
315
|
};
|
|
304
316
|
}
|
|
305
317
|
createInstance(element, options) {
|
|
306
|
-
return new QRCode(element, options);
|
|
318
|
+
return new QRCode(element, options, this.onError.bind(this));
|
|
319
|
+
}
|
|
320
|
+
onError(error) {
|
|
321
|
+
error.name = packageMetadata.productName + ' QRCode';
|
|
322
|
+
if (this.isDevMode()) {
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
console.warn(error);
|
|
327
|
+
}
|
|
307
328
|
}
|
|
308
329
|
};
|
|
309
330
|
__decorate([
|
|
@@ -485,8 +506,93 @@ BarcodesModule = __decorate([
|
|
|
485
506
|
})
|
|
486
507
|
], BarcodesModule);
|
|
487
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @hidden
|
|
511
|
+
*/
|
|
512
|
+
const isPresent = (value) => value !== null && value !== undefined;
|
|
513
|
+
/**
|
|
514
|
+
* Creates a value validator for a particular Barcode type.
|
|
515
|
+
*
|
|
516
|
+
* @param {BarcodeType} type The type of the Barcode.
|
|
517
|
+
* @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
|
|
518
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts-no-run
|
|
522
|
+
* const control = new FormControl('1234', createBarcodeValidator('EAN8'));
|
|
523
|
+
* console.log(control.errors);
|
|
524
|
+
*
|
|
525
|
+
* // {
|
|
526
|
+
* // barcode: {
|
|
527
|
+
* // message: 'The value of the "EAN13" encoding should be 12 symbols',
|
|
528
|
+
* // value: '1234',
|
|
529
|
+
* // type: 'EAN13'
|
|
530
|
+
* // }
|
|
531
|
+
* // }
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
const createBarcodeValidator = (type, size) => {
|
|
535
|
+
const validator = barcodeValidator(type, size);
|
|
536
|
+
return (control) => {
|
|
537
|
+
if (!isPresent(control.value) || control.value === '') {
|
|
538
|
+
return null;
|
|
539
|
+
}
|
|
540
|
+
const result = validator(control.value);
|
|
541
|
+
if (result.valid === true) {
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
return {
|
|
545
|
+
barcode: {
|
|
546
|
+
message: result.error.message,
|
|
547
|
+
value: control.value,
|
|
548
|
+
type: type
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Creates a value validator for a particular Barcode type.
|
|
556
|
+
*
|
|
557
|
+
* @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
|
|
558
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts-no-run
|
|
562
|
+
* const control = new FormControl('Фоо', createQRCodeValidator());
|
|
563
|
+
* console.log(control.errors);
|
|
564
|
+
*
|
|
565
|
+
* // {
|
|
566
|
+
* // qrcode: {
|
|
567
|
+
* // message: 'Unsupported character in QR Code: "Ф".',
|
|
568
|
+
* // value: '1234',
|
|
569
|
+
* // type: 'EAN13'
|
|
570
|
+
* // }
|
|
571
|
+
* // }
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
const createQRCodeValidator = (encoding = 'ISO_8859_1') => {
|
|
575
|
+
const validator = qrcodeValidator(encoding);
|
|
576
|
+
return (control) => {
|
|
577
|
+
if (!control.value) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
const result = validator(control.value);
|
|
581
|
+
if (result.valid === true) {
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
return {
|
|
585
|
+
qrcode: {
|
|
586
|
+
message: result.error.message,
|
|
587
|
+
value: control.value,
|
|
588
|
+
encoding: encoding
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
|
|
488
594
|
/**
|
|
489
595
|
* Generated bundle index. Do not edit.
|
|
490
596
|
*/
|
|
491
597
|
|
|
492
|
-
export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule };
|
|
598
|
+
export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule, createBarcodeValidator, createQRCodeValidator };
|
package/dist/fesm5/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { __decorate, __metadata, __extends } from 'tslib';
|
|
6
|
-
import { Input, ViewChild, ElementRef, Component, ChangeDetectionStrategy, Renderer2, NgZone, NgModule } from '@angular/core';
|
|
7
|
-
import { Barcode, QRCode } from '@progress/kendo-charts';
|
|
6
|
+
import { isDevMode, Input, ViewChild, ElementRef, Component, ChangeDetectionStrategy, Renderer2, NgZone, NgModule } from '@angular/core';
|
|
7
|
+
import { Barcode, QRCode, barcodeValidator, qrcodeValidator } from '@progress/kendo-charts';
|
|
8
8
|
import { isDocumentAvailable, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
9
9
|
import { exportImage, exportSVG } from '@progress/kendo-drawing';
|
|
10
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
@@ -16,7 +16,7 @@ var packageMetadata = {
|
|
|
16
16
|
name: '@progress/kendo-angular-barcodes',
|
|
17
17
|
productName: 'Kendo UI for Angular',
|
|
18
18
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
19
|
-
publishDate:
|
|
19
|
+
publishDate: 1641993026,
|
|
20
20
|
version: '',
|
|
21
21
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
22
22
|
};
|
|
@@ -114,6 +114,9 @@ var BaseComponent = /** @class */ (function () {
|
|
|
114
114
|
this.instance.setOptions(this.options);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
+
BaseComponent.prototype.isDevMode = function () {
|
|
118
|
+
return isDevMode();
|
|
119
|
+
};
|
|
117
120
|
__decorate([
|
|
118
121
|
Input(),
|
|
119
122
|
__metadata("design:type", Number)
|
|
@@ -192,7 +195,16 @@ var BarcodeComponent = /** @class */ (function (_super) {
|
|
|
192
195
|
configurable: true
|
|
193
196
|
});
|
|
194
197
|
BarcodeComponent.prototype.createInstance = function (element, options) {
|
|
195
|
-
return new Barcode(element, options);
|
|
198
|
+
return new Barcode(element, options, this.onError.bind(this));
|
|
199
|
+
};
|
|
200
|
+
BarcodeComponent.prototype.onError = function (error) {
|
|
201
|
+
error.name = packageMetadata.productName + ' Barcode';
|
|
202
|
+
if (this.isDevMode()) {
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
console.warn(error);
|
|
207
|
+
}
|
|
196
208
|
};
|
|
197
209
|
__decorate([
|
|
198
210
|
Input(),
|
|
@@ -325,7 +337,16 @@ var QRCodeComponent = /** @class */ (function (_super) {
|
|
|
325
337
|
configurable: true
|
|
326
338
|
});
|
|
327
339
|
QRCodeComponent.prototype.createInstance = function (element, options) {
|
|
328
|
-
return new QRCode(element, options);
|
|
340
|
+
return new QRCode(element, options, this.onError.bind(this));
|
|
341
|
+
};
|
|
342
|
+
QRCodeComponent.prototype.onError = function (error) {
|
|
343
|
+
error.name = packageMetadata.productName + ' QRCode';
|
|
344
|
+
if (this.isDevMode()) {
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
console.warn(error);
|
|
349
|
+
}
|
|
329
350
|
};
|
|
330
351
|
__decorate([
|
|
331
352
|
Input(),
|
|
@@ -515,8 +536,94 @@ var BarcodesModule = /** @class */ (function () {
|
|
|
515
536
|
return BarcodesModule;
|
|
516
537
|
}());
|
|
517
538
|
|
|
539
|
+
/**
|
|
540
|
+
* @hidden
|
|
541
|
+
*/
|
|
542
|
+
var isPresent = function (value) { return value !== null && value !== undefined; };
|
|
543
|
+
/**
|
|
544
|
+
* Creates a value validator for a particular Barcode type.
|
|
545
|
+
*
|
|
546
|
+
* @param {BarcodeType} type The type of the Barcode.
|
|
547
|
+
* @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
|
|
548
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```ts-no-run
|
|
552
|
+
* const control = new FormControl('1234', createBarcodeValidator('EAN8'));
|
|
553
|
+
* console.log(control.errors);
|
|
554
|
+
*
|
|
555
|
+
* // {
|
|
556
|
+
* // barcode: {
|
|
557
|
+
* // message: 'The value of the "EAN13" encoding should be 12 symbols',
|
|
558
|
+
* // value: '1234',
|
|
559
|
+
* // type: 'EAN13'
|
|
560
|
+
* // }
|
|
561
|
+
* // }
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
var createBarcodeValidator = function (type, size) {
|
|
565
|
+
var validator = barcodeValidator(type, size);
|
|
566
|
+
return function (control) {
|
|
567
|
+
if (!isPresent(control.value) || control.value === '') {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
var result = validator(control.value);
|
|
571
|
+
if (result.valid === true) {
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
barcode: {
|
|
576
|
+
message: result.error.message,
|
|
577
|
+
value: control.value,
|
|
578
|
+
type: type
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Creates a value validator for a particular Barcode type.
|
|
586
|
+
*
|
|
587
|
+
* @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
|
|
588
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts-no-run
|
|
592
|
+
* const control = new FormControl('Фоо', createQRCodeValidator());
|
|
593
|
+
* console.log(control.errors);
|
|
594
|
+
*
|
|
595
|
+
* // {
|
|
596
|
+
* // qrcode: {
|
|
597
|
+
* // message: 'Unsupported character in QR Code: "Ф".',
|
|
598
|
+
* // value: '1234',
|
|
599
|
+
* // type: 'EAN13'
|
|
600
|
+
* // }
|
|
601
|
+
* // }
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
var createQRCodeValidator = function (encoding) {
|
|
605
|
+
if (encoding === void 0) { encoding = 'ISO_8859_1'; }
|
|
606
|
+
var validator = qrcodeValidator(encoding);
|
|
607
|
+
return function (control) {
|
|
608
|
+
if (!control.value) {
|
|
609
|
+
return null;
|
|
610
|
+
}
|
|
611
|
+
var result = validator(control.value);
|
|
612
|
+
if (result.valid === true) {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
qrcode: {
|
|
617
|
+
message: result.error.message,
|
|
618
|
+
value: control.value,
|
|
619
|
+
encoding: encoding
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
|
|
518
625
|
/**
|
|
519
626
|
* Generated bundle index. Do not edit.
|
|
520
627
|
*/
|
|
521
628
|
|
|
522
|
-
export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule };
|
|
629
|
+
export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule, createBarcodeValidator, createQRCodeValidator };
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var kendo_charts_1 = require("@progress/kendo-charts");
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
var isPresent = function (value) { return value !== null && value !== undefined; };
|
|
12
|
+
var ɵ0 = isPresent;
|
|
13
|
+
exports.ɵ0 = ɵ0;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a value validator for a particular Barcode type.
|
|
16
|
+
*
|
|
17
|
+
* @param {BarcodeType} type The type of the Barcode.
|
|
18
|
+
* @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
|
|
19
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts-no-run
|
|
23
|
+
* const control = new FormControl('1234', createBarcodeValidator('EAN8'));
|
|
24
|
+
* console.log(control.errors);
|
|
25
|
+
*
|
|
26
|
+
* // {
|
|
27
|
+
* // barcode: {
|
|
28
|
+
* // message: 'The value of the "EAN13" encoding should be 12 symbols',
|
|
29
|
+
* // value: '1234',
|
|
30
|
+
* // type: 'EAN13'
|
|
31
|
+
* // }
|
|
32
|
+
* // }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
exports.createBarcodeValidator = function (type, size) {
|
|
36
|
+
var validator = kendo_charts_1.barcodeValidator(type, size);
|
|
37
|
+
return function (control) {
|
|
38
|
+
if (!isPresent(control.value) || control.value === '') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
var result = validator(control.value);
|
|
42
|
+
if (result.valid === true) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
barcode: {
|
|
47
|
+
message: result.error.message,
|
|
48
|
+
value: control.value,
|
|
49
|
+
type: type
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -8,6 +8,7 @@ var tslib_1 = require("tslib");
|
|
|
8
8
|
var core_1 = require("@angular/core");
|
|
9
9
|
var kendo_charts_1 = require("@progress/kendo-charts");
|
|
10
10
|
var base_component_1 = require("./base.component");
|
|
11
|
+
var package_metadata_1 = require("./package-metadata");
|
|
11
12
|
/**
|
|
12
13
|
* Represents the Kendo UI Barcode component for Angular.
|
|
13
14
|
*
|
|
@@ -75,7 +76,16 @@ var BarcodeComponent = /** @class */ (function (_super) {
|
|
|
75
76
|
configurable: true
|
|
76
77
|
});
|
|
77
78
|
BarcodeComponent.prototype.createInstance = function (element, options) {
|
|
78
|
-
return new kendo_charts_1.Barcode(element, options);
|
|
79
|
+
return new kendo_charts_1.Barcode(element, options, this.onError.bind(this));
|
|
80
|
+
};
|
|
81
|
+
BarcodeComponent.prototype.onError = function (error) {
|
|
82
|
+
error.name = package_metadata_1.packageMetadata.productName + ' Barcode';
|
|
83
|
+
if (this.isDevMode()) {
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.warn(error);
|
|
88
|
+
}
|
|
79
89
|
};
|
|
80
90
|
tslib_1.__decorate([
|
|
81
91
|
core_1.Input(),
|
|
@@ -103,6 +103,9 @@ var BaseComponent = /** @class */ (function () {
|
|
|
103
103
|
this.instance.setOptions(this.options);
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
+
BaseComponent.prototype.isDevMode = function () {
|
|
107
|
+
return core_1.isDevMode();
|
|
108
|
+
};
|
|
106
109
|
tslib_1.__decorate([
|
|
107
110
|
core_1.Input(),
|
|
108
111
|
tslib_1.__metadata("design:type", Number)
|
package/dist/npm/main.js
CHANGED
|
@@ -14,3 +14,7 @@ var qrcode_module_1 = require("./qrcode.module");
|
|
|
14
14
|
exports.QRCodeModule = qrcode_module_1.QRCodeModule;
|
|
15
15
|
var barcodes_module_1 = require("./barcodes.module");
|
|
16
16
|
exports.BarcodesModule = barcodes_module_1.BarcodesModule;
|
|
17
|
+
var barcode_validator_1 = require("./barcode-validator");
|
|
18
|
+
exports.createBarcodeValidator = barcode_validator_1.createBarcodeValidator;
|
|
19
|
+
var qrcode_validator_1 = require("./qrcode-validator");
|
|
20
|
+
exports.createQRCodeValidator = qrcode_validator_1.createQRCodeValidator;
|
|
@@ -11,7 +11,7 @@ exports.packageMetadata = {
|
|
|
11
11
|
name: '@progress/kendo-angular-barcodes',
|
|
12
12
|
productName: 'Kendo UI for Angular',
|
|
13
13
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
14
|
-
publishDate:
|
|
14
|
+
publishDate: 1641993026,
|
|
15
15
|
version: '',
|
|
16
16
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
17
17
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var kendo_charts_1 = require("@progress/kendo-charts");
|
|
8
|
+
/**
|
|
9
|
+
* Creates a value validator for a particular Barcode type.
|
|
10
|
+
*
|
|
11
|
+
* @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
|
|
12
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts-no-run
|
|
16
|
+
* const control = new FormControl('Фоо', createQRCodeValidator());
|
|
17
|
+
* console.log(control.errors);
|
|
18
|
+
*
|
|
19
|
+
* // {
|
|
20
|
+
* // qrcode: {
|
|
21
|
+
* // message: 'Unsupported character in QR Code: "Ф".',
|
|
22
|
+
* // value: '1234',
|
|
23
|
+
* // type: 'EAN13'
|
|
24
|
+
* // }
|
|
25
|
+
* // }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
exports.createQRCodeValidator = function (encoding) {
|
|
29
|
+
if (encoding === void 0) { encoding = 'ISO_8859_1'; }
|
|
30
|
+
var validator = kendo_charts_1.qrcodeValidator(encoding);
|
|
31
|
+
return function (control) {
|
|
32
|
+
if (!control.value) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
var result = validator(control.value);
|
|
36
|
+
if (result.valid === true) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
qrcode: {
|
|
41
|
+
message: result.error.message,
|
|
42
|
+
value: control.value,
|
|
43
|
+
encoding: encoding
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -8,6 +8,7 @@ var tslib_1 = require("tslib");
|
|
|
8
8
|
var core_1 = require("@angular/core");
|
|
9
9
|
var kendo_charts_1 = require("@progress/kendo-charts");
|
|
10
10
|
var base_component_1 = require("./base.component");
|
|
11
|
+
var package_metadata_1 = require("./package-metadata");
|
|
11
12
|
var DEFAULT_COLOR = '#000';
|
|
12
13
|
var DEFAULT_BACKGROUND = '#fff';
|
|
13
14
|
var DEFAULT_ERROR_CORRECTION = 'L';
|
|
@@ -77,7 +78,16 @@ var QRCodeComponent = /** @class */ (function (_super) {
|
|
|
77
78
|
configurable: true
|
|
78
79
|
});
|
|
79
80
|
QRCodeComponent.prototype.createInstance = function (element, options) {
|
|
80
|
-
return new kendo_charts_1.QRCode(element, options);
|
|
81
|
+
return new kendo_charts_1.QRCode(element, options, this.onError.bind(this));
|
|
82
|
+
};
|
|
83
|
+
QRCodeComponent.prototype.onError = function (error) {
|
|
84
|
+
error.name = package_metadata_1.packageMetadata.productName + ' QRCode';
|
|
85
|
+
if (this.isDevMode()) {
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.warn(error);
|
|
90
|
+
}
|
|
81
91
|
};
|
|
82
92
|
tslib_1.__decorate([
|
|
83
93
|
core_1.Input(),
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
System.register("@progress/kendo-angular-barcodes",["@angular/core","@progress/kendo-angular-common","
|
|
5
|
+
System.register("@progress/kendo-angular-barcodes",["tslib","@angular/core","@progress/kendo-angular-common","@progress/kendo-charts","@progress/kendo-drawing","@progress/kendo-licensing"],function(a){var i,d,s,c,u,p;function t(e){return e.__useDefault?e.default:e}return{setters:[function(e){i=t(e)},function(e){d=t(e)},function(e){s=t(e)},function(e){c=t(e)},function(e){u=t(e)},function(e){p=t(e)}],execute:function(){function r(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var o,n;n={},r.m=o=[function(e,t){e.exports=d},function(e,t){e.exports=i},function(e,t){e.exports=c},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.packageMetadata={name:"@progress/kendo-angular-barcodes",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1641993026,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"}},function(e,t){e.exports=s},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=o(0),a=o(4),o=o(7),o=r.__decorate([n.NgModule({declarations:[o.QRCodeComponent],imports:[a.ResizeSensorModule],exports:[o.QRCodeComponent]})],i);function i(){}t.QRCodeModule=o},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=o(0),a=o(4),o=o(9),o=r.__decorate([n.NgModule({declarations:[o.BarcodeComponent],imports:[a.ResizeSensorModule],exports:[o.BarcodeComponent]})],i);function i(){}t.BarcodeModule=o},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=o(1),a=o(0),i=o(2),d=o(8),s=o(3),a=(n=d.BaseComponent,r.__extends(c,n),Object.defineProperty(c.prototype,"options",{get:function(){return{background:this.background||"#fff",border:this.border,color:this.color||"#000",encoding:this.encoding,errorCorrection:this.errorCorrection||"L",overlay:this.overlay||{},padding:this.padding,renderAs:this.renderAs,size:this.size,value:this.value}},enumerable:!0,configurable:!0}),c.prototype.createInstance=function(e,t){return new i.QRCode(e,t,this.onError.bind(this))},c.prototype.onError=function(e){if(e.name=s.packageMetadata.productName+" QRCode",this.isDevMode())throw e;console.warn(e)},r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"background",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"border",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"color",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"encoding",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"errorCorrection",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"overlay",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Number)],c.prototype,"padding",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"renderAs",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"size",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"value",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Number)],c.prototype,"resizeRateLimit",void 0),r.__decorate([a.Component({changeDetection:a.ChangeDetectionStrategy.OnPush,selector:"kendo-qrcode",exportAs:"kendoQRCode",template:'\n <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>\n '}),r.__metadata("design:paramtypes",[a.ElementRef,a.Renderer2,a.NgZone])],c));function c(e,t,o){var r=n.call(this,e,t,o)||this;return r.element=e,r.renderer=t,r.ngZone=o,r.resizeRateLimit=10,r}t.QRCodeComponent=a},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=o(0),a=o(4),i=o(14),d=o(13),s=o(3),r=(Object.defineProperty(c.prototype,"autoResize",{get:function(){return 0<this.resizeRateLimit},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"canRender",{get:function(){return a.isDocumentAvailable()&&Boolean(this.element)},enumerable:!0,configurable:!0}),c.prototype.ngAfterViewInit=function(){this.refresh()},c.prototype.ngOnChanges=function(e){e.renderAs&&this.instance&&(this.instance.destroy(),this.instance=null),this.refresh()},c.prototype.resize=function(){this.instance&&this.instance.redraw()},c.prototype.onResize=function(){this.autoResize&&this.resize()},c.prototype.exportImage=function(e){return void 0===e&&(e={}),i.exportImage(this.exportVisual(),e)},c.prototype.exportSVG=function(e){return void 0===e&&(e={}),i.exportSVG(this.exportVisual(),e)},c.prototype.exportVisual=function(){return this.instance.exportVisual()},c.prototype.refresh=function(){var e;this.canRender&&(this.instance?this.instance.setOptions(this.options):(e=this.element.nativeElement,this.instance=this.createInstance(e,this.options)))},c.prototype.isDevMode=function(){return n.isDevMode()},r.__decorate([n.Input(),r.__metadata("design:type",Number)],c.prototype,"resizeRateLimit",void 0),r.__decorate([n.ViewChild("surface",{static:!0}),r.__metadata("design:type",n.ElementRef)],c.prototype,"surfaceElement",void 0),c);function c(e,t,o){this.element=e,this.renderer=t,this.ngZone=o,this.resizeRateLimit=10,d.validatePackage(s.packageMetadata)}t.BaseComponent=r},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=o(1),a=o(0),i=o(2),d=o(8),s=o(3),a=(n=d.BaseComponent,r.__extends(c,n),Object.defineProperty(c.prototype,"options",{get:function(){return{renderAs:this.renderAs,background:this.background,border:this.border,checksum:this.checksum,color:this.color,height:this.height,padding:this.padding,text:this.text,type:this.type,value:this.value,width:this.width}},enumerable:!0,configurable:!0}),c.prototype.createInstance=function(e,t){return new i.Barcode(e,t,this.onError.bind(this))},c.prototype.onError=function(e){if(e.name=s.packageMetadata.productName+" Barcode",this.isDevMode())throw e;console.warn(e)},r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"background",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"border",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Boolean)],c.prototype,"checksum",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"color",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Number)],c.prototype,"height",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"padding",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"renderAs",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"text",void 0),r.__decorate([a.Input(),r.__metadata("design:type",String)],c.prototype,"type",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Object)],c.prototype,"value",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Number)],c.prototype,"width",void 0),r.__decorate([a.Input(),r.__metadata("design:type",Number)],c.prototype,"resizeRateLimit",void 0),r.__decorate([a.Component({changeDetection:a.ChangeDetectionStrategy.OnPush,exportAs:"kendoBarcode",selector:"kendo-barcode",template:'\n <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>\n '}),r.__metadata("design:paramtypes",[a.ElementRef,a.Renderer2,a.NgZone])],c));function c(e,t,o){var r=n.call(this,e,t,o)||this;return r.element=e,r.renderer=t,r.ngZone=o,r.resizeRateLimit=10,r}t.BarcodeComponent=a},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(2);t.createQRCodeValidator=function(o){void 0===o&&(o="ISO_8859_1");var r=n.qrcodeValidator(o);return function(e){if(!e.value)return null;var t=r(e.value);return!0===t.valid?null:{qrcode:{message:t.error.message,value:e.value,encoding:o}}}}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(2);t.createBarcodeValidator=function(o,e){var r=n.barcodeValidator(o,e);return function(e){if(null==e.value||""===e.value)return null;var t=r(e.value);return!0===t.valid?null:{barcode:{message:t.error.message,value:e.value,type:o}}}}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=o(0),a=o(6),o=o(5),o=r.__decorate([n.NgModule({exports:[a.BarcodeModule,o.QRCodeModule]})],i);function i(){}t.BarcodesModule=o},function(e,t){e.exports=p},function(e,t){e.exports=u},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(9);t.BarcodeComponent=r.BarcodeComponent;r=o(7);t.QRCodeComponent=r.QRCodeComponent;r=o(6);t.BarcodeModule=r.BarcodeModule;r=o(5);t.QRCodeModule=r.QRCodeModule;r=o(12);t.BarcodesModule=r.BarcodesModule;r=o(11);t.createBarcodeValidator=r.createBarcodeValidator;o=o(10);t.createQRCodeValidator=o.createQRCodeValidator,function(e){for(var t in e)a(t,e[t])}(t)}],r.c=n,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}}});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Kendo UI Angular Barcodes",
|
|
4
4
|
"author": "Progress",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.2.0",
|
|
7
7
|
"main": "dist/npm/index.js",
|
|
8
8
|
"module": "dist/fesm5/index.js",
|
|
9
9
|
"es2015": "dist/fesm2015/index.js",
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@angular/common": "8 - 13",
|
|
40
40
|
"@angular/core": "8 - 13",
|
|
41
|
+
"@angular/forms": "8 - 13",
|
|
41
42
|
"@progress/kendo-angular-common": "^2.0.0",
|
|
42
43
|
"@progress/kendo-drawing": "^1.1.2",
|
|
43
44
|
"@progress/kendo-licensing": "^1.0.0",
|
|
44
45
|
"rxjs": "^6.4.0 || ^7.0.0"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@progress/kendo-charts": "^1.
|
|
48
|
+
"@progress/kendo-charts": "^1.22.0",
|
|
48
49
|
"@progress/kendo-schematics": "^1.1.0",
|
|
49
50
|
"tslib": "^1.9.0"
|
|
50
51
|
},
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@progress/kendo-angular-intl": "^3.1.2",
|
|
70
71
|
"@progress/kendo-angular-jest-preset": "^2.0.0",
|
|
71
72
|
"@progress/kendo-angular-l10n": "^3.0.3",
|
|
73
|
+
"@progress/kendo-angular-label": "^3.1.1",
|
|
72
74
|
"@progress/kendo-angular-pdf-export": "^3.0.2",
|
|
73
75
|
"@progress/kendo-angular-popup": "^4.0.2",
|
|
74
76
|
"@progress/kendo-angular-tasks": "^19.0.1",
|