Hides unused label layouts in a less janky way.

This commit is contained in:
Aaron Louie 2020-12-16 14:01:27 -05:00
parent 218c8a138c
commit 3e7cdb9fa2
4 changed files with 30 additions and 25 deletions

View File

@ -18,29 +18,32 @@ export const labelLayouts = {
pageWidth: 64,
pageHeight: 32,
}),
// rectangle_3x1_code128: new LabelLayout({
// name: '3in x 1in Rectangular Label - CODE128',
// barcodeType: 'code128',
// id: 'rectangle_3x1_code128',
// pageWidth: 76.2 + labelMargin,
// pageHeight: 25.4 + labelMargin,
// delimiter: '',
// }),
// rectangle_code128: new LabelLayout({
// name: '2.75in x 1.25in Rectangular Label - CODE128',
// barcodeType: 'code128',
// id: 'rectangle_code128',
// pageWidth: 69.9 + labelMargin,
// pageHeight: 31.8 + labelMargin,
// delimiter: '',
// }),
// rectangle_datamatrix: new LabelLayout({
// name: '2in x 1in Rectangular Label - DataMatrix',
// barcodeType: 'datamatrix',
// id: 'rectangle_datamatrix',
// pageWidth: 50.8 + labelMargin,
// pageHeight: 25.4 + labelMargin,
// }),
rectangle_3x1_code128: new LabelLayout({
name: '3in x 1in Rectangular Label - CODE128',
barcodeType: 'code128',
id: 'rectangle_3x1_code128',
pageWidth: 76.2 + labelMargin,
pageHeight: 25.4 + labelMargin,
delimiter: '',
hide: true,
}),
rectangle_code128: new LabelLayout({
name: '2.75in x 1.25in Rectangular Label - CODE128',
barcodeType: 'code128',
id: 'rectangle_code128',
pageWidth: 69.9 + labelMargin,
pageHeight: 31.8 + labelMargin,
delimiter: '',
hide: true,
}),
rectangle_datamatrix: new LabelLayout({
name: '2in x 1in Rectangular Label - DataMatrix',
barcodeType: 'datamatrix',
id: 'rectangle_datamatrix',
pageWidth: 50.8 + labelMargin,
pageHeight: 25.4 + labelMargin,
hide: true,
}),
rectangle_datamatrixrectangular: new LabelLayout({
name: '2in x 1in Rectangular Label - DataMatrix Rectangular',
barcodeType: 'datamatrixrectangular',

View File

@ -8,6 +8,7 @@ export interface LayoutOptions {
numCols?: number;
numCopies?: number;
delimiter?: string;
hide?: boolean;
}
export class LabelLayout {
@ -20,6 +21,7 @@ export class LabelLayout {
numCols = 1;
numCopies = 1;
delimiter = '-';
hide = false;
constructor(private options: LayoutOptions) {
if (options) {

View File

@ -28,7 +28,7 @@
#labelLayoutSelect="matSelect"
[formControl]="labelLayoutFormControl"
>
<mat-select-trigger [ngClass]="'selected-label-layout'">{{selectedLabelLayout.name}}</mat-select-trigger>
<mat-select-trigger [ngClass]="'selected-label-layout'">{{selectedLabelLayout?.name}}</mat-select-trigger>
<mat-option
*ngFor="let layout of allLabelLayouts"
[value]="layout.id"

View File

@ -45,7 +45,7 @@ export class SettingsComponent implements AfterViewInit {
Validators.pattern(this.settings.locationIdRegExp),
]);
this.allLabelLayouts = Object.values(labelLayouts);
this.allLabelLayouts = Object.values(labelLayouts).filter(layout => !layout.hide);
this._loadFakeData();
}