react-jsbarcode 0.2.3 → 0.2.4
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/Readme.md +10 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +6 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6 -26
- package/lib/index.js.map +1 -1
- package/package.json +14 -14
- package/CHANGELOG.md +0 -54
package/lib/index.js
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
function _interopNamespace(e) {
|
|
7
|
-
if (e && e.__esModule) return e;
|
|
8
|
-
var n = Object.create(null);
|
|
9
|
-
if (e) {
|
|
10
|
-
Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default') {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
n["default"] = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
4
|
+
var react = require('react');
|
|
25
5
|
|
|
26
6
|
var barcodes = {};
|
|
27
7
|
|
|
@@ -3354,17 +3334,17 @@ if (typeof jQuery !== 'undefined') {
|
|
|
3354
3334
|
var JsBarcode_1 = JsBarcode;
|
|
3355
3335
|
|
|
3356
3336
|
const ReactBarcode = ({ style, className, value, options, renderer = "svg" }) => {
|
|
3357
|
-
const containerRef =
|
|
3358
|
-
|
|
3337
|
+
const containerRef = react.useRef(null);
|
|
3338
|
+
react.useEffect(() => {
|
|
3359
3339
|
JsBarcode_1(containerRef.current, value, options);
|
|
3360
3340
|
}, [value, options, renderer]);
|
|
3361
3341
|
switch (renderer) {
|
|
3362
3342
|
case 'canvas':
|
|
3363
|
-
return jsxRuntime.jsx("canvas", { ref: containerRef, style: style, className: className }
|
|
3343
|
+
return jsxRuntime.jsx("canvas", { ref: containerRef, style: style, className: className });
|
|
3364
3344
|
case 'image':
|
|
3365
|
-
return jsxRuntime.jsx("img", { ref: containerRef, alt: "barcode", style: style, className: className }
|
|
3345
|
+
return jsxRuntime.jsx("img", { ref: containerRef, alt: "barcode", style: style, className: className });
|
|
3366
3346
|
default:
|
|
3367
|
-
return jsxRuntime.jsx("svg", { ref: containerRef, style: style, className: className }
|
|
3347
|
+
return jsxRuntime.jsx("svg", { ref: containerRef, style: style, className: className });
|
|
3368
3348
|
}
|
|
3369
3349
|
};
|
|
3370
3350
|
|