@progress/kendo-angular-barcodes 17.0.0-develop.20 → 17.0.0-develop.22

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