react-barcode
Advanced tools
Comparing version 1.4.6 to 1.5.0
@@ -0,4 +1,7 @@ | ||
import React from "react"; | ||
export interface Options { | ||
width?: number; | ||
height?: number; | ||
renderer?: "canvas" | "img" | "svg"; | ||
format?: | ||
@@ -9,2 +12,3 @@ | "CODE39" | ||
| "ITF14" | ||
| "ITF" | ||
| "MSI" | ||
@@ -34,3 +38,5 @@ | "pharmacode" | ||
export default class Barcode extends React.Component<BarcodeProps> {} | ||
export default class Barcode extends React.Component<BarcodeProps> { | ||
renderElementRef: React.RefObject<HTMLCanvasElement | SVGElement | HTMLImageElement>; | ||
} | ||
"use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -11,4 +13,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -95,13 +95,23 @@ | ||
value: function render() { | ||
var _this$props = this.props, | ||
id = _this$props.id, | ||
className = _this$props.className; | ||
if (this.props.renderer === 'svg') { | ||
return _react["default"].createElement("svg", { | ||
ref: this.renderElementRef | ||
ref: this.renderElementRef, | ||
id: id, | ||
className: className | ||
}); | ||
} else if (this.props.renderer === 'canvas') { | ||
return _react["default"].createElement("canvas", { | ||
ref: this.renderElementRef | ||
ref: this.renderElementRef, | ||
id: id, | ||
className: className | ||
}); | ||
} else if (this.props.renderer === 'img') { | ||
return _react["default"].createElement("img", { | ||
ref: this.renderElementRef | ||
ref: this.renderElementRef, | ||
id: id, | ||
className: className | ||
}); | ||
@@ -134,3 +144,5 @@ } | ||
marginLeft: _propTypes["default"].number, | ||
marginRight: _propTypes["default"].number | ||
marginRight: _propTypes["default"].number, | ||
id: _propTypes["default"].string, | ||
className: _propTypes["default"].string | ||
}; | ||
@@ -151,4 +163,5 @@ Barcode.defaultProps = { | ||
lineColor: '#000000', | ||
margin: 10 | ||
margin: 10, | ||
className: '' | ||
}; | ||
module.exports = Barcode; |
{ | ||
"name": "react-barcode", | ||
"version": "1.4.6", | ||
"version": "1.5.0", | ||
"description": "React component to generate barcodes", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# react-barcode | ||
<img src="https://raw.githubusercontent.com/kciter/react-barcode/master/images/barcode.png" alt="barcode" width="600"><br> | ||
@@ -56,3 +57,5 @@ Preview: http://kciter.github.io/react-barcode/ | ||
marginLeft: undefined, | ||
marginRight: undefined | ||
marginRight: undefined, | ||
id: undefined, | ||
className: undefined | ||
} | ||
@@ -59,0 +62,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11217
175
86