xl-public-utils 1.0.21 → 1.0.22

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/qrcode.js +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xl-public-utils",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
package/src/qrcode.js CHANGED
@@ -43,8 +43,8 @@ export function generateQRCodeWithText(content, options = {}) {
43
43
  textLeftMargin = 20,
44
44
  fontWeight = 700,
45
45
  textColor = '#000',
46
- eclevel = 'M',
47
- version = 1,
46
+ eclevel,
47
+ version,
48
48
  textContent
49
49
  } = options
50
50
  /**
@@ -77,6 +77,9 @@ export function generateQRCodeWithText(content, options = {}) {
77
77
  const tempCanvas = document.createElement('canvas');
78
78
  tempCanvas.width = qrcodeW;
79
79
  tempCanvas.height = qrcodeH;
80
+ const otherOpts = {};
81
+ if(eclevel) otherOpts['eclevel'] = eclevel;
82
+ if(version) otherOpts['version'] = version;
80
83
  try {
81
84
  generFunc(tempCanvas, {
82
85
  bcid: bcid, // Barcode type
@@ -85,8 +88,7 @@ export function generateQRCodeWithText(content, options = {}) {
85
88
  width: qrcodeW, // QR code width
86
89
  height: qrcodeH, // QR code height
87
90
  includetext: false, // Do not include text below QR code
88
- eclevel,
89
- version
91
+ ...otherOpts
90
92
  });
91
93
  // Draw the QR code on the left (300x300), centered vertically at (0, 21)
92
94
  ctx.drawImage(tempCanvas, left, top, qrcodeW, qrcodeH);