@progress/kendo-react-barcodes 4.14.0-dev.202112141254

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 (103) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +78 -0
  3. package/README.md +59 -0
  4. package/about.md +3 -0
  5. package/dist/cdn/js/kendo-react-barcodes.js +1 -0
  6. package/dist/es/Barcode.d.ts +49 -0
  7. package/dist/es/Barcode.js +146 -0
  8. package/dist/es/BarcodeContext.d.ts +12 -0
  9. package/dist/es/BarcodeContext.js +6 -0
  10. package/dist/es/BarcodeProps.d.ts +61 -0
  11. package/dist/es/BarcodeProps.js +0 -0
  12. package/dist/es/BaseBarcode.d.ts +75 -0
  13. package/dist/es/BaseBarcode.js +179 -0
  14. package/dist/es/BaseBarcodeProps.d.ts +41 -0
  15. package/dist/es/BaseBarcodeProps.js +0 -0
  16. package/dist/es/QRCode.d.ts +49 -0
  17. package/dist/es/QRCode.js +149 -0
  18. package/dist/es/QRCodeProps.d.ts +73 -0
  19. package/dist/es/QRCodeProps.js +0 -0
  20. package/dist/es/common/barcodes.d.ts +4 -0
  21. package/dist/es/common/barcodes.js +0 -0
  22. package/dist/es/main.d.ts +6 -0
  23. package/dist/es/main.js +3 -0
  24. package/dist/es/package-metadata.d.ts +5 -0
  25. package/dist/es/package-metadata.js +11 -0
  26. package/dist/es/store/reducer.d.ts +10 -0
  27. package/dist/es/store/reducer.js +41 -0
  28. package/dist/es/store/store.d.ts +25 -0
  29. package/dist/es/store/store.js +28 -0
  30. package/dist/es/types/barcode-text.d.ts +32 -0
  31. package/dist/es/types/barcode-text.js +0 -0
  32. package/dist/es/types/barcode-type.d.ts +4 -0
  33. package/dist/es/types/barcode-type.js +0 -0
  34. package/dist/es/types/border.interface.d.ts +18 -0
  35. package/dist/es/types/border.interface.js +0 -0
  36. package/dist/es/types/dash-type.interface.d.ts +4 -0
  37. package/dist/es/types/dash-type.interface.js +0 -0
  38. package/dist/es/types/margin.interface.d.ts +21 -0
  39. package/dist/es/types/margin.interface.js +0 -0
  40. package/dist/es/types/padding.interface.d.ts +21 -0
  41. package/dist/es/types/padding.interface.js +0 -0
  42. package/dist/es/types/qrcode-encoding.d.ts +4 -0
  43. package/dist/es/types/qrcode-encoding.js +0 -0
  44. package/dist/es/types/qrcode-error-correction.d.ts +9 -0
  45. package/dist/es/types/qrcode-error-correction.js +0 -0
  46. package/dist/es/types/qrcode-overlay.d.ts +25 -0
  47. package/dist/es/types/qrcode-overlay.js +0 -0
  48. package/dist/es/types/render-mode.d.ts +8 -0
  49. package/dist/es/types/render-mode.js +0 -0
  50. package/dist/es/types.d.ts +10 -0
  51. package/dist/es/types.js +0 -0
  52. package/dist/es/utils/common.d.ts +4 -0
  53. package/dist/es/utils/common.js +39 -0
  54. package/dist/npm/Barcode.d.ts +49 -0
  55. package/dist/npm/Barcode.js +148 -0
  56. package/dist/npm/BarcodeContext.d.ts +12 -0
  57. package/dist/npm/BarcodeContext.js +8 -0
  58. package/dist/npm/BarcodeProps.d.ts +61 -0
  59. package/dist/npm/BarcodeProps.js +2 -0
  60. package/dist/npm/BaseBarcode.d.ts +75 -0
  61. package/dist/npm/BaseBarcode.js +181 -0
  62. package/dist/npm/BaseBarcodeProps.d.ts +41 -0
  63. package/dist/npm/BaseBarcodeProps.js +2 -0
  64. package/dist/npm/QRCode.d.ts +49 -0
  65. package/dist/npm/QRCode.js +151 -0
  66. package/dist/npm/QRCodeProps.d.ts +73 -0
  67. package/dist/npm/QRCodeProps.js +2 -0
  68. package/dist/npm/common/barcodes.d.ts +4 -0
  69. package/dist/npm/common/barcodes.js +2 -0
  70. package/dist/npm/main.d.ts +6 -0
  71. package/dist/npm/main.js +6 -0
  72. package/dist/npm/package-metadata.d.ts +5 -0
  73. package/dist/npm/package-metadata.js +13 -0
  74. package/dist/npm/store/reducer.d.ts +10 -0
  75. package/dist/npm/store/reducer.js +44 -0
  76. package/dist/npm/store/store.d.ts +25 -0
  77. package/dist/npm/store/store.js +30 -0
  78. package/dist/npm/types/barcode-text.d.ts +32 -0
  79. package/dist/npm/types/barcode-text.js +2 -0
  80. package/dist/npm/types/barcode-type.d.ts +4 -0
  81. package/dist/npm/types/barcode-type.js +2 -0
  82. package/dist/npm/types/border.interface.d.ts +18 -0
  83. package/dist/npm/types/border.interface.js +2 -0
  84. package/dist/npm/types/dash-type.interface.d.ts +4 -0
  85. package/dist/npm/types/dash-type.interface.js +2 -0
  86. package/dist/npm/types/margin.interface.d.ts +21 -0
  87. package/dist/npm/types/margin.interface.js +2 -0
  88. package/dist/npm/types/padding.interface.d.ts +21 -0
  89. package/dist/npm/types/padding.interface.js +2 -0
  90. package/dist/npm/types/qrcode-encoding.d.ts +4 -0
  91. package/dist/npm/types/qrcode-encoding.js +2 -0
  92. package/dist/npm/types/qrcode-error-correction.d.ts +9 -0
  93. package/dist/npm/types/qrcode-error-correction.js +2 -0
  94. package/dist/npm/types/qrcode-overlay.d.ts +25 -0
  95. package/dist/npm/types/qrcode-overlay.js +2 -0
  96. package/dist/npm/types/render-mode.d.ts +8 -0
  97. package/dist/npm/types/render-mode.js +2 -0
  98. package/dist/npm/types.d.ts +10 -0
  99. package/dist/npm/types.js +2 -0
  100. package/dist/npm/utils/common.d.ts +4 -0
  101. package/dist/npm/utils/common.js +41 -0
  102. package/dist/systemjs/kendo-react-barcodes.js +1 -0
  103. package/package.json +71 -0
@@ -0,0 +1,49 @@
1
+ import * as React from 'react';
2
+ import { BarcodeProps } from './BarcodeProps';
3
+ import { Surface } from '@progress/kendo-drawing';
4
+ import { Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
5
+ /**
6
+ * Represents the KendoReact Barcode component.
7
+ */
8
+ export declare class Barcode extends React.Component<BarcodeProps, {}> {
9
+ private _baseBarcode;
10
+ /**
11
+ * @hidden
12
+ */
13
+ readonly barcodeInstance: any;
14
+ /**
15
+ * The Drawing `Surface` of the Barcode.
16
+ */
17
+ readonly surface: Surface | null;
18
+ /**
19
+ * The DOM element of the Barcode.
20
+ */
21
+ readonly element: HTMLDivElement | null;
22
+ /**
23
+ * @hidden
24
+ */
25
+ render(): any;
26
+ /**
27
+ * Exports the component as an image. The export operation is asynchronous and returns a promise.
28
+ *
29
+ * @param {ImageExportOptions} options - The parameters for the exported image.
30
+ * @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
31
+ */
32
+ exportImage(options?: ImageExportOptions): Promise<string>;
33
+ /**
34
+ * Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
35
+ *
36
+ * @param options - The parameters for the exported file.
37
+ * @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
38
+ */
39
+ exportSVG(options?: SVGExportOptions): Promise<string>;
40
+ /**
41
+ * Exports a Barcode component as a Drawing `Scene`.
42
+ *
43
+ * @param {any} options - The parameters for the export operation.
44
+ * @returns {Group} - A promise that returns the root `Group` of the scene.
45
+ */
46
+ exportVisual(options?: any): Group;
47
+ private getTarget;
48
+ private deriveOptionsFromParent;
49
+ }
@@ -0,0 +1,146 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
31
+ t[p[i]] = s[p[i]];
32
+ return t;
33
+ };
34
+ import * as React from 'react';
35
+ import { BaseBarcode } from './BaseBarcode';
36
+ import { Barcode as KendoBarcode } from '@progress/kendo-charts';
37
+ import { exportImage, exportSVG, Group } from '@progress/kendo-drawing';
38
+ import { classNames } from '@progress/kendo-react-common';
39
+ /**
40
+ * Represents the KendoReact Barcode component.
41
+ */
42
+ var Barcode = /** @class */ (function (_super) {
43
+ __extends(Barcode, _super);
44
+ function Barcode() {
45
+ var _this = _super !== null && _super.apply(this, arguments) || this;
46
+ _this.getTarget = function () {
47
+ return _this;
48
+ };
49
+ _this.deriveOptionsFromParent = function (options) {
50
+ return Object.assign({}, options, {
51
+ background: _this.props.background,
52
+ border: _this.props.border,
53
+ checksum: _this.props.checksum,
54
+ color: _this.props.color,
55
+ height: _this.props.height,
56
+ padding: _this.props.padding,
57
+ text: _this.props.text,
58
+ type: _this.props.type,
59
+ value: _this.props.value,
60
+ width: _this.props.width
61
+ });
62
+ };
63
+ return _this;
64
+ }
65
+ Object.defineProperty(Barcode.prototype, "barcodeInstance", {
66
+ /**
67
+ * @hidden
68
+ */
69
+ get: function () {
70
+ if (this._baseBarcode !== null) {
71
+ return this._baseBarcode.barcodeInstance;
72
+ }
73
+ return null;
74
+ },
75
+ enumerable: true,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(Barcode.prototype, "surface", {
79
+ /**
80
+ * The Drawing `Surface` of the Barcode.
81
+ */
82
+ get: function () {
83
+ if (this._baseBarcode !== null) {
84
+ return this._baseBarcode.surface;
85
+ }
86
+ return null;
87
+ },
88
+ enumerable: true,
89
+ configurable: true
90
+ });
91
+ Object.defineProperty(Barcode.prototype, "element", {
92
+ /**
93
+ * The DOM element of the Barcode.
94
+ */
95
+ get: function () {
96
+ if (this._baseBarcode !== null) {
97
+ return this._baseBarcode.element;
98
+ }
99
+ return null;
100
+ },
101
+ enumerable: true,
102
+ configurable: true
103
+ });
104
+ /**
105
+ * @hidden
106
+ */
107
+ Barcode.prototype.render = function () {
108
+ var _this = this;
109
+ var _a = this.props, children = _a.children, className = _a.className, baseBarcodeProps = __rest(_a, ["children", "className"]);
110
+ return (React.createElement(BaseBarcode, __assign({}, baseBarcodeProps, { deriveOptionsFromParent: this.deriveOptionsFromParent, ref: function (baseBarcode) { return _this._baseBarcode = baseBarcode; }, barcodeConstructor: KendoBarcode, getTarget: this.getTarget, className: classNames('k-barcode', className) }), children));
111
+ };
112
+ /**
113
+ * Exports the component as an image. The export operation is asynchronous and returns a promise.
114
+ *
115
+ * @param {ImageExportOptions} options - The parameters for the exported image.
116
+ * @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
117
+ */
118
+ Barcode.prototype.exportImage = function (options) {
119
+ if (options === void 0) { options = {}; }
120
+ return exportImage(this.exportVisual(), options);
121
+ };
122
+ /**
123
+ * Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
124
+ *
125
+ * @param options - The parameters for the exported file.
126
+ * @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
127
+ */
128
+ Barcode.prototype.exportSVG = function (options) {
129
+ if (options === void 0) { options = {}; }
130
+ return exportSVG(this.exportVisual(), options);
131
+ };
132
+ /**
133
+ * Exports a Barcode component as a Drawing `Scene`.
134
+ *
135
+ * @param {any} options - The parameters for the export operation.
136
+ * @returns {Group} - A promise that returns the root `Group` of the scene.
137
+ */
138
+ Barcode.prototype.exportVisual = function (options) {
139
+ if (this.barcodeInstance !== null) {
140
+ return this.barcodeInstance.exportVisual(options);
141
+ }
142
+ return new Group();
143
+ };
144
+ return Barcode;
145
+ }(React.Component));
146
+ export { Barcode };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { Store } from './store/store';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export interface BarcodeContextType {
7
+ observersStore: Store;
8
+ }
9
+ /**
10
+ * @hidden
11
+ */
12
+ export declare const BarcodeContext: React.Context<BarcodeContextType>;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * @hidden
4
+ */
5
+ export var BarcodeContext = React.createContext(null);
6
+ BarcodeContext.displayName = 'BarcodeContext';
@@ -0,0 +1,61 @@
1
+ import { BaseBarcodeProps } from './BaseBarcodeProps';
2
+ import { BarcodeText, BarcodeType, Border, Padding } from './types';
3
+ /**
4
+ * Represents the props of the [KendoReact Barcode component]({% slug overview_barcode_barcodes %}).
5
+ */
6
+ export interface BarcodeProps extends BaseBarcodeProps {
7
+ /**
8
+ * The background color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
9
+ *
10
+ * @default "white"
11
+ */
12
+ background?: string;
13
+ /**
14
+ * The border of the Barcode.
15
+ */
16
+ border?: Border;
17
+ /**
18
+ * If set to `true`, the Barcode will display the checksum digit next to the value in the text area.
19
+ *
20
+ * @default false
21
+ */
22
+ checksum?: boolean;
23
+ /**
24
+ * The color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
25
+ *
26
+ * @default "black"
27
+ */
28
+ color?: string;
29
+ /**
30
+ * The height of the Barcode in pixels.
31
+ *
32
+ * The Barcode dimensions can also be set through regular CSS styling.
33
+ */
34
+ height?: number;
35
+ /**
36
+ * The padding of the Barcode. A numeric value sets all paddings.
37
+ *
38
+ * @default 0
39
+ */
40
+ padding?: Padding | number;
41
+ /**
42
+ * The Barcode text label configuration.
43
+ */
44
+ text?: BarcodeText;
45
+ /**
46
+ * The symbology (encoding) the Barcode will use.
47
+ *
48
+ * @default "Code39"
49
+ */
50
+ type: BarcodeType | string;
51
+ /**
52
+ * The value of the Barcode.
53
+ */
54
+ value: number | string;
55
+ /**
56
+ * The width of the Barcode in pixels.
57
+ *
58
+ * The Barcode dimensions can also be set through regular CSS styling.
59
+ */
60
+ width?: number;
61
+ }
File without changes
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import * as PropTypes from 'prop-types';
3
+ import { Surface } from '@progress/kendo-drawing';
4
+ import { BaseBarcodePrivateProps } from './BaseBarcodeProps';
5
+ import { BarcodeContextType } from './BarcodeContext';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export declare class BaseBarcode extends React.Component<BaseBarcodePrivateProps, {}> {
10
+ /**
11
+ * @hidden
12
+ */
13
+ static propTypes: {
14
+ dir: PropTypes.Requireable<string>;
15
+ renderAs: PropTypes.Requireable<string>;
16
+ };
17
+ /**
18
+ * @hidden
19
+ */
20
+ static defaultProps: {
21
+ renderAs: string;
22
+ };
23
+ /**
24
+ * @hidden
25
+ */
26
+ barcodeInstance: any | null;
27
+ /**
28
+ * @hidden
29
+ */
30
+ surface: Surface;
31
+ /**
32
+ * @hidden
33
+ */
34
+ readonly element: HTMLDivElement;
35
+ protected _element: HTMLDivElement | null;
36
+ protected contextValue: BarcodeContextType;
37
+ protected observersStore: any;
38
+ constructor(props: BaseBarcodePrivateProps);
39
+ /**
40
+ * @hidden
41
+ */
42
+ componentDidMount(): void;
43
+ /**
44
+ * @hidden
45
+ */
46
+ componentDidUpdate(prevProps: any): void;
47
+ /**
48
+ * @hidden
49
+ */
50
+ componentWillUnmount(): void;
51
+ /**
52
+ * @hidden
53
+ */
54
+ render(): any;
55
+ /**
56
+ * @hidden
57
+ */
58
+ instantiateCoreBarcode(): void;
59
+ /**
60
+ * @hidden
61
+ */
62
+ refresh(): void;
63
+ /**
64
+ * @hidden
65
+ */
66
+ getBarcodeOptions(): any;
67
+ /**
68
+ * @hidden
69
+ */
70
+ trigger(name: string, e: any): void;
71
+ /**
72
+ * @hidden
73
+ */
74
+ onWindowResize: () => void;
75
+ }
@@ -0,0 +1,179 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __rest = (this && this.__rest) || function (s, e) {
15
+ var t = {};
16
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
+ t[p] = s[p];
18
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
20
+ t[p[i]] = s[p[i]];
21
+ return t;
22
+ };
23
+ import * as React from 'react';
24
+ import * as PropTypes from 'prop-types';
25
+ import createStore from './store/store';
26
+ import { observersReducer } from './store/reducer';
27
+ import { isOptionsChanged } from './utils/common';
28
+ import { BarcodeContext } from './BarcodeContext';
29
+ import { validatePackage } from '@progress/kendo-react-common';
30
+ import { packageMetadata } from './package-metadata';
31
+ /**
32
+ * @hidden
33
+ */
34
+ var BaseBarcode = /** @class */ (function (_super) {
35
+ __extends(BaseBarcode, _super);
36
+ function BaseBarcode(props) {
37
+ var _this = _super.call(this, props) || this;
38
+ /**
39
+ * @hidden
40
+ */
41
+ _this.barcodeInstance = null;
42
+ _this._element = null;
43
+ _this.observersStore = {};
44
+ /* DOM event handlers */
45
+ /**
46
+ * @hidden
47
+ */
48
+ _this.onWindowResize = function () {
49
+ if (_this.barcodeInstance !== null) {
50
+ _this.barcodeInstance.redraw();
51
+ _this.trigger('render', { sender: _this });
52
+ }
53
+ };
54
+ validatePackage(packageMetadata);
55
+ _this.observersStore = createStore(observersReducer);
56
+ _this.contextValue = {
57
+ observersStore: _this.observersStore
58
+ };
59
+ return _this;
60
+ }
61
+ Object.defineProperty(BaseBarcode.prototype, "element", {
62
+ /**
63
+ * @hidden
64
+ */
65
+ get: function () {
66
+ return this._element;
67
+ },
68
+ enumerable: true,
69
+ configurable: true
70
+ });
71
+ /**
72
+ * @hidden
73
+ */
74
+ BaseBarcode.prototype.componentDidMount = function () {
75
+ this.instantiateCoreBarcode();
76
+ window.addEventListener('resize', this.onWindowResize);
77
+ this.trigger('render', { sender: this });
78
+ };
79
+ /**
80
+ * @hidden
81
+ */
82
+ BaseBarcode.prototype.componentDidUpdate = function (prevProps) {
83
+ var _a = this.props, children = _a.children, deriveOptionsFromParent = _a.deriveOptionsFromParent, getTarget = _a.getTarget, barcodeConstructor = _a.barcodeConstructor, className = _a.className, renderAs = _a.renderAs, currentOthers = __rest(_a, ["children", "deriveOptionsFromParent", "getTarget", "barcodeConstructor", "className", "renderAs"]);
84
+ var prevChildren = prevProps.children, prevDeriveOptionsFromParent = prevProps.deriveOptionsFromParent, prevGetTarget = prevProps.getTarget, prevBarcodeConstructor = prevProps.barcodeConstructor, prevClassName = prevProps.className, prevRenderAs = prevProps.renderAs, prevOthers = __rest(prevProps, ["children", "deriveOptionsFromParent", "getTarget", "barcodeConstructor", "className", "renderAs"]);
85
+ if (this.barcodeInstance !== null) {
86
+ var optionsChanged = isOptionsChanged(prevOthers, currentOthers);
87
+ if ((renderAs || 'svg') !== (prevRenderAs || 'svg')) {
88
+ if (this.barcodeInstance !== null) {
89
+ this.barcodeInstance.destroy();
90
+ this.barcodeInstance = null;
91
+ }
92
+ this.instantiateCoreBarcode();
93
+ }
94
+ else if (optionsChanged) {
95
+ this.refresh();
96
+ }
97
+ this.trigger('render', { sender: this });
98
+ }
99
+ };
100
+ /**
101
+ * @hidden
102
+ */
103
+ BaseBarcode.prototype.componentWillUnmount = function () {
104
+ if (this.barcodeInstance !== null) {
105
+ this.barcodeInstance.destroy();
106
+ this.barcodeInstance = null;
107
+ }
108
+ window.removeEventListener('resize', this.onWindowResize);
109
+ };
110
+ /**
111
+ * @hidden
112
+ */
113
+ BaseBarcode.prototype.render = function () {
114
+ var _this = this;
115
+ var _a = this.props, _b = _a.style, style = _b === void 0 ? {} : _b, className = _a.className, children = _a.children;
116
+ return (React.createElement(BarcodeContext.Provider, { value: this.contextValue },
117
+ React.createElement("div", { style: style, ref: function (el) { return _this._element = el; }, className: className }, children)));
118
+ };
119
+ /**
120
+ * @hidden
121
+ */
122
+ BaseBarcode.prototype.instantiateCoreBarcode = function () {
123
+ var barcodeConstructor = this.props.barcodeConstructor;
124
+ var barcodeOptions = this.getBarcodeOptions();
125
+ this.barcodeInstance = new barcodeConstructor(this.element, barcodeOptions, function (error) {
126
+ if (process.env.NODE_ENV !== 'production') {
127
+ throw error;
128
+ }
129
+ else {
130
+ console.warn(error);
131
+ }
132
+ });
133
+ };
134
+ /**
135
+ * @hidden
136
+ */
137
+ BaseBarcode.prototype.refresh = function () {
138
+ if (this.barcodeInstance !== null) {
139
+ var barcodeOptions = this.getBarcodeOptions();
140
+ this.barcodeInstance.setOptions(barcodeOptions);
141
+ }
142
+ };
143
+ /**
144
+ * @hidden
145
+ */
146
+ BaseBarcode.prototype.getBarcodeOptions = function () {
147
+ var _a = this.props, renderAs = _a.renderAs, deriveOptionsFromParent = _a.deriveOptionsFromParent;
148
+ var barcodeOptions = { renderAs: renderAs };
149
+ if (deriveOptionsFromParent) {
150
+ // Add options from parent - required by TS
151
+ barcodeOptions = deriveOptionsFromParent(barcodeOptions);
152
+ }
153
+ return barcodeOptions;
154
+ };
155
+ /**
156
+ * @hidden
157
+ */
158
+ BaseBarcode.prototype.trigger = function (name, e) {
159
+ var observers = this.observersStore.getState();
160
+ for (var idx = 0; idx < observers.length; idx++) {
161
+ observers[idx].trigger(name, e);
162
+ }
163
+ };
164
+ /**
165
+ * @hidden
166
+ */
167
+ BaseBarcode.propTypes = {
168
+ dir: PropTypes.string,
169
+ renderAs: PropTypes.oneOf(['svg', 'canvas'])
170
+ };
171
+ /**
172
+ * @hidden
173
+ */
174
+ BaseBarcode.defaultProps = {
175
+ renderAs: 'svg'
176
+ };
177
+ return BaseBarcode;
178
+ }(React.Component));
179
+ export { BaseBarcode };
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ import { Barcodes } from './common/barcodes';
3
+ import { RenderMode } from './types';
4
+ /**
5
+ * @hidden
6
+ */
7
+ export interface BaseBarcodePrivateProps extends BaseBarcodeProps {
8
+ /**
9
+ * @hidden
10
+ */
11
+ deriveOptionsFromParent?: (options: any) => any;
12
+ /**
13
+ * @hidden
14
+ */
15
+ barcodeConstructor: any;
16
+ /**
17
+ * @hidden
18
+ */
19
+ getTarget: () => Barcodes;
20
+ }
21
+ /**
22
+ * @hidden
23
+ */
24
+ export interface BaseBarcodeProps {
25
+ /**
26
+ * The styles that are applied to the component.
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * Sets additional CSS classes to the component.
31
+ */
32
+ className?: string;
33
+ /**
34
+ * Sets the preferred rendering engine.
35
+ *
36
+ * The supported values are:
37
+ * - `"svg"`&mdash;If available, renders the component as an inline `svg` element.
38
+ * - `"canvas"`&mdash;If available, renders the component as a `canvas` element.
39
+ */
40
+ renderAs?: RenderMode;
41
+ }
File without changes
@@ -0,0 +1,49 @@
1
+ import * as React from 'react';
2
+ import { QRCodeProps } from './QRCodeProps';
3
+ import { Surface } from '@progress/kendo-drawing';
4
+ import { Group, ImageExportOptions, SVGExportOptions } from '@progress/kendo-drawing';
5
+ /**
6
+ * Represents the KendoReact QRCode component.
7
+ */
8
+ export declare class QRCode extends React.Component<QRCodeProps, {}> {
9
+ private _baseBarcode;
10
+ /**
11
+ * @hidden
12
+ */
13
+ readonly barcodeInstance: any;
14
+ /**
15
+ * The Drawing `Surface` of the Barcode.
16
+ */
17
+ readonly surface: Surface | null;
18
+ /**
19
+ * The DOM element of the Barcode.
20
+ */
21
+ readonly element: HTMLDivElement | null;
22
+ /**
23
+ * @hidden
24
+ */
25
+ render(): any;
26
+ /**
27
+ * Exports the component as an image. The export operation is asynchronous and returns a promise.
28
+ *
29
+ * @param {ImageExportOptions} options - The parameters for the exported image.
30
+ * @returns {Promise<string>} - A promise that will be resolved with a PNG image encoded as a Data URI.
31
+ */
32
+ exportImage(options?: ImageExportOptions): Promise<string>;
33
+ /**
34
+ * Exports the component as an SVG document. The export operation is asynchronous and returns a promise.
35
+ *
36
+ * @param options - The parameters for the exported file.
37
+ * @returns - A promise that will be resolved with an SVG document that is encoded as a Data URI.
38
+ */
39
+ exportSVG(options?: SVGExportOptions): Promise<string>;
40
+ /**
41
+ * Exports a Barcode component as a Drawing `Scene`.
42
+ *
43
+ * @param {any} options - The parameters for the export operation.
44
+ * @returns {Group} - A promise that returns the root `Group` of the scene.
45
+ */
46
+ exportVisual(options?: any): Group;
47
+ private getTarget;
48
+ private deriveOptionsFromParent;
49
+ }