feat: Add QR code size setting for fixed-size QR codes
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -128,6 +128,8 @@
|
|||||||
"qrCodePaddingTooltip": "White space around the QR code for better scanning reliability",
|
"qrCodePaddingTooltip": "White space around the QR code for better scanning reliability",
|
||||||
"qrCodeMaxWidth": "QR Code Max Width",
|
"qrCodeMaxWidth": "QR Code Max Width",
|
||||||
"qrCodeMaxWidthTooltip": "Maximum width of QR code as percentage of label. Set to 0 for automatic sizing.",
|
"qrCodeMaxWidthTooltip": "Maximum width of QR code as percentage of label. Set to 0 for automatic sizing.",
|
||||||
|
"qrCodeSize": "QR Code Size",
|
||||||
|
"qrCodeSizeTooltip": "Fixed size of QR code in millimeters. Set to 0 for automatic sizing based on label.",
|
||||||
"auto": "Auto"
|
"auto": "Auto"
|
||||||
},
|
},
|
||||||
"spoolSelect": {
|
"spoolSelect": {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export interface QRCodePrintSettings {
|
|||||||
textSize?: number;
|
textSize?: number;
|
||||||
qrCodePadding?: number; // in mm, default 2
|
qrCodePadding?: number; // in mm, default 2
|
||||||
qrCodeMaxWidth?: number; // percentage 0-100, 0 = no constraint (auto)
|
qrCodeMaxWidth?: number; // percentage 0-100, 0 = no constraint (auto)
|
||||||
|
qrCodeSize?: number; // in mm, 0 = auto
|
||||||
printSettings: PrintSettings;
|
printSettings: PrintSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
|||||||
const textSize = printSettings?.textSize || 3;
|
const textSize = printSettings?.textSize || 3;
|
||||||
const qrCodePadding = printSettings?.qrCodePadding ?? 2;
|
const qrCodePadding = printSettings?.qrCodePadding ?? 2;
|
||||||
const qrCodeMaxWidth = printSettings?.qrCodeMaxWidth ?? 0; // 0 = auto (no constraint)
|
const qrCodeMaxWidth = printSettings?.qrCodeMaxWidth ?? 0; // 0 = auto (no constraint)
|
||||||
|
const qrCodeSize = printSettings?.qrCodeSize ?? 0; // 0 = auto
|
||||||
|
|
||||||
const elements = items.map((item) => {
|
const elements = items.map((item) => {
|
||||||
return (
|
return (
|
||||||
@@ -224,6 +225,40 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label={t("printing.qrcode.qrCodeSize")} tooltip={t("printing.qrcode.qrCodeSizeTooltip")}>
|
||||||
|
<Row>
|
||||||
|
<Col span={12}>
|
||||||
|
<Slider
|
||||||
|
disabled={showQRCodeMode === "no"}
|
||||||
|
tooltip={{ formatter: (value) => (value === 0 ? t("printing.qrcode.auto") : `${value} mm`) }}
|
||||||
|
min={0}
|
||||||
|
max={50}
|
||||||
|
value={qrCodeSize}
|
||||||
|
step={1}
|
||||||
|
onChange={(value) => {
|
||||||
|
printSettings.qrCodeSize = value;
|
||||||
|
setPrintSettings(printSettings);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<InputNumber
|
||||||
|
disabled={showQRCodeMode === "no"}
|
||||||
|
min={0}
|
||||||
|
max={100}
|
||||||
|
step={1}
|
||||||
|
style={{ margin: "0 16px" }}
|
||||||
|
value={qrCodeSize}
|
||||||
|
addonAfter="mm"
|
||||||
|
placeholder={t("printing.qrcode.auto")}
|
||||||
|
onChange={(value) => {
|
||||||
|
printSettings.qrCodeSize = value ?? 0;
|
||||||
|
setPrintSettings(printSettings);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
{extraSettings}
|
{extraSettings}
|
||||||
</>
|
</>
|
||||||
@@ -243,8 +278,8 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.print-page .print-qrcode {
|
.print-page .print-qrcode {
|
||||||
width: auto !important;
|
width: ${qrCodeSize > 0 ? `${qrCodeSize}mm` : "auto"} !important;
|
||||||
height: auto !important;
|
height: ${qrCodeSize > 0 ? `${qrCodeSize}mm` : "auto"} !important;
|
||||||
padding: ${qrCodePadding}mm;
|
padding: ${qrCodePadding}mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user