diff --git a/angular.json b/angular.json index b7b4e35..7959e09 100644 --- a/angular.json +++ b/angular.json @@ -21,6 +21,7 @@ "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/demo", + "preserveSymlinks": true, "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", diff --git a/package-lock.json b/package-lock.json index e36d6ce..43b0bc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ngx-kjua-library", - "version": "18.0.0", + "version": "18.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ngx-kjua-library", - "version": "18.0.0", + "version": "18.1.1", "license": "MIT", "dependencies": { "@angular/common": "^18.0.0", diff --git a/projects/ngx-kjua/src/lib/kjua/lib/qrcode.ts b/projects/ngx-kjua/src/lib/kjua/lib/qrcode.ts index 9a4ea59..8c585a3 100644 --- a/projects/ngx-kjua/src/lib/kjua/lib/qrcode.ts +++ b/projects/ngx-kjua/src/lib/kjua/lib/qrcode.ts @@ -1,14 +1,18 @@ const RE_CODE_LENGTH_OVERFLOW = /code length overflow/i; -import * as qr_gen from "qrcode-generator"; -(qr_gen as any).stringToBytes = qr_gen.stringToBytesFuncs["UTF-8"]; +import qrcode from "qrcode-generator"; +qrcode.stringToBytes = qrcode.stringToBytesFuncs["UTF-8"]; -const min_qrcode = (text: any, level: any, min_ver: number = 1) => { - min_ver = Math.max(1, min_ver); +const min_qrcode = ( + text: string, + level: ErrorCorrectionLevel, + min_ver: TypeNumber = 1 +) => { + min_ver = Math.max(1, min_ver) as TypeNumber; for (let version = min_ver; version <= 40; version += 1) { try { - const qr = (qr_gen as any)(version, level); + const qr = qrcode(version, level); qr.addData(text); qr.make(); const module_count = qr.getModuleCount(); @@ -33,8 +37,8 @@ const min_qrcode = (text: any, level: any, min_ver: number = 1) => { export const quiet_qrcode = ( text = "", - level = "L", - min_ver = 1, + level: ErrorCorrectionLevel = "L", + min_ver: TypeNumber = 1, quiet = 0 ) => { const qr = min_qrcode(text, level, min_ver);