@progress/kendo-angular-barcodes 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +614 -0
  3. package/README.md +31 -0
  4. package/dist/cdn/js/kendo-angular-barcodes.js +20 -0
  5. package/dist/cdn/main.js +5 -0
  6. package/dist/es/barcode.component.js +139 -0
  7. package/dist/es/barcode.module.js +52 -0
  8. package/dist/es/barcodes.module.js +50 -0
  9. package/dist/es/base.component.js +114 -0
  10. package/dist/es/chart-types/barcode-types.js +4 -0
  11. package/dist/es/chart-types/field-types.js +4 -0
  12. package/dist/es/chart-types/qrcode-types.js +4 -0
  13. package/dist/es/chart-types.js +4 -0
  14. package/dist/es/index.js +9 -0
  15. package/dist/es/main.js +9 -0
  16. package/dist/es/package-metadata.js +15 -0
  17. package/dist/es/qrcode.component.js +137 -0
  18. package/dist/es/qrcode.module.js +52 -0
  19. package/dist/es2015/barcode.component.d.ts +311 -0
  20. package/dist/es2015/barcode.component.js +134 -0
  21. package/dist/es2015/barcode.module.d.ts +37 -0
  22. package/dist/es2015/barcode.module.js +49 -0
  23. package/dist/es2015/barcodes.module.d.ts +37 -0
  24. package/dist/es2015/barcodes.module.js +47 -0
  25. package/dist/es2015/base.component.d.ts +54 -0
  26. package/dist/es2015/base.component.js +102 -0
  27. package/dist/es2015/chart-types/barcode-types.d.ts +109 -0
  28. package/dist/es2015/chart-types/barcode-types.js +4 -0
  29. package/dist/es2015/chart-types/field-types.d.ts +59 -0
  30. package/dist/es2015/chart-types/field-types.js +4 -0
  31. package/dist/es2015/chart-types/qrcode-types.d.ts +124 -0
  32. package/dist/es2015/chart-types/qrcode-types.js +4 -0
  33. package/dist/es2015/chart-types.d.ts +7 -0
  34. package/dist/es2015/chart-types.js +4 -0
  35. package/dist/es2015/index.d.ts +9 -0
  36. package/dist/es2015/index.js +9 -0
  37. package/dist/es2015/index.metadata.json +1 -0
  38. package/dist/es2015/main.d.ts +10 -0
  39. package/dist/es2015/main.js +9 -0
  40. package/dist/es2015/package-metadata.d.ts +9 -0
  41. package/dist/es2015/package-metadata.js +15 -0
  42. package/dist/es2015/qrcode.component.d.ts +288 -0
  43. package/dist/es2015/qrcode.component.js +132 -0
  44. package/dist/es2015/qrcode.module.d.ts +37 -0
  45. package/dist/es2015/qrcode.module.js +49 -0
  46. package/dist/fesm2015/index.js +492 -0
  47. package/dist/fesm5/index.js +522 -0
  48. package/dist/npm/barcode.component.js +141 -0
  49. package/dist/npm/barcode.module.js +54 -0
  50. package/dist/npm/barcodes.module.js +52 -0
  51. package/dist/npm/base.component.js +116 -0
  52. package/dist/npm/chart-types/barcode-types.js +6 -0
  53. package/dist/npm/chart-types/field-types.js +6 -0
  54. package/dist/npm/chart-types/qrcode-types.js +6 -0
  55. package/dist/npm/chart-types.js +6 -0
  56. package/dist/npm/index.js +13 -0
  57. package/dist/npm/main.js +16 -0
  58. package/dist/npm/package-metadata.js +17 -0
  59. package/dist/npm/qrcode.component.js +139 -0
  60. package/dist/npm/qrcode.module.js +54 -0
  61. package/dist/systemjs/kendo-angular-barcodes.js +5 -0
  62. package/package.json +154 -0
  63. package/schematics/collection.json +12 -0
  64. package/schematics/ngAdd/index.js +18 -0
  65. package/schematics/ngAdd/index.js.map +1 -0
  66. package/schematics/ngAdd/schema.json +28 -0
@@ -0,0 +1,492 @@
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 } from 'tslib';
6
+ import { Input, ViewChild, ElementRef, Component, ChangeDetectionStrategy, Renderer2, NgZone, NgModule } from '@angular/core';
7
+ import { Barcode, QRCode } 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
+ const packageMetadata = {
16
+ name: '@progress/kendo-angular-barcodes',
17
+ productName: 'Kendo UI for Angular',
18
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
19
+ publishDate: 1638370938,
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
+ 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
+ }
108
+ __decorate([
109
+ Input(),
110
+ __metadata("design:type", Number)
111
+ ], BaseComponent.prototype, "resizeRateLimit", void 0);
112
+ __decorate([
113
+ ViewChild('surface', { static: true }),
114
+ __metadata("design:type", ElementRef)
115
+ ], BaseComponent.prototype, "surfaceElement", void 0);
116
+
117
+ /**
118
+ * Represents the Kendo UI Barcode component for Angular.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * import { Component } from '@angular/core';
123
+ *
124
+ * _@Component({
125
+ * selector: 'my-app',
126
+ * template: `
127
+ * <kendo-barcode type="EAN8" value="1234567">
128
+ * </kendo-barcode>
129
+ * `
130
+ * })
131
+ * export class AppComponent {
132
+ * }
133
+ * ```
134
+ */
135
+ let BarcodeComponent = class BarcodeComponent extends BaseComponent {
136
+ constructor(element, renderer, ngZone) {
137
+ super(element, renderer, ngZone);
138
+ this.element = element;
139
+ this.renderer = renderer;
140
+ this.ngZone = ngZone;
141
+ /**
142
+ * Limits the automatic resizing of the Barcode. Sets the maximum number of times per second
143
+ * that the component redraws its content when the size of its container changes.
144
+ * Defaults to `10`. To disable the automatic resizing, set it to `0`.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * _@Component({
149
+ * selector: 'my-app',
150
+ * template: `
151
+ * <kendo-barcode type="EAN8" [value]="1234567"
152
+ * [resizeRateLimit]="2">
153
+ * </kendo-barcode>
154
+ * `
155
+ * })
156
+ * export class AppComponent {
157
+ * }
158
+ * ```
159
+ */
160
+ this.resizeRateLimit = 10;
161
+ }
162
+ get options() {
163
+ return {
164
+ renderAs: this.renderAs,
165
+ background: this.background,
166
+ border: this.border,
167
+ checksum: this.checksum,
168
+ color: this.color,
169
+ height: this.height,
170
+ padding: this.padding,
171
+ text: this.text,
172
+ type: this.type,
173
+ value: this.value,
174
+ width: this.width
175
+ };
176
+ }
177
+ createInstance(element, options) {
178
+ return new Barcode(element, options);
179
+ }
180
+ };
181
+ __decorate([
182
+ Input(),
183
+ __metadata("design:type", String)
184
+ ], BarcodeComponent.prototype, "background", void 0);
185
+ __decorate([
186
+ Input(),
187
+ __metadata("design:type", Object)
188
+ ], BarcodeComponent.prototype, "border", void 0);
189
+ __decorate([
190
+ Input(),
191
+ __metadata("design:type", Boolean)
192
+ ], BarcodeComponent.prototype, "checksum", void 0);
193
+ __decorate([
194
+ Input(),
195
+ __metadata("design:type", String)
196
+ ], BarcodeComponent.prototype, "color", void 0);
197
+ __decorate([
198
+ Input(),
199
+ __metadata("design:type", Number)
200
+ ], BarcodeComponent.prototype, "height", void 0);
201
+ __decorate([
202
+ Input(),
203
+ __metadata("design:type", Object)
204
+ ], BarcodeComponent.prototype, "padding", void 0);
205
+ __decorate([
206
+ Input(),
207
+ __metadata("design:type", String)
208
+ ], BarcodeComponent.prototype, "renderAs", void 0);
209
+ __decorate([
210
+ Input(),
211
+ __metadata("design:type", Object)
212
+ ], BarcodeComponent.prototype, "text", void 0);
213
+ __decorate([
214
+ Input(),
215
+ __metadata("design:type", String)
216
+ ], BarcodeComponent.prototype, "type", void 0);
217
+ __decorate([
218
+ Input(),
219
+ __metadata("design:type", Object)
220
+ ], BarcodeComponent.prototype, "value", void 0);
221
+ __decorate([
222
+ Input(),
223
+ __metadata("design:type", Number)
224
+ ], BarcodeComponent.prototype, "width", void 0);
225
+ __decorate([
226
+ Input(),
227
+ __metadata("design:type", Number)
228
+ ], BarcodeComponent.prototype, "resizeRateLimit", void 0);
229
+ BarcodeComponent = __decorate([
230
+ Component({
231
+ changeDetection: ChangeDetectionStrategy.OnPush,
232
+ exportAs: 'kendoBarcode',
233
+ selector: 'kendo-barcode',
234
+ template: `
235
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
236
+ `
237
+ }),
238
+ __metadata("design:paramtypes", [ElementRef,
239
+ Renderer2,
240
+ NgZone])
241
+ ], BarcodeComponent);
242
+
243
+ const DEFAULT_COLOR = '#000';
244
+ const DEFAULT_BACKGROUND = '#fff';
245
+ const DEFAULT_ERROR_CORRECTION = 'L';
246
+ /**
247
+ * Represents the Kendo UI QR Code component for Angular.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * import { Component } from '@angular/core';
252
+ *
253
+ * _@Component({
254
+ * selector: 'my-app',
255
+ * template: `
256
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui">
257
+ * </kendo-qrcode>
258
+ * `
259
+ * })
260
+ * export class AppComponent {
261
+ * }
262
+ * ```
263
+ */
264
+ let QRCodeComponent = class QRCodeComponent extends BaseComponent {
265
+ constructor(element, renderer, ngZone) {
266
+ super(element, renderer, ngZone);
267
+ this.element = element;
268
+ this.renderer = renderer;
269
+ this.ngZone = ngZone;
270
+ /**
271
+ * Limits the automatic resizing of the QR Code. Sets the maximum number of times per second
272
+ * that the component redraws its content when the size of its container changes.
273
+ * Defaults to `10`. To disable the automatic resizing, set it to `0`.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * _@Component({
278
+ * selector: 'my-app',
279
+ * template: `
280
+ * <kendo-qrcode value="https://www.telerik.com/kendo-angular-ui"
281
+ * [resizeRateLimit]="2">
282
+ * </kendo-qrcode>
283
+ * `
284
+ * })
285
+ * export class AppComponent {
286
+ * }
287
+ * ```
288
+ */
289
+ this.resizeRateLimit = 10;
290
+ }
291
+ get options() {
292
+ return {
293
+ background: this.background || DEFAULT_BACKGROUND,
294
+ border: this.border,
295
+ color: this.color || DEFAULT_COLOR,
296
+ encoding: this.encoding,
297
+ errorCorrection: this.errorCorrection || DEFAULT_ERROR_CORRECTION,
298
+ overlay: this.overlay || {},
299
+ padding: this.padding,
300
+ renderAs: this.renderAs,
301
+ size: this.size,
302
+ value: this.value
303
+ };
304
+ }
305
+ createInstance(element, options) {
306
+ return new QRCode(element, options);
307
+ }
308
+ };
309
+ __decorate([
310
+ Input(),
311
+ __metadata("design:type", String)
312
+ ], QRCodeComponent.prototype, "background", void 0);
313
+ __decorate([
314
+ Input(),
315
+ __metadata("design:type", Object)
316
+ ], QRCodeComponent.prototype, "border", void 0);
317
+ __decorate([
318
+ Input(),
319
+ __metadata("design:type", String)
320
+ ], QRCodeComponent.prototype, "color", void 0);
321
+ __decorate([
322
+ Input(),
323
+ __metadata("design:type", String)
324
+ ], QRCodeComponent.prototype, "encoding", void 0);
325
+ __decorate([
326
+ Input(),
327
+ __metadata("design:type", String)
328
+ ], QRCodeComponent.prototype, "errorCorrection", void 0);
329
+ __decorate([
330
+ Input(),
331
+ __metadata("design:type", Object)
332
+ ], QRCodeComponent.prototype, "overlay", void 0);
333
+ __decorate([
334
+ Input(),
335
+ __metadata("design:type", Number)
336
+ ], QRCodeComponent.prototype, "padding", void 0);
337
+ __decorate([
338
+ Input(),
339
+ __metadata("design:type", String)
340
+ ], QRCodeComponent.prototype, "renderAs", void 0);
341
+ __decorate([
342
+ Input(),
343
+ __metadata("design:type", Object)
344
+ ], QRCodeComponent.prototype, "size", void 0);
345
+ __decorate([
346
+ Input(),
347
+ __metadata("design:type", Object)
348
+ ], QRCodeComponent.prototype, "value", void 0);
349
+ __decorate([
350
+ Input(),
351
+ __metadata("design:type", Number)
352
+ ], QRCodeComponent.prototype, "resizeRateLimit", void 0);
353
+ QRCodeComponent = __decorate([
354
+ Component({
355
+ changeDetection: ChangeDetectionStrategy.OnPush,
356
+ selector: 'kendo-qrcode',
357
+ exportAs: 'kendoQRCode',
358
+ template: `
359
+ <kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
360
+ `
361
+ }),
362
+ __metadata("design:paramtypes", [ElementRef,
363
+ Renderer2,
364
+ NgZone])
365
+ ], QRCodeComponent);
366
+
367
+ /**
368
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
369
+ * definition for the Barcode component.
370
+ *
371
+ * @example
372
+ *
373
+ * ```ts-no-run
374
+ * // Import the Barcode module
375
+ * import { BarcodeModule } from '@progress/kendo-angular-barcodes';
376
+ *
377
+ * // The browser platform with a compiler
378
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
379
+ *
380
+ * import { NgModule } from '@angular/core';
381
+ *
382
+ * // Import the app component
383
+ * import { AppComponent } from './app.component';
384
+ *
385
+ * // Define the app module
386
+ * _@NgModule({
387
+ * declarations: [AppComponent], // declare app component
388
+ * imports: [BrowserModule, BarcodeModule], // import Barcode module
389
+ * bootstrap: [AppComponent]
390
+ * })
391
+ * export class AppModule {}
392
+ *
393
+ * // Compile and launch the module
394
+ * platformBrowserDynamic().bootstrapModule(AppModule);
395
+ *
396
+ * ```
397
+ */
398
+ let BarcodeModule = class BarcodeModule {
399
+ };
400
+ BarcodeModule = __decorate([
401
+ NgModule({
402
+ declarations: [BarcodeComponent],
403
+ imports: [ResizeSensorModule],
404
+ exports: [BarcodeComponent]
405
+ })
406
+ ], BarcodeModule);
407
+
408
+ /**
409
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
410
+ * definition for the QR Code component.
411
+ *
412
+ * @example
413
+ *
414
+ * ```ts-no-run
415
+ * // Import the QR Code module
416
+ * import { QRCodeModule } from '@progress/kendo-angular-barcodes';
417
+ *
418
+ * // The browser platform with a compiler
419
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
420
+ *
421
+ * import { NgModule } from '@angular/core';
422
+ *
423
+ * // Import the app component
424
+ * import { AppComponent } from './app.component';
425
+ *
426
+ * // Define the app module
427
+ * _@NgModule({
428
+ * declarations: [AppComponent], // declare app component
429
+ * imports: [BrowserModule, QRCodeModule], // import QRCodeModule module
430
+ * bootstrap: [AppComponent]
431
+ * })
432
+ * export class AppModule {}
433
+ *
434
+ * // Compile and launch the module
435
+ * platformBrowserDynamic().bootstrapModule(AppModule);
436
+ *
437
+ * ```
438
+ */
439
+ let QRCodeModule = class QRCodeModule {
440
+ };
441
+ QRCodeModule = __decorate([
442
+ NgModule({
443
+ declarations: [QRCodeComponent],
444
+ imports: [ResizeSensorModule],
445
+ exports: [QRCodeComponent]
446
+ })
447
+ ], QRCodeModule);
448
+
449
+ /**
450
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
451
+ * definition for the Barcode and QR Code components.
452
+ *
453
+ * @example
454
+ *
455
+ * ```ts-no-run
456
+ * // Import the Barcodes module
457
+ * import { BarcodesModule } from '@progress/kendo-angular-barcodes';
458
+ *
459
+ * // The browser platform with a compiler
460
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
461
+ *
462
+ * import { NgModule } from '@angular/core';
463
+ *
464
+ * // Import the app component
465
+ * import { AppComponent } from './app.component';
466
+ *
467
+ * // Define the app module
468
+ * _@NgModule({
469
+ * declarations: [AppComponent], // declare app component
470
+ * imports: [BrowserModule, BarcodesModule], // import Barcodes module
471
+ * bootstrap: [AppComponent]
472
+ * })
473
+ * export class AppModule {}
474
+ *
475
+ * // Compile and launch the module
476
+ * platformBrowserDynamic().bootstrapModule(AppModule);
477
+ *
478
+ * ```
479
+ */
480
+ let BarcodesModule = class BarcodesModule {
481
+ };
482
+ BarcodesModule = __decorate([
483
+ NgModule({
484
+ exports: [BarcodeModule, QRCodeModule]
485
+ })
486
+ ], BarcodesModule);
487
+
488
+ /**
489
+ * Generated bundle index. Do not edit.
490
+ */
491
+
492
+ export { BaseComponent, BarcodeComponent, QRCodeComponent, BarcodeModule, QRCodeModule, BarcodesModule };