@progress/kendo-angular-barcodes 17.0.0-develop.21 → 17.0.0-develop.23
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/barcode.component.d.ts +1 -1
- package/base.component.d.ts +1 -1
- package/chart-types/barcode-types.d.ts +1 -1
- package/chart-types/field-types.d.ts +2 -2
- package/chart-types/qrcode-types.d.ts +2 -2
- package/esm2022/barcode.component.mjs +384 -0
- package/{esm2020 → esm2022}/barcode.module.mjs +4 -4
- package/{esm2020 → esm2022}/barcodes.module.mjs +4 -4
- package/{esm2020 → esm2022}/base.component.mjs +15 -10
- package/{esm2020 → esm2022}/package-metadata.mjs +2 -2
- package/esm2022/qrcode.component.mjs +361 -0
- package/{esm2020 → esm2022}/qrcode.module.mjs +4 -4
- package/fesm2022/progress-kendo-angular-barcodes.mjs +1102 -0
- package/package.json +12 -18
- package/qrcode.component.d.ts +1 -1
- package/schematics/ngAdd/index.js +1 -1
- package/esm2020/barcode.component.mjs +0 -124
- package/esm2020/qrcode.component.mjs +0 -124
- package/fesm2015/progress-kendo-angular-barcodes.mjs +0 -600
- package/fesm2020/progress-kendo-angular-barcodes.mjs +0 -600
- /package/{esm2020 → esm2022}/barcode-validator.mjs +0 -0
- /package/{esm2020 → esm2022}/chart-types/barcode-types.mjs +0 -0
- /package/{esm2020 → esm2022}/chart-types/field-types.mjs +0 -0
- /package/{esm2020 → esm2022}/chart-types/qrcode-types.mjs +0 -0
- /package/{esm2020 → esm2022}/chart-types.mjs +0 -0
- /package/{esm2020 → esm2022}/directives.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/progress-kendo-angular-barcodes.mjs +0 -0
- /package/{esm2020 → esm2022}/qrcode-validator.mjs +0 -0
@@ -0,0 +1,1102 @@
|
|
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: 1730105071,
|
20
|
+
version: '17.0.0-develop.23',
|
21
|
+
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
22
|
+
};
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @hidden
|
26
|
+
*/
|
27
|
+
class BaseComponent {
|
28
|
+
element;
|
29
|
+
renderer;
|
30
|
+
ngZone;
|
31
|
+
resizeRateLimit = 10;
|
32
|
+
surfaceElement;
|
33
|
+
instance;
|
34
|
+
get autoResize() {
|
35
|
+
return this.resizeRateLimit > 0;
|
36
|
+
}
|
37
|
+
get canRender() {
|
38
|
+
return isDocumentAvailable() && Boolean(this.element);
|
39
|
+
}
|
40
|
+
constructor(element, renderer, ngZone) {
|
41
|
+
this.element = element;
|
42
|
+
this.renderer = renderer;
|
43
|
+
this.ngZone = ngZone;
|
44
|
+
validatePackage(packageMetadata);
|
45
|
+
}
|
46
|
+
ngAfterViewInit() {
|
47
|
+
this.refresh();
|
48
|
+
}
|
49
|
+
ngOnChanges(changes) {
|
50
|
+
// Need to create a new instance if the rendering mode changes.
|
51
|
+
if (changes['renderAs'] && this.instance) {
|
52
|
+
this.instance.destroy();
|
53
|
+
this.instance = null;
|
54
|
+
}
|
55
|
+
this.refresh();
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Detects the size of the container and redraws the component.
|
59
|
+
* Resizing is automatic unless you set the `resizeRateLimit` option to `0`.
|
60
|
+
*/
|
61
|
+
resize() {
|
62
|
+
if (this.instance) {
|
63
|
+
this.instance.redraw();
|
64
|
+
}
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* @hidden
|
68
|
+
*/
|
69
|
+
onResize() {
|
70
|
+
if (this.autoResize) {
|
71
|
+
this.resize();
|
72
|
+
}
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Exports the component as an image. The export operation is asynchronous and returns a promise.
|
76
|
+
*
|
77
|
+
* @param {ImageExportOptions} options - The parameters for the exported image.
|
78
|
+
* @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
|
79
|
+
*/
|
80
|
+
exportImage(options = {}) {
|
81
|
+
return exportImage(this.exportVisual(), options);
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
|
85
|
+
*
|
86
|
+
* @param options - The parameters for the exported file.
|
87
|
+
* @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
|
88
|
+
*/
|
89
|
+
exportSVG(options = {}) {
|
90
|
+
return exportSVG(this.exportVisual(), options);
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* Exports the component as a Drawing Group.
|
94
|
+
*
|
95
|
+
* @returns - The exported Group.
|
96
|
+
*/
|
97
|
+
exportVisual() {
|
98
|
+
return this.instance.exportVisual();
|
99
|
+
}
|
100
|
+
refresh() {
|
101
|
+
if (!this.canRender) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
if (!this.instance) {
|
105
|
+
const element = this.element.nativeElement;
|
106
|
+
this.instance = this.createInstance(element, this.options);
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
this.instance.setOptions(this.options);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
isDevMode() {
|
113
|
+
return isDevMode();
|
114
|
+
}
|
115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
116
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: BaseComponent, inputs: { resizeRateLimit: "resizeRateLimit" }, viewQueries: [{ propertyName: "surfaceElement", first: true, predicate: ["surface"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 });
|
117
|
+
}
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseComponent, decorators: [{
|
119
|
+
type: Directive
|
120
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { resizeRateLimit: [{
|
121
|
+
type: Input
|
122
|
+
}], surfaceElement: [{
|
123
|
+
type: ViewChild,
|
124
|
+
args: ['surface', { static: true }]
|
125
|
+
}] } });
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Represents the Kendo UI Barcode component for Angular.
|
129
|
+
*
|
130
|
+
* @example
|
131
|
+
* ```ts
|
132
|
+
* import { Component } from '@angular/core';
|
133
|
+
*
|
134
|
+
* _@Component({
|
135
|
+
* selector: 'my-app',
|
136
|
+
* template: `
|
137
|
+
* <kendo-barcode type="EAN8" value="1234567">
|
138
|
+
* </kendo-barcode>
|
139
|
+
* `
|
140
|
+
* })
|
141
|
+
* export class AppComponent {
|
142
|
+
* }
|
143
|
+
* ```
|
144
|
+
*/
|
145
|
+
class BarcodeComponent extends BaseComponent {
|
146
|
+
element;
|
147
|
+
renderer;
|
148
|
+
ngZone;
|
149
|
+
/**
|
150
|
+
* The background color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
|
151
|
+
*
|
152
|
+
* @default "white"
|
153
|
+
*
|
154
|
+
* @example
|
155
|
+
* ```ts-preview
|
156
|
+
* import { Component } from '@angular/core';
|
157
|
+
*
|
158
|
+
* _@Component({
|
159
|
+
* selector: 'my-app',
|
160
|
+
* template: `
|
161
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
162
|
+
* background="#fc0">
|
163
|
+
* </kendo-barcode>
|
164
|
+
* `
|
165
|
+
* })
|
166
|
+
* export class AppComponent {
|
167
|
+
* }
|
168
|
+
* ```
|
169
|
+
*/
|
170
|
+
background;
|
171
|
+
/**
|
172
|
+
* The border of the Barcode.
|
173
|
+
*
|
174
|
+
* @example
|
175
|
+
* ```ts-preview
|
176
|
+
* import { Component } from '@angular/core';
|
177
|
+
* import { Border } from '@progress/kendo-angular-barcodes';
|
178
|
+
*
|
179
|
+
* _@Component({
|
180
|
+
* selector: 'my-app',
|
181
|
+
* template: `
|
182
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
183
|
+
* [border]="barcodeBorder" [padding]="5">
|
184
|
+
* </kendo-barcode>
|
185
|
+
* `
|
186
|
+
* })
|
187
|
+
* export class AppComponent {
|
188
|
+
* barcodeBorder: Border = {
|
189
|
+
* color: '#fc0',
|
190
|
+
* width: 2
|
191
|
+
* };
|
192
|
+
* }
|
193
|
+
* ```
|
194
|
+
*/
|
195
|
+
border;
|
196
|
+
/**
|
197
|
+
* If set to `true`, the Barcode will display the checksum digit next to the value in the text area.
|
198
|
+
*
|
199
|
+
* @default false
|
200
|
+
*
|
201
|
+
* @example
|
202
|
+
* ```ts-preview
|
203
|
+
* _@Component({
|
204
|
+
* selector: 'my-app',
|
205
|
+
* template: `
|
206
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
207
|
+
* [checksum]="true">
|
208
|
+
* </kendo-barcode>
|
209
|
+
* `
|
210
|
+
* })
|
211
|
+
* export class AppComponent {
|
212
|
+
* }
|
213
|
+
* ```
|
214
|
+
*/
|
215
|
+
checksum;
|
216
|
+
/**
|
217
|
+
* The color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
|
218
|
+
*
|
219
|
+
* @default "black"
|
220
|
+
*
|
221
|
+
* @example
|
222
|
+
* ```ts-preview
|
223
|
+
* _@Component({
|
224
|
+
* selector: 'my-app',
|
225
|
+
* template: `
|
226
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
227
|
+
* color="#fc0">
|
228
|
+
* </kendo-barcode>
|
229
|
+
* `
|
230
|
+
* })
|
231
|
+
* export class AppComponent {
|
232
|
+
* }
|
233
|
+
* ```
|
234
|
+
*/
|
235
|
+
color;
|
236
|
+
/**
|
237
|
+
* The height of the Barcode in pixels.
|
238
|
+
*
|
239
|
+
* The Barcode dimensions can also be set through regular CSS styling.
|
240
|
+
*
|
241
|
+
* @example
|
242
|
+
* ```ts-preview
|
243
|
+
* _@Component({
|
244
|
+
* selector: 'my-app',
|
245
|
+
* template: `
|
246
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
247
|
+
* [width]="200" [height]="100">
|
248
|
+
* </kendo-barcode>
|
249
|
+
*
|
250
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
251
|
+
* [style.width.px]="200" [style.height.px]="100">
|
252
|
+
* </kendo-barcode>
|
253
|
+
* `
|
254
|
+
* })
|
255
|
+
* export class AppComponent {
|
256
|
+
* }
|
257
|
+
* ```
|
258
|
+
*/
|
259
|
+
height;
|
260
|
+
/**
|
261
|
+
* The padding of the Barcode. A numeric value sets all paddings.
|
262
|
+
*
|
263
|
+
* @default 0
|
264
|
+
*
|
265
|
+
* @example
|
266
|
+
* ```ts-preview
|
267
|
+
* import { Component } from '@angular/core';
|
268
|
+
* import { Padding } from '@progress/kendo-angular-barcodes';
|
269
|
+
*
|
270
|
+
* _@Component({
|
271
|
+
* selector: 'my-app',
|
272
|
+
* template: `
|
273
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
274
|
+
* [padding]="5" background="#fc0">
|
275
|
+
* </kendo-barcode>
|
276
|
+
*
|
277
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
278
|
+
* [padding]="barcodePadding" background="#cf0">
|
279
|
+
* </kendo-barcode>
|
280
|
+
* `
|
281
|
+
* })
|
282
|
+
* export class AppComponent {
|
283
|
+
* barcodePadding: Padding = {
|
284
|
+
* top: 20,
|
285
|
+
* bottom: 10,
|
286
|
+
* left: 5,
|
287
|
+
* right: 5
|
288
|
+
* };
|
289
|
+
* }
|
290
|
+
* ```
|
291
|
+
*/
|
292
|
+
padding;
|
293
|
+
/**
|
294
|
+
* Sets the preferred rendering mode of the Barcode.
|
295
|
+
*
|
296
|
+
* The supported values are:
|
297
|
+
* * `"canvas"`—Renders the component as a Canvas element.
|
298
|
+
* * `"svg"`—Renders the component as an inline SVG document.
|
299
|
+
*
|
300
|
+
* @default "svg"
|
301
|
+
*
|
302
|
+
* @example
|
303
|
+
* ```ts-preview
|
304
|
+
* _@Component({
|
305
|
+
* selector: 'my-app',
|
306
|
+
* template: `
|
307
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
308
|
+
* renderAs="canvas">
|
309
|
+
* </kendo-barcode>
|
310
|
+
* `
|
311
|
+
* })
|
312
|
+
* export class AppComponent {
|
313
|
+
* }
|
314
|
+
* ```
|
315
|
+
*/
|
316
|
+
renderAs;
|
317
|
+
/**
|
318
|
+
* The Barcode text label configuration.
|
319
|
+
*
|
320
|
+
* @example
|
321
|
+
* ```ts-preview
|
322
|
+
* import { Component } from '@angular/core';
|
323
|
+
* import { BarcodeText } from '@progress/kendo-angular-barcodes';
|
324
|
+
*
|
325
|
+
* _@Component({
|
326
|
+
* selector: 'my-app',
|
327
|
+
* template: `
|
328
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
329
|
+
* [text]="barcodeText">
|
330
|
+
* </kendo-barcode>
|
331
|
+
* `
|
332
|
+
* })
|
333
|
+
* export class AppComponent {
|
334
|
+
* barcodeText: BarcodeText = {
|
335
|
+
* color: '#fc0',
|
336
|
+
* font: '20px monospace'
|
337
|
+
* };
|
338
|
+
* }
|
339
|
+
* ```
|
340
|
+
*/
|
341
|
+
text;
|
342
|
+
/**
|
343
|
+
* The symbology (encoding) the Barcode will use.
|
344
|
+
*
|
345
|
+
* @default "Code39"
|
346
|
+
*
|
347
|
+
* @example
|
348
|
+
* ```ts-preview
|
349
|
+
* import { Component } from '@angular/core';
|
350
|
+
*
|
351
|
+
* _@Component({
|
352
|
+
* selector: 'my-app',
|
353
|
+
* template: `
|
354
|
+
* <kendo-barcode type="EAN13" value="123456789987">
|
355
|
+
* </kendo-barcode>
|
356
|
+
* `
|
357
|
+
* })
|
358
|
+
* export class AppComponent {
|
359
|
+
* }
|
360
|
+
* ```
|
361
|
+
*/
|
362
|
+
type;
|
363
|
+
/**
|
364
|
+
* The value of the Barcode.
|
365
|
+
*
|
366
|
+
* @example
|
367
|
+
* ```ts-preview
|
368
|
+
* import { Component } from '@angular/core';
|
369
|
+
*
|
370
|
+
* _@Component({
|
371
|
+
* selector: 'my-app',
|
372
|
+
* template: `
|
373
|
+
* <kendo-barcode type="EAN13" value="123456789987">
|
374
|
+
* </kendo-barcode>
|
375
|
+
* `
|
376
|
+
* })
|
377
|
+
* export class AppComponent {
|
378
|
+
* }
|
379
|
+
* ```
|
380
|
+
*/
|
381
|
+
value;
|
382
|
+
/**
|
383
|
+
* The width of the Barcode in pixels.
|
384
|
+
*
|
385
|
+
* The Barcode dimensions can also be set through regular CSS styling.
|
386
|
+
*
|
387
|
+
* @example
|
388
|
+
* ```ts-preview
|
389
|
+
* _@Component({
|
390
|
+
* selector: 'my-app',
|
391
|
+
* template: `
|
392
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
393
|
+
* [width]="200" [height]="100">
|
394
|
+
* </kendo-barcode>
|
395
|
+
*
|
396
|
+
* <kendo-barcode type="EAN8" value="1234567"
|
397
|
+
* [style.width.px]="200" [style.height.px]="100">
|
398
|
+
* </kendo-barcode>
|
399
|
+
* `
|
400
|
+
* })
|
401
|
+
* export class AppComponent {
|
402
|
+
* }
|
403
|
+
* ```
|
404
|
+
*/
|
405
|
+
width;
|
406
|
+
/**
|
407
|
+
* Limits the automatic resizing of the Barcode. Sets the maximum number of times per second
|
408
|
+
* that the component redraws its content when the size of its container changes.
|
409
|
+
* Defaults to `10`. To disable the automatic resizing, set it to `0`.
|
410
|
+
*
|
411
|
+
* @example
|
412
|
+
* ```ts
|
413
|
+
* _@Component({
|
414
|
+
* selector: 'my-app',
|
415
|
+
* template: `
|
416
|
+
* <kendo-barcode type="EAN8" [value]="1234567"
|
417
|
+
* [resizeRateLimit]="2">
|
418
|
+
* </kendo-barcode>
|
419
|
+
* `
|
420
|
+
* })
|
421
|
+
* export class AppComponent {
|
422
|
+
* }
|
423
|
+
* ```
|
424
|
+
*/
|
425
|
+
resizeRateLimit = 10;
|
426
|
+
get options() {
|
427
|
+
return {
|
428
|
+
renderAs: this.renderAs,
|
429
|
+
background: this.background,
|
430
|
+
border: this.border,
|
431
|
+
checksum: this.checksum,
|
432
|
+
color: this.color,
|
433
|
+
height: this.height,
|
434
|
+
padding: this.padding,
|
435
|
+
text: this.text,
|
436
|
+
type: this.type,
|
437
|
+
value: this.value,
|
438
|
+
width: this.width
|
439
|
+
};
|
440
|
+
}
|
441
|
+
constructor(element, renderer, ngZone) {
|
442
|
+
super(element, renderer, ngZone);
|
443
|
+
this.element = element;
|
444
|
+
this.renderer = renderer;
|
445
|
+
this.ngZone = ngZone;
|
446
|
+
}
|
447
|
+
createInstance(element, options) {
|
448
|
+
return new Barcode(element, options, this.onError.bind(this));
|
449
|
+
}
|
450
|
+
onError(error) {
|
451
|
+
error.name = packageMetadata.productName + ' Barcode';
|
452
|
+
if (this.isDevMode()) {
|
453
|
+
throw error;
|
454
|
+
}
|
455
|
+
else {
|
456
|
+
console.warn(error);
|
457
|
+
}
|
458
|
+
}
|
459
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
460
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", 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: `
|
461
|
+
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
|
462
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
463
|
+
}
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodeComponent, decorators: [{
|
465
|
+
type: Component,
|
466
|
+
args: [{
|
467
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
468
|
+
exportAs: 'kendoBarcode',
|
469
|
+
selector: 'kendo-barcode',
|
470
|
+
template: `
|
471
|
+
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
|
472
|
+
`,
|
473
|
+
standalone: true,
|
474
|
+
imports: [ResizeSensorComponent]
|
475
|
+
}]
|
476
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { background: [{
|
477
|
+
type: Input
|
478
|
+
}], border: [{
|
479
|
+
type: Input
|
480
|
+
}], checksum: [{
|
481
|
+
type: Input
|
482
|
+
}], color: [{
|
483
|
+
type: Input
|
484
|
+
}], height: [{
|
485
|
+
type: Input
|
486
|
+
}], padding: [{
|
487
|
+
type: Input
|
488
|
+
}], renderAs: [{
|
489
|
+
type: Input
|
490
|
+
}], text: [{
|
491
|
+
type: Input
|
492
|
+
}], type: [{
|
493
|
+
type: Input
|
494
|
+
}], value: [{
|
495
|
+
type: Input
|
496
|
+
}], width: [{
|
497
|
+
type: Input
|
498
|
+
}], resizeRateLimit: [{
|
499
|
+
type: Input
|
500
|
+
}] } });
|
501
|
+
|
502
|
+
const DEFAULT_COLOR = '#000';
|
503
|
+
const DEFAULT_BACKGROUND = '#fff';
|
504
|
+
const DEFAULT_ERROR_CORRECTION = 'L';
|
505
|
+
/**
|
506
|
+
* Represents the Kendo UI QR Code component for Angular.
|
507
|
+
*
|
508
|
+
* @example
|
509
|
+
* ```ts
|
510
|
+
* import { Component } from '@angular/core';
|
511
|
+
*
|
512
|
+
* _@Component({
|
513
|
+
* selector: 'my-app',
|
514
|
+
* template: `
|
515
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
|
516
|
+
* </kendo-qrcode>
|
517
|
+
* `
|
518
|
+
* })
|
519
|
+
* export class AppComponent {
|
520
|
+
* }
|
521
|
+
* ```
|
522
|
+
*/
|
523
|
+
class QRCodeComponent extends BaseComponent {
|
524
|
+
element;
|
525
|
+
renderer;
|
526
|
+
ngZone;
|
527
|
+
/**
|
528
|
+
* The background color of the QR Code. Accepts a valid CSS color string, including hex and rgb.
|
529
|
+
*
|
530
|
+
* @default "white"
|
531
|
+
*
|
532
|
+
* @example
|
533
|
+
* ```ts-preview
|
534
|
+
* import { Component } from '@angular/core';
|
535
|
+
*
|
536
|
+
* _@Component({
|
537
|
+
* selector: 'my-app',
|
538
|
+
* template: `
|
539
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
540
|
+
* background="#fc0">
|
541
|
+
* </kendo-qrcode>
|
542
|
+
* `
|
543
|
+
* })
|
544
|
+
* export class AppComponent {
|
545
|
+
* }
|
546
|
+
* ```
|
547
|
+
*/
|
548
|
+
background;
|
549
|
+
/**
|
550
|
+
* The border of the QR Code.
|
551
|
+
*
|
552
|
+
* @example
|
553
|
+
* ```ts-preview
|
554
|
+
* import { Component } from '@angular/core';
|
555
|
+
* import { Border } from '@progress/kendo-angular-barcodes';
|
556
|
+
*
|
557
|
+
* _@Component({
|
558
|
+
* selector: 'my-app',
|
559
|
+
* template: `
|
560
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
561
|
+
* [border]="qrcodeBorder" [padding]="5">
|
562
|
+
* </kendo-qrcode>
|
563
|
+
* `
|
564
|
+
* })
|
565
|
+
* export class AppComponent {
|
566
|
+
* qrcodeBorder: Border = {
|
567
|
+
* color: '#fc0',
|
568
|
+
* width: 2
|
569
|
+
* };
|
570
|
+
* }
|
571
|
+
* ```
|
572
|
+
*/
|
573
|
+
border;
|
574
|
+
/**
|
575
|
+
* The color of the QR Code. Accepts a valid CSS color string, including hex and rgb.
|
576
|
+
*
|
577
|
+
* @default "black"
|
578
|
+
*
|
579
|
+
* @example
|
580
|
+
* ```ts-preview
|
581
|
+
* _@Component({
|
582
|
+
* selector: 'my-app',
|
583
|
+
* template: `
|
584
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
585
|
+
* color="#fc0">
|
586
|
+
* </kendo-qrcode>
|
587
|
+
* `
|
588
|
+
* })
|
589
|
+
* export class AppComponent {
|
590
|
+
* }
|
591
|
+
* ```
|
592
|
+
*/
|
593
|
+
color;
|
594
|
+
/**
|
595
|
+
* The encoding mode used to encode the value.
|
596
|
+
*
|
597
|
+
* > **Important** The UTF-8 encoding is not included in the specifications and is not supported by all readers.
|
598
|
+
*
|
599
|
+
* The possible values are:
|
600
|
+
* * `"ISO_8859_1"`—Supports all characters from the [ISO/IEC 8859-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) character set.
|
601
|
+
* * `"UTF_8"`—Supports all [Unicode](https://en.wikipedia.org/wiki/List_of_Unicode_characters) characters.
|
602
|
+
*
|
603
|
+
* @default "ISO_8859_1"
|
604
|
+
*
|
605
|
+
* @example
|
606
|
+
* ```ts-preview
|
607
|
+
* _@Component({
|
608
|
+
* selector: 'my-app',
|
609
|
+
* template: `
|
610
|
+
* <kendo-qrcode value="АБВ" encoding="UTF_8">
|
611
|
+
* </kendo-qrcode>
|
612
|
+
* `
|
613
|
+
* })
|
614
|
+
* export class AppComponent {
|
615
|
+
* }
|
616
|
+
* ```
|
617
|
+
*/
|
618
|
+
encoding;
|
619
|
+
/**
|
620
|
+
* The error correction level to use.
|
621
|
+
*
|
622
|
+
* The possible values are:
|
623
|
+
* * `"L"`—Approximately 7% of the codewords can be restored.
|
624
|
+
* * `"M"`—Approximately 15% of the codewords can be restored.
|
625
|
+
* * `"Q"`—Approximately 25% of the codewords can be restored.
|
626
|
+
* * `"H"`—Approximately 30% of the codewords can be restored.
|
627
|
+
*
|
628
|
+
* @default "L"
|
629
|
+
*
|
630
|
+
* @example
|
631
|
+
* ```ts-preview
|
632
|
+
* _@Component({
|
633
|
+
* selector: 'my-app',
|
634
|
+
* template: `
|
635
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
636
|
+
* errorCorrection="Q">
|
637
|
+
* </kendo-qrcode>
|
638
|
+
* `
|
639
|
+
* })
|
640
|
+
* export class AppComponent {
|
641
|
+
* }
|
642
|
+
* ```
|
643
|
+
*/
|
644
|
+
errorCorrection;
|
645
|
+
/**
|
646
|
+
* An optional image overlay that will placed over the QR Code.
|
647
|
+
*
|
648
|
+
* > **Note** Always test if the code reads correctly with the applied overlay.
|
649
|
+
* > Depending on the length of the value and the size of the overlay, you might need to raise the `errorCorrection` level to `"M"` or `"H"`.
|
650
|
+
*
|
651
|
+
* @example
|
652
|
+
* ```ts-preview
|
653
|
+
* import { QRCodeOverlay } from '@progress/kendo-angular-barcodes';
|
654
|
+
*
|
655
|
+
* _@Component({
|
656
|
+
* selector: 'my-app',
|
657
|
+
* template: `
|
658
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
659
|
+
* [overlay]="qrcodeOverlay">
|
660
|
+
* </kendo-qrcode>
|
661
|
+
* `
|
662
|
+
* })
|
663
|
+
* export class AppComponent {
|
664
|
+
* qrcodeOverlay: QRCodeOverlay = {
|
665
|
+
* type: 'swiss'
|
666
|
+
* };
|
667
|
+
* }
|
668
|
+
* ```
|
669
|
+
*/
|
670
|
+
overlay;
|
671
|
+
/**
|
672
|
+
* The padding of the QR Code. The value sets all paddings in pixels.
|
673
|
+
*
|
674
|
+
* @default 0
|
675
|
+
*
|
676
|
+
* @example
|
677
|
+
* ```ts-preview
|
678
|
+
* import { Component } from '@angular/core';
|
679
|
+
*
|
680
|
+
* _@Component({
|
681
|
+
* selector: 'my-app',
|
682
|
+
* template: `
|
683
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
684
|
+
* [padding]="10" background="#fc0">
|
685
|
+
* </kendo-qrcode>
|
686
|
+
* `
|
687
|
+
* })
|
688
|
+
* export class AppComponent {
|
689
|
+
* }
|
690
|
+
* ```
|
691
|
+
*/
|
692
|
+
padding;
|
693
|
+
/**
|
694
|
+
* Sets the preferred rendering mode of the QR Code.
|
695
|
+
*
|
696
|
+
* The supported values are:
|
697
|
+
* * `"canvas"`—Renders the component as a Canvas element.
|
698
|
+
* * `"svg"`—Renders the component as an inline SVG document.
|
699
|
+
*
|
700
|
+
* @default "svg"
|
701
|
+
*
|
702
|
+
* @example
|
703
|
+
* ```ts-preview
|
704
|
+
* _@Component({
|
705
|
+
* selector: 'my-app',
|
706
|
+
* template: `
|
707
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
708
|
+
* renderAs="canvas">
|
709
|
+
* </kendo-qrcode>
|
710
|
+
* `
|
711
|
+
* })
|
712
|
+
* export class AppComponent {
|
713
|
+
* }
|
714
|
+
* ```
|
715
|
+
*/
|
716
|
+
renderAs;
|
717
|
+
/**
|
718
|
+
* Specifies the size of a QR Code. Numeric values are treated as pixels.
|
719
|
+
*
|
720
|
+
* If no size is specified, the size will be determined from the element width and height.
|
721
|
+
* If the element has width or height of zero, a default value of 200 pixels will be used.
|
722
|
+
*
|
723
|
+
* @default "200px"
|
724
|
+
*
|
725
|
+
* @example
|
726
|
+
* ```ts-preview
|
727
|
+
* _@Component({
|
728
|
+
* selector: 'my-app',
|
729
|
+
* template: `
|
730
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
731
|
+
* [size]="200">
|
732
|
+
* </kendo-qrcode>
|
733
|
+
*
|
734
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
735
|
+
* [style.width.px]="200" [style.height.px]="200">
|
736
|
+
* </kendo-qrcode>
|
737
|
+
* `
|
738
|
+
* })
|
739
|
+
* export class AppComponent {
|
740
|
+
* }
|
741
|
+
* ```
|
742
|
+
*/
|
743
|
+
size;
|
744
|
+
/**
|
745
|
+
* The value of the QR Code.
|
746
|
+
*
|
747
|
+
* @example
|
748
|
+
* ```ts-preview
|
749
|
+
* _@Component({
|
750
|
+
* selector: 'my-app',
|
751
|
+
* template: `
|
752
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
|
753
|
+
* </kendo-qrcode>
|
754
|
+
* `
|
755
|
+
* })
|
756
|
+
* export class AppComponent {
|
757
|
+
* }
|
758
|
+
* ```
|
759
|
+
*/
|
760
|
+
value;
|
761
|
+
/**
|
762
|
+
* Limits the automatic resizing of the QR Code. Sets the maximum number of times per second
|
763
|
+
* that the component redraws its content when the size of its container changes.
|
764
|
+
* Defaults to `10`. To disable the automatic resizing, set it to `0`.
|
765
|
+
*
|
766
|
+
* @example
|
767
|
+
* ```ts
|
768
|
+
* _@Component({
|
769
|
+
* selector: 'my-app',
|
770
|
+
* template: `
|
771
|
+
* <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
|
772
|
+
* [resizeRateLimit]="2">
|
773
|
+
* </kendo-qrcode>
|
774
|
+
* `
|
775
|
+
* })
|
776
|
+
* export class AppComponent {
|
777
|
+
* }
|
778
|
+
* ```
|
779
|
+
*/
|
780
|
+
resizeRateLimit = 10;
|
781
|
+
get options() {
|
782
|
+
return {
|
783
|
+
background: this.background || DEFAULT_BACKGROUND,
|
784
|
+
border: this.border,
|
785
|
+
color: this.color || DEFAULT_COLOR,
|
786
|
+
encoding: this.encoding,
|
787
|
+
errorCorrection: this.errorCorrection || DEFAULT_ERROR_CORRECTION,
|
788
|
+
overlay: this.overlay || {},
|
789
|
+
padding: this.padding,
|
790
|
+
renderAs: this.renderAs,
|
791
|
+
size: this.size,
|
792
|
+
value: this.value
|
793
|
+
};
|
794
|
+
}
|
795
|
+
constructor(element, renderer, ngZone) {
|
796
|
+
super(element, renderer, ngZone);
|
797
|
+
this.element = element;
|
798
|
+
this.renderer = renderer;
|
799
|
+
this.ngZone = ngZone;
|
800
|
+
}
|
801
|
+
createInstance(element, options) {
|
802
|
+
return new QRCode(element, options, this.onError.bind(this));
|
803
|
+
}
|
804
|
+
onError(error) {
|
805
|
+
error.name = packageMetadata.productName + ' QRCode';
|
806
|
+
if (this.isDevMode()) {
|
807
|
+
throw error;
|
808
|
+
}
|
809
|
+
else {
|
810
|
+
console.warn(error);
|
811
|
+
}
|
812
|
+
}
|
813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QRCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
814
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", 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: `
|
815
|
+
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
|
816
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
817
|
+
}
|
818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QRCodeComponent, decorators: [{
|
819
|
+
type: Component,
|
820
|
+
args: [{
|
821
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
822
|
+
selector: 'kendo-qrcode',
|
823
|
+
exportAs: 'kendoQRCode',
|
824
|
+
template: `
|
825
|
+
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
|
826
|
+
`,
|
827
|
+
standalone: true,
|
828
|
+
imports: [ResizeSensorComponent]
|
829
|
+
}]
|
830
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { background: [{
|
831
|
+
type: Input
|
832
|
+
}], border: [{
|
833
|
+
type: Input
|
834
|
+
}], color: [{
|
835
|
+
type: Input
|
836
|
+
}], encoding: [{
|
837
|
+
type: Input
|
838
|
+
}], errorCorrection: [{
|
839
|
+
type: Input
|
840
|
+
}], overlay: [{
|
841
|
+
type: Input
|
842
|
+
}], padding: [{
|
843
|
+
type: Input
|
844
|
+
}], renderAs: [{
|
845
|
+
type: Input
|
846
|
+
}], size: [{
|
847
|
+
type: Input
|
848
|
+
}], value: [{
|
849
|
+
type: Input
|
850
|
+
}], resizeRateLimit: [{
|
851
|
+
type: Input
|
852
|
+
}] } });
|
853
|
+
|
854
|
+
/**
|
855
|
+
* Utility array that contains all `Barcode` related components and directives
|
856
|
+
*/
|
857
|
+
const KENDO_BARCODE = [
|
858
|
+
BarcodeComponent
|
859
|
+
];
|
860
|
+
/**
|
861
|
+
* Utility array that contains all `QRCode` related components and directives
|
862
|
+
*/
|
863
|
+
const KENDO_QRCODE = [
|
864
|
+
QRCodeComponent
|
865
|
+
];
|
866
|
+
/**
|
867
|
+
* Utility array that contains all `@progress/kendo-angular-barcodes` related components and directives
|
868
|
+
*/
|
869
|
+
const KENDO_BARCODES = [
|
870
|
+
...KENDO_BARCODE,
|
871
|
+
...KENDO_QRCODE
|
872
|
+
];
|
873
|
+
|
874
|
+
//IMPORTANT: NgModule export kept for backwards compatibility
|
875
|
+
/**
|
876
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
|
877
|
+
* definition for the Barcode component.
|
878
|
+
*
|
879
|
+
* @example
|
880
|
+
*
|
881
|
+
* ```ts-no-run
|
882
|
+
* // Import the Barcode module
|
883
|
+
* import { BarcodeModule } from '@progress/kendo-angular-barcodes';
|
884
|
+
*
|
885
|
+
* // The browser platform with a compiler
|
886
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
887
|
+
*
|
888
|
+
* import { NgModule } from '@angular/core';
|
889
|
+
*
|
890
|
+
* // Import the app component
|
891
|
+
* import { AppComponent } from './app.component';
|
892
|
+
*
|
893
|
+
* // Define the app module
|
894
|
+
* _@NgModule({
|
895
|
+
* declarations: [AppComponent], // declare app component
|
896
|
+
* imports: [BrowserModule, BarcodeModule], // import Barcode module
|
897
|
+
* bootstrap: [AppComponent]
|
898
|
+
* })
|
899
|
+
* export class AppModule {}
|
900
|
+
*
|
901
|
+
* // Compile and launch the module
|
902
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
903
|
+
*
|
904
|
+
* ```
|
905
|
+
*/
|
906
|
+
class BarcodeModule {
|
907
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
908
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: BarcodeModule, imports: [BarcodeComponent], exports: [BarcodeComponent] });
|
909
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodeModule, providers: [ResizeBatchService], imports: [KENDO_BARCODE] });
|
910
|
+
}
|
911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodeModule, decorators: [{
|
912
|
+
type: NgModule,
|
913
|
+
args: [{
|
914
|
+
imports: [...KENDO_BARCODE],
|
915
|
+
exports: [...KENDO_BARCODE],
|
916
|
+
providers: [ResizeBatchService]
|
917
|
+
}]
|
918
|
+
}] });
|
919
|
+
|
920
|
+
//IMPORTANT: NgModule export kept for backwards compatibility
|
921
|
+
/**
|
922
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
|
923
|
+
* definition for the QR Code component.
|
924
|
+
*
|
925
|
+
* @example
|
926
|
+
*
|
927
|
+
* ```ts-no-run
|
928
|
+
* // Import the QR Code module
|
929
|
+
* import { QRCodeModule } from '@progress/kendo-angular-barcodes';
|
930
|
+
*
|
931
|
+
* // The browser platform with a compiler
|
932
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
933
|
+
*
|
934
|
+
* import { NgModule } from '@angular/core';
|
935
|
+
*
|
936
|
+
* // Import the app component
|
937
|
+
* import { AppComponent } from './app.component';
|
938
|
+
*
|
939
|
+
* // Define the app module
|
940
|
+
* _@NgModule({
|
941
|
+
* declarations: [AppComponent], // declare app component
|
942
|
+
* imports: [BrowserModule, QRCodeModule], // import QRCodeModule module
|
943
|
+
* bootstrap: [AppComponent]
|
944
|
+
* })
|
945
|
+
* export class AppModule {}
|
946
|
+
*
|
947
|
+
* // Compile and launch the module
|
948
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
949
|
+
*
|
950
|
+
* ```
|
951
|
+
*/
|
952
|
+
class QRCodeModule {
|
953
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QRCodeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
954
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: QRCodeModule, imports: [QRCodeComponent], exports: [QRCodeComponent] });
|
955
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QRCodeModule, providers: [ResizeBatchService], imports: [KENDO_QRCODE] });
|
956
|
+
}
|
957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QRCodeModule, decorators: [{
|
958
|
+
type: NgModule,
|
959
|
+
args: [{
|
960
|
+
imports: [...KENDO_QRCODE],
|
961
|
+
exports: [...KENDO_QRCODE],
|
962
|
+
providers: [ResizeBatchService]
|
963
|
+
}]
|
964
|
+
}] });
|
965
|
+
|
966
|
+
//IMPORTANT: NgModule export kept for backwards compatibility
|
967
|
+
/**
|
968
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
|
969
|
+
* definition for the Barcode and QR Code components.
|
970
|
+
*
|
971
|
+
* @example
|
972
|
+
*
|
973
|
+
* ```ts-no-run
|
974
|
+
* // Import the Barcodes module
|
975
|
+
* import { BarcodesModule } from '@progress/kendo-angular-barcodes';
|
976
|
+
*
|
977
|
+
* // The browser platform with a compiler
|
978
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
979
|
+
*
|
980
|
+
* import { NgModule } from '@angular/core';
|
981
|
+
*
|
982
|
+
* // Import the app component
|
983
|
+
* import { AppComponent } from './app.component';
|
984
|
+
*
|
985
|
+
* // Define the app module
|
986
|
+
* _@NgModule({
|
987
|
+
* declarations: [AppComponent], // declare app component
|
988
|
+
* imports: [BrowserModule, BarcodesModule], // import Barcodes module
|
989
|
+
* bootstrap: [AppComponent]
|
990
|
+
* })
|
991
|
+
* export class AppModule {}
|
992
|
+
*
|
993
|
+
* // Compile and launch the module
|
994
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
995
|
+
*
|
996
|
+
* ```
|
997
|
+
*/
|
998
|
+
class BarcodesModule {
|
999
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1000
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: BarcodesModule, imports: [BarcodeComponent, QRCodeComponent], exports: [BarcodeComponent, QRCodeComponent] });
|
1001
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodesModule, providers: [ResizeBatchService], imports: [KENDO_BARCODES] });
|
1002
|
+
}
|
1003
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarcodesModule, decorators: [{
|
1004
|
+
type: NgModule,
|
1005
|
+
args: [{
|
1006
|
+
imports: [...KENDO_BARCODES],
|
1007
|
+
exports: [...KENDO_BARCODES],
|
1008
|
+
providers: [ResizeBatchService]
|
1009
|
+
}]
|
1010
|
+
}] });
|
1011
|
+
|
1012
|
+
/**
|
1013
|
+
* @hidden
|
1014
|
+
*/
|
1015
|
+
const isPresent = (value) => value !== null && value !== undefined;
|
1016
|
+
/**
|
1017
|
+
* Creates a value validator for a particular Barcode type.
|
1018
|
+
*
|
1019
|
+
* @param {BarcodeType} type The type of the Barcode.
|
1020
|
+
* @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
|
1021
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
|
1022
|
+
*
|
1023
|
+
* @example
|
1024
|
+
* ```ts-no-run
|
1025
|
+
* const control = new FormControl('1234', createBarcodeValidator('EAN8'));
|
1026
|
+
* console.log(control.errors);
|
1027
|
+
*
|
1028
|
+
* // {
|
1029
|
+
* // barcode: {
|
1030
|
+
* // message: 'The value of the "EAN13" encoding should be 12 symbols',
|
1031
|
+
* // value: '1234',
|
1032
|
+
* // type: 'EAN13'
|
1033
|
+
* // }
|
1034
|
+
* // }
|
1035
|
+
* ```
|
1036
|
+
*/
|
1037
|
+
const createBarcodeValidator = (type, size) => {
|
1038
|
+
const validator = barcodeValidator(type, size);
|
1039
|
+
return (control) => {
|
1040
|
+
if (!isPresent(control.value) || control.value === '') {
|
1041
|
+
return null;
|
1042
|
+
}
|
1043
|
+
const result = validator(control.value);
|
1044
|
+
if (result.valid === true) {
|
1045
|
+
return null;
|
1046
|
+
}
|
1047
|
+
return {
|
1048
|
+
barcode: {
|
1049
|
+
message: result.error.message,
|
1050
|
+
value: control.value,
|
1051
|
+
type: type
|
1052
|
+
}
|
1053
|
+
};
|
1054
|
+
};
|
1055
|
+
};
|
1056
|
+
|
1057
|
+
/**
|
1058
|
+
* Creates a value validator for a particular Barcode type.
|
1059
|
+
*
|
1060
|
+
* @param {QRCodeEncoding} encoding The QR Code encoding. Defaults to 'ISO_8859_1'.
|
1061
|
+
* @returns {ValidatorFn} A validator function that returns an error map with the `qrcode` property if the validation check fails, otherwise `null`.
|
1062
|
+
*
|
1063
|
+
* @example
|
1064
|
+
* ```ts-no-run
|
1065
|
+
* const control = new FormControl('Фоо', createQRCodeValidator());
|
1066
|
+
* console.log(control.errors);
|
1067
|
+
*
|
1068
|
+
* // {
|
1069
|
+
* // qrcode: {
|
1070
|
+
* // message: 'Unsupported character in QR Code: "Ф".',
|
1071
|
+
* // value: '1234',
|
1072
|
+
* // type: 'EAN13'
|
1073
|
+
* // }
|
1074
|
+
* // }
|
1075
|
+
* ```
|
1076
|
+
*/
|
1077
|
+
const createQRCodeValidator = (encoding = 'ISO_8859_1') => {
|
1078
|
+
const validator = qrcodeValidator(encoding);
|
1079
|
+
return (control) => {
|
1080
|
+
if (!control.value) {
|
1081
|
+
return null;
|
1082
|
+
}
|
1083
|
+
const result = validator(control.value);
|
1084
|
+
if (result.valid === true) {
|
1085
|
+
return null;
|
1086
|
+
}
|
1087
|
+
return {
|
1088
|
+
qrcode: {
|
1089
|
+
message: result.error.message,
|
1090
|
+
value: control.value,
|
1091
|
+
encoding: encoding
|
1092
|
+
}
|
1093
|
+
};
|
1094
|
+
};
|
1095
|
+
};
|
1096
|
+
|
1097
|
+
/**
|
1098
|
+
* Generated bundle index. Do not edit.
|
1099
|
+
*/
|
1100
|
+
|
1101
|
+
export { BarcodeComponent, BarcodeModule, BarcodesModule, KENDO_BARCODE, KENDO_BARCODES, KENDO_QRCODE, QRCodeComponent, QRCodeModule, createBarcodeValidator, createQRCodeValidator };
|
1102
|
+
|