@progress/kendo-angular-barcodes 1.0.0 → 2.0.0-next.202204011448

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.
Files changed (70) hide show
  1. package/{dist/es2015/barcode-validator.d.ts → barcode-validator.d.ts} +0 -0
  2. package/{dist/es2015/barcode.component.d.ts → barcode.component.d.ts} +4 -1
  3. package/{dist/es2015/barcode.module.d.ts → barcode.module.d.ts} +6 -0
  4. package/{dist/es2015/barcodes.module.d.ts → barcodes.module.d.ts} +6 -0
  5. package/{dist/es2015/base.component.d.ts → base.component.d.ts} +6 -3
  6. package/bundles/kendo-angular-barcodes.umd.js +5 -0
  7. package/{dist/es2015/chart-types → chart-types}/barcode-types.d.ts +0 -0
  8. package/{dist/es2015/chart-types → chart-types}/field-types.d.ts +0 -0
  9. package/{dist/es2015/chart-types → chart-types}/qrcode-types.d.ts +0 -0
  10. package/{dist/es2015/chart-types.d.ts → chart-types.d.ts} +0 -0
  11. package/{dist/es2015 → esm2015}/barcode-validator.js +0 -2
  12. package/{dist/es2015 → esm2015}/barcode.component.js +42 -64
  13. package/{dist/es → esm2015}/barcode.module.js +14 -14
  14. package/{dist/es → esm2015}/barcodes.module.js +12 -12
  15. package/{dist/es2015 → esm2015}/base.component.js +12 -10
  16. package/{dist/es2015 → esm2015}/chart-types/barcode-types.js +1 -0
  17. package/{dist/es2015 → esm2015}/chart-types/field-types.js +1 -0
  18. package/{dist/es2015 → esm2015}/chart-types/qrcode-types.js +1 -0
  19. package/{dist/es → esm2015}/chart-types.js +3 -0
  20. package/{dist/es/index.js → esm2015/kendo-angular-barcodes.js} +0 -1
  21. package/{dist/es2015/main.d.ts → esm2015/main.js} +0 -0
  22. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  23. package/{dist/es2015 → esm2015}/qrcode-validator.js +0 -0
  24. package/{dist/es2015 → esm2015}/qrcode.component.js +40 -60
  25. package/{dist/es2015 → esm2015}/qrcode.module.js +14 -11
  26. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-barcodes.js} +129 -155
  27. package/{dist/es2015/index.d.ts → kendo-angular-barcodes.d.ts} +1 -1
  28. package/{dist/es/main.js → main.d.ts} +1 -0
  29. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  30. package/package.json +29 -100
  31. package/{dist/es2015/qrcode-validator.d.ts → qrcode-validator.d.ts} +0 -0
  32. package/{dist/es2015/qrcode.component.d.ts → qrcode.component.d.ts} +4 -1
  33. package/{dist/es2015/qrcode.module.d.ts → qrcode.module.d.ts} +6 -0
  34. package/schematics/ngAdd/index.js +5 -2
  35. package/schematics/ngAdd/index.js.map +1 -1
  36. package/dist/cdn/js/kendo-angular-barcodes.js +0 -20
  37. package/dist/cdn/main.js +0 -5
  38. package/dist/es/barcode-validator.js +0 -51
  39. package/dist/es/barcode.component.js +0 -149
  40. package/dist/es/base.component.js +0 -117
  41. package/dist/es/chart-types/barcode-types.js +0 -4
  42. package/dist/es/chart-types/field-types.js +0 -4
  43. package/dist/es/chart-types/qrcode-types.js +0 -4
  44. package/dist/es/package-metadata.js +0 -15
  45. package/dist/es/qrcode-validator.js +0 -45
  46. package/dist/es/qrcode.component.js +0 -147
  47. package/dist/es/qrcode.module.js +0 -52
  48. package/dist/es2015/barcode.module.js +0 -49
  49. package/dist/es2015/barcodes.module.js +0 -47
  50. package/dist/es2015/chart-types.js +0 -4
  51. package/dist/es2015/index.js +0 -9
  52. package/dist/es2015/index.metadata.json +0 -1
  53. package/dist/es2015/main.js +0 -11
  54. package/dist/fesm5/index.js +0 -629
  55. package/dist/npm/barcode-validator.js +0 -53
  56. package/dist/npm/barcode.component.js +0 -151
  57. package/dist/npm/barcode.module.js +0 -54
  58. package/dist/npm/barcodes.module.js +0 -52
  59. package/dist/npm/base.component.js +0 -119
  60. package/dist/npm/chart-types/barcode-types.js +0 -6
  61. package/dist/npm/chart-types/field-types.js +0 -6
  62. package/dist/npm/chart-types/qrcode-types.js +0 -6
  63. package/dist/npm/chart-types.js +0 -6
  64. package/dist/npm/index.js +0 -13
  65. package/dist/npm/main.js +0 -20
  66. package/dist/npm/package-metadata.js +0 -17
  67. package/dist/npm/qrcode-validator.js +0 -47
  68. package/dist/npm/qrcode.component.js +0 -149
  69. package/dist/npm/qrcode.module.js +0 -54
  70. package/dist/systemjs/kendo-angular-barcodes.js +0 -5
@@ -1,629 +0,0 @@
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 { __decorate, __metadata, __extends } from 'tslib';
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
- import { isDocumentAvailable, ResizeSensorModule } from '@progress/kendo-angular-common';
9
- import { exportImage, exportSVG } from '@progress/kendo-drawing';
10
- import { validatePackage } from '@progress/kendo-licensing';
11
-
12
- /**
13
- * @hidden
14
- */
15
- var packageMetadata = {
16
- name: '@progress/kendo-angular-barcodes',
17
- productName: 'Kendo UI for Angular',
18
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
19
- publishDate: 1648115793,
20
- version: '',
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
- };
23
-
24
- /**
25
- * @hidden
26
- */
27
- var BaseComponent = /** @class */ (function () {
28
- function BaseComponent(element, renderer, ngZone) {
29
- this.element = element;
30
- this.renderer = renderer;
31
- this.ngZone = ngZone;
32
- this.resizeRateLimit = 10;
33
- validatePackage(packageMetadata);
34
- }
35
- Object.defineProperty(BaseComponent.prototype, "autoResize", {
36
- get: function () {
37
- return this.resizeRateLimit > 0;
38
- },
39
- enumerable: true,
40
- configurable: true
41
- });
42
- Object.defineProperty(BaseComponent.prototype, "canRender", {
43
- get: function () {
44
- return isDocumentAvailable() && Boolean(this.element);
45
- },
46
- enumerable: true,
47
- configurable: true
48
- });
49
- BaseComponent.prototype.ngAfterViewInit = function () {
50
- this.refresh();
51
- };
52
- BaseComponent.prototype.ngOnChanges = function (changes) {
53
- // Need to create a new instance if the rendering mode changes.
54
- if (changes['renderAs'] && this.instance) {
55
- this.instance.destroy();
56
- this.instance = null;
57
- }
58
- this.refresh();
59
- };
60
- /**
61
- * Detects the size of the container and redraws the component.
62
- * Resizing is automatic unless you set the `resizeRateLimit` option to `0`.
63
- */
64
- BaseComponent.prototype.resize = function () {
65
- if (this.instance) {
66
- this.instance.redraw();
67
- }
68
- };
69
- /**
70
- * @hidden
71
- */
72
- BaseComponent.prototype.onResize = function () {
73
- if (this.autoResize) {
74
- this.resize();
75
- }
76
- };
77
- /**
78
- * Exports the component as an image. The export operation is asynchronous and returns a promise.
79
- *
80
- * @param {ImageExportOptions} options - The parameters for the exported image.
81
- * @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
82
- */
83
- BaseComponent.prototype.exportImage = function (options) {
84
- if (options === void 0) { options = {}; }
85
- return exportImage(this.exportVisual(), options);
86
- };
87
- /**
88
- * Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
89
- *
90
- * @param options - The parameters for the exported file.
91
- * @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
92
- */
93
- BaseComponent.prototype.exportSVG = function (options) {
94
- if (options === void 0) { options = {}; }
95
- return exportSVG(this.exportVisual(), options);
96
- };
97
- /**
98
- * Exports the component as a Drawing Group.
99
- *
100
- * @returns - The exported Group.
101
- */
102
- BaseComponent.prototype.exportVisual = function () {
103
- return this.instance.exportVisual();
104
- };
105
- BaseComponent.prototype.refresh = function () {
106
- if (!this.canRender) {
107
- return;
108
- }
109
- if (!this.instance) {
110
- var element = this.element.nativeElement;
111
- this.instance = this.createInstance(element, this.options);
112
- }
113
- else {
114
- this.instance.setOptions(this.options);
115
- }
116
- };
117
- BaseComponent.prototype.isDevMode = function () {
118
- return isDevMode();
119
- };
120
- __decorate([
121
- Input(),
122
- __metadata("design:type", Number)
123
- ], BaseComponent.prototype, "resizeRateLimit", void 0);
124
- __decorate([
125
- ViewChild('surface', { static: true }),
126
- __metadata("design:type", ElementRef)
127
- ], BaseComponent.prototype, "surfaceElement", void 0);
128
- return BaseComponent;
129
- }());
130
-
131
- /**
132
- * Represents the Kendo UI Barcode component for Angular.
133
- *
134
- * @example
135
- * ```ts
136
- * import { Component } from '@angular/core';
137
- *
138
- * _@Component({
139
- * selector: 'my-app',
140
- * template: `
141
- * <kendo-barcode type="EAN8" value="1234567">
142
- * </kendo-barcode>
143
- * `
144
- * })
145
- * export class AppComponent {
146
- * }
147
- * ```
148
- */
149
- var BarcodeComponent = /** @class */ (function (_super) {
150
- __extends(BarcodeComponent, _super);
151
- function BarcodeComponent(element, renderer, ngZone) {
152
- var _this = _super.call(this, element, renderer, ngZone) || this;
153
- _this.element = element;
154
- _this.renderer = renderer;
155
- _this.ngZone = ngZone;
156
- /**
157
- * Limits the automatic resizing of the Barcode. Sets the maximum number of times per second
158
- * that the component redraws its content when the size of its container changes.
159
- * Defaults to `10`. To disable the automatic resizing, set it to `0`.
160
- *
161
- * @example
162
- * ```ts
163
- * _@Component({
164
- * selector: 'my-app',
165
- * template: `
166
- * <kendo-barcode type="EAN8" [value]="1234567"
167
- * [resizeRateLimit]="2">
168
- * </kendo-barcode>
169
- * `
170
- * })
171
- * export class AppComponent {
172
- * }
173
- * ```
174
- */
175
- _this.resizeRateLimit = 10;
176
- return _this;
177
- }
178
- Object.defineProperty(BarcodeComponent.prototype, "options", {
179
- get: function () {
180
- return {
181
- renderAs: this.renderAs,
182
- background: this.background,
183
- border: this.border,
184
- checksum: this.checksum,
185
- color: this.color,
186
- height: this.height,
187
- padding: this.padding,
188
- text: this.text,
189
- type: this.type,
190
- value: this.value,
191
- width: this.width
192
- };
193
- },
194
- enumerable: true,
195
- configurable: true
196
- });
197
- BarcodeComponent.prototype.createInstance = function (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
- }
208
- };
209
- __decorate([
210
- Input(),
211
- __metadata("design:type", String)
212
- ], BarcodeComponent.prototype, "background", void 0);
213
- __decorate([
214
- Input(),
215
- __metadata("design:type", Object)
216
- ], BarcodeComponent.prototype, "border", void 0);
217
- __decorate([
218
- Input(),
219
- __metadata("design:type", Boolean)
220
- ], BarcodeComponent.prototype, "checksum", void 0);
221
- __decorate([
222
- Input(),
223
- __metadata("design:type", String)
224
- ], BarcodeComponent.prototype, "color", void 0);
225
- __decorate([
226
- Input(),
227
- __metadata("design:type", Number)
228
- ], BarcodeComponent.prototype, "height", void 0);
229
- __decorate([
230
- Input(),
231
- __metadata("design:type", Object)
232
- ], BarcodeComponent.prototype, "padding", void 0);
233
- __decorate([
234
- Input(),
235
- __metadata("design:type", String)
236
- ], BarcodeComponent.prototype, "renderAs", void 0);
237
- __decorate([
238
- Input(),
239
- __metadata("design:type", Object)
240
- ], BarcodeComponent.prototype, "text", void 0);
241
- __decorate([
242
- Input(),
243
- __metadata("design:type", String)
244
- ], BarcodeComponent.prototype, "type", void 0);
245
- __decorate([
246
- Input(),
247
- __metadata("design:type", Object)
248
- ], BarcodeComponent.prototype, "value", void 0);
249
- __decorate([
250
- Input(),
251
- __metadata("design:type", Number)
252
- ], BarcodeComponent.prototype, "width", void 0);
253
- __decorate([
254
- Input(),
255
- __metadata("design:type", Number)
256
- ], BarcodeComponent.prototype, "resizeRateLimit", void 0);
257
- BarcodeComponent = __decorate([
258
- Component({
259
- changeDetection: ChangeDetectionStrategy.OnPush,
260
- exportAs: 'kendoBarcode',
261
- selector: 'kendo-barcode',
262
- template: "\n <kendo-resize-sensor (resize)=\"onResize()\" [rateLimit]=\"resizeRateLimit\"></kendo-resize-sensor>\n "
263
- }),
264
- __metadata("design:paramtypes", [ElementRef,
265
- Renderer2,
266
- NgZone])
267
- ], BarcodeComponent);
268
- return BarcodeComponent;
269
- }(BaseComponent));
270
-
271
- var DEFAULT_COLOR = '#000';
272
- var DEFAULT_BACKGROUND = '#fff';
273
- var DEFAULT_ERROR_CORRECTION = 'L';
274
- /**
275
- * Represents the Kendo UI QR Code component for Angular.
276
- *
277
- * @example
278
- * ```ts
279
- * import { Component } from '@angular/core';
280
- *
281
- * _@Component({
282
- * selector: 'my-app',
283
- * template: `
284
- * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
285
- * </kendo-qrcode>
286
- * `
287
- * })
288
- * export class AppComponent {
289
- * }
290
- * ```
291
- */
292
- var QRCodeComponent = /** @class */ (function (_super) {
293
- __extends(QRCodeComponent, _super);
294
- function QRCodeComponent(element, renderer, ngZone) {
295
- var _this = _super.call(this, element, renderer, ngZone) || this;
296
- _this.element = element;
297
- _this.renderer = renderer;
298
- _this.ngZone = ngZone;
299
- /**
300
- * Limits the automatic resizing of the QR Code. Sets the maximum number of times per second
301
- * that the component redraws its content when the size of its container changes.
302
- * Defaults to `10`. To disable the automatic resizing, set it to `0`.
303
- *
304
- * @example
305
- * ```ts
306
- * _@Component({
307
- * selector: 'my-app',
308
- * template: `
309
- * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
310
- * [resizeRateLimit]="2">
311
- * </kendo-qrcode>
312
- * `
313
- * })
314
- * export class AppComponent {
315
- * }
316
- * ```
317
- */
318
- _this.resizeRateLimit = 10;
319
- return _this;
320
- }
321
- Object.defineProperty(QRCodeComponent.prototype, "options", {
322
- get: function () {
323
- return {
324
- background: this.background || DEFAULT_BACKGROUND,
325
- border: this.border,
326
- color: this.color || DEFAULT_COLOR,
327
- encoding: this.encoding,
328
- errorCorrection: this.errorCorrection || DEFAULT_ERROR_CORRECTION,
329
- overlay: this.overlay || {},
330
- padding: this.padding,
331
- renderAs: this.renderAs,
332
- size: this.size,
333
- value: this.value
334
- };
335
- },
336
- enumerable: true,
337
- configurable: true
338
- });
339
- QRCodeComponent.prototype.createInstance = function (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
- }
350
- };
351
- __decorate([
352
- Input(),
353
- __metadata("design:type", String)
354
- ], QRCodeComponent.prototype, "background", void 0);
355
- __decorate([
356
- Input(),
357
- __metadata("design:type", Object)
358
- ], QRCodeComponent.prototype, "border", void 0);
359
- __decorate([
360
- Input(),
361
- __metadata("design:type", String)
362
- ], QRCodeComponent.prototype, "color", void 0);
363
- __decorate([
364
- Input(),
365
- __metadata("design:type", String)
366
- ], QRCodeComponent.prototype, "encoding", void 0);
367
- __decorate([
368
- Input(),
369
- __metadata("design:type", String)
370
- ], QRCodeComponent.prototype, "errorCorrection", void 0);
371
- __decorate([
372
- Input(),
373
- __metadata("design:type", Object)
374
- ], QRCodeComponent.prototype, "overlay", void 0);
375
- __decorate([
376
- Input(),
377
- __metadata("design:type", Number)
378
- ], QRCodeComponent.prototype, "padding", void 0);
379
- __decorate([
380
- Input(),
381
- __metadata("design:type", String)
382
- ], QRCodeComponent.prototype, "renderAs", void 0);
383
- __decorate([
384
- Input(),
385
- __metadata("design:type", Object)
386
- ], QRCodeComponent.prototype, "size", void 0);
387
- __decorate([
388
- Input(),
389
- __metadata("design:type", Object)
390
- ], QRCodeComponent.prototype, "value", void 0);
391
- __decorate([
392
- Input(),
393
- __metadata("design:type", Number)
394
- ], QRCodeComponent.prototype, "resizeRateLimit", void 0);
395
- QRCodeComponent = __decorate([
396
- Component({
397
- changeDetection: ChangeDetectionStrategy.OnPush,
398
- selector: 'kendo-qrcode',
399
- exportAs: 'kendoQRCode',
400
- template: "\n <kendo-resize-sensor (resize)=\"onResize()\" [rateLimit]=\"resizeRateLimit\"></kendo-resize-sensor>\n "
401
- }),
402
- __metadata("design:paramtypes", [ElementRef,
403
- Renderer2,
404
- NgZone])
405
- ], QRCodeComponent);
406
- return QRCodeComponent;
407
- }(BaseComponent));
408
-
409
- /**
410
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
411
- * definition for the Barcode component.
412
- *
413
- * @example
414
- *
415
- * ```ts-no-run
416
- * // Import the Barcode module
417
- * import { BarcodeModule } from '@progress/kendo-angular-barcodes';
418
- *
419
- * // The browser platform with a compiler
420
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
421
- *
422
- * import { NgModule } from '@angular/core';
423
- *
424
- * // Import the app component
425
- * import { AppComponent } from './app.component';
426
- *
427
- * // Define the app module
428
- * _@NgModule({
429
- * declarations: [AppComponent], // declare app component
430
- * imports: [BrowserModule, BarcodeModule], // import Barcode module
431
- * bootstrap: [AppComponent]
432
- * })
433
- * export class AppModule {}
434
- *
435
- * // Compile and launch the module
436
- * platformBrowserDynamic().bootstrapModule(AppModule);
437
- *
438
- * ```
439
- */
440
- var BarcodeModule = /** @class */ (function () {
441
- function BarcodeModule() {
442
- }
443
- BarcodeModule = __decorate([
444
- NgModule({
445
- declarations: [BarcodeComponent],
446
- imports: [ResizeSensorModule],
447
- exports: [BarcodeComponent]
448
- })
449
- ], BarcodeModule);
450
- return BarcodeModule;
451
- }());
452
-
453
- /**
454
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
455
- * definition for the QR Code component.
456
- *
457
- * @example
458
- *
459
- * ```ts-no-run
460
- * // Import the QR Code module
461
- * import { QRCodeModule } from '@progress/kendo-angular-barcodes';
462
- *
463
- * // The browser platform with a compiler
464
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
465
- *
466
- * import { NgModule } from '@angular/core';
467
- *
468
- * // Import the app component
469
- * import { AppComponent } from './app.component';
470
- *
471
- * // Define the app module
472
- * _@NgModule({
473
- * declarations: [AppComponent], // declare app component
474
- * imports: [BrowserModule, QRCodeModule], // import QRCodeModule module
475
- * bootstrap: [AppComponent]
476
- * })
477
- * export class AppModule {}
478
- *
479
- * // Compile and launch the module
480
- * platformBrowserDynamic().bootstrapModule(AppModule);
481
- *
482
- * ```
483
- */
484
- var QRCodeModule = /** @class */ (function () {
485
- function QRCodeModule() {
486
- }
487
- QRCodeModule = __decorate([
488
- NgModule({
489
- declarations: [QRCodeComponent],
490
- imports: [ResizeSensorModule],
491
- exports: [QRCodeComponent]
492
- })
493
- ], QRCodeModule);
494
- return QRCodeModule;
495
- }());
496
-
497
- /**
498
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
499
- * definition for the Barcode and QR Code components.
500
- *
501
- * @example
502
- *
503
- * ```ts-no-run
504
- * // Import the Barcodes module
505
- * import { BarcodesModule } from '@progress/kendo-angular-barcodes';
506
- *
507
- * // The browser platform with a compiler
508
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
509
- *
510
- * import { NgModule } from '@angular/core';
511
- *
512
- * // Import the app component
513
- * import { AppComponent } from './app.component';
514
- *
515
- * // Define the app module
516
- * _@NgModule({
517
- * declarations: [AppComponent], // declare app component
518
- * imports: [BrowserModule, BarcodesModule], // import Barcodes module
519
- * bootstrap: [AppComponent]
520
- * })
521
- * export class AppModule {}
522
- *
523
- * // Compile and launch the module
524
- * platformBrowserDynamic().bootstrapModule(AppModule);
525
- *
526
- * ```
527
- */
528
- var BarcodesModule = /** @class */ (function () {
529
- function BarcodesModule() {
530
- }
531
- BarcodesModule = __decorate([
532
- NgModule({
533
- exports: [BarcodeModule, QRCodeModule]
534
- })
535
- ], BarcodesModule);
536
- return BarcodesModule;
537
- }());
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
-
625
- /**
626
- * Generated bundle index. Do not edit.
627
- */
628
-
629
- export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule, createBarcodeValidator, createQRCodeValidator };
@@ -1,53 +0,0 @@
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
- };