Browse Source

qr scanner - WIP - adapt qr code generator options so they are recognized by the scanner

pull/4898/head
Daniel Spaude 2 years ago
parent
commit
5171605a8c
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 15
      packages/nc-gui/components/virtual-cell/QrCode.vue
  2. 19
      packages/nc-gui/package-lock.json
  3. 1
      packages/nc-gui/package.json

15
packages/nc-gui/components/virtual-cell/QrCode.vue

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useQRCode } from '@vueuse/integrations/useQRCode' import { useQRCode } from '@vueuse/integrations/useQRCode'
import type QRCode from 'qrcode'
const maxNumberOfAllowedCharsForQrValue = 2000 const maxNumberOfAllowedCharsForQrValue = 2000
@ -11,11 +12,25 @@ const tooManyCharsForQrCode = computed(() => qrValue?.value.length > maxNumberOf
const showQrCode = computed(() => qrValue?.value?.length > 0 && !tooManyCharsForQrCode.value) const showQrCode = computed(() => qrValue?.value?.length > 0 && !tooManyCharsForQrCode.value)
const qrCodeOptions: QRCode.QRCodeToDataURLOptions = {
errorCorrectionLevel: 'M',
// type: 'image/png',
// quality: 0.92,
margin: 1,
version: 4,
rendererOpts: {
quality: 1,
},
}
console.log(qrCodeOptions)
const qrCode = useQRCode(qrValue, { const qrCode = useQRCode(qrValue, {
...qrCodeOptions,
width: 150, width: 150,
}) })
const qrCodeLarge = useQRCode(qrValue, { const qrCodeLarge = useQRCode(qrValue, {
...qrCodeOptions,
width: 600, width: 600,
}) })

19
packages/nc-gui/package-lock.json generated

@ -70,6 +70,7 @@
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/dagre": "^0.7.48", "@types/dagre": "^0.7.48",
"@types/papaparse": "^5.3.2", "@types/papaparse": "^5.3.2",
"@types/qrcode": "^1.5.0",
"@types/sortablejs": "^1.13.0", "@types/sortablejs": "^1.13.0",
"@types/tinycolor2": "^1.4.3", "@types/tinycolor2": "^1.4.3",
"@types/validator": "^13.7.10", "@types/validator": "^13.7.10",
@ -3154,6 +3155,15 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/qrcode": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.0.tgz",
"integrity": "sha512-x5ilHXRxUPIMfjtM+1vf/GPTRWZ81nqscursm5gMznJeK9M0YnZ1c3bEvRLQ0zSSgedLx1J6MGL231ObQGGhaA==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/qs": { "node_modules/@types/qs": {
"version": "6.9.7", "version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
@ -20247,6 +20257,15 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/qrcode": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.0.tgz",
"integrity": "sha512-x5ilHXRxUPIMfjtM+1vf/GPTRWZ81nqscursm5gMznJeK9M0YnZ1c3bEvRLQ0zSSgedLx1J6MGL231ObQGGhaA==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/qs": { "@types/qs": {
"version": "6.9.7", "version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",

1
packages/nc-gui/package.json

@ -93,6 +93,7 @@
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/dagre": "^0.7.48", "@types/dagre": "^0.7.48",
"@types/papaparse": "^5.3.2", "@types/papaparse": "^5.3.2",
"@types/qrcode": "^1.5.0",
"@types/sortablejs": "^1.13.0", "@types/sortablejs": "^1.13.0",
"@types/tinycolor2": "^1.4.3", "@types/tinycolor2": "^1.4.3",
"@types/validator": "^13.7.10", "@types/validator": "^13.7.10",

Loading…
Cancel
Save