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