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:
@@ -24,6 +24,7 @@ export interface QRCodePrintSettings {
|
||||
textSize?: number;
|
||||
qrCodePadding?: number; // in mm, default 2
|
||||
qrCodeMaxWidth?: number; // percentage 0-100, 0 = no constraint (auto)
|
||||
qrCodeSize?: number; // in mm, 0 = auto
|
||||
printSettings: PrintSettings;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
||||
const textSize = printSettings?.textSize || 3;
|
||||
const qrCodePadding = printSettings?.qrCodePadding ?? 2;
|
||||
const qrCodeMaxWidth = printSettings?.qrCodeMaxWidth ?? 0; // 0 = auto (no constraint)
|
||||
const qrCodeSize = printSettings?.qrCodeSize ?? 0; // 0 = auto
|
||||
|
||||
const elements = items.map((item) => {
|
||||
return (
|
||||
@@ -224,6 +225,40 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
||||
</Col>
|
||||
</Row>
|
||||
</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}
|
||||
</>
|
||||
@@ -243,8 +278,8 @@ const QRCodePrintingDialog: React.FC<QRCodePrintingDialogProps> = ({
|
||||
}
|
||||
|
||||
.print-page .print-qrcode {
|
||||
width: auto !important;
|
||||
height: auto !important;
|
||||
width: ${qrCodeSize > 0 ? `${qrCodeSize}mm` : "auto"} !important;
|
||||
height: ${qrCodeSize > 0 ? `${qrCodeSize}mm` : "auto"} !important;
|
||||
padding: ${qrCodePadding}mm;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user