@progress/kendo-angular-barcodes 2.0.2-dev.202211170705 → 11.0.0-develop.100

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 (39) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +4 -4
  3. package/README.md +1 -1
  4. package/barcode-validator.d.ts +1 -1
  5. package/barcode.component.d.ts +3 -3
  6. package/barcode.module.d.ts +1 -1
  7. package/barcodes.module.d.ts +1 -1
  8. package/base.component.d.ts +1 -1
  9. package/chart-types/barcode-types.d.ts +1 -1
  10. package/chart-types/field-types.d.ts +1 -1
  11. package/chart-types/qrcode-types.d.ts +1 -1
  12. package/chart-types.d.ts +1 -1
  13. package/{esm2015/barcode-validator.js → esm2020/barcode-validator.mjs} +1 -1
  14. package/{esm2015/barcode.component.js → esm2020/barcode.component.mjs} +5 -5
  15. package/{esm2015/barcode.module.js → esm2020/barcode.module.mjs} +5 -5
  16. package/{esm2015/barcodes.module.js → esm2020/barcodes.module.mjs} +5 -5
  17. package/{esm2015/base.component.js → esm2020/base.component.mjs} +5 -5
  18. package/{esm2015/chart-types/barcode-types.js → esm2020/chart-types/barcode-types.mjs} +1 -1
  19. package/{esm2015/chart-types/field-types.js → esm2020/chart-types/field-types.mjs} +1 -1
  20. package/{esm2015/chart-types/qrcode-types.js → esm2020/chart-types/qrcode-types.mjs} +1 -1
  21. package/{esm2015/chart-types.js → esm2020/chart-types.mjs} +1 -1
  22. package/{main.d.ts → esm2020/index.mjs} +1 -1
  23. package/{esm2015/package-metadata.js → esm2020/package-metadata.mjs} +3 -3
  24. package/{esm2015/kendo-angular-barcodes.js → esm2020/progress-kendo-angular-barcodes.mjs} +2 -2
  25. package/{esm2015/qrcode-validator.js → esm2020/qrcode-validator.mjs} +1 -1
  26. package/{esm2015/qrcode.component.js → esm2020/qrcode.component.mjs} +5 -5
  27. package/{esm2015/qrcode.module.js → esm2020/qrcode.module.mjs} +5 -5
  28. package/fesm2015/{kendo-angular-barcodes.js → progress-kendo-angular-barcodes.mjs} +24 -24
  29. package/fesm2020/progress-kendo-angular-barcodes.mjs +572 -0
  30. package/{esm2015/main.js → index.d.ts} +1 -1
  31. package/package-metadata.d.ts +1 -1
  32. package/package.json +30 -56
  33. package/{kendo-angular-barcodes.d.ts → progress-kendo-angular-barcodes.d.ts} +2 -2
  34. package/qrcode-validator.d.ts +1 -1
  35. package/qrcode.component.d.ts +2 -2
  36. package/qrcode.module.d.ts +1 -1
  37. package/schematics/ngAdd/index.js +1 -5
  38. package/bundles/kendo-angular-barcodes.umd.js +0 -5
  39. package/schematics/ngAdd/index.js.map +0 -1
@@ -0,0 +1,572 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as i0 from '@angular/core';
6
+ import { isDevMode, Directive, Input, ViewChild, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
7
+ import { Barcode, QRCode, barcodeValidator, qrcodeValidator } from '@progress/kendo-charts';
8
+ import * as i1 from '@progress/kendo-angular-common';
9
+ import { isDocumentAvailable, ResizeSensorModule } from '@progress/kendo-angular-common';
10
+ import { exportImage, exportSVG } from '@progress/kendo-drawing';
11
+ import { validatePackage } from '@progress/kendo-licensing';
12
+
13
+ /**
14
+ * @hidden
15
+ */
16
+ const packageMetadata = {
17
+ name: '@progress/kendo-angular-barcodes',
18
+ productName: 'Kendo UI for Angular',
19
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
20
+ publishDate: 1673469098,
21
+ version: '',
22
+ licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
23
+ };
24
+
25
+ /**
26
+ * @hidden
27
+ */
28
+ class BaseComponent {
29
+ constructor(element, renderer, ngZone) {
30
+ this.element = element;
31
+ this.renderer = renderer;
32
+ this.ngZone = ngZone;
33
+ this.resizeRateLimit = 10;
34
+ validatePackage(packageMetadata);
35
+ }
36
+ get autoResize() {
37
+ return this.resizeRateLimit > 0;
38
+ }
39
+ get canRender() {
40
+ return isDocumentAvailable() && Boolean(this.element);
41
+ }
42
+ ngAfterViewInit() {
43
+ this.refresh();
44
+ }
45
+ ngOnChanges(changes) {
46
+ // Need to create a new instance if the rendering mode changes.
47
+ if (changes['renderAs'] && this.instance) {
48
+ this.instance.destroy();
49
+ this.instance = null;
50
+ }
51
+ this.refresh();
52
+ }
53
+ /**
54
+ * Detects the size of the container and redraws the component.
55
+ * Resizing is automatic unless you set the `resizeRateLimit` option to `0`.
56
+ */
57
+ resize() {
58
+ if (this.instance) {
59
+ this.instance.redraw();
60
+ }
61
+ }
62
+ /**
63
+ * @hidden
64
+ */
65
+ onResize() {
66
+ if (this.autoResize) {
67
+ this.resize();
68
+ }
69
+ }
70
+ /**
71
+ * Exports the component as an image. The export operation is asynchronous and returns a promise.
72
+ *
73
+ * @param {ImageExportOptions} options - The parameters for the exported image.
74
+ * @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
75
+ */
76
+ exportImage(options = {}) {
77
+ return exportImage(this.exportVisual(), options);
78
+ }
79
+ /**
80
+ * Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
81
+ *
82
+ * @param options - The parameters for the exported file.
83
+ * @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
84
+ */
85
+ exportSVG(options = {}) {
86
+ return exportSVG(this.exportVisual(), options);
87
+ }
88
+ /**
89
+ * Exports the component as a Drawing Group.
90
+ *
91
+ * @returns - The exported Group.
92
+ */
93
+ exportVisual() {
94
+ return this.instance.exportVisual();
95
+ }
96
+ refresh() {
97
+ if (!this.canRender) {
98
+ return;
99
+ }
100
+ if (!this.instance) {
101
+ const element = this.element.nativeElement;
102
+ this.instance = this.createInstance(element, this.options);
103
+ }
104
+ else {
105
+ this.instance.setOptions(this.options);
106
+ }
107
+ }
108
+ isDevMode() {
109
+ return isDevMode();
110
+ }
111
+ }
112
+ BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
113
+ BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: BaseComponent, inputs: { resizeRateLimit: "resizeRateLimit" }, viewQueries: [{ propertyName: "surfaceElement", first: true, predicate: ["surface"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 });
114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseComponent, decorators: [{
115
+ type: Directive
116
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { resizeRateLimit: [{
117
+ type: Input
118
+ }], surfaceElement: [{
119
+ type: ViewChild,
120
+ args: ['surface', { static: true }]
121
+ }] } });
122
+
123
+ /**
124
+ * Represents the Kendo UI Barcode component for Angular.
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * import { Component } from '@angular/core';
129
+ *
130
+ * _@Component({
131
+ * selector: 'my-app',
132
+ * template: `
133
+ * <kendo-barcode type="EAN8" value="1234567">
134
+ * </kendo-barcode>
135
+ * `
136
+ * })
137
+ * export class AppComponent {
138
+ * }
139
+ * ```
140
+ */
141
+ class BarcodeComponent extends BaseComponent {
142
+ constructor(element, renderer, ngZone) {
143
+ super(element, renderer, ngZone);
144
+ this.element = element;
145
+ this.renderer = renderer;
146
+ this.ngZone = ngZone;
147
+ /**
148
+ * Limits the automatic resizing of the Barcode. Sets the maximum number of times per second
149
+ * that the component redraws its content when the size of its container changes.
150
+ * Defaults to `10`. To disable the automatic resizing, set it to `0`.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * _@Component({
155
+ * selector: 'my-app',
156
+ * template: `
157
+ * <kendo-barcode type="EAN8" [value]="1234567"
158
+ * [resizeRateLimit]="2">
159
+ * </kendo-barcode>
160
+ * `
161
+ * })
162
+ * export class AppComponent {
163
+ * }
164
+ * ```
165
+ */
166
+ this.resizeRateLimit = 10;
167
+ }
168
+ get options() {
169
+ return {
170
+ renderAs: this.renderAs,
171
+ background: this.background,
172
+ border: this.border,
173
+ checksum: this.checksum,
174
+ color: this.color,
175
+ height: this.height,
176
+ padding: this.padding,
177
+ text: this.text,
178
+ type: this.type,
179
+ value: this.value,
180
+ width: this.width
181
+ };
182
+ }
183
+ createInstance(element, options) {
184
+ return new Barcode(element, options, this.onError.bind(this));
185
+ }
186
+ onError(error) {
187
+ error.name = packageMetadata.productName + ' Barcode';
188
+ if (this.isDevMode()) {
189
+ throw error;
190
+ }
191
+ else {
192
+ console.warn(error);
193
+ }
194
+ }
195
+ }
196
+ BarcodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
197
+ BarcodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: BarcodeComponent, selector: "kendo-barcode", inputs: { background: "background", border: "border", checksum: "checksum", color: "color", height: "height", padding: "padding", renderAs: "renderAs", text: "text", type: "type", value: "value", width: "width", resizeRateLimit: "resizeRateLimit" }, exportAs: ["kendoBarcode"], usesInheritance: true, ngImport: i0, template: `
198
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
199
+ `, isInline: true, components: [{ type: i1.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeComponent, decorators: [{
201
+ type: Component,
202
+ args: [{
203
+ changeDetection: ChangeDetectionStrategy.OnPush,
204
+ exportAs: 'kendoBarcode',
205
+ selector: 'kendo-barcode',
206
+ template: `
207
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
208
+ `
209
+ }]
210
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { background: [{
211
+ type: Input
212
+ }], border: [{
213
+ type: Input
214
+ }], checksum: [{
215
+ type: Input
216
+ }], color: [{
217
+ type: Input
218
+ }], height: [{
219
+ type: Input
220
+ }], padding: [{
221
+ type: Input
222
+ }], renderAs: [{
223
+ type: Input
224
+ }], text: [{
225
+ type: Input
226
+ }], type: [{
227
+ type: Input
228
+ }], value: [{
229
+ type: Input
230
+ }], width: [{
231
+ type: Input
232
+ }], resizeRateLimit: [{
233
+ type: Input
234
+ }] } });
235
+
236
+ const DEFAULT_COLOR = '#000';
237
+ const DEFAULT_BACKGROUND = '#fff';
238
+ const DEFAULT_ERROR_CORRECTION = 'L';
239
+ /**
240
+ * Represents the Kendo UI QR Code component for Angular.
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * import { Component } from '@angular/core';
245
+ *
246
+ * _@Component({
247
+ * selector: 'my-app',
248
+ * template: `
249
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
250
+ * </kendo-qrcode>
251
+ * `
252
+ * })
253
+ * export class AppComponent {
254
+ * }
255
+ * ```
256
+ */
257
+ class QRCodeComponent extends BaseComponent {
258
+ constructor(element, renderer, ngZone) {
259
+ super(element, renderer, ngZone);
260
+ this.element = element;
261
+ this.renderer = renderer;
262
+ this.ngZone = ngZone;
263
+ /**
264
+ * Limits the automatic resizing of the QR Code. Sets the maximum number of times per second
265
+ * that the component redraws its content when the size of its container changes.
266
+ * Defaults to `10`. To disable the automatic resizing, set it to `0`.
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * _@Component({
271
+ * selector: 'my-app',
272
+ * template: `
273
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
274
+ * [resizeRateLimit]="2">
275
+ * </kendo-qrcode>
276
+ * `
277
+ * })
278
+ * export class AppComponent {
279
+ * }
280
+ * ```
281
+ */
282
+ this.resizeRateLimit = 10;
283
+ }
284
+ get options() {
285
+ return {
286
+ background: this.background || DEFAULT_BACKGROUND,
287
+ border: this.border,
288
+ color: this.color || DEFAULT_COLOR,
289
+ encoding: this.encoding,
290
+ errorCorrection: this.errorCorrection || DEFAULT_ERROR_CORRECTION,
291
+ overlay: this.overlay || {},
292
+ padding: this.padding,
293
+ renderAs: this.renderAs,
294
+ size: this.size,
295
+ value: this.value
296
+ };
297
+ }
298
+ createInstance(element, options) {
299
+ return new QRCode(element, options, this.onError.bind(this));
300
+ }
301
+ onError(error) {
302
+ error.name = packageMetadata.productName + ' QRCode';
303
+ if (this.isDevMode()) {
304
+ throw error;
305
+ }
306
+ else {
307
+ console.warn(error);
308
+ }
309
+ }
310
+ }
311
+ QRCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
312
+ QRCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", 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: `
313
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
314
+ `, isInline: true, components: [{ type: i1.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeComponent, decorators: [{
316
+ type: Component,
317
+ args: [{
318
+ changeDetection: ChangeDetectionStrategy.OnPush,
319
+ selector: 'kendo-qrcode',
320
+ exportAs: 'kendoQRCode',
321
+ template: `
322
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
323
+ `
324
+ }]
325
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { background: [{
326
+ type: Input
327
+ }], border: [{
328
+ type: Input
329
+ }], color: [{
330
+ type: Input
331
+ }], encoding: [{
332
+ type: Input
333
+ }], errorCorrection: [{
334
+ type: Input
335
+ }], overlay: [{
336
+ type: Input
337
+ }], padding: [{
338
+ type: Input
339
+ }], renderAs: [{
340
+ type: Input
341
+ }], size: [{
342
+ type: Input
343
+ }], value: [{
344
+ type: Input
345
+ }], resizeRateLimit: [{
346
+ type: Input
347
+ }] } });
348
+
349
+ /**
350
+ * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
351
+ * definition for the Barcode component.
352
+ *
353
+ * @example
354
+ *
355
+ * ```ts-no-run
356
+ * // Import the Barcode module
357
+ * import { BarcodeModule } from '@progress/kendo-angular-barcodes';
358
+ *
359
+ * // The browser platform with a compiler
360
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
361
+ *
362
+ * import { NgModule } from '@angular/core';
363
+ *
364
+ * // Import the app component
365
+ * import { AppComponent } from './app.component';
366
+ *
367
+ * // Define the app module
368
+ * _@NgModule({
369
+ * declarations: [AppComponent], // declare app component
370
+ * imports: [BrowserModule, BarcodeModule], // import Barcode module
371
+ * bootstrap: [AppComponent]
372
+ * })
373
+ * export class AppModule {}
374
+ *
375
+ * // Compile and launch the module
376
+ * platformBrowserDynamic().bootstrapModule(AppModule);
377
+ *
378
+ * ```
379
+ */
380
+ class BarcodeModule {
381
+ }
382
+ BarcodeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
383
+ BarcodeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeModule, declarations: [BarcodeComponent], imports: [ResizeSensorModule], exports: [BarcodeComponent] });
384
+ BarcodeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeModule, imports: [[ResizeSensorModule]] });
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodeModule, decorators: [{
386
+ type: NgModule,
387
+ args: [{
388
+ declarations: [BarcodeComponent],
389
+ imports: [ResizeSensorModule],
390
+ exports: [BarcodeComponent]
391
+ }]
392
+ }] });
393
+
394
+ /**
395
+ * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
396
+ * definition for the QR Code component.
397
+ *
398
+ * @example
399
+ *
400
+ * ```ts-no-run
401
+ * // Import the QR Code module
402
+ * import { QRCodeModule } from '@progress/kendo-angular-barcodes';
403
+ *
404
+ * // The browser platform with a compiler
405
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
406
+ *
407
+ * import { NgModule } from '@angular/core';
408
+ *
409
+ * // Import the app component
410
+ * import { AppComponent } from './app.component';
411
+ *
412
+ * // Define the app module
413
+ * _@NgModule({
414
+ * declarations: [AppComponent], // declare app component
415
+ * imports: [BrowserModule, QRCodeModule], // import QRCodeModule module
416
+ * bootstrap: [AppComponent]
417
+ * })
418
+ * export class AppModule {}
419
+ *
420
+ * // Compile and launch the module
421
+ * platformBrowserDynamic().bootstrapModule(AppModule);
422
+ *
423
+ * ```
424
+ */
425
+ class QRCodeModule {
426
+ }
427
+ QRCodeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
428
+ QRCodeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeModule, declarations: [QRCodeComponent], imports: [ResizeSensorModule], exports: [QRCodeComponent] });
429
+ QRCodeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeModule, imports: [[ResizeSensorModule]] });
430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: QRCodeModule, decorators: [{
431
+ type: NgModule,
432
+ args: [{
433
+ declarations: [QRCodeComponent],
434
+ imports: [ResizeSensorModule],
435
+ exports: [QRCodeComponent]
436
+ }]
437
+ }] });
438
+
439
+ /**
440
+ * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
441
+ * definition for the Barcode and QR Code components.
442
+ *
443
+ * @example
444
+ *
445
+ * ```ts-no-run
446
+ * // Import the Barcodes module
447
+ * import { BarcodesModule } from '@progress/kendo-angular-barcodes';
448
+ *
449
+ * // The browser platform with a compiler
450
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
451
+ *
452
+ * import { NgModule } from '@angular/core';
453
+ *
454
+ * // Import the app component
455
+ * import { AppComponent } from './app.component';
456
+ *
457
+ * // Define the app module
458
+ * _@NgModule({
459
+ * declarations: [AppComponent], // declare app component
460
+ * imports: [BrowserModule, BarcodesModule], // import Barcodes module
461
+ * bootstrap: [AppComponent]
462
+ * })
463
+ * export class AppModule {}
464
+ *
465
+ * // Compile and launch the module
466
+ * platformBrowserDynamic().bootstrapModule(AppModule);
467
+ *
468
+ * ```
469
+ */
470
+ class BarcodesModule {
471
+ }
472
+ BarcodesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
473
+ BarcodesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodesModule, exports: [BarcodeModule, QRCodeModule] });
474
+ BarcodesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodesModule, imports: [BarcodeModule, QRCodeModule] });
475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BarcodesModule, decorators: [{
476
+ type: NgModule,
477
+ args: [{
478
+ exports: [BarcodeModule, QRCodeModule]
479
+ }]
480
+ }] });
481
+
482
+ /**
483
+ * @hidden
484
+ */
485
+ const isPresent = (value) => value !== null && value !== undefined;
486
+ /**
487
+ * Creates a value validator for a particular Barcode type.
488
+ *
489
+ * @param {BarcodeType} type The type of the Barcode.
490
+ * @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
491
+ * @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
492
+ *
493
+ * @example
494
+ * ```ts-no-run
495
+ * const control = new FormControl('1234', createBarcodeValidator('EAN8'));
496
+ * console.log(control.errors);
497
+ *
498
+ * // {
499
+ * // barcode: {
500
+ * // message: 'The value of the "EAN13" encoding should be 12 symbols',
501
+ * // value: '1234',
502
+ * // type: 'EAN13'
503
+ * // }
504
+ * // }
505
+ * ```
506
+ */
507
+ const createBarcodeValidator = (type, size) => {
508
+ const validator = barcodeValidator(type, size);
509
+ return (control) => {
510
+ if (!isPresent(control.value) || control.value === '') {
511
+ return null;
512
+ }
513
+ const result = validator(control.value);
514
+ if (result.valid === true) {
515
+ return null;
516
+ }
517
+ return {
518
+ barcode: {
519
+ message: result.error.message,
520
+ value: control.value,
521
+ type: type
522
+ }
523
+ };
524
+ };
525
+ };
526
+
527
+ /**
528
+ * Creates a value validator for a particular Barcode type.
529
+ *
530
+ * @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
531
+ * @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
532
+ *
533
+ * @example
534
+ * ```ts-no-run
535
+ * const control = new FormControl('Фоо', createQRCodeValidator());
536
+ * console.log(control.errors);
537
+ *
538
+ * // {
539
+ * // qrcode: {
540
+ * // message: 'Unsupported character in QR Code: "Ф".',
541
+ * // value: '1234',
542
+ * // type: 'EAN13'
543
+ * // }
544
+ * // }
545
+ * ```
546
+ */
547
+ const createQRCodeValidator = (encoding = 'ISO_8859_1') => {
548
+ const validator = qrcodeValidator(encoding);
549
+ return (control) => {
550
+ if (!control.value) {
551
+ return null;
552
+ }
553
+ const result = validator(control.value);
554
+ if (result.valid === true) {
555
+ return null;
556
+ }
557
+ return {
558
+ qrcode: {
559
+ message: result.error.message,
560
+ value: control.value,
561
+ encoding: encoding
562
+ }
563
+ };
564
+ };
565
+ };
566
+
567
+ /**
568
+ * Generated bundle index. Do not edit.
569
+ */
570
+
571
+ export { BarcodeComponent, BarcodeModule, BarcodesModule, QRCodeComponent, QRCodeModule, createBarcodeValidator, createQRCodeValidator };
572
+
@@ -1,5 +1,5 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2023 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
5
  export { BarcodeComponent } from './barcode.component';
@@ -1,5 +1,5 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2023 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
5
  import { PackageMetadata } from '@progress/kendo-licensing';