- LabelTemplate bekommt columns/rows (optional, leer = automatisch passend), plus konfigurierbare Raender/Abstaende - damit ein Etikett exakt auf das vorgedruckte Raster eines physischen Etikettenbogens (z.B. Avery) gelegt werden kann statt nur automatisch berechnet - Startposition beim Drucken waehlbar, fuer bereits angebrochene Boegen (erste Seite startet ab der gewaehlten Position, Folgeseiten wieder von vorne)
86 lines
1.5 KiB
TypeScript
86 lines
1.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
ArrayMaxSize,
|
|
IsArray,
|
|
IsBoolean,
|
|
IsInt,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { LabelElementDto } from './label-element.dto';
|
|
|
|
export class CreateLabelTemplateDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
name!: string;
|
|
|
|
@ApiProperty({ type: [LabelElementDto] })
|
|
@IsArray()
|
|
@ArrayMaxSize(50)
|
|
@ValidateNested({ each: true })
|
|
@Type(() => LabelElementDto)
|
|
elements!: LabelElementDto[];
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(10)
|
|
widthMm?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(10)
|
|
heightMm?: number;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Spalten pro A4-Bogen. Leer = automatisch so viele wie passen.',
|
|
})
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
columns?: number;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Zeilen pro A4-Bogen. Leer = automatisch so viele wie passen.',
|
|
})
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
rows?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
marginTopMm?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
marginLeftMm?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
gapXMm?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
gapYMm?: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isDefault?: boolean;
|
|
}
|